remove externals in favor of npm packages
parent
6379335d6a
commit
ff711f080b
|
@ -3482,8 +3482,7 @@
|
||||||
"@types/raf": {
|
"@types/raf": {
|
||||||
"version": "3.4.0",
|
"version": "3.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/raf/-/raf-3.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/raf/-/raf-3.4.0.tgz",
|
||||||
"integrity": "sha512-taW5/WYqo36N7V39oYyHP9Ipfd5pNFvGTIQsNGj86xV88YQ7GnI30/yMfKDF7Zgin0m3e+ikX88FvImnK4RjGw==",
|
"integrity": "sha512-taW5/WYqo36N7V39oYyHP9Ipfd5pNFvGTIQsNGj86xV88YQ7GnI30/yMfKDF7Zgin0m3e+ikX88FvImnK4RjGw=="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"@types/range-parser": {
|
"@types/range-parser": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
|
@ -6075,7 +6074,6 @@
|
||||||
"version": "3.0.6",
|
"version": "3.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.6.tgz",
|
||||||
"integrity": "sha512-eFUy8R/4DgocR93LF8lr+YUxW4PYblUe/Q1gz2osk/cI5n8AsYdassvln0D9QPhLXQ6Lx7l8hwtT8FLvOn2Ihg==",
|
"integrity": "sha512-eFUy8R/4DgocR93LF8lr+YUxW4PYblUe/Q1gz2osk/cI5n8AsYdassvln0D9QPhLXQ6Lx7l8hwtT8FLvOn2Ihg==",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.6.3",
|
"@babel/runtime": "^7.6.3",
|
||||||
"@types/raf": "^3.4.0",
|
"@types/raf": "^3.4.0",
|
||||||
|
@ -17141,7 +17139,6 @@
|
||||||
"version": "3.4.1",
|
"version": "3.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
|
||||||
"integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==",
|
"integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"performance-now": "^2.1.0"
|
"performance-now": "^2.1.0"
|
||||||
}
|
}
|
||||||
|
@ -18052,8 +18049,7 @@
|
||||||
"rgbcolor": {
|
"rgbcolor": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/rgbcolor/-/rgbcolor-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/rgbcolor/-/rgbcolor-1.0.1.tgz",
|
||||||
"integrity": "sha1-1lBezbMEplldom+ktDMHMGd1lF0=",
|
"integrity": "sha1-1lBezbMEplldom+ktDMHMGd1lF0="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"rimraf": {
|
"rimraf": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
|
|
|
@ -134,6 +134,7 @@
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/polyfill": "^7.11.5",
|
"@babel/polyfill": "^7.11.5",
|
||||||
|
"canvg": "^3.0.6",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"jspdf": "^2.1.1",
|
"jspdf": "^2.1.1",
|
||||||
"regenerator-runtime": "^0.13.7",
|
"regenerator-runtime": "^0.13.7",
|
||||||
|
|
|
@ -12,10 +12,6 @@
|
||||||
<!-- As yet no ES6 -->
|
<!-- As yet no ES6 -->
|
||||||
<script src="../../jquery.min.js"></script>
|
<script src="../../jquery.min.js"></script>
|
||||||
|
|
||||||
<!-- ES6+ polyfills (Babel) -->
|
|
||||||
<script src="../../external/core-js-bundle/minified.js"></script>
|
|
||||||
<script src="../../external/regenerator-runtime/runtime.js"></script>
|
|
||||||
|
|
||||||
<script type="module" src="index.js"></script>
|
<script type="module" src="index.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -9,13 +9,6 @@
|
||||||
<script nomodule="" src="../../redirect-on-no-module-support.js"></script>
|
<script nomodule="" src="../../redirect-on-no-module-support.js"></script>
|
||||||
<script type="module" src="../../redirect-on-lacking-support.js"></script>
|
<script type="module" src="../../redirect-on-lacking-support.js"></script>
|
||||||
|
|
||||||
<!-- Browser polyfills -->
|
|
||||||
<script src="../../external/dom-polyfill/dom-polyfill.js"></script>
|
|
||||||
|
|
||||||
<!-- ES6+ polyfills (Babel) -->
|
|
||||||
<script src="../../external/core-js-bundle/minified.js"></script>
|
|
||||||
<script src="../../external/regenerator-runtime/runtime.js"></script>
|
|
||||||
|
|
||||||
<script type="module" src="openclipart.js"></script>
|
<script type="module" src="openclipart.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import {jml, body, nbsp} from '../../../external/jamilih/jml-es.js';
|
// eslint-disable-next-line node/no-unpublished-import
|
||||||
|
import {jml, body, nbsp} from 'jamilih';
|
||||||
import $ from '../../../external/query-result/esm/index.js';
|
import $ from '../../../external/query-result/esm/index.js';
|
||||||
import {manipulation} from '../../../external/qr-manipulation/dist/index-es.js';
|
import {manipulation} from '../../../external/qr-manipulation/dist/index-es.js';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* adopted for moinmoins item storage. It sends in one post png and svg data
|
* adopted for moinmoins item storage. It sends in one post png and svg data
|
||||||
* (I agree to dual license my work to additional GPLv2 or later)
|
* (I agree to dual license my work to additional GPLv2 or later)
|
||||||
*/
|
*/
|
||||||
import {canvg} from '../../../external/canvg/canvg.js';
|
import {Canvg as canvg} from 'canvg';
|
||||||
|
|
||||||
const loadExtensionTranslation = async function (lang) {
|
const loadExtensionTranslation = async function (lang) {
|
||||||
let translationModule;
|
let translationModule;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @copyright 2010 Alexis Deveria
|
* @copyright 2010 Alexis Deveria
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import {canvg} from '../../../external/canvg/canvg.js';
|
import {Canvg as canvg} from 'canvg';
|
||||||
|
|
||||||
const loadExtensionTranslation = async function (lang) {
|
const loadExtensionTranslation = async function (lang) {
|
||||||
let translationModule;
|
let translationModule;
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
* @borrows module:locale.setStrings as setStrings
|
* @borrows module:locale.setStrings as setStrings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// eslint-disable-next-line node/no-unpublished-import
|
||||||
|
import deparam from 'deparam';
|
||||||
|
|
||||||
import './touch.js';
|
import './touch.js';
|
||||||
import {NS} from '../common/namespaces.js';
|
import {NS} from '../common/namespaces.js';
|
||||||
import {isWebkit, isChrome, isGecko, isIE, isMac, isTouch} from '../common/browser.js';
|
import {isWebkit, isChrome, isGecko, isIE, isMac, isTouch} from '../common/browser.js';
|
||||||
|
@ -26,7 +29,6 @@ import {getTypeMap, convertUnit, isValidUnit} from '../common/units.js';
|
||||||
import {
|
import {
|
||||||
hasCustomHandler, getCustomHandler, injectExtendedContextMenuItemsIntoDom
|
hasCustomHandler, getCustomHandler, injectExtendedContextMenuItemsIntoDom
|
||||||
} from './contextmenu.js';
|
} from './contextmenu.js';
|
||||||
import deparam from '../external/deparam/deparam.esm.js';
|
|
||||||
|
|
||||||
import SvgCanvas from '../svgcanvas/svgcanvas.js';
|
import SvgCanvas from '../svgcanvas/svgcanvas.js';
|
||||||
import Layer from '../common/layer.js';
|
import Layer from '../common/layer.js';
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,282 +0,0 @@
|
||||||
/**
|
|
||||||
* For parsing color values.
|
|
||||||
* @module RGBColor
|
|
||||||
* @author Stoyan Stefanov <sstoo@gmail.com>
|
|
||||||
* @see https://www.phpied.com/rgb-color-parser-in-javascript/
|
|
||||||
* @license MIT
|
|
||||||
*/
|
|
||||||
const simpleColors = {
|
|
||||||
aliceblue: 'f0f8ff',
|
|
||||||
antiquewhite: 'faebd7',
|
|
||||||
aqua: '00ffff',
|
|
||||||
aquamarine: '7fffd4',
|
|
||||||
azure: 'f0ffff',
|
|
||||||
beige: 'f5f5dc',
|
|
||||||
bisque: 'ffe4c4',
|
|
||||||
black: '000000',
|
|
||||||
blanchedalmond: 'ffebcd',
|
|
||||||
blue: '0000ff',
|
|
||||||
blueviolet: '8a2be2',
|
|
||||||
brown: 'a52a2a',
|
|
||||||
burlywood: 'deb887',
|
|
||||||
cadetblue: '5f9ea0',
|
|
||||||
chartreuse: '7fff00',
|
|
||||||
chocolate: 'd2691e',
|
|
||||||
coral: 'ff7f50',
|
|
||||||
cornflowerblue: '6495ed',
|
|
||||||
cornsilk: 'fff8dc',
|
|
||||||
crimson: 'dc143c',
|
|
||||||
cyan: '00ffff',
|
|
||||||
darkblue: '00008b',
|
|
||||||
darkcyan: '008b8b',
|
|
||||||
darkgoldenrod: 'b8860b',
|
|
||||||
darkgray: 'a9a9a9',
|
|
||||||
darkgreen: '006400',
|
|
||||||
darkkhaki: 'bdb76b',
|
|
||||||
darkmagenta: '8b008b',
|
|
||||||
darkolivegreen: '556b2f',
|
|
||||||
darkorange: 'ff8c00',
|
|
||||||
darkorchid: '9932cc',
|
|
||||||
darkred: '8b0000',
|
|
||||||
darksalmon: 'e9967a',
|
|
||||||
darkseagreen: '8fbc8f',
|
|
||||||
darkslateblue: '483d8b',
|
|
||||||
darkslategray: '2f4f4f',
|
|
||||||
darkturquoise: '00ced1',
|
|
||||||
darkviolet: '9400d3',
|
|
||||||
deeppink: 'ff1493',
|
|
||||||
deepskyblue: '00bfff',
|
|
||||||
dimgray: '696969',
|
|
||||||
dodgerblue: '1e90ff',
|
|
||||||
feldspar: 'd19275',
|
|
||||||
firebrick: 'b22222',
|
|
||||||
floralwhite: 'fffaf0',
|
|
||||||
forestgreen: '228b22',
|
|
||||||
fuchsia: 'ff00ff',
|
|
||||||
gainsboro: 'dcdcdc',
|
|
||||||
ghostwhite: 'f8f8ff',
|
|
||||||
gold: 'ffd700',
|
|
||||||
goldenrod: 'daa520',
|
|
||||||
gray: '808080',
|
|
||||||
green: '008000',
|
|
||||||
greenyellow: 'adff2f',
|
|
||||||
honeydew: 'f0fff0',
|
|
||||||
hotpink: 'ff69b4',
|
|
||||||
indianred: 'cd5c5c',
|
|
||||||
indigo: '4b0082',
|
|
||||||
ivory: 'fffff0',
|
|
||||||
khaki: 'f0e68c',
|
|
||||||
lavender: 'e6e6fa',
|
|
||||||
lavenderblush: 'fff0f5',
|
|
||||||
lawngreen: '7cfc00',
|
|
||||||
lemonchiffon: 'fffacd',
|
|
||||||
lightblue: 'add8e6',
|
|
||||||
lightcoral: 'f08080',
|
|
||||||
lightcyan: 'e0ffff',
|
|
||||||
lightgoldenrodyellow: 'fafad2',
|
|
||||||
lightgrey: 'd3d3d3',
|
|
||||||
lightgreen: '90ee90',
|
|
||||||
lightpink: 'ffb6c1',
|
|
||||||
lightsalmon: 'ffa07a',
|
|
||||||
lightseagreen: '20b2aa',
|
|
||||||
lightskyblue: '87cefa',
|
|
||||||
lightslateblue: '8470ff',
|
|
||||||
lightslategray: '778899',
|
|
||||||
lightsteelblue: 'b0c4de',
|
|
||||||
lightyellow: 'ffffe0',
|
|
||||||
lime: '00ff00',
|
|
||||||
limegreen: '32cd32',
|
|
||||||
linen: 'faf0e6',
|
|
||||||
magenta: 'ff00ff',
|
|
||||||
maroon: '800000',
|
|
||||||
mediumaquamarine: '66cdaa',
|
|
||||||
mediumblue: '0000cd',
|
|
||||||
mediumorchid: 'ba55d3',
|
|
||||||
mediumpurple: '9370d8',
|
|
||||||
mediumseagreen: '3cb371',
|
|
||||||
mediumslateblue: '7b68ee',
|
|
||||||
mediumspringgreen: '00fa9a',
|
|
||||||
mediumturquoise: '48d1cc',
|
|
||||||
mediumvioletred: 'c71585',
|
|
||||||
midnightblue: '191970',
|
|
||||||
mintcream: 'f5fffa',
|
|
||||||
mistyrose: 'ffe4e1',
|
|
||||||
moccasin: 'ffe4b5',
|
|
||||||
navajowhite: 'ffdead',
|
|
||||||
navy: '000080',
|
|
||||||
oldlace: 'fdf5e6',
|
|
||||||
olive: '808000',
|
|
||||||
olivedrab: '6b8e23',
|
|
||||||
orange: 'ffa500',
|
|
||||||
orangered: 'ff4500',
|
|
||||||
orchid: 'da70d6',
|
|
||||||
palegoldenrod: 'eee8aa',
|
|
||||||
palegreen: '98fb98',
|
|
||||||
paleturquoise: 'afeeee',
|
|
||||||
palevioletred: 'd87093',
|
|
||||||
papayawhip: 'ffefd5',
|
|
||||||
peachpuff: 'ffdab9',
|
|
||||||
peru: 'cd853f',
|
|
||||||
pink: 'ffc0cb',
|
|
||||||
plum: 'dda0dd',
|
|
||||||
powderblue: 'b0e0e6',
|
|
||||||
purple: '800080',
|
|
||||||
red: 'ff0000',
|
|
||||||
rosybrown: 'bc8f8f',
|
|
||||||
royalblue: '4169e1',
|
|
||||||
saddlebrown: '8b4513',
|
|
||||||
salmon: 'fa8072',
|
|
||||||
sandybrown: 'f4a460',
|
|
||||||
seagreen: '2e8b57',
|
|
||||||
seashell: 'fff5ee',
|
|
||||||
sienna: 'a0522d',
|
|
||||||
silver: 'c0c0c0',
|
|
||||||
skyblue: '87ceeb',
|
|
||||||
slateblue: '6a5acd',
|
|
||||||
slategray: '708090',
|
|
||||||
snow: 'fffafa',
|
|
||||||
springgreen: '00ff7f',
|
|
||||||
steelblue: '4682b4',
|
|
||||||
tan: 'd2b48c',
|
|
||||||
teal: '008080',
|
|
||||||
thistle: 'd8bfd8',
|
|
||||||
tomato: 'ff6347',
|
|
||||||
turquoise: '40e0d0',
|
|
||||||
violet: 'ee82ee',
|
|
||||||
violetred: 'd02090',
|
|
||||||
wheat: 'f5deb3',
|
|
||||||
white: 'ffffff',
|
|
||||||
whitesmoke: 'f5f5f5',
|
|
||||||
yellow: 'ffff00',
|
|
||||||
yellowgreen: '9acd32'
|
|
||||||
};
|
|
||||||
|
|
||||||
// array of color definition objects
|
|
||||||
const colorDefs = [
|
|
||||||
{
|
|
||||||
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
|
|
||||||
// re: /^rgb\((?<r>\d{1,3}),\s*(?<g>\d{1,3}),\s*(?<b>\d{1,3})\)$/,
|
|
||||||
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
|
|
||||||
process (_, ...bits) {
|
|
||||||
return bits.map((b) => Number.parseInt(b));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
re: /^(\w{2})(\w{2})(\w{2})$/,
|
|
||||||
// re: /^(?<r>\w{2})(?<g>\w{2})(?<b>\w{2})$/,
|
|
||||||
example: ['#00ff00', '336699'],
|
|
||||||
process (_, ...bits) {
|
|
||||||
return bits.map((b) => Number.parseInt(b, 16));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
re: /^(\w)(\w)(\w)$/,
|
|
||||||
// re: /^(?<r>\w{1})(?<g>\w{1})(?<b>\w{1})$/,
|
|
||||||
example: ['#fb0', 'f0f'],
|
|
||||||
process (_, ...bits) {
|
|
||||||
return bits.map((b) => Number.parseInt(b + b, 16));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class to parse color values.
|
|
||||||
*/
|
|
||||||
export default class RGBColor {
|
|
||||||
/**
|
|
||||||
* @param {string} colorString
|
|
||||||
*/
|
|
||||||
constructor (colorString) {
|
|
||||||
this.ok = false;
|
|
||||||
|
|
||||||
// strip any leading #
|
|
||||||
if (colorString.charAt(0) === '#') { // remove # if any
|
|
||||||
colorString = colorString.substr(1, 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
colorString = colorString.replace(/ /g, '');
|
|
||||||
colorString = colorString.toLowerCase();
|
|
||||||
|
|
||||||
// before getting into regexps, try simple matches
|
|
||||||
// and overwrite the input
|
|
||||||
if (colorString in simpleColors) {
|
|
||||||
colorString = simpleColors[colorString];
|
|
||||||
}
|
|
||||||
// end of simple type-in colors
|
|
||||||
|
|
||||||
// search through the definitions to find a match
|
|
||||||
|
|
||||||
colorDefs.forEach(({re, process: processor}) => {
|
|
||||||
const bits = re.exec(colorString);
|
|
||||||
if (bits) {
|
|
||||||
const [r, g, b] = processor(...bits);
|
|
||||||
Object.assign(this, {r, g, b});
|
|
||||||
this.ok = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// validate/cleanup values
|
|
||||||
this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);
|
|
||||||
this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);
|
|
||||||
this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// some getters
|
|
||||||
/**
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
toRGB () {
|
|
||||||
return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
toHex () {
|
|
||||||
let r = this.r.toString(16);
|
|
||||||
let g = this.g.toString(16);
|
|
||||||
let b = this.b.toString(16);
|
|
||||||
if (r.length === 1) { r = '0' + r; }
|
|
||||||
if (g.length === 1) { g = '0' + g; }
|
|
||||||
if (b.length === 1) { b = '0' + b; }
|
|
||||||
return '#' + r + g + b;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Offers a bulleted list of help.
|
|
||||||
* @returns {HTMLUListElement}
|
|
||||||
*/
|
|
||||||
static getHelpXML () {
|
|
||||||
const examples = [
|
|
||||||
// add regexps
|
|
||||||
...colorDefs.flatMap(({example}) => {
|
|
||||||
return example;
|
|
||||||
}),
|
|
||||||
// add type-in colors
|
|
||||||
...Object.keys(simpleColors)
|
|
||||||
];
|
|
||||||
|
|
||||||
const xml = document.createElement('ul');
|
|
||||||
xml.setAttribute('id', 'rgbcolor-examples');
|
|
||||||
|
|
||||||
xml.append(...examples.map((example) => {
|
|
||||||
try {
|
|
||||||
const listItem = document.createElement('li');
|
|
||||||
const listColor = new RGBColor(example);
|
|
||||||
const exampleDiv = document.createElement('div');
|
|
||||||
exampleDiv.style.cssText = `
|
|
||||||
margin: 3px;
|
|
||||||
border: 1px solid black;
|
|
||||||
background: ${listColor.toHex()};
|
|
||||||
color: ${listColor.toHex()};`;
|
|
||||||
exampleDiv.append('test');
|
|
||||||
const listItemValue = ` ${example} -> ${listColor.toRGB()} -> ${listColor.toHex()}`;
|
|
||||||
listItem.append(exampleDiv, listItemValue);
|
|
||||||
return listItem;
|
|
||||||
} catch (e) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
return xml;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,102 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by alexey2baranov on 28.01.17.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
An extraction of the deparam method from Ben Alman's jQuery BBQ
|
|
||||||
http://benalman.com/projects/jquery-bbq-plugin/
|
|
||||||
*/
|
|
||||||
|
|
||||||
const coerce_types = {'true': !0, 'false': !1, 'null': null};
|
|
||||||
|
|
||||||
function deparam (params, coerce) {
|
|
||||||
// console.log(params)
|
|
||||||
const obj = {};
|
|
||||||
|
|
||||||
// Iterate over all name=value pairs.
|
|
||||||
params.replace(/\+/g, ' ').split('&').forEach(function (v) {
|
|
||||||
const param = v.split('=');
|
|
||||||
|
|
||||||
let
|
|
||||||
key = decodeURIComponent(param[0]),
|
|
||||||
// If key is more complex than 'foo', like 'a[]' or 'a[b][c]', split it
|
|
||||||
// into its component parts.
|
|
||||||
keys = key.split(']['),
|
|
||||||
keys_last = keys.length - 1;
|
|
||||||
|
|
||||||
// If the first keys part contains [ and the last ends with ], then []
|
|
||||||
// are correctly balanced.
|
|
||||||
if (/\[/.test(keys[0]) && /\]$/.test(keys[keys_last])) {
|
|
||||||
// Remove the trailing ] from the last keys part.
|
|
||||||
keys[keys_last] = keys[keys_last].replace(/\]$/, '');
|
|
||||||
|
|
||||||
// Split first keys part into two parts on the [ and add them back onto
|
|
||||||
// the beginning of the keys array.
|
|
||||||
keys = keys.shift().split('[').concat(keys);
|
|
||||||
|
|
||||||
keys_last = keys.length - 1;
|
|
||||||
} else {
|
|
||||||
// Basic 'foo' style key.
|
|
||||||
keys_last = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Are we dealing with a name=value pair, or just a name?
|
|
||||||
if (param.length >= 2) {
|
|
||||||
let val = decodeURIComponent(param.slice(1).join('='));
|
|
||||||
|
|
||||||
// Coerce values.
|
|
||||||
if (coerce) {
|
|
||||||
val = val && !isNaN(val) ? +val // number
|
|
||||||
: val === 'undefined' ? undefined // undefined
|
|
||||||
: coerce_types[val] !== undefined ? coerce_types[val] // true, false, null
|
|
||||||
: val; // string
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keys_last) {
|
|
||||||
let cur = obj;
|
|
||||||
// Complex key, build deep object structure based on a few rules:
|
|
||||||
// * The 'cur' pointer starts at the object top-level.
|
|
||||||
// * [] = array push (n is set to array length), [n] = array if n is
|
|
||||||
// numeric, otherwise object.
|
|
||||||
// * If at the last keys part, set the value.
|
|
||||||
// * For each keys part, if the current level is undefined create an
|
|
||||||
// object or array based on the type of the next keys part.
|
|
||||||
// * Move the 'cur' pointer to the next level.
|
|
||||||
// * Rinse & repeat.
|
|
||||||
for (let i = 0; i <= keys_last; i++) {
|
|
||||||
key = keys[i] === '' ? cur.length : keys[i];
|
|
||||||
cur = cur[key] = i < keys_last
|
|
||||||
? cur[key] || (keys[i + 1] && isNaN(keys[i + 1]) ? {} : [])
|
|
||||||
: val;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Simple key, even simpler rules, since only scalars and shallow
|
|
||||||
// arrays are allowed.
|
|
||||||
|
|
||||||
if (Array.isArray(obj[key])) {
|
|
||||||
// val is already an array, so push on the next value.
|
|
||||||
obj[key].push(val);
|
|
||||||
|
|
||||||
} else if (obj[key] !== undefined) {
|
|
||||||
// val isn't an array, but since a second value has been specified,
|
|
||||||
// convert val into an array.
|
|
||||||
obj[key] = [obj[key], val];
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// val is a scalar.
|
|
||||||
obj[key] = val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (key) {
|
|
||||||
// No value was defined, so set something meaningful.
|
|
||||||
obj[key] = coerce
|
|
||||||
? undefined
|
|
||||||
: '';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default deparam;
|
|
|
@ -1,121 +0,0 @@
|
||||||
// From https://github.com/inexorabletash/polyfill/blob/master/dom.js
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @module DOMPolyfill
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {Node} o
|
|
||||||
* @param {module:DOMPolyfill~ParentNode|module:DOMPolyfill~ChildNode} ps
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function mixin (o, ps) {
|
|
||||||
if (!o) return;
|
|
||||||
Object.keys(ps).forEach((p) => {
|
|
||||||
if ((p in o) || (p in o.prototype)) { return; }
|
|
||||||
try {
|
|
||||||
Object.defineProperty(
|
|
||||||
o.prototype,
|
|
||||||
p,
|
|
||||||
Object.getOwnPropertyDescriptor(ps, p)
|
|
||||||
);
|
|
||||||
} catch (ex) {
|
|
||||||
// Throws in IE8; just copy it
|
|
||||||
o[p] = ps[p];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {Node[]} nodes
|
|
||||||
* @returns {Node}
|
|
||||||
*/
|
|
||||||
function convertNodesIntoANode (nodes) {
|
|
||||||
nodes = nodes.map((node) => {
|
|
||||||
const isNode = node && typeof node === 'object' && 'nodeType' in node;
|
|
||||||
return isNode ? node : document.createTextNode(node);
|
|
||||||
});
|
|
||||||
if (nodes.length === 1) {
|
|
||||||
return nodes[0];
|
|
||||||
}
|
|
||||||
const node = document.createDocumentFragment();
|
|
||||||
nodes.forEach((n) => {
|
|
||||||
// // eslint-disable-next-line unicorn/prefer-node-append
|
|
||||||
node.appendChild(n);
|
|
||||||
});
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ParentNode = {
|
|
||||||
prepend (...nodes) {
|
|
||||||
nodes = convertNodesIntoANode(nodes);
|
|
||||||
this.insertBefore(nodes, this.firstChild);
|
|
||||||
},
|
|
||||||
append (...nodes) {
|
|
||||||
nodes = convertNodesIntoANode(nodes);
|
|
||||||
// // eslint-disable-next-line unicorn/prefer-node-append
|
|
||||||
this.appendChild(nodes);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
mixin(Document || HTMLDocument, ParentNode); // HTMLDocument for IE8
|
|
||||||
mixin(DocumentFragment, ParentNode);
|
|
||||||
mixin(Element, ParentNode);
|
|
||||||
|
|
||||||
// Mixin ChildNode
|
|
||||||
// https://dom.spec.whatwg.org/#interface-childnode
|
|
||||||
|
|
||||||
const ChildNode = {
|
|
||||||
before (...nodes) {
|
|
||||||
const parent = this.parentNode;
|
|
||||||
if (!parent) return;
|
|
||||||
let viablePreviousSibling = this.previousSibling;
|
|
||||||
while (nodes.includes(viablePreviousSibling)) {
|
|
||||||
viablePreviousSibling = viablePreviousSibling.previousSibling;
|
|
||||||
}
|
|
||||||
const node = convertNodesIntoANode(nodes);
|
|
||||||
parent.insertBefore(
|
|
||||||
node,
|
|
||||||
viablePreviousSibling
|
|
||||||
? viablePreviousSibling.nextSibling
|
|
||||||
: parent.firstChild
|
|
||||||
);
|
|
||||||
},
|
|
||||||
after (...nodes) {
|
|
||||||
const parent = this.parentNode;
|
|
||||||
if (!parent) return;
|
|
||||||
let viableNextSibling = this.nextSibling;
|
|
||||||
while (nodes.includes(viableNextSibling)) {
|
|
||||||
viableNextSibling = viableNextSibling.nextSibling;
|
|
||||||
}
|
|
||||||
const node = convertNodesIntoANode(nodes);
|
|
||||||
// eslint-disable-next-line unicorn/prefer-modern-dom-apis
|
|
||||||
parent.insertBefore(node, viableNextSibling);
|
|
||||||
},
|
|
||||||
replaceWith (...nodes) {
|
|
||||||
const parent = this.parentNode;
|
|
||||||
if (!parent) return;
|
|
||||||
let viableNextSibling = this.nextSibling;
|
|
||||||
while (nodes.includes(viableNextSibling)) {
|
|
||||||
viableNextSibling = viableNextSibling.nextSibling;
|
|
||||||
}
|
|
||||||
const node = convertNodesIntoANode(nodes);
|
|
||||||
|
|
||||||
if (this.parentNode === parent) {
|
|
||||||
parent.replaceChild(node, this);
|
|
||||||
} else {
|
|
||||||
// eslint-disable-next-line unicorn/prefer-modern-dom-apis
|
|
||||||
parent.insertBefore(node, viableNextSibling);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
remove () {
|
|
||||||
if (!this.parentNode) { return; }
|
|
||||||
this.parentNode.removeChild(this); // eslint-disable-line unicorn/prefer-node-remove
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
mixin(DocumentType, ChildNode);
|
|
||||||
mixin(Element, ChildNode);
|
|
||||||
mixin(CharacterData, ChildNode);
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,162 +0,0 @@
|
||||||
function _slicedToArray(arr, i) {
|
|
||||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
|
||||||
}
|
|
||||||
|
|
||||||
function _arrayWithHoles(arr) {
|
|
||||||
if (Array.isArray(arr)) return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _iterableToArrayLimit(arr, i) {
|
|
||||||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var _arr = [];
|
|
||||||
var _n = true;
|
|
||||||
var _d = false;
|
|
||||||
var _e = undefined;
|
|
||||||
|
|
||||||
try {
|
|
||||||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
||||||
_arr.push(_s.value);
|
|
||||||
|
|
||||||
if (i && _arr.length === i) break;
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
_d = true;
|
|
||||||
_e = err;
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (!_n && _i["return"] != null) _i["return"]();
|
|
||||||
} finally {
|
|
||||||
if (_d) throw _e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return _arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _nonIterableRest() {
|
|
||||||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadStylesheets(stylesheets) {
|
|
||||||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
||||||
beforeDefault = _ref.before,
|
|
||||||
afterDefault = _ref.after,
|
|
||||||
faviconDefault = _ref.favicon,
|
|
||||||
canvasDefault = _ref.canvas,
|
|
||||||
_ref$image = _ref.image,
|
|
||||||
imageDefault = _ref$image === void 0 ? true : _ref$image,
|
|
||||||
acceptErrors = _ref.acceptErrors;
|
|
||||||
|
|
||||||
stylesheets = Array.isArray(stylesheets) ? stylesheets : [stylesheets];
|
|
||||||
|
|
||||||
function setupLink(stylesheetURL) {
|
|
||||||
var options = {};
|
|
||||||
|
|
||||||
if (Array.isArray(stylesheetURL)) {
|
|
||||||
var _stylesheetURL = stylesheetURL;
|
|
||||||
|
|
||||||
var _stylesheetURL2 = _slicedToArray(_stylesheetURL, 2);
|
|
||||||
|
|
||||||
stylesheetURL = _stylesheetURL2[0];
|
|
||||||
var _stylesheetURL2$ = _stylesheetURL2[1];
|
|
||||||
options = _stylesheetURL2$ === void 0 ? {} : _stylesheetURL2$;
|
|
||||||
}
|
|
||||||
|
|
||||||
var _options = options,
|
|
||||||
_options$favicon = _options.favicon,
|
|
||||||
favicon = _options$favicon === void 0 ? faviconDefault : _options$favicon;
|
|
||||||
var _options2 = options,
|
|
||||||
_options2$before = _options2.before,
|
|
||||||
before = _options2$before === void 0 ? beforeDefault : _options2$before,
|
|
||||||
_options2$after = _options2.after,
|
|
||||||
after = _options2$after === void 0 ? afterDefault : _options2$after,
|
|
||||||
_options2$canvas = _options2.canvas,
|
|
||||||
canvas = _options2$canvas === void 0 ? canvasDefault : _options2$canvas,
|
|
||||||
_options2$image = _options2.image,
|
|
||||||
image = _options2$image === void 0 ? imageDefault : _options2$image;
|
|
||||||
|
|
||||||
function addLink() {
|
|
||||||
if (before) {
|
|
||||||
before.before(link);
|
|
||||||
} else if (after) {
|
|
||||||
after.after(link);
|
|
||||||
} else {
|
|
||||||
// eslint-disable-next-line unicorn/prefer-node-append
|
|
||||||
document.head.appendChild(link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var link = document.createElement('link'); // eslint-disable-next-line promise/avoid-new
|
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
var rej = reject;
|
|
||||||
|
|
||||||
if (acceptErrors) {
|
|
||||||
rej = typeof acceptErrors === 'function' ? function (error) {
|
|
||||||
acceptErrors({
|
|
||||||
error: error,
|
|
||||||
stylesheetURL: stylesheetURL,
|
|
||||||
options: options,
|
|
||||||
resolve: resolve,
|
|
||||||
reject: reject
|
|
||||||
});
|
|
||||||
} : resolve;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stylesheetURL.endsWith('.css')) {
|
|
||||||
favicon = false;
|
|
||||||
} else if (stylesheetURL.endsWith('.ico')) {
|
|
||||||
favicon = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (favicon) {
|
|
||||||
link.rel = 'shortcut icon';
|
|
||||||
link.type = 'image/x-icon';
|
|
||||||
|
|
||||||
if (image === false) {
|
|
||||||
link.href = stylesheetURL;
|
|
||||||
addLink();
|
|
||||||
resolve(link);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var cnv = document.createElement('canvas');
|
|
||||||
cnv.width = 16;
|
|
||||||
cnv.height = 16;
|
|
||||||
var context = cnv.getContext('2d');
|
|
||||||
var img = document.createElement('img');
|
|
||||||
img.addEventListener('error', function (error) {
|
|
||||||
reject(error);
|
|
||||||
});
|
|
||||||
img.addEventListener('load', function () {
|
|
||||||
context.drawImage(img, 0, 0);
|
|
||||||
link.href = canvas ? cnv.toDataURL('image/x-icon') : stylesheetURL;
|
|
||||||
addLink();
|
|
||||||
resolve(link);
|
|
||||||
});
|
|
||||||
img.src = stylesheetURL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
link.rel = 'stylesheet';
|
|
||||||
link.type = 'text/css';
|
|
||||||
link.href = stylesheetURL;
|
|
||||||
addLink();
|
|
||||||
link.addEventListener('error', function (error) {
|
|
||||||
rej(error);
|
|
||||||
});
|
|
||||||
link.addEventListener('load', function () {
|
|
||||||
resolve(link);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.all(stylesheets.map(function (stylesheetURL) {
|
|
||||||
return setupLink(stylesheetURL);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default loadStylesheets;
|
|
|
@ -1,580 +0,0 @@
|
||||||
function _typeof(obj) {
|
|
||||||
"@babel/helpers - typeof";
|
|
||||||
|
|
||||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
||||||
_typeof = function (obj) {
|
|
||||||
return typeof obj;
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
_typeof = function (obj) {
|
|
||||||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return _typeof(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _classCallCheck(instance, Constructor) {
|
|
||||||
if (!(instance instanceof Constructor)) {
|
|
||||||
throw new TypeError("Cannot call a class as a function");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* eslint-disable no-bitwise, unicorn/prefer-query-selector */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* StackBlur - a fast almost Gaussian Blur For Canvas
|
|
||||||
*
|
|
||||||
* In case you find this class useful - especially in commercial projects -
|
|
||||||
* I am not totally unhappy for a small donation to my PayPal account
|
|
||||||
* mario@quasimondo.de
|
|
||||||
*
|
|
||||||
* Or support me on flattr:
|
|
||||||
* {@link https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript}.
|
|
||||||
*
|
|
||||||
* @module StackBlur
|
|
||||||
* @author Mario Klingemann
|
|
||||||
* Contact: mario@quasimondo.com
|
|
||||||
* Website: {@link http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html}
|
|
||||||
* Twitter: @quasimondo
|
|
||||||
*
|
|
||||||
* @copyright (c) 2010 Mario Klingemann
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint-disable max-len */
|
|
||||||
var mulTable = [512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259];
|
|
||||||
var shgTable = [9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24];
|
|
||||||
/* eslint-enable max-len */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string|HTMLImageElement} img
|
|
||||||
* @param {string|HTMLCanvasElement} canvas
|
|
||||||
* @param {Float} radius
|
|
||||||
* @param {boolean} blurAlphaChannel
|
|
||||||
* @returns {undefined}
|
|
||||||
*/
|
|
||||||
|
|
||||||
function processImage(img, canvas, radius, blurAlphaChannel) {
|
|
||||||
if (typeof img === 'string') {
|
|
||||||
img = document.getElementById(img);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!img || !('naturalWidth' in img)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var w = img.naturalWidth;
|
|
||||||
var h = img.naturalHeight;
|
|
||||||
|
|
||||||
if (typeof canvas === 'string') {
|
|
||||||
canvas = document.getElementById(canvas);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!canvas || !('getContext' in canvas)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
canvas.style.width = w + 'px';
|
|
||||||
canvas.style.height = h + 'px';
|
|
||||||
canvas.width = w;
|
|
||||||
canvas.height = h;
|
|
||||||
var context = canvas.getContext('2d');
|
|
||||||
context.clearRect(0, 0, w, h);
|
|
||||||
context.drawImage(img, 0, 0);
|
|
||||||
|
|
||||||
if (isNaN(radius) || radius < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (blurAlphaChannel) {
|
|
||||||
processCanvasRGBA(canvas, 0, 0, w, h, radius);
|
|
||||||
} else {
|
|
||||||
processCanvasRGB(canvas, 0, 0, w, h, radius);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {string|HTMLCanvasElement} canvas
|
|
||||||
* @param {Integer} topX
|
|
||||||
* @param {Integer} topY
|
|
||||||
* @param {Integer} width
|
|
||||||
* @param {Integer} height
|
|
||||||
* @throws {Error|TypeError}
|
|
||||||
* @returns {ImageData} See {@link https://html.spec.whatwg.org/multipage/canvas.html#imagedata}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function getImageDataFromCanvas(canvas, topX, topY, width, height) {
|
|
||||||
if (typeof canvas === 'string') {
|
|
||||||
canvas = document.getElementById(canvas);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!canvas || _typeof(canvas) !== 'object' || !('getContext' in canvas)) {
|
|
||||||
throw new TypeError('Expecting canvas with `getContext` method ' + 'in processCanvasRGB(A) calls!');
|
|
||||||
}
|
|
||||||
|
|
||||||
var context = canvas.getContext('2d');
|
|
||||||
|
|
||||||
try {
|
|
||||||
return context.getImageData(topX, topY, width, height);
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('unable to access image data: ' + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {HTMLCanvasElement} canvas
|
|
||||||
* @param {Integer} topX
|
|
||||||
* @param {Integer} topY
|
|
||||||
* @param {Integer} width
|
|
||||||
* @param {Integer} height
|
|
||||||
* @param {Float} radius
|
|
||||||
* @returns {undefined}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function processCanvasRGBA(canvas, topX, topY, width, height, radius) {
|
|
||||||
if (isNaN(radius) || radius < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
radius |= 0;
|
|
||||||
var imageData = getImageDataFromCanvas(canvas, topX, topY, width, height);
|
|
||||||
imageData = processImageDataRGBA(imageData, topX, topY, width, height, radius);
|
|
||||||
canvas.getContext('2d').putImageData(imageData, topX, topY);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {ImageData} imageData
|
|
||||||
* @param {Integer} topX
|
|
||||||
* @param {Integer} topY
|
|
||||||
* @param {Integer} width
|
|
||||||
* @param {Integer} height
|
|
||||||
* @param {Float} radius
|
|
||||||
* @returns {ImageData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function processImageDataRGBA(imageData, topX, topY, width, height, radius) {
|
|
||||||
var pixels = imageData.data;
|
|
||||||
var x, y, i, p, yp, yi, yw, rSum, gSum, bSum, aSum, rOutSum, gOutSum, bOutSum, aOutSum, rInSum, gInSum, bInSum, aInSum, pr, pg, pb, pa, rbs;
|
|
||||||
var div = 2 * radius + 1; // const w4 = width << 2;
|
|
||||||
|
|
||||||
var widthMinus1 = width - 1;
|
|
||||||
var heightMinus1 = height - 1;
|
|
||||||
var radiusPlus1 = radius + 1;
|
|
||||||
var sumFactor = radiusPlus1 * (radiusPlus1 + 1) / 2;
|
|
||||||
var stackStart = new BlurStack();
|
|
||||||
var stack = stackStart;
|
|
||||||
var stackEnd;
|
|
||||||
|
|
||||||
for (i = 1; i < div; i++) {
|
|
||||||
stack = stack.next = new BlurStack();
|
|
||||||
|
|
||||||
if (i === radiusPlus1) {
|
|
||||||
stackEnd = stack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stack.next = stackStart;
|
|
||||||
var stackIn = null;
|
|
||||||
var stackOut = null;
|
|
||||||
yw = yi = 0;
|
|
||||||
var mulSum = mulTable[radius];
|
|
||||||
var shgSum = shgTable[radius];
|
|
||||||
|
|
||||||
for (y = 0; y < height; y++) {
|
|
||||||
rInSum = gInSum = bInSum = aInSum = rSum = gSum = bSum = aSum = 0;
|
|
||||||
rOutSum = radiusPlus1 * (pr = pixels[yi]);
|
|
||||||
gOutSum = radiusPlus1 * (pg = pixels[yi + 1]);
|
|
||||||
bOutSum = radiusPlus1 * (pb = pixels[yi + 2]);
|
|
||||||
aOutSum = radiusPlus1 * (pa = pixels[yi + 3]);
|
|
||||||
rSum += sumFactor * pr;
|
|
||||||
gSum += sumFactor * pg;
|
|
||||||
bSum += sumFactor * pb;
|
|
||||||
aSum += sumFactor * pa;
|
|
||||||
stack = stackStart;
|
|
||||||
|
|
||||||
for (i = 0; i < radiusPlus1; i++) {
|
|
||||||
stack.r = pr;
|
|
||||||
stack.g = pg;
|
|
||||||
stack.b = pb;
|
|
||||||
stack.a = pa;
|
|
||||||
stack = stack.next;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 1; i < radiusPlus1; i++) {
|
|
||||||
p = yi + ((widthMinus1 < i ? widthMinus1 : i) << 2);
|
|
||||||
rSum += (stack.r = pr = pixels[p]) * (rbs = radiusPlus1 - i);
|
|
||||||
gSum += (stack.g = pg = pixels[p + 1]) * rbs;
|
|
||||||
bSum += (stack.b = pb = pixels[p + 2]) * rbs;
|
|
||||||
aSum += (stack.a = pa = pixels[p + 3]) * rbs;
|
|
||||||
rInSum += pr;
|
|
||||||
gInSum += pg;
|
|
||||||
bInSum += pb;
|
|
||||||
aInSum += pa;
|
|
||||||
stack = stack.next;
|
|
||||||
}
|
|
||||||
|
|
||||||
stackIn = stackStart;
|
|
||||||
stackOut = stackEnd;
|
|
||||||
|
|
||||||
for (x = 0; x < width; x++) {
|
|
||||||
pixels[yi + 3] = pa = aSum * mulSum >> shgSum;
|
|
||||||
|
|
||||||
if (pa !== 0) {
|
|
||||||
pa = 255 / pa;
|
|
||||||
pixels[yi] = (rSum * mulSum >> shgSum) * pa;
|
|
||||||
pixels[yi + 1] = (gSum * mulSum >> shgSum) * pa;
|
|
||||||
pixels[yi + 2] = (bSum * mulSum >> shgSum) * pa;
|
|
||||||
} else {
|
|
||||||
pixels[yi] = pixels[yi + 1] = pixels[yi + 2] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
rSum -= rOutSum;
|
|
||||||
gSum -= gOutSum;
|
|
||||||
bSum -= bOutSum;
|
|
||||||
aSum -= aOutSum;
|
|
||||||
rOutSum -= stackIn.r;
|
|
||||||
gOutSum -= stackIn.g;
|
|
||||||
bOutSum -= stackIn.b;
|
|
||||||
aOutSum -= stackIn.a;
|
|
||||||
p = yw + ((p = x + radius + 1) < widthMinus1 ? p : widthMinus1) << 2;
|
|
||||||
rInSum += stackIn.r = pixels[p];
|
|
||||||
gInSum += stackIn.g = pixels[p + 1];
|
|
||||||
bInSum += stackIn.b = pixels[p + 2];
|
|
||||||
aInSum += stackIn.a = pixels[p + 3];
|
|
||||||
rSum += rInSum;
|
|
||||||
gSum += gInSum;
|
|
||||||
bSum += bInSum;
|
|
||||||
aSum += aInSum;
|
|
||||||
stackIn = stackIn.next;
|
|
||||||
rOutSum += pr = stackOut.r;
|
|
||||||
gOutSum += pg = stackOut.g;
|
|
||||||
bOutSum += pb = stackOut.b;
|
|
||||||
aOutSum += pa = stackOut.a;
|
|
||||||
rInSum -= pr;
|
|
||||||
gInSum -= pg;
|
|
||||||
bInSum -= pb;
|
|
||||||
aInSum -= pa;
|
|
||||||
stackOut = stackOut.next;
|
|
||||||
yi += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
yw += width;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (x = 0; x < width; x++) {
|
|
||||||
gInSum = bInSum = aInSum = rInSum = gSum = bSum = aSum = rSum = 0;
|
|
||||||
yi = x << 2;
|
|
||||||
rOutSum = radiusPlus1 * (pr = pixels[yi]);
|
|
||||||
gOutSum = radiusPlus1 * (pg = pixels[yi + 1]);
|
|
||||||
bOutSum = radiusPlus1 * (pb = pixels[yi + 2]);
|
|
||||||
aOutSum = radiusPlus1 * (pa = pixels[yi + 3]);
|
|
||||||
rSum += sumFactor * pr;
|
|
||||||
gSum += sumFactor * pg;
|
|
||||||
bSum += sumFactor * pb;
|
|
||||||
aSum += sumFactor * pa;
|
|
||||||
stack = stackStart;
|
|
||||||
|
|
||||||
for (i = 0; i < radiusPlus1; i++) {
|
|
||||||
stack.r = pr;
|
|
||||||
stack.g = pg;
|
|
||||||
stack.b = pb;
|
|
||||||
stack.a = pa;
|
|
||||||
stack = stack.next;
|
|
||||||
}
|
|
||||||
|
|
||||||
yp = width;
|
|
||||||
|
|
||||||
for (i = 1; i <= radius; i++) {
|
|
||||||
yi = yp + x << 2;
|
|
||||||
rSum += (stack.r = pr = pixels[yi]) * (rbs = radiusPlus1 - i);
|
|
||||||
gSum += (stack.g = pg = pixels[yi + 1]) * rbs;
|
|
||||||
bSum += (stack.b = pb = pixels[yi + 2]) * rbs;
|
|
||||||
aSum += (stack.a = pa = pixels[yi + 3]) * rbs;
|
|
||||||
rInSum += pr;
|
|
||||||
gInSum += pg;
|
|
||||||
bInSum += pb;
|
|
||||||
aInSum += pa;
|
|
||||||
stack = stack.next;
|
|
||||||
|
|
||||||
if (i < heightMinus1) {
|
|
||||||
yp += width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
yi = x;
|
|
||||||
stackIn = stackStart;
|
|
||||||
stackOut = stackEnd;
|
|
||||||
|
|
||||||
for (y = 0; y < height; y++) {
|
|
||||||
p = yi << 2;
|
|
||||||
pixels[p + 3] = pa = aSum * mulSum >> shgSum;
|
|
||||||
|
|
||||||
if (pa > 0) {
|
|
||||||
pa = 255 / pa;
|
|
||||||
pixels[p] = (rSum * mulSum >> shgSum) * pa;
|
|
||||||
pixels[p + 1] = (gSum * mulSum >> shgSum) * pa;
|
|
||||||
pixels[p + 2] = (bSum * mulSum >> shgSum) * pa;
|
|
||||||
} else {
|
|
||||||
pixels[p] = pixels[p + 1] = pixels[p + 2] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
rSum -= rOutSum;
|
|
||||||
gSum -= gOutSum;
|
|
||||||
bSum -= bOutSum;
|
|
||||||
aSum -= aOutSum;
|
|
||||||
rOutSum -= stackIn.r;
|
|
||||||
gOutSum -= stackIn.g;
|
|
||||||
bOutSum -= stackIn.b;
|
|
||||||
aOutSum -= stackIn.a;
|
|
||||||
p = x + ((p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1) * width << 2;
|
|
||||||
rSum += rInSum += stackIn.r = pixels[p];
|
|
||||||
gSum += gInSum += stackIn.g = pixels[p + 1];
|
|
||||||
bSum += bInSum += stackIn.b = pixels[p + 2];
|
|
||||||
aSum += aInSum += stackIn.a = pixels[p + 3];
|
|
||||||
stackIn = stackIn.next;
|
|
||||||
rOutSum += pr = stackOut.r;
|
|
||||||
gOutSum += pg = stackOut.g;
|
|
||||||
bOutSum += pb = stackOut.b;
|
|
||||||
aOutSum += pa = stackOut.a;
|
|
||||||
rInSum -= pr;
|
|
||||||
gInSum -= pg;
|
|
||||||
bInSum -= pb;
|
|
||||||
aInSum -= pa;
|
|
||||||
stackOut = stackOut.next;
|
|
||||||
yi += width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return imageData;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {HTMLCanvasElement} canvas
|
|
||||||
* @param {Integer} topX
|
|
||||||
* @param {Integer} topY
|
|
||||||
* @param {Integer} width
|
|
||||||
* @param {Integer} height
|
|
||||||
* @param {Float} radius
|
|
||||||
* @returns {undefined}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function processCanvasRGB(canvas, topX, topY, width, height, radius) {
|
|
||||||
if (isNaN(radius) || radius < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
radius |= 0;
|
|
||||||
var imageData = getImageDataFromCanvas(canvas, topX, topY, width, height);
|
|
||||||
imageData = processImageDataRGB(imageData, topX, topY, width, height, radius);
|
|
||||||
canvas.getContext('2d').putImageData(imageData, topX, topY);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {ImageData} imageData
|
|
||||||
* @param {Integer} topX
|
|
||||||
* @param {Integer} topY
|
|
||||||
* @param {Integer} width
|
|
||||||
* @param {Integer} height
|
|
||||||
* @param {Float} radius
|
|
||||||
* @returns {ImageData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function processImageDataRGB(imageData, topX, topY, width, height, radius) {
|
|
||||||
var pixels = imageData.data;
|
|
||||||
var x, y, i, p, yp, yi, yw, rSum, gSum, bSum, rOutSum, gOutSum, bOutSum, rInSum, gInSum, bInSum, pr, pg, pb, rbs;
|
|
||||||
var div = 2 * radius + 1; // const w4 = width << 2;
|
|
||||||
|
|
||||||
var widthMinus1 = width - 1;
|
|
||||||
var heightMinus1 = height - 1;
|
|
||||||
var radiusPlus1 = radius + 1;
|
|
||||||
var sumFactor = radiusPlus1 * (radiusPlus1 + 1) / 2;
|
|
||||||
var stackStart = new BlurStack();
|
|
||||||
var stack = stackStart;
|
|
||||||
var stackEnd;
|
|
||||||
|
|
||||||
for (i = 1; i < div; i++) {
|
|
||||||
stack = stack.next = new BlurStack();
|
|
||||||
|
|
||||||
if (i === radiusPlus1) {
|
|
||||||
stackEnd = stack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stack.next = stackStart;
|
|
||||||
var stackIn = null;
|
|
||||||
var stackOut = null;
|
|
||||||
yw = yi = 0;
|
|
||||||
var mulSum = mulTable[radius];
|
|
||||||
var shgSum = shgTable[radius];
|
|
||||||
|
|
||||||
for (y = 0; y < height; y++) {
|
|
||||||
rInSum = gInSum = bInSum = rSum = gSum = bSum = 0;
|
|
||||||
rOutSum = radiusPlus1 * (pr = pixels[yi]);
|
|
||||||
gOutSum = radiusPlus1 * (pg = pixels[yi + 1]);
|
|
||||||
bOutSum = radiusPlus1 * (pb = pixels[yi + 2]);
|
|
||||||
rSum += sumFactor * pr;
|
|
||||||
gSum += sumFactor * pg;
|
|
||||||
bSum += sumFactor * pb;
|
|
||||||
stack = stackStart;
|
|
||||||
|
|
||||||
for (i = 0; i < radiusPlus1; i++) {
|
|
||||||
stack.r = pr;
|
|
||||||
stack.g = pg;
|
|
||||||
stack.b = pb;
|
|
||||||
stack = stack.next;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 1; i < radiusPlus1; i++) {
|
|
||||||
p = yi + ((widthMinus1 < i ? widthMinus1 : i) << 2);
|
|
||||||
rSum += (stack.r = pr = pixels[p]) * (rbs = radiusPlus1 - i);
|
|
||||||
gSum += (stack.g = pg = pixels[p + 1]) * rbs;
|
|
||||||
bSum += (stack.b = pb = pixels[p + 2]) * rbs;
|
|
||||||
rInSum += pr;
|
|
||||||
gInSum += pg;
|
|
||||||
bInSum += pb;
|
|
||||||
stack = stack.next;
|
|
||||||
}
|
|
||||||
|
|
||||||
stackIn = stackStart;
|
|
||||||
stackOut = stackEnd;
|
|
||||||
|
|
||||||
for (x = 0; x < width; x++) {
|
|
||||||
pixels[yi] = rSum * mulSum >> shgSum;
|
|
||||||
pixels[yi + 1] = gSum * mulSum >> shgSum;
|
|
||||||
pixels[yi + 2] = bSum * mulSum >> shgSum;
|
|
||||||
rSum -= rOutSum;
|
|
||||||
gSum -= gOutSum;
|
|
||||||
bSum -= bOutSum;
|
|
||||||
rOutSum -= stackIn.r;
|
|
||||||
gOutSum -= stackIn.g;
|
|
||||||
bOutSum -= stackIn.b;
|
|
||||||
p = yw + ((p = x + radius + 1) < widthMinus1 ? p : widthMinus1) << 2;
|
|
||||||
rInSum += stackIn.r = pixels[p];
|
|
||||||
gInSum += stackIn.g = pixels[p + 1];
|
|
||||||
bInSum += stackIn.b = pixels[p + 2];
|
|
||||||
rSum += rInSum;
|
|
||||||
gSum += gInSum;
|
|
||||||
bSum += bInSum;
|
|
||||||
stackIn = stackIn.next;
|
|
||||||
rOutSum += pr = stackOut.r;
|
|
||||||
gOutSum += pg = stackOut.g;
|
|
||||||
bOutSum += pb = stackOut.b;
|
|
||||||
rInSum -= pr;
|
|
||||||
gInSum -= pg;
|
|
||||||
bInSum -= pb;
|
|
||||||
stackOut = stackOut.next;
|
|
||||||
yi += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
yw += width;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (x = 0; x < width; x++) {
|
|
||||||
gInSum = bInSum = rInSum = gSum = bSum = rSum = 0;
|
|
||||||
yi = x << 2;
|
|
||||||
rOutSum = radiusPlus1 * (pr = pixels[yi]);
|
|
||||||
gOutSum = radiusPlus1 * (pg = pixels[yi + 1]);
|
|
||||||
bOutSum = radiusPlus1 * (pb = pixels[yi + 2]);
|
|
||||||
rSum += sumFactor * pr;
|
|
||||||
gSum += sumFactor * pg;
|
|
||||||
bSum += sumFactor * pb;
|
|
||||||
stack = stackStart;
|
|
||||||
|
|
||||||
for (i = 0; i < radiusPlus1; i++) {
|
|
||||||
stack.r = pr;
|
|
||||||
stack.g = pg;
|
|
||||||
stack.b = pb;
|
|
||||||
stack = stack.next;
|
|
||||||
}
|
|
||||||
|
|
||||||
yp = width;
|
|
||||||
|
|
||||||
for (i = 1; i <= radius; i++) {
|
|
||||||
yi = yp + x << 2;
|
|
||||||
rSum += (stack.r = pr = pixels[yi]) * (rbs = radiusPlus1 - i);
|
|
||||||
gSum += (stack.g = pg = pixels[yi + 1]) * rbs;
|
|
||||||
bSum += (stack.b = pb = pixels[yi + 2]) * rbs;
|
|
||||||
rInSum += pr;
|
|
||||||
gInSum += pg;
|
|
||||||
bInSum += pb;
|
|
||||||
stack = stack.next;
|
|
||||||
|
|
||||||
if (i < heightMinus1) {
|
|
||||||
yp += width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
yi = x;
|
|
||||||
stackIn = stackStart;
|
|
||||||
stackOut = stackEnd;
|
|
||||||
|
|
||||||
for (y = 0; y < height; y++) {
|
|
||||||
p = yi << 2;
|
|
||||||
pixels[p] = rSum * mulSum >> shgSum;
|
|
||||||
pixels[p + 1] = gSum * mulSum >> shgSum;
|
|
||||||
pixels[p + 2] = bSum * mulSum >> shgSum;
|
|
||||||
rSum -= rOutSum;
|
|
||||||
gSum -= gOutSum;
|
|
||||||
bSum -= bOutSum;
|
|
||||||
rOutSum -= stackIn.r;
|
|
||||||
gOutSum -= stackIn.g;
|
|
||||||
bOutSum -= stackIn.b;
|
|
||||||
p = x + ((p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1) * width << 2;
|
|
||||||
rSum += rInSum += stackIn.r = pixels[p];
|
|
||||||
gSum += gInSum += stackIn.g = pixels[p + 1];
|
|
||||||
bSum += bInSum += stackIn.b = pixels[p + 2];
|
|
||||||
stackIn = stackIn.next;
|
|
||||||
rOutSum += pr = stackOut.r;
|
|
||||||
gOutSum += pg = stackOut.g;
|
|
||||||
bOutSum += pb = stackOut.b;
|
|
||||||
rInSum -= pr;
|
|
||||||
gInSum -= pg;
|
|
||||||
bInSum -= pb;
|
|
||||||
stackOut = stackOut.next;
|
|
||||||
yi += width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return imageData;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
var BlurStack =
|
|
||||||
/**
|
|
||||||
* Set properties.
|
|
||||||
*/
|
|
||||||
function BlurStack() {
|
|
||||||
_classCallCheck(this, BlurStack);
|
|
||||||
|
|
||||||
this.r = 0;
|
|
||||||
this.g = 0;
|
|
||||||
this.b = 0;
|
|
||||||
this.a = 0;
|
|
||||||
this.next = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export { BlurStack, processCanvasRGB as canvasRGB, processCanvasRGBA as canvasRGBA, processImage as image, processImageDataRGB as imageDataRGB, processImageDataRGBA as imageDataRGBA };
|
|
|
@ -17,7 +17,7 @@
|
||||||
import {jsPDF} from 'jspdf/dist/jspdf.es.min.js';
|
import {jsPDF} from 'jspdf/dist/jspdf.es.min.js';
|
||||||
import 'svg2pdf.js/dist/svg2pdf.es.js';
|
import 'svg2pdf.js/dist/svg2pdf.es.js';
|
||||||
|
|
||||||
import {canvg} from '../external/canvg/canvg.js';
|
import {Canvg as canvg} from 'canvg';
|
||||||
|
|
||||||
import '../common/svgpathseg.js';
|
import '../common/svgpathseg.js';
|
||||||
import jQueryPluginSVG from '../common/jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr`
|
import jQueryPluginSVG from '../common/jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr`
|
||||||
|
|
Loading…
Reference in New Issue