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
|
@@ -16,15 +16,15 @@ function commonjsRequire () {
|
|
|
16
16
|
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var html2canvasPro = createCommonjsModule(function (module, exports) {
|
|
20
20
|
/*!
|
|
21
|
-
* html2canvas 1.
|
|
22
|
-
* Copyright (c)
|
|
21
|
+
* html2canvas-pro 1.5.8 <https://yorickshan.github.io/html2canvas-pro/>
|
|
22
|
+
* Copyright (c) 2024 yorickshan <https://github.com/yorickshan>
|
|
23
23
|
* Released under MIT License
|
|
24
24
|
*/
|
|
25
25
|
(function (global, factory) {
|
|
26
26
|
module.exports = factory() ;
|
|
27
|
-
}(commonjsGlobal, (function () {
|
|
27
|
+
})(commonjsGlobal, (function () {
|
|
28
28
|
/*! *****************************************************************************
|
|
29
29
|
Copyright (c) Microsoft Corporation.
|
|
30
30
|
|
|
@@ -1008,38 +1008,38 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1008
1008
|
return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
|
|
1009
1009
|
};
|
|
1010
1010
|
var LEFT_PARENTHESIS_TOKEN = {
|
|
1011
|
-
type: 2 /* LEFT_PARENTHESIS_TOKEN */
|
|
1011
|
+
type: 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */
|
|
1012
1012
|
};
|
|
1013
1013
|
var RIGHT_PARENTHESIS_TOKEN = {
|
|
1014
|
-
type: 3 /* RIGHT_PARENTHESIS_TOKEN */
|
|
1015
|
-
};
|
|
1016
|
-
var COMMA_TOKEN = { type: 4 /* COMMA_TOKEN */ };
|
|
1017
|
-
var SUFFIX_MATCH_TOKEN = { type: 13 /* SUFFIX_MATCH_TOKEN */ };
|
|
1018
|
-
var PREFIX_MATCH_TOKEN = { type: 8 /* PREFIX_MATCH_TOKEN */ };
|
|
1019
|
-
var COLUMN_TOKEN = { type: 21 /* COLUMN_TOKEN */ };
|
|
1020
|
-
var DASH_MATCH_TOKEN = { type: 9 /* DASH_MATCH_TOKEN */ };
|
|
1021
|
-
var INCLUDE_MATCH_TOKEN = { type: 10 /* INCLUDE_MATCH_TOKEN */ };
|
|
1014
|
+
type: 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */
|
|
1015
|
+
};
|
|
1016
|
+
var COMMA_TOKEN = { type: 4 /* TokenType.COMMA_TOKEN */ };
|
|
1017
|
+
var SUFFIX_MATCH_TOKEN = { type: 13 /* TokenType.SUFFIX_MATCH_TOKEN */ };
|
|
1018
|
+
var PREFIX_MATCH_TOKEN = { type: 8 /* TokenType.PREFIX_MATCH_TOKEN */ };
|
|
1019
|
+
var COLUMN_TOKEN = { type: 21 /* TokenType.COLUMN_TOKEN */ };
|
|
1020
|
+
var DASH_MATCH_TOKEN = { type: 9 /* TokenType.DASH_MATCH_TOKEN */ };
|
|
1021
|
+
var INCLUDE_MATCH_TOKEN = { type: 10 /* TokenType.INCLUDE_MATCH_TOKEN */ };
|
|
1022
1022
|
var LEFT_CURLY_BRACKET_TOKEN = {
|
|
1023
|
-
type: 11 /* LEFT_CURLY_BRACKET_TOKEN */
|
|
1023
|
+
type: 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */
|
|
1024
1024
|
};
|
|
1025
1025
|
var RIGHT_CURLY_BRACKET_TOKEN = {
|
|
1026
|
-
type: 12 /* RIGHT_CURLY_BRACKET_TOKEN */
|
|
1027
|
-
};
|
|
1028
|
-
var SUBSTRING_MATCH_TOKEN = { type: 14 /* SUBSTRING_MATCH_TOKEN */ };
|
|
1029
|
-
var BAD_URL_TOKEN = { type: 23 /* BAD_URL_TOKEN */ };
|
|
1030
|
-
var BAD_STRING_TOKEN = { type: 1 /* BAD_STRING_TOKEN */ };
|
|
1031
|
-
var CDO_TOKEN = { type: 25 /* CDO_TOKEN */ };
|
|
1032
|
-
var CDC_TOKEN = { type: 24 /* CDC_TOKEN */ };
|
|
1033
|
-
var COLON_TOKEN = { type: 26 /* COLON_TOKEN */ };
|
|
1034
|
-
var SEMICOLON_TOKEN = { type: 27 /* SEMICOLON_TOKEN */ };
|
|
1026
|
+
type: 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */
|
|
1027
|
+
};
|
|
1028
|
+
var SUBSTRING_MATCH_TOKEN = { type: 14 /* TokenType.SUBSTRING_MATCH_TOKEN */ };
|
|
1029
|
+
var BAD_URL_TOKEN = { type: 23 /* TokenType.BAD_URL_TOKEN */ };
|
|
1030
|
+
var BAD_STRING_TOKEN = { type: 1 /* TokenType.BAD_STRING_TOKEN */ };
|
|
1031
|
+
var CDO_TOKEN = { type: 25 /* TokenType.CDO_TOKEN */ };
|
|
1032
|
+
var CDC_TOKEN = { type: 24 /* TokenType.CDC_TOKEN */ };
|
|
1033
|
+
var COLON_TOKEN = { type: 26 /* TokenType.COLON_TOKEN */ };
|
|
1034
|
+
var SEMICOLON_TOKEN = { type: 27 /* TokenType.SEMICOLON_TOKEN */ };
|
|
1035
1035
|
var LEFT_SQUARE_BRACKET_TOKEN = {
|
|
1036
|
-
type: 28 /* LEFT_SQUARE_BRACKET_TOKEN */
|
|
1036
|
+
type: 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */
|
|
1037
1037
|
};
|
|
1038
1038
|
var RIGHT_SQUARE_BRACKET_TOKEN = {
|
|
1039
|
-
type: 29 /* RIGHT_SQUARE_BRACKET_TOKEN */
|
|
1039
|
+
type: 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */
|
|
1040
1040
|
};
|
|
1041
|
-
var WHITESPACE_TOKEN = { type: 31 /* WHITESPACE_TOKEN */ };
|
|
1042
|
-
var EOF_TOKEN = { type: 32 /* EOF_TOKEN */ };
|
|
1041
|
+
var WHITESPACE_TOKEN = { type: 31 /* TokenType.WHITESPACE_TOKEN */ };
|
|
1042
|
+
var EOF_TOKEN = { type: 32 /* TokenType.EOF_TOKEN */ };
|
|
1043
1043
|
var Tokenizer = /** @class */ (function () {
|
|
1044
1044
|
function Tokenizer() {
|
|
1045
1045
|
this._value = [];
|
|
@@ -1068,7 +1068,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1068
1068
|
if (isNameCodePoint(c1) || isValidEscape(c2, c3)) {
|
|
1069
1069
|
var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED;
|
|
1070
1070
|
var value = this.consumeName();
|
|
1071
|
-
return { type: 5 /* HASH_TOKEN */, value: value, flags: flags };
|
|
1071
|
+
return { type: 5 /* TokenType.HASH_TOKEN */, value: value, flags: flags };
|
|
1072
1072
|
}
|
|
1073
1073
|
break;
|
|
1074
1074
|
case DOLLAR_SIGN:
|
|
@@ -1157,7 +1157,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1157
1157
|
var a3 = this.peekCodePoint(2);
|
|
1158
1158
|
if (isIdentifierStart(a1, a2, a3)) {
|
|
1159
1159
|
var value = this.consumeName();
|
|
1160
|
-
return { type: 7 /* AT_KEYWORD_TOKEN */, value: value };
|
|
1160
|
+
return { type: 7 /* TokenType.AT_KEYWORD_TOKEN */, value: value };
|
|
1161
1161
|
}
|
|
1162
1162
|
break;
|
|
1163
1163
|
case LEFT_SQUARE_BRACKET:
|
|
@@ -1221,7 +1221,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1221
1221
|
this.reconsumeCodePoint(codePoint);
|
|
1222
1222
|
return this.consumeIdentLikeToken();
|
|
1223
1223
|
}
|
|
1224
|
-
return { type: 6 /* DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
|
|
1224
|
+
return { type: 6 /* TokenType.DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
|
|
1225
1225
|
};
|
|
1226
1226
|
Tokenizer.prototype.consumeCodePoint = function () {
|
|
1227
1227
|
var value = this._value.shift();
|
|
@@ -1252,7 +1252,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1252
1252
|
if (questionMarks) {
|
|
1253
1253
|
var start_1 = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16);
|
|
1254
1254
|
var end = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16);
|
|
1255
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start_1, end: end };
|
|
1255
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start_1, end: end };
|
|
1256
1256
|
}
|
|
1257
1257
|
var start = parseInt(fromCodePoint$1.apply(void 0, digits), 16);
|
|
1258
1258
|
if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) {
|
|
@@ -1264,10 +1264,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1264
1264
|
codePoint = this.consumeCodePoint();
|
|
1265
1265
|
}
|
|
1266
1266
|
var end = parseInt(fromCodePoint$1.apply(void 0, endDigits), 16);
|
|
1267
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: end };
|
|
1267
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: end };
|
|
1268
1268
|
}
|
|
1269
1269
|
else {
|
|
1270
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: start };
|
|
1270
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: start };
|
|
1271
1271
|
}
|
|
1272
1272
|
};
|
|
1273
1273
|
Tokenizer.prototype.consumeIdentLikeToken = function () {
|
|
@@ -1278,24 +1278,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) {
|
|
1280
1280
|
this.consumeCodePoint();
|
|
1281
|
-
return { type: 19 /* FUNCTION_TOKEN */, value: value };
|
|
1281
|
+
return { type: 19 /* TokenType.FUNCTION_TOKEN */, value: value };
|
|
1282
1282
|
}
|
|
1283
|
-
return { type: 20 /* IDENT_TOKEN */, value: value };
|
|
1283
|
+
return { type: 20 /* TokenType.IDENT_TOKEN */, value: value };
|
|
1284
1284
|
};
|
|
1285
1285
|
Tokenizer.prototype.consumeUrlToken = function () {
|
|
1286
1286
|
var value = [];
|
|
1287
1287
|
this.consumeWhiteSpace();
|
|
1288
1288
|
if (this.peekCodePoint(0) === EOF) {
|
|
1289
|
-
return { type: 22 /* URL_TOKEN */, value: '' };
|
|
1289
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: '' };
|
|
1290
1290
|
}
|
|
1291
1291
|
var next = this.peekCodePoint(0);
|
|
1292
1292
|
if (next === APOSTROPHE || next === QUOTATION_MARK) {
|
|
1293
1293
|
var stringToken = this.consumeStringToken(this.consumeCodePoint());
|
|
1294
|
-
if (stringToken.type === 0 /* STRING_TOKEN */) {
|
|
1294
|
+
if (stringToken.type === 0 /* TokenType.STRING_TOKEN */) {
|
|
1295
1295
|
this.consumeWhiteSpace();
|
|
1296
1296
|
if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
|
|
1297
1297
|
this.consumeCodePoint();
|
|
1298
|
-
return { type: 22 /* URL_TOKEN */, value: stringToken.value };
|
|
1298
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: stringToken.value };
|
|
1299
1299
|
}
|
|
1300
1300
|
}
|
|
1301
1301
|
this.consumeBadUrlRemnants();
|
|
@@ -1304,13 +1304,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1304
1304
|
while (true) {
|
|
1305
1305
|
var codePoint = this.consumeCodePoint();
|
|
1306
1306
|
if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
|
|
1307
|
-
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1307
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1308
1308
|
}
|
|
1309
1309
|
else if (isWhiteSpace(codePoint)) {
|
|
1310
1310
|
this.consumeWhiteSpace();
|
|
1311
1311
|
if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
|
|
1312
1312
|
this.consumeCodePoint();
|
|
1313
|
-
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1313
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1314
1314
|
}
|
|
1315
1315
|
this.consumeBadUrlRemnants();
|
|
1316
1316
|
return BAD_URL_TOKEN;
|
|
@@ -1370,7 +1370,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1370
1370
|
var codePoint = this._value[i];
|
|
1371
1371
|
if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) {
|
|
1372
1372
|
value += this.consumeStringSlice(i);
|
|
1373
|
-
return { type: 0 /* STRING_TOKEN */, value: value };
|
|
1373
|
+
return { type: 0 /* TokenType.STRING_TOKEN */, value: value };
|
|
1374
1374
|
}
|
|
1375
1375
|
if (codePoint === LINE_FEED) {
|
|
1376
1376
|
this._value.splice(0, i);
|
|
@@ -1432,13 +1432,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1432
1432
|
var c3 = this.peekCodePoint(2);
|
|
1433
1433
|
if (isIdentifierStart(c1, c2, c3)) {
|
|
1434
1434
|
var unit = this.consumeName();
|
|
1435
|
-
return { type: 15 /* DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
|
|
1435
|
+
return { type: 15 /* TokenType.DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
|
|
1436
1436
|
}
|
|
1437
1437
|
if (c1 === PERCENTAGE_SIGN) {
|
|
1438
1438
|
this.consumeCodePoint();
|
|
1439
|
-
return { type: 16 /* PERCENTAGE_TOKEN */, number: number, flags: flags };
|
|
1439
|
+
return { type: 16 /* TokenType.PERCENTAGE_TOKEN */, number: number, flags: flags };
|
|
1440
1440
|
}
|
|
1441
|
-
return { type: 17 /* NUMBER_TOKEN */, number: number, flags: flags };
|
|
1441
|
+
return { type: 17 /* TokenType.NUMBER_TOKEN */, number: number, flags: flags };
|
|
1442
1442
|
};
|
|
1443
1443
|
Tokenizer.prototype.consumeEscapedCodePoint = function () {
|
|
1444
1444
|
var codePoint = this.consumeCodePoint();
|
|
@@ -1497,18 +1497,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1497
1497
|
};
|
|
1498
1498
|
Parser.prototype.parseComponentValue = function () {
|
|
1499
1499
|
var token = this.consumeToken();
|
|
1500
|
-
while (token.type === 31 /* WHITESPACE_TOKEN */) {
|
|
1500
|
+
while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */) {
|
|
1501
1501
|
token = this.consumeToken();
|
|
1502
1502
|
}
|
|
1503
|
-
if (token.type === 32 /* EOF_TOKEN */) {
|
|
1503
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1504
1504
|
throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
|
|
1505
1505
|
}
|
|
1506
1506
|
this.reconsumeToken(token);
|
|
1507
1507
|
var value = this.consumeComponentValue();
|
|
1508
1508
|
do {
|
|
1509
1509
|
token = this.consumeToken();
|
|
1510
|
-
} while (token.type === 31 /* WHITESPACE_TOKEN */);
|
|
1511
|
-
if (token.type === 32 /* EOF_TOKEN */) {
|
|
1510
|
+
} while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */);
|
|
1511
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1512
1512
|
return value;
|
|
1513
1513
|
}
|
|
1514
1514
|
throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
|
|
@@ -1517,7 +1517,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1517
1517
|
var values = [];
|
|
1518
1518
|
while (true) {
|
|
1519
1519
|
var value = this.consumeComponentValue();
|
|
1520
|
-
if (value.type === 32 /* EOF_TOKEN */) {
|
|
1520
|
+
if (value.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1521
1521
|
return values;
|
|
1522
1522
|
}
|
|
1523
1523
|
values.push(value);
|
|
@@ -1527,11 +1527,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1527
1527
|
Parser.prototype.consumeComponentValue = function () {
|
|
1528
1528
|
var token = this.consumeToken();
|
|
1529
1529
|
switch (token.type) {
|
|
1530
|
-
case 11 /* LEFT_CURLY_BRACKET_TOKEN */:
|
|
1531
|
-
case 28 /* LEFT_SQUARE_BRACKET_TOKEN */:
|
|
1532
|
-
case 2 /* LEFT_PARENTHESIS_TOKEN */:
|
|
1530
|
+
case 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */:
|
|
1531
|
+
case 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */:
|
|
1532
|
+
case 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */:
|
|
1533
1533
|
return this.consumeSimpleBlock(token.type);
|
|
1534
|
-
case 19 /* FUNCTION_TOKEN */:
|
|
1534
|
+
case 19 /* TokenType.FUNCTION_TOKEN */:
|
|
1535
1535
|
return this.consumeFunction(token);
|
|
1536
1536
|
}
|
|
1537
1537
|
return token;
|
|
@@ -1540,7 +1540,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1540
1540
|
var block = { type: type, values: [] };
|
|
1541
1541
|
var token = this.consumeToken();
|
|
1542
1542
|
while (true) {
|
|
1543
|
-
if (token.type === 32 /* EOF_TOKEN */ || isEndingTokenFor(token, type)) {
|
|
1543
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */ || isEndingTokenFor(token, type)) {
|
|
1544
1544
|
return block;
|
|
1545
1545
|
}
|
|
1546
1546
|
this.reconsumeToken(token);
|
|
@@ -1552,11 +1552,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1552
1552
|
var cssFunction = {
|
|
1553
1553
|
name: functionToken.value,
|
|
1554
1554
|
values: [],
|
|
1555
|
-
type: 18 /* FUNCTION */
|
|
1555
|
+
type: 18 /* TokenType.FUNCTION */
|
|
1556
1556
|
};
|
|
1557
1557
|
while (true) {
|
|
1558
1558
|
var token = this.consumeToken();
|
|
1559
|
-
if (token.type === 32 /* EOF_TOKEN */ || token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */) {
|
|
1559
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */ || token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */) {
|
|
1560
1560
|
return cssFunction;
|
|
1561
1561
|
}
|
|
1562
1562
|
this.reconsumeToken(token);
|
|
@@ -1572,22 +1572,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1572
1572
|
};
|
|
1573
1573
|
return Parser;
|
|
1574
1574
|
}());
|
|
1575
|
-
var isDimensionToken = function (token) { return token.type === 15 /* DIMENSION_TOKEN */; };
|
|
1576
|
-
var isNumberToken = function (token) { return token.type === 17 /* NUMBER_TOKEN */; };
|
|
1577
|
-
var isIdentToken = function (token) { return token.type === 20 /* IDENT_TOKEN */; };
|
|
1578
|
-
var isStringToken = function (token) { return token.type === 0 /* STRING_TOKEN */; };
|
|
1575
|
+
var isDimensionToken = function (token) { return token.type === 15 /* TokenType.DIMENSION_TOKEN */; };
|
|
1576
|
+
var isNumberToken = function (token) { return token.type === 17 /* TokenType.NUMBER_TOKEN */; };
|
|
1577
|
+
var isIdentToken = function (token) { return token.type === 20 /* TokenType.IDENT_TOKEN */; };
|
|
1578
|
+
var isStringToken = function (token) { return token.type === 0 /* TokenType.STRING_TOKEN */; };
|
|
1579
1579
|
var isIdentWithValue = function (token, value) {
|
|
1580
1580
|
return isIdentToken(token) && token.value === value;
|
|
1581
1581
|
};
|
|
1582
|
-
var nonWhiteSpace = function (token) { return token.type !== 31 /* WHITESPACE_TOKEN */; };
|
|
1582
|
+
var nonWhiteSpace = function (token) { return token.type !== 31 /* TokenType.WHITESPACE_TOKEN */; };
|
|
1583
1583
|
var nonFunctionArgSeparator = function (token) {
|
|
1584
|
-
return token.type !== 31 /* WHITESPACE_TOKEN */ && token.type !== 4 /* COMMA_TOKEN */;
|
|
1584
|
+
return token.type !== 31 /* TokenType.WHITESPACE_TOKEN */ && token.type !== 4 /* TokenType.COMMA_TOKEN */;
|
|
1585
1585
|
};
|
|
1586
1586
|
var parseFunctionArgs = function (tokens) {
|
|
1587
1587
|
var args = [];
|
|
1588
1588
|
var arg = [];
|
|
1589
1589
|
tokens.forEach(function (token) {
|
|
1590
|
-
if (token.type === 4 /* COMMA_TOKEN */) {
|
|
1590
|
+
if (token.type === 4 /* TokenType.COMMA_TOKEN */) {
|
|
1591
1591
|
if (arg.length === 0) {
|
|
1592
1592
|
throw new Error("Error parsing function args, zero tokens for arg");
|
|
1593
1593
|
}
|
|
@@ -1595,7 +1595,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1595
1595
|
arg = [];
|
|
1596
1596
|
return;
|
|
1597
1597
|
}
|
|
1598
|
-
if (token.type !== 31 /* WHITESPACE_TOKEN */) {
|
|
1598
|
+
if (token.type !== 31 /* TokenType.WHITESPACE_TOKEN */) {
|
|
1599
1599
|
arg.push(token);
|
|
1600
1600
|
}
|
|
1601
1601
|
});
|
|
@@ -1605,37 +1605,37 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1605
1605
|
return args;
|
|
1606
1606
|
};
|
|
1607
1607
|
var isEndingTokenFor = function (token, type) {
|
|
1608
|
-
if (type === 11 /* LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* RIGHT_CURLY_BRACKET_TOKEN */) {
|
|
1608
|
+
if (type === 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */) {
|
|
1609
1609
|
return true;
|
|
1610
1610
|
}
|
|
1611
|
-
if (type === 28 /* LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* RIGHT_SQUARE_BRACKET_TOKEN */) {
|
|
1611
|
+
if (type === 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */) {
|
|
1612
1612
|
return true;
|
|
1613
1613
|
}
|
|
1614
|
-
return type === 2 /* LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */;
|
|
1614
|
+
return type === 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */;
|
|
1615
1615
|
};
|
|
1616
1616
|
|
|
1617
1617
|
var isLength = function (token) {
|
|
1618
|
-
return token.type === 17 /* NUMBER_TOKEN */ || token.type === 15 /* DIMENSION_TOKEN */;
|
|
1618
|
+
return token.type === 17 /* TokenType.NUMBER_TOKEN */ || token.type === 15 /* TokenType.DIMENSION_TOKEN */;
|
|
1619
1619
|
};
|
|
1620
1620
|
|
|
1621
1621
|
var isLengthPercentage = function (token) {
|
|
1622
|
-
return token.type === 16 /* PERCENTAGE_TOKEN */ || isLength(token);
|
|
1622
|
+
return token.type === 16 /* TokenType.PERCENTAGE_TOKEN */ || isLength(token);
|
|
1623
1623
|
};
|
|
1624
1624
|
var parseLengthPercentageTuple = function (tokens) {
|
|
1625
1625
|
return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]];
|
|
1626
1626
|
};
|
|
1627
1627
|
var ZERO_LENGTH = {
|
|
1628
|
-
type: 17 /* NUMBER_TOKEN */,
|
|
1628
|
+
type: 17 /* TokenType.NUMBER_TOKEN */,
|
|
1629
1629
|
number: 0,
|
|
1630
1630
|
flags: FLAG_INTEGER
|
|
1631
1631
|
};
|
|
1632
1632
|
var FIFTY_PERCENT = {
|
|
1633
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
1633
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
1634
1634
|
number: 50,
|
|
1635
1635
|
flags: FLAG_INTEGER
|
|
1636
1636
|
};
|
|
1637
1637
|
var HUNDRED_PERCENT = {
|
|
1638
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
1638
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
1639
1639
|
number: 100,
|
|
1640
1640
|
flags: FLAG_INTEGER
|
|
1641
1641
|
};
|
|
@@ -1644,7 +1644,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1644
1644
|
return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)];
|
|
1645
1645
|
};
|
|
1646
1646
|
var getAbsoluteValue = function (token, parent) {
|
|
1647
|
-
if (token.type === 16 /* PERCENTAGE_TOKEN */) {
|
|
1647
|
+
if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
1648
1648
|
return (token.number / 100) * parent;
|
|
1649
1649
|
}
|
|
1650
1650
|
if (isDimensionToken(token)) {
|
|
@@ -1667,7 +1667,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1667
1667
|
var angle = {
|
|
1668
1668
|
name: 'angle',
|
|
1669
1669
|
parse: function (_context, value) {
|
|
1670
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
1670
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
1671
1671
|
switch (value.unit) {
|
|
1672
1672
|
case DEG:
|
|
1673
1673
|
return (Math.PI * value.number) / 180;
|
|
@@ -1683,7 +1683,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1683
1683
|
}
|
|
1684
1684
|
};
|
|
1685
1685
|
var isAngle = function (value) {
|
|
1686
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
1686
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
1687
1687
|
if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) {
|
|
1688
1688
|
return true;
|
|
1689
1689
|
}
|
|
@@ -1733,87 +1733,154 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1733
1733
|
};
|
|
1734
1734
|
var deg = function (deg) { return (Math.PI * deg) / 180; };
|
|
1735
1735
|
|
|
1736
|
-
var color$1 = {
|
|
1737
|
-
name: 'color',
|
|
1738
|
-
parse: function (context, value) {
|
|
1739
|
-
if (value.type === 18 /* FUNCTION */) {
|
|
1740
|
-
var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
|
|
1741
|
-
if (typeof colorFunction === 'undefined') {
|
|
1742
|
-
throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\"");
|
|
1743
|
-
}
|
|
1744
|
-
return colorFunction(context, value.values);
|
|
1745
|
-
}
|
|
1746
|
-
if (value.type === 5 /* HASH_TOKEN */) {
|
|
1747
|
-
if (value.value.length === 3) {
|
|
1748
|
-
var r = value.value.substring(0, 1);
|
|
1749
|
-
var g = value.value.substring(1, 2);
|
|
1750
|
-
var b = value.value.substring(2, 3);
|
|
1751
|
-
return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1);
|
|
1752
|
-
}
|
|
1753
|
-
if (value.value.length === 4) {
|
|
1754
|
-
var r = value.value.substring(0, 1);
|
|
1755
|
-
var g = value.value.substring(1, 2);
|
|
1756
|
-
var b = value.value.substring(2, 3);
|
|
1757
|
-
var a = value.value.substring(3, 4);
|
|
1758
|
-
return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255);
|
|
1759
|
-
}
|
|
1760
|
-
if (value.value.length === 6) {
|
|
1761
|
-
var r = value.value.substring(0, 2);
|
|
1762
|
-
var g = value.value.substring(2, 4);
|
|
1763
|
-
var b = value.value.substring(4, 6);
|
|
1764
|
-
return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1);
|
|
1765
|
-
}
|
|
1766
|
-
if (value.value.length === 8) {
|
|
1767
|
-
var r = value.value.substring(0, 2);
|
|
1768
|
-
var g = value.value.substring(2, 4);
|
|
1769
|
-
var b = value.value.substring(4, 6);
|
|
1770
|
-
var a = value.value.substring(6, 8);
|
|
1771
|
-
return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255);
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
if (value.type === 20 /* IDENT_TOKEN */) {
|
|
1775
|
-
var namedColor = COLORS[value.value.toUpperCase()];
|
|
1776
|
-
if (typeof namedColor !== 'undefined') {
|
|
1777
|
-
return namedColor;
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
return COLORS.TRANSPARENT;
|
|
1781
|
-
}
|
|
1782
|
-
};
|
|
1783
1736
|
var isTransparent = function (color) { return (0xff & color) === 0; };
|
|
1784
1737
|
var asString = function (color) {
|
|
1785
1738
|
var alpha = 0xff & color;
|
|
1786
1739
|
var blue = 0xff & (color >> 8);
|
|
1787
1740
|
var green = 0xff & (color >> 16);
|
|
1788
1741
|
var red = 0xff & (color >> 24);
|
|
1789
|
-
return alpha < 255 ? "rgba("
|
|
1742
|
+
return alpha < 255 ? "rgba(".concat(red, ",").concat(green, ",").concat(blue, ",").concat(alpha / 255, ")") : "rgb(".concat(red, ",").concat(green, ",").concat(blue, ")");
|
|
1790
1743
|
};
|
|
1791
1744
|
var pack = function (r, g, b, a) {
|
|
1792
1745
|
return ((r << 24) | (g << 16) | (b << 8) | (Math.round(a * 255) << 0)) >>> 0;
|
|
1793
1746
|
};
|
|
1794
1747
|
var getTokenColorValue = function (token, i) {
|
|
1795
|
-
if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
1748
|
+
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
1796
1749
|
return token.number;
|
|
1797
1750
|
}
|
|
1798
|
-
if (token.type === 16 /* PERCENTAGE_TOKEN */) {
|
|
1751
|
+
if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
1799
1752
|
var max = i === 3 ? 1 : 255;
|
|
1800
1753
|
return i === 3 ? (token.number / 100) * max : Math.round((token.number / 100) * max);
|
|
1801
1754
|
}
|
|
1802
1755
|
return 0;
|
|
1803
1756
|
};
|
|
1804
|
-
var
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1757
|
+
var isRelativeTransform = function (tokens) {
|
|
1758
|
+
return (tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ ? tokens[0].value : 'unknown') === 'from';
|
|
1759
|
+
};
|
|
1760
|
+
var clamp = function (value, min, max) {
|
|
1761
|
+
return Math.min(Math.max(value, min), max);
|
|
1762
|
+
};
|
|
1763
|
+
var multiplyMatrices = function (A, B) {
|
|
1764
|
+
return [
|
|
1765
|
+
A[0] * B[0] + A[1] * B[1] + A[2] * B[2],
|
|
1766
|
+
A[3] * B[0] + A[4] * B[1] + A[5] * B[2],
|
|
1767
|
+
A[6] * B[0] + A[7] * B[1] + A[8] * B[2]
|
|
1768
|
+
];
|
|
1769
|
+
};
|
|
1770
|
+
var packSrgb = function (args) {
|
|
1771
|
+
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));
|
|
1772
|
+
};
|
|
1773
|
+
var packSrgbLinear = function (_a) {
|
|
1774
|
+
var r = _a[0], g = _a[1], b = _a[2], a = _a[3];
|
|
1775
|
+
var rgb = srgbLinear2rgb([r, g, b]);
|
|
1776
|
+
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);
|
|
1777
|
+
};
|
|
1778
|
+
var packXYZ = function (args) {
|
|
1779
|
+
var srgb_linear = xyz2rgbLinear([args[0], args[1], args[2]]);
|
|
1780
|
+
return packSrgbLinear([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
|
|
1781
|
+
};
|
|
1782
|
+
var packLab = function (_context, args) {
|
|
1783
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1784
|
+
throw new Error('Relative color not supported for lab()');
|
|
1785
|
+
}
|
|
1786
|
+
var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(lab2xyz([l, a, b])));
|
|
1787
|
+
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);
|
|
1788
|
+
};
|
|
1789
|
+
var packOkLab = function (_context, args) {
|
|
1790
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1791
|
+
throw new Error('Relative color not supported for oklab()');
|
|
1792
|
+
}
|
|
1793
|
+
var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(oklab2xyz([l, a, b])));
|
|
1794
|
+
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);
|
|
1795
|
+
};
|
|
1796
|
+
var packOkLch = function (_context, args) {
|
|
1797
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1798
|
+
throw new Error('Relative color not supported for oklch()');
|
|
1799
|
+
}
|
|
1800
|
+
var _a = extractOkLchComponents(args), l = _a[0], c = _a[1], h = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(oklab2xyz(lch2lab([l, c, h]))));
|
|
1801
|
+
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);
|
|
1802
|
+
};
|
|
1803
|
+
var packLch = function (_context, args) {
|
|
1804
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1805
|
+
throw new Error('Relative color not supported for lch()');
|
|
1806
|
+
}
|
|
1807
|
+
var _a = extractLchComponents(args), l = _a[0], c = _a[1], h = _a[2], a = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(lab2xyz(lch2lab([l, c, h]))));
|
|
1808
|
+
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);
|
|
1809
|
+
};
|
|
1810
|
+
var extractHslComponents = function (context, args) {
|
|
1811
|
+
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;
|
|
1812
|
+
return [h, s, l, a];
|
|
1813
|
+
};
|
|
1814
|
+
var packHSL = function (context, args) {
|
|
1815
|
+
if (isRelativeTransform(args)) {
|
|
1816
|
+
throw new Error('Relative color not supported for hsl()');
|
|
1817
|
+
}
|
|
1818
|
+
var _a = extractHslComponents(context, args), h = _a[0], s = _a[1], l = _a[2], a = _a[3], rgb = hsl2rgb([h, s, l]);
|
|
1819
|
+
return pack(rgb[0] * 255, rgb[1] * 255, rgb[2] * 255, s === 0 ? 1 : a);
|
|
1820
|
+
};
|
|
1821
|
+
var extractLchComponents = function (args) {
|
|
1822
|
+
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;
|
|
1823
|
+
return [l, c, h, a];
|
|
1824
|
+
};
|
|
1825
|
+
var extractLabComponents = function (args) {
|
|
1826
|
+
var tokens = args.filter(nonFunctionArgSeparator),
|
|
1827
|
+
// eslint-disable-next-line prettier/prettier
|
|
1828
|
+
l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1829
|
+
? tokens[0].number / 100
|
|
1830
|
+
: isNumberToken(tokens[0])
|
|
1831
|
+
? tokens[0].number
|
|
1832
|
+
: 0,
|
|
1833
|
+
// eslint-disable-next-line prettier/prettier
|
|
1834
|
+
a = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1835
|
+
? tokens[1].number / 100
|
|
1836
|
+
: isNumberToken(tokens[1])
|
|
1837
|
+
? tokens[1].number
|
|
1838
|
+
: 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;
|
|
1839
|
+
return [l, a, b, alpha];
|
|
1840
|
+
};
|
|
1841
|
+
var extractOkLchComponents = function (args) {
|
|
1842
|
+
var tokens = args.filter(nonFunctionArgSeparator),
|
|
1843
|
+
// eslint-disable-next-line prettier/prettier
|
|
1844
|
+
l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1845
|
+
? tokens[0].number / 100
|
|
1846
|
+
: isNumberToken(tokens[0])
|
|
1847
|
+
? tokens[0].number
|
|
1848
|
+
: 0,
|
|
1849
|
+
// eslint-disable-next-line prettier/prettier
|
|
1850
|
+
c = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1851
|
+
? tokens[1].number / 100
|
|
1852
|
+
: isNumberToken(tokens[1])
|
|
1853
|
+
? tokens[1].number
|
|
1854
|
+
: 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;
|
|
1855
|
+
return [l, c, h, a];
|
|
1856
|
+
};
|
|
1857
|
+
/**
|
|
1858
|
+
* Convert D65 to D50
|
|
1859
|
+
*
|
|
1860
|
+
* @param xyz
|
|
1861
|
+
*/
|
|
1862
|
+
var d65toD50 = function (xyz) {
|
|
1863
|
+
return multiplyMatrices(
|
|
1864
|
+
// eslint-disable-next-line prettier/prettier
|
|
1865
|
+
[
|
|
1866
|
+
1.0479297925449969, 0.022946870601609652, -0.05019226628920524, 0.02962780877005599, 0.9904344267538799,
|
|
1867
|
+
-0.017073799063418826, -0.009243040646204504, 0.015055191490298152, 0.7518742814281371
|
|
1868
|
+
], xyz);
|
|
1815
1869
|
};
|
|
1816
|
-
|
|
1870
|
+
/**
|
|
1871
|
+
* Convert D50 to D65
|
|
1872
|
+
*
|
|
1873
|
+
* @param xyz
|
|
1874
|
+
*/
|
|
1875
|
+
var d50toD65 = function (xyz) {
|
|
1876
|
+
return multiplyMatrices(
|
|
1877
|
+
// eslint-disable-next-line prettier/prettier
|
|
1878
|
+
[
|
|
1879
|
+
0.955473421488075, -0.02309845494876471, 0.06325924320057072, -0.0283697093338637, 1.0099953980813041,
|
|
1880
|
+
0.021041441191917323, 0.012314014864481998, -0.020507649298898964, 1.330365926242124
|
|
1881
|
+
], xyz);
|
|
1882
|
+
};
|
|
1883
|
+
var hue2rgb = function (t1, t2, hue) {
|
|
1817
1884
|
if (hue < 0) {
|
|
1818
1885
|
hue += 1;
|
|
1819
1886
|
}
|
|
@@ -1832,29 +1899,783 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1832
1899
|
else {
|
|
1833
1900
|
return t1;
|
|
1834
1901
|
}
|
|
1835
|
-
}
|
|
1836
|
-
var
|
|
1837
|
-
var
|
|
1838
|
-
var hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3];
|
|
1839
|
-
var h = (hue.type === 17 /* NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2);
|
|
1840
|
-
var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0;
|
|
1841
|
-
var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0;
|
|
1842
|
-
var a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1;
|
|
1902
|
+
};
|
|
1903
|
+
var hsl2rgb = function (_a) {
|
|
1904
|
+
var h = _a[0], s = _a[1], l = _a[2];
|
|
1843
1905
|
if (s === 0) {
|
|
1844
|
-
return
|
|
1906
|
+
return [l * 255, l * 255, l * 255];
|
|
1907
|
+
}
|
|
1908
|
+
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);
|
|
1909
|
+
return [r, g, b];
|
|
1910
|
+
};
|
|
1911
|
+
/**
|
|
1912
|
+
* Convert lch to OKLab
|
|
1913
|
+
*
|
|
1914
|
+
* @param l
|
|
1915
|
+
* @param c
|
|
1916
|
+
* @param h
|
|
1917
|
+
*/
|
|
1918
|
+
var lch2lab = function (_a) {
|
|
1919
|
+
var l = _a[0], c = _a[1], h = _a[2];
|
|
1920
|
+
if (c < 0) {
|
|
1921
|
+
c = 0;
|
|
1922
|
+
}
|
|
1923
|
+
if (isNaN(h)) {
|
|
1924
|
+
h = 0;
|
|
1925
|
+
}
|
|
1926
|
+
return [l, c * Math.cos((h * Math.PI) / 180), c * Math.sin((h * Math.PI) / 180)];
|
|
1927
|
+
};
|
|
1928
|
+
/**
|
|
1929
|
+
* Convert OKLab to XYZ relative to D65
|
|
1930
|
+
*
|
|
1931
|
+
* @param lab
|
|
1932
|
+
*/
|
|
1933
|
+
var oklab2xyz = function (lab) {
|
|
1934
|
+
var LMSg = multiplyMatrices(
|
|
1935
|
+
// eslint-disable-next-line prettier/prettier
|
|
1936
|
+
[
|
|
1937
|
+
1, 0.3963377773761749, 0.2158037573099136, 1, -0.1055613458156586, -0.0638541728258133, 1,
|
|
1938
|
+
-0.0894841775298119, -1.2914855480194092
|
|
1939
|
+
], lab), LMS = LMSg.map(function (val) { return Math.pow(val, 3); });
|
|
1940
|
+
return multiplyMatrices(
|
|
1941
|
+
// eslint-disable-next-line prettier/prettier
|
|
1942
|
+
[
|
|
1943
|
+
1.2268798758459243, -0.5578149944602171, 0.2813910456659647, -0.0405757452148008, 1.112286803280317,
|
|
1944
|
+
-0.0717110580655164, -0.0763729366746601, -0.4214933324022432, 1.5869240198367816
|
|
1945
|
+
], LMS);
|
|
1946
|
+
};
|
|
1947
|
+
/**
|
|
1948
|
+
* Convert Lab to D50-adapted XYZ
|
|
1949
|
+
*
|
|
1950
|
+
* @param lab
|
|
1951
|
+
*/
|
|
1952
|
+
var lab2xyz = function (lab) {
|
|
1953
|
+
var fy = (lab[0] + 16) / 116, fx = lab[1] / 500 + fy, fz = fy - lab[2] / 200, k = 24389 / 27, e = 24 / 116, xyz = [
|
|
1954
|
+
((fx > e ? Math.pow(fx, 3) : (116 * fx - 16) / k) * 0.3457) / 0.3585,
|
|
1955
|
+
lab[0] > 8 ? Math.pow(fy, 3) : lab[0] / k,
|
|
1956
|
+
((fz > e ? Math.pow(fz, 3) : (116 * fz - 16) / k) * (1.0 - 0.3457 - 0.3585)) / 0.3585
|
|
1957
|
+
];
|
|
1958
|
+
return d50toD65([xyz[0], xyz[1], xyz[2]]);
|
|
1959
|
+
};
|
|
1960
|
+
/**
|
|
1961
|
+
* Convert RGB to XYZ
|
|
1962
|
+
*
|
|
1963
|
+
* @param _context
|
|
1964
|
+
* @param args
|
|
1965
|
+
*/
|
|
1966
|
+
var rgbToXyz = function (_context, args) {
|
|
1967
|
+
var tokens = args.filter(nonFunctionArgSeparator);
|
|
1968
|
+
if (tokens.length === 3) {
|
|
1969
|
+
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];
|
|
1970
|
+
return [x, y, z, 1];
|
|
1971
|
+
}
|
|
1972
|
+
if (tokens.length === 4) {
|
|
1973
|
+
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];
|
|
1974
|
+
return [x, y, z, a];
|
|
1975
|
+
}
|
|
1976
|
+
return [0, 0, 0, 1];
|
|
1977
|
+
};
|
|
1978
|
+
/**
|
|
1979
|
+
* HSL to XYZ
|
|
1980
|
+
*
|
|
1981
|
+
* @param context
|
|
1982
|
+
* @param args
|
|
1983
|
+
*/
|
|
1984
|
+
var hslToXyz = function (context, args) {
|
|
1985
|
+
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];
|
|
1986
|
+
return [x, y, z, a];
|
|
1987
|
+
};
|
|
1988
|
+
/**
|
|
1989
|
+
* LAB to XYZ
|
|
1990
|
+
*
|
|
1991
|
+
* @param _context
|
|
1992
|
+
* @param args
|
|
1993
|
+
*/
|
|
1994
|
+
var labToXyz = function (_context, args) {
|
|
1995
|
+
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];
|
|
1996
|
+
return [x, y, z, alpha];
|
|
1997
|
+
};
|
|
1998
|
+
/**
|
|
1999
|
+
* LCH to XYZ
|
|
2000
|
+
*
|
|
2001
|
+
* @param _context
|
|
2002
|
+
* @param args
|
|
2003
|
+
*/
|
|
2004
|
+
var lchToXyz = function (_context, args) {
|
|
2005
|
+
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];
|
|
2006
|
+
return [x, y, z, alpha];
|
|
2007
|
+
};
|
|
2008
|
+
/**
|
|
2009
|
+
* OKLch to XYZ
|
|
2010
|
+
*
|
|
2011
|
+
* @param _context
|
|
2012
|
+
* @param args
|
|
2013
|
+
*/
|
|
2014
|
+
var oklchToXyz = function (_context, args) {
|
|
2015
|
+
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];
|
|
2016
|
+
return [x, y, z, alpha];
|
|
2017
|
+
};
|
|
2018
|
+
/**
|
|
2019
|
+
* OKLab to XYZ
|
|
2020
|
+
*
|
|
2021
|
+
* @param _context
|
|
2022
|
+
* @param args
|
|
2023
|
+
*/
|
|
2024
|
+
var oklabToXyz = function (_context, args) {
|
|
2025
|
+
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];
|
|
2026
|
+
return [x, y, z, alpha];
|
|
2027
|
+
};
|
|
2028
|
+
/**
|
|
2029
|
+
* XYZ-50 to XYZ
|
|
2030
|
+
*
|
|
2031
|
+
* @param args
|
|
2032
|
+
*/
|
|
2033
|
+
var xyz50ToXYZ = function (args) {
|
|
2034
|
+
return d50toD65([args[0], args[1], args[2]]);
|
|
2035
|
+
};
|
|
2036
|
+
/**
|
|
2037
|
+
* Does nothing, required for SUPPORTED_COLOR_SPACES_FROM_XYZ in the _color() function
|
|
2038
|
+
*
|
|
2039
|
+
* @param args
|
|
2040
|
+
*/
|
|
2041
|
+
var xyzFromXYZ = function (args) {
|
|
2042
|
+
return args;
|
|
2043
|
+
};
|
|
2044
|
+
/**
|
|
2045
|
+
* XYZ-65 to XYZ-50
|
|
2046
|
+
*
|
|
2047
|
+
* @param args
|
|
2048
|
+
*/
|
|
2049
|
+
var xyz50FromXYZ = function (args) {
|
|
2050
|
+
var _a = d65toD50([args[0], args[2], args[3]]), x = _a[0], y = _a[1], z = _a[2];
|
|
2051
|
+
return [x, y, z, args[3]];
|
|
2052
|
+
};
|
|
2053
|
+
/**
|
|
2054
|
+
* Convert XYZ to SRGB and Pack
|
|
2055
|
+
*
|
|
2056
|
+
* @param args
|
|
2057
|
+
*/
|
|
2058
|
+
var convertXyz = function (args) {
|
|
2059
|
+
return packXYZ([args[0], args[1], args[2], args[3]]);
|
|
2060
|
+
};
|
|
2061
|
+
/**
|
|
2062
|
+
* Convert XYZ-50 to SRGB and Pack
|
|
2063
|
+
*
|
|
2064
|
+
* @param args
|
|
2065
|
+
*/
|
|
2066
|
+
var convertXyz50 = function (args) {
|
|
2067
|
+
var xyz = xyz50ToXYZ([args[0], args[1], args[2]]);
|
|
2068
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2069
|
+
};
|
|
2070
|
+
|
|
2071
|
+
/**
|
|
2072
|
+
* SRGB related functions
|
|
2073
|
+
*/
|
|
2074
|
+
/**
|
|
2075
|
+
* Convert XYZ to linear-light sRGB
|
|
2076
|
+
*
|
|
2077
|
+
* @param xyz
|
|
2078
|
+
*/
|
|
2079
|
+
var xyz2rgbLinear = function (xyz) {
|
|
2080
|
+
return multiplyMatrices(
|
|
2081
|
+
// eslint-disable-next-line prettier/prettier
|
|
2082
|
+
[
|
|
2083
|
+
3.2409699419045226, -1.537383177570094, -0.4986107602930034, -0.9692436362808796, 1.8759675015077202,
|
|
2084
|
+
0.04155505740717559, 0.05563007969699366, -0.20397695888897652, 1.0569715142428786
|
|
2085
|
+
], xyz);
|
|
2086
|
+
};
|
|
2087
|
+
/**
|
|
2088
|
+
* Convert XYZ to linear-light sRGB
|
|
2089
|
+
*
|
|
2090
|
+
* @param xyz
|
|
2091
|
+
*/
|
|
2092
|
+
var rgbLinear2xyz = function (xyz) {
|
|
2093
|
+
return multiplyMatrices(
|
|
2094
|
+
// eslint-disable-next-line prettier/prettier
|
|
2095
|
+
[
|
|
2096
|
+
0.41239079926595934, 0.357584339383878, 0.1804807884018343, 0.21263900587151027, 0.715168678767756,
|
|
2097
|
+
0.07219231536073371, 0.01933081871559182, 0.11919477979462598, 0.9505321522496607
|
|
2098
|
+
], xyz);
|
|
2099
|
+
};
|
|
2100
|
+
/**
|
|
2101
|
+
* Convert sRGB to RGB
|
|
2102
|
+
*
|
|
2103
|
+
* @param rgb
|
|
2104
|
+
*/
|
|
2105
|
+
var srgbLinear2rgb = function (rgb) {
|
|
2106
|
+
return rgb.map(function (c) {
|
|
2107
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2108
|
+
// eslint-disable-next-line prettier/prettier
|
|
2109
|
+
return abs > 0.0031308 ? sign * (1.055 * Math.pow(abs, (1 / 2.4)) - 0.055) : 12.92 * c;
|
|
2110
|
+
});
|
|
2111
|
+
};
|
|
2112
|
+
/**
|
|
2113
|
+
* Convert RGB to sRGB
|
|
2114
|
+
*
|
|
2115
|
+
* @param rgb
|
|
2116
|
+
*/
|
|
2117
|
+
var rgb2rgbLinear = function (rgb) {
|
|
2118
|
+
return rgb.map(function (c) {
|
|
2119
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2120
|
+
// eslint-disable-next-line prettier/prettier
|
|
2121
|
+
return abs <= 0.04045 ? c / 12.92 : sign * Math.pow(((abs + 0.055) / 1.055), 2.4);
|
|
2122
|
+
});
|
|
2123
|
+
};
|
|
2124
|
+
/**
|
|
2125
|
+
* XYZ to SRGB
|
|
2126
|
+
*
|
|
2127
|
+
* @param args
|
|
2128
|
+
*/
|
|
2129
|
+
var srgbFromXYZ = function (args) {
|
|
2130
|
+
var _a = srgbLinear2rgb(xyz2rgbLinear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2131
|
+
return [r, g, b, args[3]];
|
|
2132
|
+
};
|
|
2133
|
+
/**
|
|
2134
|
+
* XYZ to SRGB-Linear
|
|
2135
|
+
* @param args
|
|
2136
|
+
*/
|
|
2137
|
+
var srgbLinearFromXYZ = function (args) {
|
|
2138
|
+
var _a = xyz2rgbLinear([args[0], args[1], args[2]]), r = _a[0], g = _a[1], b = _a[2];
|
|
2139
|
+
return [
|
|
2140
|
+
clamp(Math.round(r * 255), 0, 255),
|
|
2141
|
+
clamp(Math.round(g * 255), 0, 255),
|
|
2142
|
+
clamp(Math.round(b * 255), 0, 255),
|
|
2143
|
+
args[3]
|
|
2144
|
+
];
|
|
2145
|
+
};
|
|
2146
|
+
|
|
2147
|
+
/**
|
|
2148
|
+
* Display-P3 related functions
|
|
2149
|
+
*/
|
|
2150
|
+
/**
|
|
2151
|
+
* Convert P3 Linear to xyz
|
|
2152
|
+
*
|
|
2153
|
+
* @param p3l
|
|
2154
|
+
*/
|
|
2155
|
+
var p3LinearToXyz = function (p3l) {
|
|
2156
|
+
return multiplyMatrices(
|
|
2157
|
+
// eslint-disable-next-line prettier/prettier
|
|
2158
|
+
[
|
|
2159
|
+
0.4865709486482162, 0.26566769316909306, 0.1982172852343625, 0.2289745640697488, 0.6917385218365064,
|
|
2160
|
+
0.079286914093745, 0.0, 0.04511338185890264, 1.043944368900976
|
|
2161
|
+
], p3l);
|
|
2162
|
+
};
|
|
2163
|
+
/**
|
|
2164
|
+
* Convert XYZ to P3 Linear
|
|
2165
|
+
*
|
|
2166
|
+
* @param xyz
|
|
2167
|
+
*/
|
|
2168
|
+
var xyzToP3Linear = function (xyz) {
|
|
2169
|
+
return multiplyMatrices(
|
|
2170
|
+
// eslint-disable-next-line prettier/prettier
|
|
2171
|
+
[
|
|
2172
|
+
2.493496911941425, -0.9313836179191239, -0.40271078445071684, -0.8294889695615747, 1.7626640603183463,
|
|
2173
|
+
0.023624685841943577, 0.03584583024378447, -0.07617238926804182, 0.9568845240076872
|
|
2174
|
+
], xyz);
|
|
2175
|
+
};
|
|
2176
|
+
/**
|
|
2177
|
+
* Convert P3 to P3 linear
|
|
2178
|
+
*
|
|
2179
|
+
* @param p3
|
|
2180
|
+
*/
|
|
2181
|
+
var p32p3Linear = function (p3) {
|
|
2182
|
+
return p3.map(function (c) {
|
|
2183
|
+
var sign = c < 0 ? -1 : 1, abs = c * sign;
|
|
2184
|
+
if (abs <= 0.04045) {
|
|
2185
|
+
return c / 12.92;
|
|
2186
|
+
}
|
|
2187
|
+
// eslint-disable-next-line prettier/prettier
|
|
2188
|
+
return sign * Math.pow(((c + 0.055) / 1.055), 2.4) || 0;
|
|
2189
|
+
});
|
|
2190
|
+
};
|
|
2191
|
+
/**
|
|
2192
|
+
* Convert P3 Linear to P3
|
|
2193
|
+
*
|
|
2194
|
+
* @param p3l
|
|
2195
|
+
*/
|
|
2196
|
+
var p3Linear2p3 = function (p3l) {
|
|
2197
|
+
return srgbLinear2rgb(p3l);
|
|
2198
|
+
};
|
|
2199
|
+
/**
|
|
2200
|
+
* Convert P3 to XYZ
|
|
2201
|
+
*
|
|
2202
|
+
* @param args
|
|
2203
|
+
*/
|
|
2204
|
+
var p3ToXYZ = function (args) {
|
|
2205
|
+
var p3_linear = p32p3Linear([args[0], args[1], args[2]]);
|
|
2206
|
+
return p3LinearToXyz([p3_linear[0], p3_linear[1], p3_linear[2]]);
|
|
2207
|
+
};
|
|
2208
|
+
/**
|
|
2209
|
+
* Convert XYZ to P3
|
|
2210
|
+
*
|
|
2211
|
+
* @param args
|
|
2212
|
+
*/
|
|
2213
|
+
var p3FromXYZ = function (args) {
|
|
2214
|
+
var _a = p3Linear2p3(xyzToP3Linear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2215
|
+
return [r, g, b, args[3]];
|
|
2216
|
+
};
|
|
2217
|
+
/**
|
|
2218
|
+
* Convert P3 to SRGB and Pack
|
|
2219
|
+
*
|
|
2220
|
+
* @param args
|
|
2221
|
+
*/
|
|
2222
|
+
var convertP3 = function (args) {
|
|
2223
|
+
var xyz = p3ToXYZ([args[0], args[1], args[2]]);
|
|
2224
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2225
|
+
};
|
|
2226
|
+
|
|
2227
|
+
/**
|
|
2228
|
+
* A98-RGB related functions
|
|
2229
|
+
*/
|
|
2230
|
+
/**
|
|
2231
|
+
* Convert XYZ to a98 linear
|
|
2232
|
+
*
|
|
2233
|
+
* @param xyz
|
|
2234
|
+
*/
|
|
2235
|
+
var xyz2a98Linear = function (xyz) {
|
|
2236
|
+
return multiplyMatrices(
|
|
2237
|
+
// eslint-disable-next-line prettier/prettier
|
|
2238
|
+
[
|
|
2239
|
+
2.0415879038107465, -0.5650069742788596, -0.34473135077832956, -0.9692436362808795, 1.8759675015077202,
|
|
2240
|
+
0.04155505740717557, 0.013444280632031142, -0.11836239223101838, 1.0151749943912054
|
|
2241
|
+
], xyz);
|
|
2242
|
+
};
|
|
2243
|
+
/**
|
|
2244
|
+
* Convert XYZ to a98 linear
|
|
2245
|
+
*
|
|
2246
|
+
* @param a98
|
|
2247
|
+
*/
|
|
2248
|
+
var a98Linear2xyz = function (a98) {
|
|
2249
|
+
return multiplyMatrices(
|
|
2250
|
+
// eslint-disable-next-line prettier/prettier
|
|
2251
|
+
[
|
|
2252
|
+
0.5766690429101305, 0.1855582379065463, 0.1882286462349947, 0.29734497525053605, 0.6273635662554661,
|
|
2253
|
+
0.0752914584939978, 0.02703136138641234, 0.07068885253582723, 0.9913375368376388
|
|
2254
|
+
], a98);
|
|
2255
|
+
};
|
|
2256
|
+
/**
|
|
2257
|
+
* Convert A98 RGB to rgb linear
|
|
2258
|
+
*
|
|
2259
|
+
* @param rgb
|
|
2260
|
+
*/
|
|
2261
|
+
var a982a98Linear = function (rgb) {
|
|
2262
|
+
var mapped = rgb.map(function (c) {
|
|
2263
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2264
|
+
return sign * Math.pow(abs, (563 / 256));
|
|
2265
|
+
});
|
|
2266
|
+
return [mapped[0], mapped[1], mapped[2]];
|
|
2267
|
+
};
|
|
2268
|
+
/**
|
|
2269
|
+
* Convert A98 RGB Linear to A98
|
|
2270
|
+
*
|
|
2271
|
+
* @param rgb
|
|
2272
|
+
*/
|
|
2273
|
+
var a98Linear2a98 = function (rgb) {
|
|
2274
|
+
var mapped = rgb.map(function (c) {
|
|
2275
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2276
|
+
return sign * Math.pow(abs, (256 / 563));
|
|
2277
|
+
});
|
|
2278
|
+
return [mapped[0], mapped[1], mapped[2]];
|
|
2279
|
+
};
|
|
2280
|
+
/**
|
|
2281
|
+
* Convert XYZ to A98
|
|
2282
|
+
*
|
|
2283
|
+
* @param args
|
|
2284
|
+
*/
|
|
2285
|
+
var a98FromXYZ = function (args) {
|
|
2286
|
+
var _a = a98Linear2a98(xyz2a98Linear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2287
|
+
return [r, g, b, args[3]];
|
|
2288
|
+
};
|
|
2289
|
+
/**
|
|
2290
|
+
* Convert A98 to XYZ and Pack
|
|
2291
|
+
*
|
|
2292
|
+
* @param args
|
|
2293
|
+
*/
|
|
2294
|
+
var convertA98rgb = function (args) {
|
|
2295
|
+
var srgb_linear = xyz2rgbLinear(a98Linear2xyz(a982a98Linear([args[0], args[1], args[2]])));
|
|
2296
|
+
return packSrgbLinear([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
|
|
2297
|
+
};
|
|
2298
|
+
|
|
2299
|
+
/**
|
|
2300
|
+
* Pro Photo related functions
|
|
2301
|
+
*/
|
|
2302
|
+
/**
|
|
2303
|
+
* Convert linear-light display-p3 to XYZ D65
|
|
2304
|
+
*
|
|
2305
|
+
* @param p3
|
|
2306
|
+
*/
|
|
2307
|
+
var proPhotoLinearToXyz = function (p3) {
|
|
2308
|
+
return multiplyMatrices(
|
|
2309
|
+
// eslint-disable-next-line prettier/prettier
|
|
2310
|
+
[
|
|
2311
|
+
0.7977666449006423, 0.13518129740053308, 0.0313477341283922, 0.2880748288194013, 0.711835234241873,
|
|
2312
|
+
0.00008993693872564, 0.0, 0.0, 0.8251046025104602
|
|
2313
|
+
], p3);
|
|
2314
|
+
};
|
|
2315
|
+
/**
|
|
2316
|
+
* Convert XYZ D65 to linear-light display-p3
|
|
2317
|
+
*
|
|
2318
|
+
* @param xyz
|
|
2319
|
+
*/
|
|
2320
|
+
var xyzToProPhotoLinear = function (xyz) {
|
|
2321
|
+
return multiplyMatrices(
|
|
2322
|
+
// eslint-disable-next-line prettier/prettier
|
|
2323
|
+
[
|
|
2324
|
+
1.3457868816471583, -0.25557208737979464, -0.05110186497554526, -0.5446307051249019, 1.5082477428451468,
|
|
2325
|
+
0.02052744743642139, 0.0, 0.0, 1.2119675456389452
|
|
2326
|
+
], xyz);
|
|
2327
|
+
};
|
|
2328
|
+
/**
|
|
2329
|
+
* Convert Pro-Photo to Pro-Photo Linear
|
|
2330
|
+
*
|
|
2331
|
+
* @param p3
|
|
2332
|
+
*/
|
|
2333
|
+
var proPhotoToProPhotoLinear = function (p3) {
|
|
2334
|
+
return p3.map(function (c) {
|
|
2335
|
+
return c < 16 / 512 ? c / 16 : Math.pow(c, 1.8);
|
|
2336
|
+
});
|
|
2337
|
+
};
|
|
2338
|
+
/**
|
|
2339
|
+
* Convert Pro-Photo Linear to Pro-Photo
|
|
2340
|
+
*
|
|
2341
|
+
* @param p3
|
|
2342
|
+
*/
|
|
2343
|
+
var proPhotoLinearToProPhoto = function (p3) {
|
|
2344
|
+
return p3.map(function (c) {
|
|
2345
|
+
return c > 1 / 512 ? Math.pow(c, (1 / 1.8)) : c * 16;
|
|
2346
|
+
});
|
|
2347
|
+
};
|
|
2348
|
+
/**
|
|
2349
|
+
* Convert Pro-Photo to XYZ
|
|
2350
|
+
*
|
|
2351
|
+
* @param args
|
|
2352
|
+
*/
|
|
2353
|
+
var proPhotoToXYZ = function (args) {
|
|
2354
|
+
var prophoto_linear = proPhotoToProPhotoLinear([args[0], args[1], args[2]]);
|
|
2355
|
+
return d50toD65(proPhotoLinearToXyz([prophoto_linear[0], prophoto_linear[1], prophoto_linear[2]]));
|
|
2356
|
+
};
|
|
2357
|
+
/**
|
|
2358
|
+
* Convert XYZ to Pro-Photo
|
|
2359
|
+
*
|
|
2360
|
+
* @param args
|
|
2361
|
+
*/
|
|
2362
|
+
var proPhotoFromXYZ = function (args) {
|
|
2363
|
+
var _a = proPhotoLinearToProPhoto(xyzToProPhotoLinear(d65toD50([args[0], args[1], args[2]]))), r = _a[0], g = _a[1], b = _a[2];
|
|
2364
|
+
return [r, g, b, args[3]];
|
|
2365
|
+
};
|
|
2366
|
+
/**
|
|
2367
|
+
* Convert Pro-Photo to XYZ and Pack
|
|
2368
|
+
*
|
|
2369
|
+
* @param args
|
|
2370
|
+
*/
|
|
2371
|
+
var convertProPhoto = function (args) {
|
|
2372
|
+
var xyz = proPhotoToXYZ([args[0], args[1], args[2]]);
|
|
2373
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2374
|
+
};
|
|
2375
|
+
|
|
2376
|
+
/**
|
|
2377
|
+
* REC2020 related functions
|
|
2378
|
+
*/
|
|
2379
|
+
var _a = 1.09929682680944;
|
|
2380
|
+
var _b = 0.018053968510807;
|
|
2381
|
+
/**
|
|
2382
|
+
* Convert rec2020 to rec2020 linear
|
|
2383
|
+
*
|
|
2384
|
+
* @param rgb
|
|
2385
|
+
*/
|
|
2386
|
+
var rec20202rec2020Linear = function (rgb) {
|
|
2387
|
+
return rgb.map(function (c) {
|
|
2388
|
+
return c < _b * 4.5 ? c / 4.5 : Math.pow((c + _a - 1) / _a, 1 / 0.45);
|
|
2389
|
+
});
|
|
2390
|
+
};
|
|
2391
|
+
/**
|
|
2392
|
+
* Convert rec2020 linear to rec2020
|
|
2393
|
+
*
|
|
2394
|
+
* @param rgb
|
|
2395
|
+
*/
|
|
2396
|
+
var rec2020Linear2rec2020 = function (rgb) {
|
|
2397
|
+
return rgb.map(function (c) {
|
|
2398
|
+
return c >= _b ? _a * Math.pow(c, 0.45) - (_a - 1) : 4.5 * c;
|
|
2399
|
+
});
|
|
2400
|
+
};
|
|
2401
|
+
/**
|
|
2402
|
+
* Convert rec2020 linear to XYZ D65
|
|
2403
|
+
*
|
|
2404
|
+
* @param rec
|
|
2405
|
+
*/
|
|
2406
|
+
var rec2020LinearToXyz = function (rec) {
|
|
2407
|
+
return multiplyMatrices(
|
|
2408
|
+
// eslint-disable-next-line prettier/prettier
|
|
2409
|
+
[
|
|
2410
|
+
0.6369580483012914, 0.14461690358620832, 0.1688809751641721, 0.2627002120112671, 0.6779980715188708,
|
|
2411
|
+
0.05930171646986196, 0.0, 0.028072693049087428, 1.060985057710791
|
|
2412
|
+
], rec);
|
|
2413
|
+
};
|
|
2414
|
+
/**
|
|
2415
|
+
* Convert XYZ D65 to rec2020 linear
|
|
2416
|
+
*
|
|
2417
|
+
* @param xyz
|
|
2418
|
+
*/
|
|
2419
|
+
var xyzToRec2020Linear = function (xyz) {
|
|
2420
|
+
return multiplyMatrices(
|
|
2421
|
+
// eslint-disable-next-line prettier/prettier
|
|
2422
|
+
[
|
|
2423
|
+
1.716651187971268, -0.355670783776392, -0.25336628137366, -0.666684351832489, 1.616481236634939,
|
|
2424
|
+
0.0157685458139111, 0.017639857445311, -0.042770613257809, 0.942103121235474
|
|
2425
|
+
], xyz);
|
|
2426
|
+
};
|
|
2427
|
+
/**
|
|
2428
|
+
* Convert Rec2020 to XYZ
|
|
2429
|
+
*
|
|
2430
|
+
* @param args
|
|
2431
|
+
*/
|
|
2432
|
+
var rec2020ToXYZ = function (args) {
|
|
2433
|
+
var rec2020_linear = rec20202rec2020Linear([args[0], args[1], args[2]]);
|
|
2434
|
+
return rec2020LinearToXyz([rec2020_linear[0], rec2020_linear[1], rec2020_linear[2]]);
|
|
2435
|
+
};
|
|
2436
|
+
/**
|
|
2437
|
+
* Convert XYZ to Rec2020
|
|
2438
|
+
*
|
|
2439
|
+
* @param args
|
|
2440
|
+
*/
|
|
2441
|
+
var rec2020FromXYZ = function (args) {
|
|
2442
|
+
var _c = rec2020Linear2rec2020(xyzToRec2020Linear([args[0], args[1], args[2]])), r = _c[0], g = _c[1], b = _c[2];
|
|
2443
|
+
return [r, g, b, args[3]];
|
|
2444
|
+
};
|
|
2445
|
+
/**
|
|
2446
|
+
* Convert Rec2020 to SRGB and Pack
|
|
2447
|
+
*
|
|
2448
|
+
* @param args
|
|
2449
|
+
*/
|
|
2450
|
+
var convertRec2020 = function (args) {
|
|
2451
|
+
var xyz = rec2020ToXYZ([args[0], args[1], args[2]]);
|
|
2452
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2453
|
+
};
|
|
2454
|
+
|
|
2455
|
+
var color$1 = {
|
|
2456
|
+
name: 'color',
|
|
2457
|
+
parse: function (context, value) {
|
|
2458
|
+
if (value.type === 18 /* TokenType.FUNCTION */) {
|
|
2459
|
+
var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
|
|
2460
|
+
if (typeof colorFunction === 'undefined') {
|
|
2461
|
+
throw new Error("Attempting to parse an unsupported color function \"".concat(value.name, "\""));
|
|
2462
|
+
}
|
|
2463
|
+
return colorFunction(context, value.values);
|
|
2464
|
+
}
|
|
2465
|
+
if (value.type === 5 /* TokenType.HASH_TOKEN */) {
|
|
2466
|
+
var _a = hash2rgb(value), r = _a[0], g = _a[1], b = _a[2], a = _a[3];
|
|
2467
|
+
return pack(r, g, b, a);
|
|
2468
|
+
}
|
|
2469
|
+
if (value.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
2470
|
+
var namedColor = COLORS[value.value.toUpperCase()];
|
|
2471
|
+
if (typeof namedColor !== 'undefined') {
|
|
2472
|
+
return namedColor;
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
return COLORS.TRANSPARENT;
|
|
2476
|
+
}
|
|
2477
|
+
};
|
|
2478
|
+
var hash2rgb = function (token) {
|
|
2479
|
+
if (token.value.length === 3) {
|
|
2480
|
+
var r = token.value.substring(0, 1);
|
|
2481
|
+
var g = token.value.substring(1, 2);
|
|
2482
|
+
var b = token.value.substring(2, 3);
|
|
2483
|
+
return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1];
|
|
2484
|
+
}
|
|
2485
|
+
if (token.value.length === 4) {
|
|
2486
|
+
var r = token.value.substring(0, 1);
|
|
2487
|
+
var g = token.value.substring(1, 2);
|
|
2488
|
+
var b = token.value.substring(2, 3);
|
|
2489
|
+
var a = token.value.substring(3, 4);
|
|
2490
|
+
return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255];
|
|
2491
|
+
}
|
|
2492
|
+
if (token.value.length === 6) {
|
|
2493
|
+
var r = token.value.substring(0, 2);
|
|
2494
|
+
var g = token.value.substring(2, 4);
|
|
2495
|
+
var b = token.value.substring(4, 6);
|
|
2496
|
+
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1];
|
|
2497
|
+
}
|
|
2498
|
+
if (token.value.length === 8) {
|
|
2499
|
+
var r = token.value.substring(0, 2);
|
|
2500
|
+
var g = token.value.substring(2, 4);
|
|
2501
|
+
var b = token.value.substring(4, 6);
|
|
2502
|
+
var a = token.value.substring(6, 8);
|
|
2503
|
+
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255];
|
|
2504
|
+
}
|
|
2505
|
+
return [0, 0, 0, 1];
|
|
2506
|
+
};
|
|
2507
|
+
var rgb = function (_context, args) {
|
|
2508
|
+
var tokens = args.filter(nonFunctionArgSeparator);
|
|
2509
|
+
if (isRelativeTransform(tokens)) {
|
|
2510
|
+
throw new Error('Relative color not supported for rgb()');
|
|
2511
|
+
}
|
|
2512
|
+
if (tokens.length === 3) {
|
|
2513
|
+
var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2];
|
|
2514
|
+
return pack(r, g, b, 1);
|
|
2515
|
+
}
|
|
2516
|
+
if (tokens.length === 4) {
|
|
2517
|
+
var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a = _b[3];
|
|
2518
|
+
return pack(r, g, b, a);
|
|
2519
|
+
}
|
|
2520
|
+
return 0;
|
|
2521
|
+
};
|
|
2522
|
+
/**
|
|
2523
|
+
* Handle the CSS color() function
|
|
2524
|
+
*
|
|
2525
|
+
* @param context
|
|
2526
|
+
* @param args
|
|
2527
|
+
*/
|
|
2528
|
+
var _color = function (context, args) {
|
|
2529
|
+
var tokens = args.filter(nonFunctionArgSeparator), token_1_value = tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ ? tokens[0].value : 'unknown', is_absolute = !isRelativeTransform(tokens);
|
|
2530
|
+
if (is_absolute) {
|
|
2531
|
+
var color_space = token_1_value, colorSpaceFunction = SUPPORTED_COLOR_SPACES_ABSOLUTE[color_space];
|
|
2532
|
+
if (typeof colorSpaceFunction === 'undefined') {
|
|
2533
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(color_space, "\" for color() function"));
|
|
2534
|
+
}
|
|
2535
|
+
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 &&
|
|
2536
|
+
tokens[4].type === 6 /* TokenType.DELIM_TOKEN */ &&
|
|
2537
|
+
tokens[4].value === '/' &&
|
|
2538
|
+
isNumberToken(tokens[5])
|
|
2539
|
+
? tokens[5].number
|
|
2540
|
+
: 1;
|
|
2541
|
+
return colorSpaceFunction([c1, c2, c3, a]);
|
|
1845
2542
|
}
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
2543
|
+
else {
|
|
2544
|
+
var extractComponent = function (color, token) {
|
|
2545
|
+
if (isNumberToken(token)) {
|
|
2546
|
+
return token.number;
|
|
2547
|
+
}
|
|
2548
|
+
var posFromVal = function (value) {
|
|
2549
|
+
return value === 'r' || value === 'x' ? 0 : value === 'g' || value === 'y' ? 1 : 2;
|
|
2550
|
+
};
|
|
2551
|
+
if (isIdentToken(token)) {
|
|
2552
|
+
var position = posFromVal(token.value);
|
|
2553
|
+
return color[position];
|
|
2554
|
+
}
|
|
2555
|
+
var parseCalc = function (args) {
|
|
2556
|
+
var parts = args.filter(nonFunctionArgSeparator);
|
|
2557
|
+
var expression = '(';
|
|
2558
|
+
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
2559
|
+
var part = parts_1[_i];
|
|
2560
|
+
expression +=
|
|
2561
|
+
part.type === 18 /* TokenType.FUNCTION */ && part.name === 'calc'
|
|
2562
|
+
? parseCalc(part.values)
|
|
2563
|
+
: isNumberToken(part)
|
|
2564
|
+
? part.number
|
|
2565
|
+
: part.type === 6 /* TokenType.DELIM_TOKEN */ || isIdentToken(part)
|
|
2566
|
+
? part.value
|
|
2567
|
+
: '';
|
|
2568
|
+
}
|
|
2569
|
+
expression += ')';
|
|
2570
|
+
return expression;
|
|
2571
|
+
};
|
|
2572
|
+
if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
2573
|
+
var args_1 = token.values.filter(nonFunctionArgSeparator);
|
|
2574
|
+
if (token.name === 'calc') {
|
|
2575
|
+
var expression = parseCalc(args_1)
|
|
2576
|
+
.replace(/r|x/, color[0].toString())
|
|
2577
|
+
.replace(/g|y/, color[1].toString())
|
|
2578
|
+
.replace(/b|z/, color[2].toString());
|
|
2579
|
+
return new Function('return ' + expression)();
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
return null;
|
|
2583
|
+
};
|
|
2584
|
+
var from_colorspace = tokens[1].type === 18 /* TokenType.FUNCTION */
|
|
2585
|
+
? tokens[1].name
|
|
2586
|
+
: isIdentToken(tokens[1]) || tokens[1].type === 5 /* TokenType.HASH_TOKEN */
|
|
2587
|
+
? 'rgb'
|
|
2588
|
+
: 'unknown', to_colorspace = isIdentToken(tokens[2]) ? tokens[2].value : 'unknown';
|
|
2589
|
+
var from = tokens[1].type === 18 /* TokenType.FUNCTION */ ? tokens[1].values : isIdentToken(tokens[1]) ? [tokens[1]] : [];
|
|
2590
|
+
if (isIdentToken(tokens[1])) {
|
|
2591
|
+
var named_color = COLORS[tokens[1].value.toUpperCase()];
|
|
2592
|
+
if (typeof named_color === 'undefined') {
|
|
2593
|
+
throw new Error("Attempting to use unknown color in relative color 'from'");
|
|
2594
|
+
}
|
|
2595
|
+
else {
|
|
2596
|
+
var _c = parseColor(context, tokens[1].value), alpha = 0xff & _c, blue = 0xff & (_c >> 8), green = 0xff & (_c >> 16), red = 0xff & (_c >> 24);
|
|
2597
|
+
from = [
|
|
2598
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: red, flags: 1 },
|
|
2599
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: green, flags: 1 },
|
|
2600
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: blue, flags: 1 },
|
|
2601
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: alpha > 1 ? alpha / 255 : alpha, flags: 1 }
|
|
2602
|
+
];
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
else if (tokens[1].type === 5 /* TokenType.HASH_TOKEN */) {
|
|
2606
|
+
var _a = hash2rgb(tokens[1]), red = _a[0], green = _a[1], blue = _a[2], alpha = _a[3];
|
|
2607
|
+
from = [
|
|
2608
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: red, flags: 1 },
|
|
2609
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: green, flags: 1 },
|
|
2610
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: blue, flags: 1 },
|
|
2611
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: alpha > 1 ? alpha / 255 : alpha, flags: 1 }
|
|
2612
|
+
];
|
|
2613
|
+
}
|
|
2614
|
+
if (from.length === 0) {
|
|
2615
|
+
throw new Error("Attempting to use unknown color in relative color 'from'");
|
|
2616
|
+
}
|
|
2617
|
+
if (to_colorspace === 'unknown') {
|
|
2618
|
+
throw new Error("Attempting to use unknown colorspace in relative color 'to'");
|
|
2619
|
+
}
|
|
2620
|
+
var fromColorToXyz = SUPPORTED_COLOR_SPACES_TO_XYZ[from_colorspace], toColorFromXyz = SUPPORTED_COLOR_SPACES_FROM_XYZ[to_colorspace], toColorPack = SUPPORTED_COLOR_SPACES_ABSOLUTE[to_colorspace];
|
|
2621
|
+
if (typeof fromColorToXyz === 'undefined') {
|
|
2622
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(from_colorspace, "\" for color() function"));
|
|
2623
|
+
}
|
|
2624
|
+
if (typeof toColorFromXyz === 'undefined') {
|
|
2625
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(to_colorspace, "\" for color() function"));
|
|
2626
|
+
}
|
|
2627
|
+
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 &&
|
|
2628
|
+
tokens[6].type === 6 /* TokenType.DELIM_TOKEN */ &&
|
|
2629
|
+
tokens[6].value === '/' &&
|
|
2630
|
+
isNumberToken(tokens[7])
|
|
2631
|
+
? tokens[7].number
|
|
2632
|
+
: 1;
|
|
2633
|
+
if (c1 === null || c2 === null || c3 === null) {
|
|
2634
|
+
throw new Error("Invalid relative color in color() function");
|
|
2635
|
+
}
|
|
2636
|
+
return toColorPack([c1, c2, c3, a]);
|
|
2637
|
+
}
|
|
2638
|
+
};
|
|
2639
|
+
var SUPPORTED_COLOR_SPACES_ABSOLUTE = {
|
|
2640
|
+
srgb: packSrgb,
|
|
2641
|
+
'srgb-linear': packSrgbLinear,
|
|
2642
|
+
'display-p3': convertP3,
|
|
2643
|
+
'a98-rgb': convertA98rgb,
|
|
2644
|
+
'prophoto-rgb': convertProPhoto,
|
|
2645
|
+
xyz: convertXyz,
|
|
2646
|
+
'xyz-d50': convertXyz50,
|
|
2647
|
+
'xyz-d65': convertXyz,
|
|
2648
|
+
rec2020: convertRec2020
|
|
2649
|
+
};
|
|
2650
|
+
var SUPPORTED_COLOR_SPACES_TO_XYZ = {
|
|
2651
|
+
rgb: rgbToXyz,
|
|
2652
|
+
hsl: hslToXyz,
|
|
2653
|
+
lab: labToXyz,
|
|
2654
|
+
lch: lchToXyz,
|
|
2655
|
+
oklab: oklabToXyz,
|
|
2656
|
+
oklch: oklchToXyz
|
|
2657
|
+
};
|
|
2658
|
+
var SUPPORTED_COLOR_SPACES_FROM_XYZ = {
|
|
2659
|
+
srgb: srgbFromXYZ,
|
|
2660
|
+
'srgb-linear': srgbLinearFromXYZ,
|
|
2661
|
+
'display-p3': p3FromXYZ,
|
|
2662
|
+
'a98-rgb': a98FromXYZ,
|
|
2663
|
+
'prophoto-rgb': proPhotoFromXYZ,
|
|
2664
|
+
xyz: xyzFromXYZ,
|
|
2665
|
+
'xyz-d50': xyz50FromXYZ,
|
|
2666
|
+
'xyz-d65': xyzFromXYZ,
|
|
2667
|
+
rec2020: rec2020FromXYZ
|
|
1852
2668
|
};
|
|
1853
2669
|
var SUPPORTED_COLOR_FUNCTIONS = {
|
|
1854
|
-
hsl:
|
|
1855
|
-
hsla:
|
|
2670
|
+
hsl: packHSL,
|
|
2671
|
+
hsla: packHSL,
|
|
1856
2672
|
rgb: rgb,
|
|
1857
|
-
rgba: rgb
|
|
2673
|
+
rgba: rgb,
|
|
2674
|
+
lch: packLch,
|
|
2675
|
+
oklch: packOkLch,
|
|
2676
|
+
oklab: packOkLab,
|
|
2677
|
+
lab: packLab,
|
|
2678
|
+
color: _color
|
|
1858
2679
|
};
|
|
1859
2680
|
var parseColor = function (context, value) {
|
|
1860
2681
|
return color$1.parse(context, Parser.create(value).parseComponentValue());
|
|
@@ -2015,18 +2836,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2015
2836
|
name: 'background-clip',
|
|
2016
2837
|
initialValue: 'border-box',
|
|
2017
2838
|
prefix: false,
|
|
2018
|
-
type: 1 /* LIST */,
|
|
2839
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2019
2840
|
parse: function (_context, tokens) {
|
|
2020
2841
|
return tokens.map(function (token) {
|
|
2021
2842
|
if (isIdentToken(token)) {
|
|
2022
2843
|
switch (token.value) {
|
|
2023
2844
|
case 'padding-box':
|
|
2024
|
-
return 1 /* PADDING_BOX */;
|
|
2845
|
+
return 1 /* BACKGROUND_CLIP.PADDING_BOX */;
|
|
2025
2846
|
case 'content-box':
|
|
2026
|
-
return 2 /* CONTENT_BOX */;
|
|
2847
|
+
return 2 /* BACKGROUND_CLIP.CONTENT_BOX */;
|
|
2027
2848
|
}
|
|
2028
2849
|
}
|
|
2029
|
-
return 0 /* BORDER_BOX */;
|
|
2850
|
+
return 0 /* BACKGROUND_CLIP.BORDER_BOX */;
|
|
2030
2851
|
});
|
|
2031
2852
|
}
|
|
2032
2853
|
};
|
|
@@ -2035,7 +2856,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2035
2856
|
name: "background-color",
|
|
2036
2857
|
initialValue: 'transparent',
|
|
2037
2858
|
prefix: false,
|
|
2038
|
-
type: 3 /* TYPE_VALUE */,
|
|
2859
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2039
2860
|
format: 'color'
|
|
2040
2861
|
};
|
|
2041
2862
|
|
|
@@ -2138,24 +2959,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2138
2959
|
var rx = 0;
|
|
2139
2960
|
var ry = 0;
|
|
2140
2961
|
switch (gradient.size) {
|
|
2141
|
-
case 0 /* CLOSEST_SIDE */:
|
|
2962
|
+
case 0 /* CSSRadialExtent.CLOSEST_SIDE */:
|
|
2142
2963
|
// The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center.
|
|
2143
2964
|
// If the shape is an ellipse, it exactly meets the closest side in each dimension.
|
|
2144
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
2965
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2145
2966
|
rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
|
|
2146
2967
|
}
|
|
2147
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
2968
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2148
2969
|
rx = Math.min(Math.abs(x), Math.abs(x - width));
|
|
2149
2970
|
ry = Math.min(Math.abs(y), Math.abs(y - height));
|
|
2150
2971
|
}
|
|
2151
2972
|
break;
|
|
2152
|
-
case 2 /* CLOSEST_CORNER */:
|
|
2973
|
+
case 2 /* CSSRadialExtent.CLOSEST_CORNER */:
|
|
2153
2974
|
// The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center.
|
|
2154
2975
|
// If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified.
|
|
2155
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
2976
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2156
2977
|
rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
|
|
2157
2978
|
}
|
|
2158
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
2979
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2159
2980
|
// Compute the ratio ry/rx (which is to be the same as for "closest-side")
|
|
2160
2981
|
var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width));
|
|
2161
2982
|
var _a = findCorner(width, height, x, y, true), cx = _a[0], cy = _a[1];
|
|
@@ -2163,23 +2984,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2163
2984
|
ry = c * rx;
|
|
2164
2985
|
}
|
|
2165
2986
|
break;
|
|
2166
|
-
case 1 /* FARTHEST_SIDE */:
|
|
2987
|
+
case 1 /* CSSRadialExtent.FARTHEST_SIDE */:
|
|
2167
2988
|
// Same as closest-side, except the ending shape is sized based on the farthest side(s)
|
|
2168
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
2989
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2169
2990
|
rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
|
|
2170
2991
|
}
|
|
2171
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
2992
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2172
2993
|
rx = Math.max(Math.abs(x), Math.abs(x - width));
|
|
2173
2994
|
ry = Math.max(Math.abs(y), Math.abs(y - height));
|
|
2174
2995
|
}
|
|
2175
2996
|
break;
|
|
2176
|
-
case 3 /* FARTHEST_CORNER */:
|
|
2997
|
+
case 3 /* CSSRadialExtent.FARTHEST_CORNER */:
|
|
2177
2998
|
// Same as closest-corner, except the ending shape is sized based on the farthest corner.
|
|
2178
2999
|
// If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified.
|
|
2179
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3000
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2180
3001
|
rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
|
|
2181
3002
|
}
|
|
2182
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3003
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2183
3004
|
// Compute the ratio ry/rx (which is to be the same as for "farthest-side")
|
|
2184
3005
|
var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width));
|
|
2185
3006
|
var _b = findCorner(width, height, x, y, false), cx = _b[0], cy = _b[1];
|
|
@@ -2201,7 +3022,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2201
3022
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2202
3023
|
if (i === 0) {
|
|
2203
3024
|
var firstToken = arg[0];
|
|
2204
|
-
if (firstToken.type === 20 /* IDENT_TOKEN */ && firstToken.value === 'to') {
|
|
3025
|
+
if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ && firstToken.value === 'to') {
|
|
2205
3026
|
angle$1 = parseNamedSide(arg);
|
|
2206
3027
|
return;
|
|
2207
3028
|
}
|
|
@@ -2213,7 +3034,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2213
3034
|
var colorStop = parseColorStop(context, arg);
|
|
2214
3035
|
stops.push(colorStop);
|
|
2215
3036
|
});
|
|
2216
|
-
return { angle: angle$1, stops: stops, type: 1 /* LINEAR_GRADIENT */ };
|
|
3037
|
+
return { angle: angle$1, stops: stops, type: 1 /* CSSImageType.LINEAR_GRADIENT */ };
|
|
2217
3038
|
};
|
|
2218
3039
|
|
|
2219
3040
|
var prefixLinearGradient = function (context, tokens) {
|
|
@@ -2222,7 +3043,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2222
3043
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2223
3044
|
if (i === 0) {
|
|
2224
3045
|
var firstToken = arg[0];
|
|
2225
|
-
if (firstToken.type === 20 /* IDENT_TOKEN */ &&
|
|
3046
|
+
if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ &&
|
|
2226
3047
|
['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) {
|
|
2227
3048
|
angle$1 = parseNamedSide(arg);
|
|
2228
3049
|
return;
|
|
@@ -2238,30 +3059,30 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2238
3059
|
return {
|
|
2239
3060
|
angle: angle$1,
|
|
2240
3061
|
stops: stops,
|
|
2241
|
-
type: 1 /* LINEAR_GRADIENT */
|
|
3062
|
+
type: 1 /* CSSImageType.LINEAR_GRADIENT */
|
|
2242
3063
|
};
|
|
2243
3064
|
};
|
|
2244
3065
|
|
|
2245
3066
|
var webkitGradient = function (context, tokens) {
|
|
2246
3067
|
var angle = deg(180);
|
|
2247
3068
|
var stops = [];
|
|
2248
|
-
var type = 1 /* LINEAR_GRADIENT */;
|
|
2249
|
-
var shape = 0 /* CIRCLE */;
|
|
2250
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3069
|
+
var type = 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
3070
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3071
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2251
3072
|
var position = [];
|
|
2252
3073
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2253
3074
|
var firstToken = arg[0];
|
|
2254
3075
|
if (i === 0) {
|
|
2255
3076
|
if (isIdentToken(firstToken) && firstToken.value === 'linear') {
|
|
2256
|
-
type = 1 /* LINEAR_GRADIENT */;
|
|
3077
|
+
type = 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
2257
3078
|
return;
|
|
2258
3079
|
}
|
|
2259
3080
|
else if (isIdentToken(firstToken) && firstToken.value === 'radial') {
|
|
2260
|
-
type = 2 /* RADIAL_GRADIENT */;
|
|
3081
|
+
type = 2 /* CSSImageType.RADIAL_GRADIENT */;
|
|
2261
3082
|
return;
|
|
2262
3083
|
}
|
|
2263
3084
|
}
|
|
2264
|
-
if (firstToken.type === 18 /* FUNCTION */) {
|
|
3085
|
+
if (firstToken.type === 18 /* TokenType.FUNCTION */) {
|
|
2265
3086
|
if (firstToken.name === 'from') {
|
|
2266
3087
|
var color = color$1.parse(context, firstToken.values[0]);
|
|
2267
3088
|
stops.push({ stop: ZERO_LENGTH, color: color });
|
|
@@ -2277,7 +3098,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2277
3098
|
var stop_1 = values[0];
|
|
2278
3099
|
if (isNumberToken(stop_1)) {
|
|
2279
3100
|
stops.push({
|
|
2280
|
-
stop: { type: 16 /* PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
|
|
3101
|
+
stop: { type: 16 /* TokenType.PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
|
|
2281
3102
|
color: color
|
|
2282
3103
|
});
|
|
2283
3104
|
}
|
|
@@ -2285,7 +3106,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2285
3106
|
}
|
|
2286
3107
|
}
|
|
2287
3108
|
});
|
|
2288
|
-
return type === 1 /* LINEAR_GRADIENT */
|
|
3109
|
+
return type === 1 /* CSSImageType.LINEAR_GRADIENT */
|
|
2289
3110
|
? {
|
|
2290
3111
|
angle: (angle + deg(180)) % deg(360),
|
|
2291
3112
|
stops: stops,
|
|
@@ -2303,8 +3124,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2303
3124
|
var COVER = 'cover';
|
|
2304
3125
|
var CONTAIN = 'contain';
|
|
2305
3126
|
var radialGradient = function (context, tokens) {
|
|
2306
|
-
var shape = 0 /* CIRCLE */;
|
|
2307
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3127
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3128
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2308
3129
|
var stops = [];
|
|
2309
3130
|
var position = [];
|
|
2310
3131
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
@@ -2335,27 +3156,27 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2335
3156
|
else if (isIdentToken(token)) {
|
|
2336
3157
|
switch (token.value) {
|
|
2337
3158
|
case CIRCLE:
|
|
2338
|
-
shape = 0 /* CIRCLE */;
|
|
3159
|
+
shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
2339
3160
|
return false;
|
|
2340
3161
|
case ELLIPSE:
|
|
2341
|
-
shape = 1 /* ELLIPSE */;
|
|
3162
|
+
shape = 1 /* CSSRadialShape.ELLIPSE */;
|
|
2342
3163
|
return false;
|
|
2343
3164
|
case 'at':
|
|
2344
3165
|
isAtPosition_1 = true;
|
|
2345
3166
|
return false;
|
|
2346
3167
|
case CLOSEST_SIDE:
|
|
2347
|
-
size = 0 /* CLOSEST_SIDE */;
|
|
3168
|
+
size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
|
|
2348
3169
|
return false;
|
|
2349
3170
|
case COVER:
|
|
2350
3171
|
case FARTHEST_SIDE:
|
|
2351
|
-
size = 1 /* FARTHEST_SIDE */;
|
|
3172
|
+
size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
|
|
2352
3173
|
return false;
|
|
2353
3174
|
case CONTAIN:
|
|
2354
3175
|
case CLOSEST_CORNER:
|
|
2355
|
-
size = 2 /* CLOSEST_CORNER */;
|
|
3176
|
+
size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
|
|
2356
3177
|
return false;
|
|
2357
3178
|
case FARTHEST_CORNER:
|
|
2358
|
-
size = 3 /* FARTHEST_CORNER */;
|
|
3179
|
+
size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2359
3180
|
return false;
|
|
2360
3181
|
}
|
|
2361
3182
|
}
|
|
@@ -2374,12 +3195,12 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2374
3195
|
stops.push(colorStop);
|
|
2375
3196
|
}
|
|
2376
3197
|
});
|
|
2377
|
-
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
|
|
3198
|
+
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* CSSImageType.RADIAL_GRADIENT */ };
|
|
2378
3199
|
};
|
|
2379
3200
|
|
|
2380
3201
|
var prefixRadialGradient = function (context, tokens) {
|
|
2381
|
-
var shape = 0 /* CIRCLE */;
|
|
2382
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3202
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3203
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2383
3204
|
var stops = [];
|
|
2384
3205
|
var position = [];
|
|
2385
3206
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
@@ -2413,24 +3234,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2413
3234
|
if (isIdentToken(token)) {
|
|
2414
3235
|
switch (token.value) {
|
|
2415
3236
|
case CIRCLE:
|
|
2416
|
-
shape = 0 /* CIRCLE */;
|
|
3237
|
+
shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
2417
3238
|
return false;
|
|
2418
3239
|
case ELLIPSE:
|
|
2419
|
-
shape = 1 /* ELLIPSE */;
|
|
3240
|
+
shape = 1 /* CSSRadialShape.ELLIPSE */;
|
|
2420
3241
|
return false;
|
|
2421
3242
|
case CONTAIN:
|
|
2422
3243
|
case CLOSEST_SIDE:
|
|
2423
|
-
size = 0 /* CLOSEST_SIDE */;
|
|
3244
|
+
size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
|
|
2424
3245
|
return false;
|
|
2425
3246
|
case FARTHEST_SIDE:
|
|
2426
|
-
size = 1 /* FARTHEST_SIDE */;
|
|
3247
|
+
size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
|
|
2427
3248
|
return false;
|
|
2428
3249
|
case CLOSEST_CORNER:
|
|
2429
|
-
size = 2 /* CLOSEST_CORNER */;
|
|
3250
|
+
size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
|
|
2430
3251
|
return false;
|
|
2431
3252
|
case COVER:
|
|
2432
3253
|
case FARTHEST_CORNER:
|
|
2433
|
-
size = 3 /* FARTHEST_CORNER */;
|
|
3254
|
+
size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2434
3255
|
return false;
|
|
2435
3256
|
}
|
|
2436
3257
|
}
|
|
@@ -2449,36 +3270,36 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2449
3270
|
stops.push(colorStop);
|
|
2450
3271
|
}
|
|
2451
3272
|
});
|
|
2452
|
-
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
|
|
3273
|
+
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* CSSImageType.RADIAL_GRADIENT */ };
|
|
2453
3274
|
};
|
|
2454
3275
|
|
|
2455
3276
|
var isLinearGradient = function (background) {
|
|
2456
|
-
return background.type === 1 /* LINEAR_GRADIENT */;
|
|
3277
|
+
return background.type === 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
2457
3278
|
};
|
|
2458
3279
|
var isRadialGradient = function (background) {
|
|
2459
|
-
return background.type === 2 /* RADIAL_GRADIENT */;
|
|
3280
|
+
return background.type === 2 /* CSSImageType.RADIAL_GRADIENT */;
|
|
2460
3281
|
};
|
|
2461
3282
|
var image = {
|
|
2462
3283
|
name: 'image',
|
|
2463
3284
|
parse: function (context, value) {
|
|
2464
|
-
if (value.type === 22 /* URL_TOKEN */) {
|
|
2465
|
-
var image_1 = { url: value.value, type: 0 /* URL */ };
|
|
3285
|
+
if (value.type === 22 /* TokenType.URL_TOKEN */) {
|
|
3286
|
+
var image_1 = { url: value.value, type: 0 /* CSSImageType.URL */ };
|
|
2466
3287
|
context.cache.addImage(value.value);
|
|
2467
3288
|
return image_1;
|
|
2468
3289
|
}
|
|
2469
|
-
if (value.type === 18 /* FUNCTION */) {
|
|
3290
|
+
if (value.type === 18 /* TokenType.FUNCTION */) {
|
|
2470
3291
|
var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name];
|
|
2471
3292
|
if (typeof imageFunction === 'undefined') {
|
|
2472
|
-
throw new Error("Attempting to parse an unsupported image function \""
|
|
3293
|
+
throw new Error("Attempting to parse an unsupported image function \"".concat(value.name, "\""));
|
|
2473
3294
|
}
|
|
2474
3295
|
return imageFunction(context, value.values);
|
|
2475
3296
|
}
|
|
2476
|
-
throw new Error("Unsupported image type "
|
|
3297
|
+
throw new Error("Unsupported image type ".concat(value.type));
|
|
2477
3298
|
}
|
|
2478
3299
|
};
|
|
2479
3300
|
function isSupportedImage(value) {
|
|
2480
|
-
return (!(value.type === 20 /* IDENT_TOKEN */ && value.value === 'none') &&
|
|
2481
|
-
(value.type !== 18 /* FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]));
|
|
3301
|
+
return (!(value.type === 20 /* TokenType.IDENT_TOKEN */ && value.value === 'none') &&
|
|
3302
|
+
(value.type !== 18 /* TokenType.FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]));
|
|
2482
3303
|
}
|
|
2483
3304
|
var SUPPORTED_IMAGE_FUNCTIONS = {
|
|
2484
3305
|
'linear-gradient': linearGradient,
|
|
@@ -2497,14 +3318,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2497
3318
|
var backgroundImage = {
|
|
2498
3319
|
name: 'background-image',
|
|
2499
3320
|
initialValue: 'none',
|
|
2500
|
-
type: 1 /* LIST */,
|
|
3321
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2501
3322
|
prefix: false,
|
|
2502
3323
|
parse: function (context, tokens) {
|
|
2503
3324
|
if (tokens.length === 0) {
|
|
2504
3325
|
return [];
|
|
2505
3326
|
}
|
|
2506
3327
|
var first = tokens[0];
|
|
2507
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
3328
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
2508
3329
|
return [];
|
|
2509
3330
|
}
|
|
2510
3331
|
return tokens
|
|
@@ -2517,18 +3338,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2517
3338
|
name: 'background-origin',
|
|
2518
3339
|
initialValue: 'border-box',
|
|
2519
3340
|
prefix: false,
|
|
2520
|
-
type: 1 /* LIST */,
|
|
3341
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2521
3342
|
parse: function (_context, tokens) {
|
|
2522
3343
|
return tokens.map(function (token) {
|
|
2523
3344
|
if (isIdentToken(token)) {
|
|
2524
3345
|
switch (token.value) {
|
|
2525
3346
|
case 'padding-box':
|
|
2526
|
-
return 1 /* PADDING_BOX */;
|
|
3347
|
+
return 1 /* BACKGROUND_ORIGIN.PADDING_BOX */;
|
|
2527
3348
|
case 'content-box':
|
|
2528
|
-
return 2 /* CONTENT_BOX */;
|
|
3349
|
+
return 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */;
|
|
2529
3350
|
}
|
|
2530
3351
|
}
|
|
2531
|
-
return 0 /* BORDER_BOX */;
|
|
3352
|
+
return 0 /* BACKGROUND_ORIGIN.BORDER_BOX */;
|
|
2532
3353
|
});
|
|
2533
3354
|
}
|
|
2534
3355
|
};
|
|
@@ -2536,7 +3357,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2536
3357
|
var backgroundPosition = {
|
|
2537
3358
|
name: 'background-position',
|
|
2538
3359
|
initialValue: '0% 0%',
|
|
2539
|
-
type: 1 /* LIST */,
|
|
3360
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2540
3361
|
prefix: false,
|
|
2541
3362
|
parse: function (_context, tokens) {
|
|
2542
3363
|
return parseFunctionArgs(tokens)
|
|
@@ -2549,7 +3370,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2549
3370
|
name: 'background-repeat',
|
|
2550
3371
|
initialValue: 'repeat',
|
|
2551
3372
|
prefix: false,
|
|
2552
|
-
type: 1 /* LIST */,
|
|
3373
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2553
3374
|
parse: function (_context, tokens) {
|
|
2554
3375
|
return parseFunctionArgs(tokens)
|
|
2555
3376
|
.map(function (values) {
|
|
@@ -2564,16 +3385,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2564
3385
|
var parseBackgroundRepeat = function (value) {
|
|
2565
3386
|
switch (value) {
|
|
2566
3387
|
case 'no-repeat':
|
|
2567
|
-
return 1 /* NO_REPEAT */;
|
|
3388
|
+
return 1 /* BACKGROUND_REPEAT.NO_REPEAT */;
|
|
2568
3389
|
case 'repeat-x':
|
|
2569
3390
|
case 'repeat no-repeat':
|
|
2570
|
-
return 2 /* REPEAT_X */;
|
|
3391
|
+
return 2 /* BACKGROUND_REPEAT.REPEAT_X */;
|
|
2571
3392
|
case 'repeat-y':
|
|
2572
3393
|
case 'no-repeat repeat':
|
|
2573
|
-
return 3 /* REPEAT_Y */;
|
|
3394
|
+
return 3 /* BACKGROUND_REPEAT.REPEAT_Y */;
|
|
2574
3395
|
case 'repeat':
|
|
2575
3396
|
default:
|
|
2576
|
-
return 0 /* REPEAT */;
|
|
3397
|
+
return 0 /* BACKGROUND_REPEAT.REPEAT */;
|
|
2577
3398
|
}
|
|
2578
3399
|
};
|
|
2579
3400
|
|
|
@@ -2587,7 +3408,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2587
3408
|
name: 'background-size',
|
|
2588
3409
|
initialValue: '0',
|
|
2589
3410
|
prefix: false,
|
|
2590
|
-
type: 1 /* LIST */,
|
|
3411
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2591
3412
|
parse: function (_context, tokens) {
|
|
2592
3413
|
return parseFunctionArgs(tokens).map(function (values) { return values.filter(isBackgroundSizeInfoToken); });
|
|
2593
3414
|
}
|
|
@@ -2597,10 +3418,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2597
3418
|
};
|
|
2598
3419
|
|
|
2599
3420
|
var borderColorForSide = function (side) { return ({
|
|
2600
|
-
name: "border-"
|
|
3421
|
+
name: "border-".concat(side, "-color"),
|
|
2601
3422
|
initialValue: 'transparent',
|
|
2602
3423
|
prefix: false,
|
|
2603
|
-
type: 3 /* TYPE_VALUE */,
|
|
3424
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2604
3425
|
format: 'color'
|
|
2605
3426
|
}); };
|
|
2606
3427
|
var borderTopColor = borderColorForSide('top');
|
|
@@ -2609,10 +3430,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2609
3430
|
var borderLeftColor = borderColorForSide('left');
|
|
2610
3431
|
|
|
2611
3432
|
var borderRadiusForSide = function (side) { return ({
|
|
2612
|
-
name: "border-radius-"
|
|
3433
|
+
name: "border-radius-".concat(side),
|
|
2613
3434
|
initialValue: '0 0',
|
|
2614
3435
|
prefix: false,
|
|
2615
|
-
type: 1 /* LIST */,
|
|
3436
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2616
3437
|
parse: function (_context, tokens) {
|
|
2617
3438
|
return parseLengthPercentageTuple(tokens.filter(isLengthPercentage));
|
|
2618
3439
|
}
|
|
@@ -2623,22 +3444,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2623
3444
|
var borderBottomLeftRadius = borderRadiusForSide('bottom-left');
|
|
2624
3445
|
|
|
2625
3446
|
var borderStyleForSide = function (side) { return ({
|
|
2626
|
-
name: "border-"
|
|
3447
|
+
name: "border-".concat(side, "-style"),
|
|
2627
3448
|
initialValue: 'solid',
|
|
2628
3449
|
prefix: false,
|
|
2629
|
-
type: 2 /* IDENT_VALUE */,
|
|
3450
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2630
3451
|
parse: function (_context, style) {
|
|
2631
3452
|
switch (style) {
|
|
2632
3453
|
case 'none':
|
|
2633
|
-
return 0 /* NONE */;
|
|
3454
|
+
return 0 /* BORDER_STYLE.NONE */;
|
|
2634
3455
|
case 'dashed':
|
|
2635
|
-
return 2 /* DASHED */;
|
|
3456
|
+
return 2 /* BORDER_STYLE.DASHED */;
|
|
2636
3457
|
case 'dotted':
|
|
2637
|
-
return 3 /* DOTTED */;
|
|
3458
|
+
return 3 /* BORDER_STYLE.DOTTED */;
|
|
2638
3459
|
case 'double':
|
|
2639
|
-
return 4 /* DOUBLE */;
|
|
3460
|
+
return 4 /* BORDER_STYLE.DOUBLE */;
|
|
2640
3461
|
}
|
|
2641
|
-
return 1 /* SOLID */;
|
|
3462
|
+
return 1 /* BORDER_STYLE.SOLID */;
|
|
2642
3463
|
}
|
|
2643
3464
|
}); };
|
|
2644
3465
|
var borderTopStyle = borderStyleForSide('top');
|
|
@@ -2647,9 +3468,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2647
3468
|
var borderLeftStyle = borderStyleForSide('left');
|
|
2648
3469
|
|
|
2649
3470
|
var borderWidthForSide = function (side) { return ({
|
|
2650
|
-
name: "border-"
|
|
3471
|
+
name: "border-".concat(side, "-width"),
|
|
2651
3472
|
initialValue: '0',
|
|
2652
|
-
type: 0 /* VALUE */,
|
|
3473
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2653
3474
|
prefix: false,
|
|
2654
3475
|
parse: function (_context, token) {
|
|
2655
3476
|
if (isDimensionToken(token)) {
|
|
@@ -2667,7 +3488,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2667
3488
|
name: "color",
|
|
2668
3489
|
initialValue: 'transparent',
|
|
2669
3490
|
prefix: false,
|
|
2670
|
-
type: 3 /* TYPE_VALUE */,
|
|
3491
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2671
3492
|
format: 'color'
|
|
2672
3493
|
};
|
|
2673
3494
|
|
|
@@ -2675,14 +3496,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2675
3496
|
name: 'direction',
|
|
2676
3497
|
initialValue: 'ltr',
|
|
2677
3498
|
prefix: false,
|
|
2678
|
-
type: 2 /* IDENT_VALUE */,
|
|
3499
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2679
3500
|
parse: function (_context, direction) {
|
|
2680
3501
|
switch (direction) {
|
|
2681
3502
|
case 'rtl':
|
|
2682
|
-
return 1 /* RTL */;
|
|
3503
|
+
return 1 /* DIRECTION.RTL */;
|
|
2683
3504
|
case 'ltr':
|
|
2684
3505
|
default:
|
|
2685
|
-
return 0 /* LTR */;
|
|
3506
|
+
return 0 /* DIRECTION.LTR */;
|
|
2686
3507
|
}
|
|
2687
3508
|
}
|
|
2688
3509
|
};
|
|
@@ -2691,97 +3512,97 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2691
3512
|
name: 'display',
|
|
2692
3513
|
initialValue: 'inline-block',
|
|
2693
3514
|
prefix: false,
|
|
2694
|
-
type: 1 /* LIST */,
|
|
3515
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2695
3516
|
parse: function (_context, tokens) {
|
|
2696
3517
|
return tokens.filter(isIdentToken).reduce(function (bit, token) {
|
|
2697
|
-
return bit | parseDisplayValue(token.value);
|
|
2698
|
-
}, 0 /* NONE */);
|
|
3518
|
+
return bit | parseDisplayValue$1(token.value);
|
|
3519
|
+
}, 0 /* DISPLAY.NONE */);
|
|
2699
3520
|
}
|
|
2700
3521
|
};
|
|
2701
|
-
var parseDisplayValue = function (display) {
|
|
3522
|
+
var parseDisplayValue$1 = function (display) {
|
|
2702
3523
|
switch (display) {
|
|
2703
3524
|
case 'block':
|
|
2704
3525
|
case '-webkit-box':
|
|
2705
|
-
return 2 /* BLOCK */;
|
|
3526
|
+
return 2 /* DISPLAY.BLOCK */;
|
|
2706
3527
|
case 'inline':
|
|
2707
|
-
return 4 /* INLINE */;
|
|
3528
|
+
return 4 /* DISPLAY.INLINE */;
|
|
2708
3529
|
case 'run-in':
|
|
2709
|
-
return 8 /* RUN_IN */;
|
|
3530
|
+
return 8 /* DISPLAY.RUN_IN */;
|
|
2710
3531
|
case 'flow':
|
|
2711
|
-
return 16 /* FLOW */;
|
|
3532
|
+
return 16 /* DISPLAY.FLOW */;
|
|
2712
3533
|
case 'flow-root':
|
|
2713
|
-
return 32 /* FLOW_ROOT */;
|
|
3534
|
+
return 32 /* DISPLAY.FLOW_ROOT */;
|
|
2714
3535
|
case 'table':
|
|
2715
|
-
return 64 /* TABLE */;
|
|
3536
|
+
return 64 /* DISPLAY.TABLE */;
|
|
2716
3537
|
case 'flex':
|
|
2717
3538
|
case '-webkit-flex':
|
|
2718
|
-
return 128 /* FLEX */;
|
|
3539
|
+
return 128 /* DISPLAY.FLEX */;
|
|
2719
3540
|
case 'grid':
|
|
2720
3541
|
case '-ms-grid':
|
|
2721
|
-
return 256 /* GRID */;
|
|
3542
|
+
return 256 /* DISPLAY.GRID */;
|
|
2722
3543
|
case 'ruby':
|
|
2723
|
-
return 512 /* RUBY */;
|
|
3544
|
+
return 512 /* DISPLAY.RUBY */;
|
|
2724
3545
|
case 'subgrid':
|
|
2725
|
-
return 1024 /* SUBGRID */;
|
|
3546
|
+
return 1024 /* DISPLAY.SUBGRID */;
|
|
2726
3547
|
case 'list-item':
|
|
2727
|
-
return 2048 /* LIST_ITEM */;
|
|
3548
|
+
return 2048 /* DISPLAY.LIST_ITEM */;
|
|
2728
3549
|
case 'table-row-group':
|
|
2729
|
-
return 4096 /* TABLE_ROW_GROUP */;
|
|
3550
|
+
return 4096 /* DISPLAY.TABLE_ROW_GROUP */;
|
|
2730
3551
|
case 'table-header-group':
|
|
2731
|
-
return 8192 /* TABLE_HEADER_GROUP */;
|
|
3552
|
+
return 8192 /* DISPLAY.TABLE_HEADER_GROUP */;
|
|
2732
3553
|
case 'table-footer-group':
|
|
2733
|
-
return 16384 /* TABLE_FOOTER_GROUP */;
|
|
3554
|
+
return 16384 /* DISPLAY.TABLE_FOOTER_GROUP */;
|
|
2734
3555
|
case 'table-row':
|
|
2735
|
-
return 32768 /* TABLE_ROW */;
|
|
3556
|
+
return 32768 /* DISPLAY.TABLE_ROW */;
|
|
2736
3557
|
case 'table-cell':
|
|
2737
|
-
return 65536 /* TABLE_CELL */;
|
|
3558
|
+
return 65536 /* DISPLAY.TABLE_CELL */;
|
|
2738
3559
|
case 'table-column-group':
|
|
2739
|
-
return 131072 /* TABLE_COLUMN_GROUP */;
|
|
3560
|
+
return 131072 /* DISPLAY.TABLE_COLUMN_GROUP */;
|
|
2740
3561
|
case 'table-column':
|
|
2741
|
-
return 262144 /* TABLE_COLUMN */;
|
|
3562
|
+
return 262144 /* DISPLAY.TABLE_COLUMN */;
|
|
2742
3563
|
case 'table-caption':
|
|
2743
|
-
return 524288 /* TABLE_CAPTION */;
|
|
3564
|
+
return 524288 /* DISPLAY.TABLE_CAPTION */;
|
|
2744
3565
|
case 'ruby-base':
|
|
2745
|
-
return 1048576 /* RUBY_BASE */;
|
|
3566
|
+
return 1048576 /* DISPLAY.RUBY_BASE */;
|
|
2746
3567
|
case 'ruby-text':
|
|
2747
|
-
return 2097152 /* RUBY_TEXT */;
|
|
3568
|
+
return 2097152 /* DISPLAY.RUBY_TEXT */;
|
|
2748
3569
|
case 'ruby-base-container':
|
|
2749
|
-
return 4194304 /* RUBY_BASE_CONTAINER */;
|
|
3570
|
+
return 4194304 /* DISPLAY.RUBY_BASE_CONTAINER */;
|
|
2750
3571
|
case 'ruby-text-container':
|
|
2751
|
-
return 8388608 /* RUBY_TEXT_CONTAINER */;
|
|
3572
|
+
return 8388608 /* DISPLAY.RUBY_TEXT_CONTAINER */;
|
|
2752
3573
|
case 'contents':
|
|
2753
|
-
return 16777216 /* CONTENTS */;
|
|
3574
|
+
return 16777216 /* DISPLAY.CONTENTS */;
|
|
2754
3575
|
case 'inline-block':
|
|
2755
|
-
return 33554432 /* INLINE_BLOCK */;
|
|
3576
|
+
return 33554432 /* DISPLAY.INLINE_BLOCK */;
|
|
2756
3577
|
case 'inline-list-item':
|
|
2757
|
-
return 67108864 /* INLINE_LIST_ITEM */;
|
|
3578
|
+
return 67108864 /* DISPLAY.INLINE_LIST_ITEM */;
|
|
2758
3579
|
case 'inline-table':
|
|
2759
|
-
return 134217728 /* INLINE_TABLE */;
|
|
3580
|
+
return 134217728 /* DISPLAY.INLINE_TABLE */;
|
|
2760
3581
|
case 'inline-flex':
|
|
2761
|
-
return 268435456 /* INLINE_FLEX */;
|
|
3582
|
+
return 268435456 /* DISPLAY.INLINE_FLEX */;
|
|
2762
3583
|
case 'inline-grid':
|
|
2763
|
-
return 536870912 /* INLINE_GRID */;
|
|
3584
|
+
return 536870912 /* DISPLAY.INLINE_GRID */;
|
|
2764
3585
|
}
|
|
2765
|
-
return 0 /* NONE */;
|
|
3586
|
+
return 0 /* DISPLAY.NONE */;
|
|
2766
3587
|
};
|
|
2767
3588
|
|
|
2768
3589
|
var float = {
|
|
2769
3590
|
name: 'float',
|
|
2770
3591
|
initialValue: 'none',
|
|
2771
3592
|
prefix: false,
|
|
2772
|
-
type: 2 /* IDENT_VALUE */,
|
|
3593
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2773
3594
|
parse: function (_context, float) {
|
|
2774
3595
|
switch (float) {
|
|
2775
3596
|
case 'left':
|
|
2776
|
-
return 1 /* LEFT */;
|
|
3597
|
+
return 1 /* FLOAT.LEFT */;
|
|
2777
3598
|
case 'right':
|
|
2778
|
-
return 2 /* RIGHT */;
|
|
3599
|
+
return 2 /* FLOAT.RIGHT */;
|
|
2779
3600
|
case 'inline-start':
|
|
2780
|
-
return 3 /* INLINE_START */;
|
|
3601
|
+
return 3 /* FLOAT.INLINE_START */;
|
|
2781
3602
|
case 'inline-end':
|
|
2782
|
-
return 4 /* INLINE_END */;
|
|
3603
|
+
return 4 /* FLOAT.INLINE_END */;
|
|
2783
3604
|
}
|
|
2784
|
-
return 0 /* NONE */;
|
|
3605
|
+
return 0 /* FLOAT.NONE */;
|
|
2785
3606
|
}
|
|
2786
3607
|
};
|
|
2787
3608
|
|
|
@@ -2789,15 +3610,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2789
3610
|
name: 'letter-spacing',
|
|
2790
3611
|
initialValue: '0',
|
|
2791
3612
|
prefix: false,
|
|
2792
|
-
type: 0 /* VALUE */,
|
|
3613
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2793
3614
|
parse: function (_context, token) {
|
|
2794
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'normal') {
|
|
3615
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'normal') {
|
|
2795
3616
|
return 0;
|
|
2796
3617
|
}
|
|
2797
|
-
if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
3618
|
+
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
2798
3619
|
return token.number;
|
|
2799
3620
|
}
|
|
2800
|
-
if (token.type === 15 /* DIMENSION_TOKEN */) {
|
|
3621
|
+
if (token.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
2801
3622
|
return token.number;
|
|
2802
3623
|
}
|
|
2803
3624
|
return 0;
|
|
@@ -2813,7 +3634,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2813
3634
|
name: 'line-break',
|
|
2814
3635
|
initialValue: 'normal',
|
|
2815
3636
|
prefix: false,
|
|
2816
|
-
type: 2 /* IDENT_VALUE */,
|
|
3637
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2817
3638
|
parse: function (_context, lineBreak) {
|
|
2818
3639
|
switch (lineBreak) {
|
|
2819
3640
|
case 'strict':
|
|
@@ -2829,13 +3650,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2829
3650
|
name: 'line-height',
|
|
2830
3651
|
initialValue: 'normal',
|
|
2831
3652
|
prefix: false,
|
|
2832
|
-
type: 4 /* TOKEN_VALUE */
|
|
3653
|
+
type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
|
|
2833
3654
|
};
|
|
2834
3655
|
var computeLineHeight = function (token, fontSize) {
|
|
2835
3656
|
if (isIdentToken(token) && token.value === 'normal') {
|
|
2836
3657
|
return 1.2 * fontSize;
|
|
2837
3658
|
}
|
|
2838
|
-
else if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
3659
|
+
else if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
2839
3660
|
return fontSize * token.number;
|
|
2840
3661
|
}
|
|
2841
3662
|
else if (isLengthPercentage(token)) {
|
|
@@ -2847,10 +3668,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2847
3668
|
var listStyleImage = {
|
|
2848
3669
|
name: 'list-style-image',
|
|
2849
3670
|
initialValue: 'none',
|
|
2850
|
-
type: 0 /* VALUE */,
|
|
3671
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2851
3672
|
prefix: false,
|
|
2852
3673
|
parse: function (context, token) {
|
|
2853
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
|
|
3674
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
|
|
2854
3675
|
return null;
|
|
2855
3676
|
}
|
|
2856
3677
|
return image.parse(context, token);
|
|
@@ -2861,14 +3682,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2861
3682
|
name: 'list-style-position',
|
|
2862
3683
|
initialValue: 'outside',
|
|
2863
3684
|
prefix: false,
|
|
2864
|
-
type: 2 /* IDENT_VALUE */,
|
|
3685
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2865
3686
|
parse: function (_context, position) {
|
|
2866
3687
|
switch (position) {
|
|
2867
3688
|
case 'inside':
|
|
2868
|
-
return 0 /* INSIDE */;
|
|
3689
|
+
return 0 /* LIST_STYLE_POSITION.INSIDE */;
|
|
2869
3690
|
case 'outside':
|
|
2870
3691
|
default:
|
|
2871
|
-
return 1 /* OUTSIDE */;
|
|
3692
|
+
return 1 /* LIST_STYLE_POSITION.OUTSIDE */;
|
|
2872
3693
|
}
|
|
2873
3694
|
}
|
|
2874
3695
|
};
|
|
@@ -2877,127 +3698,127 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2877
3698
|
name: 'list-style-type',
|
|
2878
3699
|
initialValue: 'none',
|
|
2879
3700
|
prefix: false,
|
|
2880
|
-
type: 2 /* IDENT_VALUE */,
|
|
3701
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2881
3702
|
parse: function (_context, type) {
|
|
2882
3703
|
switch (type) {
|
|
2883
3704
|
case 'disc':
|
|
2884
|
-
return 0 /* DISC */;
|
|
3705
|
+
return 0 /* LIST_STYLE_TYPE.DISC */;
|
|
2885
3706
|
case 'circle':
|
|
2886
|
-
return 1 /* CIRCLE */;
|
|
3707
|
+
return 1 /* LIST_STYLE_TYPE.CIRCLE */;
|
|
2887
3708
|
case 'square':
|
|
2888
|
-
return 2 /* SQUARE */;
|
|
3709
|
+
return 2 /* LIST_STYLE_TYPE.SQUARE */;
|
|
2889
3710
|
case 'decimal':
|
|
2890
|
-
return 3 /* DECIMAL */;
|
|
3711
|
+
return 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
2891
3712
|
case 'cjk-decimal':
|
|
2892
|
-
return 4 /* CJK_DECIMAL */;
|
|
3713
|
+
return 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */;
|
|
2893
3714
|
case 'decimal-leading-zero':
|
|
2894
|
-
return 5 /* DECIMAL_LEADING_ZERO */;
|
|
3715
|
+
return 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */;
|
|
2895
3716
|
case 'lower-roman':
|
|
2896
|
-
return 6 /* LOWER_ROMAN */;
|
|
3717
|
+
return 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */;
|
|
2897
3718
|
case 'upper-roman':
|
|
2898
|
-
return 7 /* UPPER_ROMAN */;
|
|
3719
|
+
return 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */;
|
|
2899
3720
|
case 'lower-greek':
|
|
2900
|
-
return 8 /* LOWER_GREEK */;
|
|
3721
|
+
return 8 /* LIST_STYLE_TYPE.LOWER_GREEK */;
|
|
2901
3722
|
case 'lower-alpha':
|
|
2902
|
-
return 9 /* LOWER_ALPHA */;
|
|
3723
|
+
return 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */;
|
|
2903
3724
|
case 'upper-alpha':
|
|
2904
|
-
return 10 /* UPPER_ALPHA */;
|
|
3725
|
+
return 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */;
|
|
2905
3726
|
case 'arabic-indic':
|
|
2906
|
-
return 11 /* ARABIC_INDIC */;
|
|
3727
|
+
return 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */;
|
|
2907
3728
|
case 'armenian':
|
|
2908
|
-
return 12 /* ARMENIAN */;
|
|
3729
|
+
return 12 /* LIST_STYLE_TYPE.ARMENIAN */;
|
|
2909
3730
|
case 'bengali':
|
|
2910
|
-
return 13 /* BENGALI */;
|
|
3731
|
+
return 13 /* LIST_STYLE_TYPE.BENGALI */;
|
|
2911
3732
|
case 'cambodian':
|
|
2912
|
-
return 14 /* CAMBODIAN */;
|
|
3733
|
+
return 14 /* LIST_STYLE_TYPE.CAMBODIAN */;
|
|
2913
3734
|
case 'cjk-earthly-branch':
|
|
2914
|
-
return 15 /* CJK_EARTHLY_BRANCH */;
|
|
3735
|
+
return 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */;
|
|
2915
3736
|
case 'cjk-heavenly-stem':
|
|
2916
|
-
return 16 /* CJK_HEAVENLY_STEM */;
|
|
3737
|
+
return 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */;
|
|
2917
3738
|
case 'cjk-ideographic':
|
|
2918
|
-
return 17 /* CJK_IDEOGRAPHIC */;
|
|
3739
|
+
return 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */;
|
|
2919
3740
|
case 'devanagari':
|
|
2920
|
-
return 18 /* DEVANAGARI */;
|
|
3741
|
+
return 18 /* LIST_STYLE_TYPE.DEVANAGARI */;
|
|
2921
3742
|
case 'ethiopic-numeric':
|
|
2922
|
-
return 19 /* ETHIOPIC_NUMERIC */;
|
|
3743
|
+
return 19 /* LIST_STYLE_TYPE.ETHIOPIC_NUMERIC */;
|
|
2923
3744
|
case 'georgian':
|
|
2924
|
-
return 20 /* GEORGIAN */;
|
|
3745
|
+
return 20 /* LIST_STYLE_TYPE.GEORGIAN */;
|
|
2925
3746
|
case 'gujarati':
|
|
2926
|
-
return 21 /* GUJARATI */;
|
|
3747
|
+
return 21 /* LIST_STYLE_TYPE.GUJARATI */;
|
|
2927
3748
|
case 'gurmukhi':
|
|
2928
|
-
return 22 /* GURMUKHI */;
|
|
3749
|
+
return 22 /* LIST_STYLE_TYPE.GURMUKHI */;
|
|
2929
3750
|
case 'hebrew':
|
|
2930
|
-
return 22 /* HEBREW */;
|
|
3751
|
+
return 22 /* LIST_STYLE_TYPE.HEBREW */;
|
|
2931
3752
|
case 'hiragana':
|
|
2932
|
-
return 23 /* HIRAGANA */;
|
|
3753
|
+
return 23 /* LIST_STYLE_TYPE.HIRAGANA */;
|
|
2933
3754
|
case 'hiragana-iroha':
|
|
2934
|
-
return 24 /* HIRAGANA_IROHA */;
|
|
3755
|
+
return 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */;
|
|
2935
3756
|
case 'japanese-formal':
|
|
2936
|
-
return 25 /* JAPANESE_FORMAL */;
|
|
3757
|
+
return 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */;
|
|
2937
3758
|
case 'japanese-informal':
|
|
2938
|
-
return 26 /* JAPANESE_INFORMAL */;
|
|
3759
|
+
return 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */;
|
|
2939
3760
|
case 'kannada':
|
|
2940
|
-
return 27 /* KANNADA */;
|
|
3761
|
+
return 27 /* LIST_STYLE_TYPE.KANNADA */;
|
|
2941
3762
|
case 'katakana':
|
|
2942
|
-
return 28 /* KATAKANA */;
|
|
3763
|
+
return 28 /* LIST_STYLE_TYPE.KATAKANA */;
|
|
2943
3764
|
case 'katakana-iroha':
|
|
2944
|
-
return 29 /* KATAKANA_IROHA */;
|
|
3765
|
+
return 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */;
|
|
2945
3766
|
case 'khmer':
|
|
2946
|
-
return 30 /* KHMER */;
|
|
3767
|
+
return 30 /* LIST_STYLE_TYPE.KHMER */;
|
|
2947
3768
|
case 'korean-hangul-formal':
|
|
2948
|
-
return 31 /* KOREAN_HANGUL_FORMAL */;
|
|
3769
|
+
return 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */;
|
|
2949
3770
|
case 'korean-hanja-formal':
|
|
2950
|
-
return 32 /* KOREAN_HANJA_FORMAL */;
|
|
3771
|
+
return 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */;
|
|
2951
3772
|
case 'korean-hanja-informal':
|
|
2952
|
-
return 33 /* KOREAN_HANJA_INFORMAL */;
|
|
3773
|
+
return 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */;
|
|
2953
3774
|
case 'lao':
|
|
2954
|
-
return 34 /* LAO */;
|
|
3775
|
+
return 34 /* LIST_STYLE_TYPE.LAO */;
|
|
2955
3776
|
case 'lower-armenian':
|
|
2956
|
-
return 35 /* LOWER_ARMENIAN */;
|
|
3777
|
+
return 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */;
|
|
2957
3778
|
case 'malayalam':
|
|
2958
|
-
return 36 /* MALAYALAM */;
|
|
3779
|
+
return 36 /* LIST_STYLE_TYPE.MALAYALAM */;
|
|
2959
3780
|
case 'mongolian':
|
|
2960
|
-
return 37 /* MONGOLIAN */;
|
|
3781
|
+
return 37 /* LIST_STYLE_TYPE.MONGOLIAN */;
|
|
2961
3782
|
case 'myanmar':
|
|
2962
|
-
return 38 /* MYANMAR */;
|
|
3783
|
+
return 38 /* LIST_STYLE_TYPE.MYANMAR */;
|
|
2963
3784
|
case 'oriya':
|
|
2964
|
-
return 39 /* ORIYA */;
|
|
3785
|
+
return 39 /* LIST_STYLE_TYPE.ORIYA */;
|
|
2965
3786
|
case 'persian':
|
|
2966
|
-
return 40 /* PERSIAN */;
|
|
3787
|
+
return 40 /* LIST_STYLE_TYPE.PERSIAN */;
|
|
2967
3788
|
case 'simp-chinese-formal':
|
|
2968
|
-
return 41 /* SIMP_CHINESE_FORMAL */;
|
|
3789
|
+
return 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */;
|
|
2969
3790
|
case 'simp-chinese-informal':
|
|
2970
|
-
return 42 /* SIMP_CHINESE_INFORMAL */;
|
|
3791
|
+
return 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */;
|
|
2971
3792
|
case 'tamil':
|
|
2972
|
-
return 43 /* TAMIL */;
|
|
3793
|
+
return 43 /* LIST_STYLE_TYPE.TAMIL */;
|
|
2973
3794
|
case 'telugu':
|
|
2974
|
-
return 44 /* TELUGU */;
|
|
3795
|
+
return 44 /* LIST_STYLE_TYPE.TELUGU */;
|
|
2975
3796
|
case 'thai':
|
|
2976
|
-
return 45 /* THAI */;
|
|
3797
|
+
return 45 /* LIST_STYLE_TYPE.THAI */;
|
|
2977
3798
|
case 'tibetan':
|
|
2978
|
-
return 46 /* TIBETAN */;
|
|
3799
|
+
return 46 /* LIST_STYLE_TYPE.TIBETAN */;
|
|
2979
3800
|
case 'trad-chinese-formal':
|
|
2980
|
-
return 47 /* TRAD_CHINESE_FORMAL */;
|
|
3801
|
+
return 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */;
|
|
2981
3802
|
case 'trad-chinese-informal':
|
|
2982
|
-
return 48 /* TRAD_CHINESE_INFORMAL */;
|
|
3803
|
+
return 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */;
|
|
2983
3804
|
case 'upper-armenian':
|
|
2984
|
-
return 49 /* UPPER_ARMENIAN */;
|
|
3805
|
+
return 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */;
|
|
2985
3806
|
case 'disclosure-open':
|
|
2986
|
-
return 50 /* DISCLOSURE_OPEN */;
|
|
3807
|
+
return 50 /* LIST_STYLE_TYPE.DISCLOSURE_OPEN */;
|
|
2987
3808
|
case 'disclosure-closed':
|
|
2988
|
-
return 51 /* DISCLOSURE_CLOSED */;
|
|
3809
|
+
return 51 /* LIST_STYLE_TYPE.DISCLOSURE_CLOSED */;
|
|
2989
3810
|
case 'none':
|
|
2990
3811
|
default:
|
|
2991
|
-
return -1 /* NONE */;
|
|
3812
|
+
return -1 /* LIST_STYLE_TYPE.NONE */;
|
|
2992
3813
|
}
|
|
2993
3814
|
}
|
|
2994
3815
|
};
|
|
2995
3816
|
|
|
2996
3817
|
var marginForSide = function (side) { return ({
|
|
2997
|
-
name: "margin-"
|
|
3818
|
+
name: "margin-".concat(side),
|
|
2998
3819
|
initialValue: '0',
|
|
2999
3820
|
prefix: false,
|
|
3000
|
-
type: 4 /* TOKEN_VALUE */
|
|
3821
|
+
type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
|
|
3001
3822
|
}); };
|
|
3002
3823
|
var marginTop = marginForSide('top');
|
|
3003
3824
|
var marginRight = marginForSide('right');
|
|
@@ -3008,21 +3829,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3008
3829
|
name: 'overflow',
|
|
3009
3830
|
initialValue: 'visible',
|
|
3010
3831
|
prefix: false,
|
|
3011
|
-
type: 1 /* LIST */,
|
|
3832
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3012
3833
|
parse: function (_context, tokens) {
|
|
3013
3834
|
return tokens.filter(isIdentToken).map(function (overflow) {
|
|
3014
3835
|
switch (overflow.value) {
|
|
3015
3836
|
case 'hidden':
|
|
3016
|
-
return 1 /* HIDDEN */;
|
|
3837
|
+
return 1 /* OVERFLOW.HIDDEN */;
|
|
3017
3838
|
case 'scroll':
|
|
3018
|
-
return 2 /* SCROLL */;
|
|
3839
|
+
return 2 /* OVERFLOW.SCROLL */;
|
|
3019
3840
|
case 'clip':
|
|
3020
|
-
return 3 /* CLIP */;
|
|
3841
|
+
return 3 /* OVERFLOW.CLIP */;
|
|
3021
3842
|
case 'auto':
|
|
3022
|
-
return 4 /* AUTO */;
|
|
3843
|
+
return 4 /* OVERFLOW.AUTO */;
|
|
3023
3844
|
case 'visible':
|
|
3024
3845
|
default:
|
|
3025
|
-
return 0 /* VISIBLE */;
|
|
3846
|
+
return 0 /* OVERFLOW.VISIBLE */;
|
|
3026
3847
|
}
|
|
3027
3848
|
});
|
|
3028
3849
|
}
|
|
@@ -3032,23 +3853,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3032
3853
|
name: 'overflow-wrap',
|
|
3033
3854
|
initialValue: 'normal',
|
|
3034
3855
|
prefix: false,
|
|
3035
|
-
type: 2 /* IDENT_VALUE */,
|
|
3856
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3036
3857
|
parse: function (_context, overflow) {
|
|
3037
3858
|
switch (overflow) {
|
|
3038
3859
|
case 'break-word':
|
|
3039
|
-
return "break-word" /* BREAK_WORD */;
|
|
3860
|
+
return "break-word" /* OVERFLOW_WRAP.BREAK_WORD */;
|
|
3040
3861
|
case 'normal':
|
|
3041
3862
|
default:
|
|
3042
|
-
return "normal" /* NORMAL */;
|
|
3863
|
+
return "normal" /* OVERFLOW_WRAP.NORMAL */;
|
|
3043
3864
|
}
|
|
3044
3865
|
}
|
|
3045
3866
|
};
|
|
3046
3867
|
|
|
3047
3868
|
var paddingForSide = function (side) { return ({
|
|
3048
|
-
name: "padding-"
|
|
3869
|
+
name: "padding-".concat(side),
|
|
3049
3870
|
initialValue: '0',
|
|
3050
3871
|
prefix: false,
|
|
3051
|
-
type: 3 /* TYPE_VALUE */,
|
|
3872
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3052
3873
|
format: 'length-percentage'
|
|
3053
3874
|
}); };
|
|
3054
3875
|
var paddingTop = paddingForSide('top');
|
|
@@ -3060,17 +3881,17 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3060
3881
|
name: 'text-align',
|
|
3061
3882
|
initialValue: 'left',
|
|
3062
3883
|
prefix: false,
|
|
3063
|
-
type: 2 /* IDENT_VALUE */,
|
|
3884
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3064
3885
|
parse: function (_context, textAlign) {
|
|
3065
3886
|
switch (textAlign) {
|
|
3066
3887
|
case 'right':
|
|
3067
|
-
return 2 /* RIGHT */;
|
|
3888
|
+
return 2 /* TEXT_ALIGN.RIGHT */;
|
|
3068
3889
|
case 'center':
|
|
3069
3890
|
case 'justify':
|
|
3070
|
-
return 1 /* CENTER */;
|
|
3891
|
+
return 1 /* TEXT_ALIGN.CENTER */;
|
|
3071
3892
|
case 'left':
|
|
3072
3893
|
default:
|
|
3073
|
-
return 0 /* LEFT */;
|
|
3894
|
+
return 0 /* TEXT_ALIGN.LEFT */;
|
|
3074
3895
|
}
|
|
3075
3896
|
}
|
|
3076
3897
|
};
|
|
@@ -3079,26 +3900,26 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3079
3900
|
name: 'position',
|
|
3080
3901
|
initialValue: 'static',
|
|
3081
3902
|
prefix: false,
|
|
3082
|
-
type: 2 /* IDENT_VALUE */,
|
|
3903
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3083
3904
|
parse: function (_context, position) {
|
|
3084
3905
|
switch (position) {
|
|
3085
3906
|
case 'relative':
|
|
3086
|
-
return 1 /* RELATIVE */;
|
|
3907
|
+
return 1 /* POSITION.RELATIVE */;
|
|
3087
3908
|
case 'absolute':
|
|
3088
|
-
return 2 /* ABSOLUTE */;
|
|
3909
|
+
return 2 /* POSITION.ABSOLUTE */;
|
|
3089
3910
|
case 'fixed':
|
|
3090
|
-
return 3 /* FIXED */;
|
|
3911
|
+
return 3 /* POSITION.FIXED */;
|
|
3091
3912
|
case 'sticky':
|
|
3092
|
-
return 4 /* STICKY */;
|
|
3913
|
+
return 4 /* POSITION.STICKY */;
|
|
3093
3914
|
}
|
|
3094
|
-
return 0 /* STATIC */;
|
|
3915
|
+
return 0 /* POSITION.STATIC */;
|
|
3095
3916
|
}
|
|
3096
3917
|
};
|
|
3097
3918
|
|
|
3098
3919
|
var textShadow = {
|
|
3099
3920
|
name: 'text-shadow',
|
|
3100
3921
|
initialValue: 'none',
|
|
3101
|
-
type: 1 /* LIST */,
|
|
3922
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3102
3923
|
prefix: false,
|
|
3103
3924
|
parse: function (context, tokens) {
|
|
3104
3925
|
if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
|
|
@@ -3139,17 +3960,17 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3139
3960
|
name: 'text-transform',
|
|
3140
3961
|
initialValue: 'none',
|
|
3141
3962
|
prefix: false,
|
|
3142
|
-
type: 2 /* IDENT_VALUE */,
|
|
3963
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3143
3964
|
parse: function (_context, textTransform) {
|
|
3144
3965
|
switch (textTransform) {
|
|
3145
3966
|
case 'uppercase':
|
|
3146
|
-
return 2 /* UPPERCASE */;
|
|
3967
|
+
return 2 /* TEXT_TRANSFORM.UPPERCASE */;
|
|
3147
3968
|
case 'lowercase':
|
|
3148
|
-
return 1 /* LOWERCASE */;
|
|
3969
|
+
return 1 /* TEXT_TRANSFORM.LOWERCASE */;
|
|
3149
3970
|
case 'capitalize':
|
|
3150
|
-
return 3 /* CAPITALIZE */;
|
|
3971
|
+
return 3 /* TEXT_TRANSFORM.CAPITALIZE */;
|
|
3151
3972
|
}
|
|
3152
|
-
return 0 /* NONE */;
|
|
3973
|
+
return 0 /* TEXT_TRANSFORM.NONE */;
|
|
3153
3974
|
}
|
|
3154
3975
|
};
|
|
3155
3976
|
|
|
@@ -3157,15 +3978,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3157
3978
|
name: 'transform',
|
|
3158
3979
|
initialValue: 'none',
|
|
3159
3980
|
prefix: true,
|
|
3160
|
-
type: 0 /* VALUE */,
|
|
3981
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3161
3982
|
parse: function (_context, token) {
|
|
3162
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
|
|
3983
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
|
|
3163
3984
|
return null;
|
|
3164
3985
|
}
|
|
3165
|
-
if (token.type === 18 /* FUNCTION */) {
|
|
3986
|
+
if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
3166
3987
|
var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
|
|
3167
3988
|
if (typeof transformFunction === 'undefined') {
|
|
3168
|
-
throw new Error("Attempting to parse an unsupported transform function \""
|
|
3989
|
+
throw new Error("Attempting to parse an unsupported transform function \"".concat(token.name, "\""));
|
|
3169
3990
|
}
|
|
3170
3991
|
return transformFunction(token.values);
|
|
3171
3992
|
}
|
|
@@ -3173,12 +3994,12 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3173
3994
|
}
|
|
3174
3995
|
};
|
|
3175
3996
|
var matrix = function (args) {
|
|
3176
|
-
var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
3997
|
+
var values = args.filter(function (arg) { return arg.type === 17 /* TokenType.NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
3177
3998
|
return values.length === 6 ? values : null;
|
|
3178
3999
|
};
|
|
3179
4000
|
// doesn't support 3D transforms at the moment
|
|
3180
4001
|
var matrix3d = function (args) {
|
|
3181
|
-
var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
4002
|
+
var values = args.filter(function (arg) { return arg.type === 17 /* TokenType.NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
3182
4003
|
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;
|
|
3183
4004
|
};
|
|
3184
4005
|
var SUPPORTED_TRANSFORM_FUNCTIONS = {
|
|
@@ -3187,7 +4008,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3187
4008
|
};
|
|
3188
4009
|
|
|
3189
4010
|
var DEFAULT_VALUE = {
|
|
3190
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
4011
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
3191
4012
|
number: 50,
|
|
3192
4013
|
flags: FLAG_INTEGER
|
|
3193
4014
|
};
|
|
@@ -3196,7 +4017,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3196
4017
|
name: 'transform-origin',
|
|
3197
4018
|
initialValue: '50% 50%',
|
|
3198
4019
|
prefix: true,
|
|
3199
|
-
type: 1 /* LIST */,
|
|
4020
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3200
4021
|
parse: function (_context, tokens) {
|
|
3201
4022
|
var origins = tokens.filter(isLengthPercentage);
|
|
3202
4023
|
if (origins.length !== 2) {
|
|
@@ -3210,16 +4031,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3210
4031
|
name: 'visible',
|
|
3211
4032
|
initialValue: 'none',
|
|
3212
4033
|
prefix: false,
|
|
3213
|
-
type: 2 /* IDENT_VALUE */,
|
|
4034
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3214
4035
|
parse: function (_context, visibility) {
|
|
3215
4036
|
switch (visibility) {
|
|
3216
4037
|
case 'hidden':
|
|
3217
|
-
return 1 /* HIDDEN */;
|
|
4038
|
+
return 1 /* VISIBILITY.HIDDEN */;
|
|
3218
4039
|
case 'collapse':
|
|
3219
|
-
return 2 /* COLLAPSE */;
|
|
4040
|
+
return 2 /* VISIBILITY.COLLAPSE */;
|
|
3220
4041
|
case 'visible':
|
|
3221
4042
|
default:
|
|
3222
|
-
return 0 /* VISIBLE */;
|
|
4043
|
+
return 0 /* VISIBILITY.VISIBLE */;
|
|
3223
4044
|
}
|
|
3224
4045
|
}
|
|
3225
4046
|
};
|
|
@@ -3234,7 +4055,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3234
4055
|
name: 'word-break',
|
|
3235
4056
|
initialValue: 'normal',
|
|
3236
4057
|
prefix: false,
|
|
3237
|
-
type: 2 /* IDENT_VALUE */,
|
|
4058
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3238
4059
|
parse: function (_context, wordBreak) {
|
|
3239
4060
|
switch (wordBreak) {
|
|
3240
4061
|
case 'break-all':
|
|
@@ -3252,9 +4073,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3252
4073
|
name: 'z-index',
|
|
3253
4074
|
initialValue: 'auto',
|
|
3254
4075
|
prefix: false,
|
|
3255
|
-
type: 0 /* VALUE */,
|
|
4076
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3256
4077
|
parse: function (_context, token) {
|
|
3257
|
-
if (token.type === 20 /* IDENT_TOKEN */) {
|
|
4078
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
3258
4079
|
return { auto: true, order: 0 };
|
|
3259
4080
|
}
|
|
3260
4081
|
if (isNumberToken(token)) {
|
|
@@ -3267,7 +4088,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3267
4088
|
var time = {
|
|
3268
4089
|
name: 'time',
|
|
3269
4090
|
parse: function (_context, value) {
|
|
3270
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
4091
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
3271
4092
|
switch (value.unit.toLowerCase()) {
|
|
3272
4093
|
case 's':
|
|
3273
4094
|
return 1000 * value.number;
|
|
@@ -3282,7 +4103,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3282
4103
|
var opacity = {
|
|
3283
4104
|
name: 'opacity',
|
|
3284
4105
|
initialValue: '1',
|
|
3285
|
-
type: 0 /* VALUE */,
|
|
4106
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3286
4107
|
prefix: false,
|
|
3287
4108
|
parse: function (_context, token) {
|
|
3288
4109
|
if (isNumberToken(token)) {
|
|
@@ -3296,7 +4117,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3296
4117
|
name: "text-decoration-color",
|
|
3297
4118
|
initialValue: 'transparent',
|
|
3298
4119
|
prefix: false,
|
|
3299
|
-
type: 3 /* TYPE_VALUE */,
|
|
4120
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3300
4121
|
format: 'color'
|
|
3301
4122
|
};
|
|
3302
4123
|
|
|
@@ -3304,24 +4125,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3304
4125
|
name: 'text-decoration-line',
|
|
3305
4126
|
initialValue: 'none',
|
|
3306
4127
|
prefix: false,
|
|
3307
|
-
type: 1 /* LIST */,
|
|
4128
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3308
4129
|
parse: function (_context, tokens) {
|
|
3309
4130
|
return tokens
|
|
3310
4131
|
.filter(isIdentToken)
|
|
3311
4132
|
.map(function (token) {
|
|
3312
4133
|
switch (token.value) {
|
|
3313
4134
|
case 'underline':
|
|
3314
|
-
return 1 /* UNDERLINE */;
|
|
4135
|
+
return 1 /* TEXT_DECORATION_LINE.UNDERLINE */;
|
|
3315
4136
|
case 'overline':
|
|
3316
|
-
return 2 /* OVERLINE */;
|
|
4137
|
+
return 2 /* TEXT_DECORATION_LINE.OVERLINE */;
|
|
3317
4138
|
case 'line-through':
|
|
3318
|
-
return 3 /* LINE_THROUGH */;
|
|
4139
|
+
return 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */;
|
|
3319
4140
|
case 'none':
|
|
3320
|
-
return 4 /* BLINK */;
|
|
4141
|
+
return 4 /* TEXT_DECORATION_LINE.BLINK */;
|
|
3321
4142
|
}
|
|
3322
|
-
return 0 /* NONE */;
|
|
4143
|
+
return 0 /* TEXT_DECORATION_LINE.NONE */;
|
|
3323
4144
|
})
|
|
3324
|
-
.filter(function (line) { return line !== 0 /* NONE */; });
|
|
4145
|
+
.filter(function (line) { return line !== 0 /* TEXT_DECORATION_LINE.NONE */; });
|
|
3325
4146
|
}
|
|
3326
4147
|
};
|
|
3327
4148
|
|
|
@@ -3329,20 +4150,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3329
4150
|
name: "font-family",
|
|
3330
4151
|
initialValue: '',
|
|
3331
4152
|
prefix: false,
|
|
3332
|
-
type: 1 /* LIST */,
|
|
4153
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3333
4154
|
parse: function (_context, tokens) {
|
|
3334
4155
|
var accumulator = [];
|
|
3335
4156
|
var results = [];
|
|
3336
4157
|
tokens.forEach(function (token) {
|
|
3337
4158
|
switch (token.type) {
|
|
3338
|
-
case 20 /* IDENT_TOKEN */:
|
|
3339
|
-
case 0 /* STRING_TOKEN */:
|
|
4159
|
+
case 20 /* TokenType.IDENT_TOKEN */:
|
|
4160
|
+
case 0 /* TokenType.STRING_TOKEN */:
|
|
3340
4161
|
accumulator.push(token.value);
|
|
3341
4162
|
break;
|
|
3342
|
-
case 17 /* NUMBER_TOKEN */:
|
|
4163
|
+
case 17 /* TokenType.NUMBER_TOKEN */:
|
|
3343
4164
|
accumulator.push(token.number.toString());
|
|
3344
4165
|
break;
|
|
3345
|
-
case 4 /* COMMA_TOKEN */:
|
|
4166
|
+
case 4 /* TokenType.COMMA_TOKEN */:
|
|
3346
4167
|
results.push(accumulator.join(' '));
|
|
3347
4168
|
accumulator.length = 0;
|
|
3348
4169
|
break;
|
|
@@ -3351,7 +4172,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3351
4172
|
if (accumulator.length) {
|
|
3352
4173
|
results.push(accumulator.join(' '));
|
|
3353
4174
|
}
|
|
3354
|
-
return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'"
|
|
4175
|
+
return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'".concat(result, "'")); });
|
|
3355
4176
|
}
|
|
3356
4177
|
};
|
|
3357
4178
|
|
|
@@ -3359,14 +4180,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3359
4180
|
name: "font-size",
|
|
3360
4181
|
initialValue: '0',
|
|
3361
4182
|
prefix: false,
|
|
3362
|
-
type: 3 /* TYPE_VALUE */,
|
|
4183
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3363
4184
|
format: 'length'
|
|
3364
4185
|
};
|
|
3365
4186
|
|
|
3366
4187
|
var fontWeight = {
|
|
3367
4188
|
name: 'font-weight',
|
|
3368
4189
|
initialValue: 'normal',
|
|
3369
|
-
type: 0 /* VALUE */,
|
|
4190
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3370
4191
|
prefix: false,
|
|
3371
4192
|
parse: function (_context, token) {
|
|
3372
4193
|
if (isNumberToken(token)) {
|
|
@@ -3388,7 +4209,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3388
4209
|
var fontVariant = {
|
|
3389
4210
|
name: 'font-variant',
|
|
3390
4211
|
initialValue: 'none',
|
|
3391
|
-
type: 1 /* LIST */,
|
|
4212
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3392
4213
|
prefix: false,
|
|
3393
4214
|
parse: function (_context, tokens) {
|
|
3394
4215
|
return tokens.filter(isIdentToken).map(function (token) { return token.value; });
|
|
@@ -3399,16 +4220,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3399
4220
|
name: 'font-style',
|
|
3400
4221
|
initialValue: 'normal',
|
|
3401
4222
|
prefix: false,
|
|
3402
|
-
type: 2 /* IDENT_VALUE */,
|
|
4223
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3403
4224
|
parse: function (_context, overflow) {
|
|
3404
4225
|
switch (overflow) {
|
|
3405
4226
|
case 'oblique':
|
|
3406
|
-
return "oblique" /* OBLIQUE */;
|
|
4227
|
+
return "oblique" /* FONT_STYLE.OBLIQUE */;
|
|
3407
4228
|
case 'italic':
|
|
3408
|
-
return "italic" /* ITALIC */;
|
|
4229
|
+
return "italic" /* FONT_STYLE.ITALIC */;
|
|
3409
4230
|
case 'normal':
|
|
3410
4231
|
default:
|
|
3411
|
-
return "normal" /* NORMAL */;
|
|
4232
|
+
return "normal" /* FONT_STYLE.NORMAL */;
|
|
3412
4233
|
}
|
|
3413
4234
|
}
|
|
3414
4235
|
};
|
|
@@ -3418,14 +4239,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3418
4239
|
var content = {
|
|
3419
4240
|
name: 'content',
|
|
3420
4241
|
initialValue: 'none',
|
|
3421
|
-
type: 1 /* LIST */,
|
|
4242
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3422
4243
|
prefix: false,
|
|
3423
4244
|
parse: function (_context, tokens) {
|
|
3424
4245
|
if (tokens.length === 0) {
|
|
3425
4246
|
return [];
|
|
3426
4247
|
}
|
|
3427
4248
|
var first = tokens[0];
|
|
3428
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4249
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3429
4250
|
return [];
|
|
3430
4251
|
}
|
|
3431
4252
|
return tokens;
|
|
@@ -3436,13 +4257,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3436
4257
|
name: 'counter-increment',
|
|
3437
4258
|
initialValue: 'none',
|
|
3438
4259
|
prefix: true,
|
|
3439
|
-
type: 1 /* LIST */,
|
|
4260
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3440
4261
|
parse: function (_context, tokens) {
|
|
3441
4262
|
if (tokens.length === 0) {
|
|
3442
4263
|
return null;
|
|
3443
4264
|
}
|
|
3444
4265
|
var first = tokens[0];
|
|
3445
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4266
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3446
4267
|
return null;
|
|
3447
4268
|
}
|
|
3448
4269
|
var increments = [];
|
|
@@ -3450,7 +4271,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3450
4271
|
for (var i = 0; i < filtered.length; i++) {
|
|
3451
4272
|
var counter = filtered[i];
|
|
3452
4273
|
var next = filtered[i + 1];
|
|
3453
|
-
if (counter.type === 20 /* IDENT_TOKEN */) {
|
|
4274
|
+
if (counter.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
3454
4275
|
var increment = next && isNumberToken(next) ? next.number : 1;
|
|
3455
4276
|
increments.push({ counter: counter.value, increment: increment });
|
|
3456
4277
|
}
|
|
@@ -3463,7 +4284,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3463
4284
|
name: 'counter-reset',
|
|
3464
4285
|
initialValue: 'none',
|
|
3465
4286
|
prefix: true,
|
|
3466
|
-
type: 1 /* LIST */,
|
|
4287
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3467
4288
|
parse: function (_context, tokens) {
|
|
3468
4289
|
if (tokens.length === 0) {
|
|
3469
4290
|
return [];
|
|
@@ -3486,7 +4307,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3486
4307
|
name: 'duration',
|
|
3487
4308
|
initialValue: '0s',
|
|
3488
4309
|
prefix: false,
|
|
3489
|
-
type: 1 /* LIST */,
|
|
4310
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3490
4311
|
parse: function (context, tokens) {
|
|
3491
4312
|
return tokens.filter(isDimensionToken).map(function (token) { return time.parse(context, token); });
|
|
3492
4313
|
}
|
|
@@ -3496,13 +4317,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3496
4317
|
name: 'quotes',
|
|
3497
4318
|
initialValue: 'none',
|
|
3498
4319
|
prefix: true,
|
|
3499
|
-
type: 1 /* LIST */,
|
|
4320
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3500
4321
|
parse: function (_context, tokens) {
|
|
3501
4322
|
if (tokens.length === 0) {
|
|
3502
4323
|
return null;
|
|
3503
4324
|
}
|
|
3504
4325
|
var first = tokens[0];
|
|
3505
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4326
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3506
4327
|
return null;
|
|
3507
4328
|
}
|
|
3508
4329
|
var quotes = [];
|
|
@@ -3532,7 +4353,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3532
4353
|
var boxShadow = {
|
|
3533
4354
|
name: 'box-shadow',
|
|
3534
4355
|
initialValue: 'none',
|
|
3535
|
-
type: 1 /* LIST */,
|
|
4356
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3536
4357
|
prefix: false,
|
|
3537
4358
|
parse: function (context, tokens) {
|
|
3538
4359
|
if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
|
|
@@ -3581,20 +4402,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3581
4402
|
name: 'paint-order',
|
|
3582
4403
|
initialValue: 'normal',
|
|
3583
4404
|
prefix: false,
|
|
3584
|
-
type: 1 /* LIST */,
|
|
4405
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3585
4406
|
parse: function (_context, tokens) {
|
|
3586
|
-
var DEFAULT_VALUE = [0 /* FILL */, 1 /* STROKE */, 2 /* MARKERS */];
|
|
4407
|
+
var DEFAULT_VALUE = [0 /* PAINT_ORDER_LAYER.FILL */, 1 /* PAINT_ORDER_LAYER.STROKE */, 2 /* PAINT_ORDER_LAYER.MARKERS */];
|
|
3587
4408
|
var layers = [];
|
|
3588
4409
|
tokens.filter(isIdentToken).forEach(function (token) {
|
|
3589
4410
|
switch (token.value) {
|
|
3590
4411
|
case 'stroke':
|
|
3591
|
-
layers.push(1 /* STROKE */);
|
|
4412
|
+
layers.push(1 /* PAINT_ORDER_LAYER.STROKE */);
|
|
3592
4413
|
break;
|
|
3593
4414
|
case 'fill':
|
|
3594
|
-
layers.push(0 /* FILL */);
|
|
4415
|
+
layers.push(0 /* PAINT_ORDER_LAYER.FILL */);
|
|
3595
4416
|
break;
|
|
3596
4417
|
case 'markers':
|
|
3597
|
-
layers.push(2 /* MARKERS */);
|
|
4418
|
+
layers.push(2 /* PAINT_ORDER_LAYER.MARKERS */);
|
|
3598
4419
|
break;
|
|
3599
4420
|
}
|
|
3600
4421
|
});
|
|
@@ -3611,14 +4432,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3611
4432
|
name: "-webkit-text-stroke-color",
|
|
3612
4433
|
initialValue: 'currentcolor',
|
|
3613
4434
|
prefix: false,
|
|
3614
|
-
type: 3 /* TYPE_VALUE */,
|
|
4435
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3615
4436
|
format: 'color'
|
|
3616
4437
|
};
|
|
3617
4438
|
|
|
3618
4439
|
var webkitTextStrokeWidth = {
|
|
3619
4440
|
name: "-webkit-text-stroke-width",
|
|
3620
4441
|
initialValue: '0',
|
|
3621
|
-
type: 0 /* VALUE */,
|
|
4442
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3622
4443
|
prefix: false,
|
|
3623
4444
|
parse: function (_context, token) {
|
|
3624
4445
|
if (isDimensionToken(token)) {
|
|
@@ -3628,6 +4449,31 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3628
4449
|
}
|
|
3629
4450
|
};
|
|
3630
4451
|
|
|
4452
|
+
var objectFit = {
|
|
4453
|
+
name: 'objectFit',
|
|
4454
|
+
initialValue: 'fill',
|
|
4455
|
+
prefix: false,
|
|
4456
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
4457
|
+
parse: function (_context, tokens) {
|
|
4458
|
+
return tokens.filter(isIdentToken).reduce(function (bit, token) {
|
|
4459
|
+
return bit | parseDisplayValue(token.value);
|
|
4460
|
+
}, 0 /* OBJECT_FIT.FILL */);
|
|
4461
|
+
}
|
|
4462
|
+
};
|
|
4463
|
+
var parseDisplayValue = function (display) {
|
|
4464
|
+
switch (display) {
|
|
4465
|
+
case 'contain':
|
|
4466
|
+
return 2 /* OBJECT_FIT.CONTAIN */;
|
|
4467
|
+
case 'cover':
|
|
4468
|
+
return 4 /* OBJECT_FIT.COVER */;
|
|
4469
|
+
case 'none':
|
|
4470
|
+
return 8 /* OBJECT_FIT.NONE */;
|
|
4471
|
+
case 'scale-down':
|
|
4472
|
+
return 16 /* OBJECT_FIT.SCALE_DOWN */;
|
|
4473
|
+
}
|
|
4474
|
+
return 0 /* OBJECT_FIT.FILL */;
|
|
4475
|
+
};
|
|
4476
|
+
|
|
3631
4477
|
var CSSParsedDeclaration = /** @class */ (function () {
|
|
3632
4478
|
function CSSParsedDeclaration(context, declaration) {
|
|
3633
4479
|
var _a, _b;
|
|
@@ -3698,9 +4544,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3698
4544
|
this.webkitTextStrokeWidth = parse(context, webkitTextStrokeWidth, declaration.webkitTextStrokeWidth);
|
|
3699
4545
|
this.wordBreak = parse(context, wordBreak, declaration.wordBreak);
|
|
3700
4546
|
this.zIndex = parse(context, zIndex, declaration.zIndex);
|
|
4547
|
+
this.objectFit = parse(context, objectFit, declaration.objectFit);
|
|
3701
4548
|
}
|
|
3702
4549
|
CSSParsedDeclaration.prototype.isVisible = function () {
|
|
3703
|
-
return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBLE */;
|
|
4550
|
+
return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBILITY.VISIBLE */;
|
|
3704
4551
|
};
|
|
3705
4552
|
CSSParsedDeclaration.prototype.isTransparent = function () {
|
|
3706
4553
|
return isTransparent(this.backgroundColor);
|
|
@@ -3709,21 +4556,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3709
4556
|
return this.transform !== null;
|
|
3710
4557
|
};
|
|
3711
4558
|
CSSParsedDeclaration.prototype.isPositioned = function () {
|
|
3712
|
-
return this.position !== 0 /* STATIC */;
|
|
4559
|
+
return this.position !== 0 /* POSITION.STATIC */;
|
|
3713
4560
|
};
|
|
3714
4561
|
CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () {
|
|
3715
4562
|
return this.isPositioned() && !this.zIndex.auto;
|
|
3716
4563
|
};
|
|
3717
4564
|
CSSParsedDeclaration.prototype.isFloating = function () {
|
|
3718
|
-
return this.float !== 0 /* NONE */;
|
|
4565
|
+
return this.float !== 0 /* FLOAT.NONE */;
|
|
3719
4566
|
};
|
|
3720
4567
|
CSSParsedDeclaration.prototype.isInlineLevel = function () {
|
|
3721
|
-
return (contains(this.display, 4 /* INLINE */) ||
|
|
3722
|
-
contains(this.display, 33554432 /* INLINE_BLOCK */) ||
|
|
3723
|
-
contains(this.display, 268435456 /* INLINE_FLEX */) ||
|
|
3724
|
-
contains(this.display, 536870912 /* INLINE_GRID */) ||
|
|
3725
|
-
contains(this.display, 67108864 /* INLINE_LIST_ITEM */) ||
|
|
3726
|
-
contains(this.display, 134217728 /* INLINE_TABLE */));
|
|
4568
|
+
return (contains(this.display, 4 /* DISPLAY.INLINE */) ||
|
|
4569
|
+
contains(this.display, 33554432 /* DISPLAY.INLINE_BLOCK */) ||
|
|
4570
|
+
contains(this.display, 268435456 /* DISPLAY.INLINE_FLEX */) ||
|
|
4571
|
+
contains(this.display, 536870912 /* DISPLAY.INLINE_GRID */) ||
|
|
4572
|
+
contains(this.display, 67108864 /* DISPLAY.INLINE_LIST_ITEM */) ||
|
|
4573
|
+
contains(this.display, 134217728 /* DISPLAY.INLINE_TABLE */));
|
|
3727
4574
|
};
|
|
3728
4575
|
return CSSParsedDeclaration;
|
|
3729
4576
|
}());
|
|
@@ -3748,16 +4595,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3748
4595
|
tokenizer.write(value);
|
|
3749
4596
|
var parser = new Parser(tokenizer.read());
|
|
3750
4597
|
switch (descriptor.type) {
|
|
3751
|
-
case 2 /* IDENT_VALUE */:
|
|
4598
|
+
case 2 /* PropertyDescriptorParsingType.IDENT_VALUE */:
|
|
3752
4599
|
var token = parser.parseComponentValue();
|
|
3753
4600
|
return descriptor.parse(context, isIdentToken(token) ? token.value : descriptor.initialValue);
|
|
3754
|
-
case 0 /* VALUE */:
|
|
4601
|
+
case 0 /* PropertyDescriptorParsingType.VALUE */:
|
|
3755
4602
|
return descriptor.parse(context, parser.parseComponentValue());
|
|
3756
|
-
case 1 /* LIST */:
|
|
4603
|
+
case 1 /* PropertyDescriptorParsingType.LIST */:
|
|
3757
4604
|
return descriptor.parse(context, parser.parseComponentValues());
|
|
3758
|
-
case 4 /* TOKEN_VALUE */:
|
|
4605
|
+
case 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */:
|
|
3759
4606
|
return parser.parseComponentValue();
|
|
3760
|
-
case 3 /* TYPE_VALUE */:
|
|
4607
|
+
case 3 /* PropertyDescriptorParsingType.TYPE_VALUE */:
|
|
3761
4608
|
switch (descriptor.format) {
|
|
3762
4609
|
case 'angle':
|
|
3763
4610
|
return angle.parse(context, parser.parseComponentValue());
|
|
@@ -3783,20 +4630,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3783
4630
|
var attribute = element.getAttribute(elementDebuggerAttribute);
|
|
3784
4631
|
switch (attribute) {
|
|
3785
4632
|
case 'all':
|
|
3786
|
-
return 1 /* ALL */;
|
|
4633
|
+
return 1 /* DebuggerType.ALL */;
|
|
3787
4634
|
case 'clone':
|
|
3788
|
-
return 2 /* CLONE */;
|
|
4635
|
+
return 2 /* DebuggerType.CLONE */;
|
|
3789
4636
|
case 'parse':
|
|
3790
|
-
return 3 /* PARSE */;
|
|
4637
|
+
return 3 /* DebuggerType.PARSE */;
|
|
3791
4638
|
case 'render':
|
|
3792
|
-
return 4 /* RENDER */;
|
|
4639
|
+
return 4 /* DebuggerType.RENDER */;
|
|
3793
4640
|
default:
|
|
3794
|
-
return 0 /* NONE */;
|
|
4641
|
+
return 0 /* DebuggerType.NONE */;
|
|
3795
4642
|
}
|
|
3796
4643
|
};
|
|
3797
4644
|
var isDebugging = function (element, type) {
|
|
3798
4645
|
var elementType = getElementDebugType(element);
|
|
3799
|
-
return elementType === 1 /* ALL */ || type === elementType;
|
|
4646
|
+
return elementType === 1 /* DebuggerType.ALL */ || type === elementType;
|
|
3800
4647
|
};
|
|
3801
4648
|
|
|
3802
4649
|
var ElementContainer = /** @class */ (function () {
|
|
@@ -3805,7 +4652,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3805
4652
|
this.textNodes = [];
|
|
3806
4653
|
this.elements = [];
|
|
3807
4654
|
this.flags = 0;
|
|
3808
|
-
if (isDebugging(element, 3 /* PARSE */)) {
|
|
4655
|
+
if (isDebugging(element, 3 /* DebuggerType.PARSE */)) {
|
|
3809
4656
|
debugger;
|
|
3810
4657
|
}
|
|
3811
4658
|
this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null));
|
|
@@ -3819,8 +4666,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3819
4666
|
}
|
|
3820
4667
|
}
|
|
3821
4668
|
this.bounds = parseBounds(this.context, element);
|
|
3822
|
-
if (isDebugging(element, 4 /* RENDER */)) {
|
|
3823
|
-
this.flags |= 16 /* DEBUG_RENDER */;
|
|
4669
|
+
if (isDebugging(element, 4 /* DebuggerType.RENDER */)) {
|
|
4670
|
+
this.flags |= 16 /* FLAGS.DEBUG_RENDER */;
|
|
3824
4671
|
}
|
|
3825
4672
|
}
|
|
3826
4673
|
return ElementContainer;
|
|
@@ -4214,7 +5061,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4214
5061
|
var range = document.createRange();
|
|
4215
5062
|
if (range.getBoundingClientRect) {
|
|
4216
5063
|
var testElement = document.createElement('boundtest');
|
|
4217
|
-
testElement.style.height = TEST_HEIGHT
|
|
5064
|
+
testElement.style.height = "".concat(TEST_HEIGHT, "px");
|
|
4218
5065
|
testElement.style.display = 'block';
|
|
4219
5066
|
document.body.appendChild(testElement);
|
|
4220
5067
|
range.selectNode(testElement);
|
|
@@ -4304,8 +5151,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4304
5151
|
ctx.fillStyle = 'red';
|
|
4305
5152
|
ctx.fillRect(0, 0, size, size);
|
|
4306
5153
|
var node = document.createElement('div');
|
|
4307
|
-
node.style.backgroundImage = "url("
|
|
4308
|
-
node.style.height = size
|
|
5154
|
+
node.style.backgroundImage = "url(".concat(greenImageSrc, ")");
|
|
5155
|
+
node.style.height = "".concat(size, "px");
|
|
4309
5156
|
// Firefox 55 does not render inline <img /> tags
|
|
4310
5157
|
return isGreenPixel(data)
|
|
4311
5158
|
? loadSerializedSVG$1(createForeignObjectSVG(size, size, 0, 0, node))
|
|
@@ -4338,7 +5185,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4338
5185
|
var img = new Image();
|
|
4339
5186
|
img.onload = function () { return resolve(img); };
|
|
4340
5187
|
img.onerror = reject;
|
|
4341
|
-
img.src = "data:image/svg+xml;charset=utf-8,"
|
|
5188
|
+
img.src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svg)));
|
|
4342
5189
|
});
|
|
4343
5190
|
};
|
|
4344
5191
|
var FEATURES = {
|
|
@@ -4482,7 +5329,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4482
5329
|
var breakWords = function (str, styles) {
|
|
4483
5330
|
var breaker = LineBreaker(str, {
|
|
4484
5331
|
lineBreak: styles.lineBreak,
|
|
4485
|
-
wordBreak: styles.overflowWrap === "break-word" /* BREAK_WORD */ ? 'break-word' : styles.wordBreak
|
|
5332
|
+
wordBreak: styles.overflowWrap === "break-word" /* OVERFLOW_WRAP.BREAK_WORD */ ? 'break-word' : styles.wordBreak
|
|
4486
5333
|
});
|
|
4487
5334
|
var words = [];
|
|
4488
5335
|
var bk;
|
|
@@ -4523,11 +5370,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4523
5370
|
}());
|
|
4524
5371
|
var transform = function (text, transform) {
|
|
4525
5372
|
switch (transform) {
|
|
4526
|
-
case 1 /* LOWERCASE */:
|
|
5373
|
+
case 1 /* TEXT_TRANSFORM.LOWERCASE */:
|
|
4527
5374
|
return text.toLowerCase();
|
|
4528
|
-
case 3 /* CAPITALIZE */:
|
|
5375
|
+
case 3 /* TEXT_TRANSFORM.CAPITALIZE */:
|
|
4529
5376
|
return text.replace(CAPITALIZE, capitalize);
|
|
4530
|
-
case 2 /* UPPERCASE */:
|
|
5377
|
+
case 2 /* TEXT_TRANSFORM.UPPERCASE */:
|
|
4531
5378
|
return text.toUpperCase();
|
|
4532
5379
|
default:
|
|
4533
5380
|
return text;
|
|
@@ -4572,9 +5419,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4572
5419
|
var _this = _super.call(this, context, img) || this;
|
|
4573
5420
|
var s = new XMLSerializer();
|
|
4574
5421
|
var bounds = parseBounds(context, img);
|
|
4575
|
-
img.setAttribute('width', bounds.width
|
|
4576
|
-
img.setAttribute('height', bounds.height
|
|
4577
|
-
_this.svg = "data:image/svg+xml,"
|
|
5422
|
+
img.setAttribute('width', "".concat(bounds.width, "px"));
|
|
5423
|
+
img.setAttribute('height', "".concat(bounds.height, "px"));
|
|
5424
|
+
_this.svg = "data:image/svg+xml,".concat(encodeURIComponent(s.serializeToString(img)));
|
|
4578
5425
|
_this.intrinsicWidth = img.width.baseVal.value;
|
|
4579
5426
|
_this.intrinsicHeight = img.height.baseVal.value;
|
|
4580
5427
|
_this.context.cache.addImage(_this.svg);
|
|
@@ -4606,7 +5453,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4606
5453
|
|
|
4607
5454
|
var CHECKBOX_BORDER_RADIUS = [
|
|
4608
5455
|
{
|
|
4609
|
-
type: 15 /* DIMENSION_TOKEN */,
|
|
5456
|
+
type: 15 /* TokenType.DIMENSION_TOKEN */,
|
|
4610
5457
|
flags: 0,
|
|
4611
5458
|
unit: 'px',
|
|
4612
5459
|
number: 3
|
|
@@ -4614,7 +5461,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4614
5461
|
];
|
|
4615
5462
|
var RADIO_BORDER_RADIUS = [
|
|
4616
5463
|
{
|
|
4617
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
5464
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
4618
5465
|
flags: 0,
|
|
4619
5466
|
number: 50
|
|
4620
5467
|
}
|
|
@@ -4659,9 +5506,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4659
5506
|
_this.styles.borderRightStyle =
|
|
4660
5507
|
_this.styles.borderBottomStyle =
|
|
4661
5508
|
_this.styles.borderLeftStyle =
|
|
4662
|
-
1 /* SOLID */;
|
|
4663
|
-
_this.styles.backgroundClip = [0 /* BORDER_BOX */];
|
|
4664
|
-
_this.styles.backgroundOrigin = [0 /* BORDER_BOX */];
|
|
5509
|
+
1 /* BORDER_STYLE.SOLID */;
|
|
5510
|
+
_this.styles.backgroundClip = [0 /* BACKGROUND_CLIP.BORDER_BOX */];
|
|
5511
|
+
_this.styles.backgroundOrigin = [0 /* BACKGROUND_ORIGIN.BORDER_BOX */];
|
|
4665
5512
|
_this.bounds = reformatInputBounds(_this.bounds);
|
|
4666
5513
|
}
|
|
4667
5514
|
switch (_this.type) {
|
|
@@ -4743,7 +5590,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4743
5590
|
var parseNodeTree = function (context, node, parent, root) {
|
|
4744
5591
|
for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) {
|
|
4745
5592
|
nextNode = childNode.nextSibling;
|
|
4746
|
-
|
|
5593
|
+
// Fixes #2238 #1624 - Fix the issue of TextNode content being overlooked in rendering due to being perceived as blank by trim().
|
|
5594
|
+
if (isTextNode(childNode) && childNode.data.length > 0) {
|
|
4747
5595
|
parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
|
|
4748
5596
|
}
|
|
4749
5597
|
else if (isElementNode(childNode)) {
|
|
@@ -4754,13 +5602,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4754
5602
|
var container = createContainer(context, childNode);
|
|
4755
5603
|
if (container.styles.isVisible()) {
|
|
4756
5604
|
if (createsRealStackingContext(childNode, container, root)) {
|
|
4757
|
-
container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
|
|
5605
|
+
container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
|
|
4758
5606
|
}
|
|
4759
5607
|
else if (createsStackingContext(container.styles)) {
|
|
4760
|
-
container.flags |= 2 /* CREATES_STACKING_CONTEXT */;
|
|
5608
|
+
container.flags |= 2 /* FLAGS.CREATES_STACKING_CONTEXT */;
|
|
4761
5609
|
}
|
|
4762
5610
|
if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) {
|
|
4763
|
-
container.flags |= 8 /* IS_LIST_OWNER */;
|
|
5611
|
+
container.flags |= 8 /* FLAGS.IS_LIST_OWNER */;
|
|
4764
5612
|
}
|
|
4765
5613
|
parent.elements.push(container);
|
|
4766
5614
|
if (childNode.shadowRoot) {
|
|
@@ -4808,7 +5656,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4808
5656
|
};
|
|
4809
5657
|
var parseTree = function (context, element) {
|
|
4810
5658
|
var container = createContainer(context, element);
|
|
4811
|
-
container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
|
|
5659
|
+
container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
|
|
4812
5660
|
parseNodeTree(context, element, container, container);
|
|
4813
5661
|
return container;
|
|
4814
5662
|
};
|
|
@@ -5076,7 +5924,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5076
5924
|
var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
|
|
5077
5925
|
var createCJKCounter = function (value, numbers, multipliers, negativeSign, suffix, flags) {
|
|
5078
5926
|
if (value < -9999 || value > 9999) {
|
|
5079
|
-
return createCounterText(value, 4 /* CJK_DECIMAL */, suffix.length > 0);
|
|
5927
|
+
return createCounterText(value, 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */, suffix.length > 0);
|
|
5080
5928
|
}
|
|
5081
5929
|
var tmp = Math.abs(value);
|
|
5082
5930
|
var string = suffix;
|
|
@@ -5112,101 +5960,101 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5112
5960
|
var koreanSuffix = appendSuffix ? ', ' : '';
|
|
5113
5961
|
var spaceSuffix = appendSuffix ? ' ' : '';
|
|
5114
5962
|
switch (type) {
|
|
5115
|
-
case 0 /* DISC */:
|
|
5963
|
+
case 0 /* LIST_STYLE_TYPE.DISC */:
|
|
5116
5964
|
return '•' + spaceSuffix;
|
|
5117
|
-
case 1 /* CIRCLE */:
|
|
5965
|
+
case 1 /* LIST_STYLE_TYPE.CIRCLE */:
|
|
5118
5966
|
return '◦' + spaceSuffix;
|
|
5119
|
-
case 2 /* SQUARE */:
|
|
5967
|
+
case 2 /* LIST_STYLE_TYPE.SQUARE */:
|
|
5120
5968
|
return '◾' + spaceSuffix;
|
|
5121
|
-
case 5 /* DECIMAL_LEADING_ZERO */:
|
|
5969
|
+
case 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */:
|
|
5122
5970
|
var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
|
5123
|
-
return string.length < 4 ? "0"
|
|
5124
|
-
case 4 /* CJK_DECIMAL */:
|
|
5971
|
+
return string.length < 4 ? "0".concat(string) : string;
|
|
5972
|
+
case 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */:
|
|
5125
5973
|
return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix);
|
|
5126
|
-
case 6 /* LOWER_ROMAN */:
|
|
5127
|
-
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
|
|
5128
|
-
case 7 /* UPPER_ROMAN */:
|
|
5129
|
-
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix);
|
|
5130
|
-
case 8 /* LOWER_GREEK */:
|
|
5974
|
+
case 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */:
|
|
5975
|
+
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix).toLowerCase();
|
|
5976
|
+
case 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */:
|
|
5977
|
+
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
5978
|
+
case 8 /* LIST_STYLE_TYPE.LOWER_GREEK */:
|
|
5131
5979
|
return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
|
|
5132
|
-
case 9 /* LOWER_ALPHA */:
|
|
5980
|
+
case 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */:
|
|
5133
5981
|
return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
|
|
5134
|
-
case 10 /* UPPER_ALPHA */:
|
|
5982
|
+
case 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */:
|
|
5135
5983
|
return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
|
|
5136
|
-
case 11 /* ARABIC_INDIC */:
|
|
5984
|
+
case 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */:
|
|
5137
5985
|
return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
|
|
5138
|
-
case 12 /* ARMENIAN */:
|
|
5139
|
-
case 49 /* UPPER_ARMENIAN */:
|
|
5140
|
-
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix);
|
|
5141
|
-
case 35 /* LOWER_ARMENIAN */:
|
|
5142
|
-
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
|
|
5143
|
-
case 13 /* BENGALI */:
|
|
5986
|
+
case 12 /* LIST_STYLE_TYPE.ARMENIAN */:
|
|
5987
|
+
case 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */:
|
|
5988
|
+
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
5989
|
+
case 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */:
|
|
5990
|
+
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix).toLowerCase();
|
|
5991
|
+
case 13 /* LIST_STYLE_TYPE.BENGALI */:
|
|
5144
5992
|
return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
|
|
5145
|
-
case 14 /* CAMBODIAN */:
|
|
5146
|
-
case 30 /* KHMER */:
|
|
5993
|
+
case 14 /* LIST_STYLE_TYPE.CAMBODIAN */:
|
|
5994
|
+
case 30 /* LIST_STYLE_TYPE.KHMER */:
|
|
5147
5995
|
return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
|
|
5148
|
-
case 15 /* CJK_EARTHLY_BRANCH */:
|
|
5996
|
+
case 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */:
|
|
5149
5997
|
return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix);
|
|
5150
|
-
case 16 /* CJK_HEAVENLY_STEM */:
|
|
5998
|
+
case 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */:
|
|
5151
5999
|
return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix);
|
|
5152
|
-
case 17 /* CJK_IDEOGRAPHIC */:
|
|
5153
|
-
case 48 /* TRAD_CHINESE_INFORMAL */:
|
|
6000
|
+
case 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */:
|
|
6001
|
+
case 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */:
|
|
5154
6002
|
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5155
|
-
case 47 /* TRAD_CHINESE_FORMAL */:
|
|
6003
|
+
case 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */:
|
|
5156
6004
|
return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5157
|
-
case 42 /* SIMP_CHINESE_INFORMAL */:
|
|
6005
|
+
case 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */:
|
|
5158
6006
|
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5159
|
-
case 41 /* SIMP_CHINESE_FORMAL */:
|
|
6007
|
+
case 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */:
|
|
5160
6008
|
return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5161
|
-
case 26 /* JAPANESE_INFORMAL */:
|
|
6009
|
+
case 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */:
|
|
5162
6010
|
return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0);
|
|
5163
|
-
case 25 /* JAPANESE_FORMAL */:
|
|
6011
|
+
case 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */:
|
|
5164
6012
|
return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5165
|
-
case 31 /* KOREAN_HANGUL_FORMAL */:
|
|
6013
|
+
case 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */:
|
|
5166
6014
|
return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5167
|
-
case 33 /* KOREAN_HANJA_INFORMAL */:
|
|
6015
|
+
case 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */:
|
|
5168
6016
|
return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0);
|
|
5169
|
-
case 32 /* KOREAN_HANJA_FORMAL */:
|
|
6017
|
+
case 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */:
|
|
5170
6018
|
return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5171
|
-
case 18 /* DEVANAGARI */:
|
|
6019
|
+
case 18 /* LIST_STYLE_TYPE.DEVANAGARI */:
|
|
5172
6020
|
return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix);
|
|
5173
|
-
case 20 /* GEORGIAN */:
|
|
5174
|
-
return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* DECIMAL */, defaultSuffix);
|
|
5175
|
-
case 21 /* GUJARATI */:
|
|
6021
|
+
case 20 /* LIST_STYLE_TYPE.GEORGIAN */:
|
|
6022
|
+
return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6023
|
+
case 21 /* LIST_STYLE_TYPE.GUJARATI */:
|
|
5176
6024
|
return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix);
|
|
5177
|
-
case 22 /* GURMUKHI */:
|
|
6025
|
+
case 22 /* LIST_STYLE_TYPE.GURMUKHI */:
|
|
5178
6026
|
return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix);
|
|
5179
|
-
case 22 /* HEBREW */:
|
|
5180
|
-
return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* DECIMAL */, defaultSuffix);
|
|
5181
|
-
case 23 /* HIRAGANA */:
|
|
6027
|
+
case 22 /* LIST_STYLE_TYPE.HEBREW */:
|
|
6028
|
+
return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6029
|
+
case 23 /* LIST_STYLE_TYPE.HIRAGANA */:
|
|
5182
6030
|
return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん');
|
|
5183
|
-
case 24 /* HIRAGANA_IROHA */:
|
|
6031
|
+
case 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */:
|
|
5184
6032
|
return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす');
|
|
5185
|
-
case 27 /* KANNADA */:
|
|
6033
|
+
case 27 /* LIST_STYLE_TYPE.KANNADA */:
|
|
5186
6034
|
return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
|
|
5187
|
-
case 28 /* KATAKANA */:
|
|
6035
|
+
case 28 /* LIST_STYLE_TYPE.KATAKANA */:
|
|
5188
6036
|
return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix);
|
|
5189
|
-
case 29 /* KATAKANA_IROHA */:
|
|
6037
|
+
case 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */:
|
|
5190
6038
|
return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix);
|
|
5191
|
-
case 34 /* LAO */:
|
|
6039
|
+
case 34 /* LIST_STYLE_TYPE.LAO */:
|
|
5192
6040
|
return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix);
|
|
5193
|
-
case 37 /* MONGOLIAN */:
|
|
6041
|
+
case 37 /* LIST_STYLE_TYPE.MONGOLIAN */:
|
|
5194
6042
|
return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix);
|
|
5195
|
-
case 38 /* MYANMAR */:
|
|
6043
|
+
case 38 /* LIST_STYLE_TYPE.MYANMAR */:
|
|
5196
6044
|
return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix);
|
|
5197
|
-
case 39 /* ORIYA */:
|
|
6045
|
+
case 39 /* LIST_STYLE_TYPE.ORIYA */:
|
|
5198
6046
|
return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix);
|
|
5199
|
-
case 40 /* PERSIAN */:
|
|
6047
|
+
case 40 /* LIST_STYLE_TYPE.PERSIAN */:
|
|
5200
6048
|
return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix);
|
|
5201
|
-
case 43 /* TAMIL */:
|
|
6049
|
+
case 43 /* LIST_STYLE_TYPE.TAMIL */:
|
|
5202
6050
|
return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix);
|
|
5203
|
-
case 44 /* TELUGU */:
|
|
6051
|
+
case 44 /* LIST_STYLE_TYPE.TELUGU */:
|
|
5204
6052
|
return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix);
|
|
5205
|
-
case 45 /* THAI */:
|
|
6053
|
+
case 45 /* LIST_STYLE_TYPE.THAI */:
|
|
5206
6054
|
return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix);
|
|
5207
|
-
case 46 /* TIBETAN */:
|
|
6055
|
+
case 46 /* LIST_STYLE_TYPE.TIBETAN */:
|
|
5208
6056
|
return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix);
|
|
5209
|
-
case 3 /* DECIMAL */:
|
|
6057
|
+
case 3 /* LIST_STYLE_TYPE.DECIMAL */:
|
|
5210
6058
|
default:
|
|
5211
6059
|
return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
|
5212
6060
|
}
|
|
@@ -5256,7 +6104,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5256
6104
|
onclone = this.options.onclone;
|
|
5257
6105
|
referenceElement = this.clonedReferenceElement;
|
|
5258
6106
|
if (typeof referenceElement === 'undefined') {
|
|
5259
|
-
return [2 /*return*/, Promise.reject("Error finding the "
|
|
6107
|
+
return [2 /*return*/, Promise.reject("Error finding the ".concat(this.referenceElement.nodeName, " in the cloned document"))];
|
|
5260
6108
|
}
|
|
5261
6109
|
if (!(documentClone.fonts && documentClone.fonts.ready)) return [3 /*break*/, 2];
|
|
5262
6110
|
return [4 /*yield*/, documentClone.fonts.ready];
|
|
@@ -5279,16 +6127,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5279
6127
|
}
|
|
5280
6128
|
});
|
|
5281
6129
|
}); });
|
|
6130
|
+
var adoptedNode = documentClone.adoptNode(this.documentElement);
|
|
6131
|
+
/**
|
|
6132
|
+
* The baseURI of the document will be lost after documentClone.open().
|
|
6133
|
+
* We can avoid it by adding <base> element.
|
|
6134
|
+
* */
|
|
6135
|
+
addBase(adoptedNode, documentClone);
|
|
5282
6136
|
documentClone.open();
|
|
5283
|
-
documentClone.write(serializeDoctype(document.doctype)
|
|
6137
|
+
documentClone.write("".concat(serializeDoctype(document.doctype), "<html></html>"));
|
|
5284
6138
|
// Chrome scrolls the parent document for some reason after the write to the cloned window???
|
|
5285
6139
|
restoreOwnerScroll(this.referenceElement.ownerDocument, scrollX, scrollY);
|
|
5286
|
-
documentClone.replaceChild(
|
|
6140
|
+
documentClone.replaceChild(adoptedNode, documentClone.documentElement);
|
|
5287
6141
|
documentClone.close();
|
|
5288
6142
|
return iframeLoad;
|
|
5289
6143
|
};
|
|
5290
6144
|
DocumentCloner.prototype.createElementClone = function (node) {
|
|
5291
|
-
if (isDebugging(node, 2 /* CLONE */)) {
|
|
6145
|
+
if (isDebugging(node, 2 /* DebuggerType.CLONE */)) {
|
|
5292
6146
|
debugger;
|
|
5293
6147
|
}
|
|
5294
6148
|
if (isCanvasElement(node)) {
|
|
@@ -5361,7 +6215,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5361
6215
|
clonedCanvas.width = canvas.width;
|
|
5362
6216
|
clonedCanvas.height = canvas.height;
|
|
5363
6217
|
var ctx = canvas.getContext('2d');
|
|
5364
|
-
var clonedCtx = clonedCanvas.getContext('2d');
|
|
6218
|
+
var clonedCtx = clonedCanvas.getContext('2d', { willReadFrequently: true });
|
|
5365
6219
|
if (clonedCtx) {
|
|
5366
6220
|
if (!this.options.allowTaint && ctx) {
|
|
5367
6221
|
clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
|
|
@@ -5496,16 +6350,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5496
6350
|
var anonymousReplacedElement = document.createElement('html2canvaspseudoelement');
|
|
5497
6351
|
copyCSSStyles(style, anonymousReplacedElement);
|
|
5498
6352
|
declaration.content.forEach(function (token) {
|
|
5499
|
-
if (token.type === 0 /* STRING_TOKEN */) {
|
|
6353
|
+
if (token.type === 0 /* TokenType.STRING_TOKEN */) {
|
|
5500
6354
|
anonymousReplacedElement.appendChild(document.createTextNode(token.value));
|
|
5501
6355
|
}
|
|
5502
|
-
else if (token.type === 22 /* URL_TOKEN */) {
|
|
6356
|
+
else if (token.type === 22 /* TokenType.URL_TOKEN */) {
|
|
5503
6357
|
var img = document.createElement('img');
|
|
5504
6358
|
img.src = token.value;
|
|
5505
6359
|
img.style.opacity = '1';
|
|
5506
6360
|
anonymousReplacedElement.appendChild(img);
|
|
5507
6361
|
}
|
|
5508
|
-
else if (token.type === 18 /* FUNCTION */) {
|
|
6362
|
+
else if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
5509
6363
|
if (token.name === 'attr') {
|
|
5510
6364
|
var attr = token.values.filter(isIdentToken);
|
|
5511
6365
|
if (attr.length) {
|
|
@@ -5518,7 +6372,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5518
6372
|
var counterState = _this.counters.getCounterValue(counter.value);
|
|
5519
6373
|
var counterType = counterStyle && isIdentToken(counterStyle)
|
|
5520
6374
|
? listStyleType.parse(_this.context, counterStyle.value)
|
|
5521
|
-
: 3 /* DECIMAL */;
|
|
6375
|
+
: 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
5522
6376
|
anonymousReplacedElement.appendChild(document.createTextNode(createCounterText(counterState, counterType, false)));
|
|
5523
6377
|
}
|
|
5524
6378
|
}
|
|
@@ -5528,8 +6382,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5528
6382
|
var counterStates = _this.counters.getCounterValues(counter.value);
|
|
5529
6383
|
var counterType_1 = counterStyle && isIdentToken(counterStyle)
|
|
5530
6384
|
? listStyleType.parse(_this.context, counterStyle.value)
|
|
5531
|
-
: 3 /* DECIMAL */;
|
|
5532
|
-
var separator = delim && delim.type === 0 /* STRING_TOKEN */ ? delim.value : '';
|
|
6385
|
+
: 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
6386
|
+
var separator = delim && delim.type === 0 /* TokenType.STRING_TOKEN */ ? delim.value : '';
|
|
5533
6387
|
var text = counterStates
|
|
5534
6388
|
.map(function (value) { return createCounterText(value, counterType_1, false); })
|
|
5535
6389
|
.join(separator);
|
|
@@ -5538,7 +6392,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5538
6392
|
}
|
|
5539
6393
|
else ;
|
|
5540
6394
|
}
|
|
5541
|
-
else if (token.type === 20 /* IDENT_TOKEN */) {
|
|
6395
|
+
else if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
5542
6396
|
switch (token.value) {
|
|
5543
6397
|
case 'open-quote':
|
|
5544
6398
|
anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, _this.quoteDepth++, true)));
|
|
@@ -5552,10 +6406,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5552
6406
|
}
|
|
5553
6407
|
}
|
|
5554
6408
|
});
|
|
5555
|
-
anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE
|
|
6409
|
+
anonymousReplacedElement.className = "".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE, " ").concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER);
|
|
5556
6410
|
var newClassName = pseudoElt === PseudoElementType.BEFORE
|
|
5557
|
-
? " "
|
|
5558
|
-
: " "
|
|
6411
|
+
? " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE)
|
|
6412
|
+
: " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER);
|
|
5559
6413
|
if (isSVGElementNode(clone)) {
|
|
5560
6414
|
clone.className.baseValue += newClassName;
|
|
5561
6415
|
}
|
|
@@ -5654,10 +6508,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5654
6508
|
str += doctype.internalSubset;
|
|
5655
6509
|
}
|
|
5656
6510
|
if (doctype.publicId) {
|
|
5657
|
-
str += "\""
|
|
6511
|
+
str += "\"".concat(doctype.publicId, "\"");
|
|
5658
6512
|
}
|
|
5659
6513
|
if (doctype.systemId) {
|
|
5660
|
-
str += "\""
|
|
6514
|
+
str += "\"".concat(doctype.systemId, "\"");
|
|
5661
6515
|
}
|
|
5662
6516
|
str += '>';
|
|
5663
6517
|
}
|
|
@@ -5681,7 +6535,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5681
6535
|
var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after';
|
|
5682
6536
|
var PSEUDO_HIDE_ELEMENT_STYLE = "{\n content: \"\" !important;\n display: none !important;\n}";
|
|
5683
6537
|
var createPseudoHideStyles = function (body) {
|
|
5684
|
-
createStyles(body, "."
|
|
6538
|
+
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));
|
|
5685
6539
|
};
|
|
5686
6540
|
var createStyles = function (body, styles) {
|
|
5687
6541
|
var document = body.ownerDocument;
|
|
@@ -5691,6 +6545,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5691
6545
|
body.appendChild(style);
|
|
5692
6546
|
}
|
|
5693
6547
|
};
|
|
6548
|
+
var addBase = function (targetELement, referenceDocument) {
|
|
6549
|
+
var _a;
|
|
6550
|
+
var baseNode = referenceDocument.createElement('base');
|
|
6551
|
+
baseNode.href = referenceDocument.baseURI;
|
|
6552
|
+
var headEle = targetELement.getElementsByTagName('head').item(0);
|
|
6553
|
+
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);
|
|
6554
|
+
};
|
|
5694
6555
|
|
|
5695
6556
|
var CacheStorage = /** @class */ (function () {
|
|
5696
6557
|
function CacheStorage() {
|
|
@@ -5768,7 +6629,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5768
6629
|
src = _a.sent();
|
|
5769
6630
|
_a.label = 2;
|
|
5770
6631
|
case 2:
|
|
5771
|
-
this.context.logger.debug("Added image "
|
|
6632
|
+
this.context.logger.debug("Added image ".concat(key.substring(0, 256)));
|
|
5772
6633
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
5773
6634
|
var img = new Image();
|
|
5774
6635
|
img.onload = function () { return resolve(img); };
|
|
@@ -5783,7 +6644,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5783
6644
|
setTimeout(function () { return resolve(img); }, 500);
|
|
5784
6645
|
}
|
|
5785
6646
|
if (_this._options.imageTimeout > 0) {
|
|
5786
|
-
setTimeout(function () { return reject("Timed out ("
|
|
6647
|
+
setTimeout(function () { return reject("Timed out (".concat(_this._options.imageTimeout, "ms) loading image")); }, _this._options.imageTimeout);
|
|
5787
6648
|
}
|
|
5788
6649
|
})];
|
|
5789
6650
|
case 3: return [2 /*return*/, _a.sent()];
|
|
@@ -5820,19 +6681,19 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5820
6681
|
}
|
|
5821
6682
|
}
|
|
5822
6683
|
else {
|
|
5823
|
-
reject("Failed to proxy resource "
|
|
6684
|
+
reject("Failed to proxy resource ".concat(key, " with status code ").concat(xhr.status));
|
|
5824
6685
|
}
|
|
5825
6686
|
};
|
|
5826
6687
|
xhr.onerror = reject;
|
|
5827
6688
|
var queryString = proxy.indexOf('?') > -1 ? '&' : '?';
|
|
5828
|
-
xhr.open('GET', ""
|
|
6689
|
+
xhr.open('GET', "".concat(proxy).concat(queryString, "url=").concat(encodeURIComponent(src), "&responseType=").concat(responseType));
|
|
5829
6690
|
if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
|
|
5830
6691
|
xhr.responseType = responseType;
|
|
5831
6692
|
}
|
|
5832
6693
|
if (_this._options.imageTimeout) {
|
|
5833
6694
|
var timeout_1 = _this._options.imageTimeout;
|
|
5834
6695
|
xhr.timeout = timeout_1;
|
|
5835
|
-
xhr.ontimeout = function () { return reject("Timed out ("
|
|
6696
|
+
xhr.ontimeout = function () { return reject("Timed out (".concat(timeout_1, "ms) proxying ").concat(key)); };
|
|
5836
6697
|
}
|
|
5837
6698
|
xhr.send();
|
|
5838
6699
|
});
|
|
@@ -5850,7 +6711,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5850
6711
|
|
|
5851
6712
|
var Vector = /** @class */ (function () {
|
|
5852
6713
|
function Vector(x, y) {
|
|
5853
|
-
this.type = 0 /* VECTOR */;
|
|
6714
|
+
this.type = 0 /* PathType.VECTOR */;
|
|
5854
6715
|
this.x = x;
|
|
5855
6716
|
this.y = y;
|
|
5856
6717
|
}
|
|
@@ -5865,7 +6726,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5865
6726
|
};
|
|
5866
6727
|
var BezierCurve = /** @class */ (function () {
|
|
5867
6728
|
function BezierCurve(start, startControl, endControl, end) {
|
|
5868
|
-
this.type = 1 /* BEZIER_CURVE */;
|
|
6729
|
+
this.type = 1 /* PathType.BEZIER_CURVE */;
|
|
5869
6730
|
this.start = start;
|
|
5870
6731
|
this.startControl = startControl;
|
|
5871
6732
|
this.endControl = endControl;
|
|
@@ -5888,7 +6749,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5888
6749
|
};
|
|
5889
6750
|
return BezierCurve;
|
|
5890
6751
|
}());
|
|
5891
|
-
var isBezierCurve = function (path) { return path.type === 1 /* BEZIER_CURVE */; };
|
|
6752
|
+
var isBezierCurve = function (path) { return path.type === 1 /* PathType.BEZIER_CURVE */; };
|
|
5892
6753
|
|
|
5893
6754
|
var BoundCurves = /** @class */ (function () {
|
|
5894
6755
|
function BoundCurves(element) {
|
|
@@ -6075,8 +6936,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6075
6936
|
this.offsetX = offsetX;
|
|
6076
6937
|
this.offsetY = offsetY;
|
|
6077
6938
|
this.matrix = matrix;
|
|
6078
|
-
this.type = 0 /* TRANSFORM */;
|
|
6079
|
-
this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
|
|
6939
|
+
this.type = 0 /* EffectType.TRANSFORM */;
|
|
6940
|
+
this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
|
|
6080
6941
|
}
|
|
6081
6942
|
return TransformEffect;
|
|
6082
6943
|
}());
|
|
@@ -6084,23 +6945,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6084
6945
|
function ClipEffect(path, target) {
|
|
6085
6946
|
this.path = path;
|
|
6086
6947
|
this.target = target;
|
|
6087
|
-
this.type = 1 /* CLIP */;
|
|
6948
|
+
this.type = 1 /* EffectType.CLIP */;
|
|
6088
6949
|
}
|
|
6089
6950
|
return ClipEffect;
|
|
6090
6951
|
}());
|
|
6091
6952
|
var OpacityEffect = /** @class */ (function () {
|
|
6092
6953
|
function OpacityEffect(opacity) {
|
|
6093
6954
|
this.opacity = opacity;
|
|
6094
|
-
this.type = 2 /* OPACITY */;
|
|
6095
|
-
this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
|
|
6955
|
+
this.type = 2 /* EffectType.OPACITY */;
|
|
6956
|
+
this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
|
|
6096
6957
|
}
|
|
6097
6958
|
return OpacityEffect;
|
|
6098
6959
|
}());
|
|
6099
6960
|
var isTransformEffect = function (effect) {
|
|
6100
|
-
return effect.type === 0 /* TRANSFORM */;
|
|
6961
|
+
return effect.type === 0 /* EffectType.TRANSFORM */;
|
|
6101
6962
|
};
|
|
6102
|
-
var isClipEffect = function (effect) { return effect.type === 1 /* CLIP */; };
|
|
6103
|
-
var isOpacityEffect = function (effect) { return effect.type === 2 /* OPACITY */; };
|
|
6963
|
+
var isClipEffect = function (effect) { return effect.type === 1 /* EffectType.CLIP */; };
|
|
6964
|
+
var isOpacityEffect = function (effect) { return effect.type === 2 /* EffectType.OPACITY */; };
|
|
6104
6965
|
|
|
6105
6966
|
var equalPath = function (a, b) {
|
|
6106
6967
|
if (a.length === b.length) {
|
|
@@ -6152,34 +7013,34 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6152
7013
|
var matrix = this.container.styles.transform;
|
|
6153
7014
|
this.effects.push(new TransformEffect(offsetX, offsetY, matrix));
|
|
6154
7015
|
}
|
|
6155
|
-
if (this.container.styles.overflowX !== 0 /* VISIBLE */) {
|
|
7016
|
+
if (this.container.styles.overflowX !== 0 /* OVERFLOW.VISIBLE */) {
|
|
6156
7017
|
var borderBox = calculateBorderBoxPath(this.curves);
|
|
6157
7018
|
var paddingBox = calculatePaddingBoxPath(this.curves);
|
|
6158
7019
|
if (equalPath(borderBox, paddingBox)) {
|
|
6159
|
-
this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
|
|
7020
|
+
this.effects.push(new ClipEffect(borderBox, 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */));
|
|
6160
7021
|
}
|
|
6161
7022
|
else {
|
|
6162
|
-
this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */));
|
|
6163
|
-
this.effects.push(new ClipEffect(paddingBox, 4 /* CONTENT */));
|
|
7023
|
+
this.effects.push(new ClipEffect(borderBox, 2 /* EffectTarget.BACKGROUND_BORDERS */));
|
|
7024
|
+
this.effects.push(new ClipEffect(paddingBox, 4 /* EffectTarget.CONTENT */));
|
|
6164
7025
|
}
|
|
6165
7026
|
}
|
|
6166
7027
|
}
|
|
6167
7028
|
ElementPaint.prototype.getEffects = function (target) {
|
|
6168
|
-
var inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(this.container.styles.position) === -1;
|
|
7029
|
+
var inFlow = [2 /* POSITION.ABSOLUTE */, 3 /* POSITION.FIXED */].indexOf(this.container.styles.position) === -1;
|
|
6169
7030
|
var parent = this.parent;
|
|
6170
7031
|
var effects = this.effects.slice(0);
|
|
6171
7032
|
while (parent) {
|
|
6172
7033
|
var croplessEffects = parent.effects.filter(function (effect) { return !isClipEffect(effect); });
|
|
6173
|
-
if (inFlow || parent.container.styles.position !== 0 /* STATIC */ || !parent.parent) {
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
if (parent.container.styles.overflowX !== 0 /* VISIBLE */) {
|
|
7034
|
+
if (inFlow || parent.container.styles.position !== 0 /* POSITION.STATIC */ || !parent.parent) {
|
|
7035
|
+
inFlow = [2 /* POSITION.ABSOLUTE */, 3 /* POSITION.FIXED */].indexOf(parent.container.styles.position) === -1;
|
|
7036
|
+
if (parent.container.styles.overflowX !== 0 /* OVERFLOW.VISIBLE */) {
|
|
6177
7037
|
var borderBox = calculateBorderBoxPath(parent.curves);
|
|
6178
7038
|
var paddingBox = calculatePaddingBoxPath(parent.curves);
|
|
6179
7039
|
if (!equalPath(borderBox, paddingBox)) {
|
|
6180
|
-
effects.unshift(new ClipEffect(paddingBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
|
|
7040
|
+
effects.unshift(new ClipEffect(paddingBox, 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */));
|
|
6181
7041
|
}
|
|
6182
7042
|
}
|
|
7043
|
+
effects.unshift.apply(effects, croplessEffects);
|
|
6183
7044
|
}
|
|
6184
7045
|
else {
|
|
6185
7046
|
effects.unshift.apply(effects, croplessEffects);
|
|
@@ -6192,13 +7053,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6192
7053
|
}());
|
|
6193
7054
|
var parseStackTree = function (parent, stackingContext, realStackingContext, listItems) {
|
|
6194
7055
|
parent.container.elements.forEach(function (child) {
|
|
6195
|
-
var treatAsRealStackingContext = contains(child.flags, 4 /* CREATES_REAL_STACKING_CONTEXT */);
|
|
6196
|
-
var createsStackingContext = contains(child.flags, 2 /* CREATES_STACKING_CONTEXT */);
|
|
7056
|
+
var treatAsRealStackingContext = contains(child.flags, 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */);
|
|
7057
|
+
var createsStackingContext = contains(child.flags, 2 /* FLAGS.CREATES_STACKING_CONTEXT */);
|
|
6197
7058
|
var paintContainer = new ElementPaint(child, parent);
|
|
6198
|
-
if (contains(child.styles.display, 2048 /* LIST_ITEM */)) {
|
|
7059
|
+
if (contains(child.styles.display, 2048 /* DISPLAY.LIST_ITEM */)) {
|
|
6199
7060
|
listItems.push(paintContainer);
|
|
6200
7061
|
}
|
|
6201
|
-
var listOwnerItems = contains(child.flags, 8 /* IS_LIST_OWNER */) ? [] : listItems;
|
|
7062
|
+
var listOwnerItems = contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */) ? [] : listItems;
|
|
6202
7063
|
if (treatAsRealStackingContext || createsStackingContext) {
|
|
6203
7064
|
var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext;
|
|
6204
7065
|
var stack = new StackingContext(paintContainer);
|
|
@@ -6255,7 +7116,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6255
7116
|
}
|
|
6256
7117
|
parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems);
|
|
6257
7118
|
}
|
|
6258
|
-
if (contains(child.flags, 8 /* IS_LIST_OWNER */)) {
|
|
7119
|
+
if (contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */)) {
|
|
6259
7120
|
processListItems(child, listOwnerItems);
|
|
6260
7121
|
}
|
|
6261
7122
|
});
|
|
@@ -6396,19 +7257,19 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6396
7257
|
};
|
|
6397
7258
|
|
|
6398
7259
|
var calculateBackgroundPositioningArea = function (backgroundOrigin, element) {
|
|
6399
|
-
if (backgroundOrigin === 0 /* BORDER_BOX */) {
|
|
7260
|
+
if (backgroundOrigin === 0 /* BACKGROUND_ORIGIN.BORDER_BOX */) {
|
|
6400
7261
|
return element.bounds;
|
|
6401
7262
|
}
|
|
6402
|
-
if (backgroundOrigin === 2 /* CONTENT_BOX */) {
|
|
7263
|
+
if (backgroundOrigin === 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */) {
|
|
6403
7264
|
return contentBox(element);
|
|
6404
7265
|
}
|
|
6405
7266
|
return paddingBox(element);
|
|
6406
7267
|
};
|
|
6407
7268
|
var calculateBackgroundPaintingArea = function (backgroundClip, element) {
|
|
6408
|
-
if (backgroundClip === 0 /* BORDER_BOX */) {
|
|
7269
|
+
if (backgroundClip === 0 /* BACKGROUND_CLIP.BORDER_BOX */) {
|
|
6409
7270
|
return element.bounds;
|
|
6410
7271
|
}
|
|
6411
|
-
if (backgroundClip === 2 /* CONTENT_BOX */) {
|
|
7272
|
+
if (backgroundClip === 2 /* BACKGROUND_CLIP.CONTENT_BOX */) {
|
|
6412
7273
|
return contentBox(element);
|
|
6413
7274
|
}
|
|
6414
7275
|
return paddingBox(element);
|
|
@@ -6422,6 +7283,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6422
7283
|
var path = calculateBackgroundRepeatPath(getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea);
|
|
6423
7284
|
var offsetX = Math.round(backgroundPositioningArea.left + position[0]);
|
|
6424
7285
|
var offsetY = Math.round(backgroundPositioningArea.top + position[1]);
|
|
7286
|
+
sizeWidth = Math.max(1, sizeWidth);
|
|
7287
|
+
sizeHeight = Math.max(1, sizeHeight);
|
|
6425
7288
|
return [path, offsetX, offsetY, sizeWidth, sizeHeight];
|
|
6426
7289
|
};
|
|
6427
7290
|
var isAuto = function (token) { return isIdentToken(token) && token.value === BACKGROUND_SIZE.AUTO; };
|
|
@@ -6536,21 +7399,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6536
7399
|
var x = _a[0], y = _a[1];
|
|
6537
7400
|
var width = _b[0], height = _b[1];
|
|
6538
7401
|
switch (repeat) {
|
|
6539
|
-
case 2 /* REPEAT_X */:
|
|
7402
|
+
case 2 /* BACKGROUND_REPEAT.REPEAT_X */:
|
|
6540
7403
|
return [
|
|
6541
7404
|
new Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)),
|
|
6542
7405
|
new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)),
|
|
6543
7406
|
new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)),
|
|
6544
7407
|
new Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y))
|
|
6545
7408
|
];
|
|
6546
|
-
case 3 /* REPEAT_Y */:
|
|
7409
|
+
case 3 /* BACKGROUND_REPEAT.REPEAT_Y */:
|
|
6547
7410
|
return [
|
|
6548
7411
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)),
|
|
6549
7412
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)),
|
|
6550
7413
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)),
|
|
6551
7414
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top))
|
|
6552
7415
|
];
|
|
6553
|
-
case 1 /* NO_REPEAT */:
|
|
7416
|
+
case 1 /* BACKGROUND_REPEAT.NO_REPEAT */:
|
|
6554
7417
|
return [
|
|
6555
7418
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)),
|
|
6556
7419
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)),
|
|
@@ -6610,7 +7473,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6610
7473
|
return { baseline: baseline, middle: middle };
|
|
6611
7474
|
};
|
|
6612
7475
|
FontMetrics.prototype.getMetrics = function (fontFamily, fontSize) {
|
|
6613
|
-
var key = fontFamily
|
|
7476
|
+
var key = "".concat(fontFamily, " ").concat(fontSize);
|
|
6614
7477
|
if (typeof this._data[key] === 'undefined') {
|
|
6615
7478
|
this._data[key] = this.parseMetrics(fontFamily, fontSize);
|
|
6616
7479
|
}
|
|
@@ -6638,15 +7501,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6638
7501
|
if (!options.canvas) {
|
|
6639
7502
|
_this.canvas.width = Math.floor(options.width * options.scale);
|
|
6640
7503
|
_this.canvas.height = Math.floor(options.height * options.scale);
|
|
6641
|
-
_this.canvas.style.width = options.width
|
|
6642
|
-
_this.canvas.style.height = options.height
|
|
7504
|
+
_this.canvas.style.width = "".concat(options.width, "px");
|
|
7505
|
+
_this.canvas.style.height = "".concat(options.height, "px");
|
|
6643
7506
|
}
|
|
6644
7507
|
_this.fontMetrics = new FontMetrics(document);
|
|
6645
7508
|
_this.ctx.scale(_this.options.scale, _this.options.scale);
|
|
6646
7509
|
_this.ctx.translate(-options.x, -options.y);
|
|
6647
7510
|
_this.ctx.textBaseline = 'bottom';
|
|
6648
7511
|
_this._activeEffects = [];
|
|
6649
|
-
_this.context.logger.debug("Canvas renderer initialized ("
|
|
7512
|
+
_this.context.logger.debug("Canvas renderer initialized (".concat(options.width, "x").concat(options.height, ") with scale ").concat(options.scale));
|
|
6650
7513
|
return _this;
|
|
6651
7514
|
}
|
|
6652
7515
|
CanvasRenderer.prototype.applyEffects = function (effects) {
|
|
@@ -6698,7 +7561,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6698
7561
|
return __generator(this, function (_a) {
|
|
6699
7562
|
switch (_a.label) {
|
|
6700
7563
|
case 0:
|
|
6701
|
-
if (contains(paint.container.flags, 16 /* DEBUG_RENDER */)) {
|
|
7564
|
+
if (contains(paint.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
|
|
6702
7565
|
debugger;
|
|
6703
7566
|
}
|
|
6704
7567
|
if (!paint.container.styles.isVisible()) return [3 /*break*/, 3];
|
|
@@ -6717,7 +7580,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6717
7580
|
CanvasRenderer.prototype.renderTextWithLetterSpacing = function (text, letterSpacing, baseline) {
|
|
6718
7581
|
var _this = this;
|
|
6719
7582
|
if (letterSpacing === 0) {
|
|
6720
|
-
|
|
7583
|
+
// Fixed an issue with characters moving up in non-Firefox.
|
|
7584
|
+
// https://github.com/niklasvh/html2canvas/issues/2107#issuecomment-692462900
|
|
7585
|
+
if (navigator.userAgent.indexOf('Firefox') === -1) {
|
|
7586
|
+
this.ctx.textBaseline = 'ideographic';
|
|
7587
|
+
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
|
7588
|
+
}
|
|
7589
|
+
else {
|
|
7590
|
+
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + baseline);
|
|
7591
|
+
}
|
|
6721
7592
|
}
|
|
6722
7593
|
else {
|
|
6723
7594
|
var letters = segmentGraphemes(text.text);
|
|
@@ -6733,8 +7604,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6733
7604
|
.join('');
|
|
6734
7605
|
var fontFamily = fixIOSSystemFonts(styles.fontFamily).join(', ');
|
|
6735
7606
|
var fontSize = isDimensionToken(styles.fontSize)
|
|
6736
|
-
? ""
|
|
6737
|
-
: styles.fontSize.number
|
|
7607
|
+
? "".concat(styles.fontSize.number).concat(styles.fontSize.unit)
|
|
7608
|
+
: "".concat(styles.fontSize.number, "px");
|
|
6738
7609
|
return [
|
|
6739
7610
|
[styles.fontStyle, fontVariant, styles.fontWeight, fontSize, fontFamily].join(' '),
|
|
6740
7611
|
fontFamily,
|
|
@@ -6743,22 +7614,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6743
7614
|
};
|
|
6744
7615
|
CanvasRenderer.prototype.renderTextNode = function (text, styles) {
|
|
6745
7616
|
return __awaiter(this, void 0, void 0, function () {
|
|
6746
|
-
var
|
|
7617
|
+
var font, paintOrder;
|
|
6747
7618
|
var _this = this;
|
|
6748
|
-
return __generator(this, function (
|
|
6749
|
-
|
|
7619
|
+
return __generator(this, function (_a) {
|
|
7620
|
+
font = this.createFontStyle(styles)[0];
|
|
6750
7621
|
this.ctx.font = font;
|
|
6751
|
-
this.ctx.direction = styles.direction === 1 /* RTL */ ? 'rtl' : 'ltr';
|
|
7622
|
+
this.ctx.direction = styles.direction === 1 /* DIRECTION.RTL */ ? 'rtl' : 'ltr';
|
|
6752
7623
|
this.ctx.textAlign = 'left';
|
|
6753
7624
|
this.ctx.textBaseline = 'alphabetic';
|
|
6754
|
-
_b = this.fontMetrics.getMetrics(fontFamily, fontSize), baseline = _b.baseline, middle = _b.middle;
|
|
6755
7625
|
paintOrder = styles.paintOrder;
|
|
6756
7626
|
text.textBounds.forEach(function (text) {
|
|
6757
7627
|
paintOrder.forEach(function (paintOrderLayer) {
|
|
6758
7628
|
switch (paintOrderLayer) {
|
|
6759
|
-
case 0 /* FILL */:
|
|
7629
|
+
case 0 /* PAINT_ORDER_LAYER.FILL */:
|
|
6760
7630
|
_this.ctx.fillStyle = asString(styles.color);
|
|
6761
|
-
_this.renderTextWithLetterSpacing(text, styles.letterSpacing,
|
|
7631
|
+
_this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
|
|
6762
7632
|
var textShadows = styles.textShadow;
|
|
6763
7633
|
if (textShadows.length && text.text.trim().length) {
|
|
6764
7634
|
textShadows
|
|
@@ -6769,7 +7639,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6769
7639
|
_this.ctx.shadowOffsetX = textShadow.offsetX.number * _this.options.scale;
|
|
6770
7640
|
_this.ctx.shadowOffsetY = textShadow.offsetY.number * _this.options.scale;
|
|
6771
7641
|
_this.ctx.shadowBlur = textShadow.blur.number;
|
|
6772
|
-
_this.renderTextWithLetterSpacing(text, styles.letterSpacing,
|
|
7642
|
+
_this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
|
|
6773
7643
|
});
|
|
6774
7644
|
_this.ctx.shadowColor = '';
|
|
6775
7645
|
_this.ctx.shadowOffsetX = 0;
|
|
@@ -6778,32 +7648,30 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6778
7648
|
}
|
|
6779
7649
|
if (styles.textDecorationLine.length) {
|
|
6780
7650
|
_this.ctx.fillStyle = asString(styles.textDecorationColor || styles.color);
|
|
7651
|
+
var decorationLineHeight_1 = 1;
|
|
6781
7652
|
styles.textDecorationLine.forEach(function (textDecorationLine) {
|
|
7653
|
+
// 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.
|
|
6782
7654
|
switch (textDecorationLine) {
|
|
6783
|
-
case 1 /* UNDERLINE */:
|
|
6784
|
-
|
|
6785
|
-
// TODO As some browsers display the line as more than 1px if the font-size is big,
|
|
6786
|
-
// need to take that into account both in position and size
|
|
6787
|
-
_this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1);
|
|
7655
|
+
case 1 /* TEXT_DECORATION_LINE.UNDERLINE */:
|
|
7656
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top + text.bounds.height - decorationLineHeight_1, text.bounds.width, decorationLineHeight_1);
|
|
6788
7657
|
break;
|
|
6789
|
-
case 2 /* OVERLINE */:
|
|
6790
|
-
_this.ctx.fillRect(text.bounds.left,
|
|
7658
|
+
case 2 /* TEXT_DECORATION_LINE.OVERLINE */:
|
|
7659
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top, text.bounds.width, decorationLineHeight_1);
|
|
6791
7660
|
break;
|
|
6792
|
-
case 3 /* LINE_THROUGH */:
|
|
6793
|
-
|
|
6794
|
-
_this.ctx.fillRect(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1);
|
|
7661
|
+
case 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */:
|
|
7662
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top + (text.bounds.height / 2 - decorationLineHeight_1 / 2), text.bounds.width, decorationLineHeight_1);
|
|
6795
7663
|
break;
|
|
6796
7664
|
}
|
|
6797
7665
|
});
|
|
6798
7666
|
}
|
|
6799
7667
|
break;
|
|
6800
|
-
case 1 /* STROKE */:
|
|
7668
|
+
case 1 /* PAINT_ORDER_LAYER.STROKE */:
|
|
6801
7669
|
if (styles.webkitTextStrokeWidth && text.text.trim().length) {
|
|
6802
7670
|
_this.ctx.strokeStyle = asString(styles.webkitTextStrokeColor);
|
|
6803
7671
|
_this.ctx.lineWidth = styles.webkitTextStrokeWidth;
|
|
6804
7672
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6805
7673
|
_this.ctx.lineJoin = !!window.chrome ? 'miter' : 'round';
|
|
6806
|
-
_this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top +
|
|
7674
|
+
_this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
|
6807
7675
|
}
|
|
6808
7676
|
_this.ctx.strokeStyle = '';
|
|
6809
7677
|
_this.ctx.lineWidth = 0;
|
|
@@ -6817,13 +7685,89 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6817
7685
|
});
|
|
6818
7686
|
};
|
|
6819
7687
|
CanvasRenderer.prototype.renderReplacedElement = function (container, curves, image) {
|
|
6820
|
-
|
|
7688
|
+
var intrinsicWidth = image.naturalWidth || container.intrinsicWidth;
|
|
7689
|
+
var intrinsicHeight = image.naturalHeight || container.intrinsicHeight;
|
|
7690
|
+
if (image && intrinsicWidth > 0 && intrinsicHeight > 0) {
|
|
6821
7691
|
var box = contentBox(container);
|
|
6822
7692
|
var path = calculatePaddingBoxPath(curves);
|
|
6823
7693
|
this.path(path);
|
|
6824
7694
|
this.ctx.save();
|
|
6825
7695
|
this.ctx.clip();
|
|
6826
|
-
|
|
7696
|
+
var sx = 0, sy = 0, sw = intrinsicWidth, sh = intrinsicHeight, dx = box.left, dy = box.top, dw = box.width, dh = box.height;
|
|
7697
|
+
var objectFit = container.styles.objectFit;
|
|
7698
|
+
var boxRatio = dw / dh;
|
|
7699
|
+
var imgRatio = sw / sh;
|
|
7700
|
+
if (objectFit === 2 /* OBJECT_FIT.CONTAIN */) {
|
|
7701
|
+
if (imgRatio > boxRatio) {
|
|
7702
|
+
dh = dw / imgRatio;
|
|
7703
|
+
dy += (box.height - dh) / 2;
|
|
7704
|
+
}
|
|
7705
|
+
else {
|
|
7706
|
+
dw = dh * imgRatio;
|
|
7707
|
+
dx += (box.width - dw) / 2;
|
|
7708
|
+
}
|
|
7709
|
+
}
|
|
7710
|
+
else if (objectFit === 4 /* OBJECT_FIT.COVER */) {
|
|
7711
|
+
if (imgRatio > boxRatio) {
|
|
7712
|
+
sw = sh * boxRatio;
|
|
7713
|
+
sx += (intrinsicWidth - sw) / 2;
|
|
7714
|
+
}
|
|
7715
|
+
else {
|
|
7716
|
+
sh = sw / boxRatio;
|
|
7717
|
+
sy += (intrinsicHeight - sh) / 2;
|
|
7718
|
+
}
|
|
7719
|
+
}
|
|
7720
|
+
else if (objectFit === 8 /* OBJECT_FIT.NONE */) {
|
|
7721
|
+
if (sw > dw) {
|
|
7722
|
+
sx += (sw - dw) / 2;
|
|
7723
|
+
sw = dw;
|
|
7724
|
+
}
|
|
7725
|
+
else {
|
|
7726
|
+
dx += (dw - sw) / 2;
|
|
7727
|
+
dw = sw;
|
|
7728
|
+
}
|
|
7729
|
+
if (sh > dh) {
|
|
7730
|
+
sy += (sh - dh) / 2;
|
|
7731
|
+
sh = dh;
|
|
7732
|
+
}
|
|
7733
|
+
else {
|
|
7734
|
+
dy += (dh - sh) / 2;
|
|
7735
|
+
dh = sh;
|
|
7736
|
+
}
|
|
7737
|
+
}
|
|
7738
|
+
else if (objectFit === 16 /* OBJECT_FIT.SCALE_DOWN */) {
|
|
7739
|
+
var containW = imgRatio > boxRatio ? dw : dh * imgRatio;
|
|
7740
|
+
var noneW = sw > dw ? sw : dw;
|
|
7741
|
+
if (containW < noneW) {
|
|
7742
|
+
if (imgRatio > boxRatio) {
|
|
7743
|
+
dh = dw / imgRatio;
|
|
7744
|
+
dy += (box.height - dh) / 2;
|
|
7745
|
+
}
|
|
7746
|
+
else {
|
|
7747
|
+
dw = dh * imgRatio;
|
|
7748
|
+
dx += (box.width - dw) / 2;
|
|
7749
|
+
}
|
|
7750
|
+
}
|
|
7751
|
+
else {
|
|
7752
|
+
if (sw > dw) {
|
|
7753
|
+
sx += (sw - dw) / 2;
|
|
7754
|
+
sw = dw;
|
|
7755
|
+
}
|
|
7756
|
+
else {
|
|
7757
|
+
dx += (dw - sw) / 2;
|
|
7758
|
+
dw = sw;
|
|
7759
|
+
}
|
|
7760
|
+
if (sh > dh) {
|
|
7761
|
+
sy += (sh - dh) / 2;
|
|
7762
|
+
sh = dh;
|
|
7763
|
+
}
|
|
7764
|
+
else {
|
|
7765
|
+
dy += (dh - sh) / 2;
|
|
7766
|
+
dh = sh;
|
|
7767
|
+
}
|
|
7768
|
+
}
|
|
7769
|
+
}
|
|
7770
|
+
this.ctx.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh);
|
|
6827
7771
|
this.ctx.restore();
|
|
6828
7772
|
}
|
|
6829
7773
|
};
|
|
@@ -6833,7 +7777,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6833
7777
|
return __generator(this, function (_c) {
|
|
6834
7778
|
switch (_c.label) {
|
|
6835
7779
|
case 0:
|
|
6836
|
-
this.applyEffects(paint.getEffects(4 /* CONTENT */));
|
|
7780
|
+
this.applyEffects(paint.getEffects(4 /* EffectTarget.CONTENT */));
|
|
6837
7781
|
container = paint.container;
|
|
6838
7782
|
curves = paint.curves;
|
|
6839
7783
|
styles = container.styles;
|
|
@@ -6861,7 +7805,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6861
7805
|
return [3 /*break*/, 8];
|
|
6862
7806
|
case 7:
|
|
6863
7807
|
_c.sent();
|
|
6864
|
-
this.context.logger.error("Error loading image "
|
|
7808
|
+
this.context.logger.error("Error loading image ".concat(container.src));
|
|
6865
7809
|
return [3 /*break*/, 8];
|
|
6866
7810
|
case 8:
|
|
6867
7811
|
if (container instanceof CanvasElementContainer) {
|
|
@@ -6878,7 +7822,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6878
7822
|
return [3 /*break*/, 12];
|
|
6879
7823
|
case 11:
|
|
6880
7824
|
_c.sent();
|
|
6881
|
-
this.context.logger.error("Error loading svg "
|
|
7825
|
+
this.context.logger.error("Error loading svg ".concat(container.svg.substring(0, 255)));
|
|
6882
7826
|
return [3 /*break*/, 12];
|
|
6883
7827
|
case 12:
|
|
6884
7828
|
if (!(container instanceof IFrameElementContainer && container.tree)) return [3 /*break*/, 14];
|
|
@@ -6938,10 +7882,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6938
7882
|
bounds = contentBox(container);
|
|
6939
7883
|
x = 0;
|
|
6940
7884
|
switch (container.styles.textAlign) {
|
|
6941
|
-
case 1 /* CENTER */:
|
|
7885
|
+
case 1 /* TEXT_ALIGN.CENTER */:
|
|
6942
7886
|
x += bounds.width / 2;
|
|
6943
7887
|
break;
|
|
6944
|
-
case 2 /* RIGHT */:
|
|
7888
|
+
case 2 /* TEXT_ALIGN.RIGHT */:
|
|
6945
7889
|
x += bounds.width;
|
|
6946
7890
|
break;
|
|
6947
7891
|
}
|
|
@@ -6959,10 +7903,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6959
7903
|
this.ctx.textBaseline = 'alphabetic';
|
|
6960
7904
|
this.ctx.textAlign = 'left';
|
|
6961
7905
|
}
|
|
6962
|
-
if (!contains(container.styles.display, 2048 /* LIST_ITEM */)) return [3 /*break*/, 20];
|
|
7906
|
+
if (!contains(container.styles.display, 2048 /* DISPLAY.LIST_ITEM */)) return [3 /*break*/, 20];
|
|
6963
7907
|
if (!(container.styles.listStyleImage !== null)) return [3 /*break*/, 19];
|
|
6964
7908
|
img = container.styles.listStyleImage;
|
|
6965
|
-
if (!(img.type === 0 /* URL */)) return [3 /*break*/, 18];
|
|
7909
|
+
if (!(img.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 18];
|
|
6966
7910
|
image = void 0;
|
|
6967
7911
|
url = img.url;
|
|
6968
7912
|
_c.label = 15;
|
|
@@ -6975,11 +7919,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6975
7919
|
return [3 /*break*/, 18];
|
|
6976
7920
|
case 17:
|
|
6977
7921
|
_c.sent();
|
|
6978
|
-
this.context.logger.error("Error loading list-style-image "
|
|
7922
|
+
this.context.logger.error("Error loading list-style-image ".concat(url));
|
|
6979
7923
|
return [3 /*break*/, 18];
|
|
6980
7924
|
case 18: return [3 /*break*/, 20];
|
|
6981
7925
|
case 19:
|
|
6982
|
-
if (paint.listValue && container.styles.listStyleType !== -1 /* NONE */) {
|
|
7926
|
+
if (paint.listValue && container.styles.listStyleType !== -1 /* LIST_STYLE_TYPE.NONE */) {
|
|
6983
7927
|
fontFamily = this.createFontStyle(styles)[0];
|
|
6984
7928
|
this.ctx.font = fontFamily;
|
|
6985
7929
|
this.ctx.fillStyle = asString(styles.color);
|
|
@@ -7002,7 +7946,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7002
7946
|
return __generator(this, function (_p) {
|
|
7003
7947
|
switch (_p.label) {
|
|
7004
7948
|
case 0:
|
|
7005
|
-
if (contains(stack.element.container.flags, 16 /* DEBUG_RENDER */)) {
|
|
7949
|
+
if (contains(stack.element.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
|
|
7006
7950
|
debugger;
|
|
7007
7951
|
}
|
|
7008
7952
|
// https://www.w3.org/TR/css-position-3/#painting-order
|
|
@@ -7150,10 +8094,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7150
8094
|
this.ctx.translate(-offsetX, -offsetY);
|
|
7151
8095
|
};
|
|
7152
8096
|
CanvasRenderer.prototype.resizeImage = function (image, width, height) {
|
|
8097
|
+
// https://github.com/niklasvh/html2canvas/pull/2911
|
|
8098
|
+
// if (image.width === width && image.height === height) {
|
|
8099
|
+
// return image;
|
|
8100
|
+
// }
|
|
7153
8101
|
var _a;
|
|
7154
|
-
if (image.width === width && image.height === height) {
|
|
7155
|
-
return image;
|
|
7156
|
-
}
|
|
7157
8102
|
var ownerDocument = (_a = this.canvas.ownerDocument) !== null && _a !== void 0 ? _a : document;
|
|
7158
8103
|
var canvas = ownerDocument.createElement('canvas');
|
|
7159
8104
|
canvas.width = Math.max(1, width);
|
|
@@ -7170,11 +8115,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7170
8115
|
case 0:
|
|
7171
8116
|
index = container.styles.backgroundImage.length - 1;
|
|
7172
8117
|
_loop_1 = function (backgroundImage) {
|
|
7173
|
-
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;
|
|
8118
|
+
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;
|
|
7174
8119
|
return __generator(this, function (_h) {
|
|
7175
8120
|
switch (_h.label) {
|
|
7176
8121
|
case 0:
|
|
7177
|
-
if (!(backgroundImage.type === 0 /* URL */)) return [3 /*break*/, 5];
|
|
8122
|
+
if (!(backgroundImage.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 5];
|
|
7178
8123
|
image = void 0;
|
|
7179
8124
|
url = backgroundImage.url;
|
|
7180
8125
|
_h.label = 1;
|
|
@@ -7186,14 +8131,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7186
8131
|
return [3 /*break*/, 4];
|
|
7187
8132
|
case 3:
|
|
7188
8133
|
_h.sent();
|
|
7189
|
-
this_1.context.logger.error("Error loading background-image "
|
|
8134
|
+
this_1.context.logger.error("Error loading background-image ".concat(url));
|
|
7190
8135
|
return [3 /*break*/, 4];
|
|
7191
8136
|
case 4:
|
|
7192
8137
|
if (image) {
|
|
8138
|
+
imageWidth = isNaN(image.width) || image.width === 0 ? 1 : image.width;
|
|
8139
|
+
imageHeight = isNaN(image.height) || image.height === 0 ? 1 : image.height;
|
|
7193
8140
|
_c = calculateBackgroundRendering(container, index, [
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
8141
|
+
imageWidth,
|
|
8142
|
+
imageHeight,
|
|
8143
|
+
imageWidth / imageHeight
|
|
7197
8144
|
]), path = _c[0], x = _c[1], y = _c[2], width = _c[3], height = _c[4];
|
|
7198
8145
|
pattern = this_1.ctx.createPattern(this_1.resizeImage(image, width, height), 'repeat');
|
|
7199
8146
|
this_1.renderRepeat(path, pattern, x, y);
|
|
@@ -7318,7 +8265,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7318
8265
|
return __generator(this, function (_a) {
|
|
7319
8266
|
switch (_a.label) {
|
|
7320
8267
|
case 0:
|
|
7321
|
-
this.applyEffects(paint.getEffects(2 /* BACKGROUND_BORDERS */));
|
|
8268
|
+
this.applyEffects(paint.getEffects(2 /* EffectTarget.BACKGROUND_BORDERS */));
|
|
7322
8269
|
styles = paint.container.styles;
|
|
7323
8270
|
hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
|
|
7324
8271
|
borders = [
|
|
@@ -7374,20 +8321,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7374
8321
|
case 3:
|
|
7375
8322
|
if (!(_i < borders_1.length)) return [3 /*break*/, 13];
|
|
7376
8323
|
border = borders_1[_i];
|
|
7377
|
-
if (!(border.style !== 0 /* NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
|
|
7378
|
-
if (!(border.style === 2 /* DASHED */)) return [3 /*break*/, 5];
|
|
7379
|
-
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* DASHED */)];
|
|
8324
|
+
if (!(border.style !== 0 /* BORDER_STYLE.NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
|
|
8325
|
+
if (!(border.style === 2 /* BORDER_STYLE.DASHED */)) return [3 /*break*/, 5];
|
|
8326
|
+
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* BORDER_STYLE.DASHED */)];
|
|
7380
8327
|
case 4:
|
|
7381
8328
|
_a.sent();
|
|
7382
8329
|
return [3 /*break*/, 11];
|
|
7383
8330
|
case 5:
|
|
7384
|
-
if (!(border.style === 3 /* DOTTED */)) return [3 /*break*/, 7];
|
|
7385
|
-
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* DOTTED */)];
|
|
8331
|
+
if (!(border.style === 3 /* BORDER_STYLE.DOTTED */)) return [3 /*break*/, 7];
|
|
8332
|
+
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* BORDER_STYLE.DOTTED */)];
|
|
7386
8333
|
case 6:
|
|
7387
8334
|
_a.sent();
|
|
7388
8335
|
return [3 /*break*/, 11];
|
|
7389
8336
|
case 7:
|
|
7390
|
-
if (!(border.style === 4 /* DOUBLE */)) return [3 /*break*/, 9];
|
|
8337
|
+
if (!(border.style === 4 /* BORDER_STYLE.DOUBLE */)) return [3 /*break*/, 9];
|
|
7391
8338
|
return [4 /*yield*/, this.renderDoubleBorder(border.color, border.width, side, paint.curves)];
|
|
7392
8339
|
case 8:
|
|
7393
8340
|
_a.sent();
|
|
@@ -7414,7 +8361,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7414
8361
|
this.ctx.save();
|
|
7415
8362
|
strokePaths = parsePathForBorderStroke(curvePoints, side);
|
|
7416
8363
|
boxPaths = parsePathForBorder(curvePoints, side);
|
|
7417
|
-
if (style === 2 /* DASHED */) {
|
|
8364
|
+
if (style === 2 /* BORDER_STYLE.DASHED */) {
|
|
7418
8365
|
this.path(boxPaths);
|
|
7419
8366
|
this.ctx.clip();
|
|
7420
8367
|
}
|
|
@@ -7441,7 +8388,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7441
8388
|
length = Math.abs(startY - endY);
|
|
7442
8389
|
}
|
|
7443
8390
|
this.ctx.beginPath();
|
|
7444
|
-
if (style === 3 /* DOTTED */) {
|
|
8391
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7445
8392
|
this.formatPath(strokePaths);
|
|
7446
8393
|
}
|
|
7447
8394
|
else {
|
|
@@ -7449,7 +8396,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7449
8396
|
}
|
|
7450
8397
|
dashLength = width < 3 ? width * 3 : width * 2;
|
|
7451
8398
|
spaceLength = width < 3 ? width * 2 : width;
|
|
7452
|
-
if (style === 3 /* DOTTED */) {
|
|
8399
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7453
8400
|
dashLength = width;
|
|
7454
8401
|
spaceLength = width;
|
|
7455
8402
|
}
|
|
@@ -7472,14 +8419,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7472
8419
|
: maxSpace;
|
|
7473
8420
|
}
|
|
7474
8421
|
if (useLineDash) {
|
|
7475
|
-
if (style === 3 /* DOTTED */) {
|
|
8422
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7476
8423
|
this.ctx.setLineDash([0, dashLength + spaceLength]);
|
|
7477
8424
|
}
|
|
7478
8425
|
else {
|
|
7479
8426
|
this.ctx.setLineDash([dashLength, spaceLength]);
|
|
7480
8427
|
}
|
|
7481
8428
|
}
|
|
7482
|
-
if (style === 3 /* DOTTED */) {
|
|
8429
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7483
8430
|
this.ctx.lineCap = 'round';
|
|
7484
8431
|
this.ctx.lineWidth = width;
|
|
7485
8432
|
}
|
|
@@ -7490,7 +8437,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7490
8437
|
this.ctx.stroke();
|
|
7491
8438
|
this.ctx.setLineDash([]);
|
|
7492
8439
|
// dashed round edge gap
|
|
7493
|
-
if (style === 2 /* DASHED */) {
|
|
8440
|
+
if (style === 2 /* BORDER_STYLE.DASHED */) {
|
|
7494
8441
|
if (isBezierCurve(boxPaths[0])) {
|
|
7495
8442
|
path1 = boxPaths[3];
|
|
7496
8443
|
path2 = boxPaths[0];
|
|
@@ -7547,22 +8494,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7547
8494
|
};
|
|
7548
8495
|
var calculateBackgroundCurvedPaintingArea = function (clip, curves) {
|
|
7549
8496
|
switch (clip) {
|
|
7550
|
-
case 0 /* BORDER_BOX */:
|
|
8497
|
+
case 0 /* BACKGROUND_CLIP.BORDER_BOX */:
|
|
7551
8498
|
return calculateBorderBoxPath(curves);
|
|
7552
|
-
case 2 /* CONTENT_BOX */:
|
|
8499
|
+
case 2 /* BACKGROUND_CLIP.CONTENT_BOX */:
|
|
7553
8500
|
return calculateContentBoxPath(curves);
|
|
7554
|
-
case 1 /* PADDING_BOX */:
|
|
8501
|
+
case 1 /* BACKGROUND_CLIP.PADDING_BOX */:
|
|
7555
8502
|
default:
|
|
7556
8503
|
return calculatePaddingBoxPath(curves);
|
|
7557
8504
|
}
|
|
7558
8505
|
};
|
|
7559
8506
|
var canvasTextAlign = function (textAlign) {
|
|
7560
8507
|
switch (textAlign) {
|
|
7561
|
-
case 1 /* CENTER */:
|
|
8508
|
+
case 1 /* TEXT_ALIGN.CENTER */:
|
|
7562
8509
|
return 'center';
|
|
7563
|
-
case 2 /* RIGHT */:
|
|
8510
|
+
case 2 /* TEXT_ALIGN.RIGHT */:
|
|
7564
8511
|
return 'right';
|
|
7565
|
-
case 0 /* LEFT */:
|
|
8512
|
+
case 0 /* TEXT_ALIGN.LEFT */:
|
|
7566
8513
|
default:
|
|
7567
8514
|
return 'left';
|
|
7568
8515
|
}
|
|
@@ -7584,11 +8531,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7584
8531
|
_this.options = options;
|
|
7585
8532
|
_this.canvas.width = Math.floor(options.width * options.scale);
|
|
7586
8533
|
_this.canvas.height = Math.floor(options.height * options.scale);
|
|
7587
|
-
_this.canvas.style.width = options.width
|
|
7588
|
-
_this.canvas.style.height = options.height
|
|
8534
|
+
_this.canvas.style.width = "".concat(options.width, "px");
|
|
8535
|
+
_this.canvas.style.height = "".concat(options.height, "px");
|
|
7589
8536
|
_this.ctx.scale(_this.options.scale, _this.options.scale);
|
|
7590
8537
|
_this.ctx.translate(-options.x, -options.y);
|
|
7591
|
-
_this.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("
|
|
8538
|
+
_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));
|
|
7592
8539
|
return _this;
|
|
7593
8540
|
}
|
|
7594
8541
|
ForeignObjectRenderer.prototype.render = function (element) {
|
|
@@ -7620,7 +8567,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7620
8567
|
resolve(img);
|
|
7621
8568
|
};
|
|
7622
8569
|
img.onerror = reject;
|
|
7623
|
-
img.src = "data:image/svg+xml;charset=utf-8,"
|
|
8570
|
+
img.src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svg)));
|
|
7624
8571
|
});
|
|
7625
8572
|
};
|
|
7626
8573
|
|
|
@@ -7641,7 +8588,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7641
8588
|
// eslint-disable-next-line no-console
|
|
7642
8589
|
if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
|
|
7643
8590
|
// eslint-disable-next-line no-console
|
|
7644
|
-
console.debug.apply(console, __spreadArray([this.id, this.getTime()
|
|
8591
|
+
console.debug.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7645
8592
|
}
|
|
7646
8593
|
else {
|
|
7647
8594
|
this.info.apply(this, args);
|
|
@@ -7661,7 +8608,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7661
8608
|
// eslint-disable-next-line no-console
|
|
7662
8609
|
if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
|
|
7663
8610
|
// eslint-disable-next-line no-console
|
|
7664
|
-
console.info.apply(console, __spreadArray([this.id, this.getTime()
|
|
8611
|
+
console.info.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7665
8612
|
}
|
|
7666
8613
|
}
|
|
7667
8614
|
};
|
|
@@ -7675,7 +8622,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7675
8622
|
// eslint-disable-next-line no-console
|
|
7676
8623
|
if (typeof window !== 'undefined' && window.console && typeof console.warn === 'function') {
|
|
7677
8624
|
// eslint-disable-next-line no-console
|
|
7678
|
-
console.warn.apply(console, __spreadArray([this.id, this.getTime()
|
|
8625
|
+
console.warn.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7679
8626
|
}
|
|
7680
8627
|
else {
|
|
7681
8628
|
this.info.apply(this, args);
|
|
@@ -7692,7 +8639,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7692
8639
|
// eslint-disable-next-line no-console
|
|
7693
8640
|
if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
|
|
7694
8641
|
// eslint-disable-next-line no-console
|
|
7695
|
-
console.error.apply(console, __spreadArray([this.id, this.getTime()
|
|
8642
|
+
console.error.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7696
8643
|
}
|
|
7697
8644
|
else {
|
|
7698
8645
|
this.info.apply(this, args);
|
|
@@ -7707,7 +8654,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7707
8654
|
function Context(options, windowBounds) {
|
|
7708
8655
|
var _a;
|
|
7709
8656
|
this.windowBounds = windowBounds;
|
|
7710
|
-
this.instanceName = "#"
|
|
8657
|
+
this.instanceName = "#".concat(Context.instanceCount++);
|
|
7711
8658
|
this.logger = new Logger({ id: this.instanceName, enabled: options.logging });
|
|
7712
8659
|
this.cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new Cache(this, options);
|
|
7713
8660
|
}
|
|
@@ -7762,7 +8709,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7762
8709
|
inlineImages: foreignObjectRendering,
|
|
7763
8710
|
copyStyles: foreignObjectRendering
|
|
7764
8711
|
};
|
|
7765
|
-
context.logger.debug("Starting document clone with size "
|
|
8712
|
+
context.logger.debug("Starting document clone with size ".concat(windowBounds.width, "x").concat(windowBounds.height, " scrolled to ").concat(-windowBounds.left, ",").concat(-windowBounds.top));
|
|
7766
8713
|
documentCloner = new DocumentCloner(context, element, cloneOptions);
|
|
7767
8714
|
clonedElement = documentCloner.clonedReferenceElement;
|
|
7768
8715
|
if (!clonedElement) {
|
|
@@ -7792,13 +8739,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7792
8739
|
canvas = _u.sent();
|
|
7793
8740
|
return [3 /*break*/, 5];
|
|
7794
8741
|
case 3:
|
|
7795
|
-
context.logger.debug("Document cloned, element located at "
|
|
8742
|
+
context.logger.debug("Document cloned, element located at ".concat(left, ",").concat(top, " with size ").concat(width, "x").concat(height, " using computed rendering"));
|
|
7796
8743
|
context.logger.debug("Starting DOM parsing");
|
|
7797
8744
|
root = parseTree(context, clonedElement);
|
|
7798
8745
|
if (backgroundColor === root.styles.backgroundColor) {
|
|
7799
8746
|
root.styles.backgroundColor = COLORS.TRANSPARENT;
|
|
7800
8747
|
}
|
|
7801
|
-
context.logger.debug("Starting renderer for element at "
|
|
8748
|
+
context.logger.debug("Starting renderer for element at ".concat(renderOptions.x, ",").concat(renderOptions.y, " with size ").concat(renderOptions.width, "x").concat(renderOptions.height));
|
|
7802
8749
|
renderer = new CanvasRenderer(context, renderOptions);
|
|
7803
8750
|
return [4 /*yield*/, renderer.render(root)];
|
|
7804
8751
|
case 4:
|
|
@@ -7840,8 +8787,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7840
8787
|
|
|
7841
8788
|
return html2canvas;
|
|
7842
8789
|
|
|
7843
|
-
}))
|
|
7844
|
-
//# sourceMappingURL=html2canvas.js.map
|
|
8790
|
+
}));
|
|
8791
|
+
//# sourceMappingURL=html2canvas-pro.js.map
|
|
7845
8792
|
});
|
|
7846
8793
|
|
|
7847
8794
|
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)}}";
|
|
@@ -8126,7 +9073,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
8126
9073
|
captureScreenshot() {
|
|
8127
9074
|
return new Promise((resolve, reject) => {
|
|
8128
9075
|
requestAnimationFrame(() => {
|
|
8129
|
-
|
|
9076
|
+
html2canvasPro(document.body, {
|
|
8130
9077
|
x: window.scrollX,
|
|
8131
9078
|
y: window.scrollY,
|
|
8132
9079
|
width: window.innerWidth,
|