Support URL search params

pull/5/head
Michał Górny 2020-11-07 00:08:59 +01:00
rodzic 8a70d6c819
commit 377299f805
6 zmienionych plików z 290 dodań i 238 usunięć

Wyświetl plik

@ -36,6 +36,8 @@
"plugin:@typescript-eslint/recommended"
],
"rules": {
"indent": "off",
"@typescript-eslint/indent": ["error", "tab"],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-non-null-assertion": "off"
}

347
package-lock.json wygenerowano
Wyświetl plik

@ -1711,13 +1711,13 @@
"dev": true
},
"@typescript-eslint/eslint-plugin": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.4.1.tgz",
"integrity": "sha512-O+8Utz8pb4OmcA+Nfi5THQnQpHSD2sDUNw9AxNHpuYOo326HZTtG8gsfT+EAYuVrFNaLyNb2QnUNkmTRDskuRA==",
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.6.1.tgz",
"integrity": "sha512-SNZyflefTMK2JyrPfFFzzoy2asLmZvZJ6+/L5cIqg4HfKGiW2Gr1Go1OyEVqne/U4QwmoasuMwppoBHWBWF2nA==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "4.4.1",
"@typescript-eslint/scope-manager": "4.4.1",
"@typescript-eslint/experimental-utils": "4.6.1",
"@typescript-eslint/scope-manager": "4.6.1",
"debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0",
@ -1749,15 +1749,15 @@
}
},
"@typescript-eslint/experimental-utils": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.4.1.tgz",
"integrity": "sha512-Nt4EVlb1mqExW9cWhpV6pd1a3DkUbX9DeyYsdoeziKOpIJ04S2KMVDO+SEidsXRH/XHDpbzXykKcMTLdTXH6cQ==",
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.6.1.tgz",
"integrity": "sha512-qyPqCFWlHZXkEBoV56UxHSoXW2qnTr4JrWVXOh3soBP3q0o7p4pUEMfInDwIa0dB/ypdtm7gLOS0hg0a73ijfg==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/scope-manager": "4.4.1",
"@typescript-eslint/types": "4.4.1",
"@typescript-eslint/typescript-estree": "4.4.1",
"@typescript-eslint/scope-manager": "4.6.1",
"@typescript-eslint/types": "4.6.1",
"@typescript-eslint/typescript-estree": "4.6.1",
"eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0"
},
@ -1771,35 +1771,18 @@
"esrecurse": "^4.3.0",
"estraverse": "^4.1.1"
}
},
"esrecurse": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
"integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
"dev": true,
"requires": {
"estraverse": "^5.2.0"
},
"dependencies": {
"estraverse": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
"integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
"dev": true
}
}
}
}
},
"@typescript-eslint/parser": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.4.1.tgz",
"integrity": "sha512-S0fuX5lDku28Au9REYUsV+hdJpW/rNW0gWlc4SXzF/kdrRaAVX9YCxKpziH7djeWT/HFAjLZcnY7NJD8xTeUEg==",
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.6.1.tgz",
"integrity": "sha512-lScKRPt1wM9UwyKkGKyQDqf0bh6jm8DQ5iN37urRIXDm16GEv+HGEmum2Fc423xlk5NUOkOpfTnKZc/tqKZkDQ==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "4.4.1",
"@typescript-eslint/types": "4.4.1",
"@typescript-eslint/typescript-estree": "4.4.1",
"@typescript-eslint/scope-manager": "4.6.1",
"@typescript-eslint/types": "4.6.1",
"@typescript-eslint/typescript-estree": "4.6.1",
"debug": "^4.1.1"
},
"dependencies": {
@ -1821,29 +1804,29 @@
}
},
"@typescript-eslint/scope-manager": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.4.1.tgz",
"integrity": "sha512-2oD/ZqD4Gj41UdFeWZxegH3cVEEH/Z6Bhr/XvwTtGv66737XkR4C9IqEkebCuqArqBJQSj4AgNHHiN1okzD/wQ==",
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.6.1.tgz",
"integrity": "sha512-f95+80r6VdINYscJY1KDUEDcxZ3prAWHulL4qRDfNVD0I5QAVSGqFkwHERDoLYJJWmEAkUMdQVvx7/c2Hp+Bjg==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.4.1",
"@typescript-eslint/visitor-keys": "4.4.1"
"@typescript-eslint/types": "4.6.1",
"@typescript-eslint/visitor-keys": "4.6.1"
}
},
"@typescript-eslint/types": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.4.1.tgz",
"integrity": "sha512-KNDfH2bCyax5db+KKIZT4rfA8rEk5N0EJ8P0T5AJjo5xrV26UAzaiqoJCxeaibqc0c/IvZxp7v2g3difn2Pn3w==",
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.6.1.tgz",
"integrity": "sha512-k2ZCHhJ96YZyPIsykickez+OMHkz06xppVLfJ+DY90i532/Cx2Z+HiRMH8YZQo7a4zVd/TwNBuRCdXlGK4yo8w==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.4.1.tgz",
"integrity": "sha512-wP/V7ScKzgSdtcY1a0pZYBoCxrCstLrgRQ2O9MmCUZDtmgxCO/TCqOTGRVwpP4/2hVfqMz/Vw1ZYrG8cVxvN3g==",
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.6.1.tgz",
"integrity": "sha512-/J/kxiyjQQKqEr5kuKLNQ1Finpfb8gf/NpbwqFFYEBjxOsZ621r9AqwS9UDRA1Rrr/eneX/YsbPAIhU2rFLjXQ==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.4.1",
"@typescript-eslint/visitor-keys": "4.4.1",
"@typescript-eslint/types": "4.6.1",
"@typescript-eslint/visitor-keys": "4.6.1",
"debug": "^4.1.1",
"globby": "^11.0.1",
"is-glob": "^4.0.1",
@ -1852,27 +1835,12 @@
"tsutils": "^3.17.1"
},
"dependencies": {
"@nodelib/fs.stat": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz",
"integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==",
"dev": true
},
"array-union": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
"dev": true
},
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"requires": {
"fill-range": "^7.0.1"
}
},
"debug": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
@ -1882,47 +1850,6 @@
"ms": "2.1.2"
}
},
"dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
"integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
"dev": true,
"requires": {
"path-type": "^4.0.0"
}
},
"fast-glob": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.4.tgz",
"integrity": "sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ==",
"dev": true,
"requires": {
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.0",
"merge2": "^1.3.0",
"micromatch": "^4.0.2",
"picomatch": "^2.2.1"
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"requires": {
"to-regex-range": "^5.0.1"
}
},
"glob-parent": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
"integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
"dev": true,
"requires": {
"is-glob": "^4.0.1"
}
},
"globby": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/globby/-/globby-11.0.1.tgz",
@ -1943,70 +1870,27 @@
"integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==",
"dev": true
},
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
"merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
"integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
"dev": true
},
"micromatch": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
"dev": true,
"requires": {
"braces": "^3.0.1",
"picomatch": "^2.0.5"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"path-type": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
"dev": true
},
"picomatch": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
"dev": true
},
"semver": {
"version": "7.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
"dev": true
},
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"requires": {
"is-number": "^7.0.0"
}
}
}
},
"@typescript-eslint/visitor-keys": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.4.1.tgz",
"integrity": "sha512-H2JMWhLaJNeaylSnMSQFEhT/S/FsJbebQALmoJxMPMxLtlVAMy2uJP/Z543n9IizhjRayLSqoInehCeNW9rWcw==",
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.6.1.tgz",
"integrity": "sha512-owABze4toX7QXwOLT3/D5a8NecZEjEWU1srqxENTfqsY3bwVnl3YYbOh6s1rp2wQKO9RTHFGjKes08FgE7SVMw==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.4.1",
"@typescript-eslint/types": "4.6.1",
"eslint-visitor-keys": "^2.0.0"
}
},
@ -2595,10 +2479,13 @@
"dev": true
},
"async": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=",
"dev": true
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
"integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",
"dev": true,
"requires": {
"lodash": "^4.17.14"
}
},
"async-each": {
"version": "1.0.3",
@ -4620,13 +4507,12 @@
}
},
"error": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/error/-/error-7.0.2.tgz",
"integrity": "sha1-pfdf/02ZJhJt2sDqXcOOaJFTywI=",
"version": "7.2.1",
"resolved": "https://registry.npmjs.org/error/-/error-7.2.1.tgz",
"integrity": "sha512-fo9HBvWnx3NGUKMvMwB/CBCMMrfEJgbDTVDEkPygA3Bdd3lM1OyCd+rbQ8BwnpF6GdVeOLDNmyL4N5Bg80ZvdA==",
"dev": true,
"requires": {
"string-template": "~0.2.1",
"xtend": "~4.0.0"
"string-template": "~0.2.1"
}
},
"error-ex": {
@ -7626,15 +7512,83 @@
"dev": true
},
"mini-css-extract-plugin": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.8.0.tgz",
"integrity": "sha512-MNpRGbNA52q6U92i0qbVpQNsgk7LExy41MdAlG84FeytfDOtRIf/mCHdEgG8rpTKOaNKiqUnZdlptF469hxqOw==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-1.3.0.tgz",
"integrity": "sha512-4DKmPwFd0XKlwoqvrkLi2X8Mlosh2ey/E/OVAucnPUdzGqrSWHgSqed/p4Ue2Q39JjIvcdSDgmZDO6mir5Ovmw==",
"dev": true,
"requires": {
"loader-utils": "^1.1.0",
"normalize-url": "1.9.1",
"schema-utils": "^1.0.0",
"loader-utils": "^2.0.0",
"schema-utils": "^3.0.0",
"webpack-sources": "^1.1.0"
},
"dependencies": {
"@types/json-schema": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz",
"integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==",
"dev": true
},
"ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"ajv-keywords": {
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
"dev": true
},
"emojis-list": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==",
"dev": true
},
"fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true
},
"json5": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
"integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
},
"loader-utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
"dev": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"schema-utils": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz",
"integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.6",
"ajv": "^6.12.5",
"ajv-keywords": "^3.5.2"
}
}
}
},
"minimalistic-assert": {
@ -8569,14 +8523,40 @@
}
},
"portfinder": {
"version": "1.0.21",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.21.tgz",
"integrity": "sha512-ESabpDCzmBS3ekHbmpAIiESq3udRsCBGiBZLsC+HgBKv2ezb0R4oG+7RnYEVZ/ZCfhel5Tx3UzdNWA0Lox2QCA==",
"version": "1.0.28",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz",
"integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==",
"dev": true,
"requires": {
"async": "^1.5.2",
"debug": "^2.2.0",
"mkdirp": "0.5.x"
"async": "^2.6.2",
"debug": "^3.1.1",
"mkdirp": "^0.5.5"
},
"dependencies": {
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
}
}
},
"posix-character-classes": {
@ -12728,9 +12708,9 @@
}
},
"typescript": {
"version": "3.5.3",
"resolved": "https://nexus.naviexpert.com/repository/npm/typescript/-/typescript-3.5.3.tgz",
"integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==",
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.5.tgz",
"integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==",
"dev": true
},
"uglify-js": {
@ -13528,13 +13508,26 @@
}
},
"webpack-livereload-plugin": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/webpack-livereload-plugin/-/webpack-livereload-plugin-2.2.0.tgz",
"integrity": "sha512-sx9xA5mHoNOUgLQI0PmXT3KV9ecsVmUaTgr+fsoL69qAOHw/7VzkL1+ZMDQ8n0dPbWounswK6cBRSgMod7Nhgg==",
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/webpack-livereload-plugin/-/webpack-livereload-plugin-2.3.0.tgz",
"integrity": "sha512-vVBLQLlNpElt2sfsBG+XLDeVbQFS4RrniVU8Hi1/hX5ycSfx6mtW8MEEITr2g0Cvo36kuPWShFFDuy+DS7KFMA==",
"dev": true,
"requires": {
"anymatch": "^3.1.1",
"portfinder": "^1.0.17",
"tiny-lr": "^1.1.1"
},
"dependencies": {
"anymatch": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
"integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
"dev": true,
"requires": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
}
}
}
},
"webpack-log": {

Wyświetl plik

@ -23,8 +23,8 @@
"@babel/register": "^7.12.1",
"@types/chartist": "^0.9.46",
"@types/pug": "^2.0.4",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
"babel-loader": "^8.1.0",
"css-loader": "^3.2.0",
"cssnano": "^4.1.10",
@ -34,7 +34,7 @@
"eslint-webpack-plugin": "^2.1.0",
"gh-pages": "^2.1.1",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.8.0",
"mini-css-extract-plugin": "^1.2.1",
"postcss": "^7.0.34",
"postcss-import": "^12.0.1",
"postcss-loader": "^4.0.4",
@ -44,11 +44,11 @@
"stylelint": "^13.7.2",
"stylelint-config-standard": "^20.0.0",
"stylelint-webpack-plugin": "^2.1.1",
"typescript": "^3.5.3",
"typescript": "^4.0.5",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpack-livereload-plugin": "^2.2.0"
"webpack-livereload-plugin": "^2.3.0"
},
"dependencies": {
"chartist": "^0.11.4",

Wyświetl plik

@ -16,6 +16,72 @@ const clearResults = (bar: ChartistStatic['Bar'], pie: ChartistStatic['Pie']) =>
document.getElementById('constituency-results')!.innerHTML = '';
};
const displayResults = (mandates: number[]) => {
mandates.forEach((value, index) => {
const committeeId = committees[index].id;
const td = document.querySelector<HTMLTableDataCellElement>(`tr.${committeeId} td:last-child`);
if (td) td.textContent = value.toString();
});
};
const displayUrl = (support: number[]) => {
const searchParams = new URLSearchParams();
support.forEach((s, i) => {
if (s > 0) searchParams.append(committees[i].id, s.toString());
});
const url = `${window.location.href}?${searchParams}`;
document.getElementById('url')!.innerHTML = `Link do wyników: ${url.link(url)}`;
};
const displayBarChart = (support: number[]) => {
const sortedSupport = committees
.map((c, i) => ({
label: c.shortName,
support: {value: support[i], className: c.id},
}))
.filter((s) => s.support.value && s.support.value > 0)
.sort((a, b) => b.support.value - a.support.value);
const barChartData = {
labels: sortedSupport.map((ss) => ss.label),
series: sortedSupport.map((ss) => ss.support),
};
const barChartOptions = {
distributeSeries: true,
};
const barChart = new Chartist.Bar('#support-bar-chart', barChartData, barChartOptions);
barChart.on('draw', (data: {type: string; element: IChartistSvg}) => {
if (data.type === 'bar') {
data.element.attr({
style: 'stroke-width: 30px',
});
}
});
return barChart;
};
const displayPieChart = (mandates: number[]) => {
const sortedMandates = committees
.map((c, i) => ({
label: c.shortName,
mandates: {value: mandates[i], className: c.id},
}))
.filter((m) => m.mandates.value && m.mandates.value > 0)
.sort((a, b) => b.mandates.value - a.mandates.value);
const pieChartData = {
series: sortedMandates.map((sm) => sm.mandates),
};
const pieChartOptions = {
donut: true,
donutWidth: 60,
startAngle: 270,
total: 460 * 2,
labelInterpolationFnc: (value: number, index: number) => (
value < 15 ? '' : `${sortedMandates[index].label} ${value}`
),
};
return new Chartist.Pie('#division-pie-chart', pieChartData, pieChartOptions);
};
const displayConstituencyResults = () => {
const container = document.getElementById('constituency-results');
constituencies.forEach((constituency, constituenyIndex) => {
@ -36,79 +102,52 @@ const displayConstituencyResults = () => {
});
};
const handleCalculateButtonClick = (event: Event) => {
event.preventDefault();
const validate = (inputs: NodeListOf<HTMLInputElement>, support: number[]) => {
const supportSum = support.reduce((a, b) => a + b, 0);
if (supportSum > 100) {
inputs.forEach((input) => input.setCustomValidity('Suma poparcia nie może przekraczać 100%'));
return false;
}
if (supportSum <= 0) {
inputs.forEach((input) => input.setCustomValidity('Suma poparcia musi być wyższa niż 0%'));
return false;
}
inputs.forEach((input) => input.setCustomValidity(''));
return document.querySelector<HTMLFormElement>('#support-form')!.checkValidity();
};
const calculate = () => {
const inputs = document.querySelectorAll<HTMLInputElement>('#support-form input');
const support = Array
.from(inputs)
.map((input) => parseFloat(input.value))
.map((value) => (Number.isNaN(value) ? 0 : value));
if (support.reduce((a, b) => a + b, 0) > 100) {
inputs.forEach((input) => input.setCustomValidity('Suma poparcia nie może przekraczać 100%'));
return;
}
inputs.forEach((input) => input.setCustomValidity(''));
if (!document.querySelector<HTMLFormElement>('#support-form')!.checkValidity()) return;
if (!validate(inputs, support)) return;
const mandates = calculateMandates(support);
mandates.forEach((value, index) => {
const committeeId = committees[index].id;
const td = document.querySelector<HTMLTableDataCellElement>(`tr.${committeeId} td:last-child`);
if (td) td.textContent = value.toString();
});
displayResults(mandates);
const sortedSupport = committees
.map((c, i) => ({
label: c.shortName,
support: {value: support[i], className: c.id},
}))
.filter((s) => s.support.value && s.support.value > 0)
.sort((a, b) => b.support.value - a.support.value);
const barChartData = {
labels: sortedSupport.map((ss) => ss.label),
series: sortedSupport.map((ss) => ss.support),
};
const barChartOptions = {
distributeSeries: true,
};
const bar = new Chartist.Bar('#support-bar-chart', barChartData, barChartOptions);
bar.on('draw', (data: {type: string; element: IChartistSvg}) => {
if (data.type === 'bar') {
data.element.attr({
style: 'stroke-width: 30px',
});
}
});
displayUrl(support);
const sortedMandates = committees
.map((c, i) => ({
label: c.shortName,
mandates: {value: mandates[i], className: c.id},
}))
.filter((m) => m.mandates.value && m.mandates.value > 0)
.sort((a, b) => b.mandates.value - a.mandates.value);
const pieChartData = {
series: sortedMandates.map((sm) => sm.mandates),
};
const pieChartOptions = {
donut: true,
donutWidth: 60,
startAngle: 270,
total: 460 * 2,
labelInterpolationFnc: (value: number, index: number) => (
value < 15 ? '' : `${sortedMandates[index].label} ${value}`
),
};
const pie = new Chartist.Pie('#division-pie-chart', pieChartData, pieChartOptions);
const barChart = displayBarChart(support);
const pieChart = displayPieChart(mandates);
displayConstituencyResults();
inputs.forEach((input) => input.addEventListener('input', () => {
clearResults(bar, pie);
clearResults(barChart, pieChart);
}));
};
const handleCalculateButtonClick = (event: Event) => {
event.preventDefault();
calculate();
};
const generateTable = () => {
const form: HTMLElement = document.getElementById('support-form')!;
form.insertAdjacentHTML('afterbegin', tableTemplate({
@ -116,6 +155,17 @@ const generateTable = () => {
}));
};
const loadResultsFromUrl = () => {
if (window.location.search) {
const searchParams = new URLSearchParams(window.location.search);
searchParams.forEach((value, key) => {
const input = document.querySelector<HTMLInputElement>(`tr.${key} td:nth-child(2) input`);
if (input) input.value = value;
});
calculate();
}
};
const bindActions = () => {
document
.querySelector('#calculate-button')!
@ -124,5 +174,6 @@ const bindActions = () => {
document.addEventListener('DOMContentLoaded', () => {
generateTable();
loadResultsFromUrl();
bindActions();
});

Wyświetl plik

@ -75,6 +75,10 @@ h2 {
line-height: 1.3;
}
#url {
margin: 8px 0 32px;
}
#constituency-results {
display: flex;
flex-wrap: wrap;

Wyświetl plik

@ -22,6 +22,8 @@ ol.updates
form#support-form
button#calculate-button Oblicz
#url
.charts-row
#support-bar-chart.ct-chart.ct-perfect-fourth
#division-pie-chart.ct-chart.ct-perfect-fourth