Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

45
static/js/ketcher2/node_modules/debounce/History.md generated vendored Normal file
View File

@ -0,0 +1,45 @@
1.1.0 / 2017-10-30
==================
* Ability to force execution (#16)
1.0.2 / 2017-04-21
==================
* Fixes #3 - Debounced function executing early? (#15)
* Merge pull request #13 from selbekk/master
* Remove date-now from package.json
* Remove date-now dependency from component.json
* Remove date-now usage
1.0.1 / 2016-07-25
==================
* add ability to clear timer (#10)
1.0.0 / 2014-06-21
==================
* Readme: attribute underscore.js in the License section
* index: rewrite to use underscore.js' implementation (#2, @TooTallNate)
* component, package: add "date-now" as a dependency
* test: fix test
* component, package: add "keywords" array
* package: adjust "description"
* package: added "repository" field (#1, @juliangruber)
0.0.3 / 2013-08-21
==================
* immediate now defaults to `false`
0.0.2 / 2013-07-27
==================
* consolidated with TJ's debounce
0.0.1 / 2012-11-5
==================
* Initial release

11
static/js/ketcher2/node_modules/debounce/Makefile generated vendored Normal file
View File

@ -0,0 +1,11 @@
build: components index.js
@component build --dev
components: component.json
@component install --dev
clean:
rm -fr build components template.js
.PHONY: clean

63
static/js/ketcher2/node_modules/debounce/Readme.md generated vendored Normal file
View File

@ -0,0 +1,63 @@
# debounce
Useful for implementing behavior that should only happen after a repeated
action has completed.
## Installation
$ component install component/debounce
Or in node:
$ npm install debounce
## Example
```js
var debounce = require('debounce');
window.onresize = debounce(resize, 200);
function resize(e) {
console.log('height', window.innerHeight);
console.log('width', window.innerWidth);
}
```
To later clear the timer and cancel currently scheduled executions:
```
window.onresize.clear();
```
To execute any pending invocations and reset the timer:
```
window.onresize.flush();
```
## API
### debounce(fn, wait, [ immediate || false ])
Creates and returns a new debounced version of the passed function that
will postpone its execution until after wait milliseconds have elapsed
since the last time it was invoked.
Pass `true` for the `immediate` parameter to cause debounce to trigger
the function on the leading edge instead of the trailing edge of the wait
interval. Useful in circumstances like preventing accidental double-clicks
on a "submit" button from firing a second time.
The debounced function returned has a property 'clear' that is a
function that will clear any scheduled future executions of your function.
The debounced function returned has a property 'flush' that is a
function that will immediately execute the function if and only if execution is scheduled,
and reset the execution timer for subsequent invocations of the debounced
function.
## License
MIT
Original implementation is from [`underscore.js`](http://underscorejs.org/)
which also has an MIT license.

View File

@ -0,0 +1,18 @@
{
"name": "debounce",
"repo": "component/debounce",
"description": "Creates and returns a new debounced version of the passed function that will postpone its execution until after wait milliseconds have elapsed since the last time it was invoked",
"version": "1.1.0",
"main": "index.js",
"scripts": [
"index.js"
],
"keywords": [
"function",
"throttle",
"invoke"
],
"dependencies": {},
"development": {},
"license": "MIT"
}

66
static/js/ketcher2/node_modules/debounce/index.js generated vendored Normal file
View File

@ -0,0 +1,66 @@
/**
* Returns a function, that, as long as it continues to be invoked, will not
* be triggered. The function will be called after it stops being called for
* N milliseconds. If `immediate` is passed, trigger the function on the
* leading edge, instead of the trailing. The function also has a property 'clear'
* that is a function which will clear the timer to prevent previously scheduled executions.
*
* @source underscore.js
* @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
* @param {Function} function to wrap
* @param {Number} timeout in ms (`100`)
* @param {Boolean} whether to execute at the beginning (`false`)
* @api public
*/
module.exports = function debounce(func, wait, immediate){
var timeout, args, context, timestamp, result;
if (null == wait) wait = 100;
function later() {
var last = Date.now() - timestamp;
if (last < wait && last >= 0) {
timeout = setTimeout(later, wait - last);
} else {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
context = args = null;
}
}
};
var debounced = function(){
context = this;
args = arguments;
timestamp = Date.now();
var callNow = immediate && !timeout;
if (!timeout) timeout = setTimeout(later, wait);
if (callNow) {
result = func.apply(context, args);
context = args = null;
}
return result;
};
debounced.clear = function() {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
};
debounced.flush = function() {
if (timeout) {
result = func.apply(context, args);
context = args = null;
clearTimeout(timeout);
timeout = null;
}
};
return debounced;
};

59
static/js/ketcher2/node_modules/debounce/package.json generated vendored Normal file
View File

@ -0,0 +1,59 @@
{
"_from": "debounce@^1.0.0",
"_id": "debounce@1.1.0",
"_inBundle": false,
"_integrity": "sha512-ZQVKfRVlwRfD150ndzEK8M90ABT+Y/JQKs4Y7U4MXdpuoUkkrr4DwKbVux3YjylA5bUMUj0Nc3pMxPJX6N2QQQ==",
"_location": "/debounce",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "debounce@^1.0.0",
"name": "debounce",
"escapedName": "debounce",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/watchify-middleware"
],
"_resolved": "https://registry.npmjs.org/debounce/-/debounce-1.1.0.tgz",
"_shasum": "6a1a4ee2a9dc4b7c24bb012558dbcdb05b37f408",
"_spec": "debounce@^1.0.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/watchify-middleware",
"bugs": {
"url": "https://github.com/component/debounce/issues"
},
"bundleDependencies": false,
"component": {
"scripts": {
"debounce/index.js": "index.js"
}
},
"deprecated": false,
"description": "Creates and returns a new debounced version of the passed function that will postpone its execution until after wait milliseconds have elapsed since the last time it was invoked",
"devDependencies": {
"minijasminenode": "^1.1.1",
"mocha": "*",
"should": "*",
"sinon": "^1.17.7"
},
"homepage": "https://github.com/component/debounce#readme",
"keywords": [
"function",
"throttle",
"invoke"
],
"license": "MIT",
"main": "index.js",
"name": "debounce",
"repository": {
"type": "git",
"url": "git://github.com/component/debounce.git"
},
"scripts": {
"test": "minijasminenode test.js"
},
"version": "1.1.0"
}

32
static/js/ketcher2/node_modules/debounce/test.html generated vendored Normal file
View File

@ -0,0 +1,32 @@
<html>
<head>
<title>Debounce Component</title>
</head>
<body>
Resize the window!
<br>
<a id='cancel' href='#'>Cancel Print</a>
<br>
<a id='now' href='#'>Print Now</a>
<script src="build/build.js" type="text/javascript"></script>
<script type="text/javascript">
var debounce = require('debounce');
window.onresize = debounce(resize, 2000);
document.getElementById('cancel').onclick = window.onresize.clear;
document.getElementById('now').onclick = printNow;
function resize(e) {
console.log('height', window.innerHeight);
console.log('width', window.innerWidth);
}
function printNow(e) {
window.onresize.clear();
resize();
}
</script>
</body>
</html>

170
static/js/ketcher2/node_modules/debounce/test.js generated vendored Normal file
View File

@ -0,0 +1,170 @@
var debounce = require('.')
var sinon = require('sinon')
describe('housekeeping', function() {
it('should be defined as a function', function() {
expect(typeof debounce).toEqual('function')
})
})
describe('catch issue #3 - Debounced function executing early?', function() {
// use sinon to control the clock
var clock
beforeEach(function(){
clock = sinon.useFakeTimers()
})
afterEach(function(){
clock.restore()
})
it('should debounce with fast timeout', function() {
var callback = sinon.spy()
// set up debounced function with wait of 100
var fn = debounce(callback, 100)
// call debounced function at interval of 50
setTimeout(fn, 100)
setTimeout(fn, 150)
setTimeout(fn, 200)
setTimeout(fn, 250)
// set the clock to 100 (period of the wait) ticks after the last debounced call
clock.tick(350)
// the callback should have been triggered once
expect(callback.callCount).toEqual(1)
})
})
describe('forcing execution', function() {
// use sinon to control the clock
var clock
beforeEach(function(){
clock = sinon.useFakeTimers()
})
afterEach(function(){
clock.restore()
})
it('should not execute prior to timeout', function() {
var callback = sinon.spy()
// set up debounced function with wait of 100
var fn = debounce(callback, 100)
// call debounced function at interval of 50
setTimeout(fn, 100)
setTimeout(fn, 150)
// set the clock to 25 (period of the wait) ticks after the last debounced call
clock.tick(175)
// the callback should not have been called yet
expect(callback.callCount).toEqual(0)
})
it('should execute prior to timeout when flushed', function() {
var callback = sinon.spy()
// set up debounced function with wait of 100
var fn = debounce(callback, 100)
// call debounced function at interval of 50
setTimeout(fn, 100)
setTimeout(fn, 150)
// set the clock to 25 (period of the wait) ticks after the last debounced call
clock.tick(175)
fn.flush()
// the callback has been called
expect(callback.callCount).toEqual(1)
})
it('should not execute again after timeout when flushed before the timeout', function() {
var callback = sinon.spy()
// set up debounced function with wait of 100
var fn = debounce(callback, 100)
// call debounced function at interval of 50
setTimeout(fn, 100)
setTimeout(fn, 150)
// set the clock to 25 (period of the wait) ticks after the last debounced call
clock.tick(175)
fn.flush()
// the callback has been called here
expect(callback.callCount).toEqual(1)
// move to past the timeout
clock.tick(225)
// the callback should have only been called once
expect(callback.callCount).toEqual(1)
})
it('should not execute on a timer after being flushed', function() {
var callback = sinon.spy()
// set up debounced function with wait of 100
var fn = debounce(callback, 100)
// call debounced function at interval of 50
setTimeout(fn, 100)
setTimeout(fn, 150)
// set the clock to 25 (period of the wait) ticks after the last debounced call
clock.tick(175)
fn.flush()
// the callback has been called here
expect(callback.callCount).toEqual(1)
// schedule again
setTimeout(fn, 250)
// move to past the new timeout
clock.tick(400)
// the callback should have been called again
expect(callback.callCount).toEqual(2)
})
it('should not execute when flushed if nothing was scheduled', function() {
var callback = sinon.spy()
// set up debounced function with wait of 100
var fn = debounce(callback, 100)
fn.flush()
// the callback should not have been called
expect(callback.callCount).toEqual(0)
})
})