pushfeedback 0.1.53 → 0.1.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/feedback-button_2.cjs.entry.js +1619 -672
- package/dist/collection/components/feedback-modal/feedback-modal.js +1 -1
- package/dist/components/feedback-modal2.js +1619 -672
- package/dist/esm/feedback-button_2.entry.js +1619 -672
- package/dist/pushfeedback/p-41eb03ff.entry.js +22 -0
- package/dist/pushfeedback/pushfeedback.esm.js +1 -1
- package/package.json +2 -2
- package/dist/pushfeedback/p-1239b879.entry.js +0 -22
|
@@ -136,15 +136,15 @@ function commonjsRequire () {
|
|
|
136
136
|
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
var
|
|
139
|
+
var html2canvasPro = createCommonjsModule(function (module, exports) {
|
|
140
140
|
/*!
|
|
141
|
-
* html2canvas 1.
|
|
142
|
-
* Copyright (c)
|
|
141
|
+
* html2canvas-pro 1.5.8 <https://yorickshan.github.io/html2canvas-pro/>
|
|
142
|
+
* Copyright (c) 2024 yorickshan <https://github.com/yorickshan>
|
|
143
143
|
* Released under MIT License
|
|
144
144
|
*/
|
|
145
145
|
(function (global, factory) {
|
|
146
146
|
module.exports = factory() ;
|
|
147
|
-
}(commonjsGlobal, (function () {
|
|
147
|
+
})(commonjsGlobal, (function () {
|
|
148
148
|
/*! *****************************************************************************
|
|
149
149
|
Copyright (c) Microsoft Corporation.
|
|
150
150
|
|
|
@@ -1128,38 +1128,38 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1128
1128
|
return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
|
|
1129
1129
|
};
|
|
1130
1130
|
var LEFT_PARENTHESIS_TOKEN = {
|
|
1131
|
-
type: 2 /* LEFT_PARENTHESIS_TOKEN */
|
|
1131
|
+
type: 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */
|
|
1132
1132
|
};
|
|
1133
1133
|
var RIGHT_PARENTHESIS_TOKEN = {
|
|
1134
|
-
type: 3 /* RIGHT_PARENTHESIS_TOKEN */
|
|
1135
|
-
};
|
|
1136
|
-
var COMMA_TOKEN = { type: 4 /* COMMA_TOKEN */ };
|
|
1137
|
-
var SUFFIX_MATCH_TOKEN = { type: 13 /* SUFFIX_MATCH_TOKEN */ };
|
|
1138
|
-
var PREFIX_MATCH_TOKEN = { type: 8 /* PREFIX_MATCH_TOKEN */ };
|
|
1139
|
-
var COLUMN_TOKEN = { type: 21 /* COLUMN_TOKEN */ };
|
|
1140
|
-
var DASH_MATCH_TOKEN = { type: 9 /* DASH_MATCH_TOKEN */ };
|
|
1141
|
-
var INCLUDE_MATCH_TOKEN = { type: 10 /* INCLUDE_MATCH_TOKEN */ };
|
|
1134
|
+
type: 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */
|
|
1135
|
+
};
|
|
1136
|
+
var COMMA_TOKEN = { type: 4 /* TokenType.COMMA_TOKEN */ };
|
|
1137
|
+
var SUFFIX_MATCH_TOKEN = { type: 13 /* TokenType.SUFFIX_MATCH_TOKEN */ };
|
|
1138
|
+
var PREFIX_MATCH_TOKEN = { type: 8 /* TokenType.PREFIX_MATCH_TOKEN */ };
|
|
1139
|
+
var COLUMN_TOKEN = { type: 21 /* TokenType.COLUMN_TOKEN */ };
|
|
1140
|
+
var DASH_MATCH_TOKEN = { type: 9 /* TokenType.DASH_MATCH_TOKEN */ };
|
|
1141
|
+
var INCLUDE_MATCH_TOKEN = { type: 10 /* TokenType.INCLUDE_MATCH_TOKEN */ };
|
|
1142
1142
|
var LEFT_CURLY_BRACKET_TOKEN = {
|
|
1143
|
-
type: 11 /* LEFT_CURLY_BRACKET_TOKEN */
|
|
1143
|
+
type: 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */
|
|
1144
1144
|
};
|
|
1145
1145
|
var RIGHT_CURLY_BRACKET_TOKEN = {
|
|
1146
|
-
type: 12 /* RIGHT_CURLY_BRACKET_TOKEN */
|
|
1147
|
-
};
|
|
1148
|
-
var SUBSTRING_MATCH_TOKEN = { type: 14 /* SUBSTRING_MATCH_TOKEN */ };
|
|
1149
|
-
var BAD_URL_TOKEN = { type: 23 /* BAD_URL_TOKEN */ };
|
|
1150
|
-
var BAD_STRING_TOKEN = { type: 1 /* BAD_STRING_TOKEN */ };
|
|
1151
|
-
var CDO_TOKEN = { type: 25 /* CDO_TOKEN */ };
|
|
1152
|
-
var CDC_TOKEN = { type: 24 /* CDC_TOKEN */ };
|
|
1153
|
-
var COLON_TOKEN = { type: 26 /* COLON_TOKEN */ };
|
|
1154
|
-
var SEMICOLON_TOKEN = { type: 27 /* SEMICOLON_TOKEN */ };
|
|
1146
|
+
type: 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */
|
|
1147
|
+
};
|
|
1148
|
+
var SUBSTRING_MATCH_TOKEN = { type: 14 /* TokenType.SUBSTRING_MATCH_TOKEN */ };
|
|
1149
|
+
var BAD_URL_TOKEN = { type: 23 /* TokenType.BAD_URL_TOKEN */ };
|
|
1150
|
+
var BAD_STRING_TOKEN = { type: 1 /* TokenType.BAD_STRING_TOKEN */ };
|
|
1151
|
+
var CDO_TOKEN = { type: 25 /* TokenType.CDO_TOKEN */ };
|
|
1152
|
+
var CDC_TOKEN = { type: 24 /* TokenType.CDC_TOKEN */ };
|
|
1153
|
+
var COLON_TOKEN = { type: 26 /* TokenType.COLON_TOKEN */ };
|
|
1154
|
+
var SEMICOLON_TOKEN = { type: 27 /* TokenType.SEMICOLON_TOKEN */ };
|
|
1155
1155
|
var LEFT_SQUARE_BRACKET_TOKEN = {
|
|
1156
|
-
type: 28 /* LEFT_SQUARE_BRACKET_TOKEN */
|
|
1156
|
+
type: 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */
|
|
1157
1157
|
};
|
|
1158
1158
|
var RIGHT_SQUARE_BRACKET_TOKEN = {
|
|
1159
|
-
type: 29 /* RIGHT_SQUARE_BRACKET_TOKEN */
|
|
1159
|
+
type: 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */
|
|
1160
1160
|
};
|
|
1161
|
-
var WHITESPACE_TOKEN = { type: 31 /* WHITESPACE_TOKEN */ };
|
|
1162
|
-
var EOF_TOKEN = { type: 32 /* EOF_TOKEN */ };
|
|
1161
|
+
var WHITESPACE_TOKEN = { type: 31 /* TokenType.WHITESPACE_TOKEN */ };
|
|
1162
|
+
var EOF_TOKEN = { type: 32 /* TokenType.EOF_TOKEN */ };
|
|
1163
1163
|
var Tokenizer = /** @class */ (function () {
|
|
1164
1164
|
function Tokenizer() {
|
|
1165
1165
|
this._value = [];
|
|
@@ -1188,7 +1188,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1188
1188
|
if (isNameCodePoint(c1) || isValidEscape(c2, c3)) {
|
|
1189
1189
|
var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED;
|
|
1190
1190
|
var value = this.consumeName();
|
|
1191
|
-
return { type: 5 /* HASH_TOKEN */, value: value, flags: flags };
|
|
1191
|
+
return { type: 5 /* TokenType.HASH_TOKEN */, value: value, flags: flags };
|
|
1192
1192
|
}
|
|
1193
1193
|
break;
|
|
1194
1194
|
case DOLLAR_SIGN:
|
|
@@ -1277,7 +1277,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1277
1277
|
var a3 = this.peekCodePoint(2);
|
|
1278
1278
|
if (isIdentifierStart(a1, a2, a3)) {
|
|
1279
1279
|
var value = this.consumeName();
|
|
1280
|
-
return { type: 7 /* AT_KEYWORD_TOKEN */, value: value };
|
|
1280
|
+
return { type: 7 /* TokenType.AT_KEYWORD_TOKEN */, value: value };
|
|
1281
1281
|
}
|
|
1282
1282
|
break;
|
|
1283
1283
|
case LEFT_SQUARE_BRACKET:
|
|
@@ -1341,7 +1341,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1341
1341
|
this.reconsumeCodePoint(codePoint);
|
|
1342
1342
|
return this.consumeIdentLikeToken();
|
|
1343
1343
|
}
|
|
1344
|
-
return { type: 6 /* DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
|
|
1344
|
+
return { type: 6 /* TokenType.DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
|
|
1345
1345
|
};
|
|
1346
1346
|
Tokenizer.prototype.consumeCodePoint = function () {
|
|
1347
1347
|
var value = this._value.shift();
|
|
@@ -1372,7 +1372,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1372
1372
|
if (questionMarks) {
|
|
1373
1373
|
var start_1 = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16);
|
|
1374
1374
|
var end = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16);
|
|
1375
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start_1, end: end };
|
|
1375
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start_1, end: end };
|
|
1376
1376
|
}
|
|
1377
1377
|
var start = parseInt(fromCodePoint$1.apply(void 0, digits), 16);
|
|
1378
1378
|
if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) {
|
|
@@ -1384,10 +1384,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1384
1384
|
codePoint = this.consumeCodePoint();
|
|
1385
1385
|
}
|
|
1386
1386
|
var end = parseInt(fromCodePoint$1.apply(void 0, endDigits), 16);
|
|
1387
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: end };
|
|
1387
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: end };
|
|
1388
1388
|
}
|
|
1389
1389
|
else {
|
|
1390
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: start };
|
|
1390
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: start };
|
|
1391
1391
|
}
|
|
1392
1392
|
};
|
|
1393
1393
|
Tokenizer.prototype.consumeIdentLikeToken = function () {
|
|
@@ -1398,24 +1398,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1398
1398
|
}
|
|
1399
1399
|
else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) {
|
|
1400
1400
|
this.consumeCodePoint();
|
|
1401
|
-
return { type: 19 /* FUNCTION_TOKEN */, value: value };
|
|
1401
|
+
return { type: 19 /* TokenType.FUNCTION_TOKEN */, value: value };
|
|
1402
1402
|
}
|
|
1403
|
-
return { type: 20 /* IDENT_TOKEN */, value: value };
|
|
1403
|
+
return { type: 20 /* TokenType.IDENT_TOKEN */, value: value };
|
|
1404
1404
|
};
|
|
1405
1405
|
Tokenizer.prototype.consumeUrlToken = function () {
|
|
1406
1406
|
var value = [];
|
|
1407
1407
|
this.consumeWhiteSpace();
|
|
1408
1408
|
if (this.peekCodePoint(0) === EOF) {
|
|
1409
|
-
return { type: 22 /* URL_TOKEN */, value: '' };
|
|
1409
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: '' };
|
|
1410
1410
|
}
|
|
1411
1411
|
var next = this.peekCodePoint(0);
|
|
1412
1412
|
if (next === APOSTROPHE || next === QUOTATION_MARK) {
|
|
1413
1413
|
var stringToken = this.consumeStringToken(this.consumeCodePoint());
|
|
1414
|
-
if (stringToken.type === 0 /* STRING_TOKEN */) {
|
|
1414
|
+
if (stringToken.type === 0 /* TokenType.STRING_TOKEN */) {
|
|
1415
1415
|
this.consumeWhiteSpace();
|
|
1416
1416
|
if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
|
|
1417
1417
|
this.consumeCodePoint();
|
|
1418
|
-
return { type: 22 /* URL_TOKEN */, value: stringToken.value };
|
|
1418
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: stringToken.value };
|
|
1419
1419
|
}
|
|
1420
1420
|
}
|
|
1421
1421
|
this.consumeBadUrlRemnants();
|
|
@@ -1424,13 +1424,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1424
1424
|
while (true) {
|
|
1425
1425
|
var codePoint = this.consumeCodePoint();
|
|
1426
1426
|
if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
|
|
1427
|
-
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1427
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1428
1428
|
}
|
|
1429
1429
|
else if (isWhiteSpace(codePoint)) {
|
|
1430
1430
|
this.consumeWhiteSpace();
|
|
1431
1431
|
if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
|
|
1432
1432
|
this.consumeCodePoint();
|
|
1433
|
-
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1433
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1434
1434
|
}
|
|
1435
1435
|
this.consumeBadUrlRemnants();
|
|
1436
1436
|
return BAD_URL_TOKEN;
|
|
@@ -1490,7 +1490,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1490
1490
|
var codePoint = this._value[i];
|
|
1491
1491
|
if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) {
|
|
1492
1492
|
value += this.consumeStringSlice(i);
|
|
1493
|
-
return { type: 0 /* STRING_TOKEN */, value: value };
|
|
1493
|
+
return { type: 0 /* TokenType.STRING_TOKEN */, value: value };
|
|
1494
1494
|
}
|
|
1495
1495
|
if (codePoint === LINE_FEED) {
|
|
1496
1496
|
this._value.splice(0, i);
|
|
@@ -1552,13 +1552,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1552
1552
|
var c3 = this.peekCodePoint(2);
|
|
1553
1553
|
if (isIdentifierStart(c1, c2, c3)) {
|
|
1554
1554
|
var unit = this.consumeName();
|
|
1555
|
-
return { type: 15 /* DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
|
|
1555
|
+
return { type: 15 /* TokenType.DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
|
|
1556
1556
|
}
|
|
1557
1557
|
if (c1 === PERCENTAGE_SIGN) {
|
|
1558
1558
|
this.consumeCodePoint();
|
|
1559
|
-
return { type: 16 /* PERCENTAGE_TOKEN */, number: number, flags: flags };
|
|
1559
|
+
return { type: 16 /* TokenType.PERCENTAGE_TOKEN */, number: number, flags: flags };
|
|
1560
1560
|
}
|
|
1561
|
-
return { type: 17 /* NUMBER_TOKEN */, number: number, flags: flags };
|
|
1561
|
+
return { type: 17 /* TokenType.NUMBER_TOKEN */, number: number, flags: flags };
|
|
1562
1562
|
};
|
|
1563
1563
|
Tokenizer.prototype.consumeEscapedCodePoint = function () {
|
|
1564
1564
|
var codePoint = this.consumeCodePoint();
|
|
@@ -1617,18 +1617,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1617
1617
|
};
|
|
1618
1618
|
Parser.prototype.parseComponentValue = function () {
|
|
1619
1619
|
var token = this.consumeToken();
|
|
1620
|
-
while (token.type === 31 /* WHITESPACE_TOKEN */) {
|
|
1620
|
+
while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */) {
|
|
1621
1621
|
token = this.consumeToken();
|
|
1622
1622
|
}
|
|
1623
|
-
if (token.type === 32 /* EOF_TOKEN */) {
|
|
1623
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1624
1624
|
throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
|
|
1625
1625
|
}
|
|
1626
1626
|
this.reconsumeToken(token);
|
|
1627
1627
|
var value = this.consumeComponentValue();
|
|
1628
1628
|
do {
|
|
1629
1629
|
token = this.consumeToken();
|
|
1630
|
-
} while (token.type === 31 /* WHITESPACE_TOKEN */);
|
|
1631
|
-
if (token.type === 32 /* EOF_TOKEN */) {
|
|
1630
|
+
} while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */);
|
|
1631
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1632
1632
|
return value;
|
|
1633
1633
|
}
|
|
1634
1634
|
throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
|
|
@@ -1637,7 +1637,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1637
1637
|
var values = [];
|
|
1638
1638
|
while (true) {
|
|
1639
1639
|
var value = this.consumeComponentValue();
|
|
1640
|
-
if (value.type === 32 /* EOF_TOKEN */) {
|
|
1640
|
+
if (value.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1641
1641
|
return values;
|
|
1642
1642
|
}
|
|
1643
1643
|
values.push(value);
|
|
@@ -1647,11 +1647,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1647
1647
|
Parser.prototype.consumeComponentValue = function () {
|
|
1648
1648
|
var token = this.consumeToken();
|
|
1649
1649
|
switch (token.type) {
|
|
1650
|
-
case 11 /* LEFT_CURLY_BRACKET_TOKEN */:
|
|
1651
|
-
case 28 /* LEFT_SQUARE_BRACKET_TOKEN */:
|
|
1652
|
-
case 2 /* LEFT_PARENTHESIS_TOKEN */:
|
|
1650
|
+
case 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */:
|
|
1651
|
+
case 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */:
|
|
1652
|
+
case 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */:
|
|
1653
1653
|
return this.consumeSimpleBlock(token.type);
|
|
1654
|
-
case 19 /* FUNCTION_TOKEN */:
|
|
1654
|
+
case 19 /* TokenType.FUNCTION_TOKEN */:
|
|
1655
1655
|
return this.consumeFunction(token);
|
|
1656
1656
|
}
|
|
1657
1657
|
return token;
|
|
@@ -1660,7 +1660,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1660
1660
|
var block = { type: type, values: [] };
|
|
1661
1661
|
var token = this.consumeToken();
|
|
1662
1662
|
while (true) {
|
|
1663
|
-
if (token.type === 32 /* EOF_TOKEN */ || isEndingTokenFor(token, type)) {
|
|
1663
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */ || isEndingTokenFor(token, type)) {
|
|
1664
1664
|
return block;
|
|
1665
1665
|
}
|
|
1666
1666
|
this.reconsumeToken(token);
|
|
@@ -1672,11 +1672,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1672
1672
|
var cssFunction = {
|
|
1673
1673
|
name: functionToken.value,
|
|
1674
1674
|
values: [],
|
|
1675
|
-
type: 18 /* FUNCTION */
|
|
1675
|
+
type: 18 /* TokenType.FUNCTION */
|
|
1676
1676
|
};
|
|
1677
1677
|
while (true) {
|
|
1678
1678
|
var token = this.consumeToken();
|
|
1679
|
-
if (token.type === 32 /* EOF_TOKEN */ || token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */) {
|
|
1679
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */ || token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */) {
|
|
1680
1680
|
return cssFunction;
|
|
1681
1681
|
}
|
|
1682
1682
|
this.reconsumeToken(token);
|
|
@@ -1692,22 +1692,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1692
1692
|
};
|
|
1693
1693
|
return Parser;
|
|
1694
1694
|
}());
|
|
1695
|
-
var isDimensionToken = function (token) { return token.type === 15 /* DIMENSION_TOKEN */; };
|
|
1696
|
-
var isNumberToken = function (token) { return token.type === 17 /* NUMBER_TOKEN */; };
|
|
1697
|
-
var isIdentToken = function (token) { return token.type === 20 /* IDENT_TOKEN */; };
|
|
1698
|
-
var isStringToken = function (token) { return token.type === 0 /* STRING_TOKEN */; };
|
|
1695
|
+
var isDimensionToken = function (token) { return token.type === 15 /* TokenType.DIMENSION_TOKEN */; };
|
|
1696
|
+
var isNumberToken = function (token) { return token.type === 17 /* TokenType.NUMBER_TOKEN */; };
|
|
1697
|
+
var isIdentToken = function (token) { return token.type === 20 /* TokenType.IDENT_TOKEN */; };
|
|
1698
|
+
var isStringToken = function (token) { return token.type === 0 /* TokenType.STRING_TOKEN */; };
|
|
1699
1699
|
var isIdentWithValue = function (token, value) {
|
|
1700
1700
|
return isIdentToken(token) && token.value === value;
|
|
1701
1701
|
};
|
|
1702
|
-
var nonWhiteSpace = function (token) { return token.type !== 31 /* WHITESPACE_TOKEN */; };
|
|
1702
|
+
var nonWhiteSpace = function (token) { return token.type !== 31 /* TokenType.WHITESPACE_TOKEN */; };
|
|
1703
1703
|
var nonFunctionArgSeparator = function (token) {
|
|
1704
|
-
return token.type !== 31 /* WHITESPACE_TOKEN */ && token.type !== 4 /* COMMA_TOKEN */;
|
|
1704
|
+
return token.type !== 31 /* TokenType.WHITESPACE_TOKEN */ && token.type !== 4 /* TokenType.COMMA_TOKEN */;
|
|
1705
1705
|
};
|
|
1706
1706
|
var parseFunctionArgs = function (tokens) {
|
|
1707
1707
|
var args = [];
|
|
1708
1708
|
var arg = [];
|
|
1709
1709
|
tokens.forEach(function (token) {
|
|
1710
|
-
if (token.type === 4 /* COMMA_TOKEN */) {
|
|
1710
|
+
if (token.type === 4 /* TokenType.COMMA_TOKEN */) {
|
|
1711
1711
|
if (arg.length === 0) {
|
|
1712
1712
|
throw new Error("Error parsing function args, zero tokens for arg");
|
|
1713
1713
|
}
|
|
@@ -1715,7 +1715,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1715
1715
|
arg = [];
|
|
1716
1716
|
return;
|
|
1717
1717
|
}
|
|
1718
|
-
if (token.type !== 31 /* WHITESPACE_TOKEN */) {
|
|
1718
|
+
if (token.type !== 31 /* TokenType.WHITESPACE_TOKEN */) {
|
|
1719
1719
|
arg.push(token);
|
|
1720
1720
|
}
|
|
1721
1721
|
});
|
|
@@ -1725,37 +1725,37 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1725
1725
|
return args;
|
|
1726
1726
|
};
|
|
1727
1727
|
var isEndingTokenFor = function (token, type) {
|
|
1728
|
-
if (type === 11 /* LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* RIGHT_CURLY_BRACKET_TOKEN */) {
|
|
1728
|
+
if (type === 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */) {
|
|
1729
1729
|
return true;
|
|
1730
1730
|
}
|
|
1731
|
-
if (type === 28 /* LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* RIGHT_SQUARE_BRACKET_TOKEN */) {
|
|
1731
|
+
if (type === 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */) {
|
|
1732
1732
|
return true;
|
|
1733
1733
|
}
|
|
1734
|
-
return type === 2 /* LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */;
|
|
1734
|
+
return type === 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */;
|
|
1735
1735
|
};
|
|
1736
1736
|
|
|
1737
1737
|
var isLength = function (token) {
|
|
1738
|
-
return token.type === 17 /* NUMBER_TOKEN */ || token.type === 15 /* DIMENSION_TOKEN */;
|
|
1738
|
+
return token.type === 17 /* TokenType.NUMBER_TOKEN */ || token.type === 15 /* TokenType.DIMENSION_TOKEN */;
|
|
1739
1739
|
};
|
|
1740
1740
|
|
|
1741
1741
|
var isLengthPercentage = function (token) {
|
|
1742
|
-
return token.type === 16 /* PERCENTAGE_TOKEN */ || isLength(token);
|
|
1742
|
+
return token.type === 16 /* TokenType.PERCENTAGE_TOKEN */ || isLength(token);
|
|
1743
1743
|
};
|
|
1744
1744
|
var parseLengthPercentageTuple = function (tokens) {
|
|
1745
1745
|
return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]];
|
|
1746
1746
|
};
|
|
1747
1747
|
var ZERO_LENGTH = {
|
|
1748
|
-
type: 17 /* NUMBER_TOKEN */,
|
|
1748
|
+
type: 17 /* TokenType.NUMBER_TOKEN */,
|
|
1749
1749
|
number: 0,
|
|
1750
1750
|
flags: FLAG_INTEGER
|
|
1751
1751
|
};
|
|
1752
1752
|
var FIFTY_PERCENT = {
|
|
1753
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
1753
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
1754
1754
|
number: 50,
|
|
1755
1755
|
flags: FLAG_INTEGER
|
|
1756
1756
|
};
|
|
1757
1757
|
var HUNDRED_PERCENT = {
|
|
1758
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
1758
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
1759
1759
|
number: 100,
|
|
1760
1760
|
flags: FLAG_INTEGER
|
|
1761
1761
|
};
|
|
@@ -1764,7 +1764,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1764
1764
|
return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)];
|
|
1765
1765
|
};
|
|
1766
1766
|
var getAbsoluteValue = function (token, parent) {
|
|
1767
|
-
if (token.type === 16 /* PERCENTAGE_TOKEN */) {
|
|
1767
|
+
if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
1768
1768
|
return (token.number / 100) * parent;
|
|
1769
1769
|
}
|
|
1770
1770
|
if (isDimensionToken(token)) {
|
|
@@ -1787,7 +1787,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1787
1787
|
var angle = {
|
|
1788
1788
|
name: 'angle',
|
|
1789
1789
|
parse: function (_context, value) {
|
|
1790
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
1790
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
1791
1791
|
switch (value.unit) {
|
|
1792
1792
|
case DEG:
|
|
1793
1793
|
return (Math.PI * value.number) / 180;
|
|
@@ -1803,7 +1803,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1803
1803
|
}
|
|
1804
1804
|
};
|
|
1805
1805
|
var isAngle = function (value) {
|
|
1806
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
1806
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
1807
1807
|
if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) {
|
|
1808
1808
|
return true;
|
|
1809
1809
|
}
|
|
@@ -1853,87 +1853,154 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1853
1853
|
};
|
|
1854
1854
|
var deg = function (deg) { return (Math.PI * deg) / 180; };
|
|
1855
1855
|
|
|
1856
|
-
var color$1 = {
|
|
1857
|
-
name: 'color',
|
|
1858
|
-
parse: function (context, value) {
|
|
1859
|
-
if (value.type === 18 /* FUNCTION */) {
|
|
1860
|
-
var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
|
|
1861
|
-
if (typeof colorFunction === 'undefined') {
|
|
1862
|
-
throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\"");
|
|
1863
|
-
}
|
|
1864
|
-
return colorFunction(context, value.values);
|
|
1865
|
-
}
|
|
1866
|
-
if (value.type === 5 /* HASH_TOKEN */) {
|
|
1867
|
-
if (value.value.length === 3) {
|
|
1868
|
-
var r = value.value.substring(0, 1);
|
|
1869
|
-
var g = value.value.substring(1, 2);
|
|
1870
|
-
var b = value.value.substring(2, 3);
|
|
1871
|
-
return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1);
|
|
1872
|
-
}
|
|
1873
|
-
if (value.value.length === 4) {
|
|
1874
|
-
var r = value.value.substring(0, 1);
|
|
1875
|
-
var g = value.value.substring(1, 2);
|
|
1876
|
-
var b = value.value.substring(2, 3);
|
|
1877
|
-
var a = value.value.substring(3, 4);
|
|
1878
|
-
return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255);
|
|
1879
|
-
}
|
|
1880
|
-
if (value.value.length === 6) {
|
|
1881
|
-
var r = value.value.substring(0, 2);
|
|
1882
|
-
var g = value.value.substring(2, 4);
|
|
1883
|
-
var b = value.value.substring(4, 6);
|
|
1884
|
-
return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1);
|
|
1885
|
-
}
|
|
1886
|
-
if (value.value.length === 8) {
|
|
1887
|
-
var r = value.value.substring(0, 2);
|
|
1888
|
-
var g = value.value.substring(2, 4);
|
|
1889
|
-
var b = value.value.substring(4, 6);
|
|
1890
|
-
var a = value.value.substring(6, 8);
|
|
1891
|
-
return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255);
|
|
1892
|
-
}
|
|
1893
|
-
}
|
|
1894
|
-
if (value.type === 20 /* IDENT_TOKEN */) {
|
|
1895
|
-
var namedColor = COLORS[value.value.toUpperCase()];
|
|
1896
|
-
if (typeof namedColor !== 'undefined') {
|
|
1897
|
-
return namedColor;
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1900
|
-
return COLORS.TRANSPARENT;
|
|
1901
|
-
}
|
|
1902
|
-
};
|
|
1903
1856
|
var isTransparent = function (color) { return (0xff & color) === 0; };
|
|
1904
1857
|
var asString = function (color) {
|
|
1905
1858
|
var alpha = 0xff & color;
|
|
1906
1859
|
var blue = 0xff & (color >> 8);
|
|
1907
1860
|
var green = 0xff & (color >> 16);
|
|
1908
1861
|
var red = 0xff & (color >> 24);
|
|
1909
|
-
return alpha < 255 ? "rgba("
|
|
1862
|
+
return alpha < 255 ? "rgba(".concat(red, ",").concat(green, ",").concat(blue, ",").concat(alpha / 255, ")") : "rgb(".concat(red, ",").concat(green, ",").concat(blue, ")");
|
|
1910
1863
|
};
|
|
1911
1864
|
var pack = function (r, g, b, a) {
|
|
1912
1865
|
return ((r << 24) | (g << 16) | (b << 8) | (Math.round(a * 255) << 0)) >>> 0;
|
|
1913
1866
|
};
|
|
1914
1867
|
var getTokenColorValue = function (token, i) {
|
|
1915
|
-
if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
1868
|
+
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
1916
1869
|
return token.number;
|
|
1917
1870
|
}
|
|
1918
|
-
if (token.type === 16 /* PERCENTAGE_TOKEN */) {
|
|
1871
|
+
if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
1919
1872
|
var max = i === 3 ? 1 : 255;
|
|
1920
1873
|
return i === 3 ? (token.number / 100) * max : Math.round((token.number / 100) * max);
|
|
1921
1874
|
}
|
|
1922
1875
|
return 0;
|
|
1923
1876
|
};
|
|
1924
|
-
var
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1877
|
+
var isRelativeTransform = function (tokens) {
|
|
1878
|
+
return (tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ ? tokens[0].value : 'unknown') === 'from';
|
|
1879
|
+
};
|
|
1880
|
+
var clamp = function (value, min, max) {
|
|
1881
|
+
return Math.min(Math.max(value, min), max);
|
|
1882
|
+
};
|
|
1883
|
+
var multiplyMatrices = function (A, B) {
|
|
1884
|
+
return [
|
|
1885
|
+
A[0] * B[0] + A[1] * B[1] + A[2] * B[2],
|
|
1886
|
+
A[3] * B[0] + A[4] * B[1] + A[5] * B[2],
|
|
1887
|
+
A[6] * B[0] + A[7] * B[1] + A[8] * B[2]
|
|
1888
|
+
];
|
|
1889
|
+
};
|
|
1890
|
+
var packSrgb = function (args) {
|
|
1891
|
+
return pack(clamp(Math.round(args[0] * 255), 0, 255), clamp(Math.round(args[1] * 255), 0, 255), clamp(Math.round(args[2] * 255), 0, 255), clamp(args[3], 0, 1));
|
|
1892
|
+
};
|
|
1893
|
+
var packSrgbLinear = function (_a) {
|
|
1894
|
+
var r = _a[0], g = _a[1], b = _a[2], a = _a[3];
|
|
1895
|
+
var rgb = srgbLinear2rgb([r, g, b]);
|
|
1896
|
+
return pack(clamp(Math.round(rgb[0] * 255), 0, 255), clamp(Math.round(rgb[1] * 255), 0, 255), clamp(Math.round(rgb[2] * 255), 0, 255), a);
|
|
1897
|
+
};
|
|
1898
|
+
var packXYZ = function (args) {
|
|
1899
|
+
var srgb_linear = xyz2rgbLinear([args[0], args[1], args[2]]);
|
|
1900
|
+
return packSrgbLinear([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
|
|
1901
|
+
};
|
|
1902
|
+
var packLab = function (_context, args) {
|
|
1903
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1904
|
+
throw new Error('Relative color not supported for lab()');
|
|
1905
|
+
}
|
|
1906
|
+
var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(lab2xyz([l, a, b])));
|
|
1907
|
+
return pack(clamp(Math.round(rgb[0] * 255), 0, 255), clamp(Math.round(rgb[1] * 255), 0, 255), clamp(Math.round(rgb[2] * 255), 0, 255), alpha);
|
|
1908
|
+
};
|
|
1909
|
+
var packOkLab = function (_context, args) {
|
|
1910
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1911
|
+
throw new Error('Relative color not supported for oklab()');
|
|
1912
|
+
}
|
|
1913
|
+
var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(oklab2xyz([l, a, b])));
|
|
1914
|
+
return pack(clamp(Math.round(rgb[0] * 255), 0, 255), clamp(Math.round(rgb[1] * 255), 0, 255), clamp(Math.round(rgb[2] * 255), 0, 255), alpha);
|
|
1915
|
+
};
|
|
1916
|
+
var packOkLch = function (_context, args) {
|
|
1917
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1918
|
+
throw new Error('Relative color not supported for oklch()');
|
|
1919
|
+
}
|
|
1920
|
+
var _a = extractOkLchComponents(args), l = _a[0], c = _a[1], h = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(oklab2xyz(lch2lab([l, c, h]))));
|
|
1921
|
+
return pack(clamp(Math.round(rgb[0] * 255), 0, 255), clamp(Math.round(rgb[1] * 255), 0, 255), clamp(Math.round(rgb[2] * 255), 0, 255), alpha);
|
|
1922
|
+
};
|
|
1923
|
+
var packLch = function (_context, args) {
|
|
1924
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1925
|
+
throw new Error('Relative color not supported for lch()');
|
|
1926
|
+
}
|
|
1927
|
+
var _a = extractLchComponents(args), l = _a[0], c = _a[1], h = _a[2], a = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(lab2xyz(lch2lab([l, c, h]))));
|
|
1928
|
+
return pack(clamp(Math.round(rgb[0] * 255), 0, 255), clamp(Math.round(rgb[1] * 255), 0, 255), clamp(Math.round(rgb[2] * 255), 0, 255), a);
|
|
1929
|
+
};
|
|
1930
|
+
var extractHslComponents = function (context, args) {
|
|
1931
|
+
var tokens = args.filter(nonFunctionArgSeparator), hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3], h = (hue.type === 17 /* TokenType.NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2), s = isLengthPercentage(saturation) ? saturation.number / 100 : 0, l = isLengthPercentage(lightness) ? lightness.number / 100 : 0, a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1;
|
|
1932
|
+
return [h, s, l, a];
|
|
1933
|
+
};
|
|
1934
|
+
var packHSL = function (context, args) {
|
|
1935
|
+
if (isRelativeTransform(args)) {
|
|
1936
|
+
throw new Error('Relative color not supported for hsl()');
|
|
1937
|
+
}
|
|
1938
|
+
var _a = extractHslComponents(context, args), h = _a[0], s = _a[1], l = _a[2], a = _a[3], rgb = hsl2rgb([h, s, l]);
|
|
1939
|
+
return pack(rgb[0] * 255, rgb[1] * 255, rgb[2] * 255, s === 0 ? 1 : a);
|
|
1940
|
+
};
|
|
1941
|
+
var extractLchComponents = function (args) {
|
|
1942
|
+
var tokens = args.filter(nonFunctionArgSeparator), l = isLengthPercentage(tokens[0]) ? tokens[0].number : 0, c = isLengthPercentage(tokens[1]) ? tokens[1].number : 0, h = isNumberToken(tokens[2]) || isDimensionToken(tokens[2]) ? tokens[2].number : 0, a = typeof tokens[4] !== 'undefined' && isLengthPercentage(tokens[4]) ? getAbsoluteValue(tokens[4], 1) : 1;
|
|
1943
|
+
return [l, c, h, a];
|
|
1944
|
+
};
|
|
1945
|
+
var extractLabComponents = function (args) {
|
|
1946
|
+
var tokens = args.filter(nonFunctionArgSeparator),
|
|
1947
|
+
// eslint-disable-next-line prettier/prettier
|
|
1948
|
+
l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1949
|
+
? tokens[0].number / 100
|
|
1950
|
+
: isNumberToken(tokens[0])
|
|
1951
|
+
? tokens[0].number
|
|
1952
|
+
: 0,
|
|
1953
|
+
// eslint-disable-next-line prettier/prettier
|
|
1954
|
+
a = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1955
|
+
? tokens[1].number / 100
|
|
1956
|
+
: isNumberToken(tokens[1])
|
|
1957
|
+
? tokens[1].number
|
|
1958
|
+
: 0, b = isNumberToken(tokens[2]) || isDimensionToken(tokens[2]) ? tokens[2].number : 0, alpha = typeof tokens[4] !== 'undefined' && isLengthPercentage(tokens[4]) ? getAbsoluteValue(tokens[4], 1) : 1;
|
|
1959
|
+
return [l, a, b, alpha];
|
|
1960
|
+
};
|
|
1961
|
+
var extractOkLchComponents = function (args) {
|
|
1962
|
+
var tokens = args.filter(nonFunctionArgSeparator),
|
|
1963
|
+
// eslint-disable-next-line prettier/prettier
|
|
1964
|
+
l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1965
|
+
? tokens[0].number / 100
|
|
1966
|
+
: isNumberToken(tokens[0])
|
|
1967
|
+
? tokens[0].number
|
|
1968
|
+
: 0,
|
|
1969
|
+
// eslint-disable-next-line prettier/prettier
|
|
1970
|
+
c = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1971
|
+
? tokens[1].number / 100
|
|
1972
|
+
: isNumberToken(tokens[1])
|
|
1973
|
+
? tokens[1].number
|
|
1974
|
+
: 0, h = isNumberToken(tokens[2]) || isDimensionToken(tokens[2]) ? tokens[2].number : 0, a = typeof tokens[4] !== 'undefined' && isLengthPercentage(tokens[4]) ? getAbsoluteValue(tokens[4], 1) : 1;
|
|
1975
|
+
return [l, c, h, a];
|
|
1976
|
+
};
|
|
1977
|
+
/**
|
|
1978
|
+
* Convert D65 to D50
|
|
1979
|
+
*
|
|
1980
|
+
* @param xyz
|
|
1981
|
+
*/
|
|
1982
|
+
var d65toD50 = function (xyz) {
|
|
1983
|
+
return multiplyMatrices(
|
|
1984
|
+
// eslint-disable-next-line prettier/prettier
|
|
1985
|
+
[
|
|
1986
|
+
1.0479297925449969, 0.022946870601609652, -0.05019226628920524, 0.02962780877005599, 0.9904344267538799,
|
|
1987
|
+
-0.017073799063418826, -0.009243040646204504, 0.015055191490298152, 0.7518742814281371
|
|
1988
|
+
], xyz);
|
|
1935
1989
|
};
|
|
1936
|
-
|
|
1990
|
+
/**
|
|
1991
|
+
* Convert D50 to D65
|
|
1992
|
+
*
|
|
1993
|
+
* @param xyz
|
|
1994
|
+
*/
|
|
1995
|
+
var d50toD65 = function (xyz) {
|
|
1996
|
+
return multiplyMatrices(
|
|
1997
|
+
// eslint-disable-next-line prettier/prettier
|
|
1998
|
+
[
|
|
1999
|
+
0.955473421488075, -0.02309845494876471, 0.06325924320057072, -0.0283697093338637, 1.0099953980813041,
|
|
2000
|
+
0.021041441191917323, 0.012314014864481998, -0.020507649298898964, 1.330365926242124
|
|
2001
|
+
], xyz);
|
|
2002
|
+
};
|
|
2003
|
+
var hue2rgb = function (t1, t2, hue) {
|
|
1937
2004
|
if (hue < 0) {
|
|
1938
2005
|
hue += 1;
|
|
1939
2006
|
}
|
|
@@ -1952,29 +2019,783 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1952
2019
|
else {
|
|
1953
2020
|
return t1;
|
|
1954
2021
|
}
|
|
1955
|
-
}
|
|
1956
|
-
var
|
|
1957
|
-
var
|
|
1958
|
-
var hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3];
|
|
1959
|
-
var h = (hue.type === 17 /* NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2);
|
|
1960
|
-
var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0;
|
|
1961
|
-
var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0;
|
|
1962
|
-
var a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1;
|
|
2022
|
+
};
|
|
2023
|
+
var hsl2rgb = function (_a) {
|
|
2024
|
+
var h = _a[0], s = _a[1], l = _a[2];
|
|
1963
2025
|
if (s === 0) {
|
|
1964
|
-
return
|
|
2026
|
+
return [l * 255, l * 255, l * 255];
|
|
2027
|
+
}
|
|
2028
|
+
var t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s, t1 = l * 2 - t2, r = hue2rgb(t1, t2, h + 1 / 3), g = hue2rgb(t1, t2, h), b = hue2rgb(t1, t2, h - 1 / 3);
|
|
2029
|
+
return [r, g, b];
|
|
2030
|
+
};
|
|
2031
|
+
/**
|
|
2032
|
+
* Convert lch to OKLab
|
|
2033
|
+
*
|
|
2034
|
+
* @param l
|
|
2035
|
+
* @param c
|
|
2036
|
+
* @param h
|
|
2037
|
+
*/
|
|
2038
|
+
var lch2lab = function (_a) {
|
|
2039
|
+
var l = _a[0], c = _a[1], h = _a[2];
|
|
2040
|
+
if (c < 0) {
|
|
2041
|
+
c = 0;
|
|
2042
|
+
}
|
|
2043
|
+
if (isNaN(h)) {
|
|
2044
|
+
h = 0;
|
|
2045
|
+
}
|
|
2046
|
+
return [l, c * Math.cos((h * Math.PI) / 180), c * Math.sin((h * Math.PI) / 180)];
|
|
2047
|
+
};
|
|
2048
|
+
/**
|
|
2049
|
+
* Convert OKLab to XYZ relative to D65
|
|
2050
|
+
*
|
|
2051
|
+
* @param lab
|
|
2052
|
+
*/
|
|
2053
|
+
var oklab2xyz = function (lab) {
|
|
2054
|
+
var LMSg = multiplyMatrices(
|
|
2055
|
+
// eslint-disable-next-line prettier/prettier
|
|
2056
|
+
[
|
|
2057
|
+
1, 0.3963377773761749, 0.2158037573099136, 1, -0.1055613458156586, -0.0638541728258133, 1,
|
|
2058
|
+
-0.0894841775298119, -1.2914855480194092
|
|
2059
|
+
], lab), LMS = LMSg.map(function (val) { return Math.pow(val, 3); });
|
|
2060
|
+
return multiplyMatrices(
|
|
2061
|
+
// eslint-disable-next-line prettier/prettier
|
|
2062
|
+
[
|
|
2063
|
+
1.2268798758459243, -0.5578149944602171, 0.2813910456659647, -0.0405757452148008, 1.112286803280317,
|
|
2064
|
+
-0.0717110580655164, -0.0763729366746601, -0.4214933324022432, 1.5869240198367816
|
|
2065
|
+
], LMS);
|
|
2066
|
+
};
|
|
2067
|
+
/**
|
|
2068
|
+
* Convert Lab to D50-adapted XYZ
|
|
2069
|
+
*
|
|
2070
|
+
* @param lab
|
|
2071
|
+
*/
|
|
2072
|
+
var lab2xyz = function (lab) {
|
|
2073
|
+
var fy = (lab[0] + 16) / 116, fx = lab[1] / 500 + fy, fz = fy - lab[2] / 200, k = 24389 / 27, e = 24 / 116, xyz = [
|
|
2074
|
+
((fx > e ? Math.pow(fx, 3) : (116 * fx - 16) / k) * 0.3457) / 0.3585,
|
|
2075
|
+
lab[0] > 8 ? Math.pow(fy, 3) : lab[0] / k,
|
|
2076
|
+
((fz > e ? Math.pow(fz, 3) : (116 * fz - 16) / k) * (1.0 - 0.3457 - 0.3585)) / 0.3585
|
|
2077
|
+
];
|
|
2078
|
+
return d50toD65([xyz[0], xyz[1], xyz[2]]);
|
|
2079
|
+
};
|
|
2080
|
+
/**
|
|
2081
|
+
* Convert RGB to XYZ
|
|
2082
|
+
*
|
|
2083
|
+
* @param _context
|
|
2084
|
+
* @param args
|
|
2085
|
+
*/
|
|
2086
|
+
var rgbToXyz = function (_context, args) {
|
|
2087
|
+
var tokens = args.filter(nonFunctionArgSeparator);
|
|
2088
|
+
if (tokens.length === 3) {
|
|
2089
|
+
var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2], rgb_linear = rgb2rgbLinear([r / 255, g / 255, b / 255]), _b = rgbLinear2xyz([rgb_linear[0], rgb_linear[1], rgb_linear[2]]), x = _b[0], y = _b[1], z = _b[2];
|
|
2090
|
+
return [x, y, z, 1];
|
|
2091
|
+
}
|
|
2092
|
+
if (tokens.length === 4) {
|
|
2093
|
+
var _c = tokens.map(getTokenColorValue), r = _c[0], g = _c[1], b = _c[2], a = _c[3], rgb_linear = rgb2rgbLinear([r / 255, g / 255, b / 255]), _d = rgbLinear2xyz([rgb_linear[0], rgb_linear[1], rgb_linear[2]]), x = _d[0], y = _d[1], z = _d[2];
|
|
2094
|
+
return [x, y, z, a];
|
|
2095
|
+
}
|
|
2096
|
+
return [0, 0, 0, 1];
|
|
2097
|
+
};
|
|
2098
|
+
/**
|
|
2099
|
+
* HSL to XYZ
|
|
2100
|
+
*
|
|
2101
|
+
* @param context
|
|
2102
|
+
* @param args
|
|
2103
|
+
*/
|
|
2104
|
+
var hslToXyz = function (context, args) {
|
|
2105
|
+
var _a = extractHslComponents(context, args), h = _a[0], s = _a[1], l = _a[2], a = _a[3], rgb_linear = rgb2rgbLinear(hsl2rgb([h, s, l])), _b = rgbLinear2xyz([rgb_linear[0], rgb_linear[1], rgb_linear[2]]), x = _b[0], y = _b[1], z = _b[2];
|
|
2106
|
+
return [x, y, z, a];
|
|
2107
|
+
};
|
|
2108
|
+
/**
|
|
2109
|
+
* LAB to XYZ
|
|
2110
|
+
*
|
|
2111
|
+
* @param _context
|
|
2112
|
+
* @param args
|
|
2113
|
+
*/
|
|
2114
|
+
var labToXyz = function (_context, args) {
|
|
2115
|
+
var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], _b = lab2xyz([l, a, b]), x = _b[0], y = _b[1], z = _b[2];
|
|
2116
|
+
return [x, y, z, alpha];
|
|
2117
|
+
};
|
|
2118
|
+
/**
|
|
2119
|
+
* LCH to XYZ
|
|
2120
|
+
*
|
|
2121
|
+
* @param _context
|
|
2122
|
+
* @param args
|
|
2123
|
+
*/
|
|
2124
|
+
var lchToXyz = function (_context, args) {
|
|
2125
|
+
var _a = extractLchComponents(args), l = _a[0], c = _a[1], h = _a[2], alpha = _a[3], _b = lab2xyz(lch2lab([l, c, h])), x = _b[0], y = _b[1], z = _b[2];
|
|
2126
|
+
return [x, y, z, alpha];
|
|
2127
|
+
};
|
|
2128
|
+
/**
|
|
2129
|
+
* OKLch to XYZ
|
|
2130
|
+
*
|
|
2131
|
+
* @param _context
|
|
2132
|
+
* @param args
|
|
2133
|
+
*/
|
|
2134
|
+
var oklchToXyz = function (_context, args) {
|
|
2135
|
+
var _a = extractOkLchComponents(args), l = _a[0], c = _a[1], h = _a[2], alpha = _a[3], _b = oklab2xyz(lch2lab([l, c, h])), x = _b[0], y = _b[1], z = _b[2];
|
|
2136
|
+
return [x, y, z, alpha];
|
|
2137
|
+
};
|
|
2138
|
+
/**
|
|
2139
|
+
* OKLab to XYZ
|
|
2140
|
+
*
|
|
2141
|
+
* @param _context
|
|
2142
|
+
* @param args
|
|
2143
|
+
*/
|
|
2144
|
+
var oklabToXyz = function (_context, args) {
|
|
2145
|
+
var _a = extractLabComponents(args), l = _a[0], c = _a[1], h = _a[2], alpha = _a[3], _b = oklab2xyz([l, c, h]), x = _b[0], y = _b[1], z = _b[2];
|
|
2146
|
+
return [x, y, z, alpha];
|
|
2147
|
+
};
|
|
2148
|
+
/**
|
|
2149
|
+
* XYZ-50 to XYZ
|
|
2150
|
+
*
|
|
2151
|
+
* @param args
|
|
2152
|
+
*/
|
|
2153
|
+
var xyz50ToXYZ = function (args) {
|
|
2154
|
+
return d50toD65([args[0], args[1], args[2]]);
|
|
2155
|
+
};
|
|
2156
|
+
/**
|
|
2157
|
+
* Does nothing, required for SUPPORTED_COLOR_SPACES_FROM_XYZ in the _color() function
|
|
2158
|
+
*
|
|
2159
|
+
* @param args
|
|
2160
|
+
*/
|
|
2161
|
+
var xyzFromXYZ = function (args) {
|
|
2162
|
+
return args;
|
|
2163
|
+
};
|
|
2164
|
+
/**
|
|
2165
|
+
* XYZ-65 to XYZ-50
|
|
2166
|
+
*
|
|
2167
|
+
* @param args
|
|
2168
|
+
*/
|
|
2169
|
+
var xyz50FromXYZ = function (args) {
|
|
2170
|
+
var _a = d65toD50([args[0], args[2], args[3]]), x = _a[0], y = _a[1], z = _a[2];
|
|
2171
|
+
return [x, y, z, args[3]];
|
|
2172
|
+
};
|
|
2173
|
+
/**
|
|
2174
|
+
* Convert XYZ to SRGB and Pack
|
|
2175
|
+
*
|
|
2176
|
+
* @param args
|
|
2177
|
+
*/
|
|
2178
|
+
var convertXyz = function (args) {
|
|
2179
|
+
return packXYZ([args[0], args[1], args[2], args[3]]);
|
|
2180
|
+
};
|
|
2181
|
+
/**
|
|
2182
|
+
* Convert XYZ-50 to SRGB and Pack
|
|
2183
|
+
*
|
|
2184
|
+
* @param args
|
|
2185
|
+
*/
|
|
2186
|
+
var convertXyz50 = function (args) {
|
|
2187
|
+
var xyz = xyz50ToXYZ([args[0], args[1], args[2]]);
|
|
2188
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2189
|
+
};
|
|
2190
|
+
|
|
2191
|
+
/**
|
|
2192
|
+
* SRGB related functions
|
|
2193
|
+
*/
|
|
2194
|
+
/**
|
|
2195
|
+
* Convert XYZ to linear-light sRGB
|
|
2196
|
+
*
|
|
2197
|
+
* @param xyz
|
|
2198
|
+
*/
|
|
2199
|
+
var xyz2rgbLinear = function (xyz) {
|
|
2200
|
+
return multiplyMatrices(
|
|
2201
|
+
// eslint-disable-next-line prettier/prettier
|
|
2202
|
+
[
|
|
2203
|
+
3.2409699419045226, -1.537383177570094, -0.4986107602930034, -0.9692436362808796, 1.8759675015077202,
|
|
2204
|
+
0.04155505740717559, 0.05563007969699366, -0.20397695888897652, 1.0569715142428786
|
|
2205
|
+
], xyz);
|
|
2206
|
+
};
|
|
2207
|
+
/**
|
|
2208
|
+
* Convert XYZ to linear-light sRGB
|
|
2209
|
+
*
|
|
2210
|
+
* @param xyz
|
|
2211
|
+
*/
|
|
2212
|
+
var rgbLinear2xyz = function (xyz) {
|
|
2213
|
+
return multiplyMatrices(
|
|
2214
|
+
// eslint-disable-next-line prettier/prettier
|
|
2215
|
+
[
|
|
2216
|
+
0.41239079926595934, 0.357584339383878, 0.1804807884018343, 0.21263900587151027, 0.715168678767756,
|
|
2217
|
+
0.07219231536073371, 0.01933081871559182, 0.11919477979462598, 0.9505321522496607
|
|
2218
|
+
], xyz);
|
|
2219
|
+
};
|
|
2220
|
+
/**
|
|
2221
|
+
* Convert sRGB to RGB
|
|
2222
|
+
*
|
|
2223
|
+
* @param rgb
|
|
2224
|
+
*/
|
|
2225
|
+
var srgbLinear2rgb = function (rgb) {
|
|
2226
|
+
return rgb.map(function (c) {
|
|
2227
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2228
|
+
// eslint-disable-next-line prettier/prettier
|
|
2229
|
+
return abs > 0.0031308 ? sign * (1.055 * Math.pow(abs, (1 / 2.4)) - 0.055) : 12.92 * c;
|
|
2230
|
+
});
|
|
2231
|
+
};
|
|
2232
|
+
/**
|
|
2233
|
+
* Convert RGB to sRGB
|
|
2234
|
+
*
|
|
2235
|
+
* @param rgb
|
|
2236
|
+
*/
|
|
2237
|
+
var rgb2rgbLinear = function (rgb) {
|
|
2238
|
+
return rgb.map(function (c) {
|
|
2239
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2240
|
+
// eslint-disable-next-line prettier/prettier
|
|
2241
|
+
return abs <= 0.04045 ? c / 12.92 : sign * Math.pow(((abs + 0.055) / 1.055), 2.4);
|
|
2242
|
+
});
|
|
2243
|
+
};
|
|
2244
|
+
/**
|
|
2245
|
+
* XYZ to SRGB
|
|
2246
|
+
*
|
|
2247
|
+
* @param args
|
|
2248
|
+
*/
|
|
2249
|
+
var srgbFromXYZ = function (args) {
|
|
2250
|
+
var _a = srgbLinear2rgb(xyz2rgbLinear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2251
|
+
return [r, g, b, args[3]];
|
|
2252
|
+
};
|
|
2253
|
+
/**
|
|
2254
|
+
* XYZ to SRGB-Linear
|
|
2255
|
+
* @param args
|
|
2256
|
+
*/
|
|
2257
|
+
var srgbLinearFromXYZ = function (args) {
|
|
2258
|
+
var _a = xyz2rgbLinear([args[0], args[1], args[2]]), r = _a[0], g = _a[1], b = _a[2];
|
|
2259
|
+
return [
|
|
2260
|
+
clamp(Math.round(r * 255), 0, 255),
|
|
2261
|
+
clamp(Math.round(g * 255), 0, 255),
|
|
2262
|
+
clamp(Math.round(b * 255), 0, 255),
|
|
2263
|
+
args[3]
|
|
2264
|
+
];
|
|
2265
|
+
};
|
|
2266
|
+
|
|
2267
|
+
/**
|
|
2268
|
+
* Display-P3 related functions
|
|
2269
|
+
*/
|
|
2270
|
+
/**
|
|
2271
|
+
* Convert P3 Linear to xyz
|
|
2272
|
+
*
|
|
2273
|
+
* @param p3l
|
|
2274
|
+
*/
|
|
2275
|
+
var p3LinearToXyz = function (p3l) {
|
|
2276
|
+
return multiplyMatrices(
|
|
2277
|
+
// eslint-disable-next-line prettier/prettier
|
|
2278
|
+
[
|
|
2279
|
+
0.4865709486482162, 0.26566769316909306, 0.1982172852343625, 0.2289745640697488, 0.6917385218365064,
|
|
2280
|
+
0.079286914093745, 0.0, 0.04511338185890264, 1.043944368900976
|
|
2281
|
+
], p3l);
|
|
2282
|
+
};
|
|
2283
|
+
/**
|
|
2284
|
+
* Convert XYZ to P3 Linear
|
|
2285
|
+
*
|
|
2286
|
+
* @param xyz
|
|
2287
|
+
*/
|
|
2288
|
+
var xyzToP3Linear = function (xyz) {
|
|
2289
|
+
return multiplyMatrices(
|
|
2290
|
+
// eslint-disable-next-line prettier/prettier
|
|
2291
|
+
[
|
|
2292
|
+
2.493496911941425, -0.9313836179191239, -0.40271078445071684, -0.8294889695615747, 1.7626640603183463,
|
|
2293
|
+
0.023624685841943577, 0.03584583024378447, -0.07617238926804182, 0.9568845240076872
|
|
2294
|
+
], xyz);
|
|
2295
|
+
};
|
|
2296
|
+
/**
|
|
2297
|
+
* Convert P3 to P3 linear
|
|
2298
|
+
*
|
|
2299
|
+
* @param p3
|
|
2300
|
+
*/
|
|
2301
|
+
var p32p3Linear = function (p3) {
|
|
2302
|
+
return p3.map(function (c) {
|
|
2303
|
+
var sign = c < 0 ? -1 : 1, abs = c * sign;
|
|
2304
|
+
if (abs <= 0.04045) {
|
|
2305
|
+
return c / 12.92;
|
|
2306
|
+
}
|
|
2307
|
+
// eslint-disable-next-line prettier/prettier
|
|
2308
|
+
return sign * Math.pow(((c + 0.055) / 1.055), 2.4) || 0;
|
|
2309
|
+
});
|
|
2310
|
+
};
|
|
2311
|
+
/**
|
|
2312
|
+
* Convert P3 Linear to P3
|
|
2313
|
+
*
|
|
2314
|
+
* @param p3l
|
|
2315
|
+
*/
|
|
2316
|
+
var p3Linear2p3 = function (p3l) {
|
|
2317
|
+
return srgbLinear2rgb(p3l);
|
|
2318
|
+
};
|
|
2319
|
+
/**
|
|
2320
|
+
* Convert P3 to XYZ
|
|
2321
|
+
*
|
|
2322
|
+
* @param args
|
|
2323
|
+
*/
|
|
2324
|
+
var p3ToXYZ = function (args) {
|
|
2325
|
+
var p3_linear = p32p3Linear([args[0], args[1], args[2]]);
|
|
2326
|
+
return p3LinearToXyz([p3_linear[0], p3_linear[1], p3_linear[2]]);
|
|
2327
|
+
};
|
|
2328
|
+
/**
|
|
2329
|
+
* Convert XYZ to P3
|
|
2330
|
+
*
|
|
2331
|
+
* @param args
|
|
2332
|
+
*/
|
|
2333
|
+
var p3FromXYZ = function (args) {
|
|
2334
|
+
var _a = p3Linear2p3(xyzToP3Linear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2335
|
+
return [r, g, b, args[3]];
|
|
2336
|
+
};
|
|
2337
|
+
/**
|
|
2338
|
+
* Convert P3 to SRGB and Pack
|
|
2339
|
+
*
|
|
2340
|
+
* @param args
|
|
2341
|
+
*/
|
|
2342
|
+
var convertP3 = function (args) {
|
|
2343
|
+
var xyz = p3ToXYZ([args[0], args[1], args[2]]);
|
|
2344
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2345
|
+
};
|
|
2346
|
+
|
|
2347
|
+
/**
|
|
2348
|
+
* A98-RGB related functions
|
|
2349
|
+
*/
|
|
2350
|
+
/**
|
|
2351
|
+
* Convert XYZ to a98 linear
|
|
2352
|
+
*
|
|
2353
|
+
* @param xyz
|
|
2354
|
+
*/
|
|
2355
|
+
var xyz2a98Linear = function (xyz) {
|
|
2356
|
+
return multiplyMatrices(
|
|
2357
|
+
// eslint-disable-next-line prettier/prettier
|
|
2358
|
+
[
|
|
2359
|
+
2.0415879038107465, -0.5650069742788596, -0.34473135077832956, -0.9692436362808795, 1.8759675015077202,
|
|
2360
|
+
0.04155505740717557, 0.013444280632031142, -0.11836239223101838, 1.0151749943912054
|
|
2361
|
+
], xyz);
|
|
2362
|
+
};
|
|
2363
|
+
/**
|
|
2364
|
+
* Convert XYZ to a98 linear
|
|
2365
|
+
*
|
|
2366
|
+
* @param a98
|
|
2367
|
+
*/
|
|
2368
|
+
var a98Linear2xyz = function (a98) {
|
|
2369
|
+
return multiplyMatrices(
|
|
2370
|
+
// eslint-disable-next-line prettier/prettier
|
|
2371
|
+
[
|
|
2372
|
+
0.5766690429101305, 0.1855582379065463, 0.1882286462349947, 0.29734497525053605, 0.6273635662554661,
|
|
2373
|
+
0.0752914584939978, 0.02703136138641234, 0.07068885253582723, 0.9913375368376388
|
|
2374
|
+
], a98);
|
|
2375
|
+
};
|
|
2376
|
+
/**
|
|
2377
|
+
* Convert A98 RGB to rgb linear
|
|
2378
|
+
*
|
|
2379
|
+
* @param rgb
|
|
2380
|
+
*/
|
|
2381
|
+
var a982a98Linear = function (rgb) {
|
|
2382
|
+
var mapped = rgb.map(function (c) {
|
|
2383
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2384
|
+
return sign * Math.pow(abs, (563 / 256));
|
|
2385
|
+
});
|
|
2386
|
+
return [mapped[0], mapped[1], mapped[2]];
|
|
2387
|
+
};
|
|
2388
|
+
/**
|
|
2389
|
+
* Convert A98 RGB Linear to A98
|
|
2390
|
+
*
|
|
2391
|
+
* @param rgb
|
|
2392
|
+
*/
|
|
2393
|
+
var a98Linear2a98 = function (rgb) {
|
|
2394
|
+
var mapped = rgb.map(function (c) {
|
|
2395
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2396
|
+
return sign * Math.pow(abs, (256 / 563));
|
|
2397
|
+
});
|
|
2398
|
+
return [mapped[0], mapped[1], mapped[2]];
|
|
2399
|
+
};
|
|
2400
|
+
/**
|
|
2401
|
+
* Convert XYZ to A98
|
|
2402
|
+
*
|
|
2403
|
+
* @param args
|
|
2404
|
+
*/
|
|
2405
|
+
var a98FromXYZ = function (args) {
|
|
2406
|
+
var _a = a98Linear2a98(xyz2a98Linear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2407
|
+
return [r, g, b, args[3]];
|
|
2408
|
+
};
|
|
2409
|
+
/**
|
|
2410
|
+
* Convert A98 to XYZ and Pack
|
|
2411
|
+
*
|
|
2412
|
+
* @param args
|
|
2413
|
+
*/
|
|
2414
|
+
var convertA98rgb = function (args) {
|
|
2415
|
+
var srgb_linear = xyz2rgbLinear(a98Linear2xyz(a982a98Linear([args[0], args[1], args[2]])));
|
|
2416
|
+
return packSrgbLinear([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
|
|
2417
|
+
};
|
|
2418
|
+
|
|
2419
|
+
/**
|
|
2420
|
+
* Pro Photo related functions
|
|
2421
|
+
*/
|
|
2422
|
+
/**
|
|
2423
|
+
* Convert linear-light display-p3 to XYZ D65
|
|
2424
|
+
*
|
|
2425
|
+
* @param p3
|
|
2426
|
+
*/
|
|
2427
|
+
var proPhotoLinearToXyz = function (p3) {
|
|
2428
|
+
return multiplyMatrices(
|
|
2429
|
+
// eslint-disable-next-line prettier/prettier
|
|
2430
|
+
[
|
|
2431
|
+
0.7977666449006423, 0.13518129740053308, 0.0313477341283922, 0.2880748288194013, 0.711835234241873,
|
|
2432
|
+
0.00008993693872564, 0.0, 0.0, 0.8251046025104602
|
|
2433
|
+
], p3);
|
|
2434
|
+
};
|
|
2435
|
+
/**
|
|
2436
|
+
* Convert XYZ D65 to linear-light display-p3
|
|
2437
|
+
*
|
|
2438
|
+
* @param xyz
|
|
2439
|
+
*/
|
|
2440
|
+
var xyzToProPhotoLinear = function (xyz) {
|
|
2441
|
+
return multiplyMatrices(
|
|
2442
|
+
// eslint-disable-next-line prettier/prettier
|
|
2443
|
+
[
|
|
2444
|
+
1.3457868816471583, -0.25557208737979464, -0.05110186497554526, -0.5446307051249019, 1.5082477428451468,
|
|
2445
|
+
0.02052744743642139, 0.0, 0.0, 1.2119675456389452
|
|
2446
|
+
], xyz);
|
|
2447
|
+
};
|
|
2448
|
+
/**
|
|
2449
|
+
* Convert Pro-Photo to Pro-Photo Linear
|
|
2450
|
+
*
|
|
2451
|
+
* @param p3
|
|
2452
|
+
*/
|
|
2453
|
+
var proPhotoToProPhotoLinear = function (p3) {
|
|
2454
|
+
return p3.map(function (c) {
|
|
2455
|
+
return c < 16 / 512 ? c / 16 : Math.pow(c, 1.8);
|
|
2456
|
+
});
|
|
2457
|
+
};
|
|
2458
|
+
/**
|
|
2459
|
+
* Convert Pro-Photo Linear to Pro-Photo
|
|
2460
|
+
*
|
|
2461
|
+
* @param p3
|
|
2462
|
+
*/
|
|
2463
|
+
var proPhotoLinearToProPhoto = function (p3) {
|
|
2464
|
+
return p3.map(function (c) {
|
|
2465
|
+
return c > 1 / 512 ? Math.pow(c, (1 / 1.8)) : c * 16;
|
|
2466
|
+
});
|
|
2467
|
+
};
|
|
2468
|
+
/**
|
|
2469
|
+
* Convert Pro-Photo to XYZ
|
|
2470
|
+
*
|
|
2471
|
+
* @param args
|
|
2472
|
+
*/
|
|
2473
|
+
var proPhotoToXYZ = function (args) {
|
|
2474
|
+
var prophoto_linear = proPhotoToProPhotoLinear([args[0], args[1], args[2]]);
|
|
2475
|
+
return d50toD65(proPhotoLinearToXyz([prophoto_linear[0], prophoto_linear[1], prophoto_linear[2]]));
|
|
2476
|
+
};
|
|
2477
|
+
/**
|
|
2478
|
+
* Convert XYZ to Pro-Photo
|
|
2479
|
+
*
|
|
2480
|
+
* @param args
|
|
2481
|
+
*/
|
|
2482
|
+
var proPhotoFromXYZ = function (args) {
|
|
2483
|
+
var _a = proPhotoLinearToProPhoto(xyzToProPhotoLinear(d65toD50([args[0], args[1], args[2]]))), r = _a[0], g = _a[1], b = _a[2];
|
|
2484
|
+
return [r, g, b, args[3]];
|
|
2485
|
+
};
|
|
2486
|
+
/**
|
|
2487
|
+
* Convert Pro-Photo to XYZ and Pack
|
|
2488
|
+
*
|
|
2489
|
+
* @param args
|
|
2490
|
+
*/
|
|
2491
|
+
var convertProPhoto = function (args) {
|
|
2492
|
+
var xyz = proPhotoToXYZ([args[0], args[1], args[2]]);
|
|
2493
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2494
|
+
};
|
|
2495
|
+
|
|
2496
|
+
/**
|
|
2497
|
+
* REC2020 related functions
|
|
2498
|
+
*/
|
|
2499
|
+
var _a = 1.09929682680944;
|
|
2500
|
+
var _b = 0.018053968510807;
|
|
2501
|
+
/**
|
|
2502
|
+
* Convert rec2020 to rec2020 linear
|
|
2503
|
+
*
|
|
2504
|
+
* @param rgb
|
|
2505
|
+
*/
|
|
2506
|
+
var rec20202rec2020Linear = function (rgb) {
|
|
2507
|
+
return rgb.map(function (c) {
|
|
2508
|
+
return c < _b * 4.5 ? c / 4.5 : Math.pow((c + _a - 1) / _a, 1 / 0.45);
|
|
2509
|
+
});
|
|
2510
|
+
};
|
|
2511
|
+
/**
|
|
2512
|
+
* Convert rec2020 linear to rec2020
|
|
2513
|
+
*
|
|
2514
|
+
* @param rgb
|
|
2515
|
+
*/
|
|
2516
|
+
var rec2020Linear2rec2020 = function (rgb) {
|
|
2517
|
+
return rgb.map(function (c) {
|
|
2518
|
+
return c >= _b ? _a * Math.pow(c, 0.45) - (_a - 1) : 4.5 * c;
|
|
2519
|
+
});
|
|
2520
|
+
};
|
|
2521
|
+
/**
|
|
2522
|
+
* Convert rec2020 linear to XYZ D65
|
|
2523
|
+
*
|
|
2524
|
+
* @param rec
|
|
2525
|
+
*/
|
|
2526
|
+
var rec2020LinearToXyz = function (rec) {
|
|
2527
|
+
return multiplyMatrices(
|
|
2528
|
+
// eslint-disable-next-line prettier/prettier
|
|
2529
|
+
[
|
|
2530
|
+
0.6369580483012914, 0.14461690358620832, 0.1688809751641721, 0.2627002120112671, 0.6779980715188708,
|
|
2531
|
+
0.05930171646986196, 0.0, 0.028072693049087428, 1.060985057710791
|
|
2532
|
+
], rec);
|
|
2533
|
+
};
|
|
2534
|
+
/**
|
|
2535
|
+
* Convert XYZ D65 to rec2020 linear
|
|
2536
|
+
*
|
|
2537
|
+
* @param xyz
|
|
2538
|
+
*/
|
|
2539
|
+
var xyzToRec2020Linear = function (xyz) {
|
|
2540
|
+
return multiplyMatrices(
|
|
2541
|
+
// eslint-disable-next-line prettier/prettier
|
|
2542
|
+
[
|
|
2543
|
+
1.716651187971268, -0.355670783776392, -0.25336628137366, -0.666684351832489, 1.616481236634939,
|
|
2544
|
+
0.0157685458139111, 0.017639857445311, -0.042770613257809, 0.942103121235474
|
|
2545
|
+
], xyz);
|
|
2546
|
+
};
|
|
2547
|
+
/**
|
|
2548
|
+
* Convert Rec2020 to XYZ
|
|
2549
|
+
*
|
|
2550
|
+
* @param args
|
|
2551
|
+
*/
|
|
2552
|
+
var rec2020ToXYZ = function (args) {
|
|
2553
|
+
var rec2020_linear = rec20202rec2020Linear([args[0], args[1], args[2]]);
|
|
2554
|
+
return rec2020LinearToXyz([rec2020_linear[0], rec2020_linear[1], rec2020_linear[2]]);
|
|
2555
|
+
};
|
|
2556
|
+
/**
|
|
2557
|
+
* Convert XYZ to Rec2020
|
|
2558
|
+
*
|
|
2559
|
+
* @param args
|
|
2560
|
+
*/
|
|
2561
|
+
var rec2020FromXYZ = function (args) {
|
|
2562
|
+
var _c = rec2020Linear2rec2020(xyzToRec2020Linear([args[0], args[1], args[2]])), r = _c[0], g = _c[1], b = _c[2];
|
|
2563
|
+
return [r, g, b, args[3]];
|
|
2564
|
+
};
|
|
2565
|
+
/**
|
|
2566
|
+
* Convert Rec2020 to SRGB and Pack
|
|
2567
|
+
*
|
|
2568
|
+
* @param args
|
|
2569
|
+
*/
|
|
2570
|
+
var convertRec2020 = function (args) {
|
|
2571
|
+
var xyz = rec2020ToXYZ([args[0], args[1], args[2]]);
|
|
2572
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2573
|
+
};
|
|
2574
|
+
|
|
2575
|
+
var color$1 = {
|
|
2576
|
+
name: 'color',
|
|
2577
|
+
parse: function (context, value) {
|
|
2578
|
+
if (value.type === 18 /* TokenType.FUNCTION */) {
|
|
2579
|
+
var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
|
|
2580
|
+
if (typeof colorFunction === 'undefined') {
|
|
2581
|
+
throw new Error("Attempting to parse an unsupported color function \"".concat(value.name, "\""));
|
|
2582
|
+
}
|
|
2583
|
+
return colorFunction(context, value.values);
|
|
2584
|
+
}
|
|
2585
|
+
if (value.type === 5 /* TokenType.HASH_TOKEN */) {
|
|
2586
|
+
var _a = hash2rgb(value), r = _a[0], g = _a[1], b = _a[2], a = _a[3];
|
|
2587
|
+
return pack(r, g, b, a);
|
|
2588
|
+
}
|
|
2589
|
+
if (value.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
2590
|
+
var namedColor = COLORS[value.value.toUpperCase()];
|
|
2591
|
+
if (typeof namedColor !== 'undefined') {
|
|
2592
|
+
return namedColor;
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
return COLORS.TRANSPARENT;
|
|
2596
|
+
}
|
|
2597
|
+
};
|
|
2598
|
+
var hash2rgb = function (token) {
|
|
2599
|
+
if (token.value.length === 3) {
|
|
2600
|
+
var r = token.value.substring(0, 1);
|
|
2601
|
+
var g = token.value.substring(1, 2);
|
|
2602
|
+
var b = token.value.substring(2, 3);
|
|
2603
|
+
return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1];
|
|
2604
|
+
}
|
|
2605
|
+
if (token.value.length === 4) {
|
|
2606
|
+
var r = token.value.substring(0, 1);
|
|
2607
|
+
var g = token.value.substring(1, 2);
|
|
2608
|
+
var b = token.value.substring(2, 3);
|
|
2609
|
+
var a = token.value.substring(3, 4);
|
|
2610
|
+
return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255];
|
|
2611
|
+
}
|
|
2612
|
+
if (token.value.length === 6) {
|
|
2613
|
+
var r = token.value.substring(0, 2);
|
|
2614
|
+
var g = token.value.substring(2, 4);
|
|
2615
|
+
var b = token.value.substring(4, 6);
|
|
2616
|
+
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1];
|
|
2617
|
+
}
|
|
2618
|
+
if (token.value.length === 8) {
|
|
2619
|
+
var r = token.value.substring(0, 2);
|
|
2620
|
+
var g = token.value.substring(2, 4);
|
|
2621
|
+
var b = token.value.substring(4, 6);
|
|
2622
|
+
var a = token.value.substring(6, 8);
|
|
2623
|
+
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255];
|
|
2624
|
+
}
|
|
2625
|
+
return [0, 0, 0, 1];
|
|
2626
|
+
};
|
|
2627
|
+
var rgb = function (_context, args) {
|
|
2628
|
+
var tokens = args.filter(nonFunctionArgSeparator);
|
|
2629
|
+
if (isRelativeTransform(tokens)) {
|
|
2630
|
+
throw new Error('Relative color not supported for rgb()');
|
|
2631
|
+
}
|
|
2632
|
+
if (tokens.length === 3) {
|
|
2633
|
+
var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2];
|
|
2634
|
+
return pack(r, g, b, 1);
|
|
2635
|
+
}
|
|
2636
|
+
if (tokens.length === 4) {
|
|
2637
|
+
var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a = _b[3];
|
|
2638
|
+
return pack(r, g, b, a);
|
|
2639
|
+
}
|
|
2640
|
+
return 0;
|
|
2641
|
+
};
|
|
2642
|
+
/**
|
|
2643
|
+
* Handle the CSS color() function
|
|
2644
|
+
*
|
|
2645
|
+
* @param context
|
|
2646
|
+
* @param args
|
|
2647
|
+
*/
|
|
2648
|
+
var _color = function (context, args) {
|
|
2649
|
+
var tokens = args.filter(nonFunctionArgSeparator), token_1_value = tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ ? tokens[0].value : 'unknown', is_absolute = !isRelativeTransform(tokens);
|
|
2650
|
+
if (is_absolute) {
|
|
2651
|
+
var color_space = token_1_value, colorSpaceFunction = SUPPORTED_COLOR_SPACES_ABSOLUTE[color_space];
|
|
2652
|
+
if (typeof colorSpaceFunction === 'undefined') {
|
|
2653
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(color_space, "\" for color() function"));
|
|
2654
|
+
}
|
|
2655
|
+
var c1 = isNumberToken(tokens[1]) ? tokens[1].number : 0, c2 = isNumberToken(tokens[2]) ? tokens[2].number : 0, c3 = isNumberToken(tokens[3]) ? tokens[3].number : 0, a = tokens.length > 4 &&
|
|
2656
|
+
tokens[4].type === 6 /* TokenType.DELIM_TOKEN */ &&
|
|
2657
|
+
tokens[4].value === '/' &&
|
|
2658
|
+
isNumberToken(tokens[5])
|
|
2659
|
+
? tokens[5].number
|
|
2660
|
+
: 1;
|
|
2661
|
+
return colorSpaceFunction([c1, c2, c3, a]);
|
|
1965
2662
|
}
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
2663
|
+
else {
|
|
2664
|
+
var extractComponent = function (color, token) {
|
|
2665
|
+
if (isNumberToken(token)) {
|
|
2666
|
+
return token.number;
|
|
2667
|
+
}
|
|
2668
|
+
var posFromVal = function (value) {
|
|
2669
|
+
return value === 'r' || value === 'x' ? 0 : value === 'g' || value === 'y' ? 1 : 2;
|
|
2670
|
+
};
|
|
2671
|
+
if (isIdentToken(token)) {
|
|
2672
|
+
var position = posFromVal(token.value);
|
|
2673
|
+
return color[position];
|
|
2674
|
+
}
|
|
2675
|
+
var parseCalc = function (args) {
|
|
2676
|
+
var parts = args.filter(nonFunctionArgSeparator);
|
|
2677
|
+
var expression = '(';
|
|
2678
|
+
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
2679
|
+
var part = parts_1[_i];
|
|
2680
|
+
expression +=
|
|
2681
|
+
part.type === 18 /* TokenType.FUNCTION */ && part.name === 'calc'
|
|
2682
|
+
? parseCalc(part.values)
|
|
2683
|
+
: isNumberToken(part)
|
|
2684
|
+
? part.number
|
|
2685
|
+
: part.type === 6 /* TokenType.DELIM_TOKEN */ || isIdentToken(part)
|
|
2686
|
+
? part.value
|
|
2687
|
+
: '';
|
|
2688
|
+
}
|
|
2689
|
+
expression += ')';
|
|
2690
|
+
return expression;
|
|
2691
|
+
};
|
|
2692
|
+
if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
2693
|
+
var args_1 = token.values.filter(nonFunctionArgSeparator);
|
|
2694
|
+
if (token.name === 'calc') {
|
|
2695
|
+
var expression = parseCalc(args_1)
|
|
2696
|
+
.replace(/r|x/, color[0].toString())
|
|
2697
|
+
.replace(/g|y/, color[1].toString())
|
|
2698
|
+
.replace(/b|z/, color[2].toString());
|
|
2699
|
+
return new Function('return ' + expression)();
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
return null;
|
|
2703
|
+
};
|
|
2704
|
+
var from_colorspace = tokens[1].type === 18 /* TokenType.FUNCTION */
|
|
2705
|
+
? tokens[1].name
|
|
2706
|
+
: isIdentToken(tokens[1]) || tokens[1].type === 5 /* TokenType.HASH_TOKEN */
|
|
2707
|
+
? 'rgb'
|
|
2708
|
+
: 'unknown', to_colorspace = isIdentToken(tokens[2]) ? tokens[2].value : 'unknown';
|
|
2709
|
+
var from = tokens[1].type === 18 /* TokenType.FUNCTION */ ? tokens[1].values : isIdentToken(tokens[1]) ? [tokens[1]] : [];
|
|
2710
|
+
if (isIdentToken(tokens[1])) {
|
|
2711
|
+
var named_color = COLORS[tokens[1].value.toUpperCase()];
|
|
2712
|
+
if (typeof named_color === 'undefined') {
|
|
2713
|
+
throw new Error("Attempting to use unknown color in relative color 'from'");
|
|
2714
|
+
}
|
|
2715
|
+
else {
|
|
2716
|
+
var _c = parseColor(context, tokens[1].value), alpha = 0xff & _c, blue = 0xff & (_c >> 8), green = 0xff & (_c >> 16), red = 0xff & (_c >> 24);
|
|
2717
|
+
from = [
|
|
2718
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: red, flags: 1 },
|
|
2719
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: green, flags: 1 },
|
|
2720
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: blue, flags: 1 },
|
|
2721
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: alpha > 1 ? alpha / 255 : alpha, flags: 1 }
|
|
2722
|
+
];
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
else if (tokens[1].type === 5 /* TokenType.HASH_TOKEN */) {
|
|
2726
|
+
var _a = hash2rgb(tokens[1]), red = _a[0], green = _a[1], blue = _a[2], alpha = _a[3];
|
|
2727
|
+
from = [
|
|
2728
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: red, flags: 1 },
|
|
2729
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: green, flags: 1 },
|
|
2730
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: blue, flags: 1 },
|
|
2731
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: alpha > 1 ? alpha / 255 : alpha, flags: 1 }
|
|
2732
|
+
];
|
|
2733
|
+
}
|
|
2734
|
+
if (from.length === 0) {
|
|
2735
|
+
throw new Error("Attempting to use unknown color in relative color 'from'");
|
|
2736
|
+
}
|
|
2737
|
+
if (to_colorspace === 'unknown') {
|
|
2738
|
+
throw new Error("Attempting to use unknown colorspace in relative color 'to'");
|
|
2739
|
+
}
|
|
2740
|
+
var fromColorToXyz = SUPPORTED_COLOR_SPACES_TO_XYZ[from_colorspace], toColorFromXyz = SUPPORTED_COLOR_SPACES_FROM_XYZ[to_colorspace], toColorPack = SUPPORTED_COLOR_SPACES_ABSOLUTE[to_colorspace];
|
|
2741
|
+
if (typeof fromColorToXyz === 'undefined') {
|
|
2742
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(from_colorspace, "\" for color() function"));
|
|
2743
|
+
}
|
|
2744
|
+
if (typeof toColorFromXyz === 'undefined') {
|
|
2745
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(to_colorspace, "\" for color() function"));
|
|
2746
|
+
}
|
|
2747
|
+
var from_color = fromColorToXyz(context, from), from_final_colorspace = toColorFromXyz(from_color), c1 = extractComponent(from_final_colorspace, tokens[3]), c2 = extractComponent(from_final_colorspace, tokens[4]), c3 = extractComponent(from_final_colorspace, tokens[5]), a = tokens.length > 6 &&
|
|
2748
|
+
tokens[6].type === 6 /* TokenType.DELIM_TOKEN */ &&
|
|
2749
|
+
tokens[6].value === '/' &&
|
|
2750
|
+
isNumberToken(tokens[7])
|
|
2751
|
+
? tokens[7].number
|
|
2752
|
+
: 1;
|
|
2753
|
+
if (c1 === null || c2 === null || c3 === null) {
|
|
2754
|
+
throw new Error("Invalid relative color in color() function");
|
|
2755
|
+
}
|
|
2756
|
+
return toColorPack([c1, c2, c3, a]);
|
|
2757
|
+
}
|
|
2758
|
+
};
|
|
2759
|
+
var SUPPORTED_COLOR_SPACES_ABSOLUTE = {
|
|
2760
|
+
srgb: packSrgb,
|
|
2761
|
+
'srgb-linear': packSrgbLinear,
|
|
2762
|
+
'display-p3': convertP3,
|
|
2763
|
+
'a98-rgb': convertA98rgb,
|
|
2764
|
+
'prophoto-rgb': convertProPhoto,
|
|
2765
|
+
xyz: convertXyz,
|
|
2766
|
+
'xyz-d50': convertXyz50,
|
|
2767
|
+
'xyz-d65': convertXyz,
|
|
2768
|
+
rec2020: convertRec2020
|
|
2769
|
+
};
|
|
2770
|
+
var SUPPORTED_COLOR_SPACES_TO_XYZ = {
|
|
2771
|
+
rgb: rgbToXyz,
|
|
2772
|
+
hsl: hslToXyz,
|
|
2773
|
+
lab: labToXyz,
|
|
2774
|
+
lch: lchToXyz,
|
|
2775
|
+
oklab: oklabToXyz,
|
|
2776
|
+
oklch: oklchToXyz
|
|
2777
|
+
};
|
|
2778
|
+
var SUPPORTED_COLOR_SPACES_FROM_XYZ = {
|
|
2779
|
+
srgb: srgbFromXYZ,
|
|
2780
|
+
'srgb-linear': srgbLinearFromXYZ,
|
|
2781
|
+
'display-p3': p3FromXYZ,
|
|
2782
|
+
'a98-rgb': a98FromXYZ,
|
|
2783
|
+
'prophoto-rgb': proPhotoFromXYZ,
|
|
2784
|
+
xyz: xyzFromXYZ,
|
|
2785
|
+
'xyz-d50': xyz50FromXYZ,
|
|
2786
|
+
'xyz-d65': xyzFromXYZ,
|
|
2787
|
+
rec2020: rec2020FromXYZ
|
|
1972
2788
|
};
|
|
1973
2789
|
var SUPPORTED_COLOR_FUNCTIONS = {
|
|
1974
|
-
hsl:
|
|
1975
|
-
hsla:
|
|
2790
|
+
hsl: packHSL,
|
|
2791
|
+
hsla: packHSL,
|
|
1976
2792
|
rgb: rgb,
|
|
1977
|
-
rgba: rgb
|
|
2793
|
+
rgba: rgb,
|
|
2794
|
+
lch: packLch,
|
|
2795
|
+
oklch: packOkLch,
|
|
2796
|
+
oklab: packOkLab,
|
|
2797
|
+
lab: packLab,
|
|
2798
|
+
color: _color
|
|
1978
2799
|
};
|
|
1979
2800
|
var parseColor = function (context, value) {
|
|
1980
2801
|
return color$1.parse(context, Parser.create(value).parseComponentValue());
|
|
@@ -2135,18 +2956,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2135
2956
|
name: 'background-clip',
|
|
2136
2957
|
initialValue: 'border-box',
|
|
2137
2958
|
prefix: false,
|
|
2138
|
-
type: 1 /* LIST */,
|
|
2959
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2139
2960
|
parse: function (_context, tokens) {
|
|
2140
2961
|
return tokens.map(function (token) {
|
|
2141
2962
|
if (isIdentToken(token)) {
|
|
2142
2963
|
switch (token.value) {
|
|
2143
2964
|
case 'padding-box':
|
|
2144
|
-
return 1 /* PADDING_BOX */;
|
|
2965
|
+
return 1 /* BACKGROUND_CLIP.PADDING_BOX */;
|
|
2145
2966
|
case 'content-box':
|
|
2146
|
-
return 2 /* CONTENT_BOX */;
|
|
2967
|
+
return 2 /* BACKGROUND_CLIP.CONTENT_BOX */;
|
|
2147
2968
|
}
|
|
2148
2969
|
}
|
|
2149
|
-
return 0 /* BORDER_BOX */;
|
|
2970
|
+
return 0 /* BACKGROUND_CLIP.BORDER_BOX */;
|
|
2150
2971
|
});
|
|
2151
2972
|
}
|
|
2152
2973
|
};
|
|
@@ -2155,7 +2976,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2155
2976
|
name: "background-color",
|
|
2156
2977
|
initialValue: 'transparent',
|
|
2157
2978
|
prefix: false,
|
|
2158
|
-
type: 3 /* TYPE_VALUE */,
|
|
2979
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2159
2980
|
format: 'color'
|
|
2160
2981
|
};
|
|
2161
2982
|
|
|
@@ -2258,24 +3079,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2258
3079
|
var rx = 0;
|
|
2259
3080
|
var ry = 0;
|
|
2260
3081
|
switch (gradient.size) {
|
|
2261
|
-
case 0 /* CLOSEST_SIDE */:
|
|
3082
|
+
case 0 /* CSSRadialExtent.CLOSEST_SIDE */:
|
|
2262
3083
|
// The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center.
|
|
2263
3084
|
// If the shape is an ellipse, it exactly meets the closest side in each dimension.
|
|
2264
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3085
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2265
3086
|
rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
|
|
2266
3087
|
}
|
|
2267
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3088
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2268
3089
|
rx = Math.min(Math.abs(x), Math.abs(x - width));
|
|
2269
3090
|
ry = Math.min(Math.abs(y), Math.abs(y - height));
|
|
2270
3091
|
}
|
|
2271
3092
|
break;
|
|
2272
|
-
case 2 /* CLOSEST_CORNER */:
|
|
3093
|
+
case 2 /* CSSRadialExtent.CLOSEST_CORNER */:
|
|
2273
3094
|
// The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center.
|
|
2274
3095
|
// If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified.
|
|
2275
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3096
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2276
3097
|
rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
|
|
2277
3098
|
}
|
|
2278
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3099
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2279
3100
|
// Compute the ratio ry/rx (which is to be the same as for "closest-side")
|
|
2280
3101
|
var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width));
|
|
2281
3102
|
var _a = findCorner(width, height, x, y, true), cx = _a[0], cy = _a[1];
|
|
@@ -2283,23 +3104,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2283
3104
|
ry = c * rx;
|
|
2284
3105
|
}
|
|
2285
3106
|
break;
|
|
2286
|
-
case 1 /* FARTHEST_SIDE */:
|
|
3107
|
+
case 1 /* CSSRadialExtent.FARTHEST_SIDE */:
|
|
2287
3108
|
// Same as closest-side, except the ending shape is sized based on the farthest side(s)
|
|
2288
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3109
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2289
3110
|
rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
|
|
2290
3111
|
}
|
|
2291
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3112
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2292
3113
|
rx = Math.max(Math.abs(x), Math.abs(x - width));
|
|
2293
3114
|
ry = Math.max(Math.abs(y), Math.abs(y - height));
|
|
2294
3115
|
}
|
|
2295
3116
|
break;
|
|
2296
|
-
case 3 /* FARTHEST_CORNER */:
|
|
3117
|
+
case 3 /* CSSRadialExtent.FARTHEST_CORNER */:
|
|
2297
3118
|
// Same as closest-corner, except the ending shape is sized based on the farthest corner.
|
|
2298
3119
|
// If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified.
|
|
2299
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3120
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2300
3121
|
rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
|
|
2301
3122
|
}
|
|
2302
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3123
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2303
3124
|
// Compute the ratio ry/rx (which is to be the same as for "farthest-side")
|
|
2304
3125
|
var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width));
|
|
2305
3126
|
var _b = findCorner(width, height, x, y, false), cx = _b[0], cy = _b[1];
|
|
@@ -2321,7 +3142,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2321
3142
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2322
3143
|
if (i === 0) {
|
|
2323
3144
|
var firstToken = arg[0];
|
|
2324
|
-
if (firstToken.type === 20 /* IDENT_TOKEN */ && firstToken.value === 'to') {
|
|
3145
|
+
if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ && firstToken.value === 'to') {
|
|
2325
3146
|
angle$1 = parseNamedSide(arg);
|
|
2326
3147
|
return;
|
|
2327
3148
|
}
|
|
@@ -2333,7 +3154,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2333
3154
|
var colorStop = parseColorStop(context, arg);
|
|
2334
3155
|
stops.push(colorStop);
|
|
2335
3156
|
});
|
|
2336
|
-
return { angle: angle$1, stops: stops, type: 1 /* LINEAR_GRADIENT */ };
|
|
3157
|
+
return { angle: angle$1, stops: stops, type: 1 /* CSSImageType.LINEAR_GRADIENT */ };
|
|
2337
3158
|
};
|
|
2338
3159
|
|
|
2339
3160
|
var prefixLinearGradient = function (context, tokens) {
|
|
@@ -2342,7 +3163,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2342
3163
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2343
3164
|
if (i === 0) {
|
|
2344
3165
|
var firstToken = arg[0];
|
|
2345
|
-
if (firstToken.type === 20 /* IDENT_TOKEN */ &&
|
|
3166
|
+
if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ &&
|
|
2346
3167
|
['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) {
|
|
2347
3168
|
angle$1 = parseNamedSide(arg);
|
|
2348
3169
|
return;
|
|
@@ -2358,30 +3179,30 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2358
3179
|
return {
|
|
2359
3180
|
angle: angle$1,
|
|
2360
3181
|
stops: stops,
|
|
2361
|
-
type: 1 /* LINEAR_GRADIENT */
|
|
3182
|
+
type: 1 /* CSSImageType.LINEAR_GRADIENT */
|
|
2362
3183
|
};
|
|
2363
3184
|
};
|
|
2364
3185
|
|
|
2365
3186
|
var webkitGradient = function (context, tokens) {
|
|
2366
3187
|
var angle = deg(180);
|
|
2367
3188
|
var stops = [];
|
|
2368
|
-
var type = 1 /* LINEAR_GRADIENT */;
|
|
2369
|
-
var shape = 0 /* CIRCLE */;
|
|
2370
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3189
|
+
var type = 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
3190
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3191
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2371
3192
|
var position = [];
|
|
2372
3193
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2373
3194
|
var firstToken = arg[0];
|
|
2374
3195
|
if (i === 0) {
|
|
2375
3196
|
if (isIdentToken(firstToken) && firstToken.value === 'linear') {
|
|
2376
|
-
type = 1 /* LINEAR_GRADIENT */;
|
|
3197
|
+
type = 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
2377
3198
|
return;
|
|
2378
3199
|
}
|
|
2379
3200
|
else if (isIdentToken(firstToken) && firstToken.value === 'radial') {
|
|
2380
|
-
type = 2 /* RADIAL_GRADIENT */;
|
|
3201
|
+
type = 2 /* CSSImageType.RADIAL_GRADIENT */;
|
|
2381
3202
|
return;
|
|
2382
3203
|
}
|
|
2383
3204
|
}
|
|
2384
|
-
if (firstToken.type === 18 /* FUNCTION */) {
|
|
3205
|
+
if (firstToken.type === 18 /* TokenType.FUNCTION */) {
|
|
2385
3206
|
if (firstToken.name === 'from') {
|
|
2386
3207
|
var color = color$1.parse(context, firstToken.values[0]);
|
|
2387
3208
|
stops.push({ stop: ZERO_LENGTH, color: color });
|
|
@@ -2397,7 +3218,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2397
3218
|
var stop_1 = values[0];
|
|
2398
3219
|
if (isNumberToken(stop_1)) {
|
|
2399
3220
|
stops.push({
|
|
2400
|
-
stop: { type: 16 /* PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
|
|
3221
|
+
stop: { type: 16 /* TokenType.PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
|
|
2401
3222
|
color: color
|
|
2402
3223
|
});
|
|
2403
3224
|
}
|
|
@@ -2405,7 +3226,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2405
3226
|
}
|
|
2406
3227
|
}
|
|
2407
3228
|
});
|
|
2408
|
-
return type === 1 /* LINEAR_GRADIENT */
|
|
3229
|
+
return type === 1 /* CSSImageType.LINEAR_GRADIENT */
|
|
2409
3230
|
? {
|
|
2410
3231
|
angle: (angle + deg(180)) % deg(360),
|
|
2411
3232
|
stops: stops,
|
|
@@ -2423,8 +3244,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2423
3244
|
var COVER = 'cover';
|
|
2424
3245
|
var CONTAIN = 'contain';
|
|
2425
3246
|
var radialGradient = function (context, tokens) {
|
|
2426
|
-
var shape = 0 /* CIRCLE */;
|
|
2427
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3247
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3248
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2428
3249
|
var stops = [];
|
|
2429
3250
|
var position = [];
|
|
2430
3251
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
@@ -2455,27 +3276,27 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2455
3276
|
else if (isIdentToken(token)) {
|
|
2456
3277
|
switch (token.value) {
|
|
2457
3278
|
case CIRCLE:
|
|
2458
|
-
shape = 0 /* CIRCLE */;
|
|
3279
|
+
shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
2459
3280
|
return false;
|
|
2460
3281
|
case ELLIPSE:
|
|
2461
|
-
shape = 1 /* ELLIPSE */;
|
|
3282
|
+
shape = 1 /* CSSRadialShape.ELLIPSE */;
|
|
2462
3283
|
return false;
|
|
2463
3284
|
case 'at':
|
|
2464
3285
|
isAtPosition_1 = true;
|
|
2465
3286
|
return false;
|
|
2466
3287
|
case CLOSEST_SIDE:
|
|
2467
|
-
size = 0 /* CLOSEST_SIDE */;
|
|
3288
|
+
size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
|
|
2468
3289
|
return false;
|
|
2469
3290
|
case COVER:
|
|
2470
3291
|
case FARTHEST_SIDE:
|
|
2471
|
-
size = 1 /* FARTHEST_SIDE */;
|
|
3292
|
+
size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
|
|
2472
3293
|
return false;
|
|
2473
3294
|
case CONTAIN:
|
|
2474
3295
|
case CLOSEST_CORNER:
|
|
2475
|
-
size = 2 /* CLOSEST_CORNER */;
|
|
3296
|
+
size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
|
|
2476
3297
|
return false;
|
|
2477
3298
|
case FARTHEST_CORNER:
|
|
2478
|
-
size = 3 /* FARTHEST_CORNER */;
|
|
3299
|
+
size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2479
3300
|
return false;
|
|
2480
3301
|
}
|
|
2481
3302
|
}
|
|
@@ -2494,12 +3315,12 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2494
3315
|
stops.push(colorStop);
|
|
2495
3316
|
}
|
|
2496
3317
|
});
|
|
2497
|
-
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
|
|
3318
|
+
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* CSSImageType.RADIAL_GRADIENT */ };
|
|
2498
3319
|
};
|
|
2499
3320
|
|
|
2500
3321
|
var prefixRadialGradient = function (context, tokens) {
|
|
2501
|
-
var shape = 0 /* CIRCLE */;
|
|
2502
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3322
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3323
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2503
3324
|
var stops = [];
|
|
2504
3325
|
var position = [];
|
|
2505
3326
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
@@ -2533,24 +3354,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2533
3354
|
if (isIdentToken(token)) {
|
|
2534
3355
|
switch (token.value) {
|
|
2535
3356
|
case CIRCLE:
|
|
2536
|
-
shape = 0 /* CIRCLE */;
|
|
3357
|
+
shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
2537
3358
|
return false;
|
|
2538
3359
|
case ELLIPSE:
|
|
2539
|
-
shape = 1 /* ELLIPSE */;
|
|
3360
|
+
shape = 1 /* CSSRadialShape.ELLIPSE */;
|
|
2540
3361
|
return false;
|
|
2541
3362
|
case CONTAIN:
|
|
2542
3363
|
case CLOSEST_SIDE:
|
|
2543
|
-
size = 0 /* CLOSEST_SIDE */;
|
|
3364
|
+
size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
|
|
2544
3365
|
return false;
|
|
2545
3366
|
case FARTHEST_SIDE:
|
|
2546
|
-
size = 1 /* FARTHEST_SIDE */;
|
|
3367
|
+
size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
|
|
2547
3368
|
return false;
|
|
2548
3369
|
case CLOSEST_CORNER:
|
|
2549
|
-
size = 2 /* CLOSEST_CORNER */;
|
|
3370
|
+
size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
|
|
2550
3371
|
return false;
|
|
2551
3372
|
case COVER:
|
|
2552
3373
|
case FARTHEST_CORNER:
|
|
2553
|
-
size = 3 /* FARTHEST_CORNER */;
|
|
3374
|
+
size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2554
3375
|
return false;
|
|
2555
3376
|
}
|
|
2556
3377
|
}
|
|
@@ -2569,36 +3390,36 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2569
3390
|
stops.push(colorStop);
|
|
2570
3391
|
}
|
|
2571
3392
|
});
|
|
2572
|
-
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
|
|
3393
|
+
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* CSSImageType.RADIAL_GRADIENT */ };
|
|
2573
3394
|
};
|
|
2574
3395
|
|
|
2575
3396
|
var isLinearGradient = function (background) {
|
|
2576
|
-
return background.type === 1 /* LINEAR_GRADIENT */;
|
|
3397
|
+
return background.type === 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
2577
3398
|
};
|
|
2578
3399
|
var isRadialGradient = function (background) {
|
|
2579
|
-
return background.type === 2 /* RADIAL_GRADIENT */;
|
|
3400
|
+
return background.type === 2 /* CSSImageType.RADIAL_GRADIENT */;
|
|
2580
3401
|
};
|
|
2581
3402
|
var image = {
|
|
2582
3403
|
name: 'image',
|
|
2583
3404
|
parse: function (context, value) {
|
|
2584
|
-
if (value.type === 22 /* URL_TOKEN */) {
|
|
2585
|
-
var image_1 = { url: value.value, type: 0 /* URL */ };
|
|
3405
|
+
if (value.type === 22 /* TokenType.URL_TOKEN */) {
|
|
3406
|
+
var image_1 = { url: value.value, type: 0 /* CSSImageType.URL */ };
|
|
2586
3407
|
context.cache.addImage(value.value);
|
|
2587
3408
|
return image_1;
|
|
2588
3409
|
}
|
|
2589
|
-
if (value.type === 18 /* FUNCTION */) {
|
|
3410
|
+
if (value.type === 18 /* TokenType.FUNCTION */) {
|
|
2590
3411
|
var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name];
|
|
2591
3412
|
if (typeof imageFunction === 'undefined') {
|
|
2592
|
-
throw new Error("Attempting to parse an unsupported image function \""
|
|
3413
|
+
throw new Error("Attempting to parse an unsupported image function \"".concat(value.name, "\""));
|
|
2593
3414
|
}
|
|
2594
3415
|
return imageFunction(context, value.values);
|
|
2595
3416
|
}
|
|
2596
|
-
throw new Error("Unsupported image type "
|
|
3417
|
+
throw new Error("Unsupported image type ".concat(value.type));
|
|
2597
3418
|
}
|
|
2598
3419
|
};
|
|
2599
3420
|
function isSupportedImage(value) {
|
|
2600
|
-
return (!(value.type === 20 /* IDENT_TOKEN */ && value.value === 'none') &&
|
|
2601
|
-
(value.type !== 18 /* FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]));
|
|
3421
|
+
return (!(value.type === 20 /* TokenType.IDENT_TOKEN */ && value.value === 'none') &&
|
|
3422
|
+
(value.type !== 18 /* TokenType.FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]));
|
|
2602
3423
|
}
|
|
2603
3424
|
var SUPPORTED_IMAGE_FUNCTIONS = {
|
|
2604
3425
|
'linear-gradient': linearGradient,
|
|
@@ -2617,14 +3438,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2617
3438
|
var backgroundImage = {
|
|
2618
3439
|
name: 'background-image',
|
|
2619
3440
|
initialValue: 'none',
|
|
2620
|
-
type: 1 /* LIST */,
|
|
3441
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2621
3442
|
prefix: false,
|
|
2622
3443
|
parse: function (context, tokens) {
|
|
2623
3444
|
if (tokens.length === 0) {
|
|
2624
3445
|
return [];
|
|
2625
3446
|
}
|
|
2626
3447
|
var first = tokens[0];
|
|
2627
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
3448
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
2628
3449
|
return [];
|
|
2629
3450
|
}
|
|
2630
3451
|
return tokens
|
|
@@ -2637,18 +3458,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2637
3458
|
name: 'background-origin',
|
|
2638
3459
|
initialValue: 'border-box',
|
|
2639
3460
|
prefix: false,
|
|
2640
|
-
type: 1 /* LIST */,
|
|
3461
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2641
3462
|
parse: function (_context, tokens) {
|
|
2642
3463
|
return tokens.map(function (token) {
|
|
2643
3464
|
if (isIdentToken(token)) {
|
|
2644
3465
|
switch (token.value) {
|
|
2645
3466
|
case 'padding-box':
|
|
2646
|
-
return 1 /* PADDING_BOX */;
|
|
3467
|
+
return 1 /* BACKGROUND_ORIGIN.PADDING_BOX */;
|
|
2647
3468
|
case 'content-box':
|
|
2648
|
-
return 2 /* CONTENT_BOX */;
|
|
3469
|
+
return 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */;
|
|
2649
3470
|
}
|
|
2650
3471
|
}
|
|
2651
|
-
return 0 /* BORDER_BOX */;
|
|
3472
|
+
return 0 /* BACKGROUND_ORIGIN.BORDER_BOX */;
|
|
2652
3473
|
});
|
|
2653
3474
|
}
|
|
2654
3475
|
};
|
|
@@ -2656,7 +3477,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2656
3477
|
var backgroundPosition = {
|
|
2657
3478
|
name: 'background-position',
|
|
2658
3479
|
initialValue: '0% 0%',
|
|
2659
|
-
type: 1 /* LIST */,
|
|
3480
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2660
3481
|
prefix: false,
|
|
2661
3482
|
parse: function (_context, tokens) {
|
|
2662
3483
|
return parseFunctionArgs(tokens)
|
|
@@ -2669,7 +3490,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2669
3490
|
name: 'background-repeat',
|
|
2670
3491
|
initialValue: 'repeat',
|
|
2671
3492
|
prefix: false,
|
|
2672
|
-
type: 1 /* LIST */,
|
|
3493
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2673
3494
|
parse: function (_context, tokens) {
|
|
2674
3495
|
return parseFunctionArgs(tokens)
|
|
2675
3496
|
.map(function (values) {
|
|
@@ -2684,16 +3505,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2684
3505
|
var parseBackgroundRepeat = function (value) {
|
|
2685
3506
|
switch (value) {
|
|
2686
3507
|
case 'no-repeat':
|
|
2687
|
-
return 1 /* NO_REPEAT */;
|
|
3508
|
+
return 1 /* BACKGROUND_REPEAT.NO_REPEAT */;
|
|
2688
3509
|
case 'repeat-x':
|
|
2689
3510
|
case 'repeat no-repeat':
|
|
2690
|
-
return 2 /* REPEAT_X */;
|
|
3511
|
+
return 2 /* BACKGROUND_REPEAT.REPEAT_X */;
|
|
2691
3512
|
case 'repeat-y':
|
|
2692
3513
|
case 'no-repeat repeat':
|
|
2693
|
-
return 3 /* REPEAT_Y */;
|
|
3514
|
+
return 3 /* BACKGROUND_REPEAT.REPEAT_Y */;
|
|
2694
3515
|
case 'repeat':
|
|
2695
3516
|
default:
|
|
2696
|
-
return 0 /* REPEAT */;
|
|
3517
|
+
return 0 /* BACKGROUND_REPEAT.REPEAT */;
|
|
2697
3518
|
}
|
|
2698
3519
|
};
|
|
2699
3520
|
|
|
@@ -2707,7 +3528,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2707
3528
|
name: 'background-size',
|
|
2708
3529
|
initialValue: '0',
|
|
2709
3530
|
prefix: false,
|
|
2710
|
-
type: 1 /* LIST */,
|
|
3531
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2711
3532
|
parse: function (_context, tokens) {
|
|
2712
3533
|
return parseFunctionArgs(tokens).map(function (values) { return values.filter(isBackgroundSizeInfoToken); });
|
|
2713
3534
|
}
|
|
@@ -2717,10 +3538,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2717
3538
|
};
|
|
2718
3539
|
|
|
2719
3540
|
var borderColorForSide = function (side) { return ({
|
|
2720
|
-
name: "border-"
|
|
3541
|
+
name: "border-".concat(side, "-color"),
|
|
2721
3542
|
initialValue: 'transparent',
|
|
2722
3543
|
prefix: false,
|
|
2723
|
-
type: 3 /* TYPE_VALUE */,
|
|
3544
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2724
3545
|
format: 'color'
|
|
2725
3546
|
}); };
|
|
2726
3547
|
var borderTopColor = borderColorForSide('top');
|
|
@@ -2729,10 +3550,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2729
3550
|
var borderLeftColor = borderColorForSide('left');
|
|
2730
3551
|
|
|
2731
3552
|
var borderRadiusForSide = function (side) { return ({
|
|
2732
|
-
name: "border-radius-"
|
|
3553
|
+
name: "border-radius-".concat(side),
|
|
2733
3554
|
initialValue: '0 0',
|
|
2734
3555
|
prefix: false,
|
|
2735
|
-
type: 1 /* LIST */,
|
|
3556
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2736
3557
|
parse: function (_context, tokens) {
|
|
2737
3558
|
return parseLengthPercentageTuple(tokens.filter(isLengthPercentage));
|
|
2738
3559
|
}
|
|
@@ -2743,22 +3564,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2743
3564
|
var borderBottomLeftRadius = borderRadiusForSide('bottom-left');
|
|
2744
3565
|
|
|
2745
3566
|
var borderStyleForSide = function (side) { return ({
|
|
2746
|
-
name: "border-"
|
|
3567
|
+
name: "border-".concat(side, "-style"),
|
|
2747
3568
|
initialValue: 'solid',
|
|
2748
3569
|
prefix: false,
|
|
2749
|
-
type: 2 /* IDENT_VALUE */,
|
|
3570
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2750
3571
|
parse: function (_context, style) {
|
|
2751
3572
|
switch (style) {
|
|
2752
3573
|
case 'none':
|
|
2753
|
-
return 0 /* NONE */;
|
|
3574
|
+
return 0 /* BORDER_STYLE.NONE */;
|
|
2754
3575
|
case 'dashed':
|
|
2755
|
-
return 2 /* DASHED */;
|
|
3576
|
+
return 2 /* BORDER_STYLE.DASHED */;
|
|
2756
3577
|
case 'dotted':
|
|
2757
|
-
return 3 /* DOTTED */;
|
|
3578
|
+
return 3 /* BORDER_STYLE.DOTTED */;
|
|
2758
3579
|
case 'double':
|
|
2759
|
-
return 4 /* DOUBLE */;
|
|
3580
|
+
return 4 /* BORDER_STYLE.DOUBLE */;
|
|
2760
3581
|
}
|
|
2761
|
-
return 1 /* SOLID */;
|
|
3582
|
+
return 1 /* BORDER_STYLE.SOLID */;
|
|
2762
3583
|
}
|
|
2763
3584
|
}); };
|
|
2764
3585
|
var borderTopStyle = borderStyleForSide('top');
|
|
@@ -2767,9 +3588,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2767
3588
|
var borderLeftStyle = borderStyleForSide('left');
|
|
2768
3589
|
|
|
2769
3590
|
var borderWidthForSide = function (side) { return ({
|
|
2770
|
-
name: "border-"
|
|
3591
|
+
name: "border-".concat(side, "-width"),
|
|
2771
3592
|
initialValue: '0',
|
|
2772
|
-
type: 0 /* VALUE */,
|
|
3593
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2773
3594
|
prefix: false,
|
|
2774
3595
|
parse: function (_context, token) {
|
|
2775
3596
|
if (isDimensionToken(token)) {
|
|
@@ -2787,7 +3608,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2787
3608
|
name: "color",
|
|
2788
3609
|
initialValue: 'transparent',
|
|
2789
3610
|
prefix: false,
|
|
2790
|
-
type: 3 /* TYPE_VALUE */,
|
|
3611
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2791
3612
|
format: 'color'
|
|
2792
3613
|
};
|
|
2793
3614
|
|
|
@@ -2795,14 +3616,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2795
3616
|
name: 'direction',
|
|
2796
3617
|
initialValue: 'ltr',
|
|
2797
3618
|
prefix: false,
|
|
2798
|
-
type: 2 /* IDENT_VALUE */,
|
|
3619
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2799
3620
|
parse: function (_context, direction) {
|
|
2800
3621
|
switch (direction) {
|
|
2801
3622
|
case 'rtl':
|
|
2802
|
-
return 1 /* RTL */;
|
|
3623
|
+
return 1 /* DIRECTION.RTL */;
|
|
2803
3624
|
case 'ltr':
|
|
2804
3625
|
default:
|
|
2805
|
-
return 0 /* LTR */;
|
|
3626
|
+
return 0 /* DIRECTION.LTR */;
|
|
2806
3627
|
}
|
|
2807
3628
|
}
|
|
2808
3629
|
};
|
|
@@ -2811,97 +3632,97 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2811
3632
|
name: 'display',
|
|
2812
3633
|
initialValue: 'inline-block',
|
|
2813
3634
|
prefix: false,
|
|
2814
|
-
type: 1 /* LIST */,
|
|
3635
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2815
3636
|
parse: function (_context, tokens) {
|
|
2816
3637
|
return tokens.filter(isIdentToken).reduce(function (bit, token) {
|
|
2817
|
-
return bit | parseDisplayValue(token.value);
|
|
2818
|
-
}, 0 /* NONE */);
|
|
3638
|
+
return bit | parseDisplayValue$1(token.value);
|
|
3639
|
+
}, 0 /* DISPLAY.NONE */);
|
|
2819
3640
|
}
|
|
2820
3641
|
};
|
|
2821
|
-
var parseDisplayValue = function (display) {
|
|
3642
|
+
var parseDisplayValue$1 = function (display) {
|
|
2822
3643
|
switch (display) {
|
|
2823
3644
|
case 'block':
|
|
2824
3645
|
case '-webkit-box':
|
|
2825
|
-
return 2 /* BLOCK */;
|
|
3646
|
+
return 2 /* DISPLAY.BLOCK */;
|
|
2826
3647
|
case 'inline':
|
|
2827
|
-
return 4 /* INLINE */;
|
|
3648
|
+
return 4 /* DISPLAY.INLINE */;
|
|
2828
3649
|
case 'run-in':
|
|
2829
|
-
return 8 /* RUN_IN */;
|
|
3650
|
+
return 8 /* DISPLAY.RUN_IN */;
|
|
2830
3651
|
case 'flow':
|
|
2831
|
-
return 16 /* FLOW */;
|
|
3652
|
+
return 16 /* DISPLAY.FLOW */;
|
|
2832
3653
|
case 'flow-root':
|
|
2833
|
-
return 32 /* FLOW_ROOT */;
|
|
3654
|
+
return 32 /* DISPLAY.FLOW_ROOT */;
|
|
2834
3655
|
case 'table':
|
|
2835
|
-
return 64 /* TABLE */;
|
|
3656
|
+
return 64 /* DISPLAY.TABLE */;
|
|
2836
3657
|
case 'flex':
|
|
2837
3658
|
case '-webkit-flex':
|
|
2838
|
-
return 128 /* FLEX */;
|
|
3659
|
+
return 128 /* DISPLAY.FLEX */;
|
|
2839
3660
|
case 'grid':
|
|
2840
3661
|
case '-ms-grid':
|
|
2841
|
-
return 256 /* GRID */;
|
|
3662
|
+
return 256 /* DISPLAY.GRID */;
|
|
2842
3663
|
case 'ruby':
|
|
2843
|
-
return 512 /* RUBY */;
|
|
3664
|
+
return 512 /* DISPLAY.RUBY */;
|
|
2844
3665
|
case 'subgrid':
|
|
2845
|
-
return 1024 /* SUBGRID */;
|
|
3666
|
+
return 1024 /* DISPLAY.SUBGRID */;
|
|
2846
3667
|
case 'list-item':
|
|
2847
|
-
return 2048 /* LIST_ITEM */;
|
|
3668
|
+
return 2048 /* DISPLAY.LIST_ITEM */;
|
|
2848
3669
|
case 'table-row-group':
|
|
2849
|
-
return 4096 /* TABLE_ROW_GROUP */;
|
|
3670
|
+
return 4096 /* DISPLAY.TABLE_ROW_GROUP */;
|
|
2850
3671
|
case 'table-header-group':
|
|
2851
|
-
return 8192 /* TABLE_HEADER_GROUP */;
|
|
3672
|
+
return 8192 /* DISPLAY.TABLE_HEADER_GROUP */;
|
|
2852
3673
|
case 'table-footer-group':
|
|
2853
|
-
return 16384 /* TABLE_FOOTER_GROUP */;
|
|
3674
|
+
return 16384 /* DISPLAY.TABLE_FOOTER_GROUP */;
|
|
2854
3675
|
case 'table-row':
|
|
2855
|
-
return 32768 /* TABLE_ROW */;
|
|
3676
|
+
return 32768 /* DISPLAY.TABLE_ROW */;
|
|
2856
3677
|
case 'table-cell':
|
|
2857
|
-
return 65536 /* TABLE_CELL */;
|
|
3678
|
+
return 65536 /* DISPLAY.TABLE_CELL */;
|
|
2858
3679
|
case 'table-column-group':
|
|
2859
|
-
return 131072 /* TABLE_COLUMN_GROUP */;
|
|
3680
|
+
return 131072 /* DISPLAY.TABLE_COLUMN_GROUP */;
|
|
2860
3681
|
case 'table-column':
|
|
2861
|
-
return 262144 /* TABLE_COLUMN */;
|
|
3682
|
+
return 262144 /* DISPLAY.TABLE_COLUMN */;
|
|
2862
3683
|
case 'table-caption':
|
|
2863
|
-
return 524288 /* TABLE_CAPTION */;
|
|
3684
|
+
return 524288 /* DISPLAY.TABLE_CAPTION */;
|
|
2864
3685
|
case 'ruby-base':
|
|
2865
|
-
return 1048576 /* RUBY_BASE */;
|
|
3686
|
+
return 1048576 /* DISPLAY.RUBY_BASE */;
|
|
2866
3687
|
case 'ruby-text':
|
|
2867
|
-
return 2097152 /* RUBY_TEXT */;
|
|
3688
|
+
return 2097152 /* DISPLAY.RUBY_TEXT */;
|
|
2868
3689
|
case 'ruby-base-container':
|
|
2869
|
-
return 4194304 /* RUBY_BASE_CONTAINER */;
|
|
3690
|
+
return 4194304 /* DISPLAY.RUBY_BASE_CONTAINER */;
|
|
2870
3691
|
case 'ruby-text-container':
|
|
2871
|
-
return 8388608 /* RUBY_TEXT_CONTAINER */;
|
|
3692
|
+
return 8388608 /* DISPLAY.RUBY_TEXT_CONTAINER */;
|
|
2872
3693
|
case 'contents':
|
|
2873
|
-
return 16777216 /* CONTENTS */;
|
|
3694
|
+
return 16777216 /* DISPLAY.CONTENTS */;
|
|
2874
3695
|
case 'inline-block':
|
|
2875
|
-
return 33554432 /* INLINE_BLOCK */;
|
|
3696
|
+
return 33554432 /* DISPLAY.INLINE_BLOCK */;
|
|
2876
3697
|
case 'inline-list-item':
|
|
2877
|
-
return 67108864 /* INLINE_LIST_ITEM */;
|
|
3698
|
+
return 67108864 /* DISPLAY.INLINE_LIST_ITEM */;
|
|
2878
3699
|
case 'inline-table':
|
|
2879
|
-
return 134217728 /* INLINE_TABLE */;
|
|
3700
|
+
return 134217728 /* DISPLAY.INLINE_TABLE */;
|
|
2880
3701
|
case 'inline-flex':
|
|
2881
|
-
return 268435456 /* INLINE_FLEX */;
|
|
3702
|
+
return 268435456 /* DISPLAY.INLINE_FLEX */;
|
|
2882
3703
|
case 'inline-grid':
|
|
2883
|
-
return 536870912 /* INLINE_GRID */;
|
|
3704
|
+
return 536870912 /* DISPLAY.INLINE_GRID */;
|
|
2884
3705
|
}
|
|
2885
|
-
return 0 /* NONE */;
|
|
3706
|
+
return 0 /* DISPLAY.NONE */;
|
|
2886
3707
|
};
|
|
2887
3708
|
|
|
2888
3709
|
var float = {
|
|
2889
3710
|
name: 'float',
|
|
2890
3711
|
initialValue: 'none',
|
|
2891
3712
|
prefix: false,
|
|
2892
|
-
type: 2 /* IDENT_VALUE */,
|
|
3713
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2893
3714
|
parse: function (_context, float) {
|
|
2894
3715
|
switch (float) {
|
|
2895
3716
|
case 'left':
|
|
2896
|
-
return 1 /* LEFT */;
|
|
3717
|
+
return 1 /* FLOAT.LEFT */;
|
|
2897
3718
|
case 'right':
|
|
2898
|
-
return 2 /* RIGHT */;
|
|
3719
|
+
return 2 /* FLOAT.RIGHT */;
|
|
2899
3720
|
case 'inline-start':
|
|
2900
|
-
return 3 /* INLINE_START */;
|
|
3721
|
+
return 3 /* FLOAT.INLINE_START */;
|
|
2901
3722
|
case 'inline-end':
|
|
2902
|
-
return 4 /* INLINE_END */;
|
|
3723
|
+
return 4 /* FLOAT.INLINE_END */;
|
|
2903
3724
|
}
|
|
2904
|
-
return 0 /* NONE */;
|
|
3725
|
+
return 0 /* FLOAT.NONE */;
|
|
2905
3726
|
}
|
|
2906
3727
|
};
|
|
2907
3728
|
|
|
@@ -2909,15 +3730,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2909
3730
|
name: 'letter-spacing',
|
|
2910
3731
|
initialValue: '0',
|
|
2911
3732
|
prefix: false,
|
|
2912
|
-
type: 0 /* VALUE */,
|
|
3733
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2913
3734
|
parse: function (_context, token) {
|
|
2914
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'normal') {
|
|
3735
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'normal') {
|
|
2915
3736
|
return 0;
|
|
2916
3737
|
}
|
|
2917
|
-
if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
3738
|
+
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
2918
3739
|
return token.number;
|
|
2919
3740
|
}
|
|
2920
|
-
if (token.type === 15 /* DIMENSION_TOKEN */) {
|
|
3741
|
+
if (token.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
2921
3742
|
return token.number;
|
|
2922
3743
|
}
|
|
2923
3744
|
return 0;
|
|
@@ -2933,7 +3754,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2933
3754
|
name: 'line-break',
|
|
2934
3755
|
initialValue: 'normal',
|
|
2935
3756
|
prefix: false,
|
|
2936
|
-
type: 2 /* IDENT_VALUE */,
|
|
3757
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2937
3758
|
parse: function (_context, lineBreak) {
|
|
2938
3759
|
switch (lineBreak) {
|
|
2939
3760
|
case 'strict':
|
|
@@ -2949,13 +3770,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2949
3770
|
name: 'line-height',
|
|
2950
3771
|
initialValue: 'normal',
|
|
2951
3772
|
prefix: false,
|
|
2952
|
-
type: 4 /* TOKEN_VALUE */
|
|
3773
|
+
type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
|
|
2953
3774
|
};
|
|
2954
3775
|
var computeLineHeight = function (token, fontSize) {
|
|
2955
3776
|
if (isIdentToken(token) && token.value === 'normal') {
|
|
2956
3777
|
return 1.2 * fontSize;
|
|
2957
3778
|
}
|
|
2958
|
-
else if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
3779
|
+
else if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
2959
3780
|
return fontSize * token.number;
|
|
2960
3781
|
}
|
|
2961
3782
|
else if (isLengthPercentage(token)) {
|
|
@@ -2967,10 +3788,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2967
3788
|
var listStyleImage = {
|
|
2968
3789
|
name: 'list-style-image',
|
|
2969
3790
|
initialValue: 'none',
|
|
2970
|
-
type: 0 /* VALUE */,
|
|
3791
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2971
3792
|
prefix: false,
|
|
2972
3793
|
parse: function (context, token) {
|
|
2973
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
|
|
3794
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
|
|
2974
3795
|
return null;
|
|
2975
3796
|
}
|
|
2976
3797
|
return image.parse(context, token);
|
|
@@ -2981,14 +3802,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2981
3802
|
name: 'list-style-position',
|
|
2982
3803
|
initialValue: 'outside',
|
|
2983
3804
|
prefix: false,
|
|
2984
|
-
type: 2 /* IDENT_VALUE */,
|
|
3805
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2985
3806
|
parse: function (_context, position) {
|
|
2986
3807
|
switch (position) {
|
|
2987
3808
|
case 'inside':
|
|
2988
|
-
return 0 /* INSIDE */;
|
|
3809
|
+
return 0 /* LIST_STYLE_POSITION.INSIDE */;
|
|
2989
3810
|
case 'outside':
|
|
2990
3811
|
default:
|
|
2991
|
-
return 1 /* OUTSIDE */;
|
|
3812
|
+
return 1 /* LIST_STYLE_POSITION.OUTSIDE */;
|
|
2992
3813
|
}
|
|
2993
3814
|
}
|
|
2994
3815
|
};
|
|
@@ -2997,127 +3818,127 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2997
3818
|
name: 'list-style-type',
|
|
2998
3819
|
initialValue: 'none',
|
|
2999
3820
|
prefix: false,
|
|
3000
|
-
type: 2 /* IDENT_VALUE */,
|
|
3821
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3001
3822
|
parse: function (_context, type) {
|
|
3002
3823
|
switch (type) {
|
|
3003
3824
|
case 'disc':
|
|
3004
|
-
return 0 /* DISC */;
|
|
3825
|
+
return 0 /* LIST_STYLE_TYPE.DISC */;
|
|
3005
3826
|
case 'circle':
|
|
3006
|
-
return 1 /* CIRCLE */;
|
|
3827
|
+
return 1 /* LIST_STYLE_TYPE.CIRCLE */;
|
|
3007
3828
|
case 'square':
|
|
3008
|
-
return 2 /* SQUARE */;
|
|
3829
|
+
return 2 /* LIST_STYLE_TYPE.SQUARE */;
|
|
3009
3830
|
case 'decimal':
|
|
3010
|
-
return 3 /* DECIMAL */;
|
|
3831
|
+
return 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
3011
3832
|
case 'cjk-decimal':
|
|
3012
|
-
return 4 /* CJK_DECIMAL */;
|
|
3833
|
+
return 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */;
|
|
3013
3834
|
case 'decimal-leading-zero':
|
|
3014
|
-
return 5 /* DECIMAL_LEADING_ZERO */;
|
|
3835
|
+
return 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */;
|
|
3015
3836
|
case 'lower-roman':
|
|
3016
|
-
return 6 /* LOWER_ROMAN */;
|
|
3837
|
+
return 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */;
|
|
3017
3838
|
case 'upper-roman':
|
|
3018
|
-
return 7 /* UPPER_ROMAN */;
|
|
3839
|
+
return 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */;
|
|
3019
3840
|
case 'lower-greek':
|
|
3020
|
-
return 8 /* LOWER_GREEK */;
|
|
3841
|
+
return 8 /* LIST_STYLE_TYPE.LOWER_GREEK */;
|
|
3021
3842
|
case 'lower-alpha':
|
|
3022
|
-
return 9 /* LOWER_ALPHA */;
|
|
3843
|
+
return 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */;
|
|
3023
3844
|
case 'upper-alpha':
|
|
3024
|
-
return 10 /* UPPER_ALPHA */;
|
|
3845
|
+
return 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */;
|
|
3025
3846
|
case 'arabic-indic':
|
|
3026
|
-
return 11 /* ARABIC_INDIC */;
|
|
3847
|
+
return 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */;
|
|
3027
3848
|
case 'armenian':
|
|
3028
|
-
return 12 /* ARMENIAN */;
|
|
3849
|
+
return 12 /* LIST_STYLE_TYPE.ARMENIAN */;
|
|
3029
3850
|
case 'bengali':
|
|
3030
|
-
return 13 /* BENGALI */;
|
|
3851
|
+
return 13 /* LIST_STYLE_TYPE.BENGALI */;
|
|
3031
3852
|
case 'cambodian':
|
|
3032
|
-
return 14 /* CAMBODIAN */;
|
|
3853
|
+
return 14 /* LIST_STYLE_TYPE.CAMBODIAN */;
|
|
3033
3854
|
case 'cjk-earthly-branch':
|
|
3034
|
-
return 15 /* CJK_EARTHLY_BRANCH */;
|
|
3855
|
+
return 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */;
|
|
3035
3856
|
case 'cjk-heavenly-stem':
|
|
3036
|
-
return 16 /* CJK_HEAVENLY_STEM */;
|
|
3857
|
+
return 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */;
|
|
3037
3858
|
case 'cjk-ideographic':
|
|
3038
|
-
return 17 /* CJK_IDEOGRAPHIC */;
|
|
3859
|
+
return 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */;
|
|
3039
3860
|
case 'devanagari':
|
|
3040
|
-
return 18 /* DEVANAGARI */;
|
|
3861
|
+
return 18 /* LIST_STYLE_TYPE.DEVANAGARI */;
|
|
3041
3862
|
case 'ethiopic-numeric':
|
|
3042
|
-
return 19 /* ETHIOPIC_NUMERIC */;
|
|
3863
|
+
return 19 /* LIST_STYLE_TYPE.ETHIOPIC_NUMERIC */;
|
|
3043
3864
|
case 'georgian':
|
|
3044
|
-
return 20 /* GEORGIAN */;
|
|
3865
|
+
return 20 /* LIST_STYLE_TYPE.GEORGIAN */;
|
|
3045
3866
|
case 'gujarati':
|
|
3046
|
-
return 21 /* GUJARATI */;
|
|
3867
|
+
return 21 /* LIST_STYLE_TYPE.GUJARATI */;
|
|
3047
3868
|
case 'gurmukhi':
|
|
3048
|
-
return 22 /* GURMUKHI */;
|
|
3869
|
+
return 22 /* LIST_STYLE_TYPE.GURMUKHI */;
|
|
3049
3870
|
case 'hebrew':
|
|
3050
|
-
return 22 /* HEBREW */;
|
|
3871
|
+
return 22 /* LIST_STYLE_TYPE.HEBREW */;
|
|
3051
3872
|
case 'hiragana':
|
|
3052
|
-
return 23 /* HIRAGANA */;
|
|
3873
|
+
return 23 /* LIST_STYLE_TYPE.HIRAGANA */;
|
|
3053
3874
|
case 'hiragana-iroha':
|
|
3054
|
-
return 24 /* HIRAGANA_IROHA */;
|
|
3875
|
+
return 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */;
|
|
3055
3876
|
case 'japanese-formal':
|
|
3056
|
-
return 25 /* JAPANESE_FORMAL */;
|
|
3877
|
+
return 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */;
|
|
3057
3878
|
case 'japanese-informal':
|
|
3058
|
-
return 26 /* JAPANESE_INFORMAL */;
|
|
3879
|
+
return 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */;
|
|
3059
3880
|
case 'kannada':
|
|
3060
|
-
return 27 /* KANNADA */;
|
|
3881
|
+
return 27 /* LIST_STYLE_TYPE.KANNADA */;
|
|
3061
3882
|
case 'katakana':
|
|
3062
|
-
return 28 /* KATAKANA */;
|
|
3883
|
+
return 28 /* LIST_STYLE_TYPE.KATAKANA */;
|
|
3063
3884
|
case 'katakana-iroha':
|
|
3064
|
-
return 29 /* KATAKANA_IROHA */;
|
|
3885
|
+
return 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */;
|
|
3065
3886
|
case 'khmer':
|
|
3066
|
-
return 30 /* KHMER */;
|
|
3887
|
+
return 30 /* LIST_STYLE_TYPE.KHMER */;
|
|
3067
3888
|
case 'korean-hangul-formal':
|
|
3068
|
-
return 31 /* KOREAN_HANGUL_FORMAL */;
|
|
3889
|
+
return 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */;
|
|
3069
3890
|
case 'korean-hanja-formal':
|
|
3070
|
-
return 32 /* KOREAN_HANJA_FORMAL */;
|
|
3891
|
+
return 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */;
|
|
3071
3892
|
case 'korean-hanja-informal':
|
|
3072
|
-
return 33 /* KOREAN_HANJA_INFORMAL */;
|
|
3893
|
+
return 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */;
|
|
3073
3894
|
case 'lao':
|
|
3074
|
-
return 34 /* LAO */;
|
|
3895
|
+
return 34 /* LIST_STYLE_TYPE.LAO */;
|
|
3075
3896
|
case 'lower-armenian':
|
|
3076
|
-
return 35 /* LOWER_ARMENIAN */;
|
|
3897
|
+
return 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */;
|
|
3077
3898
|
case 'malayalam':
|
|
3078
|
-
return 36 /* MALAYALAM */;
|
|
3899
|
+
return 36 /* LIST_STYLE_TYPE.MALAYALAM */;
|
|
3079
3900
|
case 'mongolian':
|
|
3080
|
-
return 37 /* MONGOLIAN */;
|
|
3901
|
+
return 37 /* LIST_STYLE_TYPE.MONGOLIAN */;
|
|
3081
3902
|
case 'myanmar':
|
|
3082
|
-
return 38 /* MYANMAR */;
|
|
3903
|
+
return 38 /* LIST_STYLE_TYPE.MYANMAR */;
|
|
3083
3904
|
case 'oriya':
|
|
3084
|
-
return 39 /* ORIYA */;
|
|
3905
|
+
return 39 /* LIST_STYLE_TYPE.ORIYA */;
|
|
3085
3906
|
case 'persian':
|
|
3086
|
-
return 40 /* PERSIAN */;
|
|
3907
|
+
return 40 /* LIST_STYLE_TYPE.PERSIAN */;
|
|
3087
3908
|
case 'simp-chinese-formal':
|
|
3088
|
-
return 41 /* SIMP_CHINESE_FORMAL */;
|
|
3909
|
+
return 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */;
|
|
3089
3910
|
case 'simp-chinese-informal':
|
|
3090
|
-
return 42 /* SIMP_CHINESE_INFORMAL */;
|
|
3911
|
+
return 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */;
|
|
3091
3912
|
case 'tamil':
|
|
3092
|
-
return 43 /* TAMIL */;
|
|
3913
|
+
return 43 /* LIST_STYLE_TYPE.TAMIL */;
|
|
3093
3914
|
case 'telugu':
|
|
3094
|
-
return 44 /* TELUGU */;
|
|
3915
|
+
return 44 /* LIST_STYLE_TYPE.TELUGU */;
|
|
3095
3916
|
case 'thai':
|
|
3096
|
-
return 45 /* THAI */;
|
|
3917
|
+
return 45 /* LIST_STYLE_TYPE.THAI */;
|
|
3097
3918
|
case 'tibetan':
|
|
3098
|
-
return 46 /* TIBETAN */;
|
|
3919
|
+
return 46 /* LIST_STYLE_TYPE.TIBETAN */;
|
|
3099
3920
|
case 'trad-chinese-formal':
|
|
3100
|
-
return 47 /* TRAD_CHINESE_FORMAL */;
|
|
3921
|
+
return 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */;
|
|
3101
3922
|
case 'trad-chinese-informal':
|
|
3102
|
-
return 48 /* TRAD_CHINESE_INFORMAL */;
|
|
3923
|
+
return 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */;
|
|
3103
3924
|
case 'upper-armenian':
|
|
3104
|
-
return 49 /* UPPER_ARMENIAN */;
|
|
3925
|
+
return 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */;
|
|
3105
3926
|
case 'disclosure-open':
|
|
3106
|
-
return 50 /* DISCLOSURE_OPEN */;
|
|
3927
|
+
return 50 /* LIST_STYLE_TYPE.DISCLOSURE_OPEN */;
|
|
3107
3928
|
case 'disclosure-closed':
|
|
3108
|
-
return 51 /* DISCLOSURE_CLOSED */;
|
|
3929
|
+
return 51 /* LIST_STYLE_TYPE.DISCLOSURE_CLOSED */;
|
|
3109
3930
|
case 'none':
|
|
3110
3931
|
default:
|
|
3111
|
-
return -1 /* NONE */;
|
|
3932
|
+
return -1 /* LIST_STYLE_TYPE.NONE */;
|
|
3112
3933
|
}
|
|
3113
3934
|
}
|
|
3114
3935
|
};
|
|
3115
3936
|
|
|
3116
3937
|
var marginForSide = function (side) { return ({
|
|
3117
|
-
name: "margin-"
|
|
3938
|
+
name: "margin-".concat(side),
|
|
3118
3939
|
initialValue: '0',
|
|
3119
3940
|
prefix: false,
|
|
3120
|
-
type: 4 /* TOKEN_VALUE */
|
|
3941
|
+
type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
|
|
3121
3942
|
}); };
|
|
3122
3943
|
var marginTop = marginForSide('top');
|
|
3123
3944
|
var marginRight = marginForSide('right');
|
|
@@ -3128,21 +3949,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3128
3949
|
name: 'overflow',
|
|
3129
3950
|
initialValue: 'visible',
|
|
3130
3951
|
prefix: false,
|
|
3131
|
-
type: 1 /* LIST */,
|
|
3952
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3132
3953
|
parse: function (_context, tokens) {
|
|
3133
3954
|
return tokens.filter(isIdentToken).map(function (overflow) {
|
|
3134
3955
|
switch (overflow.value) {
|
|
3135
3956
|
case 'hidden':
|
|
3136
|
-
return 1 /* HIDDEN */;
|
|
3957
|
+
return 1 /* OVERFLOW.HIDDEN */;
|
|
3137
3958
|
case 'scroll':
|
|
3138
|
-
return 2 /* SCROLL */;
|
|
3959
|
+
return 2 /* OVERFLOW.SCROLL */;
|
|
3139
3960
|
case 'clip':
|
|
3140
|
-
return 3 /* CLIP */;
|
|
3961
|
+
return 3 /* OVERFLOW.CLIP */;
|
|
3141
3962
|
case 'auto':
|
|
3142
|
-
return 4 /* AUTO */;
|
|
3963
|
+
return 4 /* OVERFLOW.AUTO */;
|
|
3143
3964
|
case 'visible':
|
|
3144
3965
|
default:
|
|
3145
|
-
return 0 /* VISIBLE */;
|
|
3966
|
+
return 0 /* OVERFLOW.VISIBLE */;
|
|
3146
3967
|
}
|
|
3147
3968
|
});
|
|
3148
3969
|
}
|
|
@@ -3152,23 +3973,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3152
3973
|
name: 'overflow-wrap',
|
|
3153
3974
|
initialValue: 'normal',
|
|
3154
3975
|
prefix: false,
|
|
3155
|
-
type: 2 /* IDENT_VALUE */,
|
|
3976
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3156
3977
|
parse: function (_context, overflow) {
|
|
3157
3978
|
switch (overflow) {
|
|
3158
3979
|
case 'break-word':
|
|
3159
|
-
return "break-word" /* BREAK_WORD */;
|
|
3980
|
+
return "break-word" /* OVERFLOW_WRAP.BREAK_WORD */;
|
|
3160
3981
|
case 'normal':
|
|
3161
3982
|
default:
|
|
3162
|
-
return "normal" /* NORMAL */;
|
|
3983
|
+
return "normal" /* OVERFLOW_WRAP.NORMAL */;
|
|
3163
3984
|
}
|
|
3164
3985
|
}
|
|
3165
3986
|
};
|
|
3166
3987
|
|
|
3167
3988
|
var paddingForSide = function (side) { return ({
|
|
3168
|
-
name: "padding-"
|
|
3989
|
+
name: "padding-".concat(side),
|
|
3169
3990
|
initialValue: '0',
|
|
3170
3991
|
prefix: false,
|
|
3171
|
-
type: 3 /* TYPE_VALUE */,
|
|
3992
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3172
3993
|
format: 'length-percentage'
|
|
3173
3994
|
}); };
|
|
3174
3995
|
var paddingTop = paddingForSide('top');
|
|
@@ -3180,17 +4001,17 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3180
4001
|
name: 'text-align',
|
|
3181
4002
|
initialValue: 'left',
|
|
3182
4003
|
prefix: false,
|
|
3183
|
-
type: 2 /* IDENT_VALUE */,
|
|
4004
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3184
4005
|
parse: function (_context, textAlign) {
|
|
3185
4006
|
switch (textAlign) {
|
|
3186
4007
|
case 'right':
|
|
3187
|
-
return 2 /* RIGHT */;
|
|
4008
|
+
return 2 /* TEXT_ALIGN.RIGHT */;
|
|
3188
4009
|
case 'center':
|
|
3189
4010
|
case 'justify':
|
|
3190
|
-
return 1 /* CENTER */;
|
|
4011
|
+
return 1 /* TEXT_ALIGN.CENTER */;
|
|
3191
4012
|
case 'left':
|
|
3192
4013
|
default:
|
|
3193
|
-
return 0 /* LEFT */;
|
|
4014
|
+
return 0 /* TEXT_ALIGN.LEFT */;
|
|
3194
4015
|
}
|
|
3195
4016
|
}
|
|
3196
4017
|
};
|
|
@@ -3199,26 +4020,26 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3199
4020
|
name: 'position',
|
|
3200
4021
|
initialValue: 'static',
|
|
3201
4022
|
prefix: false,
|
|
3202
|
-
type: 2 /* IDENT_VALUE */,
|
|
4023
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3203
4024
|
parse: function (_context, position) {
|
|
3204
4025
|
switch (position) {
|
|
3205
4026
|
case 'relative':
|
|
3206
|
-
return 1 /* RELATIVE */;
|
|
4027
|
+
return 1 /* POSITION.RELATIVE */;
|
|
3207
4028
|
case 'absolute':
|
|
3208
|
-
return 2 /* ABSOLUTE */;
|
|
4029
|
+
return 2 /* POSITION.ABSOLUTE */;
|
|
3209
4030
|
case 'fixed':
|
|
3210
|
-
return 3 /* FIXED */;
|
|
4031
|
+
return 3 /* POSITION.FIXED */;
|
|
3211
4032
|
case 'sticky':
|
|
3212
|
-
return 4 /* STICKY */;
|
|
4033
|
+
return 4 /* POSITION.STICKY */;
|
|
3213
4034
|
}
|
|
3214
|
-
return 0 /* STATIC */;
|
|
4035
|
+
return 0 /* POSITION.STATIC */;
|
|
3215
4036
|
}
|
|
3216
4037
|
};
|
|
3217
4038
|
|
|
3218
4039
|
var textShadow = {
|
|
3219
4040
|
name: 'text-shadow',
|
|
3220
4041
|
initialValue: 'none',
|
|
3221
|
-
type: 1 /* LIST */,
|
|
4042
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3222
4043
|
prefix: false,
|
|
3223
4044
|
parse: function (context, tokens) {
|
|
3224
4045
|
if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
|
|
@@ -3259,17 +4080,17 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3259
4080
|
name: 'text-transform',
|
|
3260
4081
|
initialValue: 'none',
|
|
3261
4082
|
prefix: false,
|
|
3262
|
-
type: 2 /* IDENT_VALUE */,
|
|
4083
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3263
4084
|
parse: function (_context, textTransform) {
|
|
3264
4085
|
switch (textTransform) {
|
|
3265
4086
|
case 'uppercase':
|
|
3266
|
-
return 2 /* UPPERCASE */;
|
|
4087
|
+
return 2 /* TEXT_TRANSFORM.UPPERCASE */;
|
|
3267
4088
|
case 'lowercase':
|
|
3268
|
-
return 1 /* LOWERCASE */;
|
|
4089
|
+
return 1 /* TEXT_TRANSFORM.LOWERCASE */;
|
|
3269
4090
|
case 'capitalize':
|
|
3270
|
-
return 3 /* CAPITALIZE */;
|
|
4091
|
+
return 3 /* TEXT_TRANSFORM.CAPITALIZE */;
|
|
3271
4092
|
}
|
|
3272
|
-
return 0 /* NONE */;
|
|
4093
|
+
return 0 /* TEXT_TRANSFORM.NONE */;
|
|
3273
4094
|
}
|
|
3274
4095
|
};
|
|
3275
4096
|
|
|
@@ -3277,15 +4098,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3277
4098
|
name: 'transform',
|
|
3278
4099
|
initialValue: 'none',
|
|
3279
4100
|
prefix: true,
|
|
3280
|
-
type: 0 /* VALUE */,
|
|
4101
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3281
4102
|
parse: function (_context, token) {
|
|
3282
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
|
|
4103
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
|
|
3283
4104
|
return null;
|
|
3284
4105
|
}
|
|
3285
|
-
if (token.type === 18 /* FUNCTION */) {
|
|
4106
|
+
if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
3286
4107
|
var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
|
|
3287
4108
|
if (typeof transformFunction === 'undefined') {
|
|
3288
|
-
throw new Error("Attempting to parse an unsupported transform function \""
|
|
4109
|
+
throw new Error("Attempting to parse an unsupported transform function \"".concat(token.name, "\""));
|
|
3289
4110
|
}
|
|
3290
4111
|
return transformFunction(token.values);
|
|
3291
4112
|
}
|
|
@@ -3293,12 +4114,12 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3293
4114
|
}
|
|
3294
4115
|
};
|
|
3295
4116
|
var matrix = function (args) {
|
|
3296
|
-
var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
4117
|
+
var values = args.filter(function (arg) { return arg.type === 17 /* TokenType.NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
3297
4118
|
return values.length === 6 ? values : null;
|
|
3298
4119
|
};
|
|
3299
4120
|
// doesn't support 3D transforms at the moment
|
|
3300
4121
|
var matrix3d = function (args) {
|
|
3301
|
-
var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
4122
|
+
var values = args.filter(function (arg) { return arg.type === 17 /* TokenType.NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
3302
4123
|
var a1 = values[0], b1 = values[1]; var a2 = values[4], b2 = values[5]; var a4 = values[12], b4 = values[13]; return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null;
|
|
3303
4124
|
};
|
|
3304
4125
|
var SUPPORTED_TRANSFORM_FUNCTIONS = {
|
|
@@ -3307,7 +4128,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3307
4128
|
};
|
|
3308
4129
|
|
|
3309
4130
|
var DEFAULT_VALUE = {
|
|
3310
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
4131
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
3311
4132
|
number: 50,
|
|
3312
4133
|
flags: FLAG_INTEGER
|
|
3313
4134
|
};
|
|
@@ -3316,7 +4137,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3316
4137
|
name: 'transform-origin',
|
|
3317
4138
|
initialValue: '50% 50%',
|
|
3318
4139
|
prefix: true,
|
|
3319
|
-
type: 1 /* LIST */,
|
|
4140
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3320
4141
|
parse: function (_context, tokens) {
|
|
3321
4142
|
var origins = tokens.filter(isLengthPercentage);
|
|
3322
4143
|
if (origins.length !== 2) {
|
|
@@ -3330,16 +4151,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3330
4151
|
name: 'visible',
|
|
3331
4152
|
initialValue: 'none',
|
|
3332
4153
|
prefix: false,
|
|
3333
|
-
type: 2 /* IDENT_VALUE */,
|
|
4154
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3334
4155
|
parse: function (_context, visibility) {
|
|
3335
4156
|
switch (visibility) {
|
|
3336
4157
|
case 'hidden':
|
|
3337
|
-
return 1 /* HIDDEN */;
|
|
4158
|
+
return 1 /* VISIBILITY.HIDDEN */;
|
|
3338
4159
|
case 'collapse':
|
|
3339
|
-
return 2 /* COLLAPSE */;
|
|
4160
|
+
return 2 /* VISIBILITY.COLLAPSE */;
|
|
3340
4161
|
case 'visible':
|
|
3341
4162
|
default:
|
|
3342
|
-
return 0 /* VISIBLE */;
|
|
4163
|
+
return 0 /* VISIBILITY.VISIBLE */;
|
|
3343
4164
|
}
|
|
3344
4165
|
}
|
|
3345
4166
|
};
|
|
@@ -3354,7 +4175,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3354
4175
|
name: 'word-break',
|
|
3355
4176
|
initialValue: 'normal',
|
|
3356
4177
|
prefix: false,
|
|
3357
|
-
type: 2 /* IDENT_VALUE */,
|
|
4178
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3358
4179
|
parse: function (_context, wordBreak) {
|
|
3359
4180
|
switch (wordBreak) {
|
|
3360
4181
|
case 'break-all':
|
|
@@ -3372,9 +4193,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3372
4193
|
name: 'z-index',
|
|
3373
4194
|
initialValue: 'auto',
|
|
3374
4195
|
prefix: false,
|
|
3375
|
-
type: 0 /* VALUE */,
|
|
4196
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3376
4197
|
parse: function (_context, token) {
|
|
3377
|
-
if (token.type === 20 /* IDENT_TOKEN */) {
|
|
4198
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
3378
4199
|
return { auto: true, order: 0 };
|
|
3379
4200
|
}
|
|
3380
4201
|
if (isNumberToken(token)) {
|
|
@@ -3387,7 +4208,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3387
4208
|
var time = {
|
|
3388
4209
|
name: 'time',
|
|
3389
4210
|
parse: function (_context, value) {
|
|
3390
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
4211
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
3391
4212
|
switch (value.unit.toLowerCase()) {
|
|
3392
4213
|
case 's':
|
|
3393
4214
|
return 1000 * value.number;
|
|
@@ -3402,7 +4223,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3402
4223
|
var opacity = {
|
|
3403
4224
|
name: 'opacity',
|
|
3404
4225
|
initialValue: '1',
|
|
3405
|
-
type: 0 /* VALUE */,
|
|
4226
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3406
4227
|
prefix: false,
|
|
3407
4228
|
parse: function (_context, token) {
|
|
3408
4229
|
if (isNumberToken(token)) {
|
|
@@ -3416,7 +4237,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3416
4237
|
name: "text-decoration-color",
|
|
3417
4238
|
initialValue: 'transparent',
|
|
3418
4239
|
prefix: false,
|
|
3419
|
-
type: 3 /* TYPE_VALUE */,
|
|
4240
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3420
4241
|
format: 'color'
|
|
3421
4242
|
};
|
|
3422
4243
|
|
|
@@ -3424,24 +4245,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3424
4245
|
name: 'text-decoration-line',
|
|
3425
4246
|
initialValue: 'none',
|
|
3426
4247
|
prefix: false,
|
|
3427
|
-
type: 1 /* LIST */,
|
|
4248
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3428
4249
|
parse: function (_context, tokens) {
|
|
3429
4250
|
return tokens
|
|
3430
4251
|
.filter(isIdentToken)
|
|
3431
4252
|
.map(function (token) {
|
|
3432
4253
|
switch (token.value) {
|
|
3433
4254
|
case 'underline':
|
|
3434
|
-
return 1 /* UNDERLINE */;
|
|
4255
|
+
return 1 /* TEXT_DECORATION_LINE.UNDERLINE */;
|
|
3435
4256
|
case 'overline':
|
|
3436
|
-
return 2 /* OVERLINE */;
|
|
4257
|
+
return 2 /* TEXT_DECORATION_LINE.OVERLINE */;
|
|
3437
4258
|
case 'line-through':
|
|
3438
|
-
return 3 /* LINE_THROUGH */;
|
|
4259
|
+
return 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */;
|
|
3439
4260
|
case 'none':
|
|
3440
|
-
return 4 /* BLINK */;
|
|
4261
|
+
return 4 /* TEXT_DECORATION_LINE.BLINK */;
|
|
3441
4262
|
}
|
|
3442
|
-
return 0 /* NONE */;
|
|
4263
|
+
return 0 /* TEXT_DECORATION_LINE.NONE */;
|
|
3443
4264
|
})
|
|
3444
|
-
.filter(function (line) { return line !== 0 /* NONE */; });
|
|
4265
|
+
.filter(function (line) { return line !== 0 /* TEXT_DECORATION_LINE.NONE */; });
|
|
3445
4266
|
}
|
|
3446
4267
|
};
|
|
3447
4268
|
|
|
@@ -3449,20 +4270,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3449
4270
|
name: "font-family",
|
|
3450
4271
|
initialValue: '',
|
|
3451
4272
|
prefix: false,
|
|
3452
|
-
type: 1 /* LIST */,
|
|
4273
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3453
4274
|
parse: function (_context, tokens) {
|
|
3454
4275
|
var accumulator = [];
|
|
3455
4276
|
var results = [];
|
|
3456
4277
|
tokens.forEach(function (token) {
|
|
3457
4278
|
switch (token.type) {
|
|
3458
|
-
case 20 /* IDENT_TOKEN */:
|
|
3459
|
-
case 0 /* STRING_TOKEN */:
|
|
4279
|
+
case 20 /* TokenType.IDENT_TOKEN */:
|
|
4280
|
+
case 0 /* TokenType.STRING_TOKEN */:
|
|
3460
4281
|
accumulator.push(token.value);
|
|
3461
4282
|
break;
|
|
3462
|
-
case 17 /* NUMBER_TOKEN */:
|
|
4283
|
+
case 17 /* TokenType.NUMBER_TOKEN */:
|
|
3463
4284
|
accumulator.push(token.number.toString());
|
|
3464
4285
|
break;
|
|
3465
|
-
case 4 /* COMMA_TOKEN */:
|
|
4286
|
+
case 4 /* TokenType.COMMA_TOKEN */:
|
|
3466
4287
|
results.push(accumulator.join(' '));
|
|
3467
4288
|
accumulator.length = 0;
|
|
3468
4289
|
break;
|
|
@@ -3471,7 +4292,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3471
4292
|
if (accumulator.length) {
|
|
3472
4293
|
results.push(accumulator.join(' '));
|
|
3473
4294
|
}
|
|
3474
|
-
return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'"
|
|
4295
|
+
return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'".concat(result, "'")); });
|
|
3475
4296
|
}
|
|
3476
4297
|
};
|
|
3477
4298
|
|
|
@@ -3479,14 +4300,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3479
4300
|
name: "font-size",
|
|
3480
4301
|
initialValue: '0',
|
|
3481
4302
|
prefix: false,
|
|
3482
|
-
type: 3 /* TYPE_VALUE */,
|
|
4303
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3483
4304
|
format: 'length'
|
|
3484
4305
|
};
|
|
3485
4306
|
|
|
3486
4307
|
var fontWeight = {
|
|
3487
4308
|
name: 'font-weight',
|
|
3488
4309
|
initialValue: 'normal',
|
|
3489
|
-
type: 0 /* VALUE */,
|
|
4310
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3490
4311
|
prefix: false,
|
|
3491
4312
|
parse: function (_context, token) {
|
|
3492
4313
|
if (isNumberToken(token)) {
|
|
@@ -3508,7 +4329,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3508
4329
|
var fontVariant = {
|
|
3509
4330
|
name: 'font-variant',
|
|
3510
4331
|
initialValue: 'none',
|
|
3511
|
-
type: 1 /* LIST */,
|
|
4332
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3512
4333
|
prefix: false,
|
|
3513
4334
|
parse: function (_context, tokens) {
|
|
3514
4335
|
return tokens.filter(isIdentToken).map(function (token) { return token.value; });
|
|
@@ -3519,16 +4340,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3519
4340
|
name: 'font-style',
|
|
3520
4341
|
initialValue: 'normal',
|
|
3521
4342
|
prefix: false,
|
|
3522
|
-
type: 2 /* IDENT_VALUE */,
|
|
4343
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3523
4344
|
parse: function (_context, overflow) {
|
|
3524
4345
|
switch (overflow) {
|
|
3525
4346
|
case 'oblique':
|
|
3526
|
-
return "oblique" /* OBLIQUE */;
|
|
4347
|
+
return "oblique" /* FONT_STYLE.OBLIQUE */;
|
|
3527
4348
|
case 'italic':
|
|
3528
|
-
return "italic" /* ITALIC */;
|
|
4349
|
+
return "italic" /* FONT_STYLE.ITALIC */;
|
|
3529
4350
|
case 'normal':
|
|
3530
4351
|
default:
|
|
3531
|
-
return "normal" /* NORMAL */;
|
|
4352
|
+
return "normal" /* FONT_STYLE.NORMAL */;
|
|
3532
4353
|
}
|
|
3533
4354
|
}
|
|
3534
4355
|
};
|
|
@@ -3538,14 +4359,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3538
4359
|
var content = {
|
|
3539
4360
|
name: 'content',
|
|
3540
4361
|
initialValue: 'none',
|
|
3541
|
-
type: 1 /* LIST */,
|
|
4362
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3542
4363
|
prefix: false,
|
|
3543
4364
|
parse: function (_context, tokens) {
|
|
3544
4365
|
if (tokens.length === 0) {
|
|
3545
4366
|
return [];
|
|
3546
4367
|
}
|
|
3547
4368
|
var first = tokens[0];
|
|
3548
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4369
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3549
4370
|
return [];
|
|
3550
4371
|
}
|
|
3551
4372
|
return tokens;
|
|
@@ -3556,13 +4377,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3556
4377
|
name: 'counter-increment',
|
|
3557
4378
|
initialValue: 'none',
|
|
3558
4379
|
prefix: true,
|
|
3559
|
-
type: 1 /* LIST */,
|
|
4380
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3560
4381
|
parse: function (_context, tokens) {
|
|
3561
4382
|
if (tokens.length === 0) {
|
|
3562
4383
|
return null;
|
|
3563
4384
|
}
|
|
3564
4385
|
var first = tokens[0];
|
|
3565
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4386
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3566
4387
|
return null;
|
|
3567
4388
|
}
|
|
3568
4389
|
var increments = [];
|
|
@@ -3570,7 +4391,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3570
4391
|
for (var i = 0; i < filtered.length; i++) {
|
|
3571
4392
|
var counter = filtered[i];
|
|
3572
4393
|
var next = filtered[i + 1];
|
|
3573
|
-
if (counter.type === 20 /* IDENT_TOKEN */) {
|
|
4394
|
+
if (counter.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
3574
4395
|
var increment = next && isNumberToken(next) ? next.number : 1;
|
|
3575
4396
|
increments.push({ counter: counter.value, increment: increment });
|
|
3576
4397
|
}
|
|
@@ -3583,7 +4404,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3583
4404
|
name: 'counter-reset',
|
|
3584
4405
|
initialValue: 'none',
|
|
3585
4406
|
prefix: true,
|
|
3586
|
-
type: 1 /* LIST */,
|
|
4407
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3587
4408
|
parse: function (_context, tokens) {
|
|
3588
4409
|
if (tokens.length === 0) {
|
|
3589
4410
|
return [];
|
|
@@ -3606,7 +4427,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3606
4427
|
name: 'duration',
|
|
3607
4428
|
initialValue: '0s',
|
|
3608
4429
|
prefix: false,
|
|
3609
|
-
type: 1 /* LIST */,
|
|
4430
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3610
4431
|
parse: function (context, tokens) {
|
|
3611
4432
|
return tokens.filter(isDimensionToken).map(function (token) { return time.parse(context, token); });
|
|
3612
4433
|
}
|
|
@@ -3616,13 +4437,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3616
4437
|
name: 'quotes',
|
|
3617
4438
|
initialValue: 'none',
|
|
3618
4439
|
prefix: true,
|
|
3619
|
-
type: 1 /* LIST */,
|
|
4440
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3620
4441
|
parse: function (_context, tokens) {
|
|
3621
4442
|
if (tokens.length === 0) {
|
|
3622
4443
|
return null;
|
|
3623
4444
|
}
|
|
3624
4445
|
var first = tokens[0];
|
|
3625
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4446
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3626
4447
|
return null;
|
|
3627
4448
|
}
|
|
3628
4449
|
var quotes = [];
|
|
@@ -3652,7 +4473,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3652
4473
|
var boxShadow = {
|
|
3653
4474
|
name: 'box-shadow',
|
|
3654
4475
|
initialValue: 'none',
|
|
3655
|
-
type: 1 /* LIST */,
|
|
4476
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3656
4477
|
prefix: false,
|
|
3657
4478
|
parse: function (context, tokens) {
|
|
3658
4479
|
if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
|
|
@@ -3701,20 +4522,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3701
4522
|
name: 'paint-order',
|
|
3702
4523
|
initialValue: 'normal',
|
|
3703
4524
|
prefix: false,
|
|
3704
|
-
type: 1 /* LIST */,
|
|
4525
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3705
4526
|
parse: function (_context, tokens) {
|
|
3706
|
-
var DEFAULT_VALUE = [0 /* FILL */, 1 /* STROKE */, 2 /* MARKERS */];
|
|
4527
|
+
var DEFAULT_VALUE = [0 /* PAINT_ORDER_LAYER.FILL */, 1 /* PAINT_ORDER_LAYER.STROKE */, 2 /* PAINT_ORDER_LAYER.MARKERS */];
|
|
3707
4528
|
var layers = [];
|
|
3708
4529
|
tokens.filter(isIdentToken).forEach(function (token) {
|
|
3709
4530
|
switch (token.value) {
|
|
3710
4531
|
case 'stroke':
|
|
3711
|
-
layers.push(1 /* STROKE */);
|
|
4532
|
+
layers.push(1 /* PAINT_ORDER_LAYER.STROKE */);
|
|
3712
4533
|
break;
|
|
3713
4534
|
case 'fill':
|
|
3714
|
-
layers.push(0 /* FILL */);
|
|
4535
|
+
layers.push(0 /* PAINT_ORDER_LAYER.FILL */);
|
|
3715
4536
|
break;
|
|
3716
4537
|
case 'markers':
|
|
3717
|
-
layers.push(2 /* MARKERS */);
|
|
4538
|
+
layers.push(2 /* PAINT_ORDER_LAYER.MARKERS */);
|
|
3718
4539
|
break;
|
|
3719
4540
|
}
|
|
3720
4541
|
});
|
|
@@ -3731,14 +4552,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3731
4552
|
name: "-webkit-text-stroke-color",
|
|
3732
4553
|
initialValue: 'currentcolor',
|
|
3733
4554
|
prefix: false,
|
|
3734
|
-
type: 3 /* TYPE_VALUE */,
|
|
4555
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3735
4556
|
format: 'color'
|
|
3736
4557
|
};
|
|
3737
4558
|
|
|
3738
4559
|
var webkitTextStrokeWidth = {
|
|
3739
4560
|
name: "-webkit-text-stroke-width",
|
|
3740
4561
|
initialValue: '0',
|
|
3741
|
-
type: 0 /* VALUE */,
|
|
4562
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3742
4563
|
prefix: false,
|
|
3743
4564
|
parse: function (_context, token) {
|
|
3744
4565
|
if (isDimensionToken(token)) {
|
|
@@ -3748,6 +4569,31 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3748
4569
|
}
|
|
3749
4570
|
};
|
|
3750
4571
|
|
|
4572
|
+
var objectFit = {
|
|
4573
|
+
name: 'objectFit',
|
|
4574
|
+
initialValue: 'fill',
|
|
4575
|
+
prefix: false,
|
|
4576
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
4577
|
+
parse: function (_context, tokens) {
|
|
4578
|
+
return tokens.filter(isIdentToken).reduce(function (bit, token) {
|
|
4579
|
+
return bit | parseDisplayValue(token.value);
|
|
4580
|
+
}, 0 /* OBJECT_FIT.FILL */);
|
|
4581
|
+
}
|
|
4582
|
+
};
|
|
4583
|
+
var parseDisplayValue = function (display) {
|
|
4584
|
+
switch (display) {
|
|
4585
|
+
case 'contain':
|
|
4586
|
+
return 2 /* OBJECT_FIT.CONTAIN */;
|
|
4587
|
+
case 'cover':
|
|
4588
|
+
return 4 /* OBJECT_FIT.COVER */;
|
|
4589
|
+
case 'none':
|
|
4590
|
+
return 8 /* OBJECT_FIT.NONE */;
|
|
4591
|
+
case 'scale-down':
|
|
4592
|
+
return 16 /* OBJECT_FIT.SCALE_DOWN */;
|
|
4593
|
+
}
|
|
4594
|
+
return 0 /* OBJECT_FIT.FILL */;
|
|
4595
|
+
};
|
|
4596
|
+
|
|
3751
4597
|
var CSSParsedDeclaration = /** @class */ (function () {
|
|
3752
4598
|
function CSSParsedDeclaration(context, declaration) {
|
|
3753
4599
|
var _a, _b;
|
|
@@ -3818,9 +4664,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3818
4664
|
this.webkitTextStrokeWidth = parse(context, webkitTextStrokeWidth, declaration.webkitTextStrokeWidth);
|
|
3819
4665
|
this.wordBreak = parse(context, wordBreak, declaration.wordBreak);
|
|
3820
4666
|
this.zIndex = parse(context, zIndex, declaration.zIndex);
|
|
4667
|
+
this.objectFit = parse(context, objectFit, declaration.objectFit);
|
|
3821
4668
|
}
|
|
3822
4669
|
CSSParsedDeclaration.prototype.isVisible = function () {
|
|
3823
|
-
return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBLE */;
|
|
4670
|
+
return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBILITY.VISIBLE */;
|
|
3824
4671
|
};
|
|
3825
4672
|
CSSParsedDeclaration.prototype.isTransparent = function () {
|
|
3826
4673
|
return isTransparent(this.backgroundColor);
|
|
@@ -3829,21 +4676,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3829
4676
|
return this.transform !== null;
|
|
3830
4677
|
};
|
|
3831
4678
|
CSSParsedDeclaration.prototype.isPositioned = function () {
|
|
3832
|
-
return this.position !== 0 /* STATIC */;
|
|
4679
|
+
return this.position !== 0 /* POSITION.STATIC */;
|
|
3833
4680
|
};
|
|
3834
4681
|
CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () {
|
|
3835
4682
|
return this.isPositioned() && !this.zIndex.auto;
|
|
3836
4683
|
};
|
|
3837
4684
|
CSSParsedDeclaration.prototype.isFloating = function () {
|
|
3838
|
-
return this.float !== 0 /* NONE */;
|
|
4685
|
+
return this.float !== 0 /* FLOAT.NONE */;
|
|
3839
4686
|
};
|
|
3840
4687
|
CSSParsedDeclaration.prototype.isInlineLevel = function () {
|
|
3841
|
-
return (contains(this.display, 4 /* INLINE */) ||
|
|
3842
|
-
contains(this.display, 33554432 /* INLINE_BLOCK */) ||
|
|
3843
|
-
contains(this.display, 268435456 /* INLINE_FLEX */) ||
|
|
3844
|
-
contains(this.display, 536870912 /* INLINE_GRID */) ||
|
|
3845
|
-
contains(this.display, 67108864 /* INLINE_LIST_ITEM */) ||
|
|
3846
|
-
contains(this.display, 134217728 /* INLINE_TABLE */));
|
|
4688
|
+
return (contains(this.display, 4 /* DISPLAY.INLINE */) ||
|
|
4689
|
+
contains(this.display, 33554432 /* DISPLAY.INLINE_BLOCK */) ||
|
|
4690
|
+
contains(this.display, 268435456 /* DISPLAY.INLINE_FLEX */) ||
|
|
4691
|
+
contains(this.display, 536870912 /* DISPLAY.INLINE_GRID */) ||
|
|
4692
|
+
contains(this.display, 67108864 /* DISPLAY.INLINE_LIST_ITEM */) ||
|
|
4693
|
+
contains(this.display, 134217728 /* DISPLAY.INLINE_TABLE */));
|
|
3847
4694
|
};
|
|
3848
4695
|
return CSSParsedDeclaration;
|
|
3849
4696
|
}());
|
|
@@ -3868,16 +4715,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3868
4715
|
tokenizer.write(value);
|
|
3869
4716
|
var parser = new Parser(tokenizer.read());
|
|
3870
4717
|
switch (descriptor.type) {
|
|
3871
|
-
case 2 /* IDENT_VALUE */:
|
|
4718
|
+
case 2 /* PropertyDescriptorParsingType.IDENT_VALUE */:
|
|
3872
4719
|
var token = parser.parseComponentValue();
|
|
3873
4720
|
return descriptor.parse(context, isIdentToken(token) ? token.value : descriptor.initialValue);
|
|
3874
|
-
case 0 /* VALUE */:
|
|
4721
|
+
case 0 /* PropertyDescriptorParsingType.VALUE */:
|
|
3875
4722
|
return descriptor.parse(context, parser.parseComponentValue());
|
|
3876
|
-
case 1 /* LIST */:
|
|
4723
|
+
case 1 /* PropertyDescriptorParsingType.LIST */:
|
|
3877
4724
|
return descriptor.parse(context, parser.parseComponentValues());
|
|
3878
|
-
case 4 /* TOKEN_VALUE */:
|
|
4725
|
+
case 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */:
|
|
3879
4726
|
return parser.parseComponentValue();
|
|
3880
|
-
case 3 /* TYPE_VALUE */:
|
|
4727
|
+
case 3 /* PropertyDescriptorParsingType.TYPE_VALUE */:
|
|
3881
4728
|
switch (descriptor.format) {
|
|
3882
4729
|
case 'angle':
|
|
3883
4730
|
return angle.parse(context, parser.parseComponentValue());
|
|
@@ -3903,20 +4750,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3903
4750
|
var attribute = element.getAttribute(elementDebuggerAttribute);
|
|
3904
4751
|
switch (attribute) {
|
|
3905
4752
|
case 'all':
|
|
3906
|
-
return 1 /* ALL */;
|
|
4753
|
+
return 1 /* DebuggerType.ALL */;
|
|
3907
4754
|
case 'clone':
|
|
3908
|
-
return 2 /* CLONE */;
|
|
4755
|
+
return 2 /* DebuggerType.CLONE */;
|
|
3909
4756
|
case 'parse':
|
|
3910
|
-
return 3 /* PARSE */;
|
|
4757
|
+
return 3 /* DebuggerType.PARSE */;
|
|
3911
4758
|
case 'render':
|
|
3912
|
-
return 4 /* RENDER */;
|
|
4759
|
+
return 4 /* DebuggerType.RENDER */;
|
|
3913
4760
|
default:
|
|
3914
|
-
return 0 /* NONE */;
|
|
4761
|
+
return 0 /* DebuggerType.NONE */;
|
|
3915
4762
|
}
|
|
3916
4763
|
};
|
|
3917
4764
|
var isDebugging = function (element, type) {
|
|
3918
4765
|
var elementType = getElementDebugType(element);
|
|
3919
|
-
return elementType === 1 /* ALL */ || type === elementType;
|
|
4766
|
+
return elementType === 1 /* DebuggerType.ALL */ || type === elementType;
|
|
3920
4767
|
};
|
|
3921
4768
|
|
|
3922
4769
|
var ElementContainer = /** @class */ (function () {
|
|
@@ -3925,7 +4772,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3925
4772
|
this.textNodes = [];
|
|
3926
4773
|
this.elements = [];
|
|
3927
4774
|
this.flags = 0;
|
|
3928
|
-
if (isDebugging(element, 3 /* PARSE */)) {
|
|
4775
|
+
if (isDebugging(element, 3 /* DebuggerType.PARSE */)) {
|
|
3929
4776
|
debugger;
|
|
3930
4777
|
}
|
|
3931
4778
|
this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null));
|
|
@@ -3939,8 +4786,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3939
4786
|
}
|
|
3940
4787
|
}
|
|
3941
4788
|
this.bounds = parseBounds(this.context, element);
|
|
3942
|
-
if (isDebugging(element, 4 /* RENDER */)) {
|
|
3943
|
-
this.flags |= 16 /* DEBUG_RENDER */;
|
|
4789
|
+
if (isDebugging(element, 4 /* DebuggerType.RENDER */)) {
|
|
4790
|
+
this.flags |= 16 /* FLAGS.DEBUG_RENDER */;
|
|
3944
4791
|
}
|
|
3945
4792
|
}
|
|
3946
4793
|
return ElementContainer;
|
|
@@ -4334,7 +5181,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4334
5181
|
var range = document.createRange();
|
|
4335
5182
|
if (range.getBoundingClientRect) {
|
|
4336
5183
|
var testElement = document.createElement('boundtest');
|
|
4337
|
-
testElement.style.height = TEST_HEIGHT
|
|
5184
|
+
testElement.style.height = "".concat(TEST_HEIGHT, "px");
|
|
4338
5185
|
testElement.style.display = 'block';
|
|
4339
5186
|
document.body.appendChild(testElement);
|
|
4340
5187
|
range.selectNode(testElement);
|
|
@@ -4424,8 +5271,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4424
5271
|
ctx.fillStyle = 'red';
|
|
4425
5272
|
ctx.fillRect(0, 0, size, size);
|
|
4426
5273
|
var node = document.createElement('div');
|
|
4427
|
-
node.style.backgroundImage = "url("
|
|
4428
|
-
node.style.height = size
|
|
5274
|
+
node.style.backgroundImage = "url(".concat(greenImageSrc, ")");
|
|
5275
|
+
node.style.height = "".concat(size, "px");
|
|
4429
5276
|
// Firefox 55 does not render inline <img /> tags
|
|
4430
5277
|
return isGreenPixel(data)
|
|
4431
5278
|
? loadSerializedSVG$1(createForeignObjectSVG(size, size, 0, 0, node))
|
|
@@ -4458,7 +5305,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4458
5305
|
var img = new Image();
|
|
4459
5306
|
img.onload = function () { return resolve(img); };
|
|
4460
5307
|
img.onerror = reject;
|
|
4461
|
-
img.src = "data:image/svg+xml;charset=utf-8,"
|
|
5308
|
+
img.src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svg)));
|
|
4462
5309
|
});
|
|
4463
5310
|
};
|
|
4464
5311
|
var FEATURES = {
|
|
@@ -4602,7 +5449,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4602
5449
|
var breakWords = function (str, styles) {
|
|
4603
5450
|
var breaker = LineBreaker(str, {
|
|
4604
5451
|
lineBreak: styles.lineBreak,
|
|
4605
|
-
wordBreak: styles.overflowWrap === "break-word" /* BREAK_WORD */ ? 'break-word' : styles.wordBreak
|
|
5452
|
+
wordBreak: styles.overflowWrap === "break-word" /* OVERFLOW_WRAP.BREAK_WORD */ ? 'break-word' : styles.wordBreak
|
|
4606
5453
|
});
|
|
4607
5454
|
var words = [];
|
|
4608
5455
|
var bk;
|
|
@@ -4643,11 +5490,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4643
5490
|
}());
|
|
4644
5491
|
var transform = function (text, transform) {
|
|
4645
5492
|
switch (transform) {
|
|
4646
|
-
case 1 /* LOWERCASE */:
|
|
5493
|
+
case 1 /* TEXT_TRANSFORM.LOWERCASE */:
|
|
4647
5494
|
return text.toLowerCase();
|
|
4648
|
-
case 3 /* CAPITALIZE */:
|
|
5495
|
+
case 3 /* TEXT_TRANSFORM.CAPITALIZE */:
|
|
4649
5496
|
return text.replace(CAPITALIZE, capitalize);
|
|
4650
|
-
case 2 /* UPPERCASE */:
|
|
5497
|
+
case 2 /* TEXT_TRANSFORM.UPPERCASE */:
|
|
4651
5498
|
return text.toUpperCase();
|
|
4652
5499
|
default:
|
|
4653
5500
|
return text;
|
|
@@ -4692,9 +5539,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4692
5539
|
var _this = _super.call(this, context, img) || this;
|
|
4693
5540
|
var s = new XMLSerializer();
|
|
4694
5541
|
var bounds = parseBounds(context, img);
|
|
4695
|
-
img.setAttribute('width', bounds.width
|
|
4696
|
-
img.setAttribute('height', bounds.height
|
|
4697
|
-
_this.svg = "data:image/svg+xml,"
|
|
5542
|
+
img.setAttribute('width', "".concat(bounds.width, "px"));
|
|
5543
|
+
img.setAttribute('height', "".concat(bounds.height, "px"));
|
|
5544
|
+
_this.svg = "data:image/svg+xml,".concat(encodeURIComponent(s.serializeToString(img)));
|
|
4698
5545
|
_this.intrinsicWidth = img.width.baseVal.value;
|
|
4699
5546
|
_this.intrinsicHeight = img.height.baseVal.value;
|
|
4700
5547
|
_this.context.cache.addImage(_this.svg);
|
|
@@ -4726,7 +5573,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4726
5573
|
|
|
4727
5574
|
var CHECKBOX_BORDER_RADIUS = [
|
|
4728
5575
|
{
|
|
4729
|
-
type: 15 /* DIMENSION_TOKEN */,
|
|
5576
|
+
type: 15 /* TokenType.DIMENSION_TOKEN */,
|
|
4730
5577
|
flags: 0,
|
|
4731
5578
|
unit: 'px',
|
|
4732
5579
|
number: 3
|
|
@@ -4734,7 +5581,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4734
5581
|
];
|
|
4735
5582
|
var RADIO_BORDER_RADIUS = [
|
|
4736
5583
|
{
|
|
4737
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
5584
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
4738
5585
|
flags: 0,
|
|
4739
5586
|
number: 50
|
|
4740
5587
|
}
|
|
@@ -4779,9 +5626,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4779
5626
|
_this.styles.borderRightStyle =
|
|
4780
5627
|
_this.styles.borderBottomStyle =
|
|
4781
5628
|
_this.styles.borderLeftStyle =
|
|
4782
|
-
1 /* SOLID */;
|
|
4783
|
-
_this.styles.backgroundClip = [0 /* BORDER_BOX */];
|
|
4784
|
-
_this.styles.backgroundOrigin = [0 /* BORDER_BOX */];
|
|
5629
|
+
1 /* BORDER_STYLE.SOLID */;
|
|
5630
|
+
_this.styles.backgroundClip = [0 /* BACKGROUND_CLIP.BORDER_BOX */];
|
|
5631
|
+
_this.styles.backgroundOrigin = [0 /* BACKGROUND_ORIGIN.BORDER_BOX */];
|
|
4785
5632
|
_this.bounds = reformatInputBounds(_this.bounds);
|
|
4786
5633
|
}
|
|
4787
5634
|
switch (_this.type) {
|
|
@@ -4863,7 +5710,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4863
5710
|
var parseNodeTree = function (context, node, parent, root) {
|
|
4864
5711
|
for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) {
|
|
4865
5712
|
nextNode = childNode.nextSibling;
|
|
4866
|
-
|
|
5713
|
+
// Fixes #2238 #1624 - Fix the issue of TextNode content being overlooked in rendering due to being perceived as blank by trim().
|
|
5714
|
+
if (isTextNode(childNode) && childNode.data.length > 0) {
|
|
4867
5715
|
parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
|
|
4868
5716
|
}
|
|
4869
5717
|
else if (isElementNode(childNode)) {
|
|
@@ -4874,13 +5722,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4874
5722
|
var container = createContainer(context, childNode);
|
|
4875
5723
|
if (container.styles.isVisible()) {
|
|
4876
5724
|
if (createsRealStackingContext(childNode, container, root)) {
|
|
4877
|
-
container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
|
|
5725
|
+
container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
|
|
4878
5726
|
}
|
|
4879
5727
|
else if (createsStackingContext(container.styles)) {
|
|
4880
|
-
container.flags |= 2 /* CREATES_STACKING_CONTEXT */;
|
|
5728
|
+
container.flags |= 2 /* FLAGS.CREATES_STACKING_CONTEXT */;
|
|
4881
5729
|
}
|
|
4882
5730
|
if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) {
|
|
4883
|
-
container.flags |= 8 /* IS_LIST_OWNER */;
|
|
5731
|
+
container.flags |= 8 /* FLAGS.IS_LIST_OWNER */;
|
|
4884
5732
|
}
|
|
4885
5733
|
parent.elements.push(container);
|
|
4886
5734
|
if (childNode.shadowRoot) {
|
|
@@ -4928,7 +5776,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4928
5776
|
};
|
|
4929
5777
|
var parseTree = function (context, element) {
|
|
4930
5778
|
var container = createContainer(context, element);
|
|
4931
|
-
container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
|
|
5779
|
+
container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
|
|
4932
5780
|
parseNodeTree(context, element, container, container);
|
|
4933
5781
|
return container;
|
|
4934
5782
|
};
|
|
@@ -5196,7 +6044,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5196
6044
|
var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
|
|
5197
6045
|
var createCJKCounter = function (value, numbers, multipliers, negativeSign, suffix, flags) {
|
|
5198
6046
|
if (value < -9999 || value > 9999) {
|
|
5199
|
-
return createCounterText(value, 4 /* CJK_DECIMAL */, suffix.length > 0);
|
|
6047
|
+
return createCounterText(value, 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */, suffix.length > 0);
|
|
5200
6048
|
}
|
|
5201
6049
|
var tmp = Math.abs(value);
|
|
5202
6050
|
var string = suffix;
|
|
@@ -5232,101 +6080,101 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5232
6080
|
var koreanSuffix = appendSuffix ? ', ' : '';
|
|
5233
6081
|
var spaceSuffix = appendSuffix ? ' ' : '';
|
|
5234
6082
|
switch (type) {
|
|
5235
|
-
case 0 /* DISC */:
|
|
6083
|
+
case 0 /* LIST_STYLE_TYPE.DISC */:
|
|
5236
6084
|
return '•' + spaceSuffix;
|
|
5237
|
-
case 1 /* CIRCLE */:
|
|
6085
|
+
case 1 /* LIST_STYLE_TYPE.CIRCLE */:
|
|
5238
6086
|
return '◦' + spaceSuffix;
|
|
5239
|
-
case 2 /* SQUARE */:
|
|
6087
|
+
case 2 /* LIST_STYLE_TYPE.SQUARE */:
|
|
5240
6088
|
return '◾' + spaceSuffix;
|
|
5241
|
-
case 5 /* DECIMAL_LEADING_ZERO */:
|
|
6089
|
+
case 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */:
|
|
5242
6090
|
var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
|
5243
|
-
return string.length < 4 ? "0"
|
|
5244
|
-
case 4 /* CJK_DECIMAL */:
|
|
6091
|
+
return string.length < 4 ? "0".concat(string) : string;
|
|
6092
|
+
case 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */:
|
|
5245
6093
|
return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix);
|
|
5246
|
-
case 6 /* LOWER_ROMAN */:
|
|
5247
|
-
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
|
|
5248
|
-
case 7 /* UPPER_ROMAN */:
|
|
5249
|
-
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix);
|
|
5250
|
-
case 8 /* LOWER_GREEK */:
|
|
6094
|
+
case 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */:
|
|
6095
|
+
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix).toLowerCase();
|
|
6096
|
+
case 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */:
|
|
6097
|
+
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6098
|
+
case 8 /* LIST_STYLE_TYPE.LOWER_GREEK */:
|
|
5251
6099
|
return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
|
|
5252
|
-
case 9 /* LOWER_ALPHA */:
|
|
6100
|
+
case 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */:
|
|
5253
6101
|
return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
|
|
5254
|
-
case 10 /* UPPER_ALPHA */:
|
|
6102
|
+
case 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */:
|
|
5255
6103
|
return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
|
|
5256
|
-
case 11 /* ARABIC_INDIC */:
|
|
6104
|
+
case 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */:
|
|
5257
6105
|
return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
|
|
5258
|
-
case 12 /* ARMENIAN */:
|
|
5259
|
-
case 49 /* UPPER_ARMENIAN */:
|
|
5260
|
-
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix);
|
|
5261
|
-
case 35 /* LOWER_ARMENIAN */:
|
|
5262
|
-
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
|
|
5263
|
-
case 13 /* BENGALI */:
|
|
6106
|
+
case 12 /* LIST_STYLE_TYPE.ARMENIAN */:
|
|
6107
|
+
case 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */:
|
|
6108
|
+
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6109
|
+
case 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */:
|
|
6110
|
+
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix).toLowerCase();
|
|
6111
|
+
case 13 /* LIST_STYLE_TYPE.BENGALI */:
|
|
5264
6112
|
return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
|
|
5265
|
-
case 14 /* CAMBODIAN */:
|
|
5266
|
-
case 30 /* KHMER */:
|
|
6113
|
+
case 14 /* LIST_STYLE_TYPE.CAMBODIAN */:
|
|
6114
|
+
case 30 /* LIST_STYLE_TYPE.KHMER */:
|
|
5267
6115
|
return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
|
|
5268
|
-
case 15 /* CJK_EARTHLY_BRANCH */:
|
|
6116
|
+
case 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */:
|
|
5269
6117
|
return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix);
|
|
5270
|
-
case 16 /* CJK_HEAVENLY_STEM */:
|
|
6118
|
+
case 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */:
|
|
5271
6119
|
return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix);
|
|
5272
|
-
case 17 /* CJK_IDEOGRAPHIC */:
|
|
5273
|
-
case 48 /* TRAD_CHINESE_INFORMAL */:
|
|
6120
|
+
case 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */:
|
|
6121
|
+
case 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */:
|
|
5274
6122
|
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5275
|
-
case 47 /* TRAD_CHINESE_FORMAL */:
|
|
6123
|
+
case 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */:
|
|
5276
6124
|
return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5277
|
-
case 42 /* SIMP_CHINESE_INFORMAL */:
|
|
6125
|
+
case 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */:
|
|
5278
6126
|
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5279
|
-
case 41 /* SIMP_CHINESE_FORMAL */:
|
|
6127
|
+
case 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */:
|
|
5280
6128
|
return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5281
|
-
case 26 /* JAPANESE_INFORMAL */:
|
|
6129
|
+
case 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */:
|
|
5282
6130
|
return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0);
|
|
5283
|
-
case 25 /* JAPANESE_FORMAL */:
|
|
6131
|
+
case 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */:
|
|
5284
6132
|
return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5285
|
-
case 31 /* KOREAN_HANGUL_FORMAL */:
|
|
6133
|
+
case 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */:
|
|
5286
6134
|
return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5287
|
-
case 33 /* KOREAN_HANJA_INFORMAL */:
|
|
6135
|
+
case 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */:
|
|
5288
6136
|
return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0);
|
|
5289
|
-
case 32 /* KOREAN_HANJA_FORMAL */:
|
|
6137
|
+
case 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */:
|
|
5290
6138
|
return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5291
|
-
case 18 /* DEVANAGARI */:
|
|
6139
|
+
case 18 /* LIST_STYLE_TYPE.DEVANAGARI */:
|
|
5292
6140
|
return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix);
|
|
5293
|
-
case 20 /* GEORGIAN */:
|
|
5294
|
-
return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* DECIMAL */, defaultSuffix);
|
|
5295
|
-
case 21 /* GUJARATI */:
|
|
6141
|
+
case 20 /* LIST_STYLE_TYPE.GEORGIAN */:
|
|
6142
|
+
return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6143
|
+
case 21 /* LIST_STYLE_TYPE.GUJARATI */:
|
|
5296
6144
|
return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix);
|
|
5297
|
-
case 22 /* GURMUKHI */:
|
|
6145
|
+
case 22 /* LIST_STYLE_TYPE.GURMUKHI */:
|
|
5298
6146
|
return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix);
|
|
5299
|
-
case 22 /* HEBREW */:
|
|
5300
|
-
return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* DECIMAL */, defaultSuffix);
|
|
5301
|
-
case 23 /* HIRAGANA */:
|
|
6147
|
+
case 22 /* LIST_STYLE_TYPE.HEBREW */:
|
|
6148
|
+
return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6149
|
+
case 23 /* LIST_STYLE_TYPE.HIRAGANA */:
|
|
5302
6150
|
return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん');
|
|
5303
|
-
case 24 /* HIRAGANA_IROHA */:
|
|
6151
|
+
case 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */:
|
|
5304
6152
|
return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす');
|
|
5305
|
-
case 27 /* KANNADA */:
|
|
6153
|
+
case 27 /* LIST_STYLE_TYPE.KANNADA */:
|
|
5306
6154
|
return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
|
|
5307
|
-
case 28 /* KATAKANA */:
|
|
6155
|
+
case 28 /* LIST_STYLE_TYPE.KATAKANA */:
|
|
5308
6156
|
return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix);
|
|
5309
|
-
case 29 /* KATAKANA_IROHA */:
|
|
6157
|
+
case 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */:
|
|
5310
6158
|
return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix);
|
|
5311
|
-
case 34 /* LAO */:
|
|
6159
|
+
case 34 /* LIST_STYLE_TYPE.LAO */:
|
|
5312
6160
|
return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix);
|
|
5313
|
-
case 37 /* MONGOLIAN */:
|
|
6161
|
+
case 37 /* LIST_STYLE_TYPE.MONGOLIAN */:
|
|
5314
6162
|
return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix);
|
|
5315
|
-
case 38 /* MYANMAR */:
|
|
6163
|
+
case 38 /* LIST_STYLE_TYPE.MYANMAR */:
|
|
5316
6164
|
return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix);
|
|
5317
|
-
case 39 /* ORIYA */:
|
|
6165
|
+
case 39 /* LIST_STYLE_TYPE.ORIYA */:
|
|
5318
6166
|
return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix);
|
|
5319
|
-
case 40 /* PERSIAN */:
|
|
6167
|
+
case 40 /* LIST_STYLE_TYPE.PERSIAN */:
|
|
5320
6168
|
return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix);
|
|
5321
|
-
case 43 /* TAMIL */:
|
|
6169
|
+
case 43 /* LIST_STYLE_TYPE.TAMIL */:
|
|
5322
6170
|
return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix);
|
|
5323
|
-
case 44 /* TELUGU */:
|
|
6171
|
+
case 44 /* LIST_STYLE_TYPE.TELUGU */:
|
|
5324
6172
|
return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix);
|
|
5325
|
-
case 45 /* THAI */:
|
|
6173
|
+
case 45 /* LIST_STYLE_TYPE.THAI */:
|
|
5326
6174
|
return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix);
|
|
5327
|
-
case 46 /* TIBETAN */:
|
|
6175
|
+
case 46 /* LIST_STYLE_TYPE.TIBETAN */:
|
|
5328
6176
|
return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix);
|
|
5329
|
-
case 3 /* DECIMAL */:
|
|
6177
|
+
case 3 /* LIST_STYLE_TYPE.DECIMAL */:
|
|
5330
6178
|
default:
|
|
5331
6179
|
return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
|
5332
6180
|
}
|
|
@@ -5376,7 +6224,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5376
6224
|
onclone = this.options.onclone;
|
|
5377
6225
|
referenceElement = this.clonedReferenceElement;
|
|
5378
6226
|
if (typeof referenceElement === 'undefined') {
|
|
5379
|
-
return [2 /*return*/, Promise.reject("Error finding the "
|
|
6227
|
+
return [2 /*return*/, Promise.reject("Error finding the ".concat(this.referenceElement.nodeName, " in the cloned document"))];
|
|
5380
6228
|
}
|
|
5381
6229
|
if (!(documentClone.fonts && documentClone.fonts.ready)) return [3 /*break*/, 2];
|
|
5382
6230
|
return [4 /*yield*/, documentClone.fonts.ready];
|
|
@@ -5399,16 +6247,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5399
6247
|
}
|
|
5400
6248
|
});
|
|
5401
6249
|
}); });
|
|
6250
|
+
var adoptedNode = documentClone.adoptNode(this.documentElement);
|
|
6251
|
+
/**
|
|
6252
|
+
* The baseURI of the document will be lost after documentClone.open().
|
|
6253
|
+
* We can avoid it by adding <base> element.
|
|
6254
|
+
* */
|
|
6255
|
+
addBase(adoptedNode, documentClone);
|
|
5402
6256
|
documentClone.open();
|
|
5403
|
-
documentClone.write(serializeDoctype(document.doctype)
|
|
6257
|
+
documentClone.write("".concat(serializeDoctype(document.doctype), "<html></html>"));
|
|
5404
6258
|
// Chrome scrolls the parent document for some reason after the write to the cloned window???
|
|
5405
6259
|
restoreOwnerScroll(this.referenceElement.ownerDocument, scrollX, scrollY);
|
|
5406
|
-
documentClone.replaceChild(
|
|
6260
|
+
documentClone.replaceChild(adoptedNode, documentClone.documentElement);
|
|
5407
6261
|
documentClone.close();
|
|
5408
6262
|
return iframeLoad;
|
|
5409
6263
|
};
|
|
5410
6264
|
DocumentCloner.prototype.createElementClone = function (node) {
|
|
5411
|
-
if (isDebugging(node, 2 /* CLONE */)) {
|
|
6265
|
+
if (isDebugging(node, 2 /* DebuggerType.CLONE */)) {
|
|
5412
6266
|
debugger;
|
|
5413
6267
|
}
|
|
5414
6268
|
if (isCanvasElement(node)) {
|
|
@@ -5481,7 +6335,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5481
6335
|
clonedCanvas.width = canvas.width;
|
|
5482
6336
|
clonedCanvas.height = canvas.height;
|
|
5483
6337
|
var ctx = canvas.getContext('2d');
|
|
5484
|
-
var clonedCtx = clonedCanvas.getContext('2d');
|
|
6338
|
+
var clonedCtx = clonedCanvas.getContext('2d', { willReadFrequently: true });
|
|
5485
6339
|
if (clonedCtx) {
|
|
5486
6340
|
if (!this.options.allowTaint && ctx) {
|
|
5487
6341
|
clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
|
|
@@ -5616,16 +6470,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5616
6470
|
var anonymousReplacedElement = document.createElement('html2canvaspseudoelement');
|
|
5617
6471
|
copyCSSStyles(style, anonymousReplacedElement);
|
|
5618
6472
|
declaration.content.forEach(function (token) {
|
|
5619
|
-
if (token.type === 0 /* STRING_TOKEN */) {
|
|
6473
|
+
if (token.type === 0 /* TokenType.STRING_TOKEN */) {
|
|
5620
6474
|
anonymousReplacedElement.appendChild(document.createTextNode(token.value));
|
|
5621
6475
|
}
|
|
5622
|
-
else if (token.type === 22 /* URL_TOKEN */) {
|
|
6476
|
+
else if (token.type === 22 /* TokenType.URL_TOKEN */) {
|
|
5623
6477
|
var img = document.createElement('img');
|
|
5624
6478
|
img.src = token.value;
|
|
5625
6479
|
img.style.opacity = '1';
|
|
5626
6480
|
anonymousReplacedElement.appendChild(img);
|
|
5627
6481
|
}
|
|
5628
|
-
else if (token.type === 18 /* FUNCTION */) {
|
|
6482
|
+
else if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
5629
6483
|
if (token.name === 'attr') {
|
|
5630
6484
|
var attr = token.values.filter(isIdentToken);
|
|
5631
6485
|
if (attr.length) {
|
|
@@ -5638,7 +6492,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5638
6492
|
var counterState = _this.counters.getCounterValue(counter.value);
|
|
5639
6493
|
var counterType = counterStyle && isIdentToken(counterStyle)
|
|
5640
6494
|
? listStyleType.parse(_this.context, counterStyle.value)
|
|
5641
|
-
: 3 /* DECIMAL */;
|
|
6495
|
+
: 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
5642
6496
|
anonymousReplacedElement.appendChild(document.createTextNode(createCounterText(counterState, counterType, false)));
|
|
5643
6497
|
}
|
|
5644
6498
|
}
|
|
@@ -5648,8 +6502,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5648
6502
|
var counterStates = _this.counters.getCounterValues(counter.value);
|
|
5649
6503
|
var counterType_1 = counterStyle && isIdentToken(counterStyle)
|
|
5650
6504
|
? listStyleType.parse(_this.context, counterStyle.value)
|
|
5651
|
-
: 3 /* DECIMAL */;
|
|
5652
|
-
var separator = delim && delim.type === 0 /* STRING_TOKEN */ ? delim.value : '';
|
|
6505
|
+
: 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
6506
|
+
var separator = delim && delim.type === 0 /* TokenType.STRING_TOKEN */ ? delim.value : '';
|
|
5653
6507
|
var text = counterStates
|
|
5654
6508
|
.map(function (value) { return createCounterText(value, counterType_1, false); })
|
|
5655
6509
|
.join(separator);
|
|
@@ -5658,7 +6512,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5658
6512
|
}
|
|
5659
6513
|
else ;
|
|
5660
6514
|
}
|
|
5661
|
-
else if (token.type === 20 /* IDENT_TOKEN */) {
|
|
6515
|
+
else if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
5662
6516
|
switch (token.value) {
|
|
5663
6517
|
case 'open-quote':
|
|
5664
6518
|
anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, _this.quoteDepth++, true)));
|
|
@@ -5672,10 +6526,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5672
6526
|
}
|
|
5673
6527
|
}
|
|
5674
6528
|
});
|
|
5675
|
-
anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE
|
|
6529
|
+
anonymousReplacedElement.className = "".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE, " ").concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER);
|
|
5676
6530
|
var newClassName = pseudoElt === PseudoElementType.BEFORE
|
|
5677
|
-
? " "
|
|
5678
|
-
: " "
|
|
6531
|
+
? " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE)
|
|
6532
|
+
: " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER);
|
|
5679
6533
|
if (isSVGElementNode(clone)) {
|
|
5680
6534
|
clone.className.baseValue += newClassName;
|
|
5681
6535
|
}
|
|
@@ -5774,10 +6628,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5774
6628
|
str += doctype.internalSubset;
|
|
5775
6629
|
}
|
|
5776
6630
|
if (doctype.publicId) {
|
|
5777
|
-
str += "\""
|
|
6631
|
+
str += "\"".concat(doctype.publicId, "\"");
|
|
5778
6632
|
}
|
|
5779
6633
|
if (doctype.systemId) {
|
|
5780
|
-
str += "\""
|
|
6634
|
+
str += "\"".concat(doctype.systemId, "\"");
|
|
5781
6635
|
}
|
|
5782
6636
|
str += '>';
|
|
5783
6637
|
}
|
|
@@ -5801,7 +6655,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5801
6655
|
var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after';
|
|
5802
6656
|
var PSEUDO_HIDE_ELEMENT_STYLE = "{\n content: \"\" !important;\n display: none !important;\n}";
|
|
5803
6657
|
var createPseudoHideStyles = function (body) {
|
|
5804
|
-
createStyles(body, "."
|
|
6658
|
+
createStyles(body, ".".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE).concat(PSEUDO_BEFORE).concat(PSEUDO_HIDE_ELEMENT_STYLE, "\n .").concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER).concat(PSEUDO_AFTER).concat(PSEUDO_HIDE_ELEMENT_STYLE));
|
|
5805
6659
|
};
|
|
5806
6660
|
var createStyles = function (body, styles) {
|
|
5807
6661
|
var document = body.ownerDocument;
|
|
@@ -5811,6 +6665,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5811
6665
|
body.appendChild(style);
|
|
5812
6666
|
}
|
|
5813
6667
|
};
|
|
6668
|
+
var addBase = function (targetELement, referenceDocument) {
|
|
6669
|
+
var _a;
|
|
6670
|
+
var baseNode = referenceDocument.createElement('base');
|
|
6671
|
+
baseNode.href = referenceDocument.baseURI;
|
|
6672
|
+
var headEle = targetELement.getElementsByTagName('head').item(0);
|
|
6673
|
+
headEle === null || headEle === void 0 ? void 0 : headEle.insertBefore(baseNode, (_a = headEle === null || headEle === void 0 ? void 0 : headEle.firstChild) !== null && _a !== void 0 ? _a : null);
|
|
6674
|
+
};
|
|
5814
6675
|
|
|
5815
6676
|
var CacheStorage = /** @class */ (function () {
|
|
5816
6677
|
function CacheStorage() {
|
|
@@ -5888,7 +6749,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5888
6749
|
src = _a.sent();
|
|
5889
6750
|
_a.label = 2;
|
|
5890
6751
|
case 2:
|
|
5891
|
-
this.context.logger.debug("Added image "
|
|
6752
|
+
this.context.logger.debug("Added image ".concat(key.substring(0, 256)));
|
|
5892
6753
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
5893
6754
|
var img = new Image();
|
|
5894
6755
|
img.onload = function () { return resolve(img); };
|
|
@@ -5903,7 +6764,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5903
6764
|
setTimeout(function () { return resolve(img); }, 500);
|
|
5904
6765
|
}
|
|
5905
6766
|
if (_this._options.imageTimeout > 0) {
|
|
5906
|
-
setTimeout(function () { return reject("Timed out ("
|
|
6767
|
+
setTimeout(function () { return reject("Timed out (".concat(_this._options.imageTimeout, "ms) loading image")); }, _this._options.imageTimeout);
|
|
5907
6768
|
}
|
|
5908
6769
|
})];
|
|
5909
6770
|
case 3: return [2 /*return*/, _a.sent()];
|
|
@@ -5940,19 +6801,19 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5940
6801
|
}
|
|
5941
6802
|
}
|
|
5942
6803
|
else {
|
|
5943
|
-
reject("Failed to proxy resource "
|
|
6804
|
+
reject("Failed to proxy resource ".concat(key, " with status code ").concat(xhr.status));
|
|
5944
6805
|
}
|
|
5945
6806
|
};
|
|
5946
6807
|
xhr.onerror = reject;
|
|
5947
6808
|
var queryString = proxy.indexOf('?') > -1 ? '&' : '?';
|
|
5948
|
-
xhr.open('GET', ""
|
|
6809
|
+
xhr.open('GET', "".concat(proxy).concat(queryString, "url=").concat(encodeURIComponent(src), "&responseType=").concat(responseType));
|
|
5949
6810
|
if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
|
|
5950
6811
|
xhr.responseType = responseType;
|
|
5951
6812
|
}
|
|
5952
6813
|
if (_this._options.imageTimeout) {
|
|
5953
6814
|
var timeout_1 = _this._options.imageTimeout;
|
|
5954
6815
|
xhr.timeout = timeout_1;
|
|
5955
|
-
xhr.ontimeout = function () { return reject("Timed out ("
|
|
6816
|
+
xhr.ontimeout = function () { return reject("Timed out (".concat(timeout_1, "ms) proxying ").concat(key)); };
|
|
5956
6817
|
}
|
|
5957
6818
|
xhr.send();
|
|
5958
6819
|
});
|
|
@@ -5970,7 +6831,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5970
6831
|
|
|
5971
6832
|
var Vector = /** @class */ (function () {
|
|
5972
6833
|
function Vector(x, y) {
|
|
5973
|
-
this.type = 0 /* VECTOR */;
|
|
6834
|
+
this.type = 0 /* PathType.VECTOR */;
|
|
5974
6835
|
this.x = x;
|
|
5975
6836
|
this.y = y;
|
|
5976
6837
|
}
|
|
@@ -5985,7 +6846,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5985
6846
|
};
|
|
5986
6847
|
var BezierCurve = /** @class */ (function () {
|
|
5987
6848
|
function BezierCurve(start, startControl, endControl, end) {
|
|
5988
|
-
this.type = 1 /* BEZIER_CURVE */;
|
|
6849
|
+
this.type = 1 /* PathType.BEZIER_CURVE */;
|
|
5989
6850
|
this.start = start;
|
|
5990
6851
|
this.startControl = startControl;
|
|
5991
6852
|
this.endControl = endControl;
|
|
@@ -6008,7 +6869,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6008
6869
|
};
|
|
6009
6870
|
return BezierCurve;
|
|
6010
6871
|
}());
|
|
6011
|
-
var isBezierCurve = function (path) { return path.type === 1 /* BEZIER_CURVE */; };
|
|
6872
|
+
var isBezierCurve = function (path) { return path.type === 1 /* PathType.BEZIER_CURVE */; };
|
|
6012
6873
|
|
|
6013
6874
|
var BoundCurves = /** @class */ (function () {
|
|
6014
6875
|
function BoundCurves(element) {
|
|
@@ -6195,8 +7056,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6195
7056
|
this.offsetX = offsetX;
|
|
6196
7057
|
this.offsetY = offsetY;
|
|
6197
7058
|
this.matrix = matrix;
|
|
6198
|
-
this.type = 0 /* TRANSFORM */;
|
|
6199
|
-
this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
|
|
7059
|
+
this.type = 0 /* EffectType.TRANSFORM */;
|
|
7060
|
+
this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
|
|
6200
7061
|
}
|
|
6201
7062
|
return TransformEffect;
|
|
6202
7063
|
}());
|
|
@@ -6204,23 +7065,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6204
7065
|
function ClipEffect(path, target) {
|
|
6205
7066
|
this.path = path;
|
|
6206
7067
|
this.target = target;
|
|
6207
|
-
this.type = 1 /* CLIP */;
|
|
7068
|
+
this.type = 1 /* EffectType.CLIP */;
|
|
6208
7069
|
}
|
|
6209
7070
|
return ClipEffect;
|
|
6210
7071
|
}());
|
|
6211
7072
|
var OpacityEffect = /** @class */ (function () {
|
|
6212
7073
|
function OpacityEffect(opacity) {
|
|
6213
7074
|
this.opacity = opacity;
|
|
6214
|
-
this.type = 2 /* OPACITY */;
|
|
6215
|
-
this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
|
|
7075
|
+
this.type = 2 /* EffectType.OPACITY */;
|
|
7076
|
+
this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
|
|
6216
7077
|
}
|
|
6217
7078
|
return OpacityEffect;
|
|
6218
7079
|
}());
|
|
6219
7080
|
var isTransformEffect = function (effect) {
|
|
6220
|
-
return effect.type === 0 /* TRANSFORM */;
|
|
7081
|
+
return effect.type === 0 /* EffectType.TRANSFORM */;
|
|
6221
7082
|
};
|
|
6222
|
-
var isClipEffect = function (effect) { return effect.type === 1 /* CLIP */; };
|
|
6223
|
-
var isOpacityEffect = function (effect) { return effect.type === 2 /* OPACITY */; };
|
|
7083
|
+
var isClipEffect = function (effect) { return effect.type === 1 /* EffectType.CLIP */; };
|
|
7084
|
+
var isOpacityEffect = function (effect) { return effect.type === 2 /* EffectType.OPACITY */; };
|
|
6224
7085
|
|
|
6225
7086
|
var equalPath = function (a, b) {
|
|
6226
7087
|
if (a.length === b.length) {
|
|
@@ -6272,34 +7133,34 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6272
7133
|
var matrix = this.container.styles.transform;
|
|
6273
7134
|
this.effects.push(new TransformEffect(offsetX, offsetY, matrix));
|
|
6274
7135
|
}
|
|
6275
|
-
if (this.container.styles.overflowX !== 0 /* VISIBLE */) {
|
|
7136
|
+
if (this.container.styles.overflowX !== 0 /* OVERFLOW.VISIBLE */) {
|
|
6276
7137
|
var borderBox = calculateBorderBoxPath(this.curves);
|
|
6277
7138
|
var paddingBox = calculatePaddingBoxPath(this.curves);
|
|
6278
7139
|
if (equalPath(borderBox, paddingBox)) {
|
|
6279
|
-
this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
|
|
7140
|
+
this.effects.push(new ClipEffect(borderBox, 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */));
|
|
6280
7141
|
}
|
|
6281
7142
|
else {
|
|
6282
|
-
this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */));
|
|
6283
|
-
this.effects.push(new ClipEffect(paddingBox, 4 /* CONTENT */));
|
|
7143
|
+
this.effects.push(new ClipEffect(borderBox, 2 /* EffectTarget.BACKGROUND_BORDERS */));
|
|
7144
|
+
this.effects.push(new ClipEffect(paddingBox, 4 /* EffectTarget.CONTENT */));
|
|
6284
7145
|
}
|
|
6285
7146
|
}
|
|
6286
7147
|
}
|
|
6287
7148
|
ElementPaint.prototype.getEffects = function (target) {
|
|
6288
|
-
var inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(this.container.styles.position) === -1;
|
|
7149
|
+
var inFlow = [2 /* POSITION.ABSOLUTE */, 3 /* POSITION.FIXED */].indexOf(this.container.styles.position) === -1;
|
|
6289
7150
|
var parent = this.parent;
|
|
6290
7151
|
var effects = this.effects.slice(0);
|
|
6291
7152
|
while (parent) {
|
|
6292
7153
|
var croplessEffects = parent.effects.filter(function (effect) { return !isClipEffect(effect); });
|
|
6293
|
-
if (inFlow || parent.container.styles.position !== 0 /* STATIC */ || !parent.parent) {
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
if (parent.container.styles.overflowX !== 0 /* VISIBLE */) {
|
|
7154
|
+
if (inFlow || parent.container.styles.position !== 0 /* POSITION.STATIC */ || !parent.parent) {
|
|
7155
|
+
inFlow = [2 /* POSITION.ABSOLUTE */, 3 /* POSITION.FIXED */].indexOf(parent.container.styles.position) === -1;
|
|
7156
|
+
if (parent.container.styles.overflowX !== 0 /* OVERFLOW.VISIBLE */) {
|
|
6297
7157
|
var borderBox = calculateBorderBoxPath(parent.curves);
|
|
6298
7158
|
var paddingBox = calculatePaddingBoxPath(parent.curves);
|
|
6299
7159
|
if (!equalPath(borderBox, paddingBox)) {
|
|
6300
|
-
effects.unshift(new ClipEffect(paddingBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
|
|
7160
|
+
effects.unshift(new ClipEffect(paddingBox, 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */));
|
|
6301
7161
|
}
|
|
6302
7162
|
}
|
|
7163
|
+
effects.unshift.apply(effects, croplessEffects);
|
|
6303
7164
|
}
|
|
6304
7165
|
else {
|
|
6305
7166
|
effects.unshift.apply(effects, croplessEffects);
|
|
@@ -6312,13 +7173,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6312
7173
|
}());
|
|
6313
7174
|
var parseStackTree = function (parent, stackingContext, realStackingContext, listItems) {
|
|
6314
7175
|
parent.container.elements.forEach(function (child) {
|
|
6315
|
-
var treatAsRealStackingContext = contains(child.flags, 4 /* CREATES_REAL_STACKING_CONTEXT */);
|
|
6316
|
-
var createsStackingContext = contains(child.flags, 2 /* CREATES_STACKING_CONTEXT */);
|
|
7176
|
+
var treatAsRealStackingContext = contains(child.flags, 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */);
|
|
7177
|
+
var createsStackingContext = contains(child.flags, 2 /* FLAGS.CREATES_STACKING_CONTEXT */);
|
|
6317
7178
|
var paintContainer = new ElementPaint(child, parent);
|
|
6318
|
-
if (contains(child.styles.display, 2048 /* LIST_ITEM */)) {
|
|
7179
|
+
if (contains(child.styles.display, 2048 /* DISPLAY.LIST_ITEM */)) {
|
|
6319
7180
|
listItems.push(paintContainer);
|
|
6320
7181
|
}
|
|
6321
|
-
var listOwnerItems = contains(child.flags, 8 /* IS_LIST_OWNER */) ? [] : listItems;
|
|
7182
|
+
var listOwnerItems = contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */) ? [] : listItems;
|
|
6322
7183
|
if (treatAsRealStackingContext || createsStackingContext) {
|
|
6323
7184
|
var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext;
|
|
6324
7185
|
var stack = new StackingContext(paintContainer);
|
|
@@ -6375,7 +7236,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6375
7236
|
}
|
|
6376
7237
|
parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems);
|
|
6377
7238
|
}
|
|
6378
|
-
if (contains(child.flags, 8 /* IS_LIST_OWNER */)) {
|
|
7239
|
+
if (contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */)) {
|
|
6379
7240
|
processListItems(child, listOwnerItems);
|
|
6380
7241
|
}
|
|
6381
7242
|
});
|
|
@@ -6516,19 +7377,19 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6516
7377
|
};
|
|
6517
7378
|
|
|
6518
7379
|
var calculateBackgroundPositioningArea = function (backgroundOrigin, element) {
|
|
6519
|
-
if (backgroundOrigin === 0 /* BORDER_BOX */) {
|
|
7380
|
+
if (backgroundOrigin === 0 /* BACKGROUND_ORIGIN.BORDER_BOX */) {
|
|
6520
7381
|
return element.bounds;
|
|
6521
7382
|
}
|
|
6522
|
-
if (backgroundOrigin === 2 /* CONTENT_BOX */) {
|
|
7383
|
+
if (backgroundOrigin === 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */) {
|
|
6523
7384
|
return contentBox(element);
|
|
6524
7385
|
}
|
|
6525
7386
|
return paddingBox(element);
|
|
6526
7387
|
};
|
|
6527
7388
|
var calculateBackgroundPaintingArea = function (backgroundClip, element) {
|
|
6528
|
-
if (backgroundClip === 0 /* BORDER_BOX */) {
|
|
7389
|
+
if (backgroundClip === 0 /* BACKGROUND_CLIP.BORDER_BOX */) {
|
|
6529
7390
|
return element.bounds;
|
|
6530
7391
|
}
|
|
6531
|
-
if (backgroundClip === 2 /* CONTENT_BOX */) {
|
|
7392
|
+
if (backgroundClip === 2 /* BACKGROUND_CLIP.CONTENT_BOX */) {
|
|
6532
7393
|
return contentBox(element);
|
|
6533
7394
|
}
|
|
6534
7395
|
return paddingBox(element);
|
|
@@ -6542,6 +7403,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6542
7403
|
var path = calculateBackgroundRepeatPath(getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea);
|
|
6543
7404
|
var offsetX = Math.round(backgroundPositioningArea.left + position[0]);
|
|
6544
7405
|
var offsetY = Math.round(backgroundPositioningArea.top + position[1]);
|
|
7406
|
+
sizeWidth = Math.max(1, sizeWidth);
|
|
7407
|
+
sizeHeight = Math.max(1, sizeHeight);
|
|
6545
7408
|
return [path, offsetX, offsetY, sizeWidth, sizeHeight];
|
|
6546
7409
|
};
|
|
6547
7410
|
var isAuto = function (token) { return isIdentToken(token) && token.value === BACKGROUND_SIZE.AUTO; };
|
|
@@ -6656,21 +7519,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6656
7519
|
var x = _a[0], y = _a[1];
|
|
6657
7520
|
var width = _b[0], height = _b[1];
|
|
6658
7521
|
switch (repeat) {
|
|
6659
|
-
case 2 /* REPEAT_X */:
|
|
7522
|
+
case 2 /* BACKGROUND_REPEAT.REPEAT_X */:
|
|
6660
7523
|
return [
|
|
6661
7524
|
new Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)),
|
|
6662
7525
|
new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)),
|
|
6663
7526
|
new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)),
|
|
6664
7527
|
new Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y))
|
|
6665
7528
|
];
|
|
6666
|
-
case 3 /* REPEAT_Y */:
|
|
7529
|
+
case 3 /* BACKGROUND_REPEAT.REPEAT_Y */:
|
|
6667
7530
|
return [
|
|
6668
7531
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)),
|
|
6669
7532
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)),
|
|
6670
7533
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)),
|
|
6671
7534
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top))
|
|
6672
7535
|
];
|
|
6673
|
-
case 1 /* NO_REPEAT */:
|
|
7536
|
+
case 1 /* BACKGROUND_REPEAT.NO_REPEAT */:
|
|
6674
7537
|
return [
|
|
6675
7538
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)),
|
|
6676
7539
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)),
|
|
@@ -6730,7 +7593,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6730
7593
|
return { baseline: baseline, middle: middle };
|
|
6731
7594
|
};
|
|
6732
7595
|
FontMetrics.prototype.getMetrics = function (fontFamily, fontSize) {
|
|
6733
|
-
var key = fontFamily
|
|
7596
|
+
var key = "".concat(fontFamily, " ").concat(fontSize);
|
|
6734
7597
|
if (typeof this._data[key] === 'undefined') {
|
|
6735
7598
|
this._data[key] = this.parseMetrics(fontFamily, fontSize);
|
|
6736
7599
|
}
|
|
@@ -6758,15 +7621,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6758
7621
|
if (!options.canvas) {
|
|
6759
7622
|
_this.canvas.width = Math.floor(options.width * options.scale);
|
|
6760
7623
|
_this.canvas.height = Math.floor(options.height * options.scale);
|
|
6761
|
-
_this.canvas.style.width = options.width
|
|
6762
|
-
_this.canvas.style.height = options.height
|
|
7624
|
+
_this.canvas.style.width = "".concat(options.width, "px");
|
|
7625
|
+
_this.canvas.style.height = "".concat(options.height, "px");
|
|
6763
7626
|
}
|
|
6764
7627
|
_this.fontMetrics = new FontMetrics(document);
|
|
6765
7628
|
_this.ctx.scale(_this.options.scale, _this.options.scale);
|
|
6766
7629
|
_this.ctx.translate(-options.x, -options.y);
|
|
6767
7630
|
_this.ctx.textBaseline = 'bottom';
|
|
6768
7631
|
_this._activeEffects = [];
|
|
6769
|
-
_this.context.logger.debug("Canvas renderer initialized ("
|
|
7632
|
+
_this.context.logger.debug("Canvas renderer initialized (".concat(options.width, "x").concat(options.height, ") with scale ").concat(options.scale));
|
|
6770
7633
|
return _this;
|
|
6771
7634
|
}
|
|
6772
7635
|
CanvasRenderer.prototype.applyEffects = function (effects) {
|
|
@@ -6818,7 +7681,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6818
7681
|
return __generator(this, function (_a) {
|
|
6819
7682
|
switch (_a.label) {
|
|
6820
7683
|
case 0:
|
|
6821
|
-
if (contains(paint.container.flags, 16 /* DEBUG_RENDER */)) {
|
|
7684
|
+
if (contains(paint.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
|
|
6822
7685
|
debugger;
|
|
6823
7686
|
}
|
|
6824
7687
|
if (!paint.container.styles.isVisible()) return [3 /*break*/, 3];
|
|
@@ -6837,7 +7700,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6837
7700
|
CanvasRenderer.prototype.renderTextWithLetterSpacing = function (text, letterSpacing, baseline) {
|
|
6838
7701
|
var _this = this;
|
|
6839
7702
|
if (letterSpacing === 0) {
|
|
6840
|
-
|
|
7703
|
+
// Fixed an issue with characters moving up in non-Firefox.
|
|
7704
|
+
// https://github.com/niklasvh/html2canvas/issues/2107#issuecomment-692462900
|
|
7705
|
+
if (navigator.userAgent.indexOf('Firefox') === -1) {
|
|
7706
|
+
this.ctx.textBaseline = 'ideographic';
|
|
7707
|
+
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
|
7708
|
+
}
|
|
7709
|
+
else {
|
|
7710
|
+
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + baseline);
|
|
7711
|
+
}
|
|
6841
7712
|
}
|
|
6842
7713
|
else {
|
|
6843
7714
|
var letters = segmentGraphemes(text.text);
|
|
@@ -6853,8 +7724,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6853
7724
|
.join('');
|
|
6854
7725
|
var fontFamily = fixIOSSystemFonts(styles.fontFamily).join(', ');
|
|
6855
7726
|
var fontSize = isDimensionToken(styles.fontSize)
|
|
6856
|
-
? ""
|
|
6857
|
-
: styles.fontSize.number
|
|
7727
|
+
? "".concat(styles.fontSize.number).concat(styles.fontSize.unit)
|
|
7728
|
+
: "".concat(styles.fontSize.number, "px");
|
|
6858
7729
|
return [
|
|
6859
7730
|
[styles.fontStyle, fontVariant, styles.fontWeight, fontSize, fontFamily].join(' '),
|
|
6860
7731
|
fontFamily,
|
|
@@ -6863,22 +7734,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6863
7734
|
};
|
|
6864
7735
|
CanvasRenderer.prototype.renderTextNode = function (text, styles) {
|
|
6865
7736
|
return __awaiter(this, void 0, void 0, function () {
|
|
6866
|
-
var
|
|
7737
|
+
var font, paintOrder;
|
|
6867
7738
|
var _this = this;
|
|
6868
|
-
return __generator(this, function (
|
|
6869
|
-
|
|
7739
|
+
return __generator(this, function (_a) {
|
|
7740
|
+
font = this.createFontStyle(styles)[0];
|
|
6870
7741
|
this.ctx.font = font;
|
|
6871
|
-
this.ctx.direction = styles.direction === 1 /* RTL */ ? 'rtl' : 'ltr';
|
|
7742
|
+
this.ctx.direction = styles.direction === 1 /* DIRECTION.RTL */ ? 'rtl' : 'ltr';
|
|
6872
7743
|
this.ctx.textAlign = 'left';
|
|
6873
7744
|
this.ctx.textBaseline = 'alphabetic';
|
|
6874
|
-
_b = this.fontMetrics.getMetrics(fontFamily, fontSize), baseline = _b.baseline, middle = _b.middle;
|
|
6875
7745
|
paintOrder = styles.paintOrder;
|
|
6876
7746
|
text.textBounds.forEach(function (text) {
|
|
6877
7747
|
paintOrder.forEach(function (paintOrderLayer) {
|
|
6878
7748
|
switch (paintOrderLayer) {
|
|
6879
|
-
case 0 /* FILL */:
|
|
7749
|
+
case 0 /* PAINT_ORDER_LAYER.FILL */:
|
|
6880
7750
|
_this.ctx.fillStyle = asString(styles.color);
|
|
6881
|
-
_this.renderTextWithLetterSpacing(text, styles.letterSpacing,
|
|
7751
|
+
_this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
|
|
6882
7752
|
var textShadows = styles.textShadow;
|
|
6883
7753
|
if (textShadows.length && text.text.trim().length) {
|
|
6884
7754
|
textShadows
|
|
@@ -6889,7 +7759,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6889
7759
|
_this.ctx.shadowOffsetX = textShadow.offsetX.number * _this.options.scale;
|
|
6890
7760
|
_this.ctx.shadowOffsetY = textShadow.offsetY.number * _this.options.scale;
|
|
6891
7761
|
_this.ctx.shadowBlur = textShadow.blur.number;
|
|
6892
|
-
_this.renderTextWithLetterSpacing(text, styles.letterSpacing,
|
|
7762
|
+
_this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
|
|
6893
7763
|
});
|
|
6894
7764
|
_this.ctx.shadowColor = '';
|
|
6895
7765
|
_this.ctx.shadowOffsetX = 0;
|
|
@@ -6898,32 +7768,30 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6898
7768
|
}
|
|
6899
7769
|
if (styles.textDecorationLine.length) {
|
|
6900
7770
|
_this.ctx.fillStyle = asString(styles.textDecorationColor || styles.color);
|
|
7771
|
+
var decorationLineHeight_1 = 1;
|
|
6901
7772
|
styles.textDecorationLine.forEach(function (textDecorationLine) {
|
|
7773
|
+
// Fix the issue where textDecorationLine exhibits x-axis positioning errors on high-resolution devices due to varying devicePixelRatio, corrected by using relative values of element heights.
|
|
6902
7774
|
switch (textDecorationLine) {
|
|
6903
|
-
case 1 /* UNDERLINE */:
|
|
6904
|
-
|
|
6905
|
-
// TODO As some browsers display the line as more than 1px if the font-size is big,
|
|
6906
|
-
// need to take that into account both in position and size
|
|
6907
|
-
_this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1);
|
|
7775
|
+
case 1 /* TEXT_DECORATION_LINE.UNDERLINE */:
|
|
7776
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top + text.bounds.height - decorationLineHeight_1, text.bounds.width, decorationLineHeight_1);
|
|
6908
7777
|
break;
|
|
6909
|
-
case 2 /* OVERLINE */:
|
|
6910
|
-
_this.ctx.fillRect(text.bounds.left,
|
|
7778
|
+
case 2 /* TEXT_DECORATION_LINE.OVERLINE */:
|
|
7779
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top, text.bounds.width, decorationLineHeight_1);
|
|
6911
7780
|
break;
|
|
6912
|
-
case 3 /* LINE_THROUGH */:
|
|
6913
|
-
|
|
6914
|
-
_this.ctx.fillRect(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1);
|
|
7781
|
+
case 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */:
|
|
7782
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top + (text.bounds.height / 2 - decorationLineHeight_1 / 2), text.bounds.width, decorationLineHeight_1);
|
|
6915
7783
|
break;
|
|
6916
7784
|
}
|
|
6917
7785
|
});
|
|
6918
7786
|
}
|
|
6919
7787
|
break;
|
|
6920
|
-
case 1 /* STROKE */:
|
|
7788
|
+
case 1 /* PAINT_ORDER_LAYER.STROKE */:
|
|
6921
7789
|
if (styles.webkitTextStrokeWidth && text.text.trim().length) {
|
|
6922
7790
|
_this.ctx.strokeStyle = asString(styles.webkitTextStrokeColor);
|
|
6923
7791
|
_this.ctx.lineWidth = styles.webkitTextStrokeWidth;
|
|
6924
7792
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6925
7793
|
_this.ctx.lineJoin = !!window.chrome ? 'miter' : 'round';
|
|
6926
|
-
_this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top +
|
|
7794
|
+
_this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
|
6927
7795
|
}
|
|
6928
7796
|
_this.ctx.strokeStyle = '';
|
|
6929
7797
|
_this.ctx.lineWidth = 0;
|
|
@@ -6937,13 +7805,89 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6937
7805
|
});
|
|
6938
7806
|
};
|
|
6939
7807
|
CanvasRenderer.prototype.renderReplacedElement = function (container, curves, image) {
|
|
6940
|
-
|
|
7808
|
+
var intrinsicWidth = image.naturalWidth || container.intrinsicWidth;
|
|
7809
|
+
var intrinsicHeight = image.naturalHeight || container.intrinsicHeight;
|
|
7810
|
+
if (image && intrinsicWidth > 0 && intrinsicHeight > 0) {
|
|
6941
7811
|
var box = contentBox(container);
|
|
6942
7812
|
var path = calculatePaddingBoxPath(curves);
|
|
6943
7813
|
this.path(path);
|
|
6944
7814
|
this.ctx.save();
|
|
6945
7815
|
this.ctx.clip();
|
|
6946
|
-
|
|
7816
|
+
var sx = 0, sy = 0, sw = intrinsicWidth, sh = intrinsicHeight, dx = box.left, dy = box.top, dw = box.width, dh = box.height;
|
|
7817
|
+
var objectFit = container.styles.objectFit;
|
|
7818
|
+
var boxRatio = dw / dh;
|
|
7819
|
+
var imgRatio = sw / sh;
|
|
7820
|
+
if (objectFit === 2 /* OBJECT_FIT.CONTAIN */) {
|
|
7821
|
+
if (imgRatio > boxRatio) {
|
|
7822
|
+
dh = dw / imgRatio;
|
|
7823
|
+
dy += (box.height - dh) / 2;
|
|
7824
|
+
}
|
|
7825
|
+
else {
|
|
7826
|
+
dw = dh * imgRatio;
|
|
7827
|
+
dx += (box.width - dw) / 2;
|
|
7828
|
+
}
|
|
7829
|
+
}
|
|
7830
|
+
else if (objectFit === 4 /* OBJECT_FIT.COVER */) {
|
|
7831
|
+
if (imgRatio > boxRatio) {
|
|
7832
|
+
sw = sh * boxRatio;
|
|
7833
|
+
sx += (intrinsicWidth - sw) / 2;
|
|
7834
|
+
}
|
|
7835
|
+
else {
|
|
7836
|
+
sh = sw / boxRatio;
|
|
7837
|
+
sy += (intrinsicHeight - sh) / 2;
|
|
7838
|
+
}
|
|
7839
|
+
}
|
|
7840
|
+
else if (objectFit === 8 /* OBJECT_FIT.NONE */) {
|
|
7841
|
+
if (sw > dw) {
|
|
7842
|
+
sx += (sw - dw) / 2;
|
|
7843
|
+
sw = dw;
|
|
7844
|
+
}
|
|
7845
|
+
else {
|
|
7846
|
+
dx += (dw - sw) / 2;
|
|
7847
|
+
dw = sw;
|
|
7848
|
+
}
|
|
7849
|
+
if (sh > dh) {
|
|
7850
|
+
sy += (sh - dh) / 2;
|
|
7851
|
+
sh = dh;
|
|
7852
|
+
}
|
|
7853
|
+
else {
|
|
7854
|
+
dy += (dh - sh) / 2;
|
|
7855
|
+
dh = sh;
|
|
7856
|
+
}
|
|
7857
|
+
}
|
|
7858
|
+
else if (objectFit === 16 /* OBJECT_FIT.SCALE_DOWN */) {
|
|
7859
|
+
var containW = imgRatio > boxRatio ? dw : dh * imgRatio;
|
|
7860
|
+
var noneW = sw > dw ? sw : dw;
|
|
7861
|
+
if (containW < noneW) {
|
|
7862
|
+
if (imgRatio > boxRatio) {
|
|
7863
|
+
dh = dw / imgRatio;
|
|
7864
|
+
dy += (box.height - dh) / 2;
|
|
7865
|
+
}
|
|
7866
|
+
else {
|
|
7867
|
+
dw = dh * imgRatio;
|
|
7868
|
+
dx += (box.width - dw) / 2;
|
|
7869
|
+
}
|
|
7870
|
+
}
|
|
7871
|
+
else {
|
|
7872
|
+
if (sw > dw) {
|
|
7873
|
+
sx += (sw - dw) / 2;
|
|
7874
|
+
sw = dw;
|
|
7875
|
+
}
|
|
7876
|
+
else {
|
|
7877
|
+
dx += (dw - sw) / 2;
|
|
7878
|
+
dw = sw;
|
|
7879
|
+
}
|
|
7880
|
+
if (sh > dh) {
|
|
7881
|
+
sy += (sh - dh) / 2;
|
|
7882
|
+
sh = dh;
|
|
7883
|
+
}
|
|
7884
|
+
else {
|
|
7885
|
+
dy += (dh - sh) / 2;
|
|
7886
|
+
dh = sh;
|
|
7887
|
+
}
|
|
7888
|
+
}
|
|
7889
|
+
}
|
|
7890
|
+
this.ctx.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh);
|
|
6947
7891
|
this.ctx.restore();
|
|
6948
7892
|
}
|
|
6949
7893
|
};
|
|
@@ -6953,7 +7897,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6953
7897
|
return __generator(this, function (_c) {
|
|
6954
7898
|
switch (_c.label) {
|
|
6955
7899
|
case 0:
|
|
6956
|
-
this.applyEffects(paint.getEffects(4 /* CONTENT */));
|
|
7900
|
+
this.applyEffects(paint.getEffects(4 /* EffectTarget.CONTENT */));
|
|
6957
7901
|
container = paint.container;
|
|
6958
7902
|
curves = paint.curves;
|
|
6959
7903
|
styles = container.styles;
|
|
@@ -6981,7 +7925,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6981
7925
|
return [3 /*break*/, 8];
|
|
6982
7926
|
case 7:
|
|
6983
7927
|
_c.sent();
|
|
6984
|
-
this.context.logger.error("Error loading image "
|
|
7928
|
+
this.context.logger.error("Error loading image ".concat(container.src));
|
|
6985
7929
|
return [3 /*break*/, 8];
|
|
6986
7930
|
case 8:
|
|
6987
7931
|
if (container instanceof CanvasElementContainer) {
|
|
@@ -6998,7 +7942,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6998
7942
|
return [3 /*break*/, 12];
|
|
6999
7943
|
case 11:
|
|
7000
7944
|
_c.sent();
|
|
7001
|
-
this.context.logger.error("Error loading svg "
|
|
7945
|
+
this.context.logger.error("Error loading svg ".concat(container.svg.substring(0, 255)));
|
|
7002
7946
|
return [3 /*break*/, 12];
|
|
7003
7947
|
case 12:
|
|
7004
7948
|
if (!(container instanceof IFrameElementContainer && container.tree)) return [3 /*break*/, 14];
|
|
@@ -7058,10 +8002,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7058
8002
|
bounds = contentBox(container);
|
|
7059
8003
|
x = 0;
|
|
7060
8004
|
switch (container.styles.textAlign) {
|
|
7061
|
-
case 1 /* CENTER */:
|
|
8005
|
+
case 1 /* TEXT_ALIGN.CENTER */:
|
|
7062
8006
|
x += bounds.width / 2;
|
|
7063
8007
|
break;
|
|
7064
|
-
case 2 /* RIGHT */:
|
|
8008
|
+
case 2 /* TEXT_ALIGN.RIGHT */:
|
|
7065
8009
|
x += bounds.width;
|
|
7066
8010
|
break;
|
|
7067
8011
|
}
|
|
@@ -7079,10 +8023,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7079
8023
|
this.ctx.textBaseline = 'alphabetic';
|
|
7080
8024
|
this.ctx.textAlign = 'left';
|
|
7081
8025
|
}
|
|
7082
|
-
if (!contains(container.styles.display, 2048 /* LIST_ITEM */)) return [3 /*break*/, 20];
|
|
8026
|
+
if (!contains(container.styles.display, 2048 /* DISPLAY.LIST_ITEM */)) return [3 /*break*/, 20];
|
|
7083
8027
|
if (!(container.styles.listStyleImage !== null)) return [3 /*break*/, 19];
|
|
7084
8028
|
img = container.styles.listStyleImage;
|
|
7085
|
-
if (!(img.type === 0 /* URL */)) return [3 /*break*/, 18];
|
|
8029
|
+
if (!(img.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 18];
|
|
7086
8030
|
image = void 0;
|
|
7087
8031
|
url = img.url;
|
|
7088
8032
|
_c.label = 15;
|
|
@@ -7095,11 +8039,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7095
8039
|
return [3 /*break*/, 18];
|
|
7096
8040
|
case 17:
|
|
7097
8041
|
_c.sent();
|
|
7098
|
-
this.context.logger.error("Error loading list-style-image "
|
|
8042
|
+
this.context.logger.error("Error loading list-style-image ".concat(url));
|
|
7099
8043
|
return [3 /*break*/, 18];
|
|
7100
8044
|
case 18: return [3 /*break*/, 20];
|
|
7101
8045
|
case 19:
|
|
7102
|
-
if (paint.listValue && container.styles.listStyleType !== -1 /* NONE */) {
|
|
8046
|
+
if (paint.listValue && container.styles.listStyleType !== -1 /* LIST_STYLE_TYPE.NONE */) {
|
|
7103
8047
|
fontFamily = this.createFontStyle(styles)[0];
|
|
7104
8048
|
this.ctx.font = fontFamily;
|
|
7105
8049
|
this.ctx.fillStyle = asString(styles.color);
|
|
@@ -7122,7 +8066,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7122
8066
|
return __generator(this, function (_p) {
|
|
7123
8067
|
switch (_p.label) {
|
|
7124
8068
|
case 0:
|
|
7125
|
-
if (contains(stack.element.container.flags, 16 /* DEBUG_RENDER */)) {
|
|
8069
|
+
if (contains(stack.element.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
|
|
7126
8070
|
debugger;
|
|
7127
8071
|
}
|
|
7128
8072
|
// https://www.w3.org/TR/css-position-3/#painting-order
|
|
@@ -7270,10 +8214,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7270
8214
|
this.ctx.translate(-offsetX, -offsetY);
|
|
7271
8215
|
};
|
|
7272
8216
|
CanvasRenderer.prototype.resizeImage = function (image, width, height) {
|
|
8217
|
+
// https://github.com/niklasvh/html2canvas/pull/2911
|
|
8218
|
+
// if (image.width === width && image.height === height) {
|
|
8219
|
+
// return image;
|
|
8220
|
+
// }
|
|
7273
8221
|
var _a;
|
|
7274
|
-
if (image.width === width && image.height === height) {
|
|
7275
|
-
return image;
|
|
7276
|
-
}
|
|
7277
8222
|
var ownerDocument = (_a = this.canvas.ownerDocument) !== null && _a !== void 0 ? _a : document;
|
|
7278
8223
|
var canvas = ownerDocument.createElement('canvas');
|
|
7279
8224
|
canvas.width = Math.max(1, width);
|
|
@@ -7290,11 +8235,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7290
8235
|
case 0:
|
|
7291
8236
|
index = container.styles.backgroundImage.length - 1;
|
|
7292
8237
|
_loop_1 = function (backgroundImage) {
|
|
7293
|
-
var image, url, _c, path, x, y, width, height, pattern, _d, path, x, y, width, height, _e, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _f, path, left, top_1, width, height, position, x, y, _g, rx, ry, radialGradient_1, midX, midY, f, invF;
|
|
8238
|
+
var image, url, imageWidth, imageHeight, _c, path, x, y, width, height, pattern, _d, path, x, y, width, height, _e, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _f, path, left, top_1, width, height, position, x, y, _g, rx, ry, radialGradient_1, midX, midY, f, invF;
|
|
7294
8239
|
return __generator(this, function (_h) {
|
|
7295
8240
|
switch (_h.label) {
|
|
7296
8241
|
case 0:
|
|
7297
|
-
if (!(backgroundImage.type === 0 /* URL */)) return [3 /*break*/, 5];
|
|
8242
|
+
if (!(backgroundImage.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 5];
|
|
7298
8243
|
image = void 0;
|
|
7299
8244
|
url = backgroundImage.url;
|
|
7300
8245
|
_h.label = 1;
|
|
@@ -7306,14 +8251,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7306
8251
|
return [3 /*break*/, 4];
|
|
7307
8252
|
case 3:
|
|
7308
8253
|
_h.sent();
|
|
7309
|
-
this_1.context.logger.error("Error loading background-image "
|
|
8254
|
+
this_1.context.logger.error("Error loading background-image ".concat(url));
|
|
7310
8255
|
return [3 /*break*/, 4];
|
|
7311
8256
|
case 4:
|
|
7312
8257
|
if (image) {
|
|
8258
|
+
imageWidth = isNaN(image.width) || image.width === 0 ? 1 : image.width;
|
|
8259
|
+
imageHeight = isNaN(image.height) || image.height === 0 ? 1 : image.height;
|
|
7313
8260
|
_c = calculateBackgroundRendering(container, index, [
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
8261
|
+
imageWidth,
|
|
8262
|
+
imageHeight,
|
|
8263
|
+
imageWidth / imageHeight
|
|
7317
8264
|
]), path = _c[0], x = _c[1], y = _c[2], width = _c[3], height = _c[4];
|
|
7318
8265
|
pattern = this_1.ctx.createPattern(this_1.resizeImage(image, width, height), 'repeat');
|
|
7319
8266
|
this_1.renderRepeat(path, pattern, x, y);
|
|
@@ -7438,7 +8385,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7438
8385
|
return __generator(this, function (_a) {
|
|
7439
8386
|
switch (_a.label) {
|
|
7440
8387
|
case 0:
|
|
7441
|
-
this.applyEffects(paint.getEffects(2 /* BACKGROUND_BORDERS */));
|
|
8388
|
+
this.applyEffects(paint.getEffects(2 /* EffectTarget.BACKGROUND_BORDERS */));
|
|
7442
8389
|
styles = paint.container.styles;
|
|
7443
8390
|
hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
|
|
7444
8391
|
borders = [
|
|
@@ -7494,20 +8441,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7494
8441
|
case 3:
|
|
7495
8442
|
if (!(_i < borders_1.length)) return [3 /*break*/, 13];
|
|
7496
8443
|
border = borders_1[_i];
|
|
7497
|
-
if (!(border.style !== 0 /* NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
|
|
7498
|
-
if (!(border.style === 2 /* DASHED */)) return [3 /*break*/, 5];
|
|
7499
|
-
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* DASHED */)];
|
|
8444
|
+
if (!(border.style !== 0 /* BORDER_STYLE.NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
|
|
8445
|
+
if (!(border.style === 2 /* BORDER_STYLE.DASHED */)) return [3 /*break*/, 5];
|
|
8446
|
+
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* BORDER_STYLE.DASHED */)];
|
|
7500
8447
|
case 4:
|
|
7501
8448
|
_a.sent();
|
|
7502
8449
|
return [3 /*break*/, 11];
|
|
7503
8450
|
case 5:
|
|
7504
|
-
if (!(border.style === 3 /* DOTTED */)) return [3 /*break*/, 7];
|
|
7505
|
-
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* DOTTED */)];
|
|
8451
|
+
if (!(border.style === 3 /* BORDER_STYLE.DOTTED */)) return [3 /*break*/, 7];
|
|
8452
|
+
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* BORDER_STYLE.DOTTED */)];
|
|
7506
8453
|
case 6:
|
|
7507
8454
|
_a.sent();
|
|
7508
8455
|
return [3 /*break*/, 11];
|
|
7509
8456
|
case 7:
|
|
7510
|
-
if (!(border.style === 4 /* DOUBLE */)) return [3 /*break*/, 9];
|
|
8457
|
+
if (!(border.style === 4 /* BORDER_STYLE.DOUBLE */)) return [3 /*break*/, 9];
|
|
7511
8458
|
return [4 /*yield*/, this.renderDoubleBorder(border.color, border.width, side, paint.curves)];
|
|
7512
8459
|
case 8:
|
|
7513
8460
|
_a.sent();
|
|
@@ -7534,7 +8481,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7534
8481
|
this.ctx.save();
|
|
7535
8482
|
strokePaths = parsePathForBorderStroke(curvePoints, side);
|
|
7536
8483
|
boxPaths = parsePathForBorder(curvePoints, side);
|
|
7537
|
-
if (style === 2 /* DASHED */) {
|
|
8484
|
+
if (style === 2 /* BORDER_STYLE.DASHED */) {
|
|
7538
8485
|
this.path(boxPaths);
|
|
7539
8486
|
this.ctx.clip();
|
|
7540
8487
|
}
|
|
@@ -7561,7 +8508,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7561
8508
|
length = Math.abs(startY - endY);
|
|
7562
8509
|
}
|
|
7563
8510
|
this.ctx.beginPath();
|
|
7564
|
-
if (style === 3 /* DOTTED */) {
|
|
8511
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7565
8512
|
this.formatPath(strokePaths);
|
|
7566
8513
|
}
|
|
7567
8514
|
else {
|
|
@@ -7569,7 +8516,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7569
8516
|
}
|
|
7570
8517
|
dashLength = width < 3 ? width * 3 : width * 2;
|
|
7571
8518
|
spaceLength = width < 3 ? width * 2 : width;
|
|
7572
|
-
if (style === 3 /* DOTTED */) {
|
|
8519
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7573
8520
|
dashLength = width;
|
|
7574
8521
|
spaceLength = width;
|
|
7575
8522
|
}
|
|
@@ -7592,14 +8539,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7592
8539
|
: maxSpace;
|
|
7593
8540
|
}
|
|
7594
8541
|
if (useLineDash) {
|
|
7595
|
-
if (style === 3 /* DOTTED */) {
|
|
8542
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7596
8543
|
this.ctx.setLineDash([0, dashLength + spaceLength]);
|
|
7597
8544
|
}
|
|
7598
8545
|
else {
|
|
7599
8546
|
this.ctx.setLineDash([dashLength, spaceLength]);
|
|
7600
8547
|
}
|
|
7601
8548
|
}
|
|
7602
|
-
if (style === 3 /* DOTTED */) {
|
|
8549
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7603
8550
|
this.ctx.lineCap = 'round';
|
|
7604
8551
|
this.ctx.lineWidth = width;
|
|
7605
8552
|
}
|
|
@@ -7610,7 +8557,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7610
8557
|
this.ctx.stroke();
|
|
7611
8558
|
this.ctx.setLineDash([]);
|
|
7612
8559
|
// dashed round edge gap
|
|
7613
|
-
if (style === 2 /* DASHED */) {
|
|
8560
|
+
if (style === 2 /* BORDER_STYLE.DASHED */) {
|
|
7614
8561
|
if (isBezierCurve(boxPaths[0])) {
|
|
7615
8562
|
path1 = boxPaths[3];
|
|
7616
8563
|
path2 = boxPaths[0];
|
|
@@ -7667,22 +8614,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7667
8614
|
};
|
|
7668
8615
|
var calculateBackgroundCurvedPaintingArea = function (clip, curves) {
|
|
7669
8616
|
switch (clip) {
|
|
7670
|
-
case 0 /* BORDER_BOX */:
|
|
8617
|
+
case 0 /* BACKGROUND_CLIP.BORDER_BOX */:
|
|
7671
8618
|
return calculateBorderBoxPath(curves);
|
|
7672
|
-
case 2 /* CONTENT_BOX */:
|
|
8619
|
+
case 2 /* BACKGROUND_CLIP.CONTENT_BOX */:
|
|
7673
8620
|
return calculateContentBoxPath(curves);
|
|
7674
|
-
case 1 /* PADDING_BOX */:
|
|
8621
|
+
case 1 /* BACKGROUND_CLIP.PADDING_BOX */:
|
|
7675
8622
|
default:
|
|
7676
8623
|
return calculatePaddingBoxPath(curves);
|
|
7677
8624
|
}
|
|
7678
8625
|
};
|
|
7679
8626
|
var canvasTextAlign = function (textAlign) {
|
|
7680
8627
|
switch (textAlign) {
|
|
7681
|
-
case 1 /* CENTER */:
|
|
8628
|
+
case 1 /* TEXT_ALIGN.CENTER */:
|
|
7682
8629
|
return 'center';
|
|
7683
|
-
case 2 /* RIGHT */:
|
|
8630
|
+
case 2 /* TEXT_ALIGN.RIGHT */:
|
|
7684
8631
|
return 'right';
|
|
7685
|
-
case 0 /* LEFT */:
|
|
8632
|
+
case 0 /* TEXT_ALIGN.LEFT */:
|
|
7686
8633
|
default:
|
|
7687
8634
|
return 'left';
|
|
7688
8635
|
}
|
|
@@ -7704,11 +8651,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7704
8651
|
_this.options = options;
|
|
7705
8652
|
_this.canvas.width = Math.floor(options.width * options.scale);
|
|
7706
8653
|
_this.canvas.height = Math.floor(options.height * options.scale);
|
|
7707
|
-
_this.canvas.style.width = options.width
|
|
7708
|
-
_this.canvas.style.height = options.height
|
|
8654
|
+
_this.canvas.style.width = "".concat(options.width, "px");
|
|
8655
|
+
_this.canvas.style.height = "".concat(options.height, "px");
|
|
7709
8656
|
_this.ctx.scale(_this.options.scale, _this.options.scale);
|
|
7710
8657
|
_this.ctx.translate(-options.x, -options.y);
|
|
7711
|
-
_this.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("
|
|
8658
|
+
_this.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (".concat(options.width, "x").concat(options.height, " at ").concat(options.x, ",").concat(options.y, ") with scale ").concat(options.scale));
|
|
7712
8659
|
return _this;
|
|
7713
8660
|
}
|
|
7714
8661
|
ForeignObjectRenderer.prototype.render = function (element) {
|
|
@@ -7740,7 +8687,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7740
8687
|
resolve(img);
|
|
7741
8688
|
};
|
|
7742
8689
|
img.onerror = reject;
|
|
7743
|
-
img.src = "data:image/svg+xml;charset=utf-8,"
|
|
8690
|
+
img.src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svg)));
|
|
7744
8691
|
});
|
|
7745
8692
|
};
|
|
7746
8693
|
|
|
@@ -7761,7 +8708,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7761
8708
|
// eslint-disable-next-line no-console
|
|
7762
8709
|
if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
|
|
7763
8710
|
// eslint-disable-next-line no-console
|
|
7764
|
-
console.debug.apply(console, __spreadArray([this.id, this.getTime()
|
|
8711
|
+
console.debug.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7765
8712
|
}
|
|
7766
8713
|
else {
|
|
7767
8714
|
this.info.apply(this, args);
|
|
@@ -7781,7 +8728,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7781
8728
|
// eslint-disable-next-line no-console
|
|
7782
8729
|
if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
|
|
7783
8730
|
// eslint-disable-next-line no-console
|
|
7784
|
-
console.info.apply(console, __spreadArray([this.id, this.getTime()
|
|
8731
|
+
console.info.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7785
8732
|
}
|
|
7786
8733
|
}
|
|
7787
8734
|
};
|
|
@@ -7795,7 +8742,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7795
8742
|
// eslint-disable-next-line no-console
|
|
7796
8743
|
if (typeof window !== 'undefined' && window.console && typeof console.warn === 'function') {
|
|
7797
8744
|
// eslint-disable-next-line no-console
|
|
7798
|
-
console.warn.apply(console, __spreadArray([this.id, this.getTime()
|
|
8745
|
+
console.warn.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7799
8746
|
}
|
|
7800
8747
|
else {
|
|
7801
8748
|
this.info.apply(this, args);
|
|
@@ -7812,7 +8759,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7812
8759
|
// eslint-disable-next-line no-console
|
|
7813
8760
|
if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
|
|
7814
8761
|
// eslint-disable-next-line no-console
|
|
7815
|
-
console.error.apply(console, __spreadArray([this.id, this.getTime()
|
|
8762
|
+
console.error.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7816
8763
|
}
|
|
7817
8764
|
else {
|
|
7818
8765
|
this.info.apply(this, args);
|
|
@@ -7827,7 +8774,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7827
8774
|
function Context(options, windowBounds) {
|
|
7828
8775
|
var _a;
|
|
7829
8776
|
this.windowBounds = windowBounds;
|
|
7830
|
-
this.instanceName = "#"
|
|
8777
|
+
this.instanceName = "#".concat(Context.instanceCount++);
|
|
7831
8778
|
this.logger = new Logger({ id: this.instanceName, enabled: options.logging });
|
|
7832
8779
|
this.cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new Cache(this, options);
|
|
7833
8780
|
}
|
|
@@ -7882,7 +8829,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7882
8829
|
inlineImages: foreignObjectRendering,
|
|
7883
8830
|
copyStyles: foreignObjectRendering
|
|
7884
8831
|
};
|
|
7885
|
-
context.logger.debug("Starting document clone with size "
|
|
8832
|
+
context.logger.debug("Starting document clone with size ".concat(windowBounds.width, "x").concat(windowBounds.height, " scrolled to ").concat(-windowBounds.left, ",").concat(-windowBounds.top));
|
|
7886
8833
|
documentCloner = new DocumentCloner(context, element, cloneOptions);
|
|
7887
8834
|
clonedElement = documentCloner.clonedReferenceElement;
|
|
7888
8835
|
if (!clonedElement) {
|
|
@@ -7912,13 +8859,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7912
8859
|
canvas = _u.sent();
|
|
7913
8860
|
return [3 /*break*/, 5];
|
|
7914
8861
|
case 3:
|
|
7915
|
-
context.logger.debug("Document cloned, element located at "
|
|
8862
|
+
context.logger.debug("Document cloned, element located at ".concat(left, ",").concat(top, " with size ").concat(width, "x").concat(height, " using computed rendering"));
|
|
7916
8863
|
context.logger.debug("Starting DOM parsing");
|
|
7917
8864
|
root = parseTree(context, clonedElement);
|
|
7918
8865
|
if (backgroundColor === root.styles.backgroundColor) {
|
|
7919
8866
|
root.styles.backgroundColor = COLORS.TRANSPARENT;
|
|
7920
8867
|
}
|
|
7921
|
-
context.logger.debug("Starting renderer for element at "
|
|
8868
|
+
context.logger.debug("Starting renderer for element at ".concat(renderOptions.x, ",").concat(renderOptions.y, " with size ").concat(renderOptions.width, "x").concat(renderOptions.height));
|
|
7922
8869
|
renderer = new CanvasRenderer(context, renderOptions);
|
|
7923
8870
|
return [4 /*yield*/, renderer.render(root)];
|
|
7924
8871
|
case 4:
|
|
@@ -7960,8 +8907,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7960
8907
|
|
|
7961
8908
|
return html2canvas;
|
|
7962
8909
|
|
|
7963
|
-
}))
|
|
7964
|
-
//# sourceMappingURL=html2canvas.js.map
|
|
8910
|
+
}));
|
|
8911
|
+
//# sourceMappingURL=html2canvas-pro.js.map
|
|
7965
8912
|
});
|
|
7966
8913
|
|
|
7967
8914
|
const feedbackModalCss = ".text-center{flex-grow:1;text-align:center}.feedback-modal-wrapper *{font-family:var(--feedback-font-family)}.feedback-modal-wrapper--custom-font *{font-family:inherit}.feedback-modal-wrapper{position:absolute;z-index:var(--feedback-modal-modal-wrapper-z-index)}.feedback-overlay{background-color:var(--feedback-modal-screenshot-bg-color);height:100%;left:0;opacity:0;position:fixed;top:0;width:100%;z-index:var(--feedback-modal-screnshot-z-index);transition:opacity 0.2s ease-out}.feedback-overlay--visible{opacity:1}.feedback-modal{display:inline-block;position:relative}.feedback-modal-content{background-color:var(--feedback-modal-content-bg-color);border-color:1px solid var(--feedback-modal-header-text-color);border-radius:var(--feedback-modal-content-border-radius);box-shadow:0px 1px 2px 0px rgba(60, 64, 67, .30), 0px 2px 6px 2px rgba(60, 64, 67, .15);box-sizing:border-box;color:var(--feedback-modal-content-text-color);display:flex;flex-direction:column;left:50%;max-width:90%;padding:20px;position:fixed;top:50%;transform:translate(-50%, -50%) scale(0.95);opacity:0;width:100%;z-index:var(--feedback-modal-content-z-index);transition:transform 0.2s ease-out, opacity 0.2s ease-out}.feedback-modal-content--open{transform:translate(-50%, -50%) scale(1);opacity:1}.feedback-modal-header{align-items:center;color:var(--feedback-modal-header-text-color);display:flex;font-size:var(--feedback-header-font-size);font-weight:var(--feedback-modal-header-font-weight);justify-content:space-between;margin-bottom:20px}.feedback-modal-rating-buttons{width:100%;margin-bottom:20px}.feedback-modal-rating-button{padding:0;background-color:transparent;border:transparent;margin-right:5px;cursor:pointer}.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button{border:1px solid var(--feedback-modal-button-border-color);border-radius:var(--feedback-modal-button-border-radius);color:var(--feedback-modal-button-text-color);font-size:var(--feedback-modal-button-font-size);font-weight:500;margin-right:10px;justify-content:center;padding:5px 10px}.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button:hover,.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button--selected{background-color:var(--feedback-modal-button-bg-color-active);border:1px solid var(--feedback-modal-button-border-color-active);color:var(--feedback-modal-button-text-color-active)}.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button:hover svg,.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button--selected svg{stroke:var(--feedback-modal-rating-button-selected-color)}.feedback-modal-rating-buttons svg{stroke:var(--feedback-modal-rating-button-color);cursor:pointer}.feedback-modal-rating-buttons--stars .feedback-modal-rating-button--selected svg{fill:var(--feedback-modal-rating-button-stars-selected-color);stroke:var(--feedback-modal-rating-button-stars-selected-color)}.feedback-modal-text textarea{background-color:var(--feedback-modal-input-bg-color);border:1px solid var(--feedback-modal-input-border-color);border-radius:var(--feedback-modal-input-border-radius);box-sizing:border-box;color:var(--feedback-modal-input-text-color);font-size:var(--feedback-modal-input-font-size);margin-bottom:20px;height:100px;min-height:100px;padding:10px;resize:vertical;width:100%}.feedback-modal-email input{background-color:var(--feedback-modal-input-bg-color);border:1px solid var(--feedback-modal-input-border-color);border-radius:var(--feedback-modal-input-border-radius);box-sizing:border-box;color:var(--feedback-modal-input-text-color);font-size:var(--feedback-modal-input-font-size);margin-bottom:20px;height:40px;padding:10px;width:100%;margin-bottom:20px}.feedback-modal-privacy{font-size:var(--feedback-modal-input-font-size);margin-bottom:20px}.feedback-modal-text textarea:focus,.feedback-modal-email input:focus{border:1px solid var(--feedback-modal-input-border-color-focused);outline:none}.feedback-modal-buttons{display:flex;flex-direction:column}.feedback-modal-buttons .feedback-modal-button{margin-bottom:20px}.feedback-modal-button{align-items:center;background-color:transparent;border:1px solid var(--feedback-modal-button-border-color);border-radius:var(--feedback-modal-button-border-radius);color:var(--feedback-modal-button-text-color);cursor:pointer;display:flex;font-size:var(--feedback-modal-button-font-size);font-weight:500;justify-content:center;min-height:40px;padding:5px 10px}.feedback-modal-button svg{margin-right:6px}.feedback-modal-button path{fill:var(--feedback-modal-button-icon-color)}.feedback-modal-button:hover path,.feedback-modal-button--active path{fill:var(--feedback-modal-button-icon-color-active)}.feedback-modal-button--submit{background-color:var(--feedback-modal-button-submit-bg-color);border:1px solid var(--feedback-modal-button-border-color-active);color:var(--feedback-modal-button-submit-text-color)}.feedback-modal-button:hover,.feedback-modal-button--active{background-color:var(--feedback-modal-button-bg-color-active);border:1px solid var(--feedback-modal-button-border-color-active);color:var(--feedback-modal-button-text-color-active)}.feedback-modal-button--submit:hover{background-color:var(--feedback-modal-button-submit-bg-color-hover);border:1px solid var(--feedback-modal-button-submit-border-color-hover);color:var(--feedback-modal-button-submit-text-color-hover)}.feedback-modal-input-heading{display:block;font-size:14px;font-weight:300;padding-bottom:10px}.feedback-modal-footer{font-size:12px;text-align:center}.feedback-modal-footer a{color:var(--feedback-modal-footer-link);font-weight:500;text-decoration:none}.feedback-logo{align-items:center;display:flex;justify-content:center;margin-top:5px}.feedback-logo a{margin-left:3px}.feedback-modal-close{background-color:var(--feedback-modal-close-bg-color);border:0;border-radius:50%;cursor:pointer;height:22px;margin-left:auto;padding:0;width:22px}.feedback-modal-close svg{stroke:var(--feedback-modal-close-color)}.feedback-modal-screenshot{background-color:var(--feedback-modal-screenshot-bg-color);height:100%;left:0;position:fixed;top:0;width:100%;z-index:var(--feedback-modal-screnshot-z-index)}.feedback-modal-screenshot-header{align-items:center;background-color:var(--feedback-modal-screenshot-header-bg-color);border-radius:var(--feedback-modal-content-border-radius);box-shadow:0px 1px 2px 0px rgba(60, 64, 67, .30), 0px 2px 6px 2px rgba(60, 64, 67, .15);box-sizing:border-box;color:var(--feedback-modal-screenshot-header-text-color);cursor:pointer;display:flex;left:50%;top:20px;transform:translateX(-50%);padding:10px;position:fixed;width:max-content;z-index:var(--feedback-modal-screenshot-header-z-index)}.feedback-modal-screenshot-close{height:24px;padding-left:10px;width:24px}.feedback-modal-screenshot-close svg{stroke:var(--feedback-modal-close-color)}.feedback-modal-message{font-size:var(--feedback-modal-message-font-size);margin-top:0}.feedback-modal-element-hover{background-color:transparent;cursor:pointer;border:1px solid var(--feedback-modal-element-hover-border-color)}.feedback-modal-element-selected{background-color:transparent;border:1px solid var(--feedback-modal-element-selected-border-color)}@media screen and (min-width: 768px){.feedback-modal-content{max-width:var(--feedback-modal-content-max-width)}.feedback-modal-content.feedback-modal-content--bottom-right{bottom:var(--feedback-modal-content-position-bottom);left:initial;right:var(--feedback-modal-content-position-right);top:initial;transform:initial}.feedback-modal-content.feedback-modal-content--bottom-left{bottom:var(--feedback-modal-content-position-bottom);left:var(--feedback-modal-content-position-left);top:initial;transform:initial}.feedback-modal-content.feedback-modal-content--top-right{right:var(--feedback-modal-content-position-right);top:var(--feedback-modal-content-position-top);transform:initial}.feedback-modal-content.feedback-modal-content--top-left{left:var(--feedback-modal-content-position-left);top:var(--feedback-modal-content-position-top);transform:initial}.feedback-modal-content.feedback-modal-content--center-left{left:5px;right:auto;top:50%;transform:translateY(-50%)}.feedback-modal-content.feedback-modal-content--center-right{left:auto;right:5px;top:50%;transform:translateY(-50%)}.feedback-modal-content.feedback-modal-content--sidebar-left.feedback-modal-content--open,.feedback-modal-content.feedback-modal-content--sidebar-right.feedback-modal-content--open{transform:translateX(0)}.feedback-modal-content.feedback-modal-content--sidebar-left{max-width:var(--feedback-modal-content-sidebar-max-width);left:0;right:auto;height:100vh;top:0;transform:translateX(-100%);transition:transform 0.5s ease-in-out;border-radius:0}.feedback-modal-content.feedback-modal-content--sidebar-right{max-width:var(--feedback-modal-content-sidebar-max-width);left:auto;right:0;height:100vh;top:0;transform:translateX(100%);transition:transform 0.5s ease-in-out;border-radius:0}.feedback-modal-text textarea{height:150px;min-height:150px}.feedback-modal-content.feedback-modal-content--bottom-right{transform:translateY(20px)}.feedback-modal-content.feedback-modal-content--bottom-right.feedback-modal-content--open{transform:translateY(0)}.feedback-modal-content.feedback-modal-content--bottom-left{transform:translateY(20px)}.feedback-modal-content.feedback-modal-content--bottom-left.feedback-modal-content--open{transform:translateY(0)}.feedback-modal-content.feedback-modal-content--top-right{transform:translateY(-20px)}.feedback-modal-content.feedback-modal-content--top-right.feedback-modal-content--open{transform:translateY(0)}.feedback-modal-content.feedback-modal-content--top-left{transform:translateY(-20px)}.feedback-modal-content.feedback-modal-content--top-left.feedback-modal-content--open{transform:translateY(0)}}";
|
|
@@ -8244,7 +9191,7 @@ const FeedbackModal = class {
|
|
|
8244
9191
|
captureScreenshot() {
|
|
8245
9192
|
return new Promise((resolve, reject) => {
|
|
8246
9193
|
requestAnimationFrame(() => {
|
|
8247
|
-
|
|
9194
|
+
html2canvasPro(document.body, {
|
|
8248
9195
|
x: window.scrollX,
|
|
8249
9196
|
y: window.scrollY,
|
|
8250
9197
|
width: window.innerWidth,
|