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

21
static/js/ketcher2/node_modules/preact-redux/LICENSE generated vendored Normal file
View File

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

49
static/js/ketcher2/node_modules/preact-redux/README.md generated vendored Normal file
View File

@ -0,0 +1,49 @@
# preact-redux
[![NPM](http://img.shields.io/npm/v/preact-redux.svg)](https://www.npmjs.com/package/preact-redux)
[![travis-ci](https://travis-ci.org/developit/preact-redux.svg)](https://travis-ci.org/developit/preact-redux)
Wraps [react-redux] up for [Preact], without using [preact-compat](https://github.com/developit/preact-compat).
> Think of this as a version of `react-redux` that is pre-aliased to use preact in place of React.
**See [preact-redux-example](https://github.com/developit/preact-redux-example):** _a full working example of `redux` + `preact` using `preact-redux`!_
---
### Usage Example
> This is a contrived example. Please refer to Redux's [Usage with React](http://redux.js.org/docs/basics/UsageWithReact.html) documentation for details on how to work with Redux from Preact.
```js
import { Provider, connect } from 'preact-redux';
import { h, render } from 'preact';
const Main = () => (
<Provider store={store}>
<Child />
</Provider>
);
const Child = connect(
state => state
)( ({ text, setText }) => (
<input value={text} onInput={e => setText(e.target.value)} />
) );
render(<Main />, document.body);
```
---
### License
[MIT]
[react-redux]: https://github.com/reactjs/react-redux
[Preact]: https://github.com/developit/preact
[MIT]: http://choosealicense.com/licenses/mit/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
{"version":3,"file":null,"sources":[],"sourcesContent":[],"names":[],"mappings":""}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
{"version":3,"file":null,"sources":[],"sourcesContent":[],"names":[],"mappings":""}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"preact-redux.min.js"}

View File

@ -0,0 +1,32 @@
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'chai-sinon'],
reporters: ['mocha'],
browsers: ['PhantomJS'],
files: ['test/**/*.js'],
preprocessors: {
'{src,test}/**/*.js': ['webpack', 'sourcemap']
},
webpack: {
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel'
}]
},
resolve: {
alias: {
src: __dirname+'/src'
}
}
},
webpackMiddleware: {
noInfo: true
}
});
};

View File

@ -0,0 +1,118 @@
{
"_from": "preact-redux@2.0.1",
"_id": "preact-redux@2.0.1",
"_inBundle": false,
"_integrity": "sha1-5g30YbGih/kq15iPzh/a/6XjhC4=",
"_location": "/preact-redux",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "preact-redux@2.0.1",
"name": "preact-redux",
"escapedName": "preact-redux",
"rawSpec": "2.0.1",
"saveSpec": null,
"fetchSpec": "2.0.1"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/preact-redux/-/preact-redux-2.0.1.tgz",
"_shasum": "e60df461b1a287f92ad7988fce1fdaffa5e3842e",
"_spec": "preact-redux@2.0.1",
"_where": "/home/manfred/enviPath/ketcher2/ketcher",
"amdName": "preactRedux",
"author": {
"name": "Jason Miller",
"email": "jason@developit.ca"
},
"bugs": {
"url": "https://github.com/developit/preact-redux/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Wraps react-redux up for Preact, without preact-compat",
"devDependencies": {
"babel-cli": "^6.14.0",
"babel-core": "^6.14.0",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.5",
"babel-plugin-external-helpers": "^6.8.0",
"babel-plugin-transform-class-properties": "^6.11.5",
"babel-plugin-transform-es2015-classes": "^6.14.0",
"babel-plugin-transform-node-env-inline": "^6.8.0",
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-plugin-transform-react-jsx": "^6.8.0",
"babel-plugin-transform-react-remove-prop-types": "^0.2.9",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-0": "^6.5.0",
"chai": "^3.5.0",
"diff": "^3.0.0",
"eslint": "^3.3.1",
"eslint-plugin-react": "^6.1.2",
"gzip-size-cli": "^1.0.0",
"karma": "^1.2.0",
"karma-chai-sinon": "^0.1.5",
"karma-mocha": "^1.1.1",
"karma-mocha-reporter": "^2.2.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.8.0",
"mkdirp": "^0.5.1",
"mocha": "^3.0.2",
"npm-run-all": "^3.0.0",
"phantomjs-prebuilt": "^2.1.12",
"preact": "^6.0.2",
"pretty-bytes-cli": "^2.0.0",
"react-redux": "^5.0.0",
"redux": "^3.6.0",
"rimraf": "^2.5.4",
"rollup": "^0.36.0",
"rollup-plugin-alias": "^1.2.0",
"rollup-plugin-babel": "^2.6.1",
"rollup-plugin-commonjs": "^5.0.4",
"rollup-plugin-es3": "^1.0.3",
"rollup-plugin-memory": "^2.0.0",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-replace": "^1.1.1",
"sinon": "^1.17.6",
"sinon-chai": "^2.8.0",
"uglify-js": "^2.7.3",
"webpack": "^1.13.2"
},
"homepage": "https://github.com/developit/preact-redux",
"jsnext:main": "dist/preact-redux.esm.js",
"keywords": [
"preact",
"redux"
],
"license": "MIT",
"main": "dist/preact-redux.js",
"minified:main": "dist/preact-redux.min.js",
"name": "preact-redux",
"peerDependencies": {
"preact": ">=3",
"redux": ">=2"
},
"repository": {
"type": "git",
"url": "git+https://github.com/developit/preact-redux.git"
},
"scripts": {
"build": "NODE_ENV=production npm-run-all clean transpile minify size",
"clean": "rimraf dist/",
"lint": "eslint {src,test}",
"minify": "uglifyjs $npm_package_main --define NODE_ENV=production --pure-funcs classCallCheck Object.defineProperty Object.freeze invariant warning -c unsafe,collapse_vars,evaluate,screw_ie8,loops,keep_fargs=false,pure_getters,unused,dead_code -m -o $npm_package_minified_main -p relative --in-source-map ${npm_package_main}.map --source-map ${npm_package_minified_main}.map",
"prepublish": "npm-run-all build test",
"release": "npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish",
"size": "size=$(gzip-size $npm_package_minified_main) && echo \"gzip size: $size / $(pretty-bytes $size)\"",
"test": "NODE_ENV=development npm-run-all lint transpile test:karma",
"test:karma": "karma start --single-run",
"test:watch": "karma start",
"transpile": "rollup -c rollup.config.js -m ${npm_package_main}.map -f umd -n $npm_package_amdName $npm_package_src_main"
},
"src:main": "src/index.js",
"version": "2.0.1"
}

View File

@ -0,0 +1,86 @@
import fs from 'fs';
import memory from 'rollup-plugin-memory';
import alias from 'rollup-plugin-alias';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
import babel from 'rollup-plugin-babel';
import es3 from 'rollup-plugin-es3';
const babelRc = JSON.parse(fs.readFileSync('.babelrc','utf8'));
const packageJson = require('./package.json');
babelRc.plugins.push('external-helpers');
const external = [
'redux',
'preact'
];
export default {
exports: 'default',
external: external,
useStrict: false,
globals: {
preact: 'preact',
redux: 'Redux'
},
targets: [
{
dest: packageJson['main'],
format: 'umd',
moduleName: 'preactRedux',
sourceMap: true
},
{
dest: packageJson['jsnext:main'],
format: 'es',
sourceMap: true
}
],
plugins: [
memory({
path: 'src/index',
contents: "import * as lib from './index'; export default lib;"
}),
{
// This insane thing transforms Lodash CommonJS modules to ESModules. Doing so shaves 500b (20%) off the library size.
load: function(id) {
if (id.match(/\blodash\b/)) {
return fs.readFileSync(id, 'utf8')
.replace(/\b(?:var\s+)?([\w$]+)\s*=\s*require\((['"])(.*?)\2\)\s*[,;]/g, 'import $1 from $2$3$2;')
.replace(/\bmodule\.exports\s*=\s*/, 'export default ');
}
}
},
alias({
'react-redux': 'node_modules/react-redux/src/index.js',
'react': __dirname+'/src/compat.js',
'invariant': __dirname+'/src/empty.js'
}),
nodeResolve({
jsnext: true,
module: true,
skip: ['react', 'preact'],
preferBuiltins: false
}),
commonjs({
include: 'node_modules/**',
exclude: [ 'node_modules/react-redux/**']
}),
babel({
babelrc: false,
presets: [
['es2015', {
loose: true,
modules: false
}]
].concat(babelRc.presets.slice(1)),
plugins: babelRc.plugins
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production')
}),
es3()
]
};

View File

@ -0,0 +1,17 @@
export { Component, h as createElement } from 'preact';
export const Children = {
only(children) {
return children && children[0] || null;
}
};
function proptype() {}
proptype.isRequired = proptype;
export const PropTypes = {
element: proptype,
func: proptype,
shape: () => proptype,
instanceOf: ()=> proptype
};

View File

@ -0,0 +1 @@
export default function(){}

View File

@ -0,0 +1 @@
export { Provider, connect, connectAdvanced } from 'react-redux';

View File

@ -0,0 +1,192 @@
import { createStore } from 'redux';
import { Provider, connect, connectAdvanced } from '../';
import { h, render, options } from 'preact';
import Redux from '../dist/preact-redux.esm.js';
// disable async rendering entirely to make tests simpler
options.debounceRendering = f => f();
describe('preact-redux', () => {
it('should export Provider & connect', () => {
expect(Provider).to.be.a('function');
expect(connect).to.be.a('function');
});
describe('<Provider />', () => {
it('should commit store prop to context', () => {
let store = createStore( a => a );
let Child = sinon.stub().returns(<div />);
render((
<Provider store={store}>
<Child />
</Provider>
), document.createElement('div'));
expect(Child).to.have.been.calledWithMatch({ }, { store });
});
});
describe('connect()', () => {
it('should connect component to store', () => {
let initialState = {
a: 'a',
b: 'b'
};
let reducer = (state=initialState, action) => {
switch (action.type) {
case 'A': return { ...state, a: action.data };
case 'B': return { ...state, b: action.data };
default: return state;
}
};
let store = createStore(reducer);
let Child = sinon.stub().returns(<div />);
let spies = {};
let ConnectedChild = connect(
({ a, b }, { c }) => ({ a, b, c }),
dispatch => ({
onA: spies.onA = sinon.spy( data => dispatch({ type:'A', data }) ),
onB: spies.onB = sinon.spy( data => dispatch({ type:'B', data }) )
})
)(Child);
render((
<Provider store={store}>
<ConnectedChild c="c" />
</Provider>
), document.createElement('div'));
expect(Child).to.have.been.calledOnce.and.calledWithMatch({
a: 'a',
b: 'b',
c: 'c',
onA: spies.onA,
onB: spies.onB
});
Child.reset();
spies.onA('aaa');
expect(Child).to.have.been.calledOnce.and.calledWithMatch({
a: 'aaa',
b: 'b',
c: 'c',
onA: spies.onA,
onB: spies.onB
});
Child.reset();
spies.onB('bbb');
expect(Child).to.have.been.calledOnce.and.calledWithMatch({
a: 'aaa',
b: 'bbb',
c: 'c',
onA: spies.onA,
onB: spies.onB
});
});
});
describe('connectAdvanced()', () => {
it('should connectAdvanced component to store', () => {
let initialState = {
a: 'a',
b: 'b'
};
let reducer = (state=initialState, action) => {
switch (action.type) {
case 'A': return { ...state, a: action.data };
case 'B': return { ...state, b: action.data };
default: return state;
}
};
let store = createStore(reducer);
let Child = sinon.stub().returns(<div />);
let spies = {};
function shallowDiffers (a, b) {
for (let i in a) if (!(i in b)) return true;
for (let i in b) if (a[i] !== b[i]) return true;
return false;
}
let ConnectedChild = connectAdvanced((dispatch) => {
/**
* from https://github.com/reactjs/react-redux/blob/master/docs/api.md
* If a consecutive call to selector returns the same object (===) as its previous call,
* the component will not be re-rendered.
* It's the responsibility of selector to return that previous object when appropriate.
*/
let result = {};
const onA = spies.onA = sinon.spy(data => dispatch({type: 'A', data}));
const onB = spies.onB = sinon.spy(data => dispatch({type: 'B', data}));
return ({a, b}, {c}) => {
const nextResult = {
a,
b,
c,
onA,
onB
};
if (shallowDiffers(result, nextResult)) {
result = nextResult;
}
return result;
};
})(Child);
render((
<Provider store={store}>
<ConnectedChild c="c" />
</Provider>
), document.createElement('div'));
expect(Child).to.have.been.calledOnce.and.calledWithMatch({
a: 'a',
b: 'b',
c: 'c',
onA: spies.onA,
onB: spies.onB
});
Child.reset();
spies.onA('aaa');
expect(Child).to.have.been.calledOnce.and.calledWithMatch({
a: 'aaa',
b: 'b',
c: 'c',
onA: spies.onA,
onB: spies.onB
});
Child.reset();
spies.onB('bbb');
expect(Child).to.have.been.calledOnce.and.calledWithMatch({
a: 'aaa',
b: 'bbb',
c: 'c',
onA: spies.onA,
onB: spies.onB
});
});
});
describe('jsnext:main', () => {
it('should export the correct interface', () => {
expect(Redux.Provider).to.be.a('function');
expect(Redux.connect).to.be.a('function');
expect(Redux.connectAdvanced).to.be.a('function');
});
});
});