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
|
@@ -140,15 +140,15 @@ function commonjsRequire () {
|
|
|
140
140
|
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
var
|
|
143
|
+
var html2canvasPro = createCommonjsModule(function (module, exports) {
|
|
144
144
|
/*!
|
|
145
|
-
* html2canvas 1.
|
|
146
|
-
* Copyright (c)
|
|
145
|
+
* html2canvas-pro 1.5.8 <https://yorickshan.github.io/html2canvas-pro/>
|
|
146
|
+
* Copyright (c) 2024 yorickshan <https://github.com/yorickshan>
|
|
147
147
|
* Released under MIT License
|
|
148
148
|
*/
|
|
149
149
|
(function (global, factory) {
|
|
150
150
|
module.exports = factory() ;
|
|
151
|
-
}(commonjsGlobal, (function () {
|
|
151
|
+
})(commonjsGlobal, (function () {
|
|
152
152
|
/*! *****************************************************************************
|
|
153
153
|
Copyright (c) Microsoft Corporation.
|
|
154
154
|
|
|
@@ -1132,38 +1132,38 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1132
1132
|
return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
|
|
1133
1133
|
};
|
|
1134
1134
|
var LEFT_PARENTHESIS_TOKEN = {
|
|
1135
|
-
type: 2 /* LEFT_PARENTHESIS_TOKEN */
|
|
1135
|
+
type: 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */
|
|
1136
1136
|
};
|
|
1137
1137
|
var RIGHT_PARENTHESIS_TOKEN = {
|
|
1138
|
-
type: 3 /* RIGHT_PARENTHESIS_TOKEN */
|
|
1139
|
-
};
|
|
1140
|
-
var COMMA_TOKEN = { type: 4 /* COMMA_TOKEN */ };
|
|
1141
|
-
var SUFFIX_MATCH_TOKEN = { type: 13 /* SUFFIX_MATCH_TOKEN */ };
|
|
1142
|
-
var PREFIX_MATCH_TOKEN = { type: 8 /* PREFIX_MATCH_TOKEN */ };
|
|
1143
|
-
var COLUMN_TOKEN = { type: 21 /* COLUMN_TOKEN */ };
|
|
1144
|
-
var DASH_MATCH_TOKEN = { type: 9 /* DASH_MATCH_TOKEN */ };
|
|
1145
|
-
var INCLUDE_MATCH_TOKEN = { type: 10 /* INCLUDE_MATCH_TOKEN */ };
|
|
1138
|
+
type: 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */
|
|
1139
|
+
};
|
|
1140
|
+
var COMMA_TOKEN = { type: 4 /* TokenType.COMMA_TOKEN */ };
|
|
1141
|
+
var SUFFIX_MATCH_TOKEN = { type: 13 /* TokenType.SUFFIX_MATCH_TOKEN */ };
|
|
1142
|
+
var PREFIX_MATCH_TOKEN = { type: 8 /* TokenType.PREFIX_MATCH_TOKEN */ };
|
|
1143
|
+
var COLUMN_TOKEN = { type: 21 /* TokenType.COLUMN_TOKEN */ };
|
|
1144
|
+
var DASH_MATCH_TOKEN = { type: 9 /* TokenType.DASH_MATCH_TOKEN */ };
|
|
1145
|
+
var INCLUDE_MATCH_TOKEN = { type: 10 /* TokenType.INCLUDE_MATCH_TOKEN */ };
|
|
1146
1146
|
var LEFT_CURLY_BRACKET_TOKEN = {
|
|
1147
|
-
type: 11 /* LEFT_CURLY_BRACKET_TOKEN */
|
|
1147
|
+
type: 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */
|
|
1148
1148
|
};
|
|
1149
1149
|
var RIGHT_CURLY_BRACKET_TOKEN = {
|
|
1150
|
-
type: 12 /* RIGHT_CURLY_BRACKET_TOKEN */
|
|
1151
|
-
};
|
|
1152
|
-
var SUBSTRING_MATCH_TOKEN = { type: 14 /* SUBSTRING_MATCH_TOKEN */ };
|
|
1153
|
-
var BAD_URL_TOKEN = { type: 23 /* BAD_URL_TOKEN */ };
|
|
1154
|
-
var BAD_STRING_TOKEN = { type: 1 /* BAD_STRING_TOKEN */ };
|
|
1155
|
-
var CDO_TOKEN = { type: 25 /* CDO_TOKEN */ };
|
|
1156
|
-
var CDC_TOKEN = { type: 24 /* CDC_TOKEN */ };
|
|
1157
|
-
var COLON_TOKEN = { type: 26 /* COLON_TOKEN */ };
|
|
1158
|
-
var SEMICOLON_TOKEN = { type: 27 /* SEMICOLON_TOKEN */ };
|
|
1150
|
+
type: 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */
|
|
1151
|
+
};
|
|
1152
|
+
var SUBSTRING_MATCH_TOKEN = { type: 14 /* TokenType.SUBSTRING_MATCH_TOKEN */ };
|
|
1153
|
+
var BAD_URL_TOKEN = { type: 23 /* TokenType.BAD_URL_TOKEN */ };
|
|
1154
|
+
var BAD_STRING_TOKEN = { type: 1 /* TokenType.BAD_STRING_TOKEN */ };
|
|
1155
|
+
var CDO_TOKEN = { type: 25 /* TokenType.CDO_TOKEN */ };
|
|
1156
|
+
var CDC_TOKEN = { type: 24 /* TokenType.CDC_TOKEN */ };
|
|
1157
|
+
var COLON_TOKEN = { type: 26 /* TokenType.COLON_TOKEN */ };
|
|
1158
|
+
var SEMICOLON_TOKEN = { type: 27 /* TokenType.SEMICOLON_TOKEN */ };
|
|
1159
1159
|
var LEFT_SQUARE_BRACKET_TOKEN = {
|
|
1160
|
-
type: 28 /* LEFT_SQUARE_BRACKET_TOKEN */
|
|
1160
|
+
type: 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */
|
|
1161
1161
|
};
|
|
1162
1162
|
var RIGHT_SQUARE_BRACKET_TOKEN = {
|
|
1163
|
-
type: 29 /* RIGHT_SQUARE_BRACKET_TOKEN */
|
|
1163
|
+
type: 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */
|
|
1164
1164
|
};
|
|
1165
|
-
var WHITESPACE_TOKEN = { type: 31 /* WHITESPACE_TOKEN */ };
|
|
1166
|
-
var EOF_TOKEN = { type: 32 /* EOF_TOKEN */ };
|
|
1165
|
+
var WHITESPACE_TOKEN = { type: 31 /* TokenType.WHITESPACE_TOKEN */ };
|
|
1166
|
+
var EOF_TOKEN = { type: 32 /* TokenType.EOF_TOKEN */ };
|
|
1167
1167
|
var Tokenizer = /** @class */ (function () {
|
|
1168
1168
|
function Tokenizer() {
|
|
1169
1169
|
this._value = [];
|
|
@@ -1192,7 +1192,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1192
1192
|
if (isNameCodePoint(c1) || isValidEscape(c2, c3)) {
|
|
1193
1193
|
var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED;
|
|
1194
1194
|
var value = this.consumeName();
|
|
1195
|
-
return { type: 5 /* HASH_TOKEN */, value: value, flags: flags };
|
|
1195
|
+
return { type: 5 /* TokenType.HASH_TOKEN */, value: value, flags: flags };
|
|
1196
1196
|
}
|
|
1197
1197
|
break;
|
|
1198
1198
|
case DOLLAR_SIGN:
|
|
@@ -1281,7 +1281,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1281
1281
|
var a3 = this.peekCodePoint(2);
|
|
1282
1282
|
if (isIdentifierStart(a1, a2, a3)) {
|
|
1283
1283
|
var value = this.consumeName();
|
|
1284
|
-
return { type: 7 /* AT_KEYWORD_TOKEN */, value: value };
|
|
1284
|
+
return { type: 7 /* TokenType.AT_KEYWORD_TOKEN */, value: value };
|
|
1285
1285
|
}
|
|
1286
1286
|
break;
|
|
1287
1287
|
case LEFT_SQUARE_BRACKET:
|
|
@@ -1345,7 +1345,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1345
1345
|
this.reconsumeCodePoint(codePoint);
|
|
1346
1346
|
return this.consumeIdentLikeToken();
|
|
1347
1347
|
}
|
|
1348
|
-
return { type: 6 /* DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
|
|
1348
|
+
return { type: 6 /* TokenType.DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
|
|
1349
1349
|
};
|
|
1350
1350
|
Tokenizer.prototype.consumeCodePoint = function () {
|
|
1351
1351
|
var value = this._value.shift();
|
|
@@ -1376,7 +1376,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1376
1376
|
if (questionMarks) {
|
|
1377
1377
|
var start_1 = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16);
|
|
1378
1378
|
var end = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16);
|
|
1379
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start_1, end: end };
|
|
1379
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start_1, end: end };
|
|
1380
1380
|
}
|
|
1381
1381
|
var start = parseInt(fromCodePoint$1.apply(void 0, digits), 16);
|
|
1382
1382
|
if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) {
|
|
@@ -1388,10 +1388,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1388
1388
|
codePoint = this.consumeCodePoint();
|
|
1389
1389
|
}
|
|
1390
1390
|
var end = parseInt(fromCodePoint$1.apply(void 0, endDigits), 16);
|
|
1391
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: end };
|
|
1391
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: end };
|
|
1392
1392
|
}
|
|
1393
1393
|
else {
|
|
1394
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: start };
|
|
1394
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: start };
|
|
1395
1395
|
}
|
|
1396
1396
|
};
|
|
1397
1397
|
Tokenizer.prototype.consumeIdentLikeToken = function () {
|
|
@@ -1402,24 +1402,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1402
1402
|
}
|
|
1403
1403
|
else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) {
|
|
1404
1404
|
this.consumeCodePoint();
|
|
1405
|
-
return { type: 19 /* FUNCTION_TOKEN */, value: value };
|
|
1405
|
+
return { type: 19 /* TokenType.FUNCTION_TOKEN */, value: value };
|
|
1406
1406
|
}
|
|
1407
|
-
return { type: 20 /* IDENT_TOKEN */, value: value };
|
|
1407
|
+
return { type: 20 /* TokenType.IDENT_TOKEN */, value: value };
|
|
1408
1408
|
};
|
|
1409
1409
|
Tokenizer.prototype.consumeUrlToken = function () {
|
|
1410
1410
|
var value = [];
|
|
1411
1411
|
this.consumeWhiteSpace();
|
|
1412
1412
|
if (this.peekCodePoint(0) === EOF) {
|
|
1413
|
-
return { type: 22 /* URL_TOKEN */, value: '' };
|
|
1413
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: '' };
|
|
1414
1414
|
}
|
|
1415
1415
|
var next = this.peekCodePoint(0);
|
|
1416
1416
|
if (next === APOSTROPHE || next === QUOTATION_MARK) {
|
|
1417
1417
|
var stringToken = this.consumeStringToken(this.consumeCodePoint());
|
|
1418
|
-
if (stringToken.type === 0 /* STRING_TOKEN */) {
|
|
1418
|
+
if (stringToken.type === 0 /* TokenType.STRING_TOKEN */) {
|
|
1419
1419
|
this.consumeWhiteSpace();
|
|
1420
1420
|
if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
|
|
1421
1421
|
this.consumeCodePoint();
|
|
1422
|
-
return { type: 22 /* URL_TOKEN */, value: stringToken.value };
|
|
1422
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: stringToken.value };
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
1425
|
this.consumeBadUrlRemnants();
|
|
@@ -1428,13 +1428,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1428
1428
|
while (true) {
|
|
1429
1429
|
var codePoint = this.consumeCodePoint();
|
|
1430
1430
|
if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
|
|
1431
|
-
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1431
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1432
1432
|
}
|
|
1433
1433
|
else if (isWhiteSpace(codePoint)) {
|
|
1434
1434
|
this.consumeWhiteSpace();
|
|
1435
1435
|
if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
|
|
1436
1436
|
this.consumeCodePoint();
|
|
1437
|
-
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1437
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1438
1438
|
}
|
|
1439
1439
|
this.consumeBadUrlRemnants();
|
|
1440
1440
|
return BAD_URL_TOKEN;
|
|
@@ -1494,7 +1494,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1494
1494
|
var codePoint = this._value[i];
|
|
1495
1495
|
if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) {
|
|
1496
1496
|
value += this.consumeStringSlice(i);
|
|
1497
|
-
return { type: 0 /* STRING_TOKEN */, value: value };
|
|
1497
|
+
return { type: 0 /* TokenType.STRING_TOKEN */, value: value };
|
|
1498
1498
|
}
|
|
1499
1499
|
if (codePoint === LINE_FEED) {
|
|
1500
1500
|
this._value.splice(0, i);
|
|
@@ -1556,13 +1556,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1556
1556
|
var c3 = this.peekCodePoint(2);
|
|
1557
1557
|
if (isIdentifierStart(c1, c2, c3)) {
|
|
1558
1558
|
var unit = this.consumeName();
|
|
1559
|
-
return { type: 15 /* DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
|
|
1559
|
+
return { type: 15 /* TokenType.DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
|
|
1560
1560
|
}
|
|
1561
1561
|
if (c1 === PERCENTAGE_SIGN) {
|
|
1562
1562
|
this.consumeCodePoint();
|
|
1563
|
-
return { type: 16 /* PERCENTAGE_TOKEN */, number: number, flags: flags };
|
|
1563
|
+
return { type: 16 /* TokenType.PERCENTAGE_TOKEN */, number: number, flags: flags };
|
|
1564
1564
|
}
|
|
1565
|
-
return { type: 17 /* NUMBER_TOKEN */, number: number, flags: flags };
|
|
1565
|
+
return { type: 17 /* TokenType.NUMBER_TOKEN */, number: number, flags: flags };
|
|
1566
1566
|
};
|
|
1567
1567
|
Tokenizer.prototype.consumeEscapedCodePoint = function () {
|
|
1568
1568
|
var codePoint = this.consumeCodePoint();
|
|
@@ -1621,18 +1621,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1621
1621
|
};
|
|
1622
1622
|
Parser.prototype.parseComponentValue = function () {
|
|
1623
1623
|
var token = this.consumeToken();
|
|
1624
|
-
while (token.type === 31 /* WHITESPACE_TOKEN */) {
|
|
1624
|
+
while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */) {
|
|
1625
1625
|
token = this.consumeToken();
|
|
1626
1626
|
}
|
|
1627
|
-
if (token.type === 32 /* EOF_TOKEN */) {
|
|
1627
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1628
1628
|
throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
|
|
1629
1629
|
}
|
|
1630
1630
|
this.reconsumeToken(token);
|
|
1631
1631
|
var value = this.consumeComponentValue();
|
|
1632
1632
|
do {
|
|
1633
1633
|
token = this.consumeToken();
|
|
1634
|
-
} while (token.type === 31 /* WHITESPACE_TOKEN */);
|
|
1635
|
-
if (token.type === 32 /* EOF_TOKEN */) {
|
|
1634
|
+
} while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */);
|
|
1635
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1636
1636
|
return value;
|
|
1637
1637
|
}
|
|
1638
1638
|
throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
|
|
@@ -1641,7 +1641,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1641
1641
|
var values = [];
|
|
1642
1642
|
while (true) {
|
|
1643
1643
|
var value = this.consumeComponentValue();
|
|
1644
|
-
if (value.type === 32 /* EOF_TOKEN */) {
|
|
1644
|
+
if (value.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1645
1645
|
return values;
|
|
1646
1646
|
}
|
|
1647
1647
|
values.push(value);
|
|
@@ -1651,11 +1651,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1651
1651
|
Parser.prototype.consumeComponentValue = function () {
|
|
1652
1652
|
var token = this.consumeToken();
|
|
1653
1653
|
switch (token.type) {
|
|
1654
|
-
case 11 /* LEFT_CURLY_BRACKET_TOKEN */:
|
|
1655
|
-
case 28 /* LEFT_SQUARE_BRACKET_TOKEN */:
|
|
1656
|
-
case 2 /* LEFT_PARENTHESIS_TOKEN */:
|
|
1654
|
+
case 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */:
|
|
1655
|
+
case 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */:
|
|
1656
|
+
case 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */:
|
|
1657
1657
|
return this.consumeSimpleBlock(token.type);
|
|
1658
|
-
case 19 /* FUNCTION_TOKEN */:
|
|
1658
|
+
case 19 /* TokenType.FUNCTION_TOKEN */:
|
|
1659
1659
|
return this.consumeFunction(token);
|
|
1660
1660
|
}
|
|
1661
1661
|
return token;
|
|
@@ -1664,7 +1664,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1664
1664
|
var block = { type: type, values: [] };
|
|
1665
1665
|
var token = this.consumeToken();
|
|
1666
1666
|
while (true) {
|
|
1667
|
-
if (token.type === 32 /* EOF_TOKEN */ || isEndingTokenFor(token, type)) {
|
|
1667
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */ || isEndingTokenFor(token, type)) {
|
|
1668
1668
|
return block;
|
|
1669
1669
|
}
|
|
1670
1670
|
this.reconsumeToken(token);
|
|
@@ -1676,11 +1676,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1676
1676
|
var cssFunction = {
|
|
1677
1677
|
name: functionToken.value,
|
|
1678
1678
|
values: [],
|
|
1679
|
-
type: 18 /* FUNCTION */
|
|
1679
|
+
type: 18 /* TokenType.FUNCTION */
|
|
1680
1680
|
};
|
|
1681
1681
|
while (true) {
|
|
1682
1682
|
var token = this.consumeToken();
|
|
1683
|
-
if (token.type === 32 /* EOF_TOKEN */ || token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */) {
|
|
1683
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */ || token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */) {
|
|
1684
1684
|
return cssFunction;
|
|
1685
1685
|
}
|
|
1686
1686
|
this.reconsumeToken(token);
|
|
@@ -1696,22 +1696,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1696
1696
|
};
|
|
1697
1697
|
return Parser;
|
|
1698
1698
|
}());
|
|
1699
|
-
var isDimensionToken = function (token) { return token.type === 15 /* DIMENSION_TOKEN */; };
|
|
1700
|
-
var isNumberToken = function (token) { return token.type === 17 /* NUMBER_TOKEN */; };
|
|
1701
|
-
var isIdentToken = function (token) { return token.type === 20 /* IDENT_TOKEN */; };
|
|
1702
|
-
var isStringToken = function (token) { return token.type === 0 /* STRING_TOKEN */; };
|
|
1699
|
+
var isDimensionToken = function (token) { return token.type === 15 /* TokenType.DIMENSION_TOKEN */; };
|
|
1700
|
+
var isNumberToken = function (token) { return token.type === 17 /* TokenType.NUMBER_TOKEN */; };
|
|
1701
|
+
var isIdentToken = function (token) { return token.type === 20 /* TokenType.IDENT_TOKEN */; };
|
|
1702
|
+
var isStringToken = function (token) { return token.type === 0 /* TokenType.STRING_TOKEN */; };
|
|
1703
1703
|
var isIdentWithValue = function (token, value) {
|
|
1704
1704
|
return isIdentToken(token) && token.value === value;
|
|
1705
1705
|
};
|
|
1706
|
-
var nonWhiteSpace = function (token) { return token.type !== 31 /* WHITESPACE_TOKEN */; };
|
|
1706
|
+
var nonWhiteSpace = function (token) { return token.type !== 31 /* TokenType.WHITESPACE_TOKEN */; };
|
|
1707
1707
|
var nonFunctionArgSeparator = function (token) {
|
|
1708
|
-
return token.type !== 31 /* WHITESPACE_TOKEN */ && token.type !== 4 /* COMMA_TOKEN */;
|
|
1708
|
+
return token.type !== 31 /* TokenType.WHITESPACE_TOKEN */ && token.type !== 4 /* TokenType.COMMA_TOKEN */;
|
|
1709
1709
|
};
|
|
1710
1710
|
var parseFunctionArgs = function (tokens) {
|
|
1711
1711
|
var args = [];
|
|
1712
1712
|
var arg = [];
|
|
1713
1713
|
tokens.forEach(function (token) {
|
|
1714
|
-
if (token.type === 4 /* COMMA_TOKEN */) {
|
|
1714
|
+
if (token.type === 4 /* TokenType.COMMA_TOKEN */) {
|
|
1715
1715
|
if (arg.length === 0) {
|
|
1716
1716
|
throw new Error("Error parsing function args, zero tokens for arg");
|
|
1717
1717
|
}
|
|
@@ -1719,7 +1719,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1719
1719
|
arg = [];
|
|
1720
1720
|
return;
|
|
1721
1721
|
}
|
|
1722
|
-
if (token.type !== 31 /* WHITESPACE_TOKEN */) {
|
|
1722
|
+
if (token.type !== 31 /* TokenType.WHITESPACE_TOKEN */) {
|
|
1723
1723
|
arg.push(token);
|
|
1724
1724
|
}
|
|
1725
1725
|
});
|
|
@@ -1729,37 +1729,37 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1729
1729
|
return args;
|
|
1730
1730
|
};
|
|
1731
1731
|
var isEndingTokenFor = function (token, type) {
|
|
1732
|
-
if (type === 11 /* LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* RIGHT_CURLY_BRACKET_TOKEN */) {
|
|
1732
|
+
if (type === 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */) {
|
|
1733
1733
|
return true;
|
|
1734
1734
|
}
|
|
1735
|
-
if (type === 28 /* LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* RIGHT_SQUARE_BRACKET_TOKEN */) {
|
|
1735
|
+
if (type === 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */) {
|
|
1736
1736
|
return true;
|
|
1737
1737
|
}
|
|
1738
|
-
return type === 2 /* LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */;
|
|
1738
|
+
return type === 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */;
|
|
1739
1739
|
};
|
|
1740
1740
|
|
|
1741
1741
|
var isLength = function (token) {
|
|
1742
|
-
return token.type === 17 /* NUMBER_TOKEN */ || token.type === 15 /* DIMENSION_TOKEN */;
|
|
1742
|
+
return token.type === 17 /* TokenType.NUMBER_TOKEN */ || token.type === 15 /* TokenType.DIMENSION_TOKEN */;
|
|
1743
1743
|
};
|
|
1744
1744
|
|
|
1745
1745
|
var isLengthPercentage = function (token) {
|
|
1746
|
-
return token.type === 16 /* PERCENTAGE_TOKEN */ || isLength(token);
|
|
1746
|
+
return token.type === 16 /* TokenType.PERCENTAGE_TOKEN */ || isLength(token);
|
|
1747
1747
|
};
|
|
1748
1748
|
var parseLengthPercentageTuple = function (tokens) {
|
|
1749
1749
|
return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]];
|
|
1750
1750
|
};
|
|
1751
1751
|
var ZERO_LENGTH = {
|
|
1752
|
-
type: 17 /* NUMBER_TOKEN */,
|
|
1752
|
+
type: 17 /* TokenType.NUMBER_TOKEN */,
|
|
1753
1753
|
number: 0,
|
|
1754
1754
|
flags: FLAG_INTEGER
|
|
1755
1755
|
};
|
|
1756
1756
|
var FIFTY_PERCENT = {
|
|
1757
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
1757
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
1758
1758
|
number: 50,
|
|
1759
1759
|
flags: FLAG_INTEGER
|
|
1760
1760
|
};
|
|
1761
1761
|
var HUNDRED_PERCENT = {
|
|
1762
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
1762
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
1763
1763
|
number: 100,
|
|
1764
1764
|
flags: FLAG_INTEGER
|
|
1765
1765
|
};
|
|
@@ -1768,7 +1768,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1768
1768
|
return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)];
|
|
1769
1769
|
};
|
|
1770
1770
|
var getAbsoluteValue = function (token, parent) {
|
|
1771
|
-
if (token.type === 16 /* PERCENTAGE_TOKEN */) {
|
|
1771
|
+
if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
1772
1772
|
return (token.number / 100) * parent;
|
|
1773
1773
|
}
|
|
1774
1774
|
if (isDimensionToken(token)) {
|
|
@@ -1791,7 +1791,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1791
1791
|
var angle = {
|
|
1792
1792
|
name: 'angle',
|
|
1793
1793
|
parse: function (_context, value) {
|
|
1794
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
1794
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
1795
1795
|
switch (value.unit) {
|
|
1796
1796
|
case DEG:
|
|
1797
1797
|
return (Math.PI * value.number) / 180;
|
|
@@ -1807,7 +1807,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1807
1807
|
}
|
|
1808
1808
|
};
|
|
1809
1809
|
var isAngle = function (value) {
|
|
1810
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
1810
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
1811
1811
|
if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) {
|
|
1812
1812
|
return true;
|
|
1813
1813
|
}
|
|
@@ -1857,87 +1857,154 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1857
1857
|
};
|
|
1858
1858
|
var deg = function (deg) { return (Math.PI * deg) / 180; };
|
|
1859
1859
|
|
|
1860
|
-
var color$1 = {
|
|
1861
|
-
name: 'color',
|
|
1862
|
-
parse: function (context, value) {
|
|
1863
|
-
if (value.type === 18 /* FUNCTION */) {
|
|
1864
|
-
var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
|
|
1865
|
-
if (typeof colorFunction === 'undefined') {
|
|
1866
|
-
throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\"");
|
|
1867
|
-
}
|
|
1868
|
-
return colorFunction(context, value.values);
|
|
1869
|
-
}
|
|
1870
|
-
if (value.type === 5 /* HASH_TOKEN */) {
|
|
1871
|
-
if (value.value.length === 3) {
|
|
1872
|
-
var r = value.value.substring(0, 1);
|
|
1873
|
-
var g = value.value.substring(1, 2);
|
|
1874
|
-
var b = value.value.substring(2, 3);
|
|
1875
|
-
return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1);
|
|
1876
|
-
}
|
|
1877
|
-
if (value.value.length === 4) {
|
|
1878
|
-
var r = value.value.substring(0, 1);
|
|
1879
|
-
var g = value.value.substring(1, 2);
|
|
1880
|
-
var b = value.value.substring(2, 3);
|
|
1881
|
-
var a = value.value.substring(3, 4);
|
|
1882
|
-
return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255);
|
|
1883
|
-
}
|
|
1884
|
-
if (value.value.length === 6) {
|
|
1885
|
-
var r = value.value.substring(0, 2);
|
|
1886
|
-
var g = value.value.substring(2, 4);
|
|
1887
|
-
var b = value.value.substring(4, 6);
|
|
1888
|
-
return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1);
|
|
1889
|
-
}
|
|
1890
|
-
if (value.value.length === 8) {
|
|
1891
|
-
var r = value.value.substring(0, 2);
|
|
1892
|
-
var g = value.value.substring(2, 4);
|
|
1893
|
-
var b = value.value.substring(4, 6);
|
|
1894
|
-
var a = value.value.substring(6, 8);
|
|
1895
|
-
return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255);
|
|
1896
|
-
}
|
|
1897
|
-
}
|
|
1898
|
-
if (value.type === 20 /* IDENT_TOKEN */) {
|
|
1899
|
-
var namedColor = COLORS[value.value.toUpperCase()];
|
|
1900
|
-
if (typeof namedColor !== 'undefined') {
|
|
1901
|
-
return namedColor;
|
|
1902
|
-
}
|
|
1903
|
-
}
|
|
1904
|
-
return COLORS.TRANSPARENT;
|
|
1905
|
-
}
|
|
1906
|
-
};
|
|
1907
1860
|
var isTransparent = function (color) { return (0xff & color) === 0; };
|
|
1908
1861
|
var asString = function (color) {
|
|
1909
1862
|
var alpha = 0xff & color;
|
|
1910
1863
|
var blue = 0xff & (color >> 8);
|
|
1911
1864
|
var green = 0xff & (color >> 16);
|
|
1912
1865
|
var red = 0xff & (color >> 24);
|
|
1913
|
-
return alpha < 255 ? "rgba("
|
|
1866
|
+
return alpha < 255 ? "rgba(".concat(red, ",").concat(green, ",").concat(blue, ",").concat(alpha / 255, ")") : "rgb(".concat(red, ",").concat(green, ",").concat(blue, ")");
|
|
1914
1867
|
};
|
|
1915
1868
|
var pack = function (r, g, b, a) {
|
|
1916
1869
|
return ((r << 24) | (g << 16) | (b << 8) | (Math.round(a * 255) << 0)) >>> 0;
|
|
1917
1870
|
};
|
|
1918
1871
|
var getTokenColorValue = function (token, i) {
|
|
1919
|
-
if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
1872
|
+
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
1920
1873
|
return token.number;
|
|
1921
1874
|
}
|
|
1922
|
-
if (token.type === 16 /* PERCENTAGE_TOKEN */) {
|
|
1875
|
+
if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
1923
1876
|
var max = i === 3 ? 1 : 255;
|
|
1924
1877
|
return i === 3 ? (token.number / 100) * max : Math.round((token.number / 100) * max);
|
|
1925
1878
|
}
|
|
1926
1879
|
return 0;
|
|
1927
1880
|
};
|
|
1928
|
-
var
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1881
|
+
var isRelativeTransform = function (tokens) {
|
|
1882
|
+
return (tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ ? tokens[0].value : 'unknown') === 'from';
|
|
1883
|
+
};
|
|
1884
|
+
var clamp = function (value, min, max) {
|
|
1885
|
+
return Math.min(Math.max(value, min), max);
|
|
1886
|
+
};
|
|
1887
|
+
var multiplyMatrices = function (A, B) {
|
|
1888
|
+
return [
|
|
1889
|
+
A[0] * B[0] + A[1] * B[1] + A[2] * B[2],
|
|
1890
|
+
A[3] * B[0] + A[4] * B[1] + A[5] * B[2],
|
|
1891
|
+
A[6] * B[0] + A[7] * B[1] + A[8] * B[2]
|
|
1892
|
+
];
|
|
1893
|
+
};
|
|
1894
|
+
var packSrgb = function (args) {
|
|
1895
|
+
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));
|
|
1896
|
+
};
|
|
1897
|
+
var packSrgbLinear = function (_a) {
|
|
1898
|
+
var r = _a[0], g = _a[1], b = _a[2], a = _a[3];
|
|
1899
|
+
var rgb = srgbLinear2rgb([r, g, b]);
|
|
1900
|
+
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);
|
|
1901
|
+
};
|
|
1902
|
+
var packXYZ = function (args) {
|
|
1903
|
+
var srgb_linear = xyz2rgbLinear([args[0], args[1], args[2]]);
|
|
1904
|
+
return packSrgbLinear([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
|
|
1905
|
+
};
|
|
1906
|
+
var packLab = function (_context, args) {
|
|
1907
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1908
|
+
throw new Error('Relative color not supported for lab()');
|
|
1909
|
+
}
|
|
1910
|
+
var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(lab2xyz([l, a, b])));
|
|
1911
|
+
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);
|
|
1912
|
+
};
|
|
1913
|
+
var packOkLab = function (_context, args) {
|
|
1914
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1915
|
+
throw new Error('Relative color not supported for oklab()');
|
|
1916
|
+
}
|
|
1917
|
+
var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(oklab2xyz([l, a, b])));
|
|
1918
|
+
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);
|
|
1919
|
+
};
|
|
1920
|
+
var packOkLch = function (_context, args) {
|
|
1921
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1922
|
+
throw new Error('Relative color not supported for oklch()');
|
|
1923
|
+
}
|
|
1924
|
+
var _a = extractOkLchComponents(args), l = _a[0], c = _a[1], h = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(oklab2xyz(lch2lab([l, c, h]))));
|
|
1925
|
+
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);
|
|
1926
|
+
};
|
|
1927
|
+
var packLch = function (_context, args) {
|
|
1928
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1929
|
+
throw new Error('Relative color not supported for lch()');
|
|
1930
|
+
}
|
|
1931
|
+
var _a = extractLchComponents(args), l = _a[0], c = _a[1], h = _a[2], a = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(lab2xyz(lch2lab([l, c, h]))));
|
|
1932
|
+
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);
|
|
1933
|
+
};
|
|
1934
|
+
var extractHslComponents = function (context, args) {
|
|
1935
|
+
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;
|
|
1936
|
+
return [h, s, l, a];
|
|
1937
|
+
};
|
|
1938
|
+
var packHSL = function (context, args) {
|
|
1939
|
+
if (isRelativeTransform(args)) {
|
|
1940
|
+
throw new Error('Relative color not supported for hsl()');
|
|
1941
|
+
}
|
|
1942
|
+
var _a = extractHslComponents(context, args), h = _a[0], s = _a[1], l = _a[2], a = _a[3], rgb = hsl2rgb([h, s, l]);
|
|
1943
|
+
return pack(rgb[0] * 255, rgb[1] * 255, rgb[2] * 255, s === 0 ? 1 : a);
|
|
1944
|
+
};
|
|
1945
|
+
var extractLchComponents = function (args) {
|
|
1946
|
+
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;
|
|
1947
|
+
return [l, c, h, a];
|
|
1948
|
+
};
|
|
1949
|
+
var extractLabComponents = function (args) {
|
|
1950
|
+
var tokens = args.filter(nonFunctionArgSeparator),
|
|
1951
|
+
// eslint-disable-next-line prettier/prettier
|
|
1952
|
+
l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1953
|
+
? tokens[0].number / 100
|
|
1954
|
+
: isNumberToken(tokens[0])
|
|
1955
|
+
? tokens[0].number
|
|
1956
|
+
: 0,
|
|
1957
|
+
// eslint-disable-next-line prettier/prettier
|
|
1958
|
+
a = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1959
|
+
? tokens[1].number / 100
|
|
1960
|
+
: isNumberToken(tokens[1])
|
|
1961
|
+
? tokens[1].number
|
|
1962
|
+
: 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;
|
|
1963
|
+
return [l, a, b, alpha];
|
|
1964
|
+
};
|
|
1965
|
+
var extractOkLchComponents = function (args) {
|
|
1966
|
+
var tokens = args.filter(nonFunctionArgSeparator),
|
|
1967
|
+
// eslint-disable-next-line prettier/prettier
|
|
1968
|
+
l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1969
|
+
? tokens[0].number / 100
|
|
1970
|
+
: isNumberToken(tokens[0])
|
|
1971
|
+
? tokens[0].number
|
|
1972
|
+
: 0,
|
|
1973
|
+
// eslint-disable-next-line prettier/prettier
|
|
1974
|
+
c = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1975
|
+
? tokens[1].number / 100
|
|
1976
|
+
: isNumberToken(tokens[1])
|
|
1977
|
+
? tokens[1].number
|
|
1978
|
+
: 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;
|
|
1979
|
+
return [l, c, h, a];
|
|
1980
|
+
};
|
|
1981
|
+
/**
|
|
1982
|
+
* Convert D65 to D50
|
|
1983
|
+
*
|
|
1984
|
+
* @param xyz
|
|
1985
|
+
*/
|
|
1986
|
+
var d65toD50 = function (xyz) {
|
|
1987
|
+
return multiplyMatrices(
|
|
1988
|
+
// eslint-disable-next-line prettier/prettier
|
|
1989
|
+
[
|
|
1990
|
+
1.0479297925449969, 0.022946870601609652, -0.05019226628920524, 0.02962780877005599, 0.9904344267538799,
|
|
1991
|
+
-0.017073799063418826, -0.009243040646204504, 0.015055191490298152, 0.7518742814281371
|
|
1992
|
+
], xyz);
|
|
1939
1993
|
};
|
|
1940
|
-
|
|
1994
|
+
/**
|
|
1995
|
+
* Convert D50 to D65
|
|
1996
|
+
*
|
|
1997
|
+
* @param xyz
|
|
1998
|
+
*/
|
|
1999
|
+
var d50toD65 = function (xyz) {
|
|
2000
|
+
return multiplyMatrices(
|
|
2001
|
+
// eslint-disable-next-line prettier/prettier
|
|
2002
|
+
[
|
|
2003
|
+
0.955473421488075, -0.02309845494876471, 0.06325924320057072, -0.0283697093338637, 1.0099953980813041,
|
|
2004
|
+
0.021041441191917323, 0.012314014864481998, -0.020507649298898964, 1.330365926242124
|
|
2005
|
+
], xyz);
|
|
2006
|
+
};
|
|
2007
|
+
var hue2rgb = function (t1, t2, hue) {
|
|
1941
2008
|
if (hue < 0) {
|
|
1942
2009
|
hue += 1;
|
|
1943
2010
|
}
|
|
@@ -1956,29 +2023,783 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1956
2023
|
else {
|
|
1957
2024
|
return t1;
|
|
1958
2025
|
}
|
|
1959
|
-
}
|
|
1960
|
-
var
|
|
1961
|
-
var
|
|
1962
|
-
var hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3];
|
|
1963
|
-
var h = (hue.type === 17 /* NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2);
|
|
1964
|
-
var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0;
|
|
1965
|
-
var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0;
|
|
1966
|
-
var a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1;
|
|
2026
|
+
};
|
|
2027
|
+
var hsl2rgb = function (_a) {
|
|
2028
|
+
var h = _a[0], s = _a[1], l = _a[2];
|
|
1967
2029
|
if (s === 0) {
|
|
1968
|
-
return
|
|
2030
|
+
return [l * 255, l * 255, l * 255];
|
|
2031
|
+
}
|
|
2032
|
+
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);
|
|
2033
|
+
return [r, g, b];
|
|
2034
|
+
};
|
|
2035
|
+
/**
|
|
2036
|
+
* Convert lch to OKLab
|
|
2037
|
+
*
|
|
2038
|
+
* @param l
|
|
2039
|
+
* @param c
|
|
2040
|
+
* @param h
|
|
2041
|
+
*/
|
|
2042
|
+
var lch2lab = function (_a) {
|
|
2043
|
+
var l = _a[0], c = _a[1], h = _a[2];
|
|
2044
|
+
if (c < 0) {
|
|
2045
|
+
c = 0;
|
|
2046
|
+
}
|
|
2047
|
+
if (isNaN(h)) {
|
|
2048
|
+
h = 0;
|
|
2049
|
+
}
|
|
2050
|
+
return [l, c * Math.cos((h * Math.PI) / 180), c * Math.sin((h * Math.PI) / 180)];
|
|
2051
|
+
};
|
|
2052
|
+
/**
|
|
2053
|
+
* Convert OKLab to XYZ relative to D65
|
|
2054
|
+
*
|
|
2055
|
+
* @param lab
|
|
2056
|
+
*/
|
|
2057
|
+
var oklab2xyz = function (lab) {
|
|
2058
|
+
var LMSg = multiplyMatrices(
|
|
2059
|
+
// eslint-disable-next-line prettier/prettier
|
|
2060
|
+
[
|
|
2061
|
+
1, 0.3963377773761749, 0.2158037573099136, 1, -0.1055613458156586, -0.0638541728258133, 1,
|
|
2062
|
+
-0.0894841775298119, -1.2914855480194092
|
|
2063
|
+
], lab), LMS = LMSg.map(function (val) { return Math.pow(val, 3); });
|
|
2064
|
+
return multiplyMatrices(
|
|
2065
|
+
// eslint-disable-next-line prettier/prettier
|
|
2066
|
+
[
|
|
2067
|
+
1.2268798758459243, -0.5578149944602171, 0.2813910456659647, -0.0405757452148008, 1.112286803280317,
|
|
2068
|
+
-0.0717110580655164, -0.0763729366746601, -0.4214933324022432, 1.5869240198367816
|
|
2069
|
+
], LMS);
|
|
2070
|
+
};
|
|
2071
|
+
/**
|
|
2072
|
+
* Convert Lab to D50-adapted XYZ
|
|
2073
|
+
*
|
|
2074
|
+
* @param lab
|
|
2075
|
+
*/
|
|
2076
|
+
var lab2xyz = function (lab) {
|
|
2077
|
+
var fy = (lab[0] + 16) / 116, fx = lab[1] / 500 + fy, fz = fy - lab[2] / 200, k = 24389 / 27, e = 24 / 116, xyz = [
|
|
2078
|
+
((fx > e ? Math.pow(fx, 3) : (116 * fx - 16) / k) * 0.3457) / 0.3585,
|
|
2079
|
+
lab[0] > 8 ? Math.pow(fy, 3) : lab[0] / k,
|
|
2080
|
+
((fz > e ? Math.pow(fz, 3) : (116 * fz - 16) / k) * (1.0 - 0.3457 - 0.3585)) / 0.3585
|
|
2081
|
+
];
|
|
2082
|
+
return d50toD65([xyz[0], xyz[1], xyz[2]]);
|
|
2083
|
+
};
|
|
2084
|
+
/**
|
|
2085
|
+
* Convert RGB to XYZ
|
|
2086
|
+
*
|
|
2087
|
+
* @param _context
|
|
2088
|
+
* @param args
|
|
2089
|
+
*/
|
|
2090
|
+
var rgbToXyz = function (_context, args) {
|
|
2091
|
+
var tokens = args.filter(nonFunctionArgSeparator);
|
|
2092
|
+
if (tokens.length === 3) {
|
|
2093
|
+
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];
|
|
2094
|
+
return [x, y, z, 1];
|
|
2095
|
+
}
|
|
2096
|
+
if (tokens.length === 4) {
|
|
2097
|
+
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];
|
|
2098
|
+
return [x, y, z, a];
|
|
2099
|
+
}
|
|
2100
|
+
return [0, 0, 0, 1];
|
|
2101
|
+
};
|
|
2102
|
+
/**
|
|
2103
|
+
* HSL to XYZ
|
|
2104
|
+
*
|
|
2105
|
+
* @param context
|
|
2106
|
+
* @param args
|
|
2107
|
+
*/
|
|
2108
|
+
var hslToXyz = function (context, args) {
|
|
2109
|
+
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];
|
|
2110
|
+
return [x, y, z, a];
|
|
2111
|
+
};
|
|
2112
|
+
/**
|
|
2113
|
+
* LAB to XYZ
|
|
2114
|
+
*
|
|
2115
|
+
* @param _context
|
|
2116
|
+
* @param args
|
|
2117
|
+
*/
|
|
2118
|
+
var labToXyz = function (_context, args) {
|
|
2119
|
+
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];
|
|
2120
|
+
return [x, y, z, alpha];
|
|
2121
|
+
};
|
|
2122
|
+
/**
|
|
2123
|
+
* LCH to XYZ
|
|
2124
|
+
*
|
|
2125
|
+
* @param _context
|
|
2126
|
+
* @param args
|
|
2127
|
+
*/
|
|
2128
|
+
var lchToXyz = function (_context, args) {
|
|
2129
|
+
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];
|
|
2130
|
+
return [x, y, z, alpha];
|
|
2131
|
+
};
|
|
2132
|
+
/**
|
|
2133
|
+
* OKLch to XYZ
|
|
2134
|
+
*
|
|
2135
|
+
* @param _context
|
|
2136
|
+
* @param args
|
|
2137
|
+
*/
|
|
2138
|
+
var oklchToXyz = function (_context, args) {
|
|
2139
|
+
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];
|
|
2140
|
+
return [x, y, z, alpha];
|
|
2141
|
+
};
|
|
2142
|
+
/**
|
|
2143
|
+
* OKLab to XYZ
|
|
2144
|
+
*
|
|
2145
|
+
* @param _context
|
|
2146
|
+
* @param args
|
|
2147
|
+
*/
|
|
2148
|
+
var oklabToXyz = function (_context, args) {
|
|
2149
|
+
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];
|
|
2150
|
+
return [x, y, z, alpha];
|
|
2151
|
+
};
|
|
2152
|
+
/**
|
|
2153
|
+
* XYZ-50 to XYZ
|
|
2154
|
+
*
|
|
2155
|
+
* @param args
|
|
2156
|
+
*/
|
|
2157
|
+
var xyz50ToXYZ = function (args) {
|
|
2158
|
+
return d50toD65([args[0], args[1], args[2]]);
|
|
2159
|
+
};
|
|
2160
|
+
/**
|
|
2161
|
+
* Does nothing, required for SUPPORTED_COLOR_SPACES_FROM_XYZ in the _color() function
|
|
2162
|
+
*
|
|
2163
|
+
* @param args
|
|
2164
|
+
*/
|
|
2165
|
+
var xyzFromXYZ = function (args) {
|
|
2166
|
+
return args;
|
|
2167
|
+
};
|
|
2168
|
+
/**
|
|
2169
|
+
* XYZ-65 to XYZ-50
|
|
2170
|
+
*
|
|
2171
|
+
* @param args
|
|
2172
|
+
*/
|
|
2173
|
+
var xyz50FromXYZ = function (args) {
|
|
2174
|
+
var _a = d65toD50([args[0], args[2], args[3]]), x = _a[0], y = _a[1], z = _a[2];
|
|
2175
|
+
return [x, y, z, args[3]];
|
|
2176
|
+
};
|
|
2177
|
+
/**
|
|
2178
|
+
* Convert XYZ to SRGB and Pack
|
|
2179
|
+
*
|
|
2180
|
+
* @param args
|
|
2181
|
+
*/
|
|
2182
|
+
var convertXyz = function (args) {
|
|
2183
|
+
return packXYZ([args[0], args[1], args[2], args[3]]);
|
|
2184
|
+
};
|
|
2185
|
+
/**
|
|
2186
|
+
* Convert XYZ-50 to SRGB and Pack
|
|
2187
|
+
*
|
|
2188
|
+
* @param args
|
|
2189
|
+
*/
|
|
2190
|
+
var convertXyz50 = function (args) {
|
|
2191
|
+
var xyz = xyz50ToXYZ([args[0], args[1], args[2]]);
|
|
2192
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2193
|
+
};
|
|
2194
|
+
|
|
2195
|
+
/**
|
|
2196
|
+
* SRGB related functions
|
|
2197
|
+
*/
|
|
2198
|
+
/**
|
|
2199
|
+
* Convert XYZ to linear-light sRGB
|
|
2200
|
+
*
|
|
2201
|
+
* @param xyz
|
|
2202
|
+
*/
|
|
2203
|
+
var xyz2rgbLinear = function (xyz) {
|
|
2204
|
+
return multiplyMatrices(
|
|
2205
|
+
// eslint-disable-next-line prettier/prettier
|
|
2206
|
+
[
|
|
2207
|
+
3.2409699419045226, -1.537383177570094, -0.4986107602930034, -0.9692436362808796, 1.8759675015077202,
|
|
2208
|
+
0.04155505740717559, 0.05563007969699366, -0.20397695888897652, 1.0569715142428786
|
|
2209
|
+
], xyz);
|
|
2210
|
+
};
|
|
2211
|
+
/**
|
|
2212
|
+
* Convert XYZ to linear-light sRGB
|
|
2213
|
+
*
|
|
2214
|
+
* @param xyz
|
|
2215
|
+
*/
|
|
2216
|
+
var rgbLinear2xyz = function (xyz) {
|
|
2217
|
+
return multiplyMatrices(
|
|
2218
|
+
// eslint-disable-next-line prettier/prettier
|
|
2219
|
+
[
|
|
2220
|
+
0.41239079926595934, 0.357584339383878, 0.1804807884018343, 0.21263900587151027, 0.715168678767756,
|
|
2221
|
+
0.07219231536073371, 0.01933081871559182, 0.11919477979462598, 0.9505321522496607
|
|
2222
|
+
], xyz);
|
|
2223
|
+
};
|
|
2224
|
+
/**
|
|
2225
|
+
* Convert sRGB to RGB
|
|
2226
|
+
*
|
|
2227
|
+
* @param rgb
|
|
2228
|
+
*/
|
|
2229
|
+
var srgbLinear2rgb = function (rgb) {
|
|
2230
|
+
return rgb.map(function (c) {
|
|
2231
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2232
|
+
// eslint-disable-next-line prettier/prettier
|
|
2233
|
+
return abs > 0.0031308 ? sign * (1.055 * Math.pow(abs, (1 / 2.4)) - 0.055) : 12.92 * c;
|
|
2234
|
+
});
|
|
2235
|
+
};
|
|
2236
|
+
/**
|
|
2237
|
+
* Convert RGB to sRGB
|
|
2238
|
+
*
|
|
2239
|
+
* @param rgb
|
|
2240
|
+
*/
|
|
2241
|
+
var rgb2rgbLinear = function (rgb) {
|
|
2242
|
+
return rgb.map(function (c) {
|
|
2243
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2244
|
+
// eslint-disable-next-line prettier/prettier
|
|
2245
|
+
return abs <= 0.04045 ? c / 12.92 : sign * Math.pow(((abs + 0.055) / 1.055), 2.4);
|
|
2246
|
+
});
|
|
2247
|
+
};
|
|
2248
|
+
/**
|
|
2249
|
+
* XYZ to SRGB
|
|
2250
|
+
*
|
|
2251
|
+
* @param args
|
|
2252
|
+
*/
|
|
2253
|
+
var srgbFromXYZ = function (args) {
|
|
2254
|
+
var _a = srgbLinear2rgb(xyz2rgbLinear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2255
|
+
return [r, g, b, args[3]];
|
|
2256
|
+
};
|
|
2257
|
+
/**
|
|
2258
|
+
* XYZ to SRGB-Linear
|
|
2259
|
+
* @param args
|
|
2260
|
+
*/
|
|
2261
|
+
var srgbLinearFromXYZ = function (args) {
|
|
2262
|
+
var _a = xyz2rgbLinear([args[0], args[1], args[2]]), r = _a[0], g = _a[1], b = _a[2];
|
|
2263
|
+
return [
|
|
2264
|
+
clamp(Math.round(r * 255), 0, 255),
|
|
2265
|
+
clamp(Math.round(g * 255), 0, 255),
|
|
2266
|
+
clamp(Math.round(b * 255), 0, 255),
|
|
2267
|
+
args[3]
|
|
2268
|
+
];
|
|
2269
|
+
};
|
|
2270
|
+
|
|
2271
|
+
/**
|
|
2272
|
+
* Display-P3 related functions
|
|
2273
|
+
*/
|
|
2274
|
+
/**
|
|
2275
|
+
* Convert P3 Linear to xyz
|
|
2276
|
+
*
|
|
2277
|
+
* @param p3l
|
|
2278
|
+
*/
|
|
2279
|
+
var p3LinearToXyz = function (p3l) {
|
|
2280
|
+
return multiplyMatrices(
|
|
2281
|
+
// eslint-disable-next-line prettier/prettier
|
|
2282
|
+
[
|
|
2283
|
+
0.4865709486482162, 0.26566769316909306, 0.1982172852343625, 0.2289745640697488, 0.6917385218365064,
|
|
2284
|
+
0.079286914093745, 0.0, 0.04511338185890264, 1.043944368900976
|
|
2285
|
+
], p3l);
|
|
2286
|
+
};
|
|
2287
|
+
/**
|
|
2288
|
+
* Convert XYZ to P3 Linear
|
|
2289
|
+
*
|
|
2290
|
+
* @param xyz
|
|
2291
|
+
*/
|
|
2292
|
+
var xyzToP3Linear = function (xyz) {
|
|
2293
|
+
return multiplyMatrices(
|
|
2294
|
+
// eslint-disable-next-line prettier/prettier
|
|
2295
|
+
[
|
|
2296
|
+
2.493496911941425, -0.9313836179191239, -0.40271078445071684, -0.8294889695615747, 1.7626640603183463,
|
|
2297
|
+
0.023624685841943577, 0.03584583024378447, -0.07617238926804182, 0.9568845240076872
|
|
2298
|
+
], xyz);
|
|
2299
|
+
};
|
|
2300
|
+
/**
|
|
2301
|
+
* Convert P3 to P3 linear
|
|
2302
|
+
*
|
|
2303
|
+
* @param p3
|
|
2304
|
+
*/
|
|
2305
|
+
var p32p3Linear = function (p3) {
|
|
2306
|
+
return p3.map(function (c) {
|
|
2307
|
+
var sign = c < 0 ? -1 : 1, abs = c * sign;
|
|
2308
|
+
if (abs <= 0.04045) {
|
|
2309
|
+
return c / 12.92;
|
|
2310
|
+
}
|
|
2311
|
+
// eslint-disable-next-line prettier/prettier
|
|
2312
|
+
return sign * Math.pow(((c + 0.055) / 1.055), 2.4) || 0;
|
|
2313
|
+
});
|
|
2314
|
+
};
|
|
2315
|
+
/**
|
|
2316
|
+
* Convert P3 Linear to P3
|
|
2317
|
+
*
|
|
2318
|
+
* @param p3l
|
|
2319
|
+
*/
|
|
2320
|
+
var p3Linear2p3 = function (p3l) {
|
|
2321
|
+
return srgbLinear2rgb(p3l);
|
|
2322
|
+
};
|
|
2323
|
+
/**
|
|
2324
|
+
* Convert P3 to XYZ
|
|
2325
|
+
*
|
|
2326
|
+
* @param args
|
|
2327
|
+
*/
|
|
2328
|
+
var p3ToXYZ = function (args) {
|
|
2329
|
+
var p3_linear = p32p3Linear([args[0], args[1], args[2]]);
|
|
2330
|
+
return p3LinearToXyz([p3_linear[0], p3_linear[1], p3_linear[2]]);
|
|
2331
|
+
};
|
|
2332
|
+
/**
|
|
2333
|
+
* Convert XYZ to P3
|
|
2334
|
+
*
|
|
2335
|
+
* @param args
|
|
2336
|
+
*/
|
|
2337
|
+
var p3FromXYZ = function (args) {
|
|
2338
|
+
var _a = p3Linear2p3(xyzToP3Linear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2339
|
+
return [r, g, b, args[3]];
|
|
2340
|
+
};
|
|
2341
|
+
/**
|
|
2342
|
+
* Convert P3 to SRGB and Pack
|
|
2343
|
+
*
|
|
2344
|
+
* @param args
|
|
2345
|
+
*/
|
|
2346
|
+
var convertP3 = function (args) {
|
|
2347
|
+
var xyz = p3ToXYZ([args[0], args[1], args[2]]);
|
|
2348
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2349
|
+
};
|
|
2350
|
+
|
|
2351
|
+
/**
|
|
2352
|
+
* A98-RGB related functions
|
|
2353
|
+
*/
|
|
2354
|
+
/**
|
|
2355
|
+
* Convert XYZ to a98 linear
|
|
2356
|
+
*
|
|
2357
|
+
* @param xyz
|
|
2358
|
+
*/
|
|
2359
|
+
var xyz2a98Linear = function (xyz) {
|
|
2360
|
+
return multiplyMatrices(
|
|
2361
|
+
// eslint-disable-next-line prettier/prettier
|
|
2362
|
+
[
|
|
2363
|
+
2.0415879038107465, -0.5650069742788596, -0.34473135077832956, -0.9692436362808795, 1.8759675015077202,
|
|
2364
|
+
0.04155505740717557, 0.013444280632031142, -0.11836239223101838, 1.0151749943912054
|
|
2365
|
+
], xyz);
|
|
2366
|
+
};
|
|
2367
|
+
/**
|
|
2368
|
+
* Convert XYZ to a98 linear
|
|
2369
|
+
*
|
|
2370
|
+
* @param a98
|
|
2371
|
+
*/
|
|
2372
|
+
var a98Linear2xyz = function (a98) {
|
|
2373
|
+
return multiplyMatrices(
|
|
2374
|
+
// eslint-disable-next-line prettier/prettier
|
|
2375
|
+
[
|
|
2376
|
+
0.5766690429101305, 0.1855582379065463, 0.1882286462349947, 0.29734497525053605, 0.6273635662554661,
|
|
2377
|
+
0.0752914584939978, 0.02703136138641234, 0.07068885253582723, 0.9913375368376388
|
|
2378
|
+
], a98);
|
|
2379
|
+
};
|
|
2380
|
+
/**
|
|
2381
|
+
* Convert A98 RGB to rgb linear
|
|
2382
|
+
*
|
|
2383
|
+
* @param rgb
|
|
2384
|
+
*/
|
|
2385
|
+
var a982a98Linear = function (rgb) {
|
|
2386
|
+
var mapped = rgb.map(function (c) {
|
|
2387
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2388
|
+
return sign * Math.pow(abs, (563 / 256));
|
|
2389
|
+
});
|
|
2390
|
+
return [mapped[0], mapped[1], mapped[2]];
|
|
2391
|
+
};
|
|
2392
|
+
/**
|
|
2393
|
+
* Convert A98 RGB Linear to A98
|
|
2394
|
+
*
|
|
2395
|
+
* @param rgb
|
|
2396
|
+
*/
|
|
2397
|
+
var a98Linear2a98 = function (rgb) {
|
|
2398
|
+
var mapped = rgb.map(function (c) {
|
|
2399
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2400
|
+
return sign * Math.pow(abs, (256 / 563));
|
|
2401
|
+
});
|
|
2402
|
+
return [mapped[0], mapped[1], mapped[2]];
|
|
2403
|
+
};
|
|
2404
|
+
/**
|
|
2405
|
+
* Convert XYZ to A98
|
|
2406
|
+
*
|
|
2407
|
+
* @param args
|
|
2408
|
+
*/
|
|
2409
|
+
var a98FromXYZ = function (args) {
|
|
2410
|
+
var _a = a98Linear2a98(xyz2a98Linear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2411
|
+
return [r, g, b, args[3]];
|
|
2412
|
+
};
|
|
2413
|
+
/**
|
|
2414
|
+
* Convert A98 to XYZ and Pack
|
|
2415
|
+
*
|
|
2416
|
+
* @param args
|
|
2417
|
+
*/
|
|
2418
|
+
var convertA98rgb = function (args) {
|
|
2419
|
+
var srgb_linear = xyz2rgbLinear(a98Linear2xyz(a982a98Linear([args[0], args[1], args[2]])));
|
|
2420
|
+
return packSrgbLinear([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
|
|
2421
|
+
};
|
|
2422
|
+
|
|
2423
|
+
/**
|
|
2424
|
+
* Pro Photo related functions
|
|
2425
|
+
*/
|
|
2426
|
+
/**
|
|
2427
|
+
* Convert linear-light display-p3 to XYZ D65
|
|
2428
|
+
*
|
|
2429
|
+
* @param p3
|
|
2430
|
+
*/
|
|
2431
|
+
var proPhotoLinearToXyz = function (p3) {
|
|
2432
|
+
return multiplyMatrices(
|
|
2433
|
+
// eslint-disable-next-line prettier/prettier
|
|
2434
|
+
[
|
|
2435
|
+
0.7977666449006423, 0.13518129740053308, 0.0313477341283922, 0.2880748288194013, 0.711835234241873,
|
|
2436
|
+
0.00008993693872564, 0.0, 0.0, 0.8251046025104602
|
|
2437
|
+
], p3);
|
|
2438
|
+
};
|
|
2439
|
+
/**
|
|
2440
|
+
* Convert XYZ D65 to linear-light display-p3
|
|
2441
|
+
*
|
|
2442
|
+
* @param xyz
|
|
2443
|
+
*/
|
|
2444
|
+
var xyzToProPhotoLinear = function (xyz) {
|
|
2445
|
+
return multiplyMatrices(
|
|
2446
|
+
// eslint-disable-next-line prettier/prettier
|
|
2447
|
+
[
|
|
2448
|
+
1.3457868816471583, -0.25557208737979464, -0.05110186497554526, -0.5446307051249019, 1.5082477428451468,
|
|
2449
|
+
0.02052744743642139, 0.0, 0.0, 1.2119675456389452
|
|
2450
|
+
], xyz);
|
|
2451
|
+
};
|
|
2452
|
+
/**
|
|
2453
|
+
* Convert Pro-Photo to Pro-Photo Linear
|
|
2454
|
+
*
|
|
2455
|
+
* @param p3
|
|
2456
|
+
*/
|
|
2457
|
+
var proPhotoToProPhotoLinear = function (p3) {
|
|
2458
|
+
return p3.map(function (c) {
|
|
2459
|
+
return c < 16 / 512 ? c / 16 : Math.pow(c, 1.8);
|
|
2460
|
+
});
|
|
2461
|
+
};
|
|
2462
|
+
/**
|
|
2463
|
+
* Convert Pro-Photo Linear to Pro-Photo
|
|
2464
|
+
*
|
|
2465
|
+
* @param p3
|
|
2466
|
+
*/
|
|
2467
|
+
var proPhotoLinearToProPhoto = function (p3) {
|
|
2468
|
+
return p3.map(function (c) {
|
|
2469
|
+
return c > 1 / 512 ? Math.pow(c, (1 / 1.8)) : c * 16;
|
|
2470
|
+
});
|
|
2471
|
+
};
|
|
2472
|
+
/**
|
|
2473
|
+
* Convert Pro-Photo to XYZ
|
|
2474
|
+
*
|
|
2475
|
+
* @param args
|
|
2476
|
+
*/
|
|
2477
|
+
var proPhotoToXYZ = function (args) {
|
|
2478
|
+
var prophoto_linear = proPhotoToProPhotoLinear([args[0], args[1], args[2]]);
|
|
2479
|
+
return d50toD65(proPhotoLinearToXyz([prophoto_linear[0], prophoto_linear[1], prophoto_linear[2]]));
|
|
2480
|
+
};
|
|
2481
|
+
/**
|
|
2482
|
+
* Convert XYZ to Pro-Photo
|
|
2483
|
+
*
|
|
2484
|
+
* @param args
|
|
2485
|
+
*/
|
|
2486
|
+
var proPhotoFromXYZ = function (args) {
|
|
2487
|
+
var _a = proPhotoLinearToProPhoto(xyzToProPhotoLinear(d65toD50([args[0], args[1], args[2]]))), r = _a[0], g = _a[1], b = _a[2];
|
|
2488
|
+
return [r, g, b, args[3]];
|
|
2489
|
+
};
|
|
2490
|
+
/**
|
|
2491
|
+
* Convert Pro-Photo to XYZ and Pack
|
|
2492
|
+
*
|
|
2493
|
+
* @param args
|
|
2494
|
+
*/
|
|
2495
|
+
var convertProPhoto = function (args) {
|
|
2496
|
+
var xyz = proPhotoToXYZ([args[0], args[1], args[2]]);
|
|
2497
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2498
|
+
};
|
|
2499
|
+
|
|
2500
|
+
/**
|
|
2501
|
+
* REC2020 related functions
|
|
2502
|
+
*/
|
|
2503
|
+
var _a = 1.09929682680944;
|
|
2504
|
+
var _b = 0.018053968510807;
|
|
2505
|
+
/**
|
|
2506
|
+
* Convert rec2020 to rec2020 linear
|
|
2507
|
+
*
|
|
2508
|
+
* @param rgb
|
|
2509
|
+
*/
|
|
2510
|
+
var rec20202rec2020Linear = function (rgb) {
|
|
2511
|
+
return rgb.map(function (c) {
|
|
2512
|
+
return c < _b * 4.5 ? c / 4.5 : Math.pow((c + _a - 1) / _a, 1 / 0.45);
|
|
2513
|
+
});
|
|
2514
|
+
};
|
|
2515
|
+
/**
|
|
2516
|
+
* Convert rec2020 linear to rec2020
|
|
2517
|
+
*
|
|
2518
|
+
* @param rgb
|
|
2519
|
+
*/
|
|
2520
|
+
var rec2020Linear2rec2020 = function (rgb) {
|
|
2521
|
+
return rgb.map(function (c) {
|
|
2522
|
+
return c >= _b ? _a * Math.pow(c, 0.45) - (_a - 1) : 4.5 * c;
|
|
2523
|
+
});
|
|
2524
|
+
};
|
|
2525
|
+
/**
|
|
2526
|
+
* Convert rec2020 linear to XYZ D65
|
|
2527
|
+
*
|
|
2528
|
+
* @param rec
|
|
2529
|
+
*/
|
|
2530
|
+
var rec2020LinearToXyz = function (rec) {
|
|
2531
|
+
return multiplyMatrices(
|
|
2532
|
+
// eslint-disable-next-line prettier/prettier
|
|
2533
|
+
[
|
|
2534
|
+
0.6369580483012914, 0.14461690358620832, 0.1688809751641721, 0.2627002120112671, 0.6779980715188708,
|
|
2535
|
+
0.05930171646986196, 0.0, 0.028072693049087428, 1.060985057710791
|
|
2536
|
+
], rec);
|
|
2537
|
+
};
|
|
2538
|
+
/**
|
|
2539
|
+
* Convert XYZ D65 to rec2020 linear
|
|
2540
|
+
*
|
|
2541
|
+
* @param xyz
|
|
2542
|
+
*/
|
|
2543
|
+
var xyzToRec2020Linear = function (xyz) {
|
|
2544
|
+
return multiplyMatrices(
|
|
2545
|
+
// eslint-disable-next-line prettier/prettier
|
|
2546
|
+
[
|
|
2547
|
+
1.716651187971268, -0.355670783776392, -0.25336628137366, -0.666684351832489, 1.616481236634939,
|
|
2548
|
+
0.0157685458139111, 0.017639857445311, -0.042770613257809, 0.942103121235474
|
|
2549
|
+
], xyz);
|
|
2550
|
+
};
|
|
2551
|
+
/**
|
|
2552
|
+
* Convert Rec2020 to XYZ
|
|
2553
|
+
*
|
|
2554
|
+
* @param args
|
|
2555
|
+
*/
|
|
2556
|
+
var rec2020ToXYZ = function (args) {
|
|
2557
|
+
var rec2020_linear = rec20202rec2020Linear([args[0], args[1], args[2]]);
|
|
2558
|
+
return rec2020LinearToXyz([rec2020_linear[0], rec2020_linear[1], rec2020_linear[2]]);
|
|
2559
|
+
};
|
|
2560
|
+
/**
|
|
2561
|
+
* Convert XYZ to Rec2020
|
|
2562
|
+
*
|
|
2563
|
+
* @param args
|
|
2564
|
+
*/
|
|
2565
|
+
var rec2020FromXYZ = function (args) {
|
|
2566
|
+
var _c = rec2020Linear2rec2020(xyzToRec2020Linear([args[0], args[1], args[2]])), r = _c[0], g = _c[1], b = _c[2];
|
|
2567
|
+
return [r, g, b, args[3]];
|
|
2568
|
+
};
|
|
2569
|
+
/**
|
|
2570
|
+
* Convert Rec2020 to SRGB and Pack
|
|
2571
|
+
*
|
|
2572
|
+
* @param args
|
|
2573
|
+
*/
|
|
2574
|
+
var convertRec2020 = function (args) {
|
|
2575
|
+
var xyz = rec2020ToXYZ([args[0], args[1], args[2]]);
|
|
2576
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2577
|
+
};
|
|
2578
|
+
|
|
2579
|
+
var color$1 = {
|
|
2580
|
+
name: 'color',
|
|
2581
|
+
parse: function (context, value) {
|
|
2582
|
+
if (value.type === 18 /* TokenType.FUNCTION */) {
|
|
2583
|
+
var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
|
|
2584
|
+
if (typeof colorFunction === 'undefined') {
|
|
2585
|
+
throw new Error("Attempting to parse an unsupported color function \"".concat(value.name, "\""));
|
|
2586
|
+
}
|
|
2587
|
+
return colorFunction(context, value.values);
|
|
2588
|
+
}
|
|
2589
|
+
if (value.type === 5 /* TokenType.HASH_TOKEN */) {
|
|
2590
|
+
var _a = hash2rgb(value), r = _a[0], g = _a[1], b = _a[2], a = _a[3];
|
|
2591
|
+
return pack(r, g, b, a);
|
|
2592
|
+
}
|
|
2593
|
+
if (value.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
2594
|
+
var namedColor = COLORS[value.value.toUpperCase()];
|
|
2595
|
+
if (typeof namedColor !== 'undefined') {
|
|
2596
|
+
return namedColor;
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
return COLORS.TRANSPARENT;
|
|
2600
|
+
}
|
|
2601
|
+
};
|
|
2602
|
+
var hash2rgb = function (token) {
|
|
2603
|
+
if (token.value.length === 3) {
|
|
2604
|
+
var r = token.value.substring(0, 1);
|
|
2605
|
+
var g = token.value.substring(1, 2);
|
|
2606
|
+
var b = token.value.substring(2, 3);
|
|
2607
|
+
return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1];
|
|
2608
|
+
}
|
|
2609
|
+
if (token.value.length === 4) {
|
|
2610
|
+
var r = token.value.substring(0, 1);
|
|
2611
|
+
var g = token.value.substring(1, 2);
|
|
2612
|
+
var b = token.value.substring(2, 3);
|
|
2613
|
+
var a = token.value.substring(3, 4);
|
|
2614
|
+
return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255];
|
|
2615
|
+
}
|
|
2616
|
+
if (token.value.length === 6) {
|
|
2617
|
+
var r = token.value.substring(0, 2);
|
|
2618
|
+
var g = token.value.substring(2, 4);
|
|
2619
|
+
var b = token.value.substring(4, 6);
|
|
2620
|
+
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1];
|
|
2621
|
+
}
|
|
2622
|
+
if (token.value.length === 8) {
|
|
2623
|
+
var r = token.value.substring(0, 2);
|
|
2624
|
+
var g = token.value.substring(2, 4);
|
|
2625
|
+
var b = token.value.substring(4, 6);
|
|
2626
|
+
var a = token.value.substring(6, 8);
|
|
2627
|
+
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255];
|
|
2628
|
+
}
|
|
2629
|
+
return [0, 0, 0, 1];
|
|
2630
|
+
};
|
|
2631
|
+
var rgb = function (_context, args) {
|
|
2632
|
+
var tokens = args.filter(nonFunctionArgSeparator);
|
|
2633
|
+
if (isRelativeTransform(tokens)) {
|
|
2634
|
+
throw new Error('Relative color not supported for rgb()');
|
|
2635
|
+
}
|
|
2636
|
+
if (tokens.length === 3) {
|
|
2637
|
+
var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2];
|
|
2638
|
+
return pack(r, g, b, 1);
|
|
2639
|
+
}
|
|
2640
|
+
if (tokens.length === 4) {
|
|
2641
|
+
var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a = _b[3];
|
|
2642
|
+
return pack(r, g, b, a);
|
|
2643
|
+
}
|
|
2644
|
+
return 0;
|
|
2645
|
+
};
|
|
2646
|
+
/**
|
|
2647
|
+
* Handle the CSS color() function
|
|
2648
|
+
*
|
|
2649
|
+
* @param context
|
|
2650
|
+
* @param args
|
|
2651
|
+
*/
|
|
2652
|
+
var _color = function (context, args) {
|
|
2653
|
+
var tokens = args.filter(nonFunctionArgSeparator), token_1_value = tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ ? tokens[0].value : 'unknown', is_absolute = !isRelativeTransform(tokens);
|
|
2654
|
+
if (is_absolute) {
|
|
2655
|
+
var color_space = token_1_value, colorSpaceFunction = SUPPORTED_COLOR_SPACES_ABSOLUTE[color_space];
|
|
2656
|
+
if (typeof colorSpaceFunction === 'undefined') {
|
|
2657
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(color_space, "\" for color() function"));
|
|
2658
|
+
}
|
|
2659
|
+
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 &&
|
|
2660
|
+
tokens[4].type === 6 /* TokenType.DELIM_TOKEN */ &&
|
|
2661
|
+
tokens[4].value === '/' &&
|
|
2662
|
+
isNumberToken(tokens[5])
|
|
2663
|
+
? tokens[5].number
|
|
2664
|
+
: 1;
|
|
2665
|
+
return colorSpaceFunction([c1, c2, c3, a]);
|
|
1969
2666
|
}
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2667
|
+
else {
|
|
2668
|
+
var extractComponent = function (color, token) {
|
|
2669
|
+
if (isNumberToken(token)) {
|
|
2670
|
+
return token.number;
|
|
2671
|
+
}
|
|
2672
|
+
var posFromVal = function (value) {
|
|
2673
|
+
return value === 'r' || value === 'x' ? 0 : value === 'g' || value === 'y' ? 1 : 2;
|
|
2674
|
+
};
|
|
2675
|
+
if (isIdentToken(token)) {
|
|
2676
|
+
var position = posFromVal(token.value);
|
|
2677
|
+
return color[position];
|
|
2678
|
+
}
|
|
2679
|
+
var parseCalc = function (args) {
|
|
2680
|
+
var parts = args.filter(nonFunctionArgSeparator);
|
|
2681
|
+
var expression = '(';
|
|
2682
|
+
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
2683
|
+
var part = parts_1[_i];
|
|
2684
|
+
expression +=
|
|
2685
|
+
part.type === 18 /* TokenType.FUNCTION */ && part.name === 'calc'
|
|
2686
|
+
? parseCalc(part.values)
|
|
2687
|
+
: isNumberToken(part)
|
|
2688
|
+
? part.number
|
|
2689
|
+
: part.type === 6 /* TokenType.DELIM_TOKEN */ || isIdentToken(part)
|
|
2690
|
+
? part.value
|
|
2691
|
+
: '';
|
|
2692
|
+
}
|
|
2693
|
+
expression += ')';
|
|
2694
|
+
return expression;
|
|
2695
|
+
};
|
|
2696
|
+
if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
2697
|
+
var args_1 = token.values.filter(nonFunctionArgSeparator);
|
|
2698
|
+
if (token.name === 'calc') {
|
|
2699
|
+
var expression = parseCalc(args_1)
|
|
2700
|
+
.replace(/r|x/, color[0].toString())
|
|
2701
|
+
.replace(/g|y/, color[1].toString())
|
|
2702
|
+
.replace(/b|z/, color[2].toString());
|
|
2703
|
+
return new Function('return ' + expression)();
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
return null;
|
|
2707
|
+
};
|
|
2708
|
+
var from_colorspace = tokens[1].type === 18 /* TokenType.FUNCTION */
|
|
2709
|
+
? tokens[1].name
|
|
2710
|
+
: isIdentToken(tokens[1]) || tokens[1].type === 5 /* TokenType.HASH_TOKEN */
|
|
2711
|
+
? 'rgb'
|
|
2712
|
+
: 'unknown', to_colorspace = isIdentToken(tokens[2]) ? tokens[2].value : 'unknown';
|
|
2713
|
+
var from = tokens[1].type === 18 /* TokenType.FUNCTION */ ? tokens[1].values : isIdentToken(tokens[1]) ? [tokens[1]] : [];
|
|
2714
|
+
if (isIdentToken(tokens[1])) {
|
|
2715
|
+
var named_color = COLORS[tokens[1].value.toUpperCase()];
|
|
2716
|
+
if (typeof named_color === 'undefined') {
|
|
2717
|
+
throw new Error("Attempting to use unknown color in relative color 'from'");
|
|
2718
|
+
}
|
|
2719
|
+
else {
|
|
2720
|
+
var _c = parseColor(context, tokens[1].value), alpha = 0xff & _c, blue = 0xff & (_c >> 8), green = 0xff & (_c >> 16), red = 0xff & (_c >> 24);
|
|
2721
|
+
from = [
|
|
2722
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: red, flags: 1 },
|
|
2723
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: green, flags: 1 },
|
|
2724
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: blue, flags: 1 },
|
|
2725
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: alpha > 1 ? alpha / 255 : alpha, flags: 1 }
|
|
2726
|
+
];
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
else if (tokens[1].type === 5 /* TokenType.HASH_TOKEN */) {
|
|
2730
|
+
var _a = hash2rgb(tokens[1]), red = _a[0], green = _a[1], blue = _a[2], alpha = _a[3];
|
|
2731
|
+
from = [
|
|
2732
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: red, flags: 1 },
|
|
2733
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: green, flags: 1 },
|
|
2734
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: blue, flags: 1 },
|
|
2735
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: alpha > 1 ? alpha / 255 : alpha, flags: 1 }
|
|
2736
|
+
];
|
|
2737
|
+
}
|
|
2738
|
+
if (from.length === 0) {
|
|
2739
|
+
throw new Error("Attempting to use unknown color in relative color 'from'");
|
|
2740
|
+
}
|
|
2741
|
+
if (to_colorspace === 'unknown') {
|
|
2742
|
+
throw new Error("Attempting to use unknown colorspace in relative color 'to'");
|
|
2743
|
+
}
|
|
2744
|
+
var fromColorToXyz = SUPPORTED_COLOR_SPACES_TO_XYZ[from_colorspace], toColorFromXyz = SUPPORTED_COLOR_SPACES_FROM_XYZ[to_colorspace], toColorPack = SUPPORTED_COLOR_SPACES_ABSOLUTE[to_colorspace];
|
|
2745
|
+
if (typeof fromColorToXyz === 'undefined') {
|
|
2746
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(from_colorspace, "\" for color() function"));
|
|
2747
|
+
}
|
|
2748
|
+
if (typeof toColorFromXyz === 'undefined') {
|
|
2749
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(to_colorspace, "\" for color() function"));
|
|
2750
|
+
}
|
|
2751
|
+
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 &&
|
|
2752
|
+
tokens[6].type === 6 /* TokenType.DELIM_TOKEN */ &&
|
|
2753
|
+
tokens[6].value === '/' &&
|
|
2754
|
+
isNumberToken(tokens[7])
|
|
2755
|
+
? tokens[7].number
|
|
2756
|
+
: 1;
|
|
2757
|
+
if (c1 === null || c2 === null || c3 === null) {
|
|
2758
|
+
throw new Error("Invalid relative color in color() function");
|
|
2759
|
+
}
|
|
2760
|
+
return toColorPack([c1, c2, c3, a]);
|
|
2761
|
+
}
|
|
2762
|
+
};
|
|
2763
|
+
var SUPPORTED_COLOR_SPACES_ABSOLUTE = {
|
|
2764
|
+
srgb: packSrgb,
|
|
2765
|
+
'srgb-linear': packSrgbLinear,
|
|
2766
|
+
'display-p3': convertP3,
|
|
2767
|
+
'a98-rgb': convertA98rgb,
|
|
2768
|
+
'prophoto-rgb': convertProPhoto,
|
|
2769
|
+
xyz: convertXyz,
|
|
2770
|
+
'xyz-d50': convertXyz50,
|
|
2771
|
+
'xyz-d65': convertXyz,
|
|
2772
|
+
rec2020: convertRec2020
|
|
2773
|
+
};
|
|
2774
|
+
var SUPPORTED_COLOR_SPACES_TO_XYZ = {
|
|
2775
|
+
rgb: rgbToXyz,
|
|
2776
|
+
hsl: hslToXyz,
|
|
2777
|
+
lab: labToXyz,
|
|
2778
|
+
lch: lchToXyz,
|
|
2779
|
+
oklab: oklabToXyz,
|
|
2780
|
+
oklch: oklchToXyz
|
|
2781
|
+
};
|
|
2782
|
+
var SUPPORTED_COLOR_SPACES_FROM_XYZ = {
|
|
2783
|
+
srgb: srgbFromXYZ,
|
|
2784
|
+
'srgb-linear': srgbLinearFromXYZ,
|
|
2785
|
+
'display-p3': p3FromXYZ,
|
|
2786
|
+
'a98-rgb': a98FromXYZ,
|
|
2787
|
+
'prophoto-rgb': proPhotoFromXYZ,
|
|
2788
|
+
xyz: xyzFromXYZ,
|
|
2789
|
+
'xyz-d50': xyz50FromXYZ,
|
|
2790
|
+
'xyz-d65': xyzFromXYZ,
|
|
2791
|
+
rec2020: rec2020FromXYZ
|
|
1976
2792
|
};
|
|
1977
2793
|
var SUPPORTED_COLOR_FUNCTIONS = {
|
|
1978
|
-
hsl:
|
|
1979
|
-
hsla:
|
|
2794
|
+
hsl: packHSL,
|
|
2795
|
+
hsla: packHSL,
|
|
1980
2796
|
rgb: rgb,
|
|
1981
|
-
rgba: rgb
|
|
2797
|
+
rgba: rgb,
|
|
2798
|
+
lch: packLch,
|
|
2799
|
+
oklch: packOkLch,
|
|
2800
|
+
oklab: packOkLab,
|
|
2801
|
+
lab: packLab,
|
|
2802
|
+
color: _color
|
|
1982
2803
|
};
|
|
1983
2804
|
var parseColor = function (context, value) {
|
|
1984
2805
|
return color$1.parse(context, Parser.create(value).parseComponentValue());
|
|
@@ -2139,18 +2960,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2139
2960
|
name: 'background-clip',
|
|
2140
2961
|
initialValue: 'border-box',
|
|
2141
2962
|
prefix: false,
|
|
2142
|
-
type: 1 /* LIST */,
|
|
2963
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2143
2964
|
parse: function (_context, tokens) {
|
|
2144
2965
|
return tokens.map(function (token) {
|
|
2145
2966
|
if (isIdentToken(token)) {
|
|
2146
2967
|
switch (token.value) {
|
|
2147
2968
|
case 'padding-box':
|
|
2148
|
-
return 1 /* PADDING_BOX */;
|
|
2969
|
+
return 1 /* BACKGROUND_CLIP.PADDING_BOX */;
|
|
2149
2970
|
case 'content-box':
|
|
2150
|
-
return 2 /* CONTENT_BOX */;
|
|
2971
|
+
return 2 /* BACKGROUND_CLIP.CONTENT_BOX */;
|
|
2151
2972
|
}
|
|
2152
2973
|
}
|
|
2153
|
-
return 0 /* BORDER_BOX */;
|
|
2974
|
+
return 0 /* BACKGROUND_CLIP.BORDER_BOX */;
|
|
2154
2975
|
});
|
|
2155
2976
|
}
|
|
2156
2977
|
};
|
|
@@ -2159,7 +2980,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2159
2980
|
name: "background-color",
|
|
2160
2981
|
initialValue: 'transparent',
|
|
2161
2982
|
prefix: false,
|
|
2162
|
-
type: 3 /* TYPE_VALUE */,
|
|
2983
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2163
2984
|
format: 'color'
|
|
2164
2985
|
};
|
|
2165
2986
|
|
|
@@ -2262,24 +3083,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2262
3083
|
var rx = 0;
|
|
2263
3084
|
var ry = 0;
|
|
2264
3085
|
switch (gradient.size) {
|
|
2265
|
-
case 0 /* CLOSEST_SIDE */:
|
|
3086
|
+
case 0 /* CSSRadialExtent.CLOSEST_SIDE */:
|
|
2266
3087
|
// The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center.
|
|
2267
3088
|
// If the shape is an ellipse, it exactly meets the closest side in each dimension.
|
|
2268
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3089
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2269
3090
|
rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
|
|
2270
3091
|
}
|
|
2271
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3092
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2272
3093
|
rx = Math.min(Math.abs(x), Math.abs(x - width));
|
|
2273
3094
|
ry = Math.min(Math.abs(y), Math.abs(y - height));
|
|
2274
3095
|
}
|
|
2275
3096
|
break;
|
|
2276
|
-
case 2 /* CLOSEST_CORNER */:
|
|
3097
|
+
case 2 /* CSSRadialExtent.CLOSEST_CORNER */:
|
|
2277
3098
|
// The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center.
|
|
2278
3099
|
// If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified.
|
|
2279
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3100
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2280
3101
|
rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
|
|
2281
3102
|
}
|
|
2282
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3103
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2283
3104
|
// Compute the ratio ry/rx (which is to be the same as for "closest-side")
|
|
2284
3105
|
var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width));
|
|
2285
3106
|
var _a = findCorner(width, height, x, y, true), cx = _a[0], cy = _a[1];
|
|
@@ -2287,23 +3108,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2287
3108
|
ry = c * rx;
|
|
2288
3109
|
}
|
|
2289
3110
|
break;
|
|
2290
|
-
case 1 /* FARTHEST_SIDE */:
|
|
3111
|
+
case 1 /* CSSRadialExtent.FARTHEST_SIDE */:
|
|
2291
3112
|
// Same as closest-side, except the ending shape is sized based on the farthest side(s)
|
|
2292
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3113
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2293
3114
|
rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
|
|
2294
3115
|
}
|
|
2295
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3116
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2296
3117
|
rx = Math.max(Math.abs(x), Math.abs(x - width));
|
|
2297
3118
|
ry = Math.max(Math.abs(y), Math.abs(y - height));
|
|
2298
3119
|
}
|
|
2299
3120
|
break;
|
|
2300
|
-
case 3 /* FARTHEST_CORNER */:
|
|
3121
|
+
case 3 /* CSSRadialExtent.FARTHEST_CORNER */:
|
|
2301
3122
|
// Same as closest-corner, except the ending shape is sized based on the farthest corner.
|
|
2302
3123
|
// If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified.
|
|
2303
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3124
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2304
3125
|
rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
|
|
2305
3126
|
}
|
|
2306
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3127
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2307
3128
|
// Compute the ratio ry/rx (which is to be the same as for "farthest-side")
|
|
2308
3129
|
var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width));
|
|
2309
3130
|
var _b = findCorner(width, height, x, y, false), cx = _b[0], cy = _b[1];
|
|
@@ -2325,7 +3146,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2325
3146
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2326
3147
|
if (i === 0) {
|
|
2327
3148
|
var firstToken = arg[0];
|
|
2328
|
-
if (firstToken.type === 20 /* IDENT_TOKEN */ && firstToken.value === 'to') {
|
|
3149
|
+
if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ && firstToken.value === 'to') {
|
|
2329
3150
|
angle$1 = parseNamedSide(arg);
|
|
2330
3151
|
return;
|
|
2331
3152
|
}
|
|
@@ -2337,7 +3158,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2337
3158
|
var colorStop = parseColorStop(context, arg);
|
|
2338
3159
|
stops.push(colorStop);
|
|
2339
3160
|
});
|
|
2340
|
-
return { angle: angle$1, stops: stops, type: 1 /* LINEAR_GRADIENT */ };
|
|
3161
|
+
return { angle: angle$1, stops: stops, type: 1 /* CSSImageType.LINEAR_GRADIENT */ };
|
|
2341
3162
|
};
|
|
2342
3163
|
|
|
2343
3164
|
var prefixLinearGradient = function (context, tokens) {
|
|
@@ -2346,7 +3167,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2346
3167
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2347
3168
|
if (i === 0) {
|
|
2348
3169
|
var firstToken = arg[0];
|
|
2349
|
-
if (firstToken.type === 20 /* IDENT_TOKEN */ &&
|
|
3170
|
+
if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ &&
|
|
2350
3171
|
['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) {
|
|
2351
3172
|
angle$1 = parseNamedSide(arg);
|
|
2352
3173
|
return;
|
|
@@ -2362,30 +3183,30 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2362
3183
|
return {
|
|
2363
3184
|
angle: angle$1,
|
|
2364
3185
|
stops: stops,
|
|
2365
|
-
type: 1 /* LINEAR_GRADIENT */
|
|
3186
|
+
type: 1 /* CSSImageType.LINEAR_GRADIENT */
|
|
2366
3187
|
};
|
|
2367
3188
|
};
|
|
2368
3189
|
|
|
2369
3190
|
var webkitGradient = function (context, tokens) {
|
|
2370
3191
|
var angle = deg(180);
|
|
2371
3192
|
var stops = [];
|
|
2372
|
-
var type = 1 /* LINEAR_GRADIENT */;
|
|
2373
|
-
var shape = 0 /* CIRCLE */;
|
|
2374
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3193
|
+
var type = 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
3194
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3195
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2375
3196
|
var position = [];
|
|
2376
3197
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2377
3198
|
var firstToken = arg[0];
|
|
2378
3199
|
if (i === 0) {
|
|
2379
3200
|
if (isIdentToken(firstToken) && firstToken.value === 'linear') {
|
|
2380
|
-
type = 1 /* LINEAR_GRADIENT */;
|
|
3201
|
+
type = 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
2381
3202
|
return;
|
|
2382
3203
|
}
|
|
2383
3204
|
else if (isIdentToken(firstToken) && firstToken.value === 'radial') {
|
|
2384
|
-
type = 2 /* RADIAL_GRADIENT */;
|
|
3205
|
+
type = 2 /* CSSImageType.RADIAL_GRADIENT */;
|
|
2385
3206
|
return;
|
|
2386
3207
|
}
|
|
2387
3208
|
}
|
|
2388
|
-
if (firstToken.type === 18 /* FUNCTION */) {
|
|
3209
|
+
if (firstToken.type === 18 /* TokenType.FUNCTION */) {
|
|
2389
3210
|
if (firstToken.name === 'from') {
|
|
2390
3211
|
var color = color$1.parse(context, firstToken.values[0]);
|
|
2391
3212
|
stops.push({ stop: ZERO_LENGTH, color: color });
|
|
@@ -2401,7 +3222,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2401
3222
|
var stop_1 = values[0];
|
|
2402
3223
|
if (isNumberToken(stop_1)) {
|
|
2403
3224
|
stops.push({
|
|
2404
|
-
stop: { type: 16 /* PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
|
|
3225
|
+
stop: { type: 16 /* TokenType.PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
|
|
2405
3226
|
color: color
|
|
2406
3227
|
});
|
|
2407
3228
|
}
|
|
@@ -2409,7 +3230,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2409
3230
|
}
|
|
2410
3231
|
}
|
|
2411
3232
|
});
|
|
2412
|
-
return type === 1 /* LINEAR_GRADIENT */
|
|
3233
|
+
return type === 1 /* CSSImageType.LINEAR_GRADIENT */
|
|
2413
3234
|
? {
|
|
2414
3235
|
angle: (angle + deg(180)) % deg(360),
|
|
2415
3236
|
stops: stops,
|
|
@@ -2427,8 +3248,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2427
3248
|
var COVER = 'cover';
|
|
2428
3249
|
var CONTAIN = 'contain';
|
|
2429
3250
|
var radialGradient = function (context, tokens) {
|
|
2430
|
-
var shape = 0 /* CIRCLE */;
|
|
2431
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3251
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3252
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2432
3253
|
var stops = [];
|
|
2433
3254
|
var position = [];
|
|
2434
3255
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
@@ -2459,27 +3280,27 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2459
3280
|
else if (isIdentToken(token)) {
|
|
2460
3281
|
switch (token.value) {
|
|
2461
3282
|
case CIRCLE:
|
|
2462
|
-
shape = 0 /* CIRCLE */;
|
|
3283
|
+
shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
2463
3284
|
return false;
|
|
2464
3285
|
case ELLIPSE:
|
|
2465
|
-
shape = 1 /* ELLIPSE */;
|
|
3286
|
+
shape = 1 /* CSSRadialShape.ELLIPSE */;
|
|
2466
3287
|
return false;
|
|
2467
3288
|
case 'at':
|
|
2468
3289
|
isAtPosition_1 = true;
|
|
2469
3290
|
return false;
|
|
2470
3291
|
case CLOSEST_SIDE:
|
|
2471
|
-
size = 0 /* CLOSEST_SIDE */;
|
|
3292
|
+
size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
|
|
2472
3293
|
return false;
|
|
2473
3294
|
case COVER:
|
|
2474
3295
|
case FARTHEST_SIDE:
|
|
2475
|
-
size = 1 /* FARTHEST_SIDE */;
|
|
3296
|
+
size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
|
|
2476
3297
|
return false;
|
|
2477
3298
|
case CONTAIN:
|
|
2478
3299
|
case CLOSEST_CORNER:
|
|
2479
|
-
size = 2 /* CLOSEST_CORNER */;
|
|
3300
|
+
size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
|
|
2480
3301
|
return false;
|
|
2481
3302
|
case FARTHEST_CORNER:
|
|
2482
|
-
size = 3 /* FARTHEST_CORNER */;
|
|
3303
|
+
size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2483
3304
|
return false;
|
|
2484
3305
|
}
|
|
2485
3306
|
}
|
|
@@ -2498,12 +3319,12 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2498
3319
|
stops.push(colorStop);
|
|
2499
3320
|
}
|
|
2500
3321
|
});
|
|
2501
|
-
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
|
|
3322
|
+
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* CSSImageType.RADIAL_GRADIENT */ };
|
|
2502
3323
|
};
|
|
2503
3324
|
|
|
2504
3325
|
var prefixRadialGradient = function (context, tokens) {
|
|
2505
|
-
var shape = 0 /* CIRCLE */;
|
|
2506
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3326
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3327
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2507
3328
|
var stops = [];
|
|
2508
3329
|
var position = [];
|
|
2509
3330
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
@@ -2537,24 +3358,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2537
3358
|
if (isIdentToken(token)) {
|
|
2538
3359
|
switch (token.value) {
|
|
2539
3360
|
case CIRCLE:
|
|
2540
|
-
shape = 0 /* CIRCLE */;
|
|
3361
|
+
shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
2541
3362
|
return false;
|
|
2542
3363
|
case ELLIPSE:
|
|
2543
|
-
shape = 1 /* ELLIPSE */;
|
|
3364
|
+
shape = 1 /* CSSRadialShape.ELLIPSE */;
|
|
2544
3365
|
return false;
|
|
2545
3366
|
case CONTAIN:
|
|
2546
3367
|
case CLOSEST_SIDE:
|
|
2547
|
-
size = 0 /* CLOSEST_SIDE */;
|
|
3368
|
+
size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
|
|
2548
3369
|
return false;
|
|
2549
3370
|
case FARTHEST_SIDE:
|
|
2550
|
-
size = 1 /* FARTHEST_SIDE */;
|
|
3371
|
+
size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
|
|
2551
3372
|
return false;
|
|
2552
3373
|
case CLOSEST_CORNER:
|
|
2553
|
-
size = 2 /* CLOSEST_CORNER */;
|
|
3374
|
+
size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
|
|
2554
3375
|
return false;
|
|
2555
3376
|
case COVER:
|
|
2556
3377
|
case FARTHEST_CORNER:
|
|
2557
|
-
size = 3 /* FARTHEST_CORNER */;
|
|
3378
|
+
size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2558
3379
|
return false;
|
|
2559
3380
|
}
|
|
2560
3381
|
}
|
|
@@ -2573,36 +3394,36 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2573
3394
|
stops.push(colorStop);
|
|
2574
3395
|
}
|
|
2575
3396
|
});
|
|
2576
|
-
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
|
|
3397
|
+
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* CSSImageType.RADIAL_GRADIENT */ };
|
|
2577
3398
|
};
|
|
2578
3399
|
|
|
2579
3400
|
var isLinearGradient = function (background) {
|
|
2580
|
-
return background.type === 1 /* LINEAR_GRADIENT */;
|
|
3401
|
+
return background.type === 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
2581
3402
|
};
|
|
2582
3403
|
var isRadialGradient = function (background) {
|
|
2583
|
-
return background.type === 2 /* RADIAL_GRADIENT */;
|
|
3404
|
+
return background.type === 2 /* CSSImageType.RADIAL_GRADIENT */;
|
|
2584
3405
|
};
|
|
2585
3406
|
var image = {
|
|
2586
3407
|
name: 'image',
|
|
2587
3408
|
parse: function (context, value) {
|
|
2588
|
-
if (value.type === 22 /* URL_TOKEN */) {
|
|
2589
|
-
var image_1 = { url: value.value, type: 0 /* URL */ };
|
|
3409
|
+
if (value.type === 22 /* TokenType.URL_TOKEN */) {
|
|
3410
|
+
var image_1 = { url: value.value, type: 0 /* CSSImageType.URL */ };
|
|
2590
3411
|
context.cache.addImage(value.value);
|
|
2591
3412
|
return image_1;
|
|
2592
3413
|
}
|
|
2593
|
-
if (value.type === 18 /* FUNCTION */) {
|
|
3414
|
+
if (value.type === 18 /* TokenType.FUNCTION */) {
|
|
2594
3415
|
var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name];
|
|
2595
3416
|
if (typeof imageFunction === 'undefined') {
|
|
2596
|
-
throw new Error("Attempting to parse an unsupported image function \""
|
|
3417
|
+
throw new Error("Attempting to parse an unsupported image function \"".concat(value.name, "\""));
|
|
2597
3418
|
}
|
|
2598
3419
|
return imageFunction(context, value.values);
|
|
2599
3420
|
}
|
|
2600
|
-
throw new Error("Unsupported image type "
|
|
3421
|
+
throw new Error("Unsupported image type ".concat(value.type));
|
|
2601
3422
|
}
|
|
2602
3423
|
};
|
|
2603
3424
|
function isSupportedImage(value) {
|
|
2604
|
-
return (!(value.type === 20 /* IDENT_TOKEN */ && value.value === 'none') &&
|
|
2605
|
-
(value.type !== 18 /* FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]));
|
|
3425
|
+
return (!(value.type === 20 /* TokenType.IDENT_TOKEN */ && value.value === 'none') &&
|
|
3426
|
+
(value.type !== 18 /* TokenType.FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]));
|
|
2606
3427
|
}
|
|
2607
3428
|
var SUPPORTED_IMAGE_FUNCTIONS = {
|
|
2608
3429
|
'linear-gradient': linearGradient,
|
|
@@ -2621,14 +3442,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2621
3442
|
var backgroundImage = {
|
|
2622
3443
|
name: 'background-image',
|
|
2623
3444
|
initialValue: 'none',
|
|
2624
|
-
type: 1 /* LIST */,
|
|
3445
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2625
3446
|
prefix: false,
|
|
2626
3447
|
parse: function (context, tokens) {
|
|
2627
3448
|
if (tokens.length === 0) {
|
|
2628
3449
|
return [];
|
|
2629
3450
|
}
|
|
2630
3451
|
var first = tokens[0];
|
|
2631
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
3452
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
2632
3453
|
return [];
|
|
2633
3454
|
}
|
|
2634
3455
|
return tokens
|
|
@@ -2641,18 +3462,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2641
3462
|
name: 'background-origin',
|
|
2642
3463
|
initialValue: 'border-box',
|
|
2643
3464
|
prefix: false,
|
|
2644
|
-
type: 1 /* LIST */,
|
|
3465
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2645
3466
|
parse: function (_context, tokens) {
|
|
2646
3467
|
return tokens.map(function (token) {
|
|
2647
3468
|
if (isIdentToken(token)) {
|
|
2648
3469
|
switch (token.value) {
|
|
2649
3470
|
case 'padding-box':
|
|
2650
|
-
return 1 /* PADDING_BOX */;
|
|
3471
|
+
return 1 /* BACKGROUND_ORIGIN.PADDING_BOX */;
|
|
2651
3472
|
case 'content-box':
|
|
2652
|
-
return 2 /* CONTENT_BOX */;
|
|
3473
|
+
return 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */;
|
|
2653
3474
|
}
|
|
2654
3475
|
}
|
|
2655
|
-
return 0 /* BORDER_BOX */;
|
|
3476
|
+
return 0 /* BACKGROUND_ORIGIN.BORDER_BOX */;
|
|
2656
3477
|
});
|
|
2657
3478
|
}
|
|
2658
3479
|
};
|
|
@@ -2660,7 +3481,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2660
3481
|
var backgroundPosition = {
|
|
2661
3482
|
name: 'background-position',
|
|
2662
3483
|
initialValue: '0% 0%',
|
|
2663
|
-
type: 1 /* LIST */,
|
|
3484
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2664
3485
|
prefix: false,
|
|
2665
3486
|
parse: function (_context, tokens) {
|
|
2666
3487
|
return parseFunctionArgs(tokens)
|
|
@@ -2673,7 +3494,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2673
3494
|
name: 'background-repeat',
|
|
2674
3495
|
initialValue: 'repeat',
|
|
2675
3496
|
prefix: false,
|
|
2676
|
-
type: 1 /* LIST */,
|
|
3497
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2677
3498
|
parse: function (_context, tokens) {
|
|
2678
3499
|
return parseFunctionArgs(tokens)
|
|
2679
3500
|
.map(function (values) {
|
|
@@ -2688,16 +3509,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2688
3509
|
var parseBackgroundRepeat = function (value) {
|
|
2689
3510
|
switch (value) {
|
|
2690
3511
|
case 'no-repeat':
|
|
2691
|
-
return 1 /* NO_REPEAT */;
|
|
3512
|
+
return 1 /* BACKGROUND_REPEAT.NO_REPEAT */;
|
|
2692
3513
|
case 'repeat-x':
|
|
2693
3514
|
case 'repeat no-repeat':
|
|
2694
|
-
return 2 /* REPEAT_X */;
|
|
3515
|
+
return 2 /* BACKGROUND_REPEAT.REPEAT_X */;
|
|
2695
3516
|
case 'repeat-y':
|
|
2696
3517
|
case 'no-repeat repeat':
|
|
2697
|
-
return 3 /* REPEAT_Y */;
|
|
3518
|
+
return 3 /* BACKGROUND_REPEAT.REPEAT_Y */;
|
|
2698
3519
|
case 'repeat':
|
|
2699
3520
|
default:
|
|
2700
|
-
return 0 /* REPEAT */;
|
|
3521
|
+
return 0 /* BACKGROUND_REPEAT.REPEAT */;
|
|
2701
3522
|
}
|
|
2702
3523
|
};
|
|
2703
3524
|
|
|
@@ -2711,7 +3532,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2711
3532
|
name: 'background-size',
|
|
2712
3533
|
initialValue: '0',
|
|
2713
3534
|
prefix: false,
|
|
2714
|
-
type: 1 /* LIST */,
|
|
3535
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2715
3536
|
parse: function (_context, tokens) {
|
|
2716
3537
|
return parseFunctionArgs(tokens).map(function (values) { return values.filter(isBackgroundSizeInfoToken); });
|
|
2717
3538
|
}
|
|
@@ -2721,10 +3542,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2721
3542
|
};
|
|
2722
3543
|
|
|
2723
3544
|
var borderColorForSide = function (side) { return ({
|
|
2724
|
-
name: "border-"
|
|
3545
|
+
name: "border-".concat(side, "-color"),
|
|
2725
3546
|
initialValue: 'transparent',
|
|
2726
3547
|
prefix: false,
|
|
2727
|
-
type: 3 /* TYPE_VALUE */,
|
|
3548
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2728
3549
|
format: 'color'
|
|
2729
3550
|
}); };
|
|
2730
3551
|
var borderTopColor = borderColorForSide('top');
|
|
@@ -2733,10 +3554,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2733
3554
|
var borderLeftColor = borderColorForSide('left');
|
|
2734
3555
|
|
|
2735
3556
|
var borderRadiusForSide = function (side) { return ({
|
|
2736
|
-
name: "border-radius-"
|
|
3557
|
+
name: "border-radius-".concat(side),
|
|
2737
3558
|
initialValue: '0 0',
|
|
2738
3559
|
prefix: false,
|
|
2739
|
-
type: 1 /* LIST */,
|
|
3560
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2740
3561
|
parse: function (_context, tokens) {
|
|
2741
3562
|
return parseLengthPercentageTuple(tokens.filter(isLengthPercentage));
|
|
2742
3563
|
}
|
|
@@ -2747,22 +3568,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2747
3568
|
var borderBottomLeftRadius = borderRadiusForSide('bottom-left');
|
|
2748
3569
|
|
|
2749
3570
|
var borderStyleForSide = function (side) { return ({
|
|
2750
|
-
name: "border-"
|
|
3571
|
+
name: "border-".concat(side, "-style"),
|
|
2751
3572
|
initialValue: 'solid',
|
|
2752
3573
|
prefix: false,
|
|
2753
|
-
type: 2 /* IDENT_VALUE */,
|
|
3574
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2754
3575
|
parse: function (_context, style) {
|
|
2755
3576
|
switch (style) {
|
|
2756
3577
|
case 'none':
|
|
2757
|
-
return 0 /* NONE */;
|
|
3578
|
+
return 0 /* BORDER_STYLE.NONE */;
|
|
2758
3579
|
case 'dashed':
|
|
2759
|
-
return 2 /* DASHED */;
|
|
3580
|
+
return 2 /* BORDER_STYLE.DASHED */;
|
|
2760
3581
|
case 'dotted':
|
|
2761
|
-
return 3 /* DOTTED */;
|
|
3582
|
+
return 3 /* BORDER_STYLE.DOTTED */;
|
|
2762
3583
|
case 'double':
|
|
2763
|
-
return 4 /* DOUBLE */;
|
|
3584
|
+
return 4 /* BORDER_STYLE.DOUBLE */;
|
|
2764
3585
|
}
|
|
2765
|
-
return 1 /* SOLID */;
|
|
3586
|
+
return 1 /* BORDER_STYLE.SOLID */;
|
|
2766
3587
|
}
|
|
2767
3588
|
}); };
|
|
2768
3589
|
var borderTopStyle = borderStyleForSide('top');
|
|
@@ -2771,9 +3592,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2771
3592
|
var borderLeftStyle = borderStyleForSide('left');
|
|
2772
3593
|
|
|
2773
3594
|
var borderWidthForSide = function (side) { return ({
|
|
2774
|
-
name: "border-"
|
|
3595
|
+
name: "border-".concat(side, "-width"),
|
|
2775
3596
|
initialValue: '0',
|
|
2776
|
-
type: 0 /* VALUE */,
|
|
3597
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2777
3598
|
prefix: false,
|
|
2778
3599
|
parse: function (_context, token) {
|
|
2779
3600
|
if (isDimensionToken(token)) {
|
|
@@ -2791,7 +3612,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2791
3612
|
name: "color",
|
|
2792
3613
|
initialValue: 'transparent',
|
|
2793
3614
|
prefix: false,
|
|
2794
|
-
type: 3 /* TYPE_VALUE */,
|
|
3615
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2795
3616
|
format: 'color'
|
|
2796
3617
|
};
|
|
2797
3618
|
|
|
@@ -2799,14 +3620,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2799
3620
|
name: 'direction',
|
|
2800
3621
|
initialValue: 'ltr',
|
|
2801
3622
|
prefix: false,
|
|
2802
|
-
type: 2 /* IDENT_VALUE */,
|
|
3623
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2803
3624
|
parse: function (_context, direction) {
|
|
2804
3625
|
switch (direction) {
|
|
2805
3626
|
case 'rtl':
|
|
2806
|
-
return 1 /* RTL */;
|
|
3627
|
+
return 1 /* DIRECTION.RTL */;
|
|
2807
3628
|
case 'ltr':
|
|
2808
3629
|
default:
|
|
2809
|
-
return 0 /* LTR */;
|
|
3630
|
+
return 0 /* DIRECTION.LTR */;
|
|
2810
3631
|
}
|
|
2811
3632
|
}
|
|
2812
3633
|
};
|
|
@@ -2815,97 +3636,97 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2815
3636
|
name: 'display',
|
|
2816
3637
|
initialValue: 'inline-block',
|
|
2817
3638
|
prefix: false,
|
|
2818
|
-
type: 1 /* LIST */,
|
|
3639
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2819
3640
|
parse: function (_context, tokens) {
|
|
2820
3641
|
return tokens.filter(isIdentToken).reduce(function (bit, token) {
|
|
2821
|
-
return bit | parseDisplayValue(token.value);
|
|
2822
|
-
}, 0 /* NONE */);
|
|
3642
|
+
return bit | parseDisplayValue$1(token.value);
|
|
3643
|
+
}, 0 /* DISPLAY.NONE */);
|
|
2823
3644
|
}
|
|
2824
3645
|
};
|
|
2825
|
-
var parseDisplayValue = function (display) {
|
|
3646
|
+
var parseDisplayValue$1 = function (display) {
|
|
2826
3647
|
switch (display) {
|
|
2827
3648
|
case 'block':
|
|
2828
3649
|
case '-webkit-box':
|
|
2829
|
-
return 2 /* BLOCK */;
|
|
3650
|
+
return 2 /* DISPLAY.BLOCK */;
|
|
2830
3651
|
case 'inline':
|
|
2831
|
-
return 4 /* INLINE */;
|
|
3652
|
+
return 4 /* DISPLAY.INLINE */;
|
|
2832
3653
|
case 'run-in':
|
|
2833
|
-
return 8 /* RUN_IN */;
|
|
3654
|
+
return 8 /* DISPLAY.RUN_IN */;
|
|
2834
3655
|
case 'flow':
|
|
2835
|
-
return 16 /* FLOW */;
|
|
3656
|
+
return 16 /* DISPLAY.FLOW */;
|
|
2836
3657
|
case 'flow-root':
|
|
2837
|
-
return 32 /* FLOW_ROOT */;
|
|
3658
|
+
return 32 /* DISPLAY.FLOW_ROOT */;
|
|
2838
3659
|
case 'table':
|
|
2839
|
-
return 64 /* TABLE */;
|
|
3660
|
+
return 64 /* DISPLAY.TABLE */;
|
|
2840
3661
|
case 'flex':
|
|
2841
3662
|
case '-webkit-flex':
|
|
2842
|
-
return 128 /* FLEX */;
|
|
3663
|
+
return 128 /* DISPLAY.FLEX */;
|
|
2843
3664
|
case 'grid':
|
|
2844
3665
|
case '-ms-grid':
|
|
2845
|
-
return 256 /* GRID */;
|
|
3666
|
+
return 256 /* DISPLAY.GRID */;
|
|
2846
3667
|
case 'ruby':
|
|
2847
|
-
return 512 /* RUBY */;
|
|
3668
|
+
return 512 /* DISPLAY.RUBY */;
|
|
2848
3669
|
case 'subgrid':
|
|
2849
|
-
return 1024 /* SUBGRID */;
|
|
3670
|
+
return 1024 /* DISPLAY.SUBGRID */;
|
|
2850
3671
|
case 'list-item':
|
|
2851
|
-
return 2048 /* LIST_ITEM */;
|
|
3672
|
+
return 2048 /* DISPLAY.LIST_ITEM */;
|
|
2852
3673
|
case 'table-row-group':
|
|
2853
|
-
return 4096 /* TABLE_ROW_GROUP */;
|
|
3674
|
+
return 4096 /* DISPLAY.TABLE_ROW_GROUP */;
|
|
2854
3675
|
case 'table-header-group':
|
|
2855
|
-
return 8192 /* TABLE_HEADER_GROUP */;
|
|
3676
|
+
return 8192 /* DISPLAY.TABLE_HEADER_GROUP */;
|
|
2856
3677
|
case 'table-footer-group':
|
|
2857
|
-
return 16384 /* TABLE_FOOTER_GROUP */;
|
|
3678
|
+
return 16384 /* DISPLAY.TABLE_FOOTER_GROUP */;
|
|
2858
3679
|
case 'table-row':
|
|
2859
|
-
return 32768 /* TABLE_ROW */;
|
|
3680
|
+
return 32768 /* DISPLAY.TABLE_ROW */;
|
|
2860
3681
|
case 'table-cell':
|
|
2861
|
-
return 65536 /* TABLE_CELL */;
|
|
3682
|
+
return 65536 /* DISPLAY.TABLE_CELL */;
|
|
2862
3683
|
case 'table-column-group':
|
|
2863
|
-
return 131072 /* TABLE_COLUMN_GROUP */;
|
|
3684
|
+
return 131072 /* DISPLAY.TABLE_COLUMN_GROUP */;
|
|
2864
3685
|
case 'table-column':
|
|
2865
|
-
return 262144 /* TABLE_COLUMN */;
|
|
3686
|
+
return 262144 /* DISPLAY.TABLE_COLUMN */;
|
|
2866
3687
|
case 'table-caption':
|
|
2867
|
-
return 524288 /* TABLE_CAPTION */;
|
|
3688
|
+
return 524288 /* DISPLAY.TABLE_CAPTION */;
|
|
2868
3689
|
case 'ruby-base':
|
|
2869
|
-
return 1048576 /* RUBY_BASE */;
|
|
3690
|
+
return 1048576 /* DISPLAY.RUBY_BASE */;
|
|
2870
3691
|
case 'ruby-text':
|
|
2871
|
-
return 2097152 /* RUBY_TEXT */;
|
|
3692
|
+
return 2097152 /* DISPLAY.RUBY_TEXT */;
|
|
2872
3693
|
case 'ruby-base-container':
|
|
2873
|
-
return 4194304 /* RUBY_BASE_CONTAINER */;
|
|
3694
|
+
return 4194304 /* DISPLAY.RUBY_BASE_CONTAINER */;
|
|
2874
3695
|
case 'ruby-text-container':
|
|
2875
|
-
return 8388608 /* RUBY_TEXT_CONTAINER */;
|
|
3696
|
+
return 8388608 /* DISPLAY.RUBY_TEXT_CONTAINER */;
|
|
2876
3697
|
case 'contents':
|
|
2877
|
-
return 16777216 /* CONTENTS */;
|
|
3698
|
+
return 16777216 /* DISPLAY.CONTENTS */;
|
|
2878
3699
|
case 'inline-block':
|
|
2879
|
-
return 33554432 /* INLINE_BLOCK */;
|
|
3700
|
+
return 33554432 /* DISPLAY.INLINE_BLOCK */;
|
|
2880
3701
|
case 'inline-list-item':
|
|
2881
|
-
return 67108864 /* INLINE_LIST_ITEM */;
|
|
3702
|
+
return 67108864 /* DISPLAY.INLINE_LIST_ITEM */;
|
|
2882
3703
|
case 'inline-table':
|
|
2883
|
-
return 134217728 /* INLINE_TABLE */;
|
|
3704
|
+
return 134217728 /* DISPLAY.INLINE_TABLE */;
|
|
2884
3705
|
case 'inline-flex':
|
|
2885
|
-
return 268435456 /* INLINE_FLEX */;
|
|
3706
|
+
return 268435456 /* DISPLAY.INLINE_FLEX */;
|
|
2886
3707
|
case 'inline-grid':
|
|
2887
|
-
return 536870912 /* INLINE_GRID */;
|
|
3708
|
+
return 536870912 /* DISPLAY.INLINE_GRID */;
|
|
2888
3709
|
}
|
|
2889
|
-
return 0 /* NONE */;
|
|
3710
|
+
return 0 /* DISPLAY.NONE */;
|
|
2890
3711
|
};
|
|
2891
3712
|
|
|
2892
3713
|
var float = {
|
|
2893
3714
|
name: 'float',
|
|
2894
3715
|
initialValue: 'none',
|
|
2895
3716
|
prefix: false,
|
|
2896
|
-
type: 2 /* IDENT_VALUE */,
|
|
3717
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2897
3718
|
parse: function (_context, float) {
|
|
2898
3719
|
switch (float) {
|
|
2899
3720
|
case 'left':
|
|
2900
|
-
return 1 /* LEFT */;
|
|
3721
|
+
return 1 /* FLOAT.LEFT */;
|
|
2901
3722
|
case 'right':
|
|
2902
|
-
return 2 /* RIGHT */;
|
|
3723
|
+
return 2 /* FLOAT.RIGHT */;
|
|
2903
3724
|
case 'inline-start':
|
|
2904
|
-
return 3 /* INLINE_START */;
|
|
3725
|
+
return 3 /* FLOAT.INLINE_START */;
|
|
2905
3726
|
case 'inline-end':
|
|
2906
|
-
return 4 /* INLINE_END */;
|
|
3727
|
+
return 4 /* FLOAT.INLINE_END */;
|
|
2907
3728
|
}
|
|
2908
|
-
return 0 /* NONE */;
|
|
3729
|
+
return 0 /* FLOAT.NONE */;
|
|
2909
3730
|
}
|
|
2910
3731
|
};
|
|
2911
3732
|
|
|
@@ -2913,15 +3734,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2913
3734
|
name: 'letter-spacing',
|
|
2914
3735
|
initialValue: '0',
|
|
2915
3736
|
prefix: false,
|
|
2916
|
-
type: 0 /* VALUE */,
|
|
3737
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2917
3738
|
parse: function (_context, token) {
|
|
2918
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'normal') {
|
|
3739
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'normal') {
|
|
2919
3740
|
return 0;
|
|
2920
3741
|
}
|
|
2921
|
-
if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
3742
|
+
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
2922
3743
|
return token.number;
|
|
2923
3744
|
}
|
|
2924
|
-
if (token.type === 15 /* DIMENSION_TOKEN */) {
|
|
3745
|
+
if (token.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
2925
3746
|
return token.number;
|
|
2926
3747
|
}
|
|
2927
3748
|
return 0;
|
|
@@ -2937,7 +3758,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2937
3758
|
name: 'line-break',
|
|
2938
3759
|
initialValue: 'normal',
|
|
2939
3760
|
prefix: false,
|
|
2940
|
-
type: 2 /* IDENT_VALUE */,
|
|
3761
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2941
3762
|
parse: function (_context, lineBreak) {
|
|
2942
3763
|
switch (lineBreak) {
|
|
2943
3764
|
case 'strict':
|
|
@@ -2953,13 +3774,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2953
3774
|
name: 'line-height',
|
|
2954
3775
|
initialValue: 'normal',
|
|
2955
3776
|
prefix: false,
|
|
2956
|
-
type: 4 /* TOKEN_VALUE */
|
|
3777
|
+
type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
|
|
2957
3778
|
};
|
|
2958
3779
|
var computeLineHeight = function (token, fontSize) {
|
|
2959
3780
|
if (isIdentToken(token) && token.value === 'normal') {
|
|
2960
3781
|
return 1.2 * fontSize;
|
|
2961
3782
|
}
|
|
2962
|
-
else if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
3783
|
+
else if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
2963
3784
|
return fontSize * token.number;
|
|
2964
3785
|
}
|
|
2965
3786
|
else if (isLengthPercentage(token)) {
|
|
@@ -2971,10 +3792,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2971
3792
|
var listStyleImage = {
|
|
2972
3793
|
name: 'list-style-image',
|
|
2973
3794
|
initialValue: 'none',
|
|
2974
|
-
type: 0 /* VALUE */,
|
|
3795
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2975
3796
|
prefix: false,
|
|
2976
3797
|
parse: function (context, token) {
|
|
2977
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
|
|
3798
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
|
|
2978
3799
|
return null;
|
|
2979
3800
|
}
|
|
2980
3801
|
return image.parse(context, token);
|
|
@@ -2985,14 +3806,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2985
3806
|
name: 'list-style-position',
|
|
2986
3807
|
initialValue: 'outside',
|
|
2987
3808
|
prefix: false,
|
|
2988
|
-
type: 2 /* IDENT_VALUE */,
|
|
3809
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2989
3810
|
parse: function (_context, position) {
|
|
2990
3811
|
switch (position) {
|
|
2991
3812
|
case 'inside':
|
|
2992
|
-
return 0 /* INSIDE */;
|
|
3813
|
+
return 0 /* LIST_STYLE_POSITION.INSIDE */;
|
|
2993
3814
|
case 'outside':
|
|
2994
3815
|
default:
|
|
2995
|
-
return 1 /* OUTSIDE */;
|
|
3816
|
+
return 1 /* LIST_STYLE_POSITION.OUTSIDE */;
|
|
2996
3817
|
}
|
|
2997
3818
|
}
|
|
2998
3819
|
};
|
|
@@ -3001,127 +3822,127 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3001
3822
|
name: 'list-style-type',
|
|
3002
3823
|
initialValue: 'none',
|
|
3003
3824
|
prefix: false,
|
|
3004
|
-
type: 2 /* IDENT_VALUE */,
|
|
3825
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3005
3826
|
parse: function (_context, type) {
|
|
3006
3827
|
switch (type) {
|
|
3007
3828
|
case 'disc':
|
|
3008
|
-
return 0 /* DISC */;
|
|
3829
|
+
return 0 /* LIST_STYLE_TYPE.DISC */;
|
|
3009
3830
|
case 'circle':
|
|
3010
|
-
return 1 /* CIRCLE */;
|
|
3831
|
+
return 1 /* LIST_STYLE_TYPE.CIRCLE */;
|
|
3011
3832
|
case 'square':
|
|
3012
|
-
return 2 /* SQUARE */;
|
|
3833
|
+
return 2 /* LIST_STYLE_TYPE.SQUARE */;
|
|
3013
3834
|
case 'decimal':
|
|
3014
|
-
return 3 /* DECIMAL */;
|
|
3835
|
+
return 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
3015
3836
|
case 'cjk-decimal':
|
|
3016
|
-
return 4 /* CJK_DECIMAL */;
|
|
3837
|
+
return 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */;
|
|
3017
3838
|
case 'decimal-leading-zero':
|
|
3018
|
-
return 5 /* DECIMAL_LEADING_ZERO */;
|
|
3839
|
+
return 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */;
|
|
3019
3840
|
case 'lower-roman':
|
|
3020
|
-
return 6 /* LOWER_ROMAN */;
|
|
3841
|
+
return 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */;
|
|
3021
3842
|
case 'upper-roman':
|
|
3022
|
-
return 7 /* UPPER_ROMAN */;
|
|
3843
|
+
return 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */;
|
|
3023
3844
|
case 'lower-greek':
|
|
3024
|
-
return 8 /* LOWER_GREEK */;
|
|
3845
|
+
return 8 /* LIST_STYLE_TYPE.LOWER_GREEK */;
|
|
3025
3846
|
case 'lower-alpha':
|
|
3026
|
-
return 9 /* LOWER_ALPHA */;
|
|
3847
|
+
return 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */;
|
|
3027
3848
|
case 'upper-alpha':
|
|
3028
|
-
return 10 /* UPPER_ALPHA */;
|
|
3849
|
+
return 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */;
|
|
3029
3850
|
case 'arabic-indic':
|
|
3030
|
-
return 11 /* ARABIC_INDIC */;
|
|
3851
|
+
return 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */;
|
|
3031
3852
|
case 'armenian':
|
|
3032
|
-
return 12 /* ARMENIAN */;
|
|
3853
|
+
return 12 /* LIST_STYLE_TYPE.ARMENIAN */;
|
|
3033
3854
|
case 'bengali':
|
|
3034
|
-
return 13 /* BENGALI */;
|
|
3855
|
+
return 13 /* LIST_STYLE_TYPE.BENGALI */;
|
|
3035
3856
|
case 'cambodian':
|
|
3036
|
-
return 14 /* CAMBODIAN */;
|
|
3857
|
+
return 14 /* LIST_STYLE_TYPE.CAMBODIAN */;
|
|
3037
3858
|
case 'cjk-earthly-branch':
|
|
3038
|
-
return 15 /* CJK_EARTHLY_BRANCH */;
|
|
3859
|
+
return 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */;
|
|
3039
3860
|
case 'cjk-heavenly-stem':
|
|
3040
|
-
return 16 /* CJK_HEAVENLY_STEM */;
|
|
3861
|
+
return 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */;
|
|
3041
3862
|
case 'cjk-ideographic':
|
|
3042
|
-
return 17 /* CJK_IDEOGRAPHIC */;
|
|
3863
|
+
return 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */;
|
|
3043
3864
|
case 'devanagari':
|
|
3044
|
-
return 18 /* DEVANAGARI */;
|
|
3865
|
+
return 18 /* LIST_STYLE_TYPE.DEVANAGARI */;
|
|
3045
3866
|
case 'ethiopic-numeric':
|
|
3046
|
-
return 19 /* ETHIOPIC_NUMERIC */;
|
|
3867
|
+
return 19 /* LIST_STYLE_TYPE.ETHIOPIC_NUMERIC */;
|
|
3047
3868
|
case 'georgian':
|
|
3048
|
-
return 20 /* GEORGIAN */;
|
|
3869
|
+
return 20 /* LIST_STYLE_TYPE.GEORGIAN */;
|
|
3049
3870
|
case 'gujarati':
|
|
3050
|
-
return 21 /* GUJARATI */;
|
|
3871
|
+
return 21 /* LIST_STYLE_TYPE.GUJARATI */;
|
|
3051
3872
|
case 'gurmukhi':
|
|
3052
|
-
return 22 /* GURMUKHI */;
|
|
3873
|
+
return 22 /* LIST_STYLE_TYPE.GURMUKHI */;
|
|
3053
3874
|
case 'hebrew':
|
|
3054
|
-
return 22 /* HEBREW */;
|
|
3875
|
+
return 22 /* LIST_STYLE_TYPE.HEBREW */;
|
|
3055
3876
|
case 'hiragana':
|
|
3056
|
-
return 23 /* HIRAGANA */;
|
|
3877
|
+
return 23 /* LIST_STYLE_TYPE.HIRAGANA */;
|
|
3057
3878
|
case 'hiragana-iroha':
|
|
3058
|
-
return 24 /* HIRAGANA_IROHA */;
|
|
3879
|
+
return 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */;
|
|
3059
3880
|
case 'japanese-formal':
|
|
3060
|
-
return 25 /* JAPANESE_FORMAL */;
|
|
3881
|
+
return 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */;
|
|
3061
3882
|
case 'japanese-informal':
|
|
3062
|
-
return 26 /* JAPANESE_INFORMAL */;
|
|
3883
|
+
return 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */;
|
|
3063
3884
|
case 'kannada':
|
|
3064
|
-
return 27 /* KANNADA */;
|
|
3885
|
+
return 27 /* LIST_STYLE_TYPE.KANNADA */;
|
|
3065
3886
|
case 'katakana':
|
|
3066
|
-
return 28 /* KATAKANA */;
|
|
3887
|
+
return 28 /* LIST_STYLE_TYPE.KATAKANA */;
|
|
3067
3888
|
case 'katakana-iroha':
|
|
3068
|
-
return 29 /* KATAKANA_IROHA */;
|
|
3889
|
+
return 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */;
|
|
3069
3890
|
case 'khmer':
|
|
3070
|
-
return 30 /* KHMER */;
|
|
3891
|
+
return 30 /* LIST_STYLE_TYPE.KHMER */;
|
|
3071
3892
|
case 'korean-hangul-formal':
|
|
3072
|
-
return 31 /* KOREAN_HANGUL_FORMAL */;
|
|
3893
|
+
return 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */;
|
|
3073
3894
|
case 'korean-hanja-formal':
|
|
3074
|
-
return 32 /* KOREAN_HANJA_FORMAL */;
|
|
3895
|
+
return 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */;
|
|
3075
3896
|
case 'korean-hanja-informal':
|
|
3076
|
-
return 33 /* KOREAN_HANJA_INFORMAL */;
|
|
3897
|
+
return 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */;
|
|
3077
3898
|
case 'lao':
|
|
3078
|
-
return 34 /* LAO */;
|
|
3899
|
+
return 34 /* LIST_STYLE_TYPE.LAO */;
|
|
3079
3900
|
case 'lower-armenian':
|
|
3080
|
-
return 35 /* LOWER_ARMENIAN */;
|
|
3901
|
+
return 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */;
|
|
3081
3902
|
case 'malayalam':
|
|
3082
|
-
return 36 /* MALAYALAM */;
|
|
3903
|
+
return 36 /* LIST_STYLE_TYPE.MALAYALAM */;
|
|
3083
3904
|
case 'mongolian':
|
|
3084
|
-
return 37 /* MONGOLIAN */;
|
|
3905
|
+
return 37 /* LIST_STYLE_TYPE.MONGOLIAN */;
|
|
3085
3906
|
case 'myanmar':
|
|
3086
|
-
return 38 /* MYANMAR */;
|
|
3907
|
+
return 38 /* LIST_STYLE_TYPE.MYANMAR */;
|
|
3087
3908
|
case 'oriya':
|
|
3088
|
-
return 39 /* ORIYA */;
|
|
3909
|
+
return 39 /* LIST_STYLE_TYPE.ORIYA */;
|
|
3089
3910
|
case 'persian':
|
|
3090
|
-
return 40 /* PERSIAN */;
|
|
3911
|
+
return 40 /* LIST_STYLE_TYPE.PERSIAN */;
|
|
3091
3912
|
case 'simp-chinese-formal':
|
|
3092
|
-
return 41 /* SIMP_CHINESE_FORMAL */;
|
|
3913
|
+
return 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */;
|
|
3093
3914
|
case 'simp-chinese-informal':
|
|
3094
|
-
return 42 /* SIMP_CHINESE_INFORMAL */;
|
|
3915
|
+
return 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */;
|
|
3095
3916
|
case 'tamil':
|
|
3096
|
-
return 43 /* TAMIL */;
|
|
3917
|
+
return 43 /* LIST_STYLE_TYPE.TAMIL */;
|
|
3097
3918
|
case 'telugu':
|
|
3098
|
-
return 44 /* TELUGU */;
|
|
3919
|
+
return 44 /* LIST_STYLE_TYPE.TELUGU */;
|
|
3099
3920
|
case 'thai':
|
|
3100
|
-
return 45 /* THAI */;
|
|
3921
|
+
return 45 /* LIST_STYLE_TYPE.THAI */;
|
|
3101
3922
|
case 'tibetan':
|
|
3102
|
-
return 46 /* TIBETAN */;
|
|
3923
|
+
return 46 /* LIST_STYLE_TYPE.TIBETAN */;
|
|
3103
3924
|
case 'trad-chinese-formal':
|
|
3104
|
-
return 47 /* TRAD_CHINESE_FORMAL */;
|
|
3925
|
+
return 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */;
|
|
3105
3926
|
case 'trad-chinese-informal':
|
|
3106
|
-
return 48 /* TRAD_CHINESE_INFORMAL */;
|
|
3927
|
+
return 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */;
|
|
3107
3928
|
case 'upper-armenian':
|
|
3108
|
-
return 49 /* UPPER_ARMENIAN */;
|
|
3929
|
+
return 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */;
|
|
3109
3930
|
case 'disclosure-open':
|
|
3110
|
-
return 50 /* DISCLOSURE_OPEN */;
|
|
3931
|
+
return 50 /* LIST_STYLE_TYPE.DISCLOSURE_OPEN */;
|
|
3111
3932
|
case 'disclosure-closed':
|
|
3112
|
-
return 51 /* DISCLOSURE_CLOSED */;
|
|
3933
|
+
return 51 /* LIST_STYLE_TYPE.DISCLOSURE_CLOSED */;
|
|
3113
3934
|
case 'none':
|
|
3114
3935
|
default:
|
|
3115
|
-
return -1 /* NONE */;
|
|
3936
|
+
return -1 /* LIST_STYLE_TYPE.NONE */;
|
|
3116
3937
|
}
|
|
3117
3938
|
}
|
|
3118
3939
|
};
|
|
3119
3940
|
|
|
3120
3941
|
var marginForSide = function (side) { return ({
|
|
3121
|
-
name: "margin-"
|
|
3942
|
+
name: "margin-".concat(side),
|
|
3122
3943
|
initialValue: '0',
|
|
3123
3944
|
prefix: false,
|
|
3124
|
-
type: 4 /* TOKEN_VALUE */
|
|
3945
|
+
type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
|
|
3125
3946
|
}); };
|
|
3126
3947
|
var marginTop = marginForSide('top');
|
|
3127
3948
|
var marginRight = marginForSide('right');
|
|
@@ -3132,21 +3953,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3132
3953
|
name: 'overflow',
|
|
3133
3954
|
initialValue: 'visible',
|
|
3134
3955
|
prefix: false,
|
|
3135
|
-
type: 1 /* LIST */,
|
|
3956
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3136
3957
|
parse: function (_context, tokens) {
|
|
3137
3958
|
return tokens.filter(isIdentToken).map(function (overflow) {
|
|
3138
3959
|
switch (overflow.value) {
|
|
3139
3960
|
case 'hidden':
|
|
3140
|
-
return 1 /* HIDDEN */;
|
|
3961
|
+
return 1 /* OVERFLOW.HIDDEN */;
|
|
3141
3962
|
case 'scroll':
|
|
3142
|
-
return 2 /* SCROLL */;
|
|
3963
|
+
return 2 /* OVERFLOW.SCROLL */;
|
|
3143
3964
|
case 'clip':
|
|
3144
|
-
return 3 /* CLIP */;
|
|
3965
|
+
return 3 /* OVERFLOW.CLIP */;
|
|
3145
3966
|
case 'auto':
|
|
3146
|
-
return 4 /* AUTO */;
|
|
3967
|
+
return 4 /* OVERFLOW.AUTO */;
|
|
3147
3968
|
case 'visible':
|
|
3148
3969
|
default:
|
|
3149
|
-
return 0 /* VISIBLE */;
|
|
3970
|
+
return 0 /* OVERFLOW.VISIBLE */;
|
|
3150
3971
|
}
|
|
3151
3972
|
});
|
|
3152
3973
|
}
|
|
@@ -3156,23 +3977,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3156
3977
|
name: 'overflow-wrap',
|
|
3157
3978
|
initialValue: 'normal',
|
|
3158
3979
|
prefix: false,
|
|
3159
|
-
type: 2 /* IDENT_VALUE */,
|
|
3980
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3160
3981
|
parse: function (_context, overflow) {
|
|
3161
3982
|
switch (overflow) {
|
|
3162
3983
|
case 'break-word':
|
|
3163
|
-
return "break-word" /* BREAK_WORD */;
|
|
3984
|
+
return "break-word" /* OVERFLOW_WRAP.BREAK_WORD */;
|
|
3164
3985
|
case 'normal':
|
|
3165
3986
|
default:
|
|
3166
|
-
return "normal" /* NORMAL */;
|
|
3987
|
+
return "normal" /* OVERFLOW_WRAP.NORMAL */;
|
|
3167
3988
|
}
|
|
3168
3989
|
}
|
|
3169
3990
|
};
|
|
3170
3991
|
|
|
3171
3992
|
var paddingForSide = function (side) { return ({
|
|
3172
|
-
name: "padding-"
|
|
3993
|
+
name: "padding-".concat(side),
|
|
3173
3994
|
initialValue: '0',
|
|
3174
3995
|
prefix: false,
|
|
3175
|
-
type: 3 /* TYPE_VALUE */,
|
|
3996
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3176
3997
|
format: 'length-percentage'
|
|
3177
3998
|
}); };
|
|
3178
3999
|
var paddingTop = paddingForSide('top');
|
|
@@ -3184,17 +4005,17 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3184
4005
|
name: 'text-align',
|
|
3185
4006
|
initialValue: 'left',
|
|
3186
4007
|
prefix: false,
|
|
3187
|
-
type: 2 /* IDENT_VALUE */,
|
|
4008
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3188
4009
|
parse: function (_context, textAlign) {
|
|
3189
4010
|
switch (textAlign) {
|
|
3190
4011
|
case 'right':
|
|
3191
|
-
return 2 /* RIGHT */;
|
|
4012
|
+
return 2 /* TEXT_ALIGN.RIGHT */;
|
|
3192
4013
|
case 'center':
|
|
3193
4014
|
case 'justify':
|
|
3194
|
-
return 1 /* CENTER */;
|
|
4015
|
+
return 1 /* TEXT_ALIGN.CENTER */;
|
|
3195
4016
|
case 'left':
|
|
3196
4017
|
default:
|
|
3197
|
-
return 0 /* LEFT */;
|
|
4018
|
+
return 0 /* TEXT_ALIGN.LEFT */;
|
|
3198
4019
|
}
|
|
3199
4020
|
}
|
|
3200
4021
|
};
|
|
@@ -3203,26 +4024,26 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3203
4024
|
name: 'position',
|
|
3204
4025
|
initialValue: 'static',
|
|
3205
4026
|
prefix: false,
|
|
3206
|
-
type: 2 /* IDENT_VALUE */,
|
|
4027
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3207
4028
|
parse: function (_context, position) {
|
|
3208
4029
|
switch (position) {
|
|
3209
4030
|
case 'relative':
|
|
3210
|
-
return 1 /* RELATIVE */;
|
|
4031
|
+
return 1 /* POSITION.RELATIVE */;
|
|
3211
4032
|
case 'absolute':
|
|
3212
|
-
return 2 /* ABSOLUTE */;
|
|
4033
|
+
return 2 /* POSITION.ABSOLUTE */;
|
|
3213
4034
|
case 'fixed':
|
|
3214
|
-
return 3 /* FIXED */;
|
|
4035
|
+
return 3 /* POSITION.FIXED */;
|
|
3215
4036
|
case 'sticky':
|
|
3216
|
-
return 4 /* STICKY */;
|
|
4037
|
+
return 4 /* POSITION.STICKY */;
|
|
3217
4038
|
}
|
|
3218
|
-
return 0 /* STATIC */;
|
|
4039
|
+
return 0 /* POSITION.STATIC */;
|
|
3219
4040
|
}
|
|
3220
4041
|
};
|
|
3221
4042
|
|
|
3222
4043
|
var textShadow = {
|
|
3223
4044
|
name: 'text-shadow',
|
|
3224
4045
|
initialValue: 'none',
|
|
3225
|
-
type: 1 /* LIST */,
|
|
4046
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3226
4047
|
prefix: false,
|
|
3227
4048
|
parse: function (context, tokens) {
|
|
3228
4049
|
if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
|
|
@@ -3263,17 +4084,17 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3263
4084
|
name: 'text-transform',
|
|
3264
4085
|
initialValue: 'none',
|
|
3265
4086
|
prefix: false,
|
|
3266
|
-
type: 2 /* IDENT_VALUE */,
|
|
4087
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3267
4088
|
parse: function (_context, textTransform) {
|
|
3268
4089
|
switch (textTransform) {
|
|
3269
4090
|
case 'uppercase':
|
|
3270
|
-
return 2 /* UPPERCASE */;
|
|
4091
|
+
return 2 /* TEXT_TRANSFORM.UPPERCASE */;
|
|
3271
4092
|
case 'lowercase':
|
|
3272
|
-
return 1 /* LOWERCASE */;
|
|
4093
|
+
return 1 /* TEXT_TRANSFORM.LOWERCASE */;
|
|
3273
4094
|
case 'capitalize':
|
|
3274
|
-
return 3 /* CAPITALIZE */;
|
|
4095
|
+
return 3 /* TEXT_TRANSFORM.CAPITALIZE */;
|
|
3275
4096
|
}
|
|
3276
|
-
return 0 /* NONE */;
|
|
4097
|
+
return 0 /* TEXT_TRANSFORM.NONE */;
|
|
3277
4098
|
}
|
|
3278
4099
|
};
|
|
3279
4100
|
|
|
@@ -3281,15 +4102,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3281
4102
|
name: 'transform',
|
|
3282
4103
|
initialValue: 'none',
|
|
3283
4104
|
prefix: true,
|
|
3284
|
-
type: 0 /* VALUE */,
|
|
4105
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3285
4106
|
parse: function (_context, token) {
|
|
3286
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
|
|
4107
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
|
|
3287
4108
|
return null;
|
|
3288
4109
|
}
|
|
3289
|
-
if (token.type === 18 /* FUNCTION */) {
|
|
4110
|
+
if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
3290
4111
|
var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
|
|
3291
4112
|
if (typeof transformFunction === 'undefined') {
|
|
3292
|
-
throw new Error("Attempting to parse an unsupported transform function \""
|
|
4113
|
+
throw new Error("Attempting to parse an unsupported transform function \"".concat(token.name, "\""));
|
|
3293
4114
|
}
|
|
3294
4115
|
return transformFunction(token.values);
|
|
3295
4116
|
}
|
|
@@ -3297,12 +4118,12 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3297
4118
|
}
|
|
3298
4119
|
};
|
|
3299
4120
|
var matrix = function (args) {
|
|
3300
|
-
var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
4121
|
+
var values = args.filter(function (arg) { return arg.type === 17 /* TokenType.NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
3301
4122
|
return values.length === 6 ? values : null;
|
|
3302
4123
|
};
|
|
3303
4124
|
// doesn't support 3D transforms at the moment
|
|
3304
4125
|
var matrix3d = function (args) {
|
|
3305
|
-
var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
4126
|
+
var values = args.filter(function (arg) { return arg.type === 17 /* TokenType.NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
3306
4127
|
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;
|
|
3307
4128
|
};
|
|
3308
4129
|
var SUPPORTED_TRANSFORM_FUNCTIONS = {
|
|
@@ -3311,7 +4132,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3311
4132
|
};
|
|
3312
4133
|
|
|
3313
4134
|
var DEFAULT_VALUE = {
|
|
3314
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
4135
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
3315
4136
|
number: 50,
|
|
3316
4137
|
flags: FLAG_INTEGER
|
|
3317
4138
|
};
|
|
@@ -3320,7 +4141,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3320
4141
|
name: 'transform-origin',
|
|
3321
4142
|
initialValue: '50% 50%',
|
|
3322
4143
|
prefix: true,
|
|
3323
|
-
type: 1 /* LIST */,
|
|
4144
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3324
4145
|
parse: function (_context, tokens) {
|
|
3325
4146
|
var origins = tokens.filter(isLengthPercentage);
|
|
3326
4147
|
if (origins.length !== 2) {
|
|
@@ -3334,16 +4155,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3334
4155
|
name: 'visible',
|
|
3335
4156
|
initialValue: 'none',
|
|
3336
4157
|
prefix: false,
|
|
3337
|
-
type: 2 /* IDENT_VALUE */,
|
|
4158
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3338
4159
|
parse: function (_context, visibility) {
|
|
3339
4160
|
switch (visibility) {
|
|
3340
4161
|
case 'hidden':
|
|
3341
|
-
return 1 /* HIDDEN */;
|
|
4162
|
+
return 1 /* VISIBILITY.HIDDEN */;
|
|
3342
4163
|
case 'collapse':
|
|
3343
|
-
return 2 /* COLLAPSE */;
|
|
4164
|
+
return 2 /* VISIBILITY.COLLAPSE */;
|
|
3344
4165
|
case 'visible':
|
|
3345
4166
|
default:
|
|
3346
|
-
return 0 /* VISIBLE */;
|
|
4167
|
+
return 0 /* VISIBILITY.VISIBLE */;
|
|
3347
4168
|
}
|
|
3348
4169
|
}
|
|
3349
4170
|
};
|
|
@@ -3358,7 +4179,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3358
4179
|
name: 'word-break',
|
|
3359
4180
|
initialValue: 'normal',
|
|
3360
4181
|
prefix: false,
|
|
3361
|
-
type: 2 /* IDENT_VALUE */,
|
|
4182
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3362
4183
|
parse: function (_context, wordBreak) {
|
|
3363
4184
|
switch (wordBreak) {
|
|
3364
4185
|
case 'break-all':
|
|
@@ -3376,9 +4197,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3376
4197
|
name: 'z-index',
|
|
3377
4198
|
initialValue: 'auto',
|
|
3378
4199
|
prefix: false,
|
|
3379
|
-
type: 0 /* VALUE */,
|
|
4200
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3380
4201
|
parse: function (_context, token) {
|
|
3381
|
-
if (token.type === 20 /* IDENT_TOKEN */) {
|
|
4202
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
3382
4203
|
return { auto: true, order: 0 };
|
|
3383
4204
|
}
|
|
3384
4205
|
if (isNumberToken(token)) {
|
|
@@ -3391,7 +4212,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3391
4212
|
var time = {
|
|
3392
4213
|
name: 'time',
|
|
3393
4214
|
parse: function (_context, value) {
|
|
3394
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
4215
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
3395
4216
|
switch (value.unit.toLowerCase()) {
|
|
3396
4217
|
case 's':
|
|
3397
4218
|
return 1000 * value.number;
|
|
@@ -3406,7 +4227,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3406
4227
|
var opacity = {
|
|
3407
4228
|
name: 'opacity',
|
|
3408
4229
|
initialValue: '1',
|
|
3409
|
-
type: 0 /* VALUE */,
|
|
4230
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3410
4231
|
prefix: false,
|
|
3411
4232
|
parse: function (_context, token) {
|
|
3412
4233
|
if (isNumberToken(token)) {
|
|
@@ -3420,7 +4241,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3420
4241
|
name: "text-decoration-color",
|
|
3421
4242
|
initialValue: 'transparent',
|
|
3422
4243
|
prefix: false,
|
|
3423
|
-
type: 3 /* TYPE_VALUE */,
|
|
4244
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3424
4245
|
format: 'color'
|
|
3425
4246
|
};
|
|
3426
4247
|
|
|
@@ -3428,24 +4249,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3428
4249
|
name: 'text-decoration-line',
|
|
3429
4250
|
initialValue: 'none',
|
|
3430
4251
|
prefix: false,
|
|
3431
|
-
type: 1 /* LIST */,
|
|
4252
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3432
4253
|
parse: function (_context, tokens) {
|
|
3433
4254
|
return tokens
|
|
3434
4255
|
.filter(isIdentToken)
|
|
3435
4256
|
.map(function (token) {
|
|
3436
4257
|
switch (token.value) {
|
|
3437
4258
|
case 'underline':
|
|
3438
|
-
return 1 /* UNDERLINE */;
|
|
4259
|
+
return 1 /* TEXT_DECORATION_LINE.UNDERLINE */;
|
|
3439
4260
|
case 'overline':
|
|
3440
|
-
return 2 /* OVERLINE */;
|
|
4261
|
+
return 2 /* TEXT_DECORATION_LINE.OVERLINE */;
|
|
3441
4262
|
case 'line-through':
|
|
3442
|
-
return 3 /* LINE_THROUGH */;
|
|
4263
|
+
return 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */;
|
|
3443
4264
|
case 'none':
|
|
3444
|
-
return 4 /* BLINK */;
|
|
4265
|
+
return 4 /* TEXT_DECORATION_LINE.BLINK */;
|
|
3445
4266
|
}
|
|
3446
|
-
return 0 /* NONE */;
|
|
4267
|
+
return 0 /* TEXT_DECORATION_LINE.NONE */;
|
|
3447
4268
|
})
|
|
3448
|
-
.filter(function (line) { return line !== 0 /* NONE */; });
|
|
4269
|
+
.filter(function (line) { return line !== 0 /* TEXT_DECORATION_LINE.NONE */; });
|
|
3449
4270
|
}
|
|
3450
4271
|
};
|
|
3451
4272
|
|
|
@@ -3453,20 +4274,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3453
4274
|
name: "font-family",
|
|
3454
4275
|
initialValue: '',
|
|
3455
4276
|
prefix: false,
|
|
3456
|
-
type: 1 /* LIST */,
|
|
4277
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3457
4278
|
parse: function (_context, tokens) {
|
|
3458
4279
|
var accumulator = [];
|
|
3459
4280
|
var results = [];
|
|
3460
4281
|
tokens.forEach(function (token) {
|
|
3461
4282
|
switch (token.type) {
|
|
3462
|
-
case 20 /* IDENT_TOKEN */:
|
|
3463
|
-
case 0 /* STRING_TOKEN */:
|
|
4283
|
+
case 20 /* TokenType.IDENT_TOKEN */:
|
|
4284
|
+
case 0 /* TokenType.STRING_TOKEN */:
|
|
3464
4285
|
accumulator.push(token.value);
|
|
3465
4286
|
break;
|
|
3466
|
-
case 17 /* NUMBER_TOKEN */:
|
|
4287
|
+
case 17 /* TokenType.NUMBER_TOKEN */:
|
|
3467
4288
|
accumulator.push(token.number.toString());
|
|
3468
4289
|
break;
|
|
3469
|
-
case 4 /* COMMA_TOKEN */:
|
|
4290
|
+
case 4 /* TokenType.COMMA_TOKEN */:
|
|
3470
4291
|
results.push(accumulator.join(' '));
|
|
3471
4292
|
accumulator.length = 0;
|
|
3472
4293
|
break;
|
|
@@ -3475,7 +4296,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3475
4296
|
if (accumulator.length) {
|
|
3476
4297
|
results.push(accumulator.join(' '));
|
|
3477
4298
|
}
|
|
3478
|
-
return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'"
|
|
4299
|
+
return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'".concat(result, "'")); });
|
|
3479
4300
|
}
|
|
3480
4301
|
};
|
|
3481
4302
|
|
|
@@ -3483,14 +4304,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3483
4304
|
name: "font-size",
|
|
3484
4305
|
initialValue: '0',
|
|
3485
4306
|
prefix: false,
|
|
3486
|
-
type: 3 /* TYPE_VALUE */,
|
|
4307
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3487
4308
|
format: 'length'
|
|
3488
4309
|
};
|
|
3489
4310
|
|
|
3490
4311
|
var fontWeight = {
|
|
3491
4312
|
name: 'font-weight',
|
|
3492
4313
|
initialValue: 'normal',
|
|
3493
|
-
type: 0 /* VALUE */,
|
|
4314
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3494
4315
|
prefix: false,
|
|
3495
4316
|
parse: function (_context, token) {
|
|
3496
4317
|
if (isNumberToken(token)) {
|
|
@@ -3512,7 +4333,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3512
4333
|
var fontVariant = {
|
|
3513
4334
|
name: 'font-variant',
|
|
3514
4335
|
initialValue: 'none',
|
|
3515
|
-
type: 1 /* LIST */,
|
|
4336
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3516
4337
|
prefix: false,
|
|
3517
4338
|
parse: function (_context, tokens) {
|
|
3518
4339
|
return tokens.filter(isIdentToken).map(function (token) { return token.value; });
|
|
@@ -3523,16 +4344,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3523
4344
|
name: 'font-style',
|
|
3524
4345
|
initialValue: 'normal',
|
|
3525
4346
|
prefix: false,
|
|
3526
|
-
type: 2 /* IDENT_VALUE */,
|
|
4347
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3527
4348
|
parse: function (_context, overflow) {
|
|
3528
4349
|
switch (overflow) {
|
|
3529
4350
|
case 'oblique':
|
|
3530
|
-
return "oblique" /* OBLIQUE */;
|
|
4351
|
+
return "oblique" /* FONT_STYLE.OBLIQUE */;
|
|
3531
4352
|
case 'italic':
|
|
3532
|
-
return "italic" /* ITALIC */;
|
|
4353
|
+
return "italic" /* FONT_STYLE.ITALIC */;
|
|
3533
4354
|
case 'normal':
|
|
3534
4355
|
default:
|
|
3535
|
-
return "normal" /* NORMAL */;
|
|
4356
|
+
return "normal" /* FONT_STYLE.NORMAL */;
|
|
3536
4357
|
}
|
|
3537
4358
|
}
|
|
3538
4359
|
};
|
|
@@ -3542,14 +4363,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3542
4363
|
var content = {
|
|
3543
4364
|
name: 'content',
|
|
3544
4365
|
initialValue: 'none',
|
|
3545
|
-
type: 1 /* LIST */,
|
|
4366
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3546
4367
|
prefix: false,
|
|
3547
4368
|
parse: function (_context, tokens) {
|
|
3548
4369
|
if (tokens.length === 0) {
|
|
3549
4370
|
return [];
|
|
3550
4371
|
}
|
|
3551
4372
|
var first = tokens[0];
|
|
3552
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4373
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3553
4374
|
return [];
|
|
3554
4375
|
}
|
|
3555
4376
|
return tokens;
|
|
@@ -3560,13 +4381,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3560
4381
|
name: 'counter-increment',
|
|
3561
4382
|
initialValue: 'none',
|
|
3562
4383
|
prefix: true,
|
|
3563
|
-
type: 1 /* LIST */,
|
|
4384
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3564
4385
|
parse: function (_context, tokens) {
|
|
3565
4386
|
if (tokens.length === 0) {
|
|
3566
4387
|
return null;
|
|
3567
4388
|
}
|
|
3568
4389
|
var first = tokens[0];
|
|
3569
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4390
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3570
4391
|
return null;
|
|
3571
4392
|
}
|
|
3572
4393
|
var increments = [];
|
|
@@ -3574,7 +4395,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3574
4395
|
for (var i = 0; i < filtered.length; i++) {
|
|
3575
4396
|
var counter = filtered[i];
|
|
3576
4397
|
var next = filtered[i + 1];
|
|
3577
|
-
if (counter.type === 20 /* IDENT_TOKEN */) {
|
|
4398
|
+
if (counter.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
3578
4399
|
var increment = next && isNumberToken(next) ? next.number : 1;
|
|
3579
4400
|
increments.push({ counter: counter.value, increment: increment });
|
|
3580
4401
|
}
|
|
@@ -3587,7 +4408,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3587
4408
|
name: 'counter-reset',
|
|
3588
4409
|
initialValue: 'none',
|
|
3589
4410
|
prefix: true,
|
|
3590
|
-
type: 1 /* LIST */,
|
|
4411
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3591
4412
|
parse: function (_context, tokens) {
|
|
3592
4413
|
if (tokens.length === 0) {
|
|
3593
4414
|
return [];
|
|
@@ -3610,7 +4431,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3610
4431
|
name: 'duration',
|
|
3611
4432
|
initialValue: '0s',
|
|
3612
4433
|
prefix: false,
|
|
3613
|
-
type: 1 /* LIST */,
|
|
4434
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3614
4435
|
parse: function (context, tokens) {
|
|
3615
4436
|
return tokens.filter(isDimensionToken).map(function (token) { return time.parse(context, token); });
|
|
3616
4437
|
}
|
|
@@ -3620,13 +4441,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3620
4441
|
name: 'quotes',
|
|
3621
4442
|
initialValue: 'none',
|
|
3622
4443
|
prefix: true,
|
|
3623
|
-
type: 1 /* LIST */,
|
|
4444
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3624
4445
|
parse: function (_context, tokens) {
|
|
3625
4446
|
if (tokens.length === 0) {
|
|
3626
4447
|
return null;
|
|
3627
4448
|
}
|
|
3628
4449
|
var first = tokens[0];
|
|
3629
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4450
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3630
4451
|
return null;
|
|
3631
4452
|
}
|
|
3632
4453
|
var quotes = [];
|
|
@@ -3656,7 +4477,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3656
4477
|
var boxShadow = {
|
|
3657
4478
|
name: 'box-shadow',
|
|
3658
4479
|
initialValue: 'none',
|
|
3659
|
-
type: 1 /* LIST */,
|
|
4480
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3660
4481
|
prefix: false,
|
|
3661
4482
|
parse: function (context, tokens) {
|
|
3662
4483
|
if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
|
|
@@ -3705,20 +4526,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3705
4526
|
name: 'paint-order',
|
|
3706
4527
|
initialValue: 'normal',
|
|
3707
4528
|
prefix: false,
|
|
3708
|
-
type: 1 /* LIST */,
|
|
4529
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3709
4530
|
parse: function (_context, tokens) {
|
|
3710
|
-
var DEFAULT_VALUE = [0 /* FILL */, 1 /* STROKE */, 2 /* MARKERS */];
|
|
4531
|
+
var DEFAULT_VALUE = [0 /* PAINT_ORDER_LAYER.FILL */, 1 /* PAINT_ORDER_LAYER.STROKE */, 2 /* PAINT_ORDER_LAYER.MARKERS */];
|
|
3711
4532
|
var layers = [];
|
|
3712
4533
|
tokens.filter(isIdentToken).forEach(function (token) {
|
|
3713
4534
|
switch (token.value) {
|
|
3714
4535
|
case 'stroke':
|
|
3715
|
-
layers.push(1 /* STROKE */);
|
|
4536
|
+
layers.push(1 /* PAINT_ORDER_LAYER.STROKE */);
|
|
3716
4537
|
break;
|
|
3717
4538
|
case 'fill':
|
|
3718
|
-
layers.push(0 /* FILL */);
|
|
4539
|
+
layers.push(0 /* PAINT_ORDER_LAYER.FILL */);
|
|
3719
4540
|
break;
|
|
3720
4541
|
case 'markers':
|
|
3721
|
-
layers.push(2 /* MARKERS */);
|
|
4542
|
+
layers.push(2 /* PAINT_ORDER_LAYER.MARKERS */);
|
|
3722
4543
|
break;
|
|
3723
4544
|
}
|
|
3724
4545
|
});
|
|
@@ -3735,14 +4556,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3735
4556
|
name: "-webkit-text-stroke-color",
|
|
3736
4557
|
initialValue: 'currentcolor',
|
|
3737
4558
|
prefix: false,
|
|
3738
|
-
type: 3 /* TYPE_VALUE */,
|
|
4559
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3739
4560
|
format: 'color'
|
|
3740
4561
|
};
|
|
3741
4562
|
|
|
3742
4563
|
var webkitTextStrokeWidth = {
|
|
3743
4564
|
name: "-webkit-text-stroke-width",
|
|
3744
4565
|
initialValue: '0',
|
|
3745
|
-
type: 0 /* VALUE */,
|
|
4566
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3746
4567
|
prefix: false,
|
|
3747
4568
|
parse: function (_context, token) {
|
|
3748
4569
|
if (isDimensionToken(token)) {
|
|
@@ -3752,6 +4573,31 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3752
4573
|
}
|
|
3753
4574
|
};
|
|
3754
4575
|
|
|
4576
|
+
var objectFit = {
|
|
4577
|
+
name: 'objectFit',
|
|
4578
|
+
initialValue: 'fill',
|
|
4579
|
+
prefix: false,
|
|
4580
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
4581
|
+
parse: function (_context, tokens) {
|
|
4582
|
+
return tokens.filter(isIdentToken).reduce(function (bit, token) {
|
|
4583
|
+
return bit | parseDisplayValue(token.value);
|
|
4584
|
+
}, 0 /* OBJECT_FIT.FILL */);
|
|
4585
|
+
}
|
|
4586
|
+
};
|
|
4587
|
+
var parseDisplayValue = function (display) {
|
|
4588
|
+
switch (display) {
|
|
4589
|
+
case 'contain':
|
|
4590
|
+
return 2 /* OBJECT_FIT.CONTAIN */;
|
|
4591
|
+
case 'cover':
|
|
4592
|
+
return 4 /* OBJECT_FIT.COVER */;
|
|
4593
|
+
case 'none':
|
|
4594
|
+
return 8 /* OBJECT_FIT.NONE */;
|
|
4595
|
+
case 'scale-down':
|
|
4596
|
+
return 16 /* OBJECT_FIT.SCALE_DOWN */;
|
|
4597
|
+
}
|
|
4598
|
+
return 0 /* OBJECT_FIT.FILL */;
|
|
4599
|
+
};
|
|
4600
|
+
|
|
3755
4601
|
var CSSParsedDeclaration = /** @class */ (function () {
|
|
3756
4602
|
function CSSParsedDeclaration(context, declaration) {
|
|
3757
4603
|
var _a, _b;
|
|
@@ -3822,9 +4668,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3822
4668
|
this.webkitTextStrokeWidth = parse(context, webkitTextStrokeWidth, declaration.webkitTextStrokeWidth);
|
|
3823
4669
|
this.wordBreak = parse(context, wordBreak, declaration.wordBreak);
|
|
3824
4670
|
this.zIndex = parse(context, zIndex, declaration.zIndex);
|
|
4671
|
+
this.objectFit = parse(context, objectFit, declaration.objectFit);
|
|
3825
4672
|
}
|
|
3826
4673
|
CSSParsedDeclaration.prototype.isVisible = function () {
|
|
3827
|
-
return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBLE */;
|
|
4674
|
+
return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBILITY.VISIBLE */;
|
|
3828
4675
|
};
|
|
3829
4676
|
CSSParsedDeclaration.prototype.isTransparent = function () {
|
|
3830
4677
|
return isTransparent(this.backgroundColor);
|
|
@@ -3833,21 +4680,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3833
4680
|
return this.transform !== null;
|
|
3834
4681
|
};
|
|
3835
4682
|
CSSParsedDeclaration.prototype.isPositioned = function () {
|
|
3836
|
-
return this.position !== 0 /* STATIC */;
|
|
4683
|
+
return this.position !== 0 /* POSITION.STATIC */;
|
|
3837
4684
|
};
|
|
3838
4685
|
CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () {
|
|
3839
4686
|
return this.isPositioned() && !this.zIndex.auto;
|
|
3840
4687
|
};
|
|
3841
4688
|
CSSParsedDeclaration.prototype.isFloating = function () {
|
|
3842
|
-
return this.float !== 0 /* NONE */;
|
|
4689
|
+
return this.float !== 0 /* FLOAT.NONE */;
|
|
3843
4690
|
};
|
|
3844
4691
|
CSSParsedDeclaration.prototype.isInlineLevel = function () {
|
|
3845
|
-
return (contains(this.display, 4 /* INLINE */) ||
|
|
3846
|
-
contains(this.display, 33554432 /* INLINE_BLOCK */) ||
|
|
3847
|
-
contains(this.display, 268435456 /* INLINE_FLEX */) ||
|
|
3848
|
-
contains(this.display, 536870912 /* INLINE_GRID */) ||
|
|
3849
|
-
contains(this.display, 67108864 /* INLINE_LIST_ITEM */) ||
|
|
3850
|
-
contains(this.display, 134217728 /* INLINE_TABLE */));
|
|
4692
|
+
return (contains(this.display, 4 /* DISPLAY.INLINE */) ||
|
|
4693
|
+
contains(this.display, 33554432 /* DISPLAY.INLINE_BLOCK */) ||
|
|
4694
|
+
contains(this.display, 268435456 /* DISPLAY.INLINE_FLEX */) ||
|
|
4695
|
+
contains(this.display, 536870912 /* DISPLAY.INLINE_GRID */) ||
|
|
4696
|
+
contains(this.display, 67108864 /* DISPLAY.INLINE_LIST_ITEM */) ||
|
|
4697
|
+
contains(this.display, 134217728 /* DISPLAY.INLINE_TABLE */));
|
|
3851
4698
|
};
|
|
3852
4699
|
return CSSParsedDeclaration;
|
|
3853
4700
|
}());
|
|
@@ -3872,16 +4719,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3872
4719
|
tokenizer.write(value);
|
|
3873
4720
|
var parser = new Parser(tokenizer.read());
|
|
3874
4721
|
switch (descriptor.type) {
|
|
3875
|
-
case 2 /* IDENT_VALUE */:
|
|
4722
|
+
case 2 /* PropertyDescriptorParsingType.IDENT_VALUE */:
|
|
3876
4723
|
var token = parser.parseComponentValue();
|
|
3877
4724
|
return descriptor.parse(context, isIdentToken(token) ? token.value : descriptor.initialValue);
|
|
3878
|
-
case 0 /* VALUE */:
|
|
4725
|
+
case 0 /* PropertyDescriptorParsingType.VALUE */:
|
|
3879
4726
|
return descriptor.parse(context, parser.parseComponentValue());
|
|
3880
|
-
case 1 /* LIST */:
|
|
4727
|
+
case 1 /* PropertyDescriptorParsingType.LIST */:
|
|
3881
4728
|
return descriptor.parse(context, parser.parseComponentValues());
|
|
3882
|
-
case 4 /* TOKEN_VALUE */:
|
|
4729
|
+
case 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */:
|
|
3883
4730
|
return parser.parseComponentValue();
|
|
3884
|
-
case 3 /* TYPE_VALUE */:
|
|
4731
|
+
case 3 /* PropertyDescriptorParsingType.TYPE_VALUE */:
|
|
3885
4732
|
switch (descriptor.format) {
|
|
3886
4733
|
case 'angle':
|
|
3887
4734
|
return angle.parse(context, parser.parseComponentValue());
|
|
@@ -3907,20 +4754,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3907
4754
|
var attribute = element.getAttribute(elementDebuggerAttribute);
|
|
3908
4755
|
switch (attribute) {
|
|
3909
4756
|
case 'all':
|
|
3910
|
-
return 1 /* ALL */;
|
|
4757
|
+
return 1 /* DebuggerType.ALL */;
|
|
3911
4758
|
case 'clone':
|
|
3912
|
-
return 2 /* CLONE */;
|
|
4759
|
+
return 2 /* DebuggerType.CLONE */;
|
|
3913
4760
|
case 'parse':
|
|
3914
|
-
return 3 /* PARSE */;
|
|
4761
|
+
return 3 /* DebuggerType.PARSE */;
|
|
3915
4762
|
case 'render':
|
|
3916
|
-
return 4 /* RENDER */;
|
|
4763
|
+
return 4 /* DebuggerType.RENDER */;
|
|
3917
4764
|
default:
|
|
3918
|
-
return 0 /* NONE */;
|
|
4765
|
+
return 0 /* DebuggerType.NONE */;
|
|
3919
4766
|
}
|
|
3920
4767
|
};
|
|
3921
4768
|
var isDebugging = function (element, type) {
|
|
3922
4769
|
var elementType = getElementDebugType(element);
|
|
3923
|
-
return elementType === 1 /* ALL */ || type === elementType;
|
|
4770
|
+
return elementType === 1 /* DebuggerType.ALL */ || type === elementType;
|
|
3924
4771
|
};
|
|
3925
4772
|
|
|
3926
4773
|
var ElementContainer = /** @class */ (function () {
|
|
@@ -3929,7 +4776,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3929
4776
|
this.textNodes = [];
|
|
3930
4777
|
this.elements = [];
|
|
3931
4778
|
this.flags = 0;
|
|
3932
|
-
if (isDebugging(element, 3 /* PARSE */)) {
|
|
4779
|
+
if (isDebugging(element, 3 /* DebuggerType.PARSE */)) {
|
|
3933
4780
|
debugger;
|
|
3934
4781
|
}
|
|
3935
4782
|
this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null));
|
|
@@ -3943,8 +4790,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3943
4790
|
}
|
|
3944
4791
|
}
|
|
3945
4792
|
this.bounds = parseBounds(this.context, element);
|
|
3946
|
-
if (isDebugging(element, 4 /* RENDER */)) {
|
|
3947
|
-
this.flags |= 16 /* DEBUG_RENDER */;
|
|
4793
|
+
if (isDebugging(element, 4 /* DebuggerType.RENDER */)) {
|
|
4794
|
+
this.flags |= 16 /* FLAGS.DEBUG_RENDER */;
|
|
3948
4795
|
}
|
|
3949
4796
|
}
|
|
3950
4797
|
return ElementContainer;
|
|
@@ -4338,7 +5185,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4338
5185
|
var range = document.createRange();
|
|
4339
5186
|
if (range.getBoundingClientRect) {
|
|
4340
5187
|
var testElement = document.createElement('boundtest');
|
|
4341
|
-
testElement.style.height = TEST_HEIGHT
|
|
5188
|
+
testElement.style.height = "".concat(TEST_HEIGHT, "px");
|
|
4342
5189
|
testElement.style.display = 'block';
|
|
4343
5190
|
document.body.appendChild(testElement);
|
|
4344
5191
|
range.selectNode(testElement);
|
|
@@ -4428,8 +5275,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4428
5275
|
ctx.fillStyle = 'red';
|
|
4429
5276
|
ctx.fillRect(0, 0, size, size);
|
|
4430
5277
|
var node = document.createElement('div');
|
|
4431
|
-
node.style.backgroundImage = "url("
|
|
4432
|
-
node.style.height = size
|
|
5278
|
+
node.style.backgroundImage = "url(".concat(greenImageSrc, ")");
|
|
5279
|
+
node.style.height = "".concat(size, "px");
|
|
4433
5280
|
// Firefox 55 does not render inline <img /> tags
|
|
4434
5281
|
return isGreenPixel(data)
|
|
4435
5282
|
? loadSerializedSVG$1(createForeignObjectSVG(size, size, 0, 0, node))
|
|
@@ -4462,7 +5309,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4462
5309
|
var img = new Image();
|
|
4463
5310
|
img.onload = function () { return resolve(img); };
|
|
4464
5311
|
img.onerror = reject;
|
|
4465
|
-
img.src = "data:image/svg+xml;charset=utf-8,"
|
|
5312
|
+
img.src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svg)));
|
|
4466
5313
|
});
|
|
4467
5314
|
};
|
|
4468
5315
|
var FEATURES = {
|
|
@@ -4606,7 +5453,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4606
5453
|
var breakWords = function (str, styles) {
|
|
4607
5454
|
var breaker = LineBreaker(str, {
|
|
4608
5455
|
lineBreak: styles.lineBreak,
|
|
4609
|
-
wordBreak: styles.overflowWrap === "break-word" /* BREAK_WORD */ ? 'break-word' : styles.wordBreak
|
|
5456
|
+
wordBreak: styles.overflowWrap === "break-word" /* OVERFLOW_WRAP.BREAK_WORD */ ? 'break-word' : styles.wordBreak
|
|
4610
5457
|
});
|
|
4611
5458
|
var words = [];
|
|
4612
5459
|
var bk;
|
|
@@ -4647,11 +5494,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4647
5494
|
}());
|
|
4648
5495
|
var transform = function (text, transform) {
|
|
4649
5496
|
switch (transform) {
|
|
4650
|
-
case 1 /* LOWERCASE */:
|
|
5497
|
+
case 1 /* TEXT_TRANSFORM.LOWERCASE */:
|
|
4651
5498
|
return text.toLowerCase();
|
|
4652
|
-
case 3 /* CAPITALIZE */:
|
|
5499
|
+
case 3 /* TEXT_TRANSFORM.CAPITALIZE */:
|
|
4653
5500
|
return text.replace(CAPITALIZE, capitalize);
|
|
4654
|
-
case 2 /* UPPERCASE */:
|
|
5501
|
+
case 2 /* TEXT_TRANSFORM.UPPERCASE */:
|
|
4655
5502
|
return text.toUpperCase();
|
|
4656
5503
|
default:
|
|
4657
5504
|
return text;
|
|
@@ -4696,9 +5543,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4696
5543
|
var _this = _super.call(this, context, img) || this;
|
|
4697
5544
|
var s = new XMLSerializer();
|
|
4698
5545
|
var bounds = parseBounds(context, img);
|
|
4699
|
-
img.setAttribute('width', bounds.width
|
|
4700
|
-
img.setAttribute('height', bounds.height
|
|
4701
|
-
_this.svg = "data:image/svg+xml,"
|
|
5546
|
+
img.setAttribute('width', "".concat(bounds.width, "px"));
|
|
5547
|
+
img.setAttribute('height', "".concat(bounds.height, "px"));
|
|
5548
|
+
_this.svg = "data:image/svg+xml,".concat(encodeURIComponent(s.serializeToString(img)));
|
|
4702
5549
|
_this.intrinsicWidth = img.width.baseVal.value;
|
|
4703
5550
|
_this.intrinsicHeight = img.height.baseVal.value;
|
|
4704
5551
|
_this.context.cache.addImage(_this.svg);
|
|
@@ -4730,7 +5577,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4730
5577
|
|
|
4731
5578
|
var CHECKBOX_BORDER_RADIUS = [
|
|
4732
5579
|
{
|
|
4733
|
-
type: 15 /* DIMENSION_TOKEN */,
|
|
5580
|
+
type: 15 /* TokenType.DIMENSION_TOKEN */,
|
|
4734
5581
|
flags: 0,
|
|
4735
5582
|
unit: 'px',
|
|
4736
5583
|
number: 3
|
|
@@ -4738,7 +5585,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4738
5585
|
];
|
|
4739
5586
|
var RADIO_BORDER_RADIUS = [
|
|
4740
5587
|
{
|
|
4741
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
5588
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
4742
5589
|
flags: 0,
|
|
4743
5590
|
number: 50
|
|
4744
5591
|
}
|
|
@@ -4783,9 +5630,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4783
5630
|
_this.styles.borderRightStyle =
|
|
4784
5631
|
_this.styles.borderBottomStyle =
|
|
4785
5632
|
_this.styles.borderLeftStyle =
|
|
4786
|
-
1 /* SOLID */;
|
|
4787
|
-
_this.styles.backgroundClip = [0 /* BORDER_BOX */];
|
|
4788
|
-
_this.styles.backgroundOrigin = [0 /* BORDER_BOX */];
|
|
5633
|
+
1 /* BORDER_STYLE.SOLID */;
|
|
5634
|
+
_this.styles.backgroundClip = [0 /* BACKGROUND_CLIP.BORDER_BOX */];
|
|
5635
|
+
_this.styles.backgroundOrigin = [0 /* BACKGROUND_ORIGIN.BORDER_BOX */];
|
|
4789
5636
|
_this.bounds = reformatInputBounds(_this.bounds);
|
|
4790
5637
|
}
|
|
4791
5638
|
switch (_this.type) {
|
|
@@ -4867,7 +5714,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4867
5714
|
var parseNodeTree = function (context, node, parent, root) {
|
|
4868
5715
|
for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) {
|
|
4869
5716
|
nextNode = childNode.nextSibling;
|
|
4870
|
-
|
|
5717
|
+
// Fixes #2238 #1624 - Fix the issue of TextNode content being overlooked in rendering due to being perceived as blank by trim().
|
|
5718
|
+
if (isTextNode(childNode) && childNode.data.length > 0) {
|
|
4871
5719
|
parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
|
|
4872
5720
|
}
|
|
4873
5721
|
else if (isElementNode(childNode)) {
|
|
@@ -4878,13 +5726,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4878
5726
|
var container = createContainer(context, childNode);
|
|
4879
5727
|
if (container.styles.isVisible()) {
|
|
4880
5728
|
if (createsRealStackingContext(childNode, container, root)) {
|
|
4881
|
-
container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
|
|
5729
|
+
container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
|
|
4882
5730
|
}
|
|
4883
5731
|
else if (createsStackingContext(container.styles)) {
|
|
4884
|
-
container.flags |= 2 /* CREATES_STACKING_CONTEXT */;
|
|
5732
|
+
container.flags |= 2 /* FLAGS.CREATES_STACKING_CONTEXT */;
|
|
4885
5733
|
}
|
|
4886
5734
|
if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) {
|
|
4887
|
-
container.flags |= 8 /* IS_LIST_OWNER */;
|
|
5735
|
+
container.flags |= 8 /* FLAGS.IS_LIST_OWNER */;
|
|
4888
5736
|
}
|
|
4889
5737
|
parent.elements.push(container);
|
|
4890
5738
|
if (childNode.shadowRoot) {
|
|
@@ -4932,7 +5780,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4932
5780
|
};
|
|
4933
5781
|
var parseTree = function (context, element) {
|
|
4934
5782
|
var container = createContainer(context, element);
|
|
4935
|
-
container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
|
|
5783
|
+
container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
|
|
4936
5784
|
parseNodeTree(context, element, container, container);
|
|
4937
5785
|
return container;
|
|
4938
5786
|
};
|
|
@@ -5200,7 +6048,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5200
6048
|
var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
|
|
5201
6049
|
var createCJKCounter = function (value, numbers, multipliers, negativeSign, suffix, flags) {
|
|
5202
6050
|
if (value < -9999 || value > 9999) {
|
|
5203
|
-
return createCounterText(value, 4 /* CJK_DECIMAL */, suffix.length > 0);
|
|
6051
|
+
return createCounterText(value, 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */, suffix.length > 0);
|
|
5204
6052
|
}
|
|
5205
6053
|
var tmp = Math.abs(value);
|
|
5206
6054
|
var string = suffix;
|
|
@@ -5236,101 +6084,101 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5236
6084
|
var koreanSuffix = appendSuffix ? ', ' : '';
|
|
5237
6085
|
var spaceSuffix = appendSuffix ? ' ' : '';
|
|
5238
6086
|
switch (type) {
|
|
5239
|
-
case 0 /* DISC */:
|
|
6087
|
+
case 0 /* LIST_STYLE_TYPE.DISC */:
|
|
5240
6088
|
return '•' + spaceSuffix;
|
|
5241
|
-
case 1 /* CIRCLE */:
|
|
6089
|
+
case 1 /* LIST_STYLE_TYPE.CIRCLE */:
|
|
5242
6090
|
return '◦' + spaceSuffix;
|
|
5243
|
-
case 2 /* SQUARE */:
|
|
6091
|
+
case 2 /* LIST_STYLE_TYPE.SQUARE */:
|
|
5244
6092
|
return '◾' + spaceSuffix;
|
|
5245
|
-
case 5 /* DECIMAL_LEADING_ZERO */:
|
|
6093
|
+
case 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */:
|
|
5246
6094
|
var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
|
5247
|
-
return string.length < 4 ? "0"
|
|
5248
|
-
case 4 /* CJK_DECIMAL */:
|
|
6095
|
+
return string.length < 4 ? "0".concat(string) : string;
|
|
6096
|
+
case 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */:
|
|
5249
6097
|
return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix);
|
|
5250
|
-
case 6 /* LOWER_ROMAN */:
|
|
5251
|
-
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
|
|
5252
|
-
case 7 /* UPPER_ROMAN */:
|
|
5253
|
-
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix);
|
|
5254
|
-
case 8 /* LOWER_GREEK */:
|
|
6098
|
+
case 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */:
|
|
6099
|
+
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix).toLowerCase();
|
|
6100
|
+
case 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */:
|
|
6101
|
+
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6102
|
+
case 8 /* LIST_STYLE_TYPE.LOWER_GREEK */:
|
|
5255
6103
|
return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
|
|
5256
|
-
case 9 /* LOWER_ALPHA */:
|
|
6104
|
+
case 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */:
|
|
5257
6105
|
return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
|
|
5258
|
-
case 10 /* UPPER_ALPHA */:
|
|
6106
|
+
case 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */:
|
|
5259
6107
|
return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
|
|
5260
|
-
case 11 /* ARABIC_INDIC */:
|
|
6108
|
+
case 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */:
|
|
5261
6109
|
return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
|
|
5262
|
-
case 12 /* ARMENIAN */:
|
|
5263
|
-
case 49 /* UPPER_ARMENIAN */:
|
|
5264
|
-
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix);
|
|
5265
|
-
case 35 /* LOWER_ARMENIAN */:
|
|
5266
|
-
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
|
|
5267
|
-
case 13 /* BENGALI */:
|
|
6110
|
+
case 12 /* LIST_STYLE_TYPE.ARMENIAN */:
|
|
6111
|
+
case 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */:
|
|
6112
|
+
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6113
|
+
case 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */:
|
|
6114
|
+
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix).toLowerCase();
|
|
6115
|
+
case 13 /* LIST_STYLE_TYPE.BENGALI */:
|
|
5268
6116
|
return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
|
|
5269
|
-
case 14 /* CAMBODIAN */:
|
|
5270
|
-
case 30 /* KHMER */:
|
|
6117
|
+
case 14 /* LIST_STYLE_TYPE.CAMBODIAN */:
|
|
6118
|
+
case 30 /* LIST_STYLE_TYPE.KHMER */:
|
|
5271
6119
|
return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
|
|
5272
|
-
case 15 /* CJK_EARTHLY_BRANCH */:
|
|
6120
|
+
case 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */:
|
|
5273
6121
|
return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix);
|
|
5274
|
-
case 16 /* CJK_HEAVENLY_STEM */:
|
|
6122
|
+
case 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */:
|
|
5275
6123
|
return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix);
|
|
5276
|
-
case 17 /* CJK_IDEOGRAPHIC */:
|
|
5277
|
-
case 48 /* TRAD_CHINESE_INFORMAL */:
|
|
6124
|
+
case 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */:
|
|
6125
|
+
case 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */:
|
|
5278
6126
|
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5279
|
-
case 47 /* TRAD_CHINESE_FORMAL */:
|
|
6127
|
+
case 47 /* LIST_STYLE_TYPE.TRAD_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 42 /* SIMP_CHINESE_INFORMAL */:
|
|
6129
|
+
case 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */:
|
|
5282
6130
|
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5283
|
-
case 41 /* SIMP_CHINESE_FORMAL */:
|
|
6131
|
+
case 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */:
|
|
5284
6132
|
return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5285
|
-
case 26 /* JAPANESE_INFORMAL */:
|
|
6133
|
+
case 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */:
|
|
5286
6134
|
return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0);
|
|
5287
|
-
case 25 /* JAPANESE_FORMAL */:
|
|
6135
|
+
case 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */:
|
|
5288
6136
|
return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5289
|
-
case 31 /* KOREAN_HANGUL_FORMAL */:
|
|
6137
|
+
case 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */:
|
|
5290
6138
|
return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5291
|
-
case 33 /* KOREAN_HANJA_INFORMAL */:
|
|
6139
|
+
case 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */:
|
|
5292
6140
|
return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0);
|
|
5293
|
-
case 32 /* KOREAN_HANJA_FORMAL */:
|
|
6141
|
+
case 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */:
|
|
5294
6142
|
return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5295
|
-
case 18 /* DEVANAGARI */:
|
|
6143
|
+
case 18 /* LIST_STYLE_TYPE.DEVANAGARI */:
|
|
5296
6144
|
return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix);
|
|
5297
|
-
case 20 /* GEORGIAN */:
|
|
5298
|
-
return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* DECIMAL */, defaultSuffix);
|
|
5299
|
-
case 21 /* GUJARATI */:
|
|
6145
|
+
case 20 /* LIST_STYLE_TYPE.GEORGIAN */:
|
|
6146
|
+
return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6147
|
+
case 21 /* LIST_STYLE_TYPE.GUJARATI */:
|
|
5300
6148
|
return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix);
|
|
5301
|
-
case 22 /* GURMUKHI */:
|
|
6149
|
+
case 22 /* LIST_STYLE_TYPE.GURMUKHI */:
|
|
5302
6150
|
return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix);
|
|
5303
|
-
case 22 /* HEBREW */:
|
|
5304
|
-
return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* DECIMAL */, defaultSuffix);
|
|
5305
|
-
case 23 /* HIRAGANA */:
|
|
6151
|
+
case 22 /* LIST_STYLE_TYPE.HEBREW */:
|
|
6152
|
+
return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6153
|
+
case 23 /* LIST_STYLE_TYPE.HIRAGANA */:
|
|
5306
6154
|
return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん');
|
|
5307
|
-
case 24 /* HIRAGANA_IROHA */:
|
|
6155
|
+
case 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */:
|
|
5308
6156
|
return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす');
|
|
5309
|
-
case 27 /* KANNADA */:
|
|
6157
|
+
case 27 /* LIST_STYLE_TYPE.KANNADA */:
|
|
5310
6158
|
return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
|
|
5311
|
-
case 28 /* KATAKANA */:
|
|
6159
|
+
case 28 /* LIST_STYLE_TYPE.KATAKANA */:
|
|
5312
6160
|
return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix);
|
|
5313
|
-
case 29 /* KATAKANA_IROHA */:
|
|
6161
|
+
case 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */:
|
|
5314
6162
|
return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix);
|
|
5315
|
-
case 34 /* LAO */:
|
|
6163
|
+
case 34 /* LIST_STYLE_TYPE.LAO */:
|
|
5316
6164
|
return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix);
|
|
5317
|
-
case 37 /* MONGOLIAN */:
|
|
6165
|
+
case 37 /* LIST_STYLE_TYPE.MONGOLIAN */:
|
|
5318
6166
|
return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix);
|
|
5319
|
-
case 38 /* MYANMAR */:
|
|
6167
|
+
case 38 /* LIST_STYLE_TYPE.MYANMAR */:
|
|
5320
6168
|
return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix);
|
|
5321
|
-
case 39 /* ORIYA */:
|
|
6169
|
+
case 39 /* LIST_STYLE_TYPE.ORIYA */:
|
|
5322
6170
|
return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix);
|
|
5323
|
-
case 40 /* PERSIAN */:
|
|
6171
|
+
case 40 /* LIST_STYLE_TYPE.PERSIAN */:
|
|
5324
6172
|
return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix);
|
|
5325
|
-
case 43 /* TAMIL */:
|
|
6173
|
+
case 43 /* LIST_STYLE_TYPE.TAMIL */:
|
|
5326
6174
|
return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix);
|
|
5327
|
-
case 44 /* TELUGU */:
|
|
6175
|
+
case 44 /* LIST_STYLE_TYPE.TELUGU */:
|
|
5328
6176
|
return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix);
|
|
5329
|
-
case 45 /* THAI */:
|
|
6177
|
+
case 45 /* LIST_STYLE_TYPE.THAI */:
|
|
5330
6178
|
return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix);
|
|
5331
|
-
case 46 /* TIBETAN */:
|
|
6179
|
+
case 46 /* LIST_STYLE_TYPE.TIBETAN */:
|
|
5332
6180
|
return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix);
|
|
5333
|
-
case 3 /* DECIMAL */:
|
|
6181
|
+
case 3 /* LIST_STYLE_TYPE.DECIMAL */:
|
|
5334
6182
|
default:
|
|
5335
6183
|
return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
|
5336
6184
|
}
|
|
@@ -5380,7 +6228,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5380
6228
|
onclone = this.options.onclone;
|
|
5381
6229
|
referenceElement = this.clonedReferenceElement;
|
|
5382
6230
|
if (typeof referenceElement === 'undefined') {
|
|
5383
|
-
return [2 /*return*/, Promise.reject("Error finding the "
|
|
6231
|
+
return [2 /*return*/, Promise.reject("Error finding the ".concat(this.referenceElement.nodeName, " in the cloned document"))];
|
|
5384
6232
|
}
|
|
5385
6233
|
if (!(documentClone.fonts && documentClone.fonts.ready)) return [3 /*break*/, 2];
|
|
5386
6234
|
return [4 /*yield*/, documentClone.fonts.ready];
|
|
@@ -5403,16 +6251,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5403
6251
|
}
|
|
5404
6252
|
});
|
|
5405
6253
|
}); });
|
|
6254
|
+
var adoptedNode = documentClone.adoptNode(this.documentElement);
|
|
6255
|
+
/**
|
|
6256
|
+
* The baseURI of the document will be lost after documentClone.open().
|
|
6257
|
+
* We can avoid it by adding <base> element.
|
|
6258
|
+
* */
|
|
6259
|
+
addBase(adoptedNode, documentClone);
|
|
5406
6260
|
documentClone.open();
|
|
5407
|
-
documentClone.write(serializeDoctype(document.doctype)
|
|
6261
|
+
documentClone.write("".concat(serializeDoctype(document.doctype), "<html></html>"));
|
|
5408
6262
|
// Chrome scrolls the parent document for some reason after the write to the cloned window???
|
|
5409
6263
|
restoreOwnerScroll(this.referenceElement.ownerDocument, scrollX, scrollY);
|
|
5410
|
-
documentClone.replaceChild(
|
|
6264
|
+
documentClone.replaceChild(adoptedNode, documentClone.documentElement);
|
|
5411
6265
|
documentClone.close();
|
|
5412
6266
|
return iframeLoad;
|
|
5413
6267
|
};
|
|
5414
6268
|
DocumentCloner.prototype.createElementClone = function (node) {
|
|
5415
|
-
if (isDebugging(node, 2 /* CLONE */)) {
|
|
6269
|
+
if (isDebugging(node, 2 /* DebuggerType.CLONE */)) {
|
|
5416
6270
|
debugger;
|
|
5417
6271
|
}
|
|
5418
6272
|
if (isCanvasElement(node)) {
|
|
@@ -5485,7 +6339,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5485
6339
|
clonedCanvas.width = canvas.width;
|
|
5486
6340
|
clonedCanvas.height = canvas.height;
|
|
5487
6341
|
var ctx = canvas.getContext('2d');
|
|
5488
|
-
var clonedCtx = clonedCanvas.getContext('2d');
|
|
6342
|
+
var clonedCtx = clonedCanvas.getContext('2d', { willReadFrequently: true });
|
|
5489
6343
|
if (clonedCtx) {
|
|
5490
6344
|
if (!this.options.allowTaint && ctx) {
|
|
5491
6345
|
clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
|
|
@@ -5620,16 +6474,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5620
6474
|
var anonymousReplacedElement = document.createElement('html2canvaspseudoelement');
|
|
5621
6475
|
copyCSSStyles(style, anonymousReplacedElement);
|
|
5622
6476
|
declaration.content.forEach(function (token) {
|
|
5623
|
-
if (token.type === 0 /* STRING_TOKEN */) {
|
|
6477
|
+
if (token.type === 0 /* TokenType.STRING_TOKEN */) {
|
|
5624
6478
|
anonymousReplacedElement.appendChild(document.createTextNode(token.value));
|
|
5625
6479
|
}
|
|
5626
|
-
else if (token.type === 22 /* URL_TOKEN */) {
|
|
6480
|
+
else if (token.type === 22 /* TokenType.URL_TOKEN */) {
|
|
5627
6481
|
var img = document.createElement('img');
|
|
5628
6482
|
img.src = token.value;
|
|
5629
6483
|
img.style.opacity = '1';
|
|
5630
6484
|
anonymousReplacedElement.appendChild(img);
|
|
5631
6485
|
}
|
|
5632
|
-
else if (token.type === 18 /* FUNCTION */) {
|
|
6486
|
+
else if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
5633
6487
|
if (token.name === 'attr') {
|
|
5634
6488
|
var attr = token.values.filter(isIdentToken);
|
|
5635
6489
|
if (attr.length) {
|
|
@@ -5642,7 +6496,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5642
6496
|
var counterState = _this.counters.getCounterValue(counter.value);
|
|
5643
6497
|
var counterType = counterStyle && isIdentToken(counterStyle)
|
|
5644
6498
|
? listStyleType.parse(_this.context, counterStyle.value)
|
|
5645
|
-
: 3 /* DECIMAL */;
|
|
6499
|
+
: 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
5646
6500
|
anonymousReplacedElement.appendChild(document.createTextNode(createCounterText(counterState, counterType, false)));
|
|
5647
6501
|
}
|
|
5648
6502
|
}
|
|
@@ -5652,8 +6506,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5652
6506
|
var counterStates = _this.counters.getCounterValues(counter.value);
|
|
5653
6507
|
var counterType_1 = counterStyle && isIdentToken(counterStyle)
|
|
5654
6508
|
? listStyleType.parse(_this.context, counterStyle.value)
|
|
5655
|
-
: 3 /* DECIMAL */;
|
|
5656
|
-
var separator = delim && delim.type === 0 /* STRING_TOKEN */ ? delim.value : '';
|
|
6509
|
+
: 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
6510
|
+
var separator = delim && delim.type === 0 /* TokenType.STRING_TOKEN */ ? delim.value : '';
|
|
5657
6511
|
var text = counterStates
|
|
5658
6512
|
.map(function (value) { return createCounterText(value, counterType_1, false); })
|
|
5659
6513
|
.join(separator);
|
|
@@ -5662,7 +6516,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5662
6516
|
}
|
|
5663
6517
|
else ;
|
|
5664
6518
|
}
|
|
5665
|
-
else if (token.type === 20 /* IDENT_TOKEN */) {
|
|
6519
|
+
else if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
5666
6520
|
switch (token.value) {
|
|
5667
6521
|
case 'open-quote':
|
|
5668
6522
|
anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, _this.quoteDepth++, true)));
|
|
@@ -5676,10 +6530,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5676
6530
|
}
|
|
5677
6531
|
}
|
|
5678
6532
|
});
|
|
5679
|
-
anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE
|
|
6533
|
+
anonymousReplacedElement.className = "".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE, " ").concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER);
|
|
5680
6534
|
var newClassName = pseudoElt === PseudoElementType.BEFORE
|
|
5681
|
-
? " "
|
|
5682
|
-
: " "
|
|
6535
|
+
? " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE)
|
|
6536
|
+
: " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER);
|
|
5683
6537
|
if (isSVGElementNode(clone)) {
|
|
5684
6538
|
clone.className.baseValue += newClassName;
|
|
5685
6539
|
}
|
|
@@ -5778,10 +6632,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5778
6632
|
str += doctype.internalSubset;
|
|
5779
6633
|
}
|
|
5780
6634
|
if (doctype.publicId) {
|
|
5781
|
-
str += "\""
|
|
6635
|
+
str += "\"".concat(doctype.publicId, "\"");
|
|
5782
6636
|
}
|
|
5783
6637
|
if (doctype.systemId) {
|
|
5784
|
-
str += "\""
|
|
6638
|
+
str += "\"".concat(doctype.systemId, "\"");
|
|
5785
6639
|
}
|
|
5786
6640
|
str += '>';
|
|
5787
6641
|
}
|
|
@@ -5805,7 +6659,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5805
6659
|
var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after';
|
|
5806
6660
|
var PSEUDO_HIDE_ELEMENT_STYLE = "{\n content: \"\" !important;\n display: none !important;\n}";
|
|
5807
6661
|
var createPseudoHideStyles = function (body) {
|
|
5808
|
-
createStyles(body, "."
|
|
6662
|
+
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));
|
|
5809
6663
|
};
|
|
5810
6664
|
var createStyles = function (body, styles) {
|
|
5811
6665
|
var document = body.ownerDocument;
|
|
@@ -5815,6 +6669,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5815
6669
|
body.appendChild(style);
|
|
5816
6670
|
}
|
|
5817
6671
|
};
|
|
6672
|
+
var addBase = function (targetELement, referenceDocument) {
|
|
6673
|
+
var _a;
|
|
6674
|
+
var baseNode = referenceDocument.createElement('base');
|
|
6675
|
+
baseNode.href = referenceDocument.baseURI;
|
|
6676
|
+
var headEle = targetELement.getElementsByTagName('head').item(0);
|
|
6677
|
+
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);
|
|
6678
|
+
};
|
|
5818
6679
|
|
|
5819
6680
|
var CacheStorage = /** @class */ (function () {
|
|
5820
6681
|
function CacheStorage() {
|
|
@@ -5892,7 +6753,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5892
6753
|
src = _a.sent();
|
|
5893
6754
|
_a.label = 2;
|
|
5894
6755
|
case 2:
|
|
5895
|
-
this.context.logger.debug("Added image "
|
|
6756
|
+
this.context.logger.debug("Added image ".concat(key.substring(0, 256)));
|
|
5896
6757
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
5897
6758
|
var img = new Image();
|
|
5898
6759
|
img.onload = function () { return resolve(img); };
|
|
@@ -5907,7 +6768,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5907
6768
|
setTimeout(function () { return resolve(img); }, 500);
|
|
5908
6769
|
}
|
|
5909
6770
|
if (_this._options.imageTimeout > 0) {
|
|
5910
|
-
setTimeout(function () { return reject("Timed out ("
|
|
6771
|
+
setTimeout(function () { return reject("Timed out (".concat(_this._options.imageTimeout, "ms) loading image")); }, _this._options.imageTimeout);
|
|
5911
6772
|
}
|
|
5912
6773
|
})];
|
|
5913
6774
|
case 3: return [2 /*return*/, _a.sent()];
|
|
@@ -5944,19 +6805,19 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5944
6805
|
}
|
|
5945
6806
|
}
|
|
5946
6807
|
else {
|
|
5947
|
-
reject("Failed to proxy resource "
|
|
6808
|
+
reject("Failed to proxy resource ".concat(key, " with status code ").concat(xhr.status));
|
|
5948
6809
|
}
|
|
5949
6810
|
};
|
|
5950
6811
|
xhr.onerror = reject;
|
|
5951
6812
|
var queryString = proxy.indexOf('?') > -1 ? '&' : '?';
|
|
5952
|
-
xhr.open('GET', ""
|
|
6813
|
+
xhr.open('GET', "".concat(proxy).concat(queryString, "url=").concat(encodeURIComponent(src), "&responseType=").concat(responseType));
|
|
5953
6814
|
if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
|
|
5954
6815
|
xhr.responseType = responseType;
|
|
5955
6816
|
}
|
|
5956
6817
|
if (_this._options.imageTimeout) {
|
|
5957
6818
|
var timeout_1 = _this._options.imageTimeout;
|
|
5958
6819
|
xhr.timeout = timeout_1;
|
|
5959
|
-
xhr.ontimeout = function () { return reject("Timed out ("
|
|
6820
|
+
xhr.ontimeout = function () { return reject("Timed out (".concat(timeout_1, "ms) proxying ").concat(key)); };
|
|
5960
6821
|
}
|
|
5961
6822
|
xhr.send();
|
|
5962
6823
|
});
|
|
@@ -5974,7 +6835,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5974
6835
|
|
|
5975
6836
|
var Vector = /** @class */ (function () {
|
|
5976
6837
|
function Vector(x, y) {
|
|
5977
|
-
this.type = 0 /* VECTOR */;
|
|
6838
|
+
this.type = 0 /* PathType.VECTOR */;
|
|
5978
6839
|
this.x = x;
|
|
5979
6840
|
this.y = y;
|
|
5980
6841
|
}
|
|
@@ -5989,7 +6850,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5989
6850
|
};
|
|
5990
6851
|
var BezierCurve = /** @class */ (function () {
|
|
5991
6852
|
function BezierCurve(start, startControl, endControl, end) {
|
|
5992
|
-
this.type = 1 /* BEZIER_CURVE */;
|
|
6853
|
+
this.type = 1 /* PathType.BEZIER_CURVE */;
|
|
5993
6854
|
this.start = start;
|
|
5994
6855
|
this.startControl = startControl;
|
|
5995
6856
|
this.endControl = endControl;
|
|
@@ -6012,7 +6873,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6012
6873
|
};
|
|
6013
6874
|
return BezierCurve;
|
|
6014
6875
|
}());
|
|
6015
|
-
var isBezierCurve = function (path) { return path.type === 1 /* BEZIER_CURVE */; };
|
|
6876
|
+
var isBezierCurve = function (path) { return path.type === 1 /* PathType.BEZIER_CURVE */; };
|
|
6016
6877
|
|
|
6017
6878
|
var BoundCurves = /** @class */ (function () {
|
|
6018
6879
|
function BoundCurves(element) {
|
|
@@ -6199,8 +7060,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6199
7060
|
this.offsetX = offsetX;
|
|
6200
7061
|
this.offsetY = offsetY;
|
|
6201
7062
|
this.matrix = matrix;
|
|
6202
|
-
this.type = 0 /* TRANSFORM */;
|
|
6203
|
-
this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
|
|
7063
|
+
this.type = 0 /* EffectType.TRANSFORM */;
|
|
7064
|
+
this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
|
|
6204
7065
|
}
|
|
6205
7066
|
return TransformEffect;
|
|
6206
7067
|
}());
|
|
@@ -6208,23 +7069,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6208
7069
|
function ClipEffect(path, target) {
|
|
6209
7070
|
this.path = path;
|
|
6210
7071
|
this.target = target;
|
|
6211
|
-
this.type = 1 /* CLIP */;
|
|
7072
|
+
this.type = 1 /* EffectType.CLIP */;
|
|
6212
7073
|
}
|
|
6213
7074
|
return ClipEffect;
|
|
6214
7075
|
}());
|
|
6215
7076
|
var OpacityEffect = /** @class */ (function () {
|
|
6216
7077
|
function OpacityEffect(opacity) {
|
|
6217
7078
|
this.opacity = opacity;
|
|
6218
|
-
this.type = 2 /* OPACITY */;
|
|
6219
|
-
this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
|
|
7079
|
+
this.type = 2 /* EffectType.OPACITY */;
|
|
7080
|
+
this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
|
|
6220
7081
|
}
|
|
6221
7082
|
return OpacityEffect;
|
|
6222
7083
|
}());
|
|
6223
7084
|
var isTransformEffect = function (effect) {
|
|
6224
|
-
return effect.type === 0 /* TRANSFORM */;
|
|
7085
|
+
return effect.type === 0 /* EffectType.TRANSFORM */;
|
|
6225
7086
|
};
|
|
6226
|
-
var isClipEffect = function (effect) { return effect.type === 1 /* CLIP */; };
|
|
6227
|
-
var isOpacityEffect = function (effect) { return effect.type === 2 /* OPACITY */; };
|
|
7087
|
+
var isClipEffect = function (effect) { return effect.type === 1 /* EffectType.CLIP */; };
|
|
7088
|
+
var isOpacityEffect = function (effect) { return effect.type === 2 /* EffectType.OPACITY */; };
|
|
6228
7089
|
|
|
6229
7090
|
var equalPath = function (a, b) {
|
|
6230
7091
|
if (a.length === b.length) {
|
|
@@ -6276,34 +7137,34 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6276
7137
|
var matrix = this.container.styles.transform;
|
|
6277
7138
|
this.effects.push(new TransformEffect(offsetX, offsetY, matrix));
|
|
6278
7139
|
}
|
|
6279
|
-
if (this.container.styles.overflowX !== 0 /* VISIBLE */) {
|
|
7140
|
+
if (this.container.styles.overflowX !== 0 /* OVERFLOW.VISIBLE */) {
|
|
6280
7141
|
var borderBox = calculateBorderBoxPath(this.curves);
|
|
6281
7142
|
var paddingBox = calculatePaddingBoxPath(this.curves);
|
|
6282
7143
|
if (equalPath(borderBox, paddingBox)) {
|
|
6283
|
-
this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
|
|
7144
|
+
this.effects.push(new ClipEffect(borderBox, 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */));
|
|
6284
7145
|
}
|
|
6285
7146
|
else {
|
|
6286
|
-
this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */));
|
|
6287
|
-
this.effects.push(new ClipEffect(paddingBox, 4 /* CONTENT */));
|
|
7147
|
+
this.effects.push(new ClipEffect(borderBox, 2 /* EffectTarget.BACKGROUND_BORDERS */));
|
|
7148
|
+
this.effects.push(new ClipEffect(paddingBox, 4 /* EffectTarget.CONTENT */));
|
|
6288
7149
|
}
|
|
6289
7150
|
}
|
|
6290
7151
|
}
|
|
6291
7152
|
ElementPaint.prototype.getEffects = function (target) {
|
|
6292
|
-
var inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(this.container.styles.position) === -1;
|
|
7153
|
+
var inFlow = [2 /* POSITION.ABSOLUTE */, 3 /* POSITION.FIXED */].indexOf(this.container.styles.position) === -1;
|
|
6293
7154
|
var parent = this.parent;
|
|
6294
7155
|
var effects = this.effects.slice(0);
|
|
6295
7156
|
while (parent) {
|
|
6296
7157
|
var croplessEffects = parent.effects.filter(function (effect) { return !isClipEffect(effect); });
|
|
6297
|
-
if (inFlow || parent.container.styles.position !== 0 /* STATIC */ || !parent.parent) {
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
if (parent.container.styles.overflowX !== 0 /* VISIBLE */) {
|
|
7158
|
+
if (inFlow || parent.container.styles.position !== 0 /* POSITION.STATIC */ || !parent.parent) {
|
|
7159
|
+
inFlow = [2 /* POSITION.ABSOLUTE */, 3 /* POSITION.FIXED */].indexOf(parent.container.styles.position) === -1;
|
|
7160
|
+
if (parent.container.styles.overflowX !== 0 /* OVERFLOW.VISIBLE */) {
|
|
6301
7161
|
var borderBox = calculateBorderBoxPath(parent.curves);
|
|
6302
7162
|
var paddingBox = calculatePaddingBoxPath(parent.curves);
|
|
6303
7163
|
if (!equalPath(borderBox, paddingBox)) {
|
|
6304
|
-
effects.unshift(new ClipEffect(paddingBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
|
|
7164
|
+
effects.unshift(new ClipEffect(paddingBox, 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */));
|
|
6305
7165
|
}
|
|
6306
7166
|
}
|
|
7167
|
+
effects.unshift.apply(effects, croplessEffects);
|
|
6307
7168
|
}
|
|
6308
7169
|
else {
|
|
6309
7170
|
effects.unshift.apply(effects, croplessEffects);
|
|
@@ -6316,13 +7177,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6316
7177
|
}());
|
|
6317
7178
|
var parseStackTree = function (parent, stackingContext, realStackingContext, listItems) {
|
|
6318
7179
|
parent.container.elements.forEach(function (child) {
|
|
6319
|
-
var treatAsRealStackingContext = contains(child.flags, 4 /* CREATES_REAL_STACKING_CONTEXT */);
|
|
6320
|
-
var createsStackingContext = contains(child.flags, 2 /* CREATES_STACKING_CONTEXT */);
|
|
7180
|
+
var treatAsRealStackingContext = contains(child.flags, 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */);
|
|
7181
|
+
var createsStackingContext = contains(child.flags, 2 /* FLAGS.CREATES_STACKING_CONTEXT */);
|
|
6321
7182
|
var paintContainer = new ElementPaint(child, parent);
|
|
6322
|
-
if (contains(child.styles.display, 2048 /* LIST_ITEM */)) {
|
|
7183
|
+
if (contains(child.styles.display, 2048 /* DISPLAY.LIST_ITEM */)) {
|
|
6323
7184
|
listItems.push(paintContainer);
|
|
6324
7185
|
}
|
|
6325
|
-
var listOwnerItems = contains(child.flags, 8 /* IS_LIST_OWNER */) ? [] : listItems;
|
|
7186
|
+
var listOwnerItems = contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */) ? [] : listItems;
|
|
6326
7187
|
if (treatAsRealStackingContext || createsStackingContext) {
|
|
6327
7188
|
var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext;
|
|
6328
7189
|
var stack = new StackingContext(paintContainer);
|
|
@@ -6379,7 +7240,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6379
7240
|
}
|
|
6380
7241
|
parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems);
|
|
6381
7242
|
}
|
|
6382
|
-
if (contains(child.flags, 8 /* IS_LIST_OWNER */)) {
|
|
7243
|
+
if (contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */)) {
|
|
6383
7244
|
processListItems(child, listOwnerItems);
|
|
6384
7245
|
}
|
|
6385
7246
|
});
|
|
@@ -6520,19 +7381,19 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6520
7381
|
};
|
|
6521
7382
|
|
|
6522
7383
|
var calculateBackgroundPositioningArea = function (backgroundOrigin, element) {
|
|
6523
|
-
if (backgroundOrigin === 0 /* BORDER_BOX */) {
|
|
7384
|
+
if (backgroundOrigin === 0 /* BACKGROUND_ORIGIN.BORDER_BOX */) {
|
|
6524
7385
|
return element.bounds;
|
|
6525
7386
|
}
|
|
6526
|
-
if (backgroundOrigin === 2 /* CONTENT_BOX */) {
|
|
7387
|
+
if (backgroundOrigin === 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */) {
|
|
6527
7388
|
return contentBox(element);
|
|
6528
7389
|
}
|
|
6529
7390
|
return paddingBox(element);
|
|
6530
7391
|
};
|
|
6531
7392
|
var calculateBackgroundPaintingArea = function (backgroundClip, element) {
|
|
6532
|
-
if (backgroundClip === 0 /* BORDER_BOX */) {
|
|
7393
|
+
if (backgroundClip === 0 /* BACKGROUND_CLIP.BORDER_BOX */) {
|
|
6533
7394
|
return element.bounds;
|
|
6534
7395
|
}
|
|
6535
|
-
if (backgroundClip === 2 /* CONTENT_BOX */) {
|
|
7396
|
+
if (backgroundClip === 2 /* BACKGROUND_CLIP.CONTENT_BOX */) {
|
|
6536
7397
|
return contentBox(element);
|
|
6537
7398
|
}
|
|
6538
7399
|
return paddingBox(element);
|
|
@@ -6546,6 +7407,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6546
7407
|
var path = calculateBackgroundRepeatPath(getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea);
|
|
6547
7408
|
var offsetX = Math.round(backgroundPositioningArea.left + position[0]);
|
|
6548
7409
|
var offsetY = Math.round(backgroundPositioningArea.top + position[1]);
|
|
7410
|
+
sizeWidth = Math.max(1, sizeWidth);
|
|
7411
|
+
sizeHeight = Math.max(1, sizeHeight);
|
|
6549
7412
|
return [path, offsetX, offsetY, sizeWidth, sizeHeight];
|
|
6550
7413
|
};
|
|
6551
7414
|
var isAuto = function (token) { return isIdentToken(token) && token.value === BACKGROUND_SIZE.AUTO; };
|
|
@@ -6660,21 +7523,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6660
7523
|
var x = _a[0], y = _a[1];
|
|
6661
7524
|
var width = _b[0], height = _b[1];
|
|
6662
7525
|
switch (repeat) {
|
|
6663
|
-
case 2 /* REPEAT_X */:
|
|
7526
|
+
case 2 /* BACKGROUND_REPEAT.REPEAT_X */:
|
|
6664
7527
|
return [
|
|
6665
7528
|
new Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)),
|
|
6666
7529
|
new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)),
|
|
6667
7530
|
new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)),
|
|
6668
7531
|
new Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y))
|
|
6669
7532
|
];
|
|
6670
|
-
case 3 /* REPEAT_Y */:
|
|
7533
|
+
case 3 /* BACKGROUND_REPEAT.REPEAT_Y */:
|
|
6671
7534
|
return [
|
|
6672
7535
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)),
|
|
6673
7536
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)),
|
|
6674
7537
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)),
|
|
6675
7538
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top))
|
|
6676
7539
|
];
|
|
6677
|
-
case 1 /* NO_REPEAT */:
|
|
7540
|
+
case 1 /* BACKGROUND_REPEAT.NO_REPEAT */:
|
|
6678
7541
|
return [
|
|
6679
7542
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)),
|
|
6680
7543
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)),
|
|
@@ -6734,7 +7597,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6734
7597
|
return { baseline: baseline, middle: middle };
|
|
6735
7598
|
};
|
|
6736
7599
|
FontMetrics.prototype.getMetrics = function (fontFamily, fontSize) {
|
|
6737
|
-
var key = fontFamily
|
|
7600
|
+
var key = "".concat(fontFamily, " ").concat(fontSize);
|
|
6738
7601
|
if (typeof this._data[key] === 'undefined') {
|
|
6739
7602
|
this._data[key] = this.parseMetrics(fontFamily, fontSize);
|
|
6740
7603
|
}
|
|
@@ -6762,15 +7625,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6762
7625
|
if (!options.canvas) {
|
|
6763
7626
|
_this.canvas.width = Math.floor(options.width * options.scale);
|
|
6764
7627
|
_this.canvas.height = Math.floor(options.height * options.scale);
|
|
6765
|
-
_this.canvas.style.width = options.width
|
|
6766
|
-
_this.canvas.style.height = options.height
|
|
7628
|
+
_this.canvas.style.width = "".concat(options.width, "px");
|
|
7629
|
+
_this.canvas.style.height = "".concat(options.height, "px");
|
|
6767
7630
|
}
|
|
6768
7631
|
_this.fontMetrics = new FontMetrics(document);
|
|
6769
7632
|
_this.ctx.scale(_this.options.scale, _this.options.scale);
|
|
6770
7633
|
_this.ctx.translate(-options.x, -options.y);
|
|
6771
7634
|
_this.ctx.textBaseline = 'bottom';
|
|
6772
7635
|
_this._activeEffects = [];
|
|
6773
|
-
_this.context.logger.debug("Canvas renderer initialized ("
|
|
7636
|
+
_this.context.logger.debug("Canvas renderer initialized (".concat(options.width, "x").concat(options.height, ") with scale ").concat(options.scale));
|
|
6774
7637
|
return _this;
|
|
6775
7638
|
}
|
|
6776
7639
|
CanvasRenderer.prototype.applyEffects = function (effects) {
|
|
@@ -6822,7 +7685,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6822
7685
|
return __generator(this, function (_a) {
|
|
6823
7686
|
switch (_a.label) {
|
|
6824
7687
|
case 0:
|
|
6825
|
-
if (contains(paint.container.flags, 16 /* DEBUG_RENDER */)) {
|
|
7688
|
+
if (contains(paint.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
|
|
6826
7689
|
debugger;
|
|
6827
7690
|
}
|
|
6828
7691
|
if (!paint.container.styles.isVisible()) return [3 /*break*/, 3];
|
|
@@ -6841,7 +7704,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6841
7704
|
CanvasRenderer.prototype.renderTextWithLetterSpacing = function (text, letterSpacing, baseline) {
|
|
6842
7705
|
var _this = this;
|
|
6843
7706
|
if (letterSpacing === 0) {
|
|
6844
|
-
|
|
7707
|
+
// Fixed an issue with characters moving up in non-Firefox.
|
|
7708
|
+
// https://github.com/niklasvh/html2canvas/issues/2107#issuecomment-692462900
|
|
7709
|
+
if (navigator.userAgent.indexOf('Firefox') === -1) {
|
|
7710
|
+
this.ctx.textBaseline = 'ideographic';
|
|
7711
|
+
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
|
7712
|
+
}
|
|
7713
|
+
else {
|
|
7714
|
+
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + baseline);
|
|
7715
|
+
}
|
|
6845
7716
|
}
|
|
6846
7717
|
else {
|
|
6847
7718
|
var letters = segmentGraphemes(text.text);
|
|
@@ -6857,8 +7728,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6857
7728
|
.join('');
|
|
6858
7729
|
var fontFamily = fixIOSSystemFonts(styles.fontFamily).join(', ');
|
|
6859
7730
|
var fontSize = isDimensionToken(styles.fontSize)
|
|
6860
|
-
? ""
|
|
6861
|
-
: styles.fontSize.number
|
|
7731
|
+
? "".concat(styles.fontSize.number).concat(styles.fontSize.unit)
|
|
7732
|
+
: "".concat(styles.fontSize.number, "px");
|
|
6862
7733
|
return [
|
|
6863
7734
|
[styles.fontStyle, fontVariant, styles.fontWeight, fontSize, fontFamily].join(' '),
|
|
6864
7735
|
fontFamily,
|
|
@@ -6867,22 +7738,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6867
7738
|
};
|
|
6868
7739
|
CanvasRenderer.prototype.renderTextNode = function (text, styles) {
|
|
6869
7740
|
return __awaiter(this, void 0, void 0, function () {
|
|
6870
|
-
var
|
|
7741
|
+
var font, paintOrder;
|
|
6871
7742
|
var _this = this;
|
|
6872
|
-
return __generator(this, function (
|
|
6873
|
-
|
|
7743
|
+
return __generator(this, function (_a) {
|
|
7744
|
+
font = this.createFontStyle(styles)[0];
|
|
6874
7745
|
this.ctx.font = font;
|
|
6875
|
-
this.ctx.direction = styles.direction === 1 /* RTL */ ? 'rtl' : 'ltr';
|
|
7746
|
+
this.ctx.direction = styles.direction === 1 /* DIRECTION.RTL */ ? 'rtl' : 'ltr';
|
|
6876
7747
|
this.ctx.textAlign = 'left';
|
|
6877
7748
|
this.ctx.textBaseline = 'alphabetic';
|
|
6878
|
-
_b = this.fontMetrics.getMetrics(fontFamily, fontSize), baseline = _b.baseline, middle = _b.middle;
|
|
6879
7749
|
paintOrder = styles.paintOrder;
|
|
6880
7750
|
text.textBounds.forEach(function (text) {
|
|
6881
7751
|
paintOrder.forEach(function (paintOrderLayer) {
|
|
6882
7752
|
switch (paintOrderLayer) {
|
|
6883
|
-
case 0 /* FILL */:
|
|
7753
|
+
case 0 /* PAINT_ORDER_LAYER.FILL */:
|
|
6884
7754
|
_this.ctx.fillStyle = asString(styles.color);
|
|
6885
|
-
_this.renderTextWithLetterSpacing(text, styles.letterSpacing,
|
|
7755
|
+
_this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
|
|
6886
7756
|
var textShadows = styles.textShadow;
|
|
6887
7757
|
if (textShadows.length && text.text.trim().length) {
|
|
6888
7758
|
textShadows
|
|
@@ -6893,7 +7763,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6893
7763
|
_this.ctx.shadowOffsetX = textShadow.offsetX.number * _this.options.scale;
|
|
6894
7764
|
_this.ctx.shadowOffsetY = textShadow.offsetY.number * _this.options.scale;
|
|
6895
7765
|
_this.ctx.shadowBlur = textShadow.blur.number;
|
|
6896
|
-
_this.renderTextWithLetterSpacing(text, styles.letterSpacing,
|
|
7766
|
+
_this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
|
|
6897
7767
|
});
|
|
6898
7768
|
_this.ctx.shadowColor = '';
|
|
6899
7769
|
_this.ctx.shadowOffsetX = 0;
|
|
@@ -6902,32 +7772,30 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6902
7772
|
}
|
|
6903
7773
|
if (styles.textDecorationLine.length) {
|
|
6904
7774
|
_this.ctx.fillStyle = asString(styles.textDecorationColor || styles.color);
|
|
7775
|
+
var decorationLineHeight_1 = 1;
|
|
6905
7776
|
styles.textDecorationLine.forEach(function (textDecorationLine) {
|
|
7777
|
+
// 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.
|
|
6906
7778
|
switch (textDecorationLine) {
|
|
6907
|
-
case 1 /* UNDERLINE */:
|
|
6908
|
-
|
|
6909
|
-
// TODO As some browsers display the line as more than 1px if the font-size is big,
|
|
6910
|
-
// need to take that into account both in position and size
|
|
6911
|
-
_this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1);
|
|
7779
|
+
case 1 /* TEXT_DECORATION_LINE.UNDERLINE */:
|
|
7780
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top + text.bounds.height - decorationLineHeight_1, text.bounds.width, decorationLineHeight_1);
|
|
6912
7781
|
break;
|
|
6913
|
-
case 2 /* OVERLINE */:
|
|
6914
|
-
_this.ctx.fillRect(text.bounds.left,
|
|
7782
|
+
case 2 /* TEXT_DECORATION_LINE.OVERLINE */:
|
|
7783
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top, text.bounds.width, decorationLineHeight_1);
|
|
6915
7784
|
break;
|
|
6916
|
-
case 3 /* LINE_THROUGH */:
|
|
6917
|
-
|
|
6918
|
-
_this.ctx.fillRect(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1);
|
|
7785
|
+
case 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */:
|
|
7786
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top + (text.bounds.height / 2 - decorationLineHeight_1 / 2), text.bounds.width, decorationLineHeight_1);
|
|
6919
7787
|
break;
|
|
6920
7788
|
}
|
|
6921
7789
|
});
|
|
6922
7790
|
}
|
|
6923
7791
|
break;
|
|
6924
|
-
case 1 /* STROKE */:
|
|
7792
|
+
case 1 /* PAINT_ORDER_LAYER.STROKE */:
|
|
6925
7793
|
if (styles.webkitTextStrokeWidth && text.text.trim().length) {
|
|
6926
7794
|
_this.ctx.strokeStyle = asString(styles.webkitTextStrokeColor);
|
|
6927
7795
|
_this.ctx.lineWidth = styles.webkitTextStrokeWidth;
|
|
6928
7796
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6929
7797
|
_this.ctx.lineJoin = !!window.chrome ? 'miter' : 'round';
|
|
6930
|
-
_this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top +
|
|
7798
|
+
_this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
|
6931
7799
|
}
|
|
6932
7800
|
_this.ctx.strokeStyle = '';
|
|
6933
7801
|
_this.ctx.lineWidth = 0;
|
|
@@ -6941,13 +7809,89 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6941
7809
|
});
|
|
6942
7810
|
};
|
|
6943
7811
|
CanvasRenderer.prototype.renderReplacedElement = function (container, curves, image) {
|
|
6944
|
-
|
|
7812
|
+
var intrinsicWidth = image.naturalWidth || container.intrinsicWidth;
|
|
7813
|
+
var intrinsicHeight = image.naturalHeight || container.intrinsicHeight;
|
|
7814
|
+
if (image && intrinsicWidth > 0 && intrinsicHeight > 0) {
|
|
6945
7815
|
var box = contentBox(container);
|
|
6946
7816
|
var path = calculatePaddingBoxPath(curves);
|
|
6947
7817
|
this.path(path);
|
|
6948
7818
|
this.ctx.save();
|
|
6949
7819
|
this.ctx.clip();
|
|
6950
|
-
|
|
7820
|
+
var sx = 0, sy = 0, sw = intrinsicWidth, sh = intrinsicHeight, dx = box.left, dy = box.top, dw = box.width, dh = box.height;
|
|
7821
|
+
var objectFit = container.styles.objectFit;
|
|
7822
|
+
var boxRatio = dw / dh;
|
|
7823
|
+
var imgRatio = sw / sh;
|
|
7824
|
+
if (objectFit === 2 /* OBJECT_FIT.CONTAIN */) {
|
|
7825
|
+
if (imgRatio > boxRatio) {
|
|
7826
|
+
dh = dw / imgRatio;
|
|
7827
|
+
dy += (box.height - dh) / 2;
|
|
7828
|
+
}
|
|
7829
|
+
else {
|
|
7830
|
+
dw = dh * imgRatio;
|
|
7831
|
+
dx += (box.width - dw) / 2;
|
|
7832
|
+
}
|
|
7833
|
+
}
|
|
7834
|
+
else if (objectFit === 4 /* OBJECT_FIT.COVER */) {
|
|
7835
|
+
if (imgRatio > boxRatio) {
|
|
7836
|
+
sw = sh * boxRatio;
|
|
7837
|
+
sx += (intrinsicWidth - sw) / 2;
|
|
7838
|
+
}
|
|
7839
|
+
else {
|
|
7840
|
+
sh = sw / boxRatio;
|
|
7841
|
+
sy += (intrinsicHeight - sh) / 2;
|
|
7842
|
+
}
|
|
7843
|
+
}
|
|
7844
|
+
else if (objectFit === 8 /* OBJECT_FIT.NONE */) {
|
|
7845
|
+
if (sw > dw) {
|
|
7846
|
+
sx += (sw - dw) / 2;
|
|
7847
|
+
sw = dw;
|
|
7848
|
+
}
|
|
7849
|
+
else {
|
|
7850
|
+
dx += (dw - sw) / 2;
|
|
7851
|
+
dw = sw;
|
|
7852
|
+
}
|
|
7853
|
+
if (sh > dh) {
|
|
7854
|
+
sy += (sh - dh) / 2;
|
|
7855
|
+
sh = dh;
|
|
7856
|
+
}
|
|
7857
|
+
else {
|
|
7858
|
+
dy += (dh - sh) / 2;
|
|
7859
|
+
dh = sh;
|
|
7860
|
+
}
|
|
7861
|
+
}
|
|
7862
|
+
else if (objectFit === 16 /* OBJECT_FIT.SCALE_DOWN */) {
|
|
7863
|
+
var containW = imgRatio > boxRatio ? dw : dh * imgRatio;
|
|
7864
|
+
var noneW = sw > dw ? sw : dw;
|
|
7865
|
+
if (containW < noneW) {
|
|
7866
|
+
if (imgRatio > boxRatio) {
|
|
7867
|
+
dh = dw / imgRatio;
|
|
7868
|
+
dy += (box.height - dh) / 2;
|
|
7869
|
+
}
|
|
7870
|
+
else {
|
|
7871
|
+
dw = dh * imgRatio;
|
|
7872
|
+
dx += (box.width - dw) / 2;
|
|
7873
|
+
}
|
|
7874
|
+
}
|
|
7875
|
+
else {
|
|
7876
|
+
if (sw > dw) {
|
|
7877
|
+
sx += (sw - dw) / 2;
|
|
7878
|
+
sw = dw;
|
|
7879
|
+
}
|
|
7880
|
+
else {
|
|
7881
|
+
dx += (dw - sw) / 2;
|
|
7882
|
+
dw = sw;
|
|
7883
|
+
}
|
|
7884
|
+
if (sh > dh) {
|
|
7885
|
+
sy += (sh - dh) / 2;
|
|
7886
|
+
sh = dh;
|
|
7887
|
+
}
|
|
7888
|
+
else {
|
|
7889
|
+
dy += (dh - sh) / 2;
|
|
7890
|
+
dh = sh;
|
|
7891
|
+
}
|
|
7892
|
+
}
|
|
7893
|
+
}
|
|
7894
|
+
this.ctx.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh);
|
|
6951
7895
|
this.ctx.restore();
|
|
6952
7896
|
}
|
|
6953
7897
|
};
|
|
@@ -6957,7 +7901,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6957
7901
|
return __generator(this, function (_c) {
|
|
6958
7902
|
switch (_c.label) {
|
|
6959
7903
|
case 0:
|
|
6960
|
-
this.applyEffects(paint.getEffects(4 /* CONTENT */));
|
|
7904
|
+
this.applyEffects(paint.getEffects(4 /* EffectTarget.CONTENT */));
|
|
6961
7905
|
container = paint.container;
|
|
6962
7906
|
curves = paint.curves;
|
|
6963
7907
|
styles = container.styles;
|
|
@@ -6985,7 +7929,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6985
7929
|
return [3 /*break*/, 8];
|
|
6986
7930
|
case 7:
|
|
6987
7931
|
_c.sent();
|
|
6988
|
-
this.context.logger.error("Error loading image "
|
|
7932
|
+
this.context.logger.error("Error loading image ".concat(container.src));
|
|
6989
7933
|
return [3 /*break*/, 8];
|
|
6990
7934
|
case 8:
|
|
6991
7935
|
if (container instanceof CanvasElementContainer) {
|
|
@@ -7002,7 +7946,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7002
7946
|
return [3 /*break*/, 12];
|
|
7003
7947
|
case 11:
|
|
7004
7948
|
_c.sent();
|
|
7005
|
-
this.context.logger.error("Error loading svg "
|
|
7949
|
+
this.context.logger.error("Error loading svg ".concat(container.svg.substring(0, 255)));
|
|
7006
7950
|
return [3 /*break*/, 12];
|
|
7007
7951
|
case 12:
|
|
7008
7952
|
if (!(container instanceof IFrameElementContainer && container.tree)) return [3 /*break*/, 14];
|
|
@@ -7062,10 +8006,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7062
8006
|
bounds = contentBox(container);
|
|
7063
8007
|
x = 0;
|
|
7064
8008
|
switch (container.styles.textAlign) {
|
|
7065
|
-
case 1 /* CENTER */:
|
|
8009
|
+
case 1 /* TEXT_ALIGN.CENTER */:
|
|
7066
8010
|
x += bounds.width / 2;
|
|
7067
8011
|
break;
|
|
7068
|
-
case 2 /* RIGHT */:
|
|
8012
|
+
case 2 /* TEXT_ALIGN.RIGHT */:
|
|
7069
8013
|
x += bounds.width;
|
|
7070
8014
|
break;
|
|
7071
8015
|
}
|
|
@@ -7083,10 +8027,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7083
8027
|
this.ctx.textBaseline = 'alphabetic';
|
|
7084
8028
|
this.ctx.textAlign = 'left';
|
|
7085
8029
|
}
|
|
7086
|
-
if (!contains(container.styles.display, 2048 /* LIST_ITEM */)) return [3 /*break*/, 20];
|
|
8030
|
+
if (!contains(container.styles.display, 2048 /* DISPLAY.LIST_ITEM */)) return [3 /*break*/, 20];
|
|
7087
8031
|
if (!(container.styles.listStyleImage !== null)) return [3 /*break*/, 19];
|
|
7088
8032
|
img = container.styles.listStyleImage;
|
|
7089
|
-
if (!(img.type === 0 /* URL */)) return [3 /*break*/, 18];
|
|
8033
|
+
if (!(img.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 18];
|
|
7090
8034
|
image = void 0;
|
|
7091
8035
|
url = img.url;
|
|
7092
8036
|
_c.label = 15;
|
|
@@ -7099,11 +8043,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7099
8043
|
return [3 /*break*/, 18];
|
|
7100
8044
|
case 17:
|
|
7101
8045
|
_c.sent();
|
|
7102
|
-
this.context.logger.error("Error loading list-style-image "
|
|
8046
|
+
this.context.logger.error("Error loading list-style-image ".concat(url));
|
|
7103
8047
|
return [3 /*break*/, 18];
|
|
7104
8048
|
case 18: return [3 /*break*/, 20];
|
|
7105
8049
|
case 19:
|
|
7106
|
-
if (paint.listValue && container.styles.listStyleType !== -1 /* NONE */) {
|
|
8050
|
+
if (paint.listValue && container.styles.listStyleType !== -1 /* LIST_STYLE_TYPE.NONE */) {
|
|
7107
8051
|
fontFamily = this.createFontStyle(styles)[0];
|
|
7108
8052
|
this.ctx.font = fontFamily;
|
|
7109
8053
|
this.ctx.fillStyle = asString(styles.color);
|
|
@@ -7126,7 +8070,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7126
8070
|
return __generator(this, function (_p) {
|
|
7127
8071
|
switch (_p.label) {
|
|
7128
8072
|
case 0:
|
|
7129
|
-
if (contains(stack.element.container.flags, 16 /* DEBUG_RENDER */)) {
|
|
8073
|
+
if (contains(stack.element.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
|
|
7130
8074
|
debugger;
|
|
7131
8075
|
}
|
|
7132
8076
|
// https://www.w3.org/TR/css-position-3/#painting-order
|
|
@@ -7274,10 +8218,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7274
8218
|
this.ctx.translate(-offsetX, -offsetY);
|
|
7275
8219
|
};
|
|
7276
8220
|
CanvasRenderer.prototype.resizeImage = function (image, width, height) {
|
|
8221
|
+
// https://github.com/niklasvh/html2canvas/pull/2911
|
|
8222
|
+
// if (image.width === width && image.height === height) {
|
|
8223
|
+
// return image;
|
|
8224
|
+
// }
|
|
7277
8225
|
var _a;
|
|
7278
|
-
if (image.width === width && image.height === height) {
|
|
7279
|
-
return image;
|
|
7280
|
-
}
|
|
7281
8226
|
var ownerDocument = (_a = this.canvas.ownerDocument) !== null && _a !== void 0 ? _a : document;
|
|
7282
8227
|
var canvas = ownerDocument.createElement('canvas');
|
|
7283
8228
|
canvas.width = Math.max(1, width);
|
|
@@ -7294,11 +8239,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7294
8239
|
case 0:
|
|
7295
8240
|
index = container.styles.backgroundImage.length - 1;
|
|
7296
8241
|
_loop_1 = function (backgroundImage) {
|
|
7297
|
-
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;
|
|
8242
|
+
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;
|
|
7298
8243
|
return __generator(this, function (_h) {
|
|
7299
8244
|
switch (_h.label) {
|
|
7300
8245
|
case 0:
|
|
7301
|
-
if (!(backgroundImage.type === 0 /* URL */)) return [3 /*break*/, 5];
|
|
8246
|
+
if (!(backgroundImage.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 5];
|
|
7302
8247
|
image = void 0;
|
|
7303
8248
|
url = backgroundImage.url;
|
|
7304
8249
|
_h.label = 1;
|
|
@@ -7310,14 +8255,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7310
8255
|
return [3 /*break*/, 4];
|
|
7311
8256
|
case 3:
|
|
7312
8257
|
_h.sent();
|
|
7313
|
-
this_1.context.logger.error("Error loading background-image "
|
|
8258
|
+
this_1.context.logger.error("Error loading background-image ".concat(url));
|
|
7314
8259
|
return [3 /*break*/, 4];
|
|
7315
8260
|
case 4:
|
|
7316
8261
|
if (image) {
|
|
8262
|
+
imageWidth = isNaN(image.width) || image.width === 0 ? 1 : image.width;
|
|
8263
|
+
imageHeight = isNaN(image.height) || image.height === 0 ? 1 : image.height;
|
|
7317
8264
|
_c = calculateBackgroundRendering(container, index, [
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
8265
|
+
imageWidth,
|
|
8266
|
+
imageHeight,
|
|
8267
|
+
imageWidth / imageHeight
|
|
7321
8268
|
]), path = _c[0], x = _c[1], y = _c[2], width = _c[3], height = _c[4];
|
|
7322
8269
|
pattern = this_1.ctx.createPattern(this_1.resizeImage(image, width, height), 'repeat');
|
|
7323
8270
|
this_1.renderRepeat(path, pattern, x, y);
|
|
@@ -7442,7 +8389,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7442
8389
|
return __generator(this, function (_a) {
|
|
7443
8390
|
switch (_a.label) {
|
|
7444
8391
|
case 0:
|
|
7445
|
-
this.applyEffects(paint.getEffects(2 /* BACKGROUND_BORDERS */));
|
|
8392
|
+
this.applyEffects(paint.getEffects(2 /* EffectTarget.BACKGROUND_BORDERS */));
|
|
7446
8393
|
styles = paint.container.styles;
|
|
7447
8394
|
hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
|
|
7448
8395
|
borders = [
|
|
@@ -7498,20 +8445,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7498
8445
|
case 3:
|
|
7499
8446
|
if (!(_i < borders_1.length)) return [3 /*break*/, 13];
|
|
7500
8447
|
border = borders_1[_i];
|
|
7501
|
-
if (!(border.style !== 0 /* NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
|
|
7502
|
-
if (!(border.style === 2 /* DASHED */)) return [3 /*break*/, 5];
|
|
7503
|
-
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* DASHED */)];
|
|
8448
|
+
if (!(border.style !== 0 /* BORDER_STYLE.NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
|
|
8449
|
+
if (!(border.style === 2 /* BORDER_STYLE.DASHED */)) return [3 /*break*/, 5];
|
|
8450
|
+
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* BORDER_STYLE.DASHED */)];
|
|
7504
8451
|
case 4:
|
|
7505
8452
|
_a.sent();
|
|
7506
8453
|
return [3 /*break*/, 11];
|
|
7507
8454
|
case 5:
|
|
7508
|
-
if (!(border.style === 3 /* DOTTED */)) return [3 /*break*/, 7];
|
|
7509
|
-
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* DOTTED */)];
|
|
8455
|
+
if (!(border.style === 3 /* BORDER_STYLE.DOTTED */)) return [3 /*break*/, 7];
|
|
8456
|
+
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* BORDER_STYLE.DOTTED */)];
|
|
7510
8457
|
case 6:
|
|
7511
8458
|
_a.sent();
|
|
7512
8459
|
return [3 /*break*/, 11];
|
|
7513
8460
|
case 7:
|
|
7514
|
-
if (!(border.style === 4 /* DOUBLE */)) return [3 /*break*/, 9];
|
|
8461
|
+
if (!(border.style === 4 /* BORDER_STYLE.DOUBLE */)) return [3 /*break*/, 9];
|
|
7515
8462
|
return [4 /*yield*/, this.renderDoubleBorder(border.color, border.width, side, paint.curves)];
|
|
7516
8463
|
case 8:
|
|
7517
8464
|
_a.sent();
|
|
@@ -7538,7 +8485,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7538
8485
|
this.ctx.save();
|
|
7539
8486
|
strokePaths = parsePathForBorderStroke(curvePoints, side);
|
|
7540
8487
|
boxPaths = parsePathForBorder(curvePoints, side);
|
|
7541
|
-
if (style === 2 /* DASHED */) {
|
|
8488
|
+
if (style === 2 /* BORDER_STYLE.DASHED */) {
|
|
7542
8489
|
this.path(boxPaths);
|
|
7543
8490
|
this.ctx.clip();
|
|
7544
8491
|
}
|
|
@@ -7565,7 +8512,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7565
8512
|
length = Math.abs(startY - endY);
|
|
7566
8513
|
}
|
|
7567
8514
|
this.ctx.beginPath();
|
|
7568
|
-
if (style === 3 /* DOTTED */) {
|
|
8515
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7569
8516
|
this.formatPath(strokePaths);
|
|
7570
8517
|
}
|
|
7571
8518
|
else {
|
|
@@ -7573,7 +8520,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7573
8520
|
}
|
|
7574
8521
|
dashLength = width < 3 ? width * 3 : width * 2;
|
|
7575
8522
|
spaceLength = width < 3 ? width * 2 : width;
|
|
7576
|
-
if (style === 3 /* DOTTED */) {
|
|
8523
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7577
8524
|
dashLength = width;
|
|
7578
8525
|
spaceLength = width;
|
|
7579
8526
|
}
|
|
@@ -7596,14 +8543,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7596
8543
|
: maxSpace;
|
|
7597
8544
|
}
|
|
7598
8545
|
if (useLineDash) {
|
|
7599
|
-
if (style === 3 /* DOTTED */) {
|
|
8546
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7600
8547
|
this.ctx.setLineDash([0, dashLength + spaceLength]);
|
|
7601
8548
|
}
|
|
7602
8549
|
else {
|
|
7603
8550
|
this.ctx.setLineDash([dashLength, spaceLength]);
|
|
7604
8551
|
}
|
|
7605
8552
|
}
|
|
7606
|
-
if (style === 3 /* DOTTED */) {
|
|
8553
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7607
8554
|
this.ctx.lineCap = 'round';
|
|
7608
8555
|
this.ctx.lineWidth = width;
|
|
7609
8556
|
}
|
|
@@ -7614,7 +8561,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7614
8561
|
this.ctx.stroke();
|
|
7615
8562
|
this.ctx.setLineDash([]);
|
|
7616
8563
|
// dashed round edge gap
|
|
7617
|
-
if (style === 2 /* DASHED */) {
|
|
8564
|
+
if (style === 2 /* BORDER_STYLE.DASHED */) {
|
|
7618
8565
|
if (isBezierCurve(boxPaths[0])) {
|
|
7619
8566
|
path1 = boxPaths[3];
|
|
7620
8567
|
path2 = boxPaths[0];
|
|
@@ -7671,22 +8618,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7671
8618
|
};
|
|
7672
8619
|
var calculateBackgroundCurvedPaintingArea = function (clip, curves) {
|
|
7673
8620
|
switch (clip) {
|
|
7674
|
-
case 0 /* BORDER_BOX */:
|
|
8621
|
+
case 0 /* BACKGROUND_CLIP.BORDER_BOX */:
|
|
7675
8622
|
return calculateBorderBoxPath(curves);
|
|
7676
|
-
case 2 /* CONTENT_BOX */:
|
|
8623
|
+
case 2 /* BACKGROUND_CLIP.CONTENT_BOX */:
|
|
7677
8624
|
return calculateContentBoxPath(curves);
|
|
7678
|
-
case 1 /* PADDING_BOX */:
|
|
8625
|
+
case 1 /* BACKGROUND_CLIP.PADDING_BOX */:
|
|
7679
8626
|
default:
|
|
7680
8627
|
return calculatePaddingBoxPath(curves);
|
|
7681
8628
|
}
|
|
7682
8629
|
};
|
|
7683
8630
|
var canvasTextAlign = function (textAlign) {
|
|
7684
8631
|
switch (textAlign) {
|
|
7685
|
-
case 1 /* CENTER */:
|
|
8632
|
+
case 1 /* TEXT_ALIGN.CENTER */:
|
|
7686
8633
|
return 'center';
|
|
7687
|
-
case 2 /* RIGHT */:
|
|
8634
|
+
case 2 /* TEXT_ALIGN.RIGHT */:
|
|
7688
8635
|
return 'right';
|
|
7689
|
-
case 0 /* LEFT */:
|
|
8636
|
+
case 0 /* TEXT_ALIGN.LEFT */:
|
|
7690
8637
|
default:
|
|
7691
8638
|
return 'left';
|
|
7692
8639
|
}
|
|
@@ -7708,11 +8655,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7708
8655
|
_this.options = options;
|
|
7709
8656
|
_this.canvas.width = Math.floor(options.width * options.scale);
|
|
7710
8657
|
_this.canvas.height = Math.floor(options.height * options.scale);
|
|
7711
|
-
_this.canvas.style.width = options.width
|
|
7712
|
-
_this.canvas.style.height = options.height
|
|
8658
|
+
_this.canvas.style.width = "".concat(options.width, "px");
|
|
8659
|
+
_this.canvas.style.height = "".concat(options.height, "px");
|
|
7713
8660
|
_this.ctx.scale(_this.options.scale, _this.options.scale);
|
|
7714
8661
|
_this.ctx.translate(-options.x, -options.y);
|
|
7715
|
-
_this.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("
|
|
8662
|
+
_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));
|
|
7716
8663
|
return _this;
|
|
7717
8664
|
}
|
|
7718
8665
|
ForeignObjectRenderer.prototype.render = function (element) {
|
|
@@ -7744,7 +8691,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7744
8691
|
resolve(img);
|
|
7745
8692
|
};
|
|
7746
8693
|
img.onerror = reject;
|
|
7747
|
-
img.src = "data:image/svg+xml;charset=utf-8,"
|
|
8694
|
+
img.src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svg)));
|
|
7748
8695
|
});
|
|
7749
8696
|
};
|
|
7750
8697
|
|
|
@@ -7765,7 +8712,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7765
8712
|
// eslint-disable-next-line no-console
|
|
7766
8713
|
if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
|
|
7767
8714
|
// eslint-disable-next-line no-console
|
|
7768
|
-
console.debug.apply(console, __spreadArray([this.id, this.getTime()
|
|
8715
|
+
console.debug.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7769
8716
|
}
|
|
7770
8717
|
else {
|
|
7771
8718
|
this.info.apply(this, args);
|
|
@@ -7785,7 +8732,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7785
8732
|
// eslint-disable-next-line no-console
|
|
7786
8733
|
if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
|
|
7787
8734
|
// eslint-disable-next-line no-console
|
|
7788
|
-
console.info.apply(console, __spreadArray([this.id, this.getTime()
|
|
8735
|
+
console.info.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7789
8736
|
}
|
|
7790
8737
|
}
|
|
7791
8738
|
};
|
|
@@ -7799,7 +8746,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7799
8746
|
// eslint-disable-next-line no-console
|
|
7800
8747
|
if (typeof window !== 'undefined' && window.console && typeof console.warn === 'function') {
|
|
7801
8748
|
// eslint-disable-next-line no-console
|
|
7802
|
-
console.warn.apply(console, __spreadArray([this.id, this.getTime()
|
|
8749
|
+
console.warn.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7803
8750
|
}
|
|
7804
8751
|
else {
|
|
7805
8752
|
this.info.apply(this, args);
|
|
@@ -7816,7 +8763,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7816
8763
|
// eslint-disable-next-line no-console
|
|
7817
8764
|
if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
|
|
7818
8765
|
// eslint-disable-next-line no-console
|
|
7819
|
-
console.error.apply(console, __spreadArray([this.id, this.getTime()
|
|
8766
|
+
console.error.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7820
8767
|
}
|
|
7821
8768
|
else {
|
|
7822
8769
|
this.info.apply(this, args);
|
|
@@ -7831,7 +8778,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7831
8778
|
function Context(options, windowBounds) {
|
|
7832
8779
|
var _a;
|
|
7833
8780
|
this.windowBounds = windowBounds;
|
|
7834
|
-
this.instanceName = "#"
|
|
8781
|
+
this.instanceName = "#".concat(Context.instanceCount++);
|
|
7835
8782
|
this.logger = new Logger({ id: this.instanceName, enabled: options.logging });
|
|
7836
8783
|
this.cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new Cache(this, options);
|
|
7837
8784
|
}
|
|
@@ -7886,7 +8833,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7886
8833
|
inlineImages: foreignObjectRendering,
|
|
7887
8834
|
copyStyles: foreignObjectRendering
|
|
7888
8835
|
};
|
|
7889
|
-
context.logger.debug("Starting document clone with size "
|
|
8836
|
+
context.logger.debug("Starting document clone with size ".concat(windowBounds.width, "x").concat(windowBounds.height, " scrolled to ").concat(-windowBounds.left, ",").concat(-windowBounds.top));
|
|
7890
8837
|
documentCloner = new DocumentCloner(context, element, cloneOptions);
|
|
7891
8838
|
clonedElement = documentCloner.clonedReferenceElement;
|
|
7892
8839
|
if (!clonedElement) {
|
|
@@ -7916,13 +8863,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7916
8863
|
canvas = _u.sent();
|
|
7917
8864
|
return [3 /*break*/, 5];
|
|
7918
8865
|
case 3:
|
|
7919
|
-
context.logger.debug("Document cloned, element located at "
|
|
8866
|
+
context.logger.debug("Document cloned, element located at ".concat(left, ",").concat(top, " with size ").concat(width, "x").concat(height, " using computed rendering"));
|
|
7920
8867
|
context.logger.debug("Starting DOM parsing");
|
|
7921
8868
|
root = parseTree(context, clonedElement);
|
|
7922
8869
|
if (backgroundColor === root.styles.backgroundColor) {
|
|
7923
8870
|
root.styles.backgroundColor = COLORS.TRANSPARENT;
|
|
7924
8871
|
}
|
|
7925
|
-
context.logger.debug("Starting renderer for element at "
|
|
8872
|
+
context.logger.debug("Starting renderer for element at ".concat(renderOptions.x, ",").concat(renderOptions.y, " with size ").concat(renderOptions.width, "x").concat(renderOptions.height));
|
|
7926
8873
|
renderer = new CanvasRenderer(context, renderOptions);
|
|
7927
8874
|
return [4 /*yield*/, renderer.render(root)];
|
|
7928
8875
|
case 4:
|
|
@@ -7964,8 +8911,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7964
8911
|
|
|
7965
8912
|
return html2canvas;
|
|
7966
8913
|
|
|
7967
|
-
}))
|
|
7968
|
-
//# sourceMappingURL=html2canvas.js.map
|
|
8914
|
+
}));
|
|
8915
|
+
//# sourceMappingURL=html2canvas-pro.js.map
|
|
7969
8916
|
});
|
|
7970
8917
|
|
|
7971
8918
|
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)}}";
|
|
@@ -8248,7 +9195,7 @@ const FeedbackModal = class {
|
|
|
8248
9195
|
captureScreenshot() {
|
|
8249
9196
|
return new Promise((resolve, reject) => {
|
|
8250
9197
|
requestAnimationFrame(() => {
|
|
8251
|
-
|
|
9198
|
+
html2canvasPro(document.body, {
|
|
8252
9199
|
x: window.scrollX,
|
|
8253
9200
|
y: window.scrollY,
|
|
8254
9201
|
width: window.innerWidth,
|