├── LICENSE ├── README.md ├── README_zh.md ├── img ├── 1上.png ├── 1下.jpg ├── 2上.jpg ├── 2下.jpg ├── 3上.jpg ├── 3下.jpg └── 4.jpg ├── js-screenshot-for-npm ├── README.md ├── js_screen_shot.js ├── node_modules │ ├── base64-arraybuffer │ │ ├── .npmignore │ │ ├── .travis.yml │ │ ├── LICENSE-MIT │ │ ├── README.md │ │ ├── lib │ │ │ └── base64-arraybuffer.js │ │ └── package.json │ ├── css-line-break │ │ ├── .flowconfig │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ │ ├── LineBreak.js │ │ │ ├── Trie.js │ │ │ ├── TrieBuilder.js │ │ │ ├── Util.js │ │ │ ├── index.js │ │ │ └── linebreak-trie.js │ │ ├── package-lock.json │ │ └── package.json │ └── html2canvas │ │ ├── .flowconfig │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ ├── RefTestRenderer.js │ │ ├── html2canvas.js │ │ ├── html2canvas.min.js │ │ └── npm │ │ │ ├── Angle.js │ │ │ ├── Bounds.js │ │ │ ├── Clone.js │ │ │ ├── Color.js │ │ │ ├── Feature.js │ │ │ ├── Font.js │ │ │ ├── Gradient.js │ │ │ ├── Input.js │ │ │ ├── Length.js │ │ │ ├── ListItem.js │ │ │ ├── Logger.js │ │ │ ├── NodeContainer.js │ │ │ ├── NodeParser.js │ │ │ ├── Proxy.js │ │ │ ├── PseudoNodeContent.js │ │ │ ├── Renderer.js │ │ │ ├── ResourceLoader.js │ │ │ ├── StackingContext.js │ │ │ ├── TextBounds.js │ │ │ ├── TextContainer.js │ │ │ ├── Unicode.js │ │ │ ├── Util.js │ │ │ ├── Window.js │ │ │ ├── drawing │ │ │ ├── BezierCurve.js │ │ │ ├── Circle.js │ │ │ ├── Path.js │ │ │ ├── Size.js │ │ │ └── Vector.js │ │ │ ├── index.js │ │ │ ├── parsing │ │ │ ├── background.js │ │ │ ├── border.js │ │ │ ├── borderRadius.js │ │ │ ├── display.js │ │ │ ├── float.js │ │ │ ├── font.js │ │ │ ├── letterSpacing.js │ │ │ ├── lineBreak.js │ │ │ ├── listStyle.js │ │ │ ├── margin.js │ │ │ ├── overflow.js │ │ │ ├── overflowWrap.js │ │ │ ├── padding.js │ │ │ ├── position.js │ │ │ ├── textDecoration.js │ │ │ ├── textShadow.js │ │ │ ├── textTransform.js │ │ │ ├── transform.js │ │ │ ├── visibility.js │ │ │ ├── word-break.js │ │ │ └── zIndex.js │ │ │ └── renderer │ │ │ ├── CanvasRenderer.js │ │ │ ├── ForeignObjectRenderer.js │ │ │ └── RefTestRenderer.js │ │ ├── flow-typed │ │ └── myLibDef.js │ │ ├── package-lock.json │ │ └── package.json ├── package-lock.json └── package.json ├── simple ├── canvas2image.js ├── html2canvas.min.js ├── index.html └── jquery-3.3.1.js └── webpack+vue+element ├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── build ├── build.js ├── check-versions.js ├── logo.png ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js └── webpack.prod.conf.js ├── config ├── dev.env.js ├── index.js └── prod.env.js ├── index.html ├── package-lock.json ├── package.json ├── src ├── App.vue ├── assets │ └── logo.png ├── components │ └── html2img.vue ├── main.js └── router │ └── index.js └── static └── .gitkeep /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 leechaojiang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JavaScript-screenshot 2 | 3 | [![star this repo](http://githubbadges.com/star.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot)[![fork this repo](http://githubbadges.com/fork.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot/fork) [![npm](https://img.shields.io/npm/v/js_screen_shots.svg)](https://www.npmjs.com/package/js_screen_shots) [![languages](https://img.shields.io/badge/javascript-81.4%25-green.svg)](https://github.com/usecodelee/JavaScript-screenshot) [![node](https://img.shields.io/badge/node-%3E1.0.0-green.svg)](https://github.com/usecodelee/JavaScript-screenshot) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php) 4 | 5 | [中文](https://github.com/usecodelee/JavaScript-screenshot/blob/master/README_zh.md) 6 | 7 | ## Introduction 8 | 9 | JavaScript implementation screenshot,There are two libraries used: 10 | 11 | > [Html2Canvas.js](https://github.com/niklasvh/html2canvas) 12 | > [Canvas2Image.js](https://github.com/SuperAL/canvas2image) 13 | 14 | I mainly made two demos and one NPM package: 15 | 16 | 1. [Simple Version](https://github.com/usecodelee/JavaScript-screenshot/tree/master/simple) 17 | 2. [Webpack+Vue+Element Version](https://github.com/usecodelee/JavaScript-screenshot/tree/master/simple) 18 | 3. [js-screenshot-for-npm](https://github.com/usecodelee/JavaScript-screenshot/tree/master/js-screenshot-for-npm) 19 | 20 | ## Simple Version Of Use 21 | 22 | > Open `index.html` directly in your browser. 23 | 24 | ## Webpack+Vue+Element Version Of Use 25 | 26 | ``` bash 27 | # install dependencies 28 | npm install 29 | 30 | # serve with hot reload at localhost:8080 31 | npm run dev 32 | 33 | # build for production with minification 34 | npm run build 35 | 36 | # build for production and view the bundle analyzer report 37 | npm run build --report 38 | ``` 39 | 40 | ### Example 41 | 42 | > **The original html is like this:** 43 | 44 | 45 | 46 | > **This is the element node:** 47 | 48 | 49 | 50 | > **This is after converting to canvas:** 51 | 52 | 53 | 54 | > **This is the element node:** 55 | 56 | 57 | 58 | > **This is after converting to img:** 59 | 60 | 61 | 62 | > **This is the element node:** 63 | 64 | 65 | 66 | > **This is the final result:** 67 | 68 | 69 | 70 | ## js-screenshot-for-npm 71 | 72 | ```bash 73 | npm install --save js_screen_shots 74 | ``` 75 | 76 | For details, see the document [README.md](https://github.com/usecodelee/JavaScript-screenshot/tree/master/js-screenshot-for-npm). 77 | -------------------------------------------------------------------------------- /README_zh.md: -------------------------------------------------------------------------------- 1 | # JavaScript实现截图 2 | 3 | [![star this repo](http://githubbadges.com/star.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot)[![fork this repo](http://githubbadges.com/fork.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot/fork) [![npm](https://img.shields.io/npm/v/js_screen_shots.svg)](https://www.npmjs.com/package/js_screen_shots) [![languages](https://img.shields.io/badge/javascript-81.4%25-green.svg)](https://github.com/usecodelee/JavaScript-screenshot) [![node](https://img.shields.io/badge/node-%3E1.0.0-green.svg)](https://github.com/usecodelee/JavaScript-screenshot) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php) 4 | 5 | ## 简介 6 | 7 | JavaScript实现网页截图,使用的库有两个: 8 | 9 | > [Html2Canvas.js](https://github.com/niklasvh/html2canvas) 10 | > [Canvas2Image.js](https://github.com/SuperAL/canvas2image) 11 | 12 | 我主要是做了两个demo和一个npm包: 13 | 14 | 1. [简单版的实现](https://github.com/usecodelee/JavaScript-screenshot/tree/master/simple) 15 | 2. [Webpack+Vue+Element版的实现](https://github.com/usecodelee/JavaScript-screenshot/tree/master/simple) 16 | 3. [js-screenshot-for-npm](https://github.com/usecodelee/JavaScript-screenshot/tree/master/js-screenshot-for-npm) 17 | 18 | ## 如何使用简单版 19 | 20 | > 直接打开`index.html`即可 21 | 22 | ## 如何使用Webpack+Vue+Element版 23 | 24 | ``` bash 25 | # 安装依赖 26 | npm install 27 | 28 | # 在localhost:8080进行热重新加载 29 | npm run dev 30 | 31 | # 压缩构建为生产环境代码 32 | npm run build 33 | 34 | # 构建为生产环境代码并查看捆绑分析器报告 35 | npm run build --report 36 | ``` 37 | 38 | ### 使用示例 39 | 40 | > 原始html是这样的: 41 | 42 | 43 | 44 | > 这是元素节点: 45 | 46 | 47 | 48 | > 这是转成canvas之后: 49 | 50 | 51 | 52 | > 这是元素节点: 53 | 54 | 55 | 56 | > 这是转成img之后: 57 | 58 | 59 | 60 | > 这是元素节点: 61 | 62 | 63 | 64 | > 这是最终截图结果: 65 | 66 | 67 | 68 | ## 使用npm安装js_screen_shots 69 | 70 | ```bash 71 | npm install --save js_screen_shots 72 | ``` 73 | 74 | 详情见[README.md](https://github.com/usecodelee/JavaScript-screenshot/tree/master/js-screenshot-for-npm) 75 | -------------------------------------------------------------------------------- /img/1上.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usecodelee/JavaScript-screenshot/544c44f1f8b4ade10c78d8eea5805705b4360206/img/1上.png -------------------------------------------------------------------------------- /img/1下.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usecodelee/JavaScript-screenshot/544c44f1f8b4ade10c78d8eea5805705b4360206/img/1下.jpg -------------------------------------------------------------------------------- /img/2上.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usecodelee/JavaScript-screenshot/544c44f1f8b4ade10c78d8eea5805705b4360206/img/2上.jpg -------------------------------------------------------------------------------- /img/2下.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usecodelee/JavaScript-screenshot/544c44f1f8b4ade10c78d8eea5805705b4360206/img/2下.jpg -------------------------------------------------------------------------------- /img/3上.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usecodelee/JavaScript-screenshot/544c44f1f8b4ade10c78d8eea5805705b4360206/img/3上.jpg -------------------------------------------------------------------------------- /img/3下.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usecodelee/JavaScript-screenshot/544c44f1f8b4ade10c78d8eea5805705b4360206/img/3下.jpg -------------------------------------------------------------------------------- /img/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usecodelee/JavaScript-screenshot/544c44f1f8b4ade10c78d8eea5805705b4360206/img/4.jpg -------------------------------------------------------------------------------- /js-screenshot-for-npm/README.md: -------------------------------------------------------------------------------- 1 | # js_screen_shots 2 | 3 | > 一个基于 JavaScript 的 DOM 截图工具。 4 | 5 | [![star this repo](http://githubbadges.com/star.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot)[![fork this repo](http://githubbadges.com/fork.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot/fork) [![npm](https://img.shields.io/npm/v/js_screen_shots.svg)](https://www.npmjs.com/package/js_screen_shots) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php) 6 | 7 | ## 如何使用 8 | 9 | 1.安装 10 | 11 | ```bash 12 | # 使用npm安装 13 | npm install --save js_screen_shots 14 | ``` 15 | 16 | 2.导入 17 | 18 | ```javascript 19 | import all from '../node_modules/js_screen_shots' 20 | console.log(all); 21 | // {html2canvas: ƒ, Canvas2Image: {…}} 22 | // Canvas2Image: {saveAsImage: ƒ, saveAsPNG: ƒ, saveAsJPEG: ƒ, saveAsGIF: ƒ, saveAsBMP: ƒ, …} 23 | // html2canvas: ƒ html2canvas(element, conf) 24 | ``` 25 | 26 | 3.使用 27 | 28 | 可以看见all对象里面有两个方法:html2canvas和Canvas2Image。 29 | html2canvas的作用是把html标签转化为canvas元素。 30 | Canvas2Image的作用是把canvas元素转化为img元素。 31 | 32 | ## 参考文档 33 | 34 | [html2canvas文档](http://html2canvas.hertzen.com/documentation) 35 | [Canvas2Image文档](https://github.com/hongru/canvas2image) 36 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/base64-arraybuffer/.npmignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | Gruntfile.js 3 | /test/ 4 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/base64-arraybuffer/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.12' 4 | - iojs-1 5 | - iojs-2 6 | - iojs-3 7 | - '4.1' 8 | before_script: 9 | - npm install 10 | before_install: npm install -g npm@'>=2.13.5' 11 | deploy: 12 | provider: npm 13 | email: niklasvh@gmail.com 14 | api_key: 15 | secure: oHV9ArprTj5WOk7MP1UF7QMJ70huXw+y7xXb5wF4+V2H8Hyfa5TfE0DiOmqrube1WXTeH1FLgq54shp/sJWi47Hkg/GyeoB5NnsPhYEaJkaON9UG5blML+ODiNVsEnq/1kNBQ8e0+0JItMPLGySKyFmuZ3yflulXKS8O88mfINo= 16 | on: 17 | tags: true 18 | branch: master 19 | repo: niklasvh/base64-arraybuffer 20 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/base64-arraybuffer/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Niklas von Hertzen 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/base64-arraybuffer/README.md: -------------------------------------------------------------------------------- 1 | # base64-arraybuffer 2 | 3 | [![Build Status](https://travis-ci.org/niklasvh/base64-arraybuffer.png)](https://travis-ci.org/niklasvh/base64-arraybuffer) 4 | [![NPM Downloads](https://img.shields.io/npm/dm/base64-arraybuffer.svg)](https://www.npmjs.org/package/base64-arraybuffer) 5 | [![NPM Version](https://img.shields.io/npm/v/base64-arraybuffer.svg)](https://www.npmjs.org/package/base64-arraybuffer) 6 | 7 | Encode/decode base64 data into ArrayBuffers 8 | 9 | ## Getting Started 10 | Install the module with: `npm install base64-arraybuffer` 11 | 12 | ## API 13 | The library encodes and decodes base64 to and from ArrayBuffers 14 | 15 | - __encode(buffer)__ - Encodes `ArrayBuffer` into base64 string 16 | - __decode(str)__ - Decodes base64 string to `ArrayBuffer` 17 | 18 | ## License 19 | Copyright (c) 2012 Niklas von Hertzen 20 | Licensed under the MIT license. 21 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js: -------------------------------------------------------------------------------- 1 | /* 2 | * base64-arraybuffer 3 | * https://github.com/niklasvh/base64-arraybuffer 4 | * 5 | * Copyright (c) 2012 Niklas von Hertzen 6 | * Licensed under the MIT license. 7 | */ 8 | (function(){ 9 | "use strict"; 10 | 11 | var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 12 | 13 | // Use a lookup table to find the index. 14 | var lookup = new Uint8Array(256); 15 | for (var i = 0; i < chars.length; i++) { 16 | lookup[chars.charCodeAt(i)] = i; 17 | } 18 | 19 | exports.encode = function(arraybuffer) { 20 | var bytes = new Uint8Array(arraybuffer), 21 | i, len = bytes.length, base64 = ""; 22 | 23 | for (i = 0; i < len; i+=3) { 24 | base64 += chars[bytes[i] >> 2]; 25 | base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; 26 | base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; 27 | base64 += chars[bytes[i + 2] & 63]; 28 | } 29 | 30 | if ((len % 3) === 2) { 31 | base64 = base64.substring(0, base64.length - 1) + "="; 32 | } else if (len % 3 === 1) { 33 | base64 = base64.substring(0, base64.length - 2) + "=="; 34 | } 35 | 36 | return base64; 37 | }; 38 | 39 | exports.decode = function(base64) { 40 | var bufferLength = base64.length * 0.75, 41 | len = base64.length, i, p = 0, 42 | encoded1, encoded2, encoded3, encoded4; 43 | 44 | if (base64[base64.length - 1] === "=") { 45 | bufferLength--; 46 | if (base64[base64.length - 2] === "=") { 47 | bufferLength--; 48 | } 49 | } 50 | 51 | var arraybuffer = new ArrayBuffer(bufferLength), 52 | bytes = new Uint8Array(arraybuffer); 53 | 54 | for (i = 0; i < len; i+=4) { 55 | encoded1 = lookup[base64.charCodeAt(i)]; 56 | encoded2 = lookup[base64.charCodeAt(i+1)]; 57 | encoded3 = lookup[base64.charCodeAt(i+2)]; 58 | encoded4 = lookup[base64.charCodeAt(i+3)]; 59 | 60 | bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); 61 | bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); 62 | bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); 63 | } 64 | 65 | return arraybuffer; 66 | }; 67 | })(); 68 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/base64-arraybuffer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "base64-arraybuffer@^0.1.5", 3 | "_id": "base64-arraybuffer@0.1.5", 4 | "_inBundle": false, 5 | "_integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", 6 | "_location": "/base64-arraybuffer", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "base64-arraybuffer@^0.1.5", 12 | "name": "base64-arraybuffer", 13 | "escapedName": "base64-arraybuffer", 14 | "rawSpec": "^0.1.5", 15 | "saveSpec": null, 16 | "fetchSpec": "^0.1.5" 17 | }, 18 | "_requiredBy": [ 19 | "/css-line-break" 20 | ], 21 | "_resolved": "http://registry.npm.taobao.org/base64-arraybuffer/download/base64-arraybuffer-0.1.5.tgz", 22 | "_shasum": "73926771923b5a19747ad666aa5cd4bf9c6e9ce8", 23 | "_spec": "base64-arraybuffer@^0.1.5", 24 | "_where": "E:\\js截图\\JavaScript-screenshot\\js-screenshot-for-npm\\node_modules\\css-line-break", 25 | "author": { 26 | "name": "Niklas von Hertzen", 27 | "email": "niklasvh@gmail.com", 28 | "url": "http://hertzen.com" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/niklasvh/base64-arraybuffer/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "deprecated": false, 35 | "description": "Encode/decode base64 data into ArrayBuffers", 36 | "devDependencies": { 37 | "grunt": "^0.4.5", 38 | "grunt-cli": "^0.1.13", 39 | "grunt-contrib-jshint": "^0.11.2", 40 | "grunt-contrib-nodeunit": "^0.4.1", 41 | "grunt-contrib-watch": "^0.6.1" 42 | }, 43 | "engines": { 44 | "node": ">= 0.6.0" 45 | }, 46 | "homepage": "https://github.com/niklasvh/base64-arraybuffer", 47 | "keywords": [], 48 | "licenses": [ 49 | { 50 | "type": "MIT", 51 | "url": "https://github.com/niklasvh/base64-arraybuffer/blob/master/LICENSE-MIT" 52 | } 53 | ], 54 | "main": "lib/base64-arraybuffer", 55 | "name": "base64-arraybuffer", 56 | "repository": { 57 | "type": "git", 58 | "url": "git+https://github.com/niklasvh/base64-arraybuffer.git" 59 | }, 60 | "scripts": { 61 | "test": "grunt nodeunit" 62 | }, 63 | "version": "0.1.5" 64 | } 65 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/css-line-break/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | [include] 3 | [libs] 4 | ./flow-typed 5 | [options] 6 | [lints] 7 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/css-line-break/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Niklas von Hertzen 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/css-line-break/README.md: -------------------------------------------------------------------------------- 1 | css-line-break 2 | ============== 3 | A JavaScript library for Line Breaking and identifying Word Boundaries, 4 | [implementing the Unicode Line Breaking Algorithm (UAX #14)](http://unicode.org/reports/tr14/) 5 | 6 | >> Line breaking, also known as word wrapping, is the process of breaking a section of text into 7 | lines such that it will fit in the available width of a page, window or other display area. 8 | The Unicode Line Breaking Algorithm performs part of this process. Given an input text, 9 | it produces a set of positions called "break opportunities" that are appropriate points to 10 | begin a new line. The selection of actual line break positions from the set of break opportunities 11 | is not covered by the Unicode Line Breaking Algorithm, but is in the domain of higher level 12 | software with knowledge of the available width and the display size of the text. 13 | 14 | In addition, the module implements CSS specific tailoring options to line breaking as 15 | defined in [CSS Text Module Level 3](https://www.w3.org/TR/css-text-3/#line-breaking). 16 | 17 | ### Installing 18 | You can install the module via npm: 19 | 20 | npm install css-line-break 21 | 22 | ### Usage 23 | The `LineBreaker` creates an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators) that returns `Break`s for a given text. 24 | 25 | LineBreaker(text, [options]); 26 | 27 | ### Example 28 | import {LineBreaker} from 'css-line-break'; 29 | 30 | const breaker = LineBreaker('Lorem ipsum lol.', { 31 | lineBreak: 'strict', 32 | wordBreak: 'break-word' 33 | }); 34 | 35 | const words = []; 36 | let bk; 37 | 38 | while (!(bk = breaker.next()).done) { 39 | words.push(bk.value.slice()); 40 | } 41 | 42 | assert.deepEqual(words, ['Lorem ', 'ipsum ', 'lol.']); 43 | 44 | ### Options 45 | The following parameters are available for the options: 46 | 47 | - `lineBreak`: `normal` | `strict` 48 | - `wordBreak`: `normal` | `break-all` | `break-word` | `keep-all` 49 | 50 | For more information how they affect the line breaking algorithms, 51 | check out [CSS Text Module Level 3](https://www.w3.org/TR/css-text-3/#line-breaking). 52 | 53 | ### Testing 54 | You can run the test suite with: 55 | 56 | npm test 57 | 58 | The library implements all the [LineBreakTest.txt tests](http://www.unicode.org/Public/10.0.0/ucd/auxiliary/LineBreakTest.txt) 59 | and a number of CSS web-platform-tests. -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/css-line-break/dist/Trie.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.Trie = exports.createTrieFromBase64 = exports.UTRIE2_INDEX_2_MASK = exports.UTRIE2_INDEX_2_BLOCK_LENGTH = exports.UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = exports.UTRIE2_INDEX_1_OFFSET = exports.UTRIE2_UTF8_2B_INDEX_2_LENGTH = exports.UTRIE2_UTF8_2B_INDEX_2_OFFSET = exports.UTRIE2_INDEX_2_BMP_LENGTH = exports.UTRIE2_LSCP_INDEX_2_LENGTH = exports.UTRIE2_DATA_MASK = exports.UTRIE2_DATA_BLOCK_LENGTH = exports.UTRIE2_LSCP_INDEX_2_OFFSET = exports.UTRIE2_SHIFT_1_2 = exports.UTRIE2_INDEX_SHIFT = exports.UTRIE2_SHIFT_1 = exports.UTRIE2_SHIFT_2 = undefined; 7 | 8 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9 | 10 | var _Util = require('./Util'); 11 | 12 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 13 | 14 | /** Shift size for getting the index-2 table offset. */ 15 | var UTRIE2_SHIFT_2 = exports.UTRIE2_SHIFT_2 = 5; 16 | 17 | /** Shift size for getting the index-1 table offset. */ 18 | var UTRIE2_SHIFT_1 = exports.UTRIE2_SHIFT_1 = 6 + 5; 19 | 20 | /** 21 | * Shift size for shifting left the index array values. 22 | * Increases possible data size with 16-bit index values at the cost 23 | * of compactability. 24 | * This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY. 25 | */ 26 | var UTRIE2_INDEX_SHIFT = exports.UTRIE2_INDEX_SHIFT = 2; 27 | 28 | /** 29 | * Difference between the two shift sizes, 30 | * for getting an index-1 offset from an index-2 offset. 6=11-5 31 | */ 32 | var UTRIE2_SHIFT_1_2 = exports.UTRIE2_SHIFT_1_2 = UTRIE2_SHIFT_1 - UTRIE2_SHIFT_2; 33 | 34 | /** 35 | * The part of the index-2 table for U+D800..U+DBFF stores values for 36 | * lead surrogate code _units_ not code _points_. 37 | * Values for lead surrogate code _points_ are indexed with this portion of the table. 38 | * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.) 39 | */ 40 | var UTRIE2_LSCP_INDEX_2_OFFSET = exports.UTRIE2_LSCP_INDEX_2_OFFSET = 0x10000 >> UTRIE2_SHIFT_2; 41 | 42 | /** Number of entries in a data block. 32=0x20 */ 43 | var UTRIE2_DATA_BLOCK_LENGTH = exports.UTRIE2_DATA_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_2; 44 | /** Mask for getting the lower bits for the in-data-block offset. */ 45 | var UTRIE2_DATA_MASK = exports.UTRIE2_DATA_MASK = UTRIE2_DATA_BLOCK_LENGTH - 1; 46 | 47 | var UTRIE2_LSCP_INDEX_2_LENGTH = exports.UTRIE2_LSCP_INDEX_2_LENGTH = 0x400 >> UTRIE2_SHIFT_2; 48 | /** Count the lengths of both BMP pieces. 2080=0x820 */ 49 | var UTRIE2_INDEX_2_BMP_LENGTH = exports.UTRIE2_INDEX_2_BMP_LENGTH = UTRIE2_LSCP_INDEX_2_OFFSET + UTRIE2_LSCP_INDEX_2_LENGTH; 50 | /** 51 | * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820. 52 | * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2. 53 | */ 54 | var UTRIE2_UTF8_2B_INDEX_2_OFFSET = exports.UTRIE2_UTF8_2B_INDEX_2_OFFSET = UTRIE2_INDEX_2_BMP_LENGTH; 55 | var UTRIE2_UTF8_2B_INDEX_2_LENGTH = exports.UTRIE2_UTF8_2B_INDEX_2_LENGTH = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */ 56 | /** 57 | * The index-1 table, only used for supplementary code points, at offset 2112=0x840. 58 | * Variable length, for code points up to highStart, where the last single-value range starts. 59 | * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1. 60 | * (For 0x100000 supplementary code points U+10000..U+10ffff.) 61 | * 62 | * The part of the index-2 table for supplementary code points starts 63 | * after this index-1 table. 64 | * 65 | * Both the index-1 table and the following part of the index-2 table 66 | * are omitted completely if there is only BMP data. 67 | */ 68 | var UTRIE2_INDEX_1_OFFSET = exports.UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET + UTRIE2_UTF8_2B_INDEX_2_LENGTH; 69 | 70 | /** 71 | * Number of index-1 entries for the BMP. 32=0x20 72 | * This part of the index-1 table is omitted from the serialized form. 73 | */ 74 | var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = exports.UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UTRIE2_SHIFT_1; 75 | 76 | /** Number of entries in an index-2 block. 64=0x40 */ 77 | var UTRIE2_INDEX_2_BLOCK_LENGTH = exports.UTRIE2_INDEX_2_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_1_2; 78 | /** Mask for getting the lower bits for the in-index-2-block offset. */ 79 | var UTRIE2_INDEX_2_MASK = exports.UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH - 1; 80 | 81 | var createTrieFromBase64 = exports.createTrieFromBase64 = function createTrieFromBase64(base64) { 82 | var buffer = (0, _Util.decode)(base64); 83 | var view32 = Array.isArray(buffer) ? (0, _Util.polyUint32Array)(buffer) : new Uint32Array(buffer); 84 | var view16 = Array.isArray(buffer) ? (0, _Util.polyUint16Array)(buffer) : new Uint16Array(buffer); 85 | var headerLength = 24; 86 | 87 | var index = view16.slice(headerLength / 2, view32[4] / 2); 88 | var data = view32[5] === 2 ? view16.slice((headerLength + view32[4]) / 2) : view32.slice(Math.ceil((headerLength + view32[4]) / 4)); 89 | 90 | return new Trie(view32[0], view32[1], view32[2], view32[3], index, data); 91 | }; 92 | 93 | var Trie = exports.Trie = function () { 94 | function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) { 95 | _classCallCheck(this, Trie); 96 | 97 | this.initialValue = initialValue; 98 | this.errorValue = errorValue; 99 | this.highStart = highStart; 100 | this.highValueIndex = highValueIndex; 101 | this.index = index; 102 | this.data = data; 103 | } 104 | 105 | /** 106 | * Get the value for a code point as stored in the Trie. 107 | * 108 | * @param codePoint the code point 109 | * @return the value 110 | */ 111 | 112 | 113 | _createClass(Trie, [{ 114 | key: 'get', 115 | value: function get(codePoint) { 116 | var ix = void 0; 117 | if (codePoint >= 0) { 118 | if (codePoint < 0x0d800 || codePoint > 0x0dbff && codePoint <= 0x0ffff) { 119 | // Ordinary BMP code point, excluding leading surrogates. 120 | // BMP uses a single level lookup. BMP index starts at offset 0 in the Trie2 index. 121 | // 16 bit data is stored in the index array itself. 122 | ix = this.index[codePoint >> UTRIE2_SHIFT_2]; 123 | ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); 124 | return this.data[ix]; 125 | } 126 | 127 | if (codePoint <= 0xffff) { 128 | // Lead Surrogate Code Point. A Separate index section is stored for 129 | // lead surrogate code units and code points. 130 | // The main index has the code unit data. 131 | // For this function, we need the code point data. 132 | // Note: this expression could be refactored for slightly improved efficiency, but 133 | // surrogate code points will be so rare in practice that it's not worth it. 134 | ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET + (codePoint - 0xd800 >> UTRIE2_SHIFT_2)]; 135 | ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); 136 | return this.data[ix]; 137 | } 138 | 139 | if (codePoint < this.highStart) { 140 | // Supplemental code point, use two-level lookup. 141 | ix = UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> UTRIE2_SHIFT_1); 142 | ix = this.index[ix]; 143 | ix += codePoint >> UTRIE2_SHIFT_2 & UTRIE2_INDEX_2_MASK; 144 | ix = this.index[ix]; 145 | ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); 146 | return this.data[ix]; 147 | } 148 | if (codePoint <= 0x10ffff) { 149 | return this.data[this.highValueIndex]; 150 | } 151 | } 152 | 153 | // Fall through. The code point is outside of the legal range of 0..0x10ffff. 154 | return this.errorValue; 155 | } 156 | }]); 157 | 158 | return Trie; 159 | }(); -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/css-line-break/dist/Util.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var toCodePoints = exports.toCodePoints = function toCodePoints(str) { 7 | var codePoints = []; 8 | var i = 0; 9 | var length = str.length; 10 | while (i < length) { 11 | var value = str.charCodeAt(i++); 12 | if (value >= 0xd800 && value <= 0xdbff && i < length) { 13 | var extra = str.charCodeAt(i++); 14 | if ((extra & 0xfc00) === 0xdc00) { 15 | codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000); 16 | } else { 17 | codePoints.push(value); 18 | i--; 19 | } 20 | } else { 21 | codePoints.push(value); 22 | } 23 | } 24 | return codePoints; 25 | }; 26 | 27 | var fromCodePoint = exports.fromCodePoint = function fromCodePoint() { 28 | if (String.fromCodePoint) { 29 | return String.fromCodePoint.apply(String, arguments); 30 | } 31 | 32 | var length = arguments.length; 33 | if (!length) { 34 | return ''; 35 | } 36 | 37 | var codeUnits = []; 38 | 39 | var index = -1; 40 | var result = ''; 41 | while (++index < length) { 42 | var codePoint = arguments.length <= index ? undefined : arguments[index]; 43 | if (codePoint <= 0xffff) { 44 | codeUnits.push(codePoint); 45 | } else { 46 | codePoint -= 0x10000; 47 | codeUnits.push((codePoint >> 10) + 0xd800, codePoint % 0x400 + 0xdc00); 48 | } 49 | if (index + 1 === length || codeUnits.length > 0x4000) { 50 | result += String.fromCharCode.apply(String, codeUnits); 51 | codeUnits.length = 0; 52 | } 53 | } 54 | return result; 55 | }; 56 | 57 | var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; 58 | 59 | // Use a lookup table to find the index. 60 | var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); 61 | for (var i = 0; i < chars.length; i++) { 62 | lookup[chars.charCodeAt(i)] = i; 63 | } 64 | 65 | var decode = exports.decode = function decode(base64) { 66 | var bufferLength = base64.length * 0.75, 67 | len = base64.length, 68 | i = void 0, 69 | p = 0, 70 | encoded1 = void 0, 71 | encoded2 = void 0, 72 | encoded3 = void 0, 73 | encoded4 = void 0; 74 | 75 | if (base64[base64.length - 1] === '=') { 76 | bufferLength--; 77 | if (base64[base64.length - 2] === '=') { 78 | bufferLength--; 79 | } 80 | } 81 | 82 | var buffer = typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined' && typeof Uint8Array.prototype.slice !== 'undefined' ? new ArrayBuffer(bufferLength) : new Array(bufferLength); 83 | var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer); 84 | 85 | for (i = 0; i < len; i += 4) { 86 | encoded1 = lookup[base64.charCodeAt(i)]; 87 | encoded2 = lookup[base64.charCodeAt(i + 1)]; 88 | encoded3 = lookup[base64.charCodeAt(i + 2)]; 89 | encoded4 = lookup[base64.charCodeAt(i + 3)]; 90 | 91 | bytes[p++] = encoded1 << 2 | encoded2 >> 4; 92 | bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2; 93 | bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63; 94 | } 95 | 96 | return buffer; 97 | }; 98 | 99 | var polyUint16Array = exports.polyUint16Array = function polyUint16Array(buffer) { 100 | var length = buffer.length; 101 | var bytes = []; 102 | for (var _i = 0; _i < length; _i += 2) { 103 | bytes.push(buffer[_i + 1] << 8 | buffer[_i]); 104 | } 105 | return bytes; 106 | }; 107 | 108 | var polyUint32Array = exports.polyUint32Array = function polyUint32Array(buffer) { 109 | var length = buffer.length; 110 | var bytes = []; 111 | for (var _i2 = 0; _i2 < length; _i2 += 4) { 112 | bytes.push(buffer[_i2 + 3] << 24 | buffer[_i2 + 2] << 16 | buffer[_i2 + 1] << 8 | buffer[_i2]); 113 | } 114 | return bytes; 115 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/css-line-break/dist/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _Util = require('./Util'); 8 | 9 | Object.defineProperty(exports, 'toCodePoints', { 10 | enumerable: true, 11 | get: function get() { 12 | return _Util.toCodePoints; 13 | } 14 | }); 15 | Object.defineProperty(exports, 'fromCodePoint', { 16 | enumerable: true, 17 | get: function get() { 18 | return _Util.fromCodePoint; 19 | } 20 | }); 21 | 22 | var _LineBreak = require('./LineBreak'); 23 | 24 | Object.defineProperty(exports, 'LineBreaker', { 25 | enumerable: true, 26 | get: function get() { 27 | return _LineBreak.LineBreaker; 28 | } 29 | }); -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/css-line-break/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "css-line-break@1.0.1", 3 | "_id": "css-line-break@1.0.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-GfIGOjPpX7KDG4ZEbAuAwYivRQo=", 6 | "_location": "/css-line-break", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "version", 10 | "registry": true, 11 | "raw": "css-line-break@1.0.1", 12 | "name": "css-line-break", 13 | "escapedName": "css-line-break", 14 | "rawSpec": "1.0.1", 15 | "saveSpec": null, 16 | "fetchSpec": "1.0.1" 17 | }, 18 | "_requiredBy": [ 19 | "/html2canvas" 20 | ], 21 | "_resolved": "http://registry.npm.taobao.org/css-line-break/download/css-line-break-1.0.1.tgz", 22 | "_shasum": "19f2063a33e95fb2831b86446c0b80c188af450a", 23 | "_spec": "css-line-break@1.0.1", 24 | "_where": "E:\\js截图\\JavaScript-screenshot\\js-screenshot-for-npm\\node_modules\\html2canvas", 25 | "author": { 26 | "name": "Niklas von Hertzen", 27 | "email": "niklasvh@gmail.com", 28 | "url": "https://hertzen.com" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/niklasvh/css-line-break/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": { 35 | "base64-arraybuffer": "^0.1.5" 36 | }, 37 | "deprecated": false, 38 | "description": "css-line-break ============== A JavaScript library for Line Breaking and identifying Word Boundaries, [implementing the Unicode Line Breaking Algorithm (UAX #14)](http://unicode.org/reports/tr14/)", 39 | "devDependencies": { 40 | "babel-cli": "6.24.1", 41 | "babel-core": "6.25.0", 42 | "babel-eslint": "7.2.3", 43 | "babel-loader": "7.1.1", 44 | "babel-plugin-dev-expression": "0.2.1", 45 | "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", 46 | "babel-plugin-transform-object-rest-spread": "6.23.0", 47 | "babel-preset-es2015": "6.24.1", 48 | "babel-preset-flow": "6.23.0", 49 | "base64-arraybuffer": "^0.1.5", 50 | "eslint": "4.2.0", 51 | "eslint-plugin-flowtype": "2.35.0", 52 | "eslint-plugin-prettier": "2.1.2", 53 | "flow-bin": "0.61.0", 54 | "mocha": "4.0.1", 55 | "prettier": "1.9.2", 56 | "rimraf": "2.6.1" 57 | }, 58 | "homepage": "https://github.com/niklasvh/css-line-break#readme", 59 | "keywords": [ 60 | "white-space", 61 | "line-break", 62 | "word-break", 63 | "word-wrap", 64 | "overflow-wrap" 65 | ], 66 | "license": "MIT", 67 | "main": "dist/index.js", 68 | "name": "css-line-break", 69 | "repository": { 70 | "type": "git", 71 | "url": "git+ssh://git@github.com/niklasvh/css-line-break.git" 72 | }, 73 | "scripts": { 74 | "build": "rimraf dist/ && npm run build:npm", 75 | "build:npm": "babel src/ -d dist/ --plugins=dev-expression,transform-es2015-modules-commonjs", 76 | "flow": "flow", 77 | "format": "prettier --single-quote --no-bracket-spacing --tab-width 4 --print-width 100 --write \"{src,scripts}/**/*.js\"", 78 | "generate-tests": "babel-node scripts/generate_line_break_tests.js", 79 | "generate-trie": "babel-node scripts/generate_line_break_trie.js", 80 | "lint": "eslint src/**/*.js", 81 | "mocha": "mocha --require babel-core/register tests/*.js", 82 | "test": "npm run flow && npm run lint && npm run mocha" 83 | }, 84 | "version": "1.0.1" 85 | } 86 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | .*/www/.* 3 | [include] 4 | [libs] 5 | ./flow-typed 6 | [options] 7 | [lints] 8 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ### Changelog ### 2 | 3 | #### v1.0.0-alpha.12 - 5.4.2018 #### 4 | * Fix white space appearing on element rendering (Fix #1438) 5 | * Reset canvas transform on finish (Fix #1494) 6 | 7 | #### v1.0.0-alpha.11 - 1.4.2018 #### 8 | * Fix IE11 member not found error 9 | * Support blob image resources in non-foreignObjectRendering mode 10 | 11 | #### v1.0.0-alpha.10 - 15.2.2018 #### 12 | * Re-introduce `onclone` option (Fix #1434) 13 | * Add `ignoreElements` predicate function option 14 | * Fix version console logging 15 | 16 | #### v1.0.0-alpha.9 - 7.1.2018 #### 17 | * Fix dynamic style sheets 18 | * Fix > 50% border-radius values 19 | 20 | #### v1.0.0-alpha.8 - 2.1.2018 #### 21 | * Use correct doctype in cloned Document (Fix #1298) 22 | * Fix individual border rendering (Fix #1349) 23 | 24 | #### v1.0.0-alpha.7 - 31.12.2017 #### 25 | * Fix form input rendering (#1338) 26 | * Improve word line breaking algorithm 27 | 28 | #### v1.0.0-alpha.6 - 28.12.2017 #### 29 | * Fix list-style: none (#1340) 30 | * Extend supported values for pseudo element content 31 | 32 | #### v1.0.0-alpha.5 - 21.12.2017 #### 33 | * Fix underline positioning 34 | * Fix canvas rendering on Chrome 35 | * Fix overflow: auto 36 | * Added support for rendering list-style 37 | 38 | #### v1.0.0-alpha.4 - 12.12.2017 #### 39 | * Fix rendering with multiple fonts defined (Fix #796) 40 | * Add support for radial-gradients 41 | * Fix logging option (#1302) 42 | * Add support for rendering webgl canvas content (#646) 43 | * Fix external SVG loading with proxies (#802) 44 | 45 | #### v1.0.0-alpha.3 - 9.12.2017 #### 46 | * Disable `foreignObjectRendering` by default (#1295) 47 | * Fix background-size when using background-origin and background-size: cover/contain (#1299) 48 | * Added support for background-origin: content-box (#1299) 49 | 50 | #### v1.0.0-alpha.2 - 7.12.2017 #### 51 | * Fix scroll positions for CanvasRenderer (#1259) 52 | * Fix `data-html2canvas-ignore` attribute (#1253) 53 | * Fix decimal `letter-spacing` values (#1293) 54 | 55 | #### v1.0.0-alpha.1 - 5.12.2017 #### 56 | * Complete rewrite of library 57 | ##### Breaking Changes ##### 58 | * Remove deprecated onrendered callback, calling `html2canvas` returns a `Promise` 59 | * Removed option `type`, same results can be achieved by assigning `x`, `y`, `scrollX`, `scrollY`, `width` and `height` properties. 60 | 61 | ##### New featues / fixes ##### 62 | * Add support for scaling canvas (defaults to device pixel ratio) 63 | * Add support for multiple text-shadows 64 | * Add support for multiple text-decorations 65 | * Add support for text-decoration-color 66 | * Add support for percentage values for border-radius 67 | * Correctly handle px and percentage values in linear-gradients 68 | * Correctly support all angle types for linear-gradients 69 | * Add support for multiple values for background-repeat, background-position and background-size 70 | 71 | #### v0.5.0-beta4 - 23.1.2016 #### 72 | * Fix logger requiring access to window object 73 | * Derequire browserify build 74 | * Fix rendering of specific elements when window is scrolled and `type` isn't set to `view` 75 | 76 | #### v0.5.0-beta3 - 6.12.2015 #### 77 | * Handle color names in linear gradients 78 | 79 | #### v0.5.0-beta2 - 20.10.2015 #### 80 | * Remove Promise polyfill (use native or provide it yourself) 81 | 82 | #### v0.5.0-beta1 - 19.10.2015 #### 83 | * Fix bug with unmatched color stops in gradients 84 | * Fix scrolling issues with iOS 85 | * Correctly handle named colors in gradients 86 | * Accept matrix3d transforms 87 | * Fix transparent colors breaking gradients 88 | * Preserve scrolling positions on render 89 | 90 | #### v0.5.0-alpha2 - 3.2.2015 #### 91 | * Switch to using browserify for building 92 | * Fix (#517) Chrome stretches background images with 'auto' or single attributes 93 | 94 | #### v0.5.0-alpha - 19.1.2015#### 95 | * Complete rewrite of library 96 | * Switched interface to return Promise 97 | * Uses hidden iframe window to perform rendering, allowing async rendering and doesn't force the viewport to be scrolled to the top anymore. 98 | * Better support for unicode 99 | * Checkbox/radio button rendering 100 | * SVG rendering 101 | * iframe rendering 102 | * Changed format for proxy requests, permitting binary responses with CORS headers as well 103 | * Fixed many layering issues (see z-index tests) 104 | 105 | #### v0.4.1 - 7.9.2013 #### 106 | * Added support for bower 107 | * Improved z-index ordering 108 | * Basic implementation for CSS transformations 109 | * Fixed inline text in top element 110 | * Basic implementation for text-shadow 111 | 112 | #### v0.4.0 - 30.1.2013 #### 113 | * Added rendering tests with webdriver 114 | * Switched to using grunt for building 115 | * Removed support for IE<9, including any FlashCanvas bits 116 | * Support for border-radius 117 | * Support for multiple background images, size, and clipping 118 | * Support for :before and :after pseudo elements 119 | * Support for placeholder rendering 120 | * Reformatted all tests to small units to test specific features 121 | 122 | #### v0.3.4 - 26.6.2012 #### 123 | 124 | * Removed (last?) jQuery dependencies (niklasvh) 125 | * SVG-powered rendering (niklasvh) 126 | * Radial gradients (SunboX) 127 | * Split renderers to their own objects (niklasvh) 128 | * Simplified API, cleaned up code (niklasvh) 129 | 130 | #### v0.3.3 - 2.3.2012 #### 131 | 132 | * SVG taint fix, and additional taint testing options for rendering (niklasvh) 133 | * Added support for CORS images and option to create canvas as tainted (niklasvh) 134 | * Improved minification saved ~1K! (cobexer) 135 | * Added integrated support for Flashcanvas (niklasvh) 136 | * Fixed a variety of legacy IE bugs (niklasvh) 137 | 138 | #### v0.3.2 - 20.2.2012 #### 139 | 140 | * Added changelog! 141 | * Added bookmarklet (cobexer) 142 | * Option to select single element to render (niklasvh) 143 | * Fixed closure compiler warnings (cobexer) 144 | * Enable profiling in FF (cobexer) 145 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Niklas von Hertzen 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/README.md: -------------------------------------------------------------------------------- 1 | html2canvas 2 | =========== 3 | 4 | [Homepage](https://html2canvas.hertzen.com) | [Downloads](https://github.com/niklasvh/html2canvas/releases) | [Questions](http://stackoverflow.com/questions/tagged/html2canvas?sort=newest) | [Donate](https://www.gittip.com/niklasvh/) 5 | 6 | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/niklasvh/html2canvas?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) 7 | [![Build Status](https://travis-ci.org/niklasvh/html2canvas.svg)](https://travis-ci.org/niklasvh/html2canvas) 8 | [![NPM Downloads](https://img.shields.io/npm/dm/html2canvas.svg)](https://www.npmjs.org/package/html2canvas) 9 | [![NPM Version](https://img.shields.io/npm/v/html2canvas.svg)](https://www.npmjs.org/package/html2canvas) 10 | 11 | #### JavaScript HTML renderer #### 12 | 13 | The script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page. 14 | 15 | 16 | ### How does it work? ### 17 | The script renders the current page as a canvas image, by reading the DOM and the different styles applied to the elements. 18 | 19 | It does **not require any rendering from the server**, as the whole image is created on the **client's browser**. However, as it is heavily dependent on the browser, this library is *not suitable* to be used in nodejs. 20 | It doesn't magically circumvent any browser content policy restrictions either, so rendering cross-origin content will require a [proxy](https://github.com/niklasvh/html2canvas/wiki/Proxies) to get the content to the [same origin](http://en.wikipedia.org/wiki/Same_origin_policy). 21 | 22 | The script is still in a **very experimental state**, so I don't recommend using it in a production environment nor start building applications with it yet, as there will be still major changes made. 23 | 24 | ### Browser compatibility ### 25 | 26 | The library should work fine on the following browsers (with `Promise` polyfill): 27 | 28 | * Firefox 3.5+ 29 | * Google Chrome 30 | * Opera 12+ 31 | * IE9+ 32 | * Safari 6+ 33 | 34 | As each CSS property needs to be manually built to be supported, there are a number of properties that are not yet supported. 35 | 36 | ### Usage ### 37 | 38 | The html2canvas library utilizes `Promise`s and expects them to be available in the global context. If you wish to 39 | support [older browsers](http://caniuse.com/#search=promise) that do not natively support `Promise`s, please include a polyfill such as 40 | [es6-promise](https://github.com/jakearchibald/es6-promise) before including `html2canvas`. 41 | 42 | **Note!** These instructions are for using the current dev version of 0.5, for the latest release version (0.4.1), checkout the [old readme](https://github.com/niklasvh/html2canvas/blob/v0.4/readme.md). 43 | 44 | To render an `element` with html2canvas, simply call: 45 | ` html2canvas(element[, options]);` 46 | 47 | The function returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) containing the `` element. Simply add a promise fullfillment handler to the promise using `then`: 48 | 49 | html2canvas(document.body).then(function(canvas) { 50 | document.body.appendChild(canvas); 51 | }); 52 | 53 | ### Building ### 54 | 55 | You can download ready builds [here](https://github.com/niklasvh/html2canvas/releases). 56 | 57 | Clone git repository: 58 | 59 | $ git clone git://github.com/niklasvh/html2canvas.git 60 | 61 | Install dependencies: 62 | 63 | $ npm install 64 | 65 | Build browser bundle 66 | 67 | $ npm run build 68 | 69 | ### Running tests ### 70 | 71 | The library has two sets of tests. The first set is a number of qunit tests that check that different values parsed by browsers are correctly converted in html2canvas. To run these tests with grunt you'll need [phantomjs](http://phantomjs.org/). 72 | 73 | The other set of tests run Firefox, Chrome and Internet Explorer with [webdriver](https://github.com/niklasvh/webdriver.js). The selenium standalone server (runs on Java) is required for these tests and can be downloaded from [here](http://code.google.com/p/selenium/downloads/list). They capture an actual screenshot from the test pages and compare the image to the screenshot created by html2canvas and calculate the percentage differences. These tests generally aren't expected to provide 100% matches, but while committing changes, these should generally not go decrease from the baseline values. 74 | 75 | Start by downloading the dependencies: 76 | 77 | $ npm install 78 | 79 | Run tests: 80 | 81 | $ npm test 82 | 83 | ### Examples ### 84 | 85 | For more information and examples, please visit the [homepage](https://html2canvas.hertzen.com) or try the [test console](http://html2canvas.hertzen.com/screenshots.html). 86 | 87 | ### Contributing ### 88 | 89 | If you wish to contribute to the project, please send the pull requests to the develop branch. Before submitting any changes, try and test that the changes work with all the support browsers. If some CSS property isn't supported or is incomplete, please create appropriate tests for it as well before submitting any code changes. 90 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/Angle.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var ANGLE = /([+-]?\d*\.?\d+)(deg|grad|rad|turn)/i; 7 | 8 | var parseAngle = exports.parseAngle = function parseAngle(angle) { 9 | var match = angle.match(ANGLE); 10 | 11 | if (match) { 12 | var value = parseFloat(match[1]); 13 | switch (match[2].toLowerCase()) { 14 | case 'deg': 15 | return Math.PI * value / 180; 16 | case 'grad': 17 | return Math.PI / 200 * value; 18 | case 'rad': 19 | return value; 20 | case 'turn': 21 | return Math.PI * 2 * value; 22 | } 23 | } 24 | 25 | return null; 26 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/Color.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // http://dev.w3.org/csswg/css-color/ 4 | 5 | Object.defineProperty(exports, "__esModule", { 6 | value: true 7 | }); 8 | 9 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); 10 | 11 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 12 | 13 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 14 | 15 | var HEX3 = /^#([a-f0-9]{3})$/i; 16 | var hex3 = function hex3(value) { 17 | var match = value.match(HEX3); 18 | if (match) { 19 | return [parseInt(match[1][0] + match[1][0], 16), parseInt(match[1][1] + match[1][1], 16), parseInt(match[1][2] + match[1][2], 16), null]; 20 | } 21 | return false; 22 | }; 23 | 24 | var HEX6 = /^#([a-f0-9]{6})$/i; 25 | var hex6 = function hex6(value) { 26 | var match = value.match(HEX6); 27 | if (match) { 28 | return [parseInt(match[1].substring(0, 2), 16), parseInt(match[1].substring(2, 4), 16), parseInt(match[1].substring(4, 6), 16), null]; 29 | } 30 | return false; 31 | }; 32 | 33 | var RGB = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/; 34 | var rgb = function rgb(value) { 35 | var match = value.match(RGB); 36 | if (match) { 37 | return [Number(match[1]), Number(match[2]), Number(match[3]), null]; 38 | } 39 | return false; 40 | }; 41 | 42 | var RGBA = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/; 43 | var rgba = function rgba(value) { 44 | var match = value.match(RGBA); 45 | if (match && match.length > 4) { 46 | return [Number(match[1]), Number(match[2]), Number(match[3]), Number(match[4])]; 47 | } 48 | return false; 49 | }; 50 | 51 | var fromArray = function fromArray(array) { 52 | return [Math.min(array[0], 255), Math.min(array[1], 255), Math.min(array[2], 255), array.length > 3 ? array[3] : null]; 53 | }; 54 | 55 | var namedColor = function namedColor(name) { 56 | var color = NAMED_COLORS[name.toLowerCase()]; 57 | return color ? color : false; 58 | }; 59 | 60 | var Color = function () { 61 | function Color(value) { 62 | _classCallCheck(this, Color); 63 | 64 | var _ref = Array.isArray(value) ? fromArray(value) : hex3(value) || rgb(value) || rgba(value) || namedColor(value) || hex6(value) || [0, 0, 0, null], 65 | _ref2 = _slicedToArray(_ref, 4), 66 | r = _ref2[0], 67 | g = _ref2[1], 68 | b = _ref2[2], 69 | a = _ref2[3]; 70 | 71 | this.r = r; 72 | this.g = g; 73 | this.b = b; 74 | this.a = a; 75 | } 76 | 77 | _createClass(Color, [{ 78 | key: 'isTransparent', 79 | value: function isTransparent() { 80 | return this.a === 0; 81 | } 82 | }, { 83 | key: 'toString', 84 | value: function toString() { 85 | return this.a !== null && this.a !== 1 ? 'rgba(' + this.r + ',' + this.g + ',' + this.b + ',' + this.a + ')' : 'rgb(' + this.r + ',' + this.g + ',' + this.b + ')'; 86 | } 87 | }]); 88 | 89 | return Color; 90 | }(); 91 | 92 | exports.default = Color; 93 | 94 | 95 | var NAMED_COLORS = { 96 | transparent: [0, 0, 0, 0], 97 | aliceblue: [240, 248, 255, null], 98 | antiquewhite: [250, 235, 215, null], 99 | aqua: [0, 255, 255, null], 100 | aquamarine: [127, 255, 212, null], 101 | azure: [240, 255, 255, null], 102 | beige: [245, 245, 220, null], 103 | bisque: [255, 228, 196, null], 104 | black: [0, 0, 0, null], 105 | blanchedalmond: [255, 235, 205, null], 106 | blue: [0, 0, 255, null], 107 | blueviolet: [138, 43, 226, null], 108 | brown: [165, 42, 42, null], 109 | burlywood: [222, 184, 135, null], 110 | cadetblue: [95, 158, 160, null], 111 | chartreuse: [127, 255, 0, null], 112 | chocolate: [210, 105, 30, null], 113 | coral: [255, 127, 80, null], 114 | cornflowerblue: [100, 149, 237, null], 115 | cornsilk: [255, 248, 220, null], 116 | crimson: [220, 20, 60, null], 117 | cyan: [0, 255, 255, null], 118 | darkblue: [0, 0, 139, null], 119 | darkcyan: [0, 139, 139, null], 120 | darkgoldenrod: [184, 134, 11, null], 121 | darkgray: [169, 169, 169, null], 122 | darkgreen: [0, 100, 0, null], 123 | darkgrey: [169, 169, 169, null], 124 | darkkhaki: [189, 183, 107, null], 125 | darkmagenta: [139, 0, 139, null], 126 | darkolivegreen: [85, 107, 47, null], 127 | darkorange: [255, 140, 0, null], 128 | darkorchid: [153, 50, 204, null], 129 | darkred: [139, 0, 0, null], 130 | darksalmon: [233, 150, 122, null], 131 | darkseagreen: [143, 188, 143, null], 132 | darkslateblue: [72, 61, 139, null], 133 | darkslategray: [47, 79, 79, null], 134 | darkslategrey: [47, 79, 79, null], 135 | darkturquoise: [0, 206, 209, null], 136 | darkviolet: [148, 0, 211, null], 137 | deeppink: [255, 20, 147, null], 138 | deepskyblue: [0, 191, 255, null], 139 | dimgray: [105, 105, 105, null], 140 | dimgrey: [105, 105, 105, null], 141 | dodgerblue: [30, 144, 255, null], 142 | firebrick: [178, 34, 34, null], 143 | floralwhite: [255, 250, 240, null], 144 | forestgreen: [34, 139, 34, null], 145 | fuchsia: [255, 0, 255, null], 146 | gainsboro: [220, 220, 220, null], 147 | ghostwhite: [248, 248, 255, null], 148 | gold: [255, 215, 0, null], 149 | goldenrod: [218, 165, 32, null], 150 | gray: [128, 128, 128, null], 151 | green: [0, 128, 0, null], 152 | greenyellow: [173, 255, 47, null], 153 | grey: [128, 128, 128, null], 154 | honeydew: [240, 255, 240, null], 155 | hotpink: [255, 105, 180, null], 156 | indianred: [205, 92, 92, null], 157 | indigo: [75, 0, 130, null], 158 | ivory: [255, 255, 240, null], 159 | khaki: [240, 230, 140, null], 160 | lavender: [230, 230, 250, null], 161 | lavenderblush: [255, 240, 245, null], 162 | lawngreen: [124, 252, 0, null], 163 | lemonchiffon: [255, 250, 205, null], 164 | lightblue: [173, 216, 230, null], 165 | lightcoral: [240, 128, 128, null], 166 | lightcyan: [224, 255, 255, null], 167 | lightgoldenrodyellow: [250, 250, 210, null], 168 | lightgray: [211, 211, 211, null], 169 | lightgreen: [144, 238, 144, null], 170 | lightgrey: [211, 211, 211, null], 171 | lightpink: [255, 182, 193, null], 172 | lightsalmon: [255, 160, 122, null], 173 | lightseagreen: [32, 178, 170, null], 174 | lightskyblue: [135, 206, 250, null], 175 | lightslategray: [119, 136, 153, null], 176 | lightslategrey: [119, 136, 153, null], 177 | lightsteelblue: [176, 196, 222, null], 178 | lightyellow: [255, 255, 224, null], 179 | lime: [0, 255, 0, null], 180 | limegreen: [50, 205, 50, null], 181 | linen: [250, 240, 230, null], 182 | magenta: [255, 0, 255, null], 183 | maroon: [128, 0, 0, null], 184 | mediumaquamarine: [102, 205, 170, null], 185 | mediumblue: [0, 0, 205, null], 186 | mediumorchid: [186, 85, 211, null], 187 | mediumpurple: [147, 112, 219, null], 188 | mediumseagreen: [60, 179, 113, null], 189 | mediumslateblue: [123, 104, 238, null], 190 | mediumspringgreen: [0, 250, 154, null], 191 | mediumturquoise: [72, 209, 204, null], 192 | mediumvioletred: [199, 21, 133, null], 193 | midnightblue: [25, 25, 112, null], 194 | mintcream: [245, 255, 250, null], 195 | mistyrose: [255, 228, 225, null], 196 | moccasin: [255, 228, 181, null], 197 | navajowhite: [255, 222, 173, null], 198 | navy: [0, 0, 128, null], 199 | oldlace: [253, 245, 230, null], 200 | olive: [128, 128, 0, null], 201 | olivedrab: [107, 142, 35, null], 202 | orange: [255, 165, 0, null], 203 | orangered: [255, 69, 0, null], 204 | orchid: [218, 112, 214, null], 205 | palegoldenrod: [238, 232, 170, null], 206 | palegreen: [152, 251, 152, null], 207 | paleturquoise: [175, 238, 238, null], 208 | palevioletred: [219, 112, 147, null], 209 | papayawhip: [255, 239, 213, null], 210 | peachpuff: [255, 218, 185, null], 211 | peru: [205, 133, 63, null], 212 | pink: [255, 192, 203, null], 213 | plum: [221, 160, 221, null], 214 | powderblue: [176, 224, 230, null], 215 | purple: [128, 0, 128, null], 216 | rebeccapurple: [102, 51, 153, null], 217 | red: [255, 0, 0, null], 218 | rosybrown: [188, 143, 143, null], 219 | royalblue: [65, 105, 225, null], 220 | saddlebrown: [139, 69, 19, null], 221 | salmon: [250, 128, 114, null], 222 | sandybrown: [244, 164, 96, null], 223 | seagreen: [46, 139, 87, null], 224 | seashell: [255, 245, 238, null], 225 | sienna: [160, 82, 45, null], 226 | silver: [192, 192, 192, null], 227 | skyblue: [135, 206, 235, null], 228 | slateblue: [106, 90, 205, null], 229 | slategray: [112, 128, 144, null], 230 | slategrey: [112, 128, 144, null], 231 | snow: [255, 250, 250, null], 232 | springgreen: [0, 255, 127, null], 233 | steelblue: [70, 130, 180, null], 234 | tan: [210, 180, 140, null], 235 | teal: [0, 128, 128, null], 236 | thistle: [216, 191, 216, null], 237 | tomato: [255, 99, 71, null], 238 | turquoise: [64, 224, 208, null], 239 | violet: [238, 130, 238, null], 240 | wheat: [245, 222, 179, null], 241 | white: [255, 255, 255, null], 242 | whitesmoke: [245, 245, 245, null], 243 | yellow: [255, 255, 0, null], 244 | yellowgreen: [154, 205, 50, null] 245 | }; 246 | 247 | var TRANSPARENT = exports.TRANSPARENT = new Color([0, 0, 0, 0]); -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/Feature.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _ForeignObjectRenderer = require('./renderer/ForeignObjectRenderer'); 8 | 9 | var testRangeBounds = function testRangeBounds(document) { 10 | var TEST_HEIGHT = 123; 11 | 12 | if (document.createRange) { 13 | var range = document.createRange(); 14 | if (range.getBoundingClientRect) { 15 | var testElement = document.createElement('boundtest'); 16 | testElement.style.height = TEST_HEIGHT + 'px'; 17 | testElement.style.display = 'block'; 18 | document.body.appendChild(testElement); 19 | 20 | range.selectNode(testElement); 21 | var rangeBounds = range.getBoundingClientRect(); 22 | var rangeHeight = Math.round(rangeBounds.height); 23 | document.body.removeChild(testElement); 24 | if (rangeHeight === TEST_HEIGHT) { 25 | return true; 26 | } 27 | } 28 | } 29 | 30 | return false; 31 | }; 32 | 33 | // iOS 10.3 taints canvas with base64 images unless crossOrigin = 'anonymous' 34 | var testBase64 = function testBase64(document, src) { 35 | var img = new Image(); 36 | var canvas = document.createElement('canvas'); 37 | var ctx = canvas.getContext('2d'); 38 | 39 | return new Promise(function (resolve) { 40 | // Single pixel base64 image renders fine on iOS 10.3??? 41 | img.src = src; 42 | 43 | var onload = function onload() { 44 | try { 45 | ctx.drawImage(img, 0, 0); 46 | canvas.toDataURL(); 47 | } catch (e) { 48 | return resolve(false); 49 | } 50 | 51 | return resolve(true); 52 | }; 53 | 54 | img.onload = onload; 55 | img.onerror = function () { 56 | return resolve(false); 57 | }; 58 | 59 | if (img.complete === true) { 60 | setTimeout(function () { 61 | onload(); 62 | }, 500); 63 | } 64 | }); 65 | }; 66 | 67 | var testCORS = function testCORS() { 68 | return typeof new Image().crossOrigin !== 'undefined'; 69 | }; 70 | 71 | var testResponseType = function testResponseType() { 72 | return typeof new XMLHttpRequest().responseType === 'string'; 73 | }; 74 | 75 | var testSVG = function testSVG(document) { 76 | var img = new Image(); 77 | var canvas = document.createElement('canvas'); 78 | var ctx = canvas.getContext('2d'); 79 | img.src = 'data:image/svg+xml,'; 80 | 81 | try { 82 | ctx.drawImage(img, 0, 0); 83 | canvas.toDataURL(); 84 | } catch (e) { 85 | return false; 86 | } 87 | return true; 88 | }; 89 | 90 | var isGreenPixel = function isGreenPixel(data) { 91 | return data[0] === 0 && data[1] === 255 && data[2] === 0 && data[3] === 255; 92 | }; 93 | 94 | var testForeignObject = function testForeignObject(document) { 95 | var canvas = document.createElement('canvas'); 96 | var size = 100; 97 | canvas.width = size; 98 | canvas.height = size; 99 | var ctx = canvas.getContext('2d'); 100 | ctx.fillStyle = 'rgb(0, 255, 0)'; 101 | ctx.fillRect(0, 0, size, size); 102 | 103 | var img = new Image(); 104 | var greenImageSrc = canvas.toDataURL(); 105 | img.src = greenImageSrc; 106 | var svg = (0, _ForeignObjectRenderer.createForeignObjectSVG)(size, size, 0, 0, img); 107 | ctx.fillStyle = 'red'; 108 | ctx.fillRect(0, 0, size, size); 109 | 110 | return (0, _ForeignObjectRenderer.loadSerializedSVG)(svg).then(function (img) { 111 | ctx.drawImage(img, 0, 0); 112 | var data = ctx.getImageData(0, 0, size, size).data; 113 | ctx.fillStyle = 'red'; 114 | ctx.fillRect(0, 0, size, size); 115 | 116 | var node = document.createElement('div'); 117 | node.style.backgroundImage = 'url(' + greenImageSrc + ')'; 118 | node.style.height = size + 'px'; 119 | // Firefox 55 does not render inline tags 120 | return isGreenPixel(data) ? (0, _ForeignObjectRenderer.loadSerializedSVG)((0, _ForeignObjectRenderer.createForeignObjectSVG)(size, size, 0, 0, node)) : Promise.reject(false); 121 | }).then(function (img) { 122 | ctx.drawImage(img, 0, 0); 123 | // Edge does not render background-images 124 | return isGreenPixel(ctx.getImageData(0, 0, size, size).data); 125 | }).catch(function (e) { 126 | return false; 127 | }); 128 | }; 129 | 130 | var FEATURES = { 131 | // $FlowFixMe - get/set properties not yet supported 132 | get SUPPORT_RANGE_BOUNDS() { 133 | 'use strict'; 134 | 135 | var value = testRangeBounds(document); 136 | Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value }); 137 | return value; 138 | }, 139 | // $FlowFixMe - get/set properties not yet supported 140 | get SUPPORT_SVG_DRAWING() { 141 | 'use strict'; 142 | 143 | var value = testSVG(document); 144 | Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value }); 145 | return value; 146 | }, 147 | // $FlowFixMe - get/set properties not yet supported 148 | get SUPPORT_BASE64_DRAWING() { 149 | 'use strict'; 150 | 151 | return function (src) { 152 | var _value = testBase64(document, src); 153 | Object.defineProperty(FEATURES, 'SUPPORT_BASE64_DRAWING', { value: function value() { 154 | return _value; 155 | } }); 156 | return _value; 157 | }; 158 | }, 159 | // $FlowFixMe - get/set properties not yet supported 160 | get SUPPORT_FOREIGNOBJECT_DRAWING() { 161 | 'use strict'; 162 | 163 | var value = typeof Array.from === 'function' && typeof window.fetch === 'function' ? testForeignObject(document) : Promise.resolve(false); 164 | Object.defineProperty(FEATURES, 'SUPPORT_FOREIGNOBJECT_DRAWING', { value: value }); 165 | return value; 166 | }, 167 | // $FlowFixMe - get/set properties not yet supported 168 | get SUPPORT_CORS_IMAGES() { 169 | 'use strict'; 170 | 171 | var value = testCORS(); 172 | Object.defineProperty(FEATURES, 'SUPPORT_CORS_IMAGES', { value: value }); 173 | return value; 174 | }, 175 | // $FlowFixMe - get/set properties not yet supported 176 | get SUPPORT_RESPONSE_TYPE() { 177 | 'use strict'; 178 | 179 | var value = testResponseType(); 180 | Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value }); 181 | return value; 182 | }, 183 | // $FlowFixMe - get/set properties not yet supported 184 | get SUPPORT_CORS_XHR() { 185 | 'use strict'; 186 | 187 | var value = 'withCredentials' in new XMLHttpRequest(); 188 | Object.defineProperty(FEATURES, 'SUPPORT_CORS_XHR', { value: value }); 189 | return value; 190 | } 191 | }; 192 | 193 | exports.default = FEATURES; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/Font.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.FontMetrics = undefined; 7 | 8 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9 | 10 | var _Util = require('./Util'); 11 | 12 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 13 | 14 | var SAMPLE_TEXT = 'Hidden Text'; 15 | 16 | var FontMetrics = exports.FontMetrics = function () { 17 | function FontMetrics(document) { 18 | _classCallCheck(this, FontMetrics); 19 | 20 | this._data = {}; 21 | this._document = document; 22 | } 23 | 24 | _createClass(FontMetrics, [{ 25 | key: '_parseMetrics', 26 | value: function _parseMetrics(font) { 27 | var container = this._document.createElement('div'); 28 | var img = this._document.createElement('img'); 29 | var span = this._document.createElement('span'); 30 | 31 | var body = this._document.body; 32 | if (!body) { 33 | throw new Error(process.env.NODE_ENV !== 'production' ? 'No document found for font metrics' : ''); 34 | } 35 | 36 | container.style.visibility = 'hidden'; 37 | container.style.fontFamily = font.fontFamily; 38 | container.style.fontSize = font.fontSize; 39 | container.style.margin = '0'; 40 | container.style.padding = '0'; 41 | 42 | body.appendChild(container); 43 | 44 | img.src = _Util.SMALL_IMAGE; 45 | img.width = 1; 46 | img.height = 1; 47 | 48 | img.style.margin = '0'; 49 | img.style.padding = '0'; 50 | img.style.verticalAlign = 'baseline'; 51 | 52 | span.style.fontFamily = font.fontFamily; 53 | span.style.fontSize = font.fontSize; 54 | span.style.margin = '0'; 55 | span.style.padding = '0'; 56 | 57 | span.appendChild(this._document.createTextNode(SAMPLE_TEXT)); 58 | container.appendChild(span); 59 | container.appendChild(img); 60 | var baseline = img.offsetTop - span.offsetTop + 2; 61 | 62 | container.removeChild(span); 63 | container.appendChild(this._document.createTextNode(SAMPLE_TEXT)); 64 | 65 | container.style.lineHeight = 'normal'; 66 | img.style.verticalAlign = 'super'; 67 | 68 | var middle = img.offsetTop - container.offsetTop + 2; 69 | 70 | body.removeChild(container); 71 | 72 | return { baseline: baseline, middle: middle }; 73 | } 74 | }, { 75 | key: 'getMetrics', 76 | value: function getMetrics(font) { 77 | var key = font.fontFamily + ' ' + font.fontSize; 78 | if (this._data[key] === undefined) { 79 | this._data[key] = this._parseMetrics(font); 80 | } 81 | 82 | return this._data[key]; 83 | } 84 | }]); 85 | 86 | return FontMetrics; 87 | }(); -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/Input.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.reformatInputBounds = exports.inlineSelectElement = exports.inlineTextAreaElement = exports.inlineInputElement = exports.getInputBorderRadius = exports.INPUT_BACKGROUND = exports.INPUT_BORDERS = exports.INPUT_COLOR = undefined; 7 | 8 | var _TextContainer = require('./TextContainer'); 9 | 10 | var _TextContainer2 = _interopRequireDefault(_TextContainer); 11 | 12 | var _background = require('./parsing/background'); 13 | 14 | var _border = require('./parsing/border'); 15 | 16 | var _Circle = require('./drawing/Circle'); 17 | 18 | var _Circle2 = _interopRequireDefault(_Circle); 19 | 20 | var _Vector = require('./drawing/Vector'); 21 | 22 | var _Vector2 = _interopRequireDefault(_Vector); 23 | 24 | var _Color = require('./Color'); 25 | 26 | var _Color2 = _interopRequireDefault(_Color); 27 | 28 | var _Length = require('./Length'); 29 | 30 | var _Length2 = _interopRequireDefault(_Length); 31 | 32 | var _Bounds = require('./Bounds'); 33 | 34 | var _TextBounds = require('./TextBounds'); 35 | 36 | var _Util = require('./Util'); 37 | 38 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 39 | 40 | var INPUT_COLOR = exports.INPUT_COLOR = new _Color2.default([42, 42, 42]); 41 | var INPUT_BORDER_COLOR = new _Color2.default([165, 165, 165]); 42 | var INPUT_BACKGROUND_COLOR = new _Color2.default([222, 222, 222]); 43 | var INPUT_BORDER = { 44 | borderWidth: 1, 45 | borderColor: INPUT_BORDER_COLOR, 46 | borderStyle: _border.BORDER_STYLE.SOLID 47 | }; 48 | var INPUT_BORDERS = exports.INPUT_BORDERS = [INPUT_BORDER, INPUT_BORDER, INPUT_BORDER, INPUT_BORDER]; 49 | var INPUT_BACKGROUND = exports.INPUT_BACKGROUND = { 50 | backgroundColor: INPUT_BACKGROUND_COLOR, 51 | backgroundImage: [], 52 | backgroundClip: _background.BACKGROUND_CLIP.PADDING_BOX, 53 | backgroundOrigin: _background.BACKGROUND_ORIGIN.PADDING_BOX 54 | }; 55 | 56 | var RADIO_BORDER_RADIUS = new _Length2.default('50%'); 57 | var RADIO_BORDER_RADIUS_TUPLE = [RADIO_BORDER_RADIUS, RADIO_BORDER_RADIUS]; 58 | var INPUT_RADIO_BORDER_RADIUS = [RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE]; 59 | 60 | var CHECKBOX_BORDER_RADIUS = new _Length2.default('3px'); 61 | var CHECKBOX_BORDER_RADIUS_TUPLE = [CHECKBOX_BORDER_RADIUS, CHECKBOX_BORDER_RADIUS]; 62 | var INPUT_CHECKBOX_BORDER_RADIUS = [CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE]; 63 | 64 | var getInputBorderRadius = exports.getInputBorderRadius = function getInputBorderRadius(node) { 65 | return node.type === 'radio' ? INPUT_RADIO_BORDER_RADIUS : INPUT_CHECKBOX_BORDER_RADIUS; 66 | }; 67 | 68 | var inlineInputElement = exports.inlineInputElement = function inlineInputElement(node, container) { 69 | if (node.type === 'radio' || node.type === 'checkbox') { 70 | if (node.checked) { 71 | var size = Math.min(container.bounds.width, container.bounds.height); 72 | container.childNodes.push(node.type === 'checkbox' ? [new _Vector2.default(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79), new _Vector2.default(container.bounds.left + size * 0.16, container.bounds.top + size * 0.5549), new _Vector2.default(container.bounds.left + size * 0.27347, container.bounds.top + size * 0.44071), new _Vector2.default(container.bounds.left + size * 0.39694, container.bounds.top + size * 0.5649), new _Vector2.default(container.bounds.left + size * 0.72983, container.bounds.top + size * 0.23), new _Vector2.default(container.bounds.left + size * 0.84, container.bounds.top + size * 0.34085), new _Vector2.default(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79)] : new _Circle2.default(container.bounds.left + size / 4, container.bounds.top + size / 4, size / 4)); 73 | } 74 | } else { 75 | inlineFormElement(getInputValue(node), node, container, false); 76 | } 77 | }; 78 | 79 | var inlineTextAreaElement = exports.inlineTextAreaElement = function inlineTextAreaElement(node, container) { 80 | inlineFormElement(node.value, node, container, true); 81 | }; 82 | 83 | var inlineSelectElement = exports.inlineSelectElement = function inlineSelectElement(node, container) { 84 | var option = node.options[node.selectedIndex || 0]; 85 | inlineFormElement(option ? option.text || '' : '', node, container, false); 86 | }; 87 | 88 | var reformatInputBounds = exports.reformatInputBounds = function reformatInputBounds(bounds) { 89 | if (bounds.width > bounds.height) { 90 | bounds.left += (bounds.width - bounds.height) / 2; 91 | bounds.width = bounds.height; 92 | } else if (bounds.width < bounds.height) { 93 | bounds.top += (bounds.height - bounds.width) / 2; 94 | bounds.height = bounds.width; 95 | } 96 | return bounds; 97 | }; 98 | 99 | var inlineFormElement = function inlineFormElement(value, node, container, allowLinebreak) { 100 | var body = node.ownerDocument.body; 101 | if (value.length > 0 && body) { 102 | var wrapper = node.ownerDocument.createElement('html2canvaswrapper'); 103 | (0, _Util.copyCSSStyles)(node.ownerDocument.defaultView.getComputedStyle(node, null), wrapper); 104 | wrapper.style.position = 'absolute'; 105 | wrapper.style.left = container.bounds.left + 'px'; 106 | wrapper.style.top = container.bounds.top + 'px'; 107 | if (!allowLinebreak) { 108 | wrapper.style.whiteSpace = 'nowrap'; 109 | } 110 | var text = node.ownerDocument.createTextNode(value); 111 | wrapper.appendChild(text); 112 | body.appendChild(wrapper); 113 | container.childNodes.push(_TextContainer2.default.fromTextNode(text, container)); 114 | body.removeChild(wrapper); 115 | } 116 | }; 117 | 118 | var getInputValue = function getInputValue(node) { 119 | var value = node.type === 'password' ? new Array(node.value.length + 1).join('\u2022') : node.value; 120 | 121 | return value.length === 0 ? node.placeholder || '' : value; 122 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/Length.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.calculateLengthFromValueWithUnit = exports.LENGTH_TYPE = undefined; 7 | 8 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9 | 10 | var _NodeContainer = require('./NodeContainer'); 11 | 12 | var _NodeContainer2 = _interopRequireDefault(_NodeContainer); 13 | 14 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 15 | 16 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 17 | 18 | var LENGTH_WITH_UNIT = /([\d.]+)(px|r?em|%)/i; 19 | 20 | var LENGTH_TYPE = exports.LENGTH_TYPE = { 21 | PX: 0, 22 | PERCENTAGE: 1 23 | }; 24 | 25 | var Length = function () { 26 | function Length(value) { 27 | _classCallCheck(this, Length); 28 | 29 | this.type = value.substr(value.length - 1) === '%' ? LENGTH_TYPE.PERCENTAGE : LENGTH_TYPE.PX; 30 | var parsedValue = parseFloat(value); 31 | if (process.env.NODE_ENV !== 'production' && isNaN(parsedValue)) { 32 | console.error('Invalid value given for Length: "' + value + '"'); 33 | } 34 | this.value = isNaN(parsedValue) ? 0 : parsedValue; 35 | } 36 | 37 | _createClass(Length, [{ 38 | key: 'isPercentage', 39 | value: function isPercentage() { 40 | return this.type === LENGTH_TYPE.PERCENTAGE; 41 | } 42 | }, { 43 | key: 'getAbsoluteValue', 44 | value: function getAbsoluteValue(parentLength) { 45 | return this.isPercentage() ? parentLength * (this.value / 100) : this.value; 46 | } 47 | }], [{ 48 | key: 'create', 49 | value: function create(v) { 50 | return new Length(v); 51 | } 52 | }]); 53 | 54 | return Length; 55 | }(); 56 | 57 | exports.default = Length; 58 | 59 | 60 | var getRootFontSize = function getRootFontSize(container) { 61 | var parent = container.parent; 62 | return parent ? getRootFontSize(parent) : parseFloat(container.style.font.fontSize); 63 | }; 64 | 65 | var calculateLengthFromValueWithUnit = exports.calculateLengthFromValueWithUnit = function calculateLengthFromValueWithUnit(container, value, unit) { 66 | switch (unit) { 67 | case 'px': 68 | case '%': 69 | return new Length(value + unit); 70 | case 'em': 71 | case 'rem': 72 | var length = new Length(value); 73 | length.value *= unit === 'em' ? parseFloat(container.style.font.fontSize) : getRootFontSize(container); 74 | return length; 75 | default: 76 | // TODO: handle correctly if unknown unit is used 77 | return new Length('0'); 78 | } 79 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/Logger.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8 | 9 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10 | 11 | var Logger = function () { 12 | function Logger(enabled, id, start) { 13 | _classCallCheck(this, Logger); 14 | 15 | this.enabled = typeof window !== 'undefined' && enabled; 16 | this.start = start ? start : Date.now(); 17 | this.id = id; 18 | } 19 | 20 | _createClass(Logger, [{ 21 | key: 'child', 22 | value: function child(id) { 23 | return new Logger(this.enabled, id, this.start); 24 | } 25 | 26 | // eslint-disable-next-line flowtype/no-weak-types 27 | 28 | }, { 29 | key: 'log', 30 | value: function log() { 31 | if (this.enabled && window.console && window.console.log) { 32 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 33 | args[_key] = arguments[_key]; 34 | } 35 | 36 | Function.prototype.bind.call(window.console.log, window.console).apply(window.console, [Date.now() - this.start + 'ms', this.id ? 'html2canvas (' + this.id + '):' : 'html2canvas:'].concat([].slice.call(args, 0))); 37 | } 38 | } 39 | 40 | // eslint-disable-next-line flowtype/no-weak-types 41 | 42 | }, { 43 | key: 'error', 44 | value: function error() { 45 | if (this.enabled && window.console && window.console.error) { 46 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 47 | args[_key2] = arguments[_key2]; 48 | } 49 | 50 | Function.prototype.bind.call(window.console.error, window.console).apply(window.console, [Date.now() - this.start + 'ms', this.id ? 'html2canvas (' + this.id + '):' : 'html2canvas:'].concat([].slice.call(args, 0))); 51 | } 52 | } 53 | }]); 54 | 55 | return Logger; 56 | }(); 57 | 58 | exports.default = Logger; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/NodeParser.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.NodeParser = undefined; 7 | 8 | var _StackingContext = require('./StackingContext'); 9 | 10 | var _StackingContext2 = _interopRequireDefault(_StackingContext); 11 | 12 | var _NodeContainer = require('./NodeContainer'); 13 | 14 | var _NodeContainer2 = _interopRequireDefault(_NodeContainer); 15 | 16 | var _TextContainer = require('./TextContainer'); 17 | 18 | var _TextContainer2 = _interopRequireDefault(_TextContainer); 19 | 20 | var _Input = require('./Input'); 21 | 22 | var _ListItem = require('./ListItem'); 23 | 24 | var _listStyle = require('./parsing/listStyle'); 25 | 26 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 27 | 28 | var NodeParser = exports.NodeParser = function NodeParser(node, resourceLoader, logger) { 29 | if (process.env.NODE_ENV !== 'production') { 30 | logger.log('Starting node parsing'); 31 | } 32 | 33 | var index = 0; 34 | 35 | var container = new _NodeContainer2.default(node, null, resourceLoader, index++); 36 | var stack = new _StackingContext2.default(container, null, true); 37 | 38 | parseNodeTree(node, container, stack, resourceLoader, index); 39 | 40 | if (process.env.NODE_ENV !== 'production') { 41 | logger.log('Finished parsing node tree'); 42 | } 43 | 44 | return stack; 45 | }; 46 | 47 | var IGNORED_NODE_NAMES = ['SCRIPT', 'HEAD', 'TITLE', 'OBJECT', 'BR', 'OPTION']; 48 | 49 | var parseNodeTree = function parseNodeTree(node, parent, stack, resourceLoader, index) { 50 | if (process.env.NODE_ENV !== 'production' && index > 50000) { 51 | throw new Error('Recursion error while parsing node tree'); 52 | } 53 | 54 | for (var childNode = node.firstChild, nextNode; childNode; childNode = nextNode) { 55 | nextNode = childNode.nextSibling; 56 | var defaultView = childNode.ownerDocument.defaultView; 57 | if (childNode instanceof defaultView.Text || childNode instanceof Text || defaultView.parent && childNode instanceof defaultView.parent.Text) { 58 | if (childNode.data.trim().length > 0) { 59 | parent.childNodes.push(_TextContainer2.default.fromTextNode(childNode, parent)); 60 | } 61 | } else if (childNode instanceof defaultView.HTMLElement || childNode instanceof HTMLElement || defaultView.parent && childNode instanceof defaultView.parent.HTMLElement) { 62 | if (IGNORED_NODE_NAMES.indexOf(childNode.nodeName) === -1) { 63 | var container = new _NodeContainer2.default(childNode, parent, resourceLoader, index++); 64 | if (container.isVisible()) { 65 | if (childNode.tagName === 'INPUT') { 66 | // $FlowFixMe 67 | (0, _Input.inlineInputElement)(childNode, container); 68 | } else if (childNode.tagName === 'TEXTAREA') { 69 | // $FlowFixMe 70 | (0, _Input.inlineTextAreaElement)(childNode, container); 71 | } else if (childNode.tagName === 'SELECT') { 72 | // $FlowFixMe 73 | (0, _Input.inlineSelectElement)(childNode, container); 74 | } else if (container.style.listStyle && container.style.listStyle.listStyleType !== _listStyle.LIST_STYLE_TYPE.NONE) { 75 | (0, _ListItem.inlineListItemElement)(childNode, container, resourceLoader); 76 | } 77 | 78 | var SHOULD_TRAVERSE_CHILDREN = childNode.tagName !== 'TEXTAREA'; 79 | var treatAsRealStackingContext = createsRealStackingContext(container, childNode); 80 | if (treatAsRealStackingContext || createsStackingContext(container)) { 81 | // for treatAsRealStackingContext:false, any positioned descendants and descendants 82 | // which actually create a new stacking context should be considered part of the parent stacking context 83 | var parentStack = treatAsRealStackingContext || container.isPositioned() ? stack.getRealParentStackingContext() : stack; 84 | var childStack = new _StackingContext2.default(container, parentStack, treatAsRealStackingContext); 85 | parentStack.contexts.push(childStack); 86 | if (SHOULD_TRAVERSE_CHILDREN) { 87 | parseNodeTree(childNode, container, childStack, resourceLoader, index); 88 | } 89 | } else { 90 | stack.children.push(container); 91 | if (SHOULD_TRAVERSE_CHILDREN) { 92 | parseNodeTree(childNode, container, stack, resourceLoader, index); 93 | } 94 | } 95 | } 96 | } 97 | } else if (childNode instanceof defaultView.SVGSVGElement || childNode instanceof SVGSVGElement || defaultView.parent && childNode instanceof defaultView.parent.SVGSVGElement) { 98 | var _container = new _NodeContainer2.default(childNode, parent, resourceLoader, index++); 99 | var _treatAsRealStackingContext = createsRealStackingContext(_container, childNode); 100 | if (_treatAsRealStackingContext || createsStackingContext(_container)) { 101 | // for treatAsRealStackingContext:false, any positioned descendants and descendants 102 | // which actually create a new stacking context should be considered part of the parent stacking context 103 | var _parentStack = _treatAsRealStackingContext || _container.isPositioned() ? stack.getRealParentStackingContext() : stack; 104 | var _childStack = new _StackingContext2.default(_container, _parentStack, _treatAsRealStackingContext); 105 | _parentStack.contexts.push(_childStack); 106 | } else { 107 | stack.children.push(_container); 108 | } 109 | } 110 | } 111 | }; 112 | 113 | var createsRealStackingContext = function createsRealStackingContext(container, node) { 114 | return container.isRootElement() || container.isPositionedWithZIndex() || container.style.opacity < 1 || container.isTransformed() || isBodyWithTransparentRoot(container, node); 115 | }; 116 | 117 | var createsStackingContext = function createsStackingContext(container) { 118 | return container.isPositioned() || container.isFloating(); 119 | }; 120 | 121 | var isBodyWithTransparentRoot = function isBodyWithTransparentRoot(container, node) { 122 | return node.nodeName === 'BODY' && container.parent instanceof _NodeContainer2.default && container.parent.style.background.backgroundColor.isTransparent(); 123 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/Proxy.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.Proxy = undefined; 7 | 8 | var _Feature = require('./Feature'); 9 | 10 | var _Feature2 = _interopRequireDefault(_Feature); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | var Proxy = exports.Proxy = function Proxy(src, options) { 15 | if (!options.proxy) { 16 | return Promise.reject(process.env.NODE_ENV !== 'production' ? 'No proxy defined' : null); 17 | } 18 | var proxy = options.proxy; 19 | 20 | return new Promise(function (resolve, reject) { 21 | var responseType = _Feature2.default.SUPPORT_CORS_XHR && _Feature2.default.SUPPORT_RESPONSE_TYPE ? 'blob' : 'text'; 22 | var xhr = _Feature2.default.SUPPORT_CORS_XHR ? new XMLHttpRequest() : new XDomainRequest(); 23 | xhr.onload = function () { 24 | if (xhr instanceof XMLHttpRequest) { 25 | if (xhr.status === 200) { 26 | if (responseType === 'text') { 27 | resolve(xhr.response); 28 | } else { 29 | var reader = new FileReader(); 30 | // $FlowFixMe 31 | reader.addEventListener('load', function () { 32 | return resolve(reader.result); 33 | }, false); 34 | // $FlowFixMe 35 | reader.addEventListener('error', function (e) { 36 | return reject(e); 37 | }, false); 38 | reader.readAsDataURL(xhr.response); 39 | } 40 | } else { 41 | reject(process.env.NODE_ENV !== 'production' ? 'Failed to proxy resource ' + src.substring(0, 256) + ' with status code ' + xhr.status : ''); 42 | } 43 | } else { 44 | resolve(xhr.responseText); 45 | } 46 | }; 47 | 48 | xhr.onerror = reject; 49 | xhr.open('GET', proxy + '?url=' + encodeURIComponent(src) + '&responseType=' + responseType); 50 | 51 | if (responseType !== 'text' && xhr instanceof XMLHttpRequest) { 52 | xhr.responseType = responseType; 53 | } 54 | 55 | if (options.imageTimeout) { 56 | var timeout = options.imageTimeout; 57 | xhr.timeout = timeout; 58 | xhr.ontimeout = function () { 59 | return reject(process.env.NODE_ENV !== 'production' ? 'Timed out (' + timeout + 'ms) proxying ' + src.substring(0, 256) : ''); 60 | }; 61 | } 62 | 63 | xhr.send(); 64 | }); 65 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/StackingContext.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8 | 9 | var _NodeContainer = require('./NodeContainer'); 10 | 11 | var _NodeContainer2 = _interopRequireDefault(_NodeContainer); 12 | 13 | var _position = require('./parsing/position'); 14 | 15 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 16 | 17 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 18 | 19 | var StackingContext = function () { 20 | function StackingContext(container, parent, treatAsRealStackingContext) { 21 | _classCallCheck(this, StackingContext); 22 | 23 | this.container = container; 24 | this.parent = parent; 25 | this.contexts = []; 26 | this.children = []; 27 | this.treatAsRealStackingContext = treatAsRealStackingContext; 28 | } 29 | 30 | _createClass(StackingContext, [{ 31 | key: 'getOpacity', 32 | value: function getOpacity() { 33 | return this.parent ? this.container.style.opacity * this.parent.getOpacity() : this.container.style.opacity; 34 | } 35 | }, { 36 | key: 'getRealParentStackingContext', 37 | value: function getRealParentStackingContext() { 38 | return !this.parent || this.treatAsRealStackingContext ? this : this.parent.getRealParentStackingContext(); 39 | } 40 | }]); 41 | 42 | return StackingContext; 43 | }(); 44 | 45 | exports.default = StackingContext; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/TextBounds.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.parseTextBounds = exports.TextBounds = undefined; 7 | 8 | var _Bounds = require('./Bounds'); 9 | 10 | var _textDecoration = require('./parsing/textDecoration'); 11 | 12 | var _Feature = require('./Feature'); 13 | 14 | var _Feature2 = _interopRequireDefault(_Feature); 15 | 16 | var _Unicode = require('./Unicode'); 17 | 18 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 19 | 20 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 21 | 22 | var TextBounds = exports.TextBounds = function TextBounds(text, bounds) { 23 | _classCallCheck(this, TextBounds); 24 | 25 | this.text = text; 26 | this.bounds = bounds; 27 | }; 28 | 29 | var parseTextBounds = exports.parseTextBounds = function parseTextBounds(value, parent, node) { 30 | var letterRendering = parent.style.letterSpacing !== 0; 31 | var textList = letterRendering ? (0, _Unicode.toCodePoints)(value).map(function (i) { 32 | return (0, _Unicode.fromCodePoint)(i); 33 | }) : (0, _Unicode.breakWords)(value, parent); 34 | var length = textList.length; 35 | var defaultView = node.parentNode ? node.parentNode.ownerDocument.defaultView : null; 36 | var scrollX = defaultView ? defaultView.pageXOffset : 0; 37 | var scrollY = defaultView ? defaultView.pageYOffset : 0; 38 | var textBounds = []; 39 | var offset = 0; 40 | for (var i = 0; i < length; i++) { 41 | var text = textList[i]; 42 | if (parent.style.textDecoration !== _textDecoration.TEXT_DECORATION.NONE || text.trim().length > 0) { 43 | if (_Feature2.default.SUPPORT_RANGE_BOUNDS) { 44 | textBounds.push(new TextBounds(text, getRangeBounds(node, offset, text.length, scrollX, scrollY))); 45 | } else { 46 | var replacementNode = node.splitText(text.length); 47 | textBounds.push(new TextBounds(text, getWrapperBounds(node, scrollX, scrollY))); 48 | node = replacementNode; 49 | } 50 | } else if (!_Feature2.default.SUPPORT_RANGE_BOUNDS) { 51 | node = node.splitText(text.length); 52 | } 53 | offset += text.length; 54 | } 55 | return textBounds; 56 | }; 57 | 58 | var getWrapperBounds = function getWrapperBounds(node, scrollX, scrollY) { 59 | var wrapper = node.ownerDocument.createElement('html2canvaswrapper'); 60 | wrapper.appendChild(node.cloneNode(true)); 61 | var parentNode = node.parentNode; 62 | if (parentNode) { 63 | parentNode.replaceChild(wrapper, node); 64 | var bounds = (0, _Bounds.parseBounds)(wrapper, scrollX, scrollY); 65 | if (wrapper.firstChild) { 66 | parentNode.replaceChild(wrapper.firstChild, wrapper); 67 | } 68 | return bounds; 69 | } 70 | return new _Bounds.Bounds(0, 0, 0, 0); 71 | }; 72 | 73 | var getRangeBounds = function getRangeBounds(node, offset, length, scrollX, scrollY) { 74 | var range = node.ownerDocument.createRange(); 75 | range.setStart(node, offset); 76 | range.setEnd(node, offset + length); 77 | return _Bounds.Bounds.fromClientRect(range.getBoundingClientRect(), scrollX, scrollY); 78 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/TextContainer.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8 | 9 | var _textTransform = require('./parsing/textTransform'); 10 | 11 | var _TextBounds = require('./TextBounds'); 12 | 13 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 14 | 15 | var TextContainer = function () { 16 | function TextContainer(text, parent, bounds) { 17 | _classCallCheck(this, TextContainer); 18 | 19 | this.text = text; 20 | this.parent = parent; 21 | this.bounds = bounds; 22 | } 23 | 24 | _createClass(TextContainer, null, [{ 25 | key: 'fromTextNode', 26 | value: function fromTextNode(node, parent) { 27 | var text = transform(node.data, parent.style.textTransform); 28 | return new TextContainer(text, parent, (0, _TextBounds.parseTextBounds)(text, parent, node)); 29 | } 30 | }]); 31 | 32 | return TextContainer; 33 | }(); 34 | 35 | exports.default = TextContainer; 36 | 37 | 38 | var CAPITALIZE = /(^|\s|:|-|\(|\))([a-z])/g; 39 | 40 | var transform = function transform(text, _transform) { 41 | switch (_transform) { 42 | case _textTransform.TEXT_TRANSFORM.LOWERCASE: 43 | return text.toLowerCase(); 44 | case _textTransform.TEXT_TRANSFORM.CAPITALIZE: 45 | return text.replace(CAPITALIZE, capitalize); 46 | case _textTransform.TEXT_TRANSFORM.UPPERCASE: 47 | return text.toUpperCase(); 48 | default: 49 | return text; 50 | } 51 | }; 52 | 53 | function capitalize(m, p1, p2) { 54 | if (m.length > 0) { 55 | return p1 + p2.toUpperCase(); 56 | } 57 | 58 | return m; 59 | } -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/Unicode.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.breakWords = exports.fromCodePoint = exports.toCodePoints = undefined; 7 | 8 | var _cssLineBreak = require('css-line-break'); 9 | 10 | Object.defineProperty(exports, 'toCodePoints', { 11 | enumerable: true, 12 | get: function get() { 13 | return _cssLineBreak.toCodePoints; 14 | } 15 | }); 16 | Object.defineProperty(exports, 'fromCodePoint', { 17 | enumerable: true, 18 | get: function get() { 19 | return _cssLineBreak.fromCodePoint; 20 | } 21 | }); 22 | 23 | var _NodeContainer = require('./NodeContainer'); 24 | 25 | var _NodeContainer2 = _interopRequireDefault(_NodeContainer); 26 | 27 | var _overflowWrap = require('./parsing/overflowWrap'); 28 | 29 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 30 | 31 | var breakWords = exports.breakWords = function breakWords(str, parent) { 32 | var breaker = (0, _cssLineBreak.LineBreaker)(str, { 33 | lineBreak: parent.style.lineBreak, 34 | wordBreak: parent.style.overflowWrap === _overflowWrap.OVERFLOW_WRAP.BREAK_WORD ? 'break-word' : parent.style.wordBreak 35 | }); 36 | 37 | var words = []; 38 | var bk = void 0; 39 | 40 | while (!(bk = breaker.next()).done) { 41 | words.push(bk.value.slice()); 42 | } 43 | 44 | return words; 45 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/Util.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var contains = exports.contains = function contains(bit, value) { 7 | return (bit & value) !== 0; 8 | }; 9 | 10 | var distance = exports.distance = function distance(a, b) { 11 | return Math.sqrt(a * a + b * b); 12 | }; 13 | 14 | var copyCSSStyles = exports.copyCSSStyles = function copyCSSStyles(style, target) { 15 | // Edge does not provide value for cssText 16 | for (var i = style.length - 1; i >= 0; i--) { 17 | var property = style.item(i); 18 | // Safari shows pseudoelements if content is set 19 | if (property !== 'content') { 20 | target.style.setProperty(property, style.getPropertyValue(property)); 21 | } 22 | } 23 | return target; 24 | }; 25 | 26 | var SMALL_IMAGE = exports.SMALL_IMAGE = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/Window.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.renderElement = undefined; 7 | 8 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); 9 | 10 | var _Logger = require('./Logger'); 11 | 12 | var _Logger2 = _interopRequireDefault(_Logger); 13 | 14 | var _NodeParser = require('./NodeParser'); 15 | 16 | var _Renderer = require('./Renderer'); 17 | 18 | var _Renderer2 = _interopRequireDefault(_Renderer); 19 | 20 | var _ForeignObjectRenderer = require('./renderer/ForeignObjectRenderer'); 21 | 22 | var _ForeignObjectRenderer2 = _interopRequireDefault(_ForeignObjectRenderer); 23 | 24 | var _Feature = require('./Feature'); 25 | 26 | var _Feature2 = _interopRequireDefault(_Feature); 27 | 28 | var _Bounds = require('./Bounds'); 29 | 30 | var _Clone = require('./Clone'); 31 | 32 | var _Font = require('./Font'); 33 | 34 | var _Color = require('./Color'); 35 | 36 | var _Color2 = _interopRequireDefault(_Color); 37 | 38 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 39 | 40 | var renderElement = exports.renderElement = function renderElement(element, options, logger) { 41 | var ownerDocument = element.ownerDocument; 42 | 43 | var windowBounds = new _Bounds.Bounds(options.scrollX, options.scrollY, options.windowWidth, options.windowHeight); 44 | 45 | // http://www.w3.org/TR/css3-background/#special-backgrounds 46 | var documentBackgroundColor = ownerDocument.documentElement ? new _Color2.default(getComputedStyle(ownerDocument.documentElement).backgroundColor) : _Color.TRANSPARENT; 47 | var bodyBackgroundColor = ownerDocument.body ? new _Color2.default(getComputedStyle(ownerDocument.body).backgroundColor) : _Color.TRANSPARENT; 48 | 49 | var backgroundColor = element === ownerDocument.documentElement ? documentBackgroundColor.isTransparent() ? bodyBackgroundColor.isTransparent() ? options.backgroundColor ? new _Color2.default(options.backgroundColor) : null : bodyBackgroundColor : documentBackgroundColor : options.backgroundColor ? new _Color2.default(options.backgroundColor) : null; 50 | 51 | return (options.foreignObjectRendering ? // $FlowFixMe 52 | _Feature2.default.SUPPORT_FOREIGNOBJECT_DRAWING : Promise.resolve(false)).then(function (supportForeignObject) { 53 | return supportForeignObject ? function (cloner) { 54 | if (process.env.NODE_ENV !== 'production') { 55 | logger.log('Document cloned, using foreignObject rendering'); 56 | } 57 | 58 | return cloner.inlineFonts(ownerDocument).then(function () { 59 | return cloner.resourceLoader.ready(); 60 | }).then(function () { 61 | var renderer = new _ForeignObjectRenderer2.default(cloner.documentElement); 62 | 63 | var defaultView = ownerDocument.defaultView; 64 | var scrollX = defaultView.pageXOffset; 65 | var scrollY = defaultView.pageYOffset; 66 | 67 | var isDocument = element.tagName === 'HTML' || element.tagName === 'BODY'; 68 | 69 | var _ref = isDocument ? (0, _Bounds.parseDocumentSize)(ownerDocument) : (0, _Bounds.parseBounds)(element, scrollX, scrollY), 70 | width = _ref.width, 71 | height = _ref.height, 72 | left = _ref.left, 73 | top = _ref.top; 74 | 75 | return renderer.render({ 76 | backgroundColor: backgroundColor, 77 | logger: logger, 78 | scale: options.scale, 79 | x: typeof options.x === 'number' ? options.x : left, 80 | y: typeof options.y === 'number' ? options.y : top, 81 | width: typeof options.width === 'number' ? options.width : Math.ceil(width), 82 | height: typeof options.height === 'number' ? options.height : Math.ceil(height), 83 | windowWidth: options.windowWidth, 84 | windowHeight: options.windowHeight, 85 | scrollX: options.scrollX, 86 | scrollY: options.scrollY 87 | }); 88 | }); 89 | }(new _Clone.DocumentCloner(element, options, logger, true, renderElement)) : (0, _Clone.cloneWindow)(ownerDocument, windowBounds, element, options, logger, renderElement).then(function (_ref2) { 90 | var _ref3 = _slicedToArray(_ref2, 3), 91 | container = _ref3[0], 92 | clonedElement = _ref3[1], 93 | resourceLoader = _ref3[2]; 94 | 95 | if (process.env.NODE_ENV !== 'production') { 96 | logger.log('Document cloned, using computed rendering'); 97 | } 98 | 99 | var stack = (0, _NodeParser.NodeParser)(clonedElement, resourceLoader, logger); 100 | var clonedDocument = clonedElement.ownerDocument; 101 | 102 | if (backgroundColor === stack.container.style.background.backgroundColor) { 103 | stack.container.style.background.backgroundColor = _Color.TRANSPARENT; 104 | } 105 | 106 | return resourceLoader.ready().then(function (imageStore) { 107 | var fontMetrics = new _Font.FontMetrics(clonedDocument); 108 | if (process.env.NODE_ENV !== 'production') { 109 | logger.log('Starting renderer'); 110 | } 111 | 112 | var defaultView = clonedDocument.defaultView; 113 | var scrollX = defaultView.pageXOffset; 114 | var scrollY = defaultView.pageYOffset; 115 | 116 | var isDocument = clonedElement.tagName === 'HTML' || clonedElement.tagName === 'BODY'; 117 | 118 | var _ref4 = isDocument ? (0, _Bounds.parseDocumentSize)(ownerDocument) : (0, _Bounds.parseBounds)(clonedElement, scrollX, scrollY), 119 | width = _ref4.width, 120 | height = _ref4.height, 121 | left = _ref4.left, 122 | top = _ref4.top; 123 | 124 | var renderOptions = { 125 | backgroundColor: backgroundColor, 126 | fontMetrics: fontMetrics, 127 | imageStore: imageStore, 128 | logger: logger, 129 | scale: options.scale, 130 | x: typeof options.x === 'number' ? options.x : left, 131 | y: typeof options.y === 'number' ? options.y : top, 132 | width: typeof options.width === 'number' ? options.width : Math.ceil(width), 133 | height: typeof options.height === 'number' ? options.height : Math.ceil(height) 134 | }; 135 | 136 | if (Array.isArray(options.target)) { 137 | return Promise.all(options.target.map(function (target) { 138 | var renderer = new _Renderer2.default(target, renderOptions); 139 | return renderer.render(stack); 140 | })); 141 | } else { 142 | var renderer = new _Renderer2.default(options.target, renderOptions); 143 | var canvas = renderer.render(stack); 144 | if (options.removeContainer === true) { 145 | if (container.parentNode) { 146 | container.parentNode.removeChild(container); 147 | } else if (process.env.NODE_ENV !== 'production') { 148 | logger.log('Cannot detach cloned iframe as it is not in the DOM anymore'); 149 | } 150 | } 151 | 152 | return canvas; 153 | } 154 | }); 155 | }); 156 | }); 157 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/drawing/BezierCurve.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8 | 9 | var _Path = require('./Path'); 10 | 11 | var _Vector = require('./Vector'); 12 | 13 | var _Vector2 = _interopRequireDefault(_Vector); 14 | 15 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 16 | 17 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 18 | 19 | var lerp = function lerp(a, b, t) { 20 | return new _Vector2.default(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); 21 | }; 22 | 23 | var BezierCurve = function () { 24 | function BezierCurve(start, startControl, endControl, end) { 25 | _classCallCheck(this, BezierCurve); 26 | 27 | this.type = _Path.PATH.BEZIER_CURVE; 28 | this.start = start; 29 | this.startControl = startControl; 30 | this.endControl = endControl; 31 | this.end = end; 32 | } 33 | 34 | _createClass(BezierCurve, [{ 35 | key: 'subdivide', 36 | value: function subdivide(t, firstHalf) { 37 | var ab = lerp(this.start, this.startControl, t); 38 | var bc = lerp(this.startControl, this.endControl, t); 39 | var cd = lerp(this.endControl, this.end, t); 40 | var abbc = lerp(ab, bc, t); 41 | var bccd = lerp(bc, cd, t); 42 | var dest = lerp(abbc, bccd, t); 43 | return firstHalf ? new BezierCurve(this.start, ab, abbc, dest) : new BezierCurve(dest, bccd, cd, this.end); 44 | } 45 | }, { 46 | key: 'reverse', 47 | value: function reverse() { 48 | return new BezierCurve(this.end, this.endControl, this.startControl, this.start); 49 | } 50 | }]); 51 | 52 | return BezierCurve; 53 | }(); 54 | 55 | exports.default = BezierCurve; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/drawing/Circle.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _Path = require('./Path'); 8 | 9 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10 | 11 | var Circle = function Circle(x, y, radius) { 12 | _classCallCheck(this, Circle); 13 | 14 | this.type = _Path.PATH.CIRCLE; 15 | this.x = x; 16 | this.y = y; 17 | this.radius = radius; 18 | if (process.env.NODE_ENV !== 'production') { 19 | if (isNaN(x)) { 20 | console.error('Invalid x value given for Circle'); 21 | } 22 | if (isNaN(y)) { 23 | console.error('Invalid y value given for Circle'); 24 | } 25 | if (isNaN(radius)) { 26 | console.error('Invalid radius value given for Circle'); 27 | } 28 | } 29 | }; 30 | 31 | exports.default = Circle; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/drawing/Path.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var PATH = exports.PATH = { 7 | VECTOR: 0, 8 | BEZIER_CURVE: 1, 9 | CIRCLE: 2 10 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/drawing/Size.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8 | 9 | var Size = function Size(width, height) { 10 | _classCallCheck(this, Size); 11 | 12 | this.width = width; 13 | this.height = height; 14 | }; 15 | 16 | exports.default = Size; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/drawing/Vector.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _Path = require('./Path'); 8 | 9 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10 | 11 | var Vector = function Vector(x, y) { 12 | _classCallCheck(this, Vector); 13 | 14 | this.type = _Path.PATH.VECTOR; 15 | this.x = x; 16 | this.y = y; 17 | if (process.env.NODE_ENV !== 'production') { 18 | if (isNaN(x)) { 19 | console.error('Invalid x value given for Vector'); 20 | } 21 | if (isNaN(y)) { 22 | console.error('Invalid y value given for Vector'); 23 | } 24 | } 25 | }; 26 | 27 | exports.default = Vector; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; 4 | 5 | var _CanvasRenderer = require('./renderer/CanvasRenderer'); 6 | 7 | var _CanvasRenderer2 = _interopRequireDefault(_CanvasRenderer); 8 | 9 | var _Logger = require('./Logger'); 10 | 11 | var _Logger2 = _interopRequireDefault(_Logger); 12 | 13 | var _Window = require('./Window'); 14 | 15 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 16 | 17 | var html2canvas = function html2canvas(element, conf) { 18 | var config = conf || {}; 19 | var logger = new _Logger2.default(typeof config.logging === 'boolean' ? config.logging : true); 20 | logger.log('html2canvas ' + "$npm_package_version"); 21 | 22 | if (process.env.NODE_ENV !== 'production' && typeof config.onrendered === 'function') { 23 | logger.error('onrendered option is deprecated, html2canvas returns a Promise with the canvas as the value'); 24 | } 25 | 26 | var ownerDocument = element.ownerDocument; 27 | if (!ownerDocument) { 28 | return Promise.reject('Provided element is not within a Document'); 29 | } 30 | var defaultView = ownerDocument.defaultView; 31 | 32 | var defaultOptions = { 33 | async: true, 34 | allowTaint: false, 35 | backgroundColor: '#ffffff', 36 | imageTimeout: 15000, 37 | logging: true, 38 | proxy: null, 39 | removeContainer: true, 40 | foreignObjectRendering: false, 41 | scale: defaultView.devicePixelRatio || 1, 42 | target: new _CanvasRenderer2.default(config.canvas), 43 | useCORS: false, 44 | windowWidth: defaultView.innerWidth, 45 | windowHeight: defaultView.innerHeight, 46 | scrollX: defaultView.pageXOffset, 47 | scrollY: defaultView.pageYOffset 48 | }; 49 | 50 | var result = (0, _Window.renderElement)(element, _extends({}, defaultOptions, config), logger); 51 | 52 | if (process.env.NODE_ENV !== 'production') { 53 | return result.catch(function (e) { 54 | logger.error(e); 55 | throw e; 56 | }); 57 | } 58 | return result; 59 | }; 60 | 61 | html2canvas.CanvasRenderer = _CanvasRenderer2.default; 62 | 63 | module.exports = html2canvas; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/border.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.parseBorder = exports.BORDER_SIDES = exports.BORDER_STYLE = undefined; 7 | 8 | var _Color = require('../Color'); 9 | 10 | var _Color2 = _interopRequireDefault(_Color); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | var BORDER_STYLE = exports.BORDER_STYLE = { 15 | NONE: 0, 16 | SOLID: 1 17 | }; 18 | 19 | var BORDER_SIDES = exports.BORDER_SIDES = { 20 | TOP: 0, 21 | RIGHT: 1, 22 | BOTTOM: 2, 23 | LEFT: 3 24 | }; 25 | 26 | var SIDES = Object.keys(BORDER_SIDES).map(function (s) { 27 | return s.toLowerCase(); 28 | }); 29 | 30 | var parseBorderStyle = function parseBorderStyle(style) { 31 | switch (style) { 32 | case 'none': 33 | return BORDER_STYLE.NONE; 34 | } 35 | return BORDER_STYLE.SOLID; 36 | }; 37 | 38 | var parseBorder = exports.parseBorder = function parseBorder(style) { 39 | return SIDES.map(function (side) { 40 | var borderColor = new _Color2.default(style.getPropertyValue('border-' + side + '-color')); 41 | var borderStyle = parseBorderStyle(style.getPropertyValue('border-' + side + '-style')); 42 | var borderWidth = parseFloat(style.getPropertyValue('border-' + side + '-width')); 43 | return { 44 | borderColor: borderColor, 45 | borderStyle: borderStyle, 46 | borderWidth: isNaN(borderWidth) ? 0 : borderWidth 47 | }; 48 | }); 49 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/borderRadius.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.parseBorderRadius = undefined; 7 | 8 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); 9 | 10 | var _Length = require('../Length'); 11 | 12 | var _Length2 = _interopRequireDefault(_Length); 13 | 14 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 15 | 16 | var SIDES = ['top-left', 'top-right', 'bottom-right', 'bottom-left']; 17 | 18 | var parseBorderRadius = exports.parseBorderRadius = function parseBorderRadius(style) { 19 | return SIDES.map(function (side) { 20 | var value = style.getPropertyValue('border-' + side + '-radius'); 21 | 22 | var _value$split$map = value.split(' ').map(_Length2.default.create), 23 | _value$split$map2 = _slicedToArray(_value$split$map, 2), 24 | horizontal = _value$split$map2[0], 25 | vertical = _value$split$map2[1]; 26 | 27 | return typeof vertical === 'undefined' ? [horizontal, horizontal] : [horizontal, vertical]; 28 | }); 29 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/display.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var DISPLAY = exports.DISPLAY = { 7 | NONE: 1 << 0, 8 | BLOCK: 1 << 1, 9 | INLINE: 1 << 2, 10 | RUN_IN: 1 << 3, 11 | FLOW: 1 << 4, 12 | FLOW_ROOT: 1 << 5, 13 | TABLE: 1 << 6, 14 | FLEX: 1 << 7, 15 | GRID: 1 << 8, 16 | RUBY: 1 << 9, 17 | SUBGRID: 1 << 10, 18 | LIST_ITEM: 1 << 11, 19 | TABLE_ROW_GROUP: 1 << 12, 20 | TABLE_HEADER_GROUP: 1 << 13, 21 | TABLE_FOOTER_GROUP: 1 << 14, 22 | TABLE_ROW: 1 << 15, 23 | TABLE_CELL: 1 << 16, 24 | TABLE_COLUMN_GROUP: 1 << 17, 25 | TABLE_COLUMN: 1 << 18, 26 | TABLE_CAPTION: 1 << 19, 27 | RUBY_BASE: 1 << 20, 28 | RUBY_TEXT: 1 << 21, 29 | RUBY_BASE_CONTAINER: 1 << 22, 30 | RUBY_TEXT_CONTAINER: 1 << 23, 31 | CONTENTS: 1 << 24, 32 | INLINE_BLOCK: 1 << 25, 33 | INLINE_LIST_ITEM: 1 << 26, 34 | INLINE_TABLE: 1 << 27, 35 | INLINE_FLEX: 1 << 28, 36 | INLINE_GRID: 1 << 29 37 | }; 38 | 39 | var parseDisplayValue = function parseDisplayValue(display) { 40 | switch (display) { 41 | case 'block': 42 | return DISPLAY.BLOCK; 43 | case 'inline': 44 | return DISPLAY.INLINE; 45 | case 'run-in': 46 | return DISPLAY.RUN_IN; 47 | case 'flow': 48 | return DISPLAY.FLOW; 49 | case 'flow-root': 50 | return DISPLAY.FLOW_ROOT; 51 | case 'table': 52 | return DISPLAY.TABLE; 53 | case 'flex': 54 | return DISPLAY.FLEX; 55 | case 'grid': 56 | return DISPLAY.GRID; 57 | case 'ruby': 58 | return DISPLAY.RUBY; 59 | case 'subgrid': 60 | return DISPLAY.SUBGRID; 61 | case 'list-item': 62 | return DISPLAY.LIST_ITEM; 63 | case 'table-row-group': 64 | return DISPLAY.TABLE_ROW_GROUP; 65 | case 'table-header-group': 66 | return DISPLAY.TABLE_HEADER_GROUP; 67 | case 'table-footer-group': 68 | return DISPLAY.TABLE_FOOTER_GROUP; 69 | case 'table-row': 70 | return DISPLAY.TABLE_ROW; 71 | case 'table-cell': 72 | return DISPLAY.TABLE_CELL; 73 | case 'table-column-group': 74 | return DISPLAY.TABLE_COLUMN_GROUP; 75 | case 'table-column': 76 | return DISPLAY.TABLE_COLUMN; 77 | case 'table-caption': 78 | return DISPLAY.TABLE_CAPTION; 79 | case 'ruby-base': 80 | return DISPLAY.RUBY_BASE; 81 | case 'ruby-text': 82 | return DISPLAY.RUBY_TEXT; 83 | case 'ruby-base-container': 84 | return DISPLAY.RUBY_BASE_CONTAINER; 85 | case 'ruby-text-container': 86 | return DISPLAY.RUBY_TEXT_CONTAINER; 87 | case 'contents': 88 | return DISPLAY.CONTENTS; 89 | case 'inline-block': 90 | return DISPLAY.INLINE_BLOCK; 91 | case 'inline-list-item': 92 | return DISPLAY.INLINE_LIST_ITEM; 93 | case 'inline-table': 94 | return DISPLAY.INLINE_TABLE; 95 | case 'inline-flex': 96 | return DISPLAY.INLINE_FLEX; 97 | case 'inline-grid': 98 | return DISPLAY.INLINE_GRID; 99 | } 100 | 101 | return DISPLAY.NONE; 102 | }; 103 | 104 | var setDisplayBit = function setDisplayBit(bit, display) { 105 | return bit | parseDisplayValue(display); 106 | }; 107 | 108 | var parseDisplay = exports.parseDisplay = function parseDisplay(display) { 109 | return display.split(' ').reduce(setDisplayBit, 0); 110 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/float.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var FLOAT = exports.FLOAT = { 7 | NONE: 0, 8 | LEFT: 1, 9 | RIGHT: 2, 10 | INLINE_START: 3, 11 | INLINE_END: 4 12 | }; 13 | 14 | var parseCSSFloat = exports.parseCSSFloat = function parseCSSFloat(float) { 15 | switch (float) { 16 | case 'left': 17 | return FLOAT.LEFT; 18 | case 'right': 19 | return FLOAT.RIGHT; 20 | case 'inline-start': 21 | return FLOAT.INLINE_START; 22 | case 'inline-end': 23 | return FLOAT.INLINE_END; 24 | } 25 | return FLOAT.NONE; 26 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/font.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | 8 | var parseFontWeight = function parseFontWeight(weight) { 9 | switch (weight) { 10 | case 'normal': 11 | return 400; 12 | case 'bold': 13 | return 700; 14 | } 15 | 16 | var value = parseInt(weight, 10); 17 | return isNaN(value) ? 400 : value; 18 | }; 19 | 20 | var parseFont = exports.parseFont = function parseFont(style) { 21 | var fontFamily = style.fontFamily; 22 | var fontSize = style.fontSize; 23 | var fontStyle = style.fontStyle; 24 | var fontVariant = style.fontVariant; 25 | var fontWeight = parseFontWeight(style.fontWeight); 26 | 27 | return { 28 | fontFamily: fontFamily, 29 | fontSize: fontSize, 30 | fontStyle: fontStyle, 31 | fontVariant: fontVariant, 32 | fontWeight: fontWeight 33 | }; 34 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/letterSpacing.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var parseLetterSpacing = exports.parseLetterSpacing = function parseLetterSpacing(letterSpacing) { 7 | if (letterSpacing === 'normal') { 8 | return 0; 9 | } 10 | var value = parseFloat(letterSpacing); 11 | return isNaN(value) ? 0 : value; 12 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/lineBreak.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var LINE_BREAK = exports.LINE_BREAK = { 7 | NORMAL: 'normal', 8 | STRICT: 'strict' 9 | }; 10 | 11 | var parseLineBreak = exports.parseLineBreak = function parseLineBreak(wordBreak) { 12 | switch (wordBreak) { 13 | case 'strict': 14 | return LINE_BREAK.STRICT; 15 | case 'normal': 16 | default: 17 | return LINE_BREAK.NORMAL; 18 | } 19 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/listStyle.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.parseListStyle = exports.parseListStyleType = exports.LIST_STYLE_TYPE = exports.LIST_STYLE_POSITION = undefined; 7 | 8 | var _background = require('./background'); 9 | 10 | var LIST_STYLE_POSITION = exports.LIST_STYLE_POSITION = { 11 | INSIDE: 0, 12 | OUTSIDE: 1 13 | }; 14 | 15 | var LIST_STYLE_TYPE = exports.LIST_STYLE_TYPE = { 16 | NONE: -1, 17 | DISC: 0, 18 | CIRCLE: 1, 19 | SQUARE: 2, 20 | DECIMAL: 3, 21 | CJK_DECIMAL: 4, 22 | DECIMAL_LEADING_ZERO: 5, 23 | LOWER_ROMAN: 6, 24 | UPPER_ROMAN: 7, 25 | LOWER_GREEK: 8, 26 | LOWER_ALPHA: 9, 27 | UPPER_ALPHA: 10, 28 | ARABIC_INDIC: 11, 29 | ARMENIAN: 12, 30 | BENGALI: 13, 31 | CAMBODIAN: 14, 32 | CJK_EARTHLY_BRANCH: 15, 33 | CJK_HEAVENLY_STEM: 16, 34 | CJK_IDEOGRAPHIC: 17, 35 | DEVANAGARI: 18, 36 | ETHIOPIC_NUMERIC: 19, 37 | GEORGIAN: 20, 38 | GUJARATI: 21, 39 | GURMUKHI: 22, 40 | HEBREW: 22, 41 | HIRAGANA: 23, 42 | HIRAGANA_IROHA: 24, 43 | JAPANESE_FORMAL: 25, 44 | JAPANESE_INFORMAL: 26, 45 | KANNADA: 27, 46 | KATAKANA: 28, 47 | KATAKANA_IROHA: 29, 48 | KHMER: 30, 49 | KOREAN_HANGUL_FORMAL: 31, 50 | KOREAN_HANJA_FORMAL: 32, 51 | KOREAN_HANJA_INFORMAL: 33, 52 | LAO: 34, 53 | LOWER_ARMENIAN: 35, 54 | MALAYALAM: 36, 55 | MONGOLIAN: 37, 56 | MYANMAR: 38, 57 | ORIYA: 39, 58 | PERSIAN: 40, 59 | SIMP_CHINESE_FORMAL: 41, 60 | SIMP_CHINESE_INFORMAL: 42, 61 | TAMIL: 43, 62 | TELUGU: 44, 63 | THAI: 45, 64 | TIBETAN: 46, 65 | TRAD_CHINESE_FORMAL: 47, 66 | TRAD_CHINESE_INFORMAL: 48, 67 | UPPER_ARMENIAN: 49, 68 | DISCLOSURE_OPEN: 50, 69 | DISCLOSURE_CLOSED: 51 70 | }; 71 | 72 | var parseListStyleType = exports.parseListStyleType = function parseListStyleType(type) { 73 | switch (type) { 74 | case 'disc': 75 | return LIST_STYLE_TYPE.DISC; 76 | case 'circle': 77 | return LIST_STYLE_TYPE.CIRCLE; 78 | case 'square': 79 | return LIST_STYLE_TYPE.SQUARE; 80 | case 'decimal': 81 | return LIST_STYLE_TYPE.DECIMAL; 82 | case 'cjk-decimal': 83 | return LIST_STYLE_TYPE.CJK_DECIMAL; 84 | case 'decimal-leading-zero': 85 | return LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO; 86 | case 'lower-roman': 87 | return LIST_STYLE_TYPE.LOWER_ROMAN; 88 | case 'upper-roman': 89 | return LIST_STYLE_TYPE.UPPER_ROMAN; 90 | case 'lower-greek': 91 | return LIST_STYLE_TYPE.LOWER_GREEK; 92 | case 'lower-alpha': 93 | return LIST_STYLE_TYPE.LOWER_ALPHA; 94 | case 'upper-alpha': 95 | return LIST_STYLE_TYPE.UPPER_ALPHA; 96 | case 'arabic-indic': 97 | return LIST_STYLE_TYPE.ARABIC_INDIC; 98 | case 'armenian': 99 | return LIST_STYLE_TYPE.ARMENIAN; 100 | case 'bengali': 101 | return LIST_STYLE_TYPE.BENGALI; 102 | case 'cambodian': 103 | return LIST_STYLE_TYPE.CAMBODIAN; 104 | case 'cjk-earthly-branch': 105 | return LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH; 106 | case 'cjk-heavenly-stem': 107 | return LIST_STYLE_TYPE.CJK_HEAVENLY_STEM; 108 | case 'cjk-ideographic': 109 | return LIST_STYLE_TYPE.CJK_IDEOGRAPHIC; 110 | case 'devanagari': 111 | return LIST_STYLE_TYPE.DEVANAGARI; 112 | case 'ethiopic-numeric': 113 | return LIST_STYLE_TYPE.ETHIOPIC_NUMERIC; 114 | case 'georgian': 115 | return LIST_STYLE_TYPE.GEORGIAN; 116 | case 'gujarati': 117 | return LIST_STYLE_TYPE.GUJARATI; 118 | case 'gurmukhi': 119 | return LIST_STYLE_TYPE.GURMUKHI; 120 | case 'hebrew': 121 | return LIST_STYLE_TYPE.HEBREW; 122 | case 'hiragana': 123 | return LIST_STYLE_TYPE.HIRAGANA; 124 | case 'hiragana-iroha': 125 | return LIST_STYLE_TYPE.HIRAGANA_IROHA; 126 | case 'japanese-formal': 127 | return LIST_STYLE_TYPE.JAPANESE_FORMAL; 128 | case 'japanese-informal': 129 | return LIST_STYLE_TYPE.JAPANESE_INFORMAL; 130 | case 'kannada': 131 | return LIST_STYLE_TYPE.KANNADA; 132 | case 'katakana': 133 | return LIST_STYLE_TYPE.KATAKANA; 134 | case 'katakana-iroha': 135 | return LIST_STYLE_TYPE.KATAKANA_IROHA; 136 | case 'khmer': 137 | return LIST_STYLE_TYPE.KHMER; 138 | case 'korean-hangul-formal': 139 | return LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL; 140 | case 'korean-hanja-formal': 141 | return LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL; 142 | case 'korean-hanja-informal': 143 | return LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL; 144 | case 'lao': 145 | return LIST_STYLE_TYPE.LAO; 146 | case 'lower-armenian': 147 | return LIST_STYLE_TYPE.LOWER_ARMENIAN; 148 | case 'malayalam': 149 | return LIST_STYLE_TYPE.MALAYALAM; 150 | case 'mongolian': 151 | return LIST_STYLE_TYPE.MONGOLIAN; 152 | case 'myanmar': 153 | return LIST_STYLE_TYPE.MYANMAR; 154 | case 'oriya': 155 | return LIST_STYLE_TYPE.ORIYA; 156 | case 'persian': 157 | return LIST_STYLE_TYPE.PERSIAN; 158 | case 'simp-chinese-formal': 159 | return LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL; 160 | case 'simp-chinese-informal': 161 | return LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL; 162 | case 'tamil': 163 | return LIST_STYLE_TYPE.TAMIL; 164 | case 'telugu': 165 | return LIST_STYLE_TYPE.TELUGU; 166 | case 'thai': 167 | return LIST_STYLE_TYPE.THAI; 168 | case 'tibetan': 169 | return LIST_STYLE_TYPE.TIBETAN; 170 | case 'trad-chinese-formal': 171 | return LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL; 172 | case 'trad-chinese-informal': 173 | return LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL; 174 | case 'upper-armenian': 175 | return LIST_STYLE_TYPE.UPPER_ARMENIAN; 176 | case 'disclosure-open': 177 | return LIST_STYLE_TYPE.DISCLOSURE_OPEN; 178 | case 'disclosure-closed': 179 | return LIST_STYLE_TYPE.DISCLOSURE_CLOSED; 180 | case 'none': 181 | default: 182 | return LIST_STYLE_TYPE.NONE; 183 | } 184 | }; 185 | 186 | var parseListStyle = exports.parseListStyle = function parseListStyle(style) { 187 | var listStyleImage = (0, _background.parseBackgroundImage)(style.getPropertyValue('list-style-image')); 188 | return { 189 | listStyleType: parseListStyleType(style.getPropertyValue('list-style-type')), 190 | listStyleImage: listStyleImage.length ? listStyleImage[0] : null, 191 | listStylePosition: parseListStylePosition(style.getPropertyValue('list-style-position')) 192 | }; 193 | }; 194 | 195 | var parseListStylePosition = function parseListStylePosition(position) { 196 | switch (position) { 197 | case 'inside': 198 | return LIST_STYLE_POSITION.INSIDE; 199 | case 'outside': 200 | default: 201 | return LIST_STYLE_POSITION.OUTSIDE; 202 | } 203 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/margin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.parseMargin = undefined; 7 | 8 | var _Length = require('../Length'); 9 | 10 | var _Length2 = _interopRequireDefault(_Length); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | var SIDES = ['top', 'right', 'bottom', 'left']; 15 | 16 | var parseMargin = exports.parseMargin = function parseMargin(style) { 17 | return SIDES.map(function (side) { 18 | return new _Length2.default(style.getPropertyValue('margin-' + side)); 19 | }); 20 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/overflow.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var OVERFLOW = exports.OVERFLOW = { 7 | VISIBLE: 0, 8 | HIDDEN: 1, 9 | SCROLL: 2, 10 | AUTO: 3 11 | }; 12 | 13 | var parseOverflow = exports.parseOverflow = function parseOverflow(overflow) { 14 | switch (overflow) { 15 | case 'hidden': 16 | return OVERFLOW.HIDDEN; 17 | case 'scroll': 18 | return OVERFLOW.SCROLL; 19 | case 'auto': 20 | return OVERFLOW.AUTO; 21 | case 'visible': 22 | default: 23 | return OVERFLOW.VISIBLE; 24 | } 25 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/overflowWrap.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var OVERFLOW_WRAP = exports.OVERFLOW_WRAP = { 7 | NORMAL: 0, 8 | BREAK_WORD: 1 9 | }; 10 | 11 | var parseOverflowWrap = exports.parseOverflowWrap = function parseOverflowWrap(overflow) { 12 | switch (overflow) { 13 | case 'break-word': 14 | return OVERFLOW_WRAP.BREAK_WORD; 15 | case 'normal': 16 | default: 17 | return OVERFLOW_WRAP.NORMAL; 18 | } 19 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/padding.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.parsePadding = exports.PADDING_SIDES = undefined; 7 | 8 | var _Length = require('../Length'); 9 | 10 | var _Length2 = _interopRequireDefault(_Length); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | var PADDING_SIDES = exports.PADDING_SIDES = { 15 | TOP: 0, 16 | RIGHT: 1, 17 | BOTTOM: 2, 18 | LEFT: 3 19 | }; 20 | 21 | var SIDES = ['top', 'right', 'bottom', 'left']; 22 | 23 | var parsePadding = exports.parsePadding = function parsePadding(style) { 24 | return SIDES.map(function (side) { 25 | return new _Length2.default(style.getPropertyValue('padding-' + side)); 26 | }); 27 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/position.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var POSITION = exports.POSITION = { 7 | STATIC: 0, 8 | RELATIVE: 1, 9 | ABSOLUTE: 2, 10 | FIXED: 3, 11 | STICKY: 4 12 | }; 13 | 14 | var parsePosition = exports.parsePosition = function parsePosition(position) { 15 | switch (position) { 16 | case 'relative': 17 | return POSITION.RELATIVE; 18 | case 'absolute': 19 | return POSITION.ABSOLUTE; 20 | case 'fixed': 21 | return POSITION.FIXED; 22 | case 'sticky': 23 | return POSITION.STICKY; 24 | } 25 | 26 | return POSITION.STATIC; 27 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/textDecoration.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.parseTextDecoration = exports.TEXT_DECORATION_LINE = exports.TEXT_DECORATION = exports.TEXT_DECORATION_STYLE = undefined; 7 | 8 | var _Color = require('../Color'); 9 | 10 | var _Color2 = _interopRequireDefault(_Color); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | var TEXT_DECORATION_STYLE = exports.TEXT_DECORATION_STYLE = { 15 | SOLID: 0, 16 | DOUBLE: 1, 17 | DOTTED: 2, 18 | DASHED: 3, 19 | WAVY: 4 20 | }; 21 | 22 | var TEXT_DECORATION = exports.TEXT_DECORATION = { 23 | NONE: null 24 | }; 25 | 26 | var TEXT_DECORATION_LINE = exports.TEXT_DECORATION_LINE = { 27 | UNDERLINE: 1, 28 | OVERLINE: 2, 29 | LINE_THROUGH: 3, 30 | BLINK: 4 31 | }; 32 | 33 | var parseLine = function parseLine(line) { 34 | switch (line) { 35 | case 'underline': 36 | return TEXT_DECORATION_LINE.UNDERLINE; 37 | case 'overline': 38 | return TEXT_DECORATION_LINE.OVERLINE; 39 | case 'line-through': 40 | return TEXT_DECORATION_LINE.LINE_THROUGH; 41 | } 42 | return TEXT_DECORATION_LINE.BLINK; 43 | }; 44 | 45 | var parseTextDecorationLine = function parseTextDecorationLine(line) { 46 | if (line === 'none') { 47 | return null; 48 | } 49 | 50 | return line.split(' ').map(parseLine); 51 | }; 52 | 53 | var parseTextDecorationStyle = function parseTextDecorationStyle(style) { 54 | switch (style) { 55 | case 'double': 56 | return TEXT_DECORATION_STYLE.DOUBLE; 57 | case 'dotted': 58 | return TEXT_DECORATION_STYLE.DOTTED; 59 | case 'dashed': 60 | return TEXT_DECORATION_STYLE.DASHED; 61 | case 'wavy': 62 | return TEXT_DECORATION_STYLE.WAVY; 63 | } 64 | return TEXT_DECORATION_STYLE.SOLID; 65 | }; 66 | 67 | var parseTextDecoration = exports.parseTextDecoration = function parseTextDecoration(style) { 68 | var textDecorationLine = parseTextDecorationLine(style.textDecorationLine ? style.textDecorationLine : style.textDecoration); 69 | if (textDecorationLine === null) { 70 | return TEXT_DECORATION.NONE; 71 | } 72 | 73 | var textDecorationColor = style.textDecorationColor ? new _Color2.default(style.textDecorationColor) : null; 74 | var textDecorationStyle = parseTextDecorationStyle(style.textDecorationStyle); 75 | 76 | return { 77 | textDecorationLine: textDecorationLine, 78 | textDecorationColor: textDecorationColor, 79 | textDecorationStyle: textDecorationStyle 80 | }; 81 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/textShadow.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.parseTextShadow = undefined; 7 | 8 | var _Color = require('../Color'); 9 | 10 | var _Color2 = _interopRequireDefault(_Color); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | var NUMBER = /^([+-]|\d|\.)$/i; 15 | 16 | var parseTextShadow = exports.parseTextShadow = function parseTextShadow(textShadow) { 17 | if (textShadow === 'none' || typeof textShadow !== 'string') { 18 | return null; 19 | } 20 | 21 | var currentValue = ''; 22 | var isLength = false; 23 | var values = []; 24 | var shadows = []; 25 | var numParens = 0; 26 | var color = null; 27 | 28 | var appendValue = function appendValue() { 29 | if (currentValue.length) { 30 | if (isLength) { 31 | values.push(parseFloat(currentValue)); 32 | } else { 33 | color = new _Color2.default(currentValue); 34 | } 35 | } 36 | isLength = false; 37 | currentValue = ''; 38 | }; 39 | 40 | var appendShadow = function appendShadow() { 41 | if (values.length && color !== null) { 42 | shadows.push({ 43 | color: color, 44 | offsetX: values[0] || 0, 45 | offsetY: values[1] || 0, 46 | blur: values[2] || 0 47 | }); 48 | } 49 | values.splice(0, values.length); 50 | color = null; 51 | }; 52 | 53 | for (var i = 0; i < textShadow.length; i++) { 54 | var c = textShadow[i]; 55 | switch (c) { 56 | case '(': 57 | currentValue += c; 58 | numParens++; 59 | break; 60 | case ')': 61 | currentValue += c; 62 | numParens--; 63 | break; 64 | case ',': 65 | if (numParens === 0) { 66 | appendValue(); 67 | appendShadow(); 68 | } else { 69 | currentValue += c; 70 | } 71 | break; 72 | case ' ': 73 | if (numParens === 0) { 74 | appendValue(); 75 | } else { 76 | currentValue += c; 77 | } 78 | break; 79 | default: 80 | if (currentValue.length === 0 && NUMBER.test(c)) { 81 | isLength = true; 82 | } 83 | currentValue += c; 84 | } 85 | } 86 | 87 | appendValue(); 88 | appendShadow(); 89 | 90 | if (shadows.length === 0) { 91 | return null; 92 | } 93 | 94 | return shadows; 95 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/textTransform.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var TEXT_TRANSFORM = exports.TEXT_TRANSFORM = { 7 | NONE: 0, 8 | LOWERCASE: 1, 9 | UPPERCASE: 2, 10 | CAPITALIZE: 3 11 | }; 12 | 13 | var parseTextTransform = exports.parseTextTransform = function parseTextTransform(textTransform) { 14 | switch (textTransform) { 15 | case 'uppercase': 16 | return TEXT_TRANSFORM.UPPERCASE; 17 | case 'lowercase': 18 | return TEXT_TRANSFORM.LOWERCASE; 19 | case 'capitalize': 20 | return TEXT_TRANSFORM.CAPITALIZE; 21 | } 22 | 23 | return TEXT_TRANSFORM.NONE; 24 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/transform.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.parseTransform = undefined; 7 | 8 | var _Length = require('../Length'); 9 | 10 | var _Length2 = _interopRequireDefault(_Length); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | var toFloat = function toFloat(s) { 15 | return parseFloat(s.trim()); 16 | }; 17 | 18 | var MATRIX = /(matrix|matrix3d)\((.+)\)/; 19 | 20 | var parseTransform = exports.parseTransform = function parseTransform(style) { 21 | var transform = parseTransformMatrix(style.transform || style.webkitTransform || style.mozTransform || 22 | // $FlowFixMe 23 | style.msTransform || 24 | // $FlowFixMe 25 | style.oTransform); 26 | if (transform === null) { 27 | return null; 28 | } 29 | 30 | return { 31 | transform: transform, 32 | transformOrigin: parseTransformOrigin(style.transformOrigin || style.webkitTransformOrigin || style.mozTransformOrigin || 33 | // $FlowFixMe 34 | style.msTransformOrigin || 35 | // $FlowFixMe 36 | style.oTransformOrigin) 37 | }; 38 | }; 39 | 40 | // $FlowFixMe 41 | var parseTransformOrigin = function parseTransformOrigin(origin) { 42 | if (typeof origin !== 'string') { 43 | var v = new _Length2.default('0'); 44 | return [v, v]; 45 | } 46 | var values = origin.split(' ').map(_Length2.default.create); 47 | return [values[0], values[1]]; 48 | }; 49 | 50 | // $FlowFixMe 51 | var parseTransformMatrix = function parseTransformMatrix(transform) { 52 | if (transform === 'none' || typeof transform !== 'string') { 53 | return null; 54 | } 55 | 56 | var match = transform.match(MATRIX); 57 | if (match) { 58 | if (match[1] === 'matrix') { 59 | var matrix = match[2].split(',').map(toFloat); 60 | return [matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]]; 61 | } else { 62 | var matrix3d = match[2].split(',').map(toFloat); 63 | return [matrix3d[0], matrix3d[1], matrix3d[4], matrix3d[5], matrix3d[12], matrix3d[13]]; 64 | } 65 | } 66 | return null; 67 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/visibility.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var VISIBILITY = exports.VISIBILITY = { 7 | VISIBLE: 0, 8 | HIDDEN: 1, 9 | COLLAPSE: 2 10 | }; 11 | 12 | var parseVisibility = exports.parseVisibility = function parseVisibility(visibility) { 13 | switch (visibility) { 14 | case 'hidden': 15 | return VISIBILITY.HIDDEN; 16 | case 'collapse': 17 | return VISIBILITY.COLLAPSE; 18 | case 'visible': 19 | default: 20 | return VISIBILITY.VISIBLE; 21 | } 22 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/word-break.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var WORD_BREAK = exports.WORD_BREAK = { 7 | NORMAL: 'normal', 8 | BREAK_ALL: 'break-all', 9 | KEEP_ALL: 'keep-all' 10 | }; 11 | 12 | var parseWordBreak = exports.parseWordBreak = function parseWordBreak(wordBreak) { 13 | switch (wordBreak) { 14 | case 'break-all': 15 | return WORD_BREAK.BREAK_ALL; 16 | case 'keep-all': 17 | return WORD_BREAK.KEEP_ALL; 18 | case 'normal': 19 | default: 20 | return WORD_BREAK.NORMAL; 21 | } 22 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/parsing/zIndex.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var parseZIndex = exports.parseZIndex = function parseZIndex(zIndex) { 7 | var auto = zIndex === 'auto'; 8 | return { 9 | auto: auto, 10 | order: auto ? 0 : parseInt(zIndex, 10) 11 | }; 12 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/renderer/ForeignObjectRenderer.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8 | 9 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10 | 11 | var ForeignObjectRenderer = function () { 12 | function ForeignObjectRenderer(element) { 13 | _classCallCheck(this, ForeignObjectRenderer); 14 | 15 | this.element = element; 16 | } 17 | 18 | _createClass(ForeignObjectRenderer, [{ 19 | key: 'render', 20 | value: function render(options) { 21 | var _this = this; 22 | 23 | this.options = options; 24 | this.canvas = document.createElement('canvas'); 25 | this.ctx = this.canvas.getContext('2d'); 26 | this.canvas.width = Math.floor(options.width) * options.scale; 27 | this.canvas.height = Math.floor(options.height) * options.scale; 28 | this.canvas.style.width = options.width + 'px'; 29 | this.canvas.style.height = options.height + 'px'; 30 | 31 | options.logger.log('ForeignObject renderer initialized (' + options.width + 'x' + options.height + ' at ' + options.x + ',' + options.y + ') with scale ' + options.scale); 32 | var svg = createForeignObjectSVG(Math.max(options.windowWidth, options.width) * options.scale, Math.max(options.windowHeight, options.height) * options.scale, options.scrollX * options.scale, options.scrollY * options.scale, this.element); 33 | 34 | return loadSerializedSVG(svg).then(function (img) { 35 | if (options.backgroundColor) { 36 | _this.ctx.fillStyle = options.backgroundColor.toString(); 37 | _this.ctx.fillRect(0, 0, options.width * options.scale, options.height * options.scale); 38 | } 39 | 40 | _this.ctx.drawImage(img, -options.x * options.scale, -options.y * options.scale); 41 | return _this.canvas; 42 | }); 43 | } 44 | }]); 45 | 46 | return ForeignObjectRenderer; 47 | }(); 48 | 49 | exports.default = ForeignObjectRenderer; 50 | var createForeignObjectSVG = exports.createForeignObjectSVG = function createForeignObjectSVG(width, height, x, y, node) { 51 | var xmlns = 'http://www.w3.org/2000/svg'; 52 | var svg = document.createElementNS(xmlns, 'svg'); 53 | var foreignObject = document.createElementNS(xmlns, 'foreignObject'); 54 | svg.setAttributeNS(null, 'width', width); 55 | svg.setAttributeNS(null, 'height', height); 56 | 57 | foreignObject.setAttributeNS(null, 'width', '100%'); 58 | foreignObject.setAttributeNS(null, 'height', '100%'); 59 | foreignObject.setAttributeNS(null, 'x', x); 60 | foreignObject.setAttributeNS(null, 'y', y); 61 | foreignObject.setAttributeNS(null, 'externalResourcesRequired', 'true'); 62 | svg.appendChild(foreignObject); 63 | 64 | foreignObject.appendChild(node); 65 | 66 | return svg; 67 | }; 68 | 69 | var loadSerializedSVG = exports.loadSerializedSVG = function loadSerializedSVG(svg) { 70 | return new Promise(function (resolve, reject) { 71 | var img = new Image(); 72 | img.onload = function () { 73 | return resolve(img); 74 | }; 75 | img.onerror = reject; 76 | 77 | img.src = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(new XMLSerializer().serializeToString(svg)); 78 | }); 79 | }; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/dist/npm/renderer/RefTestRenderer.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | var _url = require('url'); 6 | 7 | var _textDecoration2 = require('../parsing/textDecoration'); 8 | 9 | var _Path = require('../drawing/Path'); 10 | 11 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 12 | 13 | var RefTestRenderer = function () { 14 | function RefTestRenderer() { 15 | _classCallCheck(this, RefTestRenderer); 16 | } 17 | 18 | _createClass(RefTestRenderer, [{ 19 | key: 'render', 20 | value: function render(options) { 21 | this.options = options; 22 | this.indent = 0; 23 | this.lines = []; 24 | options.logger.log('RefTest renderer initialized'); 25 | this.writeLine('Window: [' + options.width + ', ' + options.height + ']'); 26 | } 27 | }, { 28 | key: 'clip', 29 | value: function clip(clipPaths, callback) { 30 | this.writeLine('Clip: ' + clipPaths.map(this.formatPath, this).join(' | ')); 31 | this.indent += 2; 32 | callback(); 33 | this.indent -= 2; 34 | } 35 | }, { 36 | key: 'drawImage', 37 | value: function drawImage(image, source, destination) { 38 | this.writeLine('Draw image: ' + this.formatImage(image) + ' (source: ' + this.formatBounds(source) + ') (destination: ' + this.formatBounds(source) + ')'); 39 | } 40 | }, { 41 | key: 'drawShape', 42 | value: function drawShape(path, color) { 43 | this.writeLine('Shape: ' + color.toString() + ' ' + this.formatPath(path)); 44 | } 45 | }, { 46 | key: 'fill', 47 | value: function fill(color) { 48 | this.writeLine('Fill: ' + color.toString()); 49 | } 50 | }, { 51 | key: 'getTarget', 52 | value: function getTarget() { 53 | return Promise.resolve(this.lines.join('\n')); 54 | } 55 | }, { 56 | key: 'rectangle', 57 | value: function rectangle(x, y, width, height, color) { 58 | var list = [x, y, width, height].map(function (v) { 59 | return Math.round(v); 60 | }).join(', '); 61 | this.writeLine('Rectangle: [' + list + '] ' + color.toString()); 62 | } 63 | }, { 64 | key: 'formatBounds', 65 | value: function formatBounds(bounds) { 66 | var list = [bounds.left, bounds.top, bounds.width, bounds.height]; 67 | return '[' + list.map(function (v) { 68 | return Math.round(v); 69 | }).join(', ') + ']'; 70 | } 71 | }, { 72 | key: 'formatImage', 73 | value: function formatImage(image) { 74 | return image.tagName === 'CANVAS' ? 'Canvas' : // $FlowFixMe 75 | 'Image ("' + (0, _url.parse)(image.src).pathname.substring(0, 100) + '")'; 76 | } 77 | }, { 78 | key: 'formatPath', 79 | value: function formatPath(path) { 80 | if (!Array.isArray(path)) { 81 | return 'Circle(x: ' + Math.round(path.x) + ', y: ' + Math.round(path.y) + ', r: ' + Math.round(path.radius) + ')'; 82 | } 83 | var string = path.map(function (v) { 84 | if (v.type === _Path.PATH.VECTOR) { 85 | return 'Vector(x: ' + Math.round(v.x) + ', y: ' + Math.round(v.y) + ')'; 86 | } 87 | if (v.type === _Path.PATH.BEZIER_CURVE) { 88 | var values = ['x0: ' + Math.round(v.start.x), 'y0: ' + Math.round(v.start.y), 'x1: ' + Math.round(v.end.x), 'y1: ' + Math.round(v.end.y), 'cx0: ' + Math.round(v.startControl.x), 'cy0: ' + Math.round(v.startControl.y), 'cx1: ' + Math.round(v.endControl.x), 'cy1: ' + Math.round(v.endControl.y)]; 89 | return 'BezierCurve(' + values.join(', ') + ')'; 90 | } 91 | }).join(' > '); 92 | return 'Path (' + string + ')'; 93 | } 94 | }, { 95 | key: 'renderLinearGradient', 96 | value: function renderLinearGradient(bounds, gradient) { 97 | var direction = ['x0: ' + Math.round(gradient.direction.x0), 'x1: ' + Math.round(gradient.direction.x1), 'y0: ' + Math.round(gradient.direction.y0), 'y1: ' + Math.round(gradient.direction.y1)]; 98 | 99 | var stops = gradient.colorStops.map(function (stop) { 100 | return stop.color.toString() + ' ' + Math.ceil(stop.stop * 100) / 100; 101 | }); 102 | 103 | this.writeLine('Gradient: ' + this.formatBounds(bounds) + ' linear-gradient(' + direction.join(', ') + ' ' + stops.join(', ') + ')'); 104 | } 105 | }, { 106 | key: 'renderRadialGradient', 107 | value: function renderRadialGradient(bounds, gradient) { 108 | var stops = gradient.colorStops.map(function (stop) { 109 | return stop.color.toString() + ' ' + Math.ceil(stop.stop * 100) / 100; 110 | }); 111 | 112 | this.writeLine('RadialGradient: ' + this.formatBounds(bounds) + ' radial-gradient(' + gradient.radius.x + ' ' + gradient.radius.y + ' at ' + gradient.center.x + ' ' + gradient.center.y + ', ' + stops.join(', ') + ')'); 113 | } 114 | }, { 115 | key: 'renderRepeat', 116 | value: function renderRepeat(path, image, imageSize, offsetX, offsetY) { 117 | this.writeLine('Repeat: ' + this.formatImage(image) + ' [' + Math.round(offsetX) + ', ' + Math.round(offsetY) + '] Size (' + Math.round(imageSize.width) + ', ' + Math.round(imageSize.height) + ') ' + this.formatPath(path)); 118 | } 119 | }, { 120 | key: 'renderTextNode', 121 | value: function renderTextNode(textBounds, color, font, textDecoration, textShadows) { 122 | var _this = this; 123 | 124 | var fontString = [font.fontStyle, font.fontVariant, font.fontWeight, parseInt(font.fontSize, 10), font.fontFamily.replace(/"/g, '')].join(' ').split(',')[0]; 125 | 126 | var textDecorationString = this.textDecoration(textDecoration, color); 127 | var shadowString = textShadows ? ' Shadows: (' + textShadows.map(function (shadow) { 128 | return shadow.color.toString() + ' ' + shadow.offsetX + 'px ' + shadow.offsetY + 'px ' + shadow.blur + 'px'; 129 | }).join(', ') + ')' : ''; 130 | 131 | this.writeLine('Text: ' + color.toString() + ' ' + fontString + shadowString + textDecorationString); 132 | 133 | this.indent += 2; 134 | textBounds.forEach(function (textBound) { 135 | _this.writeLine('[' + Math.round(textBound.bounds.left) + ', ' + Math.round(textBound.bounds.top) + ']: ' + textBound.text); 136 | }); 137 | this.indent -= 2; 138 | } 139 | }, { 140 | key: 'textDecoration', 141 | value: function textDecoration(_textDecoration, color) { 142 | if (_textDecoration) { 143 | var textDecorationColor = (_textDecoration.textDecorationColor ? _textDecoration.textDecorationColor : color).toString(); 144 | var textDecorationLines = _textDecoration.textDecorationLine.map(this.textDecorationLine, this); 145 | return _textDecoration ? ' ' + this.textDecorationStyle(_textDecoration.textDecorationStyle) + ' ' + textDecorationColor + ' ' + textDecorationLines.join(', ') : ''; 146 | } 147 | 148 | return ''; 149 | } 150 | }, { 151 | key: 'textDecorationLine', 152 | value: function textDecorationLine(_textDecorationLine) { 153 | switch (_textDecorationLine) { 154 | case _textDecoration2.TEXT_DECORATION_LINE.LINE_THROUGH: 155 | return 'line-through'; 156 | case _textDecoration2.TEXT_DECORATION_LINE.OVERLINE: 157 | return 'overline'; 158 | case _textDecoration2.TEXT_DECORATION_LINE.UNDERLINE: 159 | return 'underline'; 160 | case _textDecoration2.TEXT_DECORATION_LINE.BLINK: 161 | return 'blink'; 162 | } 163 | return 'UNKNOWN'; 164 | } 165 | }, { 166 | key: 'textDecorationStyle', 167 | value: function textDecorationStyle(_textDecorationStyle) { 168 | switch (_textDecorationStyle) { 169 | case _textDecoration2.TEXT_DECORATION_STYLE.SOLID: 170 | return 'solid'; 171 | case _textDecoration2.TEXT_DECORATION_STYLE.DOTTED: 172 | return 'dotted'; 173 | case _textDecoration2.TEXT_DECORATION_STYLE.DOUBLE: 174 | return 'double'; 175 | case _textDecoration2.TEXT_DECORATION_STYLE.DASHED: 176 | return 'dashed'; 177 | case _textDecoration2.TEXT_DECORATION_STYLE.WAVY: 178 | return 'WAVY'; 179 | } 180 | return 'UNKNOWN'; 181 | } 182 | }, { 183 | key: 'setOpacity', 184 | value: function setOpacity(opacity) { 185 | this.writeLine('Opacity: ' + opacity); 186 | } 187 | }, { 188 | key: 'transform', 189 | value: function transform(offsetX, offsetY, matrix, callback) { 190 | this.writeLine('Transform: (' + Math.round(offsetX) + ', ' + Math.round(offsetY) + ') [' + matrix.map(function (v) { 191 | return Math.round(v * 100) / 100; 192 | }).join(', ') + ']'); 193 | this.indent += 2; 194 | callback(); 195 | this.indent -= 2; 196 | } 197 | }, { 198 | key: 'writeLine', 199 | value: function writeLine(text) { 200 | this.lines.push('' + new Array(this.indent + 1).join(' ') + text); 201 | } 202 | }]); 203 | 204 | return RefTestRenderer; 205 | }(); 206 | 207 | module.exports = RefTestRenderer; -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/flow-typed/myLibDef.js: -------------------------------------------------------------------------------- 1 | declare var __DEV__: boolean; 2 | declare var __VERSION__: string; 3 | 4 | declare class SVGSVGElement extends Element { 5 | className: string; 6 | style: CSSStyleDeclaration; 7 | 8 | getPresentationAttribute(name: string): any; 9 | } 10 | 11 | declare class HTMLBodyElement extends HTMLElement {} 12 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/node_modules/html2canvas/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "html2canvas", 3 | "_id": "html2canvas@1.0.0-alpha.12", 4 | "_inBundle": false, 5 | "_integrity": "sha1-OxmS48mz9WBjw1/WIElPN+uohRM=", 6 | "_location": "/html2canvas", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "html2canvas", 12 | "name": "html2canvas", 13 | "escapedName": "html2canvas", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/" 21 | ], 22 | "_resolved": "http://registry.npm.taobao.org/html2canvas/download/html2canvas-1.0.0-alpha.12.tgz", 23 | "_shasum": "3b1992e3c9b3f56063c35fd620494f37eba88513", 24 | "_spec": "html2canvas", 25 | "_where": "E:\\js截图\\JavaScript-screenshot\\js-screenshot-for-npm", 26 | "author": { 27 | "name": "Niklas von Hertzen", 28 | "email": "niklasvh@gmail.com", 29 | "url": "https://hertzen.com" 30 | }, 31 | "bugs": { 32 | "url": "https://github.com/niklasvh/html2canvas/issues" 33 | }, 34 | "bundleDependencies": false, 35 | "dependencies": { 36 | "css-line-break": "1.0.1" 37 | }, 38 | "deprecated": false, 39 | "description": "Screenshots with JavaScript", 40 | "devDependencies": { 41 | "babel-cli": "6.24.1", 42 | "babel-core": "6.25.0", 43 | "babel-eslint": "7.2.3", 44 | "babel-loader": "7.1.1", 45 | "babel-plugin-dev-expression": "0.2.1", 46 | "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", 47 | "babel-plugin-transform-object-rest-spread": "6.23.0", 48 | "babel-preset-es2015": "6.24.1", 49 | "babel-preset-flow": "6.23.0", 50 | "base64-arraybuffer": "0.1.5", 51 | "body-parser": "1.17.2", 52 | "chai": "4.1.1", 53 | "chromeless": "1.2.0", 54 | "cors": "2.8.4", 55 | "eslint": "4.2.0", 56 | "eslint-plugin-flowtype": "2.35.0", 57 | "eslint-plugin-prettier": "2.1.2", 58 | "express": "4.15.4", 59 | "filenamify-url": "1.0.0", 60 | "flow-bin": "0.56.0", 61 | "glob": "7.1.2", 62 | "html2canvas-proxy": "1.0.0", 63 | "jquery": "3.2.1", 64 | "karma": "1.7.0", 65 | "karma-chrome-launcher": "2.2.0", 66 | "karma-edge-launcher": "0.4.1", 67 | "karma-firefox-launcher": "1.0.1", 68 | "karma-ie-launcher": "1.0.0", 69 | "karma-mocha": "1.3.0", 70 | "karma-sauce-launcher": "1.1.0", 71 | "mocha": "3.5.0", 72 | "platform": "1.3.4", 73 | "prettier": "1.5.3", 74 | "promise-polyfill": "6.0.2", 75 | "replace-in-file": "^3.0.0", 76 | "rimraf": "2.6.1", 77 | "serve-index": "1.9.0", 78 | "slash": "1.0.0", 79 | "uglifyjs-webpack-plugin": "^1.1.2", 80 | "webpack": "3.4.1" 81 | }, 82 | "engines": { 83 | "node": ">=4.0.0" 84 | }, 85 | "homepage": "https://html2canvas.hertzen.com", 86 | "license": "MIT", 87 | "main": "dist/npm/index.js", 88 | "name": "html2canvas", 89 | "repository": { 90 | "type": "git", 91 | "url": "git+ssh://git@github.com/niklasvh/html2canvas.git" 92 | }, 93 | "scripts": { 94 | "build": "rimraf dist/ && node scripts/create-reftest-list && npm run build:npm && npm run build:browser", 95 | "build:browser": "webpack", 96 | "build:npm": "babel src/ -d dist/npm/ --plugins=dev-expression,transform-es2015-modules-commonjs && replace-in-file __VERSION__ '\"$npm_package_version\"' dist/npm/index.js", 97 | "flow": "flow", 98 | "format": "prettier --single-quote --no-bracket-spacing --tab-width 4 --print-width 100 --write \"{src,www/src,tests,scripts}/**/*.js\"", 99 | "karma": "node karma", 100 | "lint": "eslint src/**", 101 | "start": "node tests/server", 102 | "test": "npm run flow && npm run lint && npm run test:node && npm run karma", 103 | "test:node": "mocha tests/node/*.js", 104 | "watch": "webpack --progress --colors --watch" 105 | }, 106 | "title": "html2canvas", 107 | "version": "1.0.0-alpha.12" 108 | } 109 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js_screen_shots", 3 | "version": "1.1.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "base64-arraybuffer": { 8 | "version": "0.1.5", 9 | "resolved": "http://registry.npm.taobao.org/base64-arraybuffer/download/base64-arraybuffer-0.1.5.tgz", 10 | "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" 11 | }, 12 | "css-line-break": { 13 | "version": "1.0.1", 14 | "resolved": "http://registry.npm.taobao.org/css-line-break/download/css-line-break-1.0.1.tgz", 15 | "integrity": "sha1-GfIGOjPpX7KDG4ZEbAuAwYivRQo=", 16 | "requires": { 17 | "base64-arraybuffer": "0.1.5" 18 | } 19 | }, 20 | "html2canvas": { 21 | "version": "1.0.0-alpha.12", 22 | "resolved": "http://registry.npm.taobao.org/html2canvas/download/html2canvas-1.0.0-alpha.12.tgz", 23 | "integrity": "sha1-OxmS48mz9WBjw1/WIElPN+uohRM=", 24 | "requires": { 25 | "css-line-break": "1.0.1" 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /js-screenshot-for-npm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js_screen_shots", 3 | "version": "1.1.3", 4 | "description": "javascript screenshot", 5 | "main": "js_screen_shot.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "usecodelee", 10 | "license": "MIT", 11 | "dependencies": { 12 | "html2canvas": "^1.0.0-alpha.12" 13 | } 14 | } -------------------------------------------------------------------------------- /simple/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 27 | 28 | 29 | 30 |

原始HTML

31 |
32 |
33 |
34 |
35 |
36 | 33333333333333333333333333333333 37 |
38 |
39 | 40 |
41 | 42 |
43 |
44 |

转成canvas

45 |

转成图片

46 |
47 | 48 | 49 | 50 | 51 | 52 | 53 | 58 | 59 |
60 | 61 | 62 | 63 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /webpack+vue+element/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"] 12 | } 13 | -------------------------------------------------------------------------------- /webpack+vue+element/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /webpack+vue+element/.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | -------------------------------------------------------------------------------- /webpack+vue+element/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parserOptions: { 6 | parser: 'babel-eslint' 7 | }, 8 | env: { 9 | browser: true, 10 | }, 11 | extends: [ 12 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention 13 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. 14 | 'plugin:vue/essential', 15 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 16 | 'standard' 17 | ], 18 | // required to lint *.vue files 19 | plugins: [ 20 | 'vue' 21 | ], 22 | // add your custom rules here 23 | rules: { 24 | // allow async-await 25 | 'generator-star-spacing': 'off', 26 | // allow debugger during development 27 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /webpack+vue+element/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | .vscode 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | -------------------------------------------------------------------------------- /webpack+vue+element/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /webpack+vue+element/build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /webpack+vue+element/build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /webpack+vue+element/build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usecodelee/JavaScript-screenshot/544c44f1f8b4ade10c78d8eea5805705b4360206/webpack+vue+element/build/logo.png -------------------------------------------------------------------------------- /webpack+vue+element/build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const config = require('../config') 4 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 5 | const packageConfig = require('../package.json') 6 | 7 | exports.assetsPath = function (_path) { 8 | const assetsSubDirectory = process.env.NODE_ENV === 'production' 9 | ? config.build.assetsSubDirectory 10 | : config.dev.assetsSubDirectory 11 | 12 | return path.posix.join(assetsSubDirectory, _path) 13 | } 14 | 15 | exports.cssLoaders = function (options) { 16 | options = options || {} 17 | 18 | const cssLoader = { 19 | loader: 'css-loader', 20 | options: { 21 | sourceMap: options.sourceMap 22 | } 23 | } 24 | 25 | const postcssLoader = { 26 | loader: 'postcss-loader', 27 | options: { 28 | sourceMap: options.sourceMap 29 | } 30 | } 31 | 32 | // generate loader string to be used with extract text plugin 33 | function generateLoaders (loader, loaderOptions) { 34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] 35 | 36 | if (loader) { 37 | loaders.push({ 38 | loader: loader + '-loader', 39 | options: Object.assign({}, loaderOptions, { 40 | sourceMap: options.sourceMap 41 | }) 42 | }) 43 | } 44 | 45 | // Extract CSS when that option is specified 46 | // (which is the case during production build) 47 | if (options.extract) { 48 | return ExtractTextPlugin.extract({ 49 | use: loaders, 50 | fallback: 'vue-style-loader' 51 | }) 52 | } else { 53 | return ['vue-style-loader'].concat(loaders) 54 | } 55 | } 56 | 57 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 58 | return { 59 | css: generateLoaders(), 60 | postcss: generateLoaders(), 61 | less: generateLoaders('less'), 62 | sass: generateLoaders('sass', { indentedSyntax: true }), 63 | scss: generateLoaders('sass'), 64 | stylus: generateLoaders('stylus'), 65 | styl: generateLoaders('stylus') 66 | } 67 | } 68 | 69 | // Generate loaders for standalone style files (outside of .vue) 70 | exports.styleLoaders = function (options) { 71 | const output = [] 72 | const loaders = exports.cssLoaders(options) 73 | 74 | for (const extension in loaders) { 75 | const loader = loaders[extension] 76 | output.push({ 77 | test: new RegExp('\\.' + extension + '$'), 78 | use: loader 79 | }) 80 | } 81 | 82 | return output 83 | } 84 | 85 | exports.createNotifierCallback = () => { 86 | const notifier = require('node-notifier') 87 | 88 | return (severity, errors) => { 89 | if (severity !== 'error') return 90 | 91 | const error = errors[0] 92 | const filename = error.file && error.file.split('!').pop() 93 | 94 | notifier.notify({ 95 | title: packageConfig.name, 96 | message: severity + ': ' + error.name, 97 | subtitle: filename || '', 98 | icon: path.join(__dirname, 'logo.png') 99 | }) 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /webpack+vue+element/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /webpack+vue+element/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const vueLoaderConfig = require('./vue-loader.conf') 6 | 7 | function resolve(dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | const createLintingRule = () => ({ 12 | test: /\.(js|vue)$/, 13 | loader: 'eslint-loader', 14 | enforce: 'pre', 15 | include: [resolve('src'), resolve('test')], 16 | options: { 17 | formatter: require('eslint-friendly-formatter'), 18 | emitWarning: !config.dev.showEslintErrorsInOverlay 19 | } 20 | }) 21 | 22 | module.exports = { 23 | context: path.resolve(__dirname, '../'), 24 | entry: { 25 | app: './src/main.js' 26 | }, 27 | output: { 28 | path: config.build.assetsRoot, 29 | filename: '[name].js', 30 | publicPath: process.env.NODE_ENV === 'production' ? 31 | config.build.assetsPublicPath : 32 | config.dev.assetsPublicPath 33 | }, 34 | resolve: { 35 | extensions: ['.js', '.vue', '.json'], 36 | alias: { 37 | 'vue$': 'vue/dist/vue.esm.js', 38 | '@': resolve('src'), 39 | } 40 | }, 41 | module: { 42 | rules: [ 43 | // ...(config.dev.useEslint ? [createLintingRule()] : []), 44 | { 45 | test: /\.vue$/, 46 | loader: 'vue-loader', 47 | options: vueLoaderConfig 48 | }, 49 | { 50 | test: /\.js$/, 51 | loader: 'babel-loader', 52 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] 53 | }, 54 | { 55 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 56 | loader: 'url-loader', 57 | options: { 58 | limit: 10000, 59 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 60 | } 61 | }, 62 | { 63 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 64 | loader: 'url-loader', 65 | options: { 66 | limit: 10000, 67 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 68 | } 69 | }, 70 | { 71 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 72 | loader: 'url-loader', 73 | options: { 74 | limit: 10000, 75 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 76 | } 77 | } 78 | ] 79 | }, 80 | node: { 81 | // prevent webpack from injecting useless setImmediate polyfill because Vue 82 | // source contains it (although only uses it if it's native). 83 | setImmediate: false, 84 | // prevent webpack from injecting mocks to Node native modules 85 | // that does not make sense for the client 86 | dgram: 'empty', 87 | fs: 'empty', 88 | net: 'empty', 89 | tls: 'empty', 90 | child_process: 'empty' 91 | } 92 | } -------------------------------------------------------------------------------- /webpack+vue+element/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const webpack = require('webpack') 4 | const config = require('../config') 5 | const merge = require('webpack-merge') 6 | const path = require('path') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 11 | const portfinder = require('portfinder') 12 | 13 | const HOST = process.env.HOST 14 | const PORT = process.env.PORT && Number(process.env.PORT) 15 | 16 | const devWebpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) 19 | }, 20 | // cheap-module-eval-source-map is faster for development 21 | devtool: config.dev.devtool, 22 | 23 | // these devServer options should be customized in /config/index.js 24 | devServer: { 25 | clientLogLevel: 'warning', 26 | historyApiFallback: { 27 | rewrites: [ 28 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, 29 | ], 30 | }, 31 | hot: true, 32 | contentBase: false, // since we use CopyWebpackPlugin. 33 | compress: true, 34 | host: HOST || config.dev.host, 35 | port: PORT || config.dev.port, 36 | open: config.dev.autoOpenBrowser, 37 | overlay: config.dev.errorOverlay 38 | ? { warnings: false, errors: true } 39 | : false, 40 | publicPath: config.dev.assetsPublicPath, 41 | proxy: config.dev.proxyTable, 42 | quiet: true, // necessary for FriendlyErrorsPlugin 43 | watchOptions: { 44 | poll: config.dev.poll, 45 | } 46 | }, 47 | plugins: [ 48 | new webpack.DefinePlugin({ 49 | 'process.env': require('../config/dev.env') 50 | }), 51 | new webpack.HotModuleReplacementPlugin(), 52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. 53 | new webpack.NoEmitOnErrorsPlugin(), 54 | // https://github.com/ampedandwired/html-webpack-plugin 55 | new HtmlWebpackPlugin({ 56 | filename: 'index.html', 57 | template: 'index.html', 58 | inject: true 59 | }), 60 | // copy custom static assets 61 | new CopyWebpackPlugin([ 62 | { 63 | from: path.resolve(__dirname, '../static'), 64 | to: config.dev.assetsSubDirectory, 65 | ignore: ['.*'] 66 | } 67 | ]) 68 | ] 69 | }) 70 | 71 | module.exports = new Promise((resolve, reject) => { 72 | portfinder.basePort = process.env.PORT || config.dev.port 73 | portfinder.getPort((err, port) => { 74 | if (err) { 75 | reject(err) 76 | } else { 77 | // publish the new Port, necessary for e2e tests 78 | process.env.PORT = port 79 | // add port to devServer config 80 | devWebpackConfig.devServer.port = port 81 | 82 | // Add FriendlyErrorsPlugin 83 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 84 | compilationSuccessInfo: { 85 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 86 | }, 87 | onErrors: config.dev.notifyOnErrors 88 | ? utils.createNotifierCallback() 89 | : undefined 90 | })) 91 | 92 | resolve(devWebpackConfig) 93 | } 94 | }) 95 | }) 96 | -------------------------------------------------------------------------------- /webpack+vue+element/build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config') 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 13 | 14 | const env = require('../config/prod.env') 15 | 16 | const webpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ 19 | sourceMap: config.build.productionSourceMap, 20 | extract: true, 21 | usePostCSS: true 22 | }) 23 | }, 24 | devtool: config.build.productionSourceMap ? config.build.devtool : false, 25 | output: { 26 | path: config.build.assetsRoot, 27 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 28 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 29 | }, 30 | plugins: [ 31 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 32 | new webpack.DefinePlugin({ 33 | 'process.env': env 34 | }), 35 | new UglifyJsPlugin({ 36 | uglifyOptions: { 37 | compress: { 38 | warnings: false 39 | } 40 | }, 41 | sourceMap: config.build.productionSourceMap, 42 | parallel: true 43 | }), 44 | // extract css into its own file 45 | new ExtractTextPlugin({ 46 | filename: utils.assetsPath('css/[name].[contenthash].css'), 47 | // Setting the following option to `false` will not extract CSS from codesplit chunks. 48 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. 49 | // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, 50 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 51 | allChunks: true, 52 | }), 53 | // Compress extracted CSS. We are using this plugin so that possible 54 | // duplicated CSS from different components can be deduped. 55 | new OptimizeCSSPlugin({ 56 | cssProcessorOptions: config.build.productionSourceMap 57 | ? { safe: true, map: { inline: false } } 58 | : { safe: true } 59 | }), 60 | // generate dist index.html with correct asset hash for caching. 61 | // you can customize output by editing /index.html 62 | // see https://github.com/ampedandwired/html-webpack-plugin 63 | new HtmlWebpackPlugin({ 64 | filename: config.build.index, 65 | template: 'index.html', 66 | inject: true, 67 | minify: { 68 | removeComments: true, 69 | collapseWhitespace: true, 70 | removeAttributeQuotes: true 71 | // more options: 72 | // https://github.com/kangax/html-minifier#options-quick-reference 73 | }, 74 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 75 | chunksSortMode: 'dependency' 76 | }), 77 | // keep module.id stable when vendor modules does not change 78 | new webpack.HashedModuleIdsPlugin(), 79 | // enable scope hoisting 80 | new webpack.optimize.ModuleConcatenationPlugin(), 81 | // split vendor js into its own file 82 | new webpack.optimize.CommonsChunkPlugin({ 83 | name: 'vendor', 84 | minChunks (module) { 85 | // any required modules inside node_modules are extracted to vendor 86 | return ( 87 | module.resource && 88 | /\.js$/.test(module.resource) && 89 | module.resource.indexOf( 90 | path.join(__dirname, '../node_modules') 91 | ) === 0 92 | ) 93 | } 94 | }), 95 | // extract webpack runtime and module manifest to its own file in order to 96 | // prevent vendor hash from being updated whenever app bundle is updated 97 | new webpack.optimize.CommonsChunkPlugin({ 98 | name: 'manifest', 99 | minChunks: Infinity 100 | }), 101 | // This instance extracts shared chunks from code splitted chunks and bundles them 102 | // in a separate chunk, similar to the vendor chunk 103 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk 104 | new webpack.optimize.CommonsChunkPlugin({ 105 | name: 'app', 106 | async: 'vendor-async', 107 | children: true, 108 | minChunks: 3 109 | }), 110 | 111 | // copy custom static assets 112 | new CopyWebpackPlugin([ 113 | { 114 | from: path.resolve(__dirname, '../static'), 115 | to: config.build.assetsSubDirectory, 116 | ignore: ['.*'] 117 | } 118 | ]) 119 | ] 120 | }) 121 | 122 | if (config.build.productionGzip) { 123 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 124 | 125 | webpackConfig.plugins.push( 126 | new CompressionWebpackPlugin({ 127 | asset: '[path].gz[query]', 128 | algorithm: 'gzip', 129 | test: new RegExp( 130 | '\\.(' + 131 | config.build.productionGzipExtensions.join('|') + 132 | ')$' 133 | ), 134 | threshold: 10240, 135 | minRatio: 0.8 136 | }) 137 | ) 138 | } 139 | 140 | if (config.build.bundleAnalyzerReport) { 141 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 142 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 143 | } 144 | 145 | module.exports = webpackConfig 146 | -------------------------------------------------------------------------------- /webpack+vue+element/config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /webpack+vue+element/config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.3.1 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | 10 | // Paths 11 | assetsSubDirectory: 'static', 12 | assetsPublicPath: '/', 13 | proxyTable: {}, 14 | 15 | // Various Dev Server settings 16 | host: 'localhost', // can be overwritten by process.env.HOST 17 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 18 | autoOpenBrowser: true, 19 | errorOverlay: true, 20 | notifyOnErrors: true, 21 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 22 | 23 | // Use Eslint Loader? 24 | // If true, your code will be linted during bundling and 25 | // linting errors and warnings will be shown in the console. 26 | useEslint: true, 27 | // If true, eslint errors and warnings will also be shown in the error overlay 28 | // in the browser. 29 | showEslintErrorsInOverlay: false, 30 | 31 | /** 32 | * Source Maps 33 | */ 34 | 35 | // https://webpack.js.org/configuration/devtool/#development 36 | devtool: 'cheap-module-eval-source-map', 37 | 38 | // If you have problems debugging vue-files in devtools, 39 | // set this to false - it *may* help 40 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 41 | cacheBusting: true, 42 | 43 | cssSourceMap: true 44 | }, 45 | 46 | build: { 47 | // Template for index.html 48 | index: path.resolve(__dirname, '../dist/index.html'), 49 | 50 | // Paths 51 | assetsRoot: path.resolve(__dirname, '../dist'), 52 | assetsSubDirectory: 'static', 53 | assetsPublicPath: '/', 54 | 55 | /** 56 | * Source Maps 57 | */ 58 | 59 | productionSourceMap: true, 60 | // https://webpack.js.org/configuration/devtool/#production 61 | devtool: '#source-map', 62 | 63 | // Gzip off by default as many popular static hosts such as 64 | // Surge or Netlify already gzip all static assets for you. 65 | // Before setting to `true`, make sure to: 66 | // npm install --save-dev compression-webpack-plugin 67 | productionGzip: false, 68 | productionGzipExtensions: ['js', 'css'], 69 | 70 | // Run the build command with an extra argument to 71 | // View the bundle analyzer report after build finishes: 72 | // `npm run build --report` 73 | // Set to `true` or `false` to always turn it on or off 74 | bundleAnalyzerReport: process.env.npm_config_report 75 | } 76 | } -------------------------------------------------------------------------------- /webpack+vue+element/config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /webpack+vue+element/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | js-screenshot 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /webpack+vue+element/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js-screenshot", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "usecodelee ", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "lint": "eslint --ext .js,.vue src", 11 | "build": "node build/build.js" 12 | }, 13 | "dependencies": { 14 | "element-ui": "^2.4.11", 15 | "js_screen_shots": "^1.1.3", 16 | "vue": "^2.5.2", 17 | "vue-router": "^3.0.1" 18 | }, 19 | "devDependencies": { 20 | "autoprefixer": "^7.1.2", 21 | "babel-core": "^6.22.1", 22 | "babel-eslint": "^8.2.1", 23 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 24 | "babel-loader": "^7.1.1", 25 | "babel-plugin-syntax-jsx": "^6.18.0", 26 | "babel-plugin-transform-runtime": "^6.22.0", 27 | "babel-plugin-transform-vue-jsx": "^3.5.0", 28 | "babel-preset-env": "^1.3.2", 29 | "babel-preset-stage-2": "^6.22.0", 30 | "chalk": "^2.0.1", 31 | "copy-webpack-plugin": "^4.0.1", 32 | "css-loader": "^0.28.0", 33 | "eslint": "^4.15.0", 34 | "eslint-config-standard": "^10.2.1", 35 | "eslint-friendly-formatter": "^3.0.0", 36 | "eslint-loader": "^1.7.1", 37 | "eslint-plugin-import": "^2.7.0", 38 | "eslint-plugin-node": "^5.2.0", 39 | "eslint-plugin-promise": "^3.4.0", 40 | "eslint-plugin-standard": "^3.0.1", 41 | "eslint-plugin-vue": "^4.0.0", 42 | "extract-text-webpack-plugin": "^3.0.0", 43 | "file-loader": "^1.1.4", 44 | "friendly-errors-webpack-plugin": "^1.6.1", 45 | "html-webpack-plugin": "^2.30.1", 46 | "node-notifier": "^5.1.2", 47 | "optimize-css-assets-webpack-plugin": "^3.2.0", 48 | "ora": "^1.2.0", 49 | "portfinder": "^1.0.13", 50 | "postcss-import": "^11.0.0", 51 | "postcss-loader": "^2.0.8", 52 | "postcss-url": "^7.2.1", 53 | "rimraf": "^2.6.0", 54 | "semver": "^5.3.0", 55 | "shelljs": "^0.7.6", 56 | "uglifyjs-webpack-plugin": "^1.1.1", 57 | "url-loader": "^0.5.8", 58 | "vue-loader": "^13.3.0", 59 | "vue-style-loader": "^3.0.1", 60 | "vue-template-compiler": "^2.5.2", 61 | "webpack": "^3.6.0", 62 | "webpack-bundle-analyzer": "^2.9.0", 63 | "webpack-dev-server": "^2.9.1", 64 | "webpack-merge": "^4.1.0" 65 | }, 66 | "engines": { 67 | "node": ">= 6.0.0", 68 | "npm": ">= 3.0.0" 69 | }, 70 | "browserslist": [ 71 | "> 1%", 72 | "last 2 versions", 73 | "not ie <= 8" 74 | ] 75 | } 76 | -------------------------------------------------------------------------------- /webpack+vue+element/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 23 | -------------------------------------------------------------------------------- /webpack+vue+element/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usecodelee/JavaScript-screenshot/544c44f1f8b4ade10c78d8eea5805705b4360206/webpack+vue+element/src/assets/logo.png -------------------------------------------------------------------------------- /webpack+vue+element/src/components/html2img.vue: -------------------------------------------------------------------------------- 1 | 48 | 49 | 140 | 141 | 162 | -------------------------------------------------------------------------------- /webpack+vue+element/src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | import all from '../node_modules/js_screen_shots' 7 | 8 | window.html2canvas = all.html2canvas; 9 | window.Canvas2Image = all.Canvas2Image; 10 | 11 | 12 | import ElementUI from '../node_modules/element-ui' 13 | 14 |    15 | import '../node_modules/element-ui/lib/theme-chalk/index.css' 16 | 17 |    18 | Vue.use(ElementUI) 19 | 20 | 21 | 22 | Vue.config.productionTip = false 23 | /* eslint-disable no-new */ 24 | new Vue({ 25 | el: '#app', 26 | router, 27 | components: { App }, 28 | template: '' 29 | }) -------------------------------------------------------------------------------- /webpack+vue+element/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import html2img from '@/components/html2img' 4 | 5 | Vue.use(Router) 6 | 7 | export default new Router({ 8 | routes: [{ 9 | path: '/', 10 | name: 'html2img', 11 | component: html2img 12 | }] 13 | }) -------------------------------------------------------------------------------- /webpack+vue+element/static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usecodelee/JavaScript-screenshot/544c44f1f8b4ade10c78d8eea5805705b4360206/webpack+vue+element/static/.gitkeep --------------------------------------------------------------------------------