From d90d8fcc2d18f0aad508af9a502811c87084ac0f Mon Sep 17 00:00:00 2001 From: Tyler Shaddix Date: Thu, 16 Nov 2023 13:48:27 -0800 Subject: [PATCH] Update build system, packages, and code style --- .github/workflows/build.yaml | 23 + .gitignore | 118 +- .nvmrc | 2 +- .prettierrc | 4 + LICENSE | 42 +- README.md | 52 +- dist/index.es.js | 485 +++ dist/index.es.js.map | 1 + dist/index.umd.js | 2 + dist/index.umd.js.map | 1 + example/build/example.es.js | 496 +++ example/build/example.es.js.map | 1 + example/build/example.js | 1576 ---------- example/build/example.js.map | 1 - example/build/example.umd.js | 2 + example/build/example.umd.js.map | 1 + example/index.html | 42 +- example/src/example.ts | 44 +- example/vite.config.js | 25 + example/webpack.config.js | 26 - lib/index.js | 1462 --------- lib/index.js.map | 1 - package-lock.json | 5067 +++++------------------------- package.json | 71 +- src/Manager.d.ts | 90 +- src/Manager.js | 121 + src/Manager.js.map | 1 + src/Manager.ts | 6 +- src/StrokeManager.d.ts | 110 +- src/StrokeManager.js | 173 + src/StrokeManager.js.map | 1 + src/StrokeManager.ts | 26 +- src/index.d.ts | 8 +- src/index.js | 12 + src/index.js.map | 1 + src/tools/EraserTool.d.ts | 37 +- src/tools/EraserTool.js | 53 + src/tools/EraserTool.js.map | 1 + src/tools/EraserTool.ts | 14 +- src/tools/HighlighterTool.d.ts | 25 +- src/tools/HighlighterTool.js | 32 + src/tools/HighlighterTool.js.map | 1 + src/tools/HighlighterTool.ts | 16 +- src/tools/PenTool.d.ts | 24 +- src/tools/PenTool.js | 30 + src/tools/PenTool.js.map | 1 + src/tools/PenTool.ts | 2 +- src/types.d.ts | 15 + src/types.js | 3 + src/types.js.map | 1 + src/util.d.ts | 32 +- src/util.js | 34 + src/util.js.map | 1 + src/util.ts | 6 +- tsconfig.json | 20 +- vite.config.js | 25 + webpack.config.js | 28 - 57 files changed, 2721 insertions(+), 7774 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .prettierrc create mode 100644 dist/index.es.js create mode 100644 dist/index.es.js.map create mode 100644 dist/index.umd.js create mode 100644 dist/index.umd.js.map create mode 100644 example/build/example.es.js create mode 100644 example/build/example.es.js.map delete mode 100644 example/build/example.js delete mode 100644 example/build/example.js.map create mode 100644 example/build/example.umd.js create mode 100644 example/build/example.umd.js.map create mode 100644 example/vite.config.js delete mode 100644 example/webpack.config.js delete mode 100644 lib/index.js delete mode 100644 lib/index.js.map create mode 100644 src/Manager.js create mode 100644 src/Manager.js.map create mode 100644 src/StrokeManager.js create mode 100644 src/StrokeManager.js.map create mode 100644 src/index.js create mode 100644 src/index.js.map create mode 100644 src/tools/EraserTool.js create mode 100644 src/tools/EraserTool.js.map create mode 100644 src/tools/HighlighterTool.js create mode 100644 src/tools/HighlighterTool.js.map create mode 100644 src/tools/PenTool.js create mode 100644 src/tools/PenTool.js.map create mode 100644 src/types.d.ts create mode 100644 src/types.js create mode 100644 src/types.js.map create mode 100644 src/util.js create mode 100644 src/util.js.map create mode 100644 vite.config.js delete mode 100644 webpack.config.js diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..20e0c06 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,23 @@ +name: build + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + cache-dependency-path: "package-lock.json" + - run: npm ci + - run: npm run typecheck + - run: npm run prettier diff --git a/.gitignore b/.gitignore index 00cbbdf..8531f93 100644 --- a/.gitignore +++ b/.gitignore @@ -1,59 +1,59 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Typescript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env - +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + diff --git a/.nvmrc b/.nvmrc index 24458a5..af135da 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v9.4.0 +v18.17.1 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..222861c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 2, + "useTabs": false +} diff --git a/LICENSE b/LICENSE index 072a54c..06ce752 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2018 Tyler Shaddix - -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. +MIT License + +Copyright (c) 2018 Tyler Shaddix + +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. diff --git a/README.md b/README.md index ed78994..7202d2e 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,26 @@ -# paintbricks -An extendable drawing system built for the web. - -## Install -``` -npm install --save paintbricks -``` - -## Usage - -```js -// import manager and tool -import {Manager, PenTool} from "paintbricks"; - -// Create a new manager -const manager = new Manager(canvasElem, canvasWidth, canvasHeight); - -// create a new pen tool with color and stroke width -const penTool = new PenTool("blue", 5); - -// set the current tool as the pen tool -manager.setTool(penTool); - -// ... draw :) -``` - +# paintbricks +An extendable drawing system built for the web. + +## Install +``` +npm install --save paintbricks +``` + +## Usage + +```js +// import manager and tool +import {Manager, PenTool} from "paintbricks"; + +// Create a new manager +const manager = new Manager(canvasElem, canvasWidth, canvasHeight); + +// create a new pen tool with color and stroke width +const penTool = new PenTool("blue", 5); + +// set the current tool as the pen tool +manager.setTool(penTool); + +// ... draw :) +``` + diff --git a/dist/index.es.js b/dist/index.es.js new file mode 100644 index 0000000..7bab69d --- /dev/null +++ b/dist/index.es.js @@ -0,0 +1,485 @@ +function g(e, t) { + return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2)); +} +function y(e, t) { + const i = g(e, t), o = { + x: t.x - e.x, + y: t.y - e.y + }; + return { + x: o.x / i, + y: o.y / i + }; +} +class k { + constructor(t) { + this.canvas = t, this.lastTouch = null, this.sensitivity = 20, this.lastStrokeParts = [], this.onStrokePartHandlers = [], this.onTouchStart = this.onTouchStart.bind(this), this.onTouchEnd = this.onTouchEnd.bind(this), this.onTouchCancel = this.onTouchCancel.bind(this), this.onTouchMove = this.onTouchMove.bind(this), this.destroy = this.destroy.bind(this), this.getRelativePosition = this.getRelativePosition.bind(this), this.canvas.addEventListener("touchstart", this.onTouchStart, { + passive: !1 + }), this.canvas.addEventListener("touchend", this.onTouchEnd, { + passive: !1 + }), this.canvas.addEventListener("touchcancel", this.onTouchCancel, { + passive: !1 + }), this.canvas.addEventListener("touchmove", this.onTouchMove, { + passive: !1 + }); + } + /** + * Registers a handler to be fired on a new stroke part + * @param handler + */ + onStrokePart(t) { + this.onStrokePartHandlers.push(t); + } + /** + * Removes all active listeners + */ + destroy() { + this.onStrokePartHandlers = [], this.lastStrokeParts = [], this.canvas.removeEventListener("touchstart", this.onTouchStart), this.canvas.removeEventListener("touchend", this.onTouchEnd), this.canvas.removeEventListener("touchcancel", this.onTouchCancel), this.canvas.removeEventListener("touchmove", this.onTouchMove); + } + /** + * Get relative position to canvas + * @param clientX + * @param clientY + * @returns IPoint + */ + getRelativePosition(t, i) { + const o = this.canvas.getBoundingClientRect(); + return { + x: t - o.left, + y: i - o.top + }; + } + /** + * Creates a new touch if one does not + * already exist + * @param e + */ + onTouchStart(t) { + if (t.preventDefault(), this.lastTouch) + return; + const o = t.changedTouches.item(0); + this.lastTouch = { + id: o.identifier, + position: this.getRelativePosition(o.clientX, o.clientY) + }; + } + /** + * Creates a line from last touch to current touch + * point and emits event. Does no-op if no existing touch + * @param e + */ + onTouchMove(t) { + if (t.preventDefault(), !this.lastTouch) + return; + const i = t.changedTouches, o = Array.from(i).find((a) => a.identifier === this.lastTouch.id); + if (!o) + return; + const n = { + id: o.identifier, + position: this.getRelativePosition(o.clientX, o.clientY) + }; + if (this.sensitivity && g(n.position, this.lastTouch.position) < 10 / this.sensitivity) + return; + const s = { + endPoint: n.position, + startPoint: this.lastTouch.position, + isStart: this.lastStrokeParts.length === 0, + isEnd: !1 + }; + this.onStrokePartHandlers.forEach((a) => { + a(s); + }), this.lastTouch = n, this.lastStrokeParts.push(s); + } + /** + * Draws a line from last point to final point. Removes + * the reference to last touch point. + * @param e + */ + onTouchEnd(t) { + if (t.preventDefault(), !this.lastTouch) + return; + const i = t.changedTouches, o = Array.from(i).find((a) => a.identifier === this.lastTouch.id); + if (!o) + return; + const n = this.getRelativePosition(o.clientX, o.clientY), s = { + startPoint: this.lastTouch.position, + endPoint: n, + isStart: !1, + isEnd: !0 + }; + this.onStrokePartHandlers.forEach((a) => { + a(s); + }), this.lastTouch = null, this.lastStrokeParts = []; + } + /** + * Removes the current last touch point + * @param e + */ + onTouchCancel(t) { + t.preventDefault(), this.lastTouch = null, this.lastStrokeParts = []; + } +} +class P { + constructor(t, i, o) { + this.canvas = t, this.canvasWidth = i, this.canvasHeight = o, this.currentTool = null, this.currentStroke = [], this.strokeManager = new k(t), this.canvasState = null, this.shouldDraw = !1, this.shouldCommit = !1; + const n = t.getContext("2d").backingStorePixelRatio || 1, s = window.devicePixelRatio || 1; + this.pixelRatio = s / n, this.setCanvasSize = this.setCanvasSize.bind(this), this.setTool = this.setTool.bind(this), this.destroy = this.destroy.bind(this), this.clear = this.clear.bind(this), this.draw = this.draw.bind(this), this.onStrokePart = this.onStrokePart.bind(this), this.nextAnimationFrame = window.requestAnimationFrame(this.draw), this.strokeManager.onStrokePart(this.onStrokePart), this.setCanvasSize(i, o); + } + /** + * Sets the canvas desired width and height and sets transform + * for hifi displays + * @param width + * @param height + */ + setCanvasSize(t, i) { + this.canvasWidth = t, this.canvasHeight = i; + const { canvas: o, canvasWidth: n, canvasHeight: s, pixelRatio: a } = this, h = o.getContext("2d"); + o.width = n * a, o.height = s * a, o.style.width = n + "px", o.style.height = s + "px", h.setTransform(a, 0, 0, a, 0, 0); + } + /** + * Sets the current tool for the manager + * @param tool + */ + setTool(t) { + this.currentTool = t; + } + /** + * Remove all event listeners + */ + destroy() { + window.cancelAnimationFrame(this.nextAnimationFrame), this.strokeManager.destroy(); + } + /** + * Clears the canvas + */ + clear() { + this.canvasState = null, this.currentStroke = [], this.shouldDraw = !0, this.shouldCommit = !0; + } + /** + * Adds a new stroke part to the nextStrokes + * array + * @param strokePart + */ + onStrokePart(t) { + this.currentStroke.push(t), this.shouldDraw = !0, t.isEnd && (this.shouldCommit = !0); + } + /** + * Draws a frame + */ + draw() { + this.nextAnimationFrame = window.requestAnimationFrame(this.draw); + const t = this.canvas.getContext("2d"); + this.shouldDraw && (t.clearRect(0, 0, this.canvasWidth, this.canvasHeight), this.canvasState && t.putImageData(this.canvasState, 0, 0), this.currentTool && this.currentStroke.length && (t.save(), this.currentTool.draw(t, this.currentStroke), t.restore()), this.shouldCommit && (this.canvasState = t.getImageData( + 0, + 0, + this.canvasWidth * this.pixelRatio, + this.canvasHeight * this.pixelRatio + ), this.currentStroke = [], this.shouldCommit = !1), this.shouldDraw = !1); + } +} +class C { + constructor(t = "red", i = 3) { + this.color = t, this.width = i; + } + /** + * Draws a "pen stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(t, i) { + const o = i[0]; + t.beginPath(), t.lineWidth = this.width, t.strokeStyle = this.color, t.lineCap = "round", t.lineJoin = "round", t.moveTo(o.startPoint.x, o.startPoint.y), i.forEach((n) => { + const { endPoint: s } = n; + t.lineTo(s.x, s.y); + }), t.stroke(); + } +} +class E { + constructor(t = 10, i) { + this.width = t, i = i || {}, this.handleOpts = { + hide: i.hide || !1, + strokeWidth: i.strokeWidth || 2, + fillColor: i.fillColor || "white", + strokeColor: i.strokeColor || "black" + }; + } + /** + * Draws an "eraser stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(t, i) { + const { handleOpts: o } = this, n = this.width / 2; + i.forEach((a) => { + const { startPoint: h, endPoint: l, isEnd: f } = a, d = g(h, l), v = y(h, l); + let r = h, u = 0; + for (; u < d; ) { + const c = { + x: r.x + v.x, + y: r.y + v.y + }; + t.clearRect( + c.x - n, + c.y - n, + this.width, + this.width + ), u++, r = c; + } + }); + const s = i[i.length - 1]; + !s.isEnd && !o.hide && (t.strokeStyle = o.strokeColor, t.fillStyle = o.fillColor, t.fillRect( + s.endPoint.x - n, + s.endPoint.y - n, + this.width, + this.width + ), t.strokeRect( + s.endPoint.x - n + 0.5, + s.endPoint.y - n + 0.5, + this.width - 1, + this.width - 1 + )); + } +} +function w(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var b = { + aliceblue: [240, 248, 255], + antiquewhite: [250, 235, 215], + aqua: [0, 255, 255], + aquamarine: [127, 255, 212], + azure: [240, 255, 255], + beige: [245, 245, 220], + bisque: [255, 228, 196], + black: [0, 0, 0], + blanchedalmond: [255, 235, 205], + blue: [0, 0, 255], + blueviolet: [138, 43, 226], + brown: [165, 42, 42], + burlywood: [222, 184, 135], + cadetblue: [95, 158, 160], + chartreuse: [127, 255, 0], + chocolate: [210, 105, 30], + coral: [255, 127, 80], + cornflowerblue: [100, 149, 237], + cornsilk: [255, 248, 220], + crimson: [220, 20, 60], + cyan: [0, 255, 255], + darkblue: [0, 0, 139], + darkcyan: [0, 139, 139], + darkgoldenrod: [184, 134, 11], + darkgray: [169, 169, 169], + darkgreen: [0, 100, 0], + darkgrey: [169, 169, 169], + darkkhaki: [189, 183, 107], + darkmagenta: [139, 0, 139], + darkolivegreen: [85, 107, 47], + darkorange: [255, 140, 0], + darkorchid: [153, 50, 204], + darkred: [139, 0, 0], + darksalmon: [233, 150, 122], + darkseagreen: [143, 188, 143], + darkslateblue: [72, 61, 139], + darkslategray: [47, 79, 79], + darkslategrey: [47, 79, 79], + darkturquoise: [0, 206, 209], + darkviolet: [148, 0, 211], + deeppink: [255, 20, 147], + deepskyblue: [0, 191, 255], + dimgray: [105, 105, 105], + dimgrey: [105, 105, 105], + dodgerblue: [30, 144, 255], + firebrick: [178, 34, 34], + floralwhite: [255, 250, 240], + forestgreen: [34, 139, 34], + fuchsia: [255, 0, 255], + gainsboro: [220, 220, 220], + ghostwhite: [248, 248, 255], + gold: [255, 215, 0], + goldenrod: [218, 165, 32], + gray: [128, 128, 128], + green: [0, 128, 0], + greenyellow: [173, 255, 47], + grey: [128, 128, 128], + honeydew: [240, 255, 240], + hotpink: [255, 105, 180], + indianred: [205, 92, 92], + indigo: [75, 0, 130], + ivory: [255, 255, 240], + khaki: [240, 230, 140], + lavender: [230, 230, 250], + lavenderblush: [255, 240, 245], + lawngreen: [124, 252, 0], + lemonchiffon: [255, 250, 205], + lightblue: [173, 216, 230], + lightcoral: [240, 128, 128], + lightcyan: [224, 255, 255], + lightgoldenrodyellow: [250, 250, 210], + lightgray: [211, 211, 211], + lightgreen: [144, 238, 144], + lightgrey: [211, 211, 211], + lightpink: [255, 182, 193], + lightsalmon: [255, 160, 122], + lightseagreen: [32, 178, 170], + lightskyblue: [135, 206, 250], + lightslategray: [119, 136, 153], + lightslategrey: [119, 136, 153], + lightsteelblue: [176, 196, 222], + lightyellow: [255, 255, 224], + lime: [0, 255, 0], + limegreen: [50, 205, 50], + linen: [250, 240, 230], + magenta: [255, 0, 255], + maroon: [128, 0, 0], + mediumaquamarine: [102, 205, 170], + mediumblue: [0, 0, 205], + mediumorchid: [186, 85, 211], + mediumpurple: [147, 112, 219], + mediumseagreen: [60, 179, 113], + mediumslateblue: [123, 104, 238], + mediumspringgreen: [0, 250, 154], + mediumturquoise: [72, 209, 204], + mediumvioletred: [199, 21, 133], + midnightblue: [25, 25, 112], + mintcream: [245, 255, 250], + mistyrose: [255, 228, 225], + moccasin: [255, 228, 181], + navajowhite: [255, 222, 173], + navy: [0, 0, 128], + oldlace: [253, 245, 230], + olive: [128, 128, 0], + olivedrab: [107, 142, 35], + orange: [255, 165, 0], + orangered: [255, 69, 0], + orchid: [218, 112, 214], + palegoldenrod: [238, 232, 170], + palegreen: [152, 251, 152], + paleturquoise: [175, 238, 238], + palevioletred: [219, 112, 147], + papayawhip: [255, 239, 213], + peachpuff: [255, 218, 185], + peru: [205, 133, 63], + pink: [255, 192, 203], + plum: [221, 160, 221], + powderblue: [176, 224, 230], + purple: [128, 0, 128], + rebeccapurple: [102, 51, 153], + red: [255, 0, 0], + rosybrown: [188, 143, 143], + royalblue: [65, 105, 225], + saddlebrown: [139, 69, 19], + salmon: [250, 128, 114], + sandybrown: [244, 164, 96], + seagreen: [46, 139, 87], + seashell: [255, 245, 238], + sienna: [160, 82, 45], + silver: [192, 192, 192], + skyblue: [135, 206, 235], + slateblue: [106, 90, 205], + slategray: [112, 128, 144], + slategrey: [112, 128, 144], + snow: [255, 250, 250], + springgreen: [0, 255, 127], + steelblue: [70, 130, 180], + tan: [210, 180, 140], + teal: [0, 128, 128], + thistle: [216, 191, 216], + tomato: [255, 99, 71], + turquoise: [64, 224, 208], + violet: [238, 130, 238], + wheat: [245, 222, 179], + white: [255, 255, 255], + whitesmoke: [245, 245, 245], + yellow: [255, 255, 0], + yellowgreen: [154, 205, 50] +}; +const p = /* @__PURE__ */ w(b); +var m = { + red: 0, + orange: 60, + yellow: 120, + green: 180, + blue: 240, + purple: 300 +}; +function T(e) { + var t, i = [], o = 1, n; + if (typeof e == "string") + if (e = e.toLowerCase(), p[e]) + i = p[e].slice(), n = "rgb"; + else if (e === "transparent") + o = 0, n = "rgb", i = [0, 0, 0]; + else if (/^#[A-Fa-f0-9]+$/.test(e)) { + var s = e.slice(1), a = s.length, h = a <= 4; + o = 1, h ? (i = [ + parseInt(s[0] + s[0], 16), + parseInt(s[1] + s[1], 16), + parseInt(s[2] + s[2], 16) + ], a === 4 && (o = parseInt(s[3] + s[3], 16) / 255)) : (i = [ + parseInt(s[0] + s[1], 16), + parseInt(s[2] + s[3], 16), + parseInt(s[4] + s[5], 16) + ], a === 8 && (o = parseInt(s[6] + s[7], 16) / 255)), i[0] || (i[0] = 0), i[1] || (i[1] = 0), i[2] || (i[2] = 0), n = "rgb"; + } else if (t = /^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(e)) { + var l = t[1], f = l === "rgb", s = l.replace(/a$/, ""); + n = s; + var a = s === "cmyk" ? 4 : s === "gray" ? 1 : 3; + i = t[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(r, u) { + if (/%$/.test(r)) + return u === a ? parseFloat(r) / 100 : s === "rgb" ? parseFloat(r) * 255 / 100 : parseFloat(r); + if (s[u] === "h") { + if (/deg$/.test(r)) + return parseFloat(r); + if (m[r] !== void 0) + return m[r]; + } + return parseFloat(r); + }), l === s && i.push(1), o = f || i[a] === void 0 ? 1 : i[a], i = i.slice(0, a); + } else + e.length > 10 && /[0-9](?:\s|\/)/.test(e) && (i = e.match(/([0-9]+)/g).map(function(d) { + return parseFloat(d); + }), n = e.match(/([a-z])/ig).join("").toLowerCase()); + else + isNaN(e) ? Array.isArray(e) || e.length ? (i = [e[0], e[1], e[2]], n = "rgb", o = e.length === 4 ? e[3] : 1) : e instanceof Object && (e.r != null || e.red != null || e.R != null ? (n = "rgb", i = [ + e.r || e.red || e.R || 0, + e.g || e.green || e.G || 0, + e.b || e.blue || e.B || 0 + ]) : (n = "hsl", i = [ + e.h || e.hue || e.H || 0, + e.s || e.saturation || e.S || 0, + e.l || e.lightness || e.L || e.b || e.brightness + ]), o = e.a || e.alpha || e.opacity || 1, e.opacity != null && (o /= 100)) : (n = "rgb", i = [e >>> 16, (e & 65280) >>> 8, e & 255]); + return { + space: n, + values: i, + alpha: o + }; +} +function S(e, t) { + var i = T(e); + return t == null && (t = i.alpha), i.space[0] === "h" ? i.space + ["a(", i.values[0], ",", i.values[1], "%,", i.values[2], "%,", t, ")"].join("") : i.space + ["a(", i.values, ",", t, ")"].join(""); +} +class R { + constructor(t = "yellow", i = 8, o = 0.3) { + this.width = i, this.color = S(t, 0.4); + } + /** + * Draws a "highlighter stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(t, i) { + const o = i[0]; + t.beginPath(), t.lineWidth = this.width, t.strokeStyle = this.color, t.lineCap = "butt", t.miterLimit = 1, t.moveTo(o.startPoint.x, o.startPoint.y), i.forEach((n) => { + const { endPoint: s } = n; + t.lineTo(s.x, s.y); + }), t.stroke(); + } +} +export { + E as EraserTool, + R as HighlighterTool, + P as Manager, + C as PenTool +}; +//# sourceMappingURL=index.es.js.map diff --git a/dist/index.es.js.map b/dist/index.es.js.map new file mode 100644 index 0000000..ec6e335 --- /dev/null +++ b/dist/index.es.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.es.js","sources":["../src/util.ts","../src/StrokeManager.ts","../src/Manager.ts","../src/tools/PenTool.ts","../src/tools/EraserTool.ts","../node_modules/color-name/index.js","../node_modules/color-parse/index.mjs","../node_modules/color-alpha/index.mjs","../src/tools/HighlighterTool.ts"],"sourcesContent":["import { IPoint } from \"./types\";\r\n\r\n/**\r\n * Get the distance between two points\r\n * @param p1\r\n * @param p2\r\n * @returns number\r\n */\r\nexport function getEuclidean(p1: IPoint, p2: IPoint): number {\r\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\r\n}\r\n\r\n/**\r\n * Gets the unit vector representing the vector from start\r\n * point to end point with a length of 1.\r\n * @param startPoint\r\n * @param endPoint\r\n * @returns IPoint\r\n */\r\nexport function getUnitVector(startPoint: IPoint, endPoint: IPoint): IPoint {\r\n const length = getEuclidean(startPoint, endPoint);\r\n\r\n const dirVect = {\r\n x: endPoint.x - startPoint.x,\r\n y: endPoint.y - startPoint.y,\r\n };\r\n\r\n const unitVect: IPoint = {\r\n x: dirVect.x / length,\r\n y: dirVect.y / length,\r\n };\r\n\r\n return unitVect;\r\n}\r\n","import { IPoint, IStrokePart } from \"./types\";\r\nimport { getEuclidean } from \"./util\";\r\n\r\nexport interface IOnStrokePartHandler {\r\n (strokePart: IStrokePart): void;\r\n}\r\n\r\nexport interface ITouch {\r\n id: number;\r\n position: IPoint;\r\n}\r\n\r\nexport class StrokeManager {\r\n // reference to canvas element\r\n private canvas: HTMLCanvasElement;\r\n // holds last touch point in a drag\r\n private lastTouch: ITouch | null;\r\n // value indicates how sensitive the stroke detection is higher is better\r\n private sensitivity: number;\r\n // holds all of the last emitted stroke parts in a drag\r\n private lastStrokeParts: IStrokePart[];\r\n // the handlers listening for new strokes\r\n private onStrokePartHandlers: IOnStrokePartHandler[];\r\n\r\n constructor(canvas: HTMLCanvasElement) {\r\n this.canvas = canvas;\r\n this.lastTouch = null;\r\n this.sensitivity = 20.0;\r\n this.lastStrokeParts = [];\r\n this.onStrokePartHandlers = [];\r\n\r\n this.onTouchStart = this.onTouchStart.bind(this);\r\n this.onTouchEnd = this.onTouchEnd.bind(this);\r\n this.onTouchCancel = this.onTouchCancel.bind(this);\r\n this.onTouchMove = this.onTouchMove.bind(this);\r\n this.destroy = this.destroy.bind(this);\r\n this.getRelativePosition = this.getRelativePosition.bind(this);\r\n\r\n this.canvas.addEventListener(\"touchstart\", this.onTouchStart, {\r\n passive: false\r\n });\r\n this.canvas.addEventListener(\"touchend\", this.onTouchEnd, {\r\n passive: false\r\n });\r\n this.canvas.addEventListener(\"touchcancel\", this.onTouchCancel, {\r\n passive: false\r\n });\r\n this.canvas.addEventListener(\"touchmove\", this.onTouchMove, {\r\n passive: false\r\n });\r\n }\r\n\r\n /**\r\n * Registers a handler to be fired on a new stroke part\r\n * @param handler\r\n */\r\n public onStrokePart(handler: IOnStrokePartHandler): void {\r\n this.onStrokePartHandlers.push(handler);\r\n }\r\n\r\n /**\r\n * Removes all active listeners\r\n */\r\n public destroy(): void {\r\n this.onStrokePartHandlers = [];\r\n this.lastStrokeParts = [];\r\n this.canvas.removeEventListener(\"touchstart\", this.onTouchStart);\r\n this.canvas.removeEventListener(\"touchend\", this.onTouchEnd);\r\n this.canvas.removeEventListener(\"touchcancel\", this.onTouchCancel);\r\n this.canvas.removeEventListener(\"touchmove\", this.onTouchMove);\r\n }\r\n\r\n /**\r\n * Get relative position to canvas\r\n * @param clientX\r\n * @param clientY\r\n * @returns IPoint\r\n */\r\n private getRelativePosition(clientX: number, clientY: number): IPoint {\r\n const rect = this.canvas.getBoundingClientRect();\r\n\r\n return {\r\n x: clientX - rect.left,\r\n y: clientY - rect.top\r\n };\r\n }\r\n\r\n /**\r\n * Creates a new touch if one does not\r\n * already exist\r\n * @param e\r\n */\r\n private onTouchStart(e: TouchEvent): void {\r\n e.preventDefault();\r\n\r\n // if there is an ongoing touch, ignore this event\r\n if (this.lastTouch) {\r\n return;\r\n }\r\n\r\n const touches: TouchList = e.changedTouches;\r\n\r\n // only get the first touch\r\n const touch = touches.item(0);\r\n\r\n // save the touch\r\n this.lastTouch = {\r\n id: touch.identifier,\r\n position: this.getRelativePosition(touch.clientX, touch.clientY)\r\n };\r\n }\r\n\r\n /**\r\n * Creates a line from last touch to current touch\r\n * point and emits event. Does no-op if no existing touch\r\n * @param e\r\n */\r\n private onTouchMove(e: TouchEvent): void {\r\n e.preventDefault();\r\n\r\n // if no last touch... something is wrong\r\n if (!this.lastTouch) {\r\n return;\r\n }\r\n\r\n const touches: TouchList = e.changedTouches;\r\n\r\n // find the current touch we are tracking\r\n const touch: Touch = Array.from(touches).find(touch => {\r\n return touch.identifier === this.lastTouch.id;\r\n });\r\n\r\n // if the touch was not one we were tracking,\r\n // ignore and no-op\r\n if (!touch) {\r\n return;\r\n }\r\n\r\n const nextTouch: ITouch = {\r\n id: touch.identifier,\r\n position: this.getRelativePosition(touch.clientX, touch.clientY)\r\n };\r\n\r\n // If sensitivity setting has been set,\r\n // check if this point is far enough from last\r\n // touch to be drawn\r\n if (\r\n this.sensitivity &&\r\n getEuclidean(nextTouch.position, this.lastTouch.position) <\r\n 10.0 / this.sensitivity\r\n ) {\r\n return;\r\n }\r\n\r\n const strokePart: IStrokePart = {\r\n endPoint: nextTouch.position,\r\n startPoint: this.lastTouch.position,\r\n isStart: this.lastStrokeParts.length === 0,\r\n isEnd: false\r\n };\r\n\r\n this.onStrokePartHandlers.forEach(handler => {\r\n handler(strokePart);\r\n });\r\n\r\n // save this touch as last touch\r\n this.lastTouch = nextTouch;\r\n this.lastStrokeParts.push(strokePart);\r\n }\r\n\r\n /**\r\n * Draws a line from last point to final point. Removes\r\n * the reference to last touch point.\r\n * @param e\r\n */\r\n private onTouchEnd(e: TouchEvent): void {\r\n e.preventDefault();\r\n\r\n // if no last touch... something is wrong\r\n if (!this.lastTouch) {\r\n return;\r\n }\r\n\r\n const touches: TouchList = e.changedTouches;\r\n\r\n // find the current touch we are tracking\r\n const touch: Touch = Array.from(touches).find(touch => {\r\n return touch.identifier === this.lastTouch.id;\r\n });\r\n\r\n // if the touch was not one we were tracking,\r\n // ignore and no-op\r\n if (!touch) {\r\n return;\r\n }\r\n\r\n const endPoint = this.getRelativePosition(touch.clientX, touch.clientY);\r\n\r\n const strokePart: IStrokePart = {\r\n startPoint: this.lastTouch.position,\r\n endPoint,\r\n isStart: false,\r\n isEnd: true\r\n };\r\n\r\n this.onStrokePartHandlers.forEach(handler => {\r\n handler(strokePart);\r\n });\r\n\r\n this.lastTouch = null;\r\n this.lastStrokeParts = [];\r\n }\r\n\r\n /**\r\n * Removes the current last touch point\r\n * @param e\r\n */\r\n private onTouchCancel(e: TouchEvent): void {\r\n e.preventDefault();\r\n this.lastTouch = null;\r\n this.lastStrokeParts = [];\r\n }\r\n}\r\n","import { IStrokePart, ITool } from \"./types\";\r\nimport { StrokeManager } from \"./StrokeManager\";\r\n\r\nexport class Manager {\r\n // reference to the canvas\r\n private canvas: HTMLCanvasElement;\r\n // reference to stroke manager\r\n private strokeManager: StrokeManager;\r\n // holds the pixel ratio between canvas backing\r\n // store and device ratio (used for hi fi displays)\r\n private pixelRatio: number;\r\n // the width of the canvas\r\n private canvasWidth: number;\r\n // the height of the canvas\r\n private canvasHeight: number;\r\n // holds a reference to next animation frame\r\n private nextAnimationFrame: number;\r\n // the currently selected tool\r\n private currentTool: ITool | null;\r\n // holds stroke parts for ongoing stroke\r\n private currentStroke: IStrokePart[];\r\n // the state of the canvas (not including ongoing stroke)\r\n private canvasState: ImageData | null;\r\n // indicates whether changes have occured that require redraw\r\n private shouldDraw: boolean;\r\n // indicates whether canvas should commit its next draw state to current state\r\n private shouldCommit: boolean;\r\n\r\n constructor(\r\n canvas: HTMLCanvasElement,\r\n canvasWidth: number,\r\n canvasHeight: number\r\n ) {\r\n this.canvas = canvas;\r\n this.canvasWidth = canvasWidth;\r\n this.canvasHeight = canvasHeight;\r\n this.currentTool = null;\r\n this.currentStroke = [];\r\n this.strokeManager = new StrokeManager(canvas);\r\n this.canvasState = null;\r\n this.shouldDraw = false;\r\n this.shouldCommit = false;\r\n\r\n // find pixel ratio relative to backing store and device ratio\r\n const bsr = (canvas.getContext(\"2d\") as any).backingStorePixelRatio || 1;\r\n const dpr = window.devicePixelRatio || 1;\r\n this.pixelRatio = dpr / bsr;\r\n\r\n this.setCanvasSize = this.setCanvasSize.bind(this);\r\n this.setTool = this.setTool.bind(this);\r\n this.destroy = this.destroy.bind(this);\r\n this.clear = this.clear.bind(this);\r\n this.draw = this.draw.bind(this);\r\n this.onStrokePart = this.onStrokePart.bind(this);\r\n\r\n // schedule animation frame loop\r\n this.nextAnimationFrame = window.requestAnimationFrame(this.draw);\r\n // set up listener for new stroke part\r\n this.strokeManager.onStrokePart(this.onStrokePart);\r\n\r\n this.setCanvasSize(canvasWidth, canvasHeight);\r\n }\r\n\r\n /**\r\n * Sets the canvas desired width and height and sets transform\r\n * for hifi displays\r\n * @param width\r\n * @param height\r\n */\r\n public setCanvasSize(width: number, height: number): void {\r\n this.canvasWidth = width;\r\n this.canvasHeight = height;\r\n\r\n const { canvas, canvasWidth, canvasHeight, pixelRatio } = this;\r\n\r\n const ctx = canvas.getContext(\"2d\");\r\n\r\n // appropriately scale canvas to map to device ratio\r\n canvas.width = canvasWidth * pixelRatio;\r\n canvas.height = canvasHeight * pixelRatio;\r\n canvas.style.width = canvasWidth + \"px\";\r\n canvas.style.height = canvasHeight + \"px\";\r\n ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\r\n }\r\n\r\n /**\r\n * Sets the current tool for the manager\r\n * @param tool\r\n */\r\n public setTool(tool: ITool): void {\r\n this.currentTool = tool;\r\n }\r\n\r\n /**\r\n * Remove all event listeners\r\n */\r\n public destroy(): void {\r\n // cancel animation loop\r\n window.cancelAnimationFrame(this.nextAnimationFrame);\r\n // remove all listeners on stroke manager\r\n this.strokeManager.destroy();\r\n }\r\n\r\n /**\r\n * Clears the canvas\r\n */\r\n public clear(): void {\r\n this.canvasState = null;\r\n this.currentStroke = [];\r\n this.shouldDraw = true;\r\n this.shouldCommit = true;\r\n }\r\n\r\n /**\r\n * Adds a new stroke part to the nextStrokes\r\n * array\r\n * @param strokePart\r\n */\r\n private onStrokePart(strokePart: IStrokePart): void {\r\n this.currentStroke.push(strokePart);\r\n\r\n this.shouldDraw = true;\r\n\r\n if (strokePart.isEnd) {\r\n this.shouldCommit = true;\r\n }\r\n }\r\n\r\n /**\r\n * Draws a frame\r\n */\r\n private draw(): void {\r\n // schedule next draw\r\n this.nextAnimationFrame = window.requestAnimationFrame(this.draw);\r\n\r\n const ctx = this.canvas.getContext(\"2d\");\r\n\r\n if (!this.shouldDraw) {\r\n return;\r\n }\r\n\r\n // clear canvas\r\n ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);\r\n\r\n // draw current state\r\n if (this.canvasState) {\r\n ctx.putImageData(this.canvasState, 0, 0);\r\n }\r\n\r\n // if a tool has been selected and there are\r\n // pending strokes, draw them\r\n if (this.currentTool && this.currentStroke.length) {\r\n ctx.save();\r\n this.currentTool.draw(ctx, this.currentStroke);\r\n ctx.restore();\r\n }\r\n\r\n // if all changes have been made for current stroke,\r\n // save it as the new canvas state\r\n if (this.shouldCommit) {\r\n this.canvasState = ctx.getImageData(\r\n 0,\r\n 0,\r\n this.canvasWidth * this.pixelRatio,\r\n this.canvasHeight * this.pixelRatio\r\n );\r\n this.currentStroke = [];\r\n this.shouldCommit = false;\r\n }\r\n\r\n this.shouldDraw = false;\r\n }\r\n}\r\n","import { IStrokePart } from \"../types\";\r\n\r\nexport class PenTool {\r\n readonly color: string;\r\n readonly width: number;\r\n\r\n constructor(color: string = \"red\", width: number = 3) {\r\n this.color = color;\r\n this.width = width;\r\n }\r\n\r\n /**\r\n * Draws a \"pen stroke\" for all line segments\r\n * @param ctx\r\n * @param strokeParts\r\n */\r\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\r\n const firstPart = strokeParts[0];\r\n\r\n ctx.beginPath();\r\n\r\n ctx.lineWidth = this.width;\r\n ctx.strokeStyle = this.color;\r\n ctx.lineCap = \"round\";\r\n ctx.lineJoin = \"round\";\r\n\r\n ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y);\r\n\r\n strokeParts.forEach((strokePart) => {\r\n const { endPoint } = strokePart;\r\n ctx.lineTo(endPoint.x, endPoint.y);\r\n });\r\n\r\n ctx.stroke();\r\n }\r\n}\r\n","import { IStrokePart, IPoint } from \"../types\";\r\nimport { getUnitVector, getEuclidean } from \"../util\";\r\n\r\nexport interface IHandleOptions {\r\n hide: boolean;\r\n strokeWidth: number;\r\n fillColor: string;\r\n strokeColor: string;\r\n}\r\n\r\nexport class EraserTool {\r\n readonly width: number;\r\n readonly handleOpts: IHandleOptions;\r\n\r\n constructor(width: number = 10, handleOpts?: Partial) {\r\n this.width = width;\r\n\r\n handleOpts = handleOpts || {};\r\n\r\n this.handleOpts = {\r\n hide: handleOpts.hide || false,\r\n strokeWidth: handleOpts.strokeWidth || 2,\r\n fillColor: handleOpts.fillColor || \"white\",\r\n strokeColor: handleOpts.strokeColor || \"black\",\r\n };\r\n }\r\n\r\n /**\r\n * Draws an \"eraser stroke\" for all line segments\r\n * @param ctx\r\n * @param strokeParts\r\n */\r\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\r\n const { handleOpts } = this;\r\n const halfWidth = this.width / 2.0;\r\n\r\n strokeParts.forEach((strokePart) => {\r\n const { startPoint, endPoint, isEnd } = strokePart;\r\n\r\n const length = getEuclidean(startPoint, endPoint);\r\n const unitVect: IPoint = getUnitVector(startPoint, endPoint);\r\n let currentPoint: IPoint = startPoint;\r\n let i = 0;\r\n\r\n // clear all the way along the drag\r\n while (i < length) {\r\n const nextPoint: IPoint = {\r\n x: currentPoint.x + unitVect.x,\r\n y: currentPoint.y + unitVect.y,\r\n };\r\n\r\n ctx.clearRect(\r\n nextPoint.x - halfWidth,\r\n nextPoint.y - halfWidth,\r\n this.width,\r\n this.width\r\n );\r\n\r\n i++;\r\n currentPoint = nextPoint;\r\n }\r\n });\r\n\r\n const lastPart = strokeParts[strokeParts.length - 1];\r\n\r\n // if the end is not the last part, then draw\r\n // the tool indicator at the endpoint\r\n if (!lastPart.isEnd && !handleOpts.hide) {\r\n ctx.strokeStyle = handleOpts.strokeColor;\r\n ctx.fillStyle = handleOpts.fillColor;\r\n\r\n ctx.fillRect(\r\n lastPart.endPoint.x - halfWidth,\r\n lastPart.endPoint.y - halfWidth,\r\n this.width,\r\n this.width\r\n );\r\n\r\n ctx.strokeRect(\r\n lastPart.endPoint.x - halfWidth + 0.5,\r\n lastPart.endPoint.y - halfWidth + 0.5,\r\n this.width - 1,\r\n this.width - 1\r\n );\r\n }\r\n }\r\n}\r\n","'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n","/**\n * @module color-parse\n */\nimport names from 'color-name'\n\nexport default parse\n\n/**\n * Base hues\n * http://dev.w3.org/csswg/css-color/#typedef-named-hue\n */\n//FIXME: use external hue detector\nvar baseHues = {\n\tred: 0,\n\torange: 60,\n\tyellow: 120,\n\tgreen: 180,\n\tblue: 240,\n\tpurple: 300\n}\n\n/**\n * Parse color from the string passed\n *\n * @return {Object} A space indicator `space`, an array `values` and `alpha`\n */\nfunction parse(cstr) {\n\tvar m, parts = [], alpha = 1, space\n\n\tif (typeof cstr === 'string') {\n\t\tcstr = cstr.toLowerCase();\n\n\t\t//keyword\n\t\tif (names[cstr]) {\n\t\t\tparts = names[cstr].slice()\n\t\t\tspace = 'rgb'\n\t\t}\n\n\t\t//reserved words\n\t\telse if (cstr === 'transparent') {\n\t\t\talpha = 0\n\t\t\tspace = 'rgb'\n\t\t\tparts = [0, 0, 0]\n\t\t}\n\n\t\t//hex\n\t\telse if (/^#[A-Fa-f0-9]+$/.test(cstr)) {\n\t\t\tvar base = cstr.slice(1)\n\t\t\tvar size = base.length\n\t\t\tvar isShort = size <= 4\n\t\t\talpha = 1\n\n\t\t\tif (isShort) {\n\t\t\t\tparts = [\n\t\t\t\t\tparseInt(base[0] + base[0], 16),\n\t\t\t\t\tparseInt(base[1] + base[1], 16),\n\t\t\t\t\tparseInt(base[2] + base[2], 16)\n\t\t\t\t]\n\t\t\t\tif (size === 4) {\n\t\t\t\t\talpha = parseInt(base[3] + base[3], 16) / 255\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tparts = [\n\t\t\t\t\tparseInt(base[0] + base[1], 16),\n\t\t\t\t\tparseInt(base[2] + base[3], 16),\n\t\t\t\t\tparseInt(base[4] + base[5], 16)\n\t\t\t\t]\n\t\t\t\tif (size === 8) {\n\t\t\t\t\talpha = parseInt(base[6] + base[7], 16) / 255\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!parts[0]) parts[0] = 0\n\t\t\tif (!parts[1]) parts[1] = 0\n\t\t\tif (!parts[2]) parts[2] = 0\n\n\t\t\tspace = 'rgb'\n\t\t}\n\n\t\t//color space\n\t\telse if (m = /^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\\s*\\(([^\\)]*)\\)/.exec(cstr)) {\n\t\t\tvar name = m[1]\n\t\t\tvar isRGB = name === 'rgb'\n\t\t\tvar base = name.replace(/a$/, '')\n\t\t\tspace = base\n\t\t\tvar size = base === 'cmyk' ? 4 : base === 'gray' ? 1 : 3\n\t\t\tparts = m[2].trim()\n\t\t\t\t.split(/\\s*[,\\/]\\s*|\\s+/)\n\t\t\t\t.map(function (x, i) {\n\t\t\t\t\t//\n\t\t\t\t\tif (/%$/.test(x)) {\n\t\t\t\t\t\t//alpha\n\t\t\t\t\t\tif (i === size) return parseFloat(x) / 100\n\t\t\t\t\t\t//rgb\n\t\t\t\t\t\tif (base === 'rgb') return parseFloat(x) * 255 / 100\n\t\t\t\t\t\treturn parseFloat(x)\n\t\t\t\t\t}\n\t\t\t\t\t//hue\n\t\t\t\t\telse if (base[i] === 'h') {\n\t\t\t\t\t\t//\n\t\t\t\t\t\tif (/deg$/.test(x)) {\n\t\t\t\t\t\t\treturn parseFloat(x)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//\n\t\t\t\t\t\telse if (baseHues[x] !== undefined) {\n\t\t\t\t\t\t\treturn baseHues[x]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn parseFloat(x)\n\t\t\t\t})\n\n\t\t\tif (name === base) parts.push(1)\n\t\t\talpha = (isRGB) ? 1 : (parts[size] === undefined) ? 1 : parts[size]\n\t\t\tparts = parts.slice(0, size)\n\t\t}\n\n\t\t//named channels case\n\t\telse if (cstr.length > 10 && /[0-9](?:\\s|\\/)/.test(cstr)) {\n\t\t\tparts = cstr.match(/([0-9]+)/g).map(function (value) {\n\t\t\t\treturn parseFloat(value)\n\t\t\t})\n\n\t\t\tspace = cstr.match(/([a-z])/ig).join('').toLowerCase()\n\t\t}\n\t}\n\n\t//numeric case\n\telse if (!isNaN(cstr)) {\n\t\tspace = 'rgb'\n\t\tparts = [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff]\n\t}\n\n\t//array-like\n\telse if (Array.isArray(cstr) || cstr.length) {\n\t\tparts = [cstr[0], cstr[1], cstr[2]]\n\t\tspace = 'rgb'\n\t\talpha = cstr.length === 4 ? cstr[3] : 1\n\t}\n\n\t//object case - detects css cases of rgb and hsl\n\telse if (cstr instanceof Object) {\n\t\tif (cstr.r != null || cstr.red != null || cstr.R != null) {\n\t\t\tspace = 'rgb'\n\t\t\tparts = [\n\t\t\t\tcstr.r || cstr.red || cstr.R || 0,\n\t\t\t\tcstr.g || cstr.green || cstr.G || 0,\n\t\t\t\tcstr.b || cstr.blue || cstr.B || 0\n\t\t\t]\n\t\t}\n\t\telse {\n\t\t\tspace = 'hsl'\n\t\t\tparts = [\n\t\t\t\tcstr.h || cstr.hue || cstr.H || 0,\n\t\t\t\tcstr.s || cstr.saturation || cstr.S || 0,\n\t\t\t\tcstr.l || cstr.lightness || cstr.L || cstr.b || cstr.brightness\n\t\t\t]\n\t\t}\n\n\t\talpha = cstr.a || cstr.alpha || cstr.opacity || 1\n\n\t\tif (cstr.opacity != null) alpha /= 100\n\t}\n\n\treturn {\n\t\tspace: space,\n\t\tvalues: parts,\n\t\talpha: alpha\n\t}\n}\n","/**\r\n * @module color-alpha\r\n */\r\nimport parse from 'color-parse';\r\n\r\nexport default function alpha (color, value) {\r\n\tvar obj = parse(color);\r\n\r\n\tif (value == null) value = obj.alpha;\r\n\r\n\t//catch percent\r\n\tif (obj.space[0] === 'h') {\r\n\t\treturn obj.space + ['a(', obj.values[0], ',', obj.values[1], '%,', obj.values[2], '%,', value, ')'].join('');\r\n\t}\r\n\r\n\treturn obj.space + ['a(', obj.values, ',', value, ')'].join('');\r\n}\r\n","import alpha from \"color-alpha\";\r\n\r\nimport { IStrokePart } from \"../types\";\r\n\r\nexport class HighlighterTool {\r\n readonly color: string;\r\n readonly width: number;\r\n\r\n constructor(\r\n color: string = \"yellow\",\r\n width: number = 8,\r\n opacity: Number = 0.3\r\n ) {\r\n this.width = width;\r\n\r\n // calculate color w/ opacity\r\n this.color = alpha(color, 0.4);\r\n }\r\n\r\n /**\r\n * Draws a \"highlighter stroke\" for all line segments\r\n * @param ctx\r\n * @param strokeParts\r\n */\r\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\r\n const firstPart = strokeParts[0];\r\n\r\n ctx.beginPath();\r\n\r\n ctx.lineWidth = this.width;\r\n ctx.strokeStyle = this.color;\r\n ctx.lineCap = \"butt\";\r\n ctx.miterLimit = 1;\r\n\r\n ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y);\r\n\r\n strokeParts.forEach((strokePart) => {\r\n const { endPoint } = strokePart;\r\n ctx.lineTo(endPoint.x, endPoint.y);\r\n });\r\n\r\n ctx.stroke();\r\n }\r\n}\r\n"],"names":["getEuclidean","p1","p2","getUnitVector","startPoint","endPoint","length","dirVect","StrokeManager","canvas","handler","clientX","clientY","rect","e","touch","touches","nextTouch","strokePart","Manager","canvasWidth","canvasHeight","bsr","dpr","width","height","pixelRatio","ctx","tool","PenTool","color","strokeParts","firstPart","EraserTool","handleOpts","halfWidth","isEnd","unitVect","currentPoint","i","nextPoint","lastPart","colorName","baseHues","parse","cstr","m","parts","alpha","space","names","base","size","isShort","name","isRGB","x","value","obj","HighlighterTool","opacity"],"mappings":"AAQgB,SAAAA,EAAaC,GAAYC,GAAoB;AAC3D,SAAO,KAAK,KAAK,KAAK,IAAID,EAAG,IAAIC,EAAG,GAAG,CAAC,IAAI,KAAK,IAAID,EAAG,IAAIC,EAAG,GAAG,CAAC,CAAC;AACtE;AASgB,SAAAC,EAAcC,GAAoBC,GAA0B;AACpE,QAAAC,IAASN,EAAaI,GAAYC,CAAQ,GAE1CE,IAAU;AAAA,IACd,GAAGF,EAAS,IAAID,EAAW;AAAA,IAC3B,GAAGC,EAAS,IAAID,EAAW;AAAA,EAAA;AAQtB,SALkB;AAAA,IACvB,GAAGG,EAAQ,IAAID;AAAA,IACf,GAAGC,EAAQ,IAAID;AAAA,EAAA;AAInB;ACrBO,MAAME,EAAc;AAAA,EAYzB,YAAYC,GAA2B;AACrC,SAAK,SAASA,GACd,KAAK,YAAY,MACjB,KAAK,cAAc,IACnB,KAAK,kBAAkB,IACvB,KAAK,uBAAuB,IAE5B,KAAK,eAAe,KAAK,aAAa,KAAK,IAAI,GAC/C,KAAK,aAAa,KAAK,WAAW,KAAK,IAAI,GAC3C,KAAK,gBAAgB,KAAK,cAAc,KAAK,IAAI,GACjD,KAAK,cAAc,KAAK,YAAY,KAAK,IAAI,GAC7C,KAAK,UAAU,KAA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GAEdA,EAAI,YAAY,KAAK,OACrBA,EAAI,cAAc,KAAK,OACvBA,EAAI,UAAU,QACdA,EAAI,aAAa,GAEjBA,EAAI,OAAOK,EAAU,WAAW,GAAGA,EAAU,WAAW,CAAC,GAE7CD,EAAA,QAAQ,CAACb,MAAe;AAC5B,YAAA,EAAE,UAAAb,EAAa,IAAAa;AACrB,MAAAS,EAAI,OAAOtB,EAAS,GAAGA,EAAS,CAAC;AAAA,IAAA,CAClC,GAEDsB,EAAI,OAAO;AAAA,EACb;AACF;","x_google_ignoreList":[5,6,7]} \ No newline at end of file diff --git a/dist/index.umd.js b/dist/index.umd.js new file mode 100644 index 0000000..51cbc58 --- /dev/null +++ b/dist/index.umd.js @@ -0,0 +1,2 @@ +(function(h,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(h=typeof globalThis<"u"?globalThis:h||self,l(h.Paintbricks={}))})(this,function(h){"use strict";function l(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function k(e,t){const i=l(e,t),o={x:t.x-e.x,y:t.y-e.y};return{x:o.x/i,y:o.y/i}}class w{constructor(t){this.canvas=t,this.lastTouch=null,this.sensitivity=20,this.lastStrokeParts=[],this.onStrokePartHandlers=[],this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.destroy=this.destroy.bind(this),this.getRelativePosition=this.getRelativePosition.bind(this),this.canvas.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.canvas.addEventListener("touchend",this.onTouchEnd,{passive:!1}),this.canvas.addEventListener("touchcancel",this.onTouchCancel,{passive:!1}),this.canvas.addEventListener("touchmove",this.onTouchMove,{passive:!1})}onStrokePart(t){this.onStrokePartHandlers.push(t)}destroy(){this.onStrokePartHandlers=[],this.lastStrokeParts=[],this.canvas.removeEventListener("touchstart",this.onTouchStart),this.canvas.removeEventListener("touchend",this.onTouchEnd),this.canvas.removeEventListener("touchcancel",this.onTouchCancel),this.canvas.removeEventListener("touchmove",this.onTouchMove)}getRelativePosition(t,i){const o=this.canvas.getBoundingClientRect();return{x:t-o.left,y:i-o.top}}onTouchStart(t){if(t.preventDefault(),this.lastTouch)return;const o=t.changedTouches.item(0);this.lastTouch={id:o.identifier,position:this.getRelativePosition(o.clientX,o.clientY)}}onTouchMove(t){if(t.preventDefault(),!this.lastTouch)return;const i=t.changedTouches,o=Array.from(i).find(a=>a.identifier===this.lastTouch.id);if(!o)return;const s={id:o.identifier,position:this.getRelativePosition(o.clientX,o.clientY)};if(this.sensitivity&&l(s.position,this.lastTouch.position)<10/this.sensitivity)return;const n={endPoint:s.position,startPoint:this.lastTouch.position,isStart:this.lastStrokeParts.length===0,isEnd:!1};this.onStrokePartHandlers.forEach(a=>{a(n)}),this.lastTouch=s,this.lastStrokeParts.push(n)}onTouchEnd(t){if(t.preventDefault(),!this.lastTouch)return;const i=t.changedTouches,o=Array.from(i).find(a=>a.identifier===this.lastTouch.id);if(!o)return;const s=this.getRelativePosition(o.clientX,o.clientY),n={startPoint:this.lastTouch.position,endPoint:s,isStart:!1,isEnd:!0};this.onStrokePartHandlers.forEach(a=>{a(n)}),this.lastTouch=null,this.lastStrokeParts=[]}onTouchCancel(t){t.preventDefault(),this.lastTouch=null,this.lastStrokeParts=[]}}class b{constructor(t,i,o){this.canvas=t,this.canvasWidth=i,this.canvasHeight=o,this.currentTool=null,this.currentStroke=[],this.strokeManager=new w(t),this.canvasState=null,this.shouldDraw=!1,this.shouldCommit=!1;const s=t.getContext("2d").backingStorePixelRatio||1,n=window.devicePixelRatio||1;this.pixelRatio=n/s,this.setCanvasSize=this.setCanvasSize.bind(this),this.setTool=this.setTool.bind(this),this.destroy=this.destroy.bind(this),this.clear=this.clear.bind(this),this.draw=this.draw.bind(this),this.onStrokePart=this.onStrokePart.bind(this),this.nextAnimationFrame=window.requestAnimationFrame(this.draw),this.strokeManager.onStrokePart(this.onStrokePart),this.setCanvasSize(i,o)}setCanvasSize(t,i){this.canvasWidth=t,this.canvasHeight=i;const{canvas:o,canvasWidth:s,canvasHeight:n,pixelRatio:a}=this,u=o.getContext("2d");o.width=s*a,o.height=n*a,o.style.width=s+"px",o.style.height=n+"px",u.setTransform(a,0,0,a,0,0)}setTool(t){this.currentTool=t}destroy(){window.cancelAnimationFrame(this.nextAnimationFrame),this.strokeManager.destroy()}clear(){this.canvasState=null,this.currentStroke=[],this.shouldDraw=!0,this.shouldCommit=!0}onStrokePart(t){this.currentStroke.push(t),this.shouldDraw=!0,t.isEnd&&(this.shouldCommit=!0)}draw(){this.nextAnimationFrame=window.requestAnimationFrame(this.draw);const t=this.canvas.getContext("2d");this.shouldDraw&&(t.clearRect(0,0,this.canvasWidth,this.canvasHeight),this.canvasState&&t.putImageData(this.canvasState,0,0),this.currentTool&&this.currentStroke.length&&(t.save(),this.currentTool.draw(t,this.currentStroke),t.restore()),this.shouldCommit&&(this.canvasState=t.getImageData(0,0,this.canvasWidth*this.pixelRatio,this.canvasHeight*this.pixelRatio),this.currentStroke=[],this.shouldCommit=!1),this.shouldDraw=!1)}}class T{constructor(t="red",i=3){this.color=t,this.width=i}draw(t,i){const o=i[0];t.beginPath(),t.lineWidth=this.width,t.strokeStyle=this.color,t.lineCap="round",t.lineJoin="round",t.moveTo(o.startPoint.x,o.startPoint.y),i.forEach(s=>{const{endPoint:n}=s;t.lineTo(n.x,n.y)}),t.stroke()}}class S{constructor(t=10,i){this.width=t,i=i||{},this.handleOpts={hide:i.hide||!1,strokeWidth:i.strokeWidth||2,fillColor:i.fillColor||"white",strokeColor:i.strokeColor||"black"}}draw(t,i){const{handleOpts:o}=this,s=this.width/2;i.forEach(a=>{const{startPoint:u,endPoint:d,isEnd:m}=a,g=l(u,d),y=k(u,d);let r=u,c=0;for(;c10&&/[0-9](?:\s|\/)/.test(e)&&(i=e.match(/([0-9]+)/g).map(function(g){return parseFloat(g)}),s=e.match(/([a-z])/ig).join("").toLowerCase());else isNaN(e)?Array.isArray(e)||e.length?(i=[e[0],e[1],e[2]],s="rgb",o=e.length===4?e[3]:1):e instanceof Object&&(e.r!=null||e.red!=null||e.R!=null?(s="rgb",i=[e.r||e.red||e.R||0,e.g||e.green||e.G||0,e.b||e.blue||e.B||0]):(s="hsl",i=[e.h||e.hue||e.H||0,e.s||e.saturation||e.S||0,e.l||e.lightness||e.L||e.b||e.brightness]),o=e.a||e.alpha||e.opacity||1,e.opacity!=null&&(o/=100)):(s="rgb",i=[e>>>16,(e&65280)>>>8,e&255]);return{space:s,values:i,alpha:o}}function R(e,t){var i=E(e);return t==null&&(t=i.alpha),i.space[0]==="h"?i.space+["a(",i.values[0],",",i.values[1],"%,",i.values[2],"%,",t,")"].join(""):i.space+["a(",i.values,",",t,")"].join("")}class M{constructor(t="yellow",i=8,o=.3){this.width=i,this.color=R(t,.4)}draw(t,i){const o=i[0];t.beginPath(),t.lineWidth=this.width,t.strokeStyle=this.color,t.lineCap="butt",t.miterLimit=1,t.moveTo(o.startPoint.x,o.startPoint.y),i.forEach(s=>{const{endPoint:n}=s;t.lineTo(n.x,n.y)}),t.stroke()}}h.EraserTool=S,h.HighlighterTool=M,h.Manager=b,h.PenTool=T,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}); +//# sourceMappingURL=index.umd.js.map diff --git a/dist/index.umd.js.map b/dist/index.umd.js.map new file mode 100644 index 0000000..29ab3d8 --- /dev/null +++ b/dist/index.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.umd.js","sources":["../src/util.ts","../src/StrokeManager.ts","../src/Manager.ts","../src/tools/PenTool.ts","../src/tools/EraserTool.ts","../node_modules/color-name/index.js","../node_modules/color-parse/index.mjs","../node_modules/color-alpha/index.mjs","../src/tools/HighlighterTool.ts"],"sourcesContent":["import { IPoint } from \"./types\";\r\n\r\n/**\r\n * Get the distance between two points\r\n * @param p1\r\n * @param p2\r\n * @returns number\r\n */\r\nexport function getEuclidean(p1: IPoint, p2: IPoint): number {\r\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\r\n}\r\n\r\n/**\r\n * Gets the unit vector representing the vector from start\r\n * point to end point with a length of 1.\r\n * @param startPoint\r\n * @param endPoint\r\n * @returns IPoint\r\n */\r\nexport function getUnitVector(startPoint: IPoint, endPoint: IPoint): IPoint {\r\n const length = getEuclidean(startPoint, endPoint);\r\n\r\n const dirVect = {\r\n x: endPoint.x - startPoint.x,\r\n y: endPoint.y - startPoint.y,\r\n };\r\n\r\n const unitVect: IPoint = {\r\n x: dirVect.x / length,\r\n y: dirVect.y / length,\r\n };\r\n\r\n return unitVect;\r\n}\r\n","import { IPoint, IStrokePart } from \"./types\";\r\nimport { getEuclidean } from \"./util\";\r\n\r\nexport interface IOnStrokePartHandler {\r\n (strokePart: IStrokePart): void;\r\n}\r\n\r\nexport interface ITouch {\r\n id: number;\r\n position: IPoint;\r\n}\r\n\r\nexport class StrokeManager {\r\n // reference to canvas element\r\n private canvas: HTMLCanvasElement;\r\n // holds last touch point in a drag\r\n private lastTouch: ITouch | null;\r\n // value indicates how sensitive the stroke detection is higher is better\r\n private sensitivity: number;\r\n // holds all of the last emitted stroke parts in a drag\r\n private lastStrokeParts: IStrokePart[];\r\n // the handlers listening for new strokes\r\n private onStrokePartHandlers: IOnStrokePartHandler[];\r\n\r\n constructor(canvas: HTMLCanvasElement) {\r\n this.canvas = canvas;\r\n this.lastTouch = null;\r\n this.sensitivity = 20.0;\r\n this.lastStrokeParts = [];\r\n this.onStrokePartHandlers = [];\r\n\r\n this.onTouchStart = this.onTouchStart.bind(this);\r\n this.onTouchEnd = this.onTouchEnd.bind(this);\r\n this.onTouchCancel = this.onTouchCancel.bind(this);\r\n this.onTouchMove = this.onTouchMove.bind(this);\r\n this.destroy = this.destroy.bind(this);\r\n this.getRelativePosition = this.getRelativePosition.bind(this);\r\n\r\n this.canvas.addEventListener(\"touchstart\", this.onTouchStart, {\r\n passive: false\r\n });\r\n this.canvas.addEventListener(\"touchend\", this.onTouchEnd, {\r\n passive: false\r\n });\r\n this.canvas.addEventListener(\"touchcancel\", this.onTouchCancel, {\r\n passive: false\r\n });\r\n this.canvas.addEventListener(\"touchmove\", this.onTouchMove, {\r\n passive: false\r\n });\r\n }\r\n\r\n /**\r\n * Registers a handler to be fired on a new stroke part\r\n * @param handler\r\n */\r\n public onStrokePart(handler: IOnStrokePartHandler): void {\r\n this.onStrokePartHandlers.push(handler);\r\n }\r\n\r\n /**\r\n * Removes all active listeners\r\n */\r\n public destroy(): void {\r\n this.onStrokePartHandlers = [];\r\n this.lastStrokeParts = [];\r\n this.canvas.removeEventListener(\"touchstart\", this.onTouchStart);\r\n this.canvas.removeEventListener(\"touchend\", this.onTouchEnd);\r\n this.canvas.removeEventListener(\"touchcancel\", this.onTouchCancel);\r\n this.canvas.removeEventListener(\"touchmove\", this.onTouchMove);\r\n }\r\n\r\n /**\r\n * Get relative position to canvas\r\n * @param clientX\r\n * @param clientY\r\n * @returns IPoint\r\n */\r\n private getRelativePosition(clientX: number, clientY: number): IPoint {\r\n const rect = this.canvas.getBoundingClientRect();\r\n\r\n return {\r\n x: clientX - rect.left,\r\n y: clientY - rect.top\r\n };\r\n }\r\n\r\n /**\r\n * Creates a new touch if one does not\r\n * already exist\r\n * @param e\r\n */\r\n private onTouchStart(e: TouchEvent): void {\r\n e.preventDefault();\r\n\r\n // if there is an ongoing touch, ignore this event\r\n if (this.lastTouch) {\r\n return;\r\n }\r\n\r\n const touches: TouchList = e.changedTouches;\r\n\r\n // only get the first touch\r\n const touch = touches.item(0);\r\n\r\n // save the touch\r\n this.lastTouch = {\r\n id: touch.identifier,\r\n position: this.getRelativePosition(touch.clientX, touch.clientY)\r\n };\r\n }\r\n\r\n /**\r\n * Creates a line from last touch to current touch\r\n * point and emits event. Does no-op if no existing touch\r\n * @param e\r\n */\r\n private onTouchMove(e: TouchEvent): void {\r\n e.preventDefault();\r\n\r\n // if no last touch... something is wrong\r\n if (!this.lastTouch) {\r\n return;\r\n }\r\n\r\n const touches: TouchList = e.changedTouches;\r\n\r\n // find the current touch we are tracking\r\n const touch: Touch = Array.from(touches).find(touch => {\r\n return touch.identifier === this.lastTouch.id;\r\n });\r\n\r\n // if the touch was not one we were tracking,\r\n // ignore and no-op\r\n if (!touch) {\r\n return;\r\n }\r\n\r\n const nextTouch: ITouch = {\r\n id: touch.identifier,\r\n position: this.getRelativePosition(touch.clientX, touch.clientY)\r\n };\r\n\r\n // If sensitivity setting has been set,\r\n // check if this point is far enough from last\r\n // touch to be drawn\r\n if (\r\n this.sensitivity &&\r\n getEuclidean(nextTouch.position, this.lastTouch.position) <\r\n 10.0 / this.sensitivity\r\n ) {\r\n return;\r\n }\r\n\r\n const strokePart: IStrokePart = {\r\n endPoint: nextTouch.position,\r\n startPoint: this.lastTouch.position,\r\n isStart: this.lastStrokeParts.length === 0,\r\n isEnd: false\r\n };\r\n\r\n this.onStrokePartHandlers.forEach(handler => {\r\n handler(strokePart);\r\n });\r\n\r\n // save this touch as last touch\r\n this.lastTouch = nextTouch;\r\n this.lastStrokeParts.push(strokePart);\r\n }\r\n\r\n /**\r\n * Draws a line from last point to final point. Removes\r\n * the reference to last touch point.\r\n * @param e\r\n */\r\n private onTouchEnd(e: TouchEvent): void {\r\n e.preventDefault();\r\n\r\n // if no last touch... something is wrong\r\n if (!this.lastTouch) {\r\n return;\r\n }\r\n\r\n const touches: TouchList = e.changedTouches;\r\n\r\n // find the current touch we are tracking\r\n const touch: Touch = Array.from(touches).find(touch => {\r\n return touch.identifier === this.lastTouch.id;\r\n });\r\n\r\n // if the touch was not one we were tracking,\r\n // ignore and no-op\r\n if (!touch) {\r\n return;\r\n }\r\n\r\n const endPoint = this.getRelativePosition(touch.clientX, touch.clientY);\r\n\r\n const strokePart: IStrokePart = {\r\n startPoint: this.lastTouch.position,\r\n endPoint,\r\n isStart: false,\r\n isEnd: true\r\n };\r\n\r\n this.onStrokePartHandlers.forEach(handler => {\r\n handler(strokePart);\r\n });\r\n\r\n this.lastTouch = null;\r\n this.lastStrokeParts = [];\r\n }\r\n\r\n /**\r\n * Removes the current last touch point\r\n * @param e\r\n */\r\n private onTouchCancel(e: TouchEvent): void {\r\n e.preventDefault();\r\n this.lastTouch = null;\r\n this.lastStrokeParts = [];\r\n }\r\n}\r\n","import { IStrokePart, ITool } from \"./types\";\r\nimport { StrokeManager } from \"./StrokeManager\";\r\n\r\nexport class Manager {\r\n // reference to the canvas\r\n private canvas: HTMLCanvasElement;\r\n // reference to stroke manager\r\n private strokeManager: StrokeManager;\r\n // holds the pixel ratio between canvas backing\r\n // store and device ratio (used for hi fi displays)\r\n private pixelRatio: number;\r\n // the width of the canvas\r\n private canvasWidth: number;\r\n // the height of the canvas\r\n private canvasHeight: number;\r\n // holds a reference to next animation frame\r\n private nextAnimationFrame: number;\r\n // the currently selected tool\r\n private currentTool: ITool | null;\r\n // holds stroke parts for ongoing stroke\r\n private currentStroke: IStrokePart[];\r\n // the state of the canvas (not including ongoing stroke)\r\n private canvasState: ImageData | null;\r\n // indicates whether changes have occured that require redraw\r\n private shouldDraw: boolean;\r\n // indicates whether canvas should commit its next draw state to current state\r\n private shouldCommit: boolean;\r\n\r\n constructor(\r\n canvas: HTMLCanvasElement,\r\n canvasWidth: number,\r\n canvasHeight: number\r\n ) {\r\n this.canvas = canvas;\r\n this.canvasWidth = canvasWidth;\r\n this.canvasHeight = canvasHeight;\r\n this.currentTool = null;\r\n this.currentStroke = [];\r\n this.strokeManager = new StrokeManager(canvas);\r\n this.canvasState = null;\r\n this.shouldDraw = false;\r\n this.shouldCommit = false;\r\n\r\n // find pixel ratio relative to backing store and device ratio\r\n const bsr = (canvas.getContext(\"2d\") as any).backingStorePixelRatio || 1;\r\n const dpr = window.devicePixelRatio || 1;\r\n this.pixelRatio = dpr / bsr;\r\n\r\n this.setCanvasSize = this.setCanvasSize.bind(this);\r\n this.setTool = this.setTool.bind(this);\r\n this.destroy = this.destroy.bind(this);\r\n this.clear = this.clear.bind(this);\r\n this.draw = this.draw.bind(this);\r\n this.onStrokePart = this.onStrokePart.bind(this);\r\n\r\n // schedule animation frame loop\r\n this.nextAnimationFrame = window.requestAnimationFrame(this.draw);\r\n // set up listener for new stroke part\r\n this.strokeManager.onStrokePart(this.onStrokePart);\r\n\r\n this.setCanvasSize(canvasWidth, canvasHeight);\r\n }\r\n\r\n /**\r\n * Sets the canvas desired width and height and sets transform\r\n * for hifi displays\r\n * @param width\r\n * @param height\r\n */\r\n public setCanvasSize(width: number, height: number): void {\r\n this.canvasWidth = width;\r\n this.canvasHeight = height;\r\n\r\n const { canvas, canvasWidth, canvasHeight, pixelRatio } = this;\r\n\r\n const ctx = canvas.getContext(\"2d\");\r\n\r\n // appropriately scale canvas to map to device ratio\r\n canvas.width = canvasWidth * pixelRatio;\r\n canvas.height = canvasHeight * pixelRatio;\r\n canvas.style.width = canvasWidth + \"px\";\r\n canvas.style.height = canvasHeight + \"px\";\r\n ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\r\n }\r\n\r\n /**\r\n * Sets the current tool for the manager\r\n * @param tool\r\n */\r\n public setTool(tool: ITool): void {\r\n this.currentTool = tool;\r\n }\r\n\r\n /**\r\n * Remove all event listeners\r\n */\r\n public destroy(): void {\r\n // cancel animation loop\r\n window.cancelAnimationFrame(this.nextAnimationFrame);\r\n // remove all listeners on stroke manager\r\n this.strokeManager.destroy();\r\n }\r\n\r\n /**\r\n * Clears the canvas\r\n */\r\n public clear(): void {\r\n this.canvasState = null;\r\n this.currentStroke = [];\r\n this.shouldDraw = true;\r\n this.shouldCommit = true;\r\n }\r\n\r\n /**\r\n * Adds a new stroke part to the nextStrokes\r\n * array\r\n * @param strokePart\r\n */\r\n private onStrokePart(strokePart: IStrokePart): void {\r\n this.currentStroke.push(strokePart);\r\n\r\n this.shouldDraw = true;\r\n\r\n if (strokePart.isEnd) {\r\n this.shouldCommit = true;\r\n }\r\n }\r\n\r\n /**\r\n * Draws a frame\r\n */\r\n private draw(): void {\r\n // schedule next draw\r\n this.nextAnimationFrame = window.requestAnimationFrame(this.draw);\r\n\r\n const ctx = this.canvas.getContext(\"2d\");\r\n\r\n if (!this.shouldDraw) {\r\n return;\r\n }\r\n\r\n // clear canvas\r\n ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);\r\n\r\n // draw current state\r\n if (this.canvasState) {\r\n ctx.putImageData(this.canvasState, 0, 0);\r\n }\r\n\r\n // if a tool has been selected and there are\r\n // pending strokes, draw them\r\n if (this.currentTool && this.currentStroke.length) {\r\n ctx.save();\r\n this.currentTool.draw(ctx, this.currentStroke);\r\n ctx.restore();\r\n }\r\n\r\n // if all changes have been made for current stroke,\r\n // save it as the new canvas state\r\n if (this.shouldCommit) {\r\n this.canvasState = ctx.getImageData(\r\n 0,\r\n 0,\r\n this.canvasWidth * this.pixelRatio,\r\n this.canvasHeight * this.pixelRatio\r\n );\r\n this.currentStroke = [];\r\n this.shouldCommit = false;\r\n }\r\n\r\n this.shouldDraw = false;\r\n }\r\n}\r\n","import { IStrokePart } from \"../types\";\r\n\r\nexport class PenTool {\r\n readonly color: string;\r\n readonly width: number;\r\n\r\n constructor(color: string = \"red\", width: number = 3) {\r\n this.color = color;\r\n this.width = width;\r\n }\r\n\r\n /**\r\n * Draws a \"pen stroke\" for all line segments\r\n * @param ctx\r\n * @param strokeParts\r\n */\r\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\r\n const firstPart = strokeParts[0];\r\n\r\n ctx.beginPath();\r\n\r\n ctx.lineWidth = this.width;\r\n ctx.strokeStyle = this.color;\r\n ctx.lineCap = \"round\";\r\n ctx.lineJoin = \"round\";\r\n\r\n ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y);\r\n\r\n strokeParts.forEach((strokePart) => {\r\n const { endPoint } = strokePart;\r\n ctx.lineTo(endPoint.x, endPoint.y);\r\n });\r\n\r\n ctx.stroke();\r\n }\r\n}\r\n","import { IStrokePart, IPoint } from \"../types\";\r\nimport { getUnitVector, getEuclidean } from \"../util\";\r\n\r\nexport interface IHandleOptions {\r\n hide: boolean;\r\n strokeWidth: number;\r\n fillColor: string;\r\n strokeColor: string;\r\n}\r\n\r\nexport class EraserTool {\r\n readonly width: number;\r\n readonly handleOpts: IHandleOptions;\r\n\r\n constructor(width: number = 10, handleOpts?: Partial) {\r\n this.width = width;\r\n\r\n handleOpts = handleOpts || {};\r\n\r\n this.handleOpts = {\r\n hide: handleOpts.hide || false,\r\n strokeWidth: handleOpts.strokeWidth || 2,\r\n fillColor: handleOpts.fillColor || \"white\",\r\n strokeColor: handleOpts.strokeColor || \"black\",\r\n };\r\n }\r\n\r\n /**\r\n * Draws an \"eraser stroke\" for all line segments\r\n * @param ctx\r\n * @param strokeParts\r\n */\r\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\r\n const { handleOpts } = this;\r\n const halfWidth = this.width / 2.0;\r\n\r\n strokeParts.forEach((strokePart) => {\r\n const { startPoint, endPoint, isEnd } = strokePart;\r\n\r\n const length = getEuclidean(startPoint, endPoint);\r\n const unitVect: IPoint = getUnitVector(startPoint, endPoint);\r\n let currentPoint: IPoint = startPoint;\r\n let i = 0;\r\n\r\n // clear all the way along the drag\r\n while (i < length) {\r\n const nextPoint: IPoint = {\r\n x: currentPoint.x + unitVect.x,\r\n y: currentPoint.y + unitVect.y,\r\n };\r\n\r\n ctx.clearRect(\r\n nextPoint.x - halfWidth,\r\n nextPoint.y - halfWidth,\r\n this.width,\r\n this.width\r\n );\r\n\r\n i++;\r\n currentPoint = nextPoint;\r\n }\r\n });\r\n\r\n const lastPart = strokeParts[strokeParts.length - 1];\r\n\r\n // if the end is not the last part, then draw\r\n // the tool indicator at the endpoint\r\n if (!lastPart.isEnd && !handleOpts.hide) {\r\n ctx.strokeStyle = handleOpts.strokeColor;\r\n ctx.fillStyle = handleOpts.fillColor;\r\n\r\n ctx.fillRect(\r\n lastPart.endPoint.x - halfWidth,\r\n lastPart.endPoint.y - halfWidth,\r\n this.width,\r\n this.width\r\n );\r\n\r\n ctx.strokeRect(\r\n lastPart.endPoint.x - halfWidth + 0.5,\r\n lastPart.endPoint.y - halfWidth + 0.5,\r\n this.width - 1,\r\n this.width - 1\r\n );\r\n }\r\n }\r\n}\r\n","'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n","/**\n * @module color-parse\n */\nimport names from 'color-name'\n\nexport default parse\n\n/**\n * Base hues\n * http://dev.w3.org/csswg/css-color/#typedef-named-hue\n */\n//FIXME: use external hue detector\nvar baseHues = {\n\tred: 0,\n\torange: 60,\n\tyellow: 120,\n\tgreen: 180,\n\tblue: 240,\n\tpurple: 300\n}\n\n/**\n * Parse color from the string passed\n *\n * @return {Object} A space indicator `space`, an array `values` and `alpha`\n */\nfunction parse(cstr) {\n\tvar m, parts = [], alpha = 1, space\n\n\tif (typeof cstr === 'string') {\n\t\tcstr = cstr.toLowerCase();\n\n\t\t//keyword\n\t\tif (names[cstr]) {\n\t\t\tparts = names[cstr].slice()\n\t\t\tspace = 'rgb'\n\t\t}\n\n\t\t//reserved words\n\t\telse if (cstr === 'transparent') {\n\t\t\talpha = 0\n\t\t\tspace = 'rgb'\n\t\t\tparts = [0, 0, 0]\n\t\t}\n\n\t\t//hex\n\t\telse if (/^#[A-Fa-f0-9]+$/.test(cstr)) {\n\t\t\tvar base = cstr.slice(1)\n\t\t\tvar size = base.length\n\t\t\tvar isShort = size <= 4\n\t\t\talpha = 1\n\n\t\t\tif (isShort) {\n\t\t\t\tparts = [\n\t\t\t\t\tparseInt(base[0] + base[0], 16),\n\t\t\t\t\tparseInt(base[1] + base[1], 16),\n\t\t\t\t\tparseInt(base[2] + base[2], 16)\n\t\t\t\t]\n\t\t\t\tif (size === 4) {\n\t\t\t\t\talpha = parseInt(base[3] + base[3], 16) / 255\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tparts = [\n\t\t\t\t\tparseInt(base[0] + base[1], 16),\n\t\t\t\t\tparseInt(base[2] + base[3], 16),\n\t\t\t\t\tparseInt(base[4] + base[5], 16)\n\t\t\t\t]\n\t\t\t\tif (size === 8) {\n\t\t\t\t\talpha = parseInt(base[6] + base[7], 16) / 255\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!parts[0]) parts[0] = 0\n\t\t\tif (!parts[1]) parts[1] = 0\n\t\t\tif (!parts[2]) parts[2] = 0\n\n\t\t\tspace = 'rgb'\n\t\t}\n\n\t\t//color space\n\t\telse if (m = /^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\\s*\\(([^\\)]*)\\)/.exec(cstr)) {\n\t\t\tvar name = m[1]\n\t\t\tvar isRGB = name === 'rgb'\n\t\t\tvar base = name.replace(/a$/, '')\n\t\t\tspace = base\n\t\t\tvar size = base === 'cmyk' ? 4 : base === 'gray' ? 1 : 3\n\t\t\tparts = m[2].trim()\n\t\t\t\t.split(/\\s*[,\\/]\\s*|\\s+/)\n\t\t\t\t.map(function (x, i) {\n\t\t\t\t\t//\n\t\t\t\t\tif (/%$/.test(x)) {\n\t\t\t\t\t\t//alpha\n\t\t\t\t\t\tif (i === size) return parseFloat(x) / 100\n\t\t\t\t\t\t//rgb\n\t\t\t\t\t\tif (base === 'rgb') return parseFloat(x) * 255 / 100\n\t\t\t\t\t\treturn parseFloat(x)\n\t\t\t\t\t}\n\t\t\t\t\t//hue\n\t\t\t\t\telse if (base[i] === 'h') {\n\t\t\t\t\t\t//\n\t\t\t\t\t\tif (/deg$/.test(x)) {\n\t\t\t\t\t\t\treturn parseFloat(x)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//\n\t\t\t\t\t\telse if (baseHues[x] !== undefined) {\n\t\t\t\t\t\t\treturn baseHues[x]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn parseFloat(x)\n\t\t\t\t})\n\n\t\t\tif (name === base) parts.push(1)\n\t\t\talpha = (isRGB) ? 1 : (parts[size] === undefined) ? 1 : parts[size]\n\t\t\tparts = parts.slice(0, size)\n\t\t}\n\n\t\t//named channels case\n\t\telse if (cstr.length > 10 && /[0-9](?:\\s|\\/)/.test(cstr)) {\n\t\t\tparts = cstr.match(/([0-9]+)/g).map(function (value) {\n\t\t\t\treturn parseFloat(value)\n\t\t\t})\n\n\t\t\tspace = cstr.match(/([a-z])/ig).join('').toLowerCase()\n\t\t}\n\t}\n\n\t//numeric case\n\telse if (!isNaN(cstr)) {\n\t\tspace = 'rgb'\n\t\tparts = [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff]\n\t}\n\n\t//array-like\n\telse if (Array.isArray(cstr) || cstr.length) {\n\t\tparts = [cstr[0], cstr[1], cstr[2]]\n\t\tspace = 'rgb'\n\t\talpha = cstr.length === 4 ? cstr[3] : 1\n\t}\n\n\t//object case - detects css cases of rgb and hsl\n\telse if (cstr instanceof Object) {\n\t\tif (cstr.r != null || cstr.red != null || cstr.R != null) {\n\t\t\tspace = 'rgb'\n\t\t\tparts = [\n\t\t\t\tcstr.r || cstr.red || cstr.R || 0,\n\t\t\t\tcstr.g || cstr.green || cstr.G || 0,\n\t\t\t\tcstr.b || cstr.blue || cstr.B || 0\n\t\t\t]\n\t\t}\n\t\telse {\n\t\t\tspace = 'hsl'\n\t\t\tparts = [\n\t\t\t\tcstr.h || cstr.hue || cstr.H || 0,\n\t\t\t\tcstr.s || cstr.saturation || cstr.S || 0,\n\t\t\t\tcstr.l || cstr.lightness || cstr.L || cstr.b || cstr.brightness\n\t\t\t]\n\t\t}\n\n\t\talpha = cstr.a || cstr.alpha || cstr.opacity || 1\n\n\t\tif (cstr.opacity != null) alpha /= 100\n\t}\n\n\treturn {\n\t\tspace: space,\n\t\tvalues: parts,\n\t\talpha: alpha\n\t}\n}\n","/**\r\n * @module color-alpha\r\n */\r\nimport parse from 'color-parse';\r\n\r\nexport default function alpha (color, value) {\r\n\tvar obj = parse(color);\r\n\r\n\tif (value == null) value = obj.alpha;\r\n\r\n\t//catch percent\r\n\tif (obj.space[0] === 'h') {\r\n\t\treturn obj.space + ['a(', obj.values[0], ',', obj.values[1], '%,', obj.values[2], '%,', value, ')'].join('');\r\n\t}\r\n\r\n\treturn obj.space + ['a(', obj.values, ',', value, ')'].join('');\r\n}\r\n","import alpha from \"color-alpha\";\r\n\r\nimport { IStrokePart } from \"../types\";\r\n\r\nexport class HighlighterTool {\r\n readonly color: string;\r\n readonly width: number;\r\n\r\n constructor(\r\n color: string = \"yellow\",\r\n width: number = 8,\r\n opacity: Number = 0.3\r\n ) {\r\n this.width = width;\r\n\r\n // calculate color w/ opacity\r\n this.color = alpha(color, 0.4);\r\n }\r\n\r\n /**\r\n * Draws a \"highlighter stroke\" for all line segments\r\n * @param ctx\r\n * @param strokeParts\r\n */\r\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\r\n const firstPart = strokeParts[0];\r\n\r\n ctx.beginPath();\r\n\r\n ctx.lineWidth = this.width;\r\n ctx.strokeStyle = this.color;\r\n ctx.lineCap = \"butt\";\r\n ctx.miterLimit = 1;\r\n\r\n ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y);\r\n\r\n strokeParts.forEach((strokePart) => {\r\n const { endPoint } = strokePart;\r\n ctx.lineTo(endPoint.x, endPoint.y);\r\n });\r\n\r\n ctx.stroke();\r\n }\r\n}\r\n"],"names":["getEuclidean","p1","p2","getUnitVector","startPoint","endPoint","length","dirVect","StrokeManager","canvas","handler","clientX","clientY","rect","e","touch","touches","nextTouch","strokePart","Manager","canvasWidth","canvasHeight","bsr","dpr","width","height","pixelRatio","ctx","tool","PenTool","color","strokeParts","firstPart","EraserTool","handleOpts","halfWidth","isEnd","unitVect","currentPoint","i","nextPoint","lastPart","colorName","baseHues","parse","cstr","m","parts","alpha","space","names","base","size","isShort","name","isRGB","x","value","obj","HighlighterTool","opacity"],"mappings":"mOAQgB,SAAAA,EAAaC,EAAYC,EAAoB,CAC3D,OAAO,KAAK,KAAK,KAAK,IAAID,EAAG,EAAIC,EAAG,EAAG,CAAC,EAAI,KAAK,IAAID,EAAG,EAAIC,EAAG,EAAG,CAAC,CAAC,CACtE,CASgB,SAAAC,EAAcC,EAAoBC,EAA0B,CACpE,MAAAC,EAASN,EAAaI,EAAYC,CAAQ,EAE1CE,EAAU,CACd,EAAGF,EAAS,EAAID,EAAW,EAC3B,EAAGC,EAAS,EAAID,EAAW,CAAA,EAQtB,MALkB,CACvB,EAAGG,EAAQ,EAAID,EACf,EAAGC,EAAQ,EAAID,CAAA,CAInB,CCrBO,MAAME,CAAc,CAYzB,YAAYC,EAA2B,CACrC,KAAK,OAASA,EACd,KAAK,UAAY,KACjB,KAAK,YAAc,GACnB,KAAK,gBAAkB,GACvB,KAAK,qBAAuB,GAE5B,KAAK,aAAe,KAAK,aAAa,KAAK,IAAI,EAC/C,KAAK,WAAa,KAAK,WAAW,KAAK,IAAI,EAC3C,KAAK,cAAgB,KAAK,cAAc,KAAK,IAAI,EACjD,KAAK,YAAc,KAAK,YAAY,KAAK,IAAI,EAC7C,KAAK,QAAU,KAAK,QAAQ,KAAK,IAAI,EACrC,KAAK,oBAAsB,KAAK,oBAAoB,KAAK,IAAI,EAE7D,KAAK,OAAO,iBAAiB,a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AC/B,CAOO,KAAKH,EAA+BI,EAAkC,CACrE,MAAAC,EAAYD,EAAY,CAAC,EAE/BJ,EAAI,UAAU,EAEdA,EAAI,UAAY,KAAK,MACrBA,EAAI,YAAc,KAAK,MACvBA,EAAI,QAAU,OACdA,EAAI,WAAa,EAEjBA,EAAI,OAAOK,EAAU,WAAW,EAAGA,EAAU,WAAW,CAAC,EAE7CD,EAAA,QAASb,GAAe,CAC5B,KAAA,CAAE,SAAAb,CAAa,EAAAa,EACrBS,EAAI,OAAOtB,EAAS,EAAGA,EAAS,CAAC,CAAA,CAClC,EAEDsB,EAAI,OAAO,CACb,CACF","x_google_ignoreList":[5,6,7]} \ No newline at end of file diff --git a/example/build/example.es.js b/example/build/example.es.js new file mode 100644 index 0000000..00ff68c --- /dev/null +++ b/example/build/example.es.js @@ -0,0 +1,496 @@ +function v(e, t) { + return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2)); +} +function w(e, t) { + const i = v(e, t), n = { + x: t.x - e.x, + y: t.y - e.y + }; + return { + x: n.x / i, + y: n.y / i + }; +} +class b { + constructor(t) { + this.canvas = t, this.lastTouch = null, this.sensitivity = 20, this.lastStrokeParts = [], this.onStrokePartHandlers = [], this.onTouchStart = this.onTouchStart.bind(this), this.onTouchEnd = this.onTouchEnd.bind(this), this.onTouchCancel = this.onTouchCancel.bind(this), this.onTouchMove = this.onTouchMove.bind(this), this.destroy = this.destroy.bind(this), this.getRelativePosition = this.getRelativePosition.bind(this), this.canvas.addEventListener("touchstart", this.onTouchStart, { + passive: !1 + }), this.canvas.addEventListener("touchend", this.onTouchEnd, { + passive: !1 + }), this.canvas.addEventListener("touchcancel", this.onTouchCancel, { + passive: !1 + }), this.canvas.addEventListener("touchmove", this.onTouchMove, { + passive: !1 + }); + } + /** + * Registers a handler to be fired on a new stroke part + * @param handler + */ + onStrokePart(t) { + this.onStrokePartHandlers.push(t); + } + /** + * Removes all active listeners + */ + destroy() { + this.onStrokePartHandlers = [], this.lastStrokeParts = [], this.canvas.removeEventListener("touchstart", this.onTouchStart), this.canvas.removeEventListener("touchend", this.onTouchEnd), this.canvas.removeEventListener("touchcancel", this.onTouchCancel), this.canvas.removeEventListener("touchmove", this.onTouchMove); + } + /** + * Get relative position to canvas + * @param clientX + * @param clientY + * @returns IPoint + */ + getRelativePosition(t, i) { + const n = this.canvas.getBoundingClientRect(); + return { + x: t - n.left, + y: i - n.top + }; + } + /** + * Creates a new touch if one does not + * already exist + * @param e + */ + onTouchStart(t) { + if (t.preventDefault(), this.lastTouch) + return; + const i = t.changedTouches.item(0); + this.lastTouch = { + id: i.identifier, + position: this.getRelativePosition(i.clientX, i.clientY) + }; + } + /** + * Creates a line from last touch to current touch + * point and emits event. Does no-op if no existing touch + * @param e + */ + onTouchMove(t) { + if (t.preventDefault(), !this.lastTouch) + return; + const i = t.changedTouches, n = Array.from(i).find((a) => a.identifier === this.lastTouch.id); + if (!n) + return; + const o = { + id: n.identifier, + position: this.getRelativePosition(n.clientX, n.clientY) + }; + if (this.sensitivity && v(o.position, this.lastTouch.position) < 10 / this.sensitivity) + return; + const s = { + endPoint: o.position, + startPoint: this.lastTouch.position, + isStart: this.lastStrokeParts.length === 0, + isEnd: !1 + }; + this.onStrokePartHandlers.forEach((a) => { + a(s); + }), this.lastTouch = o, this.lastStrokeParts.push(s); + } + /** + * Draws a line from last point to final point. Removes + * the reference to last touch point. + * @param e + */ + onTouchEnd(t) { + if (t.preventDefault(), !this.lastTouch) + return; + const i = t.changedTouches, n = Array.from(i).find((a) => a.identifier === this.lastTouch.id); + if (!n) + return; + const o = this.getRelativePosition(n.clientX, n.clientY), s = { + startPoint: this.lastTouch.position, + endPoint: o, + isStart: !1, + isEnd: !0 + }; + this.onStrokePartHandlers.forEach((a) => { + a(s); + }), this.lastTouch = null, this.lastStrokeParts = []; + } + /** + * Removes the current last touch point + * @param e + */ + onTouchCancel(t) { + t.preventDefault(), this.lastTouch = null, this.lastStrokeParts = []; + } +} +class f { + constructor(t, i, n) { + this.canvas = t, this.canvasWidth = i, this.canvasHeight = n, this.currentTool = null, this.currentStroke = [], this.strokeManager = new b(t), this.canvasState = null, this.shouldDraw = !1, this.shouldCommit = !1; + const o = t.getContext("2d").backingStorePixelRatio || 1, s = window.devicePixelRatio || 1; + this.pixelRatio = s / o, this.setCanvasSize = this.setCanvasSize.bind(this), this.setTool = this.setTool.bind(this), this.destroy = this.destroy.bind(this), this.clear = this.clear.bind(this), this.draw = this.draw.bind(this), this.onStrokePart = this.onStrokePart.bind(this), this.nextAnimationFrame = window.requestAnimationFrame(this.draw), this.strokeManager.onStrokePart(this.onStrokePart), this.setCanvasSize(i, n); + } + /** + * Sets the canvas desired width and height and sets transform + * for hifi displays + * @param width + * @param height + */ + setCanvasSize(t, i) { + this.canvasWidth = t, this.canvasHeight = i; + const { canvas: n, canvasWidth: o, canvasHeight: s, pixelRatio: a } = this, l = n.getContext("2d"); + n.width = o * a, n.height = s * a, n.style.width = o + "px", n.style.height = s + "px", l.setTransform(a, 0, 0, a, 0, 0); + } + /** + * Sets the current tool for the manager + * @param tool + */ + setTool(t) { + this.currentTool = t; + } + /** + * Remove all event listeners + */ + destroy() { + window.cancelAnimationFrame(this.nextAnimationFrame), this.strokeManager.destroy(); + } + /** + * Clears the canvas + */ + clear() { + this.canvasState = null, this.currentStroke = [], this.shouldDraw = !0, this.shouldCommit = !0; + } + /** + * Adds a new stroke part to the nextStrokes + * array + * @param strokePart + */ + onStrokePart(t) { + this.currentStroke.push(t), this.shouldDraw = !0, t.isEnd && (this.shouldCommit = !0); + } + /** + * Draws a frame + */ + draw() { + this.nextAnimationFrame = window.requestAnimationFrame(this.draw); + const t = this.canvas.getContext("2d"); + this.shouldDraw && (t.clearRect(0, 0, this.canvasWidth, this.canvasHeight), this.canvasState && t.putImageData(this.canvasState, 0, 0), this.currentTool && this.currentStroke.length && (t.save(), this.currentTool.draw(t, this.currentStroke), t.restore()), this.shouldCommit && (this.canvasState = t.getImageData( + 0, + 0, + this.canvasWidth * this.pixelRatio, + this.canvasHeight * this.pixelRatio + ), this.currentStroke = [], this.shouldCommit = !1), this.shouldDraw = !1); + } +} +class p { + constructor(t = "red", i = 3) { + this.color = t, this.width = i; + } + /** + * Draws a "pen stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(t, i) { + const n = i[0]; + t.beginPath(), t.lineWidth = this.width, t.strokeStyle = this.color, t.lineCap = "round", t.lineJoin = "round", t.moveTo(n.startPoint.x, n.startPoint.y), i.forEach((o) => { + const { endPoint: s } = o; + t.lineTo(s.x, s.y); + }), t.stroke(); + } +} +class T { + constructor(t = 10, i) { + this.width = t, i = i || {}, this.handleOpts = { + hide: i.hide || !1, + strokeWidth: i.strokeWidth || 2, + fillColor: i.fillColor || "white", + strokeColor: i.strokeColor || "black" + }; + } + /** + * Draws an "eraser stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(t, i) { + const { handleOpts: n } = this, o = this.width / 2; + i.forEach((a) => { + const { startPoint: l, endPoint: h, isEnd: c } = a, d = v(l, h), g = w(l, h); + let r = l, u = 0; + for (; u < d; ) { + const m = { + x: r.x + g.x, + y: r.y + g.y + }; + t.clearRect( + m.x - o, + m.y - o, + this.width, + this.width + ), u++, r = m; + } + }); + const s = i[i.length - 1]; + !s.isEnd && !n.hide && (t.strokeStyle = n.strokeColor, t.fillStyle = n.fillColor, t.fillRect( + s.endPoint.x - o, + s.endPoint.y - o, + this.width, + this.width + ), t.strokeRect( + s.endPoint.x - o + 0.5, + s.endPoint.y - o + 0.5, + this.width - 1, + this.width - 1 + )); + } +} +function P(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var S = { + aliceblue: [240, 248, 255], + antiquewhite: [250, 235, 215], + aqua: [0, 255, 255], + aquamarine: [127, 255, 212], + azure: [240, 255, 255], + beige: [245, 245, 220], + bisque: [255, 228, 196], + black: [0, 0, 0], + blanchedalmond: [255, 235, 205], + blue: [0, 0, 255], + blueviolet: [138, 43, 226], + brown: [165, 42, 42], + burlywood: [222, 184, 135], + cadetblue: [95, 158, 160], + chartreuse: [127, 255, 0], + chocolate: [210, 105, 30], + coral: [255, 127, 80], + cornflowerblue: [100, 149, 237], + cornsilk: [255, 248, 220], + crimson: [220, 20, 60], + cyan: [0, 255, 255], + darkblue: [0, 0, 139], + darkcyan: [0, 139, 139], + darkgoldenrod: [184, 134, 11], + darkgray: [169, 169, 169], + darkgreen: [0, 100, 0], + darkgrey: [169, 169, 169], + darkkhaki: [189, 183, 107], + darkmagenta: [139, 0, 139], + darkolivegreen: [85, 107, 47], + darkorange: [255, 140, 0], + darkorchid: [153, 50, 204], + darkred: [139, 0, 0], + darksalmon: [233, 150, 122], + darkseagreen: [143, 188, 143], + darkslateblue: [72, 61, 139], + darkslategray: [47, 79, 79], + darkslategrey: [47, 79, 79], + darkturquoise: [0, 206, 209], + darkviolet: [148, 0, 211], + deeppink: [255, 20, 147], + deepskyblue: [0, 191, 255], + dimgray: [105, 105, 105], + dimgrey: [105, 105, 105], + dodgerblue: [30, 144, 255], + firebrick: [178, 34, 34], + floralwhite: [255, 250, 240], + forestgreen: [34, 139, 34], + fuchsia: [255, 0, 255], + gainsboro: [220, 220, 220], + ghostwhite: [248, 248, 255], + gold: [255, 215, 0], + goldenrod: [218, 165, 32], + gray: [128, 128, 128], + green: [0, 128, 0], + greenyellow: [173, 255, 47], + grey: [128, 128, 128], + honeydew: [240, 255, 240], + hotpink: [255, 105, 180], + indianred: [205, 92, 92], + indigo: [75, 0, 130], + ivory: [255, 255, 240], + khaki: [240, 230, 140], + lavender: [230, 230, 250], + lavenderblush: [255, 240, 245], + lawngreen: [124, 252, 0], + lemonchiffon: [255, 250, 205], + lightblue: [173, 216, 230], + lightcoral: [240, 128, 128], + lightcyan: [224, 255, 255], + lightgoldenrodyellow: [250, 250, 210], + lightgray: [211, 211, 211], + lightgreen: [144, 238, 144], + lightgrey: [211, 211, 211], + lightpink: [255, 182, 193], + lightsalmon: [255, 160, 122], + lightseagreen: [32, 178, 170], + lightskyblue: [135, 206, 250], + lightslategray: [119, 136, 153], + lightslategrey: [119, 136, 153], + lightsteelblue: [176, 196, 222], + lightyellow: [255, 255, 224], + lime: [0, 255, 0], + limegreen: [50, 205, 50], + linen: [250, 240, 230], + magenta: [255, 0, 255], + maroon: [128, 0, 0], + mediumaquamarine: [102, 205, 170], + mediumblue: [0, 0, 205], + mediumorchid: [186, 85, 211], + mediumpurple: [147, 112, 219], + mediumseagreen: [60, 179, 113], + mediumslateblue: [123, 104, 238], + mediumspringgreen: [0, 250, 154], + mediumturquoise: [72, 209, 204], + mediumvioletred: [199, 21, 133], + midnightblue: [25, 25, 112], + mintcream: [245, 255, 250], + mistyrose: [255, 228, 225], + moccasin: [255, 228, 181], + navajowhite: [255, 222, 173], + navy: [0, 0, 128], + oldlace: [253, 245, 230], + olive: [128, 128, 0], + olivedrab: [107, 142, 35], + orange: [255, 165, 0], + orangered: [255, 69, 0], + orchid: [218, 112, 214], + palegoldenrod: [238, 232, 170], + palegreen: [152, 251, 152], + paleturquoise: [175, 238, 238], + palevioletred: [219, 112, 147], + papayawhip: [255, 239, 213], + peachpuff: [255, 218, 185], + peru: [205, 133, 63], + pink: [255, 192, 203], + plum: [221, 160, 221], + powderblue: [176, 224, 230], + purple: [128, 0, 128], + rebeccapurple: [102, 51, 153], + red: [255, 0, 0], + rosybrown: [188, 143, 143], + royalblue: [65, 105, 225], + saddlebrown: [139, 69, 19], + salmon: [250, 128, 114], + sandybrown: [244, 164, 96], + seagreen: [46, 139, 87], + seashell: [255, 245, 238], + sienna: [160, 82, 45], + silver: [192, 192, 192], + skyblue: [135, 206, 235], + slateblue: [106, 90, 205], + slategray: [112, 128, 144], + slategrey: [112, 128, 144], + snow: [255, 250, 250], + springgreen: [0, 255, 127], + steelblue: [70, 130, 180], + tan: [210, 180, 140], + teal: [0, 128, 128], + thistle: [216, 191, 216], + tomato: [255, 99, 71], + turquoise: [64, 224, 208], + violet: [238, 130, 238], + wheat: [245, 222, 179], + white: [255, 255, 255], + whitesmoke: [245, 245, 245], + yellow: [255, 255, 0], + yellowgreen: [154, 205, 50] +}; +const y = /* @__PURE__ */ P(S); +var k = { + red: 0, + orange: 60, + yellow: 120, + green: 180, + blue: 240, + purple: 300 +}; +function E(e) { + var t, i = [], n = 1, o; + if (typeof e == "string") + if (e = e.toLowerCase(), y[e]) + i = y[e].slice(), o = "rgb"; + else if (e === "transparent") + n = 0, o = "rgb", i = [0, 0, 0]; + else if (/^#[A-Fa-f0-9]+$/.test(e)) { + var s = e.slice(1), a = s.length, l = a <= 4; + n = 1, l ? (i = [ + parseInt(s[0] + s[0], 16), + parseInt(s[1] + s[1], 16), + parseInt(s[2] + s[2], 16) + ], a === 4 && (n = parseInt(s[3] + s[3], 16) / 255)) : (i = [ + parseInt(s[0] + s[1], 16), + parseInt(s[2] + s[3], 16), + parseInt(s[4] + s[5], 16) + ], a === 8 && (n = parseInt(s[6] + s[7], 16) / 255)), i[0] || (i[0] = 0), i[1] || (i[1] = 0), i[2] || (i[2] = 0), o = "rgb"; + } else if (t = /^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(e)) { + var h = t[1], c = h === "rgb", s = h.replace(/a$/, ""); + o = s; + var a = s === "cmyk" ? 4 : s === "gray" ? 1 : 3; + i = t[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(r, u) { + if (/%$/.test(r)) + return u === a ? parseFloat(r) / 100 : s === "rgb" ? parseFloat(r) * 255 / 100 : parseFloat(r); + if (s[u] === "h") { + if (/deg$/.test(r)) + return parseFloat(r); + if (k[r] !== void 0) + return k[r]; + } + return parseFloat(r); + }), h === s && i.push(1), n = c || i[a] === void 0 ? 1 : i[a], i = i.slice(0, a); + } else + e.length > 10 && /[0-9](?:\s|\/)/.test(e) && (i = e.match(/([0-9]+)/g).map(function(d) { + return parseFloat(d); + }), o = e.match(/([a-z])/ig).join("").toLowerCase()); + else + isNaN(e) ? Array.isArray(e) || e.length ? (i = [e[0], e[1], e[2]], o = "rgb", n = e.length === 4 ? e[3] : 1) : e instanceof Object && (e.r != null || e.red != null || e.R != null ? (o = "rgb", i = [ + e.r || e.red || e.R || 0, + e.g || e.green || e.G || 0, + e.b || e.blue || e.B || 0 + ]) : (o = "hsl", i = [ + e.h || e.hue || e.H || 0, + e.s || e.saturation || e.S || 0, + e.l || e.lightness || e.L || e.b || e.brightness + ]), n = e.a || e.alpha || e.opacity || 1, e.opacity != null && (n /= 100)) : (o = "rgb", i = [e >>> 16, (e & 65280) >>> 8, e & 255]); + return { + space: o, + values: i, + alpha: n + }; +} +function x(e, t) { + var i = E(e); + return t == null && (t = i.alpha), i.space[0] === "h" ? i.space + ["a(", i.values[0], ",", i.values[1], "%,", i.values[2], "%,", t, ")"].join("") : i.space + ["a(", i.values, ",", t, ")"].join(""); +} +class C { + constructor(t = "yellow", i = 8, n = 0.3) { + this.width = i, this.color = x(t, 0.4); + } + /** + * Draws a "highlighter stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(t, i) { + const n = i[0]; + t.beginPath(), t.lineWidth = this.width, t.strokeStyle = this.color, t.lineCap = "butt", t.miterLimit = 1, t.moveTo(n.startPoint.x, n.startPoint.y), i.forEach((o) => { + const { endPoint: s } = o; + t.lineTo(s.x, s.y); + }), t.stroke(); + } +} +window.onload = function() { + const e = document.getElementById("canvas"), t = document.getElementById("red-pen"), i = document.getElementById("blue-pen"), n = document.getElementById("eraser"), o = document.getElementById("highlighter"), s = document.getElementById("clear"); + if (!t || !i || !n || !o || !s) + throw new Error("Invalid elements"); + const a = 400, l = 400, h = new f(e, a, l), c = new p("red", 3), d = new p("blue", 8), g = new T(20), r = new C("yellow", 30); + h.setTool(c), t.onclick = function() { + h.setTool(c); + }, i.onclick = function() { + h.setTool(d); + }, n.onclick = function() { + h.setTool(g); + }, o.onclick = function() { + h.setTool(r); + }, s.onclick = function() { + h.clear(); + }; +}; +//# sourceMappingURL=example.es.js.map diff --git a/example/build/example.es.js.map b/example/build/example.es.js.map new file mode 100644 index 0000000..5f7a6df --- /dev/null +++ b/example/build/example.es.js.map @@ -0,0 +1 @@ +{"version":3,"file":"example.es.js","sources":["../../dist/index.es.js","../src/example.ts"],"sourcesContent":["function g(e, t) {\n return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));\n}\nfunction y(e, t) {\n const i = g(e, t), o = {\n x: t.x - e.x,\n y: t.y - e.y\n };\n return {\n x: o.x / i,\n y: o.y / i\n };\n}\nclass k {\n constructor(t) {\n this.canvas = t, this.lastTouch = null, this.sensitivity = 20, this.lastStrokeParts = [], this.onStrokePartHandlers = [], this.onTouchStart = this.onTouchStart.bind(this), this.onTouchEnd = this.onTouchEnd.bind(this), this.onTouchCancel = this.onTouchCancel.bind(this), this.onTouchMove = this.onTouchMove.bind(this), this.destroy = this.destroy.bind(this), this.getRelativePosition = this.getRelativePosition.bind(this), this.canvas.addEventListener(\"touchstart\", this.onTouchStart, {\n passive: !1\n }), this.canvas.addEventListener(\"touchend\", this.onTouchEnd, {\n passive: !1\n }), this.canvas.addEventListener(\"touchcancel\", this.onTouchCancel, {\n passive: !1\n }), this.canvas.addEventListener(\"touchmove\", this.onTouchMove, {\n passive: !1\n });\n }\n /**\n * Registers a handler to be fired on a new stroke part\n * @param handler\n */\n onStrokePart(t) {\n this.onStrokePartHandlers.push(t);\n }\n /**\n * Removes all active listeners\n */\n destroy() {\n this.onStrokePartHandlers = [], this.lastStrokeParts = [], this.canvas.removeEventListener(\"touchstart\", this.onTouchStart), this.canvas.removeEventListener(\"touchend\", this.onTouchEnd), this.canvas.removeEventListener(\"touchcancel\", this.onTouchCancel), this.canvas.removeEventListener(\"touchmove\", this.onTouchMove);\n }\n /**\n * Get relative position to canvas\n * @param clientX\n * @param clientY\n * @returns IPoint\n */\n getRelativePosition(t, i) {\n const o = this.canvas.getBoundingClientRect();\n return {\n x: t - o.left,\n y: i - o.top\n };\n }\n /**\n * Creates a new touch if one does not\n * already exist\n * @param e\n */\n onTouchStart(t) {\n if (t.preventDefault(), this.lastTouch)\n return;\n const o = t.changedTouches.item(0);\n this.lastTouch = {\n id: o.identifier,\n position: this.getRelativePosition(o.clientX, o.clientY)\n };\n }\n /**\n * Creates a line from last touch to current touch\n * point and emits event. Does no-op if no existing touch\n * @param e\n */\n onTouchMove(t) {\n if (t.preventDefault(), !this.lastTouch)\n return;\n const i = t.changedTouches, o = Array.from(i).find((a) => a.identifier === this.lastTouch.id);\n if (!o)\n return;\n const n = {\n id: o.identifier,\n position: this.getRelativePosition(o.clientX, o.clientY)\n };\n if (this.sensitivity && g(n.position, this.lastTouch.position) < 10 / this.sensitivity)\n return;\n const s = {\n endPoint: n.position,\n startPoint: this.lastTouch.position,\n isStart: this.lastStrokeParts.length === 0,\n isEnd: !1\n };\n this.onStrokePartHandlers.forEach((a) => {\n a(s);\n }), this.lastTouch = n, this.lastStrokeParts.push(s);\n }\n /**\n * Draws a line from last point to final point. Removes\n * the reference to last touch point.\n * @param e\n */\n onTouchEnd(t) {\n if (t.preventDefault(), !this.lastTouch)\n return;\n const i = t.changedTouches, o = Array.from(i).find((a) => a.identifier === this.lastTouch.id);\n if (!o)\n return;\n const n = this.getRelativePosition(o.clientX, o.clientY), s = {\n startPoint: this.lastTouch.position,\n endPoint: n,\n isStart: !1,\n isEnd: !0\n };\n this.onStrokePartHandlers.forEach((a) => {\n a(s);\n }), this.lastTouch = null, this.lastStrokeParts = [];\n }\n /**\n * Removes the current last touch point\n * @param e\n */\n onTouchCancel(t) {\n t.preventDefault(), this.lastTouch = null, this.lastStrokeParts = [];\n }\n}\nclass P {\n constructor(t, i, o) {\n this.canvas = t, this.canvasWidth = i, this.canvasHeight = o, this.currentTool = null, this.currentStroke = [], this.strokeManager = new k(t), this.canvasState = null, this.shouldDraw = !1, this.shouldCommit = !1;\n const n = t.getContext(\"2d\").backingStorePixelRatio || 1, s = window.devicePixelRatio || 1;\n this.pixelRatio = s / n, this.setCanvasSize = this.setCanvasSize.bind(this), this.setTool = this.setTool.bind(this), this.destroy = this.destroy.bind(this), this.clear = this.clear.bind(this), this.draw = this.draw.bind(this), this.onStrokePart = this.onStrokePart.bind(this), this.nextAnimationFrame = window.requestAnimationFrame(this.draw), this.strokeManager.onStrokePart(this.onStrokePart), this.setCanvasSize(i, o);\n }\n /**\n * Sets the canvas desired width and height and sets transform\n * for hifi displays\n * @param width\n * @param height\n */\n setCanvasSize(t, i) {\n this.canvasWidth = t, this.canvasHeight = i;\n const { canvas: o, canvasWidth: n, canvasHeight: s, pixelRatio: a } = this, h = o.getContext(\"2d\");\n o.width = n * a, o.height = s * a, o.style.width = n + \"px\", o.style.height = s + \"px\", h.setTransform(a, 0, 0, a, 0, 0);\n }\n /**\n * Sets the current tool for the manager\n * @param tool\n */\n setTool(t) {\n this.currentTool = t;\n }\n /**\n * Remove all event listeners\n */\n destroy() {\n window.cancelAnimationFrame(this.nextAnimationFrame), this.strokeManager.destroy();\n }\n /**\n * Clears the canvas\n */\n clear() {\n this.canvasState = null, this.currentStroke = [], this.shouldDraw = !0, this.shouldCommit = !0;\n }\n /**\n * Adds a new stroke part to the nextStrokes\n * array\n * @param strokePart\n */\n onStrokePart(t) {\n this.currentStroke.push(t), this.shouldDraw = !0, t.isEnd && (this.shouldCommit = !0);\n }\n /**\n * Draws a frame\n */\n draw() {\n this.nextAnimationFrame = window.requestAnimationFrame(this.draw);\n const t = this.canvas.getContext(\"2d\");\n this.shouldDraw && (t.clearRect(0, 0, this.canvasWidth, this.canvasHeight), this.canvasState && t.putImageData(this.canvasState, 0, 0), this.currentTool && this.currentStroke.length && (t.save(), this.currentTool.draw(t, this.currentStroke), t.restore()), this.shouldCommit && (this.canvasState = t.getImageData(\n 0,\n 0,\n this.canvasWidth * this.pixelRatio,\n this.canvasHeight * this.pixelRatio\n ), this.currentStroke = [], this.shouldCommit = !1), this.shouldDraw = !1);\n }\n}\nclass C {\n constructor(t = \"red\", i = 3) {\n this.color = t, this.width = i;\n }\n /**\n * Draws a \"pen stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n draw(t, i) {\n const o = i[0];\n t.beginPath(), t.lineWidth = this.width, t.strokeStyle = this.color, t.lineCap = \"round\", t.lineJoin = \"round\", t.moveTo(o.startPoint.x, o.startPoint.y), i.forEach((n) => {\n const { endPoint: s } = n;\n t.lineTo(s.x, s.y);\n }), t.stroke();\n }\n}\nclass E {\n constructor(t = 10, i) {\n this.width = t, i = i || {}, this.handleOpts = {\n hide: i.hide || !1,\n strokeWidth: i.strokeWidth || 2,\n fillColor: i.fillColor || \"white\",\n strokeColor: i.strokeColor || \"black\"\n };\n }\n /**\n * Draws an \"eraser stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n draw(t, i) {\n const { handleOpts: o } = this, n = this.width / 2;\n i.forEach((a) => {\n const { startPoint: h, endPoint: l, isEnd: f } = a, d = g(h, l), v = y(h, l);\n let r = h, u = 0;\n for (; u < d; ) {\n const c = {\n x: r.x + v.x,\n y: r.y + v.y\n };\n t.clearRect(\n c.x - n,\n c.y - n,\n this.width,\n this.width\n ), u++, r = c;\n }\n });\n const s = i[i.length - 1];\n !s.isEnd && !o.hide && (t.strokeStyle = o.strokeColor, t.fillStyle = o.fillColor, t.fillRect(\n s.endPoint.x - n,\n s.endPoint.y - n,\n this.width,\n this.width\n ), t.strokeRect(\n s.endPoint.x - n + 0.5,\n s.endPoint.y - n + 0.5,\n this.width - 1,\n this.width - 1\n ));\n }\n}\nfunction w(e) {\n return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, \"default\") ? e.default : e;\n}\nvar b = {\n aliceblue: [240, 248, 255],\n antiquewhite: [250, 235, 215],\n aqua: [0, 255, 255],\n aquamarine: [127, 255, 212],\n azure: [240, 255, 255],\n beige: [245, 245, 220],\n bisque: [255, 228, 196],\n black: [0, 0, 0],\n blanchedalmond: [255, 235, 205],\n blue: [0, 0, 255],\n blueviolet: [138, 43, 226],\n brown: [165, 42, 42],\n burlywood: [222, 184, 135],\n cadetblue: [95, 158, 160],\n chartreuse: [127, 255, 0],\n chocolate: [210, 105, 30],\n coral: [255, 127, 80],\n cornflowerblue: [100, 149, 237],\n cornsilk: [255, 248, 220],\n crimson: [220, 20, 60],\n cyan: [0, 255, 255],\n darkblue: [0, 0, 139],\n darkcyan: [0, 139, 139],\n darkgoldenrod: [184, 134, 11],\n darkgray: [169, 169, 169],\n darkgreen: [0, 100, 0],\n darkgrey: [169, 169, 169],\n darkkhaki: [189, 183, 107],\n darkmagenta: [139, 0, 139],\n darkolivegreen: [85, 107, 47],\n darkorange: [255, 140, 0],\n darkorchid: [153, 50, 204],\n darkred: [139, 0, 0],\n darksalmon: [233, 150, 122],\n darkseagreen: [143, 188, 143],\n darkslateblue: [72, 61, 139],\n darkslategray: [47, 79, 79],\n darkslategrey: [47, 79, 79],\n darkturquoise: [0, 206, 209],\n darkviolet: [148, 0, 211],\n deeppink: [255, 20, 147],\n deepskyblue: [0, 191, 255],\n dimgray: [105, 105, 105],\n dimgrey: [105, 105, 105],\n dodgerblue: [30, 144, 255],\n firebrick: [178, 34, 34],\n floralwhite: [255, 250, 240],\n forestgreen: [34, 139, 34],\n fuchsia: [255, 0, 255],\n gainsboro: [220, 220, 220],\n ghostwhite: [248, 248, 255],\n gold: [255, 215, 0],\n goldenrod: [218, 165, 32],\n gray: [128, 128, 128],\n green: [0, 128, 0],\n greenyellow: [173, 255, 47],\n grey: [128, 128, 128],\n honeydew: [240, 255, 240],\n hotpink: [255, 105, 180],\n indianred: [205, 92, 92],\n indigo: [75, 0, 130],\n ivory: [255, 255, 240],\n khaki: [240, 230, 140],\n lavender: [230, 230, 250],\n lavenderblush: [255, 240, 245],\n lawngreen: [124, 252, 0],\n lemonchiffon: [255, 250, 205],\n lightblue: [173, 216, 230],\n lightcoral: [240, 128, 128],\n lightcyan: [224, 255, 255],\n lightgoldenrodyellow: [250, 250, 210],\n lightgray: [211, 211, 211],\n lightgreen: [144, 238, 144],\n lightgrey: [211, 211, 211],\n lightpink: [255, 182, 193],\n lightsalmon: [255, 160, 122],\n lightseagreen: [32, 178, 170],\n lightskyblue: [135, 206, 250],\n lightslategray: [119, 136, 153],\n lightslategrey: [119, 136, 153],\n lightsteelblue: [176, 196, 222],\n lightyellow: [255, 255, 224],\n lime: [0, 255, 0],\n limegreen: [50, 205, 50],\n linen: [250, 240, 230],\n magenta: [255, 0, 255],\n maroon: [128, 0, 0],\n mediumaquamarine: [102, 205, 170],\n mediumblue: [0, 0, 205],\n mediumorchid: [186, 85, 211],\n mediumpurple: [147, 112, 219],\n mediumseagreen: [60, 179, 113],\n mediumslateblue: [123, 104, 238],\n mediumspringgreen: [0, 250, 154],\n mediumturquoise: [72, 209, 204],\n mediumvioletred: [199, 21, 133],\n midnightblue: [25, 25, 112],\n mintcream: [245, 255, 250],\n mistyrose: [255, 228, 225],\n moccasin: [255, 228, 181],\n navajowhite: [255, 222, 173],\n navy: [0, 0, 128],\n oldlace: [253, 245, 230],\n olive: [128, 128, 0],\n olivedrab: [107, 142, 35],\n orange: [255, 165, 0],\n orangered: [255, 69, 0],\n orchid: [218, 112, 214],\n palegoldenrod: [238, 232, 170],\n palegreen: [152, 251, 152],\n paleturquoise: [175, 238, 238],\n palevioletred: [219, 112, 147],\n papayawhip: [255, 239, 213],\n peachpuff: [255, 218, 185],\n peru: [205, 133, 63],\n pink: [255, 192, 203],\n plum: [221, 160, 221],\n powderblue: [176, 224, 230],\n purple: [128, 0, 128],\n rebeccapurple: [102, 51, 153],\n red: [255, 0, 0],\n rosybrown: [188, 143, 143],\n royalblue: [65, 105, 225],\n saddlebrown: [139, 69, 19],\n salmon: [250, 128, 114],\n sandybrown: [244, 164, 96],\n seagreen: [46, 139, 87],\n seashell: [255, 245, 238],\n sienna: [160, 82, 45],\n silver: [192, 192, 192],\n skyblue: [135, 206, 235],\n slateblue: [106, 90, 205],\n slategray: [112, 128, 144],\n slategrey: [112, 128, 144],\n snow: [255, 250, 250],\n springgreen: [0, 255, 127],\n steelblue: [70, 130, 180],\n tan: [210, 180, 140],\n teal: [0, 128, 128],\n thistle: [216, 191, 216],\n tomato: [255, 99, 71],\n turquoise: [64, 224, 208],\n violet: [238, 130, 238],\n wheat: [245, 222, 179],\n white: [255, 255, 255],\n whitesmoke: [245, 245, 245],\n yellow: [255, 255, 0],\n yellowgreen: [154, 205, 50]\n};\nconst p = /* @__PURE__ */ w(b);\nvar m = {\n red: 0,\n orange: 60,\n yellow: 120,\n green: 180,\n blue: 240,\n purple: 300\n};\nfunction T(e) {\n var t, i = [], o = 1, n;\n if (typeof e == \"string\")\n if (e = e.toLowerCase(), p[e])\n i = p[e].slice(), n = \"rgb\";\n else if (e === \"transparent\")\n o = 0, n = \"rgb\", i = [0, 0, 0];\n else if (/^#[A-Fa-f0-9]+$/.test(e)) {\n var s = e.slice(1), a = s.length, h = a <= 4;\n o = 1, h ? (i = [\n parseInt(s[0] + s[0], 16),\n parseInt(s[1] + s[1], 16),\n parseInt(s[2] + s[2], 16)\n ], a === 4 && (o = parseInt(s[3] + s[3], 16) / 255)) : (i = [\n parseInt(s[0] + s[1], 16),\n parseInt(s[2] + s[3], 16),\n parseInt(s[4] + s[5], 16)\n ], a === 8 && (o = parseInt(s[6] + s[7], 16) / 255)), i[0] || (i[0] = 0), i[1] || (i[1] = 0), i[2] || (i[2] = 0), n = \"rgb\";\n } else if (t = /^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\\s*\\(([^\\)]*)\\)/.exec(e)) {\n var l = t[1], f = l === \"rgb\", s = l.replace(/a$/, \"\");\n n = s;\n var a = s === \"cmyk\" ? 4 : s === \"gray\" ? 1 : 3;\n i = t[2].trim().split(/\\s*[,\\/]\\s*|\\s+/).map(function(r, u) {\n if (/%$/.test(r))\n return u === a ? parseFloat(r) / 100 : s === \"rgb\" ? parseFloat(r) * 255 / 100 : parseFloat(r);\n if (s[u] === \"h\") {\n if (/deg$/.test(r))\n return parseFloat(r);\n if (m[r] !== void 0)\n return m[r];\n }\n return parseFloat(r);\n }), l === s && i.push(1), o = f || i[a] === void 0 ? 1 : i[a], i = i.slice(0, a);\n } else\n e.length > 10 && /[0-9](?:\\s|\\/)/.test(e) && (i = e.match(/([0-9]+)/g).map(function(d) {\n return parseFloat(d);\n }), n = e.match(/([a-z])/ig).join(\"\").toLowerCase());\n else\n isNaN(e) ? Array.isArray(e) || e.length ? (i = [e[0], e[1], e[2]], n = \"rgb\", o = e.length === 4 ? e[3] : 1) : e instanceof Object && (e.r != null || e.red != null || e.R != null ? (n = \"rgb\", i = [\n e.r || e.red || e.R || 0,\n e.g || e.green || e.G || 0,\n e.b || e.blue || e.B || 0\n ]) : (n = \"hsl\", i = [\n e.h || e.hue || e.H || 0,\n e.s || e.saturation || e.S || 0,\n e.l || e.lightness || e.L || e.b || e.brightness\n ]), o = e.a || e.alpha || e.opacity || 1, e.opacity != null && (o /= 100)) : (n = \"rgb\", i = [e >>> 16, (e & 65280) >>> 8, e & 255]);\n return {\n space: n,\n values: i,\n alpha: o\n };\n}\nfunction S(e, t) {\n var i = T(e);\n return t == null && (t = i.alpha), i.space[0] === \"h\" ? i.space + [\"a(\", i.values[0], \",\", i.values[1], \"%,\", i.values[2], \"%,\", t, \")\"].join(\"\") : i.space + [\"a(\", i.values, \",\", t, \")\"].join(\"\");\n}\nclass R {\n constructor(t = \"yellow\", i = 8, o = 0.3) {\n this.width = i, this.color = S(t, 0.4);\n }\n /**\n * Draws a \"highlighter stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n draw(t, i) {\n const o = i[0];\n t.beginPath(), t.lineWidth = this.width, t.strokeStyle = this.color, t.lineCap = \"butt\", t.miterLimit = 1, t.moveTo(o.startPoint.x, o.startPoint.y), i.forEach((n) => {\n const { endPoint: s } = n;\n t.lineTo(s.x, s.y);\n }), t.stroke();\n }\n}\nexport {\n E as EraserTool,\n R as HighlighterTool,\n P as Manager,\n C as PenTool\n};\n//# sourceMappingURL=index.es.js.map\n","import {\r\n Manager,\r\n PenTool,\r\n EraserTool,\r\n HighlighterTool,\r\n} from \"../../dist/index.es\";\r\n\r\nwindow.onload = function () {\r\n const canvas = document.getElementById(\"canvas\");\r\n const redPenElem = document.getElementById(\"red-pen\");\r\n const bluePenElem = document.getElementById(\"blue-pen\");\r\n const eraserElem = document.getElementById(\"eraser\");\r\n const highlighterElem = document.getElementById(\"highlighter\");\r\n const clearElem = document.getElementById(\"clear\");\r\n\r\n if (\r\n !redPenElem ||\r\n !bluePenElem ||\r\n !eraserElem ||\r\n !highlighterElem ||\r\n !clearElem\r\n ) {\r\n throw new Error(\"Invalid elements\");\r\n }\r\n\r\n const width = 400;\r\n const height = 400;\r\n\r\n const manager = new Manager(canvas, width, height);\r\n\r\n const redPen = new PenTool(\"red\", 3);\r\n const bluePen = new PenTool(\"blue\", 8);\r\n const eraser = new EraserTool(20);\r\n const highlighterTool = new HighlighterTool(\"yellow\", 30);\r\n\r\n manager.setTool(redPen);\r\n\r\n redPenElem.onclick = function () {\r\n manager.setTool(redPen);\r\n };\r\n\r\n bluePenElem.onclick = function () {\r\n manager.setTool(bluePen);\r\n };\r\n\r\n eraserElem.onclick = function () {\r\n manager.setTool(eraser);\r\n };\r\n\r\n highlighterElem.onclick = function () {\r\n manager.setTool(highlighterTool);\r\n };\r\n\r\n clearElem.onclick = function () {\r\n manager.clear();\r\n };\r\n};\r\n"],"names":["g","y","o","k","n","P","h","C","E","l","f","v","c","w","b","p","m","T","S","R","canvas","redPenElem","bluePenElem","eraserElem","highlighterElem","clearElem","width","height","manager","Manager","redPen","PenTool","bluePen","eraser","EraserTool","highlighterTool","HighlighterTool"],"mappings":"AAAA,SAASA,EAAE,GAAG,GAAG;AACf,SAAO,KAAK,KAAK,KAAK,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,KAAK,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAClE;AACA,SAASC,EAAE,GAAG,GAAG;AACf,QAAM,IAAID,EAAE,GA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AAQ,MAAM;AAAA,EAAA;AAElB;"} \ No newline at end of file diff --git a/example/build/example.js b/example/build/example.js deleted file mode 100644 index d6b5fec..0000000 --- a/example/build/example.js +++ /dev/null @@ -1,1576 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const lib_1 = __webpack_require__(1); -window.onload = function () { - const canvas = document.getElementById("canvas"); - const redPenElem = document.getElementById("red-pen"); - const bluePenElem = document.getElementById("blue-pen"); - const eraserElem = document.getElementById("eraser"); - const highlighterElem = document.getElementById("highlighter"); - const clearElem = document.getElementById("clear"); - const width = 400; - const height = 400; - const manager = new lib_1.Manager(canvas, width, height); - const redPen = new lib_1.PenTool("red", 3); - const bluePen = new lib_1.PenTool("blue", 8); - const eraser = new lib_1.EraserTool(20); - const highlighterTool = new lib_1.HighlighterTool("yellow", 30); - manager.setTool(redPen); - redPenElem.onclick = function () { - manager.setTool(redPen); - }; - bluePenElem.onclick = function () { - manager.setTool(bluePen); - }; - eraserElem.onclick = function () { - manager.setTool(eraser); - }; - highlighterElem.onclick = function () { - manager.setTool(highlighterTool); - }; - clearElem.onclick = function () { - manager.clear(); - }; -}; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -(function webpackUniversalModuleDefinition(root, factory) { - if(true) - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["Paintbricks"] = factory(); - else - root["Paintbricks"] = factory(); -})(typeof self !== 'undefined' ? self : this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Get the distance between two points - * @param p1 - * @param p2 - * @returns number - */ -function getEuclidean(p1, p2) { - return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); -} -exports.getEuclidean = getEuclidean; -/** - * Gets the unit vector representing the vector from start - * point to end point with a length of 1. - * @param startPoint - * @param endPoint - * @returns IPoint - */ -function getUnitVector(startPoint, endPoint) { - const length = this.getEuclidean(startPoint, endPoint); - const dirVect = { - x: endPoint.x - startPoint.x, - y: endPoint.y - startPoint.y - }; - const unitVect = { - x: dirVect.x / length, - y: dirVect.y / length - }; - return unitVect; -} -exports.getUnitVector = getUnitVector; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var Manager_1 = __webpack_require__(2); -exports.Manager = Manager_1.Manager; -var PenTool_1 = __webpack_require__(4); -exports.PenTool = PenTool_1.PenTool; -var EraserTool_1 = __webpack_require__(5); -exports.EraserTool = EraserTool_1.EraserTool; -var HighlighterTool_1 = __webpack_require__(6); -exports.HighlighterTool = HighlighterTool_1.HighlighterTool; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const StrokeManager_1 = __webpack_require__(3); -class Manager { - constructor(canvas, canvasWidth, canvasHeight) { - this.canvas = canvas; - this.canvasWidth = canvasWidth; - this.canvasHeight = canvasHeight; - this.currentTool = null; - this.currentStroke = []; - this.strokeManager = new StrokeManager_1.StrokeManager(canvas); - this.canvasState = null; - this.shouldDraw = false; - this.shouldCommit = false; - // find pixel ratio relative to backing store and device ratio - const bsr = canvas.getContext("2d").backingStorePixelRatio || 1; - const dpr = window.devicePixelRatio || 1; - this.pixelRatio = dpr / bsr; - this.setCanvasSize = this.setCanvasSize.bind(this); - this.setTool = this.setTool.bind(this); - this.destroy = this.destroy.bind(this); - this.clear = this.clear.bind(this); - this.draw = this.draw.bind(this); - this.onStrokePart = this.onStrokePart.bind(this); - // schedule animation frame loop - this.nextAnimationFrame = window.requestAnimationFrame(this.draw); - // set up listener for new stroke part - this.strokeManager.onStrokePart(this.onStrokePart); - this.setCanvasSize(canvasWidth, canvasHeight); - } - /** - * Sets the canvas desired width and height and sets transform - * for hifi displays - * @param width - * @param height - */ - setCanvasSize(width, height) { - this.canvasWidth = width; - this.canvasHeight = height; - const { canvas, canvasWidth, canvasHeight, pixelRatio } = this; - const ctx = canvas.getContext("2d"); - // appropriately scale canvas to map to device ratio - canvas.width = canvasWidth * pixelRatio; - canvas.height = canvasHeight * pixelRatio; - canvas.style.width = canvasWidth + "px"; - canvas.style.height = canvasHeight + "px"; - ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); - } - /** - * Sets the current tool for the manager - * @param tool - */ - setTool(tool) { - this.currentTool = tool; - } - /** - * Remove all event listeners - */ - destroy() { - // cancel animation loop - window.cancelAnimationFrame(this.nextAnimationFrame); - // remove all listeners on stroke manager - this.strokeManager.destroy(); - } - /** - * Clears the canvas - */ - clear() { - this.canvasState = null; - this.currentStroke = []; - this.shouldDraw = true; - this.shouldCommit = true; - } - /** - * Adds a new stroke part to the nextStrokes - * array - * @param strokePart - */ - onStrokePart(strokePart) { - this.currentStroke.push(strokePart); - this.shouldDraw = true; - if (strokePart.isEnd) { - this.shouldCommit = true; - } - } - /** - * Draws a frame - */ - draw() { - // schedule next draw - this.nextAnimationFrame = window.requestAnimationFrame(this.draw); - const ctx = this.canvas.getContext("2d"); - if (!this.shouldDraw) { - return; - } - // clear canvas - ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight); - // draw current state - if (this.canvasState) { - ctx.putImageData(this.canvasState, 0, 0); - } - // if a tool has been selected and there are - // pending strokes, draw them - if (this.currentTool && this.currentStroke.length) { - ctx.save(); - this.currentTool.draw(ctx, this.currentStroke); - ctx.restore(); - } - // if all changes have been made for current stroke, - // save it as the new canvas state - if (this.shouldCommit) { - this.canvasState = ctx.getImageData(0, 0, this.canvasWidth * this.pixelRatio, this.canvasHeight * this.pixelRatio); - this.currentStroke = []; - this.shouldCommit = false; - } - this.shouldDraw = false; - } -} -exports.Manager = Manager; - - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = __webpack_require__(0); -class StrokeManager { - constructor(canvas) { - this.canvas = canvas; - this.lastTouch = null; - this.sensitivity = 20.0; - this.lastStrokeParts = []; - this.onStrokePartHandlers = []; - this.onTouchStart = this.onTouchStart.bind(this); - this.onTouchEnd = this.onTouchEnd.bind(this); - this.onTouchCancel = this.onTouchCancel.bind(this); - this.onTouchMove = this.onTouchMove.bind(this); - this.destroy = this.destroy.bind(this); - this.getRelativePosition = this.getRelativePosition.bind(this); - this.canvas.addEventListener("touchstart", this.onTouchStart, { - passive: false - }); - this.canvas.addEventListener("touchend", this.onTouchEnd, { - passive: false - }); - this.canvas.addEventListener("touchcancel", this.onTouchCancel, { - passive: false - }); - this.canvas.addEventListener("touchmove", this.onTouchMove, { - passive: false - }); - } - /** - * Registers a handler to be fired on a new stroke part - * @param handler - */ - onStrokePart(handler) { - this.onStrokePartHandlers.push(handler); - } - /** - * Removes all active listeners - */ - destroy() { - this.onStrokePartHandlers = []; - this.lastStrokeParts = []; - this.canvas.removeEventListener("touchstart", this.onTouchStart); - this.canvas.removeEventListener("touchend", this.onTouchEnd); - this.canvas.removeEventListener("touchcancel", this.onTouchCancel); - this.canvas.removeEventListener("touchmove", this.onTouchMove); - } - /** - * Get relative position to canvas - * @param clientX - * @param clientY - * @returns IPoint - */ - getRelativePosition(clientX, clientY) { - const rect = this.canvas.getBoundingClientRect(); - return { - x: clientX - rect.left, - y: clientY - rect.top - }; - } - /** - * Creates a new touch if one does not - * already exist - * @param e - */ - onTouchStart(e) { - e.preventDefault(); - // if there is an ongoing touch, ignore this event - if (this.lastTouch) { - return; - } - const touches = e.changedTouches; - // only get the first touch - const touch = touches.item(0); - // save the touch - this.lastTouch = { - id: touch.identifier, - position: this.getRelativePosition(touch.clientX, touch.clientY) - }; - } - /** - * Creates a line from last touch to current touch - * point and emits event. Does no-op if no existing touch - * @param e - */ - onTouchMove(e) { - e.preventDefault(); - // if no last touch... something is wrong - if (!this.lastTouch) { - return; - } - const touches = e.changedTouches; - // find the current touch we are tracking - const touch = Array.from(touches).find(touch => { - return touch.identifier === this.lastTouch.id; - }); - // if the touch was not one we were tracking, - // ignore and no-op - if (!touch) { - return; - } - const nextTouch = { - id: touch.identifier, - position: this.getRelativePosition(touch.clientX, touch.clientY) - }; - // If sensitivity setting has been set, - // check if this point is far enough from last - // touch to be drawn - if (this.sensitivity && - util_1.getEuclidean(nextTouch.position, this.lastTouch.position) < - 10.0 / this.sensitivity) { - return; - } - const strokePart = { - endPoint: nextTouch.position, - startPoint: this.lastTouch.position, - isStart: this.lastStrokeParts.length === 0, - isEnd: false - }; - this.onStrokePartHandlers.forEach(handler => { - handler(strokePart); - }); - // save this touch as last touch - this.lastTouch = nextTouch; - this.lastStrokeParts.push(strokePart); - } - /** - * Draws a line from last point to final point. Removes - * the reference to last touch point. - * @param e - */ - onTouchEnd(e) { - e.preventDefault(); - // if no last touch... something is wrong - if (!this.lastTouch) { - return; - } - const touches = e.changedTouches; - // find the current touch we are tracking - const touch = Array.from(touches).find(touch => { - return touch.identifier === this.lastTouch.id; - }); - // if the touch was not one we were tracking, - // ignore and no-op - if (!touch) { - return; - } - const endPoint = this.getRelativePosition(touch.clientX, touch.clientY); - const strokePart = { - startPoint: this.lastTouch.position, - endPoint, - isStart: false, - isEnd: true - }; - this.onStrokePartHandlers.forEach(handler => { - handler(strokePart); - }); - this.lastTouch = null; - this.lastStrokeParts = []; - } - /** - * Removes the current last touch point - * @param e - */ - onTouchCancel(e) { - e.preventDefault(); - this.lastTouch = null; - this.lastStrokeParts = []; - } -} -exports.StrokeManager = StrokeManager; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -class PenTool { - constructor(color = "red", width = 3) { - this.color = color; - this.width = width; - } - /** - * Draws a "pen stroke" for all line segments - * @param ctx - * @param strokeParts - */ - draw(ctx, strokeParts) { - const firstPart = strokeParts[0]; - ctx.beginPath(); - ctx.lineWidth = this.width; - ctx.strokeStyle = this.color; - ctx.lineCap = "round"; - ctx.lineJoin = "round"; - ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y); - strokeParts.forEach(strokePart => { - const { endPoint } = strokePart; - ctx.lineTo(endPoint.x, endPoint.y); - }); - ctx.stroke(); - } -} -exports.PenTool = PenTool; - - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = __webpack_require__(0); -class EraserTool { - constructor(width = 10, handleOpts) { - this.width = width; - this.lastEndPoint = null; - handleOpts = handleOpts || {}; - this.handleOpts = { - hide: handleOpts.hide || false, - strokeWidth: handleOpts.strokeWidth || 2, - fillColor: handleOpts.fillColor || "white", - strokeColor: handleOpts.strokeColor || "black" - }; - } - /** - * Draws an "eraser stroke" for all line segments - * @param ctx - * @param strokeParts - */ - draw(ctx, strokeParts) { - const { handleOpts } = this; - const halfWidth = this.width / 2.0; - strokeParts.forEach(strokePart => { - const { startPoint, endPoint, isEnd } = strokePart; - const length = util_1.getEuclidean(startPoint, endPoint); - const unitVect = util_1.getUnitVector(startPoint, endPoint); - let currentPoint = startPoint; - let i = 0; - // clear all the way along the drag - while (i < length) { - const nextPoint = { - x: currentPoint.x + unitVect.x, - y: currentPoint.y + unitVect.y - }; - ctx.clearRect(nextPoint.x - halfWidth, nextPoint.y - halfWidth, this.width, this.width); - i++; - currentPoint = nextPoint; - } - }); - const lastPart = strokeParts[strokeParts.length - 1]; - // if the end is not the last part, then draw - // the tool indicator at the endpoint - if (!lastPart.isEnd && !handleOpts.hide) { - ctx.strokeStyle = handleOpts.strokeColor; - ctx.fillStyle = handleOpts.fillColor; - ctx.fillRect(lastPart.endPoint.x - halfWidth, lastPart.endPoint.y - halfWidth, this.width, this.width); - ctx.strokeRect(lastPart.endPoint.x - halfWidth + 0.5, lastPart.endPoint.y - halfWidth + 0.5, this.width - 1, this.width - 1); - } - } -} -exports.EraserTool = EraserTool; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const parseColor = __webpack_require__(7); -class HighlighterTool { - constructor(color = "yellow", width = 8, opacity = 0.3) { - this.width = width; - this.lastStrokePart = null; - // calculate rgba color w/ opacity - const { rgb } = parseColor(color); - this.color = `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${opacity})`; - } - /** - * Draws a "highlighter stroke" for all line segments - * @param ctx - * @param strokeParts - */ - draw(ctx, strokeParts) { - const firstPart = strokeParts[0]; - ctx.beginPath(); - ctx.lineWidth = this.width; - ctx.strokeStyle = this.color; - ctx.lineCap = "butt"; - ctx.miterLimit = 1; - ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y); - strokeParts.forEach(strokePart => { - const { endPoint } = strokePart; - ctx.lineTo(endPoint.x, endPoint.y); - }); - ctx.stroke(); - } -} -exports.HighlighterTool = HighlighterTool; - - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - -var convert = __webpack_require__(8); - -module.exports = function (cstr) { - var m, conv, parts, alpha; - if (m = /^((?:rgb|hs[lv]|cmyk|xyz|lab)a?)\s*\(([^\)]*)\)/.exec(cstr)) { - var name = m[1]; - var base = name.replace(/a$/, ''); - var size = base === 'cmyk' ? 4 : 3; - conv = convert[base]; - - parts = m[2].replace(/^\s+|\s+$/g, '') - .split(/\s*,\s*/) - .map(function (x, i) { - if (/%$/.test(x) && i === size) { - return parseFloat(x) / 100; - } - else if (/%$/.test(x)) { - return parseFloat(x); - } - return parseFloat(x); - }) - ; - if (name === base) parts.push(1); - alpha = parts[size] === undefined ? 1 : parts[size]; - parts = parts.slice(0, size); - - conv[base] = function () { return parts }; - } - else if (/^#[A-Fa-f0-9]+$/.test(cstr)) { - var base = cstr.replace(/^#/,''); - var size = base.length; - conv = convert.rgb; - parts = base.split(size === 3 ? /(.)/ : /(..)/); - parts = parts.filter(Boolean) - .map(function (x) { - if (size === 3) { - return parseInt(x + x, 16); - } - else { - return parseInt(x, 16) - } - }) - ; - alpha = 1; - conv.rgb = function () { return parts }; - if (!parts[0]) parts[0] = 0; - if (!parts[1]) parts[1] = 0; - if (!parts[2]) parts[2] = 0; - } - else { - conv = convert.keyword; - conv.keyword = function () { return cstr }; - parts = cstr; - alpha = 1; - } - - var res = { - rgb: undefined, - hsl: undefined, - hsv: undefined, - cmyk: undefined, - keyword: undefined, - hex: undefined - }; - try { res.rgb = conv.rgb(parts) } catch (e) {} - try { res.hsl = conv.hsl(parts) } catch (e) {} - try { res.hsv = conv.hsv(parts) } catch (e) {} - try { res.cmyk = conv.cmyk(parts) } catch (e) {} - try { res.keyword = conv.keyword(parts) } catch (e) {} - - if (res.rgb) res.hex = '#' + res.rgb.map(function (x) { - var s = x.toString(16); - if (s.length === 1) return '0' + s; - return s; - }).join(''); - - if (res.rgb) res.rgba = res.rgb.concat(alpha); - if (res.hsl) res.hsla = res.hsl.concat(alpha); - if (res.hsv) res.hsva = res.hsv.concat(alpha); - if (res.cmyk) res.cmyka = res.cmyk.concat(alpha); - - return res; -}; - - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -var conversions = __webpack_require__(9); - -var convert = function() { - return new Converter(); -} - -for (var func in conversions) { - // export Raw versions - convert[func + "Raw"] = (function(func) { - // accept array or plain args - return function(arg) { - if (typeof arg == "number") - arg = Array.prototype.slice.call(arguments); - return conversions[func](arg); - } - })(func); - - var pair = /(\w+)2(\w+)/.exec(func), - from = pair[1], - to = pair[2]; - - // export rgb2hsl and ["rgb"]["hsl"] - convert[from] = convert[from] || {}; - - convert[from][to] = convert[func] = (function(func) { - return function(arg) { - if (typeof arg == "number") - arg = Array.prototype.slice.call(arguments); - - var val = conversions[func](arg); - if (typeof val == "string" || val === undefined) - return val; // keyword - - for (var i = 0; i < val.length; i++) - val[i] = Math.round(val[i]); - return val; - } - })(func); -} - - -/* Converter does lazy conversion and caching */ -var Converter = function() { - this.convs = {}; -}; - -/* Either get the values for a space or - set the values for a space, depending on args */ -Converter.prototype.routeSpace = function(space, args) { - var values = args[0]; - if (values === undefined) { - // color.rgb() - return this.getValues(space); - } - // color.rgb(10, 10, 10) - if (typeof values == "number") { - values = Array.prototype.slice.call(args); - } - - return this.setValues(space, values); -}; - -/* Set the values for a space, invalidating cache */ -Converter.prototype.setValues = function(space, values) { - this.space = space; - this.convs = {}; - this.convs[space] = values; - return this; -}; - -/* Get the values for a space. If there's already - a conversion for the space, fetch it, otherwise - compute it */ -Converter.prototype.getValues = function(space) { - var vals = this.convs[space]; - if (!vals) { - var fspace = this.space, - from = this.convs[fspace]; - vals = convert[fspace][space](from); - - this.convs[space] = vals; - } - return vals; -}; - -["rgb", "hsl", "hsv", "cmyk", "keyword"].forEach(function(space) { - Converter.prototype[space] = function(vals) { - return this.routeSpace(space, arguments); - } -}); - -module.exports = convert; - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - -/* MIT license */ - -module.exports = { - rgb2hsl: rgb2hsl, - rgb2hsv: rgb2hsv, - rgb2hwb: rgb2hwb, - rgb2cmyk: rgb2cmyk, - rgb2keyword: rgb2keyword, - rgb2xyz: rgb2xyz, - rgb2lab: rgb2lab, - rgb2lch: rgb2lch, - - hsl2rgb: hsl2rgb, - hsl2hsv: hsl2hsv, - hsl2hwb: hsl2hwb, - hsl2cmyk: hsl2cmyk, - hsl2keyword: hsl2keyword, - - hsv2rgb: hsv2rgb, - hsv2hsl: hsv2hsl, - hsv2hwb: hsv2hwb, - hsv2cmyk: hsv2cmyk, - hsv2keyword: hsv2keyword, - - hwb2rgb: hwb2rgb, - hwb2hsl: hwb2hsl, - hwb2hsv: hwb2hsv, - hwb2cmyk: hwb2cmyk, - hwb2keyword: hwb2keyword, - - cmyk2rgb: cmyk2rgb, - cmyk2hsl: cmyk2hsl, - cmyk2hsv: cmyk2hsv, - cmyk2hwb: cmyk2hwb, - cmyk2keyword: cmyk2keyword, - - keyword2rgb: keyword2rgb, - keyword2hsl: keyword2hsl, - keyword2hsv: keyword2hsv, - keyword2hwb: keyword2hwb, - keyword2cmyk: keyword2cmyk, - keyword2lab: keyword2lab, - keyword2xyz: keyword2xyz, - - xyz2rgb: xyz2rgb, - xyz2lab: xyz2lab, - xyz2lch: xyz2lch, - - lab2xyz: lab2xyz, - lab2rgb: lab2rgb, - lab2lch: lab2lch, - - lch2lab: lch2lab, - lch2xyz: lch2xyz, - lch2rgb: lch2rgb -} - - -function rgb2hsl(rgb) { - var r = rgb[0]/255, - g = rgb[1]/255, - b = rgb[2]/255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - delta = max - min, - h, s, l; - - if (max == min) - h = 0; - else if (r == max) - h = (g - b) / delta; - else if (g == max) - h = 2 + (b - r) / delta; - else if (b == max) - h = 4 + (r - g)/ delta; - - h = Math.min(h * 60, 360); - - if (h < 0) - h += 360; - - l = (min + max) / 2; - - if (max == min) - s = 0; - else if (l <= 0.5) - s = delta / (max + min); - else - s = delta / (2 - max - min); - - return [h, s * 100, l * 100]; -} - -function rgb2hsv(rgb) { - var r = rgb[0], - g = rgb[1], - b = rgb[2], - min = Math.min(r, g, b), - max = Math.max(r, g, b), - delta = max - min, - h, s, v; - - if (max == 0) - s = 0; - else - s = (delta/max * 1000)/10; - - if (max == min) - h = 0; - else if (r == max) - h = (g - b) / delta; - else if (g == max) - h = 2 + (b - r) / delta; - else if (b == max) - h = 4 + (r - g) / delta; - - h = Math.min(h * 60, 360); - - if (h < 0) - h += 360; - - v = ((max / 255) * 1000) / 10; - - return [h, s, v]; -} - -function rgb2hwb(rgb) { - var r = rgb[0], - g = rgb[1], - b = rgb[2], - h = rgb2hsl(rgb)[0], - w = 1/255 * Math.min(r, Math.min(g, b)), - b = 1 - 1/255 * Math.max(r, Math.max(g, b)); - - return [h, w * 100, b * 100]; -} - -function rgb2cmyk(rgb) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255, - c, m, y, k; - - k = Math.min(1 - r, 1 - g, 1 - b); - c = (1 - r - k) / (1 - k) || 0; - m = (1 - g - k) / (1 - k) || 0; - y = (1 - b - k) / (1 - k) || 0; - return [c * 100, m * 100, y * 100, k * 100]; -} - -function rgb2keyword(rgb) { - return reverseKeywords[JSON.stringify(rgb)]; -} - -function rgb2xyz(rgb) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255; - - // assume sRGB - r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); - g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); - b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); - - var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); - var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); - var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); - - return [x * 100, y *100, z * 100]; -} - -function rgb2lab(rgb) { - var xyz = rgb2xyz(rgb), - x = xyz[0], - y = xyz[1], - z = xyz[2], - l, a, b; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116); - - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); - - return [l, a, b]; -} - -function rgb2lch(args) { - return lab2lch(rgb2lab(args)); -} - -function hsl2rgb(hsl) { - var h = hsl[0] / 360, - s = hsl[1] / 100, - l = hsl[2] / 100, - t1, t2, t3, rgb, val; - - if (s == 0) { - val = l * 255; - return [val, val, val]; - } - - if (l < 0.5) - t2 = l * (1 + s); - else - t2 = l + s - l * s; - t1 = 2 * l - t2; - - rgb = [0, 0, 0]; - for (var i = 0; i < 3; i++) { - t3 = h + 1 / 3 * - (i - 1); - t3 < 0 && t3++; - t3 > 1 && t3--; - - if (6 * t3 < 1) - val = t1 + (t2 - t1) * 6 * t3; - else if (2 * t3 < 1) - val = t2; - else if (3 * t3 < 2) - val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; - else - val = t1; - - rgb[i] = val * 255; - } - - return rgb; -} - -function hsl2hsv(hsl) { - var h = hsl[0], - s = hsl[1] / 100, - l = hsl[2] / 100, - sv, v; - - if(l === 0) { - // no need to do calc on black - // also avoids divide by 0 error - return [0, 0, 0]; - } - - l *= 2; - s *= (l <= 1) ? l : 2 - l; - v = (l + s) / 2; - sv = (2 * s) / (l + s); - return [h, sv * 100, v * 100]; -} - -function hsl2hwb(args) { - return rgb2hwb(hsl2rgb(args)); -} - -function hsl2cmyk(args) { - return rgb2cmyk(hsl2rgb(args)); -} - -function hsl2keyword(args) { - return rgb2keyword(hsl2rgb(args)); -} - - -function hsv2rgb(hsv) { - var h = hsv[0] / 60, - s = hsv[1] / 100, - v = hsv[2] / 100, - hi = Math.floor(h) % 6; - - var f = h - Math.floor(h), - p = 255 * v * (1 - s), - q = 255 * v * (1 - (s * f)), - t = 255 * v * (1 - (s * (1 - f))), - v = 255 * v; - - switch(hi) { - case 0: - return [v, t, p]; - case 1: - return [q, v, p]; - case 2: - return [p, v, t]; - case 3: - return [p, q, v]; - case 4: - return [t, p, v]; - case 5: - return [v, p, q]; - } -} - -function hsv2hsl(hsv) { - var h = hsv[0], - s = hsv[1] / 100, - v = hsv[2] / 100, - sl, l; - - l = (2 - s) * v; - sl = s * v; - sl /= (l <= 1) ? l : 2 - l; - sl = sl || 0; - l /= 2; - return [h, sl * 100, l * 100]; -} - -function hsv2hwb(args) { - return rgb2hwb(hsv2rgb(args)) -} - -function hsv2cmyk(args) { - return rgb2cmyk(hsv2rgb(args)); -} - -function hsv2keyword(args) { - return rgb2keyword(hsv2rgb(args)); -} - -// http://dev.w3.org/csswg/css-color/#hwb-to-rgb -function hwb2rgb(hwb) { - var h = hwb[0] / 360, - wh = hwb[1] / 100, - bl = hwb[2] / 100, - ratio = wh + bl, - i, v, f, n; - - // wh + bl cant be > 1 - if (ratio > 1) { - wh /= ratio; - bl /= ratio; - } - - i = Math.floor(6 * h); - v = 1 - bl; - f = 6 * h - i; - if ((i & 0x01) != 0) { - f = 1 - f; - } - n = wh + f * (v - wh); // linear interpolation - - switch (i) { - default: - case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; - } - - return [r * 255, g * 255, b * 255]; -} - -function hwb2hsl(args) { - return rgb2hsl(hwb2rgb(args)); -} - -function hwb2hsv(args) { - return rgb2hsv(hwb2rgb(args)); -} - -function hwb2cmyk(args) { - return rgb2cmyk(hwb2rgb(args)); -} - -function hwb2keyword(args) { - return rgb2keyword(hwb2rgb(args)); -} - -function cmyk2rgb(cmyk) { - var c = cmyk[0] / 100, - m = cmyk[1] / 100, - y = cmyk[2] / 100, - k = cmyk[3] / 100, - r, g, b; - - r = 1 - Math.min(1, c * (1 - k) + k); - g = 1 - Math.min(1, m * (1 - k) + k); - b = 1 - Math.min(1, y * (1 - k) + k); - return [r * 255, g * 255, b * 255]; -} - -function cmyk2hsl(args) { - return rgb2hsl(cmyk2rgb(args)); -} - -function cmyk2hsv(args) { - return rgb2hsv(cmyk2rgb(args)); -} - -function cmyk2hwb(args) { - return rgb2hwb(cmyk2rgb(args)); -} - -function cmyk2keyword(args) { - return rgb2keyword(cmyk2rgb(args)); -} - - -function xyz2rgb(xyz) { - var x = xyz[0] / 100, - y = xyz[1] / 100, - z = xyz[2] / 100, - r, g, b; - - r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); - g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); - b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); - - // assume sRGB - r = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) - : r = (r * 12.92); - - g = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) - : g = (g * 12.92); - - b = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) - : b = (b * 12.92); - - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); - - return [r * 255, g * 255, b * 255]; -} - -function xyz2lab(xyz) { - var x = xyz[0], - y = xyz[1], - z = xyz[2], - l, a, b; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116); - - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); - - return [l, a, b]; -} - -function xyz2lch(args) { - return lab2lch(xyz2lab(args)); -} - -function lab2xyz(lab) { - var l = lab[0], - a = lab[1], - b = lab[2], - x, y, z, y2; - - if (l <= 8) { - y = (l * 100) / 903.3; - y2 = (7.787 * (y / 100)) + (16 / 116); - } else { - y = 100 * Math.pow((l + 16) / 116, 3); - y2 = Math.pow(y / 100, 1/3); - } - - x = x / 95.047 <= 0.008856 ? x = (95.047 * ((a / 500) + y2 - (16 / 116))) / 7.787 : 95.047 * Math.pow((a / 500) + y2, 3); - - z = z / 108.883 <= 0.008859 ? z = (108.883 * (y2 - (b / 200) - (16 / 116))) / 7.787 : 108.883 * Math.pow(y2 - (b / 200), 3); - - return [x, y, z]; -} - -function lab2lch(lab) { - var l = lab[0], - a = lab[1], - b = lab[2], - hr, h, c; - - hr = Math.atan2(b, a); - h = hr * 360 / 2 / Math.PI; - if (h < 0) { - h += 360; - } - c = Math.sqrt(a * a + b * b); - return [l, c, h]; -} - -function lab2rgb(args) { - return xyz2rgb(lab2xyz(args)); -} - -function lch2lab(lch) { - var l = lch[0], - c = lch[1], - h = lch[2], - a, b, hr; - - hr = h / 360 * 2 * Math.PI; - a = c * Math.cos(hr); - b = c * Math.sin(hr); - return [l, a, b]; -} - -function lch2xyz(args) { - return lab2xyz(lch2lab(args)); -} - -function lch2rgb(args) { - return lab2rgb(lch2lab(args)); -} - -function keyword2rgb(keyword) { - return cssKeywords[keyword]; -} - -function keyword2hsl(args) { - return rgb2hsl(keyword2rgb(args)); -} - -function keyword2hsv(args) { - return rgb2hsv(keyword2rgb(args)); -} - -function keyword2hwb(args) { - return rgb2hwb(keyword2rgb(args)); -} - -function keyword2cmyk(args) { - return rgb2cmyk(keyword2rgb(args)); -} - -function keyword2lab(args) { - return rgb2lab(keyword2rgb(args)); -} - -function keyword2xyz(args) { - return rgb2xyz(keyword2rgb(args)); -} - -var cssKeywords = { - aliceblue: [240,248,255], - antiquewhite: [250,235,215], - aqua: [0,255,255], - aquamarine: [127,255,212], - azure: [240,255,255], - beige: [245,245,220], - bisque: [255,228,196], - black: [0,0,0], - blanchedalmond: [255,235,205], - blue: [0,0,255], - blueviolet: [138,43,226], - brown: [165,42,42], - burlywood: [222,184,135], - cadetblue: [95,158,160], - chartreuse: [127,255,0], - chocolate: [210,105,30], - coral: [255,127,80], - cornflowerblue: [100,149,237], - cornsilk: [255,248,220], - crimson: [220,20,60], - cyan: [0,255,255], - darkblue: [0,0,139], - darkcyan: [0,139,139], - darkgoldenrod: [184,134,11], - darkgray: [169,169,169], - darkgreen: [0,100,0], - darkgrey: [169,169,169], - darkkhaki: [189,183,107], - darkmagenta: [139,0,139], - darkolivegreen: [85,107,47], - darkorange: [255,140,0], - darkorchid: [153,50,204], - darkred: [139,0,0], - darksalmon: [233,150,122], - darkseagreen: [143,188,143], - darkslateblue: [72,61,139], - darkslategray: [47,79,79], - darkslategrey: [47,79,79], - darkturquoise: [0,206,209], - darkviolet: [148,0,211], - deeppink: [255,20,147], - deepskyblue: [0,191,255], - dimgray: [105,105,105], - dimgrey: [105,105,105], - dodgerblue: [30,144,255], - firebrick: [178,34,34], - floralwhite: [255,250,240], - forestgreen: [34,139,34], - fuchsia: [255,0,255], - gainsboro: [220,220,220], - ghostwhite: [248,248,255], - gold: [255,215,0], - goldenrod: [218,165,32], - gray: [128,128,128], - green: [0,128,0], - greenyellow: [173,255,47], - grey: [128,128,128], - honeydew: [240,255,240], - hotpink: [255,105,180], - indianred: [205,92,92], - indigo: [75,0,130], - ivory: [255,255,240], - khaki: [240,230,140], - lavender: [230,230,250], - lavenderblush: [255,240,245], - lawngreen: [124,252,0], - lemonchiffon: [255,250,205], - lightblue: [173,216,230], - lightcoral: [240,128,128], - lightcyan: [224,255,255], - lightgoldenrodyellow: [250,250,210], - lightgray: [211,211,211], - lightgreen: [144,238,144], - lightgrey: [211,211,211], - lightpink: [255,182,193], - lightsalmon: [255,160,122], - lightseagreen: [32,178,170], - lightskyblue: [135,206,250], - lightslategray: [119,136,153], - lightslategrey: [119,136,153], - lightsteelblue: [176,196,222], - lightyellow: [255,255,224], - lime: [0,255,0], - limegreen: [50,205,50], - linen: [250,240,230], - magenta: [255,0,255], - maroon: [128,0,0], - mediumaquamarine: [102,205,170], - mediumblue: [0,0,205], - mediumorchid: [186,85,211], - mediumpurple: [147,112,219], - mediumseagreen: [60,179,113], - mediumslateblue: [123,104,238], - mediumspringgreen: [0,250,154], - mediumturquoise: [72,209,204], - mediumvioletred: [199,21,133], - midnightblue: [25,25,112], - mintcream: [245,255,250], - mistyrose: [255,228,225], - moccasin: [255,228,181], - navajowhite: [255,222,173], - navy: [0,0,128], - oldlace: [253,245,230], - olive: [128,128,0], - olivedrab: [107,142,35], - orange: [255,165,0], - orangered: [255,69,0], - orchid: [218,112,214], - palegoldenrod: [238,232,170], - palegreen: [152,251,152], - paleturquoise: [175,238,238], - palevioletred: [219,112,147], - papayawhip: [255,239,213], - peachpuff: [255,218,185], - peru: [205,133,63], - pink: [255,192,203], - plum: [221,160,221], - powderblue: [176,224,230], - purple: [128,0,128], - rebeccapurple: [102, 51, 153], - red: [255,0,0], - rosybrown: [188,143,143], - royalblue: [65,105,225], - saddlebrown: [139,69,19], - salmon: [250,128,114], - sandybrown: [244,164,96], - seagreen: [46,139,87], - seashell: [255,245,238], - sienna: [160,82,45], - silver: [192,192,192], - skyblue: [135,206,235], - slateblue: [106,90,205], - slategray: [112,128,144], - slategrey: [112,128,144], - snow: [255,250,250], - springgreen: [0,255,127], - steelblue: [70,130,180], - tan: [210,180,140], - teal: [0,128,128], - thistle: [216,191,216], - tomato: [255,99,71], - turquoise: [64,224,208], - violet: [238,130,238], - wheat: [245,222,179], - white: [255,255,255], - whitesmoke: [245,245,245], - yellow: [255,255,0], - yellowgreen: [154,205,50] -}; - -var reverseKeywords = {}; -for (var key in cssKeywords) { - reverseKeywords[JSON.stringify(cssKeywords[key])] = key; -} - - -/***/ }) -/******/ ]); -}); - - -/***/ }) -/******/ ]); -//# sourceMappingURL=example.js.map \ No newline at end of file diff --git a/example/build/example.js.map b/example/build/example.js.map deleted file mode 100644 index 8d93fc6..0000000 --- a/example/build/example.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap c92d6cd72610a99b6a57","webpack:///./example/src/example.ts","webpack:///webpack:///webpack/universalModuleDefinition","webpack:///webpack:///webpack/bootstrap ba9999905dc0e382e67c","webpack:///webpack:///src/util.ts","webpack:///webpack:///src/index.ts","webpack:///webpack:///src/Manager.ts","webpack:///webpack:///src/StrokeManager.ts","webpack:///webpack:///src/tools/PenTool.ts","webpack:///webpack:///src/tools/EraserTool.ts","webpack:///webpack:///src/tools/HighlighterTool.ts","webpack:///webpack:///node_modules/parse-color/index.js","webpack:///webpack:///node_modules/color-convert/index.js","webpack:///webpack:///node_modules/color-convert/conversions.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;AC7DA,qCAKmB;AAEnB,MAAM,CAAC,MAAM,GAAG;IACd,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,QAA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CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAE3D,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC/B,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;YAChC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;CACF;AA1CD,0CA0CC;;;;;;;AC/CD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,SAAS,8BAA8B;AACvC,SAAS,oCAAoC;;AAE7C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;;;;;;AClFA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA,uD;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB;;AAEnB,qBAAqB,gBAAgB;AACrC;AACA;AACA;AACA,GAAG;AACH;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED,yB;;;;;;AC3FA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;;AAExB;AACA;AACA;AACA,kBAAkB,OAAO,QAAQ;AACjC,kBAAkB,OAAO,QAAQ;AACjC,mBAAmB,OAAO,OAAO;AACjC,mBAAmB,OAAO,OAAO;AACjC,kBAAkB,QAAQ,OAAO;AACjC,kBAAkB,QAAQ,OAAO;AACjC;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA","file":"example.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap c92d6cd72610a99b6a57","import {\n Manager,\n PenTool,\n EraserTool,\n HighlighterTool\n} from \"../../lib\";\n\nwindow.onload = function () {\n const canvas = document.getElementById(\"canvas\");\n const redPenElem = document.getElementById(\"red-pen\");\n const bluePenElem = document.getElementById(\"blue-pen\");\n const eraserElem = document.getElementById(\"eraser\");\n const highlighterElem = document.getElementById(\"highlighter\");\n const clearElem = document.getElementById(\"clear\");\n \n const width = 400;\n const height = 400;\n \n const manager = new Manager(canvas, width, height);\n \n const redPen = new PenTool(\"red\", 3);\n const bluePen = new PenTool(\"blue\", 8);\n const eraser = new EraserTool(20);\n const highlighterTool = new HighlighterTool(\"yellow\", 30);\n \n manager.setTool(redPen);\n \n redPenElem.onclick = function() {\n manager.setTool(redPen);\n };\n \n bluePenElem.onclick = function() {\n manager.setTool(bluePen);\n };\n \n eraserElem.onclick = function() {\n manager.setTool(eraser);\n };\n \n highlighterElem.onclick = function() {\n manager.setTool(highlighterTool);\n };\n \n clearElem.onclick = function() {\n manager.clear();\n };\n};\n\n\n// WEBPACK FOOTER //\n// ./example/src/example.ts","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Paintbricks\"] = factory();\n\telse\n\t\troot[\"Paintbricks\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition\n\n\n// WEBPACK FOOTER //\n// webpack:///webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ba9999905dc0e382e67c\n\n\n// WEBPACK FOOTER //\n// webpack:///webpack/bootstrap ba9999905dc0e382e67c","import { IPoint } from \"./types\";\n\n/**\n * Get the distance between two points\n * @param p1\n * @param p2\n * @returns number\n */\nexport function getEuclidean(p1: IPoint, p2: IPoint): number {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n}\n\n/**\n * Gets the unit vector representing the vector from start\n * point to end point with a length of 1.\n * @param startPoint\n * @param endPoint\n * @returns IPoint\n */\nexport function getUnitVector(startPoint: IPoint, endPoint: IPoint): IPoint {\n const length = this.getEuclidean(startPoint, endPoint);\n\n const dirVect = {\n x: endPoint.x - startPoint.x,\n y: endPoint.y - startPoint.y\n };\n\n const unitVect: IPoint = {\n x: dirVect.x / length,\n y: dirVect.y / length\n };\n\n return unitVect;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/util.ts\n\n\n// WEBPACK FOOTER //\n// webpack:///src/util.ts","export { Manager } from \"./Manager\";\nexport { PenTool } from \"./tools/PenTool\";\nexport { EraserTool } from \"./tools/EraserTool\";\nexport { HighlighterTool } from \"./tools/HighlighterTool\";\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts\n\n\n// WEBPACK FOOTER //\n// webpack:///src/index.ts","import { IPoint, IStrokePart, ITool } from \"./types\";\nimport { StrokeManager } from \"./StrokeManager\";\n\nexport class Manager {\n // reference to the canvas\n private canvas: HTMLCanvasElement;\n // reference to stroke manager\n private strokeManager: StrokeManager;\n // holds the pixel ratio between canvas backing\n // store and device ratio (used for hi fi displays)\n private pixelRatio: number;\n // the width of the canvas\n private canvasWidth: number;\n // the height of the canvas\n private canvasHeight: number;\n // holds a reference to next animation frame\n private nextAnimationFrame: number;\n // the currently selected tool\n private currentTool: ITool | null;\n // holds stroke parts for ongoing stroke\n private currentStroke: IStrokePart[];\n // the state of the canvas (not including ongoing stroke)\n private canvasState: ImageData | null;\n // indicates whether changes have occured that require redraw\n private shouldDraw: boolean;\n // indicates whether canvas should commit its next draw state to current state\n private shouldCommit: boolean;\n\n constructor(\n canvas: HTMLCanvasElement,\n canvasWidth: number,\n canvasHeight: number\n ) {\n this.canvas = canvas;\n this.canvasWidth = canvasWidth;\n this.canvasHeight = canvasHeight;\n this.currentTool = null;\n this.currentStroke = [];\n this.strokeManager = new StrokeManager(canvas);\n this.canvasState = null;\n this.shouldDraw = false;\n this.shouldCommit = false;\n\n // find pixel ratio relative to backing store and device ratio\n const bsr = (canvas.getContext(\"2d\") as any).backingStorePixelRatio || 1;\n const dpr = window.devicePixelRatio || 1;\n this.pixelRatio = dpr / bsr;\n\n this.setCanvasSize = this.setCanvasSize.bind(this);\n this.setTool = this.setTool.bind(this);\n this.destroy = this.destroy.bind(this);\n this.clear = this.clear.bind(this);\n this.draw = this.draw.bind(this);\n this.onStrokePart = this.onStrokePart.bind(this);\n\n // schedule animation frame loop\n this.nextAnimationFrame = window.requestAnimationFrame(this.draw);\n // set up listener for new stroke part\n this.strokeManager.onStrokePart(this.onStrokePart);\n\n this.setCanvasSize(canvasWidth, canvasHeight);\n }\n\n /**\n * Sets the canvas desired width and height and sets transform\n * for hifi displays\n * @param width\n * @param height\n */\n public setCanvasSize(width: number, height: number): void {\n this.canvasWidth = width;\n this.canvasHeight = height;\n\n const { canvas, canvasWidth, canvasHeight, pixelRatio } = this;\n\n const ctx = canvas.getContext(\"2d\");\n\n // appropriately scale canvas to map to device ratio\n canvas.width = canvasWidth * pixelRatio;\n canvas.height = canvasHeight * pixelRatio;\n canvas.style.width = canvasWidth + \"px\";\n canvas.style.height = canvasHeight + \"px\";\n ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n }\n\n /**\n * Sets the current tool for the manager\n * @param tool\n */\n public setTool(tool: ITool): void {\n this.currentTool = tool;\n }\n\n /**\n * Remove all event listeners\n */\n public destroy(): void {\n // cancel animation loop\n window.cancelAnimationFrame(this.nextAnimationFrame);\n // remove all listeners on stroke manager\n this.strokeManager.destroy();\n }\n\n /**\n * Clears the canvas\n */\n public clear(): void {\n this.canvasState = null;\n this.currentStroke = [];\n this.shouldDraw = true;\n this.shouldCommit = true;\n }\n\n /**\n * Adds a new stroke part to the nextStrokes\n * array\n * @param strokePart\n */\n private onStrokePart(strokePart: IStrokePart): void {\n this.currentStroke.push(strokePart);\n\n this.shouldDraw = true;\n\n if (strokePart.isEnd) {\n this.shouldCommit = true;\n }\n }\n\n /**\n * Draws a frame\n */\n private draw(): void {\n // schedule next draw\n this.nextAnimationFrame = window.requestAnimationFrame(this.draw);\n\n const ctx = this.canvas.getContext(\"2d\");\n\n if (!this.shouldDraw) {\n return;\n }\n\n // clear canvas\n ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);\n\n // draw current state\n if (this.canvasState) {\n ctx.putImageData(this.canvasState, 0, 0);\n }\n\n // if a tool has been selected and there are\n // pending strokes, draw them\n if (this.currentTool && this.currentStroke.length) {\n ctx.save();\n this.currentTool.draw(ctx, this.currentStroke);\n ctx.restore();\n }\n\n // if all changes have been made for current stroke,\n // save it as the new canvas state\n if (this.shouldCommit) {\n this.canvasState = ctx.getImageData(\n 0,\n 0,\n this.canvasWidth * this.pixelRatio,\n this.canvasHeight * this.pixelRatio\n );\n this.currentStroke = [];\n this.shouldCommit = false;\n }\n\n this.shouldDraw = false;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Manager.ts\n\n\n// WEBPACK FOOTER //\n// webpack:///src/Manager.ts","import { IPoint, IStrokePart } from \"./types\";\nimport { getEuclidean } from \"./util\";\n\nexport interface IOnStrokePartHandler {\n (strokePart: IStrokePart): void;\n}\n\nexport interface ITouch {\n id: number;\n position: IPoint;\n}\n\nexport class StrokeManager {\n // reference to canvas element\n private canvas: HTMLCanvasElement;\n // holds last touch point in a drag\n private lastTouch: ITouch | null;\n // value indicates how sensitive the stroke detection is higher is better\n private sensitivity: number;\n // holds all of the last emitted stroke parts in a drag\n private lastStrokeParts: IStrokePart[];\n // the handlers listening for new strokes\n private onStrokePartHandlers: IOnStrokePartHandler[];\n\n constructor(canvas: HTMLCanvasElement) {\n this.canvas = canvas;\n this.lastTouch = null;\n this.sensitivity = 20.0;\n this.lastStrokeParts = [];\n this.onStrokePartHandlers = [];\n\n this.onTouchStart = this.onTouchStart.bind(this);\n this.onTouchEnd = this.onTouchEnd.bind(this);\n this.onTouchCancel = this.onTouchCancel.bind(this);\n this.onTouchMove = this.onTouchMove.bind(this);\n this.destroy = this.destroy.bind(this);\n this.getRelativePosition = this.getRelativePosition.bind(this);\n\n this.canvas.addEventListener(\"touchstart\", this.onTouchStart, {\n passive: false\n });\n this.canvas.addEventListener(\"touchend\", this.onTouchEnd, {\n passive: false\n });\n this.canvas.addEventListener(\"touchcancel\", this.onTouchCancel, {\n passive: false\n });\n this.canvas.addEventListener(\"touchmove\", this.onTouchMove, {\n passive: false\n });\n }\n\n /**\n * Registers a handler to be fired on a new stroke part\n * @param handler\n */\n public onStrokePart(handler: IOnStrokePartHandler): void {\n this.onStrokePartHandlers.push(handler);\n }\n\n /**\n * Removes all active listeners\n */\n public destroy(): void {\n this.onStrokePartHandlers = [];\n this.lastStrokeParts = [];\n this.canvas.removeEventListener(\"touchstart\", this.onTouchStart);\n this.canvas.removeEventListener(\"touchend\", this.onTouchEnd);\n this.canvas.removeEventListener(\"touchcancel\", this.onTouchCancel);\n this.canvas.removeEventListener(\"touchmove\", this.onTouchMove);\n }\n\n /**\n * Get relative position to canvas\n * @param clientX\n * @param clientY\n * @returns IPoint\n */\n private getRelativePosition(clientX: number, clientY: number): IPoint {\n const rect = this.canvas.getBoundingClientRect();\n\n return {\n x: clientX - rect.left,\n y: clientY - rect.top\n };\n }\n\n /**\n * Creates a new touch if one does not\n * already exist\n * @param e\n */\n private onTouchStart(e: TouchEvent): void {\n e.preventDefault();\n\n // if there is an ongoing touch, ignore this event\n if (this.lastTouch) {\n return;\n }\n\n const touches: TouchList = e.changedTouches;\n\n // only get the first touch\n const touch = touches.item(0);\n\n // save the touch\n this.lastTouch = {\n id: touch.identifier,\n position: this.getRelativePosition(touch.clientX, touch.clientY)\n };\n }\n\n /**\n * Creates a line from last touch to current touch\n * point and emits event. Does no-op if no existing touch\n * @param e\n */\n private onTouchMove(e: TouchEvent): void {\n e.preventDefault();\n\n // if no last touch... something is wrong\n if (!this.lastTouch) {\n return;\n }\n\n const touches: TouchList = e.changedTouches;\n\n // find the current touch we are tracking\n const touch: Touch = Array.from(touches).find(touch => {\n return touch.identifier === this.lastTouch.id;\n });\n\n // if the touch was not one we were tracking,\n // ignore and no-op\n if (!touch) {\n return;\n }\n\n const nextTouch: ITouch = {\n id: touch.identifier,\n position: this.getRelativePosition(touch.clientX, touch.clientY)\n };\n\n // If sensitivity setting has been set,\n // check if this point is far enough from last\n // touch to be drawn\n if (\n this.sensitivity &&\n getEuclidean(nextTouch.position, this.lastTouch.position) <\n 10.0 / this.sensitivity\n ) {\n return;\n }\n\n const strokePart: IStrokePart = {\n endPoint: nextTouch.position,\n startPoint: this.lastTouch.position,\n isStart: this.lastStrokeParts.length === 0,\n isEnd: false\n };\n\n this.onStrokePartHandlers.forEach(handler => {\n handler(strokePart);\n });\n\n // save this touch as last touch\n this.lastTouch = nextTouch;\n this.lastStrokeParts.push(strokePart);\n }\n\n /**\n * Draws a line from last point to final point. Removes\n * the reference to last touch point.\n * @param e\n */\n private onTouchEnd(e: TouchEvent): void {\n e.preventDefault();\n\n // if no last touch... something is wrong\n if (!this.lastTouch) {\n return;\n }\n\n const touches: TouchList = e.changedTouches;\n\n // find the current touch we are tracking\n const touch: Touch = Array.from(touches).find(touch => {\n return touch.identifier === this.lastTouch.id;\n });\n\n // if the touch was not one we were tracking,\n // ignore and no-op\n if (!touch) {\n return;\n }\n\n const endPoint = this.getRelativePosition(touch.clientX, touch.clientY);\n\n const strokePart: IStrokePart = {\n startPoint: this.lastTouch.position,\n endPoint,\n isStart: false,\n isEnd: true\n };\n\n this.onStrokePartHandlers.forEach(handler => {\n handler(strokePart);\n });\n\n this.lastTouch = null;\n this.lastStrokeParts = [];\n }\n\n /**\n * Removes the current last touch point\n * @param e\n */\n private onTouchCancel(e: TouchEvent): void {\n e.preventDefault();\n this.lastTouch = null;\n this.lastStrokeParts = [];\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/StrokeManager.ts\n\n\n// WEBPACK FOOTER //\n// webpack:///src/StrokeManager.ts","import { IStrokePart } from \"../types\";\n\nexport class PenTool {\n readonly color: string;\n readonly width: number;\n\n constructor(color: string = \"red\", width: number = 3) {\n this.color = color;\n this.width = width;\n }\n\n /**\n * Draws a \"pen stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\n const firstPart = strokeParts[0];\n\n ctx.beginPath();\n\n ctx.lineWidth = this.width;\n ctx.strokeStyle = this.color;\n ctx.lineCap = \"round\";\n ctx.lineJoin = \"round\";\n\n ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y);\n\n strokeParts.forEach(strokePart => {\n const { endPoint } = strokePart;\n ctx.lineTo(endPoint.x, endPoint.y);\n });\n\n ctx.stroke();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/tools/PenTool.ts\n\n\n// WEBPACK FOOTER //\n// webpack:///src/tools/PenTool.ts","import { IStrokePart, IPoint } from \"../types\";\nimport { getUnitVector, getEuclidean } from \"../util\";\n\nexport interface IHandleOptions {\n hide: boolean;\n strokeWidth: number;\n fillColor: string;\n strokeColor: string;\n}\n\nexport class EraserTool {\n readonly width: number;\n readonly handleOpts: IHandleOptions;\n private lastEndPoint: IPoint | null;\n\n constructor(width: number = 10, handleOpts?: Partial) {\n this.width = width;\n this.lastEndPoint = null;\n\n handleOpts = handleOpts || {};\n\n this.handleOpts = {\n hide: handleOpts.hide || false,\n strokeWidth: handleOpts.strokeWidth || 2,\n fillColor: handleOpts.fillColor || \"white\",\n strokeColor: handleOpts.strokeColor || \"black\"\n };\n }\n\n /**\n * Draws an \"eraser stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\n const { handleOpts } = this;\n const halfWidth = this.width / 2.0;\n\n strokeParts.forEach(strokePart => {\n const { startPoint, endPoint, isEnd } = strokePart;\n\n const length = getEuclidean(startPoint, endPoint);\n const unitVect: IPoint = getUnitVector(startPoint, endPoint);\n let currentPoint: IPoint = startPoint;\n let i = 0;\n\n // clear all the way along the drag\n while (i < length) {\n const nextPoint: IPoint = {\n x: currentPoint.x + unitVect.x,\n y: currentPoint.y + unitVect.y\n };\n\n ctx.clearRect(\n nextPoint.x - halfWidth,\n nextPoint.y - halfWidth,\n this.width,\n this.width\n );\n\n i++;\n currentPoint = nextPoint;\n }\n });\n\n const lastPart = strokeParts[strokeParts.length - 1];\n\n // if the end is not the last part, then draw\n // the tool indicator at the endpoint\n if (!lastPart.isEnd && !handleOpts.hide) {\n ctx.strokeStyle = handleOpts.strokeColor;\n ctx.fillStyle = handleOpts.fillColor;\n\n ctx.fillRect(\n lastPart.endPoint.x - halfWidth,\n lastPart.endPoint.y - halfWidth,\n this.width,\n this.width\n );\n\n ctx.strokeRect(\n lastPart.endPoint.x - halfWidth + 0.5,\n lastPart.endPoint.y - halfWidth + 0.5,\n this.width - 1,\n this.width - 1\n );\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/tools/EraserTool.ts\n\n\n// WEBPACK FOOTER //\n// webpack:///src/tools/EraserTool.ts","import * as parseColor from \"parse-color\";\n\nimport { IStrokePart, IPoint } from \"../types\";\nimport { getUnitVector, getEuclidean } from \"../util\";\n\nexport class HighlighterTool {\n readonly color: string;\n readonly width: number;\n private lastStrokePart: IStrokePart | null;\n\n constructor(\n color: string = \"yellow\",\n width: number = 8,\n opacity: Number = 0.3\n ) {\n this.width = width;\n this.lastStrokePart = null;\n\n // calculate rgba color w/ opacity\n const { rgb } = parseColor(color);\n this.color = `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${opacity})`;\n }\n\n /**\n * Draws a \"highlighter stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\n const firstPart = strokeParts[0];\n\n ctx.beginPath();\n\n ctx.lineWidth = this.width;\n ctx.strokeStyle = this.color;\n ctx.lineCap = \"butt\";\n ctx.miterLimit = 1;\n\n ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y);\n\n strokeParts.forEach(strokePart => {\n const { endPoint } = strokePart;\n ctx.lineTo(endPoint.x, endPoint.y);\n });\n\n ctx.stroke();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/tools/HighlighterTool.ts\n\n\n// WEBPACK FOOTER //\n// webpack:///src/tools/HighlighterTool.ts","var convert = require('color-convert');\n\nmodule.exports = function (cstr) {\n var m, conv, parts, alpha;\n if (m = /^((?:rgb|hs[lv]|cmyk|xyz|lab)a?)\\s*\\(([^\\)]*)\\)/.exec(cstr)) {\n var name = m[1];\n var base = name.replace(/a$/, '');\n var size = base === 'cmyk' ? 4 : 3;\n conv = convert[base];\n \n parts = m[2].replace(/^\\s+|\\s+$/g, '')\n .split(/\\s*,\\s*/)\n .map(function (x, i) {\n if (/%$/.test(x) && i === size) {\n return parseFloat(x) / 100;\n }\n else if (/%$/.test(x)) {\n return parseFloat(x);\n }\n return parseFloat(x);\n })\n ;\n if (name === base) parts.push(1);\n alpha = parts[size] === undefined ? 1 : parts[size];\n parts = parts.slice(0, size);\n \n conv[base] = function () { return parts };\n }\n else if (/^#[A-Fa-f0-9]+$/.test(cstr)) {\n var base = cstr.replace(/^#/,'');\n var size = base.length;\n conv = convert.rgb;\n parts = base.split(size === 3 ? /(.)/ : /(..)/);\n parts = parts.filter(Boolean)\n .map(function (x) {\n if (size === 3) {\n return parseInt(x + x, 16);\n }\n else {\n return parseInt(x, 16)\n }\n })\n ;\n alpha = 1;\n conv.rgb = function () { return parts };\n if (!parts[0]) parts[0] = 0;\n if (!parts[1]) parts[1] = 0;\n if (!parts[2]) parts[2] = 0;\n }\n else {\n conv = convert.keyword;\n conv.keyword = function () { return cstr };\n parts = cstr;\n alpha = 1;\n }\n \n var res = {\n rgb: undefined,\n hsl: undefined,\n hsv: undefined,\n cmyk: undefined,\n keyword: undefined,\n hex: undefined\n };\n try { res.rgb = conv.rgb(parts) } catch (e) {}\n try { res.hsl = conv.hsl(parts) } catch (e) {}\n try { res.hsv = conv.hsv(parts) } catch (e) {}\n try { res.cmyk = conv.cmyk(parts) } catch (e) {}\n try { res.keyword = conv.keyword(parts) } catch (e) {}\n \n if (res.rgb) res.hex = '#' + res.rgb.map(function (x) {\n var s = x.toString(16);\n if (s.length === 1) return '0' + s;\n return s;\n }).join('');\n \n if (res.rgb) res.rgba = res.rgb.concat(alpha);\n if (res.hsl) res.hsla = res.hsl.concat(alpha);\n if (res.hsv) res.hsva = res.hsv.concat(alpha);\n if (res.cmyk) res.cmyka = res.cmyk.concat(alpha);\n \n return res;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/parse-color/index.js\n// module id = 7\n// module chunks = 0\n\n\n// WEBPACK FOOTER //\n// webpack:///node_modules/parse-color/index.js","var conversions = require(\"./conversions\");\n\nvar convert = function() {\n return new Converter();\n}\n\nfor (var func in conversions) {\n // export Raw versions\n convert[func + \"Raw\"] = (function(func) {\n // accept array or plain args\n return function(arg) {\n if (typeof arg == \"number\")\n arg = Array.prototype.slice.call(arguments);\n return conversions[func](arg);\n }\n })(func);\n\n var pair = /(\\w+)2(\\w+)/.exec(func),\n from = pair[1],\n to = pair[2];\n\n // export rgb2hsl and [\"rgb\"][\"hsl\"]\n convert[from] = convert[from] || {};\n\n convert[from][to] = convert[func] = (function(func) { \n return function(arg) {\n if (typeof arg == \"number\")\n arg = Array.prototype.slice.call(arguments);\n \n var val = conversions[func](arg);\n if (typeof val == \"string\" || val === undefined)\n return val; // keyword\n\n for (var i = 0; i < val.length; i++)\n val[i] = Math.round(val[i]);\n return val;\n }\n })(func);\n}\n\n\n/* Converter does lazy conversion and caching */\nvar Converter = function() {\n this.convs = {};\n};\n\n/* Either get the values for a space or\n set the values for a space, depending on args */\nConverter.prototype.routeSpace = function(space, args) {\n var values = args[0];\n if (values === undefined) {\n // color.rgb()\n return this.getValues(space);\n }\n // color.rgb(10, 10, 10)\n if (typeof values == \"number\") {\n values = Array.prototype.slice.call(args); \n }\n\n return this.setValues(space, values);\n};\n \n/* Set the values for a space, invalidating cache */\nConverter.prototype.setValues = function(space, values) {\n this.space = space;\n this.convs = {};\n this.convs[space] = values;\n return this;\n};\n\n/* Get the values for a space. If there's already\n a conversion for the space, fetch it, otherwise\n compute it */\nConverter.prototype.getValues = function(space) {\n var vals = this.convs[space];\n if (!vals) {\n var fspace = this.space,\n from = this.convs[fspace];\n vals = convert[fspace][space](from);\n\n this.convs[space] = vals;\n }\n return vals;\n};\n\n[\"rgb\", \"hsl\", \"hsv\", \"cmyk\", \"keyword\"].forEach(function(space) {\n Converter.prototype[space] = function(vals) {\n return this.routeSpace(space, arguments);\n }\n});\n\nmodule.exports = convert;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/color-convert/index.js\n// module id = 8\n// module chunks = 0\n\n\n// WEBPACK FOOTER //\n// webpack:///node_modules/color-convert/index.js","/* MIT license */\n\nmodule.exports = {\n rgb2hsl: rgb2hsl,\n rgb2hsv: rgb2hsv,\n rgb2hwb: rgb2hwb,\n rgb2cmyk: rgb2cmyk,\n rgb2keyword: rgb2keyword,\n rgb2xyz: rgb2xyz,\n rgb2lab: rgb2lab,\n rgb2lch: rgb2lch,\n\n hsl2rgb: hsl2rgb,\n hsl2hsv: hsl2hsv,\n hsl2hwb: hsl2hwb,\n hsl2cmyk: hsl2cmyk,\n hsl2keyword: hsl2keyword,\n\n hsv2rgb: hsv2rgb,\n hsv2hsl: hsv2hsl,\n hsv2hwb: hsv2hwb,\n hsv2cmyk: hsv2cmyk,\n hsv2keyword: hsv2keyword,\n\n hwb2rgb: hwb2rgb,\n hwb2hsl: hwb2hsl,\n hwb2hsv: hwb2hsv,\n hwb2cmyk: hwb2cmyk,\n hwb2keyword: hwb2keyword,\n\n cmyk2rgb: cmyk2rgb,\n cmyk2hsl: cmyk2hsl,\n cmyk2hsv: cmyk2hsv,\n cmyk2hwb: cmyk2hwb,\n cmyk2keyword: cmyk2keyword,\n\n keyword2rgb: keyword2rgb,\n keyword2hsl: keyword2hsl,\n keyword2hsv: keyword2hsv,\n keyword2hwb: keyword2hwb,\n keyword2cmyk: keyword2cmyk,\n keyword2lab: keyword2lab,\n keyword2xyz: keyword2xyz,\n\n xyz2rgb: xyz2rgb,\n xyz2lab: xyz2lab,\n xyz2lch: xyz2lch,\n\n lab2xyz: lab2xyz,\n lab2rgb: lab2rgb,\n lab2lch: lab2lch,\n\n lch2lab: lch2lab,\n lch2xyz: lch2xyz,\n lch2rgb: lch2rgb\n}\n\n\nfunction rgb2hsl(rgb) {\n var r = rgb[0]/255,\n g = rgb[1]/255,\n b = rgb[2]/255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n delta = max - min,\n h, s, l;\n\n if (max == min)\n h = 0;\n else if (r == max)\n h = (g - b) / delta;\n else if (g == max)\n h = 2 + (b - r) / delta;\n else if (b == max)\n h = 4 + (r - g)/ delta;\n\n h = Math.min(h * 60, 360);\n\n if (h < 0)\n h += 360;\n\n l = (min + max) / 2;\n\n if (max == min)\n s = 0;\n else if (l <= 0.5)\n s = delta / (max + min);\n else\n s = delta / (2 - max - min);\n\n return [h, s * 100, l * 100];\n}\n\nfunction rgb2hsv(rgb) {\n var r = rgb[0],\n g = rgb[1],\n b = rgb[2],\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n delta = max - min,\n h, s, v;\n\n if (max == 0)\n s = 0;\n else\n s = (delta/max * 1000)/10;\n\n if (max == min)\n h = 0;\n else if (r == max)\n h = (g - b) / delta;\n else if (g == max)\n h = 2 + (b - r) / delta;\n else if (b == max)\n h = 4 + (r - g) / delta;\n\n h = Math.min(h * 60, 360);\n\n if (h < 0)\n h += 360;\n\n v = ((max / 255) * 1000) / 10;\n\n return [h, s, v];\n}\n\nfunction rgb2hwb(rgb) {\n var r = rgb[0],\n g = rgb[1],\n b = rgb[2],\n h = rgb2hsl(rgb)[0],\n w = 1/255 * Math.min(r, Math.min(g, b)),\n b = 1 - 1/255 * Math.max(r, Math.max(g, b));\n\n return [h, w * 100, b * 100];\n}\n\nfunction rgb2cmyk(rgb) {\n var r = rgb[0] / 255,\n g = rgb[1] / 255,\n b = rgb[2] / 255,\n c, m, y, k;\n\n k = Math.min(1 - r, 1 - g, 1 - b);\n c = (1 - r - k) / (1 - k) || 0;\n m = (1 - g - k) / (1 - k) || 0;\n y = (1 - b - k) / (1 - k) || 0;\n return [c * 100, m * 100, y * 100, k * 100];\n}\n\nfunction rgb2keyword(rgb) {\n return reverseKeywords[JSON.stringify(rgb)];\n}\n\nfunction rgb2xyz(rgb) {\n var r = rgb[0] / 255,\n g = rgb[1] / 255,\n b = rgb[2] / 255;\n\n // assume sRGB\n r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);\n g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);\n b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);\n\n var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n return [x * 100, y *100, z * 100];\n}\n\nfunction rgb2lab(rgb) {\n var xyz = rgb2xyz(rgb),\n x = xyz[0],\n y = xyz[1],\n z = xyz[2],\n l, a, b;\n\n x /= 95.047;\n y /= 100;\n z /= 108.883;\n\n x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116);\n y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116);\n z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116);\n\n l = (116 * y) - 16;\n a = 500 * (x - y);\n b = 200 * (y - z);\n\n return [l, a, b];\n}\n\nfunction rgb2lch(args) {\n return lab2lch(rgb2lab(args));\n}\n\nfunction hsl2rgb(hsl) {\n var h = hsl[0] / 360,\n s = hsl[1] / 100,\n l = hsl[2] / 100,\n t1, t2, t3, rgb, val;\n\n if (s == 0) {\n val = l * 255;\n return [val, val, val];\n }\n\n if (l < 0.5)\n t2 = l * (1 + s);\n else\n t2 = l + s - l * s;\n t1 = 2 * l - t2;\n\n rgb = [0, 0, 0];\n for (var i = 0; i < 3; i++) {\n t3 = h + 1 / 3 * - (i - 1);\n t3 < 0 && t3++;\n t3 > 1 && t3--;\n\n if (6 * t3 < 1)\n val = t1 + (t2 - t1) * 6 * t3;\n else if (2 * t3 < 1)\n val = t2;\n else if (3 * t3 < 2)\n val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n else\n val = t1;\n\n rgb[i] = val * 255;\n }\n\n return rgb;\n}\n\nfunction hsl2hsv(hsl) {\n var h = hsl[0],\n s = hsl[1] / 100,\n l = hsl[2] / 100,\n sv, v;\n\n if(l === 0) {\n // no need to do calc on black\n // also avoids divide by 0 error\n return [0, 0, 0];\n }\n\n l *= 2;\n s *= (l <= 1) ? l : 2 - l;\n v = (l + s) / 2;\n sv = (2 * s) / (l + s);\n return [h, sv * 100, v * 100];\n}\n\nfunction hsl2hwb(args) {\n return rgb2hwb(hsl2rgb(args));\n}\n\nfunction hsl2cmyk(args) {\n return rgb2cmyk(hsl2rgb(args));\n}\n\nfunction hsl2keyword(args) {\n return rgb2keyword(hsl2rgb(args));\n}\n\n\nfunction hsv2rgb(hsv) {\n var h = hsv[0] / 60,\n s = hsv[1] / 100,\n v = hsv[2] / 100,\n hi = Math.floor(h) % 6;\n\n var f = h - Math.floor(h),\n p = 255 * v * (1 - s),\n q = 255 * v * (1 - (s * f)),\n t = 255 * v * (1 - (s * (1 - f))),\n v = 255 * v;\n\n switch(hi) {\n case 0:\n return [v, t, p];\n case 1:\n return [q, v, p];\n case 2:\n return [p, v, t];\n case 3:\n return [p, q, v];\n case 4:\n return [t, p, v];\n case 5:\n return [v, p, q];\n }\n}\n\nfunction hsv2hsl(hsv) {\n var h = hsv[0],\n s = hsv[1] / 100,\n v = hsv[2] / 100,\n sl, l;\n\n l = (2 - s) * v;\n sl = s * v;\n sl /= (l <= 1) ? l : 2 - l;\n sl = sl || 0;\n l /= 2;\n return [h, sl * 100, l * 100];\n}\n\nfunction hsv2hwb(args) {\n return rgb2hwb(hsv2rgb(args))\n}\n\nfunction hsv2cmyk(args) {\n return rgb2cmyk(hsv2rgb(args));\n}\n\nfunction hsv2keyword(args) {\n return rgb2keyword(hsv2rgb(args));\n}\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nfunction hwb2rgb(hwb) {\n var h = hwb[0] / 360,\n wh = hwb[1] / 100,\n bl = hwb[2] / 100,\n ratio = wh + bl,\n i, v, f, n;\n\n // wh + bl cant be > 1\n if (ratio > 1) {\n wh /= ratio;\n bl /= ratio;\n }\n\n i = Math.floor(6 * h);\n v = 1 - bl;\n f = 6 * h - i;\n if ((i & 0x01) != 0) {\n f = 1 - f;\n }\n n = wh + f * (v - wh); // linear interpolation\n\n switch (i) {\n default:\n case 6:\n case 0: r = v; g = n; b = wh; break;\n case 1: r = n; g = v; b = wh; break;\n case 2: r = wh; g = v; b = n; break;\n case 3: r = wh; g = n; b = v; break;\n case 4: r = n; g = wh; b = v; break;\n case 5: r = v; g = wh; b = n; break;\n }\n\n return [r * 255, g * 255, b * 255];\n}\n\nfunction hwb2hsl(args) {\n return rgb2hsl(hwb2rgb(args));\n}\n\nfunction hwb2hsv(args) {\n return rgb2hsv(hwb2rgb(args));\n}\n\nfunction hwb2cmyk(args) {\n return rgb2cmyk(hwb2rgb(args));\n}\n\nfunction hwb2keyword(args) {\n return rgb2keyword(hwb2rgb(args));\n}\n\nfunction cmyk2rgb(cmyk) {\n var c = cmyk[0] / 100,\n m = cmyk[1] / 100,\n y = cmyk[2] / 100,\n k = cmyk[3] / 100,\n r, g, b;\n\n r = 1 - Math.min(1, c * (1 - k) + k);\n g = 1 - Math.min(1, m * (1 - k) + k);\n b = 1 - Math.min(1, y * (1 - k) + k);\n return [r * 255, g * 255, b * 255];\n}\n\nfunction cmyk2hsl(args) {\n return rgb2hsl(cmyk2rgb(args));\n}\n\nfunction cmyk2hsv(args) {\n return rgb2hsv(cmyk2rgb(args));\n}\n\nfunction cmyk2hwb(args) {\n return rgb2hwb(cmyk2rgb(args));\n}\n\nfunction cmyk2keyword(args) {\n return rgb2keyword(cmyk2rgb(args));\n}\n\n\nfunction xyz2rgb(xyz) {\n var x = xyz[0] / 100,\n y = xyz[1] / 100,\n z = xyz[2] / 100,\n r, g, b;\n\n r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n // assume sRGB\n r = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)\n : r = (r * 12.92);\n\n g = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)\n : g = (g * 12.92);\n\n b = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)\n : b = (b * 12.92);\n\n r = Math.min(Math.max(0, r), 1);\n g = Math.min(Math.max(0, g), 1);\n b = Math.min(Math.max(0, b), 1);\n\n return [r * 255, g * 255, b * 255];\n}\n\nfunction xyz2lab(xyz) {\n var x = xyz[0],\n y = xyz[1],\n z = xyz[2],\n l, a, b;\n\n x /= 95.047;\n y /= 100;\n z /= 108.883;\n\n x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116);\n y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116);\n z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116);\n\n l = (116 * y) - 16;\n a = 500 * (x - y);\n b = 200 * (y - z);\n\n return [l, a, b];\n}\n\nfunction xyz2lch(args) {\n return lab2lch(xyz2lab(args));\n}\n\nfunction lab2xyz(lab) {\n var l = lab[0],\n a = lab[1],\n b = lab[2],\n x, y, z, y2;\n\n if (l <= 8) {\n y = (l * 100) / 903.3;\n y2 = (7.787 * (y / 100)) + (16 / 116);\n } else {\n y = 100 * Math.pow((l + 16) / 116, 3);\n y2 = Math.pow(y / 100, 1/3);\n }\n\n x = x / 95.047 <= 0.008856 ? x = (95.047 * ((a / 500) + y2 - (16 / 116))) / 7.787 : 95.047 * Math.pow((a / 500) + y2, 3);\n\n z = z / 108.883 <= 0.008859 ? z = (108.883 * (y2 - (b / 200) - (16 / 116))) / 7.787 : 108.883 * Math.pow(y2 - (b / 200), 3);\n\n return [x, y, z];\n}\n\nfunction lab2lch(lab) {\n var l = lab[0],\n a = lab[1],\n b = lab[2],\n hr, h, c;\n\n hr = Math.atan2(b, a);\n h = hr * 360 / 2 / Math.PI;\n if (h < 0) {\n h += 360;\n }\n c = Math.sqrt(a * a + b * b);\n return [l, c, h];\n}\n\nfunction lab2rgb(args) {\n return xyz2rgb(lab2xyz(args));\n}\n\nfunction lch2lab(lch) {\n var l = lch[0],\n c = lch[1],\n h = lch[2],\n a, b, hr;\n\n hr = h / 360 * 2 * Math.PI;\n a = c * Math.cos(hr);\n b = c * Math.sin(hr);\n return [l, a, b];\n}\n\nfunction lch2xyz(args) {\n return lab2xyz(lch2lab(args));\n}\n\nfunction lch2rgb(args) {\n return lab2rgb(lch2lab(args));\n}\n\nfunction keyword2rgb(keyword) {\n return cssKeywords[keyword];\n}\n\nfunction keyword2hsl(args) {\n return rgb2hsl(keyword2rgb(args));\n}\n\nfunction keyword2hsv(args) {\n return rgb2hsv(keyword2rgb(args));\n}\n\nfunction keyword2hwb(args) {\n return rgb2hwb(keyword2rgb(args));\n}\n\nfunction keyword2cmyk(args) {\n return rgb2cmyk(keyword2rgb(args));\n}\n\nfunction keyword2lab(args) {\n return rgb2lab(keyword2rgb(args));\n}\n\nfunction keyword2xyz(args) {\n return rgb2xyz(keyword2rgb(args));\n}\n\nvar cssKeywords = {\n aliceblue: [240,248,255],\n antiquewhite: [250,235,215],\n aqua: [0,255,255],\n aquamarine: [127,255,212],\n azure: [240,255,255],\n beige: [245,245,220],\n bisque: [255,228,196],\n black: [0,0,0],\n blanchedalmond: [255,235,205],\n blue: [0,0,255],\n blueviolet: [138,43,226],\n brown: [165,42,42],\n burlywood: [222,184,135],\n cadetblue: [95,158,160],\n chartreuse: [127,255,0],\n chocolate: [210,105,30],\n coral: [255,127,80],\n cornflowerblue: [100,149,237],\n cornsilk: [255,248,220],\n crimson: [220,20,60],\n cyan: [0,255,255],\n darkblue: [0,0,139],\n darkcyan: [0,139,139],\n darkgoldenrod: [184,134,11],\n darkgray: [169,169,169],\n darkgreen: [0,100,0],\n darkgrey: [169,169,169],\n darkkhaki: [189,183,107],\n darkmagenta: [139,0,139],\n darkolivegreen: [85,107,47],\n darkorange: [255,140,0],\n darkorchid: [153,50,204],\n darkred: [139,0,0],\n darksalmon: [233,150,122],\n darkseagreen: [143,188,143],\n darkslateblue: [72,61,139],\n darkslategray: [47,79,79],\n darkslategrey: [47,79,79],\n darkturquoise: [0,206,209],\n darkviolet: [148,0,211],\n deeppink: [255,20,147],\n deepskyblue: [0,191,255],\n dimgray: [105,105,105],\n dimgrey: [105,105,105],\n dodgerblue: [30,144,255],\n firebrick: [178,34,34],\n floralwhite: [255,250,240],\n forestgreen: [34,139,34],\n fuchsia: [255,0,255],\n gainsboro: [220,220,220],\n ghostwhite: [248,248,255],\n gold: [255,215,0],\n goldenrod: [218,165,32],\n gray: [128,128,128],\n green: [0,128,0],\n greenyellow: [173,255,47],\n grey: [128,128,128],\n honeydew: [240,255,240],\n hotpink: [255,105,180],\n indianred: [205,92,92],\n indigo: [75,0,130],\n ivory: [255,255,240],\n khaki: [240,230,140],\n lavender: [230,230,250],\n lavenderblush: [255,240,245],\n lawngreen: [124,252,0],\n lemonchiffon: [255,250,205],\n lightblue: [173,216,230],\n lightcoral: [240,128,128],\n lightcyan: [224,255,255],\n lightgoldenrodyellow: [250,250,210],\n lightgray: [211,211,211],\n lightgreen: [144,238,144],\n lightgrey: [211,211,211],\n lightpink: [255,182,193],\n lightsalmon: [255,160,122],\n lightseagreen: [32,178,170],\n lightskyblue: [135,206,250],\n lightslategray: [119,136,153],\n lightslategrey: [119,136,153],\n lightsteelblue: [176,196,222],\n lightyellow: [255,255,224],\n lime: [0,255,0],\n limegreen: [50,205,50],\n linen: [250,240,230],\n magenta: [255,0,255],\n maroon: [128,0,0],\n mediumaquamarine: [102,205,170],\n mediumblue: [0,0,205],\n mediumorchid: [186,85,211],\n mediumpurple: [147,112,219],\n mediumseagreen: [60,179,113],\n mediumslateblue: [123,104,238],\n mediumspringgreen: [0,250,154],\n mediumturquoise: [72,209,204],\n mediumvioletred: [199,21,133],\n midnightblue: [25,25,112],\n mintcream: [245,255,250],\n mistyrose: [255,228,225],\n moccasin: [255,228,181],\n navajowhite: [255,222,173],\n navy: [0,0,128],\n oldlace: [253,245,230],\n olive: [128,128,0],\n olivedrab: [107,142,35],\n orange: [255,165,0],\n orangered: [255,69,0],\n orchid: [218,112,214],\n palegoldenrod: [238,232,170],\n palegreen: [152,251,152],\n paleturquoise: [175,238,238],\n palevioletred: [219,112,147],\n papayawhip: [255,239,213],\n peachpuff: [255,218,185],\n peru: [205,133,63],\n pink: [255,192,203],\n plum: [221,160,221],\n powderblue: [176,224,230],\n purple: [128,0,128],\n rebeccapurple: [102, 51, 153],\n red: [255,0,0],\n rosybrown: [188,143,143],\n royalblue: [65,105,225],\n saddlebrown: [139,69,19],\n salmon: [250,128,114],\n sandybrown: [244,164,96],\n seagreen: [46,139,87],\n seashell: [255,245,238],\n sienna: [160,82,45],\n silver: [192,192,192],\n skyblue: [135,206,235],\n slateblue: [106,90,205],\n slategray: [112,128,144],\n slategrey: [112,128,144],\n snow: [255,250,250],\n springgreen: [0,255,127],\n steelblue: [70,130,180],\n tan: [210,180,140],\n teal: [0,128,128],\n thistle: [216,191,216],\n tomato: [255,99,71],\n turquoise: [64,224,208],\n violet: [238,130,238],\n wheat: [245,222,179],\n white: [255,255,255],\n whitesmoke: [245,245,245],\n yellow: [255,255,0],\n yellowgreen: [154,205,50]\n};\n\nvar reverseKeywords = {};\nfor (var key in cssKeywords) {\n reverseKeywords[JSON.stringify(cssKeywords[key])] = key;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/color-convert/conversions.js\n// module id = 9\n// module chunks = 0\n\n\n// WEBPACK FOOTER //\n// webpack:///node_modules/color-convert/conversions.js"],"sourceRoot":""} \ No newline at end of file diff --git a/example/build/example.umd.js b/example/build/example.umd.js new file mode 100644 index 0000000..33ba8c3 --- /dev/null +++ b/example/build/example.umd.js @@ -0,0 +1,2 @@ +(function(c){typeof define=="function"&&define.amd?define(c):c()})(function(){"use strict";function c(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function w(e,t){const i=c(e,t),n={x:t.x-e.x,y:t.y-e.y};return{x:n.x/i,y:n.y/i}}class b{constructor(t){this.canvas=t,this.lastTouch=null,this.sensitivity=20,this.lastStrokeParts=[],this.onStrokePartHandlers=[],this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.destroy=this.destroy.bind(this),this.getRelativePosition=this.getRelativePosition.bind(this),this.canvas.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.canvas.addEventListener("touchend",this.onTouchEnd,{passive:!1}),this.canvas.addEventListener("touchcancel",this.onTouchCancel,{passive:!1}),this.canvas.addEventListener("touchmove",this.onTouchMove,{passive:!1})}onStrokePart(t){this.onStrokePartHandlers.push(t)}destroy(){this.onStrokePartHandlers=[],this.lastStrokeParts=[],this.canvas.removeEventListener("touchstart",this.onTouchStart),this.canvas.removeEventListener("touchend",this.onTouchEnd),this.canvas.removeEventListener("touchcancel",this.onTouchCancel),this.canvas.removeEventListener("touchmove",this.onTouchMove)}getRelativePosition(t,i){const n=this.canvas.getBoundingClientRect();return{x:t-n.left,y:i-n.top}}onTouchStart(t){if(t.preventDefault(),this.lastTouch)return;const i=t.changedTouches.item(0);this.lastTouch={id:i.identifier,position:this.getRelativePosition(i.clientX,i.clientY)}}onTouchMove(t){if(t.preventDefault(),!this.lastTouch)return;const i=t.changedTouches,n=Array.from(i).find(a=>a.identifier===this.lastTouch.id);if(!n)return;const o={id:n.identifier,position:this.getRelativePosition(n.clientX,n.clientY)};if(this.sensitivity&&c(o.position,this.lastTouch.position)<10/this.sensitivity)return;const s={endPoint:o.position,startPoint:this.lastTouch.position,isStart:this.lastStrokeParts.length===0,isEnd:!1};this.onStrokePartHandlers.forEach(a=>{a(s)}),this.lastTouch=o,this.lastStrokeParts.push(s)}onTouchEnd(t){if(t.preventDefault(),!this.lastTouch)return;const i=t.changedTouches,n=Array.from(i).find(a=>a.identifier===this.lastTouch.id);if(!n)return;const o=this.getRelativePosition(n.clientX,n.clientY),s={startPoint:this.lastTouch.position,endPoint:o,isStart:!1,isEnd:!0};this.onStrokePartHandlers.forEach(a=>{a(s)}),this.lastTouch=null,this.lastStrokeParts=[]}onTouchCancel(t){t.preventDefault(),this.lastTouch=null,this.lastStrokeParts=[]}}class f{constructor(t,i,n){this.canvas=t,this.canvasWidth=i,this.canvasHeight=n,this.currentTool=null,this.currentStroke=[],this.strokeManager=new b(t),this.canvasState=null,this.shouldDraw=!1,this.shouldCommit=!1;const o=t.getContext("2d").backingStorePixelRatio||1,s=window.devicePixelRatio||1;this.pixelRatio=s/o,this.setCanvasSize=this.setCanvasSize.bind(this),this.setTool=this.setTool.bind(this),this.destroy=this.destroy.bind(this),this.clear=this.clear.bind(this),this.draw=this.draw.bind(this),this.onStrokePart=this.onStrokePart.bind(this),this.nextAnimationFrame=window.requestAnimationFrame(this.draw),this.strokeManager.onStrokePart(this.onStrokePart),this.setCanvasSize(i,n)}setCanvasSize(t,i){this.canvasWidth=t,this.canvasHeight=i;const{canvas:n,canvasWidth:o,canvasHeight:s,pixelRatio:a}=this,l=n.getContext("2d");n.width=o*a,n.height=s*a,n.style.width=o+"px",n.style.height=s+"px",l.setTransform(a,0,0,a,0,0)}setTool(t){this.currentTool=t}destroy(){window.cancelAnimationFrame(this.nextAnimationFrame),this.strokeManager.destroy()}clear(){this.canvasState=null,this.currentStroke=[],this.shouldDraw=!0,this.shouldCommit=!0}onStrokePart(t){this.currentStroke.push(t),this.shouldDraw=!0,t.isEnd&&(this.shouldCommit=!0)}draw(){this.nextAnimationFrame=window.requestAnimationFrame(this.draw);const t=this.canvas.getContext("2d");this.shouldDraw&&(t.clearRect(0,0,this.canvasWidth,this.canvasHeight),this.canvasState&&t.putImageData(this.canvasState,0,0),this.currentTool&&this.currentStroke.length&&(t.save(),this.currentTool.draw(t,this.currentStroke),t.restore()),this.shouldCommit&&(this.canvasState=t.getImageData(0,0,this.canvasWidth*this.pixelRatio,this.canvasHeight*this.pixelRatio),this.currentStroke=[],this.shouldCommit=!1),this.shouldDraw=!1)}}class p{constructor(t="red",i=3){this.color=t,this.width=i}draw(t,i){const n=i[0];t.beginPath(),t.lineWidth=this.width,t.strokeStyle=this.color,t.lineCap="round",t.lineJoin="round",t.moveTo(n.startPoint.x,n.startPoint.y),i.forEach(o=>{const{endPoint:s}=o;t.lineTo(s.x,s.y)}),t.stroke()}}class T{constructor(t=10,i){this.width=t,i=i||{},this.handleOpts={hide:i.hide||!1,strokeWidth:i.strokeWidth||2,fillColor:i.fillColor||"white",strokeColor:i.strokeColor||"black"}}draw(t,i){const{handleOpts:n}=this,o=this.width/2;i.forEach(a=>{const{startPoint:l,endPoint:h,isEnd:d}=a,u=c(l,h),m=w(l,h);let r=l,g=0;for(;g10&&/[0-9](?:\s|\/)/.test(e)&&(i=e.match(/([0-9]+)/g).map(function(u){return parseFloat(u)}),o=e.match(/([a-z])/ig).join("").toLowerCase());else isNaN(e)?Array.isArray(e)||e.length?(i=[e[0],e[1],e[2]],o="rgb",n=e.length===4?e[3]:1):e instanceof Object&&(e.r!=null||e.red!=null||e.R!=null?(o="rgb",i=[e.r||e.red||e.R||0,e.g||e.green||e.G||0,e.b||e.blue||e.B||0]):(o="hsl",i=[e.h||e.hue||e.H||0,e.s||e.saturation||e.S||0,e.l||e.lightness||e.L||e.b||e.brightness]),n=e.a||e.alpha||e.opacity||1,e.opacity!=null&&(n/=100)):(o="rgb",i=[e>>>16,(e&65280)>>>8,e&255]);return{space:o,values:i,alpha:n}}function x(e,t){var i=E(e);return t==null&&(t=i.alpha),i.space[0]==="h"?i.space+["a(",i.values[0],",",i.values[1],"%,",i.values[2],"%,",t,")"].join(""):i.space+["a(",i.values,",",t,")"].join("")}class C{constructor(t="yellow",i=8,n=.3){this.width=i,this.color=x(t,.4)}draw(t,i){const n=i[0];t.beginPath(),t.lineWidth=this.width,t.strokeStyle=this.color,t.lineCap="butt",t.miterLimit=1,t.moveTo(n.startPoint.x,n.startPoint.y),i.forEach(o=>{const{endPoint:s}=o;t.lineTo(s.x,s.y)}),t.stroke()}}window.onload=function(){const e=document.getElementById("canvas"),t=document.getElementById("red-pen"),i=document.getElementById("blue-pen"),n=document.getElementById("eraser"),o=document.getElementById("highlighter"),s=document.getElementById("clear");if(!t||!i||!n||!o||!s)throw new Error("Invalid elements");const a=400,l=400,h=new f(e,a,l),d=new p("red",3),u=new p("blue",8),m=new T(20),r=new C("yellow",30);h.setTool(d),t.onclick=function(){h.setTool(d)},i.onclick=function(){h.setTool(u)},n.onclick=function(){h.setTool(m)},o.onclick=function(){h.setTool(r)},s.onclick=function(){h.clear()}}}); +//# sourceMappingURL=example.umd.js.map diff --git a/example/build/example.umd.js.map b/example/build/example.umd.js.map new file mode 100644 index 0000000..ceecc89 --- /dev/null +++ b/example/build/example.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"example.umd.js","sources":["../../dist/index.es.js","../src/example.ts"],"sourcesContent":["function g(e, t) {\n return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));\n}\nfunction y(e, t) {\n const i = g(e, t), o = {\n x: t.x - e.x,\n y: t.y - e.y\n };\n return {\n x: o.x / i,\n y: o.y / i\n };\n}\nclass k {\n constructor(t) {\n this.canvas = t, this.lastTouch = null, this.sensitivity = 20, this.lastStrokeParts = [], this.onStrokePartHandlers = [], this.onTouchStart = this.onTouchStart.bind(this), this.onTouchEnd = this.onTouchEnd.bind(this), this.onTouchCancel = this.onTouchCancel.bind(this), this.onTouchMove = this.onTouchMove.bind(this), this.destroy = this.destroy.bind(this), this.getRelativePosition = this.getRelativePosition.bind(this), this.canvas.addEventListener(\"touchstart\", this.onTouchStart, {\n passive: !1\n }), this.canvas.addEventListener(\"touchend\", this.onTouchEnd, {\n passive: !1\n }), this.canvas.addEventListener(\"touchcancel\", this.onTouchCancel, {\n passive: !1\n }), this.canvas.addEventListener(\"touchmove\", this.onTouchMove, {\n passive: !1\n });\n }\n /**\n * Registers a handler to be fired on a new stroke part\n * @param handler\n */\n onStrokePart(t) {\n this.onStrokePartHandlers.push(t);\n }\n /**\n * Removes all active listeners\n */\n destroy() {\n this.onStrokePartHandlers = [], this.lastStrokeParts = [], this.canvas.removeEventListener(\"touchstart\", this.onTouchStart), this.canvas.removeEventListener(\"touchend\", this.onTouchEnd), this.canvas.removeEventListener(\"touchcancel\", this.onTouchCancel), this.canvas.removeEventListener(\"touchmove\", this.onTouchMove);\n }\n /**\n * Get relative position to canvas\n * @param clientX\n * @param clientY\n * @returns IPoint\n */\n getRelativePosition(t, i) {\n const o = this.canvas.getBoundingClientRect();\n return {\n x: t - o.left,\n y: i - o.top\n };\n }\n /**\n * Creates a new touch if one does not\n * already exist\n * @param e\n */\n onTouchStart(t) {\n if (t.preventDefault(), this.lastTouch)\n return;\n const o = t.changedTouches.item(0);\n this.lastTouch = {\n id: o.identifier,\n position: this.getRelativePosition(o.clientX, o.clientY)\n };\n }\n /**\n * Creates a line from last touch to current touch\n * point and emits event. Does no-op if no existing touch\n * @param e\n */\n onTouchMove(t) {\n if (t.preventDefault(), !this.lastTouch)\n return;\n const i = t.changedTouches, o = Array.from(i).find((a) => a.identifier === this.lastTouch.id);\n if (!o)\n return;\n const n = {\n id: o.identifier,\n position: this.getRelativePosition(o.clientX, o.clientY)\n };\n if (this.sensitivity && g(n.position, this.lastTouch.position) < 10 / this.sensitivity)\n return;\n const s = {\n endPoint: n.position,\n startPoint: this.lastTouch.position,\n isStart: this.lastStrokeParts.length === 0,\n isEnd: !1\n };\n this.onStrokePartHandlers.forEach((a) => {\n a(s);\n }), this.lastTouch = n, this.lastStrokeParts.push(s);\n }\n /**\n * Draws a line from last point to final point. Removes\n * the reference to last touch point.\n * @param e\n */\n onTouchEnd(t) {\n if (t.preventDefault(), !this.lastTouch)\n return;\n const i = t.changedTouches, o = Array.from(i).find((a) => a.identifier === this.lastTouch.id);\n if (!o)\n return;\n const n = this.getRelativePosition(o.clientX, o.clientY), s = {\n startPoint: this.lastTouch.position,\n endPoint: n,\n isStart: !1,\n isEnd: !0\n };\n this.onStrokePartHandlers.forEach((a) => {\n a(s);\n }), this.lastTouch = null, this.lastStrokeParts = [];\n }\n /**\n * Removes the current last touch point\n * @param e\n */\n onTouchCancel(t) {\n t.preventDefault(), this.lastTouch = null, this.lastStrokeParts = [];\n }\n}\nclass P {\n constructor(t, i, o) {\n this.canvas = t, this.canvasWidth = i, this.canvasHeight = o, this.currentTool = null, this.currentStroke = [], this.strokeManager = new k(t), this.canvasState = null, this.shouldDraw = !1, this.shouldCommit = !1;\n const n = t.getContext(\"2d\").backingStorePixelRatio || 1, s = window.devicePixelRatio || 1;\n this.pixelRatio = s / n, this.setCanvasSize = this.setCanvasSize.bind(this), this.setTool = this.setTool.bind(this), this.destroy = this.destroy.bind(this), this.clear = this.clear.bind(this), this.draw = this.draw.bind(this), this.onStrokePart = this.onStrokePart.bind(this), this.nextAnimationFrame = window.requestAnimationFrame(this.draw), this.strokeManager.onStrokePart(this.onStrokePart), this.setCanvasSize(i, o);\n }\n /**\n * Sets the canvas desired width and height and sets transform\n * for hifi displays\n * @param width\n * @param height\n */\n setCanvasSize(t, i) {\n this.canvasWidth = t, this.canvasHeight = i;\n const { canvas: o, canvasWidth: n, canvasHeight: s, pixelRatio: a } = this, h = o.getContext(\"2d\");\n o.width = n * a, o.height = s * a, o.style.width = n + \"px\", o.style.height = s + \"px\", h.setTransform(a, 0, 0, a, 0, 0);\n }\n /**\n * Sets the current tool for the manager\n * @param tool\n */\n setTool(t) {\n this.currentTool = t;\n }\n /**\n * Remove all event listeners\n */\n destroy() {\n window.cancelAnimationFrame(this.nextAnimationFrame), this.strokeManager.destroy();\n }\n /**\n * Clears the canvas\n */\n clear() {\n this.canvasState = null, this.currentStroke = [], this.shouldDraw = !0, this.shouldCommit = !0;\n }\n /**\n * Adds a new stroke part to the nextStrokes\n * array\n * @param strokePart\n */\n onStrokePart(t) {\n this.currentStroke.push(t), this.shouldDraw = !0, t.isEnd && (this.shouldCommit = !0);\n }\n /**\n * Draws a frame\n */\n draw() {\n this.nextAnimationFrame = window.requestAnimationFrame(this.draw);\n const t = this.canvas.getContext(\"2d\");\n this.shouldDraw && (t.clearRect(0, 0, this.canvasWidth, this.canvasHeight), this.canvasState && t.putImageData(this.canvasState, 0, 0), this.currentTool && this.currentStroke.length && (t.save(), this.currentTool.draw(t, this.currentStroke), t.restore()), this.shouldCommit && (this.canvasState = t.getImageData(\n 0,\n 0,\n this.canvasWidth * this.pixelRatio,\n this.canvasHeight * this.pixelRatio\n ), this.currentStroke = [], this.shouldCommit = !1), this.shouldDraw = !1);\n }\n}\nclass C {\n constructor(t = \"red\", i = 3) {\n this.color = t, this.width = i;\n }\n /**\n * Draws a \"pen stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n draw(t, i) {\n const o = i[0];\n t.beginPath(), t.lineWidth = this.width, t.strokeStyle = this.color, t.lineCap = \"round\", t.lineJoin = \"round\", t.moveTo(o.startPoint.x, o.startPoint.y), i.forEach((n) => {\n const { endPoint: s } = n;\n t.lineTo(s.x, s.y);\n }), t.stroke();\n }\n}\nclass E {\n constructor(t = 10, i) {\n this.width = t, i = i || {}, this.handleOpts = {\n hide: i.hide || !1,\n strokeWidth: i.strokeWidth || 2,\n fillColor: i.fillColor || \"white\",\n strokeColor: i.strokeColor || \"black\"\n };\n }\n /**\n * Draws an \"eraser stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n draw(t, i) {\n const { handleOpts: o } = this, n = this.width / 2;\n i.forEach((a) => {\n const { startPoint: h, endPoint: l, isEnd: f } = a, d = g(h, l), v = y(h, l);\n let r = h, u = 0;\n for (; u < d; ) {\n const c = {\n x: r.x + v.x,\n y: r.y + v.y\n };\n t.clearRect(\n c.x - n,\n c.y - n,\n this.width,\n this.width\n ), u++, r = c;\n }\n });\n const s = i[i.length - 1];\n !s.isEnd && !o.hide && (t.strokeStyle = o.strokeColor, t.fillStyle = o.fillColor, t.fillRect(\n s.endPoint.x - n,\n s.endPoint.y - n,\n this.width,\n this.width\n ), t.strokeRect(\n s.endPoint.x - n + 0.5,\n s.endPoint.y - n + 0.5,\n this.width - 1,\n this.width - 1\n ));\n }\n}\nfunction w(e) {\n return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, \"default\") ? e.default : e;\n}\nvar b = {\n aliceblue: [240, 248, 255],\n antiquewhite: [250, 235, 215],\n aqua: [0, 255, 255],\n aquamarine: [127, 255, 212],\n azure: [240, 255, 255],\n beige: [245, 245, 220],\n bisque: [255, 228, 196],\n black: [0, 0, 0],\n blanchedalmond: [255, 235, 205],\n blue: [0, 0, 255],\n blueviolet: [138, 43, 226],\n brown: [165, 42, 42],\n burlywood: [222, 184, 135],\n cadetblue: [95, 158, 160],\n chartreuse: [127, 255, 0],\n chocolate: [210, 105, 30],\n coral: [255, 127, 80],\n cornflowerblue: [100, 149, 237],\n cornsilk: [255, 248, 220],\n crimson: [220, 20, 60],\n cyan: [0, 255, 255],\n darkblue: [0, 0, 139],\n darkcyan: [0, 139, 139],\n darkgoldenrod: [184, 134, 11],\n darkgray: [169, 169, 169],\n darkgreen: [0, 100, 0],\n darkgrey: [169, 169, 169],\n darkkhaki: [189, 183, 107],\n darkmagenta: [139, 0, 139],\n darkolivegreen: [85, 107, 47],\n darkorange: [255, 140, 0],\n darkorchid: [153, 50, 204],\n darkred: [139, 0, 0],\n darksalmon: [233, 150, 122],\n darkseagreen: [143, 188, 143],\n darkslateblue: [72, 61, 139],\n darkslategray: [47, 79, 79],\n darkslategrey: [47, 79, 79],\n darkturquoise: [0, 206, 209],\n darkviolet: [148, 0, 211],\n deeppink: [255, 20, 147],\n deepskyblue: [0, 191, 255],\n dimgray: [105, 105, 105],\n dimgrey: [105, 105, 105],\n dodgerblue: [30, 144, 255],\n firebrick: [178, 34, 34],\n floralwhite: [255, 250, 240],\n forestgreen: [34, 139, 34],\n fuchsia: [255, 0, 255],\n gainsboro: [220, 220, 220],\n ghostwhite: [248, 248, 255],\n gold: [255, 215, 0],\n goldenrod: [218, 165, 32],\n gray: [128, 128, 128],\n green: [0, 128, 0],\n greenyellow: [173, 255, 47],\n grey: [128, 128, 128],\n honeydew: [240, 255, 240],\n hotpink: [255, 105, 180],\n indianred: [205, 92, 92],\n indigo: [75, 0, 130],\n ivory: [255, 255, 240],\n khaki: [240, 230, 140],\n lavender: [230, 230, 250],\n lavenderblush: [255, 240, 245],\n lawngreen: [124, 252, 0],\n lemonchiffon: [255, 250, 205],\n lightblue: [173, 216, 230],\n lightcoral: [240, 128, 128],\n lightcyan: [224, 255, 255],\n lightgoldenrodyellow: [250, 250, 210],\n lightgray: [211, 211, 211],\n lightgreen: [144, 238, 144],\n lightgrey: [211, 211, 211],\n lightpink: [255, 182, 193],\n lightsalmon: [255, 160, 122],\n lightseagreen: [32, 178, 170],\n lightskyblue: [135, 206, 250],\n lightslategray: [119, 136, 153],\n lightslategrey: [119, 136, 153],\n lightsteelblue: [176, 196, 222],\n lightyellow: [255, 255, 224],\n lime: [0, 255, 0],\n limegreen: [50, 205, 50],\n linen: [250, 240, 230],\n magenta: [255, 0, 255],\n maroon: [128, 0, 0],\n mediumaquamarine: [102, 205, 170],\n mediumblue: [0, 0, 205],\n mediumorchid: [186, 85, 211],\n mediumpurple: [147, 112, 219],\n mediumseagreen: [60, 179, 113],\n mediumslateblue: [123, 104, 238],\n mediumspringgreen: [0, 250, 154],\n mediumturquoise: [72, 209, 204],\n mediumvioletred: [199, 21, 133],\n midnightblue: [25, 25, 112],\n mintcream: [245, 255, 250],\n mistyrose: [255, 228, 225],\n moccasin: [255, 228, 181],\n navajowhite: [255, 222, 173],\n navy: [0, 0, 128],\n oldlace: [253, 245, 230],\n olive: [128, 128, 0],\n olivedrab: [107, 142, 35],\n orange: [255, 165, 0],\n orangered: [255, 69, 0],\n orchid: [218, 112, 214],\n palegoldenrod: [238, 232, 170],\n palegreen: [152, 251, 152],\n paleturquoise: [175, 238, 238],\n palevioletred: [219, 112, 147],\n papayawhip: [255, 239, 213],\n peachpuff: [255, 218, 185],\n peru: [205, 133, 63],\n pink: [255, 192, 203],\n plum: [221, 160, 221],\n powderblue: [176, 224, 230],\n purple: [128, 0, 128],\n rebeccapurple: [102, 51, 153],\n red: [255, 0, 0],\n rosybrown: [188, 143, 143],\n royalblue: [65, 105, 225],\n saddlebrown: [139, 69, 19],\n salmon: [250, 128, 114],\n sandybrown: [244, 164, 96],\n seagreen: [46, 139, 87],\n seashell: [255, 245, 238],\n sienna: [160, 82, 45],\n silver: [192, 192, 192],\n skyblue: [135, 206, 235],\n slateblue: [106, 90, 205],\n slategray: [112, 128, 144],\n slategrey: [112, 128, 144],\n snow: [255, 250, 250],\n springgreen: [0, 255, 127],\n steelblue: [70, 130, 180],\n tan: [210, 180, 140],\n teal: [0, 128, 128],\n thistle: [216, 191, 216],\n tomato: [255, 99, 71],\n turquoise: [64, 224, 208],\n violet: [238, 130, 238],\n wheat: [245, 222, 179],\n white: [255, 255, 255],\n whitesmoke: [245, 245, 245],\n yellow: [255, 255, 0],\n yellowgreen: [154, 205, 50]\n};\nconst p = /* @__PURE__ */ w(b);\nvar m = {\n red: 0,\n orange: 60,\n yellow: 120,\n green: 180,\n blue: 240,\n purple: 300\n};\nfunction T(e) {\n var t, i = [], o = 1, n;\n if (typeof e == \"string\")\n if (e = e.toLowerCase(), p[e])\n i = p[e].slice(), n = \"rgb\";\n else if (e === \"transparent\")\n o = 0, n = \"rgb\", i = [0, 0, 0];\n else if (/^#[A-Fa-f0-9]+$/.test(e)) {\n var s = e.slice(1), a = s.length, h = a <= 4;\n o = 1, h ? (i = [\n parseInt(s[0] + s[0], 16),\n parseInt(s[1] + s[1], 16),\n parseInt(s[2] + s[2], 16)\n ], a === 4 && (o = parseInt(s[3] + s[3], 16) / 255)) : (i = [\n parseInt(s[0] + s[1], 16),\n parseInt(s[2] + s[3], 16),\n parseInt(s[4] + s[5], 16)\n ], a === 8 && (o = parseInt(s[6] + s[7], 16) / 255)), i[0] || (i[0] = 0), i[1] || (i[1] = 0), i[2] || (i[2] = 0), n = \"rgb\";\n } else if (t = /^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\\s*\\(([^\\)]*)\\)/.exec(e)) {\n var l = t[1], f = l === \"rgb\", s = l.replace(/a$/, \"\");\n n = s;\n var a = s === \"cmyk\" ? 4 : s === \"gray\" ? 1 : 3;\n i = t[2].trim().split(/\\s*[,\\/]\\s*|\\s+/).map(function(r, u) {\n if (/%$/.test(r))\n return u === a ? parseFloat(r) / 100 : s === \"rgb\" ? parseFloat(r) * 255 / 100 : parseFloat(r);\n if (s[u] === \"h\") {\n if (/deg$/.test(r))\n return parseFloat(r);\n if (m[r] !== void 0)\n return m[r];\n }\n return parseFloat(r);\n }), l === s && i.push(1), o = f || i[a] === void 0 ? 1 : i[a], i = i.slice(0, a);\n } else\n e.length > 10 && /[0-9](?:\\s|\\/)/.test(e) && (i = e.match(/([0-9]+)/g).map(function(d) {\n return parseFloat(d);\n }), n = e.match(/([a-z])/ig).join(\"\").toLowerCase());\n else\n isNaN(e) ? Array.isArray(e) || e.length ? (i = [e[0], e[1], e[2]], n = \"rgb\", o = e.length === 4 ? e[3] : 1) : e instanceof Object && (e.r != null || e.red != null || e.R != null ? (n = \"rgb\", i = [\n e.r || e.red || e.R || 0,\n e.g || e.green || e.G || 0,\n e.b || e.blue || e.B || 0\n ]) : (n = \"hsl\", i = [\n e.h || e.hue || e.H || 0,\n e.s || e.saturation || e.S || 0,\n e.l || e.lightness || e.L || e.b || e.brightness\n ]), o = e.a || e.alpha || e.opacity || 1, e.opacity != null && (o /= 100)) : (n = \"rgb\", i = [e >>> 16, (e & 65280) >>> 8, e & 255]);\n return {\n space: n,\n values: i,\n alpha: o\n };\n}\nfunction S(e, t) {\n var i = T(e);\n return t == null && (t = i.alpha), i.space[0] === \"h\" ? i.space + [\"a(\", i.values[0], \",\", i.values[1], \"%,\", i.values[2], \"%,\", t, \")\"].join(\"\") : i.space + [\"a(\", i.values, \",\", t, \")\"].join(\"\");\n}\nclass R {\n constructor(t = \"yellow\", i = 8, o = 0.3) {\n this.width = i, this.color = S(t, 0.4);\n }\n /**\n * Draws a \"highlighter stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n draw(t, i) {\n const o = i[0];\n t.beginPath(), t.lineWidth = this.width, t.strokeStyle = this.color, t.lineCap = \"butt\", t.miterLimit = 1, t.moveTo(o.startPoint.x, o.startPoint.y), i.forEach((n) => {\n const { endPoint: s } = n;\n t.lineTo(s.x, s.y);\n }), t.stroke();\n }\n}\nexport {\n E as EraserTool,\n R as HighlighterTool,\n P as Manager,\n C as PenTool\n};\n//# sourceMappingURL=index.es.js.map\n","import {\r\n Manager,\r\n PenTool,\r\n EraserTool,\r\n HighlighterTool,\r\n} from \"../../dist/index.es\";\r\n\r\nwindow.onload = function () {\r\n const canvas = document.getElementById(\"canvas\");\r\n const redPenElem = document.getElementById(\"red-pen\");\r\n const bluePenElem = document.getElementById(\"blue-pen\");\r\n const eraserElem = document.getElementById(\"eraser\");\r\n const highlighterElem = document.getElementById(\"highlighter\");\r\n const clearElem = document.getElementById(\"clear\");\r\n\r\n if (\r\n !redPenElem ||\r\n !bluePenElem ||\r\n !eraserElem ||\r\n !highlighterElem ||\r\n !clearElem\r\n ) {\r\n throw new Error(\"Invalid elements\");\r\n }\r\n\r\n const width = 400;\r\n const height = 400;\r\n\r\n const manager = new Manager(canvas, width, height);\r\n\r\n const redPen = new PenTool(\"red\", 3);\r\n const bluePen = new PenTool(\"blue\", 8);\r\n const eraser = new EraserTool(20);\r\n const highlighterTool = new HighlighterTool(\"yellow\", 30);\r\n\r\n manager.setTool(redPen);\r\n\r\n redPenElem.onclick = function () {\r\n manager.setTool(redPen);\r\n };\r\n\r\n bluePenElem.onclick = function () {\r\n manager.setTool(bluePen);\r\n };\r\n\r\n eraserElem.onclick = function () {\r\n manager.setTool(eraser);\r\n };\r\n\r\n highlighterElem.onclick = function () {\r\n manager.setTool(highlighterTool);\r\n };\r\n\r\n clearElem.onclick = function () {\r\n manager.clear();\r\n };\r\n};\r\n"],"names":["g","y","o","k","n","P","h","C","E","l","f","d","v","u","c","w","b","p","m","T","S","R","canvas","redPenElem","bluePenElem","eraserElem","highlighterElem","clearElem","width","height","manager","Manager","redPen","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C,EAC7BC,EAAU,IAAID,EAAQ,OAAQ,CAAC,EAC/BE,EAAS,IAAIC,EAAW,EAAE,EAC1BC,EAAkB,IAAIC,EAAgB,SAAU,EAAE,EAExDR,EAAQ,QAAQE,CAAM,EAEtBT,EAAW,QAAU,UAAY,CAC/BO,EAAQ,QAAQE,CAAM,CAAA,EAGxBR,EAAY,QAAU,UAAY,CAChCM,EAAQ,QAAQI,CAAO,CAAA,EAGzBT,EAAW,QAAU,UAAY,CAC/BK,EAAQ,QAAQK,CAAM,CAAA,EAGxBT,EAAgB,QAAU,UAAY,CACpCI,EAAQ,QAAQO,CAAe,CAAA,EAGjCV,EAAU,QAAU,UAAY,CAC9BG,EAAQ,MAAM,CAAA,CAElB"} \ No newline at end of file diff --git a/example/index.html b/example/index.html index 5a78212..aa003b3 100644 --- a/example/index.html +++ b/example/index.html @@ -1,21 +1,21 @@ - - - - - - Paintbricks | Example - - - - -
- - - - - -
- - - - \ No newline at end of file + + + + + + Paintbricks | Example + + + + +
+ + + + + +
+ + + + diff --git a/example/src/example.ts b/example/src/example.ts index f7706a2..6f91ba8 100644 --- a/example/src/example.ts +++ b/example/src/example.ts @@ -2,8 +2,8 @@ import { Manager, PenTool, EraserTool, - HighlighterTool -} from "../../lib"; + HighlighterTool, +} from "../../dist/index.es"; window.onload = function () { const canvas = document.getElementById("canvas"); @@ -12,36 +12,46 @@ window.onload = function () { const eraserElem = document.getElementById("eraser"); const highlighterElem = document.getElementById("highlighter"); const clearElem = document.getElementById("clear"); - + + if ( + !redPenElem || + !bluePenElem || + !eraserElem || + !highlighterElem || + !clearElem + ) { + throw new Error("Invalid elements"); + } + const width = 400; const height = 400; - + const manager = new Manager(canvas, width, height); - + const redPen = new PenTool("red", 3); const bluePen = new PenTool("blue", 8); const eraser = new EraserTool(20); const highlighterTool = new HighlighterTool("yellow", 30); - + manager.setTool(redPen); - - redPenElem.onclick = function() { + + redPenElem.onclick = function () { manager.setTool(redPen); }; - - bluePenElem.onclick = function() { + + bluePenElem.onclick = function () { manager.setTool(bluePen); }; - - eraserElem.onclick = function() { + + eraserElem.onclick = function () { manager.setTool(eraser); }; - - highlighterElem.onclick = function() { + + highlighterElem.onclick = function () { manager.setTool(highlighterTool); }; - - clearElem.onclick = function() { + + clearElem.onclick = function () { manager.clear(); }; -}; \ No newline at end of file +}; diff --git a/example/vite.config.js b/example/vite.config.js new file mode 100644 index 0000000..71f2907 --- /dev/null +++ b/example/vite.config.js @@ -0,0 +1,25 @@ +import { defineConfig } from "vite"; +import path from "path"; + +export default defineConfig({ + build: { + lib: { + entry: path.resolve(__dirname, "./src/example.ts"), + name: "Example", + fileName: (format) => `example.${format}.js`, + }, + outDir: path.resolve(__dirname, "./build"), + sourcemap: true, + }, + resolve: { + alias: { + "@": path.resolve(__dirname, "src"), + }, + extensions: [".ts", ".js", ".json"], + }, + esbuild: { + loader: "ts", + include: /\.tsx?$/, + exclude: /node_modules/, + }, +}); diff --git a/example/webpack.config.js b/example/webpack.config.js deleted file mode 100644 index af3b862..0000000 --- a/example/webpack.config.js +++ /dev/null @@ -1,26 +0,0 @@ -module.exports = { - entry: "./example/src/example.ts", - - output: { - filename: "example.js", - path: __dirname + "/build/" - }, - - // Enable sourcemaps for debugging webpack's output. - devtool: "source-map", - - resolve: { - // Add '.ts' and '.tsx' as resolvable extensions. - extensions: [".ts", ".js", ".json"] - }, - - module: { - rules: [ - // All files with a '.ts' extension will be handled by 'awesome-typescript-loader'. - { test: /\.tsx?$/, loader: "awesome-typescript-loader" }, - - // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. - { enforce: "pre", test: /\.js$/, loader: "source-map-loader" } - ] - } -}; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index fae4e7e..0000000 --- a/lib/index.js +++ /dev/null @@ -1,1462 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["Paintbricks"] = factory(); - else - root["Paintbricks"] = factory(); -})(typeof self !== 'undefined' ? self : this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Get the distance between two points - * @param p1 - * @param p2 - * @returns number - */ -function getEuclidean(p1, p2) { - return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); -} -exports.getEuclidean = getEuclidean; -/** - * Gets the unit vector representing the vector from start - * point to end point with a length of 1. - * @param startPoint - * @param endPoint - * @returns IPoint - */ -function getUnitVector(startPoint, endPoint) { - const length = this.getEuclidean(startPoint, endPoint); - const dirVect = { - x: endPoint.x - startPoint.x, - y: endPoint.y - startPoint.y - }; - const unitVect = { - x: dirVect.x / length, - y: dirVect.y / length - }; - return unitVect; -} -exports.getUnitVector = getUnitVector; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var Manager_1 = __webpack_require__(2); -exports.Manager = Manager_1.Manager; -var PenTool_1 = __webpack_require__(4); -exports.PenTool = PenTool_1.PenTool; -var EraserTool_1 = __webpack_require__(5); -exports.EraserTool = EraserTool_1.EraserTool; -var HighlighterTool_1 = __webpack_require__(6); -exports.HighlighterTool = HighlighterTool_1.HighlighterTool; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const StrokeManager_1 = __webpack_require__(3); -class Manager { - constructor(canvas, canvasWidth, canvasHeight) { - this.canvas = canvas; - this.canvasWidth = canvasWidth; - this.canvasHeight = canvasHeight; - this.currentTool = null; - this.currentStroke = []; - this.strokeManager = new StrokeManager_1.StrokeManager(canvas); - this.canvasState = null; - this.shouldDraw = false; - this.shouldCommit = false; - // find pixel ratio relative to backing store and device ratio - const bsr = canvas.getContext("2d").backingStorePixelRatio || 1; - const dpr = window.devicePixelRatio || 1; - this.pixelRatio = dpr / bsr; - this.setCanvasSize = this.setCanvasSize.bind(this); - this.setTool = this.setTool.bind(this); - this.destroy = this.destroy.bind(this); - this.clear = this.clear.bind(this); - this.draw = this.draw.bind(this); - this.onStrokePart = this.onStrokePart.bind(this); - // schedule animation frame loop - this.nextAnimationFrame = window.requestAnimationFrame(this.draw); - // set up listener for new stroke part - this.strokeManager.onStrokePart(this.onStrokePart); - this.setCanvasSize(canvasWidth, canvasHeight); - } - /** - * Sets the canvas desired width and height and sets transform - * for hifi displays - * @param width - * @param height - */ - setCanvasSize(width, height) { - this.canvasWidth = width; - this.canvasHeight = height; - const { canvas, canvasWidth, canvasHeight, pixelRatio } = this; - const ctx = canvas.getContext("2d"); - // appropriately scale canvas to map to device ratio - canvas.width = canvasWidth * pixelRatio; - canvas.height = canvasHeight * pixelRatio; - canvas.style.width = canvasWidth + "px"; - canvas.style.height = canvasHeight + "px"; - ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); - } - /** - * Sets the current tool for the manager - * @param tool - */ - setTool(tool) { - this.currentTool = tool; - } - /** - * Remove all event listeners - */ - destroy() { - // cancel animation loop - window.cancelAnimationFrame(this.nextAnimationFrame); - // remove all listeners on stroke manager - this.strokeManager.destroy(); - } - /** - * Clears the canvas - */ - clear() { - this.canvasState = null; - this.currentStroke = []; - this.shouldDraw = true; - this.shouldCommit = true; - } - /** - * Adds a new stroke part to the nextStrokes - * array - * @param strokePart - */ - onStrokePart(strokePart) { - this.currentStroke.push(strokePart); - this.shouldDraw = true; - if (strokePart.isEnd) { - this.shouldCommit = true; - } - } - /** - * Draws a frame - */ - draw() { - // schedule next draw - this.nextAnimationFrame = window.requestAnimationFrame(this.draw); - const ctx = this.canvas.getContext("2d"); - if (!this.shouldDraw) { - return; - } - // clear canvas - ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight); - // draw current state - if (this.canvasState) { - ctx.putImageData(this.canvasState, 0, 0); - } - // if a tool has been selected and there are - // pending strokes, draw them - if (this.currentTool && this.currentStroke.length) { - ctx.save(); - this.currentTool.draw(ctx, this.currentStroke); - ctx.restore(); - } - // if all changes have been made for current stroke, - // save it as the new canvas state - if (this.shouldCommit) { - this.canvasState = ctx.getImageData(0, 0, this.canvasWidth * this.pixelRatio, this.canvasHeight * this.pixelRatio); - this.currentStroke = []; - this.shouldCommit = false; - } - this.shouldDraw = false; - } -} -exports.Manager = Manager; - - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = __webpack_require__(0); -class StrokeManager { - constructor(canvas) { - this.canvas = canvas; - this.lastTouch = null; - this.sensitivity = 20.0; - this.lastStrokeParts = []; - this.onStrokePartHandlers = []; - this.onTouchStart = this.onTouchStart.bind(this); - this.onTouchEnd = this.onTouchEnd.bind(this); - this.onTouchCancel = this.onTouchCancel.bind(this); - this.onTouchMove = this.onTouchMove.bind(this); - this.destroy = this.destroy.bind(this); - this.getRelativePosition = this.getRelativePosition.bind(this); - this.canvas.addEventListener("touchstart", this.onTouchStart, { - passive: false - }); - this.canvas.addEventListener("touchend", this.onTouchEnd, { - passive: false - }); - this.canvas.addEventListener("touchcancel", this.onTouchCancel, { - passive: false - }); - this.canvas.addEventListener("touchmove", this.onTouchMove, { - passive: false - }); - } - /** - * Registers a handler to be fired on a new stroke part - * @param handler - */ - onStrokePart(handler) { - this.onStrokePartHandlers.push(handler); - } - /** - * Removes all active listeners - */ - destroy() { - this.onStrokePartHandlers = []; - this.lastStrokeParts = []; - this.canvas.removeEventListener("touchstart", this.onTouchStart); - this.canvas.removeEventListener("touchend", this.onTouchEnd); - this.canvas.removeEventListener("touchcancel", this.onTouchCancel); - this.canvas.removeEventListener("touchmove", this.onTouchMove); - } - /** - * Get relative position to canvas - * @param clientX - * @param clientY - * @returns IPoint - */ - getRelativePosition(clientX, clientY) { - const rect = this.canvas.getBoundingClientRect(); - return { - x: clientX - rect.left, - y: clientY - rect.top - }; - } - /** - * Creates a new touch if one does not - * already exist - * @param e - */ - onTouchStart(e) { - e.preventDefault(); - // if there is an ongoing touch, ignore this event - if (this.lastTouch) { - return; - } - const touches = e.changedTouches; - // only get the first touch - const touch = touches.item(0); - // save the touch - this.lastTouch = { - id: touch.identifier, - position: this.getRelativePosition(touch.clientX, touch.clientY) - }; - } - /** - * Creates a line from last touch to current touch - * point and emits event. Does no-op if no existing touch - * @param e - */ - onTouchMove(e) { - e.preventDefault(); - // if no last touch... something is wrong - if (!this.lastTouch) { - return; - } - const touches = e.changedTouches; - // find the current touch we are tracking - const touch = Array.from(touches).find(touch => { - return touch.identifier === this.lastTouch.id; - }); - // if the touch was not one we were tracking, - // ignore and no-op - if (!touch) { - return; - } - const nextTouch = { - id: touch.identifier, - position: this.getRelativePosition(touch.clientX, touch.clientY) - }; - // If sensitivity setting has been set, - // check if this point is far enough from last - // touch to be drawn - if (this.sensitivity && - util_1.getEuclidean(nextTouch.position, this.lastTouch.position) < - 10.0 / this.sensitivity) { - return; - } - const strokePart = { - endPoint: nextTouch.position, - startPoint: this.lastTouch.position, - isStart: this.lastStrokeParts.length === 0, - isEnd: false - }; - this.onStrokePartHandlers.forEach(handler => { - handler(strokePart); - }); - // save this touch as last touch - this.lastTouch = nextTouch; - this.lastStrokeParts.push(strokePart); - } - /** - * Draws a line from last point to final point. Removes - * the reference to last touch point. - * @param e - */ - onTouchEnd(e) { - e.preventDefault(); - // if no last touch... something is wrong - if (!this.lastTouch) { - return; - } - const touches = e.changedTouches; - // find the current touch we are tracking - const touch = Array.from(touches).find(touch => { - return touch.identifier === this.lastTouch.id; - }); - // if the touch was not one we were tracking, - // ignore and no-op - if (!touch) { - return; - } - const endPoint = this.getRelativePosition(touch.clientX, touch.clientY); - const strokePart = { - startPoint: this.lastTouch.position, - endPoint, - isStart: false, - isEnd: true - }; - this.onStrokePartHandlers.forEach(handler => { - handler(strokePart); - }); - this.lastTouch = null; - this.lastStrokeParts = []; - } - /** - * Removes the current last touch point - * @param e - */ - onTouchCancel(e) { - e.preventDefault(); - this.lastTouch = null; - this.lastStrokeParts = []; - } -} -exports.StrokeManager = StrokeManager; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -class PenTool { - constructor(color = "red", width = 3) { - this.color = color; - this.width = width; - } - /** - * Draws a "pen stroke" for all line segments - * @param ctx - * @param strokeParts - */ - draw(ctx, strokeParts) { - const firstPart = strokeParts[0]; - ctx.beginPath(); - ctx.lineWidth = this.width; - ctx.strokeStyle = this.color; - ctx.lineCap = "round"; - ctx.lineJoin = "round"; - ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y); - strokeParts.forEach(strokePart => { - const { endPoint } = strokePart; - ctx.lineTo(endPoint.x, endPoint.y); - }); - ctx.stroke(); - } -} -exports.PenTool = PenTool; - - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = __webpack_require__(0); -class EraserTool { - constructor(width = 10, handleOpts) { - this.width = width; - this.lastEndPoint = null; - handleOpts = handleOpts || {}; - this.handleOpts = { - hide: handleOpts.hide || false, - strokeWidth: handleOpts.strokeWidth || 2, - fillColor: handleOpts.fillColor || "white", - strokeColor: handleOpts.strokeColor || "black" - }; - } - /** - * Draws an "eraser stroke" for all line segments - * @param ctx - * @param strokeParts - */ - draw(ctx, strokeParts) { - const { handleOpts } = this; - const halfWidth = this.width / 2.0; - strokeParts.forEach(strokePart => { - const { startPoint, endPoint, isEnd } = strokePart; - const length = util_1.getEuclidean(startPoint, endPoint); - const unitVect = util_1.getUnitVector(startPoint, endPoint); - let currentPoint = startPoint; - let i = 0; - // clear all the way along the drag - while (i < length) { - const nextPoint = { - x: currentPoint.x + unitVect.x, - y: currentPoint.y + unitVect.y - }; - ctx.clearRect(nextPoint.x - halfWidth, nextPoint.y - halfWidth, this.width, this.width); - i++; - currentPoint = nextPoint; - } - }); - const lastPart = strokeParts[strokeParts.length - 1]; - // if the end is not the last part, then draw - // the tool indicator at the endpoint - if (!lastPart.isEnd && !handleOpts.hide) { - ctx.strokeStyle = handleOpts.strokeColor; - ctx.fillStyle = handleOpts.fillColor; - ctx.fillRect(lastPart.endPoint.x - halfWidth, lastPart.endPoint.y - halfWidth, this.width, this.width); - ctx.strokeRect(lastPart.endPoint.x - halfWidth + 0.5, lastPart.endPoint.y - halfWidth + 0.5, this.width - 1, this.width - 1); - } - } -} -exports.EraserTool = EraserTool; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const parseColor = __webpack_require__(7); -class HighlighterTool { - constructor(color = "yellow", width = 8, opacity = 0.3) { - this.width = width; - this.lastStrokePart = null; - // calculate rgba color w/ opacity - const { rgb } = parseColor(color); - this.color = `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${opacity})`; - } - /** - * Draws a "highlighter stroke" for all line segments - * @param ctx - * @param strokeParts - */ - draw(ctx, strokeParts) { - const firstPart = strokeParts[0]; - ctx.beginPath(); - ctx.lineWidth = this.width; - ctx.strokeStyle = this.color; - ctx.lineCap = "butt"; - ctx.miterLimit = 1; - ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y); - strokeParts.forEach(strokePart => { - const { endPoint } = strokePart; - ctx.lineTo(endPoint.x, endPoint.y); - }); - ctx.stroke(); - } -} -exports.HighlighterTool = HighlighterTool; - - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - -var convert = __webpack_require__(8); - -module.exports = function (cstr) { - var m, conv, parts, alpha; - if (m = /^((?:rgb|hs[lv]|cmyk|xyz|lab)a?)\s*\(([^\)]*)\)/.exec(cstr)) { - var name = m[1]; - var base = name.replace(/a$/, ''); - var size = base === 'cmyk' ? 4 : 3; - conv = convert[base]; - - parts = m[2].replace(/^\s+|\s+$/g, '') - .split(/\s*,\s*/) - .map(function (x, i) { - if (/%$/.test(x) && i === size) { - return parseFloat(x) / 100; - } - else if (/%$/.test(x)) { - return parseFloat(x); - } - return parseFloat(x); - }) - ; - if (name === base) parts.push(1); - alpha = parts[size] === undefined ? 1 : parts[size]; - parts = parts.slice(0, size); - - conv[base] = function () { return parts }; - } - else if (/^#[A-Fa-f0-9]+$/.test(cstr)) { - var base = cstr.replace(/^#/,''); - var size = base.length; - conv = convert.rgb; - parts = base.split(size === 3 ? /(.)/ : /(..)/); - parts = parts.filter(Boolean) - .map(function (x) { - if (size === 3) { - return parseInt(x + x, 16); - } - else { - return parseInt(x, 16) - } - }) - ; - alpha = 1; - conv.rgb = function () { return parts }; - if (!parts[0]) parts[0] = 0; - if (!parts[1]) parts[1] = 0; - if (!parts[2]) parts[2] = 0; - } - else { - conv = convert.keyword; - conv.keyword = function () { return cstr }; - parts = cstr; - alpha = 1; - } - - var res = { - rgb: undefined, - hsl: undefined, - hsv: undefined, - cmyk: undefined, - keyword: undefined, - hex: undefined - }; - try { res.rgb = conv.rgb(parts) } catch (e) {} - try { res.hsl = conv.hsl(parts) } catch (e) {} - try { res.hsv = conv.hsv(parts) } catch (e) {} - try { res.cmyk = conv.cmyk(parts) } catch (e) {} - try { res.keyword = conv.keyword(parts) } catch (e) {} - - if (res.rgb) res.hex = '#' + res.rgb.map(function (x) { - var s = x.toString(16); - if (s.length === 1) return '0' + s; - return s; - }).join(''); - - if (res.rgb) res.rgba = res.rgb.concat(alpha); - if (res.hsl) res.hsla = res.hsl.concat(alpha); - if (res.hsv) res.hsva = res.hsv.concat(alpha); - if (res.cmyk) res.cmyka = res.cmyk.concat(alpha); - - return res; -}; - - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -var conversions = __webpack_require__(9); - -var convert = function() { - return new Converter(); -} - -for (var func in conversions) { - // export Raw versions - convert[func + "Raw"] = (function(func) { - // accept array or plain args - return function(arg) { - if (typeof arg == "number") - arg = Array.prototype.slice.call(arguments); - return conversions[func](arg); - } - })(func); - - var pair = /(\w+)2(\w+)/.exec(func), - from = pair[1], - to = pair[2]; - - // export rgb2hsl and ["rgb"]["hsl"] - convert[from] = convert[from] || {}; - - convert[from][to] = convert[func] = (function(func) { - return function(arg) { - if (typeof arg == "number") - arg = Array.prototype.slice.call(arguments); - - var val = conversions[func](arg); - if (typeof val == "string" || val === undefined) - return val; // keyword - - for (var i = 0; i < val.length; i++) - val[i] = Math.round(val[i]); - return val; - } - })(func); -} - - -/* Converter does lazy conversion and caching */ -var Converter = function() { - this.convs = {}; -}; - -/* Either get the values for a space or - set the values for a space, depending on args */ -Converter.prototype.routeSpace = function(space, args) { - var values = args[0]; - if (values === undefined) { - // color.rgb() - return this.getValues(space); - } - // color.rgb(10, 10, 10) - if (typeof values == "number") { - values = Array.prototype.slice.call(args); - } - - return this.setValues(space, values); -}; - -/* Set the values for a space, invalidating cache */ -Converter.prototype.setValues = function(space, values) { - this.space = space; - this.convs = {}; - this.convs[space] = values; - return this; -}; - -/* Get the values for a space. If there's already - a conversion for the space, fetch it, otherwise - compute it */ -Converter.prototype.getValues = function(space) { - var vals = this.convs[space]; - if (!vals) { - var fspace = this.space, - from = this.convs[fspace]; - vals = convert[fspace][space](from); - - this.convs[space] = vals; - } - return vals; -}; - -["rgb", "hsl", "hsv", "cmyk", "keyword"].forEach(function(space) { - Converter.prototype[space] = function(vals) { - return this.routeSpace(space, arguments); - } -}); - -module.exports = convert; - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - -/* MIT license */ - -module.exports = { - rgb2hsl: rgb2hsl, - rgb2hsv: rgb2hsv, - rgb2hwb: rgb2hwb, - rgb2cmyk: rgb2cmyk, - rgb2keyword: rgb2keyword, - rgb2xyz: rgb2xyz, - rgb2lab: rgb2lab, - rgb2lch: rgb2lch, - - hsl2rgb: hsl2rgb, - hsl2hsv: hsl2hsv, - hsl2hwb: hsl2hwb, - hsl2cmyk: hsl2cmyk, - hsl2keyword: hsl2keyword, - - hsv2rgb: hsv2rgb, - hsv2hsl: hsv2hsl, - hsv2hwb: hsv2hwb, - hsv2cmyk: hsv2cmyk, - hsv2keyword: hsv2keyword, - - hwb2rgb: hwb2rgb, - hwb2hsl: hwb2hsl, - hwb2hsv: hwb2hsv, - hwb2cmyk: hwb2cmyk, - hwb2keyword: hwb2keyword, - - cmyk2rgb: cmyk2rgb, - cmyk2hsl: cmyk2hsl, - cmyk2hsv: cmyk2hsv, - cmyk2hwb: cmyk2hwb, - cmyk2keyword: cmyk2keyword, - - keyword2rgb: keyword2rgb, - keyword2hsl: keyword2hsl, - keyword2hsv: keyword2hsv, - keyword2hwb: keyword2hwb, - keyword2cmyk: keyword2cmyk, - keyword2lab: keyword2lab, - keyword2xyz: keyword2xyz, - - xyz2rgb: xyz2rgb, - xyz2lab: xyz2lab, - xyz2lch: xyz2lch, - - lab2xyz: lab2xyz, - lab2rgb: lab2rgb, - lab2lch: lab2lch, - - lch2lab: lch2lab, - lch2xyz: lch2xyz, - lch2rgb: lch2rgb -} - - -function rgb2hsl(rgb) { - var r = rgb[0]/255, - g = rgb[1]/255, - b = rgb[2]/255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - delta = max - min, - h, s, l; - - if (max == min) - h = 0; - else if (r == max) - h = (g - b) / delta; - else if (g == max) - h = 2 + (b - r) / delta; - else if (b == max) - h = 4 + (r - g)/ delta; - - h = Math.min(h * 60, 360); - - if (h < 0) - h += 360; - - l = (min + max) / 2; - - if (max == min) - s = 0; - else if (l <= 0.5) - s = delta / (max + min); - else - s = delta / (2 - max - min); - - return [h, s * 100, l * 100]; -} - -function rgb2hsv(rgb) { - var r = rgb[0], - g = rgb[1], - b = rgb[2], - min = Math.min(r, g, b), - max = Math.max(r, g, b), - delta = max - min, - h, s, v; - - if (max == 0) - s = 0; - else - s = (delta/max * 1000)/10; - - if (max == min) - h = 0; - else if (r == max) - h = (g - b) / delta; - else if (g == max) - h = 2 + (b - r) / delta; - else if (b == max) - h = 4 + (r - g) / delta; - - h = Math.min(h * 60, 360); - - if (h < 0) - h += 360; - - v = ((max / 255) * 1000) / 10; - - return [h, s, v]; -} - -function rgb2hwb(rgb) { - var r = rgb[0], - g = rgb[1], - b = rgb[2], - h = rgb2hsl(rgb)[0], - w = 1/255 * Math.min(r, Math.min(g, b)), - b = 1 - 1/255 * Math.max(r, Math.max(g, b)); - - return [h, w * 100, b * 100]; -} - -function rgb2cmyk(rgb) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255, - c, m, y, k; - - k = Math.min(1 - r, 1 - g, 1 - b); - c = (1 - r - k) / (1 - k) || 0; - m = (1 - g - k) / (1 - k) || 0; - y = (1 - b - k) / (1 - k) || 0; - return [c * 100, m * 100, y * 100, k * 100]; -} - -function rgb2keyword(rgb) { - return reverseKeywords[JSON.stringify(rgb)]; -} - -function rgb2xyz(rgb) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255; - - // assume sRGB - r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); - g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); - b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); - - var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); - var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); - var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); - - return [x * 100, y *100, z * 100]; -} - -function rgb2lab(rgb) { - var xyz = rgb2xyz(rgb), - x = xyz[0], - y = xyz[1], - z = xyz[2], - l, a, b; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116); - - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); - - return [l, a, b]; -} - -function rgb2lch(args) { - return lab2lch(rgb2lab(args)); -} - -function hsl2rgb(hsl) { - var h = hsl[0] / 360, - s = hsl[1] / 100, - l = hsl[2] / 100, - t1, t2, t3, rgb, val; - - if (s == 0) { - val = l * 255; - return [val, val, val]; - } - - if (l < 0.5) - t2 = l * (1 + s); - else - t2 = l + s - l * s; - t1 = 2 * l - t2; - - rgb = [0, 0, 0]; - for (var i = 0; i < 3; i++) { - t3 = h + 1 / 3 * - (i - 1); - t3 < 0 && t3++; - t3 > 1 && t3--; - - if (6 * t3 < 1) - val = t1 + (t2 - t1) * 6 * t3; - else if (2 * t3 < 1) - val = t2; - else if (3 * t3 < 2) - val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; - else - val = t1; - - rgb[i] = val * 255; - } - - return rgb; -} - -function hsl2hsv(hsl) { - var h = hsl[0], - s = hsl[1] / 100, - l = hsl[2] / 100, - sv, v; - - if(l === 0) { - // no need to do calc on black - // also avoids divide by 0 error - return [0, 0, 0]; - } - - l *= 2; - s *= (l <= 1) ? l : 2 - l; - v = (l + s) / 2; - sv = (2 * s) / (l + s); - return [h, sv * 100, v * 100]; -} - -function hsl2hwb(args) { - return rgb2hwb(hsl2rgb(args)); -} - -function hsl2cmyk(args) { - return rgb2cmyk(hsl2rgb(args)); -} - -function hsl2keyword(args) { - return rgb2keyword(hsl2rgb(args)); -} - - -function hsv2rgb(hsv) { - var h = hsv[0] / 60, - s = hsv[1] / 100, - v = hsv[2] / 100, - hi = Math.floor(h) % 6; - - var f = h - Math.floor(h), - p = 255 * v * (1 - s), - q = 255 * v * (1 - (s * f)), - t = 255 * v * (1 - (s * (1 - f))), - v = 255 * v; - - switch(hi) { - case 0: - return [v, t, p]; - case 1: - return [q, v, p]; - case 2: - return [p, v, t]; - case 3: - return [p, q, v]; - case 4: - return [t, p, v]; - case 5: - return [v, p, q]; - } -} - -function hsv2hsl(hsv) { - var h = hsv[0], - s = hsv[1] / 100, - v = hsv[2] / 100, - sl, l; - - l = (2 - s) * v; - sl = s * v; - sl /= (l <= 1) ? l : 2 - l; - sl = sl || 0; - l /= 2; - return [h, sl * 100, l * 100]; -} - -function hsv2hwb(args) { - return rgb2hwb(hsv2rgb(args)) -} - -function hsv2cmyk(args) { - return rgb2cmyk(hsv2rgb(args)); -} - -function hsv2keyword(args) { - return rgb2keyword(hsv2rgb(args)); -} - -// http://dev.w3.org/csswg/css-color/#hwb-to-rgb -function hwb2rgb(hwb) { - var h = hwb[0] / 360, - wh = hwb[1] / 100, - bl = hwb[2] / 100, - ratio = wh + bl, - i, v, f, n; - - // wh + bl cant be > 1 - if (ratio > 1) { - wh /= ratio; - bl /= ratio; - } - - i = Math.floor(6 * h); - v = 1 - bl; - f = 6 * h - i; - if ((i & 0x01) != 0) { - f = 1 - f; - } - n = wh + f * (v - wh); // linear interpolation - - switch (i) { - default: - case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; - } - - return [r * 255, g * 255, b * 255]; -} - -function hwb2hsl(args) { - return rgb2hsl(hwb2rgb(args)); -} - -function hwb2hsv(args) { - return rgb2hsv(hwb2rgb(args)); -} - -function hwb2cmyk(args) { - return rgb2cmyk(hwb2rgb(args)); -} - -function hwb2keyword(args) { - return rgb2keyword(hwb2rgb(args)); -} - -function cmyk2rgb(cmyk) { - var c = cmyk[0] / 100, - m = cmyk[1] / 100, - y = cmyk[2] / 100, - k = cmyk[3] / 100, - r, g, b; - - r = 1 - Math.min(1, c * (1 - k) + k); - g = 1 - Math.min(1, m * (1 - k) + k); - b = 1 - Math.min(1, y * (1 - k) + k); - return [r * 255, g * 255, b * 255]; -} - -function cmyk2hsl(args) { - return rgb2hsl(cmyk2rgb(args)); -} - -function cmyk2hsv(args) { - return rgb2hsv(cmyk2rgb(args)); -} - -function cmyk2hwb(args) { - return rgb2hwb(cmyk2rgb(args)); -} - -function cmyk2keyword(args) { - return rgb2keyword(cmyk2rgb(args)); -} - - -function xyz2rgb(xyz) { - var x = xyz[0] / 100, - y = xyz[1] / 100, - z = xyz[2] / 100, - r, g, b; - - r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); - g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); - b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); - - // assume sRGB - r = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) - : r = (r * 12.92); - - g = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) - : g = (g * 12.92); - - b = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) - : b = (b * 12.92); - - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); - - return [r * 255, g * 255, b * 255]; -} - -function xyz2lab(xyz) { - var x = xyz[0], - y = xyz[1], - z = xyz[2], - l, a, b; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116); - - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); - - return [l, a, b]; -} - -function xyz2lch(args) { - return lab2lch(xyz2lab(args)); -} - -function lab2xyz(lab) { - var l = lab[0], - a = lab[1], - b = lab[2], - x, y, z, y2; - - if (l <= 8) { - y = (l * 100) / 903.3; - y2 = (7.787 * (y / 100)) + (16 / 116); - } else { - y = 100 * Math.pow((l + 16) / 116, 3); - y2 = Math.pow(y / 100, 1/3); - } - - x = x / 95.047 <= 0.008856 ? x = (95.047 * ((a / 500) + y2 - (16 / 116))) / 7.787 : 95.047 * Math.pow((a / 500) + y2, 3); - - z = z / 108.883 <= 0.008859 ? z = (108.883 * (y2 - (b / 200) - (16 / 116))) / 7.787 : 108.883 * Math.pow(y2 - (b / 200), 3); - - return [x, y, z]; -} - -function lab2lch(lab) { - var l = lab[0], - a = lab[1], - b = lab[2], - hr, h, c; - - hr = Math.atan2(b, a); - h = hr * 360 / 2 / Math.PI; - if (h < 0) { - h += 360; - } - c = Math.sqrt(a * a + b * b); - return [l, c, h]; -} - -function lab2rgb(args) { - return xyz2rgb(lab2xyz(args)); -} - -function lch2lab(lch) { - var l = lch[0], - c = lch[1], - h = lch[2], - a, b, hr; - - hr = h / 360 * 2 * Math.PI; - a = c * Math.cos(hr); - b = c * Math.sin(hr); - return [l, a, b]; -} - -function lch2xyz(args) { - return lab2xyz(lch2lab(args)); -} - -function lch2rgb(args) { - return lab2rgb(lch2lab(args)); -} - -function keyword2rgb(keyword) { - return cssKeywords[keyword]; -} - -function keyword2hsl(args) { - return rgb2hsl(keyword2rgb(args)); -} - -function keyword2hsv(args) { - return rgb2hsv(keyword2rgb(args)); -} - -function keyword2hwb(args) { - return rgb2hwb(keyword2rgb(args)); -} - -function keyword2cmyk(args) { - return rgb2cmyk(keyword2rgb(args)); -} - -function keyword2lab(args) { - return rgb2lab(keyword2rgb(args)); -} - -function keyword2xyz(args) { - return rgb2xyz(keyword2rgb(args)); -} - -var cssKeywords = { - aliceblue: [240,248,255], - antiquewhite: [250,235,215], - aqua: [0,255,255], - aquamarine: [127,255,212], - azure: [240,255,255], - beige: [245,245,220], - bisque: [255,228,196], - black: [0,0,0], - blanchedalmond: [255,235,205], - blue: [0,0,255], - blueviolet: [138,43,226], - brown: [165,42,42], - burlywood: [222,184,135], - cadetblue: [95,158,160], - chartreuse: [127,255,0], - chocolate: [210,105,30], - coral: [255,127,80], - cornflowerblue: [100,149,237], - cornsilk: [255,248,220], - crimson: [220,20,60], - cyan: [0,255,255], - darkblue: [0,0,139], - darkcyan: [0,139,139], - darkgoldenrod: [184,134,11], - darkgray: [169,169,169], - darkgreen: [0,100,0], - darkgrey: [169,169,169], - darkkhaki: [189,183,107], - darkmagenta: [139,0,139], - darkolivegreen: [85,107,47], - darkorange: [255,140,0], - darkorchid: [153,50,204], - darkred: [139,0,0], - darksalmon: [233,150,122], - darkseagreen: [143,188,143], - darkslateblue: [72,61,139], - darkslategray: [47,79,79], - darkslategrey: [47,79,79], - darkturquoise: [0,206,209], - darkviolet: [148,0,211], - deeppink: [255,20,147], - deepskyblue: [0,191,255], - dimgray: [105,105,105], - dimgrey: [105,105,105], - dodgerblue: [30,144,255], - firebrick: [178,34,34], - floralwhite: [255,250,240], - forestgreen: [34,139,34], - fuchsia: [255,0,255], - gainsboro: [220,220,220], - ghostwhite: [248,248,255], - gold: [255,215,0], - goldenrod: [218,165,32], - gray: [128,128,128], - green: [0,128,0], - greenyellow: [173,255,47], - grey: [128,128,128], - honeydew: [240,255,240], - hotpink: [255,105,180], - indianred: [205,92,92], - indigo: [75,0,130], - ivory: [255,255,240], - khaki: [240,230,140], - lavender: [230,230,250], - lavenderblush: [255,240,245], - lawngreen: [124,252,0], - lemonchiffon: [255,250,205], - lightblue: [173,216,230], - lightcoral: [240,128,128], - lightcyan: [224,255,255], - lightgoldenrodyellow: [250,250,210], - lightgray: [211,211,211], - lightgreen: [144,238,144], - lightgrey: [211,211,211], - lightpink: [255,182,193], - lightsalmon: [255,160,122], - lightseagreen: [32,178,170], - lightskyblue: [135,206,250], - lightslategray: [119,136,153], - lightslategrey: [119,136,153], - lightsteelblue: [176,196,222], - lightyellow: [255,255,224], - lime: [0,255,0], - limegreen: [50,205,50], - linen: [250,240,230], - magenta: [255,0,255], - maroon: [128,0,0], - mediumaquamarine: [102,205,170], - mediumblue: [0,0,205], - mediumorchid: [186,85,211], - mediumpurple: [147,112,219], - mediumseagreen: [60,179,113], - mediumslateblue: [123,104,238], - mediumspringgreen: [0,250,154], - mediumturquoise: [72,209,204], - mediumvioletred: [199,21,133], - midnightblue: [25,25,112], - mintcream: [245,255,250], - mistyrose: [255,228,225], - moccasin: [255,228,181], - navajowhite: [255,222,173], - navy: [0,0,128], - oldlace: [253,245,230], - olive: [128,128,0], - olivedrab: [107,142,35], - orange: [255,165,0], - orangered: [255,69,0], - orchid: [218,112,214], - palegoldenrod: [238,232,170], - palegreen: [152,251,152], - paleturquoise: [175,238,238], - palevioletred: [219,112,147], - papayawhip: [255,239,213], - peachpuff: [255,218,185], - peru: [205,133,63], - pink: [255,192,203], - plum: [221,160,221], - powderblue: [176,224,230], - purple: [128,0,128], - rebeccapurple: [102, 51, 153], - red: [255,0,0], - rosybrown: [188,143,143], - royalblue: [65,105,225], - saddlebrown: [139,69,19], - salmon: [250,128,114], - sandybrown: [244,164,96], - seagreen: [46,139,87], - seashell: [255,245,238], - sienna: [160,82,45], - silver: [192,192,192], - skyblue: [135,206,235], - slateblue: [106,90,205], - slategray: [112,128,144], - slategrey: [112,128,144], - snow: [255,250,250], - springgreen: [0,255,127], - steelblue: [70,130,180], - tan: [210,180,140], - teal: [0,128,128], - thistle: [216,191,216], - tomato: [255,99,71], - turquoise: [64,224,208], - violet: [238,130,238], - wheat: [245,222,179], - white: [255,255,255], - whitesmoke: [245,245,245], - yellow: [255,255,0], - yellowgreen: [154,205,50] -}; - -var reverseKeywords = {}; -for (var key in cssKeywords) { - reverseKeywords[JSON.stringify(cssKeywords[key])] = key; -} - - -/***/ }) -/******/ ]); -}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/index.js.map b/lib/index.js.map deleted file mode 100644 index 5b0d1a7..0000000 --- a/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap ba9999905dc0e382e67c","webpack:///./src/util.ts","webpack:///./src/index.ts","webpack:///./src/Manager.ts","webpack:///./src/StrokeManager.ts","webpack:///./src/tools/PenTool.ts","webpack:///./src/tools/EraserTool.ts","webpack:///./src/tools/HighlighterTool.ts","webpack:///./node_modules/parse-color/index.js","webpack:///./node_modules/color-convert/index.js","webpack:///./node_modules/color-convert/conversions.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA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AAQ,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;CACF;AA1CD,0CA0CC;;;;;;;AC/CD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,SAAS,8BAA8B;AACvC,SAAS,oCAAoC;;AAE7C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;;;;;;AClFA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA,uD;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB;;AAEnB,qBAAqB,gBAAgB;AACrC;AACA;AACA;AACA,GAAG;AACH;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED,yB;;;;;;AC3FA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;;AAExB;AACA;AACA;AACA,kBAAkB,OAAO,QAAQ;AACjC,kBAAkB,OAAO,QAAQ;AACjC,mBAAmB,OAAO,OAAO;AACjC,mBAAmB,OAAO,OAAO;AACjC,kBAAkB,QAAQ,OAAO;AACjC,kBAAkB,QAAQ,OAAO;AACjC;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Paintbricks\"] = factory();\n\telse\n\t\troot[\"Paintbricks\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ba9999905dc0e382e67c","import { IPoint } from \"./types\";\n\n/**\n * Get the distance between two points\n * @param p1\n * @param p2\n * @returns number\n */\nexport function getEuclidean(p1: IPoint, p2: IPoint): number {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n}\n\n/**\n * Gets the unit vector representing the vector from start\n * point to end point with a length of 1.\n * @param startPoint\n * @param endPoint\n * @returns IPoint\n */\nexport function getUnitVector(startPoint: IPoint, endPoint: IPoint): IPoint {\n const length = this.getEuclidean(startPoint, endPoint);\n\n const dirVect = {\n x: endPoint.x - startPoint.x,\n y: endPoint.y - startPoint.y\n };\n\n const unitVect: IPoint = {\n x: dirVect.x / length,\n y: dirVect.y / length\n };\n\n return unitVect;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/util.ts","export { Manager } from \"./Manager\";\nexport { PenTool } from \"./tools/PenTool\";\nexport { EraserTool } from \"./tools/EraserTool\";\nexport { HighlighterTool } from \"./tools/HighlighterTool\";\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts","import { IPoint, IStrokePart, ITool } from \"./types\";\nimport { StrokeManager } from \"./StrokeManager\";\n\nexport class Manager {\n // reference to the canvas\n private canvas: HTMLCanvasElement;\n // reference to stroke manager\n private strokeManager: StrokeManager;\n // holds the pixel ratio between canvas backing\n // store and device ratio (used for hi fi displays)\n private pixelRatio: number;\n // the width of the canvas\n private canvasWidth: number;\n // the height of the canvas\n private canvasHeight: number;\n // holds a reference to next animation frame\n private nextAnimationFrame: number;\n // the currently selected tool\n private currentTool: ITool | null;\n // holds stroke parts for ongoing stroke\n private currentStroke: IStrokePart[];\n // the state of the canvas (not including ongoing stroke)\n private canvasState: ImageData | null;\n // indicates whether changes have occured that require redraw\n private shouldDraw: boolean;\n // indicates whether canvas should commit its next draw state to current state\n private shouldCommit: boolean;\n\n constructor(\n canvas: HTMLCanvasElement,\n canvasWidth: number,\n canvasHeight: number\n ) {\n this.canvas = canvas;\n this.canvasWidth = canvasWidth;\n this.canvasHeight = canvasHeight;\n this.currentTool = null;\n this.currentStroke = [];\n this.strokeManager = new StrokeManager(canvas);\n this.canvasState = null;\n this.shouldDraw = false;\n this.shouldCommit = false;\n\n // find pixel ratio relative to backing store and device ratio\n const bsr = (canvas.getContext(\"2d\") as any).backingStorePixelRatio || 1;\n const dpr = window.devicePixelRatio || 1;\n this.pixelRatio = dpr / bsr;\n\n this.setCanvasSize = this.setCanvasSize.bind(this);\n this.setTool = this.setTool.bind(this);\n this.destroy = this.destroy.bind(this);\n this.clear = this.clear.bind(this);\n this.draw = this.draw.bind(this);\n this.onStrokePart = this.onStrokePart.bind(this);\n\n // schedule animation frame loop\n this.nextAnimationFrame = window.requestAnimationFrame(this.draw);\n // set up listener for new stroke part\n this.strokeManager.onStrokePart(this.onStrokePart);\n\n this.setCanvasSize(canvasWidth, canvasHeight);\n }\n\n /**\n * Sets the canvas desired width and height and sets transform\n * for hifi displays\n * @param width\n * @param height\n */\n public setCanvasSize(width: number, height: number): void {\n this.canvasWidth = width;\n this.canvasHeight = height;\n\n const { canvas, canvasWidth, canvasHeight, pixelRatio } = this;\n\n const ctx = canvas.getContext(\"2d\");\n\n // appropriately scale canvas to map to device ratio\n canvas.width = canvasWidth * pixelRatio;\n canvas.height = canvasHeight * pixelRatio;\n canvas.style.width = canvasWidth + \"px\";\n canvas.style.height = canvasHeight + \"px\";\n ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n }\n\n /**\n * Sets the current tool for the manager\n * @param tool\n */\n public setTool(tool: ITool): void {\n this.currentTool = tool;\n }\n\n /**\n * Remove all event listeners\n */\n public destroy(): void {\n // cancel animation loop\n window.cancelAnimationFrame(this.nextAnimationFrame);\n // remove all listeners on stroke manager\n this.strokeManager.destroy();\n }\n\n /**\n * Clears the canvas\n */\n public clear(): void {\n this.canvasState = null;\n this.currentStroke = [];\n this.shouldDraw = true;\n this.shouldCommit = true;\n }\n\n /**\n * Adds a new stroke part to the nextStrokes\n * array\n * @param strokePart\n */\n private onStrokePart(strokePart: IStrokePart): void {\n this.currentStroke.push(strokePart);\n\n this.shouldDraw = true;\n\n if (strokePart.isEnd) {\n this.shouldCommit = true;\n }\n }\n\n /**\n * Draws a frame\n */\n private draw(): void {\n // schedule next draw\n this.nextAnimationFrame = window.requestAnimationFrame(this.draw);\n\n const ctx = this.canvas.getContext(\"2d\");\n\n if (!this.shouldDraw) {\n return;\n }\n\n // clear canvas\n ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);\n\n // draw current state\n if (this.canvasState) {\n ctx.putImageData(this.canvasState, 0, 0);\n }\n\n // if a tool has been selected and there are\n // pending strokes, draw them\n if (this.currentTool && this.currentStroke.length) {\n ctx.save();\n this.currentTool.draw(ctx, this.currentStroke);\n ctx.restore();\n }\n\n // if all changes have been made for current stroke,\n // save it as the new canvas state\n if (this.shouldCommit) {\n this.canvasState = ctx.getImageData(\n 0,\n 0,\n this.canvasWidth * this.pixelRatio,\n this.canvasHeight * this.pixelRatio\n );\n this.currentStroke = [];\n this.shouldCommit = false;\n }\n\n this.shouldDraw = false;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Manager.ts","import { IPoint, IStrokePart } from \"./types\";\nimport { getEuclidean } from \"./util\";\n\nexport interface IOnStrokePartHandler {\n (strokePart: IStrokePart): void;\n}\n\nexport interface ITouch {\n id: number;\n position: IPoint;\n}\n\nexport class StrokeManager {\n // reference to canvas element\n private canvas: HTMLCanvasElement;\n // holds last touch point in a drag\n private lastTouch: ITouch | null;\n // value indicates how sensitive the stroke detection is higher is better\n private sensitivity: number;\n // holds all of the last emitted stroke parts in a drag\n private lastStrokeParts: IStrokePart[];\n // the handlers listening for new strokes\n private onStrokePartHandlers: IOnStrokePartHandler[];\n\n constructor(canvas: HTMLCanvasElement) {\n this.canvas = canvas;\n this.lastTouch = null;\n this.sensitivity = 20.0;\n this.lastStrokeParts = [];\n this.onStrokePartHandlers = [];\n\n this.onTouchStart = this.onTouchStart.bind(this);\n this.onTouchEnd = this.onTouchEnd.bind(this);\n this.onTouchCancel = this.onTouchCancel.bind(this);\n this.onTouchMove = this.onTouchMove.bind(this);\n this.destroy = this.destroy.bind(this);\n this.getRelativePosition = this.getRelativePosition.bind(this);\n\n this.canvas.addEventListener(\"touchstart\", this.onTouchStart, {\n passive: false\n });\n this.canvas.addEventListener(\"touchend\", this.onTouchEnd, {\n passive: false\n });\n this.canvas.addEventListener(\"touchcancel\", this.onTouchCancel, {\n passive: false\n });\n this.canvas.addEventListener(\"touchmove\", this.onTouchMove, {\n passive: false\n });\n }\n\n /**\n * Registers a handler to be fired on a new stroke part\n * @param handler\n */\n public onStrokePart(handler: IOnStrokePartHandler): void {\n this.onStrokePartHandlers.push(handler);\n }\n\n /**\n * Removes all active listeners\n */\n public destroy(): void {\n this.onStrokePartHandlers = [];\n this.lastStrokeParts = [];\n this.canvas.removeEventListener(\"touchstart\", this.onTouchStart);\n this.canvas.removeEventListener(\"touchend\", this.onTouchEnd);\n this.canvas.removeEventListener(\"touchcancel\", this.onTouchCancel);\n this.canvas.removeEventListener(\"touchmove\", this.onTouchMove);\n }\n\n /**\n * Get relative position to canvas\n * @param clientX\n * @param clientY\n * @returns IPoint\n */\n private getRelativePosition(clientX: number, clientY: number): IPoint {\n const rect = this.canvas.getBoundingClientRect();\n\n return {\n x: clientX - rect.left,\n y: clientY - rect.top\n };\n }\n\n /**\n * Creates a new touch if one does not\n * already exist\n * @param e\n */\n private onTouchStart(e: TouchEvent): void {\n e.preventDefault();\n\n // if there is an ongoing touch, ignore this event\n if (this.lastTouch) {\n return;\n }\n\n const touches: TouchList = e.changedTouches;\n\n // only get the first touch\n const touch = touches.item(0);\n\n // save the touch\n this.lastTouch = {\n id: touch.identifier,\n position: this.getRelativePosition(touch.clientX, touch.clientY)\n };\n }\n\n /**\n * Creates a line from last touch to current touch\n * point and emits event. Does no-op if no existing touch\n * @param e\n */\n private onTouchMove(e: TouchEvent): void {\n e.preventDefault();\n\n // if no last touch... something is wrong\n if (!this.lastTouch) {\n return;\n }\n\n const touches: TouchList = e.changedTouches;\n\n // find the current touch we are tracking\n const touch: Touch = Array.from(touches).find(touch => {\n return touch.identifier === this.lastTouch.id;\n });\n\n // if the touch was not one we were tracking,\n // ignore and no-op\n if (!touch) {\n return;\n }\n\n const nextTouch: ITouch = {\n id: touch.identifier,\n position: this.getRelativePosition(touch.clientX, touch.clientY)\n };\n\n // If sensitivity setting has been set,\n // check if this point is far enough from last\n // touch to be drawn\n if (\n this.sensitivity &&\n getEuclidean(nextTouch.position, this.lastTouch.position) <\n 10.0 / this.sensitivity\n ) {\n return;\n }\n\n const strokePart: IStrokePart = {\n endPoint: nextTouch.position,\n startPoint: this.lastTouch.position,\n isStart: this.lastStrokeParts.length === 0,\n isEnd: false\n };\n\n this.onStrokePartHandlers.forEach(handler => {\n handler(strokePart);\n });\n\n // save this touch as last touch\n this.lastTouch = nextTouch;\n this.lastStrokeParts.push(strokePart);\n }\n\n /**\n * Draws a line from last point to final point. Removes\n * the reference to last touch point.\n * @param e\n */\n private onTouchEnd(e: TouchEvent): void {\n e.preventDefault();\n\n // if no last touch... something is wrong\n if (!this.lastTouch) {\n return;\n }\n\n const touches: TouchList = e.changedTouches;\n\n // find the current touch we are tracking\n const touch: Touch = Array.from(touches).find(touch => {\n return touch.identifier === this.lastTouch.id;\n });\n\n // if the touch was not one we were tracking,\n // ignore and no-op\n if (!touch) {\n return;\n }\n\n const endPoint = this.getRelativePosition(touch.clientX, touch.clientY);\n\n const strokePart: IStrokePart = {\n startPoint: this.lastTouch.position,\n endPoint,\n isStart: false,\n isEnd: true\n };\n\n this.onStrokePartHandlers.forEach(handler => {\n handler(strokePart);\n });\n\n this.lastTouch = null;\n this.lastStrokeParts = [];\n }\n\n /**\n * Removes the current last touch point\n * @param e\n */\n private onTouchCancel(e: TouchEvent): void {\n e.preventDefault();\n this.lastTouch = null;\n this.lastStrokeParts = [];\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/StrokeManager.ts","import { IStrokePart } from \"../types\";\n\nexport class PenTool {\n readonly color: string;\n readonly width: number;\n\n constructor(color: string = \"red\", width: number = 3) {\n this.color = color;\n this.width = width;\n }\n\n /**\n * Draws a \"pen stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\n const firstPart = strokeParts[0];\n\n ctx.beginPath();\n\n ctx.lineWidth = this.width;\n ctx.strokeStyle = this.color;\n ctx.lineCap = \"round\";\n ctx.lineJoin = \"round\";\n\n ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y);\n\n strokeParts.forEach(strokePart => {\n const { endPoint } = strokePart;\n ctx.lineTo(endPoint.x, endPoint.y);\n });\n\n ctx.stroke();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/tools/PenTool.ts","import { IStrokePart, IPoint } from \"../types\";\nimport { getUnitVector, getEuclidean } from \"../util\";\n\nexport interface IHandleOptions {\n hide: boolean;\n strokeWidth: number;\n fillColor: string;\n strokeColor: string;\n}\n\nexport class EraserTool {\n readonly width: number;\n readonly handleOpts: IHandleOptions;\n private lastEndPoint: IPoint | null;\n\n constructor(width: number = 10, handleOpts?: Partial) {\n this.width = width;\n this.lastEndPoint = null;\n\n handleOpts = handleOpts || {};\n\n this.handleOpts = {\n hide: handleOpts.hide || false,\n strokeWidth: handleOpts.strokeWidth || 2,\n fillColor: handleOpts.fillColor || \"white\",\n strokeColor: handleOpts.strokeColor || \"black\"\n };\n }\n\n /**\n * Draws an \"eraser stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\n const { handleOpts } = this;\n const halfWidth = this.width / 2.0;\n\n strokeParts.forEach(strokePart => {\n const { startPoint, endPoint, isEnd } = strokePart;\n\n const length = getEuclidean(startPoint, endPoint);\n const unitVect: IPoint = getUnitVector(startPoint, endPoint);\n let currentPoint: IPoint = startPoint;\n let i = 0;\n\n // clear all the way along the drag\n while (i < length) {\n const nextPoint: IPoint = {\n x: currentPoint.x + unitVect.x,\n y: currentPoint.y + unitVect.y\n };\n\n ctx.clearRect(\n nextPoint.x - halfWidth,\n nextPoint.y - halfWidth,\n this.width,\n this.width\n );\n\n i++;\n currentPoint = nextPoint;\n }\n });\n\n const lastPart = strokeParts[strokeParts.length - 1];\n\n // if the end is not the last part, then draw\n // the tool indicator at the endpoint\n if (!lastPart.isEnd && !handleOpts.hide) {\n ctx.strokeStyle = handleOpts.strokeColor;\n ctx.fillStyle = handleOpts.fillColor;\n\n ctx.fillRect(\n lastPart.endPoint.x - halfWidth,\n lastPart.endPoint.y - halfWidth,\n this.width,\n this.width\n );\n\n ctx.strokeRect(\n lastPart.endPoint.x - halfWidth + 0.5,\n lastPart.endPoint.y - halfWidth + 0.5,\n this.width - 1,\n this.width - 1\n );\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/tools/EraserTool.ts","import * as parseColor from \"parse-color\";\n\nimport { IStrokePart, IPoint } from \"../types\";\nimport { getUnitVector, getEuclidean } from \"../util\";\n\nexport class HighlighterTool {\n readonly color: string;\n readonly width: number;\n private lastStrokePart: IStrokePart | null;\n\n constructor(\n color: string = \"yellow\",\n width: number = 8,\n opacity: Number = 0.3\n ) {\n this.width = width;\n this.lastStrokePart = null;\n\n // calculate rgba color w/ opacity\n const { rgb } = parseColor(color);\n this.color = `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${opacity})`;\n }\n\n /**\n * Draws a \"highlighter stroke\" for all line segments\n * @param ctx\n * @param strokeParts\n */\n public draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void {\n const firstPart = strokeParts[0];\n\n ctx.beginPath();\n\n ctx.lineWidth = this.width;\n ctx.strokeStyle = this.color;\n ctx.lineCap = \"butt\";\n ctx.miterLimit = 1;\n\n ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y);\n\n strokeParts.forEach(strokePart => {\n const { endPoint } = strokePart;\n ctx.lineTo(endPoint.x, endPoint.y);\n });\n\n ctx.stroke();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/tools/HighlighterTool.ts","var convert = require('color-convert');\n\nmodule.exports = function (cstr) {\n var m, conv, parts, alpha;\n if (m = /^((?:rgb|hs[lv]|cmyk|xyz|lab)a?)\\s*\\(([^\\)]*)\\)/.exec(cstr)) {\n var name = m[1];\n var base = name.replace(/a$/, '');\n var size = base === 'cmyk' ? 4 : 3;\n conv = convert[base];\n \n parts = m[2].replace(/^\\s+|\\s+$/g, '')\n .split(/\\s*,\\s*/)\n .map(function (x, i) {\n if (/%$/.test(x) && i === size) {\n return parseFloat(x) / 100;\n }\n else if (/%$/.test(x)) {\n return parseFloat(x);\n }\n return parseFloat(x);\n })\n ;\n if (name === base) parts.push(1);\n alpha = parts[size] === undefined ? 1 : parts[size];\n parts = parts.slice(0, size);\n \n conv[base] = function () { return parts };\n }\n else if (/^#[A-Fa-f0-9]+$/.test(cstr)) {\n var base = cstr.replace(/^#/,'');\n var size = base.length;\n conv = convert.rgb;\n parts = base.split(size === 3 ? /(.)/ : /(..)/);\n parts = parts.filter(Boolean)\n .map(function (x) {\n if (size === 3) {\n return parseInt(x + x, 16);\n }\n else {\n return parseInt(x, 16)\n }\n })\n ;\n alpha = 1;\n conv.rgb = function () { return parts };\n if (!parts[0]) parts[0] = 0;\n if (!parts[1]) parts[1] = 0;\n if (!parts[2]) parts[2] = 0;\n }\n else {\n conv = convert.keyword;\n conv.keyword = function () { return cstr };\n parts = cstr;\n alpha = 1;\n }\n \n var res = {\n rgb: undefined,\n hsl: undefined,\n hsv: undefined,\n cmyk: undefined,\n keyword: undefined,\n hex: undefined\n };\n try { res.rgb = conv.rgb(parts) } catch (e) {}\n try { res.hsl = conv.hsl(parts) } catch (e) {}\n try { res.hsv = conv.hsv(parts) } catch (e) {}\n try { res.cmyk = conv.cmyk(parts) } catch (e) {}\n try { res.keyword = conv.keyword(parts) } catch (e) {}\n \n if (res.rgb) res.hex = '#' + res.rgb.map(function (x) {\n var s = x.toString(16);\n if (s.length === 1) return '0' + s;\n return s;\n }).join('');\n \n if (res.rgb) res.rgba = res.rgb.concat(alpha);\n if (res.hsl) res.hsla = res.hsl.concat(alpha);\n if (res.hsv) res.hsva = res.hsv.concat(alpha);\n if (res.cmyk) res.cmyka = res.cmyk.concat(alpha);\n \n return res;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/parse-color/index.js\n// module id = 7\n// module chunks = 0","var conversions = require(\"./conversions\");\n\nvar convert = function() {\n return new Converter();\n}\n\nfor (var func in conversions) {\n // export Raw versions\n convert[func + \"Raw\"] = (function(func) {\n // accept array or plain args\n return function(arg) {\n if (typeof arg == \"number\")\n arg = Array.prototype.slice.call(arguments);\n return conversions[func](arg);\n }\n })(func);\n\n var pair = /(\\w+)2(\\w+)/.exec(func),\n from = pair[1],\n to = pair[2];\n\n // export rgb2hsl and [\"rgb\"][\"hsl\"]\n convert[from] = convert[from] || {};\n\n convert[from][to] = convert[func] = (function(func) { \n return function(arg) {\n if (typeof arg == \"number\")\n arg = Array.prototype.slice.call(arguments);\n \n var val = conversions[func](arg);\n if (typeof val == \"string\" || val === undefined)\n return val; // keyword\n\n for (var i = 0; i < val.length; i++)\n val[i] = Math.round(val[i]);\n return val;\n }\n })(func);\n}\n\n\n/* Converter does lazy conversion and caching */\nvar Converter = function() {\n this.convs = {};\n};\n\n/* Either get the values for a space or\n set the values for a space, depending on args */\nConverter.prototype.routeSpace = function(space, args) {\n var values = args[0];\n if (values === undefined) {\n // color.rgb()\n return this.getValues(space);\n }\n // color.rgb(10, 10, 10)\n if (typeof values == \"number\") {\n values = Array.prototype.slice.call(args); \n }\n\n return this.setValues(space, values);\n};\n \n/* Set the values for a space, invalidating cache */\nConverter.prototype.setValues = function(space, values) {\n this.space = space;\n this.convs = {};\n this.convs[space] = values;\n return this;\n};\n\n/* Get the values for a space. If there's already\n a conversion for the space, fetch it, otherwise\n compute it */\nConverter.prototype.getValues = function(space) {\n var vals = this.convs[space];\n if (!vals) {\n var fspace = this.space,\n from = this.convs[fspace];\n vals = convert[fspace][space](from);\n\n this.convs[space] = vals;\n }\n return vals;\n};\n\n[\"rgb\", \"hsl\", \"hsv\", \"cmyk\", \"keyword\"].forEach(function(space) {\n Converter.prototype[space] = function(vals) {\n return this.routeSpace(space, arguments);\n }\n});\n\nmodule.exports = convert;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/color-convert/index.js\n// module id = 8\n// module chunks = 0","/* MIT license */\n\nmodule.exports = {\n rgb2hsl: rgb2hsl,\n rgb2hsv: rgb2hsv,\n rgb2hwb: rgb2hwb,\n rgb2cmyk: rgb2cmyk,\n rgb2keyword: rgb2keyword,\n rgb2xyz: rgb2xyz,\n rgb2lab: rgb2lab,\n rgb2lch: rgb2lch,\n\n hsl2rgb: hsl2rgb,\n hsl2hsv: hsl2hsv,\n hsl2hwb: hsl2hwb,\n hsl2cmyk: hsl2cmyk,\n hsl2keyword: hsl2keyword,\n\n hsv2rgb: hsv2rgb,\n hsv2hsl: hsv2hsl,\n hsv2hwb: hsv2hwb,\n hsv2cmyk: hsv2cmyk,\n hsv2keyword: hsv2keyword,\n\n hwb2rgb: hwb2rgb,\n hwb2hsl: hwb2hsl,\n hwb2hsv: hwb2hsv,\n hwb2cmyk: hwb2cmyk,\n hwb2keyword: hwb2keyword,\n\n cmyk2rgb: cmyk2rgb,\n cmyk2hsl: cmyk2hsl,\n cmyk2hsv: cmyk2hsv,\n cmyk2hwb: cmyk2hwb,\n cmyk2keyword: cmyk2keyword,\n\n keyword2rgb: keyword2rgb,\n keyword2hsl: keyword2hsl,\n keyword2hsv: keyword2hsv,\n keyword2hwb: keyword2hwb,\n keyword2cmyk: keyword2cmyk,\n keyword2lab: keyword2lab,\n keyword2xyz: keyword2xyz,\n\n xyz2rgb: xyz2rgb,\n xyz2lab: xyz2lab,\n xyz2lch: xyz2lch,\n\n lab2xyz: lab2xyz,\n lab2rgb: lab2rgb,\n lab2lch: lab2lch,\n\n lch2lab: lch2lab,\n lch2xyz: lch2xyz,\n lch2rgb: lch2rgb\n}\n\n\nfunction rgb2hsl(rgb) {\n var r = rgb[0]/255,\n g = rgb[1]/255,\n b = rgb[2]/255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n delta = max - min,\n h, s, l;\n\n if (max == min)\n h = 0;\n else if (r == max)\n h = (g - b) / delta;\n else if (g == max)\n h = 2 + (b - r) / delta;\n else if (b == max)\n h = 4 + (r - g)/ delta;\n\n h = Math.min(h * 60, 360);\n\n if (h < 0)\n h += 360;\n\n l = (min + max) / 2;\n\n if (max == min)\n s = 0;\n else if (l <= 0.5)\n s = delta / (max + min);\n else\n s = delta / (2 - max - min);\n\n return [h, s * 100, l * 100];\n}\n\nfunction rgb2hsv(rgb) {\n var r = rgb[0],\n g = rgb[1],\n b = rgb[2],\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n delta = max - min,\n h, s, v;\n\n if (max == 0)\n s = 0;\n else\n s = (delta/max * 1000)/10;\n\n if (max == min)\n h = 0;\n else if (r == max)\n h = (g - b) / delta;\n else if (g == max)\n h = 2 + (b - r) / delta;\n else if (b == max)\n h = 4 + (r - g) / delta;\n\n h = Math.min(h * 60, 360);\n\n if (h < 0)\n h += 360;\n\n v = ((max / 255) * 1000) / 10;\n\n return [h, s, v];\n}\n\nfunction rgb2hwb(rgb) {\n var r = rgb[0],\n g = rgb[1],\n b = rgb[2],\n h = rgb2hsl(rgb)[0],\n w = 1/255 * Math.min(r, Math.min(g, b)),\n b = 1 - 1/255 * Math.max(r, Math.max(g, b));\n\n return [h, w * 100, b * 100];\n}\n\nfunction rgb2cmyk(rgb) {\n var r = rgb[0] / 255,\n g = rgb[1] / 255,\n b = rgb[2] / 255,\n c, m, y, k;\n\n k = Math.min(1 - r, 1 - g, 1 - b);\n c = (1 - r - k) / (1 - k) || 0;\n m = (1 - g - k) / (1 - k) || 0;\n y = (1 - b - k) / (1 - k) || 0;\n return [c * 100, m * 100, y * 100, k * 100];\n}\n\nfunction rgb2keyword(rgb) {\n return reverseKeywords[JSON.stringify(rgb)];\n}\n\nfunction rgb2xyz(rgb) {\n var r = rgb[0] / 255,\n g = rgb[1] / 255,\n b = rgb[2] / 255;\n\n // assume sRGB\n r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);\n g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);\n b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);\n\n var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n return [x * 100, y *100, z * 100];\n}\n\nfunction rgb2lab(rgb) {\n var xyz = rgb2xyz(rgb),\n x = xyz[0],\n y = xyz[1],\n z = xyz[2],\n l, a, b;\n\n x /= 95.047;\n y /= 100;\n z /= 108.883;\n\n x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116);\n y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116);\n z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116);\n\n l = (116 * y) - 16;\n a = 500 * (x - y);\n b = 200 * (y - z);\n\n return [l, a, b];\n}\n\nfunction rgb2lch(args) {\n return lab2lch(rgb2lab(args));\n}\n\nfunction hsl2rgb(hsl) {\n var h = hsl[0] / 360,\n s = hsl[1] / 100,\n l = hsl[2] / 100,\n t1, t2, t3, rgb, val;\n\n if (s == 0) {\n val = l * 255;\n return [val, val, val];\n }\n\n if (l < 0.5)\n t2 = l * (1 + s);\n else\n t2 = l + s - l * s;\n t1 = 2 * l - t2;\n\n rgb = [0, 0, 0];\n for (var i = 0; i < 3; i++) {\n t3 = h + 1 / 3 * - (i - 1);\n t3 < 0 && t3++;\n t3 > 1 && t3--;\n\n if (6 * t3 < 1)\n val = t1 + (t2 - t1) * 6 * t3;\n else if (2 * t3 < 1)\n val = t2;\n else if (3 * t3 < 2)\n val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n else\n val = t1;\n\n rgb[i] = val * 255;\n }\n\n return rgb;\n}\n\nfunction hsl2hsv(hsl) {\n var h = hsl[0],\n s = hsl[1] / 100,\n l = hsl[2] / 100,\n sv, v;\n\n if(l === 0) {\n // no need to do calc on black\n // also avoids divide by 0 error\n return [0, 0, 0];\n }\n\n l *= 2;\n s *= (l <= 1) ? l : 2 - l;\n v = (l + s) / 2;\n sv = (2 * s) / (l + s);\n return [h, sv * 100, v * 100];\n}\n\nfunction hsl2hwb(args) {\n return rgb2hwb(hsl2rgb(args));\n}\n\nfunction hsl2cmyk(args) {\n return rgb2cmyk(hsl2rgb(args));\n}\n\nfunction hsl2keyword(args) {\n return rgb2keyword(hsl2rgb(args));\n}\n\n\nfunction hsv2rgb(hsv) {\n var h = hsv[0] / 60,\n s = hsv[1] / 100,\n v = hsv[2] / 100,\n hi = Math.floor(h) % 6;\n\n var f = h - Math.floor(h),\n p = 255 * v * (1 - s),\n q = 255 * v * (1 - (s * f)),\n t = 255 * v * (1 - (s * (1 - f))),\n v = 255 * v;\n\n switch(hi) {\n case 0:\n return [v, t, p];\n case 1:\n return [q, v, p];\n case 2:\n return [p, v, t];\n case 3:\n return [p, q, v];\n case 4:\n return [t, p, v];\n case 5:\n return [v, p, q];\n }\n}\n\nfunction hsv2hsl(hsv) {\n var h = hsv[0],\n s = hsv[1] / 100,\n v = hsv[2] / 100,\n sl, l;\n\n l = (2 - s) * v;\n sl = s * v;\n sl /= (l <= 1) ? l : 2 - l;\n sl = sl || 0;\n l /= 2;\n return [h, sl * 100, l * 100];\n}\n\nfunction hsv2hwb(args) {\n return rgb2hwb(hsv2rgb(args))\n}\n\nfunction hsv2cmyk(args) {\n return rgb2cmyk(hsv2rgb(args));\n}\n\nfunction hsv2keyword(args) {\n return rgb2keyword(hsv2rgb(args));\n}\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nfunction hwb2rgb(hwb) {\n var h = hwb[0] / 360,\n wh = hwb[1] / 100,\n bl = hwb[2] / 100,\n ratio = wh + bl,\n i, v, f, n;\n\n // wh + bl cant be > 1\n if (ratio > 1) {\n wh /= ratio;\n bl /= ratio;\n }\n\n i = Math.floor(6 * h);\n v = 1 - bl;\n f = 6 * h - i;\n if ((i & 0x01) != 0) {\n f = 1 - f;\n }\n n = wh + f * (v - wh); // linear interpolation\n\n switch (i) {\n default:\n case 6:\n case 0: r = v; g = n; b = wh; break;\n case 1: r = n; g = v; b = wh; break;\n case 2: r = wh; g = v; b = n; break;\n case 3: r = wh; g = n; b = v; break;\n case 4: r = n; g = wh; b = v; break;\n case 5: r = v; g = wh; b = n; break;\n }\n\n return [r * 255, g * 255, b * 255];\n}\n\nfunction hwb2hsl(args) {\n return rgb2hsl(hwb2rgb(args));\n}\n\nfunction hwb2hsv(args) {\n return rgb2hsv(hwb2rgb(args));\n}\n\nfunction hwb2cmyk(args) {\n return rgb2cmyk(hwb2rgb(args));\n}\n\nfunction hwb2keyword(args) {\n return rgb2keyword(hwb2rgb(args));\n}\n\nfunction cmyk2rgb(cmyk) {\n var c = cmyk[0] / 100,\n m = cmyk[1] / 100,\n y = cmyk[2] / 100,\n k = cmyk[3] / 100,\n r, g, b;\n\n r = 1 - Math.min(1, c * (1 - k) + k);\n g = 1 - Math.min(1, m * (1 - k) + k);\n b = 1 - Math.min(1, y * (1 - k) + k);\n return [r * 255, g * 255, b * 255];\n}\n\nfunction cmyk2hsl(args) {\n return rgb2hsl(cmyk2rgb(args));\n}\n\nfunction cmyk2hsv(args) {\n return rgb2hsv(cmyk2rgb(args));\n}\n\nfunction cmyk2hwb(args) {\n return rgb2hwb(cmyk2rgb(args));\n}\n\nfunction cmyk2keyword(args) {\n return rgb2keyword(cmyk2rgb(args));\n}\n\n\nfunction xyz2rgb(xyz) {\n var x = xyz[0] / 100,\n y = xyz[1] / 100,\n z = xyz[2] / 100,\n r, g, b;\n\n r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n // assume sRGB\n r = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)\n : r = (r * 12.92);\n\n g = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)\n : g = (g * 12.92);\n\n b = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)\n : b = (b * 12.92);\n\n r = Math.min(Math.max(0, r), 1);\n g = Math.min(Math.max(0, g), 1);\n b = Math.min(Math.max(0, b), 1);\n\n return [r * 255, g * 255, b * 255];\n}\n\nfunction xyz2lab(xyz) {\n var x = xyz[0],\n y = xyz[1],\n z = xyz[2],\n l, a, b;\n\n x /= 95.047;\n y /= 100;\n z /= 108.883;\n\n x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116);\n y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116);\n z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116);\n\n l = (116 * y) - 16;\n a = 500 * (x - y);\n b = 200 * (y - z);\n\n return [l, a, b];\n}\n\nfunction xyz2lch(args) {\n return lab2lch(xyz2lab(args));\n}\n\nfunction lab2xyz(lab) {\n var l = lab[0],\n a = lab[1],\n b = lab[2],\n x, y, z, y2;\n\n if (l <= 8) {\n y = (l * 100) / 903.3;\n y2 = (7.787 * (y / 100)) + (16 / 116);\n } else {\n y = 100 * Math.pow((l + 16) / 116, 3);\n y2 = Math.pow(y / 100, 1/3);\n }\n\n x = x / 95.047 <= 0.008856 ? x = (95.047 * ((a / 500) + y2 - (16 / 116))) / 7.787 : 95.047 * Math.pow((a / 500) + y2, 3);\n\n z = z / 108.883 <= 0.008859 ? z = (108.883 * (y2 - (b / 200) - (16 / 116))) / 7.787 : 108.883 * Math.pow(y2 - (b / 200), 3);\n\n return [x, y, z];\n}\n\nfunction lab2lch(lab) {\n var l = lab[0],\n a = lab[1],\n b = lab[2],\n hr, h, c;\n\n hr = Math.atan2(b, a);\n h = hr * 360 / 2 / Math.PI;\n if (h < 0) {\n h += 360;\n }\n c = Math.sqrt(a * a + b * b);\n return [l, c, h];\n}\n\nfunction lab2rgb(args) {\n return xyz2rgb(lab2xyz(args));\n}\n\nfunction lch2lab(lch) {\n var l = lch[0],\n c = lch[1],\n h = lch[2],\n a, b, hr;\n\n hr = h / 360 * 2 * Math.PI;\n a = c * Math.cos(hr);\n b = c * Math.sin(hr);\n return [l, a, b];\n}\n\nfunction lch2xyz(args) {\n return lab2xyz(lch2lab(args));\n}\n\nfunction lch2rgb(args) {\n return lab2rgb(lch2lab(args));\n}\n\nfunction keyword2rgb(keyword) {\n return cssKeywords[keyword];\n}\n\nfunction keyword2hsl(args) {\n return rgb2hsl(keyword2rgb(args));\n}\n\nfunction keyword2hsv(args) {\n return rgb2hsv(keyword2rgb(args));\n}\n\nfunction keyword2hwb(args) {\n return rgb2hwb(keyword2rgb(args));\n}\n\nfunction keyword2cmyk(args) {\n return rgb2cmyk(keyword2rgb(args));\n}\n\nfunction keyword2lab(args) {\n return rgb2lab(keyword2rgb(args));\n}\n\nfunction keyword2xyz(args) {\n return rgb2xyz(keyword2rgb(args));\n}\n\nvar cssKeywords = {\n aliceblue: [240,248,255],\n antiquewhite: [250,235,215],\n aqua: [0,255,255],\n aquamarine: [127,255,212],\n azure: [240,255,255],\n beige: [245,245,220],\n bisque: [255,228,196],\n black: [0,0,0],\n blanchedalmond: [255,235,205],\n blue: [0,0,255],\n blueviolet: [138,43,226],\n brown: [165,42,42],\n burlywood: [222,184,135],\n cadetblue: [95,158,160],\n chartreuse: [127,255,0],\n chocolate: [210,105,30],\n coral: [255,127,80],\n cornflowerblue: [100,149,237],\n cornsilk: [255,248,220],\n crimson: [220,20,60],\n cyan: [0,255,255],\n darkblue: [0,0,139],\n darkcyan: [0,139,139],\n darkgoldenrod: [184,134,11],\n darkgray: [169,169,169],\n darkgreen: [0,100,0],\n darkgrey: [169,169,169],\n darkkhaki: [189,183,107],\n darkmagenta: [139,0,139],\n darkolivegreen: [85,107,47],\n darkorange: [255,140,0],\n darkorchid: [153,50,204],\n darkred: [139,0,0],\n darksalmon: [233,150,122],\n darkseagreen: [143,188,143],\n darkslateblue: [72,61,139],\n darkslategray: [47,79,79],\n darkslategrey: [47,79,79],\n darkturquoise: [0,206,209],\n darkviolet: [148,0,211],\n deeppink: [255,20,147],\n deepskyblue: [0,191,255],\n dimgray: [105,105,105],\n dimgrey: [105,105,105],\n dodgerblue: [30,144,255],\n firebrick: [178,34,34],\n floralwhite: [255,250,240],\n forestgreen: [34,139,34],\n fuchsia: [255,0,255],\n gainsboro: [220,220,220],\n ghostwhite: [248,248,255],\n gold: [255,215,0],\n goldenrod: [218,165,32],\n gray: [128,128,128],\n green: [0,128,0],\n greenyellow: [173,255,47],\n grey: [128,128,128],\n honeydew: [240,255,240],\n hotpink: [255,105,180],\n indianred: [205,92,92],\n indigo: [75,0,130],\n ivory: [255,255,240],\n khaki: [240,230,140],\n lavender: [230,230,250],\n lavenderblush: [255,240,245],\n lawngreen: [124,252,0],\n lemonchiffon: [255,250,205],\n lightblue: [173,216,230],\n lightcoral: [240,128,128],\n lightcyan: [224,255,255],\n lightgoldenrodyellow: [250,250,210],\n lightgray: [211,211,211],\n lightgreen: [144,238,144],\n lightgrey: [211,211,211],\n lightpink: [255,182,193],\n lightsalmon: [255,160,122],\n lightseagreen: [32,178,170],\n lightskyblue: [135,206,250],\n lightslategray: [119,136,153],\n lightslategrey: [119,136,153],\n lightsteelblue: [176,196,222],\n lightyellow: [255,255,224],\n lime: [0,255,0],\n limegreen: [50,205,50],\n linen: [250,240,230],\n magenta: [255,0,255],\n maroon: [128,0,0],\n mediumaquamarine: [102,205,170],\n mediumblue: [0,0,205],\n mediumorchid: [186,85,211],\n mediumpurple: [147,112,219],\n mediumseagreen: [60,179,113],\n mediumslateblue: [123,104,238],\n mediumspringgreen: [0,250,154],\n mediumturquoise: [72,209,204],\n mediumvioletred: [199,21,133],\n midnightblue: [25,25,112],\n mintcream: [245,255,250],\n mistyrose: [255,228,225],\n moccasin: [255,228,181],\n navajowhite: [255,222,173],\n navy: [0,0,128],\n oldlace: [253,245,230],\n olive: [128,128,0],\n olivedrab: [107,142,35],\n orange: [255,165,0],\n orangered: [255,69,0],\n orchid: [218,112,214],\n palegoldenrod: [238,232,170],\n palegreen: [152,251,152],\n paleturquoise: [175,238,238],\n palevioletred: [219,112,147],\n papayawhip: [255,239,213],\n peachpuff: [255,218,185],\n peru: [205,133,63],\n pink: [255,192,203],\n plum: [221,160,221],\n powderblue: [176,224,230],\n purple: [128,0,128],\n rebeccapurple: [102, 51, 153],\n red: [255,0,0],\n rosybrown: [188,143,143],\n royalblue: [65,105,225],\n saddlebrown: [139,69,19],\n salmon: [250,128,114],\n sandybrown: [244,164,96],\n seagreen: [46,139,87],\n seashell: [255,245,238],\n sienna: [160,82,45],\n silver: [192,192,192],\n skyblue: [135,206,235],\n slateblue: [106,90,205],\n slategray: [112,128,144],\n slategrey: [112,128,144],\n snow: [255,250,250],\n springgreen: [0,255,127],\n steelblue: [70,130,180],\n tan: [210,180,140],\n teal: [0,128,128],\n thistle: [216,191,216],\n tomato: [255,99,71],\n turquoise: [64,224,208],\n violet: [238,130,238],\n wheat: [245,222,179],\n white: [255,255,255],\n whitesmoke: [245,245,245],\n yellow: [255,255,0],\n yellowgreen: [154,205,50]\n};\n\nvar reverseKeywords = {};\nfor (var key in cssKeywords) {\n reverseKeywords[JSON.stringify(cssKeywords[key])] = key;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/color-convert/conversions.js\n// module id = 9\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index a2b3299..2c1ca62 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,4290 +1,777 @@ -{ - "name": "paintbricks", - "version": "0.0.2", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "acorn": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz", - "integrity": "sha1-dEbTlFnFT7SagObuZHgUm5QOyCI=", - "dev": true - }, - "acorn-dynamic-import": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-2.0.2.tgz", - "integrity": "sha1-x1K9IQvvZ5UBtsbLf8hPj0cVjMQ=", - "dev": true, - "requires": { - "acorn": "4.0.13" - }, - "dependencies": { - "acorn": { - "version": "4.0.13", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", - "dev": true - } - } - }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "dev": true, - "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.0.0", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1" - } - }, - "ajv-keywords": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", - "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", - "dev": true - }, - "align-text": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", - "dev": true, - "requires": { - "kind-of": "3.2.2", - "longest": "1.0.1", - "repeat-string": "1.6.1" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "anymatch": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", - "integrity": "sha1-VT3Lj5HjyImEXf26NMd3IbkLnXo=", - "dev": true, - "requires": { - "micromatch": "2.3.11", - "normalize-path": "2.1.1" - }, - "dependencies": { - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true, - "requires": { - "arr-flatten": "1.1.0" - } - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", - "dev": true - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true, - "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.2" - } - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true, - "requires": { - "is-posix-bracket": "0.1.1" - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.1", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.2", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.4" - } - } - } - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", - "dev": true - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "asn1.js": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.2.tgz", - "integrity": "sha1-gRfvT37YfNj4kES1v/l6wkOhbJo=", - "dev": true, - "requires": { - "bn.js": "4.11.8", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.0" - } - }, - "assert": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", - "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", - "dev": true, - "requires": { - "util": "0.10.3" - } - }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true - }, - "async": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", - "integrity": "sha1-YaKau2/MAm/qd+VtHG7FOnlZUfQ=", - "dev": true, - "requires": { - "lodash": "4.17.4" - } - }, - "async-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", - "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", - "dev": true - }, - "atob": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", - "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=", - "dev": true - }, - "awesome-typescript-loader": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/awesome-typescript-loader/-/awesome-typescript-loader-3.4.1.tgz", - "integrity": "sha1-IvpJgA8GGewYqxU4Ou+TuVN43qk=", - "dev": true, - "requires": { - "colors": "1.1.2", - "enhanced-resolve": "3.3.0", - "loader-utils": "1.1.0", - "lodash": "4.17.4", - "micromatch": "3.1.5", - "mkdirp": "0.5.1", - "object-assign": "4.1.1", - "source-map-support": "0.4.18" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", - "dev": true, - "requires": { - "cache-base": "1.0.1", - "class-utils": "0.3.6", - "component-emitter": "1.2.1", - "define-property": "1.0.0", - "isobject": "3.0.1", - "mixin-deep": "1.3.0", - "pascalcase": "0.1.1" - } - }, - "base64-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.1.tgz", - "integrity": "sha1-qRlH2h9KUW6jjltOwOw3c2deCIY=", - "dev": true - }, - "big.js": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", - "integrity": "sha1-pfwpi4G54Nyi5FiCR4S2XFK6WI4=", - "dev": true - }, - "binary-extensions": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", - "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", - "dev": true - }, - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha1-LN4J617jQfSEdGuwMJsyU7GxRC8=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true, - "requires": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.0.tgz", - "integrity": "sha1-pGlBy1+0khVrPWplbgbDU2Tj5m4=", - "dev": true, - "requires": { - "arr-flatten": "1.1.0", - "array-unique": "0.3.2", - "define-property": "1.0.0", - "extend-shallow": "2.0.1", - "fill-range": "4.0.0", - "isobject": "3.0.1", - "repeat-element": "1.1.2", - "snapdragon": "0.8.1", - "snapdragon-node": "2.1.1", - "split-string": "3.1.0", - "to-regex": "3.0.1" - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", - "dev": true - }, - "browserify-aes": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.1.1.tgz", - "integrity": "sha1-OLerVe24Bv8tzaGn8WIHc6R3xJ8=", - "dev": true, - "requires": { - "buffer-xor": "1.0.3", - "cipher-base": "1.0.4", - "create-hash": "1.1.3", - "evp_bytestokey": "1.0.3", - "inherits": "2.0.3", - "safe-buffer": "5.1.1" - } - }, - "browserify-cipher": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.0.tgz", - "integrity": "sha1-mYgkSHS/XtTijalWZtzWasj8Njo=", - "dev": true, - "requires": { - "browserify-aes": "1.1.1", - "browserify-des": "1.0.0", - "evp_bytestokey": "1.0.3" - } - }, - "browserify-des": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.0.tgz", - "integrity": "sha1-2qJ3cXRwki7S/hhZQRihdUOXId0=", - "dev": true, - "requires": { - "cipher-base": "1.0.4", - "des.js": "1.0.0", - "inherits": "2.0.3" - } - }, - "browserify-rsa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", - "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", - "dev": true, - "requires": { - "bn.js": "4.11.8", - "randombytes": "2.0.6" - } - }, - "browserify-sign": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", - "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", - "dev": true, - "requires": { - "bn.js": "4.11.8", - "browserify-rsa": "4.0.1", - "create-hash": "1.1.3", - "create-hmac": "1.1.6", - "elliptic": "6.4.0", - "inherits": "2.0.3", - "parse-asn1": "5.1.0" - } - }, - "browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha1-KGlFnZqjviRf6P4sofRuLn9U1z8=", - "dev": true, - "requires": { - "pako": "1.0.6" - } - }, - "buffer": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", - "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", - "dev": true, - "requires": { - "base64-js": "1.2.1", - "ieee754": "1.1.8", - "isarray": "1.0.0" - } - }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", - "dev": true - }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", - "dev": true, - "requires": { - "collection-visit": "1.0.0", - "component-emitter": "1.2.1", - "get-value": "2.0.6", - "has-value": "1.0.0", - "isobject": "3.0.1", - "set-value": "2.0.0", - "to-object-path": "0.3.0", - "union-value": "1.0.0", - "unset-value": "1.0.0" - } - }, - "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", - "dev": true - }, - "center-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", - "dev": true, - "requires": { - "align-text": "0.1.4", - "lazy-cache": "1.0.4" - }, - "dependencies": { - "lazy-cache": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", - "dev": true - } - } - }, - "chokidar": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", - "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", - "dev": true, - "requires": { - "anymatch": "1.3.2", - "async-each": "1.0.1", - "fsevents": "1.1.3", - "glob-parent": "2.0.0", - "inherits": "2.0.3", - "is-binary-path": "1.0.1", - "is-glob": "2.0.1", - "path-is-absolute": "1.0.1", - "readdirp": "2.1.0" - } - }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha1-h2Dk7MJy9MNjUy+SbYdKriwTl94=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.1" - } - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", - "dev": true, - "requires": { - "arr-union": "3.1.0", - "define-property": "0.2.5", - "isobject": "3.0.1", - "static-extend": "0.1.2" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "0.1.6" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", - "dev": true, - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", - "dev": true - } - } - }, - "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "dev": true, - "requires": { - "center-align": "0.1.3", - "right-align": "0.1.3", - "wordwrap": "0.0.2" - } - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "requires": { - "map-visit": "1.0.0", - "object-visit": "1.0.1" - } - }, - "color-convert": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-0.5.3.tgz", - "integrity": "sha1-vbbGnOZg+t/+CwAHzER+G59ygr0=" - }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true - }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "console-browserify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", - "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", - "dev": true, - "requires": { - "date-now": "0.1.4" - } - }, - "constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", - "dev": true - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "create-ecdh": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.0.tgz", - "integrity": "sha1-iIxyNZbN92EvZJgjPuvXo1MBc30=", - "dev": true, - "requires": { - "bn.js": "4.11.8", - "elliptic": "6.4.0" - } - }, - "create-hash": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.3.tgz", - "integrity": "sha1-YGBCrIuSYnUPSDyt2rD1gZFy2P0=", - "dev": true, - "requires": { - "cipher-base": "1.0.4", - "inherits": "2.0.3", - "ripemd160": "2.0.1", - "sha.js": "2.4.10" - } - }, - "create-hmac": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.6.tgz", - "integrity": "sha1-rLniIaThe9sHbpBlfEK5PjcmzwY=", - "dev": true, - "requires": { - "cipher-base": "1.0.4", - "create-hash": "1.1.3", - "inherits": "2.0.3", - "ripemd160": "2.0.1", - "safe-buffer": "5.1.1", - "sha.js": "2.4.10" - } - }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.3.0" - } - }, - "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha1-OWz58xN/A+S45TLFj2mCVOAPgOw=", - "dev": true, - "requires": { - "browserify-cipher": "1.0.0", - "browserify-sign": "4.0.4", - "create-ecdh": "4.0.0", - "create-hash": "1.1.3", - "create-hmac": "1.1.6", - "diffie-hellman": "5.0.2", - "inherits": "2.0.3", - "pbkdf2": "3.0.14", - "public-encrypt": "4.0.0", - "randombytes": "2.0.6", - "randomfill": "1.0.3" - } - }, - "d": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", - "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", - "dev": true, - "requires": { - "es5-ext": "0.10.38" - } - }, - "date-now": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", - "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", - "dev": true - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true - }, - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "1.0.2" - } - }, - "des.js": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", - "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "minimalistic-assert": "1.0.0" - } - }, - "diffie-hellman": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.2.tgz", - "integrity": "sha1-tYNXOScM/ias9jIJn97SoH8gnl4=", - "dev": true, - "requires": { - "bn.js": "4.11.8", - "miller-rabin": "4.0.1", - "randombytes": "2.0.6" - } - }, - "domain-browser": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.7.tgz", - "integrity": "sha1-hnqksJP6oF8d4IwG9NeyH9+GmLw=", - "dev": true - }, - "elliptic": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", - "dev": true, - "requires": { - "bn.js": "4.11.8", - "brorand": "1.1.0", - "hash.js": "1.1.3", - "hmac-drbg": "1.0.1", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.0", - "minimalistic-crypto-utils": "1.0.1" - } - }, - "emojis-list": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", - "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", - "dev": true - }, - "enhanced-resolve": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.3.0.tgz", - "integrity": "sha1-lQlk7MfwMypCMhtnOzjcj/FVNbM=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "memory-fs": "0.4.1", - "object-assign": "4.1.1", - "tapable": "0.2.8" - } - }, - "errno": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.6.tgz", - "integrity": "sha1-w4bOimKD8U/AlWO3FWCQjJv1MCY=", - "dev": true, - "requires": { - "prr": "1.0.1" - } - }, - "error-ex": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", - "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", - "dev": true, - "requires": { - "is-arrayish": "0.2.1" - } - }, - "es5-ext": { - "version": "0.10.38", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.38.tgz", - "integrity": "sha1-+n1A1lu8m7imfh0/nMZWoAUw7tM=", - "dev": true, - "requires": { - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1" - } - }, - "es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.38", - "es6-symbol": "3.1.1" - } - }, - "es6-map": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", - "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.38", - "es6-iterator": "2.0.3", - "es6-set": "0.1.5", - "es6-symbol": "3.1.1", - "event-emitter": "0.3.5" - } - }, - "es6-set": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", - "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.38", - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1", - "event-emitter": "0.3.5" - } - }, - "es6-symbol": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", - "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.38" - } - }, - "es6-weak-map": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", - "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.38", - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1" - } - }, - "escope": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", - "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", - "dev": true, - "requires": { - "es6-map": "0.1.5", - "es6-weak-map": "2.0.2", - "esrecurse": "4.2.0", - "estraverse": "4.2.0" - } - }, - "esrecurse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", - "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", - "dev": true, - "requires": { - "estraverse": "4.2.0", - "object-assign": "4.1.1" - } - }, - "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", - "dev": true - }, - "event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.38" - } - }, - "events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", - "dev": true - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha1-f8vbGY3HGVlDLv4ThCaE4FJaywI=", - "dev": true, - "requires": { - "md5.js": "1.3.4", - "safe-buffer": "5.1.1" - } - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "5.1.0", - "get-stream": "3.0.0", - "is-stream": "1.1.0", - "npm-run-path": "2.0.2", - "p-finally": "1.0.0", - "signal-exit": "3.0.2", - "strip-eof": "1.0.0" - } - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "2.6.9", - "define-property": "0.2.5", - "extend-shallow": "2.0.1", - "posix-character-classes": "0.1.1", - "regex-not": "1.0.0", - "snapdragon": "0.8.1", - "to-regex": "3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "0.1.6" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", - "dev": true, - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", - "dev": true - } - } - }, - "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", - "dev": true, - "requires": { - "fill-range": "2.2.3" - }, - "dependencies": { - "fill-range": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", - "dev": true, - "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "1.1.7", - "repeat-element": "1.1.2", - "repeat-string": "1.6.1" - } - }, - "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - } - }, - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "0.1.1" - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha1-rQD+TcYSqSMuhxhxHcXLWrAoVUM=", - "dev": true, - "requires": { - "array-unique": "0.3.2", - "define-property": "1.0.0", - "expand-brackets": "2.1.4", - "extend-shallow": "2.0.1", - "fragment-cache": "0.2.1", - "regex-not": "1.0.0", - "snapdragon": "0.8.1", - "to-regex": "3.0.1" - } - }, - "fast-deep-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", - "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true - }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "2.0.1", - "is-number": "3.0.0", - "repeat-string": "1.6.1", - "to-regex-range": "2.1.1" - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "2.0.0" - } - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", - "dev": true, - "requires": { - "for-in": "1.0.2" - } - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "requires": { - "map-cache": "0.2.2" - } - }, - "fsevents": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz", - "integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==", - "dev": true, - "requires": { - "nan": "^2.3.0", - "node-pre-gyp": "^0.6.39" - }, - "dependencies": { - "abbrev": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "ajv": { - "version": "4.11.8", - "bundled": true, - "dev": true, - "requires": { - "co": "^4.6.0", - "json-stable-stringify": "^1.0.1" - } - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "aproba": { - "version": "1.1.1", - "bundled": true, - "dev": true - }, - "are-we-there-yet": { - "version": "1.1.4", - "bundled": true, - "dev": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "asn1": { - "version": "0.2.3", - "bundled": true, - "dev": true - }, - "assert-plus": { - "version": "0.2.0", - "bundled": true, - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "bundled": true, - "dev": true - }, - "aws-sign2": { - "version": "0.6.0", - "bundled": true, - "dev": true - }, - "aws4": { - "version": "1.6.0", - "bundled": true, - "dev": true - }, - "balanced-match": { - "version": "0.4.2", - "bundled": true, - "dev": true - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "block-stream": { - "version": "0.0.9", - "bundled": true, - "dev": true, - "requires": { - "inherits": "~2.0.0" - } - }, - "boom": { - "version": "2.10.1", - "bundled": true, - "dev": true, - "requires": { - "hoek": "2.x.x" - } - }, - "brace-expansion": { - "version": "1.1.7", - "bundled": true, - "dev": true, - "requires": { - "balanced-match": "^0.4.1", - "concat-map": "0.0.1" - } - }, - "buffer-shims": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "caseless": { - "version": "0.12.0", - "bundled": true, - "dev": true - }, - "co": { - "version": "4.6.0", - "bundled": true, - "dev": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "combined-stream": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "cryptiles": { - "version": "2.0.5", - "bundled": true, - "dev": true, - "requires": { - "boom": "2.x.x" - } - }, - "dashdash": { - "version": "1.14.1", - "bundled": true, - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true - } - } - }, - "debug": { - "version": "2.6.8", - "bundled": true, - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "deep-extend": { - "version": "0.4.2", - "bundled": true, - "dev": true - }, - "delayed-stream": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "detect-libc": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "ecc-jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsbn": "~0.1.0" - } - }, - "extend": { - "version": "3.0.1", - "bundled": true, - "dev": true - }, - "extsprintf": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "forever-agent": { - "version": "0.6.1", - "bundled": true, - "dev": true - }, - "form-data": { - "version": "2.1.4", - "bundled": true, - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.12" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "fstream": { - "version": "1.0.11", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - } - }, - "fstream-ignore": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "requires": { - "fstream": "^1.0.0", - "inherits": "2", - "minimatch": "^3.0.0" - } - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "dev": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "getpass": { - "version": "0.1.7", - "bundled": true, - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true - } - } - }, - "glob": { - "version": "7.1.2", - "bundled": true, - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "graceful-fs": { - "version": "4.1.11", - "bundled": true, - "dev": true - }, - "har-schema": { - "version": "1.0.5", - "bundled": true, - "dev": true - }, - "har-validator": { - "version": "4.2.1", - "bundled": true, - "dev": true, - "requires": { - "ajv": "^4.9.1", - "har-schema": "^1.0.5" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true - }, - "hawk": { - "version": "3.1.3", - "bundled": true, - "dev": true, - "requires": { - "boom": "2.x.x", - "cryptiles": "2.x.x", - "hoek": "2.x.x", - "sntp": "1.x.x" - } - }, - "hoek": { - "version": "2.16.3", - "bundled": true, - "dev": true - }, - "http-signature": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "requires": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true, - "dev": true - }, - "ini": { - "version": "1.3.4", - "bundled": true, - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-typedarray": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "isstream": { - "version": "0.1.2", - "bundled": true, - "dev": true - }, - "jodid25519": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsbn": "~0.1.0" - } - }, - "jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "bundled": true, - "dev": true - }, - "json-stable-stringify": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "jsonify": "~0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "bundled": true, - "dev": true - }, - "jsonify": { - "version": "0.0.0", - "bundled": true, - "dev": true - }, - "jsprim": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.0.2", - "json-schema": "0.2.3", - "verror": "1.3.6" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true - } - } - }, - "mime-db": { - "version": "1.27.0", - "bundled": true, - "dev": true - }, - "mime-types": { - "version": "2.1.15", - "bundled": true, - "dev": true, - "requires": { - "mime-db": "~1.27.0" - } - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true - }, - "ms": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "node-pre-gyp": { - "version": "0.6.39", - "bundled": true, - "dev": true, - "requires": { - "detect-libc": "^1.0.2", - "hawk": "3.1.3", - "mkdirp": "^0.5.1", - "nopt": "^4.0.1", - "npmlog": "^4.0.2", - "rc": "^1.1.7", - "request": "2.81.0", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^2.2.1", - "tar-pack": "^3.4.0" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "dev": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npmlog": { - "version": "4.1.0", - "bundled": true, - "dev": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "oauth-sign": { - "version": "0.8.2", - "bundled": true, - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "osenv": { - "version": "0.1.4", - "bundled": true, - "dev": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "performance-now": { - "version": "0.2.0", - "bundled": true, - "dev": true - }, - "process-nextick-args": { - "version": "1.0.7", - "bundled": true, - "dev": true - }, - "punycode": { - "version": "1.4.1", - "bundled": true, - "dev": true - }, - "qs": { - "version": "6.4.0", - "bundled": true, - "dev": true - }, - "rc": { - "version": "1.2.1", - "bundled": true, - "dev": true, - "requires": { - "deep-extend": "~0.4.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - } - }, - "readable-stream": { - "version": "2.2.9", - "bundled": true, - "dev": true, - "requires": { - "buffer-shims": "~1.0.0", - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~1.0.0", - "util-deprecate": "~1.0.1" - } - }, - "request": { - "version": "2.81.0", - "bundled": true, - "dev": true, - "requires": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~2.1.1", - "har-validator": "~4.2.1", - "hawk": "~3.1.3", - "http-signature": "~1.1.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.7", - "oauth-sign": "~0.8.1", - "performance-now": "^0.2.0", - "qs": "~6.4.0", - "safe-buffer": "^5.0.1", - "stringstream": "~0.0.4", - "tough-cookie": "~2.3.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.0.0" - } - }, - "rimraf": { - "version": "2.6.1", - "bundled": true, - "dev": true, - "requires": { - "glob": "^7.0.5" - } - }, - "safe-buffer": { - "version": "5.0.1", - "bundled": true, - "dev": true - }, - "semver": { - "version": "5.3.0", - "bundled": true, - "dev": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true - }, - "sntp": { - "version": "1.0.9", - "bundled": true, - "dev": true, - "requires": { - "hoek": "2.x.x" - } - }, - "sshpk": { - "version": "1.13.0", - "bundled": true, - "dev": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jodid25519": "^1.0.0", - "jsbn": "~0.1.0", - "tweetnacl": "~0.14.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true - } - } - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "stringstream": { - "version": "0.0.5", - "bundled": true, - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true - }, - "tar": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "block-stream": "*", - "fstream": "^1.0.2", - "inherits": "2" - } - }, - "tar-pack": { - "version": "3.4.0", - "bundled": true, - "dev": true, - "requires": { - "debug": "^2.2.0", - "fstream": "^1.0.10", - "fstream-ignore": "^1.0.5", - "once": "^1.3.3", - "readable-stream": "^2.1.4", - "rimraf": "^2.5.1", - "tar": "^2.2.1", - "uid-number": "^0.0.6" - } - }, - "tough-cookie": { - "version": "2.3.2", - "bundled": true, - "dev": true, - "requires": { - "punycode": "^1.4.1" - } - }, - "tunnel-agent": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "bundled": true, - "dev": true, - "optional": true - }, - "uid-number": { - "version": "0.0.6", - "bundled": true, - "dev": true - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "uuid": { - "version": "3.0.1", - "bundled": true, - "dev": true - }, - "verror": { - "version": "1.3.6", - "bundled": true, - "dev": true, - "requires": { - "extsprintf": "1.0.2" - } - }, - "wide-align": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "requires": { - "string-width": "^1.0.2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true - } - } - }, - "get-caller-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", - "dev": true - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", - "dev": true, - "requires": { - "glob-parent": "2.0.0", - "is-glob": "2.0.1" - } - }, - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true, - "requires": { - "is-glob": "2.0.1" - } - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "requires": { - "get-value": "2.0.6", - "has-values": "1.0.0", - "isobject": "3.0.1" - } - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true, - "requires": { - "is-number": "3.0.0", - "kind-of": "4.0.0" - }, - "dependencies": { - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "hash-base": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-2.0.2.tgz", - "integrity": "sha1-ZuodhW206KVHDK32/OI65SRO8uE=", - "dev": true, - "requires": { - "inherits": "2.0.3" - } - }, - "hash.js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", - "integrity": "sha1-NA3tvmKQGHFRweodd3o0SJNd+EY=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "minimalistic-assert": "1.0.0" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dev": true, - "requires": { - "hash.js": "1.1.3", - "minimalistic-assert": "1.0.0", - "minimalistic-crypto-utils": "1.0.1" - } - }, - "hosted-git-info": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha1-bWDjSzq7yDEwYsO3mO+NkBoHrzw=", - "dev": true - }, - "https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", - "dev": true - }, - "ieee754": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", - "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=", - "dev": true - }, - "indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", - "dev": true - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "interpret": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", - "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", - "dev": true - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", - "dev": true, - "requires": { - "kind-of": "6.0.2" - } - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", - "dev": true, - "requires": { - "binary-extensions": "1.11.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "1.1.1" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", - "dev": true, - "requires": { - "kind-of": "6.0.2" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", - "dev": true, - "requires": { - "is-accessor-descriptor": "1.0.0", - "is-data-descriptor": "1.0.0", - "kind-of": "6.0.2" - } - }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", - "dev": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", - "dev": true, - "requires": { - "is-primitive": "2.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-odd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz", - "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", - "dev": true, - "requires": { - "is-number": "3.0.0" - } - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", - "dev": true, - "requires": { - "isobject": "3.0.1" - } - }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", - "dev": true - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "json-loader": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/json-loader/-/json-loader-0.5.7.tgz", - "integrity": "sha1-3KFKcCNf+C8KyaOr62DTN6NlGF0=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true - }, - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha1-ARRrNqYhjmTljzqNZt5df8b20FE=", - "dev": true - }, - "lazy-cache": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", - "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", - "dev": true, - "requires": { - "set-getter": "0.1.0" - } - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "dev": true, - "requires": { - "invert-kv": "1.0.0" - } - }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "strip-bom": "3.0.0" - } - }, - "loader-runner": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.0.tgz", - "integrity": "sha1-9IKuqC1UPgeSFwDVpG7yb9rGuKI=", - "dev": true - }, - "loader-utils": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", - "integrity": "sha512-gkD9aSEG9UGglyPcDJqY9YBTUtCLKaBK6ihD2VP1d1X60lTfFspNZNulGBBbUZLkPygy4LySYHyxBpq+VhjObQ==", - "dev": true, - "requires": { - "big.js": "^3.1.3", - "emojis-list": "^2.0.0", - "json5": "^0.5.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "2.0.0", - "path-exists": "3.0.0" - } - }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha512-6X37Sq9KCpLSXEh8uM12AKYlviHPNNk4RxiGBn4cmKGJinbXBneWIV7iE/nXkM928O7ytHcHb6+X6Svl0f4hXg==", - "dev": true - }, - "longest": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true - }, - "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha1-Yi4y6CSItJJ5EUpPns9F581rulU=", - "dev": true, - "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" - } - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true, - "requires": { - "object-visit": "1.0.1" - } - }, - "md5.js": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", - "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", - "dev": true, - "requires": { - "hash-base": "3.0.4", - "inherits": "2.0.3" - }, - "dependencies": { - "hash-base": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", - "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.1" - } - } - } - }, - "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", - "dev": true, - "requires": { - "mimic-fn": "1.1.0" - } - }, - "memory-fs": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", - "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", - "dev": true, - "requires": { - "errno": "0.1.6", - "readable-stream": "2.3.3" - } - }, - "micromatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.5.tgz", - "integrity": "sha1-0F4WjCBkct+8qYW/709XeXtM1Lo=", - "dev": true, - "requires": { - "arr-diff": "4.0.0", - "array-unique": "0.3.2", - "braces": "2.3.0", - "define-property": "1.0.0", - "extend-shallow": "2.0.1", - "extglob": "2.0.4", - "fragment-cache": "0.2.1", - "kind-of": "6.0.2", - "nanomatch": "1.2.7", - "object.pick": "1.3.0", - "regex-not": "1.0.0", - "snapdragon": "0.8.1", - "to-regex": "3.0.1" - } - }, - "miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha1-8IA1HIZbDcViqEYpZtqlNUPHik0=", - "dev": true, - "requires": { - "bn.js": "4.11.8", - "brorand": "1.1.0" - } - }, - "mimic-fn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", - "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", - "dev": true - }, - "minimalistic-assert": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz", - "integrity": "sha1-cCvi3aazf0g2vLP121ZkG2Sh09M=", - "dev": true - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", - "dev": true, - "requires": { - "brace-expansion": "1.1.8" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q==", - "dev": true - }, - "mixin-deep": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.0.tgz", - "integrity": "sha1-R6hzK6l3mUV8jB7KKPlRMtfoFQo=", - "dev": true, - "requires": { - "for-in": "1.0.2", - "is-extendable": "1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", - "dev": true, - "requires": { - "is-plain-object": "2.0.4" - } - } - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha512-SknJC52obPfGQPnjIkXbmA6+5H15E+fR+E4iR2oQ3zzCLbd7/ONua69R/Gw7AgkTLsRG+r5fzksYwWe1AgTyWA==", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "nan": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz", - "integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=", - "dev": true - }, - "nanomatch": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.7.tgz", - "integrity": "sha1-U81KoQn/aLf4aVkf3J0Q2u7qPnk=", - "dev": true, - "requires": { - "arr-diff": "4.0.0", - "array-unique": "0.3.2", - "define-property": "1.0.0", - "extend-shallow": "2.0.1", - "fragment-cache": "0.2.1", - "is-odd": "1.0.0", - "kind-of": "5.1.0", - "object.pick": "1.3.0", - "regex-not": "1.0.0", - "snapdragon": "0.8.1", - "to-regex": "3.0.1" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", - "dev": true - } - } - }, - "node-libs-browser": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", - "integrity": "sha1-X5QmPUBPbkR2fXJpAf/wVHjWAN8=", - "dev": true, - "requires": { - "assert": "1.4.1", - "browserify-zlib": "0.2.0", - "buffer": "4.9.1", - "console-browserify": "1.1.0", - "constants-browserify": "1.0.0", - "crypto-browserify": "3.12.0", - "domain-browser": "1.1.7", - "events": "1.1.1", - "https-browserify": "1.0.0", - "os-browserify": "0.3.0", - "path-browserify": "0.0.0", - "process": "0.11.10", - "punycode": "1.4.1", - "querystring-es3": "0.2.1", - "readable-stream": "2.3.3", - "stream-browserify": "2.0.1", - "stream-http": "2.8.0", - "string_decoder": "1.0.3", - "timers-browserify": "2.0.4", - "tty-browserify": "0.0.0", - "url": "0.11.0", - "util": "0.10.3", - "vm-browserify": "0.0.4" - } - }, - "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=", - "dev": true, - "requires": { - "hosted-git-info": "2.5.0", - "is-builtin-module": "1.0.0", - "semver": "5.5.0", - "validate-npm-package-license": "3.0.1" - } - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "1.1.0" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "2.0.1" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "requires": { - "copy-descriptor": "0.1.1", - "define-property": "0.2.5", - "kind-of": "3.2.2" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "0.1.6" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", - "dev": true, - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", - "dev": true - } - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "requires": { - "isobject": "3.0.1" - } - }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", - "dev": true, - "requires": { - "for-own": "0.1.5", - "is-extendable": "0.1.1" - } - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true, - "requires": { - "isobject": "3.0.1" - } - }, - "os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", - "dev": true - }, - "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha1-QrwpAKa1uL0XN2yOiCtlr8zyS/I=", - "dev": true, - "requires": { - "execa": "0.7.0", - "lcid": "1.0.0", - "mem": "1.1.0" - } - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.2.0.tgz", - "integrity": "sha1-DpK2vty1nwIsE9DxlJ3ILRWQnxw=", - "dev": true, - "requires": { - "p-try": "1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "1.2.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, - "pako": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", - "integrity": "sha1-AQEhG6pwxLykoPY/Igbpe3368lg=", - "dev": true - }, - "parse-asn1": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.0.tgz", - "integrity": "sha1-N8T5t+06tlx0gXtfJICTf7+XxxI=", - "dev": true, - "requires": { - "asn1.js": "4.9.2", - "browserify-aes": "1.1.1", - "create-hash": "1.1.3", - "evp_bytestokey": "1.0.3", - "pbkdf2": "3.0.14" - } - }, - "parse-color": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-color/-/parse-color-1.0.0.tgz", - "integrity": "sha1-e3SLlag/A/FqlPU15S1/PZRlhhk=", - "requires": { - "color-convert": "0.5.3" - } - }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", - "dev": true, - "requires": { - "glob-base": "0.3.0", - "is-dotfile": "1.0.3", - "is-extglob": "1.0.0", - "is-glob": "2.0.1" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "1.3.1" - } - }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true - }, - "path-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", - "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "requires": { - "pify": "2.3.0" - } - }, - "pbkdf2": { - "version": "3.0.14", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.14.tgz", - "integrity": "sha1-o14TxkeZsGzhUyD0WcIw5o5zut4=", - "dev": true, - "requires": { - "create-hash": "1.1.3", - "create-hmac": "1.1.6", - "ripemd160": "2.0.1", - "safe-buffer": "5.1.1", - "sha.js": "2.4.10" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true - }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", - "dev": true - }, - "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", - "dev": true - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "dev": true - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true - }, - "prr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", - "dev": true - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "public-encrypt": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.0.tgz", - "integrity": "sha1-OfaZ86RlYN1eusvKaTyvfGXBjMY=", - "dev": true, - "requires": { - "bn.js": "4.11.8", - "browserify-rsa": "4.0.1", - "create-hash": "1.1.3", - "parse-asn1": "5.1.0", - "randombytes": "2.0.6" - } - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "dev": true - }, - "querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", - "dev": true - }, - "randomatic": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha1-x6vpzIuHwLqodrGf3oP9RkeX44w=", - "dev": true, - "requires": { - "is-number": "3.0.0", - "kind-of": "4.0.0" - }, - "dependencies": { - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "randombytes": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", - "integrity": "sha1-0wLFIpSFiISKjTAMkytEwkIx2oA=", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, - "randomfill": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.3.tgz", - "integrity": "sha1-uWt99YfwHdkXJsQY8wVTsUGOPWI=", - "dev": true, - "requires": { - "randombytes": "2.0.6", - "safe-buffer": "5.1.1" - } - }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "requires": { - "load-json-file": "2.0.0", - "normalize-package-data": "2.4.0", - "path-type": "2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "requires": { - "find-up": "2.1.0", - "read-pkg": "2.0.0" - } - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" - } - }, - "readdirp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", - "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "minimatch": "3.0.4", - "readable-stream": "2.3.3", - "set-immediate-shim": "1.0.1" - } - }, - "regex-cache": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha1-db3FiioUls7EihKDW8VMjVYjNt0=", - "dev": true, - "requires": { - "is-equal-shallow": "0.1.3" - } - }, - "regex-not": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz", - "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", - "dev": true, - "requires": { - "extend-shallow": "2.0.1" - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, - "repeat-element": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", - "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "right-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", - "dev": true, - "requires": { - "align-text": "0.1.4" - } - }, - "ripemd160": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.1.tgz", - "integrity": "sha1-D0WEKVxTo2KK9+bXmsohzlfRxuc=", - "dev": true, - "requires": { - "hash-base": "2.0.2", - "inherits": "2.0.3" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=", - "dev": true - }, - "semver": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", - "integrity": "sha1-3Eu8emyp2Rbe5dQ1FvAJK1j3uKs=", - "dev": true - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "set-getter": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", - "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", - "dev": true, - "requires": { - "to-object-path": "0.3.0" - } - }, - "set-immediate-shim": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", - "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", - "dev": true - }, - "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha1-ca5KiPD+77v1LR6mBPP7MV67YnQ=", - "dev": true, - "requires": { - "extend-shallow": "2.0.1", - "is-extendable": "0.1.1", - "is-plain-object": "2.0.4", - "split-string": "3.1.0" - } - }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", - "dev": true - }, - "sha.js": { - "version": "2.4.10", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.10.tgz", - "integrity": "sha1-sf3lzX0RpWJmOKB8YEq5Cc+jH5s=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.1" - } - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "snapdragon": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.1.tgz", - "integrity": "sha1-4StUh/re0+PeoKyR6UAL91tAE3A=", - "dev": true, - "requires": { - "base": "0.11.2", - "debug": "2.6.9", - "define-property": "0.2.5", - "extend-shallow": "2.0.1", - "map-cache": "0.2.2", - "source-map": "0.5.7", - "source-map-resolve": "0.5.1", - "use": "2.0.2" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "0.1.6" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", - "dev": true, - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", - "dev": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", - "dev": true, - "requires": { - "define-property": "1.0.0", - "isobject": "3.0.1", - "snapdragon-util": "3.0.1" - } - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "source-list-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", - "integrity": "sha1-qqR0A/eyRakvvJfqCPJQ1gh+0IU=", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "source-map-loader": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-0.2.4.tgz", - "integrity": "sha512-OU6UJUty+i2JDpTItnizPrlpOIBLmQbWMuBg9q5bVtnHACqw1tn9nNwqJLbv0/00JjnJb/Ee5g5WS5vrRv7zIQ==", - "dev": true, - "requires": { - "async": "^2.5.0", - "loader-utils": "^1.1.0" - } - }, - "source-map-resolve": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", - "integrity": "sha1-etD1k/IoFZjoVN+A8ZquS5LXoRo=", - "dev": true, - "requires": { - "atob": "2.0.3", - "decode-uri-component": "0.2.0", - "resolve-url": "0.2.1", - "source-map-url": "0.4.0", - "urix": "0.1.0" - } - }, - "source-map-support": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", - "integrity": "sha1-Aoam3ovkJkEzhZTpfM6nXwosWF8=", - "dev": true, - "requires": { - "source-map": "0.5.7" - } - }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true - }, - "spdx-correct": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", - "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", - "dev": true, - "requires": { - "spdx-license-ids": "1.2.2" - } - }, - "spdx-expression-parse": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", - "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", - "dev": true - }, - "spdx-license-ids": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", - "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", - "dev": true - }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", - "dev": true, - "requires": { - "extend-shallow": "3.0.2" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "1.0.0", - "is-extendable": "1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", - "dev": true, - "requires": { - "is-plain-object": "2.0.4" - } - } - } - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "requires": { - "define-property": "0.2.5", - "object-copy": "0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "0.1.6" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", - "dev": true, - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", - "dev": true - } - } - }, - "stream-browserify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", - "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3" - } - }, - "stream-http": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.0.tgz", - "integrity": "sha1-/YZUbaybHJGv+PxdKHuY+vtBvBA=", - "dev": true, - "requires": { - "builtin-status-codes": "3.0.0", - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "to-arraybuffer": "1.0.1", - "xtend": "4.0.1" - } - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } - } - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - }, - "tapable": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.8.tgz", - "integrity": "sha1-mTcqXJmb8t8WCvwNdL7U9HlIzSI=", - "dev": true - }, - "timers-browserify": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.4.tgz", - "integrity": "sha1-lspT9LeUpefA4b18yIo3Ipj6AeY=", - "dev": true, - "requires": { - "setimmediate": "1.0.5" - } - }, - "to-arraybuffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", - "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", - "dev": true - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "to-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.1.tgz", - "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", - "dev": true, - "requires": { - "define-property": "0.2.5", - "extend-shallow": "2.0.1", - "regex-not": "1.0.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "0.1.6" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", - "dev": true, - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", - "dev": true - } - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "requires": { - "is-number": "3.0.0", - "repeat-string": "1.6.1" - } - }, - "tty-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", - "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", - "dev": true - }, - "typescript": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.2.tgz", - "integrity": "sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q=", - "dev": true - }, - "uglify-js": { - "version": "2.8.29", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", - "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", - "dev": true, - "requires": { - "source-map": "0.5.7", - "uglify-to-browserify": "1.0.2", - "yargs": "3.10.0" - }, - "dependencies": { - "yargs": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", - "dev": true, - "requires": { - "camelcase": "1.2.1", - "cliui": "2.1.0", - "decamelize": "1.2.0", - "window-size": "0.1.0" - } - } - } - }, - "uglify-to-browserify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", - "dev": true, - "optional": true - }, - "uglifyjs-webpack-plugin": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-0.4.6.tgz", - "integrity": "sha1-uVH0q7a9YX5m9j64kUmOORdj4wk=", - "dev": true, - "requires": { - "source-map": "0.5.7", - "uglify-js": "2.8.29", - "webpack-sources": "1.1.0" - } - }, - "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", - "dev": true, - "requires": { - "arr-union": "3.1.0", - "get-value": "2.0.6", - "is-extendable": "0.1.1", - "set-value": "0.4.3" - }, - "dependencies": { - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true, - "requires": { - "extend-shallow": "2.0.1", - "is-extendable": "0.1.1", - "is-plain-object": "2.0.4", - "to-object-path": "0.3.0" - } - } - } - }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "requires": { - "has-value": "0.3.1", - "isobject": "3.0.1" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "requires": { - "get-value": "2.0.6", - "has-values": "0.1.4", - "isobject": "2.1.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true - } - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "dev": true, - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", - "dev": true - } - } - }, - "use": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/use/-/use-2.0.2.tgz", - "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", - "dev": true, - "requires": { - "define-property": "0.2.5", - "isobject": "3.0.1", - "lazy-cache": "2.0.2" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "0.1.6" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", - "dev": true, - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", - "dev": true - } - } - }, - "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "dev": true, - "requires": { - "inherits": "2.0.1" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", - "dev": true - } - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "validate-npm-package-license": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", - "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", - "dev": true, - "requires": { - "spdx-correct": "1.0.2", - "spdx-expression-parse": "1.0.4" - } - }, - "vm-browserify": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", - "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", - "dev": true, - "requires": { - "indexof": "0.0.1" - } - }, - "watchpack": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.4.0.tgz", - "integrity": "sha1-ShRyvLuVK9Cpu0A2gB+VTfs5+qw=", - "dev": true, - "requires": { - "async": "2.6.0", - "chokidar": "1.7.0", - "graceful-fs": "4.1.11" - } - }, - "webpack": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.10.0.tgz", - "integrity": "sha1-UpG4dQeM8qv0K90jr+P4+WwX1yU=", - "dev": true, - "requires": { - "acorn": "5.3.0", - "acorn-dynamic-import": "2.0.2", - "ajv": "5.5.2", - "ajv-keywords": "2.1.1", - "async": "2.6.0", - "enhanced-resolve": "3.4.1", - "escope": "3.6.0", - "interpret": "1.1.0", - "json-loader": "0.5.7", - "json5": "0.5.1", - "loader-runner": "2.3.0", - "loader-utils": "1.1.0", - "memory-fs": "0.4.1", - "mkdirp": "0.5.1", - "node-libs-browser": "2.1.0", - "source-map": "0.5.7", - "supports-color": "4.5.0", - "tapable": "0.2.8", - "uglifyjs-webpack-plugin": "0.4.6", - "watchpack": "1.4.0", - "webpack-sources": "1.1.0", - "yargs": "8.0.2" - }, - "dependencies": { - "enhanced-resolve": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz", - "integrity": "sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "memory-fs": "0.4.1", - "object-assign": "4.1.1", - "tapable": "0.2.8" - } - } - } - }, - "webpack-sources": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz", - "integrity": "sha1-oQHrrlnWUHNU1x2AE5UKOot6WlQ=", - "dev": true, - "requires": { - "source-list-map": "2.0.0", - "source-map": "0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=", - "dev": true - } - } - }, - "which": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=", - "dev": true, - "requires": { - "isexe": "2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "window-size": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", - "dev": true - }, - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1" - }, - "dependencies": { - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - } - } - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - }, - "yargs": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", - "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", - "dev": true, - "requires": { - "camelcase": "4.1.0", - "cliui": "3.2.0", - "decamelize": "1.2.0", - "get-caller-file": "1.0.2", - "os-locale": "2.1.0", - "read-pkg-up": "2.0.0", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "2.1.1", - "which-module": "2.0.0", - "y18n": "3.2.1", - "yargs-parser": "7.0.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "dev": true, - "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" - }, - "dependencies": { - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - } - } - } - } - }, - "yargs-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", - "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", - "dev": true, - "requires": { - "camelcase": "4.1.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - } - } - } - } -} +{ + "name": "paintbricks", + "version": "1.0.2", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "paintbricks", + "version": "1.0.2", + "license": "MIT", + "dependencies": { + "color-alpha": "^1.1.3" + }, + "devDependencies": { + "esbuild": "^0.19.5", + "prettier": "^3.1.0", + "typescript": "^5.2.2", + "vite": "^5.0.0" + }, + "engines": { + "node": " >=14.13.1 || >=16.0.0" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", + "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz", + "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz", + "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz", + "integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz", + "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz", + "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz", + "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz", + "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz", + "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz", + "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz", + "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz", + "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz", + "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz", + "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz", + "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz", + "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz", + "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz", + "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz", + "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz", + "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz", + "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz", + "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.4.1.tgz", + "integrity": "sha512-Ss4suS/sd+6xLRu+MLCkED2mUrAyqHmmvZB+zpzZ9Znn9S8wCkTQCJaQ8P8aHofnvG5L16u9MVnJjCqioPErwQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.4.1.tgz", + "integrity": "sha512-sRSkGTvGsARwWd7TzC8LKRf8FiPn7257vd/edzmvG4RIr9x68KBN0/Ek48CkuUJ5Pj/Dp9vKWv6PEupjKWjTYA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.4.1.tgz", + "integrity": "sha512-nz0AiGrrXyaWpsmBXUGOBiRDU0wyfSXbFuF98pPvIO8O6auQsPG6riWsfQqmCCC5FNd8zKQ4JhgugRNAkBJ8mQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.4.1.tgz", + "integrity": "sha512-Ogqvf4/Ve/faMaiPRvzsJEqajbqs00LO+8vtrPBVvLgdw4wBg6ZDXdkDAZO+4MLnrc8mhGV6VJAzYScZdPLtJg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.4.1.tgz", + "integrity": "sha512-9zc2tqlr6HfO+hx9+wktUlWTRdje7Ub15iJqKcqg5uJZ+iKqmd2CMxlgPpXi7+bU7bjfDIuvCvnGk7wewFEhCg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.4.1.tgz", + "integrity": "sha512-phLb1fN3rq2o1j1v+nKxXUTSJnAhzhU0hLrl7Qzb0fLpwkGMHDem+o6d+ZI8+/BlTXfMU4kVWGvy6g9k/B8L6Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.4.1.tgz", + "integrity": "sha512-M2sDtw4tf57VPSjbTAN/lz1doWUqO2CbQuX3L9K6GWIR5uw9j+ROKCvvUNBY8WUbMxwaoc8mH9HmmBKsLht7+w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.4.1.tgz", + "integrity": "sha512-mHIlRLX+hx+30cD6c4BaBOsSqdnCE4ok7/KDvjHYAHoSuveoMMxIisZFvcLhUnyZcPBXDGZTuBoalcuh43UfQQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.4.1.tgz", + "integrity": "sha512-tB+RZuDi3zxFx7vDrjTNGVLu2KNyzYv+UY8jz7e4TMEoAj7iEt8Qk6xVu6mo3pgjnsHj6jnq3uuRsHp97DLwOA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.4.1.tgz", + "integrity": "sha512-Hdn39PzOQowK/HZzYpCuZdJC91PE6EaGbTe2VCA9oq2u18evkisQfws0Smh9QQGNNRa/T7MOuGNQoLeXhhE3PQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.4.1.tgz", + "integrity": "sha512-tLpKb1Elm9fM8c5w3nl4N1eLTP4bCqTYw9tqUBxX8/hsxqHO3dxc2qPbZ9PNkdK4tg4iLEYn0pOUnVByRd2CbA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.4.1.tgz", + "integrity": "sha512-eAhItDX9yQtZVM3yvXS/VR3qPqcnXvnLyx1pLXl4JzyNMBNO3KC986t/iAg2zcMzpAp9JSvxB5VZGnBiNoA98w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/color-alpha": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-alpha/-/color-alpha-1.1.3.tgz", + "integrity": "sha512-krPYBO1RSO5LH4AGb/b6z70O1Ip2o0F0+0cVFN5FN99jfQtZFT08rQyg+9oOBNJYAn3SRwJIFC8jUEOKz7PisA==", + "dependencies": { + "color-parse": "^1.4.1" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/color-parse": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/color-parse/-/color-parse-1.4.3.tgz", + "integrity": "sha512-BADfVl/FHkQkyo8sRBwMYBqemqsgnu7JZAwUgvBvuwwuNUZAhSvLTbsEErS5bQXzOjDR0dWzJ4vXN2Q+QoPx0A==", + "dependencies": { + "color-name": "^1.0.0" + } + }, + "node_modules/esbuild": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz", + "integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.19.5", + "@esbuild/android-arm64": "0.19.5", + "@esbuild/android-x64": "0.19.5", + "@esbuild/darwin-arm64": "0.19.5", + "@esbuild/darwin-x64": "0.19.5", + "@esbuild/freebsd-arm64": "0.19.5", + "@esbuild/freebsd-x64": "0.19.5", + "@esbuild/linux-arm": "0.19.5", + "@esbuild/linux-arm64": "0.19.5", + "@esbuild/linux-ia32": "0.19.5", + "@esbuild/linux-loong64": "0.19.5", + "@esbuild/linux-mips64el": "0.19.5", + "@esbuild/linux-ppc64": "0.19.5", + "@esbuild/linux-riscv64": "0.19.5", + "@esbuild/linux-s390x": "0.19.5", + "@esbuild/linux-x64": "0.19.5", + "@esbuild/netbsd-x64": "0.19.5", + "@esbuild/openbsd-x64": "0.19.5", + "@esbuild/sunos-x64": "0.19.5", + "@esbuild/win32-arm64": "0.19.5", + "@esbuild/win32-ia32": "0.19.5", + "@esbuild/win32-x64": "0.19.5" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prettier": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/rollup": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.4.1.tgz", + "integrity": "sha512-idZzrUpWSblPJX66i+GzrpjKE3vbYrlWirUHteoAbjKReZwa0cohAErOYA5efoMmNCdvG9yrJS+w9Kl6csaH4w==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.4.1", + "@rollup/rollup-android-arm64": "4.4.1", + "@rollup/rollup-darwin-arm64": "4.4.1", + "@rollup/rollup-darwin-x64": "4.4.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.4.1", + "@rollup/rollup-linux-arm64-gnu": "4.4.1", + "@rollup/rollup-linux-arm64-musl": "4.4.1", + "@rollup/rollup-linux-x64-gnu": "4.4.1", + "@rollup/rollup-linux-x64-musl": "4.4.1", + "@rollup/rollup-win32-arm64-msvc": "4.4.1", + "@rollup/rollup-win32-ia32-msvc": "4.4.1", + "@rollup/rollup-win32-x64-msvc": "4.4.1", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/vite": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.0.tgz", + "integrity": "sha512-ESJVM59mdyGpsiNAeHQOR/0fqNoOyWPYesFto8FFZugfmhdHx8Fzd8sF3Q/xkVhZsyOxHfdM7ieiVAorI9RjFw==", + "dev": true, + "dependencies": { + "esbuild": "^0.19.3", + "postcss": "^8.4.31", + "rollup": "^4.2.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json index 3703fe0..10353d8 100644 --- a/package.json +++ b/package.json @@ -1,33 +1,38 @@ -{ - "name": "paintbricks", - "version": "0.0.2", - "description": "An extendable drawing system built for the web.", - "main": "lib/index.js", - "devDependencies": { - "awesome-typescript-loader": "^3.4.1", - "prettier": "^1.10.2", - "source-map-loader": "^0.2.3", - "typescript": "^2.6.2", - "webpack": "^3.10.0" - }, - "scripts": { - "build": "./node_modules/.bin/webpack --config webpack.config.js", - "build-example": "./node_modules/.bin/webpack --config example/webpack.config.js", - "format": "./node_modules/.bin/prettier es6 --write \"{src/**/*.ts,webpack.config.js}\"", - "prepublish": "npm run build" - }, - "typings": "src/index.d.ts", - "repository": { - "type": "git", - "url": "git+https://github.com/tshaddix/paintbricks.git" - }, - "author": "Tyler Shaddix ", - "license": "MIT", - "bugs": { - "url": "https://github.com/tshaddix/paintbricks/issues" - }, - "homepage": "https://github.com/tshaddix/paintbricks#readme", - "dependencies": { - "parse-color": "^1.0.0" - } -} +{ + "name": "paintbricks", + "version": "1.0.2", + "description": "An extendable drawing system built for the web.", + "exports": "./dist/index.esm.js", + "engines": { + "node": " >=14.13.1 || >=16.0.0" + }, + "type": "module", + "scripts": { + "build": "vite build", + "build-example": "vite build --config example/vite.config.js", + "prepublish": "npm run build", + "typecheck": "tsc --skipLibCheck", + "prettier": "prettier --check \"{src,example/src}/**/*.{ts,json}\"", + "prettier:fix": "prettier --write \"{src,example/src}/**/*.{ts,json}\"" + }, + "typings": "src/index.d.ts", + "repository": { + "type": "git", + "url": "git+https://github.com/tshaddix/paintbricks.git" + }, + "author": "Tyler Shaddix ", + "license": "MIT", + "bugs": { + "url": "https://github.com/tshaddix/paintbricks/issues" + }, + "homepage": "https://github.com/tshaddix/paintbricks#readme", + "dependencies": { + "color-alpha": "^1.1.3" + }, + "devDependencies": { + "esbuild": "^0.19.5", + "prettier": "^3.1.0", + "typescript": "^5.2.2", + "vite": "^5.0.0" + } +} diff --git a/src/Manager.d.ts b/src/Manager.d.ts index 1b2b296..63b5e39 100644 --- a/src/Manager.d.ts +++ b/src/Manager.d.ts @@ -1,45 +1,45 @@ -import { ITool } from "./types"; -export declare class Manager { - private canvas; - private strokeManager; - private pixelRatio; - private canvasWidth; - private canvasHeight; - private nextAnimationFrame; - private currentTool; - private currentStroke; - private canvasState; - private shouldDraw; - private shouldCommit; - constructor(canvas: HTMLCanvasElement, canvasWidth: number, canvasHeight: number); - /** - * Sets the canvas desired width and height and sets transform - * for hifi displays - * @param width - * @param height - */ - setCanvasSize(width: number, height: number): void; - /** - * Sets the current tool for the manager - * @param tool - */ - setTool(tool: ITool): void; - /** - * Remove all event listeners - */ - destroy(): void; - /** - * Clears the canvas - */ - clear(): void; - /** - * Adds a new stroke part to the nextStrokes - * array - * @param strokePart - */ - private onStrokePart(strokePart); - /** - * Draws a frame - */ - private draw(); -} +import { ITool } from "./types"; +export declare class Manager { + private canvas; + private strokeManager; + private pixelRatio; + private canvasWidth; + private canvasHeight; + private nextAnimationFrame; + private currentTool; + private currentStroke; + private canvasState; + private shouldDraw; + private shouldCommit; + constructor(canvas: HTMLCanvasElement, canvasWidth: number, canvasHeight: number); + /** + * Sets the canvas desired width and height and sets transform + * for hifi displays + * @param width + * @param height + */ + setCanvasSize(width: number, height: number): void; + /** + * Sets the current tool for the manager + * @param tool + */ + setTool(tool: ITool): void; + /** + * Remove all event listeners + */ + destroy(): void; + /** + * Clears the canvas + */ + clear(): void; + /** + * Adds a new stroke part to the nextStrokes + * array + * @param strokePart + */ + private onStrokePart; + /** + * Draws a frame + */ + private draw; +} diff --git a/src/Manager.js b/src/Manager.js new file mode 100644 index 0000000..e22a88b --- /dev/null +++ b/src/Manager.js @@ -0,0 +1,121 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Manager = void 0; +const StrokeManager_1 = require("./StrokeManager"); +class Manager { + constructor(canvas, canvasWidth, canvasHeight) { + this.canvas = canvas; + this.canvasWidth = canvasWidth; + this.canvasHeight = canvasHeight; + this.currentTool = null; + this.currentStroke = []; + this.strokeManager = new StrokeManager_1.StrokeManager(canvas); + this.canvasState = null; + this.shouldDraw = false; + this.shouldCommit = false; + // find pixel ratio relative to backing store and device ratio + const bsr = canvas.getContext("2d").backingStorePixelRatio || 1; + const dpr = window.devicePixelRatio || 1; + this.pixelRatio = dpr / bsr; + this.setCanvasSize = this.setCanvasSize.bind(this); + this.setTool = this.setTool.bind(this); + this.destroy = this.destroy.bind(this); + this.clear = this.clear.bind(this); + this.draw = this.draw.bind(this); + this.onStrokePart = this.onStrokePart.bind(this); + // schedule animation frame loop + this.nextAnimationFrame = window.requestAnimationFrame(this.draw); + // set up listener for new stroke part + this.strokeManager.onStrokePart(this.onStrokePart); + this.setCanvasSize(canvasWidth, canvasHeight); + } + /** + * Sets the canvas desired width and height and sets transform + * for hifi displays + * @param width + * @param height + */ + setCanvasSize(width, height) { + this.canvasWidth = width; + this.canvasHeight = height; + const { canvas, canvasWidth, canvasHeight, pixelRatio } = this; + const ctx = canvas.getContext("2d"); + // appropriately scale canvas to map to device ratio + canvas.width = canvasWidth * pixelRatio; + canvas.height = canvasHeight * pixelRatio; + canvas.style.width = canvasWidth + "px"; + canvas.style.height = canvasHeight + "px"; + ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); + } + /** + * Sets the current tool for the manager + * @param tool + */ + setTool(tool) { + this.currentTool = tool; + } + /** + * Remove all event listeners + */ + destroy() { + // cancel animation loop + window.cancelAnimationFrame(this.nextAnimationFrame); + // remove all listeners on stroke manager + this.strokeManager.destroy(); + } + /** + * Clears the canvas + */ + clear() { + this.canvasState = null; + this.currentStroke = []; + this.shouldDraw = true; + this.shouldCommit = true; + } + /** + * Adds a new stroke part to the nextStrokes + * array + * @param strokePart + */ + onStrokePart(strokePart) { + this.currentStroke.push(strokePart); + this.shouldDraw = true; + if (strokePart.isEnd) { + this.shouldCommit = true; + } + } + /** + * Draws a frame + */ + draw() { + // schedule next draw + this.nextAnimationFrame = window.requestAnimationFrame(this.draw); + const ctx = this.canvas.getContext("2d"); + if (!this.shouldDraw) { + return; + } + // clear canvas + ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight); + // draw current state + if (this.canvasState) { + ctx.putImageData(this.canvasState, 0, 0); + } + // if a tool has been selected and there are + // pending strokes, draw them + if (this.currentTool && this.currentStroke.length) { + ctx.save(); + this.currentTool.draw(ctx, this.currentStroke); + ctx.restore(); + } + // if all changes have been made for current stroke, + // save it as the new canvas state + if (this.shouldCommit) { + this.canvasState = ctx.getImageData(0, 0, this.canvasWidth * this.pixelRatio, this.canvasHeight * this.pixelRatio); + this.currentStroke = []; + this.shouldCommit = false; + } + this.shouldDraw = false; + } +} +exports.Manager = Manager; +//# sourceMappingURL=Manager.js.map \ No newline at end of file diff --git a/src/Manager.js.map b/src/Manager.js.map new file mode 100644 index 0000000..351cd67 --- /dev/null +++ b/src/Manager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Manager.js","sourceRoot":"","sources":["Manager.ts"],"names":[],"mappings":";;;AACA,mDAAgD;AAEhD,MAAa,OAAO;IAyBlB,YACE,MAAyB,EACzB,WAAmB,EACnB,YAAoB;QAEpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,aAAa,GAAG,IAAI,6BAAa,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1B,8DAA8D;QAC9D,MAAM,GAAG,GAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAS,CAAC,sBAAsB,IAAI,CAAC,CAAC;QACzE,MAAM,GAAG,GAAG,MAAM,CAAC,gBAAgB,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,GAAG,CAAC;QAE5B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,KAA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I,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YACjD,GAAG,CAAC,IAAI,EAAE,CAAC;YACX,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YAC/C,GAAG,CAAC,OAAO,EAAE,CAAC;SACf;QAED,oDAAoD;QACpD,kCAAkC;QAClC,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC,YAAY,CACjC,CAAC,EACD,CAAC,EACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,EAClC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,UAAU,CACpC,CAAC;YACF,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;SAC3B;QAED,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;CACF;AAzKD,0BAyKC"} \ No newline at end of file diff --git a/src/Manager.ts b/src/Manager.ts index 24bb74f..ce83327 100644 --- a/src/Manager.ts +++ b/src/Manager.ts @@ -1,4 +1,4 @@ -import { IPoint, IStrokePart, ITool } from "./types"; +import { IStrokePart, ITool } from "./types"; import { StrokeManager } from "./StrokeManager"; export class Manager { @@ -29,7 +29,7 @@ export class Manager { constructor( canvas: HTMLCanvasElement, canvasWidth: number, - canvasHeight: number + canvasHeight: number, ) { this.canvas = canvas; this.canvasWidth = canvasWidth; @@ -162,7 +162,7 @@ export class Manager { 0, 0, this.canvasWidth * this.pixelRatio, - this.canvasHeight * this.pixelRatio + this.canvasHeight * this.pixelRatio, ); this.currentStroke = []; this.shouldCommit = false; diff --git a/src/StrokeManager.d.ts b/src/StrokeManager.d.ts index c1810b0..9b0be96 100644 --- a/src/StrokeManager.d.ts +++ b/src/StrokeManager.d.ts @@ -1,55 +1,55 @@ -import { IPoint, IStrokePart } from "./types"; -export interface IOnStrokePartHandler { - (strokePart: IStrokePart): void; -} -export interface ITouch { - id: number; - position: IPoint; -} -export declare class StrokeManager { - private canvas; - private lastTouch; - private sensitivity; - private lastStrokeParts; - private onStrokePartHandlers; - constructor(canvas: HTMLCanvasElement); - /** - * Registers a handler to be fired on a new stroke part - * @param handler - */ - onStrokePart(handler: IOnStrokePartHandler): void; - /** - * Removes all active listeners - */ - destroy(): void; - /** - * Get relative position to canvas - * @param clientX - * @param clientY - * @returns IPoint - */ - private getRelativePosition(clientX, clientY); - /** - * Creates a new touch if one does not - * already exist - * @param e - */ - private onTouchStart(e); - /** - * Creates a line from last touch to current touch - * point and emits event. Does no-op if no existing touch - * @param e - */ - private onTouchMove(e); - /** - * Draws a line from last point to final point. Removes - * the reference to last touch point. - * @param e - */ - private onTouchEnd(e); - /** - * Removes the current last touch point - * @param e - */ - private onTouchCancel(e); -} +import { IPoint, IStrokePart } from "./types"; +export interface IOnStrokePartHandler { + (strokePart: IStrokePart): void; +} +export interface ITouch { + id: number; + position: IPoint; +} +export declare class StrokeManager { + private canvas; + private lastTouch; + private sensitivity; + private lastStrokeParts; + private onStrokePartHandlers; + constructor(canvas: HTMLCanvasElement); + /** + * Registers a handler to be fired on a new stroke part + * @param handler + */ + onStrokePart(handler: IOnStrokePartHandler): void; + /** + * Removes all active listeners + */ + destroy(): void; + /** + * Get relative position to canvas + * @param clientX + * @param clientY + * @returns IPoint + */ + private getRelativePosition; + /** + * Creates a new touch if one does not + * already exist + * @param e + */ + private onTouchStart; + /** + * Creates a line from last touch to current touch + * point and emits event. Does no-op if no existing touch + * @param e + */ + private onTouchMove; + /** + * Draws a line from last point to final point. Removes + * the reference to last touch point. + * @param e + */ + private onTouchEnd; + /** + * Removes the current last touch point + * @param e + */ + private onTouchCancel; +} diff --git a/src/StrokeManager.js b/src/StrokeManager.js new file mode 100644 index 0000000..da67f47 --- /dev/null +++ b/src/StrokeManager.js @@ -0,0 +1,173 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StrokeManager = void 0; +const util_1 = require("./util"); +class StrokeManager { + constructor(canvas) { + this.canvas = canvas; + this.lastTouch = null; + this.sensitivity = 20.0; + this.lastStrokeParts = []; + this.onStrokePartHandlers = []; + this.onTouchStart = this.onTouchStart.bind(this); + this.onTouchEnd = this.onTouchEnd.bind(this); + this.onTouchCancel = this.onTouchCancel.bind(this); + this.onTouchMove = this.onTouchMove.bind(this); + this.destroy = this.destroy.bind(this); + this.getRelativePosition = this.getRelativePosition.bind(this); + this.canvas.addEventListener("touchstart", this.onTouchStart, { + passive: false, + }); + this.canvas.addEventListener("touchend", this.onTouchEnd, { + passive: false, + }); + this.canvas.addEventListener("touchcancel", this.onTouchCancel, { + passive: false, + }); + this.canvas.addEventListener("touchmove", this.onTouchMove, { + passive: false, + }); + } + /** + * Registers a handler to be fired on a new stroke part + * @param handler + */ + onStrokePart(handler) { + this.onStrokePartHandlers.push(handler); + } + /** + * Removes all active listeners + */ + destroy() { + this.onStrokePartHandlers = []; + this.lastStrokeParts = []; + this.canvas.removeEventListener("touchstart", this.onTouchStart); + this.canvas.removeEventListener("touchend", this.onTouchEnd); + this.canvas.removeEventListener("touchcancel", this.onTouchCancel); + this.canvas.removeEventListener("touchmove", this.onTouchMove); + } + /** + * Get relative position to canvas + * @param clientX + * @param clientY + * @returns IPoint + */ + getRelativePosition(clientX, clientY) { + const rect = this.canvas.getBoundingClientRect(); + return { + x: clientX - rect.left, + y: clientY - rect.top, + }; + } + /** + * Creates a new touch if one does not + * already exist + * @param e + */ + onTouchStart(e) { + e.preventDefault(); + // if there is an ongoing touch, ignore this event + if (this.lastTouch) { + return; + } + const touches = e.changedTouches; + // only get the first touch + const touch = touches.item(0); + // save the touch + this.lastTouch = { + id: touch.identifier, + position: this.getRelativePosition(touch.clientX, touch.clientY), + }; + } + /** + * Creates a line from last touch to current touch + * point and emits event. Does no-op if no existing touch + * @param e + */ + onTouchMove(e) { + e.preventDefault(); + // if no last touch... something is wrong + if (!this.lastTouch) { + return; + } + const touches = e.changedTouches; + // find the current touch we are tracking + const touch = Array.from(touches).find((touch) => { + return touch.identifier === this.lastTouch.id; + }); + // if the touch was not one we were tracking, + // ignore and no-op + if (!touch) { + return; + } + const nextTouch = { + id: touch.identifier, + position: this.getRelativePosition(touch.clientX, touch.clientY), + }; + // If sensitivity setting has been set, + // check if this point is far enough from last + // touch to be drawn + if (this.sensitivity && + (0, util_1.getEuclidean)(nextTouch.position, this.lastTouch.position) < + 10.0 / this.sensitivity) { + return; + } + const strokePart = { + endPoint: nextTouch.position, + startPoint: this.lastTouch.position, + isStart: this.lastStrokeParts.length === 0, + isEnd: false, + }; + this.onStrokePartHandlers.forEach((handler) => { + handler(strokePart); + }); + // save this touch as last touch + this.lastTouch = nextTouch; + this.lastStrokeParts.push(strokePart); + } + /** + * Draws a line from last point to final point. Removes + * the reference to last touch point. + * @param e + */ + onTouchEnd(e) { + e.preventDefault(); + // if no last touch... something is wrong + if (!this.lastTouch) { + return; + } + const touches = e.changedTouches; + // find the current touch we are tracking + const touch = Array.from(touches).find((touch) => { + return touch.identifier === this.lastTouch.id; + }); + // if the touch was not one we were tracking, + // ignore and no-op + if (!touch) { + return; + } + const endPoint = this.getRelativePosition(touch.clientX, touch.clientY); + const strokePart = { + startPoint: this.lastTouch.position, + endPoint, + isStart: false, + isEnd: true, + }; + this.onStrokePartHandlers.forEach((handler) => { + handler(strokePart); + }); + this.lastTouch = null; + this.lastStrokeParts = []; + } + /** + * Removes the current last touch point + * @param e + */ + onTouchCancel(e) { + e.preventDefault(); + this.lastTouch = null; + this.lastStrokeParts = []; + } +} +exports.StrokeManager = StrokeManager; +//# sourceMappingURL=StrokeManager.js.map \ No newline at end of file diff --git a/src/StrokeManager.js.map b/src/StrokeManager.js.map new file mode 100644 index 0000000..cde3dc1 --- /dev/null +++ b/src/StrokeManager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"StrokeManager.js","sourceRoot":"","sources":["StrokeManager.ts"],"names":[],"mappings":";;;AACA,iCAAsC;AAWtC,MAAa,aAAa;IA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CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;IAC5B,CAAC;CACF;AAlND,sCAkNC"} \ No newline at end of file diff --git a/src/StrokeManager.ts b/src/StrokeManager.ts index 8a8ac6f..65a215d 100644 --- a/src/StrokeManager.ts +++ b/src/StrokeManager.ts @@ -37,16 +37,16 @@ export class StrokeManager { this.getRelativePosition = this.getRelativePosition.bind(this); this.canvas.addEventListener("touchstart", this.onTouchStart, { - passive: false + passive: false, }); this.canvas.addEventListener("touchend", this.onTouchEnd, { - passive: false + passive: false, }); this.canvas.addEventListener("touchcancel", this.onTouchCancel, { - passive: false + passive: false, }); this.canvas.addEventListener("touchmove", this.onTouchMove, { - passive: false + passive: false, }); } @@ -81,7 +81,7 @@ export class StrokeManager { return { x: clientX - rect.left, - y: clientY - rect.top + y: clientY - rect.top, }; } @@ -106,7 +106,7 @@ export class StrokeManager { // save the touch this.lastTouch = { id: touch.identifier, - position: this.getRelativePosition(touch.clientX, touch.clientY) + position: this.getRelativePosition(touch.clientX, touch.clientY), }; } @@ -126,7 +126,7 @@ export class StrokeManager { const touches: TouchList = e.changedTouches; // find the current touch we are tracking - const touch: Touch = Array.from(touches).find(touch => { + const touch: Touch = Array.from(touches).find((touch) => { return touch.identifier === this.lastTouch.id; }); @@ -138,7 +138,7 @@ export class StrokeManager { const nextTouch: ITouch = { id: touch.identifier, - position: this.getRelativePosition(touch.clientX, touch.clientY) + position: this.getRelativePosition(touch.clientX, touch.clientY), }; // If sensitivity setting has been set, @@ -156,10 +156,10 @@ export class StrokeManager { endPoint: nextTouch.position, startPoint: this.lastTouch.position, isStart: this.lastStrokeParts.length === 0, - isEnd: false + isEnd: false, }; - this.onStrokePartHandlers.forEach(handler => { + this.onStrokePartHandlers.forEach((handler) => { handler(strokePart); }); @@ -184,7 +184,7 @@ export class StrokeManager { const touches: TouchList = e.changedTouches; // find the current touch we are tracking - const touch: Touch = Array.from(touches).find(touch => { + const touch: Touch = Array.from(touches).find((touch) => { return touch.identifier === this.lastTouch.id; }); @@ -200,10 +200,10 @@ export class StrokeManager { startPoint: this.lastTouch.position, endPoint, isStart: false, - isEnd: true + isEnd: true, }; - this.onStrokePartHandlers.forEach(handler => { + this.onStrokePartHandlers.forEach((handler) => { handler(strokePart); }); diff --git a/src/index.d.ts b/src/index.d.ts index b12b72f..b847885 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,4 +1,4 @@ -export { Manager } from "./Manager"; -export { PenTool } from "./tools/PenTool"; -export { EraserTool } from "./tools/EraserTool"; -export { HighlighterTool } from "./tools/HighlighterTool"; +export { Manager } from "./Manager"; +export { PenTool } from "./tools/PenTool"; +export { EraserTool } from "./tools/EraserTool"; +export { HighlighterTool } from "./tools/HighlighterTool"; diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..d6d19bc --- /dev/null +++ b/src/index.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.HighlighterTool = exports.EraserTool = exports.PenTool = exports.Manager = void 0; +var Manager_1 = require("./Manager"); +Object.defineProperty(exports, "Manager", { enumerable: true, get: function () { return Manager_1.Manager; } }); +var PenTool_1 = require("./tools/PenTool"); +Object.defineProperty(exports, "PenTool", { enumerable: true, get: function () { return PenTool_1.PenTool; } }); +var EraserTool_1 = require("./tools/EraserTool"); +Object.defineProperty(exports, "EraserTool", { enumerable: true, get: function () { return EraserTool_1.EraserTool; } }); +var HighlighterTool_1 = require("./tools/HighlighterTool"); +Object.defineProperty(exports, "HighlighterTool", { enumerable: true, get: function () { return HighlighterTool_1.HighlighterTool; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/src/index.js.map b/src/index.js.map new file mode 100644 index 0000000..e8362ca --- /dev/null +++ b/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,2CAA0C;AAAjC,kGAAA,OAAO,OAAA;AAChB,iDAAgD;AAAvC,wGAAA,UAAU,OAAA;AACnB,2DAA0D;AAAjD,kHAAA,eAAe,OAAA"} \ No newline at end of file diff --git a/src/tools/EraserTool.d.ts b/src/tools/EraserTool.d.ts index aabde4c..dcf0ebc 100644 --- a/src/tools/EraserTool.d.ts +++ b/src/tools/EraserTool.d.ts @@ -1,19 +1,18 @@ -import { IStrokePart } from "../types"; -export interface IHandleOptions { - hide: boolean; - strokeWidth: number; - fillColor: string; - strokeColor: string; -} -export declare class EraserTool { - readonly width: number; - readonly handleOpts: IHandleOptions; - private lastEndPoint; - constructor(width?: number, handleOpts?: Partial); - /** - * Draws an "eraser stroke" for all line segments - * @param ctx - * @param strokeParts - */ - draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void; -} +import { IStrokePart } from "../types"; +export interface IHandleOptions { + hide: boolean; + strokeWidth: number; + fillColor: string; + strokeColor: string; +} +export declare class EraserTool { + readonly width: number; + readonly handleOpts: IHandleOptions; + constructor(width?: number, handleOpts?: Partial); + /** + * Draws an "eraser stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void; +} diff --git a/src/tools/EraserTool.js b/src/tools/EraserTool.js new file mode 100644 index 0000000..caf3c26 --- /dev/null +++ b/src/tools/EraserTool.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EraserTool = void 0; +const util_1 = require("../util"); +class EraserTool { + constructor(width = 10, handleOpts) { + this.width = width; + handleOpts = handleOpts || {}; + this.handleOpts = { + hide: handleOpts.hide || false, + strokeWidth: handleOpts.strokeWidth || 2, + fillColor: handleOpts.fillColor || "white", + strokeColor: handleOpts.strokeColor || "black", + }; + } + /** + * Draws an "eraser stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(ctx, strokeParts) { + const { handleOpts } = this; + const halfWidth = this.width / 2.0; + strokeParts.forEach((strokePart) => { + const { startPoint, endPoint, isEnd } = strokePart; + const length = (0, util_1.getEuclidean)(startPoint, endPoint); + const unitVect = (0, util_1.getUnitVector)(startPoint, endPoint); + let currentPoint = startPoint; + let i = 0; + // clear all the way along the drag + while (i < length) { + const nextPoint = { + x: currentPoint.x + unitVect.x, + y: currentPoint.y + unitVect.y, + }; + ctx.clearRect(nextPoint.x - halfWidth, nextPoint.y - halfWidth, this.width, this.width); + i++; + currentPoint = nextPoint; + } + }); + const lastPart = strokeParts[strokeParts.length - 1]; + // if the end is not the last part, then draw + // the tool indicator at the endpoint + if (!lastPart.isEnd && !handleOpts.hide) { + ctx.strokeStyle = handleOpts.strokeColor; + ctx.fillStyle = handleOpts.fillColor; + ctx.fillRect(lastPart.endPoint.x - halfWidth, lastPart.endPoint.y - halfWidth, this.width, this.width); + ctx.strokeRect(lastPart.endPoint.x - halfWidth + 0.5, lastPart.endPoint.y - halfWidth + 0.5, this.width - 1, this.width - 1); + } + } +} +exports.EraserTool = EraserTool; +//# sourceMappingURL=EraserTool.js.map \ No newline at end of file diff --git a/src/tools/EraserTool.js.map b/src/tools/EraserTool.js.map new file mode 100644 index 0000000..9fd27b2 --- /dev/null +++ b/src/tools/EraserTool.js.map @@ -0,0 +1 @@ +{"version":3,"file":"EraserTool.js","sourceRoot":"","sources":["EraserTool.ts"],"names":[],"mappings":";;;AACA,kCAAsD;AAStD,MAAa,UAAU;IAIrB,YAAY,QAAgB,EAAE,EAAE,UAAoC;QAClE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,UAAU,GAAG,UAAU,IAAI,EAAE,CAAC;QAE9B,IAAI,CAAC,UAAU,GAAG;YAChB,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,KAAK;YAC9B,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,CAAC;YACxC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,OAAO;YAC1C,WAAW,EAAE,UAAU,CAAC,WAA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AAC,WAAW,CAAC;YACzC,GAAG,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;YAErC,GAAG,CAAC,QAAQ,CACV,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,EAC/B,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,EAC/B,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,KAAK,CACX,CAAC;YAEF,GAAG,CAAC,UAAU,CACZ,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,GAAG,EACrC,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,GAAG,EACrC,IAAI,CAAC,KAAK,GAAG,CAAC,EACd,IAAI,CAAC,KAAK,GAAG,CAAC,CACf,CAAC;SACH;IACH,CAAC;CACF;AA5ED,gCA4EC"} \ No newline at end of file diff --git a/src/tools/EraserTool.ts b/src/tools/EraserTool.ts index ba082fa..ca74e23 100644 --- a/src/tools/EraserTool.ts +++ b/src/tools/EraserTool.ts @@ -11,11 +11,9 @@ export interface IHandleOptions { export class EraserTool { readonly width: number; readonly handleOpts: IHandleOptions; - private lastEndPoint: IPoint | null; constructor(width: number = 10, handleOpts?: Partial) { this.width = width; - this.lastEndPoint = null; handleOpts = handleOpts || {}; @@ -23,7 +21,7 @@ export class EraserTool { hide: handleOpts.hide || false, strokeWidth: handleOpts.strokeWidth || 2, fillColor: handleOpts.fillColor || "white", - strokeColor: handleOpts.strokeColor || "black" + strokeColor: handleOpts.strokeColor || "black", }; } @@ -36,7 +34,7 @@ export class EraserTool { const { handleOpts } = this; const halfWidth = this.width / 2.0; - strokeParts.forEach(strokePart => { + strokeParts.forEach((strokePart) => { const { startPoint, endPoint, isEnd } = strokePart; const length = getEuclidean(startPoint, endPoint); @@ -48,14 +46,14 @@ export class EraserTool { while (i < length) { const nextPoint: IPoint = { x: currentPoint.x + unitVect.x, - y: currentPoint.y + unitVect.y + y: currentPoint.y + unitVect.y, }; ctx.clearRect( nextPoint.x - halfWidth, nextPoint.y - halfWidth, this.width, - this.width + this.width, ); i++; @@ -75,14 +73,14 @@ export class EraserTool { lastPart.endPoint.x - halfWidth, lastPart.endPoint.y - halfWidth, this.width, - this.width + this.width, ); ctx.strokeRect( lastPart.endPoint.x - halfWidth + 0.5, lastPart.endPoint.y - halfWidth + 0.5, this.width - 1, - this.width - 1 + this.width - 1, ); } } diff --git a/src/tools/HighlighterTool.d.ts b/src/tools/HighlighterTool.d.ts index fbd9e0d..ec8db85 100644 --- a/src/tools/HighlighterTool.d.ts +++ b/src/tools/HighlighterTool.d.ts @@ -1,13 +1,12 @@ -import { IStrokePart } from "../types"; -export declare class HighlighterTool { - readonly color: string; - readonly width: number; - private lastStrokePart; - constructor(color?: string, width?: number, opacity?: Number); - /** - * Draws a "highlighter stroke" for all line segments - * @param ctx - * @param strokeParts - */ - draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void; -} +import { IStrokePart } from "../types"; +export declare class HighlighterTool { + readonly color: string; + readonly width: number; + constructor(color?: string, width?: number, opacity?: Number); + /** + * Draws a "highlighter stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void; +} diff --git a/src/tools/HighlighterTool.js b/src/tools/HighlighterTool.js new file mode 100644 index 0000000..f892179 --- /dev/null +++ b/src/tools/HighlighterTool.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.HighlighterTool = void 0; +const color_alpha_1 = require("color-alpha"); +class HighlighterTool { + constructor(color = "yellow", width = 8, opacity = 0.3) { + this.width = width; + // calculate color w/ opacity + this.color = (0, color_alpha_1.default)(color, 0.4); + } + /** + * Draws a "highlighter stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(ctx, strokeParts) { + const firstPart = strokeParts[0]; + ctx.beginPath(); + ctx.lineWidth = this.width; + ctx.strokeStyle = this.color; + ctx.lineCap = "butt"; + ctx.miterLimit = 1; + ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y); + strokeParts.forEach((strokePart) => { + const { endPoint } = strokePart; + ctx.lineTo(endPoint.x, endPoint.y); + }); + ctx.stroke(); + } +} +exports.HighlighterTool = HighlighterTool; +//# sourceMappingURL=HighlighterTool.js.map \ No newline at end of file diff --git a/src/tools/HighlighterTool.js.map b/src/tools/HighlighterTool.js.map new file mode 100644 index 0000000..64b185c --- /dev/null +++ b/src/tools/HighlighterTool.js.map @@ -0,0 +1 @@ +{"version":3,"file":"HighlighterTool.js","sourceRoot":"","sources":["HighlighterTool.ts"],"names":[],"mappings":";;;AAAA,6CAAgC;AAIhC,MAAa,eAAe;IAI1B,YACE,QAAgB,QAAQ,EACxB,QAAgB,CAAC,EACjB,UAAkB,GAAG;QAErB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,6BAA6B;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAA,qBAAK,EAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,IAAI,CAAC,GAA6B,EAAE,WAA0B;QACnE,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAEjC,GAAG,CAAC,SAAS,EAAE,CAAC;QAEhB,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;QAC3B,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC;QAC7B,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;QACrB,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC;QAEnB,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAE3D,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YACjC,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;YAChC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;CACF;AAvCD,0CAuCC"} \ No newline at end of file diff --git a/src/tools/HighlighterTool.ts b/src/tools/HighlighterTool.ts index 8a981f8..3e34ccb 100644 --- a/src/tools/HighlighterTool.ts +++ b/src/tools/HighlighterTool.ts @@ -1,24 +1,20 @@ -import * as parseColor from "parse-color"; +import alpha from "color-alpha"; -import { IStrokePart, IPoint } from "../types"; -import { getUnitVector, getEuclidean } from "../util"; +import { IStrokePart } from "../types"; export class HighlighterTool { readonly color: string; readonly width: number; - private lastStrokePart: IStrokePart | null; constructor( color: string = "yellow", width: number = 8, - opacity: Number = 0.3 + opacity: Number = 0.3, ) { this.width = width; - this.lastStrokePart = null; - // calculate rgba color w/ opacity - const { rgb } = parseColor(color); - this.color = `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${opacity})`; + // calculate color w/ opacity + this.color = alpha(color, 0.4); } /** @@ -38,7 +34,7 @@ export class HighlighterTool { ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y); - strokeParts.forEach(strokePart => { + strokeParts.forEach((strokePart) => { const { endPoint } = strokePart; ctx.lineTo(endPoint.x, endPoint.y); }); diff --git a/src/tools/PenTool.d.ts b/src/tools/PenTool.d.ts index a390ee7..d9b2f3a 100644 --- a/src/tools/PenTool.d.ts +++ b/src/tools/PenTool.d.ts @@ -1,12 +1,12 @@ -import { IStrokePart } from "../types"; -export declare class PenTool { - readonly color: string; - readonly width: number; - constructor(color?: string, width?: number); - /** - * Draws a "pen stroke" for all line segments - * @param ctx - * @param strokeParts - */ - draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void; -} +import { IStrokePart } from "../types"; +export declare class PenTool { + readonly color: string; + readonly width: number; + constructor(color?: string, width?: number); + /** + * Draws a "pen stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void; +} diff --git a/src/tools/PenTool.js b/src/tools/PenTool.js new file mode 100644 index 0000000..ce94dcb --- /dev/null +++ b/src/tools/PenTool.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PenTool = void 0; +class PenTool { + constructor(color = "red", width = 3) { + this.color = color; + this.width = width; + } + /** + * Draws a "pen stroke" for all line segments + * @param ctx + * @param strokeParts + */ + draw(ctx, strokeParts) { + const firstPart = strokeParts[0]; + ctx.beginPath(); + ctx.lineWidth = this.width; + ctx.strokeStyle = this.color; + ctx.lineCap = "round"; + ctx.lineJoin = "round"; + ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y); + strokeParts.forEach((strokePart) => { + const { endPoint } = strokePart; + ctx.lineTo(endPoint.x, endPoint.y); + }); + ctx.stroke(); + } +} +exports.PenTool = PenTool; +//# sourceMappingURL=PenTool.js.map \ No newline at end of file diff --git a/src/tools/PenTool.js.map b/src/tools/PenTool.js.map new file mode 100644 index 0000000..0d424f1 --- /dev/null +++ b/src/tools/PenTool.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PenTool.js","sourceRoot":"","sources":["PenTool.ts"],"names":[],"mappings":";;;AAEA,MAAa,OAAO;IAIlB,YAAY,QAAgB,KAAK,EAAE,QAAgB,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACI,IAAI,CAAC,GAA6B,EAAE,WAA0B;QACnE,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAEjC,GAAG,CAAC,SAAS,EAAE,CAAC;QAEhB,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;QAC3B,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC;QAC7B,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACtB,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC;QAEvB,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAE3D,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YACjC,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;YAChC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;CACF;AAjCD,0BAiCC"} \ No newline at end of file diff --git a/src/tools/PenTool.ts b/src/tools/PenTool.ts index ff5bc98..764dd5b 100644 --- a/src/tools/PenTool.ts +++ b/src/tools/PenTool.ts @@ -26,7 +26,7 @@ export class PenTool { ctx.moveTo(firstPart.startPoint.x, firstPart.startPoint.y); - strokeParts.forEach(strokePart => { + strokeParts.forEach((strokePart) => { const { endPoint } = strokePart; ctx.lineTo(endPoint.x, endPoint.y); }); diff --git a/src/types.d.ts b/src/types.d.ts new file mode 100644 index 0000000..2fc248e --- /dev/null +++ b/src/types.d.ts @@ -0,0 +1,15 @@ +export interface IPoint { + x: number; + y: number; +} +export interface IStrokePart extends ILine { + isStart: boolean; + isEnd: boolean; +} +export interface ILine { + startPoint: IPoint; + endPoint: IPoint; +} +export interface ITool { + draw(ctx: CanvasRenderingContext2D, strokeParts: IStrokePart[]): void; +} diff --git a/src/types.js b/src/types.js new file mode 100644 index 0000000..11e638d --- /dev/null +++ b/src/types.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/src/types.js.map b/src/types.js.map new file mode 100644 index 0000000..8da0887 --- /dev/null +++ b/src/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/util.d.ts b/src/util.d.ts index 2111b3d..3e702e7 100644 --- a/src/util.d.ts +++ b/src/util.d.ts @@ -1,16 +1,16 @@ -import { IPoint } from "./types"; -/** - * Get the distance between two points - * @param p1 - * @param p2 - * @returns number - */ -export declare function getEuclidean(p1: IPoint, p2: IPoint): number; -/** - * Gets the unit vector representing the vector from start - * point to end point with a length of 1. - * @param startPoint - * @param endPoint - * @returns IPoint - */ -export declare function getUnitVector(startPoint: IPoint, endPoint: IPoint): IPoint; +import { IPoint } from "./types"; +/** + * Get the distance between two points + * @param p1 + * @param p2 + * @returns number + */ +export declare function getEuclidean(p1: IPoint, p2: IPoint): number; +/** + * Gets the unit vector representing the vector from start + * point to end point with a length of 1. + * @param startPoint + * @param endPoint + * @returns IPoint + */ +export declare function getUnitVector(startPoint: IPoint, endPoint: IPoint): IPoint; diff --git a/src/util.js b/src/util.js new file mode 100644 index 0000000..dfc28bf --- /dev/null +++ b/src/util.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getUnitVector = exports.getEuclidean = void 0; +/** + * Get the distance between two points + * @param p1 + * @param p2 + * @returns number + */ +function getEuclidean(p1, p2) { + return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); +} +exports.getEuclidean = getEuclidean; +/** + * Gets the unit vector representing the vector from start + * point to end point with a length of 1. + * @param startPoint + * @param endPoint + * @returns IPoint + */ +function getUnitVector(startPoint, endPoint) { + const length = getEuclidean(startPoint, endPoint); + const dirVect = { + x: endPoint.x - startPoint.x, + y: endPoint.y - startPoint.y, + }; + const unitVect = { + x: dirVect.x / length, + y: dirVect.y / length, + }; + return unitVect; +} +exports.getUnitVector = getUnitVector; +//# sourceMappingURL=util.js.map \ No newline at end of file diff --git a/src/util.js.map b/src/util.js.map new file mode 100644 index 0000000..48f6402 --- /dev/null +++ b/src/util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"util.js","sourceRoot":"","sources":["util.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,EAAU,EAAE,EAAU;IACjD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAFD,oCAEC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,UAAkB,EAAE,QAAgB;IAChE,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAElD,MAAM,OAAO,GAAG;QACd,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;QAC5B,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;KAC7B,CAAC;IAEF,MAAM,QAAQ,GAAW;QACvB,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM;QACrB,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM;KACtB,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAdD,sCAcC"} \ No newline at end of file diff --git a/src/util.ts b/src/util.ts index c6b01ac..a83a78a 100644 --- a/src/util.ts +++ b/src/util.ts @@ -18,16 +18,16 @@ export function getEuclidean(p1: IPoint, p2: IPoint): number { * @returns IPoint */ export function getUnitVector(startPoint: IPoint, endPoint: IPoint): IPoint { - const length = this.getEuclidean(startPoint, endPoint); + const length = getEuclidean(startPoint, endPoint); const dirVect = { x: endPoint.x - startPoint.x, - y: endPoint.y - startPoint.y + y: endPoint.y - startPoint.y, }; const unitVect: IPoint = { x: dirVect.x / length, - y: dirVect.y / length + y: dirVect.y / length, }; return unitVect; diff --git a/tsconfig.json b/tsconfig.json index 4577e3e..f287c91 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,11 @@ -{ - "compilerOptions": { - "sourceMap": true, - "module": "commonjs", - "target": "es6", - "declaration": true - }, - "include": [ - "./src/**/*" - ] +{ + "compilerOptions": { + "sourceMap": true, + "module": "commonjs", + "target": "es6", + "declaration": true + }, + "include": [ + "./src/**/*" + ] } \ No newline at end of file diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..0537383 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,25 @@ +import { defineConfig } from "vite"; +import path from "path"; + +export default defineConfig({ + build: { + outDir: "dist", + lib: { + entry: path.resolve(__dirname, "src/index.ts"), + name: "Paintbricks", + fileName: (format) => `index.${format}.js`, + }, + sourcemap: true, + }, + resolve: { + alias: { + "@": path.resolve(__dirname, "src"), + }, + extensions: [".ts", ".js", ".json"], + }, + esbuild: { + loader: "ts", + include: /\.tsx?$/, + exclude: /node_modules/, + }, +}); diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 63ac46c..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,28 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - - output: { - filename: "index.js", - path: __dirname + "/lib/", - library: "Paintbricks", - libraryTarget: "umd" - }, - - // Enable sourcemaps for debugging webpack's output. - devtool: "source-map", - - resolve: { - // Add '.ts' and '.tsx' as resolvable extensions. - extensions: [".ts", ".js", ".json"] - }, - - module: { - rules: [ - // All files with a '.ts' extension will be handled by 'awesome-typescript-loader'. - { test: /\.tsx?$/, loader: "awesome-typescript-loader" }, - - // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. - { enforce: "pre", test: /\.js$/, loader: "source-map-loader" } - ] - } -};