mirror of
https://github.com/dyiop/astute.git
synced 2025-04-06 21:30:20 -04:00
added some files
This commit is contained in:
parent
e6788ff464
commit
37e2b03121
|
@ -197,10 +197,10 @@
|
|||
|
||||
<!--MODAL: new invoice-->
|
||||
<app-modal-form [title]="'New Invoice'" #new>
|
||||
<!--General-->
|
||||
<div class="modal-body">
|
||||
<p class="h4 text-right">General</p>
|
||||
<hr>
|
||||
|
||||
<table class="table table-borderless table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
@ -300,25 +300,26 @@
|
|||
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="feeTypes[inDet.feeTypeId - 1]"
|
||||
disabled></td>
|
||||
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.fee"
|
||||
(change)="onNewCellChange(i, 'fee', fee.value); updateNewBillAmt();" #fee>
|
||||
(change)="onNewCellChange(i, 'fee', fee.value); updateNewBillAmt();" #fee disabled>
|
||||
</td>
|
||||
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.qty"
|
||||
[step]="inDet.remainingQty / 100"
|
||||
(change)="onNewCellChange(i, 'qty', qty.value); updateNewBillAmt();" #qty>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="p-0 m-0">
|
||||
<th class="align-content-center">
|
||||
<p>{{getPerc(fee.value * qty.value, inDet.remainingQty)}}%</p>
|
||||
<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>
|
||||
</th>
|
||||
<td colspan="4">
|
||||
<div class="progress" style="height: 25px;">
|
||||
<div class="progress-bar bg-success" role="progressbar"
|
||||
[ngStyle]="{'width': getPerc(fee.value * qty.value, inDet.remainingQty) + '%'}">
|
||||
${{fee.value * qty.value}}
|
||||
[ngStyle]="{'width': getPerc(qty.value, inDet.remainingQty) + '%'}">
|
||||
{{qty.value}}
|
||||
</div>
|
||||
<div class="progress-bar bg-danger" role="progressbar"
|
||||
[ngStyle]="{'width': (100 - getPerc(fee.value * qty.value, inDet.remainingQty)) + '%'}">
|
||||
${{inDet.remainingQty - (fee.value * qty.value)}}
|
||||
[ngStyle]="{'width': (100 - getPerc(qty.value, inDet.remainingQty)) + '%'}">
|
||||
{{inDet.remainingQty - (qty.value)}}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -330,7 +331,7 @@
|
|||
<select class="custom-select"
|
||||
(change)="pushOntoNewDetail(inNumIn.value, newInDetails.length + 1, poDetails[poDetSelec.value].lineItemNo,
|
||||
poDetails[poDetSelec.value].feeTypeId, poDetails[poDetSelec.value].serviceTypeId,
|
||||
poDetails[poDetSelec.value].serviceDesc, 1, 0, poDetails[poDetSelec.value].remainingQty)"
|
||||
poDetails[poDetSelec.value].serviceDesc, 0, poDetails[poDetSelec.value].fee, poDetails[poDetSelec.value].remainingQty)"
|
||||
[disabled]="!poDetails.length"
|
||||
#poDetSelec>
|
||||
<option>Choose PO Detail...</option>
|
||||
|
|
|
@ -255,6 +255,20 @@ export class InvoiceComponent implements OnInit {
|
|||
return [year, month, day].join('-');
|
||||
}
|
||||
|
||||
formatDate(d: Date) {
|
||||
let month = '' + (d.getMonth() + 1),
|
||||
day = '' + d.getDate(),
|
||||
year = d.getFullYear();
|
||||
|
||||
if (month.length < 2) {
|
||||
month = '0' + month;
|
||||
}
|
||||
if (day.length < 2) {
|
||||
day = '0' + day;
|
||||
}
|
||||
return [year, month, day].join('-');
|
||||
}
|
||||
|
||||
addInvoice(invoiceNumber, poNum, changeOrderNum, pmtStatus, billAmt, specialNotes, certification, status, ref) {
|
||||
// String invoiceNumber;
|
||||
// Date invoiceDate;
|
||||
|
@ -267,14 +281,14 @@ export class InvoiceComponent implements OnInit {
|
|||
// Date pmtReceivedDate;
|
||||
const invData = {
|
||||
"invoiceNumber": invoiceNumber,
|
||||
"invoiceDate": new Date(),
|
||||
"invoiceDate": this.formatDate(new Date()),
|
||||
"poNum": poNum,
|
||||
"changeOrderNum": changeOrderNum,
|
||||
"pmtStatus": +pmtStatus,
|
||||
"billAmt": +billAmt,
|
||||
"specialNotes": specialNotes,
|
||||
"certification": certification,
|
||||
"pmtReceivedDate": new Date(),
|
||||
"pmtReceivedDate": this.formatDate(new Date()),
|
||||
'invoiceStatus': status
|
||||
};
|
||||
|
||||
|
@ -362,7 +376,7 @@ export class InvoiceComponent implements OnInit {
|
|||
if (data) {
|
||||
this.refreshData();
|
||||
} else {
|
||||
alert('submit invoice failed.')
|
||||
alert('submit invoice failed.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
7
AstuteClient2/src/assets/html2canvas/.flowconfig
Normal file
7
AstuteClient2/src/assets/html2canvas/.flowconfig
Normal file
|
@ -0,0 +1,7 @@
|
|||
[ignore]
|
||||
.*/www/.*
|
||||
[include]
|
||||
[libs]
|
||||
./flow-typed
|
||||
[options]
|
||||
[lints]
|
144
AstuteClient2/src/assets/html2canvas/CHANGELOG.md
Normal file
144
AstuteClient2/src/assets/html2canvas/CHANGELOG.md
Normal file
|
@ -0,0 +1,144 @@
|
|||
### Changelog ###
|
||||
|
||||
#### v1.0.0-alpha.12 - 5.4.2018 ####
|
||||
* Fix white space appearing on element rendering (Fix #1438)
|
||||
* Reset canvas transform on finish (Fix #1494)
|
||||
|
||||
#### v1.0.0-alpha.11 - 1.4.2018 ####
|
||||
* Fix IE11 member not found error
|
||||
* Support blob image resources in non-foreignObjectRendering mode
|
||||
|
||||
#### v1.0.0-alpha.10 - 15.2.2018 ####
|
||||
* Re-introduce `onclone` option (Fix #1434)
|
||||
* Add `ignoreElements` predicate function option
|
||||
* Fix version console logging
|
||||
|
||||
#### v1.0.0-alpha.9 - 7.1.2018 ####
|
||||
* Fix dynamic style sheets
|
||||
* Fix > 50% border-radius values
|
||||
|
||||
#### v1.0.0-alpha.8 - 2.1.2018 ####
|
||||
* Use correct doctype in cloned Document (Fix #1298)
|
||||
* Fix individual border rendering (Fix #1349)
|
||||
|
||||
#### v1.0.0-alpha.7 - 31.12.2017 ####
|
||||
* Fix form input rendering (#1338)
|
||||
* Improve word line breaking algorithm
|
||||
|
||||
#### v1.0.0-alpha.6 - 28.12.2017 ####
|
||||
* Fix list-style: none (#1340)
|
||||
* Extend supported values for pseudo element content
|
||||
|
||||
#### v1.0.0-alpha.5 - 21.12.2017 ####
|
||||
* Fix underline positioning
|
||||
* Fix canvas rendering on Chrome
|
||||
* Fix overflow: auto
|
||||
* Added support for rendering list-style
|
||||
|
||||
#### v1.0.0-alpha.4 - 12.12.2017 ####
|
||||
* Fix rendering with multiple fonts defined (Fix #796)
|
||||
* Add support for radial-gradients
|
||||
* Fix logging option (#1302)
|
||||
* Add support for rendering webgl canvas content (#646)
|
||||
* Fix external SVG loading with proxies (#802)
|
||||
|
||||
#### v1.0.0-alpha.3 - 9.12.2017 ####
|
||||
* Disable `foreignObjectRendering` by default (#1295)
|
||||
* Fix background-size when using background-origin and background-size: cover/contain (#1299)
|
||||
* Added support for background-origin: content-box (#1299)
|
||||
|
||||
#### v1.0.0-alpha.2 - 7.12.2017 ####
|
||||
* Fix scroll positions for CanvasRenderer (#1259)
|
||||
* Fix `data-html2canvas-ignore` attribute (#1253)
|
||||
* Fix decimal `letter-spacing` values (#1293)
|
||||
|
||||
#### v1.0.0-alpha.1 - 5.12.2017 ####
|
||||
* Complete rewrite of library
|
||||
##### Breaking Changes #####
|
||||
* Remove deprecated onrendered callback, calling `html2canvas` returns a `Promise<HTMLCanvasElement>`
|
||||
* Removed option `type`, same results can be achieved by assigning `x`, `y`, `scrollX`, `scrollY`, `width` and `height` properties.
|
||||
|
||||
##### New featues / fixes #####
|
||||
* Add support for scaling canvas (defaults to device pixel ratio)
|
||||
* Add support for multiple text-shadows
|
||||
* Add support for multiple text-decorations
|
||||
* Add support for text-decoration-color
|
||||
* Add support for percentage values for border-radius
|
||||
* Correctly handle px and percentage values in linear-gradients
|
||||
* Correctly support all angle types for linear-gradients
|
||||
* Add support for multiple values for background-repeat, background-position and background-size
|
||||
|
||||
#### v0.5.0-beta4 - 23.1.2016 ####
|
||||
* Fix logger requiring access to window object
|
||||
* Derequire browserify build
|
||||
* Fix rendering of specific elements when window is scrolled and `type` isn't set to `view`
|
||||
|
||||
#### v0.5.0-beta3 - 6.12.2015 ####
|
||||
* Handle color names in linear gradients
|
||||
|
||||
#### v0.5.0-beta2 - 20.10.2015 ####
|
||||
* Remove Promise polyfill (use native or provide it yourself)
|
||||
|
||||
#### v0.5.0-beta1 - 19.10.2015 ####
|
||||
* Fix bug with unmatched color stops in gradients
|
||||
* Fix scrolling issues with iOS
|
||||
* Correctly handle named colors in gradients
|
||||
* Accept matrix3d transforms
|
||||
* Fix transparent colors breaking gradients
|
||||
* Preserve scrolling positions on render
|
||||
|
||||
#### v0.5.0-alpha2 - 3.2.2015 ####
|
||||
* Switch to using browserify for building
|
||||
* Fix (#517) Chrome stretches background images with 'auto' or single attributes
|
||||
|
||||
#### v0.5.0-alpha - 19.1.2015####
|
||||
* Complete rewrite of library
|
||||
* Switched interface to return Promise
|
||||
* Uses hidden iframe window to perform rendering, allowing async rendering and doesn't force the viewport to be scrolled to the top anymore.
|
||||
* Better support for unicode
|
||||
* Checkbox/radio button rendering
|
||||
* SVG rendering
|
||||
* iframe rendering
|
||||
* Changed format for proxy requests, permitting binary responses with CORS headers as well
|
||||
* Fixed many layering issues (see z-index tests)
|
||||
|
||||
#### v0.4.1 - 7.9.2013 ####
|
||||
* Added support for bower
|
||||
* Improved z-index ordering
|
||||
* Basic implementation for CSS transformations
|
||||
* Fixed inline text in top element
|
||||
* Basic implementation for text-shadow
|
||||
|
||||
#### v0.4.0 - 30.1.2013 ####
|
||||
* Added rendering tests with <a href="https://github.com/niklasvh/webdriver.js">webdriver</a>
|
||||
* Switched to using grunt for building
|
||||
* Removed support for IE<9, including any FlashCanvas bits
|
||||
* Support for border-radius
|
||||
* Support for multiple background images, size, and clipping
|
||||
* Support for :before and :after pseudo elements
|
||||
* Support for placeholder rendering
|
||||
* Reformatted all tests to small units to test specific features
|
||||
|
||||
#### v0.3.4 - 26.6.2012 ####
|
||||
|
||||
* Removed (last?) jQuery dependencies (<a href="https://github.com/niklasvh/html2canvas/commit/343b86705fe163766fcf735eb0217130e4bd5b17">niklasvh</a>)
|
||||
* SVG-powered rendering (<a href="https://github.com/niklasvh/html2canvas/commit/67d3e0d0f59a5a654caf71a2e3be6494ff146c75">niklasvh</a>)
|
||||
* Radial gradients (<a href="https://github.com/niklasvh/html2canvas/commit/4f22c18043a73c0c3bbf3b5e4d62714c56acd3c7">SunboX</a>)
|
||||
* Split renderers to their own objects (<a href="https://github.com/niklasvh/html2canvas/commit/94f2f799a457cd29a21cc56ef8c06f1697866739">niklasvh</a>)
|
||||
* Simplified API, cleaned up code (<a href="https://github.com/niklasvh/html2canvas/commit/c7d526c9eaa6a4abf4754d205fe1dee360c7660e">niklasvh</a>)
|
||||
|
||||
#### v0.3.3 - 2.3.2012 ####
|
||||
|
||||
* SVG taint fix, and additional taint testing options for rendering (<a href="https://github.com/niklasvh/html2canvas/commit/2dc8b9385e656696cb019d615bdfa1d98b17d5d4">niklasvh</a>)
|
||||
* Added support for CORS images and option to create canvas as tainted (<a href="https://github.com/niklasvh/html2canvas/commit/3ad49efa0032cde25c6ed32a39e35d1505d3b2ef">niklasvh</a>)
|
||||
* Improved minification saved ~1K! (<a href="https://github.com/cobexer/html2canvas/commit/b82be022b2b9240bd503e078ac980bde2b953e43">cobexer</a>)
|
||||
* Added integrated support for Flashcanvas (<a href="https://github.com/niklasvh/html2canvas/commit/e9257191519f67d74fd5e364d8dee3c0963ba5fc">niklasvh</a>)
|
||||
* Fixed a variety of legacy IE bugs (<a href="https://github.com/niklasvh/html2canvas/commit/b65357c55d0701017bafcd357bc654b54d458f8f">niklasvh</a>)
|
||||
|
||||
#### v0.3.2 - 20.2.2012 ####
|
||||
|
||||
* Added changelog!
|
||||
* Added bookmarklet (<a href="https://github.com/niklasvh/html2canvas/commit/b320dd306e1a2d32a3bc5a71b6ebf6d8c060cde5">cobexer</a>)
|
||||
* Option to select single element to render (<a href="https://github.com/niklasvh/html2canvas/commit/0cb252ada91c84ef411288b317c03e97da1f12ad">niklasvh</a>)
|
||||
* Fixed closure compiler warnings (<a href="https://github.com/niklasvh/html2canvas/commit/36ff1ec7aadcbdf66851a0b77f0b9e87e4a8e4a1">cobexer</a>)
|
||||
* Enable profiling in FF (<a href="https://github.com/niklasvh/html2canvas/commit/bbd75286a8406cf9e5aea01fdb7950d547edefb9">cobexer</a>)
|
22
AstuteClient2/src/assets/html2canvas/LICENSE
Normal file
22
AstuteClient2/src/assets/html2canvas/LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2012 Niklas von Hertzen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
89
AstuteClient2/src/assets/html2canvas/README.md
Normal file
89
AstuteClient2/src/assets/html2canvas/README.md
Normal file
|
@ -0,0 +1,89 @@
|
|||
html2canvas
|
||||
===========
|
||||
|
||||
[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/)
|
||||
|
||||
[](https://gitter.im/niklasvh/html2canvas?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
[](https://travis-ci.org/niklasvh/html2canvas)
|
||||
[](https://www.npmjs.org/package/html2canvas)
|
||||
[](https://www.npmjs.org/package/html2canvas)
|
||||
|
||||
#### JavaScript HTML renderer ####
|
||||
|
||||
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.
|
||||
|
||||
|
||||
### How does it work? ###
|
||||
The script renders the current page as a canvas image, by reading the DOM and the different styles applied to the elements.
|
||||
|
||||
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.
|
||||
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).
|
||||
|
||||
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.
|
||||
|
||||
### Browser compatibility ###
|
||||
|
||||
The library should work fine on the following browsers (with `Promise` polyfill):
|
||||
|
||||
* Firefox 3.5+
|
||||
* Google Chrome
|
||||
* Opera 12+
|
||||
* IE9+
|
||||
* Safari 6+
|
||||
|
||||
As each CSS property needs to be manually built to be supported, there are a number of properties that are not yet supported.
|
||||
|
||||
### Usage ###
|
||||
|
||||
The html2canvas library utilizes `Promise`s and expects them to be available in the global context. If you wish to
|
||||
support [older browsers](http://caniuse.com/#search=promise) that do not natively support `Promise`s, please include a polyfill such as
|
||||
[es6-promise](https://github.com/jakearchibald/es6-promise) before including `html2canvas`.
|
||||
|
||||
**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).
|
||||
|
||||
To render an `element` with html2canvas, simply call:
|
||||
` html2canvas(element[, options]);`
|
||||
|
||||
The function returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) containing the `<canvas>` element. Simply add a promise fullfillment handler to the promise using `then`:
|
||||
|
||||
html2canvas(document.body).then(function(canvas) {
|
||||
document.body.appendChild(canvas);
|
||||
});
|
||||
|
||||
### Building ###
|
||||
|
||||
You can download ready builds [here](https://github.com/niklasvh/html2canvas/releases).
|
||||
|
||||
Clone git repository:
|
||||
|
||||
$ git clone git://github.com/niklasvh/html2canvas.git
|
||||
|
||||
Install dependencies:
|
||||
|
||||
$ npm install
|
||||
|
||||
Build browser bundle
|
||||
|
||||
$ npm run build
|
||||
|
||||
### Running tests ###
|
||||
|
||||
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/).
|
||||
|
||||
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.
|
||||
|
||||
Start by downloading the dependencies:
|
||||
|
||||
$ npm install
|
||||
|
||||
Run tests:
|
||||
|
||||
$ npm test
|
||||
|
||||
### Examples ###
|
||||
|
||||
For more information and examples, please visit the [homepage](https://html2canvas.hertzen.com) or try the [test console](http://html2canvas.hertzen.com/screenshots.html).
|
||||
|
||||
### Contributing ###
|
||||
|
||||
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.
|
2199
AstuteClient2/src/assets/html2canvas/dist/RefTestRenderer.js
vendored
Normal file
2199
AstuteClient2/src/assets/html2canvas/dist/RefTestRenderer.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7274
AstuteClient2/src/assets/html2canvas/dist/html2canvas.js
vendored
Normal file
7274
AstuteClient2/src/assets/html2canvas/dist/html2canvas.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
AstuteClient2/src/assets/html2canvas/dist/html2canvas.min.js
vendored
Normal file
6
AstuteClient2/src/assets/html2canvas/dist/html2canvas.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
26
AstuteClient2/src/assets/html2canvas/dist/npm/Angle.js
vendored
Normal file
26
AstuteClient2/src/assets/html2canvas/dist/npm/Angle.js
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var ANGLE = /([+-]?\d*\.?\d+)(deg|grad|rad|turn)/i;
|
||||
|
||||
var parseAngle = exports.parseAngle = function parseAngle(angle) {
|
||||
var match = angle.match(ANGLE);
|
||||
|
||||
if (match) {
|
||||
var value = parseFloat(match[1]);
|
||||
switch (match[2].toLowerCase()) {
|
||||
case 'deg':
|
||||
return Math.PI * value / 180;
|
||||
case 'grad':
|
||||
return Math.PI / 200 * value;
|
||||
case 'rad':
|
||||
return value;
|
||||
case 'turn':
|
||||
return Math.PI * 2 * value;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
203
AstuteClient2/src/assets/html2canvas/dist/npm/Bounds.js
vendored
Normal file
203
AstuteClient2/src/assets/html2canvas/dist/npm/Bounds.js
vendored
Normal file
|
@ -0,0 +1,203 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseBoundCurves = exports.calculatePaddingBoxPath = exports.calculateBorderBoxPath = exports.parsePathForBorder = exports.parseDocumentSize = exports.calculateContentBox = exports.calculatePaddingBox = exports.parseBounds = exports.Bounds = undefined;
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _Vector = require('./drawing/Vector');
|
||||
|
||||
var _Vector2 = _interopRequireDefault(_Vector);
|
||||
|
||||
var _BezierCurve = require('./drawing/BezierCurve');
|
||||
|
||||
var _BezierCurve2 = _interopRequireDefault(_BezierCurve);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var TOP = 0;
|
||||
var RIGHT = 1;
|
||||
var BOTTOM = 2;
|
||||
var LEFT = 3;
|
||||
|
||||
var H = 0;
|
||||
var V = 1;
|
||||
|
||||
var Bounds = exports.Bounds = function () {
|
||||
function Bounds(x, y, w, h) {
|
||||
_classCallCheck(this, Bounds);
|
||||
|
||||
this.left = x;
|
||||
this.top = y;
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
}
|
||||
|
||||
_createClass(Bounds, null, [{
|
||||
key: 'fromClientRect',
|
||||
value: function fromClientRect(clientRect, scrollX, scrollY) {
|
||||
return new Bounds(clientRect.left + scrollX, clientRect.top + scrollY, clientRect.width, clientRect.height);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Bounds;
|
||||
}();
|
||||
|
||||
var parseBounds = exports.parseBounds = function parseBounds(node, scrollX, scrollY) {
|
||||
return Bounds.fromClientRect(node.getBoundingClientRect(), scrollX, scrollY);
|
||||
};
|
||||
|
||||
var calculatePaddingBox = exports.calculatePaddingBox = function calculatePaddingBox(bounds, borders) {
|
||||
return new Bounds(bounds.left + borders[LEFT].borderWidth, bounds.top + borders[TOP].borderWidth, bounds.width - (borders[RIGHT].borderWidth + borders[LEFT].borderWidth), bounds.height - (borders[TOP].borderWidth + borders[BOTTOM].borderWidth));
|
||||
};
|
||||
|
||||
var calculateContentBox = exports.calculateContentBox = function calculateContentBox(bounds, padding, borders) {
|
||||
// TODO support percentage paddings
|
||||
var paddingTop = padding[TOP].value;
|
||||
var paddingRight = padding[RIGHT].value;
|
||||
var paddingBottom = padding[BOTTOM].value;
|
||||
var paddingLeft = padding[LEFT].value;
|
||||
|
||||
return new Bounds(bounds.left + paddingLeft + borders[LEFT].borderWidth, bounds.top + paddingTop + borders[TOP].borderWidth, bounds.width - (borders[RIGHT].borderWidth + borders[LEFT].borderWidth + paddingLeft + paddingRight), bounds.height - (borders[TOP].borderWidth + borders[BOTTOM].borderWidth + paddingTop + paddingBottom));
|
||||
};
|
||||
|
||||
var parseDocumentSize = exports.parseDocumentSize = function parseDocumentSize(document) {
|
||||
var body = document.body;
|
||||
var documentElement = document.documentElement;
|
||||
|
||||
if (!body || !documentElement) {
|
||||
throw new Error(process.env.NODE_ENV !== 'production' ? 'Unable to get document size' : '');
|
||||
}
|
||||
var width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth));
|
||||
|
||||
var height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight));
|
||||
|
||||
return new Bounds(0, 0, width, height);
|
||||
};
|
||||
|
||||
var parsePathForBorder = exports.parsePathForBorder = function parsePathForBorder(curves, borderSide) {
|
||||
switch (borderSide) {
|
||||
case TOP:
|
||||
return createPathFromCurves(curves.topLeftOuter, curves.topLeftInner, curves.topRightOuter, curves.topRightInner);
|
||||
case RIGHT:
|
||||
return createPathFromCurves(curves.topRightOuter, curves.topRightInner, curves.bottomRightOuter, curves.bottomRightInner);
|
||||
case BOTTOM:
|
||||
return createPathFromCurves(curves.bottomRightOuter, curves.bottomRightInner, curves.bottomLeftOuter, curves.bottomLeftInner);
|
||||
case LEFT:
|
||||
default:
|
||||
return createPathFromCurves(curves.bottomLeftOuter, curves.bottomLeftInner, curves.topLeftOuter, curves.topLeftInner);
|
||||
}
|
||||
};
|
||||
|
||||
var createPathFromCurves = function createPathFromCurves(outer1, inner1, outer2, inner2) {
|
||||
var path = [];
|
||||
if (outer1 instanceof _BezierCurve2.default) {
|
||||
path.push(outer1.subdivide(0.5, false));
|
||||
} else {
|
||||
path.push(outer1);
|
||||
}
|
||||
|
||||
if (outer2 instanceof _BezierCurve2.default) {
|
||||
path.push(outer2.subdivide(0.5, true));
|
||||
} else {
|
||||
path.push(outer2);
|
||||
}
|
||||
|
||||
if (inner2 instanceof _BezierCurve2.default) {
|
||||
path.push(inner2.subdivide(0.5, true).reverse());
|
||||
} else {
|
||||
path.push(inner2);
|
||||
}
|
||||
|
||||
if (inner1 instanceof _BezierCurve2.default) {
|
||||
path.push(inner1.subdivide(0.5, false).reverse());
|
||||
} else {
|
||||
path.push(inner1);
|
||||
}
|
||||
|
||||
return path;
|
||||
};
|
||||
|
||||
var calculateBorderBoxPath = exports.calculateBorderBoxPath = function calculateBorderBoxPath(curves) {
|
||||
return [curves.topLeftOuter, curves.topRightOuter, curves.bottomRightOuter, curves.bottomLeftOuter];
|
||||
};
|
||||
|
||||
var calculatePaddingBoxPath = exports.calculatePaddingBoxPath = function calculatePaddingBoxPath(curves) {
|
||||
return [curves.topLeftInner, curves.topRightInner, curves.bottomRightInner, curves.bottomLeftInner];
|
||||
};
|
||||
|
||||
var parseBoundCurves = exports.parseBoundCurves = function parseBoundCurves(bounds, borders, borderRadius) {
|
||||
var tlh = borderRadius[CORNER.TOP_LEFT][H].getAbsoluteValue(bounds.width);
|
||||
var tlv = borderRadius[CORNER.TOP_LEFT][V].getAbsoluteValue(bounds.height);
|
||||
var trh = borderRadius[CORNER.TOP_RIGHT][H].getAbsoluteValue(bounds.width);
|
||||
var trv = borderRadius[CORNER.TOP_RIGHT][V].getAbsoluteValue(bounds.height);
|
||||
var brh = borderRadius[CORNER.BOTTOM_RIGHT][H].getAbsoluteValue(bounds.width);
|
||||
var brv = borderRadius[CORNER.BOTTOM_RIGHT][V].getAbsoluteValue(bounds.height);
|
||||
var blh = borderRadius[CORNER.BOTTOM_LEFT][H].getAbsoluteValue(bounds.width);
|
||||
var blv = borderRadius[CORNER.BOTTOM_LEFT][V].getAbsoluteValue(bounds.height);
|
||||
|
||||
var factors = [];
|
||||
factors.push((tlh + trh) / bounds.width);
|
||||
factors.push((blh + brh) / bounds.width);
|
||||
factors.push((tlv + blv) / bounds.height);
|
||||
factors.push((trv + brv) / bounds.height);
|
||||
var maxFactor = Math.max.apply(Math, factors);
|
||||
|
||||
if (maxFactor > 1) {
|
||||
tlh /= maxFactor;
|
||||
tlv /= maxFactor;
|
||||
trh /= maxFactor;
|
||||
trv /= maxFactor;
|
||||
brh /= maxFactor;
|
||||
brv /= maxFactor;
|
||||
blh /= maxFactor;
|
||||
blv /= maxFactor;
|
||||
}
|
||||
|
||||
var topWidth = bounds.width - trh;
|
||||
var rightHeight = bounds.height - brv;
|
||||
var bottomWidth = bounds.width - brh;
|
||||
var leftHeight = bounds.height - blv;
|
||||
|
||||
return {
|
||||
topLeftOuter: tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left, bounds.top, tlh, tlv, CORNER.TOP_LEFT) : new _Vector2.default(bounds.left, bounds.top),
|
||||
topLeftInner: tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + borders[LEFT].borderWidth, bounds.top + borders[TOP].borderWidth, Math.max(0, tlh - borders[LEFT].borderWidth), Math.max(0, tlv - borders[TOP].borderWidth), CORNER.TOP_LEFT) : new _Vector2.default(bounds.left + borders[LEFT].borderWidth, bounds.top + borders[TOP].borderWidth),
|
||||
topRightOuter: trh > 0 || trv > 0 ? getCurvePoints(bounds.left + topWidth, bounds.top, trh, trv, CORNER.TOP_RIGHT) : new _Vector2.default(bounds.left + bounds.width, bounds.top),
|
||||
topRightInner: trh > 0 || trv > 0 ? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borders[LEFT].borderWidth), bounds.top + borders[TOP].borderWidth, topWidth > bounds.width + borders[LEFT].borderWidth ? 0 : trh - borders[LEFT].borderWidth, trv - borders[TOP].borderWidth, CORNER.TOP_RIGHT) : new _Vector2.default(bounds.left + bounds.width - borders[RIGHT].borderWidth, bounds.top + borders[TOP].borderWidth),
|
||||
bottomRightOuter: brh > 0 || brv > 0 ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh, brv, CORNER.BOTTOM_RIGHT) : new _Vector2.default(bounds.left + bounds.width, bounds.top + bounds.height),
|
||||
bottomRightInner: brh > 0 || brv > 0 ? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - borders[LEFT].borderWidth), bounds.top + Math.min(rightHeight, bounds.height + borders[TOP].borderWidth), Math.max(0, brh - borders[RIGHT].borderWidth), brv - borders[BOTTOM].borderWidth, CORNER.BOTTOM_RIGHT) : new _Vector2.default(bounds.left + bounds.width - borders[RIGHT].borderWidth, bounds.top + bounds.height - borders[BOTTOM].borderWidth),
|
||||
bottomLeftOuter: blh > 0 || blv > 0 ? getCurvePoints(bounds.left, bounds.top + leftHeight, blh, blv, CORNER.BOTTOM_LEFT) : new _Vector2.default(bounds.left, bounds.top + bounds.height),
|
||||
bottomLeftInner: blh > 0 || blv > 0 ? getCurvePoints(bounds.left + borders[LEFT].borderWidth, bounds.top + leftHeight, Math.max(0, blh - borders[LEFT].borderWidth), blv - borders[BOTTOM].borderWidth, CORNER.BOTTOM_LEFT) : new _Vector2.default(bounds.left + borders[LEFT].borderWidth, bounds.top + bounds.height - borders[BOTTOM].borderWidth)
|
||||
};
|
||||
};
|
||||
|
||||
var CORNER = {
|
||||
TOP_LEFT: 0,
|
||||
TOP_RIGHT: 1,
|
||||
BOTTOM_RIGHT: 2,
|
||||
BOTTOM_LEFT: 3
|
||||
};
|
||||
|
||||
var getCurvePoints = function getCurvePoints(x, y, r1, r2, position) {
|
||||
var kappa = 4 * ((Math.sqrt(2) - 1) / 3);
|
||||
var ox = r1 * kappa; // control point offset horizontal
|
||||
var oy = r2 * kappa; // control point offset vertical
|
||||
var xm = x + r1; // x-middle
|
||||
var ym = y + r2; // y-middle
|
||||
|
||||
switch (position) {
|
||||
case CORNER.TOP_LEFT:
|
||||
return new _BezierCurve2.default(new _Vector2.default(x, ym), new _Vector2.default(x, ym - oy), new _Vector2.default(xm - ox, y), new _Vector2.default(xm, y));
|
||||
case CORNER.TOP_RIGHT:
|
||||
return new _BezierCurve2.default(new _Vector2.default(x, y), new _Vector2.default(x + ox, y), new _Vector2.default(xm, ym - oy), new _Vector2.default(xm, ym));
|
||||
case CORNER.BOTTOM_RIGHT:
|
||||
return new _BezierCurve2.default(new _Vector2.default(xm, y), new _Vector2.default(xm, y + oy), new _Vector2.default(x + ox, ym), new _Vector2.default(x, ym));
|
||||
case CORNER.BOTTOM_LEFT:
|
||||
default:
|
||||
return new _BezierCurve2.default(new _Vector2.default(xm, ym), new _Vector2.default(xm - ox, ym), new _Vector2.default(x, y + oy), new _Vector2.default(x, y));
|
||||
}
|
||||
};
|
582
AstuteClient2/src/assets/html2canvas/dist/npm/Clone.js
vendored
Normal file
582
AstuteClient2/src/assets/html2canvas/dist/npm/Clone.js
vendored
Normal file
|
@ -0,0 +1,582 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.cloneWindow = exports.DocumentCloner = undefined;
|
||||
|
||||
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"); } }; }();
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _Bounds = require('./Bounds');
|
||||
|
||||
var _Proxy = require('./Proxy');
|
||||
|
||||
var _ResourceLoader = require('./ResourceLoader');
|
||||
|
||||
var _ResourceLoader2 = _interopRequireDefault(_ResourceLoader);
|
||||
|
||||
var _Util = require('./Util');
|
||||
|
||||
var _background = require('./parsing/background');
|
||||
|
||||
var _CanvasRenderer = require('./renderer/CanvasRenderer');
|
||||
|
||||
var _CanvasRenderer2 = _interopRequireDefault(_CanvasRenderer);
|
||||
|
||||
var _PseudoNodeContent = require('./PseudoNodeContent');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var IGNORE_ATTRIBUTE = 'data-html2canvas-ignore';
|
||||
|
||||
var DocumentCloner = exports.DocumentCloner = function () {
|
||||
function DocumentCloner(element, options, logger, copyInline, renderer) {
|
||||
_classCallCheck(this, DocumentCloner);
|
||||
|
||||
this.referenceElement = element;
|
||||
this.scrolledElements = [];
|
||||
this.copyStyles = copyInline;
|
||||
this.inlineImages = copyInline;
|
||||
this.logger = logger;
|
||||
this.options = options;
|
||||
this.renderer = renderer;
|
||||
this.resourceLoader = new _ResourceLoader2.default(options, logger, window);
|
||||
this.pseudoContentData = {
|
||||
counters: {},
|
||||
quoteDepth: 0
|
||||
};
|
||||
// $FlowFixMe
|
||||
this.documentElement = this.cloneNode(element.ownerDocument.documentElement);
|
||||
}
|
||||
|
||||
_createClass(DocumentCloner, [{
|
||||
key: 'inlineAllImages',
|
||||
value: function inlineAllImages(node) {
|
||||
var _this = this;
|
||||
|
||||
if (this.inlineImages && node) {
|
||||
var style = node.style;
|
||||
Promise.all((0, _background.parseBackgroundImage)(style.backgroundImage).map(function (backgroundImage) {
|
||||
if (backgroundImage.method === 'url') {
|
||||
return _this.resourceLoader.inlineImage(backgroundImage.args[0]).then(function (img) {
|
||||
return img && typeof img.src === 'string' ? 'url("' + img.src + '")' : 'none';
|
||||
}).catch(function (e) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
_this.logger.log('Unable to load image', e);
|
||||
}
|
||||
});
|
||||
}
|
||||
return Promise.resolve('' + backgroundImage.prefix + backgroundImage.method + '(' + backgroundImage.args.join(',') + ')');
|
||||
})).then(function (backgroundImages) {
|
||||
if (backgroundImages.length > 1) {
|
||||
// TODO Multiple backgrounds somehow broken in Chrome
|
||||
style.backgroundColor = '';
|
||||
}
|
||||
style.backgroundImage = backgroundImages.join(',');
|
||||
});
|
||||
|
||||
if (node instanceof HTMLImageElement) {
|
||||
this.resourceLoader.inlineImage(node.src).then(function (img) {
|
||||
if (img && node instanceof HTMLImageElement && node.parentNode) {
|
||||
var parentNode = node.parentNode;
|
||||
var clonedChild = (0, _Util.copyCSSStyles)(node.style, img.cloneNode(false));
|
||||
parentNode.replaceChild(clonedChild, node);
|
||||
}
|
||||
}).catch(function (e) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
_this.logger.log('Unable to load image', e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'inlineFonts',
|
||||
value: function inlineFonts(document) {
|
||||
var _this2 = this;
|
||||
|
||||
return Promise.all(Array.from(document.styleSheets).map(function (sheet) {
|
||||
if (sheet.href) {
|
||||
return fetch(sheet.href).then(function (res) {
|
||||
return res.text();
|
||||
}).then(function (text) {
|
||||
return createStyleSheetFontsFromText(text, sheet.href);
|
||||
}).catch(function (e) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
_this2.logger.log('Unable to load stylesheet', e);
|
||||
}
|
||||
return [];
|
||||
});
|
||||
}
|
||||
return getSheetFonts(sheet, document);
|
||||
})).then(function (fonts) {
|
||||
return fonts.reduce(function (acc, font) {
|
||||
return acc.concat(font);
|
||||
}, []);
|
||||
}).then(function (fonts) {
|
||||
return Promise.all(fonts.map(function (font) {
|
||||
return fetch(font.formats[0].src).then(function (response) {
|
||||
return response.blob();
|
||||
}).then(function (blob) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var reader = new FileReader();
|
||||
reader.onerror = reject;
|
||||
reader.onload = function () {
|
||||
// $FlowFixMe
|
||||
var result = reader.result;
|
||||
resolve(result);
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
}).then(function (dataUri) {
|
||||
font.fontFace.setProperty('src', 'url("' + dataUri + '")');
|
||||
return '@font-face {' + font.fontFace.cssText + ' ';
|
||||
});
|
||||
}));
|
||||
}).then(function (fontCss) {
|
||||
var style = document.createElement('style');
|
||||
style.textContent = fontCss.join('\n');
|
||||
_this2.documentElement.appendChild(style);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'createElementClone',
|
||||
value: function createElementClone(node) {
|
||||
var _this3 = this;
|
||||
|
||||
if (this.copyStyles && node instanceof HTMLCanvasElement) {
|
||||
var img = node.ownerDocument.createElement('img');
|
||||
try {
|
||||
img.src = node.toDataURL();
|
||||
return img;
|
||||
} catch (e) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
this.logger.log('Unable to clone canvas contents, canvas is tainted');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (node instanceof HTMLIFrameElement) {
|
||||
var tempIframe = node.cloneNode(false);
|
||||
var iframeKey = generateIframeKey();
|
||||
tempIframe.setAttribute('data-html2canvas-internal-iframe-key', iframeKey);
|
||||
|
||||
var _parseBounds = (0, _Bounds.parseBounds)(node, 0, 0),
|
||||
width = _parseBounds.width,
|
||||
height = _parseBounds.height;
|
||||
|
||||
this.resourceLoader.cache[iframeKey] = getIframeDocumentElement(node, this.options).then(function (documentElement) {
|
||||
return _this3.renderer(documentElement, {
|
||||
async: _this3.options.async,
|
||||
allowTaint: _this3.options.allowTaint,
|
||||
backgroundColor: '#ffffff',
|
||||
canvas: null,
|
||||
imageTimeout: _this3.options.imageTimeout,
|
||||
logging: _this3.options.logging,
|
||||
proxy: _this3.options.proxy,
|
||||
removeContainer: _this3.options.removeContainer,
|
||||
scale: _this3.options.scale,
|
||||
foreignObjectRendering: _this3.options.foreignObjectRendering,
|
||||
useCORS: _this3.options.useCORS,
|
||||
target: new _CanvasRenderer2.default(),
|
||||
width: width,
|
||||
height: height,
|
||||
x: 0,
|
||||
y: 0,
|
||||
windowWidth: documentElement.ownerDocument.defaultView.innerWidth,
|
||||
windowHeight: documentElement.ownerDocument.defaultView.innerHeight,
|
||||
scrollX: documentElement.ownerDocument.defaultView.pageXOffset,
|
||||
scrollY: documentElement.ownerDocument.defaultView.pageYOffset
|
||||
}, _this3.logger.child(iframeKey));
|
||||
}).then(function (canvas) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var iframeCanvas = document.createElement('img');
|
||||
iframeCanvas.onload = function () {
|
||||
return resolve(canvas);
|
||||
};
|
||||
iframeCanvas.onerror = reject;
|
||||
iframeCanvas.src = canvas.toDataURL();
|
||||
if (tempIframe.parentNode) {
|
||||
tempIframe.parentNode.replaceChild((0, _Util.copyCSSStyles)(node.ownerDocument.defaultView.getComputedStyle(node), iframeCanvas), tempIframe);
|
||||
}
|
||||
});
|
||||
});
|
||||
return tempIframe;
|
||||
}
|
||||
|
||||
if (node instanceof HTMLStyleElement && node.sheet && node.sheet.cssRules) {
|
||||
var css = [].slice.call(node.sheet.cssRules, 0).reduce(function (css, rule) {
|
||||
try {
|
||||
if (rule && rule.cssText) {
|
||||
return css + rule.cssText;
|
||||
}
|
||||
return css;
|
||||
} catch (err) {
|
||||
_this3.logger.log('Unable to access cssText property', rule.name);
|
||||
return css;
|
||||
}
|
||||
}, '');
|
||||
var style = node.cloneNode(false);
|
||||
style.textContent = css;
|
||||
return style;
|
||||
}
|
||||
|
||||
return node.cloneNode(false);
|
||||
}
|
||||
}, {
|
||||
key: 'cloneNode',
|
||||
value: function cloneNode(node) {
|
||||
var clone = node.nodeType === Node.TEXT_NODE ? document.createTextNode(node.nodeValue) : this.createElementClone(node);
|
||||
|
||||
var window = node.ownerDocument.defaultView;
|
||||
var style = node instanceof window.HTMLElement ? window.getComputedStyle(node) : null;
|
||||
var styleBefore = node instanceof window.HTMLElement ? window.getComputedStyle(node, ':before') : null;
|
||||
var styleAfter = node instanceof window.HTMLElement ? window.getComputedStyle(node, ':after') : null;
|
||||
|
||||
if (this.referenceElement === node && clone instanceof window.HTMLElement) {
|
||||
this.clonedReferenceElement = clone;
|
||||
}
|
||||
|
||||
if (clone instanceof window.HTMLBodyElement) {
|
||||
createPseudoHideStyles(clone);
|
||||
}
|
||||
|
||||
var counters = (0, _PseudoNodeContent.parseCounterReset)(style, this.pseudoContentData);
|
||||
var contentBefore = (0, _PseudoNodeContent.resolvePseudoContent)(node, styleBefore, this.pseudoContentData);
|
||||
|
||||
for (var child = node.firstChild; child; child = child.nextSibling) {
|
||||
if (child.nodeType !== Node.ELEMENT_NODE || child.nodeName !== 'SCRIPT' &&
|
||||
// $FlowFixMe
|
||||
!child.hasAttribute(IGNORE_ATTRIBUTE) && (typeof this.options.ignoreElements !== 'function' ||
|
||||
// $FlowFixMe
|
||||
!this.options.ignoreElements(child))) {
|
||||
if (!this.copyStyles || child.nodeName !== 'STYLE') {
|
||||
clone.appendChild(this.cloneNode(child));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var contentAfter = (0, _PseudoNodeContent.resolvePseudoContent)(node, styleAfter, this.pseudoContentData);
|
||||
(0, _PseudoNodeContent.popCounters)(counters, this.pseudoContentData);
|
||||
|
||||
if (node instanceof window.HTMLElement && clone instanceof window.HTMLElement) {
|
||||
if (styleBefore) {
|
||||
this.inlineAllImages(inlinePseudoElement(node, clone, styleBefore, contentBefore, PSEUDO_BEFORE));
|
||||
}
|
||||
if (styleAfter) {
|
||||
this.inlineAllImages(inlinePseudoElement(node, clone, styleAfter, contentAfter, PSEUDO_AFTER));
|
||||
}
|
||||
if (style && this.copyStyles && !(node instanceof HTMLIFrameElement)) {
|
||||
(0, _Util.copyCSSStyles)(style, clone);
|
||||
}
|
||||
this.inlineAllImages(clone);
|
||||
if (node.scrollTop !== 0 || node.scrollLeft !== 0) {
|
||||
this.scrolledElements.push([clone, node.scrollLeft, node.scrollTop]);
|
||||
}
|
||||
switch (node.nodeName) {
|
||||
case 'CANVAS':
|
||||
if (!this.copyStyles) {
|
||||
cloneCanvasContents(node, clone);
|
||||
}
|
||||
break;
|
||||
case 'TEXTAREA':
|
||||
case 'SELECT':
|
||||
clone.value = node.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
}]);
|
||||
|
||||
return DocumentCloner;
|
||||
}();
|
||||
|
||||
var getSheetFonts = function getSheetFonts(sheet, document) {
|
||||
// $FlowFixMe
|
||||
return (sheet.cssRules ? Array.from(sheet.cssRules) : []).filter(function (rule) {
|
||||
return rule.type === CSSRule.FONT_FACE_RULE;
|
||||
}).map(function (rule) {
|
||||
var src = (0, _background.parseBackgroundImage)(rule.style.getPropertyValue('src'));
|
||||
var formats = [];
|
||||
for (var i = 0; i < src.length; i++) {
|
||||
if (src[i].method === 'url' && src[i + 1] && src[i + 1].method === 'format') {
|
||||
var a = document.createElement('a');
|
||||
a.href = src[i].args[0];
|
||||
if (document.body) {
|
||||
document.body.appendChild(a);
|
||||
}
|
||||
|
||||
var font = {
|
||||
src: a.href,
|
||||
format: src[i + 1].args[0]
|
||||
};
|
||||
formats.push(font);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
// TODO select correct format for browser),
|
||||
|
||||
formats: formats.filter(function (font) {
|
||||
return (/^woff/i.test(font.format)
|
||||
);
|
||||
}),
|
||||
fontFace: rule.style
|
||||
};
|
||||
}).filter(function (font) {
|
||||
return font.formats.length;
|
||||
});
|
||||
};
|
||||
|
||||
var createStyleSheetFontsFromText = function createStyleSheetFontsFromText(text, baseHref) {
|
||||
var doc = document.implementation.createHTMLDocument('');
|
||||
var base = document.createElement('base');
|
||||
// $FlowFixMe
|
||||
base.href = baseHref;
|
||||
var style = document.createElement('style');
|
||||
|
||||
style.textContent = text;
|
||||
if (doc.head) {
|
||||
doc.head.appendChild(base);
|
||||
}
|
||||
if (doc.body) {
|
||||
doc.body.appendChild(style);
|
||||
}
|
||||
|
||||
return style.sheet ? getSheetFonts(style.sheet, doc) : [];
|
||||
};
|
||||
|
||||
var restoreOwnerScroll = function restoreOwnerScroll(ownerDocument, x, y) {
|
||||
if (ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) {
|
||||
ownerDocument.defaultView.scrollTo(x, y);
|
||||
}
|
||||
};
|
||||
|
||||
var cloneCanvasContents = function cloneCanvasContents(canvas, clonedCanvas) {
|
||||
try {
|
||||
if (clonedCanvas) {
|
||||
clonedCanvas.width = canvas.width;
|
||||
clonedCanvas.height = canvas.height;
|
||||
var ctx = canvas.getContext('2d');
|
||||
var clonedCtx = clonedCanvas.getContext('2d');
|
||||
if (ctx) {
|
||||
clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
|
||||
} else {
|
||||
clonedCtx.drawImage(canvas, 0, 0);
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
var inlinePseudoElement = function inlinePseudoElement(node, clone, style, contentItems, pseudoElt) {
|
||||
if (!style || !style.content || style.content === 'none' || style.content === '-moz-alt-content' || style.display === 'none') {
|
||||
return;
|
||||
}
|
||||
|
||||
var anonymousReplacedElement = clone.ownerDocument.createElement('html2canvaspseudoelement');
|
||||
(0, _Util.copyCSSStyles)(style, anonymousReplacedElement);
|
||||
|
||||
if (contentItems) {
|
||||
var len = contentItems.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var item = contentItems[i];
|
||||
switch (item.type) {
|
||||
case _PseudoNodeContent.PSEUDO_CONTENT_ITEM_TYPE.IMAGE:
|
||||
var img = clone.ownerDocument.createElement('img');
|
||||
img.src = (0, _background.parseBackgroundImage)('url(' + item.value + ')')[0].args[0];
|
||||
img.style.opacity = '1';
|
||||
anonymousReplacedElement.appendChild(img);
|
||||
break;
|
||||
case _PseudoNodeContent.PSEUDO_CONTENT_ITEM_TYPE.TEXT:
|
||||
anonymousReplacedElement.appendChild(clone.ownerDocument.createTextNode(item.value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + ' ' + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
|
||||
clone.className += pseudoElt === PSEUDO_BEFORE ? ' ' + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE : ' ' + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
|
||||
if (pseudoElt === PSEUDO_BEFORE) {
|
||||
clone.insertBefore(anonymousReplacedElement, clone.firstChild);
|
||||
} else {
|
||||
clone.appendChild(anonymousReplacedElement);
|
||||
}
|
||||
|
||||
return anonymousReplacedElement;
|
||||
};
|
||||
|
||||
var URL_REGEXP = /^url\((.+)\)$/i;
|
||||
var PSEUDO_BEFORE = ':before';
|
||||
var PSEUDO_AFTER = ':after';
|
||||
var PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = '___html2canvas___pseudoelement_before';
|
||||
var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after';
|
||||
|
||||
var PSEUDO_HIDE_ELEMENT_STYLE = '{\n content: "" !important;\n display: none !important;\n}';
|
||||
|
||||
var createPseudoHideStyles = function createPseudoHideStyles(body) {
|
||||
createStyles(body, '.' + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + PSEUDO_BEFORE + PSEUDO_HIDE_ELEMENT_STYLE + '\n .' + PSEUDO_HIDE_ELEMENT_CLASS_AFTER + PSEUDO_AFTER + PSEUDO_HIDE_ELEMENT_STYLE);
|
||||
};
|
||||
|
||||
var createStyles = function createStyles(body, styles) {
|
||||
var style = body.ownerDocument.createElement('style');
|
||||
style.innerHTML = styles;
|
||||
body.appendChild(style);
|
||||
};
|
||||
|
||||
var initNode = function initNode(_ref) {
|
||||
var _ref2 = _slicedToArray(_ref, 3),
|
||||
element = _ref2[0],
|
||||
x = _ref2[1],
|
||||
y = _ref2[2];
|
||||
|
||||
element.scrollLeft = x;
|
||||
element.scrollTop = y;
|
||||
};
|
||||
|
||||
var generateIframeKey = function generateIframeKey() {
|
||||
return Math.ceil(Date.now() + Math.random() * 10000000).toString(16);
|
||||
};
|
||||
|
||||
var DATA_URI_REGEXP = /^data:text\/(.+);(base64)?,(.*)$/i;
|
||||
|
||||
var getIframeDocumentElement = function getIframeDocumentElement(node, options) {
|
||||
try {
|
||||
return Promise.resolve(node.contentWindow.document.documentElement);
|
||||
} catch (e) {
|
||||
return options.proxy ? (0, _Proxy.Proxy)(node.src, options).then(function (html) {
|
||||
var match = html.match(DATA_URI_REGEXP);
|
||||
if (!match) {
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
return match[2] === 'base64' ? window.atob(decodeURIComponent(match[3])) : decodeURIComponent(match[3]);
|
||||
}).then(function (html) {
|
||||
return createIframeContainer(node.ownerDocument, (0, _Bounds.parseBounds)(node, 0, 0)).then(function (cloneIframeContainer) {
|
||||
var cloneWindow = cloneIframeContainer.contentWindow;
|
||||
var documentClone = cloneWindow.document;
|
||||
|
||||
documentClone.open();
|
||||
documentClone.write(html);
|
||||
var iframeLoad = iframeLoader(cloneIframeContainer).then(function () {
|
||||
return documentClone.documentElement;
|
||||
});
|
||||
|
||||
documentClone.close();
|
||||
return iframeLoad;
|
||||
});
|
||||
}) : Promise.reject();
|
||||
}
|
||||
};
|
||||
|
||||
var createIframeContainer = function createIframeContainer(ownerDocument, bounds) {
|
||||
var cloneIframeContainer = ownerDocument.createElement('iframe');
|
||||
|
||||
cloneIframeContainer.className = 'html2canvas-container';
|
||||
cloneIframeContainer.style.visibility = 'hidden';
|
||||
cloneIframeContainer.style.position = 'fixed';
|
||||
cloneIframeContainer.style.left = '-10000px';
|
||||
cloneIframeContainer.style.top = '0px';
|
||||
cloneIframeContainer.style.border = '0';
|
||||
cloneIframeContainer.width = bounds.width.toString();
|
||||
cloneIframeContainer.height = bounds.height.toString();
|
||||
cloneIframeContainer.scrolling = 'no'; // ios won't scroll without it
|
||||
cloneIframeContainer.setAttribute(IGNORE_ATTRIBUTE, 'true');
|
||||
if (!ownerDocument.body) {
|
||||
return Promise.reject(process.env.NODE_ENV !== 'production' ? 'Body element not found in Document that is getting rendered' : '');
|
||||
}
|
||||
|
||||
ownerDocument.body.appendChild(cloneIframeContainer);
|
||||
|
||||
return Promise.resolve(cloneIframeContainer);
|
||||
};
|
||||
|
||||
var iframeLoader = function iframeLoader(cloneIframeContainer) {
|
||||
var cloneWindow = cloneIframeContainer.contentWindow;
|
||||
var documentClone = cloneWindow.document;
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
cloneWindow.onload = cloneIframeContainer.onload = documentClone.onreadystatechange = function () {
|
||||
var interval = setInterval(function () {
|
||||
if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') {
|
||||
clearInterval(interval);
|
||||
resolve(cloneIframeContainer);
|
||||
}
|
||||
}, 50);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
var cloneWindow = exports.cloneWindow = function cloneWindow(ownerDocument, bounds, referenceElement, options, logger, renderer) {
|
||||
var cloner = new DocumentCloner(referenceElement, options, logger, false, renderer);
|
||||
var scrollX = ownerDocument.defaultView.pageXOffset;
|
||||
var scrollY = ownerDocument.defaultView.pageYOffset;
|
||||
|
||||
return createIframeContainer(ownerDocument, bounds).then(function (cloneIframeContainer) {
|
||||
var cloneWindow = cloneIframeContainer.contentWindow;
|
||||
var documentClone = cloneWindow.document;
|
||||
|
||||
/* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
|
||||
if window url is about:blank, we can assign the url to current by writing onto the document
|
||||
*/
|
||||
|
||||
var iframeLoad = iframeLoader(cloneIframeContainer).then(function () {
|
||||
cloner.scrolledElements.forEach(initNode);
|
||||
cloneWindow.scrollTo(bounds.left, bounds.top);
|
||||
if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent) && (cloneWindow.scrollY !== bounds.top || cloneWindow.scrollX !== bounds.left)) {
|
||||
documentClone.documentElement.style.top = -bounds.top + 'px';
|
||||
documentClone.documentElement.style.left = -bounds.left + 'px';
|
||||
documentClone.documentElement.style.position = 'absolute';
|
||||
}
|
||||
|
||||
var result = Promise.resolve([cloneIframeContainer, cloner.clonedReferenceElement, cloner.resourceLoader]);
|
||||
|
||||
var onclone = options.onclone;
|
||||
|
||||
return cloner.clonedReferenceElement instanceof cloneWindow.HTMLElement || cloner.clonedReferenceElement instanceof ownerDocument.defaultView.HTMLElement || cloner.clonedReferenceElement instanceof HTMLElement ? typeof onclone === 'function' ? Promise.resolve().then(function () {
|
||||
return onclone(documentClone);
|
||||
}).then(function () {
|
||||
return result;
|
||||
}) : result : Promise.reject(process.env.NODE_ENV !== 'production' ? 'Error finding the ' + referenceElement.nodeName + ' in the cloned document' : '');
|
||||
});
|
||||
|
||||
documentClone.open();
|
||||
documentClone.write(serializeDoctype(document.doctype) + '<html></html>');
|
||||
// Chrome scrolls the parent document for some reason after the write to the cloned window???
|
||||
restoreOwnerScroll(referenceElement.ownerDocument, scrollX, scrollY);
|
||||
documentClone.replaceChild(documentClone.adoptNode(cloner.documentElement), documentClone.documentElement);
|
||||
documentClone.close();
|
||||
|
||||
return iframeLoad;
|
||||
});
|
||||
};
|
||||
|
||||
var serializeDoctype = function serializeDoctype(doctype) {
|
||||
var str = '';
|
||||
if (doctype) {
|
||||
str += '<!DOCTYPE ';
|
||||
if (doctype.name) {
|
||||
str += doctype.name;
|
||||
}
|
||||
|
||||
if (doctype.internalSubset) {
|
||||
str += doctype.internalSubset;
|
||||
}
|
||||
|
||||
if (doctype.publicId) {
|
||||
str += '"' + doctype.publicId + '"';
|
||||
}
|
||||
|
||||
if (doctype.systemId) {
|
||||
str += '"' + doctype.systemId + '"';
|
||||
}
|
||||
|
||||
str += '>';
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
247
AstuteClient2/src/assets/html2canvas/dist/npm/Color.js
vendored
Normal file
247
AstuteClient2/src/assets/html2canvas/dist/npm/Color.js
vendored
Normal file
|
@ -0,0 +1,247 @@
|
|||
'use strict';
|
||||
|
||||
// http://dev.w3.org/csswg/css-color/
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
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"); } }; }();
|
||||
|
||||
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; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var HEX3 = /^#([a-f0-9]{3})$/i;
|
||||
var hex3 = function hex3(value) {
|
||||
var match = value.match(HEX3);
|
||||
if (match) {
|
||||
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];
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var HEX6 = /^#([a-f0-9]{6})$/i;
|
||||
var hex6 = function hex6(value) {
|
||||
var match = value.match(HEX6);
|
||||
if (match) {
|
||||
return [parseInt(match[1].substring(0, 2), 16), parseInt(match[1].substring(2, 4), 16), parseInt(match[1].substring(4, 6), 16), null];
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var RGB = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/;
|
||||
var rgb = function rgb(value) {
|
||||
var match = value.match(RGB);
|
||||
if (match) {
|
||||
return [Number(match[1]), Number(match[2]), Number(match[3]), null];
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var RGBA = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/;
|
||||
var rgba = function rgba(value) {
|
||||
var match = value.match(RGBA);
|
||||
if (match && match.length > 4) {
|
||||
return [Number(match[1]), Number(match[2]), Number(match[3]), Number(match[4])];
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var fromArray = function fromArray(array) {
|
||||
return [Math.min(array[0], 255), Math.min(array[1], 255), Math.min(array[2], 255), array.length > 3 ? array[3] : null];
|
||||
};
|
||||
|
||||
var namedColor = function namedColor(name) {
|
||||
var color = NAMED_COLORS[name.toLowerCase()];
|
||||
return color ? color : false;
|
||||
};
|
||||
|
||||
var Color = function () {
|
||||
function Color(value) {
|
||||
_classCallCheck(this, Color);
|
||||
|
||||
var _ref = Array.isArray(value) ? fromArray(value) : hex3(value) || rgb(value) || rgba(value) || namedColor(value) || hex6(value) || [0, 0, 0, null],
|
||||
_ref2 = _slicedToArray(_ref, 4),
|
||||
r = _ref2[0],
|
||||
g = _ref2[1],
|
||||
b = _ref2[2],
|
||||
a = _ref2[3];
|
||||
|
||||
this.r = r;
|
||||
this.g = g;
|
||||
this.b = b;
|
||||
this.a = a;
|
||||
}
|
||||
|
||||
_createClass(Color, [{
|
||||
key: 'isTransparent',
|
||||
value: function isTransparent() {
|
||||
return this.a === 0;
|
||||
}
|
||||
}, {
|
||||
key: 'toString',
|
||||
value: function toString() {
|
||||
return this.a !== null && this.a !== 1 ? 'rgba(' + this.r + ',' + this.g + ',' + this.b + ',' + this.a + ')' : 'rgb(' + this.r + ',' + this.g + ',' + this.b + ')';
|
||||
}
|
||||
}]);
|
||||
|
||||
return Color;
|
||||
}();
|
||||
|
||||
exports.default = Color;
|
||||
|
||||
|
||||
var NAMED_COLORS = {
|
||||
transparent: [0, 0, 0, 0],
|
||||
aliceblue: [240, 248, 255, null],
|
||||
antiquewhite: [250, 235, 215, null],
|
||||
aqua: [0, 255, 255, null],
|
||||
aquamarine: [127, 255, 212, null],
|
||||
azure: [240, 255, 255, null],
|
||||
beige: [245, 245, 220, null],
|
||||
bisque: [255, 228, 196, null],
|
||||
black: [0, 0, 0, null],
|
||||
blanchedalmond: [255, 235, 205, null],
|
||||
blue: [0, 0, 255, null],
|
||||
blueviolet: [138, 43, 226, null],
|
||||
brown: [165, 42, 42, null],
|
||||
burlywood: [222, 184, 135, null],
|
||||
cadetblue: [95, 158, 160, null],
|
||||
chartreuse: [127, 255, 0, null],
|
||||
chocolate: [210, 105, 30, null],
|
||||
coral: [255, 127, 80, null],
|
||||
cornflowerblue: [100, 149, 237, null],
|
||||
cornsilk: [255, 248, 220, null],
|
||||
crimson: [220, 20, 60, null],
|
||||
cyan: [0, 255, 255, null],
|
||||
darkblue: [0, 0, 139, null],
|
||||
darkcyan: [0, 139, 139, null],
|
||||
darkgoldenrod: [184, 134, 11, null],
|
||||
darkgray: [169, 169, 169, null],
|
||||
darkgreen: [0, 100, 0, null],
|
||||
darkgrey: [169, 169, 169, null],
|
||||
darkkhaki: [189, 183, 107, null],
|
||||
darkmagenta: [139, 0, 139, null],
|
||||
darkolivegreen: [85, 107, 47, null],
|
||||
darkorange: [255, 140, 0, null],
|
||||
darkorchid: [153, 50, 204, null],
|
||||
darkred: [139, 0, 0, null],
|
||||
darksalmon: [233, 150, 122, null],
|
||||
darkseagreen: [143, 188, 143, null],
|
||||
darkslateblue: [72, 61, 139, null],
|
||||
darkslategray: [47, 79, 79, null],
|
||||
darkslategrey: [47, 79, 79, null],
|
||||
darkturquoise: [0, 206, 209, null],
|
||||
darkviolet: [148, 0, 211, null],
|
||||
deeppink: [255, 20, 147, null],
|
||||
deepskyblue: [0, 191, 255, null],
|
||||
dimgray: [105, 105, 105, null],
|
||||
dimgrey: [105, 105, 105, null],
|
||||
dodgerblue: [30, 144, 255, null],
|
||||
firebrick: [178, 34, 34, null],
|
||||
floralwhite: [255, 250, 240, null],
|
||||
forestgreen: [34, 139, 34, null],
|
||||
fuchsia: [255, 0, 255, null],
|
||||
gainsboro: [220, 220, 220, null],
|
||||
ghostwhite: [248, 248, 255, null],
|
||||
gold: [255, 215, 0, null],
|
||||
goldenrod: [218, 165, 32, null],
|
||||
gray: [128, 128, 128, null],
|
||||
green: [0, 128, 0, null],
|
||||
greenyellow: [173, 255, 47, null],
|
||||
grey: [128, 128, 128, null],
|
||||
honeydew: [240, 255, 240, null],
|
||||
hotpink: [255, 105, 180, null],
|
||||
indianred: [205, 92, 92, null],
|
||||
indigo: [75, 0, 130, null],
|
||||
ivory: [255, 255, 240, null],
|
||||
khaki: [240, 230, 140, null],
|
||||
lavender: [230, 230, 250, null],
|
||||
lavenderblush: [255, 240, 245, null],
|
||||
lawngreen: [124, 252, 0, null],
|
||||
lemonchiffon: [255, 250, 205, null],
|
||||
lightblue: [173, 216, 230, null],
|
||||
lightcoral: [240, 128, 128, null],
|
||||
lightcyan: [224, 255, 255, null],
|
||||
lightgoldenrodyellow: [250, 250, 210, null],
|
||||
lightgray: [211, 211, 211, null],
|
||||
lightgreen: [144, 238, 144, null],
|
||||
lightgrey: [211, 211, 211, null],
|
||||
lightpink: [255, 182, 193, null],
|
||||
lightsalmon: [255, 160, 122, null],
|
||||
lightseagreen: [32, 178, 170, null],
|
||||
lightskyblue: [135, 206, 250, null],
|
||||
lightslategray: [119, 136, 153, null],
|
||||
lightslategrey: [119, 136, 153, null],
|
||||
lightsteelblue: [176, 196, 222, null],
|
||||
lightyellow: [255, 255, 224, null],
|
||||
lime: [0, 255, 0, null],
|
||||
limegreen: [50, 205, 50, null],
|
||||
linen: [250, 240, 230, null],
|
||||
magenta: [255, 0, 255, null],
|
||||
maroon: [128, 0, 0, null],
|
||||
mediumaquamarine: [102, 205, 170, null],
|
||||
mediumblue: [0, 0, 205, null],
|
||||
mediumorchid: [186, 85, 211, null],
|
||||
mediumpurple: [147, 112, 219, null],
|
||||
mediumseagreen: [60, 179, 113, null],
|
||||
mediumslateblue: [123, 104, 238, null],
|
||||
mediumspringgreen: [0, 250, 154, null],
|
||||
mediumturquoise: [72, 209, 204, null],
|
||||
mediumvioletred: [199, 21, 133, null],
|
||||
midnightblue: [25, 25, 112, null],
|
||||
mintcream: [245, 255, 250, null],
|
||||
mistyrose: [255, 228, 225, null],
|
||||
moccasin: [255, 228, 181, null],
|
||||
navajowhite: [255, 222, 173, null],
|
||||
navy: [0, 0, 128, null],
|
||||
oldlace: [253, 245, 230, null],
|
||||
olive: [128, 128, 0, null],
|
||||
olivedrab: [107, 142, 35, null],
|
||||
orange: [255, 165, 0, null],
|
||||
orangered: [255, 69, 0, null],
|
||||
orchid: [218, 112, 214, null],
|
||||
palegoldenrod: [238, 232, 170, null],
|
||||
palegreen: [152, 251, 152, null],
|
||||
paleturquoise: [175, 238, 238, null],
|
||||
palevioletred: [219, 112, 147, null],
|
||||
papayawhip: [255, 239, 213, null],
|
||||
peachpuff: [255, 218, 185, null],
|
||||
peru: [205, 133, 63, null],
|
||||
pink: [255, 192, 203, null],
|
||||
plum: [221, 160, 221, null],
|
||||
powderblue: [176, 224, 230, null],
|
||||
purple: [128, 0, 128, null],
|
||||
rebeccapurple: [102, 51, 153, null],
|
||||
red: [255, 0, 0, null],
|
||||
rosybrown: [188, 143, 143, null],
|
||||
royalblue: [65, 105, 225, null],
|
||||
saddlebrown: [139, 69, 19, null],
|
||||
salmon: [250, 128, 114, null],
|
||||
sandybrown: [244, 164, 96, null],
|
||||
seagreen: [46, 139, 87, null],
|
||||
seashell: [255, 245, 238, null],
|
||||
sienna: [160, 82, 45, null],
|
||||
silver: [192, 192, 192, null],
|
||||
skyblue: [135, 206, 235, null],
|
||||
slateblue: [106, 90, 205, null],
|
||||
slategray: [112, 128, 144, null],
|
||||
slategrey: [112, 128, 144, null],
|
||||
snow: [255, 250, 250, null],
|
||||
springgreen: [0, 255, 127, null],
|
||||
steelblue: [70, 130, 180, null],
|
||||
tan: [210, 180, 140, null],
|
||||
teal: [0, 128, 128, null],
|
||||
thistle: [216, 191, 216, null],
|
||||
tomato: [255, 99, 71, null],
|
||||
turquoise: [64, 224, 208, null],
|
||||
violet: [238, 130, 238, null],
|
||||
wheat: [245, 222, 179, null],
|
||||
white: [255, 255, 255, null],
|
||||
whitesmoke: [245, 245, 245, null],
|
||||
yellow: [255, 255, 0, null],
|
||||
yellowgreen: [154, 205, 50, null]
|
||||
};
|
||||
|
||||
var TRANSPARENT = exports.TRANSPARENT = new Color([0, 0, 0, 0]);
|
193
AstuteClient2/src/assets/html2canvas/dist/npm/Feature.js
vendored
Normal file
193
AstuteClient2/src/assets/html2canvas/dist/npm/Feature.js
vendored
Normal file
|
@ -0,0 +1,193 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _ForeignObjectRenderer = require('./renderer/ForeignObjectRenderer');
|
||||
|
||||
var testRangeBounds = function testRangeBounds(document) {
|
||||
var TEST_HEIGHT = 123;
|
||||
|
||||
if (document.createRange) {
|
||||
var range = document.createRange();
|
||||
if (range.getBoundingClientRect) {
|
||||
var testElement = document.createElement('boundtest');
|
||||
testElement.style.height = TEST_HEIGHT + 'px';
|
||||
testElement.style.display = 'block';
|
||||
document.body.appendChild(testElement);
|
||||
|
||||
range.selectNode(testElement);
|
||||
var rangeBounds = range.getBoundingClientRect();
|
||||
var rangeHeight = Math.round(rangeBounds.height);
|
||||
document.body.removeChild(testElement);
|
||||
if (rangeHeight === TEST_HEIGHT) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
// iOS 10.3 taints canvas with base64 images unless crossOrigin = 'anonymous'
|
||||
var testBase64 = function testBase64(document, src) {
|
||||
var img = new Image();
|
||||
var canvas = document.createElement('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
// Single pixel base64 image renders fine on iOS 10.3???
|
||||
img.src = src;
|
||||
|
||||
var onload = function onload() {
|
||||
try {
|
||||
ctx.drawImage(img, 0, 0);
|
||||
canvas.toDataURL();
|
||||
} catch (e) {
|
||||
return resolve(false);
|
||||
}
|
||||
|
||||
return resolve(true);
|
||||
};
|
||||
|
||||
img.onload = onload;
|
||||
img.onerror = function () {
|
||||
return resolve(false);
|
||||
};
|
||||
|
||||
if (img.complete === true) {
|
||||
setTimeout(function () {
|
||||
onload();
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var testCORS = function testCORS() {
|
||||
return typeof new Image().crossOrigin !== 'undefined';
|
||||
};
|
||||
|
||||
var testResponseType = function testResponseType() {
|
||||
return typeof new XMLHttpRequest().responseType === 'string';
|
||||
};
|
||||
|
||||
var testSVG = function testSVG(document) {
|
||||
var img = new Image();
|
||||
var canvas = document.createElement('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
img.src = 'data:image/svg+xml,<svg xmlns=\'http://www.w3.org/2000/svg\'></svg>';
|
||||
|
||||
try {
|
||||
ctx.drawImage(img, 0, 0);
|
||||
canvas.toDataURL();
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
var isGreenPixel = function isGreenPixel(data) {
|
||||
return data[0] === 0 && data[1] === 255 && data[2] === 0 && data[3] === 255;
|
||||
};
|
||||
|
||||
var testForeignObject = function testForeignObject(document) {
|
||||
var canvas = document.createElement('canvas');
|
||||
var size = 100;
|
||||
canvas.width = size;
|
||||
canvas.height = size;
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = 'rgb(0, 255, 0)';
|
||||
ctx.fillRect(0, 0, size, size);
|
||||
|
||||
var img = new Image();
|
||||
var greenImageSrc = canvas.toDataURL();
|
||||
img.src = greenImageSrc;
|
||||
var svg = (0, _ForeignObjectRenderer.createForeignObjectSVG)(size, size, 0, 0, img);
|
||||
ctx.fillStyle = 'red';
|
||||
ctx.fillRect(0, 0, size, size);
|
||||
|
||||
return (0, _ForeignObjectRenderer.loadSerializedSVG)(svg).then(function (img) {
|
||||
ctx.drawImage(img, 0, 0);
|
||||
var data = ctx.getImageData(0, 0, size, size).data;
|
||||
ctx.fillStyle = 'red';
|
||||
ctx.fillRect(0, 0, size, size);
|
||||
|
||||
var node = document.createElement('div');
|
||||
node.style.backgroundImage = 'url(' + greenImageSrc + ')';
|
||||
node.style.height = size + 'px';
|
||||
// Firefox 55 does not render inline <img /> tags
|
||||
return isGreenPixel(data) ? (0, _ForeignObjectRenderer.loadSerializedSVG)((0, _ForeignObjectRenderer.createForeignObjectSVG)(size, size, 0, 0, node)) : Promise.reject(false);
|
||||
}).then(function (img) {
|
||||
ctx.drawImage(img, 0, 0);
|
||||
// Edge does not render background-images
|
||||
return isGreenPixel(ctx.getImageData(0, 0, size, size).data);
|
||||
}).catch(function (e) {
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
var FEATURES = {
|
||||
// $FlowFixMe - get/set properties not yet supported
|
||||
get SUPPORT_RANGE_BOUNDS() {
|
||||
'use strict';
|
||||
|
||||
var value = testRangeBounds(document);
|
||||
Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value });
|
||||
return value;
|
||||
},
|
||||
// $FlowFixMe - get/set properties not yet supported
|
||||
get SUPPORT_SVG_DRAWING() {
|
||||
'use strict';
|
||||
|
||||
var value = testSVG(document);
|
||||
Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });
|
||||
return value;
|
||||
},
|
||||
// $FlowFixMe - get/set properties not yet supported
|
||||
get SUPPORT_BASE64_DRAWING() {
|
||||
'use strict';
|
||||
|
||||
return function (src) {
|
||||
var _value = testBase64(document, src);
|
||||
Object.defineProperty(FEATURES, 'SUPPORT_BASE64_DRAWING', { value: function value() {
|
||||
return _value;
|
||||
} });
|
||||
return _value;
|
||||
};
|
||||
},
|
||||
// $FlowFixMe - get/set properties not yet supported
|
||||
get SUPPORT_FOREIGNOBJECT_DRAWING() {
|
||||
'use strict';
|
||||
|
||||
var value = typeof Array.from === 'function' && typeof window.fetch === 'function' ? testForeignObject(document) : Promise.resolve(false);
|
||||
Object.defineProperty(FEATURES, 'SUPPORT_FOREIGNOBJECT_DRAWING', { value: value });
|
||||
return value;
|
||||
},
|
||||
// $FlowFixMe - get/set properties not yet supported
|
||||
get SUPPORT_CORS_IMAGES() {
|
||||
'use strict';
|
||||
|
||||
var value = testCORS();
|
||||
Object.defineProperty(FEATURES, 'SUPPORT_CORS_IMAGES', { value: value });
|
||||
return value;
|
||||
},
|
||||
// $FlowFixMe - get/set properties not yet supported
|
||||
get SUPPORT_RESPONSE_TYPE() {
|
||||
'use strict';
|
||||
|
||||
var value = testResponseType();
|
||||
Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value });
|
||||
return value;
|
||||
},
|
||||
// $FlowFixMe - get/set properties not yet supported
|
||||
get SUPPORT_CORS_XHR() {
|
||||
'use strict';
|
||||
|
||||
var value = 'withCredentials' in new XMLHttpRequest();
|
||||
Object.defineProperty(FEATURES, 'SUPPORT_CORS_XHR', { value: value });
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = FEATURES;
|
87
AstuteClient2/src/assets/html2canvas/dist/npm/Font.js
vendored
Normal file
87
AstuteClient2/src/assets/html2canvas/dist/npm/Font.js
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.FontMetrics = undefined;
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _Util = require('./Util');
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var SAMPLE_TEXT = 'Hidden Text';
|
||||
|
||||
var FontMetrics = exports.FontMetrics = function () {
|
||||
function FontMetrics(document) {
|
||||
_classCallCheck(this, FontMetrics);
|
||||
|
||||
this._data = {};
|
||||
this._document = document;
|
||||
}
|
||||
|
||||
_createClass(FontMetrics, [{
|
||||
key: '_parseMetrics',
|
||||
value: function _parseMetrics(font) {
|
||||
var container = this._document.createElement('div');
|
||||
var img = this._document.createElement('img');
|
||||
var span = this._document.createElement('span');
|
||||
|
||||
var body = this._document.body;
|
||||
if (!body) {
|
||||
throw new Error(process.env.NODE_ENV !== 'production' ? 'No document found for font metrics' : '');
|
||||
}
|
||||
|
||||
container.style.visibility = 'hidden';
|
||||
container.style.fontFamily = font.fontFamily;
|
||||
container.style.fontSize = font.fontSize;
|
||||
container.style.margin = '0';
|
||||
container.style.padding = '0';
|
||||
|
||||
body.appendChild(container);
|
||||
|
||||
img.src = _Util.SMALL_IMAGE;
|
||||
img.width = 1;
|
||||
img.height = 1;
|
||||
|
||||
img.style.margin = '0';
|
||||
img.style.padding = '0';
|
||||
img.style.verticalAlign = 'baseline';
|
||||
|
||||
span.style.fontFamily = font.fontFamily;
|
||||
span.style.fontSize = font.fontSize;
|
||||
span.style.margin = '0';
|
||||
span.style.padding = '0';
|
||||
|
||||
span.appendChild(this._document.createTextNode(SAMPLE_TEXT));
|
||||
container.appendChild(span);
|
||||
container.appendChild(img);
|
||||
var baseline = img.offsetTop - span.offsetTop + 2;
|
||||
|
||||
container.removeChild(span);
|
||||
container.appendChild(this._document.createTextNode(SAMPLE_TEXT));
|
||||
|
||||
container.style.lineHeight = 'normal';
|
||||
img.style.verticalAlign = 'super';
|
||||
|
||||
var middle = img.offsetTop - container.offsetTop + 2;
|
||||
|
||||
body.removeChild(container);
|
||||
|
||||
return { baseline: baseline, middle: middle };
|
||||
}
|
||||
}, {
|
||||
key: 'getMetrics',
|
||||
value: function getMetrics(font) {
|
||||
var key = font.fontFamily + ' ' + font.fontSize;
|
||||
if (this._data[key] === undefined) {
|
||||
this._data[key] = this._parseMetrics(font);
|
||||
}
|
||||
|
||||
return this._data[key];
|
||||
}
|
||||
}]);
|
||||
|
||||
return FontMetrics;
|
||||
}();
|
447
AstuteClient2/src/assets/html2canvas/dist/npm/Gradient.js
vendored
Normal file
447
AstuteClient2/src/assets/html2canvas/dist/npm/Gradient.js
vendored
Normal file
|
@ -0,0 +1,447 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.transformWebkitRadialGradientArgs = exports.parseGradient = exports.RadialGradient = exports.LinearGradient = exports.RADIAL_GRADIENT_SHAPE = exports.GRADIENT_TYPE = undefined;
|
||||
|
||||
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"); } }; }();
|
||||
|
||||
var _NodeContainer = require('./NodeContainer');
|
||||
|
||||
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
||||
|
||||
var _Angle = require('./Angle');
|
||||
|
||||
var _Color = require('./Color');
|
||||
|
||||
var _Color2 = _interopRequireDefault(_Color);
|
||||
|
||||
var _Length = require('./Length');
|
||||
|
||||
var _Length2 = _interopRequireDefault(_Length);
|
||||
|
||||
var _Util = require('./Util');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var SIDE_OR_CORNER = /^(to )?(left|top|right|bottom)( (left|top|right|bottom))?$/i;
|
||||
var PERCENTAGE_ANGLES = /^([+-]?\d*\.?\d+)% ([+-]?\d*\.?\d+)%$/i;
|
||||
var ENDS_WITH_LENGTH = /(px)|%|( 0)$/i;
|
||||
var FROM_TO_COLORSTOP = /^(from|to|color-stop)\((?:([\d.]+)(%)?,\s*)?(.+?)\)$/i;
|
||||
var RADIAL_SHAPE_DEFINITION = /^\s*(circle|ellipse)?\s*((?:([\d.]+)(px|r?em|%)\s*(?:([\d.]+)(px|r?em|%))?)|closest-side|closest-corner|farthest-side|farthest-corner)?\s*(?:at\s*(?:(left|center|right)|([\d.]+)(px|r?em|%))\s+(?:(top|center|bottom)|([\d.]+)(px|r?em|%)))?(?:\s|$)/i;
|
||||
|
||||
var GRADIENT_TYPE = exports.GRADIENT_TYPE = {
|
||||
LINEAR_GRADIENT: 0,
|
||||
RADIAL_GRADIENT: 1
|
||||
};
|
||||
|
||||
var RADIAL_GRADIENT_SHAPE = exports.RADIAL_GRADIENT_SHAPE = {
|
||||
CIRCLE: 0,
|
||||
ELLIPSE: 1
|
||||
};
|
||||
|
||||
var LENGTH_FOR_POSITION = {
|
||||
left: new _Length2.default('0%'),
|
||||
top: new _Length2.default('0%'),
|
||||
center: new _Length2.default('50%'),
|
||||
right: new _Length2.default('100%'),
|
||||
bottom: new _Length2.default('100%')
|
||||
};
|
||||
|
||||
var LinearGradient = exports.LinearGradient = function LinearGradient(colorStops, direction) {
|
||||
_classCallCheck(this, LinearGradient);
|
||||
|
||||
this.type = GRADIENT_TYPE.LINEAR_GRADIENT;
|
||||
this.colorStops = colorStops;
|
||||
this.direction = direction;
|
||||
};
|
||||
|
||||
var RadialGradient = exports.RadialGradient = function RadialGradient(colorStops, shape, center, radius) {
|
||||
_classCallCheck(this, RadialGradient);
|
||||
|
||||
this.type = GRADIENT_TYPE.RADIAL_GRADIENT;
|
||||
this.colorStops = colorStops;
|
||||
this.shape = shape;
|
||||
this.center = center;
|
||||
this.radius = radius;
|
||||
};
|
||||
|
||||
var parseGradient = exports.parseGradient = function parseGradient(container, _ref, bounds) {
|
||||
var args = _ref.args,
|
||||
method = _ref.method,
|
||||
prefix = _ref.prefix;
|
||||
|
||||
if (method === 'linear-gradient') {
|
||||
return parseLinearGradient(args, bounds, !!prefix);
|
||||
} else if (method === 'gradient' && args[0] === 'linear') {
|
||||
// TODO handle correct angle
|
||||
return parseLinearGradient(['to bottom'].concat(transformObsoleteColorStops(args.slice(3))), bounds, !!prefix);
|
||||
} else if (method === 'radial-gradient') {
|
||||
return parseRadialGradient(container, prefix === '-webkit-' ? transformWebkitRadialGradientArgs(args) : args, bounds);
|
||||
} else if (method === 'gradient' && args[0] === 'radial') {
|
||||
return parseRadialGradient(container, transformObsoleteColorStops(transformWebkitRadialGradientArgs(args.slice(1))), bounds);
|
||||
}
|
||||
};
|
||||
|
||||
var parseColorStops = function parseColorStops(args, firstColorStopIndex, lineLength) {
|
||||
var colorStops = [];
|
||||
|
||||
for (var i = firstColorStopIndex; i < args.length; i++) {
|
||||
var value = args[i];
|
||||
var HAS_LENGTH = ENDS_WITH_LENGTH.test(value);
|
||||
var lastSpaceIndex = value.lastIndexOf(' ');
|
||||
var _color = new _Color2.default(HAS_LENGTH ? value.substring(0, lastSpaceIndex) : value);
|
||||
var _stop = HAS_LENGTH ? new _Length2.default(value.substring(lastSpaceIndex + 1)) : i === firstColorStopIndex ? new _Length2.default('0%') : i === args.length - 1 ? new _Length2.default('100%') : null;
|
||||
colorStops.push({ color: _color, stop: _stop });
|
||||
}
|
||||
|
||||
var absoluteValuedColorStops = colorStops.map(function (_ref2) {
|
||||
var color = _ref2.color,
|
||||
stop = _ref2.stop;
|
||||
|
||||
var absoluteStop = lineLength === 0 ? 0 : stop ? stop.getAbsoluteValue(lineLength) / lineLength : null;
|
||||
|
||||
return {
|
||||
color: color,
|
||||
// $FlowFixMe
|
||||
stop: absoluteStop
|
||||
};
|
||||
});
|
||||
|
||||
var previousColorStop = absoluteValuedColorStops[0].stop;
|
||||
for (var _i = 0; _i < absoluteValuedColorStops.length; _i++) {
|
||||
if (previousColorStop !== null) {
|
||||
var _stop2 = absoluteValuedColorStops[_i].stop;
|
||||
if (_stop2 === null) {
|
||||
var n = _i;
|
||||
while (absoluteValuedColorStops[n].stop === null) {
|
||||
n++;
|
||||
}
|
||||
var steps = n - _i + 1;
|
||||
var nextColorStep = absoluteValuedColorStops[n].stop;
|
||||
var stepSize = (nextColorStep - previousColorStop) / steps;
|
||||
for (; _i < n; _i++) {
|
||||
previousColorStop = absoluteValuedColorStops[_i].stop = previousColorStop + stepSize;
|
||||
}
|
||||
} else {
|
||||
previousColorStop = _stop2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return absoluteValuedColorStops;
|
||||
};
|
||||
|
||||
var parseLinearGradient = function parseLinearGradient(args, bounds, hasPrefix) {
|
||||
var angle = (0, _Angle.parseAngle)(args[0]);
|
||||
var HAS_SIDE_OR_CORNER = SIDE_OR_CORNER.test(args[0]);
|
||||
var HAS_DIRECTION = HAS_SIDE_OR_CORNER || angle !== null || PERCENTAGE_ANGLES.test(args[0]);
|
||||
var direction = HAS_DIRECTION ? angle !== null ? calculateGradientDirection(
|
||||
// if there is a prefix, the 0° angle points due East (instead of North per W3C)
|
||||
hasPrefix ? angle - Math.PI * 0.5 : angle, bounds) : HAS_SIDE_OR_CORNER ? parseSideOrCorner(args[0], bounds) : parsePercentageAngle(args[0], bounds) : calculateGradientDirection(Math.PI, bounds);
|
||||
var firstColorStopIndex = HAS_DIRECTION ? 1 : 0;
|
||||
|
||||
// TODO: Fix some inaccuracy with color stops with px values
|
||||
var lineLength = Math.min((0, _Util.distance)(Math.abs(direction.x0) + Math.abs(direction.x1), Math.abs(direction.y0) + Math.abs(direction.y1)), bounds.width * 2, bounds.height * 2);
|
||||
|
||||
return new LinearGradient(parseColorStops(args, firstColorStopIndex, lineLength), direction);
|
||||
};
|
||||
|
||||
var parseRadialGradient = function parseRadialGradient(container, args, bounds) {
|
||||
var m = args[0].match(RADIAL_SHAPE_DEFINITION);
|
||||
var shape = m && (m[1] === 'circle' || // explicit shape specification
|
||||
m[3] !== undefined && m[5] === undefined) // only one radius coordinate
|
||||
? RADIAL_GRADIENT_SHAPE.CIRCLE : RADIAL_GRADIENT_SHAPE.ELLIPSE;
|
||||
var radius = {};
|
||||
var center = {};
|
||||
|
||||
if (m) {
|
||||
// Radius
|
||||
if (m[3] !== undefined) {
|
||||
radius.x = (0, _Length.calculateLengthFromValueWithUnit)(container, m[3], m[4]).getAbsoluteValue(bounds.width);
|
||||
}
|
||||
|
||||
if (m[5] !== undefined) {
|
||||
radius.y = (0, _Length.calculateLengthFromValueWithUnit)(container, m[5], m[6]).getAbsoluteValue(bounds.height);
|
||||
}
|
||||
|
||||
// Position
|
||||
if (m[7]) {
|
||||
center.x = LENGTH_FOR_POSITION[m[7].toLowerCase()];
|
||||
} else if (m[8] !== undefined) {
|
||||
center.x = (0, _Length.calculateLengthFromValueWithUnit)(container, m[8], m[9]);
|
||||
}
|
||||
|
||||
if (m[10]) {
|
||||
center.y = LENGTH_FOR_POSITION[m[10].toLowerCase()];
|
||||
} else if (m[11] !== undefined) {
|
||||
center.y = (0, _Length.calculateLengthFromValueWithUnit)(container, m[11], m[12]);
|
||||
}
|
||||
}
|
||||
|
||||
var gradientCenter = {
|
||||
x: center.x === undefined ? bounds.width / 2 : center.x.getAbsoluteValue(bounds.width),
|
||||
y: center.y === undefined ? bounds.height / 2 : center.y.getAbsoluteValue(bounds.height)
|
||||
};
|
||||
var gradientRadius = calculateRadius(m && m[2] || 'farthest-corner', shape, gradientCenter, radius, bounds);
|
||||
|
||||
return new RadialGradient(parseColorStops(args, m ? 1 : 0, Math.min(gradientRadius.x, gradientRadius.y)), shape, gradientCenter, gradientRadius);
|
||||
};
|
||||
|
||||
var calculateGradientDirection = function calculateGradientDirection(radian, bounds) {
|
||||
var width = bounds.width;
|
||||
var height = bounds.height;
|
||||
var HALF_WIDTH = width * 0.5;
|
||||
var HALF_HEIGHT = height * 0.5;
|
||||
var lineLength = Math.abs(width * Math.sin(radian)) + Math.abs(height * Math.cos(radian));
|
||||
var HALF_LINE_LENGTH = lineLength / 2;
|
||||
|
||||
var x0 = HALF_WIDTH + Math.sin(radian) * HALF_LINE_LENGTH;
|
||||
var y0 = HALF_HEIGHT - Math.cos(radian) * HALF_LINE_LENGTH;
|
||||
var x1 = width - x0;
|
||||
var y1 = height - y0;
|
||||
|
||||
return { x0: x0, x1: x1, y0: y0, y1: y1 };
|
||||
};
|
||||
|
||||
var parseTopRight = function parseTopRight(bounds) {
|
||||
return Math.acos(bounds.width / 2 / ((0, _Util.distance)(bounds.width, bounds.height) / 2));
|
||||
};
|
||||
|
||||
var parseSideOrCorner = function parseSideOrCorner(side, bounds) {
|
||||
switch (side) {
|
||||
case 'bottom':
|
||||
case 'to top':
|
||||
return calculateGradientDirection(0, bounds);
|
||||
case 'left':
|
||||
case 'to right':
|
||||
return calculateGradientDirection(Math.PI / 2, bounds);
|
||||
case 'right':
|
||||
case 'to left':
|
||||
return calculateGradientDirection(3 * Math.PI / 2, bounds);
|
||||
case 'top right':
|
||||
case 'right top':
|
||||
case 'to bottom left':
|
||||
case 'to left bottom':
|
||||
return calculateGradientDirection(Math.PI + parseTopRight(bounds), bounds);
|
||||
case 'top left':
|
||||
case 'left top':
|
||||
case 'to bottom right':
|
||||
case 'to right bottom':
|
||||
return calculateGradientDirection(Math.PI - parseTopRight(bounds), bounds);
|
||||
case 'bottom left':
|
||||
case 'left bottom':
|
||||
case 'to top right':
|
||||
case 'to right top':
|
||||
return calculateGradientDirection(parseTopRight(bounds), bounds);
|
||||
case 'bottom right':
|
||||
case 'right bottom':
|
||||
case 'to top left':
|
||||
case 'to left top':
|
||||
return calculateGradientDirection(2 * Math.PI - parseTopRight(bounds), bounds);
|
||||
case 'top':
|
||||
case 'to bottom':
|
||||
default:
|
||||
return calculateGradientDirection(Math.PI, bounds);
|
||||
}
|
||||
};
|
||||
|
||||
var parsePercentageAngle = function parsePercentageAngle(angle, bounds) {
|
||||
var _angle$split$map = angle.split(' ').map(parseFloat),
|
||||
_angle$split$map2 = _slicedToArray(_angle$split$map, 2),
|
||||
left = _angle$split$map2[0],
|
||||
top = _angle$split$map2[1];
|
||||
|
||||
var ratio = left / 100 * bounds.width / (top / 100 * bounds.height);
|
||||
|
||||
return calculateGradientDirection(Math.atan(isNaN(ratio) ? 1 : ratio) + Math.PI / 2, bounds);
|
||||
};
|
||||
|
||||
var findCorner = function findCorner(bounds, x, y, closest) {
|
||||
var corners = [{ x: 0, y: 0 }, { x: 0, y: bounds.height }, { x: bounds.width, y: 0 }, { x: bounds.width, y: bounds.height }];
|
||||
|
||||
// $FlowFixMe
|
||||
return corners.reduce(function (stat, corner) {
|
||||
var d = (0, _Util.distance)(x - corner.x, y - corner.y);
|
||||
if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) {
|
||||
return {
|
||||
optimumCorner: corner,
|
||||
optimumDistance: d
|
||||
};
|
||||
}
|
||||
|
||||
return stat;
|
||||
}, {
|
||||
optimumDistance: closest ? Infinity : -Infinity,
|
||||
optimumCorner: null
|
||||
}).optimumCorner;
|
||||
};
|
||||
|
||||
var calculateRadius = function calculateRadius(extent, shape, center, radius, bounds) {
|
||||
var x = center.x;
|
||||
var y = center.y;
|
||||
var rx = 0;
|
||||
var ry = 0;
|
||||
|
||||
switch (extent) {
|
||||
case 'closest-side':
|
||||
// The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center.
|
||||
// If the shape is an ellipse, it exactly meets the closest side in each dimension.
|
||||
if (shape === RADIAL_GRADIENT_SHAPE.CIRCLE) {
|
||||
rx = ry = Math.min(Math.abs(x), Math.abs(x - bounds.width), Math.abs(y), Math.abs(y - bounds.height));
|
||||
} else if (shape === RADIAL_GRADIENT_SHAPE.ELLIPSE) {
|
||||
rx = Math.min(Math.abs(x), Math.abs(x - bounds.width));
|
||||
ry = Math.min(Math.abs(y), Math.abs(y - bounds.height));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'closest-corner':
|
||||
// The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center.
|
||||
// If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified.
|
||||
if (shape === RADIAL_GRADIENT_SHAPE.CIRCLE) {
|
||||
rx = ry = Math.min((0, _Util.distance)(x, y), (0, _Util.distance)(x, y - bounds.height), (0, _Util.distance)(x - bounds.width, y), (0, _Util.distance)(x - bounds.width, y - bounds.height));
|
||||
} else if (shape === RADIAL_GRADIENT_SHAPE.ELLIPSE) {
|
||||
// Compute the ratio ry/rx (which is to be the same as for "closest-side")
|
||||
var c = Math.min(Math.abs(y), Math.abs(y - bounds.height)) / Math.min(Math.abs(x), Math.abs(x - bounds.width));
|
||||
var corner = findCorner(bounds, x, y, true);
|
||||
rx = (0, _Util.distance)(corner.x - x, (corner.y - y) / c);
|
||||
ry = c * rx;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'farthest-side':
|
||||
// Same as closest-side, except the ending shape is sized based on the farthest side(s)
|
||||
if (shape === RADIAL_GRADIENT_SHAPE.CIRCLE) {
|
||||
rx = ry = Math.max(Math.abs(x), Math.abs(x - bounds.width), Math.abs(y), Math.abs(y - bounds.height));
|
||||
} else if (shape === RADIAL_GRADIENT_SHAPE.ELLIPSE) {
|
||||
rx = Math.max(Math.abs(x), Math.abs(x - bounds.width));
|
||||
ry = Math.max(Math.abs(y), Math.abs(y - bounds.height));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'farthest-corner':
|
||||
// Same as closest-corner, except the ending shape is sized based on the farthest corner.
|
||||
// If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified.
|
||||
if (shape === RADIAL_GRADIENT_SHAPE.CIRCLE) {
|
||||
rx = ry = Math.max((0, _Util.distance)(x, y), (0, _Util.distance)(x, y - bounds.height), (0, _Util.distance)(x - bounds.width, y), (0, _Util.distance)(x - bounds.width, y - bounds.height));
|
||||
} else if (shape === RADIAL_GRADIENT_SHAPE.ELLIPSE) {
|
||||
// Compute the ratio ry/rx (which is to be the same as for "farthest-side")
|
||||
var _c = Math.max(Math.abs(y), Math.abs(y - bounds.height)) / Math.max(Math.abs(x), Math.abs(x - bounds.width));
|
||||
var _corner = findCorner(bounds, x, y, false);
|
||||
rx = (0, _Util.distance)(_corner.x - x, (_corner.y - y) / _c);
|
||||
ry = _c * rx;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// pixel or percentage values
|
||||
rx = radius.x || 0;
|
||||
ry = radius.y !== undefined ? radius.y : rx;
|
||||
break;
|
||||
}
|
||||
|
||||
return {
|
||||
x: rx,
|
||||
y: ry
|
||||
};
|
||||
};
|
||||
|
||||
var transformWebkitRadialGradientArgs = exports.transformWebkitRadialGradientArgs = function transformWebkitRadialGradientArgs(args) {
|
||||
var shape = '';
|
||||
var radius = '';
|
||||
var extent = '';
|
||||
var position = '';
|
||||
var idx = 0;
|
||||
|
||||
var POSITION = /^(left|center|right|\d+(?:px|r?em|%)?)(?:\s+(top|center|bottom|\d+(?:px|r?em|%)?))?$/i;
|
||||
var SHAPE_AND_EXTENT = /^(circle|ellipse)?\s*(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)?$/i;
|
||||
var RADIUS = /^\d+(px|r?em|%)?(?:\s+\d+(px|r?em|%)?)?$/i;
|
||||
|
||||
var matchStartPosition = args[idx].match(POSITION);
|
||||
if (matchStartPosition) {
|
||||
idx++;
|
||||
}
|
||||
|
||||
var matchShapeExtent = args[idx].match(SHAPE_AND_EXTENT);
|
||||
if (matchShapeExtent) {
|
||||
shape = matchShapeExtent[1] || '';
|
||||
extent = matchShapeExtent[2] || '';
|
||||
if (extent === 'contain') {
|
||||
extent = 'closest-side';
|
||||
} else if (extent === 'cover') {
|
||||
extent = 'farthest-corner';
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
var matchStartRadius = args[idx].match(RADIUS);
|
||||
if (matchStartRadius) {
|
||||
idx++;
|
||||
}
|
||||
|
||||
var matchEndPosition = args[idx].match(POSITION);
|
||||
if (matchEndPosition) {
|
||||
idx++;
|
||||
}
|
||||
|
||||
var matchEndRadius = args[idx].match(RADIUS);
|
||||
if (matchEndRadius) {
|
||||
idx++;
|
||||
}
|
||||
|
||||
var matchPosition = matchEndPosition || matchStartPosition;
|
||||
if (matchPosition && matchPosition[1]) {
|
||||
position = matchPosition[1] + (/^\d+$/.test(matchPosition[1]) ? 'px' : '');
|
||||
if (matchPosition[2]) {
|
||||
position += ' ' + matchPosition[2] + (/^\d+$/.test(matchPosition[2]) ? 'px' : '');
|
||||
}
|
||||
}
|
||||
|
||||
var matchRadius = matchEndRadius || matchStartRadius;
|
||||
if (matchRadius) {
|
||||
radius = matchRadius[0];
|
||||
if (!matchRadius[1]) {
|
||||
radius += 'px';
|
||||
}
|
||||
}
|
||||
|
||||
if (position && !shape && !radius && !extent) {
|
||||
radius = position;
|
||||
position = '';
|
||||
}
|
||||
|
||||
if (position) {
|
||||
position = 'at ' + position;
|
||||
}
|
||||
|
||||
return [[shape, extent, radius, position].filter(function (s) {
|
||||
return !!s;
|
||||
}).join(' ')].concat(args.slice(idx));
|
||||
};
|
||||
|
||||
var transformObsoleteColorStops = function transformObsoleteColorStops(args) {
|
||||
return args.map(function (color) {
|
||||
return color.match(FROM_TO_COLORSTOP);
|
||||
})
|
||||
// $FlowFixMe
|
||||
.map(function (v, index) {
|
||||
if (!v) {
|
||||
return args[index];
|
||||
}
|
||||
|
||||
switch (v[1]) {
|
||||
case 'from':
|
||||
return v[4] + ' 0%';
|
||||
case 'to':
|
||||
return v[4] + ' 100%';
|
||||
case 'color-stop':
|
||||
if (v[3] === '%') {
|
||||
return v[4] + ' ' + v[2];
|
||||
}
|
||||
return v[4] + ' ' + parseFloat(v[2]) * 100 + '%';
|
||||
}
|
||||
});
|
||||
};
|
122
AstuteClient2/src/assets/html2canvas/dist/npm/Input.js
vendored
Normal file
122
AstuteClient2/src/assets/html2canvas/dist/npm/Input.js
vendored
Normal file
|
@ -0,0 +1,122 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.reformatInputBounds = exports.inlineSelectElement = exports.inlineTextAreaElement = exports.inlineInputElement = exports.getInputBorderRadius = exports.INPUT_BACKGROUND = exports.INPUT_BORDERS = exports.INPUT_COLOR = undefined;
|
||||
|
||||
var _TextContainer = require('./TextContainer');
|
||||
|
||||
var _TextContainer2 = _interopRequireDefault(_TextContainer);
|
||||
|
||||
var _background = require('./parsing/background');
|
||||
|
||||
var _border = require('./parsing/border');
|
||||
|
||||
var _Circle = require('./drawing/Circle');
|
||||
|
||||
var _Circle2 = _interopRequireDefault(_Circle);
|
||||
|
||||
var _Vector = require('./drawing/Vector');
|
||||
|
||||
var _Vector2 = _interopRequireDefault(_Vector);
|
||||
|
||||
var _Color = require('./Color');
|
||||
|
||||
var _Color2 = _interopRequireDefault(_Color);
|
||||
|
||||
var _Length = require('./Length');
|
||||
|
||||
var _Length2 = _interopRequireDefault(_Length);
|
||||
|
||||
var _Bounds = require('./Bounds');
|
||||
|
||||
var _TextBounds = require('./TextBounds');
|
||||
|
||||
var _Util = require('./Util');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var INPUT_COLOR = exports.INPUT_COLOR = new _Color2.default([42, 42, 42]);
|
||||
var INPUT_BORDER_COLOR = new _Color2.default([165, 165, 165]);
|
||||
var INPUT_BACKGROUND_COLOR = new _Color2.default([222, 222, 222]);
|
||||
var INPUT_BORDER = {
|
||||
borderWidth: 1,
|
||||
borderColor: INPUT_BORDER_COLOR,
|
||||
borderStyle: _border.BORDER_STYLE.SOLID
|
||||
};
|
||||
var INPUT_BORDERS = exports.INPUT_BORDERS = [INPUT_BORDER, INPUT_BORDER, INPUT_BORDER, INPUT_BORDER];
|
||||
var INPUT_BACKGROUND = exports.INPUT_BACKGROUND = {
|
||||
backgroundColor: INPUT_BACKGROUND_COLOR,
|
||||
backgroundImage: [],
|
||||
backgroundClip: _background.BACKGROUND_CLIP.PADDING_BOX,
|
||||
backgroundOrigin: _background.BACKGROUND_ORIGIN.PADDING_BOX
|
||||
};
|
||||
|
||||
var RADIO_BORDER_RADIUS = new _Length2.default('50%');
|
||||
var RADIO_BORDER_RADIUS_TUPLE = [RADIO_BORDER_RADIUS, RADIO_BORDER_RADIUS];
|
||||
var INPUT_RADIO_BORDER_RADIUS = [RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE];
|
||||
|
||||
var CHECKBOX_BORDER_RADIUS = new _Length2.default('3px');
|
||||
var CHECKBOX_BORDER_RADIUS_TUPLE = [CHECKBOX_BORDER_RADIUS, CHECKBOX_BORDER_RADIUS];
|
||||
var INPUT_CHECKBOX_BORDER_RADIUS = [CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE];
|
||||
|
||||
var getInputBorderRadius = exports.getInputBorderRadius = function getInputBorderRadius(node) {
|
||||
return node.type === 'radio' ? INPUT_RADIO_BORDER_RADIUS : INPUT_CHECKBOX_BORDER_RADIUS;
|
||||
};
|
||||
|
||||
var inlineInputElement = exports.inlineInputElement = function inlineInputElement(node, container) {
|
||||
if (node.type === 'radio' || node.type === 'checkbox') {
|
||||
if (node.checked) {
|
||||
var size = Math.min(container.bounds.width, container.bounds.height);
|
||||
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));
|
||||
}
|
||||
} else {
|
||||
inlineFormElement(getInputValue(node), node, container, false);
|
||||
}
|
||||
};
|
||||
|
||||
var inlineTextAreaElement = exports.inlineTextAreaElement = function inlineTextAreaElement(node, container) {
|
||||
inlineFormElement(node.value, node, container, true);
|
||||
};
|
||||
|
||||
var inlineSelectElement = exports.inlineSelectElement = function inlineSelectElement(node, container) {
|
||||
var option = node.options[node.selectedIndex || 0];
|
||||
inlineFormElement(option ? option.text || '' : '', node, container, false);
|
||||
};
|
||||
|
||||
var reformatInputBounds = exports.reformatInputBounds = function reformatInputBounds(bounds) {
|
||||
if (bounds.width > bounds.height) {
|
||||
bounds.left += (bounds.width - bounds.height) / 2;
|
||||
bounds.width = bounds.height;
|
||||
} else if (bounds.width < bounds.height) {
|
||||
bounds.top += (bounds.height - bounds.width) / 2;
|
||||
bounds.height = bounds.width;
|
||||
}
|
||||
return bounds;
|
||||
};
|
||||
|
||||
var inlineFormElement = function inlineFormElement(value, node, container, allowLinebreak) {
|
||||
var body = node.ownerDocument.body;
|
||||
if (value.length > 0 && body) {
|
||||
var wrapper = node.ownerDocument.createElement('html2canvaswrapper');
|
||||
(0, _Util.copyCSSStyles)(node.ownerDocument.defaultView.getComputedStyle(node, null), wrapper);
|
||||
wrapper.style.position = 'absolute';
|
||||
wrapper.style.left = container.bounds.left + 'px';
|
||||
wrapper.style.top = container.bounds.top + 'px';
|
||||
if (!allowLinebreak) {
|
||||
wrapper.style.whiteSpace = 'nowrap';
|
||||
}
|
||||
var text = node.ownerDocument.createTextNode(value);
|
||||
wrapper.appendChild(text);
|
||||
body.appendChild(wrapper);
|
||||
container.childNodes.push(_TextContainer2.default.fromTextNode(text, container));
|
||||
body.removeChild(wrapper);
|
||||
}
|
||||
};
|
||||
|
||||
var getInputValue = function getInputValue(node) {
|
||||
var value = node.type === 'password' ? new Array(node.value.length + 1).join('\u2022') : node.value;
|
||||
|
||||
return value.length === 0 ? node.placeholder || '' : value;
|
||||
};
|
79
AstuteClient2/src/assets/html2canvas/dist/npm/Length.js
vendored
Normal file
79
AstuteClient2/src/assets/html2canvas/dist/npm/Length.js
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.calculateLengthFromValueWithUnit = exports.LENGTH_TYPE = undefined;
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _NodeContainer = require('./NodeContainer');
|
||||
|
||||
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var LENGTH_WITH_UNIT = /([\d.]+)(px|r?em|%)/i;
|
||||
|
||||
var LENGTH_TYPE = exports.LENGTH_TYPE = {
|
||||
PX: 0,
|
||||
PERCENTAGE: 1
|
||||
};
|
||||
|
||||
var Length = function () {
|
||||
function Length(value) {
|
||||
_classCallCheck(this, Length);
|
||||
|
||||
this.type = value.substr(value.length - 1) === '%' ? LENGTH_TYPE.PERCENTAGE : LENGTH_TYPE.PX;
|
||||
var parsedValue = parseFloat(value);
|
||||
if (process.env.NODE_ENV !== 'production' && isNaN(parsedValue)) {
|
||||
console.error('Invalid value given for Length: "' + value + '"');
|
||||
}
|
||||
this.value = isNaN(parsedValue) ? 0 : parsedValue;
|
||||
}
|
||||
|
||||
_createClass(Length, [{
|
||||
key: 'isPercentage',
|
||||
value: function isPercentage() {
|
||||
return this.type === LENGTH_TYPE.PERCENTAGE;
|
||||
}
|
||||
}, {
|
||||
key: 'getAbsoluteValue',
|
||||
value: function getAbsoluteValue(parentLength) {
|
||||
return this.isPercentage() ? parentLength * (this.value / 100) : this.value;
|
||||
}
|
||||
}], [{
|
||||
key: 'create',
|
||||
value: function create(v) {
|
||||
return new Length(v);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Length;
|
||||
}();
|
||||
|
||||
exports.default = Length;
|
||||
|
||||
|
||||
var getRootFontSize = function getRootFontSize(container) {
|
||||
var parent = container.parent;
|
||||
return parent ? getRootFontSize(parent) : parseFloat(container.style.font.fontSize);
|
||||
};
|
||||
|
||||
var calculateLengthFromValueWithUnit = exports.calculateLengthFromValueWithUnit = function calculateLengthFromValueWithUnit(container, value, unit) {
|
||||
switch (unit) {
|
||||
case 'px':
|
||||
case '%':
|
||||
return new Length(value + unit);
|
||||
case 'em':
|
||||
case 'rem':
|
||||
var length = new Length(value);
|
||||
length.value *= unit === 'em' ? parseFloat(container.style.font.fontSize) : getRootFontSize(container);
|
||||
return length;
|
||||
default:
|
||||
// TODO: handle correctly if unknown unit is used
|
||||
return new Length('0');
|
||||
}
|
||||
};
|
317
AstuteClient2/src/assets/html2canvas/dist/npm/ListItem.js
vendored
Normal file
317
AstuteClient2/src/assets/html2canvas/dist/npm/ListItem.js
vendored
Normal file
|
@ -0,0 +1,317 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createCounterText = exports.inlineListItemElement = exports.getListOwner = undefined;
|
||||
|
||||
var _Util = require('./Util');
|
||||
|
||||
var _NodeContainer = require('./NodeContainer');
|
||||
|
||||
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
||||
|
||||
var _TextContainer = require('./TextContainer');
|
||||
|
||||
var _TextContainer2 = _interopRequireDefault(_TextContainer);
|
||||
|
||||
var _listStyle = require('./parsing/listStyle');
|
||||
|
||||
var _Unicode = require('./Unicode');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// Margin between the enumeration and the list item content
|
||||
var MARGIN_RIGHT = 7;
|
||||
|
||||
var ancestorTypes = ['OL', 'UL', 'MENU'];
|
||||
|
||||
var getListOwner = exports.getListOwner = function getListOwner(container) {
|
||||
var parent = container.parent;
|
||||
if (!parent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
do {
|
||||
var isAncestor = ancestorTypes.indexOf(parent.tagName) !== -1;
|
||||
if (isAncestor) {
|
||||
return parent;
|
||||
}
|
||||
parent = parent.parent;
|
||||
} while (parent);
|
||||
|
||||
return container.parent;
|
||||
};
|
||||
|
||||
var inlineListItemElement = exports.inlineListItemElement = function inlineListItemElement(node, container, resourceLoader) {
|
||||
var listStyle = container.style.listStyle;
|
||||
|
||||
if (!listStyle) {
|
||||
return;
|
||||
}
|
||||
|
||||
var style = node.ownerDocument.defaultView.getComputedStyle(node, null);
|
||||
var wrapper = node.ownerDocument.createElement('html2canvaswrapper');
|
||||
(0, _Util.copyCSSStyles)(style, wrapper);
|
||||
|
||||
wrapper.style.position = 'absolute';
|
||||
wrapper.style.bottom = 'auto';
|
||||
wrapper.style.display = 'block';
|
||||
wrapper.style.letterSpacing = 'normal';
|
||||
|
||||
switch (listStyle.listStylePosition) {
|
||||
case _listStyle.LIST_STYLE_POSITION.OUTSIDE:
|
||||
wrapper.style.left = 'auto';
|
||||
wrapper.style.right = node.ownerDocument.defaultView.innerWidth - container.bounds.left - container.style.margin[1].getAbsoluteValue(container.bounds.width) + MARGIN_RIGHT + 'px';
|
||||
wrapper.style.textAlign = 'right';
|
||||
break;
|
||||
case _listStyle.LIST_STYLE_POSITION.INSIDE:
|
||||
wrapper.style.left = container.bounds.left - container.style.margin[3].getAbsoluteValue(container.bounds.width) + 'px';
|
||||
wrapper.style.right = 'auto';
|
||||
wrapper.style.textAlign = 'left';
|
||||
break;
|
||||
}
|
||||
|
||||
var text = void 0;
|
||||
var MARGIN_TOP = container.style.margin[0].getAbsoluteValue(container.bounds.width);
|
||||
var styleImage = listStyle.listStyleImage;
|
||||
if (styleImage) {
|
||||
if (styleImage.method === 'url') {
|
||||
var image = node.ownerDocument.createElement('img');
|
||||
image.src = styleImage.args[0];
|
||||
wrapper.style.top = container.bounds.top - MARGIN_TOP + 'px';
|
||||
wrapper.style.width = 'auto';
|
||||
wrapper.style.height = 'auto';
|
||||
wrapper.appendChild(image);
|
||||
} else {
|
||||
var size = parseFloat(container.style.font.fontSize) * 0.5;
|
||||
wrapper.style.top = container.bounds.top - MARGIN_TOP + container.bounds.height - 1.5 * size + 'px';
|
||||
wrapper.style.width = size + 'px';
|
||||
wrapper.style.height = size + 'px';
|
||||
wrapper.style.backgroundImage = style.listStyleImage;
|
||||
}
|
||||
} else if (typeof container.listIndex === 'number') {
|
||||
text = node.ownerDocument.createTextNode(createCounterText(container.listIndex, listStyle.listStyleType, true));
|
||||
wrapper.appendChild(text);
|
||||
wrapper.style.top = container.bounds.top - MARGIN_TOP + 'px';
|
||||
}
|
||||
|
||||
// $FlowFixMe
|
||||
var body = node.ownerDocument.body;
|
||||
body.appendChild(wrapper);
|
||||
|
||||
if (text) {
|
||||
container.childNodes.push(_TextContainer2.default.fromTextNode(text, container));
|
||||
body.removeChild(wrapper);
|
||||
} else {
|
||||
// $FlowFixMe
|
||||
container.childNodes.push(new _NodeContainer2.default(wrapper, container, resourceLoader, 0));
|
||||
}
|
||||
};
|
||||
|
||||
var ROMAN_UPPER = {
|
||||
integers: [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
|
||||
values: ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
|
||||
};
|
||||
|
||||
var ARMENIAN = {
|
||||
integers: [9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
|
||||
values: ['Ք', 'Փ', 'Ւ', 'Ց', 'Ր', 'Տ', 'Վ', 'Ս', 'Ռ', 'Ջ', 'Պ', 'Չ', 'Ո', 'Շ', 'Ն', 'Յ', 'Մ', 'Ճ', 'Ղ', 'Ձ', 'Հ', 'Կ', 'Ծ', 'Խ', 'Լ', 'Ի', 'Ժ', 'Թ', 'Ը', 'Է', 'Զ', 'Ե', 'Դ', 'Գ', 'Բ', 'Ա']
|
||||
};
|
||||
|
||||
var HEBREW = {
|
||||
integers: [10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 19, 18, 17, 16, 15, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
|
||||
values: ['י׳', 'ט׳', 'ח׳', 'ז׳', 'ו׳', 'ה׳', 'ד׳', 'ג׳', 'ב׳', 'א׳', 'ת', 'ש', 'ר', 'ק', 'צ', 'פ', 'ע', 'ס', 'נ', 'מ', 'ל', 'כ', 'יט', 'יח', 'יז', 'טז', 'טו', 'י', 'ט', 'ח', 'ז', 'ו', 'ה', 'ד', 'ג', 'ב', 'א']
|
||||
};
|
||||
|
||||
var GEORGIAN = {
|
||||
integers: [10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
|
||||
values: ['ჵ', 'ჰ', 'ჯ', 'ჴ', 'ხ', 'ჭ', 'წ', 'ძ', 'ც', 'ჩ', 'შ', 'ყ', 'ღ', 'ქ', 'ფ', 'ჳ', 'ტ', 'ს', 'რ', 'ჟ', 'პ', 'ო', 'ჲ', 'ნ', 'მ', 'ლ', 'კ', 'ი', 'თ', 'ჱ', 'ზ', 'ვ', 'ე', 'დ', 'გ', 'ბ', 'ა']
|
||||
};
|
||||
|
||||
var createAdditiveCounter = function createAdditiveCounter(value, min, max, symbols, fallback, suffix) {
|
||||
if (value < min || value > max) {
|
||||
return createCounterText(value, fallback, suffix.length > 0);
|
||||
}
|
||||
|
||||
return symbols.integers.reduce(function (string, integer, index) {
|
||||
while (value >= integer) {
|
||||
value -= integer;
|
||||
string += symbols.values[index];
|
||||
}
|
||||
return string;
|
||||
}, '') + suffix;
|
||||
};
|
||||
|
||||
var createCounterStyleWithSymbolResolver = function createCounterStyleWithSymbolResolver(value, codePointRangeLength, isNumeric, resolver) {
|
||||
var string = '';
|
||||
|
||||
do {
|
||||
if (!isNumeric) {
|
||||
value--;
|
||||
}
|
||||
string = resolver(value) + string;
|
||||
value /= codePointRangeLength;
|
||||
} while (value * codePointRangeLength >= codePointRangeLength);
|
||||
|
||||
return string;
|
||||
};
|
||||
|
||||
var createCounterStyleFromRange = function createCounterStyleFromRange(value, codePointRangeStart, codePointRangeEnd, isNumeric, suffix) {
|
||||
var codePointRangeLength = codePointRangeEnd - codePointRangeStart + 1;
|
||||
|
||||
return (value < 0 ? '-' : '') + (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, isNumeric, function (codePoint) {
|
||||
return (0, _Unicode.fromCodePoint)(Math.floor(codePoint % codePointRangeLength) + codePointRangeStart);
|
||||
}) + suffix);
|
||||
};
|
||||
|
||||
var createCounterStyleFromSymbols = function createCounterStyleFromSymbols(value, symbols) {
|
||||
var suffix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '. ';
|
||||
|
||||
var codePointRangeLength = symbols.length;
|
||||
return createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, false, function (codePoint) {
|
||||
return symbols[Math.floor(codePoint % codePointRangeLength)];
|
||||
}) + suffix;
|
||||
};
|
||||
|
||||
var CJK_ZEROS = 1 << 0;
|
||||
var CJK_TEN_COEFFICIENTS = 1 << 1;
|
||||
var CJK_TEN_HIGH_COEFFICIENTS = 1 << 2;
|
||||
var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
|
||||
|
||||
var createCJKCounter = function createCJKCounter(value, numbers, multipliers, negativeSign, suffix, flags) {
|
||||
if (value < -9999 || value > 9999) {
|
||||
return createCounterText(value, _listStyle.LIST_STYLE_TYPE.CJK_DECIMAL, suffix.length > 0);
|
||||
}
|
||||
var tmp = Math.abs(value);
|
||||
var string = suffix;
|
||||
|
||||
if (tmp === 0) {
|
||||
return numbers[0] + string;
|
||||
}
|
||||
|
||||
for (var digit = 0; tmp > 0 && digit <= 4; digit++) {
|
||||
var coefficient = tmp % 10;
|
||||
|
||||
if (coefficient === 0 && (0, _Util.contains)(flags, CJK_ZEROS) && string !== '') {
|
||||
string = numbers[coefficient] + string;
|
||||
} else if (coefficient > 1 || coefficient === 1 && digit === 0 || coefficient === 1 && digit === 1 && (0, _Util.contains)(flags, CJK_TEN_COEFFICIENTS) || coefficient === 1 && digit === 1 && (0, _Util.contains)(flags, CJK_TEN_HIGH_COEFFICIENTS) && value > 100 || coefficient === 1 && digit > 1 && (0, _Util.contains)(flags, CJK_HUNDRED_COEFFICIENTS)) {
|
||||
string = numbers[coefficient] + (digit > 0 ? multipliers[digit - 1] : '') + string;
|
||||
} else if (coefficient === 1 && digit > 0) {
|
||||
string = multipliers[digit - 1] + string;
|
||||
}
|
||||
tmp = Math.floor(tmp / 10);
|
||||
}
|
||||
|
||||
return (value < 0 ? negativeSign : '') + string;
|
||||
};
|
||||
|
||||
var CHINESE_INFORMAL_MULTIPLIERS = '十百千萬';
|
||||
var CHINESE_FORMAL_MULTIPLIERS = '拾佰仟萬';
|
||||
var JAPANESE_NEGATIVE = 'マイナス';
|
||||
var KOREAN_NEGATIVE = '마이너스 ';
|
||||
|
||||
var createCounterText = exports.createCounterText = function createCounterText(value, type, appendSuffix) {
|
||||
var defaultSuffix = appendSuffix ? '. ' : '';
|
||||
var cjkSuffix = appendSuffix ? '、' : '';
|
||||
var koreanSuffix = appendSuffix ? ', ' : '';
|
||||
switch (type) {
|
||||
case _listStyle.LIST_STYLE_TYPE.DISC:
|
||||
return '•';
|
||||
case _listStyle.LIST_STYLE_TYPE.CIRCLE:
|
||||
return '◦';
|
||||
case _listStyle.LIST_STYLE_TYPE.SQUARE:
|
||||
return '◾';
|
||||
case _listStyle.LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO:
|
||||
var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
||||
return string.length < 4 ? '0' + string : string;
|
||||
case _listStyle.LIST_STYLE_TYPE.CJK_DECIMAL:
|
||||
return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.LOWER_ROMAN:
|
||||
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase();
|
||||
case _listStyle.LIST_STYLE_TYPE.UPPER_ROMAN:
|
||||
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.LOWER_GREEK:
|
||||
return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.LOWER_ALPHA:
|
||||
return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.UPPER_ALPHA:
|
||||
return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.ARABIC_INDIC:
|
||||
return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.ARMENIAN:
|
||||
case _listStyle.LIST_STYLE_TYPE.UPPER_ARMENIAN:
|
||||
return createAdditiveCounter(value, 1, 9999, ARMENIAN, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.LOWER_ARMENIAN:
|
||||
return createAdditiveCounter(value, 1, 9999, ARMENIAN, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase();
|
||||
case _listStyle.LIST_STYLE_TYPE.BENGALI:
|
||||
return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.CAMBODIAN:
|
||||
case _listStyle.LIST_STYLE_TYPE.KHMER:
|
||||
return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH:
|
||||
return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.CJK_HEAVENLY_STEM:
|
||||
return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.CJK_IDEOGRAPHIC:
|
||||
case _listStyle.LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL:
|
||||
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
||||
case _listStyle.LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL:
|
||||
return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
||||
case _listStyle.LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL:
|
||||
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
||||
case _listStyle.LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL:
|
||||
return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
||||
case _listStyle.LIST_STYLE_TYPE.JAPANESE_INFORMAL:
|
||||
return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0);
|
||||
case _listStyle.LIST_STYLE_TYPE.JAPANESE_FORMAL:
|
||||
return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
||||
case _listStyle.LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL:
|
||||
return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
||||
case _listStyle.LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL:
|
||||
return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0);
|
||||
case _listStyle.LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL:
|
||||
return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
||||
case _listStyle.LIST_STYLE_TYPE.DEVANAGARI:
|
||||
return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.GEORGIAN:
|
||||
return createAdditiveCounter(value, 1, 19999, GEORGIAN, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.GUJARATI:
|
||||
return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.GURMUKHI:
|
||||
return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.HEBREW:
|
||||
return createAdditiveCounter(value, 1, 10999, HEBREW, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.HIRAGANA:
|
||||
return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん');
|
||||
case _listStyle.LIST_STYLE_TYPE.HIRAGANA_IROHA:
|
||||
return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす');
|
||||
case _listStyle.LIST_STYLE_TYPE.KANNADA:
|
||||
return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.KATAKANA:
|
||||
return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.KATAKANA_IROHA:
|
||||
return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.LAO:
|
||||
return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.MONGOLIAN:
|
||||
return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.MYANMAR:
|
||||
return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.ORIYA:
|
||||
return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.PERSIAN:
|
||||
return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.TAMIL:
|
||||
return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.TELUGU:
|
||||
return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.THAI:
|
||||
return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.TIBETAN:
|
||||
return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix);
|
||||
case _listStyle.LIST_STYLE_TYPE.DECIMAL:
|
||||
default:
|
||||
return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
||||
}
|
||||
};
|
58
AstuteClient2/src/assets/html2canvas/dist/npm/Logger.js
vendored
Normal file
58
AstuteClient2/src/assets/html2canvas/dist/npm/Logger.js
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
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; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Logger = function () {
|
||||
function Logger(enabled, id, start) {
|
||||
_classCallCheck(this, Logger);
|
||||
|
||||
this.enabled = typeof window !== 'undefined' && enabled;
|
||||
this.start = start ? start : Date.now();
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
_createClass(Logger, [{
|
||||
key: 'child',
|
||||
value: function child(id) {
|
||||
return new Logger(this.enabled, id, this.start);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line flowtype/no-weak-types
|
||||
|
||||
}, {
|
||||
key: 'log',
|
||||
value: function log() {
|
||||
if (this.enabled && window.console && window.console.log) {
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line flowtype/no-weak-types
|
||||
|
||||
}, {
|
||||
key: 'error',
|
||||
value: function error() {
|
||||
if (this.enabled && window.console && window.console.error) {
|
||||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
args[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return Logger;
|
||||
}();
|
||||
|
||||
exports.default = Logger;
|
240
AstuteClient2/src/assets/html2canvas/dist/npm/NodeContainer.js
vendored
Normal file
240
AstuteClient2/src/assets/html2canvas/dist/npm/NodeContainer.js
vendored
Normal file
|
@ -0,0 +1,240 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _Color = require('./Color');
|
||||
|
||||
var _Color2 = _interopRequireDefault(_Color);
|
||||
|
||||
var _Util = require('./Util');
|
||||
|
||||
var _background = require('./parsing/background');
|
||||
|
||||
var _border = require('./parsing/border');
|
||||
|
||||
var _borderRadius = require('./parsing/borderRadius');
|
||||
|
||||
var _display = require('./parsing/display');
|
||||
|
||||
var _float = require('./parsing/float');
|
||||
|
||||
var _font = require('./parsing/font');
|
||||
|
||||
var _letterSpacing = require('./parsing/letterSpacing');
|
||||
|
||||
var _lineBreak = require('./parsing/lineBreak');
|
||||
|
||||
var _listStyle = require('./parsing/listStyle');
|
||||
|
||||
var _margin = require('./parsing/margin');
|
||||
|
||||
var _overflow = require('./parsing/overflow');
|
||||
|
||||
var _overflowWrap = require('./parsing/overflowWrap');
|
||||
|
||||
var _padding = require('./parsing/padding');
|
||||
|
||||
var _position = require('./parsing/position');
|
||||
|
||||
var _textDecoration = require('./parsing/textDecoration');
|
||||
|
||||
var _textShadow = require('./parsing/textShadow');
|
||||
|
||||
var _textTransform = require('./parsing/textTransform');
|
||||
|
||||
var _transform = require('./parsing/transform');
|
||||
|
||||
var _visibility = require('./parsing/visibility');
|
||||
|
||||
var _wordBreak = require('./parsing/word-break');
|
||||
|
||||
var _zIndex = require('./parsing/zIndex');
|
||||
|
||||
var _Bounds = require('./Bounds');
|
||||
|
||||
var _Input = require('./Input');
|
||||
|
||||
var _ListItem = require('./ListItem');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var INPUT_TAGS = ['INPUT', 'TEXTAREA', 'SELECT'];
|
||||
|
||||
var NodeContainer = function () {
|
||||
function NodeContainer(node, parent, resourceLoader, index) {
|
||||
var _this = this;
|
||||
|
||||
_classCallCheck(this, NodeContainer);
|
||||
|
||||
this.parent = parent;
|
||||
this.tagName = node.tagName;
|
||||
this.index = index;
|
||||
this.childNodes = [];
|
||||
this.listItems = [];
|
||||
if (typeof node.start === 'number') {
|
||||
this.listStart = node.start;
|
||||
}
|
||||
var defaultView = node.ownerDocument.defaultView;
|
||||
var scrollX = defaultView.pageXOffset;
|
||||
var scrollY = defaultView.pageYOffset;
|
||||
var style = defaultView.getComputedStyle(node, null);
|
||||
var display = (0, _display.parseDisplay)(style.display);
|
||||
|
||||
var IS_INPUT = node.type === 'radio' || node.type === 'checkbox';
|
||||
|
||||
var position = (0, _position.parsePosition)(style.position);
|
||||
|
||||
this.style = {
|
||||
background: IS_INPUT ? _Input.INPUT_BACKGROUND : (0, _background.parseBackground)(style, resourceLoader),
|
||||
border: IS_INPUT ? _Input.INPUT_BORDERS : (0, _border.parseBorder)(style),
|
||||
borderRadius: (node instanceof defaultView.HTMLInputElement || node instanceof HTMLInputElement) && IS_INPUT ? (0, _Input.getInputBorderRadius)(node) : (0, _borderRadius.parseBorderRadius)(style),
|
||||
color: IS_INPUT ? _Input.INPUT_COLOR : new _Color2.default(style.color),
|
||||
display: display,
|
||||
float: (0, _float.parseCSSFloat)(style.float),
|
||||
font: (0, _font.parseFont)(style),
|
||||
letterSpacing: (0, _letterSpacing.parseLetterSpacing)(style.letterSpacing),
|
||||
listStyle: display === _display.DISPLAY.LIST_ITEM ? (0, _listStyle.parseListStyle)(style) : null,
|
||||
lineBreak: (0, _lineBreak.parseLineBreak)(style.lineBreak),
|
||||
margin: (0, _margin.parseMargin)(style),
|
||||
opacity: parseFloat(style.opacity),
|
||||
overflow: INPUT_TAGS.indexOf(node.tagName) === -1 ? (0, _overflow.parseOverflow)(style.overflow) : _overflow.OVERFLOW.HIDDEN,
|
||||
overflowWrap: (0, _overflowWrap.parseOverflowWrap)(style.overflowWrap ? style.overflowWrap : style.wordWrap),
|
||||
padding: (0, _padding.parsePadding)(style),
|
||||
position: position,
|
||||
textDecoration: (0, _textDecoration.parseTextDecoration)(style),
|
||||
textShadow: (0, _textShadow.parseTextShadow)(style.textShadow),
|
||||
textTransform: (0, _textTransform.parseTextTransform)(style.textTransform),
|
||||
transform: (0, _transform.parseTransform)(style),
|
||||
visibility: (0, _visibility.parseVisibility)(style.visibility),
|
||||
wordBreak: (0, _wordBreak.parseWordBreak)(style.wordBreak),
|
||||
zIndex: (0, _zIndex.parseZIndex)(position !== _position.POSITION.STATIC ? style.zIndex : 'auto')
|
||||
};
|
||||
|
||||
if (this.isTransformed()) {
|
||||
// getBoundingClientRect provides values post-transform, we want them without the transformation
|
||||
node.style.transform = 'matrix(1,0,0,1,0,0)';
|
||||
}
|
||||
|
||||
if (display === _display.DISPLAY.LIST_ITEM) {
|
||||
var listOwner = (0, _ListItem.getListOwner)(this);
|
||||
if (listOwner) {
|
||||
var listIndex = listOwner.listItems.length;
|
||||
listOwner.listItems.push(this);
|
||||
this.listIndex = node.hasAttribute('value') && typeof node.value === 'number' ? node.value : listIndex === 0 ? typeof listOwner.listStart === 'number' ? listOwner.listStart : 1 : listOwner.listItems[listIndex - 1].listIndex + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO move bound retrieval for all nodes to a later stage?
|
||||
if (node.tagName === 'IMG') {
|
||||
node.addEventListener('load', function () {
|
||||
_this.bounds = (0, _Bounds.parseBounds)(node, scrollX, scrollY);
|
||||
_this.curvedBounds = (0, _Bounds.parseBoundCurves)(_this.bounds, _this.style.border, _this.style.borderRadius);
|
||||
});
|
||||
}
|
||||
this.image = getImage(node, resourceLoader);
|
||||
this.bounds = IS_INPUT ? (0, _Input.reformatInputBounds)((0, _Bounds.parseBounds)(node, scrollX, scrollY)) : (0, _Bounds.parseBounds)(node, scrollX, scrollY);
|
||||
this.curvedBounds = (0, _Bounds.parseBoundCurves)(this.bounds, this.style.border, this.style.borderRadius);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
this.name = '' + node.tagName.toLowerCase() + (node.id ? '#' + node.id : '') + node.className.toString().split(' ').map(function (s) {
|
||||
return s.length ? '.' + s : '';
|
||||
}).join('');
|
||||
}
|
||||
}
|
||||
|
||||
_createClass(NodeContainer, [{
|
||||
key: 'getClipPaths',
|
||||
value: function getClipPaths() {
|
||||
var parentClips = this.parent ? this.parent.getClipPaths() : [];
|
||||
var isClipped = this.style.overflow !== _overflow.OVERFLOW.VISIBLE;
|
||||
|
||||
return isClipped ? parentClips.concat([(0, _Bounds.calculatePaddingBoxPath)(this.curvedBounds)]) : parentClips;
|
||||
}
|
||||
}, {
|
||||
key: 'isInFlow',
|
||||
value: function isInFlow() {
|
||||
return this.isRootElement() && !this.isFloating() && !this.isAbsolutelyPositioned();
|
||||
}
|
||||
}, {
|
||||
key: 'isVisible',
|
||||
value: function isVisible() {
|
||||
return !(0, _Util.contains)(this.style.display, _display.DISPLAY.NONE) && this.style.opacity > 0 && this.style.visibility === _visibility.VISIBILITY.VISIBLE;
|
||||
}
|
||||
}, {
|
||||
key: 'isAbsolutelyPositioned',
|
||||
value: function isAbsolutelyPositioned() {
|
||||
return this.style.position !== _position.POSITION.STATIC && this.style.position !== _position.POSITION.RELATIVE;
|
||||
}
|
||||
}, {
|
||||
key: 'isPositioned',
|
||||
value: function isPositioned() {
|
||||
return this.style.position !== _position.POSITION.STATIC;
|
||||
}
|
||||
}, {
|
||||
key: 'isFloating',
|
||||
value: function isFloating() {
|
||||
return this.style.float !== _float.FLOAT.NONE;
|
||||
}
|
||||
}, {
|
||||
key: 'isRootElement',
|
||||
value: function isRootElement() {
|
||||
return this.parent === null;
|
||||
}
|
||||
}, {
|
||||
key: 'isTransformed',
|
||||
value: function isTransformed() {
|
||||
return this.style.transform !== null;
|
||||
}
|
||||
}, {
|
||||
key: 'isPositionedWithZIndex',
|
||||
value: function isPositionedWithZIndex() {
|
||||
return this.isPositioned() && !this.style.zIndex.auto;
|
||||
}
|
||||
}, {
|
||||
key: 'isInlineLevel',
|
||||
value: function isInlineLevel() {
|
||||
return (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_BLOCK) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_FLEX) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_GRID) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_LIST_ITEM) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_TABLE);
|
||||
}
|
||||
}, {
|
||||
key: 'isInlineBlockOrInlineTable',
|
||||
value: function isInlineBlockOrInlineTable() {
|
||||
return (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_BLOCK) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_TABLE);
|
||||
}
|
||||
}]);
|
||||
|
||||
return NodeContainer;
|
||||
}();
|
||||
|
||||
exports.default = NodeContainer;
|
||||
|
||||
|
||||
var getImage = function getImage(node, resourceLoader) {
|
||||
if (node instanceof node.ownerDocument.defaultView.SVGSVGElement || node instanceof SVGSVGElement) {
|
||||
var s = new XMLSerializer();
|
||||
return resourceLoader.loadImage('data:image/svg+xml,' + encodeURIComponent(s.serializeToString(node)));
|
||||
}
|
||||
switch (node.tagName) {
|
||||
case 'IMG':
|
||||
// $FlowFixMe
|
||||
var img = node;
|
||||
return resourceLoader.loadImage(img.currentSrc || img.src);
|
||||
case 'CANVAS':
|
||||
// $FlowFixMe
|
||||
var canvas = node;
|
||||
return resourceLoader.loadCanvas(canvas);
|
||||
case 'IFRAME':
|
||||
var iframeKey = node.getAttribute('data-html2canvas-internal-iframe-key');
|
||||
if (iframeKey) {
|
||||
return iframeKey;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
123
AstuteClient2/src/assets/html2canvas/dist/npm/NodeParser.js
vendored
Normal file
123
AstuteClient2/src/assets/html2canvas/dist/npm/NodeParser.js
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.NodeParser = undefined;
|
||||
|
||||
var _StackingContext = require('./StackingContext');
|
||||
|
||||
var _StackingContext2 = _interopRequireDefault(_StackingContext);
|
||||
|
||||
var _NodeContainer = require('./NodeContainer');
|
||||
|
||||
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
||||
|
||||
var _TextContainer = require('./TextContainer');
|
||||
|
||||
var _TextContainer2 = _interopRequireDefault(_TextContainer);
|
||||
|
||||
var _Input = require('./Input');
|
||||
|
||||
var _ListItem = require('./ListItem');
|
||||
|
||||
var _listStyle = require('./parsing/listStyle');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var NodeParser = exports.NodeParser = function NodeParser(node, resourceLoader, logger) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
logger.log('Starting node parsing');
|
||||
}
|
||||
|
||||
var index = 0;
|
||||
|
||||
var container = new _NodeContainer2.default(node, null, resourceLoader, index++);
|
||||
var stack = new _StackingContext2.default(container, null, true);
|
||||
|
||||
parseNodeTree(node, container, stack, resourceLoader, index);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
logger.log('Finished parsing node tree');
|
||||
}
|
||||
|
||||
return stack;
|
||||
};
|
||||
|
||||
var IGNORED_NODE_NAMES = ['SCRIPT', 'HEAD', 'TITLE', 'OBJECT', 'BR', 'OPTION'];
|
||||
|
||||
var parseNodeTree = function parseNodeTree(node, parent, stack, resourceLoader, index) {
|
||||
if (process.env.NODE_ENV !== 'production' && index > 50000) {
|
||||
throw new Error('Recursion error while parsing node tree');
|
||||
}
|
||||
|
||||
for (var childNode = node.firstChild, nextNode; childNode; childNode = nextNode) {
|
||||
nextNode = childNode.nextSibling;
|
||||
var defaultView = childNode.ownerDocument.defaultView;
|
||||
if (childNode instanceof defaultView.Text || childNode instanceof Text || defaultView.parent && childNode instanceof defaultView.parent.Text) {
|
||||
if (childNode.data.trim().length > 0) {
|
||||
parent.childNodes.push(_TextContainer2.default.fromTextNode(childNode, parent));
|
||||
}
|
||||
} else if (childNode instanceof defaultView.HTMLElement || childNode instanceof HTMLElement || defaultView.parent && childNode instanceof defaultView.parent.HTMLElement) {
|
||||
if (IGNORED_NODE_NAMES.indexOf(childNode.nodeName) === -1) {
|
||||
var container = new _NodeContainer2.default(childNode, parent, resourceLoader, index++);
|
||||
if (container.isVisible()) {
|
||||
if (childNode.tagName === 'INPUT') {
|
||||
// $FlowFixMe
|
||||
(0, _Input.inlineInputElement)(childNode, container);
|
||||
} else if (childNode.tagName === 'TEXTAREA') {
|
||||
// $FlowFixMe
|
||||
(0, _Input.inlineTextAreaElement)(childNode, container);
|
||||
} else if (childNode.tagName === 'SELECT') {
|
||||
// $FlowFixMe
|
||||
(0, _Input.inlineSelectElement)(childNode, container);
|
||||
} else if (container.style.listStyle && container.style.listStyle.listStyleType !== _listStyle.LIST_STYLE_TYPE.NONE) {
|
||||
(0, _ListItem.inlineListItemElement)(childNode, container, resourceLoader);
|
||||
}
|
||||
|
||||
var SHOULD_TRAVERSE_CHILDREN = childNode.tagName !== 'TEXTAREA';
|
||||
var treatAsRealStackingContext = createsRealStackingContext(container, childNode);
|
||||
if (treatAsRealStackingContext || createsStackingContext(container)) {
|
||||
// for treatAsRealStackingContext:false, any positioned descendants and descendants
|
||||
// which actually create a new stacking context should be considered part of the parent stacking context
|
||||
var parentStack = treatAsRealStackingContext || container.isPositioned() ? stack.getRealParentStackingContext() : stack;
|
||||
var childStack = new _StackingContext2.default(container, parentStack, treatAsRealStackingContext);
|
||||
parentStack.contexts.push(childStack);
|
||||
if (SHOULD_TRAVERSE_CHILDREN) {
|
||||
parseNodeTree(childNode, container, childStack, resourceLoader, index);
|
||||
}
|
||||
} else {
|
||||
stack.children.push(container);
|
||||
if (SHOULD_TRAVERSE_CHILDREN) {
|
||||
parseNodeTree(childNode, container, stack, resourceLoader, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (childNode instanceof defaultView.SVGSVGElement || childNode instanceof SVGSVGElement || defaultView.parent && childNode instanceof defaultView.parent.SVGSVGElement) {
|
||||
var _container = new _NodeContainer2.default(childNode, parent, resourceLoader, index++);
|
||||
var _treatAsRealStackingContext = createsRealStackingContext(_container, childNode);
|
||||
if (_treatAsRealStackingContext || createsStackingContext(_container)) {
|
||||
// for treatAsRealStackingContext:false, any positioned descendants and descendants
|
||||
// which actually create a new stacking context should be considered part of the parent stacking context
|
||||
var _parentStack = _treatAsRealStackingContext || _container.isPositioned() ? stack.getRealParentStackingContext() : stack;
|
||||
var _childStack = new _StackingContext2.default(_container, _parentStack, _treatAsRealStackingContext);
|
||||
_parentStack.contexts.push(_childStack);
|
||||
} else {
|
||||
stack.children.push(_container);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var createsRealStackingContext = function createsRealStackingContext(container, node) {
|
||||
return container.isRootElement() || container.isPositionedWithZIndex() || container.style.opacity < 1 || container.isTransformed() || isBodyWithTransparentRoot(container, node);
|
||||
};
|
||||
|
||||
var createsStackingContext = function createsStackingContext(container) {
|
||||
return container.isPositioned() || container.isFloating();
|
||||
};
|
||||
|
||||
var isBodyWithTransparentRoot = function isBodyWithTransparentRoot(container, node) {
|
||||
return node.nodeName === 'BODY' && container.parent instanceof _NodeContainer2.default && container.parent.style.background.backgroundColor.isTransparent();
|
||||
};
|
65
AstuteClient2/src/assets/html2canvas/dist/npm/Proxy.js
vendored
Normal file
65
AstuteClient2/src/assets/html2canvas/dist/npm/Proxy.js
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Proxy = undefined;
|
||||
|
||||
var _Feature = require('./Feature');
|
||||
|
||||
var _Feature2 = _interopRequireDefault(_Feature);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var Proxy = exports.Proxy = function Proxy(src, options) {
|
||||
if (!options.proxy) {
|
||||
return Promise.reject(process.env.NODE_ENV !== 'production' ? 'No proxy defined' : null);
|
||||
}
|
||||
var proxy = options.proxy;
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
var responseType = _Feature2.default.SUPPORT_CORS_XHR && _Feature2.default.SUPPORT_RESPONSE_TYPE ? 'blob' : 'text';
|
||||
var xhr = _Feature2.default.SUPPORT_CORS_XHR ? new XMLHttpRequest() : new XDomainRequest();
|
||||
xhr.onload = function () {
|
||||
if (xhr instanceof XMLHttpRequest) {
|
||||
if (xhr.status === 200) {
|
||||
if (responseType === 'text') {
|
||||
resolve(xhr.response);
|
||||
} else {
|
||||
var reader = new FileReader();
|
||||
// $FlowFixMe
|
||||
reader.addEventListener('load', function () {
|
||||
return resolve(reader.result);
|
||||
}, false);
|
||||
// $FlowFixMe
|
||||
reader.addEventListener('error', function (e) {
|
||||
return reject(e);
|
||||
}, false);
|
||||
reader.readAsDataURL(xhr.response);
|
||||
}
|
||||
} else {
|
||||
reject(process.env.NODE_ENV !== 'production' ? 'Failed to proxy resource ' + src.substring(0, 256) + ' with status code ' + xhr.status : '');
|
||||
}
|
||||
} else {
|
||||
resolve(xhr.responseText);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = reject;
|
||||
xhr.open('GET', proxy + '?url=' + encodeURIComponent(src) + '&responseType=' + responseType);
|
||||
|
||||
if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
|
||||
xhr.responseType = responseType;
|
||||
}
|
||||
|
||||
if (options.imageTimeout) {
|
||||
var timeout = options.imageTimeout;
|
||||
xhr.timeout = timeout;
|
||||
xhr.ontimeout = function () {
|
||||
return reject(process.env.NODE_ENV !== 'production' ? 'Timed out (' + timeout + 'ms) proxying ' + src.substring(0, 256) : '');
|
||||
};
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
};
|
324
AstuteClient2/src/assets/html2canvas/dist/npm/PseudoNodeContent.js
vendored
Normal file
324
AstuteClient2/src/assets/html2canvas/dist/npm/PseudoNodeContent.js
vendored
Normal file
|
@ -0,0 +1,324 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseContent = exports.resolvePseudoContent = exports.popCounters = exports.parseCounterReset = exports.TOKEN_TYPE = exports.PSEUDO_CONTENT_ITEM_TYPE = undefined;
|
||||
|
||||
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"); } }; }();
|
||||
|
||||
var _ListItem = require('./ListItem');
|
||||
|
||||
var _listStyle = require('./parsing/listStyle');
|
||||
|
||||
var PSEUDO_CONTENT_ITEM_TYPE = exports.PSEUDO_CONTENT_ITEM_TYPE = {
|
||||
TEXT: 0,
|
||||
IMAGE: 1
|
||||
};
|
||||
|
||||
var TOKEN_TYPE = exports.TOKEN_TYPE = {
|
||||
STRING: 0,
|
||||
ATTRIBUTE: 1,
|
||||
URL: 2,
|
||||
COUNTER: 3,
|
||||
COUNTERS: 4,
|
||||
OPENQUOTE: 5,
|
||||
CLOSEQUOTE: 6
|
||||
};
|
||||
|
||||
var parseCounterReset = exports.parseCounterReset = function parseCounterReset(style, data) {
|
||||
if (!style || !style.counterReset || style.counterReset === 'none') {
|
||||
return [];
|
||||
}
|
||||
|
||||
var counterNames = [];
|
||||
var counterResets = style.counterReset.split(/\s*,\s*/);
|
||||
var lenCounterResets = counterResets.length;
|
||||
|
||||
for (var i = 0; i < lenCounterResets; i++) {
|
||||
var _counterResets$i$spli = counterResets[i].split(/\s+/),
|
||||
_counterResets$i$spli2 = _slicedToArray(_counterResets$i$spli, 2),
|
||||
counterName = _counterResets$i$spli2[0],
|
||||
initialValue = _counterResets$i$spli2[1];
|
||||
|
||||
counterNames.push(counterName);
|
||||
var counter = data.counters[counterName];
|
||||
if (!counter) {
|
||||
counter = data.counters[counterName] = [];
|
||||
}
|
||||
counter.push(parseInt(initialValue || 0, 10));
|
||||
}
|
||||
|
||||
return counterNames;
|
||||
};
|
||||
|
||||
var popCounters = exports.popCounters = function popCounters(counterNames, data) {
|
||||
var lenCounters = counterNames.length;
|
||||
for (var i = 0; i < lenCounters; i++) {
|
||||
data.counters[counterNames[i]].pop();
|
||||
}
|
||||
};
|
||||
|
||||
var resolvePseudoContent = exports.resolvePseudoContent = function resolvePseudoContent(node, style, data) {
|
||||
if (!style || !style.content || style.content === 'none' || style.content === '-moz-alt-content' || style.display === 'none') {
|
||||
return null;
|
||||
}
|
||||
|
||||
var tokens = parseContent(style.content);
|
||||
|
||||
var len = tokens.length;
|
||||
var contentItems = [];
|
||||
var s = '';
|
||||
|
||||
// increment the counter (if there is a "counter-increment" declaration)
|
||||
var counterIncrement = style.counterIncrement;
|
||||
if (counterIncrement && counterIncrement !== 'none') {
|
||||
var _counterIncrement$spl = counterIncrement.split(/\s+/),
|
||||
_counterIncrement$spl2 = _slicedToArray(_counterIncrement$spl, 2),
|
||||
counterName = _counterIncrement$spl2[0],
|
||||
incrementValue = _counterIncrement$spl2[1];
|
||||
|
||||
var counter = data.counters[counterName];
|
||||
if (counter) {
|
||||
counter[counter.length - 1] += incrementValue === undefined ? 1 : parseInt(incrementValue, 10);
|
||||
}
|
||||
}
|
||||
|
||||
// build the content string
|
||||
for (var i = 0; i < len; i++) {
|
||||
var token = tokens[i];
|
||||
switch (token.type) {
|
||||
case TOKEN_TYPE.STRING:
|
||||
s += token.value || '';
|
||||
break;
|
||||
|
||||
case TOKEN_TYPE.ATTRIBUTE:
|
||||
if (node instanceof HTMLElement && token.value) {
|
||||
s += node.getAttribute(token.value) || '';
|
||||
}
|
||||
break;
|
||||
|
||||
case TOKEN_TYPE.COUNTER:
|
||||
var _counter = data.counters[token.name || ''];
|
||||
if (_counter) {
|
||||
s += formatCounterValue([_counter[_counter.length - 1]], '', token.format);
|
||||
}
|
||||
break;
|
||||
|
||||
case TOKEN_TYPE.COUNTERS:
|
||||
var _counters = data.counters[token.name || ''];
|
||||
if (_counters) {
|
||||
s += formatCounterValue(_counters, token.glue, token.format);
|
||||
}
|
||||
break;
|
||||
|
||||
case TOKEN_TYPE.OPENQUOTE:
|
||||
s += getQuote(style, true, data.quoteDepth);
|
||||
data.quoteDepth++;
|
||||
break;
|
||||
|
||||
case TOKEN_TYPE.CLOSEQUOTE:
|
||||
data.quoteDepth--;
|
||||
s += getQuote(style, false, data.quoteDepth);
|
||||
break;
|
||||
|
||||
case TOKEN_TYPE.URL:
|
||||
if (s) {
|
||||
contentItems.push({ type: PSEUDO_CONTENT_ITEM_TYPE.TEXT, value: s });
|
||||
s = '';
|
||||
}
|
||||
contentItems.push({ type: PSEUDO_CONTENT_ITEM_TYPE.IMAGE, value: token.value || '' });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (s) {
|
||||
contentItems.push({ type: PSEUDO_CONTENT_ITEM_TYPE.TEXT, value: s });
|
||||
}
|
||||
|
||||
return contentItems;
|
||||
};
|
||||
|
||||
var parseContent = exports.parseContent = function parseContent(content, cache) {
|
||||
if (cache && cache[content]) {
|
||||
return cache[content];
|
||||
}
|
||||
|
||||
var tokens = [];
|
||||
var len = content.length;
|
||||
|
||||
var isString = false;
|
||||
var isEscaped = false;
|
||||
var isFunction = false;
|
||||
var str = '';
|
||||
var functionName = '';
|
||||
var args = [];
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
var c = content.charAt(i);
|
||||
|
||||
switch (c) {
|
||||
case "'":
|
||||
case '"':
|
||||
if (isEscaped) {
|
||||
str += c;
|
||||
} else {
|
||||
isString = !isString;
|
||||
if (!isFunction && !isString) {
|
||||
tokens.push({ type: TOKEN_TYPE.STRING, value: str });
|
||||
str = '';
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
if (isEscaped) {
|
||||
str += c;
|
||||
isEscaped = false;
|
||||
} else {
|
||||
isEscaped = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case '(':
|
||||
if (isString) {
|
||||
str += c;
|
||||
} else {
|
||||
isFunction = true;
|
||||
functionName = str;
|
||||
str = '';
|
||||
args = [];
|
||||
}
|
||||
break;
|
||||
|
||||
case ')':
|
||||
if (isString) {
|
||||
str += c;
|
||||
} else if (isFunction) {
|
||||
if (str) {
|
||||
args.push(str);
|
||||
}
|
||||
|
||||
switch (functionName) {
|
||||
case 'attr':
|
||||
if (args.length > 0) {
|
||||
tokens.push({ type: TOKEN_TYPE.ATTRIBUTE, value: args[0] });
|
||||
}
|
||||
break;
|
||||
|
||||
case 'counter':
|
||||
if (args.length > 0) {
|
||||
var counter = {
|
||||
type: TOKEN_TYPE.COUNTER,
|
||||
name: args[0]
|
||||
};
|
||||
if (args.length > 1) {
|
||||
counter.format = args[1];
|
||||
}
|
||||
tokens.push(counter);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'counters':
|
||||
if (args.length > 0) {
|
||||
var _counters2 = {
|
||||
type: TOKEN_TYPE.COUNTERS,
|
||||
name: args[0]
|
||||
};
|
||||
if (args.length > 1) {
|
||||
_counters2.glue = args[1];
|
||||
}
|
||||
if (args.length > 2) {
|
||||
_counters2.format = args[2];
|
||||
}
|
||||
tokens.push(_counters2);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
if (args.length > 0) {
|
||||
tokens.push({ type: TOKEN_TYPE.URL, value: args[0] });
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
isFunction = false;
|
||||
str = '';
|
||||
}
|
||||
break;
|
||||
|
||||
case ',':
|
||||
if (isString) {
|
||||
str += c;
|
||||
} else if (isFunction) {
|
||||
args.push(str);
|
||||
str = '';
|
||||
}
|
||||
break;
|
||||
|
||||
case ' ':
|
||||
case '\t':
|
||||
if (isString) {
|
||||
str += c;
|
||||
} else if (str) {
|
||||
addOtherToken(tokens, str);
|
||||
str = '';
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
str += c;
|
||||
}
|
||||
|
||||
if (c !== '\\') {
|
||||
isEscaped = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (str) {
|
||||
addOtherToken(tokens, str);
|
||||
}
|
||||
|
||||
if (cache) {
|
||||
cache[content] = tokens;
|
||||
}
|
||||
|
||||
return tokens;
|
||||
};
|
||||
|
||||
var addOtherToken = function addOtherToken(tokens, identifier) {
|
||||
switch (identifier) {
|
||||
case 'open-quote':
|
||||
tokens.push({ type: TOKEN_TYPE.OPENQUOTE });
|
||||
break;
|
||||
case 'close-quote':
|
||||
tokens.push({ type: TOKEN_TYPE.CLOSEQUOTE });
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
var getQuote = function getQuote(style, isOpening, quoteDepth) {
|
||||
var quotes = style.quotes ? style.quotes.split(/\s+/) : ["'\"'", "'\"'"];
|
||||
var idx = quoteDepth * 2;
|
||||
if (idx >= quotes.length) {
|
||||
idx = quotes.length - 2;
|
||||
}
|
||||
if (!isOpening) {
|
||||
++idx;
|
||||
}
|
||||
return quotes[idx].replace(/^["']|["']$/g, '');
|
||||
};
|
||||
|
||||
var formatCounterValue = function formatCounterValue(counter, glue, format) {
|
||||
var len = counter.length;
|
||||
var result = '';
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (i > 0) {
|
||||
result += glue || '';
|
||||
}
|
||||
result += (0, _ListItem.createCounterText)(counter[i], (0, _listStyle.parseListStyleType)(format || 'decimal'), false);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
328
AstuteClient2/src/assets/html2canvas/dist/npm/Renderer.js
vendored
Normal file
328
AstuteClient2/src/assets/html2canvas/dist/npm/Renderer.js
vendored
Normal file
|
@ -0,0 +1,328 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
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"); } }; }();
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _Bounds = require('./Bounds');
|
||||
|
||||
var _Font = require('./Font');
|
||||
|
||||
var _Gradient = require('./Gradient');
|
||||
|
||||
var _TextContainer = require('./TextContainer');
|
||||
|
||||
var _TextContainer2 = _interopRequireDefault(_TextContainer);
|
||||
|
||||
var _background = require('./parsing/background');
|
||||
|
||||
var _border = require('./parsing/border');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Renderer = function () {
|
||||
function Renderer(target, options) {
|
||||
_classCallCheck(this, Renderer);
|
||||
|
||||
this.target = target;
|
||||
this.options = options;
|
||||
target.render(options);
|
||||
}
|
||||
|
||||
_createClass(Renderer, [{
|
||||
key: 'renderNode',
|
||||
value: function renderNode(container) {
|
||||
if (container.isVisible()) {
|
||||
this.renderNodeBackgroundAndBorders(container);
|
||||
this.renderNodeContent(container);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'renderNodeContent',
|
||||
value: function renderNodeContent(container) {
|
||||
var _this = this;
|
||||
|
||||
var callback = function callback() {
|
||||
if (container.childNodes.length) {
|
||||
container.childNodes.forEach(function (child) {
|
||||
if (child instanceof _TextContainer2.default) {
|
||||
var style = child.parent.style;
|
||||
_this.target.renderTextNode(child.bounds, style.color, style.font, style.textDecoration, style.textShadow);
|
||||
} else {
|
||||
_this.target.drawShape(child, container.style.color);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (container.image) {
|
||||
var _image = _this.options.imageStore.get(container.image);
|
||||
if (_image) {
|
||||
var contentBox = (0, _Bounds.calculateContentBox)(container.bounds, container.style.padding, container.style.border);
|
||||
var _width = typeof _image.width === 'number' && _image.width > 0 ? _image.width : contentBox.width;
|
||||
var _height = typeof _image.height === 'number' && _image.height > 0 ? _image.height : contentBox.height;
|
||||
if (_width > 0 && _height > 0) {
|
||||
_this.target.clip([(0, _Bounds.calculatePaddingBoxPath)(container.curvedBounds)], function () {
|
||||
_this.target.drawImage(_image, new _Bounds.Bounds(0, 0, _width, _height), contentBox);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var paths = container.getClipPaths();
|
||||
if (paths.length) {
|
||||
this.target.clip(paths, callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'renderNodeBackgroundAndBorders',
|
||||
value: function renderNodeBackgroundAndBorders(container) {
|
||||
var _this2 = this;
|
||||
|
||||
var HAS_BACKGROUND = !container.style.background.backgroundColor.isTransparent() || container.style.background.backgroundImage.length;
|
||||
|
||||
var hasRenderableBorders = container.style.border.some(function (border) {
|
||||
return border.borderStyle !== _border.BORDER_STYLE.NONE && !border.borderColor.isTransparent();
|
||||
});
|
||||
|
||||
var callback = function callback() {
|
||||
var backgroundPaintingArea = (0, _background.calculateBackgroungPaintingArea)(container.curvedBounds, container.style.background.backgroundClip);
|
||||
|
||||
if (HAS_BACKGROUND) {
|
||||
_this2.target.clip([backgroundPaintingArea], function () {
|
||||
if (!container.style.background.backgroundColor.isTransparent()) {
|
||||
_this2.target.fill(container.style.background.backgroundColor);
|
||||
}
|
||||
|
||||
_this2.renderBackgroundImage(container);
|
||||
});
|
||||
}
|
||||
|
||||
container.style.border.forEach(function (border, side) {
|
||||
if (border.borderStyle !== _border.BORDER_STYLE.NONE && !border.borderColor.isTransparent()) {
|
||||
_this2.renderBorder(border, side, container.curvedBounds);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (HAS_BACKGROUND || hasRenderableBorders) {
|
||||
var paths = container.parent ? container.parent.getClipPaths() : [];
|
||||
if (paths.length) {
|
||||
this.target.clip(paths, callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'renderBackgroundImage',
|
||||
value: function renderBackgroundImage(container) {
|
||||
var _this3 = this;
|
||||
|
||||
container.style.background.backgroundImage.slice(0).reverse().forEach(function (backgroundImage) {
|
||||
if (backgroundImage.source.method === 'url' && backgroundImage.source.args.length) {
|
||||
_this3.renderBackgroundRepeat(container, backgroundImage);
|
||||
} else if (/gradient/i.test(backgroundImage.source.method)) {
|
||||
_this3.renderBackgroundGradient(container, backgroundImage);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'renderBackgroundRepeat',
|
||||
value: function renderBackgroundRepeat(container, background) {
|
||||
var image = this.options.imageStore.get(background.source.args[0]);
|
||||
if (image) {
|
||||
var backgroundPositioningArea = (0, _background.calculateBackgroungPositioningArea)(container.style.background.backgroundOrigin, container.bounds, container.style.padding, container.style.border);
|
||||
var backgroundImageSize = (0, _background.calculateBackgroundSize)(background, image, backgroundPositioningArea);
|
||||
var position = (0, _background.calculateBackgroundPosition)(background.position, backgroundImageSize, backgroundPositioningArea);
|
||||
var _path = (0, _background.calculateBackgroundRepeatPath)(background, position, backgroundImageSize, backgroundPositioningArea, container.bounds);
|
||||
|
||||
var _offsetX = Math.round(backgroundPositioningArea.left + position.x);
|
||||
var _offsetY = Math.round(backgroundPositioningArea.top + position.y);
|
||||
this.target.renderRepeat(_path, image, backgroundImageSize, _offsetX, _offsetY);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'renderBackgroundGradient',
|
||||
value: function renderBackgroundGradient(container, background) {
|
||||
var backgroundPositioningArea = (0, _background.calculateBackgroungPositioningArea)(container.style.background.backgroundOrigin, container.bounds, container.style.padding, container.style.border);
|
||||
var backgroundImageSize = (0, _background.calculateGradientBackgroundSize)(background, backgroundPositioningArea);
|
||||
var position = (0, _background.calculateBackgroundPosition)(background.position, backgroundImageSize, backgroundPositioningArea);
|
||||
var gradientBounds = new _Bounds.Bounds(Math.round(backgroundPositioningArea.left + position.x), Math.round(backgroundPositioningArea.top + position.y), backgroundImageSize.width, backgroundImageSize.height);
|
||||
|
||||
var gradient = (0, _Gradient.parseGradient)(container, background.source, gradientBounds);
|
||||
if (gradient) {
|
||||
switch (gradient.type) {
|
||||
case _Gradient.GRADIENT_TYPE.LINEAR_GRADIENT:
|
||||
// $FlowFixMe
|
||||
this.target.renderLinearGradient(gradientBounds, gradient);
|
||||
break;
|
||||
case _Gradient.GRADIENT_TYPE.RADIAL_GRADIENT:
|
||||
// $FlowFixMe
|
||||
this.target.renderRadialGradient(gradientBounds, gradient);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'renderBorder',
|
||||
value: function renderBorder(border, side, curvePoints) {
|
||||
this.target.drawShape((0, _Bounds.parsePathForBorder)(curvePoints, side), border.borderColor);
|
||||
}
|
||||
}, {
|
||||
key: 'renderStack',
|
||||
value: function renderStack(stack) {
|
||||
var _this4 = this;
|
||||
|
||||
if (stack.container.isVisible()) {
|
||||
var _opacity = stack.getOpacity();
|
||||
if (_opacity !== this._opacity) {
|
||||
this.target.setOpacity(stack.getOpacity());
|
||||
this._opacity = _opacity;
|
||||
}
|
||||
|
||||
var _transform = stack.container.style.transform;
|
||||
if (_transform !== null) {
|
||||
this.target.transform(stack.container.bounds.left + _transform.transformOrigin[0].value, stack.container.bounds.top + _transform.transformOrigin[1].value, _transform.transform, function () {
|
||||
return _this4.renderStackContent(stack);
|
||||
});
|
||||
} else {
|
||||
this.renderStackContent(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'renderStackContent',
|
||||
value: function renderStackContent(stack) {
|
||||
var _splitStackingContext = splitStackingContexts(stack),
|
||||
_splitStackingContext2 = _slicedToArray(_splitStackingContext, 5),
|
||||
negativeZIndex = _splitStackingContext2[0],
|
||||
zeroOrAutoZIndexOrTransformedOrOpacity = _splitStackingContext2[1],
|
||||
positiveZIndex = _splitStackingContext2[2],
|
||||
nonPositionedFloats = _splitStackingContext2[3],
|
||||
nonPositionedInlineLevel = _splitStackingContext2[4];
|
||||
|
||||
var _splitDescendants = splitDescendants(stack),
|
||||
_splitDescendants2 = _slicedToArray(_splitDescendants, 2),
|
||||
inlineLevel = _splitDescendants2[0],
|
||||
nonInlineLevel = _splitDescendants2[1];
|
||||
|
||||
// https://www.w3.org/TR/css-position-3/#painting-order
|
||||
// 1. the background and borders of the element forming the stacking context.
|
||||
|
||||
|
||||
this.renderNodeBackgroundAndBorders(stack.container);
|
||||
// 2. the child stacking contexts with negative stack levels (most negative first).
|
||||
negativeZIndex.sort(sortByZIndex).forEach(this.renderStack, this);
|
||||
// 3. For all its in-flow, non-positioned, block-level descendants in tree order:
|
||||
this.renderNodeContent(stack.container);
|
||||
nonInlineLevel.forEach(this.renderNode, this);
|
||||
// 4. All non-positioned floating descendants, in tree order. For each one of these,
|
||||
// treat the element as if it created a new stacking context, but any positioned descendants and descendants
|
||||
// which actually create a new stacking context should be considered part of the parent stacking context,
|
||||
// not this new one.
|
||||
nonPositionedFloats.forEach(this.renderStack, this);
|
||||
// 5. the in-flow, inline-level, non-positioned descendants, including inline tables and inline blocks.
|
||||
nonPositionedInlineLevel.forEach(this.renderStack, this);
|
||||
inlineLevel.forEach(this.renderNode, this);
|
||||
// 6. All positioned, opacity or transform descendants, in tree order that fall into the following categories:
|
||||
// All positioned descendants with 'z-index: auto' or 'z-index: 0', in tree order.
|
||||
// For those with 'z-index: auto', treat the element as if it created a new stacking context,
|
||||
// but any positioned descendants and descendants which actually create a new stacking context should be
|
||||
// considered part of the parent stacking context, not this new one. For those with 'z-index: 0',
|
||||
// treat the stacking context generated atomically.
|
||||
//
|
||||
// All opacity descendants with opacity less than 1
|
||||
//
|
||||
// All transform descendants with transform other than none
|
||||
zeroOrAutoZIndexOrTransformedOrOpacity.forEach(this.renderStack, this);
|
||||
// 7. Stacking contexts formed by positioned descendants with z-indices greater than or equal to 1 in z-index
|
||||
// order (smallest first) then tree order.
|
||||
positiveZIndex.sort(sortByZIndex).forEach(this.renderStack, this);
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render(stack) {
|
||||
var _this5 = this;
|
||||
|
||||
if (this.options.backgroundColor) {
|
||||
this.target.rectangle(this.options.x, this.options.y, this.options.width, this.options.height, this.options.backgroundColor);
|
||||
}
|
||||
this.renderStack(stack);
|
||||
var target = this.target.getTarget();
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
return target.then(function (output) {
|
||||
_this5.options.logger.log('Render completed');
|
||||
return output;
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Renderer;
|
||||
}();
|
||||
|
||||
exports.default = Renderer;
|
||||
|
||||
|
||||
var splitDescendants = function splitDescendants(stack) {
|
||||
var inlineLevel = [];
|
||||
var nonInlineLevel = [];
|
||||
|
||||
var length = stack.children.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
var child = stack.children[i];
|
||||
if (child.isInlineLevel()) {
|
||||
inlineLevel.push(child);
|
||||
} else {
|
||||
nonInlineLevel.push(child);
|
||||
}
|
||||
}
|
||||
return [inlineLevel, nonInlineLevel];
|
||||
};
|
||||
|
||||
var splitStackingContexts = function splitStackingContexts(stack) {
|
||||
var negativeZIndex = [];
|
||||
var zeroOrAutoZIndexOrTransformedOrOpacity = [];
|
||||
var positiveZIndex = [];
|
||||
var nonPositionedFloats = [];
|
||||
var nonPositionedInlineLevel = [];
|
||||
var length = stack.contexts.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
var child = stack.contexts[i];
|
||||
if (child.container.isPositioned() || child.container.style.opacity < 1 || child.container.isTransformed()) {
|
||||
if (child.container.style.zIndex.order < 0) {
|
||||
negativeZIndex.push(child);
|
||||
} else if (child.container.style.zIndex.order > 0) {
|
||||
positiveZIndex.push(child);
|
||||
} else {
|
||||
zeroOrAutoZIndexOrTransformedOrOpacity.push(child);
|
||||
}
|
||||
} else {
|
||||
if (child.container.isFloating()) {
|
||||
nonPositionedFloats.push(child);
|
||||
} else {
|
||||
nonPositionedInlineLevel.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
return [negativeZIndex, zeroOrAutoZIndexOrTransformedOrOpacity, positiveZIndex, nonPositionedFloats, nonPositionedInlineLevel];
|
||||
};
|
||||
|
||||
var sortByZIndex = function sortByZIndex(a, b) {
|
||||
if (a.container.style.zIndex.order > b.container.style.zIndex.order) {
|
||||
return 1;
|
||||
} else if (a.container.style.zIndex.order < b.container.style.zIndex.order) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return a.container.index > b.container.index ? 1 : -1;
|
||||
};
|
271
AstuteClient2/src/assets/html2canvas/dist/npm/ResourceLoader.js
vendored
Normal file
271
AstuteClient2/src/assets/html2canvas/dist/npm/ResourceLoader.js
vendored
Normal file
|
@ -0,0 +1,271 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ResourceStore = undefined;
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _Feature = require('./Feature');
|
||||
|
||||
var _Feature2 = _interopRequireDefault(_Feature);
|
||||
|
||||
var _Proxy = require('./Proxy');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var ResourceLoader = function () {
|
||||
function ResourceLoader(options, logger, window) {
|
||||
_classCallCheck(this, ResourceLoader);
|
||||
|
||||
this.options = options;
|
||||
this._window = window;
|
||||
this.origin = this.getOrigin(window.location.href);
|
||||
this.cache = {};
|
||||
this.logger = logger;
|
||||
this._index = 0;
|
||||
}
|
||||
|
||||
_createClass(ResourceLoader, [{
|
||||
key: 'loadImage',
|
||||
value: function loadImage(src) {
|
||||
var _this = this;
|
||||
|
||||
if (this.hasResourceInCache(src)) {
|
||||
return src;
|
||||
}
|
||||
if (isBlobImage(src)) {
|
||||
this.cache[src] = _loadImage(src, this.options.imageTimeout || 0);
|
||||
return src;
|
||||
}
|
||||
|
||||
if (!isSVG(src) || _Feature2.default.SUPPORT_SVG_DRAWING) {
|
||||
if (this.options.allowTaint === true || isInlineImage(src) || this.isSameOrigin(src)) {
|
||||
return this.addImage(src, src, false);
|
||||
} else if (!this.isSameOrigin(src)) {
|
||||
if (typeof this.options.proxy === 'string') {
|
||||
this.cache[src] = (0, _Proxy.Proxy)(src, this.options).then(function (src) {
|
||||
return _loadImage(src, _this.options.imageTimeout || 0);
|
||||
});
|
||||
return src;
|
||||
} else if (this.options.useCORS === true && _Feature2.default.SUPPORT_CORS_IMAGES) {
|
||||
return this.addImage(src, src, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'inlineImage',
|
||||
value: function inlineImage(src) {
|
||||
var _this2 = this;
|
||||
|
||||
if (isInlineImage(src)) {
|
||||
return _loadImage(src, this.options.imageTimeout || 0);
|
||||
}
|
||||
if (this.hasResourceInCache(src)) {
|
||||
return this.cache[src];
|
||||
}
|
||||
if (!this.isSameOrigin(src) && typeof this.options.proxy === 'string') {
|
||||
return this.cache[src] = (0, _Proxy.Proxy)(src, this.options).then(function (src) {
|
||||
return _loadImage(src, _this2.options.imageTimeout || 0);
|
||||
});
|
||||
}
|
||||
|
||||
return this.xhrImage(src);
|
||||
}
|
||||
}, {
|
||||
key: 'xhrImage',
|
||||
value: function xhrImage(src) {
|
||||
var _this3 = this;
|
||||
|
||||
this.cache[src] = new Promise(function (resolve, reject) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status !== 200) {
|
||||
reject('Failed to fetch image ' + src.substring(0, 256) + ' with status code ' + xhr.status);
|
||||
} else {
|
||||
var reader = new FileReader();
|
||||
reader.addEventListener('load', function () {
|
||||
// $FlowFixMe
|
||||
var result = reader.result;
|
||||
resolve(result);
|
||||
}, false);
|
||||
reader.addEventListener('error', function (e) {
|
||||
return reject(e);
|
||||
}, false);
|
||||
reader.readAsDataURL(xhr.response);
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.responseType = 'blob';
|
||||
if (_this3.options.imageTimeout) {
|
||||
var timeout = _this3.options.imageTimeout;
|
||||
xhr.timeout = timeout;
|
||||
xhr.ontimeout = function () {
|
||||
return reject(process.env.NODE_ENV !== 'production' ? 'Timed out (' + timeout + 'ms) fetching ' + src.substring(0, 256) : '');
|
||||
};
|
||||
}
|
||||
xhr.open('GET', src, true);
|
||||
xhr.send();
|
||||
}).then(function (src) {
|
||||
return _loadImage(src, _this3.options.imageTimeout || 0);
|
||||
});
|
||||
|
||||
return this.cache[src];
|
||||
}
|
||||
}, {
|
||||
key: 'loadCanvas',
|
||||
value: function loadCanvas(node) {
|
||||
var key = String(this._index++);
|
||||
this.cache[key] = Promise.resolve(node);
|
||||
return key;
|
||||
}
|
||||
}, {
|
||||
key: 'hasResourceInCache',
|
||||
value: function hasResourceInCache(key) {
|
||||
return typeof this.cache[key] !== 'undefined';
|
||||
}
|
||||
}, {
|
||||
key: 'addImage',
|
||||
value: function addImage(key, src, useCORS) {
|
||||
var _this4 = this;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
this.logger.log('Added image ' + key.substring(0, 256));
|
||||
}
|
||||
|
||||
var imageLoadHandler = function imageLoadHandler(supportsDataImages) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var img = new Image();
|
||||
img.onload = function () {
|
||||
return resolve(img);
|
||||
};
|
||||
//ios safari 10.3 taints canvas with data urls unless crossOrigin is set to anonymous
|
||||
if (!supportsDataImages || useCORS) {
|
||||
img.crossOrigin = 'anonymous';
|
||||
}
|
||||
|
||||
img.onerror = reject;
|
||||
img.src = src;
|
||||
if (img.complete === true) {
|
||||
// Inline XML images may fail to parse, throwing an Error later on
|
||||
setTimeout(function () {
|
||||
resolve(img);
|
||||
}, 500);
|
||||
}
|
||||
if (_this4.options.imageTimeout) {
|
||||
var timeout = _this4.options.imageTimeout;
|
||||
setTimeout(function () {
|
||||
return reject(process.env.NODE_ENV !== 'production' ? 'Timed out (' + timeout + 'ms) fetching ' + src.substring(0, 256) : '');
|
||||
}, timeout);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.cache[key] = isInlineBase64Image(src) && !isSVG(src) ? // $FlowFixMe
|
||||
_Feature2.default.SUPPORT_BASE64_DRAWING(src).then(imageLoadHandler) : imageLoadHandler(true);
|
||||
return key;
|
||||
}
|
||||
}, {
|
||||
key: 'isSameOrigin',
|
||||
value: function isSameOrigin(url) {
|
||||
return this.getOrigin(url) === this.origin;
|
||||
}
|
||||
}, {
|
||||
key: 'getOrigin',
|
||||
value: function getOrigin(url) {
|
||||
var link = this._link || (this._link = this._window.document.createElement('a'));
|
||||
link.href = url;
|
||||
link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/
|
||||
return link.protocol + link.hostname + link.port;
|
||||
}
|
||||
}, {
|
||||
key: 'ready',
|
||||
value: function ready() {
|
||||
var _this5 = this;
|
||||
|
||||
var keys = Object.keys(this.cache);
|
||||
var values = keys.map(function (str) {
|
||||
return _this5.cache[str].catch(function (e) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
_this5.logger.log('Unable to load image', e);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
});
|
||||
return Promise.all(values).then(function (images) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
_this5.logger.log('Finished loading ' + images.length + ' images', images);
|
||||
}
|
||||
return new ResourceStore(keys, images);
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return ResourceLoader;
|
||||
}();
|
||||
|
||||
exports.default = ResourceLoader;
|
||||
|
||||
var ResourceStore = exports.ResourceStore = function () {
|
||||
function ResourceStore(keys, resources) {
|
||||
_classCallCheck(this, ResourceStore);
|
||||
|
||||
this._keys = keys;
|
||||
this._resources = resources;
|
||||
}
|
||||
|
||||
_createClass(ResourceStore, [{
|
||||
key: 'get',
|
||||
value: function get(key) {
|
||||
var index = this._keys.indexOf(key);
|
||||
return index === -1 ? null : this._resources[index];
|
||||
}
|
||||
}]);
|
||||
|
||||
return ResourceStore;
|
||||
}();
|
||||
|
||||
var INLINE_SVG = /^data:image\/svg\+xml/i;
|
||||
var INLINE_BASE64 = /^data:image\/.*;base64,/i;
|
||||
var INLINE_IMG = /^data:image\/.*/i;
|
||||
|
||||
var isInlineImage = function isInlineImage(src) {
|
||||
return INLINE_IMG.test(src);
|
||||
};
|
||||
var isInlineBase64Image = function isInlineBase64Image(src) {
|
||||
return INLINE_BASE64.test(src);
|
||||
};
|
||||
var isBlobImage = function isBlobImage(src) {
|
||||
return src.substr(0, 4) === 'blob';
|
||||
};
|
||||
|
||||
var isSVG = function isSVG(src) {
|
||||
return src.substr(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src);
|
||||
};
|
||||
|
||||
var _loadImage = function _loadImage(src, timeout) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var img = new Image();
|
||||
img.onload = function () {
|
||||
return resolve(img);
|
||||
};
|
||||
img.onerror = reject;
|
||||
img.src = src;
|
||||
if (img.complete === true) {
|
||||
// Inline XML images may fail to parse, throwing an Error later on
|
||||
setTimeout(function () {
|
||||
resolve(img);
|
||||
}, 500);
|
||||
}
|
||||
if (timeout) {
|
||||
setTimeout(function () {
|
||||
return reject(process.env.NODE_ENV !== 'production' ? 'Timed out (' + timeout + 'ms) loading image' : '');
|
||||
}, timeout);
|
||||
}
|
||||
});
|
||||
};
|
45
AstuteClient2/src/assets/html2canvas/dist/npm/StackingContext.js
vendored
Normal file
45
AstuteClient2/src/assets/html2canvas/dist/npm/StackingContext.js
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _NodeContainer = require('./NodeContainer');
|
||||
|
||||
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
||||
|
||||
var _position = require('./parsing/position');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var StackingContext = function () {
|
||||
function StackingContext(container, parent, treatAsRealStackingContext) {
|
||||
_classCallCheck(this, StackingContext);
|
||||
|
||||
this.container = container;
|
||||
this.parent = parent;
|
||||
this.contexts = [];
|
||||
this.children = [];
|
||||
this.treatAsRealStackingContext = treatAsRealStackingContext;
|
||||
}
|
||||
|
||||
_createClass(StackingContext, [{
|
||||
key: 'getOpacity',
|
||||
value: function getOpacity() {
|
||||
return this.parent ? this.container.style.opacity * this.parent.getOpacity() : this.container.style.opacity;
|
||||
}
|
||||
}, {
|
||||
key: 'getRealParentStackingContext',
|
||||
value: function getRealParentStackingContext() {
|
||||
return !this.parent || this.treatAsRealStackingContext ? this : this.parent.getRealParentStackingContext();
|
||||
}
|
||||
}]);
|
||||
|
||||
return StackingContext;
|
||||
}();
|
||||
|
||||
exports.default = StackingContext;
|
78
AstuteClient2/src/assets/html2canvas/dist/npm/TextBounds.js
vendored
Normal file
78
AstuteClient2/src/assets/html2canvas/dist/npm/TextBounds.js
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseTextBounds = exports.TextBounds = undefined;
|
||||
|
||||
var _Bounds = require('./Bounds');
|
||||
|
||||
var _textDecoration = require('./parsing/textDecoration');
|
||||
|
||||
var _Feature = require('./Feature');
|
||||
|
||||
var _Feature2 = _interopRequireDefault(_Feature);
|
||||
|
||||
var _Unicode = require('./Unicode');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var TextBounds = exports.TextBounds = function TextBounds(text, bounds) {
|
||||
_classCallCheck(this, TextBounds);
|
||||
|
||||
this.text = text;
|
||||
this.bounds = bounds;
|
||||
};
|
||||
|
||||
var parseTextBounds = exports.parseTextBounds = function parseTextBounds(value, parent, node) {
|
||||
var letterRendering = parent.style.letterSpacing !== 0;
|
||||
var textList = letterRendering ? (0, _Unicode.toCodePoints)(value).map(function (i) {
|
||||
return (0, _Unicode.fromCodePoint)(i);
|
||||
}) : (0, _Unicode.breakWords)(value, parent);
|
||||
var length = textList.length;
|
||||
var defaultView = node.parentNode ? node.parentNode.ownerDocument.defaultView : null;
|
||||
var scrollX = defaultView ? defaultView.pageXOffset : 0;
|
||||
var scrollY = defaultView ? defaultView.pageYOffset : 0;
|
||||
var textBounds = [];
|
||||
var offset = 0;
|
||||
for (var i = 0; i < length; i++) {
|
||||
var text = textList[i];
|
||||
if (parent.style.textDecoration !== _textDecoration.TEXT_DECORATION.NONE || text.trim().length > 0) {
|
||||
if (_Feature2.default.SUPPORT_RANGE_BOUNDS) {
|
||||
textBounds.push(new TextBounds(text, getRangeBounds(node, offset, text.length, scrollX, scrollY)));
|
||||
} else {
|
||||
var replacementNode = node.splitText(text.length);
|
||||
textBounds.push(new TextBounds(text, getWrapperBounds(node, scrollX, scrollY)));
|
||||
node = replacementNode;
|
||||
}
|
||||
} else if (!_Feature2.default.SUPPORT_RANGE_BOUNDS) {
|
||||
node = node.splitText(text.length);
|
||||
}
|
||||
offset += text.length;
|
||||
}
|
||||
return textBounds;
|
||||
};
|
||||
|
||||
var getWrapperBounds = function getWrapperBounds(node, scrollX, scrollY) {
|
||||
var wrapper = node.ownerDocument.createElement('html2canvaswrapper');
|
||||
wrapper.appendChild(node.cloneNode(true));
|
||||
var parentNode = node.parentNode;
|
||||
if (parentNode) {
|
||||
parentNode.replaceChild(wrapper, node);
|
||||
var bounds = (0, _Bounds.parseBounds)(wrapper, scrollX, scrollY);
|
||||
if (wrapper.firstChild) {
|
||||
parentNode.replaceChild(wrapper.firstChild, wrapper);
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
return new _Bounds.Bounds(0, 0, 0, 0);
|
||||
};
|
||||
|
||||
var getRangeBounds = function getRangeBounds(node, offset, length, scrollX, scrollY) {
|
||||
var range = node.ownerDocument.createRange();
|
||||
range.setStart(node, offset);
|
||||
range.setEnd(node, offset + length);
|
||||
return _Bounds.Bounds.fromClientRect(range.getBoundingClientRect(), scrollX, scrollY);
|
||||
};
|
59
AstuteClient2/src/assets/html2canvas/dist/npm/TextContainer.js
vendored
Normal file
59
AstuteClient2/src/assets/html2canvas/dist/npm/TextContainer.js
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _textTransform = require('./parsing/textTransform');
|
||||
|
||||
var _TextBounds = require('./TextBounds');
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var TextContainer = function () {
|
||||
function TextContainer(text, parent, bounds) {
|
||||
_classCallCheck(this, TextContainer);
|
||||
|
||||
this.text = text;
|
||||
this.parent = parent;
|
||||
this.bounds = bounds;
|
||||
}
|
||||
|
||||
_createClass(TextContainer, null, [{
|
||||
key: 'fromTextNode',
|
||||
value: function fromTextNode(node, parent) {
|
||||
var text = transform(node.data, parent.style.textTransform);
|
||||
return new TextContainer(text, parent, (0, _TextBounds.parseTextBounds)(text, parent, node));
|
||||
}
|
||||
}]);
|
||||
|
||||
return TextContainer;
|
||||
}();
|
||||
|
||||
exports.default = TextContainer;
|
||||
|
||||
|
||||
var CAPITALIZE = /(^|\s|:|-|\(|\))([a-z])/g;
|
||||
|
||||
var transform = function transform(text, _transform) {
|
||||
switch (_transform) {
|
||||
case _textTransform.TEXT_TRANSFORM.LOWERCASE:
|
||||
return text.toLowerCase();
|
||||
case _textTransform.TEXT_TRANSFORM.CAPITALIZE:
|
||||
return text.replace(CAPITALIZE, capitalize);
|
||||
case _textTransform.TEXT_TRANSFORM.UPPERCASE:
|
||||
return text.toUpperCase();
|
||||
default:
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
function capitalize(m, p1, p2) {
|
||||
if (m.length > 0) {
|
||||
return p1 + p2.toUpperCase();
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
45
AstuteClient2/src/assets/html2canvas/dist/npm/Unicode.js
vendored
Normal file
45
AstuteClient2/src/assets/html2canvas/dist/npm/Unicode.js
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.breakWords = exports.fromCodePoint = exports.toCodePoints = undefined;
|
||||
|
||||
var _cssLineBreak = require('css-line-break');
|
||||
|
||||
Object.defineProperty(exports, 'toCodePoints', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _cssLineBreak.toCodePoints;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'fromCodePoint', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _cssLineBreak.fromCodePoint;
|
||||
}
|
||||
});
|
||||
|
||||
var _NodeContainer = require('./NodeContainer');
|
||||
|
||||
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
||||
|
||||
var _overflowWrap = require('./parsing/overflowWrap');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var breakWords = exports.breakWords = function breakWords(str, parent) {
|
||||
var breaker = (0, _cssLineBreak.LineBreaker)(str, {
|
||||
lineBreak: parent.style.lineBreak,
|
||||
wordBreak: parent.style.overflowWrap === _overflowWrap.OVERFLOW_WRAP.BREAK_WORD ? 'break-word' : parent.style.wordBreak
|
||||
});
|
||||
|
||||
var words = [];
|
||||
var bk = void 0;
|
||||
|
||||
while (!(bk = breaker.next()).done) {
|
||||
words.push(bk.value.slice());
|
||||
}
|
||||
|
||||
return words;
|
||||
};
|
26
AstuteClient2/src/assets/html2canvas/dist/npm/Util.js
vendored
Normal file
26
AstuteClient2/src/assets/html2canvas/dist/npm/Util.js
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var contains = exports.contains = function contains(bit, value) {
|
||||
return (bit & value) !== 0;
|
||||
};
|
||||
|
||||
var distance = exports.distance = function distance(a, b) {
|
||||
return Math.sqrt(a * a + b * b);
|
||||
};
|
||||
|
||||
var copyCSSStyles = exports.copyCSSStyles = function copyCSSStyles(style, target) {
|
||||
// Edge does not provide value for cssText
|
||||
for (var i = style.length - 1; i >= 0; i--) {
|
||||
var property = style.item(i);
|
||||
// Safari shows pseudoelements if content is set
|
||||
if (property !== 'content') {
|
||||
target.style.setProperty(property, style.getPropertyValue(property));
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
var SMALL_IMAGE = exports.SMALL_IMAGE = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
|
157
AstuteClient2/src/assets/html2canvas/dist/npm/Window.js
vendored
Normal file
157
AstuteClient2/src/assets/html2canvas/dist/npm/Window.js
vendored
Normal file
|
@ -0,0 +1,157 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.renderElement = undefined;
|
||||
|
||||
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"); } }; }();
|
||||
|
||||
var _Logger = require('./Logger');
|
||||
|
||||
var _Logger2 = _interopRequireDefault(_Logger);
|
||||
|
||||
var _NodeParser = require('./NodeParser');
|
||||
|
||||
var _Renderer = require('./Renderer');
|
||||
|
||||
var _Renderer2 = _interopRequireDefault(_Renderer);
|
||||
|
||||
var _ForeignObjectRenderer = require('./renderer/ForeignObjectRenderer');
|
||||
|
||||
var _ForeignObjectRenderer2 = _interopRequireDefault(_ForeignObjectRenderer);
|
||||
|
||||
var _Feature = require('./Feature');
|
||||
|
||||
var _Feature2 = _interopRequireDefault(_Feature);
|
||||
|
||||
var _Bounds = require('./Bounds');
|
||||
|
||||
var _Clone = require('./Clone');
|
||||
|
||||
var _Font = require('./Font');
|
||||
|
||||
var _Color = require('./Color');
|
||||
|
||||
var _Color2 = _interopRequireDefault(_Color);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var renderElement = exports.renderElement = function renderElement(element, options, logger) {
|
||||
var ownerDocument = element.ownerDocument;
|
||||
|
||||
var windowBounds = new _Bounds.Bounds(options.scrollX, options.scrollY, options.windowWidth, options.windowHeight);
|
||||
|
||||
// http://www.w3.org/TR/css3-background/#special-backgrounds
|
||||
var documentBackgroundColor = ownerDocument.documentElement ? new _Color2.default(getComputedStyle(ownerDocument.documentElement).backgroundColor) : _Color.TRANSPARENT;
|
||||
var bodyBackgroundColor = ownerDocument.body ? new _Color2.default(getComputedStyle(ownerDocument.body).backgroundColor) : _Color.TRANSPARENT;
|
||||
|
||||
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;
|
||||
|
||||
return (options.foreignObjectRendering ? // $FlowFixMe
|
||||
_Feature2.default.SUPPORT_FOREIGNOBJECT_DRAWING : Promise.resolve(false)).then(function (supportForeignObject) {
|
||||
return supportForeignObject ? function (cloner) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
logger.log('Document cloned, using foreignObject rendering');
|
||||
}
|
||||
|
||||
return cloner.inlineFonts(ownerDocument).then(function () {
|
||||
return cloner.resourceLoader.ready();
|
||||
}).then(function () {
|
||||
var renderer = new _ForeignObjectRenderer2.default(cloner.documentElement);
|
||||
|
||||
var defaultView = ownerDocument.defaultView;
|
||||
var scrollX = defaultView.pageXOffset;
|
||||
var scrollY = defaultView.pageYOffset;
|
||||
|
||||
var isDocument = element.tagName === 'HTML' || element.tagName === 'BODY';
|
||||
|
||||
var _ref = isDocument ? (0, _Bounds.parseDocumentSize)(ownerDocument) : (0, _Bounds.parseBounds)(element, scrollX, scrollY),
|
||||
width = _ref.width,
|
||||
height = _ref.height,
|
||||
left = _ref.left,
|
||||
top = _ref.top;
|
||||
|
||||
return renderer.render({
|
||||
backgroundColor: backgroundColor,
|
||||
logger: logger,
|
||||
scale: options.scale,
|
||||
x: typeof options.x === 'number' ? options.x : left,
|
||||
y: typeof options.y === 'number' ? options.y : top,
|
||||
width: typeof options.width === 'number' ? options.width : Math.ceil(width),
|
||||
height: typeof options.height === 'number' ? options.height : Math.ceil(height),
|
||||
windowWidth: options.windowWidth,
|
||||
windowHeight: options.windowHeight,
|
||||
scrollX: options.scrollX,
|
||||
scrollY: options.scrollY
|
||||
});
|
||||
});
|
||||
}(new _Clone.DocumentCloner(element, options, logger, true, renderElement)) : (0, _Clone.cloneWindow)(ownerDocument, windowBounds, element, options, logger, renderElement).then(function (_ref2) {
|
||||
var _ref3 = _slicedToArray(_ref2, 3),
|
||||
container = _ref3[0],
|
||||
clonedElement = _ref3[1],
|
||||
resourceLoader = _ref3[2];
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
logger.log('Document cloned, using computed rendering');
|
||||
}
|
||||
|
||||
var stack = (0, _NodeParser.NodeParser)(clonedElement, resourceLoader, logger);
|
||||
var clonedDocument = clonedElement.ownerDocument;
|
||||
|
||||
if (backgroundColor === stack.container.style.background.backgroundColor) {
|
||||
stack.container.style.background.backgroundColor = _Color.TRANSPARENT;
|
||||
}
|
||||
|
||||
return resourceLoader.ready().then(function (imageStore) {
|
||||
var fontMetrics = new _Font.FontMetrics(clonedDocument);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
logger.log('Starting renderer');
|
||||
}
|
||||
|
||||
var defaultView = clonedDocument.defaultView;
|
||||
var scrollX = defaultView.pageXOffset;
|
||||
var scrollY = defaultView.pageYOffset;
|
||||
|
||||
var isDocument = clonedElement.tagName === 'HTML' || clonedElement.tagName === 'BODY';
|
||||
|
||||
var _ref4 = isDocument ? (0, _Bounds.parseDocumentSize)(ownerDocument) : (0, _Bounds.parseBounds)(clonedElement, scrollX, scrollY),
|
||||
width = _ref4.width,
|
||||
height = _ref4.height,
|
||||
left = _ref4.left,
|
||||
top = _ref4.top;
|
||||
|
||||
var renderOptions = {
|
||||
backgroundColor: backgroundColor,
|
||||
fontMetrics: fontMetrics,
|
||||
imageStore: imageStore,
|
||||
logger: logger,
|
||||
scale: options.scale,
|
||||
x: typeof options.x === 'number' ? options.x : left,
|
||||
y: typeof options.y === 'number' ? options.y : top,
|
||||
width: typeof options.width === 'number' ? options.width : Math.ceil(width),
|
||||
height: typeof options.height === 'number' ? options.height : Math.ceil(height)
|
||||
};
|
||||
|
||||
if (Array.isArray(options.target)) {
|
||||
return Promise.all(options.target.map(function (target) {
|
||||
var renderer = new _Renderer2.default(target, renderOptions);
|
||||
return renderer.render(stack);
|
||||
}));
|
||||
} else {
|
||||
var renderer = new _Renderer2.default(options.target, renderOptions);
|
||||
var canvas = renderer.render(stack);
|
||||
if (options.removeContainer === true) {
|
||||
if (container.parentNode) {
|
||||
container.parentNode.removeChild(container);
|
||||
} else if (process.env.NODE_ENV !== 'production') {
|
||||
logger.log('Cannot detach cloned iframe as it is not in the DOM anymore');
|
||||
}
|
||||
}
|
||||
|
||||
return canvas;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
55
AstuteClient2/src/assets/html2canvas/dist/npm/drawing/BezierCurve.js
vendored
Normal file
55
AstuteClient2/src/assets/html2canvas/dist/npm/drawing/BezierCurve.js
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _Path = require('./Path');
|
||||
|
||||
var _Vector = require('./Vector');
|
||||
|
||||
var _Vector2 = _interopRequireDefault(_Vector);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var lerp = function lerp(a, b, t) {
|
||||
return new _Vector2.default(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
|
||||
};
|
||||
|
||||
var BezierCurve = function () {
|
||||
function BezierCurve(start, startControl, endControl, end) {
|
||||
_classCallCheck(this, BezierCurve);
|
||||
|
||||
this.type = _Path.PATH.BEZIER_CURVE;
|
||||
this.start = start;
|
||||
this.startControl = startControl;
|
||||
this.endControl = endControl;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
_createClass(BezierCurve, [{
|
||||
key: 'subdivide',
|
||||
value: function subdivide(t, firstHalf) {
|
||||
var ab = lerp(this.start, this.startControl, t);
|
||||
var bc = lerp(this.startControl, this.endControl, t);
|
||||
var cd = lerp(this.endControl, this.end, t);
|
||||
var abbc = lerp(ab, bc, t);
|
||||
var bccd = lerp(bc, cd, t);
|
||||
var dest = lerp(abbc, bccd, t);
|
||||
return firstHalf ? new BezierCurve(this.start, ab, abbc, dest) : new BezierCurve(dest, bccd, cd, this.end);
|
||||
}
|
||||
}, {
|
||||
key: 'reverse',
|
||||
value: function reverse() {
|
||||
return new BezierCurve(this.end, this.endControl, this.startControl, this.start);
|
||||
}
|
||||
}]);
|
||||
|
||||
return BezierCurve;
|
||||
}();
|
||||
|
||||
exports.default = BezierCurve;
|
31
AstuteClient2/src/assets/html2canvas/dist/npm/drawing/Circle.js
vendored
Normal file
31
AstuteClient2/src/assets/html2canvas/dist/npm/drawing/Circle.js
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _Path = require('./Path');
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Circle = function Circle(x, y, radius) {
|
||||
_classCallCheck(this, Circle);
|
||||
|
||||
this.type = _Path.PATH.CIRCLE;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.radius = radius;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (isNaN(x)) {
|
||||
console.error('Invalid x value given for Circle');
|
||||
}
|
||||
if (isNaN(y)) {
|
||||
console.error('Invalid y value given for Circle');
|
||||
}
|
||||
if (isNaN(radius)) {
|
||||
console.error('Invalid radius value given for Circle');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = Circle;
|
10
AstuteClient2/src/assets/html2canvas/dist/npm/drawing/Path.js
vendored
Normal file
10
AstuteClient2/src/assets/html2canvas/dist/npm/drawing/Path.js
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var PATH = exports.PATH = {
|
||||
VECTOR: 0,
|
||||
BEZIER_CURVE: 1,
|
||||
CIRCLE: 2
|
||||
};
|
16
AstuteClient2/src/assets/html2canvas/dist/npm/drawing/Size.js
vendored
Normal file
16
AstuteClient2/src/assets/html2canvas/dist/npm/drawing/Size.js
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Size = function Size(width, height) {
|
||||
_classCallCheck(this, Size);
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
};
|
||||
|
||||
exports.default = Size;
|
27
AstuteClient2/src/assets/html2canvas/dist/npm/drawing/Vector.js
vendored
Normal file
27
AstuteClient2/src/assets/html2canvas/dist/npm/drawing/Vector.js
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _Path = require('./Path');
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Vector = function Vector(x, y) {
|
||||
_classCallCheck(this, Vector);
|
||||
|
||||
this.type = _Path.PATH.VECTOR;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (isNaN(x)) {
|
||||
console.error('Invalid x value given for Vector');
|
||||
}
|
||||
if (isNaN(y)) {
|
||||
console.error('Invalid y value given for Vector');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = Vector;
|
63
AstuteClient2/src/assets/html2canvas/dist/npm/index.js
vendored
Normal file
63
AstuteClient2/src/assets/html2canvas/dist/npm/index.js
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
'use strict';
|
||||
|
||||
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; };
|
||||
|
||||
var _CanvasRenderer = require('./renderer/CanvasRenderer');
|
||||
|
||||
var _CanvasRenderer2 = _interopRequireDefault(_CanvasRenderer);
|
||||
|
||||
var _Logger = require('./Logger');
|
||||
|
||||
var _Logger2 = _interopRequireDefault(_Logger);
|
||||
|
||||
var _Window = require('./Window');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var html2canvas = function html2canvas(element, conf) {
|
||||
var config = conf || {};
|
||||
var logger = new _Logger2.default(typeof config.logging === 'boolean' ? config.logging : true);
|
||||
logger.log('html2canvas ' + "$npm_package_version");
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && typeof config.onrendered === 'function') {
|
||||
logger.error('onrendered option is deprecated, html2canvas returns a Promise with the canvas as the value');
|
||||
}
|
||||
|
||||
var ownerDocument = element.ownerDocument;
|
||||
if (!ownerDocument) {
|
||||
return Promise.reject('Provided element is not within a Document');
|
||||
}
|
||||
var defaultView = ownerDocument.defaultView;
|
||||
|
||||
var defaultOptions = {
|
||||
async: true,
|
||||
allowTaint: false,
|
||||
backgroundColor: '#ffffff',
|
||||
imageTimeout: 15000,
|
||||
logging: true,
|
||||
proxy: null,
|
||||
removeContainer: true,
|
||||
foreignObjectRendering: false,
|
||||
scale: defaultView.devicePixelRatio || 1,
|
||||
target: new _CanvasRenderer2.default(config.canvas),
|
||||
useCORS: false,
|
||||
windowWidth: defaultView.innerWidth,
|
||||
windowHeight: defaultView.innerHeight,
|
||||
scrollX: defaultView.pageXOffset,
|
||||
scrollY: defaultView.pageYOffset
|
||||
};
|
||||
|
||||
var result = (0, _Window.renderElement)(element, _extends({}, defaultOptions, config), logger);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
return result.catch(function (e) {
|
||||
logger.error(e);
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
html2canvas.CanvasRenderer = _CanvasRenderer2.default;
|
||||
|
||||
module.exports = html2canvas;
|
353
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/background.js
vendored
Normal file
353
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/background.js
vendored
Normal file
|
@ -0,0 +1,353 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseBackgroundImage = exports.parseBackground = exports.calculateBackgroundRepeatPath = exports.calculateBackgroundPosition = exports.calculateBackgroungPositioningArea = exports.calculateBackgroungPaintingArea = exports.calculateGradientBackgroundSize = exports.calculateBackgroundSize = exports.BACKGROUND_ORIGIN = exports.BACKGROUND_CLIP = exports.BACKGROUND_SIZE = exports.BACKGROUND_REPEAT = undefined;
|
||||
|
||||
var _Color = require('../Color');
|
||||
|
||||
var _Color2 = _interopRequireDefault(_Color);
|
||||
|
||||
var _Length = require('../Length');
|
||||
|
||||
var _Length2 = _interopRequireDefault(_Length);
|
||||
|
||||
var _Size = require('../drawing/Size');
|
||||
|
||||
var _Size2 = _interopRequireDefault(_Size);
|
||||
|
||||
var _Vector = require('../drawing/Vector');
|
||||
|
||||
var _Vector2 = _interopRequireDefault(_Vector);
|
||||
|
||||
var _Bounds = require('../Bounds');
|
||||
|
||||
var _padding = require('./padding');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var BACKGROUND_REPEAT = exports.BACKGROUND_REPEAT = {
|
||||
REPEAT: 0,
|
||||
NO_REPEAT: 1,
|
||||
REPEAT_X: 2,
|
||||
REPEAT_Y: 3
|
||||
};
|
||||
|
||||
var BACKGROUND_SIZE = exports.BACKGROUND_SIZE = {
|
||||
AUTO: 0,
|
||||
CONTAIN: 1,
|
||||
COVER: 2,
|
||||
LENGTH: 3
|
||||
};
|
||||
|
||||
var BACKGROUND_CLIP = exports.BACKGROUND_CLIP = {
|
||||
BORDER_BOX: 0,
|
||||
PADDING_BOX: 1,
|
||||
CONTENT_BOX: 2
|
||||
};
|
||||
|
||||
var BACKGROUND_ORIGIN = exports.BACKGROUND_ORIGIN = BACKGROUND_CLIP;
|
||||
|
||||
var AUTO = 'auto';
|
||||
|
||||
var BackgroundSize = function BackgroundSize(size) {
|
||||
_classCallCheck(this, BackgroundSize);
|
||||
|
||||
switch (size) {
|
||||
case 'contain':
|
||||
this.size = BACKGROUND_SIZE.CONTAIN;
|
||||
break;
|
||||
case 'cover':
|
||||
this.size = BACKGROUND_SIZE.COVER;
|
||||
break;
|
||||
case 'auto':
|
||||
this.size = BACKGROUND_SIZE.AUTO;
|
||||
break;
|
||||
default:
|
||||
this.value = new _Length2.default(size);
|
||||
}
|
||||
};
|
||||
|
||||
var calculateBackgroundSize = exports.calculateBackgroundSize = function calculateBackgroundSize(backgroundImage, image, bounds) {
|
||||
var width = 0;
|
||||
var height = 0;
|
||||
var size = backgroundImage.size;
|
||||
if (size[0].size === BACKGROUND_SIZE.CONTAIN || size[0].size === BACKGROUND_SIZE.COVER) {
|
||||
var targetRatio = bounds.width / bounds.height;
|
||||
var currentRatio = image.width / image.height;
|
||||
return targetRatio < currentRatio !== (size[0].size === BACKGROUND_SIZE.COVER) ? new _Size2.default(bounds.width, bounds.width / currentRatio) : new _Size2.default(bounds.height * currentRatio, bounds.height);
|
||||
}
|
||||
|
||||
if (size[0].value) {
|
||||
width = size[0].value.getAbsoluteValue(bounds.width);
|
||||
}
|
||||
|
||||
if (size[0].size === BACKGROUND_SIZE.AUTO && size[1].size === BACKGROUND_SIZE.AUTO) {
|
||||
height = image.height;
|
||||
} else if (size[1].size === BACKGROUND_SIZE.AUTO) {
|
||||
height = width / image.width * image.height;
|
||||
} else if (size[1].value) {
|
||||
height = size[1].value.getAbsoluteValue(bounds.height);
|
||||
}
|
||||
|
||||
if (size[0].size === BACKGROUND_SIZE.AUTO) {
|
||||
width = height / image.height * image.width;
|
||||
}
|
||||
|
||||
return new _Size2.default(width, height);
|
||||
};
|
||||
|
||||
var calculateGradientBackgroundSize = exports.calculateGradientBackgroundSize = function calculateGradientBackgroundSize(backgroundImage, bounds) {
|
||||
var size = backgroundImage.size;
|
||||
var width = size[0].value ? size[0].value.getAbsoluteValue(bounds.width) : bounds.width;
|
||||
var height = size[1].value ? size[1].value.getAbsoluteValue(bounds.height) : size[0].value ? width : bounds.height;
|
||||
|
||||
return new _Size2.default(width, height);
|
||||
};
|
||||
|
||||
var AUTO_SIZE = new BackgroundSize(AUTO);
|
||||
|
||||
var calculateBackgroungPaintingArea = exports.calculateBackgroungPaintingArea = function calculateBackgroungPaintingArea(curves, clip) {
|
||||
switch (clip) {
|
||||
case BACKGROUND_CLIP.BORDER_BOX:
|
||||
return (0, _Bounds.calculateBorderBoxPath)(curves);
|
||||
case BACKGROUND_CLIP.PADDING_BOX:
|
||||
default:
|
||||
return (0, _Bounds.calculatePaddingBoxPath)(curves);
|
||||
}
|
||||
};
|
||||
|
||||
var calculateBackgroungPositioningArea = exports.calculateBackgroungPositioningArea = function calculateBackgroungPositioningArea(backgroundOrigin, bounds, padding, border) {
|
||||
var paddingBox = (0, _Bounds.calculatePaddingBox)(bounds, border);
|
||||
|
||||
switch (backgroundOrigin) {
|
||||
case BACKGROUND_ORIGIN.BORDER_BOX:
|
||||
return bounds;
|
||||
case BACKGROUND_ORIGIN.CONTENT_BOX:
|
||||
var paddingLeft = padding[_padding.PADDING_SIDES.LEFT].getAbsoluteValue(bounds.width);
|
||||
var paddingRight = padding[_padding.PADDING_SIDES.RIGHT].getAbsoluteValue(bounds.width);
|
||||
var paddingTop = padding[_padding.PADDING_SIDES.TOP].getAbsoluteValue(bounds.width);
|
||||
var paddingBottom = padding[_padding.PADDING_SIDES.BOTTOM].getAbsoluteValue(bounds.width);
|
||||
return new _Bounds.Bounds(paddingBox.left + paddingLeft, paddingBox.top + paddingTop, paddingBox.width - paddingLeft - paddingRight, paddingBox.height - paddingTop - paddingBottom);
|
||||
case BACKGROUND_ORIGIN.PADDING_BOX:
|
||||
default:
|
||||
return paddingBox;
|
||||
}
|
||||
};
|
||||
|
||||
var calculateBackgroundPosition = exports.calculateBackgroundPosition = function calculateBackgroundPosition(position, size, bounds) {
|
||||
return new _Vector2.default(position[0].getAbsoluteValue(bounds.width - size.width), position[1].getAbsoluteValue(bounds.height - size.height));
|
||||
};
|
||||
|
||||
var calculateBackgroundRepeatPath = exports.calculateBackgroundRepeatPath = function calculateBackgroundRepeatPath(background, position, size, backgroundPositioningArea, bounds) {
|
||||
var repeat = background.repeat;
|
||||
switch (repeat) {
|
||||
case BACKGROUND_REPEAT.REPEAT_X:
|
||||
return [new _Vector2.default(Math.round(bounds.left), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(size.height + backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(bounds.left), Math.round(size.height + backgroundPositioningArea.top + position.y))];
|
||||
case BACKGROUND_REPEAT.REPEAT_Y:
|
||||
return [new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(bounds.top)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(bounds.top)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(bounds.height + bounds.top)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(bounds.height + bounds.top))];
|
||||
case BACKGROUND_REPEAT.NO_REPEAT:
|
||||
return [new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(backgroundPositioningArea.top + position.y + size.height)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(backgroundPositioningArea.top + position.y + size.height))];
|
||||
default:
|
||||
return [new _Vector2.default(Math.round(bounds.left), Math.round(bounds.top)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(bounds.top)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(bounds.height + bounds.top)), new _Vector2.default(Math.round(bounds.left), Math.round(bounds.height + bounds.top))];
|
||||
}
|
||||
};
|
||||
|
||||
var parseBackground = exports.parseBackground = function parseBackground(style, resourceLoader) {
|
||||
return {
|
||||
backgroundColor: new _Color2.default(style.backgroundColor),
|
||||
backgroundImage: parseBackgroundImages(style, resourceLoader),
|
||||
backgroundClip: parseBackgroundClip(style.backgroundClip),
|
||||
backgroundOrigin: parseBackgroundOrigin(style.backgroundOrigin)
|
||||
};
|
||||
};
|
||||
|
||||
var parseBackgroundClip = function parseBackgroundClip(backgroundClip) {
|
||||
switch (backgroundClip) {
|
||||
case 'padding-box':
|
||||
return BACKGROUND_CLIP.PADDING_BOX;
|
||||
case 'content-box':
|
||||
return BACKGROUND_CLIP.CONTENT_BOX;
|
||||
}
|
||||
return BACKGROUND_CLIP.BORDER_BOX;
|
||||
};
|
||||
|
||||
var parseBackgroundOrigin = function parseBackgroundOrigin(backgroundOrigin) {
|
||||
switch (backgroundOrigin) {
|
||||
case 'padding-box':
|
||||
return BACKGROUND_ORIGIN.PADDING_BOX;
|
||||
case 'content-box':
|
||||
return BACKGROUND_ORIGIN.CONTENT_BOX;
|
||||
}
|
||||
return BACKGROUND_ORIGIN.BORDER_BOX;
|
||||
};
|
||||
|
||||
var parseBackgroundRepeat = function parseBackgroundRepeat(backgroundRepeat) {
|
||||
switch (backgroundRepeat.trim()) {
|
||||
case 'no-repeat':
|
||||
return BACKGROUND_REPEAT.NO_REPEAT;
|
||||
case 'repeat-x':
|
||||
case 'repeat no-repeat':
|
||||
return BACKGROUND_REPEAT.REPEAT_X;
|
||||
case 'repeat-y':
|
||||
case 'no-repeat repeat':
|
||||
return BACKGROUND_REPEAT.REPEAT_Y;
|
||||
case 'repeat':
|
||||
return BACKGROUND_REPEAT.REPEAT;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
console.error('Invalid background-repeat value "' + backgroundRepeat + '"');
|
||||
}
|
||||
|
||||
return BACKGROUND_REPEAT.REPEAT;
|
||||
};
|
||||
|
||||
var parseBackgroundImages = function parseBackgroundImages(style, resourceLoader) {
|
||||
var sources = parseBackgroundImage(style.backgroundImage).map(function (backgroundImage) {
|
||||
if (backgroundImage.method === 'url') {
|
||||
var key = resourceLoader.loadImage(backgroundImage.args[0]);
|
||||
backgroundImage.args = key ? [key] : [];
|
||||
}
|
||||
return backgroundImage;
|
||||
});
|
||||
var positions = style.backgroundPosition.split(',');
|
||||
var repeats = style.backgroundRepeat.split(',');
|
||||
var sizes = style.backgroundSize.split(',');
|
||||
|
||||
return sources.map(function (source, index) {
|
||||
var size = (sizes[index] || AUTO).trim().split(' ').map(parseBackgroundSize);
|
||||
var position = (positions[index] || AUTO).trim().split(' ').map(parseBackgoundPosition);
|
||||
|
||||
return {
|
||||
source: source,
|
||||
repeat: parseBackgroundRepeat(typeof repeats[index] === 'string' ? repeats[index] : repeats[0]),
|
||||
size: size.length < 2 ? [size[0], AUTO_SIZE] : [size[0], size[1]],
|
||||
position: position.length < 2 ? [position[0], position[0]] : [position[0], position[1]]
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
var parseBackgroundSize = function parseBackgroundSize(size) {
|
||||
return size === 'auto' ? AUTO_SIZE : new BackgroundSize(size);
|
||||
};
|
||||
|
||||
var parseBackgoundPosition = function parseBackgoundPosition(position) {
|
||||
switch (position) {
|
||||
case 'bottom':
|
||||
case 'right':
|
||||
return new _Length2.default('100%');
|
||||
case 'left':
|
||||
case 'top':
|
||||
return new _Length2.default('0%');
|
||||
case 'auto':
|
||||
return new _Length2.default('0');
|
||||
}
|
||||
return new _Length2.default(position);
|
||||
};
|
||||
|
||||
var parseBackgroundImage = exports.parseBackgroundImage = function parseBackgroundImage(image) {
|
||||
var whitespace = /^\s$/;
|
||||
var results = [];
|
||||
|
||||
var args = [];
|
||||
var method = '';
|
||||
var quote = null;
|
||||
var definition = '';
|
||||
var mode = 0;
|
||||
var numParen = 0;
|
||||
|
||||
var appendResult = function appendResult() {
|
||||
var prefix = '';
|
||||
if (method) {
|
||||
if (definition.substr(0, 1) === '"') {
|
||||
definition = definition.substr(1, definition.length - 2);
|
||||
}
|
||||
|
||||
if (definition) {
|
||||
args.push(definition.trim());
|
||||
}
|
||||
|
||||
var prefix_i = method.indexOf('-', 1) + 1;
|
||||
if (method.substr(0, 1) === '-' && prefix_i > 0) {
|
||||
prefix = method.substr(0, prefix_i).toLowerCase();
|
||||
method = method.substr(prefix_i);
|
||||
}
|
||||
method = method.toLowerCase();
|
||||
if (method !== 'none') {
|
||||
results.push({
|
||||
prefix: prefix,
|
||||
method: method,
|
||||
args: args
|
||||
});
|
||||
}
|
||||
}
|
||||
args = [];
|
||||
method = definition = '';
|
||||
};
|
||||
|
||||
image.split('').forEach(function (c) {
|
||||
if (mode === 0 && whitespace.test(c)) {
|
||||
return;
|
||||
}
|
||||
switch (c) {
|
||||
case '"':
|
||||
if (!quote) {
|
||||
quote = c;
|
||||
} else if (quote === c) {
|
||||
quote = null;
|
||||
}
|
||||
break;
|
||||
case '(':
|
||||
if (quote) {
|
||||
break;
|
||||
} else if (mode === 0) {
|
||||
mode = 1;
|
||||
return;
|
||||
} else {
|
||||
numParen++;
|
||||
}
|
||||
break;
|
||||
case ')':
|
||||
if (quote) {
|
||||
break;
|
||||
} else if (mode === 1) {
|
||||
if (numParen === 0) {
|
||||
mode = 0;
|
||||
appendResult();
|
||||
return;
|
||||
} else {
|
||||
numParen--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ',':
|
||||
if (quote) {
|
||||
break;
|
||||
} else if (mode === 0) {
|
||||
appendResult();
|
||||
return;
|
||||
} else if (mode === 1) {
|
||||
if (numParen === 0 && !method.match(/^url$/i)) {
|
||||
args.push(definition.trim());
|
||||
definition = '';
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (mode === 0) {
|
||||
method += c;
|
||||
} else {
|
||||
definition += c;
|
||||
}
|
||||
});
|
||||
|
||||
appendResult();
|
||||
return results;
|
||||
};
|
49
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/border.js
vendored
Normal file
49
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/border.js
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseBorder = exports.BORDER_SIDES = exports.BORDER_STYLE = undefined;
|
||||
|
||||
var _Color = require('../Color');
|
||||
|
||||
var _Color2 = _interopRequireDefault(_Color);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var BORDER_STYLE = exports.BORDER_STYLE = {
|
||||
NONE: 0,
|
||||
SOLID: 1
|
||||
};
|
||||
|
||||
var BORDER_SIDES = exports.BORDER_SIDES = {
|
||||
TOP: 0,
|
||||
RIGHT: 1,
|
||||
BOTTOM: 2,
|
||||
LEFT: 3
|
||||
};
|
||||
|
||||
var SIDES = Object.keys(BORDER_SIDES).map(function (s) {
|
||||
return s.toLowerCase();
|
||||
});
|
||||
|
||||
var parseBorderStyle = function parseBorderStyle(style) {
|
||||
switch (style) {
|
||||
case 'none':
|
||||
return BORDER_STYLE.NONE;
|
||||
}
|
||||
return BORDER_STYLE.SOLID;
|
||||
};
|
||||
|
||||
var parseBorder = exports.parseBorder = function parseBorder(style) {
|
||||
return SIDES.map(function (side) {
|
||||
var borderColor = new _Color2.default(style.getPropertyValue('border-' + side + '-color'));
|
||||
var borderStyle = parseBorderStyle(style.getPropertyValue('border-' + side + '-style'));
|
||||
var borderWidth = parseFloat(style.getPropertyValue('border-' + side + '-width'));
|
||||
return {
|
||||
borderColor: borderColor,
|
||||
borderStyle: borderStyle,
|
||||
borderWidth: isNaN(borderWidth) ? 0 : borderWidth
|
||||
};
|
||||
});
|
||||
};
|
29
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/borderRadius.js
vendored
Normal file
29
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/borderRadius.js
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseBorderRadius = undefined;
|
||||
|
||||
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"); } }; }();
|
||||
|
||||
var _Length = require('../Length');
|
||||
|
||||
var _Length2 = _interopRequireDefault(_Length);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var SIDES = ['top-left', 'top-right', 'bottom-right', 'bottom-left'];
|
||||
|
||||
var parseBorderRadius = exports.parseBorderRadius = function parseBorderRadius(style) {
|
||||
return SIDES.map(function (side) {
|
||||
var value = style.getPropertyValue('border-' + side + '-radius');
|
||||
|
||||
var _value$split$map = value.split(' ').map(_Length2.default.create),
|
||||
_value$split$map2 = _slicedToArray(_value$split$map, 2),
|
||||
horizontal = _value$split$map2[0],
|
||||
vertical = _value$split$map2[1];
|
||||
|
||||
return typeof vertical === 'undefined' ? [horizontal, horizontal] : [horizontal, vertical];
|
||||
});
|
||||
};
|
110
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/display.js
vendored
Normal file
110
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/display.js
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var DISPLAY = exports.DISPLAY = {
|
||||
NONE: 1 << 0,
|
||||
BLOCK: 1 << 1,
|
||||
INLINE: 1 << 2,
|
||||
RUN_IN: 1 << 3,
|
||||
FLOW: 1 << 4,
|
||||
FLOW_ROOT: 1 << 5,
|
||||
TABLE: 1 << 6,
|
||||
FLEX: 1 << 7,
|
||||
GRID: 1 << 8,
|
||||
RUBY: 1 << 9,
|
||||
SUBGRID: 1 << 10,
|
||||
LIST_ITEM: 1 << 11,
|
||||
TABLE_ROW_GROUP: 1 << 12,
|
||||
TABLE_HEADER_GROUP: 1 << 13,
|
||||
TABLE_FOOTER_GROUP: 1 << 14,
|
||||
TABLE_ROW: 1 << 15,
|
||||
TABLE_CELL: 1 << 16,
|
||||
TABLE_COLUMN_GROUP: 1 << 17,
|
||||
TABLE_COLUMN: 1 << 18,
|
||||
TABLE_CAPTION: 1 << 19,
|
||||
RUBY_BASE: 1 << 20,
|
||||
RUBY_TEXT: 1 << 21,
|
||||
RUBY_BASE_CONTAINER: 1 << 22,
|
||||
RUBY_TEXT_CONTAINER: 1 << 23,
|
||||
CONTENTS: 1 << 24,
|
||||
INLINE_BLOCK: 1 << 25,
|
||||
INLINE_LIST_ITEM: 1 << 26,
|
||||
INLINE_TABLE: 1 << 27,
|
||||
INLINE_FLEX: 1 << 28,
|
||||
INLINE_GRID: 1 << 29
|
||||
};
|
||||
|
||||
var parseDisplayValue = function parseDisplayValue(display) {
|
||||
switch (display) {
|
||||
case 'block':
|
||||
return DISPLAY.BLOCK;
|
||||
case 'inline':
|
||||
return DISPLAY.INLINE;
|
||||
case 'run-in':
|
||||
return DISPLAY.RUN_IN;
|
||||
case 'flow':
|
||||
return DISPLAY.FLOW;
|
||||
case 'flow-root':
|
||||
return DISPLAY.FLOW_ROOT;
|
||||
case 'table':
|
||||
return DISPLAY.TABLE;
|
||||
case 'flex':
|
||||
return DISPLAY.FLEX;
|
||||
case 'grid':
|
||||
return DISPLAY.GRID;
|
||||
case 'ruby':
|
||||
return DISPLAY.RUBY;
|
||||
case 'subgrid':
|
||||
return DISPLAY.SUBGRID;
|
||||
case 'list-item':
|
||||
return DISPLAY.LIST_ITEM;
|
||||
case 'table-row-group':
|
||||
return DISPLAY.TABLE_ROW_GROUP;
|
||||
case 'table-header-group':
|
||||
return DISPLAY.TABLE_HEADER_GROUP;
|
||||
case 'table-footer-group':
|
||||
return DISPLAY.TABLE_FOOTER_GROUP;
|
||||
case 'table-row':
|
||||
return DISPLAY.TABLE_ROW;
|
||||
case 'table-cell':
|
||||
return DISPLAY.TABLE_CELL;
|
||||
case 'table-column-group':
|
||||
return DISPLAY.TABLE_COLUMN_GROUP;
|
||||
case 'table-column':
|
||||
return DISPLAY.TABLE_COLUMN;
|
||||
case 'table-caption':
|
||||
return DISPLAY.TABLE_CAPTION;
|
||||
case 'ruby-base':
|
||||
return DISPLAY.RUBY_BASE;
|
||||
case 'ruby-text':
|
||||
return DISPLAY.RUBY_TEXT;
|
||||
case 'ruby-base-container':
|
||||
return DISPLAY.RUBY_BASE_CONTAINER;
|
||||
case 'ruby-text-container':
|
||||
return DISPLAY.RUBY_TEXT_CONTAINER;
|
||||
case 'contents':
|
||||
return DISPLAY.CONTENTS;
|
||||
case 'inline-block':
|
||||
return DISPLAY.INLINE_BLOCK;
|
||||
case 'inline-list-item':
|
||||
return DISPLAY.INLINE_LIST_ITEM;
|
||||
case 'inline-table':
|
||||
return DISPLAY.INLINE_TABLE;
|
||||
case 'inline-flex':
|
||||
return DISPLAY.INLINE_FLEX;
|
||||
case 'inline-grid':
|
||||
return DISPLAY.INLINE_GRID;
|
||||
}
|
||||
|
||||
return DISPLAY.NONE;
|
||||
};
|
||||
|
||||
var setDisplayBit = function setDisplayBit(bit, display) {
|
||||
return bit | parseDisplayValue(display);
|
||||
};
|
||||
|
||||
var parseDisplay = exports.parseDisplay = function parseDisplay(display) {
|
||||
return display.split(' ').reduce(setDisplayBit, 0);
|
||||
};
|
26
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/float.js
vendored
Normal file
26
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/float.js
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var FLOAT = exports.FLOAT = {
|
||||
NONE: 0,
|
||||
LEFT: 1,
|
||||
RIGHT: 2,
|
||||
INLINE_START: 3,
|
||||
INLINE_END: 4
|
||||
};
|
||||
|
||||
var parseCSSFloat = exports.parseCSSFloat = function parseCSSFloat(float) {
|
||||
switch (float) {
|
||||
case 'left':
|
||||
return FLOAT.LEFT;
|
||||
case 'right':
|
||||
return FLOAT.RIGHT;
|
||||
case 'inline-start':
|
||||
return FLOAT.INLINE_START;
|
||||
case 'inline-end':
|
||||
return FLOAT.INLINE_END;
|
||||
}
|
||||
return FLOAT.NONE;
|
||||
};
|
34
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/font.js
vendored
Normal file
34
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/font.js
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
|
||||
var parseFontWeight = function parseFontWeight(weight) {
|
||||
switch (weight) {
|
||||
case 'normal':
|
||||
return 400;
|
||||
case 'bold':
|
||||
return 700;
|
||||
}
|
||||
|
||||
var value = parseInt(weight, 10);
|
||||
return isNaN(value) ? 400 : value;
|
||||
};
|
||||
|
||||
var parseFont = exports.parseFont = function parseFont(style) {
|
||||
var fontFamily = style.fontFamily;
|
||||
var fontSize = style.fontSize;
|
||||
var fontStyle = style.fontStyle;
|
||||
var fontVariant = style.fontVariant;
|
||||
var fontWeight = parseFontWeight(style.fontWeight);
|
||||
|
||||
return {
|
||||
fontFamily: fontFamily,
|
||||
fontSize: fontSize,
|
||||
fontStyle: fontStyle,
|
||||
fontVariant: fontVariant,
|
||||
fontWeight: fontWeight
|
||||
};
|
||||
};
|
12
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/letterSpacing.js
vendored
Normal file
12
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/letterSpacing.js
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var parseLetterSpacing = exports.parseLetterSpacing = function parseLetterSpacing(letterSpacing) {
|
||||
if (letterSpacing === 'normal') {
|
||||
return 0;
|
||||
}
|
||||
var value = parseFloat(letterSpacing);
|
||||
return isNaN(value) ? 0 : value;
|
||||
};
|
19
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/lineBreak.js
vendored
Normal file
19
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/lineBreak.js
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var LINE_BREAK = exports.LINE_BREAK = {
|
||||
NORMAL: 'normal',
|
||||
STRICT: 'strict'
|
||||
};
|
||||
|
||||
var parseLineBreak = exports.parseLineBreak = function parseLineBreak(wordBreak) {
|
||||
switch (wordBreak) {
|
||||
case 'strict':
|
||||
return LINE_BREAK.STRICT;
|
||||
case 'normal':
|
||||
default:
|
||||
return LINE_BREAK.NORMAL;
|
||||
}
|
||||
};
|
203
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/listStyle.js
vendored
Normal file
203
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/listStyle.js
vendored
Normal file
|
@ -0,0 +1,203 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseListStyle = exports.parseListStyleType = exports.LIST_STYLE_TYPE = exports.LIST_STYLE_POSITION = undefined;
|
||||
|
||||
var _background = require('./background');
|
||||
|
||||
var LIST_STYLE_POSITION = exports.LIST_STYLE_POSITION = {
|
||||
INSIDE: 0,
|
||||
OUTSIDE: 1
|
||||
};
|
||||
|
||||
var LIST_STYLE_TYPE = exports.LIST_STYLE_TYPE = {
|
||||
NONE: -1,
|
||||
DISC: 0,
|
||||
CIRCLE: 1,
|
||||
SQUARE: 2,
|
||||
DECIMAL: 3,
|
||||
CJK_DECIMAL: 4,
|
||||
DECIMAL_LEADING_ZERO: 5,
|
||||
LOWER_ROMAN: 6,
|
||||
UPPER_ROMAN: 7,
|
||||
LOWER_GREEK: 8,
|
||||
LOWER_ALPHA: 9,
|
||||
UPPER_ALPHA: 10,
|
||||
ARABIC_INDIC: 11,
|
||||
ARMENIAN: 12,
|
||||
BENGALI: 13,
|
||||
CAMBODIAN: 14,
|
||||
CJK_EARTHLY_BRANCH: 15,
|
||||
CJK_HEAVENLY_STEM: 16,
|
||||
CJK_IDEOGRAPHIC: 17,
|
||||
DEVANAGARI: 18,
|
||||
ETHIOPIC_NUMERIC: 19,
|
||||
GEORGIAN: 20,
|
||||
GUJARATI: 21,
|
||||
GURMUKHI: 22,
|
||||
HEBREW: 22,
|
||||
HIRAGANA: 23,
|
||||
HIRAGANA_IROHA: 24,
|
||||
JAPANESE_FORMAL: 25,
|
||||
JAPANESE_INFORMAL: 26,
|
||||
KANNADA: 27,
|
||||
KATAKANA: 28,
|
||||
KATAKANA_IROHA: 29,
|
||||
KHMER: 30,
|
||||
KOREAN_HANGUL_FORMAL: 31,
|
||||
KOREAN_HANJA_FORMAL: 32,
|
||||
KOREAN_HANJA_INFORMAL: 33,
|
||||
LAO: 34,
|
||||
LOWER_ARMENIAN: 35,
|
||||
MALAYALAM: 36,
|
||||
MONGOLIAN: 37,
|
||||
MYANMAR: 38,
|
||||
ORIYA: 39,
|
||||
PERSIAN: 40,
|
||||
SIMP_CHINESE_FORMAL: 41,
|
||||
SIMP_CHINESE_INFORMAL: 42,
|
||||
TAMIL: 43,
|
||||
TELUGU: 44,
|
||||
THAI: 45,
|
||||
TIBETAN: 46,
|
||||
TRAD_CHINESE_FORMAL: 47,
|
||||
TRAD_CHINESE_INFORMAL: 48,
|
||||
UPPER_ARMENIAN: 49,
|
||||
DISCLOSURE_OPEN: 50,
|
||||
DISCLOSURE_CLOSED: 51
|
||||
};
|
||||
|
||||
var parseListStyleType = exports.parseListStyleType = function parseListStyleType(type) {
|
||||
switch (type) {
|
||||
case 'disc':
|
||||
return LIST_STYLE_TYPE.DISC;
|
||||
case 'circle':
|
||||
return LIST_STYLE_TYPE.CIRCLE;
|
||||
case 'square':
|
||||
return LIST_STYLE_TYPE.SQUARE;
|
||||
case 'decimal':
|
||||
return LIST_STYLE_TYPE.DECIMAL;
|
||||
case 'cjk-decimal':
|
||||
return LIST_STYLE_TYPE.CJK_DECIMAL;
|
||||
case 'decimal-leading-zero':
|
||||
return LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO;
|
||||
case 'lower-roman':
|
||||
return LIST_STYLE_TYPE.LOWER_ROMAN;
|
||||
case 'upper-roman':
|
||||
return LIST_STYLE_TYPE.UPPER_ROMAN;
|
||||
case 'lower-greek':
|
||||
return LIST_STYLE_TYPE.LOWER_GREEK;
|
||||
case 'lower-alpha':
|
||||
return LIST_STYLE_TYPE.LOWER_ALPHA;
|
||||
case 'upper-alpha':
|
||||
return LIST_STYLE_TYPE.UPPER_ALPHA;
|
||||
case 'arabic-indic':
|
||||
return LIST_STYLE_TYPE.ARABIC_INDIC;
|
||||
case 'armenian':
|
||||
return LIST_STYLE_TYPE.ARMENIAN;
|
||||
case 'bengali':
|
||||
return LIST_STYLE_TYPE.BENGALI;
|
||||
case 'cambodian':
|
||||
return LIST_STYLE_TYPE.CAMBODIAN;
|
||||
case 'cjk-earthly-branch':
|
||||
return LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH;
|
||||
case 'cjk-heavenly-stem':
|
||||
return LIST_STYLE_TYPE.CJK_HEAVENLY_STEM;
|
||||
case 'cjk-ideographic':
|
||||
return LIST_STYLE_TYPE.CJK_IDEOGRAPHIC;
|
||||
case 'devanagari':
|
||||
return LIST_STYLE_TYPE.DEVANAGARI;
|
||||
case 'ethiopic-numeric':
|
||||
return LIST_STYLE_TYPE.ETHIOPIC_NUMERIC;
|
||||
case 'georgian':
|
||||
return LIST_STYLE_TYPE.GEORGIAN;
|
||||
case 'gujarati':
|
||||
return LIST_STYLE_TYPE.GUJARATI;
|
||||
case 'gurmukhi':
|
||||
return LIST_STYLE_TYPE.GURMUKHI;
|
||||
case 'hebrew':
|
||||
return LIST_STYLE_TYPE.HEBREW;
|
||||
case 'hiragana':
|
||||
return LIST_STYLE_TYPE.HIRAGANA;
|
||||
case 'hiragana-iroha':
|
||||
return LIST_STYLE_TYPE.HIRAGANA_IROHA;
|
||||
case 'japanese-formal':
|
||||
return LIST_STYLE_TYPE.JAPANESE_FORMAL;
|
||||
case 'japanese-informal':
|
||||
return LIST_STYLE_TYPE.JAPANESE_INFORMAL;
|
||||
case 'kannada':
|
||||
return LIST_STYLE_TYPE.KANNADA;
|
||||
case 'katakana':
|
||||
return LIST_STYLE_TYPE.KATAKANA;
|
||||
case 'katakana-iroha':
|
||||
return LIST_STYLE_TYPE.KATAKANA_IROHA;
|
||||
case 'khmer':
|
||||
return LIST_STYLE_TYPE.KHMER;
|
||||
case 'korean-hangul-formal':
|
||||
return LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL;
|
||||
case 'korean-hanja-formal':
|
||||
return LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL;
|
||||
case 'korean-hanja-informal':
|
||||
return LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL;
|
||||
case 'lao':
|
||||
return LIST_STYLE_TYPE.LAO;
|
||||
case 'lower-armenian':
|
||||
return LIST_STYLE_TYPE.LOWER_ARMENIAN;
|
||||
case 'malayalam':
|
||||
return LIST_STYLE_TYPE.MALAYALAM;
|
||||
case 'mongolian':
|
||||
return LIST_STYLE_TYPE.MONGOLIAN;
|
||||
case 'myanmar':
|
||||
return LIST_STYLE_TYPE.MYANMAR;
|
||||
case 'oriya':
|
||||
return LIST_STYLE_TYPE.ORIYA;
|
||||
case 'persian':
|
||||
return LIST_STYLE_TYPE.PERSIAN;
|
||||
case 'simp-chinese-formal':
|
||||
return LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL;
|
||||
case 'simp-chinese-informal':
|
||||
return LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL;
|
||||
case 'tamil':
|
||||
return LIST_STYLE_TYPE.TAMIL;
|
||||
case 'telugu':
|
||||
return LIST_STYLE_TYPE.TELUGU;
|
||||
case 'thai':
|
||||
return LIST_STYLE_TYPE.THAI;
|
||||
case 'tibetan':
|
||||
return LIST_STYLE_TYPE.TIBETAN;
|
||||
case 'trad-chinese-formal':
|
||||
return LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL;
|
||||
case 'trad-chinese-informal':
|
||||
return LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL;
|
||||
case 'upper-armenian':
|
||||
return LIST_STYLE_TYPE.UPPER_ARMENIAN;
|
||||
case 'disclosure-open':
|
||||
return LIST_STYLE_TYPE.DISCLOSURE_OPEN;
|
||||
case 'disclosure-closed':
|
||||
return LIST_STYLE_TYPE.DISCLOSURE_CLOSED;
|
||||
case 'none':
|
||||
default:
|
||||
return LIST_STYLE_TYPE.NONE;
|
||||
}
|
||||
};
|
||||
|
||||
var parseListStyle = exports.parseListStyle = function parseListStyle(style) {
|
||||
var listStyleImage = (0, _background.parseBackgroundImage)(style.getPropertyValue('list-style-image'));
|
||||
return {
|
||||
listStyleType: parseListStyleType(style.getPropertyValue('list-style-type')),
|
||||
listStyleImage: listStyleImage.length ? listStyleImage[0] : null,
|
||||
listStylePosition: parseListStylePosition(style.getPropertyValue('list-style-position'))
|
||||
};
|
||||
};
|
||||
|
||||
var parseListStylePosition = function parseListStylePosition(position) {
|
||||
switch (position) {
|
||||
case 'inside':
|
||||
return LIST_STYLE_POSITION.INSIDE;
|
||||
case 'outside':
|
||||
default:
|
||||
return LIST_STYLE_POSITION.OUTSIDE;
|
||||
}
|
||||
};
|
20
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/margin.js
vendored
Normal file
20
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/margin.js
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseMargin = undefined;
|
||||
|
||||
var _Length = require('../Length');
|
||||
|
||||
var _Length2 = _interopRequireDefault(_Length);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var SIDES = ['top', 'right', 'bottom', 'left'];
|
||||
|
||||
var parseMargin = exports.parseMargin = function parseMargin(style) {
|
||||
return SIDES.map(function (side) {
|
||||
return new _Length2.default(style.getPropertyValue('margin-' + side));
|
||||
});
|
||||
};
|
25
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/overflow.js
vendored
Normal file
25
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/overflow.js
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var OVERFLOW = exports.OVERFLOW = {
|
||||
VISIBLE: 0,
|
||||
HIDDEN: 1,
|
||||
SCROLL: 2,
|
||||
AUTO: 3
|
||||
};
|
||||
|
||||
var parseOverflow = exports.parseOverflow = function parseOverflow(overflow) {
|
||||
switch (overflow) {
|
||||
case 'hidden':
|
||||
return OVERFLOW.HIDDEN;
|
||||
case 'scroll':
|
||||
return OVERFLOW.SCROLL;
|
||||
case 'auto':
|
||||
return OVERFLOW.AUTO;
|
||||
case 'visible':
|
||||
default:
|
||||
return OVERFLOW.VISIBLE;
|
||||
}
|
||||
};
|
19
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/overflowWrap.js
vendored
Normal file
19
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/overflowWrap.js
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var OVERFLOW_WRAP = exports.OVERFLOW_WRAP = {
|
||||
NORMAL: 0,
|
||||
BREAK_WORD: 1
|
||||
};
|
||||
|
||||
var parseOverflowWrap = exports.parseOverflowWrap = function parseOverflowWrap(overflow) {
|
||||
switch (overflow) {
|
||||
case 'break-word':
|
||||
return OVERFLOW_WRAP.BREAK_WORD;
|
||||
case 'normal':
|
||||
default:
|
||||
return OVERFLOW_WRAP.NORMAL;
|
||||
}
|
||||
};
|
27
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/padding.js
vendored
Normal file
27
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/padding.js
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parsePadding = exports.PADDING_SIDES = undefined;
|
||||
|
||||
var _Length = require('../Length');
|
||||
|
||||
var _Length2 = _interopRequireDefault(_Length);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var PADDING_SIDES = exports.PADDING_SIDES = {
|
||||
TOP: 0,
|
||||
RIGHT: 1,
|
||||
BOTTOM: 2,
|
||||
LEFT: 3
|
||||
};
|
||||
|
||||
var SIDES = ['top', 'right', 'bottom', 'left'];
|
||||
|
||||
var parsePadding = exports.parsePadding = function parsePadding(style) {
|
||||
return SIDES.map(function (side) {
|
||||
return new _Length2.default(style.getPropertyValue('padding-' + side));
|
||||
});
|
||||
};
|
27
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/position.js
vendored
Normal file
27
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/position.js
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var POSITION = exports.POSITION = {
|
||||
STATIC: 0,
|
||||
RELATIVE: 1,
|
||||
ABSOLUTE: 2,
|
||||
FIXED: 3,
|
||||
STICKY: 4
|
||||
};
|
||||
|
||||
var parsePosition = exports.parsePosition = function parsePosition(position) {
|
||||
switch (position) {
|
||||
case 'relative':
|
||||
return POSITION.RELATIVE;
|
||||
case 'absolute':
|
||||
return POSITION.ABSOLUTE;
|
||||
case 'fixed':
|
||||
return POSITION.FIXED;
|
||||
case 'sticky':
|
||||
return POSITION.STICKY;
|
||||
}
|
||||
|
||||
return POSITION.STATIC;
|
||||
};
|
81
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/textDecoration.js
vendored
Normal file
81
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/textDecoration.js
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseTextDecoration = exports.TEXT_DECORATION_LINE = exports.TEXT_DECORATION = exports.TEXT_DECORATION_STYLE = undefined;
|
||||
|
||||
var _Color = require('../Color');
|
||||
|
||||
var _Color2 = _interopRequireDefault(_Color);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var TEXT_DECORATION_STYLE = exports.TEXT_DECORATION_STYLE = {
|
||||
SOLID: 0,
|
||||
DOUBLE: 1,
|
||||
DOTTED: 2,
|
||||
DASHED: 3,
|
||||
WAVY: 4
|
||||
};
|
||||
|
||||
var TEXT_DECORATION = exports.TEXT_DECORATION = {
|
||||
NONE: null
|
||||
};
|
||||
|
||||
var TEXT_DECORATION_LINE = exports.TEXT_DECORATION_LINE = {
|
||||
UNDERLINE: 1,
|
||||
OVERLINE: 2,
|
||||
LINE_THROUGH: 3,
|
||||
BLINK: 4
|
||||
};
|
||||
|
||||
var parseLine = function parseLine(line) {
|
||||
switch (line) {
|
||||
case 'underline':
|
||||
return TEXT_DECORATION_LINE.UNDERLINE;
|
||||
case 'overline':
|
||||
return TEXT_DECORATION_LINE.OVERLINE;
|
||||
case 'line-through':
|
||||
return TEXT_DECORATION_LINE.LINE_THROUGH;
|
||||
}
|
||||
return TEXT_DECORATION_LINE.BLINK;
|
||||
};
|
||||
|
||||
var parseTextDecorationLine = function parseTextDecorationLine(line) {
|
||||
if (line === 'none') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return line.split(' ').map(parseLine);
|
||||
};
|
||||
|
||||
var parseTextDecorationStyle = function parseTextDecorationStyle(style) {
|
||||
switch (style) {
|
||||
case 'double':
|
||||
return TEXT_DECORATION_STYLE.DOUBLE;
|
||||
case 'dotted':
|
||||
return TEXT_DECORATION_STYLE.DOTTED;
|
||||
case 'dashed':
|
||||
return TEXT_DECORATION_STYLE.DASHED;
|
||||
case 'wavy':
|
||||
return TEXT_DECORATION_STYLE.WAVY;
|
||||
}
|
||||
return TEXT_DECORATION_STYLE.SOLID;
|
||||
};
|
||||
|
||||
var parseTextDecoration = exports.parseTextDecoration = function parseTextDecoration(style) {
|
||||
var textDecorationLine = parseTextDecorationLine(style.textDecorationLine ? style.textDecorationLine : style.textDecoration);
|
||||
if (textDecorationLine === null) {
|
||||
return TEXT_DECORATION.NONE;
|
||||
}
|
||||
|
||||
var textDecorationColor = style.textDecorationColor ? new _Color2.default(style.textDecorationColor) : null;
|
||||
var textDecorationStyle = parseTextDecorationStyle(style.textDecorationStyle);
|
||||
|
||||
return {
|
||||
textDecorationLine: textDecorationLine,
|
||||
textDecorationColor: textDecorationColor,
|
||||
textDecorationStyle: textDecorationStyle
|
||||
};
|
||||
};
|
95
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/textShadow.js
vendored
Normal file
95
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/textShadow.js
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseTextShadow = undefined;
|
||||
|
||||
var _Color = require('../Color');
|
||||
|
||||
var _Color2 = _interopRequireDefault(_Color);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var NUMBER = /^([+-]|\d|\.)$/i;
|
||||
|
||||
var parseTextShadow = exports.parseTextShadow = function parseTextShadow(textShadow) {
|
||||
if (textShadow === 'none' || typeof textShadow !== 'string') {
|
||||
return null;
|
||||
}
|
||||
|
||||
var currentValue = '';
|
||||
var isLength = false;
|
||||
var values = [];
|
||||
var shadows = [];
|
||||
var numParens = 0;
|
||||
var color = null;
|
||||
|
||||
var appendValue = function appendValue() {
|
||||
if (currentValue.length) {
|
||||
if (isLength) {
|
||||
values.push(parseFloat(currentValue));
|
||||
} else {
|
||||
color = new _Color2.default(currentValue);
|
||||
}
|
||||
}
|
||||
isLength = false;
|
||||
currentValue = '';
|
||||
};
|
||||
|
||||
var appendShadow = function appendShadow() {
|
||||
if (values.length && color !== null) {
|
||||
shadows.push({
|
||||
color: color,
|
||||
offsetX: values[0] || 0,
|
||||
offsetY: values[1] || 0,
|
||||
blur: values[2] || 0
|
||||
});
|
||||
}
|
||||
values.splice(0, values.length);
|
||||
color = null;
|
||||
};
|
||||
|
||||
for (var i = 0; i < textShadow.length; i++) {
|
||||
var c = textShadow[i];
|
||||
switch (c) {
|
||||
case '(':
|
||||
currentValue += c;
|
||||
numParens++;
|
||||
break;
|
||||
case ')':
|
||||
currentValue += c;
|
||||
numParens--;
|
||||
break;
|
||||
case ',':
|
||||
if (numParens === 0) {
|
||||
appendValue();
|
||||
appendShadow();
|
||||
} else {
|
||||
currentValue += c;
|
||||
}
|
||||
break;
|
||||
case ' ':
|
||||
if (numParens === 0) {
|
||||
appendValue();
|
||||
} else {
|
||||
currentValue += c;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (currentValue.length === 0 && NUMBER.test(c)) {
|
||||
isLength = true;
|
||||
}
|
||||
currentValue += c;
|
||||
}
|
||||
}
|
||||
|
||||
appendValue();
|
||||
appendShadow();
|
||||
|
||||
if (shadows.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return shadows;
|
||||
};
|
24
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/textTransform.js
vendored
Normal file
24
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/textTransform.js
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var TEXT_TRANSFORM = exports.TEXT_TRANSFORM = {
|
||||
NONE: 0,
|
||||
LOWERCASE: 1,
|
||||
UPPERCASE: 2,
|
||||
CAPITALIZE: 3
|
||||
};
|
||||
|
||||
var parseTextTransform = exports.parseTextTransform = function parseTextTransform(textTransform) {
|
||||
switch (textTransform) {
|
||||
case 'uppercase':
|
||||
return TEXT_TRANSFORM.UPPERCASE;
|
||||
case 'lowercase':
|
||||
return TEXT_TRANSFORM.LOWERCASE;
|
||||
case 'capitalize':
|
||||
return TEXT_TRANSFORM.CAPITALIZE;
|
||||
}
|
||||
|
||||
return TEXT_TRANSFORM.NONE;
|
||||
};
|
67
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/transform.js
vendored
Normal file
67
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/transform.js
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseTransform = undefined;
|
||||
|
||||
var _Length = require('../Length');
|
||||
|
||||
var _Length2 = _interopRequireDefault(_Length);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var toFloat = function toFloat(s) {
|
||||
return parseFloat(s.trim());
|
||||
};
|
||||
|
||||
var MATRIX = /(matrix|matrix3d)\((.+)\)/;
|
||||
|
||||
var parseTransform = exports.parseTransform = function parseTransform(style) {
|
||||
var transform = parseTransformMatrix(style.transform || style.webkitTransform || style.mozTransform ||
|
||||
// $FlowFixMe
|
||||
style.msTransform ||
|
||||
// $FlowFixMe
|
||||
style.oTransform);
|
||||
if (transform === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
transform: transform,
|
||||
transformOrigin: parseTransformOrigin(style.transformOrigin || style.webkitTransformOrigin || style.mozTransformOrigin ||
|
||||
// $FlowFixMe
|
||||
style.msTransformOrigin ||
|
||||
// $FlowFixMe
|
||||
style.oTransformOrigin)
|
||||
};
|
||||
};
|
||||
|
||||
// $FlowFixMe
|
||||
var parseTransformOrigin = function parseTransformOrigin(origin) {
|
||||
if (typeof origin !== 'string') {
|
||||
var v = new _Length2.default('0');
|
||||
return [v, v];
|
||||
}
|
||||
var values = origin.split(' ').map(_Length2.default.create);
|
||||
return [values[0], values[1]];
|
||||
};
|
||||
|
||||
// $FlowFixMe
|
||||
var parseTransformMatrix = function parseTransformMatrix(transform) {
|
||||
if (transform === 'none' || typeof transform !== 'string') {
|
||||
return null;
|
||||
}
|
||||
|
||||
var match = transform.match(MATRIX);
|
||||
if (match) {
|
||||
if (match[1] === 'matrix') {
|
||||
var matrix = match[2].split(',').map(toFloat);
|
||||
return [matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]];
|
||||
} else {
|
||||
var matrix3d = match[2].split(',').map(toFloat);
|
||||
return [matrix3d[0], matrix3d[1], matrix3d[4], matrix3d[5], matrix3d[12], matrix3d[13]];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
22
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/visibility.js
vendored
Normal file
22
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/visibility.js
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var VISIBILITY = exports.VISIBILITY = {
|
||||
VISIBLE: 0,
|
||||
HIDDEN: 1,
|
||||
COLLAPSE: 2
|
||||
};
|
||||
|
||||
var parseVisibility = exports.parseVisibility = function parseVisibility(visibility) {
|
||||
switch (visibility) {
|
||||
case 'hidden':
|
||||
return VISIBILITY.HIDDEN;
|
||||
case 'collapse':
|
||||
return VISIBILITY.COLLAPSE;
|
||||
case 'visible':
|
||||
default:
|
||||
return VISIBILITY.VISIBLE;
|
||||
}
|
||||
};
|
22
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/word-break.js
vendored
Normal file
22
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/word-break.js
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var WORD_BREAK = exports.WORD_BREAK = {
|
||||
NORMAL: 'normal',
|
||||
BREAK_ALL: 'break-all',
|
||||
KEEP_ALL: 'keep-all'
|
||||
};
|
||||
|
||||
var parseWordBreak = exports.parseWordBreak = function parseWordBreak(wordBreak) {
|
||||
switch (wordBreak) {
|
||||
case 'break-all':
|
||||
return WORD_BREAK.BREAK_ALL;
|
||||
case 'keep-all':
|
||||
return WORD_BREAK.KEEP_ALL;
|
||||
case 'normal':
|
||||
default:
|
||||
return WORD_BREAK.NORMAL;
|
||||
}
|
||||
};
|
12
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/zIndex.js
vendored
Normal file
12
AstuteClient2/src/assets/html2canvas/dist/npm/parsing/zIndex.js
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var parseZIndex = exports.parseZIndex = function parseZIndex(zIndex) {
|
||||
var auto = zIndex === 'auto';
|
||||
return {
|
||||
auto: auto,
|
||||
order: auto ? 0 : parseInt(zIndex, 10)
|
||||
};
|
||||
};
|
255
AstuteClient2/src/assets/html2canvas/dist/npm/renderer/CanvasRenderer.js
vendored
Normal file
255
AstuteClient2/src/assets/html2canvas/dist/npm/renderer/CanvasRenderer.js
vendored
Normal file
|
@ -0,0 +1,255 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _Path = require('../drawing/Path');
|
||||
|
||||
var _textDecoration = require('../parsing/textDecoration');
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var addColorStops = function addColorStops(gradient, canvasGradient) {
|
||||
var maxStop = Math.max.apply(null, gradient.colorStops.map(function (colorStop) {
|
||||
return colorStop.stop;
|
||||
}));
|
||||
var f = 1 / Math.max(1, maxStop);
|
||||
gradient.colorStops.forEach(function (colorStop) {
|
||||
canvasGradient.addColorStop(f * colorStop.stop, colorStop.color.toString());
|
||||
});
|
||||
};
|
||||
|
||||
var CanvasRenderer = function () {
|
||||
function CanvasRenderer(canvas) {
|
||||
_classCallCheck(this, CanvasRenderer);
|
||||
|
||||
this.canvas = canvas ? canvas : document.createElement('canvas');
|
||||
}
|
||||
|
||||
_createClass(CanvasRenderer, [{
|
||||
key: 'render',
|
||||
value: function render(options) {
|
||||
this.ctx = this.canvas.getContext('2d');
|
||||
this.options = options;
|
||||
this.canvas.width = Math.floor(options.width * options.scale);
|
||||
this.canvas.height = Math.floor(options.height * options.scale);
|
||||
this.canvas.style.width = options.width + 'px';
|
||||
this.canvas.style.height = options.height + 'px';
|
||||
|
||||
this.ctx.scale(this.options.scale, this.options.scale);
|
||||
this.ctx.translate(-options.x, -options.y);
|
||||
this.ctx.textBaseline = 'bottom';
|
||||
options.logger.log('Canvas renderer initialized (' + options.width + 'x' + options.height + ' at ' + options.x + ',' + options.y + ') with scale ' + this.options.scale);
|
||||
}
|
||||
}, {
|
||||
key: 'clip',
|
||||
value: function clip(clipPaths, callback) {
|
||||
var _this = this;
|
||||
|
||||
if (clipPaths.length) {
|
||||
this.ctx.save();
|
||||
clipPaths.forEach(function (path) {
|
||||
_this.path(path);
|
||||
_this.ctx.clip();
|
||||
});
|
||||
}
|
||||
|
||||
callback();
|
||||
|
||||
if (clipPaths.length) {
|
||||
this.ctx.restore();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'drawImage',
|
||||
value: function drawImage(image, source, destination) {
|
||||
this.ctx.drawImage(image, source.left, source.top, source.width, source.height, destination.left, destination.top, destination.width, destination.height);
|
||||
}
|
||||
}, {
|
||||
key: 'drawShape',
|
||||
value: function drawShape(path, color) {
|
||||
this.path(path);
|
||||
this.ctx.fillStyle = color.toString();
|
||||
this.ctx.fill();
|
||||
}
|
||||
}, {
|
||||
key: 'fill',
|
||||
value: function fill(color) {
|
||||
this.ctx.fillStyle = color.toString();
|
||||
this.ctx.fill();
|
||||
}
|
||||
}, {
|
||||
key: 'getTarget',
|
||||
value: function getTarget() {
|
||||
this.canvas.getContext('2d').setTransform(1, 0, 0, 1, 0, 0);
|
||||
return Promise.resolve(this.canvas);
|
||||
}
|
||||
}, {
|
||||
key: 'path',
|
||||
value: function path(_path) {
|
||||
var _this2 = this;
|
||||
|
||||
this.ctx.beginPath();
|
||||
if (Array.isArray(_path)) {
|
||||
_path.forEach(function (point, index) {
|
||||
var start = point.type === _Path.PATH.VECTOR ? point : point.start;
|
||||
if (index === 0) {
|
||||
_this2.ctx.moveTo(start.x, start.y);
|
||||
} else {
|
||||
_this2.ctx.lineTo(start.x, start.y);
|
||||
}
|
||||
|
||||
if (point.type === _Path.PATH.BEZIER_CURVE) {
|
||||
_this2.ctx.bezierCurveTo(point.startControl.x, point.startControl.y, point.endControl.x, point.endControl.y, point.end.x, point.end.y);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.ctx.arc(_path.x + _path.radius, _path.y + _path.radius, _path.radius, 0, Math.PI * 2, true);
|
||||
}
|
||||
|
||||
this.ctx.closePath();
|
||||
}
|
||||
}, {
|
||||
key: 'rectangle',
|
||||
value: function rectangle(x, y, width, height, color) {
|
||||
this.ctx.fillStyle = color.toString();
|
||||
this.ctx.fillRect(x, y, width, height);
|
||||
}
|
||||
}, {
|
||||
key: 'renderLinearGradient',
|
||||
value: function renderLinearGradient(bounds, gradient) {
|
||||
var linearGradient = this.ctx.createLinearGradient(bounds.left + gradient.direction.x1, bounds.top + gradient.direction.y1, bounds.left + gradient.direction.x0, bounds.top + gradient.direction.y0);
|
||||
|
||||
addColorStops(gradient, linearGradient);
|
||||
this.ctx.fillStyle = linearGradient;
|
||||
this.ctx.fillRect(bounds.left, bounds.top, bounds.width, bounds.height);
|
||||
}
|
||||
}, {
|
||||
key: 'renderRadialGradient',
|
||||
value: function renderRadialGradient(bounds, gradient) {
|
||||
var _this3 = this;
|
||||
|
||||
var x = bounds.left + gradient.center.x;
|
||||
var y = bounds.top + gradient.center.y;
|
||||
|
||||
var radialGradient = this.ctx.createRadialGradient(x, y, 0, x, y, gradient.radius.x);
|
||||
if (!radialGradient) {
|
||||
return;
|
||||
}
|
||||
|
||||
addColorStops(gradient, radialGradient);
|
||||
this.ctx.fillStyle = radialGradient;
|
||||
|
||||
if (gradient.radius.x !== gradient.radius.y) {
|
||||
// transforms for elliptical radial gradient
|
||||
var midX = bounds.left + 0.5 * bounds.width;
|
||||
var midY = bounds.top + 0.5 * bounds.height;
|
||||
var f = gradient.radius.y / gradient.radius.x;
|
||||
var invF = 1 / f;
|
||||
|
||||
this.transform(midX, midY, [1, 0, 0, f, 0, 0], function () {
|
||||
return _this3.ctx.fillRect(bounds.left, invF * (bounds.top - midY) + midY, bounds.width, bounds.height * invF);
|
||||
});
|
||||
} else {
|
||||
this.ctx.fillRect(bounds.left, bounds.top, bounds.width, bounds.height);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'renderRepeat',
|
||||
value: function renderRepeat(path, image, imageSize, offsetX, offsetY) {
|
||||
this.path(path);
|
||||
this.ctx.fillStyle = this.ctx.createPattern(this.resizeImage(image, imageSize), 'repeat');
|
||||
this.ctx.translate(offsetX, offsetY);
|
||||
this.ctx.fill();
|
||||
this.ctx.translate(-offsetX, -offsetY);
|
||||
}
|
||||
}, {
|
||||
key: 'renderTextNode',
|
||||
value: function renderTextNode(textBounds, color, font, textDecoration, textShadows) {
|
||||
var _this4 = this;
|
||||
|
||||
this.ctx.font = [font.fontStyle, font.fontVariant, font.fontWeight, font.fontSize, font.fontFamily].join(' ');
|
||||
|
||||
textBounds.forEach(function (text) {
|
||||
_this4.ctx.fillStyle = color.toString();
|
||||
if (textShadows && text.text.trim().length) {
|
||||
textShadows.slice(0).reverse().forEach(function (textShadow) {
|
||||
_this4.ctx.shadowColor = textShadow.color.toString();
|
||||
_this4.ctx.shadowOffsetX = textShadow.offsetX * _this4.options.scale;
|
||||
_this4.ctx.shadowOffsetY = textShadow.offsetY * _this4.options.scale;
|
||||
_this4.ctx.shadowBlur = textShadow.blur;
|
||||
|
||||
_this4.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
||||
});
|
||||
} else {
|
||||
_this4.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
||||
}
|
||||
|
||||
if (textDecoration !== null) {
|
||||
var textDecorationColor = textDecoration.textDecorationColor || color;
|
||||
textDecoration.textDecorationLine.forEach(function (textDecorationLine) {
|
||||
switch (textDecorationLine) {
|
||||
case _textDecoration.TEXT_DECORATION_LINE.UNDERLINE:
|
||||
// Draws a line at the baseline of the font
|
||||
// TODO As some browsers display the line as more than 1px if the font-size is big,
|
||||
// need to take that into account both in position and size
|
||||
var _options$fontMetrics$ = _this4.options.fontMetrics.getMetrics(font),
|
||||
baseline = _options$fontMetrics$.baseline;
|
||||
|
||||
_this4.rectangle(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1, textDecorationColor);
|
||||
break;
|
||||
case _textDecoration.TEXT_DECORATION_LINE.OVERLINE:
|
||||
_this4.rectangle(text.bounds.left, Math.round(text.bounds.top), text.bounds.width, 1, textDecorationColor);
|
||||
break;
|
||||
case _textDecoration.TEXT_DECORATION_LINE.LINE_THROUGH:
|
||||
// TODO try and find exact position for line-through
|
||||
var _options$fontMetrics$2 = _this4.options.fontMetrics.getMetrics(font),
|
||||
middle = _options$fontMetrics$2.middle;
|
||||
|
||||
_this4.rectangle(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1, textDecorationColor);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'resizeImage',
|
||||
value: function resizeImage(image, size) {
|
||||
if (image.width === size.width && image.height === size.height) {
|
||||
return image;
|
||||
}
|
||||
|
||||
var canvas = this.canvas.ownerDocument.createElement('canvas');
|
||||
canvas.width = size.width;
|
||||
canvas.height = size.height;
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, size.width, size.height);
|
||||
return canvas;
|
||||
}
|
||||
}, {
|
||||
key: 'setOpacity',
|
||||
value: function setOpacity(opacity) {
|
||||
this.ctx.globalAlpha = opacity;
|
||||
}
|
||||
}, {
|
||||
key: 'transform',
|
||||
value: function transform(offsetX, offsetY, matrix, callback) {
|
||||
this.ctx.save();
|
||||
this.ctx.translate(offsetX, offsetY);
|
||||
this.ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
||||
this.ctx.translate(-offsetX, -offsetY);
|
||||
|
||||
callback();
|
||||
|
||||
this.ctx.restore();
|
||||
}
|
||||
}]);
|
||||
|
||||
return CanvasRenderer;
|
||||
}();
|
||||
|
||||
exports.default = CanvasRenderer;
|
79
AstuteClient2/src/assets/html2canvas/dist/npm/renderer/ForeignObjectRenderer.js
vendored
Normal file
79
AstuteClient2/src/assets/html2canvas/dist/npm/renderer/ForeignObjectRenderer.js
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
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; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var ForeignObjectRenderer = function () {
|
||||
function ForeignObjectRenderer(element) {
|
||||
_classCallCheck(this, ForeignObjectRenderer);
|
||||
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
_createClass(ForeignObjectRenderer, [{
|
||||
key: 'render',
|
||||
value: function render(options) {
|
||||
var _this = this;
|
||||
|
||||
this.options = options;
|
||||
this.canvas = document.createElement('canvas');
|
||||
this.ctx = this.canvas.getContext('2d');
|
||||
this.canvas.width = Math.floor(options.width) * options.scale;
|
||||
this.canvas.height = Math.floor(options.height) * options.scale;
|
||||
this.canvas.style.width = options.width + 'px';
|
||||
this.canvas.style.height = options.height + 'px';
|
||||
|
||||
options.logger.log('ForeignObject renderer initialized (' + options.width + 'x' + options.height + ' at ' + options.x + ',' + options.y + ') with scale ' + options.scale);
|
||||
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);
|
||||
|
||||
return loadSerializedSVG(svg).then(function (img) {
|
||||
if (options.backgroundColor) {
|
||||
_this.ctx.fillStyle = options.backgroundColor.toString();
|
||||
_this.ctx.fillRect(0, 0, options.width * options.scale, options.height * options.scale);
|
||||
}
|
||||
|
||||
_this.ctx.drawImage(img, -options.x * options.scale, -options.y * options.scale);
|
||||
return _this.canvas;
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return ForeignObjectRenderer;
|
||||
}();
|
||||
|
||||
exports.default = ForeignObjectRenderer;
|
||||
var createForeignObjectSVG = exports.createForeignObjectSVG = function createForeignObjectSVG(width, height, x, y, node) {
|
||||
var xmlns = 'http://www.w3.org/2000/svg';
|
||||
var svg = document.createElementNS(xmlns, 'svg');
|
||||
var foreignObject = document.createElementNS(xmlns, 'foreignObject');
|
||||
svg.setAttributeNS(null, 'width', width);
|
||||
svg.setAttributeNS(null, 'height', height);
|
||||
|
||||
foreignObject.setAttributeNS(null, 'width', '100%');
|
||||
foreignObject.setAttributeNS(null, 'height', '100%');
|
||||
foreignObject.setAttributeNS(null, 'x', x);
|
||||
foreignObject.setAttributeNS(null, 'y', y);
|
||||
foreignObject.setAttributeNS(null, 'externalResourcesRequired', 'true');
|
||||
svg.appendChild(foreignObject);
|
||||
|
||||
foreignObject.appendChild(node);
|
||||
|
||||
return svg;
|
||||
};
|
||||
|
||||
var loadSerializedSVG = exports.loadSerializedSVG = function loadSerializedSVG(svg) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var img = new Image();
|
||||
img.onload = function () {
|
||||
return resolve(img);
|
||||
};
|
||||
img.onerror = reject;
|
||||
|
||||
img.src = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(new XMLSerializer().serializeToString(svg));
|
||||
});
|
||||
};
|
207
AstuteClient2/src/assets/html2canvas/dist/npm/renderer/RefTestRenderer.js
vendored
Normal file
207
AstuteClient2/src/assets/html2canvas/dist/npm/renderer/RefTestRenderer.js
vendored
Normal file
|
@ -0,0 +1,207 @@
|
|||
'use strict';
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _url = require('url');
|
||||
|
||||
var _textDecoration2 = require('../parsing/textDecoration');
|
||||
|
||||
var _Path = require('../drawing/Path');
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var RefTestRenderer = function () {
|
||||
function RefTestRenderer() {
|
||||
_classCallCheck(this, RefTestRenderer);
|
||||
}
|
||||
|
||||
_createClass(RefTestRenderer, [{
|
||||
key: 'render',
|
||||
value: function render(options) {
|
||||
this.options = options;
|
||||
this.indent = 0;
|
||||
this.lines = [];
|
||||
options.logger.log('RefTest renderer initialized');
|
||||
this.writeLine('Window: [' + options.width + ', ' + options.height + ']');
|
||||
}
|
||||
}, {
|
||||
key: 'clip',
|
||||
value: function clip(clipPaths, callback) {
|
||||
this.writeLine('Clip: ' + clipPaths.map(this.formatPath, this).join(' | '));
|
||||
this.indent += 2;
|
||||
callback();
|
||||
this.indent -= 2;
|
||||
}
|
||||
}, {
|
||||
key: 'drawImage',
|
||||
value: function drawImage(image, source, destination) {
|
||||
this.writeLine('Draw image: ' + this.formatImage(image) + ' (source: ' + this.formatBounds(source) + ') (destination: ' + this.formatBounds(source) + ')');
|
||||
}
|
||||
}, {
|
||||
key: 'drawShape',
|
||||
value: function drawShape(path, color) {
|
||||
this.writeLine('Shape: ' + color.toString() + ' ' + this.formatPath(path));
|
||||
}
|
||||
}, {
|
||||
key: 'fill',
|
||||
value: function fill(color) {
|
||||
this.writeLine('Fill: ' + color.toString());
|
||||
}
|
||||
}, {
|
||||
key: 'getTarget',
|
||||
value: function getTarget() {
|
||||
return Promise.resolve(this.lines.join('\n'));
|
||||
}
|
||||
}, {
|
||||
key: 'rectangle',
|
||||
value: function rectangle(x, y, width, height, color) {
|
||||
var list = [x, y, width, height].map(function (v) {
|
||||
return Math.round(v);
|
||||
}).join(', ');
|
||||
this.writeLine('Rectangle: [' + list + '] ' + color.toString());
|
||||
}
|
||||
}, {
|
||||
key: 'formatBounds',
|
||||
value: function formatBounds(bounds) {
|
||||
var list = [bounds.left, bounds.top, bounds.width, bounds.height];
|
||||
return '[' + list.map(function (v) {
|
||||
return Math.round(v);
|
||||
}).join(', ') + ']';
|
||||
}
|
||||
}, {
|
||||
key: 'formatImage',
|
||||
value: function formatImage(image) {
|
||||
return image.tagName === 'CANVAS' ? 'Canvas' : // $FlowFixMe
|
||||
'Image ("' + (0, _url.parse)(image.src).pathname.substring(0, 100) + '")';
|
||||
}
|
||||
}, {
|
||||
key: 'formatPath',
|
||||
value: function formatPath(path) {
|
||||
if (!Array.isArray(path)) {
|
||||
return 'Circle(x: ' + Math.round(path.x) + ', y: ' + Math.round(path.y) + ', r: ' + Math.round(path.radius) + ')';
|
||||
}
|
||||
var string = path.map(function (v) {
|
||||
if (v.type === _Path.PATH.VECTOR) {
|
||||
return 'Vector(x: ' + Math.round(v.x) + ', y: ' + Math.round(v.y) + ')';
|
||||
}
|
||||
if (v.type === _Path.PATH.BEZIER_CURVE) {
|
||||
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)];
|
||||
return 'BezierCurve(' + values.join(', ') + ')';
|
||||
}
|
||||
}).join(' > ');
|
||||
return 'Path (' + string + ')';
|
||||
}
|
||||
}, {
|
||||
key: 'renderLinearGradient',
|
||||
value: function renderLinearGradient(bounds, gradient) {
|
||||
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)];
|
||||
|
||||
var stops = gradient.colorStops.map(function (stop) {
|
||||
return stop.color.toString() + ' ' + Math.ceil(stop.stop * 100) / 100;
|
||||
});
|
||||
|
||||
this.writeLine('Gradient: ' + this.formatBounds(bounds) + ' linear-gradient(' + direction.join(', ') + ' ' + stops.join(', ') + ')');
|
||||
}
|
||||
}, {
|
||||
key: 'renderRadialGradient',
|
||||
value: function renderRadialGradient(bounds, gradient) {
|
||||
var stops = gradient.colorStops.map(function (stop) {
|
||||
return stop.color.toString() + ' ' + Math.ceil(stop.stop * 100) / 100;
|
||||
});
|
||||
|
||||
this.writeLine('RadialGradient: ' + this.formatBounds(bounds) + ' radial-gradient(' + gradient.radius.x + ' ' + gradient.radius.y + ' at ' + gradient.center.x + ' ' + gradient.center.y + ', ' + stops.join(', ') + ')');
|
||||
}
|
||||
}, {
|
||||
key: 'renderRepeat',
|
||||
value: function renderRepeat(path, image, imageSize, offsetX, offsetY) {
|
||||
this.writeLine('Repeat: ' + this.formatImage(image) + ' [' + Math.round(offsetX) + ', ' + Math.round(offsetY) + '] Size (' + Math.round(imageSize.width) + ', ' + Math.round(imageSize.height) + ') ' + this.formatPath(path));
|
||||
}
|
||||
}, {
|
||||
key: 'renderTextNode',
|
||||
value: function renderTextNode(textBounds, color, font, textDecoration, textShadows) {
|
||||
var _this = this;
|
||||
|
||||
var fontString = [font.fontStyle, font.fontVariant, font.fontWeight, parseInt(font.fontSize, 10), font.fontFamily.replace(/"/g, '')].join(' ').split(',')[0];
|
||||
|
||||
var textDecorationString = this.textDecoration(textDecoration, color);
|
||||
var shadowString = textShadows ? ' Shadows: (' + textShadows.map(function (shadow) {
|
||||
return shadow.color.toString() + ' ' + shadow.offsetX + 'px ' + shadow.offsetY + 'px ' + shadow.blur + 'px';
|
||||
}).join(', ') + ')' : '';
|
||||
|
||||
this.writeLine('Text: ' + color.toString() + ' ' + fontString + shadowString + textDecorationString);
|
||||
|
||||
this.indent += 2;
|
||||
textBounds.forEach(function (textBound) {
|
||||
_this.writeLine('[' + Math.round(textBound.bounds.left) + ', ' + Math.round(textBound.bounds.top) + ']: ' + textBound.text);
|
||||
});
|
||||
this.indent -= 2;
|
||||
}
|
||||
}, {
|
||||
key: 'textDecoration',
|
||||
value: function textDecoration(_textDecoration, color) {
|
||||
if (_textDecoration) {
|
||||
var textDecorationColor = (_textDecoration.textDecorationColor ? _textDecoration.textDecorationColor : color).toString();
|
||||
var textDecorationLines = _textDecoration.textDecorationLine.map(this.textDecorationLine, this);
|
||||
return _textDecoration ? ' ' + this.textDecorationStyle(_textDecoration.textDecorationStyle) + ' ' + textDecorationColor + ' ' + textDecorationLines.join(', ') : '';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}, {
|
||||
key: 'textDecorationLine',
|
||||
value: function textDecorationLine(_textDecorationLine) {
|
||||
switch (_textDecorationLine) {
|
||||
case _textDecoration2.TEXT_DECORATION_LINE.LINE_THROUGH:
|
||||
return 'line-through';
|
||||
case _textDecoration2.TEXT_DECORATION_LINE.OVERLINE:
|
||||
return 'overline';
|
||||
case _textDecoration2.TEXT_DECORATION_LINE.UNDERLINE:
|
||||
return 'underline';
|
||||
case _textDecoration2.TEXT_DECORATION_LINE.BLINK:
|
||||
return 'blink';
|
||||
}
|
||||
return 'UNKNOWN';
|
||||
}
|
||||
}, {
|
||||
key: 'textDecorationStyle',
|
||||
value: function textDecorationStyle(_textDecorationStyle) {
|
||||
switch (_textDecorationStyle) {
|
||||
case _textDecoration2.TEXT_DECORATION_STYLE.SOLID:
|
||||
return 'solid';
|
||||
case _textDecoration2.TEXT_DECORATION_STYLE.DOTTED:
|
||||
return 'dotted';
|
||||
case _textDecoration2.TEXT_DECORATION_STYLE.DOUBLE:
|
||||
return 'double';
|
||||
case _textDecoration2.TEXT_DECORATION_STYLE.DASHED:
|
||||
return 'dashed';
|
||||
case _textDecoration2.TEXT_DECORATION_STYLE.WAVY:
|
||||
return 'WAVY';
|
||||
}
|
||||
return 'UNKNOWN';
|
||||
}
|
||||
}, {
|
||||
key: 'setOpacity',
|
||||
value: function setOpacity(opacity) {
|
||||
this.writeLine('Opacity: ' + opacity);
|
||||
}
|
||||
}, {
|
||||
key: 'transform',
|
||||
value: function transform(offsetX, offsetY, matrix, callback) {
|
||||
this.writeLine('Transform: (' + Math.round(offsetX) + ', ' + Math.round(offsetY) + ') [' + matrix.map(function (v) {
|
||||
return Math.round(v * 100) / 100;
|
||||
}).join(', ') + ']');
|
||||
this.indent += 2;
|
||||
callback();
|
||||
this.indent -= 2;
|
||||
}
|
||||
}, {
|
||||
key: 'writeLine',
|
||||
value: function writeLine(text) {
|
||||
this.lines.push('' + new Array(this.indent + 1).join(' ') + text);
|
||||
}
|
||||
}]);
|
||||
|
||||
return RefTestRenderer;
|
||||
}();
|
||||
|
||||
module.exports = RefTestRenderer;
|
11
AstuteClient2/src/assets/html2canvas/flow-typed/myLibDef.js
vendored
Normal file
11
AstuteClient2/src/assets/html2canvas/flow-typed/myLibDef.js
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
declare var __DEV__: boolean;
|
||||
declare var __VERSION__: string;
|
||||
|
||||
declare class SVGSVGElement extends Element {
|
||||
className: string;
|
||||
style: CSSStyleDeclaration;
|
||||
|
||||
getPresentationAttribute(name: string): any;
|
||||
}
|
||||
|
||||
declare class HTMLBodyElement extends HTMLElement {}
|
8919
AstuteClient2/src/assets/html2canvas/package-lock.json
generated
Normal file
8919
AstuteClient2/src/assets/html2canvas/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
109
AstuteClient2/src/assets/html2canvas/package.json
Normal file
109
AstuteClient2/src/assets/html2canvas/package.json
Normal file
|
@ -0,0 +1,109 @@
|
|||
{
|
||||
"_from": "html2canvas",
|
||||
"_id": "html2canvas@1.0.0-alpha.12",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-OxmS48mz9WBjw1/WIElPN+uohRM=",
|
||||
"_location": "/html2canvas",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "html2canvas",
|
||||
"name": "html2canvas",
|
||||
"escapedName": "html2canvas",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/html2pdf.js"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.0.0-alpha.12.tgz",
|
||||
"_shasum": "3b1992e3c9b3f56063c35fd620494f37eba88513",
|
||||
"_spec": "html2canvas",
|
||||
"_where": "D:\\Documents\\Astute\\AstuteClient",
|
||||
"author": {
|
||||
"name": "Niklas von Hertzen",
|
||||
"email": "niklasvh@gmail.com",
|
||||
"url": "https://hertzen.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/niklasvh/html2canvas/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"css-line-break": "1.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Screenshots with JavaScript",
|
||||
"devDependencies": {
|
||||
"babel-cli": "6.24.1",
|
||||
"babel-core": "6.25.0",
|
||||
"babel-eslint": "7.2.3",
|
||||
"babel-loader": "7.1.1",
|
||||
"babel-plugin-dev-expression": "0.2.1",
|
||||
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
|
||||
"babel-plugin-transform-object-rest-spread": "6.23.0",
|
||||
"babel-preset-es2015": "6.24.1",
|
||||
"babel-preset-flow": "6.23.0",
|
||||
"base64-arraybuffer": "0.1.5",
|
||||
"body-parser": "1.17.2",
|
||||
"chai": "4.1.1",
|
||||
"chromeless": "1.2.0",
|
||||
"cors": "2.8.4",
|
||||
"eslint": "4.2.0",
|
||||
"eslint-plugin-flowtype": "2.35.0",
|
||||
"eslint-plugin-prettier": "2.1.2",
|
||||
"express": "4.15.4",
|
||||
"filenamify-url": "1.0.0",
|
||||
"flow-bin": "0.56.0",
|
||||
"glob": "7.1.2",
|
||||
"html2canvas-proxy": "1.0.0",
|
||||
"jquery": "3.2.1",
|
||||
"karma": "1.7.0",
|
||||
"karma-chrome-launcher": "2.2.0",
|
||||
"karma-edge-launcher": "0.4.1",
|
||||
"karma-firefox-launcher": "1.0.1",
|
||||
"karma-ie-launcher": "1.0.0",
|
||||
"karma-mocha": "1.3.0",
|
||||
"karma-sauce-launcher": "1.1.0",
|
||||
"mocha": "3.5.0",
|
||||
"platform": "1.3.4",
|
||||
"prettier": "1.5.3",
|
||||
"promise-polyfill": "6.0.2",
|
||||
"replace-in-file": "^3.0.0",
|
||||
"rimraf": "2.6.1",
|
||||
"serve-index": "1.9.0",
|
||||
"slash": "1.0.0",
|
||||
"uglifyjs-webpack-plugin": "^1.1.2",
|
||||
"webpack": "3.4.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"homepage": "https://html2canvas.hertzen.com",
|
||||
"license": "MIT",
|
||||
"main": "dist/npm/index.js",
|
||||
"name": "html2canvas",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/niklasvh/html2canvas.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rimraf dist/ && node scripts/create-reftest-list && npm run build:npm && npm run build:browser",
|
||||
"build:browser": "webpack",
|
||||
"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",
|
||||
"flow": "flow",
|
||||
"format": "prettier --single-quote --no-bracket-spacing --tab-width 4 --print-width 100 --write \"{src,www/src,tests,scripts}/**/*.js\"",
|
||||
"karma": "node karma",
|
||||
"lint": "eslint src/**",
|
||||
"start": "node tests/server",
|
||||
"test": "npm run flow && npm run lint && npm run test:node && npm run karma",
|
||||
"test:node": "mocha tests/node/*.js",
|
||||
"watch": "webpack --progress --colors --watch"
|
||||
},
|
||||
"title": "html2canvas",
|
||||
"version": "1.0.0-alpha.12"
|
||||
}
|
14
AstuteClient2/src/assets/html2pdf.js/.babelrc
Normal file
14
AstuteClient2/src/assets/html2pdf.js/.babelrc
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"presets": [
|
||||
[
|
||||
"env",
|
||||
{
|
||||
"modules": false
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"external-helpers",
|
||||
"transform-object-assign"
|
||||
]
|
||||
}
|
21
AstuteClient2/src/assets/html2pdf.js/LICENSE
Normal file
21
AstuteClient2/src/assets/html2pdf.js/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2017 Erik Koopmans
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
176
AstuteClient2/src/assets/html2pdf.js/README.md
Normal file
176
AstuteClient2/src/assets/html2pdf.js/README.md
Normal file
|
@ -0,0 +1,176 @@
|
|||
# html2pdf
|
||||
|
||||
html2pdf converts any webpage or element into a printable PDF entirely client-side using [html2canvas](https://github.com/niklasvh/html2canvas) and [jsPDF](https://github.com/MrRio/jsPDF).
|
||||
|
||||
## Getting started
|
||||
|
||||
#### HTML
|
||||
|
||||
The simplest way to use html2pdf is to download `dist/html2pdf.bundle.min.js` to your project folder and include it in your HTML with:
|
||||
|
||||
```html
|
||||
<script src="html2pdf.bundle.min.js"></script>
|
||||
```
|
||||
|
||||
*Note: [Click here](#dependencies) for more information about using the unbundled version `dist/html2canvas.min.js`.*
|
||||
|
||||
#### NPM
|
||||
|
||||
Install html2pdf and its dependencies using NPM with `npm install --save html2pdf.js` (make sure to include `.js` in the package name).
|
||||
|
||||
*Note: You can use NPM to create your project, but html2pdf **will not run in Node.js**, it must be run in a browser.*
|
||||
|
||||
#### Bower
|
||||
|
||||
Install html2pdf and its dependencies using Bower with `bower install --save html2pdf.js` (make sure to include `.js` in the package name).
|
||||
|
||||
## Usage
|
||||
|
||||
Once installed, html2pdf is ready to use. The following command will generate a PDF of `#element-to-print` and prompt the user to save the result:
|
||||
|
||||
```js
|
||||
var element = document.getElementById('element-to-print');
|
||||
html2pdf(element);
|
||||
```
|
||||
|
||||
### Advanced usage
|
||||
|
||||
Every step of html2pdf is configurable, using its new Promise-based API. If html2pdf is called without arguments, it will return a `Worker` object:
|
||||
|
||||
```js
|
||||
var worker = html2pdf(); // Or: var worker = new html2pdf.Worker;
|
||||
```
|
||||
|
||||
This worker has methods that can be chained sequentially, as each Promise resolves, and allows insertion of your own intermediate functions between steps. A prerequisite system allows you to skip over mandatory steps (like canvas creation) without any trouble:
|
||||
|
||||
```js
|
||||
// This will implicitly create the canvas and PDF objects before saving.
|
||||
var worker = html2pdf().from(element).save();
|
||||
```
|
||||
|
||||
#### Workflow
|
||||
|
||||
The basic workflow of html2pdf tasks (enforced by the prereq system) is:
|
||||
|
||||
```
|
||||
.from() -> .toContainer() -> .toCanvas() -> .toImg() -> .toPdf() -> .save()
|
||||
```
|
||||
|
||||
#### Worker API
|
||||
|
||||
| Method | Arguments | Description |
|
||||
|--------------|--------------------|-------------|
|
||||
| from | src, type | Sets the source (HTML string or element) for the PDF. Optional `type` specifies other sources: `'string'`, `'element'`, `'canvas'`, or `'img'`. |
|
||||
| to | target | Converts the source to the specified target (`'container'`, `'canvas'`, `'img'`, or `'pdf'`). Each target also has its own `toX` method that can be called directly: `toContainer()`, `toCanvas()`, `toImg()`, and `toPdf()`. |
|
||||
| output | type, options, src | Routes to the appropriate `outputPdf` or `outputImg` method based on specified `src` (`'pdf'` (default) or `'img'`). |
|
||||
| outputPdf | type, options | Sends `type` and `options` to the jsPDF object's `output` method, and returns the result as a Promise (use `.then` to access). See the [jsPDF source code](https://rawgit.com/MrRio/jsPDF/master/docs/jspdf.js.html#line992) for more info. |
|
||||
| outputImg | type, options | Returns the specified data type for the image as a Promise (use `.then` to access). Supported types: `'img'`, `'datauristring'`/`'dataurlstring'`, and `'datauri'`/`'dataurl'`. |
|
||||
| save | filename | Saves the PDF object with the optional filename (creates user download prompt). |
|
||||
| set | opt | Sets the specified properties. See [Options](#options) below for more details. |
|
||||
| get | key, cbk | Returns the property specified in `key`, either as a Promise (use `.then` to access), or by calling `cbk` if provided. |
|
||||
| then | onFulfilled, onRejected | Standard Promise method, with `this` re-bound to the Worker, and with added progress-tracking (see [Progress](#progress) below). Note that `.then` returns a `Worker`, which is a subclass of Promise. |
|
||||
| thenCore | onFulFilled, onRejected | Standard Promise method, with `this` re-bound to the Worker (no progress-tracking). Note that `.thenCore` returns a `Worker`, which is a subclass of Promise. |
|
||||
| thenExternal | onFulfilled, onRejected | True Promise method. Using this 'exits' the Worker chain - you will not be able to continue chaining Worker methods after `.thenExternal`. |
|
||||
| catch, catchExternal | onRejected | Standard Promise method. `catchExternal` exits the Worker chain - you will not be able to continue chaining Worker methods after `.catchExternal`. |
|
||||
| error | msg | Throws an error in the Worker's Promise chain. |
|
||||
|
||||
A few aliases are also provided for convenience:
|
||||
|
||||
| Method | Alias |
|
||||
|-----------|-----------|
|
||||
| save | saveAs |
|
||||
| set | using |
|
||||
| output | export |
|
||||
| then | run |
|
||||
|
||||
## Options
|
||||
|
||||
html2pdf can be configured using an optional `opt` parameter:
|
||||
|
||||
```js
|
||||
var element = document.getElementById('element-to-print');
|
||||
var opt = {
|
||||
margin: 1,
|
||||
filename: 'myfile.pdf',
|
||||
image: { type: 'jpeg', quality: 0.98 },
|
||||
html2canvas: { scale: 2 },
|
||||
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
|
||||
};
|
||||
|
||||
// New Promise-based usage:
|
||||
html2pdf().from(element).set(opt).save();
|
||||
|
||||
// Old monolithic-style usage:
|
||||
html2pdf(element, opt);
|
||||
```
|
||||
|
||||
The `opt` parameter has the following optional fields:
|
||||
|
||||
|Name |Type |Default |Description |
|
||||
|------------|----------------|------------------------------|------------------------------------------------------------------------------------------------------------|
|
||||
|margin |number or array |0 |PDF margin (in jsPDF units). Can be a single number, `[vMargin, hMargin]`, or `[top, left, bottom, right]`. |
|
||||
|filename |string |'file.pdf' |The default filename of the exported PDF. |
|
||||
|image |object |{type: 'jpeg', quality: 0.95} |The image type and quality used to generate the PDF. See the Extra Features section below. |
|
||||
|enableLinks |boolean |true |If enabled, PDF hyperlinks are automatically added ontop of all anchor tags. |
|
||||
|html2canvas |object |{ } |Configuration options sent directly to `html2canvas` ([see here](https://html2canvas.hertzen.com/configuration) for usage).|
|
||||
|jsPDF |object |{ } |Configuration options sent directly to `jsPDF` ([see here](http://rawgit.com/MrRio/jsPDF/master/docs/jsPDF.html) for usage).|
|
||||
|
||||
### Page-breaks
|
||||
|
||||
You may add `html2pdf`-specific page-breaks to your document by adding the CSS class `html2pdf__page-break` to any element (normally an empty `div`). For React elements, use `className=html2pdf__page-break`. During PDF creation, these elements will be given a height calculated to fill the remainder of the PDF page that they are on. Example usage:
|
||||
|
||||
```html
|
||||
<div id="element-to-print">
|
||||
<span>I'm on page 1!</span>
|
||||
<div class="html2pdf__page-break"></div>
|
||||
<span>I'm on page 2!</span>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Image type and quality
|
||||
|
||||
You may customize the image type and quality exported from the canvas by setting the `image` option. This must be an object with the following fields:
|
||||
|
||||
|Name |Type |Default |Description |
|
||||
|------------|----------------|------------------------------|---------------------------------------------------------------------------------------------|
|
||||
|type |string |'jpeg' |The image type. HTMLCanvasElement only supports 'png', 'jpeg', and 'webp' (on Chrome). |
|
||||
|quality |number |0.95 |The image quality, from 0 to 1. This setting is only used for jpeg/webp (not png). |
|
||||
|
||||
These options are limited to the available settings for [HTMLCanvasElement.toDataURL()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL), which ignores quality settings for 'png' images. To enable png image compression, try using the [canvas-png-compression shim](https://github.com/ShyykoSerhiy/canvas-png-compression), which should be an in-place solution to enable png compression via the `quality` option.
|
||||
|
||||
## Progress
|
||||
|
||||
The Worker object returned by `html2pdf()` has a built-in progress-tracking mechanism. It will be updated to allow a progress callback that will be called with each update, however it is currently a work-in-progress.
|
||||
|
||||
## Dependencies
|
||||
|
||||
html2pdf depends on the external packages [html2canvas](https://github.com/niklasvh/html2canvas), [jsPDF](https://github.com/MrRio/jsPDF), and [es6-promise](https://github.com/stefanpenner/es6-promise). These dependencies are automatically loaded when using NPM or the bundled package.
|
||||
|
||||
If using the unbundled `dist/html2pdf.min.js` (or its un-minified version), you must also include each dependency. Order is important, otherwise html2canvas will be overridden by jsPDF's own internal implementation:
|
||||
|
||||
```html
|
||||
<script src="es6-promise.auto.min.js"></script>
|
||||
<script src="jspdf.min.js"></script>
|
||||
<script src="html2canvas.min.js"></script>
|
||||
<script src="html2pdf.min.js"></script>
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
### Issues
|
||||
|
||||
When submitting an issue, please provide reproducible code that highlights the issue, preferably by creating a fork of [this template jsFiddle](https://jsfiddle.net/u6o6ne41/) (which has html2pdf already loaded). Remember that html2pdf uses [html2canvas](https://github.com/niklasvh/html2canvas) and [jsPDF](https://github.com/MrRio/jsPDF) as dependencies, so it's a good idea to check each of those repositories' issue trackers to see if your problem has already been addressed.
|
||||
|
||||
### Pull requests
|
||||
|
||||
If you want to create a new feature or bugfix, please feel free to fork and submit a pull request! Use the [`develop`](/eKoopmans/html2pdf/tree/develop) branch, which features the latest development, and make changes to `/src/` rather than directly to `/dist/`. You can test your changes by rebuilding with `npm run build`.
|
||||
|
||||
## Credits
|
||||
|
||||
[Erik Koopmans](https://github.com/eKoopmans)
|
||||
|
||||
## License
|
||||
|
||||
[The MIT License](http://opensource.org/licenses/MIT)
|
||||
|
||||
Copyright (c) 2017 Erik Koopmans <[http://www.erik-koopmans.com/](http://www.erik-koopmans.com/)>
|
28
AstuteClient2/src/assets/html2pdf.js/bower.json
Normal file
28
AstuteClient2/src/assets/html2pdf.js/bower.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "html2pdf.js",
|
||||
"description": "Client-side HTML-to-PDF rendering using pure JS",
|
||||
"main": "dist/html2pdf.bundle.js",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"authors": [
|
||||
"Erik Koopmans <erik@erik-koopmans.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"javascript",
|
||||
"pdf-generation",
|
||||
"html",
|
||||
"client-side",
|
||||
"canvas"
|
||||
],
|
||||
"homepage": "https://github.com/eKoopmans/html2pdf",
|
||||
"ignore": [
|
||||
"node_modules/",
|
||||
"bower_components/",
|
||||
".archive/",
|
||||
".devel/"
|
||||
]
|
||||
}
|
803
AstuteClient2/src/assets/html2pdf.js/dist/html2pdf.js
vendored
Normal file
803
AstuteClient2/src/assets/html2pdf.js/dist/html2pdf.js
vendored
Normal file
|
@ -0,0 +1,803 @@
|
|||
/**
|
||||
* html2pdf.js v0.9.0
|
||||
* Copyright (c) 2018 Erik Koopmans
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('es6-promise/auto'), require('jspdf'), require('html2canvas')) :
|
||||
typeof define === 'function' && define.amd ? define(['es6-promise/auto', 'jspdf', 'html2canvas'], factory) :
|
||||
(global.html2pdf = factory(null,global.jsPDF,global.html2canvas));
|
||||
}(this, (function (auto,jsPDF,html2canvas) { 'use strict';
|
||||
|
||||
jsPDF = jsPDF && jsPDF.hasOwnProperty('default') ? jsPDF['default'] : jsPDF;
|
||||
html2canvas = html2canvas && html2canvas.hasOwnProperty('default') ? html2canvas['default'] : html2canvas;
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
||||
return typeof obj;
|
||||
} : function (obj) {
|
||||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
// Determine the type of a variable/object.
|
||||
var objType = function objType(obj) {
|
||||
var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj);
|
||||
if (type === 'undefined') return 'undefined';else if (type === 'string' || obj instanceof String) return 'string';else if (type === 'number' || obj instanceof Number) return 'number';else if (type === 'function' || obj instanceof Function) return 'function';else if (!!obj && obj.constructor === Array) return 'array';else if (obj && obj.nodeType === 1) return 'element';else if (type === 'object') return 'object';else return 'unknown';
|
||||
};
|
||||
|
||||
// Create an HTML element with optional className, innerHTML, and style.
|
||||
var createElement = function createElement(tagName, opt) {
|
||||
var el = document.createElement(tagName);
|
||||
if (opt.className) el.className = opt.className;
|
||||
if (opt.innerHTML) {
|
||||
el.innerHTML = opt.innerHTML;
|
||||
var scripts = el.getElementsByTagName('script');
|
||||
for (var i = scripts.length; i-- > 0; null) {
|
||||
scripts[i].parentNode.removeChild(scripts[i]);
|
||||
}
|
||||
}
|
||||
for (var key in opt.style) {
|
||||
el.style[key] = opt.style[key];
|
||||
}
|
||||
return el;
|
||||
};
|
||||
|
||||
// Deep-clone a node and preserve contents/properties.
|
||||
var cloneNode = function cloneNode(node, javascriptEnabled) {
|
||||
// Recursively clone the node.
|
||||
var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false);
|
||||
for (var child = node.firstChild; child; child = child.nextSibling) {
|
||||
if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') {
|
||||
clone.appendChild(cloneNode(child, javascriptEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
if (node.nodeType === 1) {
|
||||
// Preserve contents/properties of special nodes.
|
||||
if (node.nodeName === 'CANVAS') {
|
||||
clone.width = node.width;
|
||||
clone.height = node.height;
|
||||
clone.getContext('2d').drawImage(node, 0, 0);
|
||||
} else if (node.nodeName === 'TEXTAREA' || node.nodeName === 'SELECT') {
|
||||
clone.value = node.value;
|
||||
}
|
||||
|
||||
// Preserve the node's scroll position when it loads.
|
||||
clone.addEventListener('load', function () {
|
||||
clone.scrollTop = node.scrollTop;
|
||||
clone.scrollLeft = node.scrollLeft;
|
||||
}, true);
|
||||
}
|
||||
|
||||
// Return the cloned node.
|
||||
return clone;
|
||||
};
|
||||
|
||||
// Convert units using the conversion value 'k' from jsPDF.
|
||||
var unitConvert = function unitConvert(obj, k) {
|
||||
var newObj = {};
|
||||
for (var key in obj) {
|
||||
newObj[key] = obj[key] * 72 / 96 / k;
|
||||
}
|
||||
return newObj;
|
||||
};
|
||||
|
||||
/* ----- CONSTRUCTOR ----- */
|
||||
|
||||
var Worker = function Worker(opt) {
|
||||
// Create the root parent for the proto chain, and the starting Worker.
|
||||
var root = _extends(Worker.convert(Promise.resolve()), JSON.parse(JSON.stringify(Worker.template)));
|
||||
var self = Worker.convert(Promise.resolve(), root);
|
||||
|
||||
// Set progress, optional settings, and return.
|
||||
self = self.setProgress(1, Worker, 1, [Worker]);
|
||||
self = self.set(opt);
|
||||
return self;
|
||||
};
|
||||
|
||||
// Boilerplate for subclassing Promise.
|
||||
Worker.prototype = Object.create(Promise.prototype);
|
||||
Worker.prototype.constructor = Worker;
|
||||
|
||||
// Converts/casts promises into Workers.
|
||||
Worker.convert = function convert(promise, inherit) {
|
||||
// Uses prototypal inheritance to receive changes made to ancestors' properties.
|
||||
promise.__proto__ = inherit || Worker.prototype;
|
||||
return promise;
|
||||
};
|
||||
|
||||
Worker.template = {
|
||||
prop: {
|
||||
src: null,
|
||||
container: null,
|
||||
overlay: null,
|
||||
canvas: null,
|
||||
img: null,
|
||||
pdf: null,
|
||||
pageSize: null
|
||||
},
|
||||
progress: {
|
||||
val: 0,
|
||||
state: null,
|
||||
n: 0,
|
||||
stack: []
|
||||
},
|
||||
opt: {
|
||||
filename: 'file.pdf',
|
||||
margin: [0, 0, 0, 0],
|
||||
image: { type: 'jpeg', quality: 0.95 },
|
||||
enableLinks: true,
|
||||
html2canvas: {},
|
||||
jsPDF: {}
|
||||
}
|
||||
};
|
||||
|
||||
/* ----- FROM / TO ----- */
|
||||
|
||||
Worker.prototype.from = function from(src, type) {
|
||||
function getType(src) {
|
||||
switch (objType(src)) {
|
||||
case 'string':
|
||||
return 'string';
|
||||
case 'element':
|
||||
return src.nodeName.toLowerCase === 'canvas' ? 'canvas' : 'element';
|
||||
default:
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
|
||||
return this.then(function from_main() {
|
||||
type = type || getType(src);
|
||||
switch (type) {
|
||||
case 'string':
|
||||
return this.set({ src: createElement('div', { innerHTML: src }) });
|
||||
case 'element':
|
||||
return this.set({ src: src });
|
||||
case 'canvas':
|
||||
return this.set({ canvas: src });
|
||||
case 'img':
|
||||
return this.set({ img: src });
|
||||
default:
|
||||
return this.error('Unknown source type.');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.to = function to(target) {
|
||||
// Route the 'to' request to the appropriate method.
|
||||
switch (target) {
|
||||
case 'container':
|
||||
return this.toContainer();
|
||||
case 'canvas':
|
||||
return this.toCanvas();
|
||||
case 'img':
|
||||
return this.toImg();
|
||||
case 'pdf':
|
||||
return this.toPdf();
|
||||
default:
|
||||
return this.error('Invalid target.');
|
||||
}
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkSrc() {
|
||||
return this.prop.src || this.error('Cannot duplicate - no source HTML.');
|
||||
}, function checkPageSize() {
|
||||
return this.prop.pageSize || this.setPageSize();
|
||||
}];
|
||||
|
||||
return this.thenList(prereqs).then(function toContainer_main() {
|
||||
// Define the CSS styles for the container and its overlay parent.
|
||||
var overlayCSS = {
|
||||
position: 'fixed', overflow: 'hidden', zIndex: 1000,
|
||||
left: 0, right: 0, bottom: 0, top: 0,
|
||||
backgroundColor: 'rgba(0,0,0,0.8)'
|
||||
};
|
||||
var containerCSS = {
|
||||
position: 'absolute', width: this.prop.pageSize.inner.width + this.prop.pageSize.unit,
|
||||
left: 0, right: 0, top: 0, height: 'auto', margin: 'auto',
|
||||
backgroundColor: 'white'
|
||||
};
|
||||
|
||||
// Set the overlay to hidden (could be changed in the future to provide a print preview).
|
||||
overlayCSS.opacity = 0;
|
||||
|
||||
// Create and attach the elements.
|
||||
var source = cloneNode(this.prop.src, this.opt.html2canvas.javascriptEnabled);
|
||||
this.prop.overlay = createElement('div', { className: 'html2pdf__overlay', style: overlayCSS });
|
||||
this.prop.container = createElement('div', { className: 'html2pdf__container', style: containerCSS });
|
||||
this.prop.container.appendChild(source);
|
||||
this.prop.overlay.appendChild(this.prop.container);
|
||||
document.body.appendChild(this.prop.overlay);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toCanvas = function toCanvas() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkContainer() {
|
||||
return document.body.contains(this.prop.container) || this.toContainer();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then create the canvas.
|
||||
return this.thenList(prereqs).then(function toCanvas_main() {
|
||||
// Handle old-fashioned 'onrendered' argument.
|
||||
var options = _extends({}, this.opt.html2canvas);
|
||||
delete options.onrendered;
|
||||
|
||||
return html2canvas(this.prop.container, options);
|
||||
}).then(function toCanvas_post(canvas) {
|
||||
// Handle old-fashioned 'onrendered' argument.
|
||||
var onRendered = this.opt.html2canvas.onrendered || function () {};
|
||||
onRendered(canvas);
|
||||
|
||||
this.prop.canvas = canvas;
|
||||
document.body.removeChild(this.prop.overlay);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toImg = function toImg() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkCanvas() {
|
||||
return this.prop.canvas || this.toCanvas();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then create the image.
|
||||
return this.thenList(prereqs).then(function toImg_main() {
|
||||
var imgData = this.prop.canvas.toDataURL('image/' + this.opt.image.type, this.opt.image.quality);
|
||||
this.prop.img = document.createElement('img');
|
||||
this.prop.img.src = imgData;
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toPdf = function toPdf() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkCanvas() {
|
||||
return this.prop.canvas || this.toCanvas();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then create the image.
|
||||
return this.thenList(prereqs).then(function toPdf_main() {
|
||||
// Create local copies of frequently used properties.
|
||||
var canvas = this.prop.canvas;
|
||||
var opt = this.opt;
|
||||
|
||||
// Calculate the number of pages.
|
||||
var ctx = canvas.getContext('2d');
|
||||
var pxFullHeight = canvas.height;
|
||||
var pxPageHeight = Math.floor(canvas.width * this.prop.pageSize.inner.ratio);
|
||||
var nPages = Math.ceil(pxFullHeight / pxPageHeight);
|
||||
|
||||
// Define pageHeight separately so it can be trimmed on the final page.
|
||||
var pageHeight = this.prop.pageSize.inner.height;
|
||||
|
||||
// Create a one-page canvas to split up the full image.
|
||||
var pageCanvas = document.createElement('canvas');
|
||||
var pageCtx = pageCanvas.getContext('2d');
|
||||
pageCanvas.width = canvas.width;
|
||||
pageCanvas.height = pxPageHeight;
|
||||
|
||||
// Initialize the PDF.
|
||||
this.prop.pdf = this.prop.pdf || new jsPDF(opt.jsPDF);
|
||||
|
||||
for (var page = 0; page < nPages; page++) {
|
||||
// Trim the final page to reduce file size.
|
||||
if (page === nPages - 1) {
|
||||
pageCanvas.height = pxFullHeight % pxPageHeight;
|
||||
pageHeight = pageCanvas.height * this.prop.pageSize.inner.width / pageCanvas.width;
|
||||
}
|
||||
|
||||
// Display the page.
|
||||
var w = pageCanvas.width;
|
||||
var h = pageCanvas.height;
|
||||
pageCtx.fillStyle = 'white';
|
||||
pageCtx.fillRect(0, 0, w, h);
|
||||
pageCtx.drawImage(canvas, 0, page * pxPageHeight, w, h, 0, 0, w, h);
|
||||
|
||||
// Add the page to the PDF.
|
||||
if (page) this.prop.pdf.addPage();
|
||||
var imgData = pageCanvas.toDataURL('image/' + opt.image.type, opt.image.quality);
|
||||
this.prop.pdf.addImage(imgData, opt.image.type, opt.margin[1], opt.margin[0], this.prop.pageSize.inner.width, pageHeight);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* ----- OUTPUT / SAVE ----- */
|
||||
|
||||
Worker.prototype.output = function output(type, options, src) {
|
||||
// Redirect requests to the correct function (outputPdf / outputImg).
|
||||
src = src || 'pdf';
|
||||
if (src.toLowerCase() === 'img' || src.toLowerCase() === 'image') {
|
||||
return this.outputImg(type, options);
|
||||
} else {
|
||||
return this.outputPdf(type, options);
|
||||
}
|
||||
};
|
||||
|
||||
Worker.prototype.outputPdf = function outputPdf(type, options) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkPdf() {
|
||||
return this.prop.pdf || this.toPdf();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then perform the appropriate output.
|
||||
return this.thenList(prereqs).then(function outputPdf_main() {
|
||||
/* Currently implemented output types:
|
||||
* https://rawgit.com/MrRio/jsPDF/master/docs/jspdf.js.html#line992
|
||||
* save(options), arraybuffer, blob, bloburi/bloburl,
|
||||
* datauristring/dataurlstring, dataurlnewwindow, datauri/dataurl
|
||||
*/
|
||||
return this.prop.pdf.output(type, options);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.outputImg = function outputImg(type, options) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkImg() {
|
||||
return this.prop.img || this.toImg();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then perform the appropriate output.
|
||||
return this.thenList(prereqs).then(function outputImg_main() {
|
||||
switch (type) {
|
||||
case undefined:
|
||||
case 'img':
|
||||
return this.prop.img;
|
||||
case 'datauristring':
|
||||
case 'dataurlstring':
|
||||
return this.prop.img.src;
|
||||
case 'datauri':
|
||||
case 'dataurl':
|
||||
return document.location.href = this.prop.img.src;
|
||||
default:
|
||||
throw 'Image output type "' + type + '" is not supported.';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.save = function save(filename) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkPdf() {
|
||||
return this.prop.pdf || this.toPdf();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs, update the filename (if provided), and save the PDF.
|
||||
return this.thenList(prereqs).set(filename ? { filename: filename } : null).then(function save_main() {
|
||||
this.prop.pdf.save(this.opt.filename);
|
||||
});
|
||||
};
|
||||
|
||||
/* ----- SET / GET ----- */
|
||||
|
||||
Worker.prototype.set = function set$$1(opt) {
|
||||
// TODO: Implement ordered pairs?
|
||||
|
||||
// Silently ignore invalid or empty input.
|
||||
if (objType(opt) !== 'object') {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Build an array of setter functions to queue.
|
||||
var fns = Object.keys(opt || {}).map(function (key) {
|
||||
if (key in Worker.template.prop) {
|
||||
// Set pre-defined properties.
|
||||
return function set_prop() {
|
||||
this.prop[key] = opt[key];
|
||||
};
|
||||
} else {
|
||||
switch (key) {
|
||||
case 'margin':
|
||||
return this.setMargin.bind(this, opt.margin);
|
||||
case 'jsPDF':
|
||||
return function set_jsPDF() {
|
||||
this.opt.jsPDF = opt.jsPDF;return this.setPageSize();
|
||||
};
|
||||
case 'pageSize':
|
||||
return this.setPageSize.bind(this, opt.pageSize);
|
||||
default:
|
||||
// Set any other properties in opt.
|
||||
return function set_opt() {
|
||||
this.opt[key] = opt[key];
|
||||
};
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
// Set properties within the promise chain.
|
||||
return this.then(function set_main() {
|
||||
return this.thenList(fns);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.get = function get$$1(key, cbk) {
|
||||
return this.then(function get_main() {
|
||||
// Fetch the requested property, either as a predefined prop or in opt.
|
||||
var val = key in Worker.template.prop ? this.prop[key] : this.opt[key];
|
||||
return cbk ? cbk(val) : val;
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.setMargin = function setMargin(margin) {
|
||||
return this.then(function setMargin_main() {
|
||||
// Parse the margin property.
|
||||
switch (objType(margin)) {
|
||||
case 'number':
|
||||
margin = [margin, margin, margin, margin];
|
||||
case 'array':
|
||||
if (margin.length === 2) {
|
||||
margin = [margin[0], margin[1], margin[0], margin[1]];
|
||||
}
|
||||
if (margin.length === 4) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return this.error('Invalid margin array.');
|
||||
}
|
||||
|
||||
// Set the margin property, then update pageSize.
|
||||
this.opt.margin = margin;
|
||||
}).then(this.setPageSize);
|
||||
};
|
||||
|
||||
Worker.prototype.setPageSize = function setPageSize(pageSize) {
|
||||
function toPx(val, k) {
|
||||
return Math.floor(val * k / 72 * 96);
|
||||
}
|
||||
|
||||
return this.then(function setPageSize_main() {
|
||||
// Retrieve page-size based on jsPDF settings, if not explicitly provided.
|
||||
pageSize = pageSize || jsPDF.getPageSize(this.opt.jsPDF);
|
||||
|
||||
// Add 'inner' field if not present.
|
||||
if (!pageSize.hasOwnProperty('inner')) {
|
||||
pageSize.inner = {
|
||||
width: pageSize.width - this.opt.margin[1] - this.opt.margin[3],
|
||||
height: pageSize.height - this.opt.margin[0] - this.opt.margin[2]
|
||||
};
|
||||
pageSize.inner.px = {
|
||||
width: toPx(pageSize.inner.width, pageSize.k),
|
||||
height: toPx(pageSize.inner.height, pageSize.k)
|
||||
};
|
||||
pageSize.inner.ratio = pageSize.inner.height / pageSize.inner.width;
|
||||
}
|
||||
|
||||
// Attach pageSize to this.
|
||||
this.prop.pageSize = pageSize;
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.setProgress = function setProgress(val, state, n, stack) {
|
||||
// Immediately update all progress values.
|
||||
if (val != null) this.progress.val = val;
|
||||
if (state != null) this.progress.state = state;
|
||||
if (n != null) this.progress.n = n;
|
||||
if (stack != null) this.progress.stack = stack;
|
||||
this.progress.ratio = this.progress.val / this.progress.state;
|
||||
|
||||
// Return this for command chaining.
|
||||
return this;
|
||||
};
|
||||
|
||||
Worker.prototype.updateProgress = function updateProgress(val, state, n, stack) {
|
||||
// Immediately update all progress values, using setProgress.
|
||||
return this.setProgress(val ? this.progress.val + val : null, state ? state : null, n ? this.progress.n + n : null, stack ? this.progress.stack.concat(stack) : null);
|
||||
};
|
||||
|
||||
/* ----- PROMISE MAPPING ----- */
|
||||
|
||||
Worker.prototype.then = function then(onFulfilled, onRejected) {
|
||||
// Wrap `this` for encapsulation.
|
||||
var self = this;
|
||||
|
||||
return this.thenCore(onFulfilled, onRejected, function then_main(onFulfilled, onRejected) {
|
||||
// Update progress while queuing, calling, and resolving `then`.
|
||||
self.updateProgress(null, null, 1, [onFulfilled]);
|
||||
return Promise.prototype.then.call(this, function then_pre(val) {
|
||||
self.updateProgress(null, onFulfilled);
|
||||
return val;
|
||||
}).then(onFulfilled, onRejected).then(function then_post(val) {
|
||||
self.updateProgress(1);
|
||||
return val;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.thenCore = function thenCore(onFulfilled, onRejected, thenBase) {
|
||||
// Handle optional thenBase parameter.
|
||||
thenBase = thenBase || Promise.prototype.then;
|
||||
|
||||
// Wrap `this` for encapsulation and bind it to the promise handlers.
|
||||
var self = this;
|
||||
if (onFulfilled) {
|
||||
onFulfilled = onFulfilled.bind(self);
|
||||
}
|
||||
if (onRejected) {
|
||||
onRejected = onRejected.bind(self);
|
||||
}
|
||||
|
||||
// Cast self into a Promise to avoid polyfills recursively defining `then`.
|
||||
var isNative = Promise.toString().indexOf('[native code]') !== -1 && Promise.name === 'Promise';
|
||||
var selfPromise = isNative ? self : Worker.convert(_extends({}, self), Promise.prototype);
|
||||
|
||||
// Return the promise, after casting it into a Worker and preserving props.
|
||||
var returnVal = thenBase.call(selfPromise, onFulfilled, onRejected);
|
||||
return Worker.convert(returnVal, self.__proto__);
|
||||
};
|
||||
|
||||
Worker.prototype.thenExternal = function thenExternal(onFulfilled, onRejected) {
|
||||
// Call `then` and return a standard promise (exits the Worker chain).
|
||||
return Promise.prototype.then.call(this, onFulfilled, onRejected);
|
||||
};
|
||||
|
||||
Worker.prototype.thenList = function thenList(fns) {
|
||||
// Queue a series of promise 'factories' into the promise chain.
|
||||
var self = this;
|
||||
fns.forEach(function thenList_forEach(fn) {
|
||||
self = self.thenCore(fn);
|
||||
});
|
||||
return self;
|
||||
};
|
||||
|
||||
Worker.prototype['catch'] = function (onRejected) {
|
||||
// Bind `this` to the promise handler, call `catch`, and return a Worker.
|
||||
if (onRejected) {
|
||||
onRejected = onRejected.bind(this);
|
||||
}
|
||||
var returnVal = Promise.prototype['catch'].call(this, onRejected);
|
||||
return Worker.convert(returnVal, this);
|
||||
};
|
||||
|
||||
Worker.prototype.catchExternal = function catchExternal(onRejected) {
|
||||
// Call `catch` and return a standard promise (exits the Worker chain).
|
||||
return Promise.prototype['catch'].call(this, onRejected);
|
||||
};
|
||||
|
||||
Worker.prototype.error = function error(msg) {
|
||||
// Throw the error in the Promise chain.
|
||||
return this.then(function error_main() {
|
||||
throw new Error(msg);
|
||||
});
|
||||
};
|
||||
|
||||
/* ----- ALIASES ----- */
|
||||
|
||||
Worker.prototype.using = Worker.prototype.set;
|
||||
Worker.prototype.saveAs = Worker.prototype.save;
|
||||
Worker.prototype.export = Worker.prototype.output;
|
||||
Worker.prototype.run = Worker.prototype.then;
|
||||
|
||||
// Import dependencies.
|
||||
// Get dimensions of a PDF page, as determined by jsPDF.
|
||||
jsPDF.getPageSize = function (orientation, unit, format) {
|
||||
// Decode options object
|
||||
if ((typeof orientation === 'undefined' ? 'undefined' : _typeof(orientation)) === 'object') {
|
||||
var options = orientation;
|
||||
orientation = options.orientation;
|
||||
unit = options.unit || unit;
|
||||
format = options.format || format;
|
||||
}
|
||||
|
||||
// Default options
|
||||
unit = unit || 'mm';
|
||||
format = format || 'a4';
|
||||
orientation = ('' + (orientation || 'P')).toLowerCase();
|
||||
var format_as_string = ('' + format).toLowerCase();
|
||||
|
||||
// Size in pt of various paper formats
|
||||
var pageFormats = {
|
||||
'a0': [2383.94, 3370.39], 'a1': [1683.78, 2383.94],
|
||||
'a2': [1190.55, 1683.78], 'a3': [841.89, 1190.55],
|
||||
'a4': [595.28, 841.89], 'a5': [419.53, 595.28],
|
||||
'a6': [297.64, 419.53], 'a7': [209.76, 297.64],
|
||||
'a8': [147.40, 209.76], 'a9': [104.88, 147.40],
|
||||
'a10': [73.70, 104.88], 'b0': [2834.65, 4008.19],
|
||||
'b1': [2004.09, 2834.65], 'b2': [1417.32, 2004.09],
|
||||
'b3': [1000.63, 1417.32], 'b4': [708.66, 1000.63],
|
||||
'b5': [498.90, 708.66], 'b6': [354.33, 498.90],
|
||||
'b7': [249.45, 354.33], 'b8': [175.75, 249.45],
|
||||
'b9': [124.72, 175.75], 'b10': [87.87, 124.72],
|
||||
'c0': [2599.37, 3676.54], 'c1': [1836.85, 2599.37],
|
||||
'c2': [1298.27, 1836.85], 'c3': [918.43, 1298.27],
|
||||
'c4': [649.13, 918.43], 'c5': [459.21, 649.13],
|
||||
'c6': [323.15, 459.21], 'c7': [229.61, 323.15],
|
||||
'c8': [161.57, 229.61], 'c9': [113.39, 161.57],
|
||||
'c10': [79.37, 113.39], 'dl': [311.81, 623.62],
|
||||
'letter': [612, 792],
|
||||
'government-letter': [576, 756],
|
||||
'legal': [612, 1008],
|
||||
'junior-legal': [576, 360],
|
||||
'ledger': [1224, 792],
|
||||
'tabloid': [792, 1224],
|
||||
'credit-card': [153, 243]
|
||||
};
|
||||
|
||||
// Unit conversion
|
||||
switch (unit) {
|
||||
case 'pt':
|
||||
var k = 1;break;
|
||||
case 'mm':
|
||||
var k = 72 / 25.4;break;
|
||||
case 'cm':
|
||||
var k = 72 / 2.54;break;
|
||||
case 'in':
|
||||
var k = 72;break;
|
||||
case 'px':
|
||||
var k = 72 / 96;break;
|
||||
case 'pc':
|
||||
var k = 12;break;
|
||||
case 'em':
|
||||
var k = 12;break;
|
||||
case 'ex':
|
||||
var k = 6;break;
|
||||
default:
|
||||
throw 'Invalid unit: ' + unit;
|
||||
}
|
||||
|
||||
// Dimensions are stored as user units and converted to points on output
|
||||
if (pageFormats.hasOwnProperty(format_as_string)) {
|
||||
var pageHeight = pageFormats[format_as_string][1] / k;
|
||||
var pageWidth = pageFormats[format_as_string][0] / k;
|
||||
} else {
|
||||
try {
|
||||
var pageHeight = format[1];
|
||||
var pageWidth = format[0];
|
||||
} catch (err) {
|
||||
throw new Error('Invalid format: ' + format);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle page orientation
|
||||
if (orientation === 'p' || orientation === 'portrait') {
|
||||
orientation = 'p';
|
||||
if (pageWidth > pageHeight) {
|
||||
var tmp = pageWidth;
|
||||
pageWidth = pageHeight;
|
||||
pageHeight = tmp;
|
||||
}
|
||||
} else if (orientation === 'l' || orientation === 'landscape') {
|
||||
orientation = 'l';
|
||||
if (pageHeight > pageWidth) {
|
||||
var tmp = pageWidth;
|
||||
pageWidth = pageHeight;
|
||||
pageHeight = tmp;
|
||||
}
|
||||
} else {
|
||||
throw 'Invalid orientation: ' + orientation;
|
||||
}
|
||||
|
||||
// Return information (k is the unit conversion ratio from pts)
|
||||
var info = { 'width': pageWidth, 'height': pageHeight, 'unit': unit, 'k': k };
|
||||
return info;
|
||||
};
|
||||
|
||||
var orig = {
|
||||
toContainer: Worker.prototype.toContainer
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
return orig.toContainer.call(this).then(function toContainer_pagebreak() {
|
||||
// Enable page-breaks.
|
||||
var pageBreaks = this.prop.container.querySelectorAll('.html2pdf__page-break');
|
||||
var pxPageHeight = this.prop.pageSize.inner.px.height;
|
||||
Array.prototype.forEach.call(pageBreaks, function pageBreak_loop(el) {
|
||||
el.style.display = 'block';
|
||||
var clientRect = el.getBoundingClientRect();
|
||||
el.style.height = pxPageHeight - clientRect.top % pxPageHeight + 'px';
|
||||
}, this);
|
||||
});
|
||||
};
|
||||
|
||||
// Add hyperlink functionality to the PDF creation.
|
||||
|
||||
// Main link array, and refs to original functions.
|
||||
var linkInfo = [];
|
||||
var orig$1 = {
|
||||
toContainer: Worker.prototype.toContainer,
|
||||
toPdf: Worker.prototype.toPdf
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
return orig$1.toContainer.call(this).then(function toContainer_hyperlink() {
|
||||
// Retrieve hyperlink info if the option is enabled.
|
||||
if (this.opt.enableLinks) {
|
||||
// Find all anchor tags and get the container's bounds for reference.
|
||||
var container = this.prop.container;
|
||||
var links = container.querySelectorAll('a');
|
||||
var containerRect = unitConvert(container.getBoundingClientRect(), this.prop.pageSize.k);
|
||||
linkInfo = [];
|
||||
|
||||
// Loop through each anchor tag.
|
||||
Array.prototype.forEach.call(links, function (link) {
|
||||
// Treat each client rect as a separate link (for text-wrapping).
|
||||
var clientRects = link.getClientRects();
|
||||
for (var i = 0; i < clientRects.length; i++) {
|
||||
var clientRect = unitConvert(clientRects[i], this.prop.pageSize.k);
|
||||
clientRect.left -= containerRect.left;
|
||||
clientRect.top -= containerRect.top;
|
||||
|
||||
var page = Math.floor(clientRect.top / this.prop.pageSize.inner.height) + 1;
|
||||
var top = this.opt.margin[0] + clientRect.top % this.prop.pageSize.inner.height;
|
||||
var left = this.opt.margin[1] + clientRect.left;
|
||||
|
||||
linkInfo.push({ page: page, top: top, left: left, clientRect: clientRect, link: link });
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toPdf = function toPdf() {
|
||||
return orig$1.toPdf.call(this).then(function toPdf_hyperlink() {
|
||||
// Add hyperlinks if the option is enabled.
|
||||
if (this.opt.enableLinks) {
|
||||
// Attach each anchor tag based on info from toContainer().
|
||||
linkInfo.forEach(function (l) {
|
||||
this.prop.pdf.setPage(l.page);
|
||||
this.prop.pdf.link(l.left, l.top, l.clientRect.width, l.clientRect.height, { url: l.link.href });
|
||||
}, this);
|
||||
|
||||
// Reset the active page of the PDF to the final page.
|
||||
var nPages = this.prop.pdf.internal.getNumberOfPages();
|
||||
this.prop.pdf.setPage(nPages);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate a PDF from an HTML element or string using html2canvas and jsPDF.
|
||||
*
|
||||
* @param {Element|string} source The source element or HTML string.
|
||||
* @param {Object=} opt An object of optional settings: 'margin', 'filename',
|
||||
* 'image' ('type' and 'quality'), and 'html2canvas' / 'jspdf', which are
|
||||
* sent as settings to their corresponding functions.
|
||||
*/
|
||||
var html2pdf = function html2pdf(src, opt) {
|
||||
// Create a new worker with the given options.
|
||||
var worker = new html2pdf.Worker(opt);
|
||||
|
||||
if (src) {
|
||||
// If src is specified, perform the traditional 'simple' operation.
|
||||
return worker.from(src).save();
|
||||
} else {
|
||||
// Otherwise, return the worker for new Promise-based operation.
|
||||
return worker;
|
||||
}
|
||||
};
|
||||
html2pdf.Worker = Worker;
|
||||
|
||||
return html2pdf;
|
||||
|
||||
})));
|
796
AstuteClient2/src/assets/html2pdf.js/dist/include/html2pdf.es.js
vendored
Normal file
796
AstuteClient2/src/assets/html2pdf.js/dist/include/html2pdf.es.js
vendored
Normal file
|
@ -0,0 +1,796 @@
|
|||
/**
|
||||
* html2pdf.js v0.9.0
|
||||
* Copyright (c) 2018 Erik Koopmans
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
import 'es6-promise/auto';
|
||||
import jsPDF from 'jspdf';
|
||||
import html2canvas from 'html2canvas';
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
||||
return typeof obj;
|
||||
} : function (obj) {
|
||||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
// Determine the type of a variable/object.
|
||||
var objType = function objType(obj) {
|
||||
var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj);
|
||||
if (type === 'undefined') return 'undefined';else if (type === 'string' || obj instanceof String) return 'string';else if (type === 'number' || obj instanceof Number) return 'number';else if (type === 'function' || obj instanceof Function) return 'function';else if (!!obj && obj.constructor === Array) return 'array';else if (obj && obj.nodeType === 1) return 'element';else if (type === 'object') return 'object';else return 'unknown';
|
||||
};
|
||||
|
||||
// Create an HTML element with optional className, innerHTML, and style.
|
||||
var createElement = function createElement(tagName, opt) {
|
||||
var el = document.createElement(tagName);
|
||||
if (opt.className) el.className = opt.className;
|
||||
if (opt.innerHTML) {
|
||||
el.innerHTML = opt.innerHTML;
|
||||
var scripts = el.getElementsByTagName('script');
|
||||
for (var i = scripts.length; i-- > 0; null) {
|
||||
scripts[i].parentNode.removeChild(scripts[i]);
|
||||
}
|
||||
}
|
||||
for (var key in opt.style) {
|
||||
el.style[key] = opt.style[key];
|
||||
}
|
||||
return el;
|
||||
};
|
||||
|
||||
// Deep-clone a node and preserve contents/properties.
|
||||
var cloneNode = function cloneNode(node, javascriptEnabled) {
|
||||
// Recursively clone the node.
|
||||
var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false);
|
||||
for (var child = node.firstChild; child; child = child.nextSibling) {
|
||||
if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') {
|
||||
clone.appendChild(cloneNode(child, javascriptEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
if (node.nodeType === 1) {
|
||||
// Preserve contents/properties of special nodes.
|
||||
if (node.nodeName === 'CANVAS') {
|
||||
clone.width = node.width;
|
||||
clone.height = node.height;
|
||||
clone.getContext('2d').drawImage(node, 0, 0);
|
||||
} else if (node.nodeName === 'TEXTAREA' || node.nodeName === 'SELECT') {
|
||||
clone.value = node.value;
|
||||
}
|
||||
|
||||
// Preserve the node's scroll position when it loads.
|
||||
clone.addEventListener('load', function () {
|
||||
clone.scrollTop = node.scrollTop;
|
||||
clone.scrollLeft = node.scrollLeft;
|
||||
}, true);
|
||||
}
|
||||
|
||||
// Return the cloned node.
|
||||
return clone;
|
||||
};
|
||||
|
||||
// Convert units using the conversion value 'k' from jsPDF.
|
||||
var unitConvert = function unitConvert(obj, k) {
|
||||
var newObj = {};
|
||||
for (var key in obj) {
|
||||
newObj[key] = obj[key] * 72 / 96 / k;
|
||||
}
|
||||
return newObj;
|
||||
};
|
||||
|
||||
/* ----- CONSTRUCTOR ----- */
|
||||
|
||||
var Worker = function Worker(opt) {
|
||||
// Create the root parent for the proto chain, and the starting Worker.
|
||||
var root = _extends(Worker.convert(Promise.resolve()), JSON.parse(JSON.stringify(Worker.template)));
|
||||
var self = Worker.convert(Promise.resolve(), root);
|
||||
|
||||
// Set progress, optional settings, and return.
|
||||
self = self.setProgress(1, Worker, 1, [Worker]);
|
||||
self = self.set(opt);
|
||||
return self;
|
||||
};
|
||||
|
||||
// Boilerplate for subclassing Promise.
|
||||
Worker.prototype = Object.create(Promise.prototype);
|
||||
Worker.prototype.constructor = Worker;
|
||||
|
||||
// Converts/casts promises into Workers.
|
||||
Worker.convert = function convert(promise, inherit) {
|
||||
// Uses prototypal inheritance to receive changes made to ancestors' properties.
|
||||
promise.__proto__ = inherit || Worker.prototype;
|
||||
return promise;
|
||||
};
|
||||
|
||||
Worker.template = {
|
||||
prop: {
|
||||
src: null,
|
||||
container: null,
|
||||
overlay: null,
|
||||
canvas: null,
|
||||
img: null,
|
||||
pdf: null,
|
||||
pageSize: null
|
||||
},
|
||||
progress: {
|
||||
val: 0,
|
||||
state: null,
|
||||
n: 0,
|
||||
stack: []
|
||||
},
|
||||
opt: {
|
||||
filename: 'file.pdf',
|
||||
margin: [0, 0, 0, 0],
|
||||
image: { type: 'jpeg', quality: 0.95 },
|
||||
enableLinks: true,
|
||||
html2canvas: {},
|
||||
jsPDF: {}
|
||||
}
|
||||
};
|
||||
|
||||
/* ----- FROM / TO ----- */
|
||||
|
||||
Worker.prototype.from = function from(src, type) {
|
||||
function getType(src) {
|
||||
switch (objType(src)) {
|
||||
case 'string':
|
||||
return 'string';
|
||||
case 'element':
|
||||
return src.nodeName.toLowerCase === 'canvas' ? 'canvas' : 'element';
|
||||
default:
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
|
||||
return this.then(function from_main() {
|
||||
type = type || getType(src);
|
||||
switch (type) {
|
||||
case 'string':
|
||||
return this.set({ src: createElement('div', { innerHTML: src }) });
|
||||
case 'element':
|
||||
return this.set({ src: src });
|
||||
case 'canvas':
|
||||
return this.set({ canvas: src });
|
||||
case 'img':
|
||||
return this.set({ img: src });
|
||||
default:
|
||||
return this.error('Unknown source type.');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.to = function to(target) {
|
||||
// Route the 'to' request to the appropriate method.
|
||||
switch (target) {
|
||||
case 'container':
|
||||
return this.toContainer();
|
||||
case 'canvas':
|
||||
return this.toCanvas();
|
||||
case 'img':
|
||||
return this.toImg();
|
||||
case 'pdf':
|
||||
return this.toPdf();
|
||||
default:
|
||||
return this.error('Invalid target.');
|
||||
}
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkSrc() {
|
||||
return this.prop.src || this.error('Cannot duplicate - no source HTML.');
|
||||
}, function checkPageSize() {
|
||||
return this.prop.pageSize || this.setPageSize();
|
||||
}];
|
||||
|
||||
return this.thenList(prereqs).then(function toContainer_main() {
|
||||
// Define the CSS styles for the container and its overlay parent.
|
||||
var overlayCSS = {
|
||||
position: 'fixed', overflow: 'hidden', zIndex: 1000,
|
||||
left: 0, right: 0, bottom: 0, top: 0,
|
||||
backgroundColor: 'rgba(0,0,0,0.8)'
|
||||
};
|
||||
var containerCSS = {
|
||||
position: 'absolute', width: this.prop.pageSize.inner.width + this.prop.pageSize.unit,
|
||||
left: 0, right: 0, top: 0, height: 'auto', margin: 'auto',
|
||||
backgroundColor: 'white'
|
||||
};
|
||||
|
||||
// Set the overlay to hidden (could be changed in the future to provide a print preview).
|
||||
overlayCSS.opacity = 0;
|
||||
|
||||
// Create and attach the elements.
|
||||
var source = cloneNode(this.prop.src, this.opt.html2canvas.javascriptEnabled);
|
||||
this.prop.overlay = createElement('div', { className: 'html2pdf__overlay', style: overlayCSS });
|
||||
this.prop.container = createElement('div', { className: 'html2pdf__container', style: containerCSS });
|
||||
this.prop.container.appendChild(source);
|
||||
this.prop.overlay.appendChild(this.prop.container);
|
||||
document.body.appendChild(this.prop.overlay);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toCanvas = function toCanvas() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkContainer() {
|
||||
return document.body.contains(this.prop.container) || this.toContainer();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then create the canvas.
|
||||
return this.thenList(prereqs).then(function toCanvas_main() {
|
||||
// Handle old-fashioned 'onrendered' argument.
|
||||
var options = _extends({}, this.opt.html2canvas);
|
||||
delete options.onrendered;
|
||||
|
||||
return html2canvas(this.prop.container, options);
|
||||
}).then(function toCanvas_post(canvas) {
|
||||
// Handle old-fashioned 'onrendered' argument.
|
||||
var onRendered = this.opt.html2canvas.onrendered || function () {};
|
||||
onRendered(canvas);
|
||||
|
||||
this.prop.canvas = canvas;
|
||||
document.body.removeChild(this.prop.overlay);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toImg = function toImg() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkCanvas() {
|
||||
return this.prop.canvas || this.toCanvas();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then create the image.
|
||||
return this.thenList(prereqs).then(function toImg_main() {
|
||||
var imgData = this.prop.canvas.toDataURL('image/' + this.opt.image.type, this.opt.image.quality);
|
||||
this.prop.img = document.createElement('img');
|
||||
this.prop.img.src = imgData;
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toPdf = function toPdf() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkCanvas() {
|
||||
return this.prop.canvas || this.toCanvas();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then create the image.
|
||||
return this.thenList(prereqs).then(function toPdf_main() {
|
||||
// Create local copies of frequently used properties.
|
||||
var canvas = this.prop.canvas;
|
||||
var opt = this.opt;
|
||||
|
||||
// Calculate the number of pages.
|
||||
var ctx = canvas.getContext('2d');
|
||||
var pxFullHeight = canvas.height;
|
||||
var pxPageHeight = Math.floor(canvas.width * this.prop.pageSize.inner.ratio);
|
||||
var nPages = Math.ceil(pxFullHeight / pxPageHeight);
|
||||
|
||||
// Define pageHeight separately so it can be trimmed on the final page.
|
||||
var pageHeight = this.prop.pageSize.inner.height;
|
||||
|
||||
// Create a one-page canvas to split up the full image.
|
||||
var pageCanvas = document.createElement('canvas');
|
||||
var pageCtx = pageCanvas.getContext('2d');
|
||||
pageCanvas.width = canvas.width;
|
||||
pageCanvas.height = pxPageHeight;
|
||||
|
||||
// Initialize the PDF.
|
||||
this.prop.pdf = this.prop.pdf || new jsPDF(opt.jsPDF);
|
||||
|
||||
for (var page = 0; page < nPages; page++) {
|
||||
// Trim the final page to reduce file size.
|
||||
if (page === nPages - 1) {
|
||||
pageCanvas.height = pxFullHeight % pxPageHeight;
|
||||
pageHeight = pageCanvas.height * this.prop.pageSize.inner.width / pageCanvas.width;
|
||||
}
|
||||
|
||||
// Display the page.
|
||||
var w = pageCanvas.width;
|
||||
var h = pageCanvas.height;
|
||||
pageCtx.fillStyle = 'white';
|
||||
pageCtx.fillRect(0, 0, w, h);
|
||||
pageCtx.drawImage(canvas, 0, page * pxPageHeight, w, h, 0, 0, w, h);
|
||||
|
||||
// Add the page to the PDF.
|
||||
if (page) this.prop.pdf.addPage();
|
||||
var imgData = pageCanvas.toDataURL('image/' + opt.image.type, opt.image.quality);
|
||||
this.prop.pdf.addImage(imgData, opt.image.type, opt.margin[1], opt.margin[0], this.prop.pageSize.inner.width, pageHeight);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* ----- OUTPUT / SAVE ----- */
|
||||
|
||||
Worker.prototype.output = function output(type, options, src) {
|
||||
// Redirect requests to the correct function (outputPdf / outputImg).
|
||||
src = src || 'pdf';
|
||||
if (src.toLowerCase() === 'img' || src.toLowerCase() === 'image') {
|
||||
return this.outputImg(type, options);
|
||||
} else {
|
||||
return this.outputPdf(type, options);
|
||||
}
|
||||
};
|
||||
|
||||
Worker.prototype.outputPdf = function outputPdf(type, options) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkPdf() {
|
||||
return this.prop.pdf || this.toPdf();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then perform the appropriate output.
|
||||
return this.thenList(prereqs).then(function outputPdf_main() {
|
||||
/* Currently implemented output types:
|
||||
* https://rawgit.com/MrRio/jsPDF/master/docs/jspdf.js.html#line992
|
||||
* save(options), arraybuffer, blob, bloburi/bloburl,
|
||||
* datauristring/dataurlstring, dataurlnewwindow, datauri/dataurl
|
||||
*/
|
||||
return this.prop.pdf.output(type, options);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.outputImg = function outputImg(type, options) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkImg() {
|
||||
return this.prop.img || this.toImg();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then perform the appropriate output.
|
||||
return this.thenList(prereqs).then(function outputImg_main() {
|
||||
switch (type) {
|
||||
case undefined:
|
||||
case 'img':
|
||||
return this.prop.img;
|
||||
case 'datauristring':
|
||||
case 'dataurlstring':
|
||||
return this.prop.img.src;
|
||||
case 'datauri':
|
||||
case 'dataurl':
|
||||
return document.location.href = this.prop.img.src;
|
||||
default:
|
||||
throw 'Image output type "' + type + '" is not supported.';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.save = function save(filename) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkPdf() {
|
||||
return this.prop.pdf || this.toPdf();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs, update the filename (if provided), and save the PDF.
|
||||
return this.thenList(prereqs).set(filename ? { filename: filename } : null).then(function save_main() {
|
||||
this.prop.pdf.save(this.opt.filename);
|
||||
});
|
||||
};
|
||||
|
||||
/* ----- SET / GET ----- */
|
||||
|
||||
Worker.prototype.set = function set$$1(opt) {
|
||||
// TODO: Implement ordered pairs?
|
||||
|
||||
// Silently ignore invalid or empty input.
|
||||
if (objType(opt) !== 'object') {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Build an array of setter functions to queue.
|
||||
var fns = Object.keys(opt || {}).map(function (key) {
|
||||
if (key in Worker.template.prop) {
|
||||
// Set pre-defined properties.
|
||||
return function set_prop() {
|
||||
this.prop[key] = opt[key];
|
||||
};
|
||||
} else {
|
||||
switch (key) {
|
||||
case 'margin':
|
||||
return this.setMargin.bind(this, opt.margin);
|
||||
case 'jsPDF':
|
||||
return function set_jsPDF() {
|
||||
this.opt.jsPDF = opt.jsPDF;return this.setPageSize();
|
||||
};
|
||||
case 'pageSize':
|
||||
return this.setPageSize.bind(this, opt.pageSize);
|
||||
default:
|
||||
// Set any other properties in opt.
|
||||
return function set_opt() {
|
||||
this.opt[key] = opt[key];
|
||||
};
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
// Set properties within the promise chain.
|
||||
return this.then(function set_main() {
|
||||
return this.thenList(fns);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.get = function get$$1(key, cbk) {
|
||||
return this.then(function get_main() {
|
||||
// Fetch the requested property, either as a predefined prop or in opt.
|
||||
var val = key in Worker.template.prop ? this.prop[key] : this.opt[key];
|
||||
return cbk ? cbk(val) : val;
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.setMargin = function setMargin(margin) {
|
||||
return this.then(function setMargin_main() {
|
||||
// Parse the margin property.
|
||||
switch (objType(margin)) {
|
||||
case 'number':
|
||||
margin = [margin, margin, margin, margin];
|
||||
case 'array':
|
||||
if (margin.length === 2) {
|
||||
margin = [margin[0], margin[1], margin[0], margin[1]];
|
||||
}
|
||||
if (margin.length === 4) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return this.error('Invalid margin array.');
|
||||
}
|
||||
|
||||
// Set the margin property, then update pageSize.
|
||||
this.opt.margin = margin;
|
||||
}).then(this.setPageSize);
|
||||
};
|
||||
|
||||
Worker.prototype.setPageSize = function setPageSize(pageSize) {
|
||||
function toPx(val, k) {
|
||||
return Math.floor(val * k / 72 * 96);
|
||||
}
|
||||
|
||||
return this.then(function setPageSize_main() {
|
||||
// Retrieve page-size based on jsPDF settings, if not explicitly provided.
|
||||
pageSize = pageSize || jsPDF.getPageSize(this.opt.jsPDF);
|
||||
|
||||
// Add 'inner' field if not present.
|
||||
if (!pageSize.hasOwnProperty('inner')) {
|
||||
pageSize.inner = {
|
||||
width: pageSize.width - this.opt.margin[1] - this.opt.margin[3],
|
||||
height: pageSize.height - this.opt.margin[0] - this.opt.margin[2]
|
||||
};
|
||||
pageSize.inner.px = {
|
||||
width: toPx(pageSize.inner.width, pageSize.k),
|
||||
height: toPx(pageSize.inner.height, pageSize.k)
|
||||
};
|
||||
pageSize.inner.ratio = pageSize.inner.height / pageSize.inner.width;
|
||||
}
|
||||
|
||||
// Attach pageSize to this.
|
||||
this.prop.pageSize = pageSize;
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.setProgress = function setProgress(val, state, n, stack) {
|
||||
// Immediately update all progress values.
|
||||
if (val != null) this.progress.val = val;
|
||||
if (state != null) this.progress.state = state;
|
||||
if (n != null) this.progress.n = n;
|
||||
if (stack != null) this.progress.stack = stack;
|
||||
this.progress.ratio = this.progress.val / this.progress.state;
|
||||
|
||||
// Return this for command chaining.
|
||||
return this;
|
||||
};
|
||||
|
||||
Worker.prototype.updateProgress = function updateProgress(val, state, n, stack) {
|
||||
// Immediately update all progress values, using setProgress.
|
||||
return this.setProgress(val ? this.progress.val + val : null, state ? state : null, n ? this.progress.n + n : null, stack ? this.progress.stack.concat(stack) : null);
|
||||
};
|
||||
|
||||
/* ----- PROMISE MAPPING ----- */
|
||||
|
||||
Worker.prototype.then = function then(onFulfilled, onRejected) {
|
||||
// Wrap `this` for encapsulation.
|
||||
var self = this;
|
||||
|
||||
return this.thenCore(onFulfilled, onRejected, function then_main(onFulfilled, onRejected) {
|
||||
// Update progress while queuing, calling, and resolving `then`.
|
||||
self.updateProgress(null, null, 1, [onFulfilled]);
|
||||
return Promise.prototype.then.call(this, function then_pre(val) {
|
||||
self.updateProgress(null, onFulfilled);
|
||||
return val;
|
||||
}).then(onFulfilled, onRejected).then(function then_post(val) {
|
||||
self.updateProgress(1);
|
||||
return val;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.thenCore = function thenCore(onFulfilled, onRejected, thenBase) {
|
||||
// Handle optional thenBase parameter.
|
||||
thenBase = thenBase || Promise.prototype.then;
|
||||
|
||||
// Wrap `this` for encapsulation and bind it to the promise handlers.
|
||||
var self = this;
|
||||
if (onFulfilled) {
|
||||
onFulfilled = onFulfilled.bind(self);
|
||||
}
|
||||
if (onRejected) {
|
||||
onRejected = onRejected.bind(self);
|
||||
}
|
||||
|
||||
// Cast self into a Promise to avoid polyfills recursively defining `then`.
|
||||
var isNative = Promise.toString().indexOf('[native code]') !== -1 && Promise.name === 'Promise';
|
||||
var selfPromise = isNative ? self : Worker.convert(_extends({}, self), Promise.prototype);
|
||||
|
||||
// Return the promise, after casting it into a Worker and preserving props.
|
||||
var returnVal = thenBase.call(selfPromise, onFulfilled, onRejected);
|
||||
return Worker.convert(returnVal, self.__proto__);
|
||||
};
|
||||
|
||||
Worker.prototype.thenExternal = function thenExternal(onFulfilled, onRejected) {
|
||||
// Call `then` and return a standard promise (exits the Worker chain).
|
||||
return Promise.prototype.then.call(this, onFulfilled, onRejected);
|
||||
};
|
||||
|
||||
Worker.prototype.thenList = function thenList(fns) {
|
||||
// Queue a series of promise 'factories' into the promise chain.
|
||||
var self = this;
|
||||
fns.forEach(function thenList_forEach(fn) {
|
||||
self = self.thenCore(fn);
|
||||
});
|
||||
return self;
|
||||
};
|
||||
|
||||
Worker.prototype['catch'] = function (onRejected) {
|
||||
// Bind `this` to the promise handler, call `catch`, and return a Worker.
|
||||
if (onRejected) {
|
||||
onRejected = onRejected.bind(this);
|
||||
}
|
||||
var returnVal = Promise.prototype['catch'].call(this, onRejected);
|
||||
return Worker.convert(returnVal, this);
|
||||
};
|
||||
|
||||
Worker.prototype.catchExternal = function catchExternal(onRejected) {
|
||||
// Call `catch` and return a standard promise (exits the Worker chain).
|
||||
return Promise.prototype['catch'].call(this, onRejected);
|
||||
};
|
||||
|
||||
Worker.prototype.error = function error(msg) {
|
||||
// Throw the error in the Promise chain.
|
||||
return this.then(function error_main() {
|
||||
throw new Error(msg);
|
||||
});
|
||||
};
|
||||
|
||||
/* ----- ALIASES ----- */
|
||||
|
||||
Worker.prototype.using = Worker.prototype.set;
|
||||
Worker.prototype.saveAs = Worker.prototype.save;
|
||||
Worker.prototype.export = Worker.prototype.output;
|
||||
Worker.prototype.run = Worker.prototype.then;
|
||||
|
||||
// Import dependencies.
|
||||
// Get dimensions of a PDF page, as determined by jsPDF.
|
||||
jsPDF.getPageSize = function (orientation, unit, format) {
|
||||
// Decode options object
|
||||
if ((typeof orientation === 'undefined' ? 'undefined' : _typeof(orientation)) === 'object') {
|
||||
var options = orientation;
|
||||
orientation = options.orientation;
|
||||
unit = options.unit || unit;
|
||||
format = options.format || format;
|
||||
}
|
||||
|
||||
// Default options
|
||||
unit = unit || 'mm';
|
||||
format = format || 'a4';
|
||||
orientation = ('' + (orientation || 'P')).toLowerCase();
|
||||
var format_as_string = ('' + format).toLowerCase();
|
||||
|
||||
// Size in pt of various paper formats
|
||||
var pageFormats = {
|
||||
'a0': [2383.94, 3370.39], 'a1': [1683.78, 2383.94],
|
||||
'a2': [1190.55, 1683.78], 'a3': [841.89, 1190.55],
|
||||
'a4': [595.28, 841.89], 'a5': [419.53, 595.28],
|
||||
'a6': [297.64, 419.53], 'a7': [209.76, 297.64],
|
||||
'a8': [147.40, 209.76], 'a9': [104.88, 147.40],
|
||||
'a10': [73.70, 104.88], 'b0': [2834.65, 4008.19],
|
||||
'b1': [2004.09, 2834.65], 'b2': [1417.32, 2004.09],
|
||||
'b3': [1000.63, 1417.32], 'b4': [708.66, 1000.63],
|
||||
'b5': [498.90, 708.66], 'b6': [354.33, 498.90],
|
||||
'b7': [249.45, 354.33], 'b8': [175.75, 249.45],
|
||||
'b9': [124.72, 175.75], 'b10': [87.87, 124.72],
|
||||
'c0': [2599.37, 3676.54], 'c1': [1836.85, 2599.37],
|
||||
'c2': [1298.27, 1836.85], 'c3': [918.43, 1298.27],
|
||||
'c4': [649.13, 918.43], 'c5': [459.21, 649.13],
|
||||
'c6': [323.15, 459.21], 'c7': [229.61, 323.15],
|
||||
'c8': [161.57, 229.61], 'c9': [113.39, 161.57],
|
||||
'c10': [79.37, 113.39], 'dl': [311.81, 623.62],
|
||||
'letter': [612, 792],
|
||||
'government-letter': [576, 756],
|
||||
'legal': [612, 1008],
|
||||
'junior-legal': [576, 360],
|
||||
'ledger': [1224, 792],
|
||||
'tabloid': [792, 1224],
|
||||
'credit-card': [153, 243]
|
||||
};
|
||||
|
||||
// Unit conversion
|
||||
switch (unit) {
|
||||
case 'pt':
|
||||
var k = 1;break;
|
||||
case 'mm':
|
||||
var k = 72 / 25.4;break;
|
||||
case 'cm':
|
||||
var k = 72 / 2.54;break;
|
||||
case 'in':
|
||||
var k = 72;break;
|
||||
case 'px':
|
||||
var k = 72 / 96;break;
|
||||
case 'pc':
|
||||
var k = 12;break;
|
||||
case 'em':
|
||||
var k = 12;break;
|
||||
case 'ex':
|
||||
var k = 6;break;
|
||||
default:
|
||||
throw 'Invalid unit: ' + unit;
|
||||
}
|
||||
|
||||
// Dimensions are stored as user units and converted to points on output
|
||||
if (pageFormats.hasOwnProperty(format_as_string)) {
|
||||
var pageHeight = pageFormats[format_as_string][1] / k;
|
||||
var pageWidth = pageFormats[format_as_string][0] / k;
|
||||
} else {
|
||||
try {
|
||||
var pageHeight = format[1];
|
||||
var pageWidth = format[0];
|
||||
} catch (err) {
|
||||
throw new Error('Invalid format: ' + format);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle page orientation
|
||||
if (orientation === 'p' || orientation === 'portrait') {
|
||||
orientation = 'p';
|
||||
if (pageWidth > pageHeight) {
|
||||
var tmp = pageWidth;
|
||||
pageWidth = pageHeight;
|
||||
pageHeight = tmp;
|
||||
}
|
||||
} else if (orientation === 'l' || orientation === 'landscape') {
|
||||
orientation = 'l';
|
||||
if (pageHeight > pageWidth) {
|
||||
var tmp = pageWidth;
|
||||
pageWidth = pageHeight;
|
||||
pageHeight = tmp;
|
||||
}
|
||||
} else {
|
||||
throw 'Invalid orientation: ' + orientation;
|
||||
}
|
||||
|
||||
// Return information (k is the unit conversion ratio from pts)
|
||||
var info = { 'width': pageWidth, 'height': pageHeight, 'unit': unit, 'k': k };
|
||||
return info;
|
||||
};
|
||||
|
||||
var orig = {
|
||||
toContainer: Worker.prototype.toContainer
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
return orig.toContainer.call(this).then(function toContainer_pagebreak() {
|
||||
// Enable page-breaks.
|
||||
var pageBreaks = this.prop.container.querySelectorAll('.html2pdf__page-break');
|
||||
var pxPageHeight = this.prop.pageSize.inner.px.height;
|
||||
Array.prototype.forEach.call(pageBreaks, function pageBreak_loop(el) {
|
||||
el.style.display = 'block';
|
||||
var clientRect = el.getBoundingClientRect();
|
||||
el.style.height = pxPageHeight - clientRect.top % pxPageHeight + 'px';
|
||||
}, this);
|
||||
});
|
||||
};
|
||||
|
||||
// Add hyperlink functionality to the PDF creation.
|
||||
|
||||
// Main link array, and refs to original functions.
|
||||
var linkInfo = [];
|
||||
var orig$1 = {
|
||||
toContainer: Worker.prototype.toContainer,
|
||||
toPdf: Worker.prototype.toPdf
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
return orig$1.toContainer.call(this).then(function toContainer_hyperlink() {
|
||||
// Retrieve hyperlink info if the option is enabled.
|
||||
if (this.opt.enableLinks) {
|
||||
// Find all anchor tags and get the container's bounds for reference.
|
||||
var container = this.prop.container;
|
||||
var links = container.querySelectorAll('a');
|
||||
var containerRect = unitConvert(container.getBoundingClientRect(), this.prop.pageSize.k);
|
||||
linkInfo = [];
|
||||
|
||||
// Loop through each anchor tag.
|
||||
Array.prototype.forEach.call(links, function (link) {
|
||||
// Treat each client rect as a separate link (for text-wrapping).
|
||||
var clientRects = link.getClientRects();
|
||||
for (var i = 0; i < clientRects.length; i++) {
|
||||
var clientRect = unitConvert(clientRects[i], this.prop.pageSize.k);
|
||||
clientRect.left -= containerRect.left;
|
||||
clientRect.top -= containerRect.top;
|
||||
|
||||
var page = Math.floor(clientRect.top / this.prop.pageSize.inner.height) + 1;
|
||||
var top = this.opt.margin[0] + clientRect.top % this.prop.pageSize.inner.height;
|
||||
var left = this.opt.margin[1] + clientRect.left;
|
||||
|
||||
linkInfo.push({ page: page, top: top, left: left, clientRect: clientRect, link: link });
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toPdf = function toPdf() {
|
||||
return orig$1.toPdf.call(this).then(function toPdf_hyperlink() {
|
||||
// Add hyperlinks if the option is enabled.
|
||||
if (this.opt.enableLinks) {
|
||||
// Attach each anchor tag based on info from toContainer().
|
||||
linkInfo.forEach(function (l) {
|
||||
this.prop.pdf.setPage(l.page);
|
||||
this.prop.pdf.link(l.left, l.top, l.clientRect.width, l.clientRect.height, { url: l.link.href });
|
||||
}, this);
|
||||
|
||||
// Reset the active page of the PDF to the final page.
|
||||
var nPages = this.prop.pdf.internal.getNumberOfPages();
|
||||
this.prop.pdf.setPage(nPages);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate a PDF from an HTML element or string using html2canvas and jsPDF.
|
||||
*
|
||||
* @param {Element|string} source The source element or HTML string.
|
||||
* @param {Object=} opt An object of optional settings: 'margin', 'filename',
|
||||
* 'image' ('type' and 'quality'), and 'html2canvas' / 'jspdf', which are
|
||||
* sent as settings to their corresponding functions.
|
||||
*/
|
||||
var html2pdf = function html2pdf(src, opt) {
|
||||
// Create a new worker with the given options.
|
||||
var worker = new html2pdf.Worker(opt);
|
||||
|
||||
if (src) {
|
||||
// If src is specified, perform the traditional 'simple' operation.
|
||||
return worker.from(src).save();
|
||||
} else {
|
||||
// Otherwise, return the worker for new Promise-based operation.
|
||||
return worker;
|
||||
}
|
||||
};
|
||||
html2pdf.Worker = Worker;
|
||||
|
||||
export default html2pdf;
|
800
AstuteClient2/src/assets/html2pdf.js/dist/require/html2pdf.cjs.js
vendored
Normal file
800
AstuteClient2/src/assets/html2pdf.js/dist/require/html2pdf.cjs.js
vendored
Normal file
|
@ -0,0 +1,800 @@
|
|||
/**
|
||||
* html2pdf.js v0.9.0
|
||||
* Copyright (c) 2018 Erik Koopmans
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||
|
||||
require('es6-promise/auto');
|
||||
var jsPDF = _interopDefault(require('jspdf'));
|
||||
var html2canvas = _interopDefault(require('html2canvas'));
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
||||
return typeof obj;
|
||||
} : function (obj) {
|
||||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
// Determine the type of a variable/object.
|
||||
var objType = function objType(obj) {
|
||||
var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj);
|
||||
if (type === 'undefined') return 'undefined';else if (type === 'string' || obj instanceof String) return 'string';else if (type === 'number' || obj instanceof Number) return 'number';else if (type === 'function' || obj instanceof Function) return 'function';else if (!!obj && obj.constructor === Array) return 'array';else if (obj && obj.nodeType === 1) return 'element';else if (type === 'object') return 'object';else return 'unknown';
|
||||
};
|
||||
|
||||
// Create an HTML element with optional className, innerHTML, and style.
|
||||
var createElement = function createElement(tagName, opt) {
|
||||
var el = document.createElement(tagName);
|
||||
if (opt.className) el.className = opt.className;
|
||||
if (opt.innerHTML) {
|
||||
el.innerHTML = opt.innerHTML;
|
||||
var scripts = el.getElementsByTagName('script');
|
||||
for (var i = scripts.length; i-- > 0; null) {
|
||||
scripts[i].parentNode.removeChild(scripts[i]);
|
||||
}
|
||||
}
|
||||
for (var key in opt.style) {
|
||||
el.style[key] = opt.style[key];
|
||||
}
|
||||
return el;
|
||||
};
|
||||
|
||||
// Deep-clone a node and preserve contents/properties.
|
||||
var cloneNode = function cloneNode(node, javascriptEnabled) {
|
||||
// Recursively clone the node.
|
||||
var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false);
|
||||
for (var child = node.firstChild; child; child = child.nextSibling) {
|
||||
if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') {
|
||||
clone.appendChild(cloneNode(child, javascriptEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
if (node.nodeType === 1) {
|
||||
// Preserve contents/properties of special nodes.
|
||||
if (node.nodeName === 'CANVAS') {
|
||||
clone.width = node.width;
|
||||
clone.height = node.height;
|
||||
clone.getContext('2d').drawImage(node, 0, 0);
|
||||
} else if (node.nodeName === 'TEXTAREA' || node.nodeName === 'SELECT') {
|
||||
clone.value = node.value;
|
||||
}
|
||||
|
||||
// Preserve the node's scroll position when it loads.
|
||||
clone.addEventListener('load', function () {
|
||||
clone.scrollTop = node.scrollTop;
|
||||
clone.scrollLeft = node.scrollLeft;
|
||||
}, true);
|
||||
}
|
||||
|
||||
// Return the cloned node.
|
||||
return clone;
|
||||
};
|
||||
|
||||
// Convert units using the conversion value 'k' from jsPDF.
|
||||
var unitConvert = function unitConvert(obj, k) {
|
||||
var newObj = {};
|
||||
for (var key in obj) {
|
||||
newObj[key] = obj[key] * 72 / 96 / k;
|
||||
}
|
||||
return newObj;
|
||||
};
|
||||
|
||||
/* ----- CONSTRUCTOR ----- */
|
||||
|
||||
var Worker = function Worker(opt) {
|
||||
// Create the root parent for the proto chain, and the starting Worker.
|
||||
var root = _extends(Worker.convert(Promise.resolve()), JSON.parse(JSON.stringify(Worker.template)));
|
||||
var self = Worker.convert(Promise.resolve(), root);
|
||||
|
||||
// Set progress, optional settings, and return.
|
||||
self = self.setProgress(1, Worker, 1, [Worker]);
|
||||
self = self.set(opt);
|
||||
return self;
|
||||
};
|
||||
|
||||
// Boilerplate for subclassing Promise.
|
||||
Worker.prototype = Object.create(Promise.prototype);
|
||||
Worker.prototype.constructor = Worker;
|
||||
|
||||
// Converts/casts promises into Workers.
|
||||
Worker.convert = function convert(promise, inherit) {
|
||||
// Uses prototypal inheritance to receive changes made to ancestors' properties.
|
||||
promise.__proto__ = inherit || Worker.prototype;
|
||||
return promise;
|
||||
};
|
||||
|
||||
Worker.template = {
|
||||
prop: {
|
||||
src: null,
|
||||
container: null,
|
||||
overlay: null,
|
||||
canvas: null,
|
||||
img: null,
|
||||
pdf: null,
|
||||
pageSize: null
|
||||
},
|
||||
progress: {
|
||||
val: 0,
|
||||
state: null,
|
||||
n: 0,
|
||||
stack: []
|
||||
},
|
||||
opt: {
|
||||
filename: 'file.pdf',
|
||||
margin: [0, 0, 0, 0],
|
||||
image: { type: 'jpeg', quality: 0.95 },
|
||||
enableLinks: true,
|
||||
html2canvas: {},
|
||||
jsPDF: {}
|
||||
}
|
||||
};
|
||||
|
||||
/* ----- FROM / TO ----- */
|
||||
|
||||
Worker.prototype.from = function from(src, type) {
|
||||
function getType(src) {
|
||||
switch (objType(src)) {
|
||||
case 'string':
|
||||
return 'string';
|
||||
case 'element':
|
||||
return src.nodeName.toLowerCase === 'canvas' ? 'canvas' : 'element';
|
||||
default:
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
|
||||
return this.then(function from_main() {
|
||||
type = type || getType(src);
|
||||
switch (type) {
|
||||
case 'string':
|
||||
return this.set({ src: createElement('div', { innerHTML: src }) });
|
||||
case 'element':
|
||||
return this.set({ src: src });
|
||||
case 'canvas':
|
||||
return this.set({ canvas: src });
|
||||
case 'img':
|
||||
return this.set({ img: src });
|
||||
default:
|
||||
return this.error('Unknown source type.');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.to = function to(target) {
|
||||
// Route the 'to' request to the appropriate method.
|
||||
switch (target) {
|
||||
case 'container':
|
||||
return this.toContainer();
|
||||
case 'canvas':
|
||||
return this.toCanvas();
|
||||
case 'img':
|
||||
return this.toImg();
|
||||
case 'pdf':
|
||||
return this.toPdf();
|
||||
default:
|
||||
return this.error('Invalid target.');
|
||||
}
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkSrc() {
|
||||
return this.prop.src || this.error('Cannot duplicate - no source HTML.');
|
||||
}, function checkPageSize() {
|
||||
return this.prop.pageSize || this.setPageSize();
|
||||
}];
|
||||
|
||||
return this.thenList(prereqs).then(function toContainer_main() {
|
||||
// Define the CSS styles for the container and its overlay parent.
|
||||
var overlayCSS = {
|
||||
position: 'fixed', overflow: 'hidden', zIndex: 1000,
|
||||
left: 0, right: 0, bottom: 0, top: 0,
|
||||
backgroundColor: 'rgba(0,0,0,0.8)'
|
||||
};
|
||||
var containerCSS = {
|
||||
position: 'absolute', width: this.prop.pageSize.inner.width + this.prop.pageSize.unit,
|
||||
left: 0, right: 0, top: 0, height: 'auto', margin: 'auto',
|
||||
backgroundColor: 'white'
|
||||
};
|
||||
|
||||
// Set the overlay to hidden (could be changed in the future to provide a print preview).
|
||||
overlayCSS.opacity = 0;
|
||||
|
||||
// Create and attach the elements.
|
||||
var source = cloneNode(this.prop.src, this.opt.html2canvas.javascriptEnabled);
|
||||
this.prop.overlay = createElement('div', { className: 'html2pdf__overlay', style: overlayCSS });
|
||||
this.prop.container = createElement('div', { className: 'html2pdf__container', style: containerCSS });
|
||||
this.prop.container.appendChild(source);
|
||||
this.prop.overlay.appendChild(this.prop.container);
|
||||
document.body.appendChild(this.prop.overlay);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toCanvas = function toCanvas() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkContainer() {
|
||||
return document.body.contains(this.prop.container) || this.toContainer();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then create the canvas.
|
||||
return this.thenList(prereqs).then(function toCanvas_main() {
|
||||
// Handle old-fashioned 'onrendered' argument.
|
||||
var options = _extends({}, this.opt.html2canvas);
|
||||
delete options.onrendered;
|
||||
|
||||
return html2canvas(this.prop.container, options);
|
||||
}).then(function toCanvas_post(canvas) {
|
||||
// Handle old-fashioned 'onrendered' argument.
|
||||
var onRendered = this.opt.html2canvas.onrendered || function () {};
|
||||
onRendered(canvas);
|
||||
|
||||
this.prop.canvas = canvas;
|
||||
document.body.removeChild(this.prop.overlay);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toImg = function toImg() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkCanvas() {
|
||||
return this.prop.canvas || this.toCanvas();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then create the image.
|
||||
return this.thenList(prereqs).then(function toImg_main() {
|
||||
var imgData = this.prop.canvas.toDataURL('image/' + this.opt.image.type, this.opt.image.quality);
|
||||
this.prop.img = document.createElement('img');
|
||||
this.prop.img.src = imgData;
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toPdf = function toPdf() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkCanvas() {
|
||||
return this.prop.canvas || this.toCanvas();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then create the image.
|
||||
return this.thenList(prereqs).then(function toPdf_main() {
|
||||
// Create local copies of frequently used properties.
|
||||
var canvas = this.prop.canvas;
|
||||
var opt = this.opt;
|
||||
|
||||
// Calculate the number of pages.
|
||||
var ctx = canvas.getContext('2d');
|
||||
var pxFullHeight = canvas.height;
|
||||
var pxPageHeight = Math.floor(canvas.width * this.prop.pageSize.inner.ratio);
|
||||
var nPages = Math.ceil(pxFullHeight / pxPageHeight);
|
||||
|
||||
// Define pageHeight separately so it can be trimmed on the final page.
|
||||
var pageHeight = this.prop.pageSize.inner.height;
|
||||
|
||||
// Create a one-page canvas to split up the full image.
|
||||
var pageCanvas = document.createElement('canvas');
|
||||
var pageCtx = pageCanvas.getContext('2d');
|
||||
pageCanvas.width = canvas.width;
|
||||
pageCanvas.height = pxPageHeight;
|
||||
|
||||
// Initialize the PDF.
|
||||
this.prop.pdf = this.prop.pdf || new jsPDF(opt.jsPDF);
|
||||
|
||||
for (var page = 0; page < nPages; page++) {
|
||||
// Trim the final page to reduce file size.
|
||||
if (page === nPages - 1) {
|
||||
pageCanvas.height = pxFullHeight % pxPageHeight;
|
||||
pageHeight = pageCanvas.height * this.prop.pageSize.inner.width / pageCanvas.width;
|
||||
}
|
||||
|
||||
// Display the page.
|
||||
var w = pageCanvas.width;
|
||||
var h = pageCanvas.height;
|
||||
pageCtx.fillStyle = 'white';
|
||||
pageCtx.fillRect(0, 0, w, h);
|
||||
pageCtx.drawImage(canvas, 0, page * pxPageHeight, w, h, 0, 0, w, h);
|
||||
|
||||
// Add the page to the PDF.
|
||||
if (page) this.prop.pdf.addPage();
|
||||
var imgData = pageCanvas.toDataURL('image/' + opt.image.type, opt.image.quality);
|
||||
this.prop.pdf.addImage(imgData, opt.image.type, opt.margin[1], opt.margin[0], this.prop.pageSize.inner.width, pageHeight);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* ----- OUTPUT / SAVE ----- */
|
||||
|
||||
Worker.prototype.output = function output(type, options, src) {
|
||||
// Redirect requests to the correct function (outputPdf / outputImg).
|
||||
src = src || 'pdf';
|
||||
if (src.toLowerCase() === 'img' || src.toLowerCase() === 'image') {
|
||||
return this.outputImg(type, options);
|
||||
} else {
|
||||
return this.outputPdf(type, options);
|
||||
}
|
||||
};
|
||||
|
||||
Worker.prototype.outputPdf = function outputPdf(type, options) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkPdf() {
|
||||
return this.prop.pdf || this.toPdf();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then perform the appropriate output.
|
||||
return this.thenList(prereqs).then(function outputPdf_main() {
|
||||
/* Currently implemented output types:
|
||||
* https://rawgit.com/MrRio/jsPDF/master/docs/jspdf.js.html#line992
|
||||
* save(options), arraybuffer, blob, bloburi/bloburl,
|
||||
* datauristring/dataurlstring, dataurlnewwindow, datauri/dataurl
|
||||
*/
|
||||
return this.prop.pdf.output(type, options);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.outputImg = function outputImg(type, options) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkImg() {
|
||||
return this.prop.img || this.toImg();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs then perform the appropriate output.
|
||||
return this.thenList(prereqs).then(function outputImg_main() {
|
||||
switch (type) {
|
||||
case undefined:
|
||||
case 'img':
|
||||
return this.prop.img;
|
||||
case 'datauristring':
|
||||
case 'dataurlstring':
|
||||
return this.prop.img.src;
|
||||
case 'datauri':
|
||||
case 'dataurl':
|
||||
return document.location.href = this.prop.img.src;
|
||||
default:
|
||||
throw 'Image output type "' + type + '" is not supported.';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.save = function save(filename) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [function checkPdf() {
|
||||
return this.prop.pdf || this.toPdf();
|
||||
}];
|
||||
|
||||
// Fulfill prereqs, update the filename (if provided), and save the PDF.
|
||||
return this.thenList(prereqs).set(filename ? { filename: filename } : null).then(function save_main() {
|
||||
this.prop.pdf.save(this.opt.filename);
|
||||
});
|
||||
};
|
||||
|
||||
/* ----- SET / GET ----- */
|
||||
|
||||
Worker.prototype.set = function set$$1(opt) {
|
||||
// TODO: Implement ordered pairs?
|
||||
|
||||
// Silently ignore invalid or empty input.
|
||||
if (objType(opt) !== 'object') {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Build an array of setter functions to queue.
|
||||
var fns = Object.keys(opt || {}).map(function (key) {
|
||||
if (key in Worker.template.prop) {
|
||||
// Set pre-defined properties.
|
||||
return function set_prop() {
|
||||
this.prop[key] = opt[key];
|
||||
};
|
||||
} else {
|
||||
switch (key) {
|
||||
case 'margin':
|
||||
return this.setMargin.bind(this, opt.margin);
|
||||
case 'jsPDF':
|
||||
return function set_jsPDF() {
|
||||
this.opt.jsPDF = opt.jsPDF;return this.setPageSize();
|
||||
};
|
||||
case 'pageSize':
|
||||
return this.setPageSize.bind(this, opt.pageSize);
|
||||
default:
|
||||
// Set any other properties in opt.
|
||||
return function set_opt() {
|
||||
this.opt[key] = opt[key];
|
||||
};
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
// Set properties within the promise chain.
|
||||
return this.then(function set_main() {
|
||||
return this.thenList(fns);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.get = function get$$1(key, cbk) {
|
||||
return this.then(function get_main() {
|
||||
// Fetch the requested property, either as a predefined prop or in opt.
|
||||
var val = key in Worker.template.prop ? this.prop[key] : this.opt[key];
|
||||
return cbk ? cbk(val) : val;
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.setMargin = function setMargin(margin) {
|
||||
return this.then(function setMargin_main() {
|
||||
// Parse the margin property.
|
||||
switch (objType(margin)) {
|
||||
case 'number':
|
||||
margin = [margin, margin, margin, margin];
|
||||
case 'array':
|
||||
if (margin.length === 2) {
|
||||
margin = [margin[0], margin[1], margin[0], margin[1]];
|
||||
}
|
||||
if (margin.length === 4) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return this.error('Invalid margin array.');
|
||||
}
|
||||
|
||||
// Set the margin property, then update pageSize.
|
||||
this.opt.margin = margin;
|
||||
}).then(this.setPageSize);
|
||||
};
|
||||
|
||||
Worker.prototype.setPageSize = function setPageSize(pageSize) {
|
||||
function toPx(val, k) {
|
||||
return Math.floor(val * k / 72 * 96);
|
||||
}
|
||||
|
||||
return this.then(function setPageSize_main() {
|
||||
// Retrieve page-size based on jsPDF settings, if not explicitly provided.
|
||||
pageSize = pageSize || jsPDF.getPageSize(this.opt.jsPDF);
|
||||
|
||||
// Add 'inner' field if not present.
|
||||
if (!pageSize.hasOwnProperty('inner')) {
|
||||
pageSize.inner = {
|
||||
width: pageSize.width - this.opt.margin[1] - this.opt.margin[3],
|
||||
height: pageSize.height - this.opt.margin[0] - this.opt.margin[2]
|
||||
};
|
||||
pageSize.inner.px = {
|
||||
width: toPx(pageSize.inner.width, pageSize.k),
|
||||
height: toPx(pageSize.inner.height, pageSize.k)
|
||||
};
|
||||
pageSize.inner.ratio = pageSize.inner.height / pageSize.inner.width;
|
||||
}
|
||||
|
||||
// Attach pageSize to this.
|
||||
this.prop.pageSize = pageSize;
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.setProgress = function setProgress(val, state, n, stack) {
|
||||
// Immediately update all progress values.
|
||||
if (val != null) this.progress.val = val;
|
||||
if (state != null) this.progress.state = state;
|
||||
if (n != null) this.progress.n = n;
|
||||
if (stack != null) this.progress.stack = stack;
|
||||
this.progress.ratio = this.progress.val / this.progress.state;
|
||||
|
||||
// Return this for command chaining.
|
||||
return this;
|
||||
};
|
||||
|
||||
Worker.prototype.updateProgress = function updateProgress(val, state, n, stack) {
|
||||
// Immediately update all progress values, using setProgress.
|
||||
return this.setProgress(val ? this.progress.val + val : null, state ? state : null, n ? this.progress.n + n : null, stack ? this.progress.stack.concat(stack) : null);
|
||||
};
|
||||
|
||||
/* ----- PROMISE MAPPING ----- */
|
||||
|
||||
Worker.prototype.then = function then(onFulfilled, onRejected) {
|
||||
// Wrap `this` for encapsulation.
|
||||
var self = this;
|
||||
|
||||
return this.thenCore(onFulfilled, onRejected, function then_main(onFulfilled, onRejected) {
|
||||
// Update progress while queuing, calling, and resolving `then`.
|
||||
self.updateProgress(null, null, 1, [onFulfilled]);
|
||||
return Promise.prototype.then.call(this, function then_pre(val) {
|
||||
self.updateProgress(null, onFulfilled);
|
||||
return val;
|
||||
}).then(onFulfilled, onRejected).then(function then_post(val) {
|
||||
self.updateProgress(1);
|
||||
return val;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.thenCore = function thenCore(onFulfilled, onRejected, thenBase) {
|
||||
// Handle optional thenBase parameter.
|
||||
thenBase = thenBase || Promise.prototype.then;
|
||||
|
||||
// Wrap `this` for encapsulation and bind it to the promise handlers.
|
||||
var self = this;
|
||||
if (onFulfilled) {
|
||||
onFulfilled = onFulfilled.bind(self);
|
||||
}
|
||||
if (onRejected) {
|
||||
onRejected = onRejected.bind(self);
|
||||
}
|
||||
|
||||
// Cast self into a Promise to avoid polyfills recursively defining `then`.
|
||||
var isNative = Promise.toString().indexOf('[native code]') !== -1 && Promise.name === 'Promise';
|
||||
var selfPromise = isNative ? self : Worker.convert(_extends({}, self), Promise.prototype);
|
||||
|
||||
// Return the promise, after casting it into a Worker and preserving props.
|
||||
var returnVal = thenBase.call(selfPromise, onFulfilled, onRejected);
|
||||
return Worker.convert(returnVal, self.__proto__);
|
||||
};
|
||||
|
||||
Worker.prototype.thenExternal = function thenExternal(onFulfilled, onRejected) {
|
||||
// Call `then` and return a standard promise (exits the Worker chain).
|
||||
return Promise.prototype.then.call(this, onFulfilled, onRejected);
|
||||
};
|
||||
|
||||
Worker.prototype.thenList = function thenList(fns) {
|
||||
// Queue a series of promise 'factories' into the promise chain.
|
||||
var self = this;
|
||||
fns.forEach(function thenList_forEach(fn) {
|
||||
self = self.thenCore(fn);
|
||||
});
|
||||
return self;
|
||||
};
|
||||
|
||||
Worker.prototype['catch'] = function (onRejected) {
|
||||
// Bind `this` to the promise handler, call `catch`, and return a Worker.
|
||||
if (onRejected) {
|
||||
onRejected = onRejected.bind(this);
|
||||
}
|
||||
var returnVal = Promise.prototype['catch'].call(this, onRejected);
|
||||
return Worker.convert(returnVal, this);
|
||||
};
|
||||
|
||||
Worker.prototype.catchExternal = function catchExternal(onRejected) {
|
||||
// Call `catch` and return a standard promise (exits the Worker chain).
|
||||
return Promise.prototype['catch'].call(this, onRejected);
|
||||
};
|
||||
|
||||
Worker.prototype.error = function error(msg) {
|
||||
// Throw the error in the Promise chain.
|
||||
return this.then(function error_main() {
|
||||
throw new Error(msg);
|
||||
});
|
||||
};
|
||||
|
||||
/* ----- ALIASES ----- */
|
||||
|
||||
Worker.prototype.using = Worker.prototype.set;
|
||||
Worker.prototype.saveAs = Worker.prototype.save;
|
||||
Worker.prototype.export = Worker.prototype.output;
|
||||
Worker.prototype.run = Worker.prototype.then;
|
||||
|
||||
// Import dependencies.
|
||||
// Get dimensions of a PDF page, as determined by jsPDF.
|
||||
jsPDF.getPageSize = function (orientation, unit, format) {
|
||||
// Decode options object
|
||||
if ((typeof orientation === 'undefined' ? 'undefined' : _typeof(orientation)) === 'object') {
|
||||
var options = orientation;
|
||||
orientation = options.orientation;
|
||||
unit = options.unit || unit;
|
||||
format = options.format || format;
|
||||
}
|
||||
|
||||
// Default options
|
||||
unit = unit || 'mm';
|
||||
format = format || 'a4';
|
||||
orientation = ('' + (orientation || 'P')).toLowerCase();
|
||||
var format_as_string = ('' + format).toLowerCase();
|
||||
|
||||
// Size in pt of various paper formats
|
||||
var pageFormats = {
|
||||
'a0': [2383.94, 3370.39], 'a1': [1683.78, 2383.94],
|
||||
'a2': [1190.55, 1683.78], 'a3': [841.89, 1190.55],
|
||||
'a4': [595.28, 841.89], 'a5': [419.53, 595.28],
|
||||
'a6': [297.64, 419.53], 'a7': [209.76, 297.64],
|
||||
'a8': [147.40, 209.76], 'a9': [104.88, 147.40],
|
||||
'a10': [73.70, 104.88], 'b0': [2834.65, 4008.19],
|
||||
'b1': [2004.09, 2834.65], 'b2': [1417.32, 2004.09],
|
||||
'b3': [1000.63, 1417.32], 'b4': [708.66, 1000.63],
|
||||
'b5': [498.90, 708.66], 'b6': [354.33, 498.90],
|
||||
'b7': [249.45, 354.33], 'b8': [175.75, 249.45],
|
||||
'b9': [124.72, 175.75], 'b10': [87.87, 124.72],
|
||||
'c0': [2599.37, 3676.54], 'c1': [1836.85, 2599.37],
|
||||
'c2': [1298.27, 1836.85], 'c3': [918.43, 1298.27],
|
||||
'c4': [649.13, 918.43], 'c5': [459.21, 649.13],
|
||||
'c6': [323.15, 459.21], 'c7': [229.61, 323.15],
|
||||
'c8': [161.57, 229.61], 'c9': [113.39, 161.57],
|
||||
'c10': [79.37, 113.39], 'dl': [311.81, 623.62],
|
||||
'letter': [612, 792],
|
||||
'government-letter': [576, 756],
|
||||
'legal': [612, 1008],
|
||||
'junior-legal': [576, 360],
|
||||
'ledger': [1224, 792],
|
||||
'tabloid': [792, 1224],
|
||||
'credit-card': [153, 243]
|
||||
};
|
||||
|
||||
// Unit conversion
|
||||
switch (unit) {
|
||||
case 'pt':
|
||||
var k = 1;break;
|
||||
case 'mm':
|
||||
var k = 72 / 25.4;break;
|
||||
case 'cm':
|
||||
var k = 72 / 2.54;break;
|
||||
case 'in':
|
||||
var k = 72;break;
|
||||
case 'px':
|
||||
var k = 72 / 96;break;
|
||||
case 'pc':
|
||||
var k = 12;break;
|
||||
case 'em':
|
||||
var k = 12;break;
|
||||
case 'ex':
|
||||
var k = 6;break;
|
||||
default:
|
||||
throw 'Invalid unit: ' + unit;
|
||||
}
|
||||
|
||||
// Dimensions are stored as user units and converted to points on output
|
||||
if (pageFormats.hasOwnProperty(format_as_string)) {
|
||||
var pageHeight = pageFormats[format_as_string][1] / k;
|
||||
var pageWidth = pageFormats[format_as_string][0] / k;
|
||||
} else {
|
||||
try {
|
||||
var pageHeight = format[1];
|
||||
var pageWidth = format[0];
|
||||
} catch (err) {
|
||||
throw new Error('Invalid format: ' + format);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle page orientation
|
||||
if (orientation === 'p' || orientation === 'portrait') {
|
||||
orientation = 'p';
|
||||
if (pageWidth > pageHeight) {
|
||||
var tmp = pageWidth;
|
||||
pageWidth = pageHeight;
|
||||
pageHeight = tmp;
|
||||
}
|
||||
} else if (orientation === 'l' || orientation === 'landscape') {
|
||||
orientation = 'l';
|
||||
if (pageHeight > pageWidth) {
|
||||
var tmp = pageWidth;
|
||||
pageWidth = pageHeight;
|
||||
pageHeight = tmp;
|
||||
}
|
||||
} else {
|
||||
throw 'Invalid orientation: ' + orientation;
|
||||
}
|
||||
|
||||
// Return information (k is the unit conversion ratio from pts)
|
||||
var info = { 'width': pageWidth, 'height': pageHeight, 'unit': unit, 'k': k };
|
||||
return info;
|
||||
};
|
||||
|
||||
var orig = {
|
||||
toContainer: Worker.prototype.toContainer
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
return orig.toContainer.call(this).then(function toContainer_pagebreak() {
|
||||
// Enable page-breaks.
|
||||
var pageBreaks = this.prop.container.querySelectorAll('.html2pdf__page-break');
|
||||
var pxPageHeight = this.prop.pageSize.inner.px.height;
|
||||
Array.prototype.forEach.call(pageBreaks, function pageBreak_loop(el) {
|
||||
el.style.display = 'block';
|
||||
var clientRect = el.getBoundingClientRect();
|
||||
el.style.height = pxPageHeight - clientRect.top % pxPageHeight + 'px';
|
||||
}, this);
|
||||
});
|
||||
};
|
||||
|
||||
// Add hyperlink functionality to the PDF creation.
|
||||
|
||||
// Main link array, and refs to original functions.
|
||||
var linkInfo = [];
|
||||
var orig$1 = {
|
||||
toContainer: Worker.prototype.toContainer,
|
||||
toPdf: Worker.prototype.toPdf
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
return orig$1.toContainer.call(this).then(function toContainer_hyperlink() {
|
||||
// Retrieve hyperlink info if the option is enabled.
|
||||
if (this.opt.enableLinks) {
|
||||
// Find all anchor tags and get the container's bounds for reference.
|
||||
var container = this.prop.container;
|
||||
var links = container.querySelectorAll('a');
|
||||
var containerRect = unitConvert(container.getBoundingClientRect(), this.prop.pageSize.k);
|
||||
linkInfo = [];
|
||||
|
||||
// Loop through each anchor tag.
|
||||
Array.prototype.forEach.call(links, function (link) {
|
||||
// Treat each client rect as a separate link (for text-wrapping).
|
||||
var clientRects = link.getClientRects();
|
||||
for (var i = 0; i < clientRects.length; i++) {
|
||||
var clientRect = unitConvert(clientRects[i], this.prop.pageSize.k);
|
||||
clientRect.left -= containerRect.left;
|
||||
clientRect.top -= containerRect.top;
|
||||
|
||||
var page = Math.floor(clientRect.top / this.prop.pageSize.inner.height) + 1;
|
||||
var top = this.opt.margin[0] + clientRect.top % this.prop.pageSize.inner.height;
|
||||
var left = this.opt.margin[1] + clientRect.left;
|
||||
|
||||
linkInfo.push({ page: page, top: top, left: left, clientRect: clientRect, link: link });
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toPdf = function toPdf() {
|
||||
return orig$1.toPdf.call(this).then(function toPdf_hyperlink() {
|
||||
// Add hyperlinks if the option is enabled.
|
||||
if (this.opt.enableLinks) {
|
||||
// Attach each anchor tag based on info from toContainer().
|
||||
linkInfo.forEach(function (l) {
|
||||
this.prop.pdf.setPage(l.page);
|
||||
this.prop.pdf.link(l.left, l.top, l.clientRect.width, l.clientRect.height, { url: l.link.href });
|
||||
}, this);
|
||||
|
||||
// Reset the active page of the PDF to the final page.
|
||||
var nPages = this.prop.pdf.internal.getNumberOfPages();
|
||||
this.prop.pdf.setPage(nPages);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate a PDF from an HTML element or string using html2canvas and jsPDF.
|
||||
*
|
||||
* @param {Element|string} source The source element or HTML string.
|
||||
* @param {Object=} opt An object of optional settings: 'margin', 'filename',
|
||||
* 'image' ('type' and 'quality'), and 'html2canvas' / 'jspdf', which are
|
||||
* sent as settings to their corresponding functions.
|
||||
*/
|
||||
var html2pdf = function html2pdf(src, opt) {
|
||||
// Create a new worker with the given options.
|
||||
var worker = new html2pdf.Worker(opt);
|
||||
|
||||
if (src) {
|
||||
// If src is specified, perform the traditional 'simple' operation.
|
||||
return worker.from(src).save();
|
||||
} else {
|
||||
// Otherwise, return the worker for new Promise-based operation.
|
||||
return worker;
|
||||
}
|
||||
};
|
||||
html2pdf.Worker = Worker;
|
||||
|
||||
module.exports = html2pdf;
|
81
AstuteClient2/src/assets/html2pdf.js/gulpfile.js
Normal file
81
AstuteClient2/src/assets/html2pdf.js/gulpfile.js
Normal file
|
@ -0,0 +1,81 @@
|
|||
// Imports.
|
||||
var gulp = require('gulp');
|
||||
var util = require('util');
|
||||
var exec = util.promisify(require('child_process').exec);
|
||||
var minimist = require('minimist');
|
||||
var fs = require('fs');
|
||||
|
||||
// Fetch command-line arguments.
|
||||
var args = minimist(process.argv.slice(2), {
|
||||
string: ['env', 'newversion', 'tagmessage'],
|
||||
default: {
|
||||
env: process.env.NODE_ENV || 'production',
|
||||
newversion: 'patch',
|
||||
tagmessage: ''
|
||||
}
|
||||
});
|
||||
args.newversion = args.newversion || 'patch';
|
||||
|
||||
/* ----- REUSABLE TASKS ----- */
|
||||
|
||||
// Get package version from package.json.
|
||||
function getVersion() {
|
||||
var pkg = JSON.parse(fs.readFileSync('./package.json'));
|
||||
return 'v' + pkg.version;
|
||||
}
|
||||
|
||||
// Merge the specified branch back into master and develop.
|
||||
function mergeBranch(branch) {
|
||||
var mergeCmd = 'git merge --no-ff --no-edit ' + branch;
|
||||
|
||||
console.log('Merging release into master.')
|
||||
return exec('git checkout master && ' + mergeCmd).then(function() {
|
||||
console.log('Merging release into develop.')
|
||||
return exec('git checkout develop && ' + mergeCmd);
|
||||
});
|
||||
}
|
||||
|
||||
/* ----- TASKS ----- */
|
||||
|
||||
// Bump version using NPM (only affects package*.json, doesn't commit).
|
||||
gulp.task('bump-version', function() {
|
||||
console.log('Bumping version number.');
|
||||
return exec('npm --no-git-tag-version version ' + args.newversion);
|
||||
});
|
||||
|
||||
// Stage a release (bump version and create a 'release/[version]' branch).
|
||||
gulp.task('stage-release', ['bump-version'], function() {
|
||||
var version = getVersion();
|
||||
var branch = 'release/' + version;
|
||||
var cmd = 'git checkout -b ' + branch + ' && git add -A';
|
||||
cmd += ' && git commit -m "Prepare release ' + version + '"';
|
||||
|
||||
console.log('Creating release branch and committing changes.');
|
||||
return exec(cmd);
|
||||
});
|
||||
|
||||
gulp.task('finalize-release', function() {
|
||||
var version = getVersion();
|
||||
var branch = 'release/' + version;
|
||||
var cmd = 'git checkout ' + branch + ' && npm run build';
|
||||
|
||||
console.log('Running build process in release branch.');
|
||||
return exec(cmd).then(function() {
|
||||
console.log('Adding all changes and performing final commit.');
|
||||
return exec('git add -A && git commit --allow-empty -m "Build ' + version + '"');
|
||||
}).then(function() {
|
||||
console.log('Tagging with provided tag message.');
|
||||
return exec('git tag -a ' + version + ' -m "' + version + ' ' + args.tagmessage + '"');
|
||||
});
|
||||
});
|
||||
|
||||
// Tag and merge the latest release into master/develop.
|
||||
gulp.task('release', ['finalize-release'], function() {
|
||||
var version = getVersion();
|
||||
var branch = 'release/' + version;
|
||||
|
||||
return mergeBranch(branch).then(function() {
|
||||
console.log('Deleting release branch.');
|
||||
return exec('git branch -d ' + branch);
|
||||
});
|
||||
});
|
83
AstuteClient2/src/assets/html2pdf.js/package.json
Normal file
83
AstuteClient2/src/assets/html2pdf.js/package.json
Normal file
|
@ -0,0 +1,83 @@
|
|||
{
|
||||
"_from": "html2pdf.js",
|
||||
"_id": "html2pdf.js@0.9.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-IIhGjx0DJ2JBLSfhLn1hphJ4PWCQNnT8OnybPxEybA9+Qz3bbsrCaGXDX0rq5zLdKPCL82g2plMjgaAKUz41mw==",
|
||||
"_location": "/html2pdf.js",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "html2pdf.js",
|
||||
"name": "html2pdf.js",
|
||||
"escapedName": "html2pdf.js",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/html2pdf.js/-/html2pdf.js-0.9.0.tgz",
|
||||
"_shasum": "30976b096da1776f70e17c31d137a1c825a70f2a",
|
||||
"_spec": "html2pdf.js",
|
||||
"_where": "D:\\Documents\\Astute\\AstuteClient",
|
||||
"author": {
|
||||
"name": "Erik Koopmans",
|
||||
"email": "erik@erik-koopmans.com",
|
||||
"url": "https://www.erik-koopmans.com"
|
||||
},
|
||||
"browser": "dist/html2pdf.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eKoopmans/html2pdf/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"es6-promise": "^4.1.1",
|
||||
"html2canvas": "^1.0.0-alpha.12",
|
||||
"jspdf": "^1.3.5"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Client-side HTML-to-PDF rendering using pure JS",
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-plugin-external-helpers": "^6.22.0",
|
||||
"babel-plugin-transform-object-assign": "^6.22.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"gulp": "^3.9.1",
|
||||
"rimraf": "^2.6.2",
|
||||
"rollup": "^0.51.8",
|
||||
"rollup-plugin-babel": "^3.0.2",
|
||||
"rollup-plugin-commonjs": "^8.2.6",
|
||||
"rollup-plugin-node-resolve": "^3.0.0",
|
||||
"rollup-plugin-replace": "^2.0.0",
|
||||
"rollup-plugin-uglify": "^2.0.1"
|
||||
},
|
||||
"homepage": "https://github.com/eKoopmans/html2pdf",
|
||||
"keywords": [
|
||||
"javascript",
|
||||
"pdf-generation",
|
||||
"html",
|
||||
"client-side",
|
||||
"canvas"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/require/html2pdf.cjs.js",
|
||||
"module": "dist/include/html2pdf.es.js",
|
||||
"name": "html2pdf.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/eKoopmans/html2pdf.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"clean": "rimraf dist",
|
||||
"prebuild": "npm install && npm run clean",
|
||||
"publish": "npm publish",
|
||||
"release": "gulp release --tagmessage",
|
||||
"stage-release": "gulp stage-release --newversion",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "0.9.0"
|
||||
}
|
116
AstuteClient2/src/assets/html2pdf.js/rollup.config.js
Normal file
116
AstuteClient2/src/assets/html2pdf.js/rollup.config.js
Normal file
|
@ -0,0 +1,116 @@
|
|||
// Import dependencies.
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import replace from 'rollup-plugin-replace';
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import uglify from 'rollup-plugin-uglify';
|
||||
import pkg from './package.json';
|
||||
|
||||
function banner() {
|
||||
var text = pkg.name + ' v' + pkg.version + '\n';
|
||||
text += 'Copyright (c) ' + (new Date).getFullYear() + ' Erik Koopmans\n';
|
||||
text += 'Released under the ' + pkg.license + ' License.';
|
||||
text = '/**\n * ' + text.replace(/\n/g, '\n * ') + '\n */';
|
||||
return { banner: text };
|
||||
}
|
||||
function license(filename) {
|
||||
filename = filename || './LICENSE';
|
||||
var data = fs.readFileSync(filename).toString();
|
||||
data = '/**\n * @license\n * ' + data.trim().replace(/\n/g, '\n * ') + '\n */\n';
|
||||
return { banner: data };
|
||||
}
|
||||
|
||||
export default [
|
||||
// Un-bundled builds.
|
||||
{
|
||||
name: 'html2pdf',
|
||||
input: 'src/index.js',
|
||||
output: [
|
||||
{ file: pkg.main, format: 'cjs' },
|
||||
{ file: pkg.module, format: 'es' },
|
||||
{ file: pkg.browser, format: 'umd' }
|
||||
],
|
||||
external: [
|
||||
'jspdf',
|
||||
'html2canvas',
|
||||
'es6-promise/auto'
|
||||
],
|
||||
globals: {
|
||||
jspdf: 'jsPDF',
|
||||
html2canvas: 'html2canvas'
|
||||
},
|
||||
plugins: [
|
||||
resolve(),
|
||||
commonjs(),
|
||||
replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
|
||||
babel({ exclude: 'node_modules/**' }),
|
||||
banner()
|
||||
]
|
||||
},
|
||||
// Un-bundled builds (minified).
|
||||
{
|
||||
name: 'html2pdf',
|
||||
input: 'src/index.js',
|
||||
output: [
|
||||
{ file: pkg.browser.replace(/js$/, 'min.js'), format: 'umd' }
|
||||
],
|
||||
external: [
|
||||
'jspdf',
|
||||
'html2canvas',
|
||||
'es6-promise/auto'
|
||||
],
|
||||
globals: {
|
||||
jspdf: 'jsPDF',
|
||||
html2canvas: 'html2canvas'
|
||||
},
|
||||
plugins: [
|
||||
resolve(),
|
||||
commonjs(),
|
||||
replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
|
||||
babel({ exclude: 'node_modules/**' }),
|
||||
uglify({
|
||||
output: { preamble: banner().banner }
|
||||
})
|
||||
]
|
||||
},
|
||||
// Bundled builds.
|
||||
{
|
||||
name: 'html2pdf',
|
||||
input: 'src/index.js',
|
||||
output: [
|
||||
{ file: pkg.browser.replace(/js$/, 'bundle.js'), format: 'umd' }
|
||||
],
|
||||
globals: {
|
||||
jspdf: 'jsPDF',
|
||||
html2canvas: 'html2canvas'
|
||||
},
|
||||
plugins: [
|
||||
resolve(),
|
||||
commonjs(),
|
||||
replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
|
||||
babel({ exclude: 'node_modules/**' }),
|
||||
banner()
|
||||
]
|
||||
},
|
||||
// Bundled builds (minified).
|
||||
{
|
||||
name: 'html2pdf',
|
||||
input: 'src/index.js',
|
||||
output: [
|
||||
{ file: pkg.browser.replace(/js$/, 'bundle.min.js'), format: 'umd' }
|
||||
],
|
||||
globals: {
|
||||
jspdf: 'jsPDF',
|
||||
html2canvas: 'html2canvas'
|
||||
},
|
||||
plugins: [
|
||||
resolve(),
|
||||
commonjs(),
|
||||
replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
|
||||
babel({ exclude: 'node_modules/**' }),
|
||||
uglify({
|
||||
output: { preamble: banner().banner }
|
||||
})
|
||||
]
|
||||
}
|
||||
];
|
31
AstuteClient2/src/assets/html2pdf.js/src/index.js
Normal file
31
AstuteClient2/src/assets/html2pdf.js/src/index.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
import 'es6-promise/auto';
|
||||
|
||||
import Worker from './worker.js';
|
||||
import './plugin/jspdf-plugin.js';
|
||||
import './plugin/pagebreaks.js';
|
||||
import './plugin/hyperlinks.js';
|
||||
|
||||
/**
|
||||
* Generate a PDF from an HTML element or string using html2canvas and jsPDF.
|
||||
*
|
||||
* @param {Element|string} source The source element or HTML string.
|
||||
* @param {Object=} opt An object of optional settings: 'margin', 'filename',
|
||||
* 'image' ('type' and 'quality'), and 'html2canvas' / 'jspdf', which are
|
||||
* sent as settings to their corresponding functions.
|
||||
*/
|
||||
var html2pdf = function html2pdf(src, opt) {
|
||||
// Create a new worker with the given options.
|
||||
var worker = new html2pdf.Worker(opt);
|
||||
|
||||
if (src) {
|
||||
// If src is specified, perform the traditional 'simple' operation.
|
||||
return worker.from(src).save();
|
||||
} else {
|
||||
// Otherwise, return the worker for new Promise-based operation.
|
||||
return worker;
|
||||
}
|
||||
}
|
||||
html2pdf.Worker = Worker;
|
||||
|
||||
// Expose the html2pdf function.
|
||||
export default html2pdf;
|
|
@ -0,0 +1,59 @@
|
|||
import Worker from '../worker.js';
|
||||
import { unitConvert } from '../utils.js';
|
||||
|
||||
// Add hyperlink functionality to the PDF creation.
|
||||
|
||||
// Main link array, and refs to original functions.
|
||||
var linkInfo = [];
|
||||
var orig = {
|
||||
toContainer: Worker.prototype.toContainer,
|
||||
toPdf: Worker.prototype.toPdf,
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
return orig.toContainer.call(this).then(function toContainer_hyperlink() {
|
||||
// Retrieve hyperlink info if the option is enabled.
|
||||
if (this.opt.enableLinks) {
|
||||
// Find all anchor tags and get the container's bounds for reference.
|
||||
var container = this.prop.container;
|
||||
var links = container.querySelectorAll('a');
|
||||
var containerRect = unitConvert(container.getBoundingClientRect(), this.prop.pageSize.k);
|
||||
linkInfo = [];
|
||||
|
||||
// Loop through each anchor tag.
|
||||
Array.prototype.forEach.call(links, function(link) {
|
||||
// Treat each client rect as a separate link (for text-wrapping).
|
||||
var clientRects = link.getClientRects();
|
||||
for (var i=0; i<clientRects.length; i++) {
|
||||
var clientRect = unitConvert(clientRects[i], this.prop.pageSize.k);
|
||||
clientRect.left -= containerRect.left;
|
||||
clientRect.top -= containerRect.top;
|
||||
|
||||
var page = Math.floor(clientRect.top / this.prop.pageSize.inner.height) + 1;
|
||||
var top = this.opt.margin[0] + clientRect.top % this.prop.pageSize.inner.height;
|
||||
var left = this.opt.margin[1] + clientRect.left;
|
||||
|
||||
linkInfo.push({ page, top, left, clientRect, link });
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toPdf = function toPdf() {
|
||||
return orig.toPdf.call(this).then(function toPdf_hyperlink() {
|
||||
// Add hyperlinks if the option is enabled.
|
||||
if (this.opt.enableLinks) {
|
||||
// Attach each anchor tag based on info from toContainer().
|
||||
linkInfo.forEach(function(l) {
|
||||
this.prop.pdf.setPage(l.page);
|
||||
this.prop.pdf.link(l.left, l.top, l.clientRect.width, l.clientRect.height,
|
||||
{ url: l.link.href });
|
||||
}, this);
|
||||
|
||||
// Reset the active page of the PDF to the final page.
|
||||
var nPages = this.prop.pdf.internal.getNumberOfPages();
|
||||
this.prop.pdf.setPage(nPages);
|
||||
}
|
||||
});
|
||||
};
|
|
@ -0,0 +1,99 @@
|
|||
// Import dependencies.
|
||||
import jsPDF from 'jspdf';
|
||||
|
||||
// Get dimensions of a PDF page, as determined by jsPDF.
|
||||
jsPDF.getPageSize = function(orientation, unit, format) {
|
||||
// Decode options object
|
||||
if (typeof orientation === 'object') {
|
||||
var options = orientation;
|
||||
orientation = options.orientation;
|
||||
unit = options.unit || unit;
|
||||
format = options.format || format;
|
||||
}
|
||||
|
||||
// Default options
|
||||
unit = unit || 'mm';
|
||||
format = format || 'a4';
|
||||
orientation = ('' + (orientation || 'P')).toLowerCase();
|
||||
var format_as_string = ('' + format).toLowerCase();
|
||||
|
||||
// Size in pt of various paper formats
|
||||
var pageFormats = {
|
||||
'a0' : [2383.94, 3370.39], 'a1' : [1683.78, 2383.94],
|
||||
'a2' : [1190.55, 1683.78], 'a3' : [ 841.89, 1190.55],
|
||||
'a4' : [ 595.28, 841.89], 'a5' : [ 419.53, 595.28],
|
||||
'a6' : [ 297.64, 419.53], 'a7' : [ 209.76, 297.64],
|
||||
'a8' : [ 147.40, 209.76], 'a9' : [ 104.88, 147.40],
|
||||
'a10' : [ 73.70, 104.88], 'b0' : [2834.65, 4008.19],
|
||||
'b1' : [2004.09, 2834.65], 'b2' : [1417.32, 2004.09],
|
||||
'b3' : [1000.63, 1417.32], 'b4' : [ 708.66, 1000.63],
|
||||
'b5' : [ 498.90, 708.66], 'b6' : [ 354.33, 498.90],
|
||||
'b7' : [ 249.45, 354.33], 'b8' : [ 175.75, 249.45],
|
||||
'b9' : [ 124.72, 175.75], 'b10' : [ 87.87, 124.72],
|
||||
'c0' : [2599.37, 3676.54], 'c1' : [1836.85, 2599.37],
|
||||
'c2' : [1298.27, 1836.85], 'c3' : [ 918.43, 1298.27],
|
||||
'c4' : [ 649.13, 918.43], 'c5' : [ 459.21, 649.13],
|
||||
'c6' : [ 323.15, 459.21], 'c7' : [ 229.61, 323.15],
|
||||
'c8' : [ 161.57, 229.61], 'c9' : [ 113.39, 161.57],
|
||||
'c10' : [ 79.37, 113.39], 'dl' : [ 311.81, 623.62],
|
||||
'letter' : [612, 792],
|
||||
'government-letter' : [576, 756],
|
||||
'legal' : [612, 1008],
|
||||
'junior-legal' : [576, 360],
|
||||
'ledger' : [1224, 792],
|
||||
'tabloid' : [792, 1224],
|
||||
'credit-card' : [153, 243]
|
||||
};
|
||||
|
||||
// Unit conversion
|
||||
switch (unit) {
|
||||
case 'pt': var k = 1; break;
|
||||
case 'mm': var k = 72 / 25.4; break;
|
||||
case 'cm': var k = 72 / 2.54; break;
|
||||
case 'in': var k = 72; break;
|
||||
case 'px': var k = 72 / 96; break;
|
||||
case 'pc': var k = 12; break;
|
||||
case 'em': var k = 12; break;
|
||||
case 'ex': var k = 6; break;
|
||||
default:
|
||||
throw ('Invalid unit: ' + unit);
|
||||
}
|
||||
|
||||
// Dimensions are stored as user units and converted to points on output
|
||||
if (pageFormats.hasOwnProperty(format_as_string)) {
|
||||
var pageHeight = pageFormats[format_as_string][1] / k;
|
||||
var pageWidth = pageFormats[format_as_string][0] / k;
|
||||
} else {
|
||||
try {
|
||||
var pageHeight = format[1];
|
||||
var pageWidth = format[0];
|
||||
} catch (err) {
|
||||
throw new Error('Invalid format: ' + format);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle page orientation
|
||||
if (orientation === 'p' || orientation === 'portrait') {
|
||||
orientation = 'p';
|
||||
if (pageWidth > pageHeight) {
|
||||
var tmp = pageWidth;
|
||||
pageWidth = pageHeight;
|
||||
pageHeight = tmp;
|
||||
}
|
||||
} else if (orientation === 'l' || orientation === 'landscape') {
|
||||
orientation = 'l';
|
||||
if (pageHeight > pageWidth) {
|
||||
var tmp = pageWidth;
|
||||
pageWidth = pageHeight;
|
||||
pageHeight = tmp;
|
||||
}
|
||||
} else {
|
||||
throw('Invalid orientation: ' + orientation);
|
||||
}
|
||||
|
||||
// Return information (k is the unit conversion ratio from pts)
|
||||
var info = { 'width': pageWidth, 'height': pageHeight, 'unit': unit, 'k': k };
|
||||
return info;
|
||||
};
|
||||
|
||||
export default jsPDF;
|
|
@ -0,0 +1,18 @@
|
|||
import Worker from '../worker.js';
|
||||
|
||||
var orig = {
|
||||
toContainer: Worker.prototype.toContainer
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
return orig.toContainer.call(this).then(function toContainer_pagebreak() {
|
||||
// Enable page-breaks.
|
||||
var pageBreaks = this.prop.container.querySelectorAll('.html2pdf__page-break');
|
||||
var pxPageHeight = this.prop.pageSize.inner.px.height;
|
||||
Array.prototype.forEach.call(pageBreaks, function pageBreak_loop(el) {
|
||||
el.style.display = 'block';
|
||||
var clientRect = el.getBoundingClientRect();
|
||||
el.style.height = pxPageHeight - (clientRect.top % pxPageHeight) + 'px';
|
||||
}, this);
|
||||
});
|
||||
};
|
69
AstuteClient2/src/assets/html2pdf.js/src/utils.js
Normal file
69
AstuteClient2/src/assets/html2pdf.js/src/utils.js
Normal file
|
@ -0,0 +1,69 @@
|
|||
// Determine the type of a variable/object.
|
||||
export const objType = function(obj) {
|
||||
var type = typeof obj;
|
||||
if (type === 'undefined') return 'undefined';
|
||||
else if (type === 'string' || obj instanceof String) return 'string';
|
||||
else if (type === 'number' || obj instanceof Number) return 'number';
|
||||
else if (type === 'function' || obj instanceof Function) return 'function';
|
||||
else if (!!obj && obj.constructor === Array) return 'array';
|
||||
else if (obj && obj.nodeType === 1) return 'element';
|
||||
else if (type === 'object') return 'object';
|
||||
else return 'unknown';
|
||||
};
|
||||
|
||||
// Create an HTML element with optional className, innerHTML, and style.
|
||||
export const createElement = function(tagName, opt) {
|
||||
var el = document.createElement(tagName);
|
||||
if (opt.className) el.className = opt.className;
|
||||
if (opt.innerHTML) {
|
||||
el.innerHTML = opt.innerHTML;
|
||||
var scripts = el.getElementsByTagName('script');
|
||||
for (var i = scripts.length; i-- > 0; null) {
|
||||
scripts[i].parentNode.removeChild(scripts[i]);
|
||||
}
|
||||
}
|
||||
for (var key in opt.style) {
|
||||
el.style[key] = opt.style[key];
|
||||
}
|
||||
return el;
|
||||
};
|
||||
|
||||
// Deep-clone a node and preserve contents/properties.
|
||||
export const cloneNode = function(node, javascriptEnabled) {
|
||||
// Recursively clone the node.
|
||||
var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false);
|
||||
for (var child = node.firstChild; child; child = child.nextSibling) {
|
||||
if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') {
|
||||
clone.appendChild(cloneNode(child, javascriptEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
if (node.nodeType === 1) {
|
||||
// Preserve contents/properties of special nodes.
|
||||
if (node.nodeName === 'CANVAS') {
|
||||
clone.width = node.width;
|
||||
clone.height = node.height;
|
||||
clone.getContext('2d').drawImage(node, 0, 0);
|
||||
} else if (node.nodeName === 'TEXTAREA' || node.nodeName === 'SELECT') {
|
||||
clone.value = node.value;
|
||||
}
|
||||
|
||||
// Preserve the node's scroll position when it loads.
|
||||
clone.addEventListener('load', function() {
|
||||
clone.scrollTop = node.scrollTop;
|
||||
clone.scrollLeft = node.scrollLeft;
|
||||
}, true);
|
||||
}
|
||||
|
||||
// Return the cloned node.
|
||||
return clone;
|
||||
}
|
||||
|
||||
// Convert units using the conversion value 'k' from jsPDF.
|
||||
export const unitConvert = function(obj, k) {
|
||||
var newObj = {};
|
||||
for (var key in obj) {
|
||||
newObj[key] = obj[key] * 72 / 96 / k;
|
||||
}
|
||||
return newObj;
|
||||
};
|
484
AstuteClient2/src/assets/html2pdf.js/src/worker.js
Normal file
484
AstuteClient2/src/assets/html2pdf.js/src/worker.js
Normal file
|
@ -0,0 +1,484 @@
|
|||
import jsPDF from 'jspdf';
|
||||
import html2canvas from 'html2canvas';
|
||||
import { objType, createElement, cloneNode, unitConvert } from './utils.js';
|
||||
|
||||
/* ----- CONSTRUCTOR ----- */
|
||||
|
||||
var Worker = function Worker(opt) {
|
||||
// Create the root parent for the proto chain, and the starting Worker.
|
||||
var root = Object.assign(Worker.convert(Promise.resolve()),
|
||||
JSON.parse(JSON.stringify(Worker.template)));
|
||||
var self = Worker.convert(Promise.resolve(), root);
|
||||
|
||||
// Set progress, optional settings, and return.
|
||||
self = self.setProgress(1, Worker, 1, [Worker]);
|
||||
self = self.set(opt);
|
||||
return self;
|
||||
};
|
||||
|
||||
// Boilerplate for subclassing Promise.
|
||||
Worker.prototype = Object.create(Promise.prototype);
|
||||
Worker.prototype.constructor = Worker;
|
||||
|
||||
// Converts/casts promises into Workers.
|
||||
Worker.convert = function convert(promise, inherit) {
|
||||
// Uses prototypal inheritance to receive changes made to ancestors' properties.
|
||||
promise.__proto__ = inherit || Worker.prototype;
|
||||
return promise;
|
||||
};
|
||||
|
||||
Worker.template = {
|
||||
prop: {
|
||||
src: null,
|
||||
container: null,
|
||||
overlay: null,
|
||||
canvas: null,
|
||||
img: null,
|
||||
pdf: null,
|
||||
pageSize: null
|
||||
},
|
||||
progress: {
|
||||
val: 0,
|
||||
state: null,
|
||||
n: 0,
|
||||
stack: []
|
||||
},
|
||||
opt: {
|
||||
filename: 'file.pdf',
|
||||
margin: [0,0,0,0],
|
||||
image: { type: 'jpeg', quality: 0.95 },
|
||||
enableLinks: true,
|
||||
html2canvas: {},
|
||||
jsPDF: {}
|
||||
}
|
||||
};
|
||||
|
||||
/* ----- FROM / TO ----- */
|
||||
|
||||
Worker.prototype.from = function from(src, type) {
|
||||
function getType(src) {
|
||||
switch (objType(src)) {
|
||||
case 'string': return 'string';
|
||||
case 'element': return src.nodeName.toLowerCase === 'canvas' ? 'canvas' : 'element';
|
||||
default: return 'unknown';
|
||||
}
|
||||
}
|
||||
|
||||
return this.then(function from_main() {
|
||||
type = type || getType(src);
|
||||
switch (type) {
|
||||
case 'string': return this.set({ src: createElement('div', {innerHTML: src}) });
|
||||
case 'element': return this.set({ src: src });
|
||||
case 'canvas': return this.set({ canvas: src });
|
||||
case 'img': return this.set({ img: src });
|
||||
default: return this.error('Unknown source type.');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.to = function to(target) {
|
||||
// Route the 'to' request to the appropriate method.
|
||||
switch (target) {
|
||||
case 'container':
|
||||
return this.toContainer();
|
||||
case 'canvas':
|
||||
return this.toCanvas();
|
||||
case 'img':
|
||||
return this.toImg();
|
||||
case 'pdf':
|
||||
return this.toPdf();
|
||||
default:
|
||||
return this.error('Invalid target.');
|
||||
}
|
||||
};
|
||||
|
||||
Worker.prototype.toContainer = function toContainer() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [
|
||||
function checkSrc() { return this.prop.src || this.error('Cannot duplicate - no source HTML.'); },
|
||||
function checkPageSize() { return this.prop.pageSize || this.setPageSize(); }
|
||||
];
|
||||
|
||||
return this.thenList(prereqs).then(function toContainer_main() {
|
||||
// Define the CSS styles for the container and its overlay parent.
|
||||
var overlayCSS = {
|
||||
position: 'fixed', overflow: 'hidden', zIndex: 1000,
|
||||
left: 0, right: 0, bottom: 0, top: 0,
|
||||
backgroundColor: 'rgba(0,0,0,0.8)'
|
||||
};
|
||||
var containerCSS = {
|
||||
position: 'absolute', width: this.prop.pageSize.inner.width + this.prop.pageSize.unit,
|
||||
left: 0, right: 0, top: 0, height: 'auto', margin: 'auto',
|
||||
backgroundColor: 'white'
|
||||
};
|
||||
|
||||
// Set the overlay to hidden (could be changed in the future to provide a print preview).
|
||||
overlayCSS.opacity = 0;
|
||||
|
||||
// Create and attach the elements.
|
||||
var source = cloneNode(this.prop.src, this.opt.html2canvas.javascriptEnabled);
|
||||
this.prop.overlay = createElement('div', { className: 'html2pdf__overlay', style: overlayCSS });
|
||||
this.prop.container = createElement('div', { className: 'html2pdf__container', style: containerCSS });
|
||||
this.prop.container.appendChild(source);
|
||||
this.prop.overlay.appendChild(this.prop.container);
|
||||
document.body.appendChild(this.prop.overlay);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toCanvas = function toCanvas() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [
|
||||
function checkContainer() { return document.body.contains(this.prop.container)
|
||||
|| this.toContainer(); }
|
||||
];
|
||||
|
||||
// Fulfill prereqs then create the canvas.
|
||||
return this.thenList(prereqs).then(function toCanvas_main() {
|
||||
// Handle old-fashioned 'onrendered' argument.
|
||||
var options = Object.assign({}, this.opt.html2canvas);
|
||||
delete options.onrendered;
|
||||
|
||||
return html2canvas(this.prop.container, options);
|
||||
}).then(function toCanvas_post(canvas) {
|
||||
// Handle old-fashioned 'onrendered' argument.
|
||||
var onRendered = this.opt.html2canvas.onrendered || function () {};
|
||||
onRendered(canvas);
|
||||
|
||||
this.prop.canvas = canvas;
|
||||
document.body.removeChild(this.prop.overlay);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toImg = function toImg() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [
|
||||
function checkCanvas() { return this.prop.canvas || this.toCanvas(); }
|
||||
];
|
||||
|
||||
// Fulfill prereqs then create the image.
|
||||
return this.thenList(prereqs).then(function toImg_main() {
|
||||
var imgData = this.prop.canvas.toDataURL('image/' + this.opt.image.type, this.opt.image.quality);
|
||||
this.prop.img = document.createElement('img');
|
||||
this.prop.img.src = imgData;
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.toPdf = function toPdf() {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [
|
||||
function checkCanvas() { return this.prop.canvas || this.toCanvas(); }
|
||||
];
|
||||
|
||||
// Fulfill prereqs then create the image.
|
||||
return this.thenList(prereqs).then(function toPdf_main() {
|
||||
// Create local copies of frequently used properties.
|
||||
var canvas = this.prop.canvas;
|
||||
var opt = this.opt;
|
||||
|
||||
// Calculate the number of pages.
|
||||
var ctx = canvas.getContext('2d');
|
||||
var pxFullHeight = canvas.height;
|
||||
var pxPageHeight = Math.floor(canvas.width * this.prop.pageSize.inner.ratio);
|
||||
var nPages = Math.ceil(pxFullHeight / pxPageHeight);
|
||||
|
||||
// Define pageHeight separately so it can be trimmed on the final page.
|
||||
var pageHeight = this.prop.pageSize.inner.height;
|
||||
|
||||
// Create a one-page canvas to split up the full image.
|
||||
var pageCanvas = document.createElement('canvas');
|
||||
var pageCtx = pageCanvas.getContext('2d');
|
||||
pageCanvas.width = canvas.width;
|
||||
pageCanvas.height = pxPageHeight;
|
||||
|
||||
// Initialize the PDF.
|
||||
this.prop.pdf = this.prop.pdf || new jsPDF(opt.jsPDF);
|
||||
|
||||
for (var page=0; page<nPages; page++) {
|
||||
// Trim the final page to reduce file size.
|
||||
if (page === nPages-1) {
|
||||
pageCanvas.height = pxFullHeight % pxPageHeight;
|
||||
pageHeight = pageCanvas.height * this.prop.pageSize.inner.width / pageCanvas.width;
|
||||
}
|
||||
|
||||
// Display the page.
|
||||
var w = pageCanvas.width;
|
||||
var h = pageCanvas.height;
|
||||
pageCtx.fillStyle = 'white';
|
||||
pageCtx.fillRect(0, 0, w, h);
|
||||
pageCtx.drawImage(canvas, 0, page*pxPageHeight, w, h, 0, 0, w, h);
|
||||
|
||||
// Add the page to the PDF.
|
||||
if (page) this.prop.pdf.addPage();
|
||||
var imgData = pageCanvas.toDataURL('image/' + opt.image.type, opt.image.quality);
|
||||
this.prop.pdf.addImage(imgData, opt.image.type, opt.margin[1], opt.margin[0],
|
||||
this.prop.pageSize.inner.width, pageHeight);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/* ----- OUTPUT / SAVE ----- */
|
||||
|
||||
Worker.prototype.output = function output(type, options, src) {
|
||||
// Redirect requests to the correct function (outputPdf / outputImg).
|
||||
src = src || 'pdf';
|
||||
if (src.toLowerCase() === 'img' || src.toLowerCase() === 'image') {
|
||||
return this.outputImg(type, options);
|
||||
} else {
|
||||
return this.outputPdf(type, options);
|
||||
}
|
||||
};
|
||||
|
||||
Worker.prototype.outputPdf = function outputPdf(type, options) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [
|
||||
function checkPdf() { return this.prop.pdf || this.toPdf(); }
|
||||
];
|
||||
|
||||
// Fulfill prereqs then perform the appropriate output.
|
||||
return this.thenList(prereqs).then(function outputPdf_main() {
|
||||
/* Currently implemented output types:
|
||||
* https://rawgit.com/MrRio/jsPDF/master/docs/jspdf.js.html#line992
|
||||
* save(options), arraybuffer, blob, bloburi/bloburl,
|
||||
* datauristring/dataurlstring, dataurlnewwindow, datauri/dataurl
|
||||
*/
|
||||
return this.prop.pdf.output(type, options);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.outputImg = function outputImg(type, options) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [
|
||||
function checkImg() { return this.prop.img || this.toImg(); }
|
||||
];
|
||||
|
||||
// Fulfill prereqs then perform the appropriate output.
|
||||
return this.thenList(prereqs).then(function outputImg_main() {
|
||||
switch (type) {
|
||||
case undefined:
|
||||
case 'img':
|
||||
return this.prop.img;
|
||||
case 'datauristring':
|
||||
case 'dataurlstring':
|
||||
return this.prop.img.src;
|
||||
case 'datauri':
|
||||
case 'dataurl':
|
||||
return document.location.href = this.prop.img.src;
|
||||
default:
|
||||
throw 'Image output type "' + type + '" is not supported.';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.save = function save(filename) {
|
||||
// Set up function prerequisites.
|
||||
var prereqs = [
|
||||
function checkPdf() { return this.prop.pdf || this.toPdf(); }
|
||||
];
|
||||
|
||||
// Fulfill prereqs, update the filename (if provided), and save the PDF.
|
||||
return this.thenList(prereqs).set(
|
||||
filename ? { filename: filename } : null
|
||||
).then(function save_main() {
|
||||
this.prop.pdf.save(this.opt.filename);
|
||||
});
|
||||
};
|
||||
|
||||
/* ----- SET / GET ----- */
|
||||
|
||||
Worker.prototype.set = function set(opt) {
|
||||
// TODO: Implement ordered pairs?
|
||||
|
||||
// Silently ignore invalid or empty input.
|
||||
if (objType(opt) !== 'object') {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Build an array of setter functions to queue.
|
||||
var fns = Object.keys(opt || {}).map(function (key) {
|
||||
if (key in Worker.template.prop) {
|
||||
// Set pre-defined properties.
|
||||
return function set_prop() { this.prop[key] = opt[key]; }
|
||||
} else {
|
||||
switch (key) {
|
||||
case 'margin':
|
||||
return this.setMargin.bind(this, opt.margin);
|
||||
case 'jsPDF':
|
||||
return function set_jsPDF() { this.opt.jsPDF = opt.jsPDF; return this.setPageSize(); }
|
||||
case 'pageSize':
|
||||
return this.setPageSize.bind(this, opt.pageSize);
|
||||
default:
|
||||
// Set any other properties in opt.
|
||||
return function set_opt() { this.opt[key] = opt[key] };
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
// Set properties within the promise chain.
|
||||
return this.then(function set_main() {
|
||||
return this.thenList(fns);
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.get = function get(key, cbk) {
|
||||
return this.then(function get_main() {
|
||||
// Fetch the requested property, either as a predefined prop or in opt.
|
||||
var val = (key in Worker.template.prop) ? this.prop[key] : this.opt[key];
|
||||
return cbk ? cbk(val) : val;
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.setMargin = function setMargin(margin) {
|
||||
return this.then(function setMargin_main() {
|
||||
// Parse the margin property.
|
||||
switch (objType(margin)) {
|
||||
case 'number':
|
||||
margin = [margin, margin, margin, margin];
|
||||
case 'array':
|
||||
if (margin.length === 2) {
|
||||
margin = [margin[0], margin[1], margin[0], margin[1]];
|
||||
}
|
||||
if (margin.length === 4) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return this.error('Invalid margin array.');
|
||||
}
|
||||
|
||||
// Set the margin property, then update pageSize.
|
||||
this.opt.margin = margin;
|
||||
}).then(this.setPageSize);
|
||||
}
|
||||
|
||||
Worker.prototype.setPageSize = function setPageSize(pageSize) {
|
||||
function toPx(val, k) {
|
||||
return Math.floor(val * k / 72 * 96);
|
||||
}
|
||||
|
||||
return this.then(function setPageSize_main() {
|
||||
// Retrieve page-size based on jsPDF settings, if not explicitly provided.
|
||||
pageSize = pageSize || jsPDF.getPageSize(this.opt.jsPDF);
|
||||
|
||||
// Add 'inner' field if not present.
|
||||
if (!pageSize.hasOwnProperty('inner')) {
|
||||
pageSize.inner = {
|
||||
width: pageSize.width - this.opt.margin[1] - this.opt.margin[3],
|
||||
height: pageSize.height - this.opt.margin[0] - this.opt.margin[2]
|
||||
};
|
||||
pageSize.inner.px = {
|
||||
width: toPx(pageSize.inner.width, pageSize.k),
|
||||
height: toPx(pageSize.inner.height, pageSize.k)
|
||||
};
|
||||
pageSize.inner.ratio = pageSize.inner.height / pageSize.inner.width;
|
||||
}
|
||||
|
||||
// Attach pageSize to this.
|
||||
this.prop.pageSize = pageSize;
|
||||
});
|
||||
}
|
||||
|
||||
Worker.prototype.setProgress = function setProgress(val, state, n, stack) {
|
||||
// Immediately update all progress values.
|
||||
if (val != null) this.progress.val = val;
|
||||
if (state != null) this.progress.state = state;
|
||||
if (n != null) this.progress.n = n;
|
||||
if (stack != null) this.progress.stack = stack;
|
||||
this.progress.ratio = this.progress.val / this.progress.state;
|
||||
|
||||
// Return this for command chaining.
|
||||
return this;
|
||||
};
|
||||
|
||||
Worker.prototype.updateProgress = function updateProgress(val, state, n, stack) {
|
||||
// Immediately update all progress values, using setProgress.
|
||||
return this.setProgress(
|
||||
val ? this.progress.val + val : null,
|
||||
state ? state : null,
|
||||
n ? this.progress.n + n : null,
|
||||
stack ? this.progress.stack.concat(stack) : null
|
||||
);
|
||||
};
|
||||
|
||||
/* ----- PROMISE MAPPING ----- */
|
||||
|
||||
Worker.prototype.then = function then(onFulfilled, onRejected) {
|
||||
// Wrap `this` for encapsulation.
|
||||
var self = this;
|
||||
|
||||
return this.thenCore(onFulfilled, onRejected, function then_main(onFulfilled, onRejected) {
|
||||
// Update progress while queuing, calling, and resolving `then`.
|
||||
self.updateProgress(null, null, 1, [onFulfilled]);
|
||||
return Promise.prototype.then.call(this, function then_pre(val) {
|
||||
self.updateProgress(null, onFulfilled);
|
||||
return val;
|
||||
}).then(onFulfilled, onRejected).then(function then_post(val) {
|
||||
self.updateProgress(1);
|
||||
return val;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Worker.prototype.thenCore = function thenCore(onFulfilled, onRejected, thenBase) {
|
||||
// Handle optional thenBase parameter.
|
||||
thenBase = thenBase || Promise.prototype.then;
|
||||
|
||||
// Wrap `this` for encapsulation and bind it to the promise handlers.
|
||||
var self = this;
|
||||
if (onFulfilled) { onFulfilled = onFulfilled.bind(self); }
|
||||
if (onRejected) { onRejected = onRejected.bind(self); }
|
||||
|
||||
// Cast self into a Promise to avoid polyfills recursively defining `then`.
|
||||
var isNative = Promise.toString().indexOf('[native code]') !== -1 && Promise.name === 'Promise';
|
||||
var selfPromise = isNative ? self : Worker.convert(Object.assign({}, self), Promise.prototype);
|
||||
|
||||
// Return the promise, after casting it into a Worker and preserving props.
|
||||
var returnVal = thenBase.call(selfPromise, onFulfilled, onRejected);
|
||||
return Worker.convert(returnVal, self.__proto__);
|
||||
};
|
||||
|
||||
Worker.prototype.thenExternal = function thenExternal(onFulfilled, onRejected) {
|
||||
// Call `then` and return a standard promise (exits the Worker chain).
|
||||
return Promise.prototype.then.call(this, onFulfilled, onRejected);
|
||||
};
|
||||
|
||||
Worker.prototype.thenList = function thenList(fns) {
|
||||
// Queue a series of promise 'factories' into the promise chain.
|
||||
var self = this;
|
||||
fns.forEach(function thenList_forEach(fn) {
|
||||
self = self.thenCore(fn);
|
||||
});
|
||||
return self;
|
||||
};
|
||||
|
||||
Worker.prototype['catch'] = function (onRejected) {
|
||||
// Bind `this` to the promise handler, call `catch`, and return a Worker.
|
||||
if (onRejected) { onRejected = onRejected.bind(this); }
|
||||
var returnVal = Promise.prototype['catch'].call(this, onRejected);
|
||||
return Worker.convert(returnVal, this);
|
||||
};
|
||||
|
||||
Worker.prototype.catchExternal = function catchExternal(onRejected) {
|
||||
// Call `catch` and return a standard promise (exits the Worker chain).
|
||||
return Promise.prototype['catch'].call(this, onRejected);
|
||||
};
|
||||
|
||||
Worker.prototype.error = function error(msg) {
|
||||
// Throw the error in the Promise chain.
|
||||
return this.then(function error_main() {
|
||||
throw new Error(msg);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/* ----- ALIASES ----- */
|
||||
|
||||
Worker.prototype.using = Worker.prototype.set;
|
||||
Worker.prototype.saveAs = Worker.prototype.save;
|
||||
Worker.prototype.export = Worker.prototype.output;
|
||||
Worker.prototype.run = Worker.prototype.then;
|
||||
|
||||
|
||||
/* ----- FINISHING ----- */
|
||||
|
||||
// Expose the Worker class.
|
||||
export default Worker;
|
9
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/.gitignore
vendored
Normal file
9
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/.gitignore
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
index.html
|
||||
css/*
|
||||
img/*
|
||||
js/*
|
||||
node_modules/
|
||||
bower_components/
|
||||
.sparkleshare
|
||||
libpeerconnection.log
|
||||
.versions
|
34
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/.jshintrc
Normal file
34
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/.jshintrc
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"bitwise": true,
|
||||
"browser": true,
|
||||
"camelcase": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"esnext": true,
|
||||
"expr": true,
|
||||
"globals": {
|
||||
"console": false,
|
||||
"define": false,
|
||||
"document": false,
|
||||
"expect": false,
|
||||
"module": false,
|
||||
"require": false,
|
||||
"window": false
|
||||
},
|
||||
"immed": true,
|
||||
"indent": 4,
|
||||
"latedef": true,
|
||||
"maxcomplexity": 15,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"node": true,
|
||||
"noempty": true,
|
||||
"nonstandard": true,
|
||||
"quotmark": "single",
|
||||
"regexp": true,
|
||||
"smarttabs": true,
|
||||
"strict": false,
|
||||
"trailing": true,
|
||||
"undef": true,
|
||||
"unused": true
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
1.9.3-p551
|
|
@ -0,0 +1,7 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "8.9.3"
|
||||
before_script:
|
||||
- npm install -g grunt-cli
|
||||
- npm install
|
||||
script: grunt test
|
914
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/CHANGELOG.md
Normal file
914
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/CHANGELOG.md
Normal file
|
@ -0,0 +1,914 @@
|
|||
== v1.14.15 (Mar/08 2018 22:59 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* rolling back change to fix caret positioning. it didn’t worked on some devices
|
||||
|
||||
== v1.14.14 (Mar/02 2018 16:55 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing mask positioning delays
|
||||
* unmask: also removing place holder if added on the first place.
|
||||
* unmask: unsetting maxlength if we set it in the first place
|
||||
|
||||
== v1.14.13 (Dec/11 2017 18:59 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixes caret issue explained on #636
|
||||
* fixing use strict issue
|
||||
|
||||
== v1.14.12 (Oct/04 2017 09:57 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* bug fixing on caret positioning on some devices
|
||||
|
||||
== v1.14.11 (May/30 2017 21:53 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing a lot of caret positioning issues. Thanks to @onuradsay
|
||||
|
||||
== v1.14.10 (Feb/13 2017 14:18 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing exception when oValue in undefined
|
||||
|
||||
== v1.14.9 (Jan/25 2017 11:17 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* don’t use input event when using samsung browser or old chrome versions
|
||||
|
||||
== v1.14.8 (Dec/26 2016 13:18 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing caret on android with chrome 28
|
||||
|
||||
== v1.14.7 (Dec/25 2016 03:51 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* improving caret positioning when cursor is on the middle
|
||||
|
||||
== v1.14.6 (Dec/24 2016 17:14 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fix caret positioning with multiple mask chars
|
||||
|
||||
== v1.14.5 (Dec/24 2016 14:42 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* fixing reserved word
|
||||
|
||||
== v1.14.4 (Dec/24 2016 14:38 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing android cursor positioning (special thanks to @felipejunges and @fernandobandeira)
|
||||
|
||||
== v1.14.3 (Nov/28 2016 11:53 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing caret positioning on safari
|
||||
|
||||
== v1.14.2 (Nov/27 2016 20:04 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* apply auto maxlength in case the mask doesn't have recursive pattern
|
||||
|
||||
== v1.14.1 (Nov/27 2016 19:20 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Fix input value mangling when inserting before a static mask character
|
||||
* fixing caret position issue
|
||||
|
||||
== v1.14.0 (Apr/03 2016 17:52 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Fix cursor jumping while editing in non-IE browsers. Thanks to @archwyrm
|
||||
|
||||
Features:
|
||||
|
||||
* adding masked function for better angular use
|
||||
|
||||
== v1.13.9 (Mar/20 2016 16:17 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* giving the opportunity to pass watchInputs locally
|
||||
|
||||
== v1.13.8 (Mar/06 2016 23:25 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* adding support for meteor
|
||||
|
||||
== v1.13.7 (Mar/06 2016 22:46 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing onChange behaviour
|
||||
|
||||
== v1.13.6 (Mar/06 2016 22:14 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing deploy procedure
|
||||
|
||||
== v1.13.5 (Mar/06 2016 22:01 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* adding clearIfNotMatch to globalOptions
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing some bugs when using non-input elements
|
||||
* fixing mobile issues at #348.
|
||||
* using input event when supported
|
||||
|
||||
== v1.13.4 (Aug/07 2015 14:21 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Add check to ensure that there are input elements before using them
|
||||
|
||||
== v1.13.3 (Jul/16 2015 16:11 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* adding main property to package.json
|
||||
|
||||
== v1.13.2 (Jul/16 2015 16:06 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* change event wasnt being triggered in some cases
|
||||
|
||||
== v1.13.1 (Jul/07 2015 15:38 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* destroying input event too
|
||||
|
||||
== v1.13.0 (Jul/07 2015 15:26 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* removing the autocomplete default.
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing bower file thanks to @lazyants
|
||||
|
||||
Features:
|
||||
|
||||
* prevent glitch when invalid chars.
|
||||
* turning off autocomplete when browsers doesn't support oninput event.
|
||||
|
||||
== v1.12.0 (Jul/07 2015 11:37 +0100 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* giving an alternative to the autocomplete/autofill problem.
|
||||
|
||||
== v1.11.4 (Feb/26 2015 22:11 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* grunt, jshint and better applyDataMask. Thanks to @lagden
|
||||
* automated deploy to npm
|
||||
|
||||
== v1.11.3 (Jan/28 2015 15:41 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* Added commonjs module definition
|
||||
|
||||
== v1.11.2 (Dec/26 2014 15:36 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* unreachable code
|
||||
|
||||
== v1.11.1 (Dec/26 2014 15:34 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* unreachable code
|
||||
|
||||
== v1.11.0 (Dec/26 2014 15:33 +0000 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* implementing selectOnFocus and data-mask-selectonfocus option
|
||||
* adding public method called: .applyDataMask in case you want to decide whether to apply masks in data-mask fields
|
||||
|
||||
== v1.10.13 (Nov/19 2014 16:06 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing bug with watchInputs feature when mask is used as a function and not a string.
|
||||
|
||||
== v1.10.12 (Nov/06 2014 13:08 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* making a few improvements to make selection, copy events easier
|
||||
|
||||
== v1.10.11 (Nov/06 2014 11:26 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* we need to revaluate dataMask flags everytime
|
||||
|
||||
== v1.10.10 (Nov/06 2014 10:41 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing dynamically data-mask added elements
|
||||
|
||||
== v1.10.9 (Nov/05 2014 10:52 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* data-mask wasnt working
|
||||
|
||||
== v1.10.8 (Nov/01 2014 13:49 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* we dont need to seek for data-mask every time
|
||||
|
||||
== v1.10.7 (Nov/01 2014 13:18 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* little optimization
|
||||
|
||||
== v1.10.6 (Oct/28 2014 13:59 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing weird cursor problems in weird cases.
|
||||
* dynamically added inputs wasnt working
|
||||
|
||||
== v1.10.5 (Oct/23 2014 11:41 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing weird cursor problems in weird cases.
|
||||
|
||||
== v1.10.4 (Oct/23 2014 11:02 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing on the fly mask change feature.
|
||||
|
||||
== v1.10.3 (Oct/22 2014 09:50 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing unmask method.
|
||||
|
||||
== v1.10.2 (Oct/20 2014 16:38 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* onChange event fired at the wrong time when the field already has a value.
|
||||
|
||||
== v1.10.1 (Oct/20 2014 16:08 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing onChange event behaviour
|
||||
|
||||
== v1.10.0 (Oct/20 2014 10:56 +0100 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* adding a way to change global settings like translation object and the byPassKeys object.
|
||||
|
||||
== v1.9.2 (Oct/20 2014 10:08 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing fallback digits implementation. Thanks @A1rPun
|
||||
|
||||
== v1.9.1 (Oct/18 2014 12:27 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* cant convert circular json exception
|
||||
|
||||
== v1.9.0 (Oct/18 2014 12:07 +0100 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* adding onInvalid callback
|
||||
|
||||
== v1.8.0 (Oct/17 2014 11:35 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* removing automatic maxlength support
|
||||
* making a few optimizations to make it faster and retro compatible with other libraries
|
||||
* creating globalOptions to make it more fast and flexible
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing issue #196
|
||||
|
||||
Features:
|
||||
|
||||
* adding the fallback translation option
|
||||
|
||||
== v1.7.8 (Oct/15 2014 10:55 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* change event may experience issues
|
||||
* avoid maximum call stack trace error
|
||||
|
||||
== v1.7.7 (Sep/10 2014 22:31 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing clojure compile issue
|
||||
|
||||
== v1.7.6 (Sep/10 2014 22:14 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing clearifnotmatch in masks with literal digits
|
||||
|
||||
== v1.7.5 (Sep/09 2014 15:43 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing paste inside of empty fields.
|
||||
|
||||
== v1.7.4 (Aug/11 2014 14:53 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* smaller and reliable code
|
||||
|
||||
== v1.7.3 (Aug/11 2014 11:28 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing issue #185
|
||||
|
||||
== v1.7.2 (Aug/08 2014 11:11 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* smaller code
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing remove bug
|
||||
|
||||
== v1.7.1 (Aug/08 2014 00:55 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* upgrading zepto, smaller syntax and fixing build
|
||||
|
||||
== v1.7.0 (Aug/07 2014 23:56 +0100 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* applying masks to dynamically added elements. (html/javascript notation)
|
||||
|
||||
== v1.6.5 (Jun/30 2014 10:24 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing clearIfNotMatch feature in cases of optional and recursive digits
|
||||
|
||||
== v1.6.4 (May/08 2014 23:54 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* testing some deployment stunts
|
||||
|
||||
== v1.6.3 (May/08 2014 23:51 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* testing some deployment stunts
|
||||
|
||||
== v1.6.2 (May/08 2014 23:45 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fuckin typo
|
||||
|
||||
== v1.6.1 (May/08 2014 23:39 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing autofocus bug
|
||||
|
||||
== v1.6.0 (May/07 2014 21:13 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing autofocus bug
|
||||
|
||||
Features:
|
||||
|
||||
* adding support to the clearIfNotMatch option
|
||||
* HTML5 placeholder support
|
||||
|
||||
== v1.5.7 (May/01 2014 18:37 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* some cleanup and stuff
|
||||
|
||||
== v1.5.6 (May/01 2014 18:30 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Bug in calculating difference between mask characters between old and new field values
|
||||
* Fix stack limit exceeded
|
||||
|
||||
== v1.5.5 (Apr/27 2014 13:47 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* UMD (Universal Module Definition) patterns for JavaScript modules
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* caret position correction
|
||||
* 114 - Fix onChange Event error
|
||||
|
||||
== v1.5.4 (Feb/09 2014 12:02 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* optmizing code
|
||||
|
||||
== v1.5.3 (Feb/08 2014 14:59 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing ctrl a bug
|
||||
|
||||
== v1.5.2 (Dec/20 2013 16:35 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* smaller source code
|
||||
|
||||
== v1.5.1 (Dec/18 2013 22:34 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* fixing some code climate problems
|
||||
|
||||
== v1.5.0 (Dec/18 2013 22:10 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing getCleanVal()
|
||||
|
||||
Features:
|
||||
|
||||
* new public method called cleanVal
|
||||
|
||||
== v1.4.2 (Dec/16 2013 15:48 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Dirty fix for masks not completing with a literal
|
||||
|
||||
== v1.4.1 (Dec/09 2013 21:23 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* revising ignored keys
|
||||
|
||||
== v1.4.0 (Nov/28 2013 18:06 +0000 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* caret positioning implementation
|
||||
|
||||
== v1.3.1 (Oct/08 2013 20:38 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* adding more keys to ignore list to make the char navigation smoothly
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Sounds like 'options' has disappeared for some reason
|
||||
|
||||
== v1.3.0 (Sep/13 2013 10:37 +0100 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* creating the maxlength option
|
||||
|
||||
== v1.2.0 (Sep/07 2013 12:07 +0100 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* adding the possibility to put recursive digits inside masks
|
||||
|
||||
== v1.1.3 (Sep/04 2013 21:21 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing late masking
|
||||
|
||||
== v1.1.2 (Aug/26 2013 15:08 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing mask on div,span etc
|
||||
|
||||
== v1.1.1 (Aug/26 2013 14:42 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* better callback handling
|
||||
|
||||
== v1.1.0 (Aug/24 2013 15:59 +0100 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* adding onchange support
|
||||
|
||||
== v1.0.3 (Aug/23 2013 23:10 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* optimizations to mask on non html fields
|
||||
|
||||
== v1.0.2 (Aug/23 2013 22:46 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* adding remask method do improve callback performance
|
||||
|
||||
== v1.0.1 (Aug/23 2013 22:01 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* normal releases again
|
||||
|
||||
== v1.0.0 (Aug/23 2013 21:59 +0100 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* huge refactoring focusing no reduce source code weight and bugfixing
|
||||
|
||||
== v0.11.5 (Aug/20 2013 17:11 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* bug fixing when mask range is bigger than 2 digits.
|
||||
|
||||
== v0.11.4 (Aug/19 2013 10:24 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* adding de delete key to byPassKeys
|
||||
|
||||
== v0.11.3 (Aug/18 2013 00:48 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing zepto compatibily
|
||||
|
||||
== v0.11.2 (Aug/17 2013 18:39 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* jmask iterate all items
|
||||
|
||||
== v0.11.1 (Aug/17 2013 18:32 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* a little bit smaller source code
|
||||
|
||||
== v0.11.0 (Aug/16 2013 21:27 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Altered "ignored keys" hook to run events (i.e. onKeyPress) afterwards. Otherwise, we miss key triggered events when the user deletes the entire text box, etc.
|
||||
|
||||
Features:
|
||||
|
||||
* adding support to method getCleanVal
|
||||
|
||||
== v0.10.1 (Jul/26 2013 09:35 +0100 by ) ==
|
||||
|
||||
|
||||
|
||||
== v0.10.0 (Jul/19 2013 23:07 +0100 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* adding data-mask support
|
||||
|
||||
== v0.9.1 (Jul/19 2013 22:35 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* jQuery-Mask-Plugin is now available at bower.io
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing addEventListener on IE7
|
||||
|
||||
== v0.9.0 (Apr/24 2013 07:44 +0100 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* Adding compatibility with Zepto.js
|
||||
|
||||
== v0.8.0 (Apr/07 2013 18:39 +0100 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* applying masks anything != than input :)
|
||||
* implementing the possibility of range chars ex: A{1,3}
|
||||
|
||||
== v0.7.11 (Apr/05 2013 22:12 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* now when you type a wrong char, the plugin will make your text fit inside of the mask instead of lose your data.
|
||||
|
||||
== v0.7.10 (Apr/04 2013 22:14 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* changing yui-compressor to clojure-compiler
|
||||
|
||||
== v0.7.9 (Apr/04 2013 22:04 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* refactoring and implementation of optional mask digits
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing maxlength and adding a smarter mask removal. issue #18
|
||||
|
||||
== v0.7.8 (Mar/30 2013 00:48 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* a few changes to get the code smallest possible.
|
||||
* removing unnecessary methods and making code smaller.
|
||||
|
||||
== v0.7.7 (Mar/29 2013 12:38 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fixing copy and paste problem related on issue #15
|
||||
|
||||
== v0.7.6 (Mar/29 2013 00:28 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* correcting mask formatationg problem related on issue #16
|
||||
|
||||
== v0.7.5 (Mar/03 2013 20:56 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* generating .gz file on deploy
|
||||
|
||||
== v0.7.4 (Mar/03 2013 20:38 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* changing minifier jsmin to yui compressor.
|
||||
|
||||
== v0.7.3 (Mar/02 2013 01:12 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* bug fixing when typed wrong data type on mixing masks.
|
||||
|
||||
== v0.7.2 (Feb/24 2013 22:02 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* fuckin stupid comma.
|
||||
|
||||
== v0.7.1 (Feb/24 2013 21:57 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* testing the private method maskToRegex
|
||||
* a little bit of changes to make the code more testable
|
||||
|
||||
== v0.7.0 (Feb/12 2013 00:30 +0000 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* Now you can decide for jquery mask plugin how to interpret 0 to 9, A and S and even teach him how to reconize patterns.
|
||||
|
||||
== v0.6.3 (Feb/11 2013 12:20 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* When the user paste a text and the last char is valid sanitize may fail
|
||||
|
||||
== v0.6.2 (Feb/11 2013 00:02 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* allowing the user type the same character as the mask without erasing it.
|
||||
|
||||
== v0.6.1 (Jan/20 2013 23:57 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* changing the way ta deployment occurs to correct jquery plugins deployments.
|
||||
|
||||
== v0.6.0 (Jan/18 2013 17:19 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* Now pushing jQuery Mask Plugin to jQuery Plugins Repository
|
||||
|
||||
== v0.5.4 (Jan/17 2013 23:06 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* upgrading jquery plugins manifest file
|
||||
|
||||
== v0.5.3 (Jan/17 2013 22:48 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* correctly generating jmask version inside of jquery mask source
|
||||
|
||||
== v0.5.2 (Jan/17 2013 22:43 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* Now pushing to jQuery Plugin Repository
|
||||
|
||||
== v0.5.1 (Jan/07 2013 23:33 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* improving the deploy process with the new stepup's upgrade.
|
||||
|
||||
== v0.5.0 (Oct/27 2012 13:40 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Bug fixes on OnSupport method with Firefox.
|
||||
|
||||
Features:
|
||||
|
||||
* the first parameter of the .mask() function, now accepts a string or a anonymous function
|
||||
|
||||
== v0.4.7 (Aug/06 2012 22:56 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* Nothing big, just class refactoring
|
||||
|
||||
== v0.4.6 (Aug/06 2012 01:25 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
- better OOP design
|
||||
- implementing the jquery data object on each mask field
|
||||
- implementing the public method .remove to disable and remove the mask
|
||||
|
||||
== v0.4.5 (Aug/04 2012 01:31 +0100 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
- improving support to complex jquery selectors
|
||||
- performance improvement.
|
||||
- callback handling improvement
|
||||
|
||||
== v0.4.4 (Jun/03 2012 21:01 +0100 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Bug fixes on Internet Explorer 8.
|
||||
|
||||
== v0.4.3 (Mar/19 2012 21:52 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Corrigindo bug para mascaras com +
|
||||
|
||||
== v0.4.2 (Mar/18 2012 15:28 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Mascara não pararecia no firefox
|
||||
|
||||
== v0.4.1 (Mar/18 2012 15:01 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Corrigindo tim das macaras.
|
||||
|
||||
== v0.4.0 (Mar/18 2012 14:51 +0000 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* Implementado mascara reversa para moeda/cpf/rg/etc.
|
||||
* Nova engine.
|
||||
|
||||
== v0.3.0 (Mar/14 2012 10:14 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* License and comments up to date.
|
||||
|
||||
Features:
|
||||
|
||||
* On-the-fly mask change.
|
||||
* onComplete and onKeyPress new callbacks.
|
||||
|
||||
== v0.2.5 (Mar/13 2012 22:55 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
- Corrigindo ctrl+v com mascara errada. - Cortando dados que exceder a mascara no ctrl+v ou se segurar alguma tecla. - Refatorando algumas partes do código.
|
||||
|
||||
== v0.2.4 (Mar/13 2012 11:06 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* Codigo refatorado, otimizado, validação mais precisa e efetiva.
|
||||
|
||||
== v0.2.3 (Mar/13 2012 01:01 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* Melhorando expressoes regulares.
|
||||
|
||||
== v0.2.2 (Mar/13 2012 00:50 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Corrindo regex de validação
|
||||
|
||||
== v0.2.1 (Mar/13 2012 00:41 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Corrigida validação alphanumerica.
|
||||
|
||||
== v0.2.0 (Mar/13 2012 00:24 +0000 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
- Input Data Type Validation.
|
||||
- Automatic MaxLength (When are not defined).
|
||||
- Live Event Implemented for Ajax-based Apps.
|
||||
- Mixed mask with validation.
|
||||
* S for string digit
|
||||
* A for alphanumeric digit
|
||||
* 0 to 9 for numeric digit.
|
||||
|
||||
== v0.1.1 (Mar/10 2012 14:05 +0000 by Igor Escobar) ==
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Implementando Crossbrowser event handling.
|
||||
|
||||
== v0.1.0 (Mar/10 2012 13:10 +0000 by Igor Escobar) ==
|
||||
|
||||
Features:
|
||||
|
||||
* Implementando mascaras com espaço para data e hora
|
||||
|
||||
== v0.0.1 (Mar/10 2012 04:42 +0000 by Igor Escobar) ==
|
||||
|
||||
Changes:
|
||||
|
||||
* Refatorando o codigo para suportar multiplas instancias
|
|
@ -0,0 +1,9 @@
|
|||
### Have you take a look into our docs?
|
||||
https://igorescobar.github.io/jQuery-Mask-Plugin/
|
||||
|
||||
### Want to contribute? Make sure you read this first
|
||||
https://github.com/igorescobar/jQuery-Mask-Plugin#contributing
|
||||
|
||||
Is this plugin helping you out? Buy me a beer and cheers! :beer:
|
||||
|
||||
:bowtie: https://www.paypal.me/igorcescobar
|
|
@ -0,0 +1,36 @@
|
|||
FROM phusion/baseimage:0.9.17
|
||||
|
||||
# Use baseimage-docker's init system.
|
||||
CMD ["/sbin/my_init"]
|
||||
|
||||
# Java 8 for Google's clojure compiler
|
||||
RUN \
|
||||
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
|
||||
echo "deb http://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list && \
|
||||
add-apt-repository -y ppa:webupd8team/java && \
|
||||
apt-get update && \
|
||||
apt-get install -y oracle-java8-installer git unzip ruby-full && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
rm -rf /var/cache/oracle-jdk8-installer
|
||||
|
||||
# Define commonly used JAVA_HOME variable
|
||||
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
|
||||
|
||||
RUN mkdir /app
|
||||
RUN mkdir /app/clojure-compiler
|
||||
|
||||
# Clojure compiler
|
||||
RUN \
|
||||
curl -O http://dl.google.com/closure-compiler/compiler-latest.zip && \
|
||||
unzip compiler-latest.zip -d /app/clojure-compiler && \
|
||||
chmod a+x /app/clojure-compiler && \
|
||||
rm compiler-latest.zip
|
||||
|
||||
RUN gem install bundler pry step-up --no-rdoc --no-ri
|
||||
|
||||
# Install Node.js
|
||||
RUN curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash -
|
||||
RUN apt-get install --yes nodejs
|
||||
|
||||
RUN npm install -g grunt-cli
|
||||
WORKDIR /app/jquery-mask-plugin
|
|
@ -0,0 +1,43 @@
|
|||
module.exports = function(grunt) {
|
||||
require('load-grunt-tasks')(grunt);
|
||||
require('time-grunt')(grunt);
|
||||
|
||||
grunt.initConfig({
|
||||
|
||||
jshint: {
|
||||
options: {
|
||||
jshintrc: '.jshintrc',
|
||||
reporter: require('jshint-stylish')
|
||||
},
|
||||
all: ['src/{,*/}*.js']
|
||||
},
|
||||
connect: {
|
||||
server: {
|
||||
options: {
|
||||
port: 9001,
|
||||
base: './'
|
||||
}
|
||||
}
|
||||
},
|
||||
qunit: {
|
||||
all: {
|
||||
options: {
|
||||
urls: [
|
||||
'http://localhost:9001/test/test-for-jquery-1.11.1.html',
|
||||
'http://localhost:9001/test/test-for-jquery-1.7.2.html',
|
||||
'http://localhost:9001/test/test-for-jquery-1.8.3.html',
|
||||
'http://localhost:9001/test/test-for-jquery-1.9.1.html',
|
||||
'http://localhost:9001/test/test-for-jquery-2.1.1.html',
|
||||
'http://localhost:9001/test/test-for-jquery-3.0.0.html',
|
||||
'http://localhost:9001/test/test-for-zepto.html'
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// A convenient task alias.
|
||||
grunt.registerTask('test', ['jshint', 'connect', 'qunit']);
|
||||
grunt.registerTask('default', ['test']);
|
||||
|
||||
};
|
|
@ -0,0 +1,22 @@
|
|||
### Have you take a look into our docs?
|
||||
https://igorescobar.github.io/jQuery-Mask-Plugin/
|
||||
|
||||
### Make sure your read this before opening a new issue:
|
||||
https://github.com/igorescobar/jQuery-Mask-Plugin#problems-or-questions
|
||||
|
||||
#### Device
|
||||
[...]
|
||||
|
||||
#### Browser (and version)?
|
||||
[...]
|
||||
|
||||
#### Functional `jsfiddle` exemplifying your problem:
|
||||
You can use this one as exemple: http://jsfiddle.net/igorescobar/6pco4om7/
|
||||
|
||||
#### Describe de problem depth:
|
||||
[...]
|
||||
|
||||
|
||||
Is this plugin helping you out? Buy me a beer and cheers! :beer:
|
||||
|
||||
:bowtie: https://www.paypal.me/igorcescobar
|
26
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/LICENSE
Normal file
26
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/LICENSE
Normal file
|
@ -0,0 +1,26 @@
|
|||
Created by Igor Escobar on 2012-03-10. Please report any bug at http://blog.igorescobar.com
|
||||
|
||||
Copyright (c) 2012 Igor Escobar http://blog.igorescobar.com
|
||||
|
||||
The MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
137
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/README.md
Normal file
137
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/README.md
Normal file
|
@ -0,0 +1,137 @@
|
|||
# jQuery Mask Plugin
|
||||
A jQuery Plugin to make masks on form fields and HTML elements.
|
||||
|
||||
[](https://travis-ci.org/igorescobar/jQuery-Mask-Plugin)
|
||||
[](https://codeclimate.com/github/igorescobar/jQuery-Mask-Plugin)
|
||||
[](https://www.jsdelivr.com/package/npm/jquery-mask-plugin)
|
||||
[](https://cdnjs.com/libraries/jquery.mask)
|
||||
|
||||
# Documentation, Demos & Usage Examples
|
||||
https://igorescobar.github.io/jQuery-Mask-Plugin/
|
||||
|
||||
## Features
|
||||
|
||||
* Lightweight (~2kb minified, ~1kb gziped).
|
||||
* Built-in support for dynamically added elements.
|
||||
* Masks on any HTML element (no need to server-side mask anymore!)!
|
||||
* HTML notation support (data-mask, data-mask-recursive, data-mask-clearifnotmatch).
|
||||
* String/Numeric/Alpha/Mixed masks.
|
||||
* Reverse mask support for masks on numeric fields.
|
||||
* Sanitization.
|
||||
* Optional digits.
|
||||
* Recursive Digits.
|
||||
* Fallback Digits.
|
||||
* Advanced mask initialization.
|
||||
* Advanced Callbacks.
|
||||
* On-the-fly mask change.
|
||||
* Mask removal.
|
||||
* Full customization.
|
||||
* Compatibility with React/UMD/Zepto.js/Angular.JS.
|
||||
* HTML5 placeholder support.
|
||||
* Clear the field if it not matches support.
|
||||
|
||||
## Want to buy me a beer? :heart_eyes:
|
||||
http://paypal.me/igorcescobar
|
||||
|
||||
## Install it via Package Managers
|
||||
### Bower
|
||||
`bower install jquery-mask-plugin`
|
||||
### NPM
|
||||
`npm i jquery-mask-plugin`
|
||||
### Meteor
|
||||
`meteor add igorescobar:jquery-mask-plugin`
|
||||
### Packagist/Composer
|
||||
`composer require igorescobar/jquery-mask-plugin`
|
||||
|
||||
## CDNs
|
||||
### CDNjs
|
||||
https://cdnjs.com/libraries/jquery.mask
|
||||
### JSDelivr
|
||||
http://www.jsdelivr.com/projects/jquery.mask
|
||||
|
||||
## RubyGems
|
||||
```ruby
|
||||
gem 'jquery_mask_rails' # more details at http://bit.ly/jquery-mask-gem
|
||||
```
|
||||
|
||||
## Tutorials
|
||||
### English
|
||||
* [Masks with jQuery Mask Plugin](http://bit.ly/masks-with-jquery-mask-plugin)
|
||||
* [Using jQuery Mask Plugin With Zepto.js](http://bit.ly/using-jquery-mask-plugin-with-zeptojs)
|
||||
|
||||
### Portuguese
|
||||
* [Mascaras com JQuery Mask Plugin](http://bit.ly/mascaras-com-jquery-mask-plugin)
|
||||
* [Mascara Javascript para os novos telefones de São Paulo](http://bit.ly/mascara-javascript-para-os-novos-telefones-de-sao-paulo)
|
||||
|
||||
### Fun (or not) facts
|
||||
* [I’ve had the chance to troll Donald Trump. But I didn’t.](http://www.igorescobar.com/blog/2016/08/21/ive-the-chance-to-troll-donald-trump-but-i-didnt/)
|
||||
|
||||
## Compatibility
|
||||
jQuery Mask Plugin has been tested with jQuery 1.7+ on all major browsers:
|
||||
|
||||
* Firefox 2+ (Win, Mac, Linux);
|
||||
* IE7+ (Win);
|
||||
* Chrome 6+ (Win, Mac, Linux, Android, iPhone);
|
||||
* Safari 3.2+ (Win, Mac, iPhone);
|
||||
* Opera 8+ (Win, Mac, Linux, Android, iPhone).
|
||||
* Android Default Browser v4+
|
||||
|
||||
## Typescript support
|
||||
Definition can be found [here](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jquery-mask-plugin).
|
||||
|
||||
To install, open terminal and navigate to your working directory.
|
||||
|
||||
### Typescript 1.x users
|
||||
* Install [typings](https://github.com/typings/typings) by running `npm install typings --global`.
|
||||
* Then install the definition by running `typings install dt~jquery-mask-plugin --global --save`.
|
||||
### Typescript 2.x users
|
||||
* Use npm `npm install --save-dev @types/jquery-mask-plugin`.
|
||||
|
||||
For configuration options and troubleshooting refer to these repositories:
|
||||
* [Typings](https://github.com/typings/typings)
|
||||
* [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped)
|
||||
* [Typescript](https://github.com/Microsoft/TypeScript)
|
||||
|
||||
|
||||
## Problems or Questions?
|
||||
Before opening a new [issue](https://github.com/igorescobar/jQuery-Mask-Plugin/issues) take a look on those frequently asked questions:
|
||||
#### [How to integrate with React.js?](https://github.com/igorescobar/jQuery-Mask-Plugin/issues/498)
|
||||
#### [How to integrate with Angular.js?](https://github.com/igorescobar/jQuery-Mask-Plugin/issues/499)
|
||||
#### [How to integrate with Vue.js?](https://github.com/ankurk91/vue-jquery-mask)
|
||||
#### [Problems with old versions of Android keyboard](https://github.com/igorescobar/jQuery-Mask-Plugin/issues/135)
|
||||
#### [Negative numbers, or currency related problems](https://github.com/igorescobar/jQuery-Mask-Plugin/issues/436#issuecomment-253176511)
|
||||
#### [Prefix or sufix on the Mask](https://github.com/igorescobar/jQuery-Mask-Plugin/issues/166)
|
||||
#### [Add validation?](https://github.com/igorescobar/jQuery-Mask-Plugin/issues/387#issuecomment-192998092)
|
||||
#### [Field type number, email not working?](https://github.com/igorescobar/jQuery-Mask-Plugin/issues/450#issuecomment-253225719)
|
||||
#### [Want to keep the placeholder as the user types?](https://github.com/igorescobar/jQuery-Mask-Plugin/issues/633#issuecomment-350819224)
|
||||
#### [E-mail mask?](https://github.com/igorescobar/jQuery-Mask-Plugin/issues/582)
|
||||
|
||||
## Bugs?
|
||||
Did you read our [docs](https://igorescobar.github.io/jQuery-Mask-Plugin/docs.html)? Yes? Cool! So now... make sure that you have a *functional* [jsfiddle](http://jsfiddle.net/) exemplifying your problem and open an [issue](https://github.com/igorescobar/jQuery-Mask-Plugin/issues) for us. Don't know how to do it? Use this [fiddle example](http://jsfiddle.net/igorescobar/6pco4om7/).
|
||||
|
||||
## Contributing
|
||||
* **Bug Reporting**: Yes! You can contribute opening [issues](https://github.com/igorescobar/jQuery-Mask-Plugin/issues)!
|
||||
* **Documenting**: Do you think that something in our [docs](https://github.com/igorescobar/jQuery-Mask-Plugin/tree/gh-pages) should be better? Do you have a cool idea to increase the awesomeness? Summit your pull request with your idea!
|
||||
* **Bug Fixing**: No time to lose? Fix it and help others! Write some [tests](https://github.com/igorescobar/jQuery-Mask-Plugin/tree/master/test) to make sure that everything are working propertly.
|
||||
* **Improving**: Open an [issue](https://github.com/igorescobar/jQuery-Mask-Plugin/issues) and lets discuss it. Just to make sure that you're on the right track.
|
||||
* **Sharing**: Yes! Have we saved some of your time? Are you enjoying our mask plugin? Sharing is caring! Tweet it! Facebook it! Linkedin It(?!) :D
|
||||
* **Donating**: Hey, now that you don't need to worry about masks again... buy me a coffee, beer or a PlayStation 4 (Xbox One also accepted!) :o)
|
||||
|
||||
### Unit Tests
|
||||
We use [QUnit](http://qunitjs.com/) and [GruntJS](http://gruntjs.com/). To run our test suit is just run: ```grunt test``` in your console or you can open those ```test-for*.html``` files inside of our ```test/``` folder.
|
||||
|
||||
In case you're familiar with [Docker](https://www.docker.com/) here is how you can use it:
|
||||
```bash
|
||||
docker build -t jquery-mask .
|
||||
CONTAINER_ID=$(docker run -d -v $PWD:/app/jquery-mask-plugin jquery-mask)
|
||||
docker exec $CONTAINER_ID sh -c "npm install"
|
||||
docker exec -it $CONTAINER_ID /bin/bash
|
||||
grunt test
|
||||
```
|
||||
|
||||
## Contributors
|
||||
* [Igor Lima](https://github.com/igorlima)
|
||||
* [Mark Simmons](https://github.com/Markipelago)
|
||||
* [Gabriel Schammah](https://github.com/gschammah)
|
||||
* [Marcelo Manzan](https://github.com/kawamanza)
|
||||
* [See the full list](https://github.com/igorescobar/jQuery-Mask-Plugin/graphs/contributors)
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "jquery-mask-plugin",
|
||||
"version": "1.14.15",
|
||||
"main": "dist/jquery.mask.js",
|
||||
"ignore": [
|
||||
"deploy.rb",
|
||||
"jquery.mask.json",
|
||||
"Gruntfile.js",
|
||||
"test/*",
|
||||
".*"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "jQuery-Mask-Plugin",
|
||||
"description": "A jQuery Plugin to make masks on form fields and HTML elements.",
|
||||
"version": "1.14.15",
|
||||
"keywords": ["javascript", "mask", "form"],
|
||||
"scripts": [
|
||||
"dist/jquery.mask.js"
|
||||
],
|
||||
"main": "dist/jquery.mask.js"
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "igorescobar/jquery-mask-plugin",
|
||||
"type": "library",
|
||||
"description": "A jQuery Plugin to make masks on form fields and html elements.",
|
||||
"keywords": ["jquery", "mask", "plugin"],
|
||||
"homepage": "https://github.com/igorescobar/jQuery-Mask-Plugin",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Igor Escobar",
|
||||
"email": "blog@igorescobar.com",
|
||||
"homepage": "https://about.me/igorescobar",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/igorescobar/jQuery-Mask-Plugin/issues"
|
||||
}
|
||||
}
|
77
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/deploy.rb
Normal file
77
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/deploy.rb
Normal file
|
@ -0,0 +1,77 @@
|
|||
require 'rubygems'
|
||||
require 'zlib'
|
||||
|
||||
JMASK_FILE = 'src/jquery.mask.js'
|
||||
JMASK_MIN_FILE = 'dist/jquery.mask.min.js'
|
||||
GHPAGES_JMASK_MIN_FILE = 'js/jquery.mask.min.js'
|
||||
JMASK_VERSION = `stepup version --next-release`.delete("\n")
|
||||
BOWER_MANIFEST_FILE = 'bower.json'
|
||||
NPM_MANIFEST_FILE = 'package.json'
|
||||
METEOR_MANIFEST_FILE = 'package.js'
|
||||
COMPONENT_MANIFEST_FILE = 'component.json'
|
||||
|
||||
abort("No notes, do deal.") if JMASK_VERSION.empty?
|
||||
|
||||
puts '# PUTTING NEW VERSION INSIDE OF JQUERY MASK FILE'
|
||||
unversioned_jmask_file = File.open(JMASK_FILE, 'rb') { |file| file.read }
|
||||
File.open(JMASK_FILE, 'w') do |file|
|
||||
file.write(unversioned_jmask_file.gsub(/\* @version: (v[0-9.+]+)/, "\* @version: #{JMASK_VERSION}"))
|
||||
end
|
||||
|
||||
puts '# COPYING NEW JMASK FILE TO DIST/'
|
||||
`yes | cp #{JMASK_FILE} dist/`
|
||||
|
||||
[BOWER_MANIFEST_FILE, NPM_MANIFEST_FILE, COMPONENT_MANIFEST_FILE, METEOR_MANIFEST_FILE].each { |manifest_name|
|
||||
puts "# UPGRADING #{manifest_name} "
|
||||
manifest_file = File.open(manifest_name, 'rb') { |file| file.read }
|
||||
File.open(manifest_name, 'w') do |file|
|
||||
file.write(manifest_file.gsub(/"version": "([0-9.+]+)"/, "\"version\": \"#{JMASK_VERSION.gsub("v", "")}\""))
|
||||
end
|
||||
}
|
||||
|
||||
puts '# GENERATING MIN FILE'
|
||||
jquery_mask_min_file = nil
|
||||
File.open(JMASK_FILE, 'r') do |file|
|
||||
minFile = File.open(JMASK_MIN_FILE, 'w')
|
||||
minFile.puts("// jQuery Mask Plugin #{JMASK_VERSION}")
|
||||
minFile.puts("// github.com/igorescobar/jQuery-Mask-Plugin")
|
||||
jquery_mask_min_file = `java -jar ../clojure-compiler/compiler.jar --js src/jquery.mask.js --charset UTF-8`
|
||||
minFile.puts(jquery_mask_min_file)
|
||||
minFile.close
|
||||
end
|
||||
|
||||
puts '# GENERATING A NEW COMMIT WITH VERSIONED FILEs'
|
||||
`git commit -am 'generating jquery mask files #{JMASK_VERSION}'`
|
||||
|
||||
puts '# PUSHING CHANGES TO REMOTE'
|
||||
`git pull --rebase && git push`
|
||||
|
||||
puts '# CREATING NEW VERSION'
|
||||
`stepup version create --no-editor`
|
||||
|
||||
puts '# UPGRATING CHANGELOG'
|
||||
`stepup changelog --format=wiki > CHANGELOG.md`
|
||||
`git commit -am "upgrading changelog"`
|
||||
`git push`
|
||||
|
||||
puts '# UPGRADING gh-pages'
|
||||
`git checkout gh-pages`
|
||||
`git pull origin gh-pages`
|
||||
|
||||
minFile = File.open(GHPAGES_JMASK_MIN_FILE, 'w')
|
||||
minFile.puts("// jQuery Mask Plugin #{JMASK_VERSION}")
|
||||
minFile.puts("// github.com/igorescobar/jQuery-Mask-Plugin")
|
||||
minFile.puts(jquery_mask_min_file)
|
||||
minFile.close
|
||||
|
||||
`git commit -am "upgrading plugin file"`
|
||||
`git push`
|
||||
`git checkout master`
|
||||
|
||||
puts '# PUBLISHING NPM PACKAGE'
|
||||
`npm publish`
|
||||
|
||||
puts '# PUBLISHING METEOR PACKAGE'
|
||||
`meteor publish`
|
||||
|
||||
puts '# DONE!'
|
604
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/dist/jquery.mask.js
vendored
Normal file
604
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/dist/jquery.mask.js
vendored
Normal file
|
@ -0,0 +1,604 @@
|
|||
/**
|
||||
* jquery.mask.js
|
||||
* @version: v1.14.15
|
||||
* @author: Igor Escobar
|
||||
*
|
||||
* Created by Igor Escobar on 2012-03-10. Please report any bug at github.com/igorescobar/jQuery-Mask-Plugin
|
||||
*
|
||||
* Copyright (c) 2012 Igor Escobar http://igorescobar.com
|
||||
*
|
||||
* The MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* jshint laxbreak: true */
|
||||
/* jshint maxcomplexity:17 */
|
||||
/* global define */
|
||||
|
||||
// UMD (Universal Module Definition) patterns for JavaScript modules that work everywhere.
|
||||
// https://github.com/umdjs/umd/blob/master/templates/jqueryPlugin.js
|
||||
(function (factory, jQuery, Zepto) {
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory(require('jquery'));
|
||||
} else {
|
||||
factory(jQuery || Zepto);
|
||||
}
|
||||
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
var Mask = function (el, mask, options) {
|
||||
|
||||
var p = {
|
||||
invalid: [],
|
||||
getCaret: function () {
|
||||
try {
|
||||
var sel,
|
||||
pos = 0,
|
||||
ctrl = el.get(0),
|
||||
dSel = document.selection,
|
||||
cSelStart = ctrl.selectionStart;
|
||||
|
||||
// IE Support
|
||||
if (dSel && navigator.appVersion.indexOf('MSIE 10') === -1) {
|
||||
sel = dSel.createRange();
|
||||
sel.moveStart('character', -p.val().length);
|
||||
pos = sel.text.length;
|
||||
}
|
||||
// Firefox support
|
||||
else if (cSelStart || cSelStart === '0') {
|
||||
pos = cSelStart;
|
||||
}
|
||||
|
||||
return pos;
|
||||
} catch (e) {}
|
||||
},
|
||||
setCaret: function(pos) {
|
||||
try {
|
||||
if (el.is(':focus')) {
|
||||
var range, ctrl = el.get(0);
|
||||
|
||||
// Firefox, WebKit, etc..
|
||||
if (ctrl.setSelectionRange) {
|
||||
ctrl.setSelectionRange(pos, pos);
|
||||
} else { // IE
|
||||
range = ctrl.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
},
|
||||
events: function() {
|
||||
el
|
||||
.on('keydown.mask', function(e) {
|
||||
el.data('mask-keycode', e.keyCode || e.which);
|
||||
el.data('mask-previus-value', el.val());
|
||||
el.data('mask-previus-caret-pos', p.getCaret());
|
||||
p.maskDigitPosMapOld = p.maskDigitPosMap;
|
||||
})
|
||||
.on($.jMaskGlobals.useInput ? 'input.mask' : 'keyup.mask', p.behaviour)
|
||||
.on('paste.mask drop.mask', function() {
|
||||
setTimeout(function() {
|
||||
el.keydown().keyup();
|
||||
}, 100);
|
||||
})
|
||||
.on('change.mask', function(){
|
||||
el.data('changed', true);
|
||||
})
|
||||
.on('blur.mask', function(){
|
||||
if (oldValue !== p.val() && !el.data('changed')) {
|
||||
el.trigger('change');
|
||||
}
|
||||
el.data('changed', false);
|
||||
})
|
||||
// it's very important that this callback remains in this position
|
||||
// otherwhise oldValue it's going to work buggy
|
||||
.on('blur.mask', function() {
|
||||
oldValue = p.val();
|
||||
})
|
||||
// select all text on focus
|
||||
.on('focus.mask', function (e) {
|
||||
if (options.selectOnFocus === true) {
|
||||
$(e.target).select();
|
||||
}
|
||||
})
|
||||
// clear the value if it not complete the mask
|
||||
.on('focusout.mask', function() {
|
||||
if (options.clearIfNotMatch && !regexMask.test(p.val())) {
|
||||
p.val('');
|
||||
}
|
||||
});
|
||||
},
|
||||
getRegexMask: function() {
|
||||
var maskChunks = [], translation, pattern, optional, recursive, oRecursive, r;
|
||||
|
||||
for (var i = 0; i < mask.length; i++) {
|
||||
translation = jMask.translation[mask.charAt(i)];
|
||||
|
||||
if (translation) {
|
||||
|
||||
pattern = translation.pattern.toString().replace(/.{1}$|^.{1}/g, '');
|
||||
optional = translation.optional;
|
||||
recursive = translation.recursive;
|
||||
|
||||
if (recursive) {
|
||||
maskChunks.push(mask.charAt(i));
|
||||
oRecursive = {digit: mask.charAt(i), pattern: pattern};
|
||||
} else {
|
||||
maskChunks.push(!optional && !recursive ? pattern : (pattern + '?'));
|
||||
}
|
||||
|
||||
} else {
|
||||
maskChunks.push(mask.charAt(i).replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'));
|
||||
}
|
||||
}
|
||||
|
||||
r = maskChunks.join('');
|
||||
|
||||
if (oRecursive) {
|
||||
r = r.replace(new RegExp('(' + oRecursive.digit + '(.*' + oRecursive.digit + ')?)'), '($1)?')
|
||||
.replace(new RegExp(oRecursive.digit, 'g'), oRecursive.pattern);
|
||||
}
|
||||
|
||||
return new RegExp(r);
|
||||
},
|
||||
destroyEvents: function() {
|
||||
el.off(['input', 'keydown', 'keyup', 'paste', 'drop', 'blur', 'focusout', ''].join('.mask '));
|
||||
},
|
||||
val: function(v) {
|
||||
var isInput = el.is('input'),
|
||||
method = isInput ? 'val' : 'text',
|
||||
r;
|
||||
|
||||
if (arguments.length > 0) {
|
||||
if (el[method]() !== v) {
|
||||
el[method](v);
|
||||
}
|
||||
r = el;
|
||||
} else {
|
||||
r = el[method]();
|
||||
}
|
||||
|
||||
return r;
|
||||
},
|
||||
calculateCaretPosition: function() {
|
||||
var oldVal = el.data('mask-previus-value') || '',
|
||||
newVal = p.getMasked(),
|
||||
caretPosNew = p.getCaret();
|
||||
if (oldVal !== newVal) {
|
||||
var caretPosOld = el.data('mask-previus-caret-pos') || 0,
|
||||
newValL = newVal.length,
|
||||
oldValL = oldVal.length,
|
||||
maskDigitsBeforeCaret = 0,
|
||||
maskDigitsAfterCaret = 0,
|
||||
maskDigitsBeforeCaretAll = 0,
|
||||
maskDigitsBeforeCaretAllOld = 0,
|
||||
i = 0;
|
||||
|
||||
for (i = caretPosNew; i < newValL; i++) {
|
||||
if (!p.maskDigitPosMap[i]) {
|
||||
break;
|
||||
}
|
||||
maskDigitsAfterCaret++;
|
||||
}
|
||||
|
||||
for (i = caretPosNew - 1; i >= 0; i--) {
|
||||
if (!p.maskDigitPosMap[i]) {
|
||||
break;
|
||||
}
|
||||
maskDigitsBeforeCaret++;
|
||||
}
|
||||
|
||||
for (i = caretPosNew - 1; i >= 0; i--) {
|
||||
if (p.maskDigitPosMap[i]) {
|
||||
maskDigitsBeforeCaretAll++;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = caretPosOld - 1; i >= 0; i--) {
|
||||
if (p.maskDigitPosMapOld[i]) {
|
||||
maskDigitsBeforeCaretAllOld++;
|
||||
}
|
||||
}
|
||||
|
||||
// if the cursor is at the end keep it there
|
||||
if (caretPosNew > oldValL) {
|
||||
caretPosNew = newValL * 10;
|
||||
} else if (caretPosOld >= caretPosNew && caretPosOld !== oldValL) {
|
||||
if (!p.maskDigitPosMapOld[caretPosNew]) {
|
||||
var caretPos = caretPosNew;
|
||||
caretPosNew -= maskDigitsBeforeCaretAllOld - maskDigitsBeforeCaretAll;
|
||||
caretPosNew -= maskDigitsBeforeCaret;
|
||||
if (p.maskDigitPosMap[caretPosNew]) {
|
||||
caretPosNew = caretPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (caretPosNew > caretPosOld) {
|
||||
caretPosNew += maskDigitsBeforeCaretAll - maskDigitsBeforeCaretAllOld;
|
||||
caretPosNew += maskDigitsAfterCaret;
|
||||
}
|
||||
}
|
||||
return caretPosNew;
|
||||
},
|
||||
behaviour: function(e) {
|
||||
e = e || window.event;
|
||||
p.invalid = [];
|
||||
|
||||
var keyCode = el.data('mask-keycode');
|
||||
|
||||
if ($.inArray(keyCode, jMask.byPassKeys) === -1) {
|
||||
var newVal = p.getMasked(),
|
||||
caretPos = p.getCaret();
|
||||
|
||||
// this is a compensation to devices/browsers that don't compensate
|
||||
// caret positioning the right way
|
||||
setTimeout(function() {
|
||||
p.setCaret(p.calculateCaretPosition());
|
||||
}, $.jMaskGlobals.keyStrokeCompensation);
|
||||
|
||||
p.val(newVal);
|
||||
p.setCaret(caretPos);
|
||||
return p.callbacks(e);
|
||||
}
|
||||
},
|
||||
getMasked: function(skipMaskChars, val) {
|
||||
var buf = [],
|
||||
value = val === undefined ? p.val() : val + '',
|
||||
m = 0, maskLen = mask.length,
|
||||
v = 0, valLen = value.length,
|
||||
offset = 1, addMethod = 'push',
|
||||
resetPos = -1,
|
||||
maskDigitCount = 0,
|
||||
maskDigitPosArr = [],
|
||||
lastMaskChar,
|
||||
check;
|
||||
|
||||
if (options.reverse) {
|
||||
addMethod = 'unshift';
|
||||
offset = -1;
|
||||
lastMaskChar = 0;
|
||||
m = maskLen - 1;
|
||||
v = valLen - 1;
|
||||
check = function () {
|
||||
return m > -1 && v > -1;
|
||||
};
|
||||
} else {
|
||||
lastMaskChar = maskLen - 1;
|
||||
check = function () {
|
||||
return m < maskLen && v < valLen;
|
||||
};
|
||||
}
|
||||
|
||||
var lastUntranslatedMaskChar;
|
||||
while (check()) {
|
||||
var maskDigit = mask.charAt(m),
|
||||
valDigit = value.charAt(v),
|
||||
translation = jMask.translation[maskDigit];
|
||||
|
||||
if (translation) {
|
||||
if (valDigit.match(translation.pattern)) {
|
||||
buf[addMethod](valDigit);
|
||||
if (translation.recursive) {
|
||||
if (resetPos === -1) {
|
||||
resetPos = m;
|
||||
} else if (m === lastMaskChar && m !== resetPos) {
|
||||
m = resetPos - offset;
|
||||
}
|
||||
|
||||
if (lastMaskChar === resetPos) {
|
||||
m -= offset;
|
||||
}
|
||||
}
|
||||
m += offset;
|
||||
} else if (valDigit === lastUntranslatedMaskChar) {
|
||||
// matched the last untranslated (raw) mask character that we encountered
|
||||
// likely an insert offset the mask character from the last entry; fall
|
||||
// through and only increment v
|
||||
maskDigitCount--;
|
||||
lastUntranslatedMaskChar = undefined;
|
||||
} else if (translation.optional) {
|
||||
m += offset;
|
||||
v -= offset;
|
||||
} else if (translation.fallback) {
|
||||
buf[addMethod](translation.fallback);
|
||||
m += offset;
|
||||
v -= offset;
|
||||
} else {
|
||||
p.invalid.push({p: v, v: valDigit, e: translation.pattern});
|
||||
}
|
||||
v += offset;
|
||||
} else {
|
||||
if (!skipMaskChars) {
|
||||
buf[addMethod](maskDigit);
|
||||
}
|
||||
|
||||
if (valDigit === maskDigit) {
|
||||
maskDigitPosArr.push(v);
|
||||
v += offset;
|
||||
} else {
|
||||
lastUntranslatedMaskChar = maskDigit;
|
||||
maskDigitPosArr.push(v + maskDigitCount);
|
||||
maskDigitCount++;
|
||||
}
|
||||
|
||||
m += offset;
|
||||
}
|
||||
}
|
||||
|
||||
var lastMaskCharDigit = mask.charAt(lastMaskChar);
|
||||
if (maskLen === valLen + 1 && !jMask.translation[lastMaskCharDigit]) {
|
||||
buf.push(lastMaskCharDigit);
|
||||
}
|
||||
|
||||
var newVal = buf.join('');
|
||||
p.mapMaskdigitPositions(newVal, maskDigitPosArr, valLen);
|
||||
return newVal;
|
||||
},
|
||||
mapMaskdigitPositions: function(newVal, maskDigitPosArr, valLen) {
|
||||
var maskDiff = options.reverse ? newVal.length - valLen : 0;
|
||||
p.maskDigitPosMap = {};
|
||||
for (var i = 0; i < maskDigitPosArr.length; i++) {
|
||||
p.maskDigitPosMap[maskDigitPosArr[i] + maskDiff] = 1;
|
||||
}
|
||||
},
|
||||
callbacks: function (e) {
|
||||
var val = p.val(),
|
||||
changed = val !== oldValue,
|
||||
defaultArgs = [val, e, el, options],
|
||||
callback = function(name, criteria, args) {
|
||||
if (typeof options[name] === 'function' && criteria) {
|
||||
options[name].apply(this, args);
|
||||
}
|
||||
};
|
||||
|
||||
callback('onChange', changed === true, defaultArgs);
|
||||
callback('onKeyPress', changed === true, defaultArgs);
|
||||
callback('onComplete', val.length === mask.length, defaultArgs);
|
||||
callback('onInvalid', p.invalid.length > 0, [val, e, el, p.invalid, options]);
|
||||
}
|
||||
};
|
||||
|
||||
el = $(el);
|
||||
var jMask = this, oldValue = p.val(), regexMask;
|
||||
|
||||
mask = typeof mask === 'function' ? mask(p.val(), undefined, el, options) : mask;
|
||||
|
||||
// public methods
|
||||
jMask.mask = mask;
|
||||
jMask.options = options;
|
||||
jMask.remove = function() {
|
||||
var caret = p.getCaret();
|
||||
if (jMask.options.placeholder) {
|
||||
el.removeAttr('placeholder');
|
||||
}
|
||||
if (el.data('mask-maxlength')) {
|
||||
el.removeAttr('maxlength');
|
||||
}
|
||||
p.destroyEvents();
|
||||
p.val(jMask.getCleanVal());
|
||||
p.setCaret(caret);
|
||||
return el;
|
||||
};
|
||||
|
||||
// get value without mask
|
||||
jMask.getCleanVal = function() {
|
||||
return p.getMasked(true);
|
||||
};
|
||||
|
||||
// get masked value without the value being in the input or element
|
||||
jMask.getMaskedVal = function(val) {
|
||||
return p.getMasked(false, val);
|
||||
};
|
||||
|
||||
jMask.init = function(onlyMask) {
|
||||
onlyMask = onlyMask || false;
|
||||
options = options || {};
|
||||
|
||||
jMask.clearIfNotMatch = $.jMaskGlobals.clearIfNotMatch;
|
||||
jMask.byPassKeys = $.jMaskGlobals.byPassKeys;
|
||||
jMask.translation = $.extend({}, $.jMaskGlobals.translation, options.translation);
|
||||
|
||||
jMask = $.extend(true, {}, jMask, options);
|
||||
|
||||
regexMask = p.getRegexMask();
|
||||
|
||||
if (onlyMask) {
|
||||
p.events();
|
||||
p.val(p.getMasked());
|
||||
} else {
|
||||
if (options.placeholder) {
|
||||
el.attr('placeholder' , options.placeholder);
|
||||
}
|
||||
|
||||
// this is necessary, otherwise if the user submit the form
|
||||
// and then press the "back" button, the autocomplete will erase
|
||||
// the data. Works fine on IE9+, FF, Opera, Safari.
|
||||
if (el.data('mask')) {
|
||||
el.attr('autocomplete', 'off');
|
||||
}
|
||||
|
||||
// detect if is necessary let the user type freely.
|
||||
// for is a lot faster than forEach.
|
||||
for (var i = 0, maxlength = true; i < mask.length; i++) {
|
||||
var translation = jMask.translation[mask.charAt(i)];
|
||||
if (translation && translation.recursive) {
|
||||
maxlength = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (maxlength) {
|
||||
el.attr('maxlength', mask.length).data('mask-maxlength', true);
|
||||
}
|
||||
|
||||
p.destroyEvents();
|
||||
p.events();
|
||||
|
||||
var caret = p.getCaret();
|
||||
p.val(p.getMasked());
|
||||
p.setCaret(caret);
|
||||
}
|
||||
};
|
||||
|
||||
jMask.init(!el.is('input'));
|
||||
};
|
||||
|
||||
$.maskWatchers = {};
|
||||
var HTMLAttributes = function () {
|
||||
var input = $(this),
|
||||
options = {},
|
||||
prefix = 'data-mask-',
|
||||
mask = input.attr('data-mask');
|
||||
|
||||
if (input.attr(prefix + 'reverse')) {
|
||||
options.reverse = true;
|
||||
}
|
||||
|
||||
if (input.attr(prefix + 'clearifnotmatch')) {
|
||||
options.clearIfNotMatch = true;
|
||||
}
|
||||
|
||||
if (input.attr(prefix + 'selectonfocus') === 'true') {
|
||||
options.selectOnFocus = true;
|
||||
}
|
||||
|
||||
if (notSameMaskObject(input, mask, options)) {
|
||||
return input.data('mask', new Mask(this, mask, options));
|
||||
}
|
||||
},
|
||||
notSameMaskObject = function(field, mask, options) {
|
||||
options = options || {};
|
||||
var maskObject = $(field).data('mask'),
|
||||
stringify = JSON.stringify,
|
||||
value = $(field).val() || $(field).text();
|
||||
try {
|
||||
if (typeof mask === 'function') {
|
||||
mask = mask(value);
|
||||
}
|
||||
return typeof maskObject !== 'object' || stringify(maskObject.options) !== stringify(options) || maskObject.mask !== mask;
|
||||
} catch (e) {}
|
||||
},
|
||||
eventSupported = function(eventName) {
|
||||
var el = document.createElement('div'), isSupported;
|
||||
|
||||
eventName = 'on' + eventName;
|
||||
isSupported = (eventName in el);
|
||||
|
||||
if ( !isSupported ) {
|
||||
el.setAttribute(eventName, 'return;');
|
||||
isSupported = typeof el[eventName] === 'function';
|
||||
}
|
||||
el = null;
|
||||
|
||||
return isSupported;
|
||||
};
|
||||
|
||||
$.fn.mask = function(mask, options) {
|
||||
options = options || {};
|
||||
var selector = this.selector,
|
||||
globals = $.jMaskGlobals,
|
||||
interval = globals.watchInterval,
|
||||
watchInputs = options.watchInputs || globals.watchInputs,
|
||||
maskFunction = function() {
|
||||
if (notSameMaskObject(this, mask, options)) {
|
||||
return $(this).data('mask', new Mask(this, mask, options));
|
||||
}
|
||||
};
|
||||
|
||||
$(this).each(maskFunction);
|
||||
|
||||
if (selector && selector !== '' && watchInputs) {
|
||||
clearInterval($.maskWatchers[selector]);
|
||||
$.maskWatchers[selector] = setInterval(function(){
|
||||
$(document).find(selector).each(maskFunction);
|
||||
}, interval);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
$.fn.masked = function(val) {
|
||||
return this.data('mask').getMaskedVal(val);
|
||||
};
|
||||
|
||||
$.fn.unmask = function() {
|
||||
clearInterval($.maskWatchers[this.selector]);
|
||||
delete $.maskWatchers[this.selector];
|
||||
return this.each(function() {
|
||||
var dataMask = $(this).data('mask');
|
||||
if (dataMask) {
|
||||
dataMask.remove().removeData('mask');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.cleanVal = function() {
|
||||
return this.data('mask').getCleanVal();
|
||||
};
|
||||
|
||||
$.applyDataMask = function(selector) {
|
||||
selector = selector || $.jMaskGlobals.maskElements;
|
||||
var $selector = (selector instanceof $) ? selector : $(selector);
|
||||
$selector.filter($.jMaskGlobals.dataMaskAttr).each(HTMLAttributes);
|
||||
};
|
||||
|
||||
var globals = {
|
||||
maskElements: 'input,td,span,div',
|
||||
dataMaskAttr: '*[data-mask]',
|
||||
dataMask: true,
|
||||
watchInterval: 300,
|
||||
watchInputs: true,
|
||||
keyStrokeCompensation: 10,
|
||||
// old versions of chrome dont work great with input event
|
||||
useInput: !/Chrome\/[2-4][0-9]|SamsungBrowser/.test(window.navigator.userAgent) && eventSupported('input'),
|
||||
watchDataMask: false,
|
||||
byPassKeys: [9, 16, 17, 18, 36, 37, 38, 39, 40, 91],
|
||||
translation: {
|
||||
'0': {pattern: /\d/},
|
||||
'9': {pattern: /\d/, optional: true},
|
||||
'#': {pattern: /\d/, recursive: true},
|
||||
'A': {pattern: /[a-zA-Z0-9]/},
|
||||
'S': {pattern: /[a-zA-Z]/}
|
||||
}
|
||||
};
|
||||
|
||||
$.jMaskGlobals = $.jMaskGlobals || {};
|
||||
globals = $.jMaskGlobals = $.extend(true, {}, globals, $.jMaskGlobals);
|
||||
|
||||
// looking for inputs with data-mask attribute
|
||||
if (globals.dataMask) {
|
||||
$.applyDataMask();
|
||||
}
|
||||
|
||||
setInterval(function() {
|
||||
if ($.jMaskGlobals.watchDataMask) {
|
||||
$.applyDataMask();
|
||||
}
|
||||
}, globals.watchInterval);
|
||||
}, window.jQuery, window.Zepto));
|
19
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/dist/jquery.mask.min.js
vendored
Normal file
19
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/dist/jquery.mask.min.js
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
// jQuery Mask Plugin v1.14.15
|
||||
// github.com/igorescobar/jQuery-Mask-Plugin
|
||||
var $jscomp={scope:{},findInternal:function(a,l,d){a instanceof String&&(a=String(a));for(var p=a.length,h=0;h<p;h++){var b=a[h];if(l.call(d,b,h,a))return{i:h,v:b}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,l,d){if(d.get||d.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[l]=d.value)};
|
||||
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,l,d,p){if(l){d=$jscomp.global;a=a.split(".");for(p=0;p<a.length-1;p++){var h=a[p];h in d||(d[h]={});d=d[h]}a=a[a.length-1];p=d[a];l=l(p);l!=p&&null!=l&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:l})}};
|
||||
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,d){return $jscomp.findInternal(this,a,d).v}},"es6-impl","es3");
|
||||
(function(a,l,d){"function"===typeof define&&define.amd?define(["jquery"],a):"object"===typeof exports?module.exports=a(require("jquery")):a(l||d)})(function(a){var l=function(b,e,f){var c={invalid:[],getCaret:function(){try{var a,r=0,g=b.get(0),e=document.selection,f=g.selectionStart;if(e&&-1===navigator.appVersion.indexOf("MSIE 10"))a=e.createRange(),a.moveStart("character",-c.val().length),r=a.text.length;else if(f||"0"===f)r=f;return r}catch(C){}},setCaret:function(a){try{if(b.is(":focus")){var c,
|
||||
g=b.get(0);g.setSelectionRange?g.setSelectionRange(a,a):(c=g.createTextRange(),c.collapse(!0),c.moveEnd("character",a),c.moveStart("character",a),c.select())}}catch(B){}},events:function(){b.on("keydown.mask",function(a){b.data("mask-keycode",a.keyCode||a.which);b.data("mask-previus-value",b.val());b.data("mask-previus-caret-pos",c.getCaret());c.maskDigitPosMapOld=c.maskDigitPosMap}).on(a.jMaskGlobals.useInput?"input.mask":"keyup.mask",c.behaviour).on("paste.mask drop.mask",function(){setTimeout(function(){b.keydown().keyup()},
|
||||
100)}).on("change.mask",function(){b.data("changed",!0)}).on("blur.mask",function(){d===c.val()||b.data("changed")||b.trigger("change");b.data("changed",!1)}).on("blur.mask",function(){d=c.val()}).on("focus.mask",function(b){!0===f.selectOnFocus&&a(b.target).select()}).on("focusout.mask",function(){f.clearIfNotMatch&&!h.test(c.val())&&c.val("")})},getRegexMask:function(){for(var a=[],b,c,f,n,d=0;d<e.length;d++)(b=m.translation[e.charAt(d)])?(c=b.pattern.toString().replace(/.{1}$|^.{1}/g,""),f=b.optional,
|
||||
(b=b.recursive)?(a.push(e.charAt(d)),n={digit:e.charAt(d),pattern:c}):a.push(f||b?c+"?":c)):a.push(e.charAt(d).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"));a=a.join("");n&&(a=a.replace(new RegExp("("+n.digit+"(.*"+n.digit+")?)"),"($1)?").replace(new RegExp(n.digit,"g"),n.pattern));return new RegExp(a)},destroyEvents:function(){b.off("input keydown keyup paste drop blur focusout ".split(" ").join(".mask "))},val:function(a){var c=b.is("input")?"val":"text";if(0<arguments.length){if(b[c]()!==a)b[c](a);
|
||||
c=b}else c=b[c]();return c},calculateCaretPosition:function(){var a=b.data("mask-previus-value")||"",e=c.getMasked(),g=c.getCaret();if(a!==e){var f=b.data("mask-previus-caret-pos")||0,e=e.length,d=a.length,m=a=0,h=0,l=0,k;for(k=g;k<e&&c.maskDigitPosMap[k];k++)m++;for(k=g-1;0<=k&&c.maskDigitPosMap[k];k--)a++;for(k=g-1;0<=k;k--)c.maskDigitPosMap[k]&&h++;for(k=f-1;0<=k;k--)c.maskDigitPosMapOld[k]&&l++;g>d?g=10*e:f>=g&&f!==d?c.maskDigitPosMapOld[g]||(f=g,g=g-(l-h)-a,c.maskDigitPosMap[g]&&(g=f)):g>f&&
|
||||
(g=g+(h-l)+m)}return g},behaviour:function(f){f=f||window.event;c.invalid=[];var e=b.data("mask-keycode");if(-1===a.inArray(e,m.byPassKeys)){var e=c.getMasked(),g=c.getCaret();setTimeout(function(){c.setCaret(c.calculateCaretPosition())},a.jMaskGlobals.keyStrokeCompensation);c.val(e);c.setCaret(g);return c.callbacks(f)}},getMasked:function(a,b){var g=[],d=void 0===b?c.val():b+"",n=0,h=e.length,q=0,l=d.length,k=1,r="push",p=-1,t=0,y=[],v,z;f.reverse?(r="unshift",k=-1,v=0,n=h-1,q=l-1,z=function(){return-1<
|
||||
n&&-1<q}):(v=h-1,z=function(){return n<h&&q<l});for(var A;z();){var x=e.charAt(n),w=d.charAt(q),u=m.translation[x];if(u)w.match(u.pattern)?(g[r](w),u.recursive&&(-1===p?p=n:n===v&&n!==p&&(n=p-k),v===p&&(n-=k)),n+=k):w===A?(t--,A=void 0):u.optional?(n+=k,q-=k):u.fallback?(g[r](u.fallback),n+=k,q-=k):c.invalid.push({p:q,v:w,e:u.pattern}),q+=k;else{if(!a)g[r](x);w===x?(y.push(q),q+=k):(A=x,y.push(q+t),t++);n+=k}}d=e.charAt(v);h!==l+1||m.translation[d]||g.push(d);g=g.join("");c.mapMaskdigitPositions(g,
|
||||
y,l);return g},mapMaskdigitPositions:function(a,b,e){a=f.reverse?a.length-e:0;c.maskDigitPosMap={};for(e=0;e<b.length;e++)c.maskDigitPosMap[b[e]+a]=1},callbacks:function(a){var h=c.val(),g=h!==d,m=[h,a,b,f],q=function(a,b,c){"function"===typeof f[a]&&b&&f[a].apply(this,c)};q("onChange",!0===g,m);q("onKeyPress",!0===g,m);q("onComplete",h.length===e.length,m);q("onInvalid",0<c.invalid.length,[h,a,b,c.invalid,f])}};b=a(b);var m=this,d=c.val(),h;e="function"===typeof e?e(c.val(),void 0,b,f):e;m.mask=
|
||||
e;m.options=f;m.remove=function(){var a=c.getCaret();m.options.placeholder&&b.removeAttr("placeholder");b.data("mask-maxlength")&&b.removeAttr("maxlength");c.destroyEvents();c.val(m.getCleanVal());c.setCaret(a);return b};m.getCleanVal=function(){return c.getMasked(!0)};m.getMaskedVal=function(a){return c.getMasked(!1,a)};m.init=function(d){d=d||!1;f=f||{};m.clearIfNotMatch=a.jMaskGlobals.clearIfNotMatch;m.byPassKeys=a.jMaskGlobals.byPassKeys;m.translation=a.extend({},a.jMaskGlobals.translation,f.translation);
|
||||
m=a.extend(!0,{},m,f);h=c.getRegexMask();if(d)c.events(),c.val(c.getMasked());else{f.placeholder&&b.attr("placeholder",f.placeholder);b.data("mask")&&b.attr("autocomplete","off");d=0;for(var l=!0;d<e.length;d++){var g=m.translation[e.charAt(d)];if(g&&g.recursive){l=!1;break}}l&&b.attr("maxlength",e.length).data("mask-maxlength",!0);c.destroyEvents();c.events();d=c.getCaret();c.val(c.getMasked());c.setCaret(d)}};m.init(!b.is("input"))};a.maskWatchers={};var d=function(){var b=a(this),e={},f=b.attr("data-mask");
|
||||
b.attr("data-mask-reverse")&&(e.reverse=!0);b.attr("data-mask-clearifnotmatch")&&(e.clearIfNotMatch=!0);"true"===b.attr("data-mask-selectonfocus")&&(e.selectOnFocus=!0);if(p(b,f,e))return b.data("mask",new l(this,f,e))},p=function(b,e,f){f=f||{};var c=a(b).data("mask"),d=JSON.stringify;b=a(b).val()||a(b).text();try{return"function"===typeof e&&(e=e(b)),"object"!==typeof c||d(c.options)!==d(f)||c.mask!==e}catch(t){}},h=function(a){var b=document.createElement("div"),d;a="on"+a;d=a in b;d||(b.setAttribute(a,
|
||||
"return;"),d="function"===typeof b[a]);return d};a.fn.mask=function(b,d){d=d||{};var e=this.selector,c=a.jMaskGlobals,h=c.watchInterval,c=d.watchInputs||c.watchInputs,t=function(){if(p(this,b,d))return a(this).data("mask",new l(this,b,d))};a(this).each(t);e&&""!==e&&c&&(clearInterval(a.maskWatchers[e]),a.maskWatchers[e]=setInterval(function(){a(document).find(e).each(t)},h));return this};a.fn.masked=function(a){return this.data("mask").getMaskedVal(a)};a.fn.unmask=function(){clearInterval(a.maskWatchers[this.selector]);
|
||||
delete a.maskWatchers[this.selector];return this.each(function(){var b=a(this).data("mask");b&&b.remove().removeData("mask")})};a.fn.cleanVal=function(){return this.data("mask").getCleanVal()};a.applyDataMask=function(b){b=b||a.jMaskGlobals.maskElements;(b instanceof a?b:a(b)).filter(a.jMaskGlobals.dataMaskAttr).each(d)};h={maskElements:"input,td,span,div",dataMaskAttr:"*[data-mask]",dataMask:!0,watchInterval:300,watchInputs:!0,keyStrokeCompensation:10,useInput:!/Chrome\/[2-4][0-9]|SamsungBrowser/.test(window.navigator.userAgent)&&
|
||||
h("input"),watchDataMask:!1,byPassKeys:[9,16,17,18,36,37,38,39,40,91],translation:{0:{pattern:/\d/},9:{pattern:/\d/,optional:!0},"#":{pattern:/\d/,recursive:!0},A:{pattern:/[a-zA-Z0-9]/},S:{pattern:/[a-zA-Z]/}}};a.jMaskGlobals=a.jMaskGlobals||{};h=a.jMaskGlobals=a.extend(!0,{},h,a.jMaskGlobals);h.dataMask&&a.applyDataMask();setInterval(function(){a.jMaskGlobals.watchDataMask&&a.applyDataMask()},h.watchInterval)},window.jQuery,window.Zepto);
|
|
@ -0,0 +1,4 @@
|
|||
web:
|
||||
build: .
|
||||
volumes:
|
||||
- ./:/app/jquery-mask-plugin
|
2351
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/package-lock.json
generated
Normal file
2351
AstuteClient2/src/assets/jQuery-Mask-Plugin-master/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user