This commit is contained in:
13
node_modules/@react-dnd/asap/.swcrc
generated
vendored
Normal file
13
node_modules/@react-dnd/asap/.swcrc
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"sourceMaps": true,
|
||||
"jsc": {
|
||||
"target": "es2017",
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true
|
||||
},
|
||||
"transform": {
|
||||
"react": { "runtime": "automatic", "useBuiltins": true }
|
||||
}
|
||||
}
|
||||
}
|
||||
68
node_modules/@react-dnd/asap/CHANGES.md
generated
vendored
Normal file
68
node_modules/@react-dnd/asap/CHANGES.md
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
## 2.0.6
|
||||
|
||||
Version 2.0.4 adds support for React Native by clarifying in package.json that
|
||||
the browser environment does not support Node.js domains.
|
||||
Why this is necessary, we leave as an exercise for the user.
|
||||
|
||||
## 2.0.3
|
||||
|
||||
Version 2.0.3 fixes a bug when adjusting the capacity of the task queue.
|
||||
|
||||
## 2.0.1-2.02
|
||||
|
||||
Version 2.0.1 fixes a bug in the way redirects were expressed that affected the
|
||||
function of Browserify, but which Mr would tolerate.
|
||||
|
||||
## 2.0.0
|
||||
|
||||
Version 2 of ASAP is a full rewrite with a few salient changes.
|
||||
First, the ASAP source is CommonJS only and designed with [Browserify][] and
|
||||
[Browserify-compatible][mr] module loaders in mind.
|
||||
|
||||
[browserify]: https://github.com/substack/node-browserify
|
||||
[mr]: https://github.com/montagejs/mr
|
||||
|
||||
The new version has been refactored in two dimensions.
|
||||
Support for Node.js and browsers have been separated, using Browserify
|
||||
redirects and ASAP has been divided into two modules.
|
||||
The "raw" layer depends on the tasks to catch thrown exceptions and unravel
|
||||
Node.js domains.
|
||||
|
||||
The full implementation of ASAP is loadable as `require("asap")` in both Node.js
|
||||
and browsers.
|
||||
|
||||
The raw layer that lacks exception handling overhead is loadable as
|
||||
`require("asap/raw")`.
|
||||
The interface is the same for both layers.
|
||||
|
||||
Tasks are no longer required to be functions, but can rather be any object that
|
||||
implements `task.call()`.
|
||||
With this feature you can recycle task objects to avoid garbage collector churn
|
||||
and avoid closures in general.
|
||||
|
||||
The implementation has been rigorously documented so that our successors can
|
||||
understand the scope of the problem that this module solves and all of its
|
||||
nuances, ensuring that the next generation of implementations know what details
|
||||
are essential.
|
||||
|
||||
- [asap.js](https://github.com/kriskowal/asap/blob/master/asap.js)
|
||||
- [raw.js](https://github.com/kriskowal/asap/blob/master/raw.js)
|
||||
- [browser-asap.js](https://github.com/kriskowal/asap/blob/master/browser-asap.js)
|
||||
- [browser-raw.js](https://github.com/kriskowal/asap/blob/master/browser-raw.js)
|
||||
|
||||
The new version has also been rigorously tested across a broad spectrum of
|
||||
browsers, in both the window and worker context.
|
||||
The following charts capture the browser test results for the most recent
|
||||
release.
|
||||
The first chart shows test results for ASAP running in the main window context.
|
||||
The second chart shows test results for ASAP running in a web worker context.
|
||||
Test results are inconclusive (grey) on browsers that do not support web
|
||||
workers.
|
||||
These data are captured automatically by [Continuous
|
||||
Integration][].
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
[continuous integration]: https://github.com/kriskowal/asap/blob/master/CONTRIBUTING.md
|
||||
19
node_modules/@react-dnd/asap/LICENSE.md
generated
vendored
Normal file
19
node_modules/@react-dnd/asap/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright 2009–2014 Contributors. All rights reserved.
|
||||
|
||||
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.
|
||||
233
node_modules/@react-dnd/asap/README.md
generated
vendored
Normal file
233
node_modules/@react-dnd/asap/README.md
generated
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
# ASAP
|
||||
|
||||
[](https://travis-ci.org/kriskowal/asap)
|
||||
|
||||
Promise and asynchronous observer libraries, as well as hand-rolled callback
|
||||
programs and libraries, often need a mechanism to postpone the running of a
|
||||
callback until the next available event.
|
||||
(See [Designing API’s for Asynchrony][zalgo].)
|
||||
The `asap` function runs a task **as soon as possible** but not before it
|
||||
returns, waiting only for the completion of the current event and previously
|
||||
scheduled tasks.
|
||||
|
||||
```javascript
|
||||
asap(function () {
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
[zalgo]: http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony
|
||||
|
||||
This CommonJS package provides an `asap` module that exports a function that
|
||||
ruts a task function _as soon as possible_.
|
||||
|
||||
ASAP strives to schedule events to occur before yielding for IO, reflow,
|
||||
or redrawing.
|
||||
Each event receives an independent stack, with only platform code in parent
|
||||
frames and the events run in the order they are scheduled.
|
||||
|
||||
ASAP provides a fast event queue that will run tasks until it is
|
||||
empty before yielding to the JavaScript engine's underlying event-loop.
|
||||
When a task gets added to a previously empty event queue, ASAP schedules a flush
|
||||
event, preferring for that event to occur before the JavaScript engine has an
|
||||
opportunity to perform IO tasks or rendering, thus making the first task and
|
||||
subsequent tasks semantically indistinguishable.
|
||||
ASAP uses a variety of techniques to preserve this invariant on different
|
||||
versions of browsers and Node.js.
|
||||
|
||||
By design, ASAP prevents input events from being handled until the task
|
||||
queue is empty.
|
||||
If the process is busy enough, this may cause incoming connection requests to be
|
||||
dropped, and may cause existing connections to inform the sender to reduce the
|
||||
transmission rate or stall.
|
||||
ASAP allows this on the theory that, if there is enough work to do, there is no
|
||||
sense in looking for trouble.
|
||||
As a consequence, ASAP can interfere with smooth animation.
|
||||
If your task should be tied to the rendering loop, consider using
|
||||
`requestAnimationFrame` instead.
|
||||
A long sequence of tasks can also effect the long running script dialog.
|
||||
If this is a problem, you may be able to use ASAP’s cousin `setImmediate` to
|
||||
break long processes into shorter intervals and periodically allow the browser
|
||||
to breathe.
|
||||
`setImmediate` will yield for IO, reflow, and repaint events.
|
||||
It also returns a handler and can be canceled.
|
||||
For a `setImmediate` shim, consider [YuzuJS setImmediate][setimmediate].
|
||||
|
||||
[setimmediate]: https://github.com/YuzuJS/setImmediate
|
||||
|
||||
Take care.
|
||||
ASAP can sustain infinite recursive calls without warning.
|
||||
It will not halt from a stack overflow, and it will not consume unbounded
|
||||
memory.
|
||||
This is behaviorally equivalent to an infinite loop.
|
||||
As with infinite loops, you can monitor a Node.js process for this behavior
|
||||
with a heart-beat signal.
|
||||
As with infinite loops, a very small amount of caution goes a long way to
|
||||
avoiding problems.
|
||||
|
||||
```javascript
|
||||
function loop() {
|
||||
asap(loop)
|
||||
}
|
||||
loop()
|
||||
```
|
||||
|
||||
In browsers, if a task throws an exception, it will not interrupt the flushing
|
||||
of high-priority tasks.
|
||||
The exception will be postponed to a later, low-priority event to avoid
|
||||
slow-downs.
|
||||
In Node.js, if a task throws an exception, ASAP will resume flushing only if—and
|
||||
only after—the error is handled by `domain.on("error")` or
|
||||
`process.on("uncaughtException")`.
|
||||
|
||||
## Raw ASAP
|
||||
|
||||
Checking for exceptions comes at a cost.
|
||||
The package also provides an `asap/raw` module that exports the underlying
|
||||
implementation which is faster but stalls if a task throws an exception.
|
||||
This internal version of the ASAP function does not check for errors.
|
||||
If a task does throw an error, it will stall the event queue unless you manually
|
||||
call `rawAsap.requestFlush()` before throwing the error, or any time after.
|
||||
|
||||
In Node.js, `asap/raw` also runs all tasks outside any domain.
|
||||
If you need a task to be bound to your domain, you will have to do it manually.
|
||||
|
||||
```js
|
||||
if (process.domain) {
|
||||
task = process.domain.bind(task)
|
||||
}
|
||||
rawAsap(task)
|
||||
```
|
||||
|
||||
## Tasks
|
||||
|
||||
A task may be any object that implements `call()`.
|
||||
A function will suffice, but closures tend not to be reusable and can cause
|
||||
garbage collector churn.
|
||||
Both `asap` and `rawAsap` accept task objects to give you the option of
|
||||
recycling task objects or using higher callable object abstractions.
|
||||
See the `asap` source for an illustration.
|
||||
|
||||
## Compatibility
|
||||
|
||||
ASAP is tested on Node.js v0.10 and in a broad spectrum of web browsers.
|
||||
The following charts capture the browser test results for the most recent
|
||||
release.
|
||||
The first chart shows test results for ASAP running in the main window context.
|
||||
The second chart shows test results for ASAP running in a web worker context.
|
||||
Test results are inconclusive (grey) on browsers that do not support web
|
||||
workers.
|
||||
These data are captured automatically by [Continuous
|
||||
Integration][].
|
||||
|
||||
[continuous integration]: https://github.com/kriskowal/asap/blob/master/CONTRIBUTING.md
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Caveats
|
||||
|
||||
When a task is added to an empty event queue, it is not always possible to
|
||||
guarantee that the task queue will begin flushing immediately after the current
|
||||
event.
|
||||
However, once the task queue begins flushing, it will not yield until the queue
|
||||
is empty, even if the queue grows while running tasks.
|
||||
|
||||
The following browsers allow the use of [DOM mutation observers][] to access
|
||||
the HTML [microtask queue][], and thus begin flushing ASAP's task queue
|
||||
immediately at the end of the current event loop turn, before any rendering or
|
||||
IO:
|
||||
|
||||
[microtask queue]: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#microtask-queue
|
||||
[dom mutation observers]: http://dom.spec.whatwg.org/#mutation-observers
|
||||
|
||||
- Android 4–4.3
|
||||
- Chrome 26–34
|
||||
- Firefox 14–29
|
||||
- Internet Explorer 11
|
||||
- iPad Safari 6–7.1
|
||||
- iPhone Safari 7–7.1
|
||||
- Safari 6–7
|
||||
|
||||
In the absense of mutation observers, there are a few browsers, and situations
|
||||
like web workers in some of the above browsers, where [message channels][]
|
||||
would be a useful way to avoid falling back to timers.
|
||||
Message channels give direct access to the HTML [task queue][], so the ASAP
|
||||
task queue would flush after any already queued rendering and IO tasks, but
|
||||
without having the minimum delay imposed by timers.
|
||||
However, among these browsers, Internet Explorer 10 and Safari do not reliably
|
||||
dispatch messages, so they are not worth the trouble to implement.
|
||||
|
||||
[message channels]: http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html#message-channels
|
||||
[task queue]: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#concept-task
|
||||
|
||||
- Internet Explorer 10
|
||||
- Safair 5.0-1
|
||||
- Opera 11-12
|
||||
|
||||
In the absense of mutation observers, these browsers and the following browsers
|
||||
all fall back to using `setTimeout` and `setInterval` to ensure that a `flush`
|
||||
occurs.
|
||||
The implementation uses both and cancels whatever handler loses the race, since
|
||||
`setTimeout` tends to occasionally skip tasks in unisolated circumstances.
|
||||
Timers generally delay the flushing of ASAP's task queue for four milliseconds.
|
||||
|
||||
- Firefox 3–13
|
||||
- Internet Explorer 6–10
|
||||
- iPad Safari 4.3
|
||||
- Lynx 2.8.7
|
||||
|
||||
## Heritage
|
||||
|
||||
ASAP has been factored out of the [Q][] asynchronous promise library.
|
||||
It originally had a naïve implementation in terms of `setTimeout`, but
|
||||
[Malte Ubl][nonblocking] provided an insight that `postMessage` might be
|
||||
useful for creating a high-priority, no-delay event dispatch hack.
|
||||
Since then, Internet Explorer proposed and implemented `setImmediate`.
|
||||
Robert Katić began contributing to Q by measuring the performance of
|
||||
the internal implementation of `asap`, paying particular attention to
|
||||
error recovery.
|
||||
Domenic, Robert, and Kris Kowal collectively settled on the current strategy of
|
||||
unrolling the high-priority event queue internally regardless of what strategy
|
||||
we used to dispatch the potentially lower-priority flush event.
|
||||
Domenic went on to make ASAP cooperate with Node.js domains.
|
||||
|
||||
[q]: https://github.com/kriskowal/q
|
||||
[nonblocking]: http://www.nonblocking.io/2011/06/windownexttick.html
|
||||
|
||||
For further reading, Nicholas Zakas provided a thorough article on [The
|
||||
Case for setImmediate][ncz].
|
||||
|
||||
[ncz]: http://www.nczonline.net/blog/2013/07/09/the-case-for-setimmediate/
|
||||
|
||||
Ember’s RSVP promise implementation later [adopted][rsvp asap] the name ASAP but
|
||||
further developed the implentation.
|
||||
Particularly, The `MessagePort` implementation was abandoned due to interaction
|
||||
[problems with Mobile Internet Explorer][ie problems] in favor of an
|
||||
implementation backed on the newer and more reliable DOM `MutationObserver`
|
||||
interface.
|
||||
These changes were back-ported into this library.
|
||||
|
||||
[ie problems]: https://github.com/cujojs/when/issues/197
|
||||
[rsvp asap]: https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
|
||||
|
||||
In addition, ASAP factored into `asap` and `asap/raw`, such that `asap` remained
|
||||
exception-safe, but `asap/raw` provided a tight kernel that could be used for
|
||||
tasks that guaranteed that they would not throw exceptions.
|
||||
This core is useful for promise implementations that capture thrown errors in
|
||||
rejected promises and do not need a second safety net.
|
||||
At the same time, the exception handling in `asap` was factored into separate
|
||||
implementations for Node.js and browsers, using the the [Browserify][browser config] `browser` property in `package.json` to instruct browser module loaders
|
||||
and bundlers, including [Browserify][], [Mr][], and [Mop][], to use the
|
||||
browser-only implementation.
|
||||
|
||||
[browser config]: https://gist.github.com/defunctzombie/4339901
|
||||
[browserify]: https://github.com/substack/node-browserify
|
||||
[mr]: https://github.com/montagejs/mr
|
||||
[mop]: https://github.com/montagejs/mop
|
||||
|
||||
## License
|
||||
|
||||
Copyright 2009-2014 by Contributors
|
||||
MIT License (enclosed)
|
||||
144
node_modules/@react-dnd/asap/dist/cjs/AsapQueue.js
generated
vendored
Normal file
144
node_modules/@react-dnd/asap/dist/cjs/AsapQueue.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _makeRequestCallJs = require("./makeRequestCall.js");
|
||||
class AsapQueue {
|
||||
// Use the fastest means possible to execute a task in its own turn, with
|
||||
// priority over other events including IO, animation, reflow, and redraw
|
||||
// events in browsers.
|
||||
//
|
||||
// An exception thrown by a task will permanently interrupt the processing of
|
||||
// subsequent tasks. The higher level `asap` function ensures that if an
|
||||
// exception is thrown by a task, that the task queue will continue flushing as
|
||||
// soon as possible, but if you use `rawAsap` directly, you are responsible to
|
||||
// either ensure that no exceptions are thrown from your task, or to manually
|
||||
// call `rawAsap.requestFlush` if an exception is thrown.
|
||||
enqueueTask(task) {
|
||||
const { queue: q , requestFlush } = this;
|
||||
if (!q.length) {
|
||||
requestFlush();
|
||||
this.flushing = true;
|
||||
}
|
||||
// Equivalent to push, but avoids a function call.
|
||||
q[q.length] = task;
|
||||
}
|
||||
constructor(){
|
||||
this.queue = [];
|
||||
// We queue errors to ensure they are thrown in right order (FIFO).
|
||||
// Array-as-queue is good enough here, since we are just dealing with exceptions.
|
||||
this.pendingErrors = [];
|
||||
// Once a flush has been requested, no further calls to `requestFlush` are
|
||||
// necessary until the next `flush` completes.
|
||||
// @ts-ignore
|
||||
this.flushing = false;
|
||||
// The position of the next task to execute in the task queue. This is
|
||||
// preserved between calls to `flush` so that it can be resumed if
|
||||
// a task throws an exception.
|
||||
this.index = 0;
|
||||
// If a task schedules additional tasks recursively, the task queue can grow
|
||||
// unbounded. To prevent memory exhaustion, the task queue will periodically
|
||||
// truncate already-completed tasks.
|
||||
this.capacity = 1024;
|
||||
// The flush function processes all tasks that have been scheduled with
|
||||
// `rawAsap` unless and until one of those tasks throws an exception.
|
||||
// If a task throws an exception, `flush` ensures that its state will remain
|
||||
// consistent and will resume where it left off when called again.
|
||||
// However, `flush` does not make any arrangements to be called again if an
|
||||
// exception is thrown.
|
||||
this.flush = ()=>{
|
||||
const { queue: q } = this;
|
||||
while(this.index < q.length){
|
||||
const currentIndex = this.index;
|
||||
// Advance the index before calling the task. This ensures that we will
|
||||
// begin flushing on the next task the task throws an error.
|
||||
this.index++;
|
||||
q[currentIndex].call();
|
||||
// Prevent leaking memory for long chains of recursive calls to `asap`.
|
||||
// If we call `asap` within tasks scheduled by `asap`, the queue will
|
||||
// grow, but to avoid an O(n) walk for every task we execute, we don't
|
||||
// shift tasks off the queue after they have been executed.
|
||||
// Instead, we periodically shift 1024 tasks off the queue.
|
||||
if (this.index > this.capacity) {
|
||||
// Manually shift all values starting at the index back to the
|
||||
// beginning of the queue.
|
||||
for(let scan = 0, newLength = q.length - this.index; scan < newLength; scan++){
|
||||
q[scan] = q[scan + this.index];
|
||||
}
|
||||
q.length -= this.index;
|
||||
this.index = 0;
|
||||
}
|
||||
}
|
||||
q.length = 0;
|
||||
this.index = 0;
|
||||
this.flushing = false;
|
||||
};
|
||||
// In a web browser, exceptions are not fatal. However, to avoid
|
||||
// slowing down the queue of pending tasks, we rethrow the error in a
|
||||
// lower priority turn.
|
||||
this.registerPendingError = (err)=>{
|
||||
this.pendingErrors.push(err);
|
||||
this.requestErrorThrow();
|
||||
};
|
||||
// `requestFlush` requests that the high priority event queue be flushed as
|
||||
// soon as possible.
|
||||
// This is useful to prevent an error thrown in a task from stalling the event
|
||||
// queue if the exception handled by Node.js’s
|
||||
// `process.on("uncaughtException")` or by a domain.
|
||||
// `requestFlush` is implemented using a strategy based on data collected from
|
||||
// every available SauceLabs Selenium web driver worker at time of writing.
|
||||
// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
|
||||
this.requestFlush = (0, _makeRequestCallJs).makeRequestCall(this.flush);
|
||||
this.requestErrorThrow = (0, _makeRequestCallJs).makeRequestCallFromTimer(()=>{
|
||||
// Throw first error
|
||||
if (this.pendingErrors.length) {
|
||||
throw this.pendingErrors.shift();
|
||||
}
|
||||
});
|
||||
}
|
||||
} // The message channel technique was discovered by Malte Ubl and was the
|
||||
// original foundation for this library.
|
||||
// http://www.nonblocking.io/2011/06/windownexttick.html
|
||||
// Safari 6.0.5 (at least) intermittently fails to create message ports on a
|
||||
// page's first load. Thankfully, this version of Safari supports
|
||||
// MutationObservers, so we don't need to fall back in that case.
|
||||
// function makeRequestCallFromMessageChannel(callback) {
|
||||
// var channel = new MessageChannel();
|
||||
// channel.port1.onmessage = callback;
|
||||
// return function requestCall() {
|
||||
// channel.port2.postMessage(0);
|
||||
// };
|
||||
// }
|
||||
// For reasons explained above, we are also unable to use `setImmediate`
|
||||
// under any circumstances.
|
||||
// Even if we were, there is another bug in Internet Explorer 10.
|
||||
// It is not sufficient to assign `setImmediate` to `requestFlush` because
|
||||
// `setImmediate` must be called *by name* and therefore must be wrapped in a
|
||||
// closure.
|
||||
// Never forget.
|
||||
// function makeRequestCallFromSetImmediate(callback) {
|
||||
// return function requestCall() {
|
||||
// setImmediate(callback);
|
||||
// };
|
||||
// }
|
||||
// Safari 6.0 has a problem where timers will get lost while the user is
|
||||
// scrolling. This problem does not impact ASAP because Safari 6.0 supports
|
||||
// mutation observers, so that implementation is used instead.
|
||||
// However, if we ever elect to use timers in Safari, the prevalent work-around
|
||||
// is to add a scroll event listener that calls for a flush.
|
||||
// `setTimeout` does not call the passed callback if the delay is less than
|
||||
// approximately 7 in web workers in Firefox 8 through 18, and sometimes not
|
||||
// even then.
|
||||
// This is for `asap.js` only.
|
||||
// Its name will be periodically randomized to break any code that depends on
|
||||
// // its existence.
|
||||
// rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer
|
||||
// ASAP was originally a nextTick shim included in Q. This was factored out
|
||||
// into this ASAP package. It was later adapted to RSVP which made further
|
||||
// amendments. These decisions, particularly to marginalize MessageChannel and
|
||||
// to capture the MutationObserver implementation in a closure, were integrated
|
||||
// back into ASAP proper.
|
||||
// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
|
||||
exports.AsapQueue = AsapQueue;
|
||||
|
||||
//# sourceMappingURL=AsapQueue.js.map
|
||||
1
node_modules/@react-dnd/asap/dist/cjs/AsapQueue.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/cjs/AsapQueue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
24
node_modules/@react-dnd/asap/dist/cjs/RawTask.js
generated
vendored
Normal file
24
node_modules/@react-dnd/asap/dist/cjs/RawTask.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
class RawTask {
|
||||
call() {
|
||||
try {
|
||||
this.task && this.task();
|
||||
} catch (error) {
|
||||
this.onError(error);
|
||||
} finally{
|
||||
this.task = null;
|
||||
this.release(this);
|
||||
}
|
||||
}
|
||||
constructor(onError, release){
|
||||
this.onError = onError;
|
||||
this.release = release;
|
||||
this.task = null;
|
||||
}
|
||||
}
|
||||
exports.RawTask = RawTask;
|
||||
|
||||
//# sourceMappingURL=RawTask.js.map
|
||||
1
node_modules/@react-dnd/asap/dist/cjs/RawTask.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/cjs/RawTask.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/RawTask.ts"],"sourcesContent":["// We wrap tasks with recyclable task objects. A task object implements\n\nimport type { TaskFn, Task } from 'types'\n\n// `call`, just like a function.\nexport class RawTask implements Task {\n\tpublic task: TaskFn | null = null\n\n\tpublic constructor(\n\t\tprivate onError: (err: any) => void,\n\t\tprivate release: (t: RawTask) => void,\n\t) {}\n\n\tpublic call() {\n\t\ttry {\n\t\t\tthis.task && this.task()\n\t\t} catch (error) {\n\t\t\tthis.onError(error)\n\t\t} finally {\n\t\t\tthis.task = null\n\t\t\tthis.release(this)\n\t\t}\n\t}\n}\n"],"names":["RawTask","call","task","error","onError","release"],"mappings":"AAEA;;;;AAGO,MAAMA,OAAO;IAQnB,AAAOC,IAAI,GAAG;QACb,IAAI;YACH,IAAI,CAACC,IAAI,IAAI,IAAI,CAACA,IAAI,EAAE;SACxB,CAAC,OAAOC,KAAK,EAAE;YACf,IAAI,CAACC,OAAO,CAACD,KAAK,CAAC;SACnB,QAAS;YACT,IAAI,CAACD,IAAI,GAAG,IAAI;YAChB,IAAI,CAACG,OAAO,CAAC,IAAI,CAAC;SAClB;KACD;IAdD,YACSD,OAA2B,EAC3BC,OAA6B,CACpC;aAFOD,OAA2B,GAA3BA,OAA2B;aAC3BC,OAA6B,GAA7BA,OAA6B;aAJ/BH,IAAI,GAAkB,IAAI;KAK7B;CAYJ;QAlBYF,OAAO,GAAPA,OAAO"}
|
||||
21
node_modules/@react-dnd/asap/dist/cjs/TaskFactory.js
generated
vendored
Normal file
21
node_modules/@react-dnd/asap/dist/cjs/TaskFactory.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _rawTaskJs = require("./RawTask.js");
|
||||
class TaskFactory {
|
||||
create(task) {
|
||||
const tasks = this.freeTasks;
|
||||
const t1 = tasks.length ? tasks.pop() : new _rawTaskJs.RawTask(this.onError, (t)=>tasks[tasks.length] = t
|
||||
);
|
||||
t1.task = task;
|
||||
return t1;
|
||||
}
|
||||
constructor(onError){
|
||||
this.onError = onError;
|
||||
this.freeTasks = [];
|
||||
}
|
||||
}
|
||||
exports.TaskFactory = TaskFactory;
|
||||
|
||||
//# sourceMappingURL=TaskFactory.js.map
|
||||
1
node_modules/@react-dnd/asap/dist/cjs/TaskFactory.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/cjs/TaskFactory.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/TaskFactory.ts"],"sourcesContent":["import type { Task } from './types.js'\nimport { RawTask } from './RawTask.js'\n\nexport class TaskFactory {\n\tprivate freeTasks: RawTask[] = []\n\n\tpublic constructor(private onError: (err: any) => void) {}\n\n\tpublic create(task: () => void): Task {\n\t\tconst tasks = this.freeTasks\n\t\tconst t = tasks.length\n\t\t\t? (tasks.pop() as RawTask)\n\t\t\t: new RawTask(this.onError, (t) => (tasks[tasks.length] = t))\n\t\tt.task = task\n\t\treturn t\n\t}\n}\n"],"names":["TaskFactory","create","task","tasks","freeTasks","t","length","pop","RawTask","onError"],"mappings":"AAAA;;;;AACwB,IAAA,UAAc,WAAd,cAAc,CAAA;AAE/B,MAAMA,WAAW;IAKvB,AAAOC,MAAM,CAACC,IAAgB,EAAQ;QACrC,MAAMC,KAAK,GAAG,IAAI,CAACC,SAAS;QAC5B,MAAMC,EAAC,GAAGF,KAAK,CAACG,MAAM,GAClBH,KAAK,CAACI,GAAG,EAAE,GACZ,IAAIC,UAAO,QAAA,CAAC,IAAI,CAACC,OAAO,EAAE,CAACJ,CAAC,GAAMF,KAAK,CAACA,KAAK,CAACG,MAAM,CAAC,GAAGD,CAAC;QAAC,CAAC;QAC9DA,EAAC,CAACH,IAAI,GAAGA,IAAI;QACb,OAAOG,EAAC,CAAA;KACR;IATD,YAA2BI,OAA2B,CAAE;aAA7BA,OAA2B,GAA3BA,OAA2B;aAF9CL,SAAS,GAAc,EAAE;KAEyB;CAU1D;QAbYJ,WAAW,GAAXA,WAAW"}
|
||||
14
node_modules/@react-dnd/asap/dist/cjs/asap.js
generated
vendored
Normal file
14
node_modules/@react-dnd/asap/dist/cjs/asap.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.asap = asap;
|
||||
var _asapQueueJs = require("./AsapQueue.js");
|
||||
var _taskFactoryJs = require("./TaskFactory.js");
|
||||
const asapQueue = new _asapQueueJs.AsapQueue();
|
||||
const taskFactory = new _taskFactoryJs.TaskFactory(asapQueue.registerPendingError);
|
||||
function asap(task) {
|
||||
asapQueue.enqueueTask(taskFactory.create(task));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=asap.js.map
|
||||
1
node_modules/@react-dnd/asap/dist/cjs/asap.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/cjs/asap.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/asap.ts"],"sourcesContent":["import { AsapQueue } from './AsapQueue.js'\nimport { TaskFactory } from './TaskFactory.js'\nimport type { TaskFn } from './types.js'\n\nconst asapQueue = new AsapQueue()\nconst taskFactory = new TaskFactory(asapQueue.registerPendingError)\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nexport function asap(task: TaskFn) {\n\tasapQueue.enqueueTask(taskFactory.create(task))\n}\n"],"names":["asap","asapQueue","AsapQueue","taskFactory","TaskFactory","registerPendingError","task","enqueueTask","create"],"mappings":"AAAA;;;;QAegBA,IAAI,GAAJA,IAAI;AAfM,IAAA,YAAgB,WAAhB,gBAAgB,CAAA;AACd,IAAA,cAAkB,WAAlB,kBAAkB,CAAA;AAG9C,MAAMC,SAAS,GAAG,IAAIC,YAAS,UAAA,EAAE;AACjC,MAAMC,WAAW,GAAG,IAAIC,cAAW,YAAA,CAACH,SAAS,CAACI,oBAAoB,CAAC;AAU5D,SAASL,IAAI,CAACM,IAAY,EAAE;IAClCL,SAAS,CAACM,WAAW,CAACJ,WAAW,CAACK,MAAM,CAACF,IAAI,CAAC,CAAC;CAC/C"}
|
||||
76
node_modules/@react-dnd/asap/dist/cjs/index.js
generated
vendored
Normal file
76
node_modules/@react-dnd/asap/dist/cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {};
|
||||
var _asapJs = _interopRequireWildcard(require("./asap.js"));
|
||||
Object.keys(_asapJs).forEach(function(key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _asapJs[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _asapJs[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
var _typesJs = _interopRequireWildcard(require("./types.js"));
|
||||
Object.keys(_typesJs).forEach(function(key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _typesJs[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _typesJs[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
var _asapQueueJs = _interopRequireWildcard(require("./AsapQueue.js"));
|
||||
Object.keys(_asapQueueJs).forEach(function(key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _asapQueueJs[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _asapQueueJs[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
var _taskFactoryJs = _interopRequireWildcard(require("./TaskFactory.js"));
|
||||
Object.keys(_taskFactoryJs).forEach(function(key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _taskFactoryJs[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _taskFactoryJs[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
} else {
|
||||
var newObj = {};
|
||||
if (obj != null) {
|
||||
for(var key in obj){
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
||||
if (desc.get || desc.set) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@react-dnd/asap/dist/cjs/index.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/cjs/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './asap.js'\nexport * from './types.js'\nexport * from './AsapQueue.js'\nexport * from './TaskFactory.js'\n"],"names":[],"mappings":"AAAA;;;;;8CAAc,WAAW;AAAzB,YAAA,OAAyB;;;2CAAzB,OAAyB;;;;mBAAzB,OAAyB;;;EAAA;+CACX,YAAY;AAA1B,YAAA,QAA0B;;;2CAA1B,QAA0B;;;;mBAA1B,QAA0B;;;EAAA;mDACZ,gBAAgB;AAA9B,YAAA,YAA8B;;;2CAA9B,YAA8B;;;;mBAA9B,YAA8B;;;EAAA;qDAChB,kBAAkB;AAAhC,YAAA,cAAgC;;;2CAAhC,cAAgC;;;;mBAAhC,cAAgC;;;EAAA"}
|
||||
83
node_modules/@react-dnd/asap/dist/cjs/makeRequestCall.js
generated
vendored
Normal file
83
node_modules/@react-dnd/asap/dist/cjs/makeRequestCall.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeRequestCallFromTimer = makeRequestCallFromTimer;
|
||||
exports.makeRequestCallFromMutationObserver = makeRequestCallFromMutationObserver;
|
||||
exports.makeRequestCall = void 0;
|
||||
// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
|
||||
// have WebKitMutationObserver but not un-prefixed MutationObserver.
|
||||
// Must use `global` or `self` instead of `window` to work in both frames and web
|
||||
// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
|
||||
/* globals self */ const scope = typeof global !== 'undefined' ? global : self;
|
||||
const BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;
|
||||
function makeRequestCallFromTimer(callback) {
|
||||
return function requestCall() {
|
||||
// We dispatch a timeout with a specified delay of 0 for engines that
|
||||
// can reliably accommodate that request. This will usually be snapped
|
||||
// to a 4 milisecond delay, but once we're flushing, there's no delay
|
||||
// between events.
|
||||
const timeoutHandle = setTimeout(handleTimer, 0);
|
||||
// However, since this timer gets frequently dropped in Firefox
|
||||
// workers, we enlist an interval handle that will try to fire
|
||||
// an event 20 times per second until it succeeds.
|
||||
const intervalHandle = setInterval(handleTimer, 50);
|
||||
function handleTimer() {
|
||||
// Whichever timer succeeds will cancel both timers and
|
||||
// execute the callback.
|
||||
clearTimeout(timeoutHandle);
|
||||
clearInterval(intervalHandle);
|
||||
callback();
|
||||
}
|
||||
};
|
||||
}
|
||||
function makeRequestCallFromMutationObserver(callback) {
|
||||
let toggle = 1;
|
||||
const observer = new BrowserMutationObserver(callback);
|
||||
const node = document.createTextNode('');
|
||||
observer.observe(node, {
|
||||
characterData: true
|
||||
});
|
||||
return function requestCall() {
|
||||
toggle = -toggle;
|
||||
node.data = toggle;
|
||||
};
|
||||
}
|
||||
const makeRequestCall = typeof BrowserMutationObserver === 'function' ? // reliably everywhere they are implemented.
|
||||
// They are implemented in all modern browsers.
|
||||
//
|
||||
// - Android 4-4.3
|
||||
// - Chrome 26-34
|
||||
// - Firefox 14-29
|
||||
// - Internet Explorer 11
|
||||
// - iPad Safari 6-7.1
|
||||
// - iPhone Safari 7-7.1
|
||||
// - Safari 6-7
|
||||
makeRequestCallFromMutationObserver : // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
|
||||
// 11-12, and in web workers in many engines.
|
||||
// Although message channels yield to any queued rendering and IO tasks, they
|
||||
// would be better than imposing the 4ms delay of timers.
|
||||
// However, they do not work reliably in Internet Explorer or Safari.
|
||||
// Internet Explorer 10 is the only browser that has setImmediate but does
|
||||
// not have MutationObservers.
|
||||
// Although setImmediate yields to the browser's renderer, it would be
|
||||
// preferrable to falling back to setTimeout since it does not have
|
||||
// the minimum 4ms penalty.
|
||||
// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
|
||||
// Desktop to a lesser extent) that renders both setImmediate and
|
||||
// MessageChannel useless for the purposes of ASAP.
|
||||
// https://github.com/kriskowal/q/issues/396
|
||||
// Timers are implemented universally.
|
||||
// We fall back to timers in workers in most engines, and in foreground
|
||||
// contexts in the following browsers.
|
||||
// However, note that even this simple case requires nuances to operate in a
|
||||
// broad spectrum of browsers.
|
||||
//
|
||||
// - Firefox 3-13
|
||||
// - Internet Explorer 6-9
|
||||
// - iPad Safari 4.3
|
||||
// - Lynx 2.8.7
|
||||
makeRequestCallFromTimer;
|
||||
exports.makeRequestCall = makeRequestCall;
|
||||
|
||||
//# sourceMappingURL=makeRequestCall.js.map
|
||||
1
node_modules/@react-dnd/asap/dist/cjs/makeRequestCall.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/cjs/makeRequestCall.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/@react-dnd/asap/dist/cjs/types.js
generated
vendored
Normal file
6
node_modules/@react-dnd/asap/dist/cjs/types.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/@react-dnd/asap/dist/cjs/types.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/cjs/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["export interface Task {\n\tcall(): void\n}\nexport type TaskFn = () => void\n"],"names":[],"mappings":"AAAA"}
|
||||
139
node_modules/@react-dnd/asap/dist/esm/AsapQueue.mjs
generated
vendored
Normal file
139
node_modules/@react-dnd/asap/dist/esm/AsapQueue.mjs
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
import { makeRequestCall, makeRequestCallFromTimer } from './makeRequestCall.mjs';
|
||||
export class AsapQueue {
|
||||
// Use the fastest means possible to execute a task in its own turn, with
|
||||
// priority over other events including IO, animation, reflow, and redraw
|
||||
// events in browsers.
|
||||
//
|
||||
// An exception thrown by a task will permanently interrupt the processing of
|
||||
// subsequent tasks. The higher level `asap` function ensures that if an
|
||||
// exception is thrown by a task, that the task queue will continue flushing as
|
||||
// soon as possible, but if you use `rawAsap` directly, you are responsible to
|
||||
// either ensure that no exceptions are thrown from your task, or to manually
|
||||
// call `rawAsap.requestFlush` if an exception is thrown.
|
||||
enqueueTask(task) {
|
||||
const { queue: q , requestFlush } = this;
|
||||
if (!q.length) {
|
||||
requestFlush();
|
||||
this.flushing = true;
|
||||
}
|
||||
// Equivalent to push, but avoids a function call.
|
||||
q[q.length] = task;
|
||||
}
|
||||
constructor(){
|
||||
this.queue = [];
|
||||
// We queue errors to ensure they are thrown in right order (FIFO).
|
||||
// Array-as-queue is good enough here, since we are just dealing with exceptions.
|
||||
this.pendingErrors = [];
|
||||
// Once a flush has been requested, no further calls to `requestFlush` are
|
||||
// necessary until the next `flush` completes.
|
||||
// @ts-ignore
|
||||
this.flushing = false;
|
||||
// The position of the next task to execute in the task queue. This is
|
||||
// preserved between calls to `flush` so that it can be resumed if
|
||||
// a task throws an exception.
|
||||
this.index = 0;
|
||||
// If a task schedules additional tasks recursively, the task queue can grow
|
||||
// unbounded. To prevent memory exhaustion, the task queue will periodically
|
||||
// truncate already-completed tasks.
|
||||
this.capacity = 1024;
|
||||
// The flush function processes all tasks that have been scheduled with
|
||||
// `rawAsap` unless and until one of those tasks throws an exception.
|
||||
// If a task throws an exception, `flush` ensures that its state will remain
|
||||
// consistent and will resume where it left off when called again.
|
||||
// However, `flush` does not make any arrangements to be called again if an
|
||||
// exception is thrown.
|
||||
this.flush = ()=>{
|
||||
const { queue: q } = this;
|
||||
while(this.index < q.length){
|
||||
const currentIndex = this.index;
|
||||
// Advance the index before calling the task. This ensures that we will
|
||||
// begin flushing on the next task the task throws an error.
|
||||
this.index++;
|
||||
q[currentIndex].call();
|
||||
// Prevent leaking memory for long chains of recursive calls to `asap`.
|
||||
// If we call `asap` within tasks scheduled by `asap`, the queue will
|
||||
// grow, but to avoid an O(n) walk for every task we execute, we don't
|
||||
// shift tasks off the queue after they have been executed.
|
||||
// Instead, we periodically shift 1024 tasks off the queue.
|
||||
if (this.index > this.capacity) {
|
||||
// Manually shift all values starting at the index back to the
|
||||
// beginning of the queue.
|
||||
for(let scan = 0, newLength = q.length - this.index; scan < newLength; scan++){
|
||||
q[scan] = q[scan + this.index];
|
||||
}
|
||||
q.length -= this.index;
|
||||
this.index = 0;
|
||||
}
|
||||
}
|
||||
q.length = 0;
|
||||
this.index = 0;
|
||||
this.flushing = false;
|
||||
};
|
||||
// In a web browser, exceptions are not fatal. However, to avoid
|
||||
// slowing down the queue of pending tasks, we rethrow the error in a
|
||||
// lower priority turn.
|
||||
this.registerPendingError = (err)=>{
|
||||
this.pendingErrors.push(err);
|
||||
this.requestErrorThrow();
|
||||
};
|
||||
// `requestFlush` requests that the high priority event queue be flushed as
|
||||
// soon as possible.
|
||||
// This is useful to prevent an error thrown in a task from stalling the event
|
||||
// queue if the exception handled by Node.js’s
|
||||
// `process.on("uncaughtException")` or by a domain.
|
||||
// `requestFlush` is implemented using a strategy based on data collected from
|
||||
// every available SauceLabs Selenium web driver worker at time of writing.
|
||||
// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
|
||||
this.requestFlush = makeRequestCall(this.flush);
|
||||
this.requestErrorThrow = makeRequestCallFromTimer(()=>{
|
||||
// Throw first error
|
||||
if (this.pendingErrors.length) {
|
||||
throw this.pendingErrors.shift();
|
||||
}
|
||||
});
|
||||
}
|
||||
} // The message channel technique was discovered by Malte Ubl and was the
|
||||
// original foundation for this library.
|
||||
// http://www.nonblocking.io/2011/06/windownexttick.html
|
||||
// Safari 6.0.5 (at least) intermittently fails to create message ports on a
|
||||
// page's first load. Thankfully, this version of Safari supports
|
||||
// MutationObservers, so we don't need to fall back in that case.
|
||||
// function makeRequestCallFromMessageChannel(callback) {
|
||||
// var channel = new MessageChannel();
|
||||
// channel.port1.onmessage = callback;
|
||||
// return function requestCall() {
|
||||
// channel.port2.postMessage(0);
|
||||
// };
|
||||
// }
|
||||
// For reasons explained above, we are also unable to use `setImmediate`
|
||||
// under any circumstances.
|
||||
// Even if we were, there is another bug in Internet Explorer 10.
|
||||
// It is not sufficient to assign `setImmediate` to `requestFlush` because
|
||||
// `setImmediate` must be called *by name* and therefore must be wrapped in a
|
||||
// closure.
|
||||
// Never forget.
|
||||
// function makeRequestCallFromSetImmediate(callback) {
|
||||
// return function requestCall() {
|
||||
// setImmediate(callback);
|
||||
// };
|
||||
// }
|
||||
// Safari 6.0 has a problem where timers will get lost while the user is
|
||||
// scrolling. This problem does not impact ASAP because Safari 6.0 supports
|
||||
// mutation observers, so that implementation is used instead.
|
||||
// However, if we ever elect to use timers in Safari, the prevalent work-around
|
||||
// is to add a scroll event listener that calls for a flush.
|
||||
// `setTimeout` does not call the passed callback if the delay is less than
|
||||
// approximately 7 in web workers in Firefox 8 through 18, and sometimes not
|
||||
// even then.
|
||||
// This is for `asap.js` only.
|
||||
// Its name will be periodically randomized to break any code that depends on
|
||||
// // its existence.
|
||||
// rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer
|
||||
// ASAP was originally a nextTick shim included in Q. This was factored out
|
||||
// into this ASAP package. It was later adapted to RSVP which made further
|
||||
// amendments. These decisions, particularly to marginalize MessageChannel and
|
||||
// to capture the MutationObserver implementation in a closure, were integrated
|
||||
// back into ASAP proper.
|
||||
// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
|
||||
|
||||
//# sourceMappingURL=AsapQueue.mjs.map
|
||||
1
node_modules/@react-dnd/asap/dist/esm/AsapQueue.mjs.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/esm/AsapQueue.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
20
node_modules/@react-dnd/asap/dist/esm/RawTask.mjs
generated
vendored
Normal file
20
node_modules/@react-dnd/asap/dist/esm/RawTask.mjs
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// `call`, just like a function.
|
||||
export class RawTask {
|
||||
call() {
|
||||
try {
|
||||
this.task && this.task();
|
||||
} catch (error) {
|
||||
this.onError(error);
|
||||
} finally{
|
||||
this.task = null;
|
||||
this.release(this);
|
||||
}
|
||||
}
|
||||
constructor(onError, release){
|
||||
this.onError = onError;
|
||||
this.release = release;
|
||||
this.task = null;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=RawTask.mjs.map
|
||||
1
node_modules/@react-dnd/asap/dist/esm/RawTask.mjs.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/esm/RawTask.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/RawTask.ts"],"sourcesContent":["// We wrap tasks with recyclable task objects. A task object implements\n\nimport type { TaskFn, Task } from 'types'\n\n// `call`, just like a function.\nexport class RawTask implements Task {\n\tpublic task: TaskFn | null = null\n\n\tpublic constructor(\n\t\tprivate onError: (err: any) => void,\n\t\tprivate release: (t: RawTask) => void,\n\t) {}\n\n\tpublic call() {\n\t\ttry {\n\t\t\tthis.task && this.task()\n\t\t} catch (error) {\n\t\t\tthis.onError(error)\n\t\t} finally {\n\t\t\tthis.task = null\n\t\t\tthis.release(this)\n\t\t}\n\t}\n}\n"],"names":["RawTask","call","task","error","onError","release"],"mappings":"AAIA,gCAAgC;AAChC,OAAO,MAAMA,OAAO;IAQnB,AAAOC,IAAI,GAAG;QACb,IAAI;YACH,IAAI,CAACC,IAAI,IAAI,IAAI,CAACA,IAAI,EAAE;SACxB,CAAC,OAAOC,KAAK,EAAE;YACf,IAAI,CAACC,OAAO,CAACD,KAAK,CAAC;SACnB,QAAS;YACT,IAAI,CAACD,IAAI,GAAG,IAAI;YAChB,IAAI,CAACG,OAAO,CAAC,IAAI,CAAC;SAClB;KACD;IAdD,YACSD,OAA2B,EAC3BC,OAA6B,CACpC;aAFOD,OAA2B,GAA3BA,OAA2B;aAC3BC,OAA6B,GAA7BA,OAA6B;aAJ/BH,IAAI,GAAkB,IAAI;KAK7B;CAYJ"}
|
||||
16
node_modules/@react-dnd/asap/dist/esm/TaskFactory.mjs
generated
vendored
Normal file
16
node_modules/@react-dnd/asap/dist/esm/TaskFactory.mjs
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { RawTask } from './RawTask.mjs';
|
||||
export class TaskFactory {
|
||||
create(task) {
|
||||
const tasks = this.freeTasks;
|
||||
const t1 = tasks.length ? tasks.pop() : new RawTask(this.onError, (t)=>tasks[tasks.length] = t
|
||||
);
|
||||
t1.task = task;
|
||||
return t1;
|
||||
}
|
||||
constructor(onError){
|
||||
this.onError = onError;
|
||||
this.freeTasks = [];
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=TaskFactory.mjs.map
|
||||
1
node_modules/@react-dnd/asap/dist/esm/TaskFactory.mjs.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/esm/TaskFactory.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/TaskFactory.ts"],"sourcesContent":["import type { Task } from './types.js'\nimport { RawTask } from './RawTask.js'\n\nexport class TaskFactory {\n\tprivate freeTasks: RawTask[] = []\n\n\tpublic constructor(private onError: (err: any) => void) {}\n\n\tpublic create(task: () => void): Task {\n\t\tconst tasks = this.freeTasks\n\t\tconst t = tasks.length\n\t\t\t? (tasks.pop() as RawTask)\n\t\t\t: new RawTask(this.onError, (t) => (tasks[tasks.length] = t))\n\t\tt.task = task\n\t\treturn t\n\t}\n}\n"],"names":["RawTask","TaskFactory","create","task","tasks","freeTasks","t","length","pop","onError"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc,CAAA;AAEtC,OAAO,MAAMC,WAAW;IAKvB,AAAOC,MAAM,CAACC,IAAgB,EAAQ;QACrC,MAAMC,KAAK,GAAG,IAAI,CAACC,SAAS;QAC5B,MAAMC,EAAC,GAAGF,KAAK,CAACG,MAAM,GAClBH,KAAK,CAACI,GAAG,EAAE,GACZ,IAAIR,OAAO,CAAC,IAAI,CAACS,OAAO,EAAE,CAACH,CAAC,GAAMF,KAAK,CAACA,KAAK,CAACG,MAAM,CAAC,GAAGD,CAAC;QAAC,CAAC;QAC9DA,EAAC,CAACH,IAAI,GAAGA,IAAI;QACb,OAAOG,EAAC,CAAA;KACR;IATD,YAA2BG,OAA2B,CAAE;aAA7BA,OAA2B,GAA3BA,OAA2B;aAF9CJ,SAAS,GAAc,EAAE;KAEyB;CAU1D"}
|
||||
16
node_modules/@react-dnd/asap/dist/esm/asap.mjs
generated
vendored
Normal file
16
node_modules/@react-dnd/asap/dist/esm/asap.mjs
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { AsapQueue } from './AsapQueue.mjs';
|
||||
import { TaskFactory } from './TaskFactory.mjs';
|
||||
const asapQueue = new AsapQueue();
|
||||
const taskFactory = new TaskFactory(asapQueue.registerPendingError);
|
||||
/**
|
||||
* Calls a task as soon as possible after returning, in its own event, with priority
|
||||
* over other events like animation, reflow, and repaint. An error thrown from an
|
||||
* event will not interrupt, nor even substantially slow down the processing of
|
||||
* other events, but will be rather postponed to a lower priority event.
|
||||
* @param {{call}} task A callable object, typically a function that takes no
|
||||
* arguments.
|
||||
*/ export function asap(task) {
|
||||
asapQueue.enqueueTask(taskFactory.create(task));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=asap.mjs.map
|
||||
1
node_modules/@react-dnd/asap/dist/esm/asap.mjs.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/esm/asap.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/asap.ts"],"sourcesContent":["import { AsapQueue } from './AsapQueue.js'\nimport { TaskFactory } from './TaskFactory.js'\nimport type { TaskFn } from './types.js'\n\nconst asapQueue = new AsapQueue()\nconst taskFactory = new TaskFactory(asapQueue.registerPendingError)\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nexport function asap(task: TaskFn) {\n\tasapQueue.enqueueTask(taskFactory.create(task))\n}\n"],"names":["AsapQueue","TaskFactory","asapQueue","taskFactory","registerPendingError","asap","task","enqueueTask","create"],"mappings":"AAAA,SAASA,SAAS,QAAQ,gBAAgB,CAAA;AAC1C,SAASC,WAAW,QAAQ,kBAAkB,CAAA;AAG9C,MAAMC,SAAS,GAAG,IAAIF,SAAS,EAAE;AACjC,MAAMG,WAAW,GAAG,IAAIF,WAAW,CAACC,SAAS,CAACE,oBAAoB,CAAC;AAEnE;;;;;;;GAOG,CACH,OAAO,SAASC,IAAI,CAACC,IAAY,EAAE;IAClCJ,SAAS,CAACK,WAAW,CAACJ,WAAW,CAACK,MAAM,CAACF,IAAI,CAAC,CAAC;CAC/C"}
|
||||
6
node_modules/@react-dnd/asap/dist/esm/index.mjs
generated
vendored
Normal file
6
node_modules/@react-dnd/asap/dist/esm/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from './asap.mjs';
|
||||
export * from './types.mjs';
|
||||
export * from './AsapQueue.mjs';
|
||||
export * from './TaskFactory.mjs';
|
||||
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
node_modules/@react-dnd/asap/dist/esm/index.mjs.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/esm/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './asap.js'\nexport * from './types.js'\nexport * from './AsapQueue.js'\nexport * from './TaskFactory.js'\n"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA"}
|
||||
77
node_modules/@react-dnd/asap/dist/esm/makeRequestCall.mjs
generated
vendored
Normal file
77
node_modules/@react-dnd/asap/dist/esm/makeRequestCall.mjs
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
|
||||
// have WebKitMutationObserver but not un-prefixed MutationObserver.
|
||||
// Must use `global` or `self` instead of `window` to work in both frames and web
|
||||
// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
|
||||
/* globals self */ const scope = typeof global !== 'undefined' ? global : self;
|
||||
const BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;
|
||||
export function makeRequestCallFromTimer(callback) {
|
||||
return function requestCall() {
|
||||
// We dispatch a timeout with a specified delay of 0 for engines that
|
||||
// can reliably accommodate that request. This will usually be snapped
|
||||
// to a 4 milisecond delay, but once we're flushing, there's no delay
|
||||
// between events.
|
||||
const timeoutHandle = setTimeout(handleTimer, 0);
|
||||
// However, since this timer gets frequently dropped in Firefox
|
||||
// workers, we enlist an interval handle that will try to fire
|
||||
// an event 20 times per second until it succeeds.
|
||||
const intervalHandle = setInterval(handleTimer, 50);
|
||||
function handleTimer() {
|
||||
// Whichever timer succeeds will cancel both timers and
|
||||
// execute the callback.
|
||||
clearTimeout(timeoutHandle);
|
||||
clearInterval(intervalHandle);
|
||||
callback();
|
||||
}
|
||||
};
|
||||
}
|
||||
// To request a high priority event, we induce a mutation observer by toggling
|
||||
// the text of a text node between "1" and "-1".
|
||||
export function makeRequestCallFromMutationObserver(callback) {
|
||||
let toggle = 1;
|
||||
const observer = new BrowserMutationObserver(callback);
|
||||
const node = document.createTextNode('');
|
||||
observer.observe(node, {
|
||||
characterData: true
|
||||
});
|
||||
return function requestCall() {
|
||||
toggle = -toggle;
|
||||
node.data = toggle;
|
||||
};
|
||||
}
|
||||
export const makeRequestCall = typeof BrowserMutationObserver === 'function' ? // reliably everywhere they are implemented.
|
||||
// They are implemented in all modern browsers.
|
||||
//
|
||||
// - Android 4-4.3
|
||||
// - Chrome 26-34
|
||||
// - Firefox 14-29
|
||||
// - Internet Explorer 11
|
||||
// - iPad Safari 6-7.1
|
||||
// - iPhone Safari 7-7.1
|
||||
// - Safari 6-7
|
||||
makeRequestCallFromMutationObserver : // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
|
||||
// 11-12, and in web workers in many engines.
|
||||
// Although message channels yield to any queued rendering and IO tasks, they
|
||||
// would be better than imposing the 4ms delay of timers.
|
||||
// However, they do not work reliably in Internet Explorer or Safari.
|
||||
// Internet Explorer 10 is the only browser that has setImmediate but does
|
||||
// not have MutationObservers.
|
||||
// Although setImmediate yields to the browser's renderer, it would be
|
||||
// preferrable to falling back to setTimeout since it does not have
|
||||
// the minimum 4ms penalty.
|
||||
// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
|
||||
// Desktop to a lesser extent) that renders both setImmediate and
|
||||
// MessageChannel useless for the purposes of ASAP.
|
||||
// https://github.com/kriskowal/q/issues/396
|
||||
// Timers are implemented universally.
|
||||
// We fall back to timers in workers in most engines, and in foreground
|
||||
// contexts in the following browsers.
|
||||
// However, note that even this simple case requires nuances to operate in a
|
||||
// broad spectrum of browsers.
|
||||
//
|
||||
// - Firefox 3-13
|
||||
// - Internet Explorer 6-9
|
||||
// - iPad Safari 4.3
|
||||
// - Lynx 2.8.7
|
||||
makeRequestCallFromTimer;
|
||||
|
||||
//# sourceMappingURL=makeRequestCall.mjs.map
|
||||
1
node_modules/@react-dnd/asap/dist/esm/makeRequestCall.mjs.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/esm/makeRequestCall.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@react-dnd/asap/dist/esm/types.mjs
generated
vendored
Normal file
3
node_modules/@react-dnd/asap/dist/esm/types.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { };
|
||||
|
||||
//# sourceMappingURL=types.mjs.map
|
||||
1
node_modules/@react-dnd/asap/dist/esm/types.mjs.map
generated
vendored
Normal file
1
node_modules/@react-dnd/asap/dist/esm/types.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["export interface Task {\n\tcall(): void\n}\nexport type TaskFn = () => void\n"],"names":[],"mappings":"AAAA,WAG+B"}
|
||||
14
node_modules/@react-dnd/asap/dist/types/AsapQueue.d.ts
generated
vendored
Normal file
14
node_modules/@react-dnd/asap/dist/types/AsapQueue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { Task } from './types.js';
|
||||
export declare class AsapQueue {
|
||||
private queue;
|
||||
private pendingErrors;
|
||||
private flushing;
|
||||
private requestFlush;
|
||||
private requestErrorThrow;
|
||||
private index;
|
||||
private capacity;
|
||||
constructor();
|
||||
enqueueTask(task: Task): void;
|
||||
private flush;
|
||||
registerPendingError: (err: any) => void;
|
||||
}
|
||||
8
node_modules/@react-dnd/asap/dist/types/RawTask.d.ts
generated
vendored
Normal file
8
node_modules/@react-dnd/asap/dist/types/RawTask.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { TaskFn, Task } from 'types';
|
||||
export declare class RawTask implements Task {
|
||||
private onError;
|
||||
private release;
|
||||
task: TaskFn | null;
|
||||
constructor(onError: (err: any) => void, release: (t: RawTask) => void);
|
||||
call(): void;
|
||||
}
|
||||
7
node_modules/@react-dnd/asap/dist/types/TaskFactory.d.ts
generated
vendored
Normal file
7
node_modules/@react-dnd/asap/dist/types/TaskFactory.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Task } from './types.js';
|
||||
export declare class TaskFactory {
|
||||
private onError;
|
||||
private freeTasks;
|
||||
constructor(onError: (err: any) => void);
|
||||
create(task: () => void): Task;
|
||||
}
|
||||
10
node_modules/@react-dnd/asap/dist/types/asap.d.ts
generated
vendored
Normal file
10
node_modules/@react-dnd/asap/dist/types/asap.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { TaskFn } from './types.js';
|
||||
/**
|
||||
* Calls a task as soon as possible after returning, in its own event, with priority
|
||||
* over other events like animation, reflow, and repaint. An error thrown from an
|
||||
* event will not interrupt, nor even substantially slow down the processing of
|
||||
* other events, but will be rather postponed to a lower priority event.
|
||||
* @param {{call}} task A callable object, typically a function that takes no
|
||||
* arguments.
|
||||
*/
|
||||
export declare function asap(task: TaskFn): void;
|
||||
4
node_modules/@react-dnd/asap/dist/types/index.d.ts
generated
vendored
Normal file
4
node_modules/@react-dnd/asap/dist/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './asap.js';
|
||||
export * from './types.js';
|
||||
export * from './AsapQueue.js';
|
||||
export * from './TaskFactory.js';
|
||||
3
node_modules/@react-dnd/asap/dist/types/makeRequestCall.d.ts
generated
vendored
Normal file
3
node_modules/@react-dnd/asap/dist/types/makeRequestCall.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare function makeRequestCallFromTimer(callback: () => void): () => void;
|
||||
export declare function makeRequestCallFromMutationObserver(callback: () => void): () => void;
|
||||
export declare const makeRequestCall: typeof makeRequestCallFromMutationObserver;
|
||||
4
node_modules/@react-dnd/asap/dist/types/types.d.ts
generated
vendored
Normal file
4
node_modules/@react-dnd/asap/dist/types/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export interface Task {
|
||||
call(): void;
|
||||
}
|
||||
export declare type TaskFn = () => void;
|
||||
39
node_modules/@react-dnd/asap/package.json
generated
vendored
Normal file
39
node_modules/@react-dnd/asap/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "@react-dnd/asap",
|
||||
"version": "4.0.1",
|
||||
"description": "High-priority task queue for Node.js and browsers",
|
||||
"keywords": [
|
||||
"event",
|
||||
"task",
|
||||
"queue"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/cjs/index.js",
|
||||
"types": "dist/types/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/esm/index.mjs",
|
||||
"require": "./dist/cjs/index.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "shx rm -rf dist/",
|
||||
"build_types": "tsc -b .",
|
||||
"build_esm": "swc -C module.type=es6 -d dist/esm src/",
|
||||
"build_cjs": "swc -C module.type=commonjs -d dist/cjs src/",
|
||||
"esm_hack": "node ../../scripts/esmify.mjs",
|
||||
"build": "run-s build_types build_esm build_cjs esm_hack"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/react-dnd/react-dnd"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.57",
|
||||
"@swc/core": "^1.2.161",
|
||||
"@types/jest": "^24.9.1",
|
||||
"@types/node": "^17.0.23",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"shx": "^0.3.4",
|
||||
"typescript": "^4.6.3"
|
||||
}
|
||||
}
|
||||
165
node_modules/@react-dnd/asap/src/AsapQueue.ts
generated
vendored
Normal file
165
node_modules/@react-dnd/asap/src/AsapQueue.ts
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
/* eslint-disable no-restricted-globals, @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unused-vars, @typescript-eslint/no-non-null-assertion */
|
||||
import type { Task } from './types.js'
|
||||
import { makeRequestCall, makeRequestCallFromTimer } from './makeRequestCall.js'
|
||||
|
||||
export class AsapQueue {
|
||||
private queue: Task[] = []
|
||||
// We queue errors to ensure they are thrown in right order (FIFO).
|
||||
// Array-as-queue is good enough here, since we are just dealing with exceptions.
|
||||
private pendingErrors: any[] = []
|
||||
// Once a flush has been requested, no further calls to `requestFlush` are
|
||||
// necessary until the next `flush` completes.
|
||||
// @ts-ignore
|
||||
private flushing = false
|
||||
// `requestFlush` is an implementation-specific method that attempts to kick
|
||||
// off a `flush` event as quickly as possible. `flush` will attempt to exhaust
|
||||
// the event queue before yielding to the browser's own event loop.
|
||||
private requestFlush: () => void
|
||||
|
||||
private requestErrorThrow: () => void
|
||||
// The position of the next task to execute in the task queue. This is
|
||||
// preserved between calls to `flush` so that it can be resumed if
|
||||
// a task throws an exception.
|
||||
private index = 0
|
||||
// If a task schedules additional tasks recursively, the task queue can grow
|
||||
// unbounded. To prevent memory exhaustion, the task queue will periodically
|
||||
// truncate already-completed tasks.
|
||||
private capacity = 1024
|
||||
|
||||
public constructor() {
|
||||
// `requestFlush` requests that the high priority event queue be flushed as
|
||||
// soon as possible.
|
||||
// This is useful to prevent an error thrown in a task from stalling the event
|
||||
// queue if the exception handled by Node.js’s
|
||||
// `process.on("uncaughtException")` or by a domain.
|
||||
|
||||
// `requestFlush` is implemented using a strategy based on data collected from
|
||||
// every available SauceLabs Selenium web driver worker at time of writing.
|
||||
// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
|
||||
this.requestFlush = makeRequestCall(this.flush)
|
||||
this.requestErrorThrow = makeRequestCallFromTimer(() => {
|
||||
// Throw first error
|
||||
if (this.pendingErrors.length) {
|
||||
throw this.pendingErrors.shift()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Use the fastest means possible to execute a task in its own turn, with
|
||||
// priority over other events including IO, animation, reflow, and redraw
|
||||
// events in browsers.
|
||||
//
|
||||
// An exception thrown by a task will permanently interrupt the processing of
|
||||
// subsequent tasks. The higher level `asap` function ensures that if an
|
||||
// exception is thrown by a task, that the task queue will continue flushing as
|
||||
// soon as possible, but if you use `rawAsap` directly, you are responsible to
|
||||
// either ensure that no exceptions are thrown from your task, or to manually
|
||||
// call `rawAsap.requestFlush` if an exception is thrown.
|
||||
public enqueueTask(task: Task): void {
|
||||
const { queue: q, requestFlush } = this
|
||||
if (!q.length) {
|
||||
requestFlush()
|
||||
this.flushing = true
|
||||
}
|
||||
// Equivalent to push, but avoids a function call.
|
||||
q[q.length] = task
|
||||
}
|
||||
|
||||
// The flush function processes all tasks that have been scheduled with
|
||||
// `rawAsap` unless and until one of those tasks throws an exception.
|
||||
// If a task throws an exception, `flush` ensures that its state will remain
|
||||
// consistent and will resume where it left off when called again.
|
||||
// However, `flush` does not make any arrangements to be called again if an
|
||||
// exception is thrown.
|
||||
private flush = () => {
|
||||
const { queue: q } = this
|
||||
while (this.index < q.length) {
|
||||
const currentIndex = this.index
|
||||
// Advance the index before calling the task. This ensures that we will
|
||||
// begin flushing on the next task the task throws an error.
|
||||
this.index++
|
||||
q[currentIndex]!.call()
|
||||
// Prevent leaking memory for long chains of recursive calls to `asap`.
|
||||
// If we call `asap` within tasks scheduled by `asap`, the queue will
|
||||
// grow, but to avoid an O(n) walk for every task we execute, we don't
|
||||
// shift tasks off the queue after they have been executed.
|
||||
// Instead, we periodically shift 1024 tasks off the queue.
|
||||
if (this.index > this.capacity) {
|
||||
// Manually shift all values starting at the index back to the
|
||||
// beginning of the queue.
|
||||
for (
|
||||
let scan = 0, newLength = q.length - this.index;
|
||||
scan < newLength;
|
||||
scan++
|
||||
) {
|
||||
q[scan] = q[scan + this.index]!
|
||||
}
|
||||
q.length -= this.index
|
||||
this.index = 0
|
||||
}
|
||||
}
|
||||
q.length = 0
|
||||
this.index = 0
|
||||
this.flushing = false
|
||||
}
|
||||
|
||||
// In a web browser, exceptions are not fatal. However, to avoid
|
||||
// slowing down the queue of pending tasks, we rethrow the error in a
|
||||
// lower priority turn.
|
||||
public registerPendingError = (err: any) => {
|
||||
this.pendingErrors.push(err)
|
||||
this.requestErrorThrow()
|
||||
}
|
||||
}
|
||||
|
||||
// The message channel technique was discovered by Malte Ubl and was the
|
||||
// original foundation for this library.
|
||||
// http://www.nonblocking.io/2011/06/windownexttick.html
|
||||
|
||||
// Safari 6.0.5 (at least) intermittently fails to create message ports on a
|
||||
// page's first load. Thankfully, this version of Safari supports
|
||||
// MutationObservers, so we don't need to fall back in that case.
|
||||
|
||||
// function makeRequestCallFromMessageChannel(callback) {
|
||||
// var channel = new MessageChannel();
|
||||
// channel.port1.onmessage = callback;
|
||||
// return function requestCall() {
|
||||
// channel.port2.postMessage(0);
|
||||
// };
|
||||
// }
|
||||
|
||||
// For reasons explained above, we are also unable to use `setImmediate`
|
||||
// under any circumstances.
|
||||
// Even if we were, there is another bug in Internet Explorer 10.
|
||||
// It is not sufficient to assign `setImmediate` to `requestFlush` because
|
||||
// `setImmediate` must be called *by name* and therefore must be wrapped in a
|
||||
// closure.
|
||||
// Never forget.
|
||||
|
||||
// function makeRequestCallFromSetImmediate(callback) {
|
||||
// return function requestCall() {
|
||||
// setImmediate(callback);
|
||||
// };
|
||||
// }
|
||||
|
||||
// Safari 6.0 has a problem where timers will get lost while the user is
|
||||
// scrolling. This problem does not impact ASAP because Safari 6.0 supports
|
||||
// mutation observers, so that implementation is used instead.
|
||||
// However, if we ever elect to use timers in Safari, the prevalent work-around
|
||||
// is to add a scroll event listener that calls for a flush.
|
||||
|
||||
// `setTimeout` does not call the passed callback if the delay is less than
|
||||
// approximately 7 in web workers in Firefox 8 through 18, and sometimes not
|
||||
// even then.
|
||||
|
||||
// This is for `asap.js` only.
|
||||
// Its name will be periodically randomized to break any code that depends on
|
||||
// // its existence.
|
||||
// rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer
|
||||
|
||||
// ASAP was originally a nextTick shim included in Q. This was factored out
|
||||
// into this ASAP package. It was later adapted to RSVP which made further
|
||||
// amendments. These decisions, particularly to marginalize MessageChannel and
|
||||
// to capture the MutationObserver implementation in a closure, were integrated
|
||||
// back into ASAP proper.
|
||||
// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
|
||||
24
node_modules/@react-dnd/asap/src/RawTask.ts
generated
vendored
Normal file
24
node_modules/@react-dnd/asap/src/RawTask.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// We wrap tasks with recyclable task objects. A task object implements
|
||||
|
||||
import type { TaskFn, Task } from 'types'
|
||||
|
||||
// `call`, just like a function.
|
||||
export class RawTask implements Task {
|
||||
public task: TaskFn | null = null
|
||||
|
||||
public constructor(
|
||||
private onError: (err: any) => void,
|
||||
private release: (t: RawTask) => void,
|
||||
) {}
|
||||
|
||||
public call() {
|
||||
try {
|
||||
this.task && this.task()
|
||||
} catch (error) {
|
||||
this.onError(error)
|
||||
} finally {
|
||||
this.task = null
|
||||
this.release(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
17
node_modules/@react-dnd/asap/src/TaskFactory.ts
generated
vendored
Normal file
17
node_modules/@react-dnd/asap/src/TaskFactory.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { Task } from './types.js'
|
||||
import { RawTask } from './RawTask.js'
|
||||
|
||||
export class TaskFactory {
|
||||
private freeTasks: RawTask[] = []
|
||||
|
||||
public constructor(private onError: (err: any) => void) {}
|
||||
|
||||
public create(task: () => void): Task {
|
||||
const tasks = this.freeTasks
|
||||
const t = tasks.length
|
||||
? (tasks.pop() as RawTask)
|
||||
: new RawTask(this.onError, (t) => (tasks[tasks.length] = t))
|
||||
t.task = task
|
||||
return t
|
||||
}
|
||||
}
|
||||
18
node_modules/@react-dnd/asap/src/asap.ts
generated
vendored
Normal file
18
node_modules/@react-dnd/asap/src/asap.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { AsapQueue } from './AsapQueue.js'
|
||||
import { TaskFactory } from './TaskFactory.js'
|
||||
import type { TaskFn } from './types.js'
|
||||
|
||||
const asapQueue = new AsapQueue()
|
||||
const taskFactory = new TaskFactory(asapQueue.registerPendingError)
|
||||
|
||||
/**
|
||||
* Calls a task as soon as possible after returning, in its own event, with priority
|
||||
* over other events like animation, reflow, and repaint. An error thrown from an
|
||||
* event will not interrupt, nor even substantially slow down the processing of
|
||||
* other events, but will be rather postponed to a lower priority event.
|
||||
* @param {{call}} task A callable object, typically a function that takes no
|
||||
* arguments.
|
||||
*/
|
||||
export function asap(task: TaskFn) {
|
||||
asapQueue.enqueueTask(taskFactory.create(task))
|
||||
}
|
||||
4
node_modules/@react-dnd/asap/src/index.ts
generated
vendored
Normal file
4
node_modules/@react-dnd/asap/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './asap.js'
|
||||
export * from './types.js'
|
||||
export * from './AsapQueue.js'
|
||||
export * from './TaskFactory.js'
|
||||
87
node_modules/@react-dnd/asap/src/makeRequestCall.ts
generated
vendored
Normal file
87
node_modules/@react-dnd/asap/src/makeRequestCall.ts
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
|
||||
// have WebKitMutationObserver but not un-prefixed MutationObserver.
|
||||
// Must use `global` or `self` instead of `window` to work in both frames and web
|
||||
// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
|
||||
|
||||
/* globals self */
|
||||
const scope = typeof global !== 'undefined' ? global : self
|
||||
const BrowserMutationObserver =
|
||||
(scope as any).MutationObserver || (scope as any).WebKitMutationObserver
|
||||
|
||||
export function makeRequestCallFromTimer(callback: () => void) {
|
||||
return function requestCall() {
|
||||
// We dispatch a timeout with a specified delay of 0 for engines that
|
||||
// can reliably accommodate that request. This will usually be snapped
|
||||
// to a 4 milisecond delay, but once we're flushing, there's no delay
|
||||
// between events.
|
||||
const timeoutHandle = setTimeout(handleTimer, 0)
|
||||
// However, since this timer gets frequently dropped in Firefox
|
||||
// workers, we enlist an interval handle that will try to fire
|
||||
// an event 20 times per second until it succeeds.
|
||||
const intervalHandle = setInterval(handleTimer, 50)
|
||||
|
||||
function handleTimer() {
|
||||
// Whichever timer succeeds will cancel both timers and
|
||||
// execute the callback.
|
||||
clearTimeout(timeoutHandle)
|
||||
clearInterval(intervalHandle)
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// To request a high priority event, we induce a mutation observer by toggling
|
||||
// the text of a text node between "1" and "-1".
|
||||
export function makeRequestCallFromMutationObserver(callback: () => void) {
|
||||
let toggle = 1
|
||||
const observer = new BrowserMutationObserver(callback)
|
||||
const node = document.createTextNode('')
|
||||
observer.observe(node, { characterData: true })
|
||||
return function requestCall() {
|
||||
toggle = -toggle
|
||||
;(node as any).data = toggle
|
||||
}
|
||||
}
|
||||
|
||||
export const makeRequestCall =
|
||||
typeof BrowserMutationObserver === 'function'
|
||||
? // MutationObservers are desirable because they have high priority and work
|
||||
// reliably everywhere they are implemented.
|
||||
// They are implemented in all modern browsers.
|
||||
//
|
||||
// - Android 4-4.3
|
||||
// - Chrome 26-34
|
||||
// - Firefox 14-29
|
||||
// - Internet Explorer 11
|
||||
// - iPad Safari 6-7.1
|
||||
// - iPhone Safari 7-7.1
|
||||
// - Safari 6-7
|
||||
makeRequestCallFromMutationObserver
|
||||
: // MessageChannels are desirable because they give direct access to the HTML
|
||||
// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
|
||||
// 11-12, and in web workers in many engines.
|
||||
// Although message channels yield to any queued rendering and IO tasks, they
|
||||
// would be better than imposing the 4ms delay of timers.
|
||||
// However, they do not work reliably in Internet Explorer or Safari.
|
||||
|
||||
// Internet Explorer 10 is the only browser that has setImmediate but does
|
||||
// not have MutationObservers.
|
||||
// Although setImmediate yields to the browser's renderer, it would be
|
||||
// preferrable to falling back to setTimeout since it does not have
|
||||
// the minimum 4ms penalty.
|
||||
// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
|
||||
// Desktop to a lesser extent) that renders both setImmediate and
|
||||
// MessageChannel useless for the purposes of ASAP.
|
||||
// https://github.com/kriskowal/q/issues/396
|
||||
|
||||
// Timers are implemented universally.
|
||||
// We fall back to timers in workers in most engines, and in foreground
|
||||
// contexts in the following browsers.
|
||||
// However, note that even this simple case requires nuances to operate in a
|
||||
// broad spectrum of browsers.
|
||||
//
|
||||
// - Firefox 3-13
|
||||
// - Internet Explorer 6-9
|
||||
// - iPad Safari 4.3
|
||||
// - Lynx 2.8.7
|
||||
makeRequestCallFromTimer
|
||||
4
node_modules/@react-dnd/asap/src/types.ts
generated
vendored
Normal file
4
node_modules/@react-dnd/asap/src/types.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export interface Task {
|
||||
call(): void
|
||||
}
|
||||
export type TaskFn = () => void
|
||||
10
node_modules/@react-dnd/asap/tsconfig.json
generated
vendored
Normal file
10
node_modules/@react-dnd/asap/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./src",
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "dist/types",
|
||||
"types": ["node", "jest"]
|
||||
},
|
||||
"include": ["./src"]
|
||||
}
|
||||
26
node_modules/@react-dnd/invariant/.github/workflows/nodejs.yml
generated
vendored
Normal file
26
node_modules/@react-dnd/invariant/.github/workflows/nodejs.yml
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Node CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [8.x, 10.x, 12.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: npm install, build, and test
|
||||
run: |
|
||||
yarn install
|
||||
yarn build
|
||||
yarn test
|
||||
env:
|
||||
CI: true
|
||||
69
node_modules/@react-dnd/invariant/CHANGELOG.md
generated
vendored
Normal file
69
node_modules/@react-dnd/invariant/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
2.2.4 / 2018-03-13
|
||||
==================
|
||||
|
||||
* Use flow strict mode (i.e. `@flow strict`).
|
||||
|
||||
2.2.3 / 2018-02-19
|
||||
==================
|
||||
|
||||
* Change license from BSD+Patents to MIT.
|
||||
|
||||
2.2.2 / 2016-11-15
|
||||
==================
|
||||
|
||||
* Add LICENSE file.
|
||||
* Misc housekeeping.
|
||||
|
||||
2.2.1 / 2016-03-09
|
||||
==================
|
||||
|
||||
* Use `NODE_ENV` variable instead of `__DEV__` to cache `process.env.NODE_ENV`.
|
||||
|
||||
2.2.0 / 2015-11-17
|
||||
==================
|
||||
|
||||
* Use `error.name` instead of `Invariant Violation`.
|
||||
|
||||
2.1.3 / 2015-11-17
|
||||
==================
|
||||
|
||||
* Remove `@provideModule` pragma.
|
||||
|
||||
2.1.2 / 2015-10-27
|
||||
==================
|
||||
|
||||
* Fix license.
|
||||
|
||||
2.1.1 / 2015-09-20
|
||||
==================
|
||||
|
||||
* Use correct SPDX license.
|
||||
* Test "browser.js" using browserify.
|
||||
* Switch from "envify" to "loose-envify".
|
||||
|
||||
2.1.0 / 2015-06-03
|
||||
==================
|
||||
|
||||
* Add "envify" as a dependency.
|
||||
* Fixed license field in "package.json".
|
||||
|
||||
2.0.0 / 2015-02-21
|
||||
==================
|
||||
|
||||
* Switch to using the "browser" field. There are now browser and server versions that respect the "format" in production.
|
||||
|
||||
1.0.2 / 2014-09-24
|
||||
==================
|
||||
|
||||
* Added tests, npmignore and gitignore.
|
||||
* Clarifications in README.
|
||||
|
||||
1.0.1 / 2014-09-24
|
||||
==================
|
||||
|
||||
* Actually include 'invariant.js'.
|
||||
|
||||
1.0.0 / 2014-09-24
|
||||
==================
|
||||
|
||||
* Initial release.
|
||||
21
node_modules/@react-dnd/invariant/LICENSE
generated
vendored
Normal file
21
node_modules/@react-dnd/invariant/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2013-present, Facebook, Inc.
|
||||
|
||||
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.
|
||||
39
node_modules/@react-dnd/invariant/README.md
generated
vendored
Normal file
39
node_modules/@react-dnd/invariant/README.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# invariant
|
||||
|
||||
[](https://actions-badge.atrox.dev/react-dnd/invariant/goto)
|
||||
|
||||
A mirror of Facebook's `invariant` (e.g. [React](https://github.com/facebook/react/blob/v0.13.3/src/vendor/core/invariant.js), [flux](https://github.com/facebook/flux/blob/2.0.2/src/invariant.js)).
|
||||
|
||||
A way to provide descriptive errors in development but generic errors in production.
|
||||
|
||||
## Note: This has been forked by react-dnd for ESM and TypeScript support
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
```sh
|
||||
npm install invariant
|
||||
```
|
||||
|
||||
## `invariant(condition, message)`
|
||||
|
||||
```js
|
||||
var invariant = require('invariant');
|
||||
|
||||
invariant(someTruthyVal, 'This will not throw');
|
||||
// No errors
|
||||
|
||||
invariant(someFalseyVal, 'This will throw an error with this message');
|
||||
// Error: Invariant Violation: This will throw an error with this message
|
||||
```
|
||||
|
||||
**Note:** When `process.env.NODE_ENV` is not `production`, the message is required. If omitted, `invariant` will throw regardless of the truthiness of the condition. When `process.env.NODE_ENV` is `production`, the message is optional – so they can be minified away.
|
||||
|
||||
### Browser
|
||||
|
||||
When used with [browserify](https://github.com/substack/node-browserify), it'll use `browser.js` (instead of `invariant.js`) and the [envify](https://github.com/hughsk/envify) transform will inline the value of `process.env.NODE_ENV`.
|
||||
|
||||
### Node
|
||||
|
||||
The node version is optimized around the performance implications of accessing `process.env`. The value of `process.env.NODE_ENV` is cached, and repeatedly used instead of reading `process.env`. See [Server rendering is slower with npm react #812](https://github.com/facebook/react/issues/812)
|
||||
11
node_modules/@react-dnd/invariant/dist/index.d.ts
generated
vendored
Normal file
11
node_modules/@react-dnd/invariant/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
export declare function invariant(condition: any, format: string, ...args: any[]): void;
|
||||
8
node_modules/@react-dnd/invariant/dist/index.js
generated
vendored
Normal file
8
node_modules/@react-dnd/invariant/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./invariant.cjs.production.min.js')
|
||||
} else {
|
||||
module.exports = require('./invariant.cjs.development.js')
|
||||
}
|
||||
44
node_modules/@react-dnd/invariant/dist/invariant.cjs.development.js
generated
vendored
Normal file
44
node_modules/@react-dnd/invariant/dist/invariant.cjs.development.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
function invariant(condition, format) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
|
||||
{
|
||||
if (format === undefined) {
|
||||
throw new Error('invariant requires an error message argument');
|
||||
}
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
var error;
|
||||
|
||||
if (format === undefined) {
|
||||
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
||||
} else {
|
||||
var argIndex = 0;
|
||||
error = new Error(format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
}));
|
||||
error.name = 'Invariant Violation';
|
||||
}
|
||||
|
||||
error.framesToPop = 1; // we don't care about invariant's own frame
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
exports.invariant = invariant;
|
||||
//# sourceMappingURL=invariant.cjs.development.js.map
|
||||
1
node_modules/@react-dnd/invariant/dist/invariant.cjs.development.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/invariant/dist/invariant.cjs.development.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"invariant.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nexport function invariant(condition: any, format: string, ...args: any[]) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n let error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n let argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() {\n return args[argIndex++];\n })\n );\n error.name = 'Invariant Violation';\n }\n\n (error as any).framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n"],"names":["invariant","condition","format","args","undefined","Error","error","argIndex","replace","name","framesToPop"],"mappings":";;AAAA;;;;;;;;;;AAWA,SAAgBA,UAAUC,WAAgBC;oCAAmBC;IAAAA;;;EAChB;QACrCD,MAAM,KAAKE,SAAf,EAA0B;YAClB,IAAIC,KAAJ,CAAU,8CAAV,CAAN;;;;MAIA,CAACJ,SAAL,EAAgB;QACVK,KAAJ;;QACIJ,MAAM,KAAKE,SAAf,EAA0B;MACxBE,KAAK,GAAG,IAAID,KAAJ,CACN,uEACE,6DAFI,CAAR;KADF,MAKO;UACDE,QAAQ,GAAG,CAAf;MACAD,KAAK,GAAG,IAAID,KAAJ,CACNH,MAAM,CAACM,OAAP,CAAe,KAAf,EAAsB;eACbL,IAAI,CAACI,QAAQ,EAAT,CAAX;OADF,CADM,CAAR;MAKAD,KAAK,CAACG,IAAN,GAAa,qBAAb;;;IAGDH,KAAa,CAACI,WAAd,GAA4B,CAA5B,CAjBa;;UAkBRJ,KAAN;;;;;;"}
|
||||
2
node_modules/@react-dnd/invariant/dist/invariant.cjs.production.min.js
generated
vendored
Normal file
2
node_modules/@react-dnd/invariant/dist/invariant.cjs.production.min.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";exports.invariant=function(r,e){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];if(!r){var a;if(void 0===e)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var t=0;(a=new Error(e.replace(/%s/g,(function(){return i[t++]})))).name="Invariant Violation"}throw a.framesToPop=1,a}};
|
||||
//# sourceMappingURL=invariant.cjs.production.min.js.map
|
||||
1
node_modules/@react-dnd/invariant/dist/invariant.cjs.production.min.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/invariant/dist/invariant.cjs.production.min.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"invariant.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nexport function invariant(condition: any, format: string, ...args: any[]) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n let error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n let argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() {\n return args[argIndex++];\n })\n );\n error.name = 'Invariant Violation';\n }\n\n (error as any).framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n"],"names":["condition","format","args","error","undefined","Error","argIndex","replace","name","framesToPop"],"mappings":"wCAW0BA,EAAgBC,8BAAmBC,mCAAAA,wBAOtDF,EAAW,KACVG,UACWC,IAAXH,EACFE,EAAQ,IAAIE,MACV,qIAGG,KACDC,EAAW,GACfH,EAAQ,IAAIE,MACVJ,EAAOM,QAAQ,OAAO,kBACbL,EAAKI,UAGVE,KAAO,4BAGdL,EAAcM,YAAc,EACvBN"}
|
||||
42
node_modules/@react-dnd/invariant/dist/invariant.esm.js
generated
vendored
Normal file
42
node_modules/@react-dnd/invariant/dist/invariant.esm.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
function invariant(condition, format) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (format === undefined) {
|
||||
throw new Error('invariant requires an error message argument');
|
||||
}
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
var error;
|
||||
|
||||
if (format === undefined) {
|
||||
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
||||
} else {
|
||||
var argIndex = 0;
|
||||
error = new Error(format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
}));
|
||||
error.name = 'Invariant Violation';
|
||||
}
|
||||
|
||||
error.framesToPop = 1; // we don't care about invariant's own frame
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export { invariant };
|
||||
//# sourceMappingURL=invariant.esm.js.map
|
||||
1
node_modules/@react-dnd/invariant/dist/invariant.esm.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/invariant/dist/invariant.esm.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"invariant.esm.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nexport function invariant(condition: any, format: string, ...args: any[]) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n let error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n let argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() {\n return args[argIndex++];\n })\n );\n error.name = 'Invariant Violation';\n }\n\n (error as any).framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n"],"names":["invariant","condition","format","args","process","env","NODE_ENV","undefined","Error","error","argIndex","replace","name","framesToPop"],"mappings":"AAAA;;;;;;;;;;AAWA,SAAgBA,UAAUC,WAAgBC;oCAAmBC;IAAAA;;;MACvDC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;QACrCJ,MAAM,KAAKK,SAAf,EAA0B;YAClB,IAAIC,KAAJ,CAAU,8CAAV,CAAN;;;;MAIA,CAACP,SAAL,EAAgB;QACVQ,KAAJ;;QACIP,MAAM,KAAKK,SAAf,EAA0B;MACxBE,KAAK,GAAG,IAAID,KAAJ,CACN,uEACE,6DAFI,CAAR;KADF,MAKO;UACDE,QAAQ,GAAG,CAAf;MACAD,KAAK,GAAG,IAAID,KAAJ,CACNN,MAAM,CAACS,OAAP,CAAe,KAAf,EAAsB;eACbR,IAAI,CAACO,QAAQ,EAAT,CAAX;OADF,CADM,CAAR;MAKAD,KAAK,CAACG,IAAN,GAAa,qBAAb;;;IAGDH,KAAa,CAACI,WAAd,GAA4B,CAA5B,CAjBa;;UAkBRJ,KAAN;;;;;;"}
|
||||
1
node_modules/@react-dnd/invariant/dist/test/development.spec.d.ts
generated
vendored
Normal file
1
node_modules/@react-dnd/invariant/dist/test/development.spec.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
node_modules/@react-dnd/invariant/dist/test/production.spec.d.ts
generated
vendored
Normal file
1
node_modules/@react-dnd/invariant/dist/test/production.spec.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
41
node_modules/@react-dnd/invariant/package.json
generated
vendored
Normal file
41
node_modules/@react-dnd/invariant/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "@react-dnd/invariant",
|
||||
"version": "2.0.0",
|
||||
"private": false,
|
||||
"description": "invariantx",
|
||||
"keywords": [
|
||||
"test",
|
||||
"invariant"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": "Andres Suarez <zertosh@gmail.com>",
|
||||
"repository": "https://github.com/react-dnd/invariant",
|
||||
"scripts": {
|
||||
"start": "tsdx watch",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test",
|
||||
"lint": "tsdx lint"
|
||||
},
|
||||
"peerDependencies": {},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "tsdx lint"
|
||||
}
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 80,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^24.0.23",
|
||||
"husky": "^3.1.0",
|
||||
"tsdx": "^0.11.0",
|
||||
"tslib": "^1.10.0",
|
||||
"typescript": "^3.7.2"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/invariant.esm.js",
|
||||
"typings": "dist/index.d.ts"
|
||||
}
|
||||
39
node_modules/@react-dnd/invariant/src/index.ts
generated
vendored
Normal file
39
node_modules/@react-dnd/invariant/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
|
||||
export function invariant(condition: any, format: string, ...args: any[]) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (format === undefined) {
|
||||
throw new Error('invariant requires an error message argument');
|
||||
}
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
let error;
|
||||
if (format === undefined) {
|
||||
error = new Error(
|
||||
'Minified exception occurred; use the non-minified dev environment ' +
|
||||
'for the full error message and additional helpful warnings.'
|
||||
);
|
||||
} else {
|
||||
let argIndex = 0;
|
||||
error = new Error(
|
||||
format.replace(/%s/g, function() {
|
||||
return args[argIndex++];
|
||||
})
|
||||
);
|
||||
error.name = 'Invariant Violation';
|
||||
}
|
||||
|
||||
(error as any).framesToPop = 1; // we don't care about invariant's own frame
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
35
node_modules/@react-dnd/invariant/test/development.spec.ts
generated
vendored
Normal file
35
node_modules/@react-dnd/invariant/test/development.spec.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import invariant from '../src';
|
||||
|
||||
describe('development mode', () => {
|
||||
const OLD_ENV = process.env;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetModules(); // this is important - it clears the cache
|
||||
process.env = { ...OLD_ENV };
|
||||
delete process.env.NODE_ENV;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.env = OLD_ENV;
|
||||
});
|
||||
|
||||
it('works', () => {
|
||||
process.env.NODE_ENV = 'development';
|
||||
|
||||
expect(function() {
|
||||
invariant(true, 'invariant message');
|
||||
}).not.toThrow();
|
||||
|
||||
expect(function() {
|
||||
invariant(false, 'invariant message');
|
||||
}).toThrow(/invariant message/);
|
||||
|
||||
expect(function() {
|
||||
(invariant as any)(true);
|
||||
}).toThrow(/requires an error/i);
|
||||
|
||||
expect(function() {
|
||||
(invariant as any)(false);
|
||||
}).toThrow(/requires an error/i);
|
||||
});
|
||||
});
|
||||
35
node_modules/@react-dnd/invariant/test/production.spec.ts
generated
vendored
Normal file
35
node_modules/@react-dnd/invariant/test/production.spec.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import invariant from '../src';
|
||||
|
||||
describe('production mode', () => {
|
||||
const OLD_ENV = process.env;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetModules(); // this is important - it clears the cache
|
||||
process.env = { ...OLD_ENV };
|
||||
delete process.env.NODE_ENV;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.env = OLD_ENV;
|
||||
});
|
||||
|
||||
it('works', () => {
|
||||
process.env.NODE_ENV = 'production';
|
||||
|
||||
expect(function() {
|
||||
invariant(true, 'invariant message');
|
||||
}).not.toThrow();
|
||||
|
||||
expect(function() {
|
||||
invariant(false, 'invariant message');
|
||||
}).toThrow(/invariant message/);
|
||||
|
||||
expect(function() {
|
||||
(invariant as any)(true);
|
||||
}).not.toThrow();
|
||||
|
||||
expect(function() {
|
||||
(invariant as any)(false);
|
||||
}).toThrow(/minified exception occurred/i);
|
||||
});
|
||||
});
|
||||
30
node_modules/@react-dnd/invariant/tsconfig.json
generated
vendored
Normal file
30
node_modules/@react-dnd/invariant/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"include": ["src", "types", "test"],
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"lib": ["dom", "esnext"],
|
||||
"importHelpers": true,
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"rootDir": "./",
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"moduleResolution": "node",
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"jsx": "react",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
||||
26
node_modules/@react-dnd/shallowequal/.github/workflows/nodejs.yml
generated
vendored
Normal file
26
node_modules/@react-dnd/shallowequal/.github/workflows/nodejs.yml
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Node CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [8.x, 10.x, 12.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: npm install, build, and test
|
||||
run: |
|
||||
yarn install
|
||||
yarn build
|
||||
yarn test
|
||||
env:
|
||||
CI: true
|
||||
21
node_modules/@react-dnd/shallowequal/LICENSE
generated
vendored
Normal file
21
node_modules/@react-dnd/shallowequal/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Alberto Leal <mailforalberto@gmail.com> (github.com/dashed)
|
||||
|
||||
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.
|
||||
64
node_modules/@react-dnd/shallowequal/README.md
generated
vendored
Normal file
64
node_modules/@react-dnd/shallowequal/README.md
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# shallowequal [](https://travis-ci.org/dashed/shallowequal) [](https://npmjs.com/shallowequal) [](https://www.npmjs.com/package/shallowequal)
|
||||
|
||||
> `shallowequal` is like lodash's [`isEqual`](https://lodash.com/docs/3.10.1#isEqual) (v3.10.1) but for shallow (strict) equal.
|
||||
|
||||
`shallowequal(value, other, [customizer], [thisArg])`
|
||||
|
||||
Performs a **_shallow equality_** comparison between two values (i.e. `value` and `other`) to determine if they are equivalent.
|
||||
|
||||
The equality check returns true if `value` and `other` are already strictly equal, OR when all the following are true:
|
||||
|
||||
- `value` and `other` are both objects with the same keys
|
||||
- For each key, the value in `value` and `other` are **strictly equal** (`===`)
|
||||
|
||||
If `customizer` (expected to be a function) is provided it is invoked to compare values. If `customizer` returns `undefined` (i.e. `void 0`), then comparisons are handled by the `shallowequal` function instead.
|
||||
|
||||
The `customizer` is bound to `thisArg` and invoked with three arguments: `(value, other, key)`.
|
||||
|
||||
**NOTE:** Docs are (shamelessly) adapted from [lodash's v3.x docs](https://lodash.com/docs/3.10.1#isEqual)
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ yarn add shallowequal
|
||||
# npm v5+
|
||||
$ npm install shallowequal
|
||||
# before npm v5
|
||||
$ npm install --save shallowequal
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const shallowequal = require("shallowequal");
|
||||
|
||||
const object = { user: "fred" };
|
||||
const other = { user: "fred" };
|
||||
|
||||
object == other;
|
||||
// → false
|
||||
|
||||
shallowequal(object, other);
|
||||
// → true
|
||||
```
|
||||
|
||||
## Credit
|
||||
|
||||
Code for `shallowEqual` originated from https://github.com/gaearon/react-pure-render/ and has since been refactored to have the exact same API as `lodash.isEqualWith` (as of `v4.17.4`).
|
||||
|
||||
## Development
|
||||
|
||||
- `node.js` and `npm`. See: https://github.com/creationix/nvm#installation
|
||||
- `yarn`. See: https://yarnpkg.com/en/docs/install
|
||||
- `npm` dependencies. Run: `yarn install`
|
||||
|
||||
### Chores
|
||||
|
||||
- Lint: `yarn lint`
|
||||
- Test: `yarn test`
|
||||
- Pretty: `yarn pretty`
|
||||
- Prepare: `yarn prepare`
|
||||
|
||||
## License
|
||||
|
||||
MIT.
|
||||
1
node_modules/@react-dnd/shallowequal/dist/index.d.ts
generated
vendored
Normal file
1
node_modules/@react-dnd/shallowequal/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function shallowEqual<T>(objA: T, objB: T, compare?: (a: T, b: T, key?: string) => boolean | void, compareContext?: any): boolean;
|
||||
8
node_modules/@react-dnd/shallowequal/dist/index.js
generated
vendored
Normal file
8
node_modules/@react-dnd/shallowequal/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./shallowequal.cjs.production.min.js')
|
||||
} else {
|
||||
module.exports = require('./shallowequal.cjs.development.js')
|
||||
}
|
||||
47
node_modules/@react-dnd/shallowequal/dist/shallowequal.cjs.development.js
generated
vendored
Normal file
47
node_modules/@react-dnd/shallowequal/dist/shallowequal.cjs.development.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
function shallowEqual(objA, objB, compare, compareContext) {
|
||||
var compareResult = compare ? compare.call(compareContext, objA, objB) : void 0;
|
||||
|
||||
if (compareResult !== void 0) {
|
||||
return !!compareResult;
|
||||
}
|
||||
|
||||
if (objA === objB) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var keysA = Object.keys(objA);
|
||||
var keysB = Object.keys(objB);
|
||||
|
||||
if (keysA.length !== keysB.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B.
|
||||
|
||||
for (var idx = 0; idx < keysA.length; idx++) {
|
||||
var key = keysA[idx];
|
||||
|
||||
if (!bHasOwnProperty(key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var valueA = objA[key];
|
||||
var valueB = objB[key];
|
||||
compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
||||
|
||||
if (compareResult === false || compareResult === void 0 && valueA !== valueB) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
exports.shallowEqual = shallowEqual;
|
||||
//# sourceMappingURL=shallowequal.cjs.development.js.map
|
||||
1
node_modules/@react-dnd/shallowequal/dist/shallowequal.cjs.development.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/shallowequal/dist/shallowequal.cjs.development.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"shallowequal.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["export function shallowEqual<T>(\n objA: T,\n objB: T,\n compare?: (a: T, b: T, key?: string) => boolean | void,\n compareContext?: any\n) {\n var compareResult = compare\n ? compare.call(compareContext, objA, objB)\n : void 0;\n if (compareResult !== void 0) {\n return !!compareResult;\n }\n\n if (objA === objB) {\n return true;\n }\n\n if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);\n\n // Test for A's keys different from B.\n for (var idx = 0; idx < keysA.length; idx++) {\n var key = keysA[idx];\n\n if (!bHasOwnProperty(key)) {\n return false;\n }\n\n var valueA = (objA as any)[key];\n var valueB = (objB as any)[key];\n\n compareResult = compare\n ? compare.call(compareContext, valueA, valueB, key)\n : void 0;\n\n if (\n compareResult === false ||\n (compareResult === void 0 && valueA !== valueB)\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["shallowEqual","objA","objB","compare","compareContext","compareResult","call","keysA","Object","keys","keysB","length","bHasOwnProperty","prototype","hasOwnProperty","bind","idx","key","valueA","valueB"],"mappings":";;SAAgBA,aACdC,MACAC,MACAC,SACAC;MAEIC,aAAa,GAAGF,OAAO,GACvBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6BH,IAA7B,EAAmCC,IAAnC,CADuB,GAEvB,KAAK,CAFT;;MAGIG,aAAa,KAAK,KAAK,CAA3B,EAA8B;WACrB,CAAC,CAACA,aAAT;;;MAGEJ,IAAI,KAAKC,IAAb,EAAmB;WACV,IAAP;;;MAGE,OAAOD,IAAP,KAAgB,QAAhB,IAA4B,CAACA,IAA7B,IAAqC,OAAOC,IAAP,KAAgB,QAArD,IAAiE,CAACA,IAAtE,EAA4E;WACnE,KAAP;;;MAGEK,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAYR,IAAZ,CAAZ;MACIS,KAAK,GAAGF,MAAM,CAACC,IAAP,CAAYP,IAAZ,CAAZ;;MAEIK,KAAK,CAACI,MAAN,KAAiBD,KAAK,CAACC,MAA3B,EAAmC;WAC1B,KAAP;;;MAGEC,eAAe,GAAGJ,MAAM,CAACK,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCb,IAArC,CAAtB;;OAGK,IAAIc,GAAG,GAAG,CAAf,EAAkBA,GAAG,GAAGT,KAAK,CAACI,MAA9B,EAAsCK,GAAG,EAAzC,EAA6C;QACvCC,GAAG,GAAGV,KAAK,CAACS,GAAD,CAAf;;QAEI,CAACJ,eAAe,CAACK,GAAD,CAApB,EAA2B;aAClB,KAAP;;;QAGEC,MAAM,GAAIjB,IAAY,CAACgB,GAAD,CAA1B;QACIE,MAAM,GAAIjB,IAAY,CAACe,GAAD,CAA1B;IAEAZ,aAAa,GAAGF,OAAO,GACnBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6Bc,MAA7B,EAAqCC,MAArC,EAA6CF,GAA7C,CADmB,GAEnB,KAAK,CAFT;;QAKEZ,aAAa,KAAK,KAAlB,IACCA,aAAa,KAAK,KAAK,CAAvB,IAA4Ba,MAAM,KAAKC,MAF1C,EAGE;aACO,KAAP;;;;SAIG,IAAP;;;;;"}
|
||||
2
node_modules/@react-dnd/shallowequal/dist/shallowequal.cjs.production.min.js
generated
vendored
Normal file
2
node_modules/@react-dnd/shallowequal/dist/shallowequal.cjs.production.min.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";exports.shallowEqual=function(r,t,e,o){var n=e?e.call(o,r,t):void 0;if(void 0!==n)return!!n;if(r===t)return!0;if("object"!=typeof r||!r||"object"!=typeof t||!t)return!1;var i=Object.keys(r),a=Object.keys(t);if(i.length!==a.length)return!1;for(var f=Object.prototype.hasOwnProperty.bind(t),l=0;l<i.length;l++){var u=i[l];if(!f(u))return!1;var c=r[u],v=t[u];if(!1===(n=e?e.call(o,c,v,u):void 0)||void 0===n&&c!==v)return!1}return!0};
|
||||
//# sourceMappingURL=shallowequal.cjs.production.min.js.map
|
||||
1
node_modules/@react-dnd/shallowequal/dist/shallowequal.cjs.production.min.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/shallowequal/dist/shallowequal.cjs.production.min.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"shallowequal.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["export function shallowEqual<T>(\n objA: T,\n objB: T,\n compare?: (a: T, b: T, key?: string) => boolean | void,\n compareContext?: any\n) {\n var compareResult = compare\n ? compare.call(compareContext, objA, objB)\n : void 0;\n if (compareResult !== void 0) {\n return !!compareResult;\n }\n\n if (objA === objB) {\n return true;\n }\n\n if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);\n\n // Test for A's keys different from B.\n for (var idx = 0; idx < keysA.length; idx++) {\n var key = keysA[idx];\n\n if (!bHasOwnProperty(key)) {\n return false;\n }\n\n var valueA = (objA as any)[key];\n var valueB = (objB as any)[key];\n\n compareResult = compare\n ? compare.call(compareContext, valueA, valueB, key)\n : void 0;\n\n if (\n compareResult === false ||\n (compareResult === void 0 && valueA !== valueB)\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["objA","objB","compare","compareContext","compareResult","call","keysA","Object","keys","keysB","length","bHasOwnProperty","prototype","hasOwnProperty","bind","idx","key","valueA","valueB"],"mappings":"2CACEA,EACAC,EACAC,EACAC,OAEIC,EAAgBF,EAChBA,EAAQG,KAAKF,EAAgBH,EAAMC,QACnC,UACkB,IAAlBG,UACOA,KAGPJ,IAASC,SACJ,KAGW,iBAATD,IAAsBA,GAAwB,iBAATC,IAAsBA,SAC7D,MAGLK,EAAQC,OAAOC,KAAKR,GACpBS,EAAQF,OAAOC,KAAKP,MAEpBK,EAAMI,SAAWD,EAAMC,cAClB,UAGLC,EAAkBJ,OAAOK,UAAUC,eAAeC,KAAKb,GAGlDc,EAAM,EAAGA,EAAMT,EAAMI,OAAQK,IAAO,KACvCC,EAAMV,EAAMS,OAEXJ,EAAgBK,UACZ,MAGLC,EAAUjB,EAAagB,GACvBE,EAAUjB,EAAae,OAOP,KALpBZ,EAAgBF,EACZA,EAAQG,KAAKF,EAAgBc,EAAQC,EAAQF,QAC7C,SAIiB,IAAlBZ,GAA4Ba,IAAWC,SAEjC,SAIJ"}
|
||||
45
node_modules/@react-dnd/shallowequal/dist/shallowequal.esm.js
generated
vendored
Normal file
45
node_modules/@react-dnd/shallowequal/dist/shallowequal.esm.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
function shallowEqual(objA, objB, compare, compareContext) {
|
||||
var compareResult = compare ? compare.call(compareContext, objA, objB) : void 0;
|
||||
|
||||
if (compareResult !== void 0) {
|
||||
return !!compareResult;
|
||||
}
|
||||
|
||||
if (objA === objB) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var keysA = Object.keys(objA);
|
||||
var keysB = Object.keys(objB);
|
||||
|
||||
if (keysA.length !== keysB.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B.
|
||||
|
||||
for (var idx = 0; idx < keysA.length; idx++) {
|
||||
var key = keysA[idx];
|
||||
|
||||
if (!bHasOwnProperty(key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var valueA = objA[key];
|
||||
var valueB = objB[key];
|
||||
compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
||||
|
||||
if (compareResult === false || compareResult === void 0 && valueA !== valueB) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export { shallowEqual };
|
||||
//# sourceMappingURL=shallowequal.esm.js.map
|
||||
1
node_modules/@react-dnd/shallowequal/dist/shallowequal.esm.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/shallowequal/dist/shallowequal.esm.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"shallowequal.esm.js","sources":["../src/index.ts"],"sourcesContent":["export function shallowEqual<T>(\n objA: T,\n objB: T,\n compare?: (a: T, b: T, key?: string) => boolean | void,\n compareContext?: any\n) {\n var compareResult = compare\n ? compare.call(compareContext, objA, objB)\n : void 0;\n if (compareResult !== void 0) {\n return !!compareResult;\n }\n\n if (objA === objB) {\n return true;\n }\n\n if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);\n\n // Test for A's keys different from B.\n for (var idx = 0; idx < keysA.length; idx++) {\n var key = keysA[idx];\n\n if (!bHasOwnProperty(key)) {\n return false;\n }\n\n var valueA = (objA as any)[key];\n var valueB = (objB as any)[key];\n\n compareResult = compare\n ? compare.call(compareContext, valueA, valueB, key)\n : void 0;\n\n if (\n compareResult === false ||\n (compareResult === void 0 && valueA !== valueB)\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["shallowEqual","objA","objB","compare","compareContext","compareResult","call","keysA","Object","keys","keysB","length","bHasOwnProperty","prototype","hasOwnProperty","bind","idx","key","valueA","valueB"],"mappings":"SAAgBA,aACdC,MACAC,MACAC,SACAC;MAEIC,aAAa,GAAGF,OAAO,GACvBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6BH,IAA7B,EAAmCC,IAAnC,CADuB,GAEvB,KAAK,CAFT;;MAGIG,aAAa,KAAK,KAAK,CAA3B,EAA8B;WACrB,CAAC,CAACA,aAAT;;;MAGEJ,IAAI,KAAKC,IAAb,EAAmB;WACV,IAAP;;;MAGE,OAAOD,IAAP,KAAgB,QAAhB,IAA4B,CAACA,IAA7B,IAAqC,OAAOC,IAAP,KAAgB,QAArD,IAAiE,CAACA,IAAtE,EAA4E;WACnE,KAAP;;;MAGEK,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAYR,IAAZ,CAAZ;MACIS,KAAK,GAAGF,MAAM,CAACC,IAAP,CAAYP,IAAZ,CAAZ;;MAEIK,KAAK,CAACI,MAAN,KAAiBD,KAAK,CAACC,MAA3B,EAAmC;WAC1B,KAAP;;;MAGEC,eAAe,GAAGJ,MAAM,CAACK,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCb,IAArC,CAAtB;;OAGK,IAAIc,GAAG,GAAG,CAAf,EAAkBA,GAAG,GAAGT,KAAK,CAACI,MAA9B,EAAsCK,GAAG,EAAzC,EAA6C;QACvCC,GAAG,GAAGV,KAAK,CAACS,GAAD,CAAf;;QAEI,CAACJ,eAAe,CAACK,GAAD,CAApB,EAA2B;aAClB,KAAP;;;QAGEC,MAAM,GAAIjB,IAAY,CAACgB,GAAD,CAA1B;QACIE,MAAM,GAAIjB,IAAY,CAACe,GAAD,CAA1B;IAEAZ,aAAa,GAAGF,OAAO,GACnBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6Bc,MAA7B,EAAqCC,MAArC,EAA6CF,GAA7C,CADmB,GAEnB,KAAK,CAFT;;QAKEZ,aAAa,KAAK,KAAlB,IACCA,aAAa,KAAK,KAAK,CAAvB,IAA4Ba,MAAM,KAAKC,MAF1C,EAGE;aACO,KAAP;;;;SAIG,IAAP;;;;;"}
|
||||
1
node_modules/@react-dnd/shallowequal/dist/test/shallowequal.spec.d.ts
generated
vendored
Normal file
1
node_modules/@react-dnd/shallowequal/dist/test/shallowequal.spec.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
48
node_modules/@react-dnd/shallowequal/package.json
generated
vendored
Normal file
48
node_modules/@react-dnd/shallowequal/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "@react-dnd/shallowequal",
|
||||
"version": "2.0.0",
|
||||
"description": "Like lodash isEqualWith but for shallow equal.",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/shallowequal.esm.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"author": {
|
||||
"name": "Alberto Leal",
|
||||
"email": "mailforalberto@gmail.com",
|
||||
"url": "github.com/dashed"
|
||||
},
|
||||
"repository": "react-dnd/shallowequal",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"shallowequal",
|
||||
"shallow",
|
||||
"equal",
|
||||
"isequal",
|
||||
"compare",
|
||||
"isequalwith"
|
||||
],
|
||||
"scripts": {
|
||||
"start": "tsdx watch",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test",
|
||||
"lint": "tsdx lint"
|
||||
},
|
||||
"peerDependencies": {},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "tsdx lint"
|
||||
}
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 80,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^24.0.23",
|
||||
"husky": "^3.1.0",
|
||||
"tsdx": "^0.11.0",
|
||||
"tslib": "^1.10.0",
|
||||
"typescript": "^3.7.2"
|
||||
}
|
||||
}
|
||||
55
node_modules/@react-dnd/shallowequal/src/index.ts
generated
vendored
Normal file
55
node_modules/@react-dnd/shallowequal/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
export function shallowEqual<T>(
|
||||
objA: T,
|
||||
objB: T,
|
||||
compare?: (a: T, b: T, key?: string) => boolean | void,
|
||||
compareContext?: any
|
||||
) {
|
||||
var compareResult = compare
|
||||
? compare.call(compareContext, objA, objB)
|
||||
: void 0;
|
||||
if (compareResult !== void 0) {
|
||||
return !!compareResult;
|
||||
}
|
||||
|
||||
if (objA === objB) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var keysA = Object.keys(objA);
|
||||
var keysB = Object.keys(objB);
|
||||
|
||||
if (keysA.length !== keysB.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
||||
|
||||
// Test for A's keys different from B.
|
||||
for (var idx = 0; idx < keysA.length; idx++) {
|
||||
var key = keysA[idx];
|
||||
|
||||
if (!bHasOwnProperty(key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var valueA = (objA as any)[key];
|
||||
var valueB = (objB as any)[key];
|
||||
|
||||
compareResult = compare
|
||||
? compare.call(compareContext, valueA, valueB, key)
|
||||
: void 0;
|
||||
|
||||
if (
|
||||
compareResult === false ||
|
||||
(compareResult === void 0 && valueA !== valueB)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
140
node_modules/@react-dnd/shallowequal/test/shallowequal.spec.ts
generated
vendored
Normal file
140
node_modules/@react-dnd/shallowequal/test/shallowequal.spec.ts
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
import { shallowEqual } from '../src/index';
|
||||
|
||||
describe('shallowequal', function() {
|
||||
// eslint-disable-next-line no-sparse-arrays
|
||||
const falsey = [, '', 0, false, NaN, null, undefined];
|
||||
|
||||
// test cases copied from https://github.com/facebook/fbjs/blob/82247de1c33e6f02a199778203643eaee16ea4dc/src/core/__tests__/shallowEqual-test.js
|
||||
it('returns false if either argument is null', () => {
|
||||
expect(shallowEqual(null, {})).toEqual(false);
|
||||
expect(shallowEqual({}, null)).toEqual(false);
|
||||
});
|
||||
|
||||
it('returns true if both arguments are null or undefined', () => {
|
||||
expect(shallowEqual(null, null)).toEqual(true);
|
||||
expect(shallowEqual(undefined, undefined)).toEqual(true);
|
||||
});
|
||||
|
||||
it('returns true if arguments are shallow equal', () => {
|
||||
expect(shallowEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).toEqual(
|
||||
true
|
||||
);
|
||||
});
|
||||
|
||||
it('returns false if arguments are not objects and not equal', () => {
|
||||
expect(shallowEqual(1, 2)).toEqual(false);
|
||||
});
|
||||
|
||||
it('returns false if only one argument is not an object', () => {
|
||||
expect(shallowEqual<any>(1, {})).toEqual(false);
|
||||
});
|
||||
|
||||
it('returns false if first argument has too many keys', () => {
|
||||
expect(shallowEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 })).toEqual(false);
|
||||
});
|
||||
|
||||
it('returns false if second argument has too many keys', () => {
|
||||
expect(shallowEqual({ a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).toEqual(false);
|
||||
});
|
||||
|
||||
it('returns true if values are not primitives but are ===', () => {
|
||||
let obj = {};
|
||||
expect(
|
||||
shallowEqual({ a: 1, b: 2, c: obj }, { a: 1, b: 2, c: obj })
|
||||
).toEqual(true);
|
||||
});
|
||||
|
||||
// subsequent test cases are copied from lodash tests
|
||||
it('returns false if arguments are not shallow equal', () => {
|
||||
expect(shallowEqual({ a: 1, b: 2, c: {} }, { a: 1, b: 2, c: {} })).toEqual(
|
||||
false
|
||||
);
|
||||
});
|
||||
|
||||
it('should provide the correct `customizer` arguments', () => {
|
||||
let argsList: any[] = [];
|
||||
const arry = [1, 2];
|
||||
const object1: any = { a: arry, b: null };
|
||||
const object2: any = { a: arry, b: null };
|
||||
|
||||
object1.b = object2;
|
||||
object2.b = object1;
|
||||
|
||||
const expected = [
|
||||
[object1, object2],
|
||||
[object1.a, object2.a, 'a'],
|
||||
[object1.b, object2.b, 'b'],
|
||||
];
|
||||
|
||||
shallowEqual(object1, object2, function(...args) {
|
||||
argsList.push(args);
|
||||
});
|
||||
|
||||
expect(argsList).toEqual(expected);
|
||||
});
|
||||
|
||||
it('should set the `this` binding', () => {
|
||||
const actual = shallowEqual(
|
||||
'a',
|
||||
'b',
|
||||
function compare(this: any, a, b) {
|
||||
return this[a] === this[b];
|
||||
},
|
||||
{ a: 1, b: 1 }
|
||||
);
|
||||
|
||||
expect(actual).toEqual(true);
|
||||
});
|
||||
|
||||
it('should handle comparisons if `customizer` returns `undefined`', () => {
|
||||
const noop = () => void 0;
|
||||
|
||||
expect(shallowEqual('a', 'a', noop)).toEqual(true);
|
||||
expect(shallowEqual(['a'], ['a'], noop)).toEqual(true);
|
||||
expect(shallowEqual({ '0': 'a' }, { '0': 'a' }, noop)).toEqual(true);
|
||||
});
|
||||
|
||||
it('should not handle comparisons if `customizer` returns `true`', () => {
|
||||
const customizer = (value: any) => typeof value === 'string' || undefined;
|
||||
|
||||
expect(shallowEqual('a', 'b', customizer)).toEqual(true);
|
||||
expect(shallowEqual(['a'], ['b'], customizer)).toEqual(true);
|
||||
expect(shallowEqual({ '0': 'a' }, { '0': 'b' }, customizer)).toEqual(true);
|
||||
});
|
||||
|
||||
it('should not handle comparisons if `customizer` returns `false`', () => {
|
||||
const customizer = (value: any) =>
|
||||
typeof value === 'string' ? false : undefined;
|
||||
expect(shallowEqual('a', 'a', customizer)).toEqual(false);
|
||||
expect(shallowEqual(['a'], ['a'], customizer)).toEqual(false);
|
||||
expect(shallowEqual({ '0': 'a' }, { '0': 'a' }, customizer)).toEqual(false);
|
||||
});
|
||||
|
||||
it('should return a boolean value even if `customizer` does not', () => {
|
||||
let actual = shallowEqual('a', 'b', () => 'c' as any);
|
||||
expect(actual).toEqual(true);
|
||||
|
||||
const values = falsey.filter(v => v !== undefined);
|
||||
const expected = values.map(() => false);
|
||||
|
||||
const result: boolean[] = [];
|
||||
values.forEach(value => {
|
||||
result.push(shallowEqual('a', 'a', () => value as any));
|
||||
});
|
||||
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
|
||||
it('should treat objects created by `Object.create(null)` like any other plain object', () => {
|
||||
class Foo {
|
||||
public a = 1;
|
||||
}
|
||||
|
||||
const object2 = { a: 1 };
|
||||
expect(shallowEqual(new Foo(), object2)).toEqual(true);
|
||||
|
||||
const object1 = Object.create(null);
|
||||
object1.a = 1;
|
||||
expect(shallowEqual(object1, object2)).toEqual(true);
|
||||
});
|
||||
});
|
||||
30
node_modules/@react-dnd/shallowequal/tsconfig.json
generated
vendored
Normal file
30
node_modules/@react-dnd/shallowequal/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"include": ["src", "types", "test"],
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"lib": ["dom", "esnext"],
|
||||
"importHelpers": true,
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"rootDir": "./",
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"moduleResolution": "node",
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"jsx": "react",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user