pushfeedback 0.1.53 → 0.1.55
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 +1670 -676
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pushfeedback.cjs.js +1 -1
- package/dist/collection/components/feedback-button/feedback-button.js +84 -2
- package/dist/collection/components/feedback-modal/feedback-modal.css +2 -1
- package/dist/collection/components/feedback-modal/feedback-modal.js +21 -2
- package/dist/components/feedback-button.js +51 -3
- package/dist/components/feedback-modal2.js +1623 -674
- package/dist/esm/feedback-button_2.entry.js +1670 -676
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pushfeedback.js +1 -1
- package/dist/pushfeedback/p-366db9ef.entry.js +22 -0
- package/dist/pushfeedback/pushfeedback.esm.js +1 -1
- package/dist/types/components/feedback-button/feedback-button.d.ts +3 -0
- package/dist/types/components/feedback-modal/feedback-modal.d.ts +1 -0
- package/dist/types/components.d.ts +6 -0
- package/package.json +2 -2
- package/dist/pushfeedback/p-1239b879.entry.js +0 -22
|
@@ -28,6 +28,7 @@ const FeedbackButton = class {
|
|
|
28
28
|
this.ratingMode = 'thumbs';
|
|
29
29
|
this.ratingPlaceholder = 'Was this page helpful?';
|
|
30
30
|
this.ratingStarsPlaceholder = 'How would you rate this page?';
|
|
31
|
+
this.footerText = '';
|
|
31
32
|
this.buttonStyle = 'default';
|
|
32
33
|
this.buttonPosition = 'default';
|
|
33
34
|
this.hideIcon = false;
|
|
@@ -35,6 +36,7 @@ const FeedbackButton = class {
|
|
|
35
36
|
this.hidePrivacyPolicy = true;
|
|
36
37
|
this.privacyPolicyText = "I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.";
|
|
37
38
|
this.fetchData = true;
|
|
39
|
+
this.submit = false;
|
|
38
40
|
}
|
|
39
41
|
componentWillLoad() {
|
|
40
42
|
if (!this.sessionId) {
|
|
@@ -84,10 +86,11 @@ const FeedbackButton = class {
|
|
|
84
86
|
'ratingMode',
|
|
85
87
|
'ratingPlaceholder',
|
|
86
88
|
'ratingStarsPlaceholder',
|
|
89
|
+
'footerText',
|
|
87
90
|
'hideScreenshotButton',
|
|
88
91
|
'hidePrivacyPolicy',
|
|
89
92
|
'privacyPolicyText',
|
|
90
|
-
'fetchData'
|
|
93
|
+
'fetchData',
|
|
91
94
|
];
|
|
92
95
|
props.forEach(prop => {
|
|
93
96
|
this.feedbackModal[prop] = this[prop];
|
|
@@ -111,7 +114,50 @@ const FeedbackButton = class {
|
|
|
111
114
|
document.head.appendChild(link);
|
|
112
115
|
}
|
|
113
116
|
showModal() {
|
|
114
|
-
this.
|
|
117
|
+
if (this.submit) {
|
|
118
|
+
this.submitRatingFeedback();
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.feedbackModal.openModal();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async submitRatingFeedback() {
|
|
125
|
+
try {
|
|
126
|
+
const body = {
|
|
127
|
+
url: window.location.href,
|
|
128
|
+
project: this.project,
|
|
129
|
+
rating: this.rating || 0,
|
|
130
|
+
ratingMode: this.ratingMode,
|
|
131
|
+
message: "",
|
|
132
|
+
session: localStorage.getItem('pushfeedback_sessionid') || '',
|
|
133
|
+
};
|
|
134
|
+
const res = await fetch('https://app.pushfeedback.com/api/feedback/', {
|
|
135
|
+
method: 'POST',
|
|
136
|
+
body: JSON.stringify(body),
|
|
137
|
+
headers: {
|
|
138
|
+
'Content-Type': 'application/json'
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
if (res.status === 201) {
|
|
142
|
+
const feedback_with_id = Object.assign(Object.assign({}, body), { id: await res.json() });
|
|
143
|
+
this.feedbackModal.feedbackSent.emit({ feedback: feedback_with_id });
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const errorText = await res.text();
|
|
147
|
+
const response = {
|
|
148
|
+
status: res.status,
|
|
149
|
+
message: errorText,
|
|
150
|
+
};
|
|
151
|
+
this.feedbackModal.feedbackError.emit({ error: response });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
const response = {
|
|
156
|
+
status: 500,
|
|
157
|
+
message: error,
|
|
158
|
+
};
|
|
159
|
+
this.feedbackModal.feedbackError.emit({ error: response });
|
|
160
|
+
}
|
|
115
161
|
}
|
|
116
162
|
render() {
|
|
117
163
|
return (h(Host, null, h("a", { class: `feedback-button-content feedback-button-content--${this.buttonStyle} feedback-button-content--${this.buttonPosition} ${this.customFont ? 'feedback-button-content--custom-font' : ''}`, onClick: () => this.showModal() }, !this.hideIcon && this.buttonStyle != 'default' && (h("span", { class: "feedback-button-content-icon" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "#fff", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "icon-edit" }, h("path", { d: "M12 20h9" }), h("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })))), h("slot", null))));
|
|
@@ -136,15 +182,15 @@ function commonjsRequire () {
|
|
|
136
182
|
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
137
183
|
}
|
|
138
184
|
|
|
139
|
-
var
|
|
185
|
+
var html2canvasPro = createCommonjsModule(function (module, exports) {
|
|
140
186
|
/*!
|
|
141
|
-
* html2canvas 1.
|
|
142
|
-
* Copyright (c)
|
|
187
|
+
* html2canvas-pro 1.5.8 <https://yorickshan.github.io/html2canvas-pro/>
|
|
188
|
+
* Copyright (c) 2024 yorickshan <https://github.com/yorickshan>
|
|
143
189
|
* Released under MIT License
|
|
144
190
|
*/
|
|
145
191
|
(function (global, factory) {
|
|
146
192
|
module.exports = factory() ;
|
|
147
|
-
}(commonjsGlobal, (function () {
|
|
193
|
+
})(commonjsGlobal, (function () {
|
|
148
194
|
/*! *****************************************************************************
|
|
149
195
|
Copyright (c) Microsoft Corporation.
|
|
150
196
|
|
|
@@ -1128,38 +1174,38 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1128
1174
|
return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
|
|
1129
1175
|
};
|
|
1130
1176
|
var LEFT_PARENTHESIS_TOKEN = {
|
|
1131
|
-
type: 2 /* LEFT_PARENTHESIS_TOKEN */
|
|
1177
|
+
type: 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */
|
|
1132
1178
|
};
|
|
1133
1179
|
var RIGHT_PARENTHESIS_TOKEN = {
|
|
1134
|
-
type: 3 /* RIGHT_PARENTHESIS_TOKEN */
|
|
1135
|
-
};
|
|
1136
|
-
var COMMA_TOKEN = { type: 4 /* COMMA_TOKEN */ };
|
|
1137
|
-
var SUFFIX_MATCH_TOKEN = { type: 13 /* SUFFIX_MATCH_TOKEN */ };
|
|
1138
|
-
var PREFIX_MATCH_TOKEN = { type: 8 /* PREFIX_MATCH_TOKEN */ };
|
|
1139
|
-
var COLUMN_TOKEN = { type: 21 /* COLUMN_TOKEN */ };
|
|
1140
|
-
var DASH_MATCH_TOKEN = { type: 9 /* DASH_MATCH_TOKEN */ };
|
|
1141
|
-
var INCLUDE_MATCH_TOKEN = { type: 10 /* INCLUDE_MATCH_TOKEN */ };
|
|
1180
|
+
type: 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */
|
|
1181
|
+
};
|
|
1182
|
+
var COMMA_TOKEN = { type: 4 /* TokenType.COMMA_TOKEN */ };
|
|
1183
|
+
var SUFFIX_MATCH_TOKEN = { type: 13 /* TokenType.SUFFIX_MATCH_TOKEN */ };
|
|
1184
|
+
var PREFIX_MATCH_TOKEN = { type: 8 /* TokenType.PREFIX_MATCH_TOKEN */ };
|
|
1185
|
+
var COLUMN_TOKEN = { type: 21 /* TokenType.COLUMN_TOKEN */ };
|
|
1186
|
+
var DASH_MATCH_TOKEN = { type: 9 /* TokenType.DASH_MATCH_TOKEN */ };
|
|
1187
|
+
var INCLUDE_MATCH_TOKEN = { type: 10 /* TokenType.INCLUDE_MATCH_TOKEN */ };
|
|
1142
1188
|
var LEFT_CURLY_BRACKET_TOKEN = {
|
|
1143
|
-
type: 11 /* LEFT_CURLY_BRACKET_TOKEN */
|
|
1189
|
+
type: 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */
|
|
1144
1190
|
};
|
|
1145
1191
|
var RIGHT_CURLY_BRACKET_TOKEN = {
|
|
1146
|
-
type: 12 /* RIGHT_CURLY_BRACKET_TOKEN */
|
|
1147
|
-
};
|
|
1148
|
-
var SUBSTRING_MATCH_TOKEN = { type: 14 /* SUBSTRING_MATCH_TOKEN */ };
|
|
1149
|
-
var BAD_URL_TOKEN = { type: 23 /* BAD_URL_TOKEN */ };
|
|
1150
|
-
var BAD_STRING_TOKEN = { type: 1 /* BAD_STRING_TOKEN */ };
|
|
1151
|
-
var CDO_TOKEN = { type: 25 /* CDO_TOKEN */ };
|
|
1152
|
-
var CDC_TOKEN = { type: 24 /* CDC_TOKEN */ };
|
|
1153
|
-
var COLON_TOKEN = { type: 26 /* COLON_TOKEN */ };
|
|
1154
|
-
var SEMICOLON_TOKEN = { type: 27 /* SEMICOLON_TOKEN */ };
|
|
1192
|
+
type: 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */
|
|
1193
|
+
};
|
|
1194
|
+
var SUBSTRING_MATCH_TOKEN = { type: 14 /* TokenType.SUBSTRING_MATCH_TOKEN */ };
|
|
1195
|
+
var BAD_URL_TOKEN = { type: 23 /* TokenType.BAD_URL_TOKEN */ };
|
|
1196
|
+
var BAD_STRING_TOKEN = { type: 1 /* TokenType.BAD_STRING_TOKEN */ };
|
|
1197
|
+
var CDO_TOKEN = { type: 25 /* TokenType.CDO_TOKEN */ };
|
|
1198
|
+
var CDC_TOKEN = { type: 24 /* TokenType.CDC_TOKEN */ };
|
|
1199
|
+
var COLON_TOKEN = { type: 26 /* TokenType.COLON_TOKEN */ };
|
|
1200
|
+
var SEMICOLON_TOKEN = { type: 27 /* TokenType.SEMICOLON_TOKEN */ };
|
|
1155
1201
|
var LEFT_SQUARE_BRACKET_TOKEN = {
|
|
1156
|
-
type: 28 /* LEFT_SQUARE_BRACKET_TOKEN */
|
|
1202
|
+
type: 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */
|
|
1157
1203
|
};
|
|
1158
1204
|
var RIGHT_SQUARE_BRACKET_TOKEN = {
|
|
1159
|
-
type: 29 /* RIGHT_SQUARE_BRACKET_TOKEN */
|
|
1205
|
+
type: 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */
|
|
1160
1206
|
};
|
|
1161
|
-
var WHITESPACE_TOKEN = { type: 31 /* WHITESPACE_TOKEN */ };
|
|
1162
|
-
var EOF_TOKEN = { type: 32 /* EOF_TOKEN */ };
|
|
1207
|
+
var WHITESPACE_TOKEN = { type: 31 /* TokenType.WHITESPACE_TOKEN */ };
|
|
1208
|
+
var EOF_TOKEN = { type: 32 /* TokenType.EOF_TOKEN */ };
|
|
1163
1209
|
var Tokenizer = /** @class */ (function () {
|
|
1164
1210
|
function Tokenizer() {
|
|
1165
1211
|
this._value = [];
|
|
@@ -1188,7 +1234,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1188
1234
|
if (isNameCodePoint(c1) || isValidEscape(c2, c3)) {
|
|
1189
1235
|
var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED;
|
|
1190
1236
|
var value = this.consumeName();
|
|
1191
|
-
return { type: 5 /* HASH_TOKEN */, value: value, flags: flags };
|
|
1237
|
+
return { type: 5 /* TokenType.HASH_TOKEN */, value: value, flags: flags };
|
|
1192
1238
|
}
|
|
1193
1239
|
break;
|
|
1194
1240
|
case DOLLAR_SIGN:
|
|
@@ -1277,7 +1323,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1277
1323
|
var a3 = this.peekCodePoint(2);
|
|
1278
1324
|
if (isIdentifierStart(a1, a2, a3)) {
|
|
1279
1325
|
var value = this.consumeName();
|
|
1280
|
-
return { type: 7 /* AT_KEYWORD_TOKEN */, value: value };
|
|
1326
|
+
return { type: 7 /* TokenType.AT_KEYWORD_TOKEN */, value: value };
|
|
1281
1327
|
}
|
|
1282
1328
|
break;
|
|
1283
1329
|
case LEFT_SQUARE_BRACKET:
|
|
@@ -1341,7 +1387,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1341
1387
|
this.reconsumeCodePoint(codePoint);
|
|
1342
1388
|
return this.consumeIdentLikeToken();
|
|
1343
1389
|
}
|
|
1344
|
-
return { type: 6 /* DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
|
|
1390
|
+
return { type: 6 /* TokenType.DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
|
|
1345
1391
|
};
|
|
1346
1392
|
Tokenizer.prototype.consumeCodePoint = function () {
|
|
1347
1393
|
var value = this._value.shift();
|
|
@@ -1372,7 +1418,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1372
1418
|
if (questionMarks) {
|
|
1373
1419
|
var start_1 = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16);
|
|
1374
1420
|
var end = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16);
|
|
1375
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start_1, end: end };
|
|
1421
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start_1, end: end };
|
|
1376
1422
|
}
|
|
1377
1423
|
var start = parseInt(fromCodePoint$1.apply(void 0, digits), 16);
|
|
1378
1424
|
if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) {
|
|
@@ -1384,10 +1430,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1384
1430
|
codePoint = this.consumeCodePoint();
|
|
1385
1431
|
}
|
|
1386
1432
|
var end = parseInt(fromCodePoint$1.apply(void 0, endDigits), 16);
|
|
1387
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: end };
|
|
1433
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: end };
|
|
1388
1434
|
}
|
|
1389
1435
|
else {
|
|
1390
|
-
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: start };
|
|
1436
|
+
return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: start };
|
|
1391
1437
|
}
|
|
1392
1438
|
};
|
|
1393
1439
|
Tokenizer.prototype.consumeIdentLikeToken = function () {
|
|
@@ -1398,24 +1444,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1398
1444
|
}
|
|
1399
1445
|
else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) {
|
|
1400
1446
|
this.consumeCodePoint();
|
|
1401
|
-
return { type: 19 /* FUNCTION_TOKEN */, value: value };
|
|
1447
|
+
return { type: 19 /* TokenType.FUNCTION_TOKEN */, value: value };
|
|
1402
1448
|
}
|
|
1403
|
-
return { type: 20 /* IDENT_TOKEN */, value: value };
|
|
1449
|
+
return { type: 20 /* TokenType.IDENT_TOKEN */, value: value };
|
|
1404
1450
|
};
|
|
1405
1451
|
Tokenizer.prototype.consumeUrlToken = function () {
|
|
1406
1452
|
var value = [];
|
|
1407
1453
|
this.consumeWhiteSpace();
|
|
1408
1454
|
if (this.peekCodePoint(0) === EOF) {
|
|
1409
|
-
return { type: 22 /* URL_TOKEN */, value: '' };
|
|
1455
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: '' };
|
|
1410
1456
|
}
|
|
1411
1457
|
var next = this.peekCodePoint(0);
|
|
1412
1458
|
if (next === APOSTROPHE || next === QUOTATION_MARK) {
|
|
1413
1459
|
var stringToken = this.consumeStringToken(this.consumeCodePoint());
|
|
1414
|
-
if (stringToken.type === 0 /* STRING_TOKEN */) {
|
|
1460
|
+
if (stringToken.type === 0 /* TokenType.STRING_TOKEN */) {
|
|
1415
1461
|
this.consumeWhiteSpace();
|
|
1416
1462
|
if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
|
|
1417
1463
|
this.consumeCodePoint();
|
|
1418
|
-
return { type: 22 /* URL_TOKEN */, value: stringToken.value };
|
|
1464
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: stringToken.value };
|
|
1419
1465
|
}
|
|
1420
1466
|
}
|
|
1421
1467
|
this.consumeBadUrlRemnants();
|
|
@@ -1424,13 +1470,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1424
1470
|
while (true) {
|
|
1425
1471
|
var codePoint = this.consumeCodePoint();
|
|
1426
1472
|
if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
|
|
1427
|
-
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1473
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1428
1474
|
}
|
|
1429
1475
|
else if (isWhiteSpace(codePoint)) {
|
|
1430
1476
|
this.consumeWhiteSpace();
|
|
1431
1477
|
if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
|
|
1432
1478
|
this.consumeCodePoint();
|
|
1433
|
-
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1479
|
+
return { type: 22 /* TokenType.URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
|
|
1434
1480
|
}
|
|
1435
1481
|
this.consumeBadUrlRemnants();
|
|
1436
1482
|
return BAD_URL_TOKEN;
|
|
@@ -1490,7 +1536,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1490
1536
|
var codePoint = this._value[i];
|
|
1491
1537
|
if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) {
|
|
1492
1538
|
value += this.consumeStringSlice(i);
|
|
1493
|
-
return { type: 0 /* STRING_TOKEN */, value: value };
|
|
1539
|
+
return { type: 0 /* TokenType.STRING_TOKEN */, value: value };
|
|
1494
1540
|
}
|
|
1495
1541
|
if (codePoint === LINE_FEED) {
|
|
1496
1542
|
this._value.splice(0, i);
|
|
@@ -1552,13 +1598,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1552
1598
|
var c3 = this.peekCodePoint(2);
|
|
1553
1599
|
if (isIdentifierStart(c1, c2, c3)) {
|
|
1554
1600
|
var unit = this.consumeName();
|
|
1555
|
-
return { type: 15 /* DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
|
|
1601
|
+
return { type: 15 /* TokenType.DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
|
|
1556
1602
|
}
|
|
1557
1603
|
if (c1 === PERCENTAGE_SIGN) {
|
|
1558
1604
|
this.consumeCodePoint();
|
|
1559
|
-
return { type: 16 /* PERCENTAGE_TOKEN */, number: number, flags: flags };
|
|
1605
|
+
return { type: 16 /* TokenType.PERCENTAGE_TOKEN */, number: number, flags: flags };
|
|
1560
1606
|
}
|
|
1561
|
-
return { type: 17 /* NUMBER_TOKEN */, number: number, flags: flags };
|
|
1607
|
+
return { type: 17 /* TokenType.NUMBER_TOKEN */, number: number, flags: flags };
|
|
1562
1608
|
};
|
|
1563
1609
|
Tokenizer.prototype.consumeEscapedCodePoint = function () {
|
|
1564
1610
|
var codePoint = this.consumeCodePoint();
|
|
@@ -1617,18 +1663,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1617
1663
|
};
|
|
1618
1664
|
Parser.prototype.parseComponentValue = function () {
|
|
1619
1665
|
var token = this.consumeToken();
|
|
1620
|
-
while (token.type === 31 /* WHITESPACE_TOKEN */) {
|
|
1666
|
+
while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */) {
|
|
1621
1667
|
token = this.consumeToken();
|
|
1622
1668
|
}
|
|
1623
|
-
if (token.type === 32 /* EOF_TOKEN */) {
|
|
1669
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1624
1670
|
throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
|
|
1625
1671
|
}
|
|
1626
1672
|
this.reconsumeToken(token);
|
|
1627
1673
|
var value = this.consumeComponentValue();
|
|
1628
1674
|
do {
|
|
1629
1675
|
token = this.consumeToken();
|
|
1630
|
-
} while (token.type === 31 /* WHITESPACE_TOKEN */);
|
|
1631
|
-
if (token.type === 32 /* EOF_TOKEN */) {
|
|
1676
|
+
} while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */);
|
|
1677
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1632
1678
|
return value;
|
|
1633
1679
|
}
|
|
1634
1680
|
throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
|
|
@@ -1637,7 +1683,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1637
1683
|
var values = [];
|
|
1638
1684
|
while (true) {
|
|
1639
1685
|
var value = this.consumeComponentValue();
|
|
1640
|
-
if (value.type === 32 /* EOF_TOKEN */) {
|
|
1686
|
+
if (value.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
1641
1687
|
return values;
|
|
1642
1688
|
}
|
|
1643
1689
|
values.push(value);
|
|
@@ -1647,11 +1693,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1647
1693
|
Parser.prototype.consumeComponentValue = function () {
|
|
1648
1694
|
var token = this.consumeToken();
|
|
1649
1695
|
switch (token.type) {
|
|
1650
|
-
case 11 /* LEFT_CURLY_BRACKET_TOKEN */:
|
|
1651
|
-
case 28 /* LEFT_SQUARE_BRACKET_TOKEN */:
|
|
1652
|
-
case 2 /* LEFT_PARENTHESIS_TOKEN */:
|
|
1696
|
+
case 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */:
|
|
1697
|
+
case 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */:
|
|
1698
|
+
case 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */:
|
|
1653
1699
|
return this.consumeSimpleBlock(token.type);
|
|
1654
|
-
case 19 /* FUNCTION_TOKEN */:
|
|
1700
|
+
case 19 /* TokenType.FUNCTION_TOKEN */:
|
|
1655
1701
|
return this.consumeFunction(token);
|
|
1656
1702
|
}
|
|
1657
1703
|
return token;
|
|
@@ -1660,7 +1706,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1660
1706
|
var block = { type: type, values: [] };
|
|
1661
1707
|
var token = this.consumeToken();
|
|
1662
1708
|
while (true) {
|
|
1663
|
-
if (token.type === 32 /* EOF_TOKEN */ || isEndingTokenFor(token, type)) {
|
|
1709
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */ || isEndingTokenFor(token, type)) {
|
|
1664
1710
|
return block;
|
|
1665
1711
|
}
|
|
1666
1712
|
this.reconsumeToken(token);
|
|
@@ -1672,11 +1718,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1672
1718
|
var cssFunction = {
|
|
1673
1719
|
name: functionToken.value,
|
|
1674
1720
|
values: [],
|
|
1675
|
-
type: 18 /* FUNCTION */
|
|
1721
|
+
type: 18 /* TokenType.FUNCTION */
|
|
1676
1722
|
};
|
|
1677
1723
|
while (true) {
|
|
1678
1724
|
var token = this.consumeToken();
|
|
1679
|
-
if (token.type === 32 /* EOF_TOKEN */ || token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */) {
|
|
1725
|
+
if (token.type === 32 /* TokenType.EOF_TOKEN */ || token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */) {
|
|
1680
1726
|
return cssFunction;
|
|
1681
1727
|
}
|
|
1682
1728
|
this.reconsumeToken(token);
|
|
@@ -1692,22 +1738,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1692
1738
|
};
|
|
1693
1739
|
return Parser;
|
|
1694
1740
|
}());
|
|
1695
|
-
var isDimensionToken = function (token) { return token.type === 15 /* DIMENSION_TOKEN */; };
|
|
1696
|
-
var isNumberToken = function (token) { return token.type === 17 /* NUMBER_TOKEN */; };
|
|
1697
|
-
var isIdentToken = function (token) { return token.type === 20 /* IDENT_TOKEN */; };
|
|
1698
|
-
var isStringToken = function (token) { return token.type === 0 /* STRING_TOKEN */; };
|
|
1741
|
+
var isDimensionToken = function (token) { return token.type === 15 /* TokenType.DIMENSION_TOKEN */; };
|
|
1742
|
+
var isNumberToken = function (token) { return token.type === 17 /* TokenType.NUMBER_TOKEN */; };
|
|
1743
|
+
var isIdentToken = function (token) { return token.type === 20 /* TokenType.IDENT_TOKEN */; };
|
|
1744
|
+
var isStringToken = function (token) { return token.type === 0 /* TokenType.STRING_TOKEN */; };
|
|
1699
1745
|
var isIdentWithValue = function (token, value) {
|
|
1700
1746
|
return isIdentToken(token) && token.value === value;
|
|
1701
1747
|
};
|
|
1702
|
-
var nonWhiteSpace = function (token) { return token.type !== 31 /* WHITESPACE_TOKEN */; };
|
|
1748
|
+
var nonWhiteSpace = function (token) { return token.type !== 31 /* TokenType.WHITESPACE_TOKEN */; };
|
|
1703
1749
|
var nonFunctionArgSeparator = function (token) {
|
|
1704
|
-
return token.type !== 31 /* WHITESPACE_TOKEN */ && token.type !== 4 /* COMMA_TOKEN */;
|
|
1750
|
+
return token.type !== 31 /* TokenType.WHITESPACE_TOKEN */ && token.type !== 4 /* TokenType.COMMA_TOKEN */;
|
|
1705
1751
|
};
|
|
1706
1752
|
var parseFunctionArgs = function (tokens) {
|
|
1707
1753
|
var args = [];
|
|
1708
1754
|
var arg = [];
|
|
1709
1755
|
tokens.forEach(function (token) {
|
|
1710
|
-
if (token.type === 4 /* COMMA_TOKEN */) {
|
|
1756
|
+
if (token.type === 4 /* TokenType.COMMA_TOKEN */) {
|
|
1711
1757
|
if (arg.length === 0) {
|
|
1712
1758
|
throw new Error("Error parsing function args, zero tokens for arg");
|
|
1713
1759
|
}
|
|
@@ -1715,7 +1761,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1715
1761
|
arg = [];
|
|
1716
1762
|
return;
|
|
1717
1763
|
}
|
|
1718
|
-
if (token.type !== 31 /* WHITESPACE_TOKEN */) {
|
|
1764
|
+
if (token.type !== 31 /* TokenType.WHITESPACE_TOKEN */) {
|
|
1719
1765
|
arg.push(token);
|
|
1720
1766
|
}
|
|
1721
1767
|
});
|
|
@@ -1725,37 +1771,37 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1725
1771
|
return args;
|
|
1726
1772
|
};
|
|
1727
1773
|
var isEndingTokenFor = function (token, type) {
|
|
1728
|
-
if (type === 11 /* LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* RIGHT_CURLY_BRACKET_TOKEN */) {
|
|
1774
|
+
if (type === 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */) {
|
|
1729
1775
|
return true;
|
|
1730
1776
|
}
|
|
1731
|
-
if (type === 28 /* LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* RIGHT_SQUARE_BRACKET_TOKEN */) {
|
|
1777
|
+
if (type === 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */) {
|
|
1732
1778
|
return true;
|
|
1733
1779
|
}
|
|
1734
|
-
return type === 2 /* LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */;
|
|
1780
|
+
return type === 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */;
|
|
1735
1781
|
};
|
|
1736
1782
|
|
|
1737
1783
|
var isLength = function (token) {
|
|
1738
|
-
return token.type === 17 /* NUMBER_TOKEN */ || token.type === 15 /* DIMENSION_TOKEN */;
|
|
1784
|
+
return token.type === 17 /* TokenType.NUMBER_TOKEN */ || token.type === 15 /* TokenType.DIMENSION_TOKEN */;
|
|
1739
1785
|
};
|
|
1740
1786
|
|
|
1741
1787
|
var isLengthPercentage = function (token) {
|
|
1742
|
-
return token.type === 16 /* PERCENTAGE_TOKEN */ || isLength(token);
|
|
1788
|
+
return token.type === 16 /* TokenType.PERCENTAGE_TOKEN */ || isLength(token);
|
|
1743
1789
|
};
|
|
1744
1790
|
var parseLengthPercentageTuple = function (tokens) {
|
|
1745
1791
|
return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]];
|
|
1746
1792
|
};
|
|
1747
1793
|
var ZERO_LENGTH = {
|
|
1748
|
-
type: 17 /* NUMBER_TOKEN */,
|
|
1794
|
+
type: 17 /* TokenType.NUMBER_TOKEN */,
|
|
1749
1795
|
number: 0,
|
|
1750
1796
|
flags: FLAG_INTEGER
|
|
1751
1797
|
};
|
|
1752
1798
|
var FIFTY_PERCENT = {
|
|
1753
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
1799
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
1754
1800
|
number: 50,
|
|
1755
1801
|
flags: FLAG_INTEGER
|
|
1756
1802
|
};
|
|
1757
1803
|
var HUNDRED_PERCENT = {
|
|
1758
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
1804
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
1759
1805
|
number: 100,
|
|
1760
1806
|
flags: FLAG_INTEGER
|
|
1761
1807
|
};
|
|
@@ -1764,7 +1810,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1764
1810
|
return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)];
|
|
1765
1811
|
};
|
|
1766
1812
|
var getAbsoluteValue = function (token, parent) {
|
|
1767
|
-
if (token.type === 16 /* PERCENTAGE_TOKEN */) {
|
|
1813
|
+
if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
1768
1814
|
return (token.number / 100) * parent;
|
|
1769
1815
|
}
|
|
1770
1816
|
if (isDimensionToken(token)) {
|
|
@@ -1787,7 +1833,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1787
1833
|
var angle = {
|
|
1788
1834
|
name: 'angle',
|
|
1789
1835
|
parse: function (_context, value) {
|
|
1790
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
1836
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
1791
1837
|
switch (value.unit) {
|
|
1792
1838
|
case DEG:
|
|
1793
1839
|
return (Math.PI * value.number) / 180;
|
|
@@ -1803,7 +1849,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1803
1849
|
}
|
|
1804
1850
|
};
|
|
1805
1851
|
var isAngle = function (value) {
|
|
1806
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
1852
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
1807
1853
|
if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) {
|
|
1808
1854
|
return true;
|
|
1809
1855
|
}
|
|
@@ -1853,87 +1899,154 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1853
1899
|
};
|
|
1854
1900
|
var deg = function (deg) { return (Math.PI * deg) / 180; };
|
|
1855
1901
|
|
|
1856
|
-
var color$1 = {
|
|
1857
|
-
name: 'color',
|
|
1858
|
-
parse: function (context, value) {
|
|
1859
|
-
if (value.type === 18 /* FUNCTION */) {
|
|
1860
|
-
var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
|
|
1861
|
-
if (typeof colorFunction === 'undefined') {
|
|
1862
|
-
throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\"");
|
|
1863
|
-
}
|
|
1864
|
-
return colorFunction(context, value.values);
|
|
1865
|
-
}
|
|
1866
|
-
if (value.type === 5 /* HASH_TOKEN */) {
|
|
1867
|
-
if (value.value.length === 3) {
|
|
1868
|
-
var r = value.value.substring(0, 1);
|
|
1869
|
-
var g = value.value.substring(1, 2);
|
|
1870
|
-
var b = value.value.substring(2, 3);
|
|
1871
|
-
return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1);
|
|
1872
|
-
}
|
|
1873
|
-
if (value.value.length === 4) {
|
|
1874
|
-
var r = value.value.substring(0, 1);
|
|
1875
|
-
var g = value.value.substring(1, 2);
|
|
1876
|
-
var b = value.value.substring(2, 3);
|
|
1877
|
-
var a = value.value.substring(3, 4);
|
|
1878
|
-
return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255);
|
|
1879
|
-
}
|
|
1880
|
-
if (value.value.length === 6) {
|
|
1881
|
-
var r = value.value.substring(0, 2);
|
|
1882
|
-
var g = value.value.substring(2, 4);
|
|
1883
|
-
var b = value.value.substring(4, 6);
|
|
1884
|
-
return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1);
|
|
1885
|
-
}
|
|
1886
|
-
if (value.value.length === 8) {
|
|
1887
|
-
var r = value.value.substring(0, 2);
|
|
1888
|
-
var g = value.value.substring(2, 4);
|
|
1889
|
-
var b = value.value.substring(4, 6);
|
|
1890
|
-
var a = value.value.substring(6, 8);
|
|
1891
|
-
return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255);
|
|
1892
|
-
}
|
|
1893
|
-
}
|
|
1894
|
-
if (value.type === 20 /* IDENT_TOKEN */) {
|
|
1895
|
-
var namedColor = COLORS[value.value.toUpperCase()];
|
|
1896
|
-
if (typeof namedColor !== 'undefined') {
|
|
1897
|
-
return namedColor;
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1900
|
-
return COLORS.TRANSPARENT;
|
|
1901
|
-
}
|
|
1902
|
-
};
|
|
1903
1902
|
var isTransparent = function (color) { return (0xff & color) === 0; };
|
|
1904
1903
|
var asString = function (color) {
|
|
1905
1904
|
var alpha = 0xff & color;
|
|
1906
1905
|
var blue = 0xff & (color >> 8);
|
|
1907
1906
|
var green = 0xff & (color >> 16);
|
|
1908
1907
|
var red = 0xff & (color >> 24);
|
|
1909
|
-
return alpha < 255 ? "rgba("
|
|
1908
|
+
return alpha < 255 ? "rgba(".concat(red, ",").concat(green, ",").concat(blue, ",").concat(alpha / 255, ")") : "rgb(".concat(red, ",").concat(green, ",").concat(blue, ")");
|
|
1910
1909
|
};
|
|
1911
1910
|
var pack = function (r, g, b, a) {
|
|
1912
1911
|
return ((r << 24) | (g << 16) | (b << 8) | (Math.round(a * 255) << 0)) >>> 0;
|
|
1913
1912
|
};
|
|
1914
1913
|
var getTokenColorValue = function (token, i) {
|
|
1915
|
-
if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
1914
|
+
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
1916
1915
|
return token.number;
|
|
1917
1916
|
}
|
|
1918
|
-
if (token.type === 16 /* PERCENTAGE_TOKEN */) {
|
|
1917
|
+
if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
1919
1918
|
var max = i === 3 ? 1 : 255;
|
|
1920
1919
|
return i === 3 ? (token.number / 100) * max : Math.round((token.number / 100) * max);
|
|
1921
1920
|
}
|
|
1922
1921
|
return 0;
|
|
1923
1922
|
};
|
|
1924
|
-
var
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1923
|
+
var isRelativeTransform = function (tokens) {
|
|
1924
|
+
return (tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ ? tokens[0].value : 'unknown') === 'from';
|
|
1925
|
+
};
|
|
1926
|
+
var clamp = function (value, min, max) {
|
|
1927
|
+
return Math.min(Math.max(value, min), max);
|
|
1928
|
+
};
|
|
1929
|
+
var multiplyMatrices = function (A, B) {
|
|
1930
|
+
return [
|
|
1931
|
+
A[0] * B[0] + A[1] * B[1] + A[2] * B[2],
|
|
1932
|
+
A[3] * B[0] + A[4] * B[1] + A[5] * B[2],
|
|
1933
|
+
A[6] * B[0] + A[7] * B[1] + A[8] * B[2]
|
|
1934
|
+
];
|
|
1935
|
+
};
|
|
1936
|
+
var packSrgb = function (args) {
|
|
1937
|
+
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));
|
|
1938
|
+
};
|
|
1939
|
+
var packSrgbLinear = function (_a) {
|
|
1940
|
+
var r = _a[0], g = _a[1], b = _a[2], a = _a[3];
|
|
1941
|
+
var rgb = srgbLinear2rgb([r, g, b]);
|
|
1942
|
+
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);
|
|
1943
|
+
};
|
|
1944
|
+
var packXYZ = function (args) {
|
|
1945
|
+
var srgb_linear = xyz2rgbLinear([args[0], args[1], args[2]]);
|
|
1946
|
+
return packSrgbLinear([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
|
|
1947
|
+
};
|
|
1948
|
+
var packLab = function (_context, args) {
|
|
1949
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1950
|
+
throw new Error('Relative color not supported for lab()');
|
|
1951
|
+
}
|
|
1952
|
+
var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(lab2xyz([l, a, b])));
|
|
1953
|
+
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);
|
|
1954
|
+
};
|
|
1955
|
+
var packOkLab = function (_context, args) {
|
|
1956
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1957
|
+
throw new Error('Relative color not supported for oklab()');
|
|
1958
|
+
}
|
|
1959
|
+
var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(oklab2xyz([l, a, b])));
|
|
1960
|
+
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);
|
|
1961
|
+
};
|
|
1962
|
+
var packOkLch = function (_context, args) {
|
|
1963
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1964
|
+
throw new Error('Relative color not supported for oklch()');
|
|
1965
|
+
}
|
|
1966
|
+
var _a = extractOkLchComponents(args), l = _a[0], c = _a[1], h = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(oklab2xyz(lch2lab([l, c, h]))));
|
|
1967
|
+
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);
|
|
1968
|
+
};
|
|
1969
|
+
var packLch = function (_context, args) {
|
|
1970
|
+
if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
|
|
1971
|
+
throw new Error('Relative color not supported for lch()');
|
|
1972
|
+
}
|
|
1973
|
+
var _a = extractLchComponents(args), l = _a[0], c = _a[1], h = _a[2], a = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(lab2xyz(lch2lab([l, c, h]))));
|
|
1974
|
+
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);
|
|
1975
|
+
};
|
|
1976
|
+
var extractHslComponents = function (context, args) {
|
|
1977
|
+
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;
|
|
1978
|
+
return [h, s, l, a];
|
|
1979
|
+
};
|
|
1980
|
+
var packHSL = function (context, args) {
|
|
1981
|
+
if (isRelativeTransform(args)) {
|
|
1982
|
+
throw new Error('Relative color not supported for hsl()');
|
|
1983
|
+
}
|
|
1984
|
+
var _a = extractHslComponents(context, args), h = _a[0], s = _a[1], l = _a[2], a = _a[3], rgb = hsl2rgb([h, s, l]);
|
|
1985
|
+
return pack(rgb[0] * 255, rgb[1] * 255, rgb[2] * 255, s === 0 ? 1 : a);
|
|
1986
|
+
};
|
|
1987
|
+
var extractLchComponents = function (args) {
|
|
1988
|
+
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;
|
|
1989
|
+
return [l, c, h, a];
|
|
1990
|
+
};
|
|
1991
|
+
var extractLabComponents = function (args) {
|
|
1992
|
+
var tokens = args.filter(nonFunctionArgSeparator),
|
|
1993
|
+
// eslint-disable-next-line prettier/prettier
|
|
1994
|
+
l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
1995
|
+
? tokens[0].number / 100
|
|
1996
|
+
: isNumberToken(tokens[0])
|
|
1997
|
+
? tokens[0].number
|
|
1998
|
+
: 0,
|
|
1999
|
+
// eslint-disable-next-line prettier/prettier
|
|
2000
|
+
a = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
2001
|
+
? tokens[1].number / 100
|
|
2002
|
+
: isNumberToken(tokens[1])
|
|
2003
|
+
? tokens[1].number
|
|
2004
|
+
: 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;
|
|
2005
|
+
return [l, a, b, alpha];
|
|
2006
|
+
};
|
|
2007
|
+
var extractOkLchComponents = function (args) {
|
|
2008
|
+
var tokens = args.filter(nonFunctionArgSeparator),
|
|
2009
|
+
// eslint-disable-next-line prettier/prettier
|
|
2010
|
+
l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
2011
|
+
? tokens[0].number / 100
|
|
2012
|
+
: isNumberToken(tokens[0])
|
|
2013
|
+
? tokens[0].number
|
|
2014
|
+
: 0,
|
|
2015
|
+
// eslint-disable-next-line prettier/prettier
|
|
2016
|
+
c = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
2017
|
+
? tokens[1].number / 100
|
|
2018
|
+
: isNumberToken(tokens[1])
|
|
2019
|
+
? tokens[1].number
|
|
2020
|
+
: 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;
|
|
2021
|
+
return [l, c, h, a];
|
|
2022
|
+
};
|
|
2023
|
+
/**
|
|
2024
|
+
* Convert D65 to D50
|
|
2025
|
+
*
|
|
2026
|
+
* @param xyz
|
|
2027
|
+
*/
|
|
2028
|
+
var d65toD50 = function (xyz) {
|
|
2029
|
+
return multiplyMatrices(
|
|
2030
|
+
// eslint-disable-next-line prettier/prettier
|
|
2031
|
+
[
|
|
2032
|
+
1.0479297925449969, 0.022946870601609652, -0.05019226628920524, 0.02962780877005599, 0.9904344267538799,
|
|
2033
|
+
-0.017073799063418826, -0.009243040646204504, 0.015055191490298152, 0.7518742814281371
|
|
2034
|
+
], xyz);
|
|
1935
2035
|
};
|
|
1936
|
-
|
|
2036
|
+
/**
|
|
2037
|
+
* Convert D50 to D65
|
|
2038
|
+
*
|
|
2039
|
+
* @param xyz
|
|
2040
|
+
*/
|
|
2041
|
+
var d50toD65 = function (xyz) {
|
|
2042
|
+
return multiplyMatrices(
|
|
2043
|
+
// eslint-disable-next-line prettier/prettier
|
|
2044
|
+
[
|
|
2045
|
+
0.955473421488075, -0.02309845494876471, 0.06325924320057072, -0.0283697093338637, 1.0099953980813041,
|
|
2046
|
+
0.021041441191917323, 0.012314014864481998, -0.020507649298898964, 1.330365926242124
|
|
2047
|
+
], xyz);
|
|
2048
|
+
};
|
|
2049
|
+
var hue2rgb = function (t1, t2, hue) {
|
|
1937
2050
|
if (hue < 0) {
|
|
1938
2051
|
hue += 1;
|
|
1939
2052
|
}
|
|
@@ -1952,29 +2065,783 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
1952
2065
|
else {
|
|
1953
2066
|
return t1;
|
|
1954
2067
|
}
|
|
1955
|
-
}
|
|
1956
|
-
var
|
|
1957
|
-
var
|
|
1958
|
-
var hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3];
|
|
1959
|
-
var h = (hue.type === 17 /* NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2);
|
|
1960
|
-
var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0;
|
|
1961
|
-
var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0;
|
|
1962
|
-
var a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1;
|
|
2068
|
+
};
|
|
2069
|
+
var hsl2rgb = function (_a) {
|
|
2070
|
+
var h = _a[0], s = _a[1], l = _a[2];
|
|
1963
2071
|
if (s === 0) {
|
|
1964
|
-
return
|
|
2072
|
+
return [l * 255, l * 255, l * 255];
|
|
2073
|
+
}
|
|
2074
|
+
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);
|
|
2075
|
+
return [r, g, b];
|
|
2076
|
+
};
|
|
2077
|
+
/**
|
|
2078
|
+
* Convert lch to OKLab
|
|
2079
|
+
*
|
|
2080
|
+
* @param l
|
|
2081
|
+
* @param c
|
|
2082
|
+
* @param h
|
|
2083
|
+
*/
|
|
2084
|
+
var lch2lab = function (_a) {
|
|
2085
|
+
var l = _a[0], c = _a[1], h = _a[2];
|
|
2086
|
+
if (c < 0) {
|
|
2087
|
+
c = 0;
|
|
2088
|
+
}
|
|
2089
|
+
if (isNaN(h)) {
|
|
2090
|
+
h = 0;
|
|
2091
|
+
}
|
|
2092
|
+
return [l, c * Math.cos((h * Math.PI) / 180), c * Math.sin((h * Math.PI) / 180)];
|
|
2093
|
+
};
|
|
2094
|
+
/**
|
|
2095
|
+
* Convert OKLab to XYZ relative to D65
|
|
2096
|
+
*
|
|
2097
|
+
* @param lab
|
|
2098
|
+
*/
|
|
2099
|
+
var oklab2xyz = function (lab) {
|
|
2100
|
+
var LMSg = multiplyMatrices(
|
|
2101
|
+
// eslint-disable-next-line prettier/prettier
|
|
2102
|
+
[
|
|
2103
|
+
1, 0.3963377773761749, 0.2158037573099136, 1, -0.1055613458156586, -0.0638541728258133, 1,
|
|
2104
|
+
-0.0894841775298119, -1.2914855480194092
|
|
2105
|
+
], lab), LMS = LMSg.map(function (val) { return Math.pow(val, 3); });
|
|
2106
|
+
return multiplyMatrices(
|
|
2107
|
+
// eslint-disable-next-line prettier/prettier
|
|
2108
|
+
[
|
|
2109
|
+
1.2268798758459243, -0.5578149944602171, 0.2813910456659647, -0.0405757452148008, 1.112286803280317,
|
|
2110
|
+
-0.0717110580655164, -0.0763729366746601, -0.4214933324022432, 1.5869240198367816
|
|
2111
|
+
], LMS);
|
|
2112
|
+
};
|
|
2113
|
+
/**
|
|
2114
|
+
* Convert Lab to D50-adapted XYZ
|
|
2115
|
+
*
|
|
2116
|
+
* @param lab
|
|
2117
|
+
*/
|
|
2118
|
+
var lab2xyz = function (lab) {
|
|
2119
|
+
var fy = (lab[0] + 16) / 116, fx = lab[1] / 500 + fy, fz = fy - lab[2] / 200, k = 24389 / 27, e = 24 / 116, xyz = [
|
|
2120
|
+
((fx > e ? Math.pow(fx, 3) : (116 * fx - 16) / k) * 0.3457) / 0.3585,
|
|
2121
|
+
lab[0] > 8 ? Math.pow(fy, 3) : lab[0] / k,
|
|
2122
|
+
((fz > e ? Math.pow(fz, 3) : (116 * fz - 16) / k) * (1.0 - 0.3457 - 0.3585)) / 0.3585
|
|
2123
|
+
];
|
|
2124
|
+
return d50toD65([xyz[0], xyz[1], xyz[2]]);
|
|
2125
|
+
};
|
|
2126
|
+
/**
|
|
2127
|
+
* Convert RGB to XYZ
|
|
2128
|
+
*
|
|
2129
|
+
* @param _context
|
|
2130
|
+
* @param args
|
|
2131
|
+
*/
|
|
2132
|
+
var rgbToXyz = function (_context, args) {
|
|
2133
|
+
var tokens = args.filter(nonFunctionArgSeparator);
|
|
2134
|
+
if (tokens.length === 3) {
|
|
2135
|
+
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];
|
|
2136
|
+
return [x, y, z, 1];
|
|
2137
|
+
}
|
|
2138
|
+
if (tokens.length === 4) {
|
|
2139
|
+
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];
|
|
2140
|
+
return [x, y, z, a];
|
|
1965
2141
|
}
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
2142
|
+
return [0, 0, 0, 1];
|
|
2143
|
+
};
|
|
2144
|
+
/**
|
|
2145
|
+
* HSL to XYZ
|
|
2146
|
+
*
|
|
2147
|
+
* @param context
|
|
2148
|
+
* @param args
|
|
2149
|
+
*/
|
|
2150
|
+
var hslToXyz = function (context, args) {
|
|
2151
|
+
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];
|
|
2152
|
+
return [x, y, z, a];
|
|
2153
|
+
};
|
|
2154
|
+
/**
|
|
2155
|
+
* LAB to XYZ
|
|
2156
|
+
*
|
|
2157
|
+
* @param _context
|
|
2158
|
+
* @param args
|
|
2159
|
+
*/
|
|
2160
|
+
var labToXyz = function (_context, args) {
|
|
2161
|
+
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];
|
|
2162
|
+
return [x, y, z, alpha];
|
|
2163
|
+
};
|
|
2164
|
+
/**
|
|
2165
|
+
* LCH to XYZ
|
|
2166
|
+
*
|
|
2167
|
+
* @param _context
|
|
2168
|
+
* @param args
|
|
2169
|
+
*/
|
|
2170
|
+
var lchToXyz = function (_context, args) {
|
|
2171
|
+
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];
|
|
2172
|
+
return [x, y, z, alpha];
|
|
2173
|
+
};
|
|
2174
|
+
/**
|
|
2175
|
+
* OKLch to XYZ
|
|
2176
|
+
*
|
|
2177
|
+
* @param _context
|
|
2178
|
+
* @param args
|
|
2179
|
+
*/
|
|
2180
|
+
var oklchToXyz = function (_context, args) {
|
|
2181
|
+
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];
|
|
2182
|
+
return [x, y, z, alpha];
|
|
2183
|
+
};
|
|
2184
|
+
/**
|
|
2185
|
+
* OKLab to XYZ
|
|
2186
|
+
*
|
|
2187
|
+
* @param _context
|
|
2188
|
+
* @param args
|
|
2189
|
+
*/
|
|
2190
|
+
var oklabToXyz = function (_context, args) {
|
|
2191
|
+
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];
|
|
2192
|
+
return [x, y, z, alpha];
|
|
2193
|
+
};
|
|
2194
|
+
/**
|
|
2195
|
+
* XYZ-50 to XYZ
|
|
2196
|
+
*
|
|
2197
|
+
* @param args
|
|
2198
|
+
*/
|
|
2199
|
+
var xyz50ToXYZ = function (args) {
|
|
2200
|
+
return d50toD65([args[0], args[1], args[2]]);
|
|
2201
|
+
};
|
|
2202
|
+
/**
|
|
2203
|
+
* Does nothing, required for SUPPORTED_COLOR_SPACES_FROM_XYZ in the _color() function
|
|
2204
|
+
*
|
|
2205
|
+
* @param args
|
|
2206
|
+
*/
|
|
2207
|
+
var xyzFromXYZ = function (args) {
|
|
2208
|
+
return args;
|
|
2209
|
+
};
|
|
2210
|
+
/**
|
|
2211
|
+
* XYZ-65 to XYZ-50
|
|
2212
|
+
*
|
|
2213
|
+
* @param args
|
|
2214
|
+
*/
|
|
2215
|
+
var xyz50FromXYZ = function (args) {
|
|
2216
|
+
var _a = d65toD50([args[0], args[2], args[3]]), x = _a[0], y = _a[1], z = _a[2];
|
|
2217
|
+
return [x, y, z, args[3]];
|
|
2218
|
+
};
|
|
2219
|
+
/**
|
|
2220
|
+
* Convert XYZ to SRGB and Pack
|
|
2221
|
+
*
|
|
2222
|
+
* @param args
|
|
2223
|
+
*/
|
|
2224
|
+
var convertXyz = function (args) {
|
|
2225
|
+
return packXYZ([args[0], args[1], args[2], args[3]]);
|
|
2226
|
+
};
|
|
2227
|
+
/**
|
|
2228
|
+
* Convert XYZ-50 to SRGB and Pack
|
|
2229
|
+
*
|
|
2230
|
+
* @param args
|
|
2231
|
+
*/
|
|
2232
|
+
var convertXyz50 = function (args) {
|
|
2233
|
+
var xyz = xyz50ToXYZ([args[0], args[1], args[2]]);
|
|
2234
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2235
|
+
};
|
|
2236
|
+
|
|
2237
|
+
/**
|
|
2238
|
+
* SRGB related functions
|
|
2239
|
+
*/
|
|
2240
|
+
/**
|
|
2241
|
+
* Convert XYZ to linear-light sRGB
|
|
2242
|
+
*
|
|
2243
|
+
* @param xyz
|
|
2244
|
+
*/
|
|
2245
|
+
var xyz2rgbLinear = function (xyz) {
|
|
2246
|
+
return multiplyMatrices(
|
|
2247
|
+
// eslint-disable-next-line prettier/prettier
|
|
2248
|
+
[
|
|
2249
|
+
3.2409699419045226, -1.537383177570094, -0.4986107602930034, -0.9692436362808796, 1.8759675015077202,
|
|
2250
|
+
0.04155505740717559, 0.05563007969699366, -0.20397695888897652, 1.0569715142428786
|
|
2251
|
+
], xyz);
|
|
2252
|
+
};
|
|
2253
|
+
/**
|
|
2254
|
+
* Convert XYZ to linear-light sRGB
|
|
2255
|
+
*
|
|
2256
|
+
* @param xyz
|
|
2257
|
+
*/
|
|
2258
|
+
var rgbLinear2xyz = function (xyz) {
|
|
2259
|
+
return multiplyMatrices(
|
|
2260
|
+
// eslint-disable-next-line prettier/prettier
|
|
2261
|
+
[
|
|
2262
|
+
0.41239079926595934, 0.357584339383878, 0.1804807884018343, 0.21263900587151027, 0.715168678767756,
|
|
2263
|
+
0.07219231536073371, 0.01933081871559182, 0.11919477979462598, 0.9505321522496607
|
|
2264
|
+
], xyz);
|
|
2265
|
+
};
|
|
2266
|
+
/**
|
|
2267
|
+
* Convert sRGB to RGB
|
|
2268
|
+
*
|
|
2269
|
+
* @param rgb
|
|
2270
|
+
*/
|
|
2271
|
+
var srgbLinear2rgb = function (rgb) {
|
|
2272
|
+
return rgb.map(function (c) {
|
|
2273
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2274
|
+
// eslint-disable-next-line prettier/prettier
|
|
2275
|
+
return abs > 0.0031308 ? sign * (1.055 * Math.pow(abs, (1 / 2.4)) - 0.055) : 12.92 * c;
|
|
2276
|
+
});
|
|
2277
|
+
};
|
|
2278
|
+
/**
|
|
2279
|
+
* Convert RGB to sRGB
|
|
2280
|
+
*
|
|
2281
|
+
* @param rgb
|
|
2282
|
+
*/
|
|
2283
|
+
var rgb2rgbLinear = function (rgb) {
|
|
2284
|
+
return rgb.map(function (c) {
|
|
2285
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2286
|
+
// eslint-disable-next-line prettier/prettier
|
|
2287
|
+
return abs <= 0.04045 ? c / 12.92 : sign * Math.pow(((abs + 0.055) / 1.055), 2.4);
|
|
2288
|
+
});
|
|
2289
|
+
};
|
|
2290
|
+
/**
|
|
2291
|
+
* XYZ to SRGB
|
|
2292
|
+
*
|
|
2293
|
+
* @param args
|
|
2294
|
+
*/
|
|
2295
|
+
var srgbFromXYZ = function (args) {
|
|
2296
|
+
var _a = srgbLinear2rgb(xyz2rgbLinear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2297
|
+
return [r, g, b, args[3]];
|
|
2298
|
+
};
|
|
2299
|
+
/**
|
|
2300
|
+
* XYZ to SRGB-Linear
|
|
2301
|
+
* @param args
|
|
2302
|
+
*/
|
|
2303
|
+
var srgbLinearFromXYZ = function (args) {
|
|
2304
|
+
var _a = xyz2rgbLinear([args[0], args[1], args[2]]), r = _a[0], g = _a[1], b = _a[2];
|
|
2305
|
+
return [
|
|
2306
|
+
clamp(Math.round(r * 255), 0, 255),
|
|
2307
|
+
clamp(Math.round(g * 255), 0, 255),
|
|
2308
|
+
clamp(Math.round(b * 255), 0, 255),
|
|
2309
|
+
args[3]
|
|
2310
|
+
];
|
|
2311
|
+
};
|
|
2312
|
+
|
|
2313
|
+
/**
|
|
2314
|
+
* Display-P3 related functions
|
|
2315
|
+
*/
|
|
2316
|
+
/**
|
|
2317
|
+
* Convert P3 Linear to xyz
|
|
2318
|
+
*
|
|
2319
|
+
* @param p3l
|
|
2320
|
+
*/
|
|
2321
|
+
var p3LinearToXyz = function (p3l) {
|
|
2322
|
+
return multiplyMatrices(
|
|
2323
|
+
// eslint-disable-next-line prettier/prettier
|
|
2324
|
+
[
|
|
2325
|
+
0.4865709486482162, 0.26566769316909306, 0.1982172852343625, 0.2289745640697488, 0.6917385218365064,
|
|
2326
|
+
0.079286914093745, 0.0, 0.04511338185890264, 1.043944368900976
|
|
2327
|
+
], p3l);
|
|
2328
|
+
};
|
|
2329
|
+
/**
|
|
2330
|
+
* Convert XYZ to P3 Linear
|
|
2331
|
+
*
|
|
2332
|
+
* @param xyz
|
|
2333
|
+
*/
|
|
2334
|
+
var xyzToP3Linear = function (xyz) {
|
|
2335
|
+
return multiplyMatrices(
|
|
2336
|
+
// eslint-disable-next-line prettier/prettier
|
|
2337
|
+
[
|
|
2338
|
+
2.493496911941425, -0.9313836179191239, -0.40271078445071684, -0.8294889695615747, 1.7626640603183463,
|
|
2339
|
+
0.023624685841943577, 0.03584583024378447, -0.07617238926804182, 0.9568845240076872
|
|
2340
|
+
], xyz);
|
|
2341
|
+
};
|
|
2342
|
+
/**
|
|
2343
|
+
* Convert P3 to P3 linear
|
|
2344
|
+
*
|
|
2345
|
+
* @param p3
|
|
2346
|
+
*/
|
|
2347
|
+
var p32p3Linear = function (p3) {
|
|
2348
|
+
return p3.map(function (c) {
|
|
2349
|
+
var sign = c < 0 ? -1 : 1, abs = c * sign;
|
|
2350
|
+
if (abs <= 0.04045) {
|
|
2351
|
+
return c / 12.92;
|
|
2352
|
+
}
|
|
2353
|
+
// eslint-disable-next-line prettier/prettier
|
|
2354
|
+
return sign * Math.pow(((c + 0.055) / 1.055), 2.4) || 0;
|
|
2355
|
+
});
|
|
2356
|
+
};
|
|
2357
|
+
/**
|
|
2358
|
+
* Convert P3 Linear to P3
|
|
2359
|
+
*
|
|
2360
|
+
* @param p3l
|
|
2361
|
+
*/
|
|
2362
|
+
var p3Linear2p3 = function (p3l) {
|
|
2363
|
+
return srgbLinear2rgb(p3l);
|
|
2364
|
+
};
|
|
2365
|
+
/**
|
|
2366
|
+
* Convert P3 to XYZ
|
|
2367
|
+
*
|
|
2368
|
+
* @param args
|
|
2369
|
+
*/
|
|
2370
|
+
var p3ToXYZ = function (args) {
|
|
2371
|
+
var p3_linear = p32p3Linear([args[0], args[1], args[2]]);
|
|
2372
|
+
return p3LinearToXyz([p3_linear[0], p3_linear[1], p3_linear[2]]);
|
|
2373
|
+
};
|
|
2374
|
+
/**
|
|
2375
|
+
* Convert XYZ to P3
|
|
2376
|
+
*
|
|
2377
|
+
* @param args
|
|
2378
|
+
*/
|
|
2379
|
+
var p3FromXYZ = function (args) {
|
|
2380
|
+
var _a = p3Linear2p3(xyzToP3Linear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2381
|
+
return [r, g, b, args[3]];
|
|
2382
|
+
};
|
|
2383
|
+
/**
|
|
2384
|
+
* Convert P3 to SRGB and Pack
|
|
2385
|
+
*
|
|
2386
|
+
* @param args
|
|
2387
|
+
*/
|
|
2388
|
+
var convertP3 = function (args) {
|
|
2389
|
+
var xyz = p3ToXYZ([args[0], args[1], args[2]]);
|
|
2390
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2391
|
+
};
|
|
2392
|
+
|
|
2393
|
+
/**
|
|
2394
|
+
* A98-RGB related functions
|
|
2395
|
+
*/
|
|
2396
|
+
/**
|
|
2397
|
+
* Convert XYZ to a98 linear
|
|
2398
|
+
*
|
|
2399
|
+
* @param xyz
|
|
2400
|
+
*/
|
|
2401
|
+
var xyz2a98Linear = function (xyz) {
|
|
2402
|
+
return multiplyMatrices(
|
|
2403
|
+
// eslint-disable-next-line prettier/prettier
|
|
2404
|
+
[
|
|
2405
|
+
2.0415879038107465, -0.5650069742788596, -0.34473135077832956, -0.9692436362808795, 1.8759675015077202,
|
|
2406
|
+
0.04155505740717557, 0.013444280632031142, -0.11836239223101838, 1.0151749943912054
|
|
2407
|
+
], xyz);
|
|
2408
|
+
};
|
|
2409
|
+
/**
|
|
2410
|
+
* Convert XYZ to a98 linear
|
|
2411
|
+
*
|
|
2412
|
+
* @param a98
|
|
2413
|
+
*/
|
|
2414
|
+
var a98Linear2xyz = function (a98) {
|
|
2415
|
+
return multiplyMatrices(
|
|
2416
|
+
// eslint-disable-next-line prettier/prettier
|
|
2417
|
+
[
|
|
2418
|
+
0.5766690429101305, 0.1855582379065463, 0.1882286462349947, 0.29734497525053605, 0.6273635662554661,
|
|
2419
|
+
0.0752914584939978, 0.02703136138641234, 0.07068885253582723, 0.9913375368376388
|
|
2420
|
+
], a98);
|
|
2421
|
+
};
|
|
2422
|
+
/**
|
|
2423
|
+
* Convert A98 RGB to rgb linear
|
|
2424
|
+
*
|
|
2425
|
+
* @param rgb
|
|
2426
|
+
*/
|
|
2427
|
+
var a982a98Linear = function (rgb) {
|
|
2428
|
+
var mapped = rgb.map(function (c) {
|
|
2429
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2430
|
+
return sign * Math.pow(abs, (563 / 256));
|
|
2431
|
+
});
|
|
2432
|
+
return [mapped[0], mapped[1], mapped[2]];
|
|
2433
|
+
};
|
|
2434
|
+
/**
|
|
2435
|
+
* Convert A98 RGB Linear to A98
|
|
2436
|
+
*
|
|
2437
|
+
* @param rgb
|
|
2438
|
+
*/
|
|
2439
|
+
var a98Linear2a98 = function (rgb) {
|
|
2440
|
+
var mapped = rgb.map(function (c) {
|
|
2441
|
+
var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
2442
|
+
return sign * Math.pow(abs, (256 / 563));
|
|
2443
|
+
});
|
|
2444
|
+
return [mapped[0], mapped[1], mapped[2]];
|
|
2445
|
+
};
|
|
2446
|
+
/**
|
|
2447
|
+
* Convert XYZ to A98
|
|
2448
|
+
*
|
|
2449
|
+
* @param args
|
|
2450
|
+
*/
|
|
2451
|
+
var a98FromXYZ = function (args) {
|
|
2452
|
+
var _a = a98Linear2a98(xyz2a98Linear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
|
|
2453
|
+
return [r, g, b, args[3]];
|
|
2454
|
+
};
|
|
2455
|
+
/**
|
|
2456
|
+
* Convert A98 to XYZ and Pack
|
|
2457
|
+
*
|
|
2458
|
+
* @param args
|
|
2459
|
+
*/
|
|
2460
|
+
var convertA98rgb = function (args) {
|
|
2461
|
+
var srgb_linear = xyz2rgbLinear(a98Linear2xyz(a982a98Linear([args[0], args[1], args[2]])));
|
|
2462
|
+
return packSrgbLinear([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
|
|
2463
|
+
};
|
|
2464
|
+
|
|
2465
|
+
/**
|
|
2466
|
+
* Pro Photo related functions
|
|
2467
|
+
*/
|
|
2468
|
+
/**
|
|
2469
|
+
* Convert linear-light display-p3 to XYZ D65
|
|
2470
|
+
*
|
|
2471
|
+
* @param p3
|
|
2472
|
+
*/
|
|
2473
|
+
var proPhotoLinearToXyz = function (p3) {
|
|
2474
|
+
return multiplyMatrices(
|
|
2475
|
+
// eslint-disable-next-line prettier/prettier
|
|
2476
|
+
[
|
|
2477
|
+
0.7977666449006423, 0.13518129740053308, 0.0313477341283922, 0.2880748288194013, 0.711835234241873,
|
|
2478
|
+
0.00008993693872564, 0.0, 0.0, 0.8251046025104602
|
|
2479
|
+
], p3);
|
|
2480
|
+
};
|
|
2481
|
+
/**
|
|
2482
|
+
* Convert XYZ D65 to linear-light display-p3
|
|
2483
|
+
*
|
|
2484
|
+
* @param xyz
|
|
2485
|
+
*/
|
|
2486
|
+
var xyzToProPhotoLinear = function (xyz) {
|
|
2487
|
+
return multiplyMatrices(
|
|
2488
|
+
// eslint-disable-next-line prettier/prettier
|
|
2489
|
+
[
|
|
2490
|
+
1.3457868816471583, -0.25557208737979464, -0.05110186497554526, -0.5446307051249019, 1.5082477428451468,
|
|
2491
|
+
0.02052744743642139, 0.0, 0.0, 1.2119675456389452
|
|
2492
|
+
], xyz);
|
|
2493
|
+
};
|
|
2494
|
+
/**
|
|
2495
|
+
* Convert Pro-Photo to Pro-Photo Linear
|
|
2496
|
+
*
|
|
2497
|
+
* @param p3
|
|
2498
|
+
*/
|
|
2499
|
+
var proPhotoToProPhotoLinear = function (p3) {
|
|
2500
|
+
return p3.map(function (c) {
|
|
2501
|
+
return c < 16 / 512 ? c / 16 : Math.pow(c, 1.8);
|
|
2502
|
+
});
|
|
2503
|
+
};
|
|
2504
|
+
/**
|
|
2505
|
+
* Convert Pro-Photo Linear to Pro-Photo
|
|
2506
|
+
*
|
|
2507
|
+
* @param p3
|
|
2508
|
+
*/
|
|
2509
|
+
var proPhotoLinearToProPhoto = function (p3) {
|
|
2510
|
+
return p3.map(function (c) {
|
|
2511
|
+
return c > 1 / 512 ? Math.pow(c, (1 / 1.8)) : c * 16;
|
|
2512
|
+
});
|
|
2513
|
+
};
|
|
2514
|
+
/**
|
|
2515
|
+
* Convert Pro-Photo to XYZ
|
|
2516
|
+
*
|
|
2517
|
+
* @param args
|
|
2518
|
+
*/
|
|
2519
|
+
var proPhotoToXYZ = function (args) {
|
|
2520
|
+
var prophoto_linear = proPhotoToProPhotoLinear([args[0], args[1], args[2]]);
|
|
2521
|
+
return d50toD65(proPhotoLinearToXyz([prophoto_linear[0], prophoto_linear[1], prophoto_linear[2]]));
|
|
2522
|
+
};
|
|
2523
|
+
/**
|
|
2524
|
+
* Convert XYZ to Pro-Photo
|
|
2525
|
+
*
|
|
2526
|
+
* @param args
|
|
2527
|
+
*/
|
|
2528
|
+
var proPhotoFromXYZ = function (args) {
|
|
2529
|
+
var _a = proPhotoLinearToProPhoto(xyzToProPhotoLinear(d65toD50([args[0], args[1], args[2]]))), r = _a[0], g = _a[1], b = _a[2];
|
|
2530
|
+
return [r, g, b, args[3]];
|
|
2531
|
+
};
|
|
2532
|
+
/**
|
|
2533
|
+
* Convert Pro-Photo to XYZ and Pack
|
|
2534
|
+
*
|
|
2535
|
+
* @param args
|
|
2536
|
+
*/
|
|
2537
|
+
var convertProPhoto = function (args) {
|
|
2538
|
+
var xyz = proPhotoToXYZ([args[0], args[1], args[2]]);
|
|
2539
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2540
|
+
};
|
|
2541
|
+
|
|
2542
|
+
/**
|
|
2543
|
+
* REC2020 related functions
|
|
2544
|
+
*/
|
|
2545
|
+
var _a = 1.09929682680944;
|
|
2546
|
+
var _b = 0.018053968510807;
|
|
2547
|
+
/**
|
|
2548
|
+
* Convert rec2020 to rec2020 linear
|
|
2549
|
+
*
|
|
2550
|
+
* @param rgb
|
|
2551
|
+
*/
|
|
2552
|
+
var rec20202rec2020Linear = function (rgb) {
|
|
2553
|
+
return rgb.map(function (c) {
|
|
2554
|
+
return c < _b * 4.5 ? c / 4.5 : Math.pow((c + _a - 1) / _a, 1 / 0.45);
|
|
2555
|
+
});
|
|
2556
|
+
};
|
|
2557
|
+
/**
|
|
2558
|
+
* Convert rec2020 linear to rec2020
|
|
2559
|
+
*
|
|
2560
|
+
* @param rgb
|
|
2561
|
+
*/
|
|
2562
|
+
var rec2020Linear2rec2020 = function (rgb) {
|
|
2563
|
+
return rgb.map(function (c) {
|
|
2564
|
+
return c >= _b ? _a * Math.pow(c, 0.45) - (_a - 1) : 4.5 * c;
|
|
2565
|
+
});
|
|
2566
|
+
};
|
|
2567
|
+
/**
|
|
2568
|
+
* Convert rec2020 linear to XYZ D65
|
|
2569
|
+
*
|
|
2570
|
+
* @param rec
|
|
2571
|
+
*/
|
|
2572
|
+
var rec2020LinearToXyz = function (rec) {
|
|
2573
|
+
return multiplyMatrices(
|
|
2574
|
+
// eslint-disable-next-line prettier/prettier
|
|
2575
|
+
[
|
|
2576
|
+
0.6369580483012914, 0.14461690358620832, 0.1688809751641721, 0.2627002120112671, 0.6779980715188708,
|
|
2577
|
+
0.05930171646986196, 0.0, 0.028072693049087428, 1.060985057710791
|
|
2578
|
+
], rec);
|
|
2579
|
+
};
|
|
2580
|
+
/**
|
|
2581
|
+
* Convert XYZ D65 to rec2020 linear
|
|
2582
|
+
*
|
|
2583
|
+
* @param xyz
|
|
2584
|
+
*/
|
|
2585
|
+
var xyzToRec2020Linear = function (xyz) {
|
|
2586
|
+
return multiplyMatrices(
|
|
2587
|
+
// eslint-disable-next-line prettier/prettier
|
|
2588
|
+
[
|
|
2589
|
+
1.716651187971268, -0.355670783776392, -0.25336628137366, -0.666684351832489, 1.616481236634939,
|
|
2590
|
+
0.0157685458139111, 0.017639857445311, -0.042770613257809, 0.942103121235474
|
|
2591
|
+
], xyz);
|
|
2592
|
+
};
|
|
2593
|
+
/**
|
|
2594
|
+
* Convert Rec2020 to XYZ
|
|
2595
|
+
*
|
|
2596
|
+
* @param args
|
|
2597
|
+
*/
|
|
2598
|
+
var rec2020ToXYZ = function (args) {
|
|
2599
|
+
var rec2020_linear = rec20202rec2020Linear([args[0], args[1], args[2]]);
|
|
2600
|
+
return rec2020LinearToXyz([rec2020_linear[0], rec2020_linear[1], rec2020_linear[2]]);
|
|
2601
|
+
};
|
|
2602
|
+
/**
|
|
2603
|
+
* Convert XYZ to Rec2020
|
|
2604
|
+
*
|
|
2605
|
+
* @param args
|
|
2606
|
+
*/
|
|
2607
|
+
var rec2020FromXYZ = function (args) {
|
|
2608
|
+
var _c = rec2020Linear2rec2020(xyzToRec2020Linear([args[0], args[1], args[2]])), r = _c[0], g = _c[1], b = _c[2];
|
|
2609
|
+
return [r, g, b, args[3]];
|
|
2610
|
+
};
|
|
2611
|
+
/**
|
|
2612
|
+
* Convert Rec2020 to SRGB and Pack
|
|
2613
|
+
*
|
|
2614
|
+
* @param args
|
|
2615
|
+
*/
|
|
2616
|
+
var convertRec2020 = function (args) {
|
|
2617
|
+
var xyz = rec2020ToXYZ([args[0], args[1], args[2]]);
|
|
2618
|
+
return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
2619
|
+
};
|
|
2620
|
+
|
|
2621
|
+
var color$1 = {
|
|
2622
|
+
name: 'color',
|
|
2623
|
+
parse: function (context, value) {
|
|
2624
|
+
if (value.type === 18 /* TokenType.FUNCTION */) {
|
|
2625
|
+
var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
|
|
2626
|
+
if (typeof colorFunction === 'undefined') {
|
|
2627
|
+
throw new Error("Attempting to parse an unsupported color function \"".concat(value.name, "\""));
|
|
2628
|
+
}
|
|
2629
|
+
return colorFunction(context, value.values);
|
|
2630
|
+
}
|
|
2631
|
+
if (value.type === 5 /* TokenType.HASH_TOKEN */) {
|
|
2632
|
+
var _a = hash2rgb(value), r = _a[0], g = _a[1], b = _a[2], a = _a[3];
|
|
2633
|
+
return pack(r, g, b, a);
|
|
2634
|
+
}
|
|
2635
|
+
if (value.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
2636
|
+
var namedColor = COLORS[value.value.toUpperCase()];
|
|
2637
|
+
if (typeof namedColor !== 'undefined') {
|
|
2638
|
+
return namedColor;
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
return COLORS.TRANSPARENT;
|
|
2642
|
+
}
|
|
2643
|
+
};
|
|
2644
|
+
var hash2rgb = function (token) {
|
|
2645
|
+
if (token.value.length === 3) {
|
|
2646
|
+
var r = token.value.substring(0, 1);
|
|
2647
|
+
var g = token.value.substring(1, 2);
|
|
2648
|
+
var b = token.value.substring(2, 3);
|
|
2649
|
+
return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1];
|
|
2650
|
+
}
|
|
2651
|
+
if (token.value.length === 4) {
|
|
2652
|
+
var r = token.value.substring(0, 1);
|
|
2653
|
+
var g = token.value.substring(1, 2);
|
|
2654
|
+
var b = token.value.substring(2, 3);
|
|
2655
|
+
var a = token.value.substring(3, 4);
|
|
2656
|
+
return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255];
|
|
2657
|
+
}
|
|
2658
|
+
if (token.value.length === 6) {
|
|
2659
|
+
var r = token.value.substring(0, 2);
|
|
2660
|
+
var g = token.value.substring(2, 4);
|
|
2661
|
+
var b = token.value.substring(4, 6);
|
|
2662
|
+
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1];
|
|
2663
|
+
}
|
|
2664
|
+
if (token.value.length === 8) {
|
|
2665
|
+
var r = token.value.substring(0, 2);
|
|
2666
|
+
var g = token.value.substring(2, 4);
|
|
2667
|
+
var b = token.value.substring(4, 6);
|
|
2668
|
+
var a = token.value.substring(6, 8);
|
|
2669
|
+
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255];
|
|
2670
|
+
}
|
|
2671
|
+
return [0, 0, 0, 1];
|
|
2672
|
+
};
|
|
2673
|
+
var rgb = function (_context, args) {
|
|
2674
|
+
var tokens = args.filter(nonFunctionArgSeparator);
|
|
2675
|
+
if (isRelativeTransform(tokens)) {
|
|
2676
|
+
throw new Error('Relative color not supported for rgb()');
|
|
2677
|
+
}
|
|
2678
|
+
if (tokens.length === 3) {
|
|
2679
|
+
var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2];
|
|
2680
|
+
return pack(r, g, b, 1);
|
|
2681
|
+
}
|
|
2682
|
+
if (tokens.length === 4) {
|
|
2683
|
+
var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a = _b[3];
|
|
2684
|
+
return pack(r, g, b, a);
|
|
2685
|
+
}
|
|
2686
|
+
return 0;
|
|
2687
|
+
};
|
|
2688
|
+
/**
|
|
2689
|
+
* Handle the CSS color() function
|
|
2690
|
+
*
|
|
2691
|
+
* @param context
|
|
2692
|
+
* @param args
|
|
2693
|
+
*/
|
|
2694
|
+
var _color = function (context, args) {
|
|
2695
|
+
var tokens = args.filter(nonFunctionArgSeparator), token_1_value = tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ ? tokens[0].value : 'unknown', is_absolute = !isRelativeTransform(tokens);
|
|
2696
|
+
if (is_absolute) {
|
|
2697
|
+
var color_space = token_1_value, colorSpaceFunction = SUPPORTED_COLOR_SPACES_ABSOLUTE[color_space];
|
|
2698
|
+
if (typeof colorSpaceFunction === 'undefined') {
|
|
2699
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(color_space, "\" for color() function"));
|
|
2700
|
+
}
|
|
2701
|
+
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 &&
|
|
2702
|
+
tokens[4].type === 6 /* TokenType.DELIM_TOKEN */ &&
|
|
2703
|
+
tokens[4].value === '/' &&
|
|
2704
|
+
isNumberToken(tokens[5])
|
|
2705
|
+
? tokens[5].number
|
|
2706
|
+
: 1;
|
|
2707
|
+
return colorSpaceFunction([c1, c2, c3, a]);
|
|
2708
|
+
}
|
|
2709
|
+
else {
|
|
2710
|
+
var extractComponent = function (color, token) {
|
|
2711
|
+
if (isNumberToken(token)) {
|
|
2712
|
+
return token.number;
|
|
2713
|
+
}
|
|
2714
|
+
var posFromVal = function (value) {
|
|
2715
|
+
return value === 'r' || value === 'x' ? 0 : value === 'g' || value === 'y' ? 1 : 2;
|
|
2716
|
+
};
|
|
2717
|
+
if (isIdentToken(token)) {
|
|
2718
|
+
var position = posFromVal(token.value);
|
|
2719
|
+
return color[position];
|
|
2720
|
+
}
|
|
2721
|
+
var parseCalc = function (args) {
|
|
2722
|
+
var parts = args.filter(nonFunctionArgSeparator);
|
|
2723
|
+
var expression = '(';
|
|
2724
|
+
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
2725
|
+
var part = parts_1[_i];
|
|
2726
|
+
expression +=
|
|
2727
|
+
part.type === 18 /* TokenType.FUNCTION */ && part.name === 'calc'
|
|
2728
|
+
? parseCalc(part.values)
|
|
2729
|
+
: isNumberToken(part)
|
|
2730
|
+
? part.number
|
|
2731
|
+
: part.type === 6 /* TokenType.DELIM_TOKEN */ || isIdentToken(part)
|
|
2732
|
+
? part.value
|
|
2733
|
+
: '';
|
|
2734
|
+
}
|
|
2735
|
+
expression += ')';
|
|
2736
|
+
return expression;
|
|
2737
|
+
};
|
|
2738
|
+
if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
2739
|
+
var args_1 = token.values.filter(nonFunctionArgSeparator);
|
|
2740
|
+
if (token.name === 'calc') {
|
|
2741
|
+
var expression = parseCalc(args_1)
|
|
2742
|
+
.replace(/r|x/, color[0].toString())
|
|
2743
|
+
.replace(/g|y/, color[1].toString())
|
|
2744
|
+
.replace(/b|z/, color[2].toString());
|
|
2745
|
+
return new Function('return ' + expression)();
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
return null;
|
|
2749
|
+
};
|
|
2750
|
+
var from_colorspace = tokens[1].type === 18 /* TokenType.FUNCTION */
|
|
2751
|
+
? tokens[1].name
|
|
2752
|
+
: isIdentToken(tokens[1]) || tokens[1].type === 5 /* TokenType.HASH_TOKEN */
|
|
2753
|
+
? 'rgb'
|
|
2754
|
+
: 'unknown', to_colorspace = isIdentToken(tokens[2]) ? tokens[2].value : 'unknown';
|
|
2755
|
+
var from = tokens[1].type === 18 /* TokenType.FUNCTION */ ? tokens[1].values : isIdentToken(tokens[1]) ? [tokens[1]] : [];
|
|
2756
|
+
if (isIdentToken(tokens[1])) {
|
|
2757
|
+
var named_color = COLORS[tokens[1].value.toUpperCase()];
|
|
2758
|
+
if (typeof named_color === 'undefined') {
|
|
2759
|
+
throw new Error("Attempting to use unknown color in relative color 'from'");
|
|
2760
|
+
}
|
|
2761
|
+
else {
|
|
2762
|
+
var _c = parseColor(context, tokens[1].value), alpha = 0xff & _c, blue = 0xff & (_c >> 8), green = 0xff & (_c >> 16), red = 0xff & (_c >> 24);
|
|
2763
|
+
from = [
|
|
2764
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: red, flags: 1 },
|
|
2765
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: green, flags: 1 },
|
|
2766
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: blue, flags: 1 },
|
|
2767
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: alpha > 1 ? alpha / 255 : alpha, flags: 1 }
|
|
2768
|
+
];
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
else if (tokens[1].type === 5 /* TokenType.HASH_TOKEN */) {
|
|
2772
|
+
var _a = hash2rgb(tokens[1]), red = _a[0], green = _a[1], blue = _a[2], alpha = _a[3];
|
|
2773
|
+
from = [
|
|
2774
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: red, flags: 1 },
|
|
2775
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: green, flags: 1 },
|
|
2776
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: blue, flags: 1 },
|
|
2777
|
+
{ type: 17 /* TokenType.NUMBER_TOKEN */, number: alpha > 1 ? alpha / 255 : alpha, flags: 1 }
|
|
2778
|
+
];
|
|
2779
|
+
}
|
|
2780
|
+
if (from.length === 0) {
|
|
2781
|
+
throw new Error("Attempting to use unknown color in relative color 'from'");
|
|
2782
|
+
}
|
|
2783
|
+
if (to_colorspace === 'unknown') {
|
|
2784
|
+
throw new Error("Attempting to use unknown colorspace in relative color 'to'");
|
|
2785
|
+
}
|
|
2786
|
+
var fromColorToXyz = SUPPORTED_COLOR_SPACES_TO_XYZ[from_colorspace], toColorFromXyz = SUPPORTED_COLOR_SPACES_FROM_XYZ[to_colorspace], toColorPack = SUPPORTED_COLOR_SPACES_ABSOLUTE[to_colorspace];
|
|
2787
|
+
if (typeof fromColorToXyz === 'undefined') {
|
|
2788
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(from_colorspace, "\" for color() function"));
|
|
2789
|
+
}
|
|
2790
|
+
if (typeof toColorFromXyz === 'undefined') {
|
|
2791
|
+
throw new Error("Attempting to parse an unsupported color space \"".concat(to_colorspace, "\" for color() function"));
|
|
2792
|
+
}
|
|
2793
|
+
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 &&
|
|
2794
|
+
tokens[6].type === 6 /* TokenType.DELIM_TOKEN */ &&
|
|
2795
|
+
tokens[6].value === '/' &&
|
|
2796
|
+
isNumberToken(tokens[7])
|
|
2797
|
+
? tokens[7].number
|
|
2798
|
+
: 1;
|
|
2799
|
+
if (c1 === null || c2 === null || c3 === null) {
|
|
2800
|
+
throw new Error("Invalid relative color in color() function");
|
|
2801
|
+
}
|
|
2802
|
+
return toColorPack([c1, c2, c3, a]);
|
|
2803
|
+
}
|
|
2804
|
+
};
|
|
2805
|
+
var SUPPORTED_COLOR_SPACES_ABSOLUTE = {
|
|
2806
|
+
srgb: packSrgb,
|
|
2807
|
+
'srgb-linear': packSrgbLinear,
|
|
2808
|
+
'display-p3': convertP3,
|
|
2809
|
+
'a98-rgb': convertA98rgb,
|
|
2810
|
+
'prophoto-rgb': convertProPhoto,
|
|
2811
|
+
xyz: convertXyz,
|
|
2812
|
+
'xyz-d50': convertXyz50,
|
|
2813
|
+
'xyz-d65': convertXyz,
|
|
2814
|
+
rec2020: convertRec2020
|
|
2815
|
+
};
|
|
2816
|
+
var SUPPORTED_COLOR_SPACES_TO_XYZ = {
|
|
2817
|
+
rgb: rgbToXyz,
|
|
2818
|
+
hsl: hslToXyz,
|
|
2819
|
+
lab: labToXyz,
|
|
2820
|
+
lch: lchToXyz,
|
|
2821
|
+
oklab: oklabToXyz,
|
|
2822
|
+
oklch: oklchToXyz
|
|
2823
|
+
};
|
|
2824
|
+
var SUPPORTED_COLOR_SPACES_FROM_XYZ = {
|
|
2825
|
+
srgb: srgbFromXYZ,
|
|
2826
|
+
'srgb-linear': srgbLinearFromXYZ,
|
|
2827
|
+
'display-p3': p3FromXYZ,
|
|
2828
|
+
'a98-rgb': a98FromXYZ,
|
|
2829
|
+
'prophoto-rgb': proPhotoFromXYZ,
|
|
2830
|
+
xyz: xyzFromXYZ,
|
|
2831
|
+
'xyz-d50': xyz50FromXYZ,
|
|
2832
|
+
'xyz-d65': xyzFromXYZ,
|
|
2833
|
+
rec2020: rec2020FromXYZ
|
|
1972
2834
|
};
|
|
1973
2835
|
var SUPPORTED_COLOR_FUNCTIONS = {
|
|
1974
|
-
hsl:
|
|
1975
|
-
hsla:
|
|
2836
|
+
hsl: packHSL,
|
|
2837
|
+
hsla: packHSL,
|
|
1976
2838
|
rgb: rgb,
|
|
1977
|
-
rgba: rgb
|
|
2839
|
+
rgba: rgb,
|
|
2840
|
+
lch: packLch,
|
|
2841
|
+
oklch: packOkLch,
|
|
2842
|
+
oklab: packOkLab,
|
|
2843
|
+
lab: packLab,
|
|
2844
|
+
color: _color
|
|
1978
2845
|
};
|
|
1979
2846
|
var parseColor = function (context, value) {
|
|
1980
2847
|
return color$1.parse(context, Parser.create(value).parseComponentValue());
|
|
@@ -2135,18 +3002,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2135
3002
|
name: 'background-clip',
|
|
2136
3003
|
initialValue: 'border-box',
|
|
2137
3004
|
prefix: false,
|
|
2138
|
-
type: 1 /* LIST */,
|
|
3005
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2139
3006
|
parse: function (_context, tokens) {
|
|
2140
3007
|
return tokens.map(function (token) {
|
|
2141
3008
|
if (isIdentToken(token)) {
|
|
2142
3009
|
switch (token.value) {
|
|
2143
3010
|
case 'padding-box':
|
|
2144
|
-
return 1 /* PADDING_BOX */;
|
|
3011
|
+
return 1 /* BACKGROUND_CLIP.PADDING_BOX */;
|
|
2145
3012
|
case 'content-box':
|
|
2146
|
-
return 2 /* CONTENT_BOX */;
|
|
3013
|
+
return 2 /* BACKGROUND_CLIP.CONTENT_BOX */;
|
|
2147
3014
|
}
|
|
2148
3015
|
}
|
|
2149
|
-
return 0 /* BORDER_BOX */;
|
|
3016
|
+
return 0 /* BACKGROUND_CLIP.BORDER_BOX */;
|
|
2150
3017
|
});
|
|
2151
3018
|
}
|
|
2152
3019
|
};
|
|
@@ -2155,7 +3022,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2155
3022
|
name: "background-color",
|
|
2156
3023
|
initialValue: 'transparent',
|
|
2157
3024
|
prefix: false,
|
|
2158
|
-
type: 3 /* TYPE_VALUE */,
|
|
3025
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2159
3026
|
format: 'color'
|
|
2160
3027
|
};
|
|
2161
3028
|
|
|
@@ -2258,24 +3125,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2258
3125
|
var rx = 0;
|
|
2259
3126
|
var ry = 0;
|
|
2260
3127
|
switch (gradient.size) {
|
|
2261
|
-
case 0 /* CLOSEST_SIDE */:
|
|
3128
|
+
case 0 /* CSSRadialExtent.CLOSEST_SIDE */:
|
|
2262
3129
|
// The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center.
|
|
2263
3130
|
// If the shape is an ellipse, it exactly meets the closest side in each dimension.
|
|
2264
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3131
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2265
3132
|
rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
|
|
2266
3133
|
}
|
|
2267
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3134
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2268
3135
|
rx = Math.min(Math.abs(x), Math.abs(x - width));
|
|
2269
3136
|
ry = Math.min(Math.abs(y), Math.abs(y - height));
|
|
2270
3137
|
}
|
|
2271
3138
|
break;
|
|
2272
|
-
case 2 /* CLOSEST_CORNER */:
|
|
3139
|
+
case 2 /* CSSRadialExtent.CLOSEST_CORNER */:
|
|
2273
3140
|
// The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center.
|
|
2274
3141
|
// If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified.
|
|
2275
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3142
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2276
3143
|
rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
|
|
2277
3144
|
}
|
|
2278
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3145
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2279
3146
|
// Compute the ratio ry/rx (which is to be the same as for "closest-side")
|
|
2280
3147
|
var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width));
|
|
2281
3148
|
var _a = findCorner(width, height, x, y, true), cx = _a[0], cy = _a[1];
|
|
@@ -2283,23 +3150,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2283
3150
|
ry = c * rx;
|
|
2284
3151
|
}
|
|
2285
3152
|
break;
|
|
2286
|
-
case 1 /* FARTHEST_SIDE */:
|
|
3153
|
+
case 1 /* CSSRadialExtent.FARTHEST_SIDE */:
|
|
2287
3154
|
// Same as closest-side, except the ending shape is sized based on the farthest side(s)
|
|
2288
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3155
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2289
3156
|
rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
|
|
2290
3157
|
}
|
|
2291
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3158
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2292
3159
|
rx = Math.max(Math.abs(x), Math.abs(x - width));
|
|
2293
3160
|
ry = Math.max(Math.abs(y), Math.abs(y - height));
|
|
2294
3161
|
}
|
|
2295
3162
|
break;
|
|
2296
|
-
case 3 /* FARTHEST_CORNER */:
|
|
3163
|
+
case 3 /* CSSRadialExtent.FARTHEST_CORNER */:
|
|
2297
3164
|
// Same as closest-corner, except the ending shape is sized based on the farthest corner.
|
|
2298
3165
|
// If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified.
|
|
2299
|
-
if (gradient.shape === 0 /* CIRCLE */) {
|
|
3166
|
+
if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
|
|
2300
3167
|
rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
|
|
2301
3168
|
}
|
|
2302
|
-
else if (gradient.shape === 1 /* ELLIPSE */) {
|
|
3169
|
+
else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
|
|
2303
3170
|
// Compute the ratio ry/rx (which is to be the same as for "farthest-side")
|
|
2304
3171
|
var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width));
|
|
2305
3172
|
var _b = findCorner(width, height, x, y, false), cx = _b[0], cy = _b[1];
|
|
@@ -2321,7 +3188,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2321
3188
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2322
3189
|
if (i === 0) {
|
|
2323
3190
|
var firstToken = arg[0];
|
|
2324
|
-
if (firstToken.type === 20 /* IDENT_TOKEN */ && firstToken.value === 'to') {
|
|
3191
|
+
if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ && firstToken.value === 'to') {
|
|
2325
3192
|
angle$1 = parseNamedSide(arg);
|
|
2326
3193
|
return;
|
|
2327
3194
|
}
|
|
@@ -2333,7 +3200,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2333
3200
|
var colorStop = parseColorStop(context, arg);
|
|
2334
3201
|
stops.push(colorStop);
|
|
2335
3202
|
});
|
|
2336
|
-
return { angle: angle$1, stops: stops, type: 1 /* LINEAR_GRADIENT */ };
|
|
3203
|
+
return { angle: angle$1, stops: stops, type: 1 /* CSSImageType.LINEAR_GRADIENT */ };
|
|
2337
3204
|
};
|
|
2338
3205
|
|
|
2339
3206
|
var prefixLinearGradient = function (context, tokens) {
|
|
@@ -2342,7 +3209,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2342
3209
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2343
3210
|
if (i === 0) {
|
|
2344
3211
|
var firstToken = arg[0];
|
|
2345
|
-
if (firstToken.type === 20 /* IDENT_TOKEN */ &&
|
|
3212
|
+
if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ &&
|
|
2346
3213
|
['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) {
|
|
2347
3214
|
angle$1 = parseNamedSide(arg);
|
|
2348
3215
|
return;
|
|
@@ -2358,30 +3225,30 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2358
3225
|
return {
|
|
2359
3226
|
angle: angle$1,
|
|
2360
3227
|
stops: stops,
|
|
2361
|
-
type: 1 /* LINEAR_GRADIENT */
|
|
3228
|
+
type: 1 /* CSSImageType.LINEAR_GRADIENT */
|
|
2362
3229
|
};
|
|
2363
3230
|
};
|
|
2364
3231
|
|
|
2365
3232
|
var webkitGradient = function (context, tokens) {
|
|
2366
3233
|
var angle = deg(180);
|
|
2367
3234
|
var stops = [];
|
|
2368
|
-
var type = 1 /* LINEAR_GRADIENT */;
|
|
2369
|
-
var shape = 0 /* CIRCLE */;
|
|
2370
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3235
|
+
var type = 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
3236
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3237
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2371
3238
|
var position = [];
|
|
2372
3239
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
2373
3240
|
var firstToken = arg[0];
|
|
2374
3241
|
if (i === 0) {
|
|
2375
3242
|
if (isIdentToken(firstToken) && firstToken.value === 'linear') {
|
|
2376
|
-
type = 1 /* LINEAR_GRADIENT */;
|
|
3243
|
+
type = 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
2377
3244
|
return;
|
|
2378
3245
|
}
|
|
2379
3246
|
else if (isIdentToken(firstToken) && firstToken.value === 'radial') {
|
|
2380
|
-
type = 2 /* RADIAL_GRADIENT */;
|
|
3247
|
+
type = 2 /* CSSImageType.RADIAL_GRADIENT */;
|
|
2381
3248
|
return;
|
|
2382
3249
|
}
|
|
2383
3250
|
}
|
|
2384
|
-
if (firstToken.type === 18 /* FUNCTION */) {
|
|
3251
|
+
if (firstToken.type === 18 /* TokenType.FUNCTION */) {
|
|
2385
3252
|
if (firstToken.name === 'from') {
|
|
2386
3253
|
var color = color$1.parse(context, firstToken.values[0]);
|
|
2387
3254
|
stops.push({ stop: ZERO_LENGTH, color: color });
|
|
@@ -2397,7 +3264,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2397
3264
|
var stop_1 = values[0];
|
|
2398
3265
|
if (isNumberToken(stop_1)) {
|
|
2399
3266
|
stops.push({
|
|
2400
|
-
stop: { type: 16 /* PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
|
|
3267
|
+
stop: { type: 16 /* TokenType.PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
|
|
2401
3268
|
color: color
|
|
2402
3269
|
});
|
|
2403
3270
|
}
|
|
@@ -2405,7 +3272,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2405
3272
|
}
|
|
2406
3273
|
}
|
|
2407
3274
|
});
|
|
2408
|
-
return type === 1 /* LINEAR_GRADIENT */
|
|
3275
|
+
return type === 1 /* CSSImageType.LINEAR_GRADIENT */
|
|
2409
3276
|
? {
|
|
2410
3277
|
angle: (angle + deg(180)) % deg(360),
|
|
2411
3278
|
stops: stops,
|
|
@@ -2423,8 +3290,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2423
3290
|
var COVER = 'cover';
|
|
2424
3291
|
var CONTAIN = 'contain';
|
|
2425
3292
|
var radialGradient = function (context, tokens) {
|
|
2426
|
-
var shape = 0 /* CIRCLE */;
|
|
2427
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3293
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3294
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2428
3295
|
var stops = [];
|
|
2429
3296
|
var position = [];
|
|
2430
3297
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
@@ -2455,27 +3322,27 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2455
3322
|
else if (isIdentToken(token)) {
|
|
2456
3323
|
switch (token.value) {
|
|
2457
3324
|
case CIRCLE:
|
|
2458
|
-
shape = 0 /* CIRCLE */;
|
|
3325
|
+
shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
2459
3326
|
return false;
|
|
2460
3327
|
case ELLIPSE:
|
|
2461
|
-
shape = 1 /* ELLIPSE */;
|
|
3328
|
+
shape = 1 /* CSSRadialShape.ELLIPSE */;
|
|
2462
3329
|
return false;
|
|
2463
3330
|
case 'at':
|
|
2464
3331
|
isAtPosition_1 = true;
|
|
2465
3332
|
return false;
|
|
2466
3333
|
case CLOSEST_SIDE:
|
|
2467
|
-
size = 0 /* CLOSEST_SIDE */;
|
|
3334
|
+
size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
|
|
2468
3335
|
return false;
|
|
2469
3336
|
case COVER:
|
|
2470
3337
|
case FARTHEST_SIDE:
|
|
2471
|
-
size = 1 /* FARTHEST_SIDE */;
|
|
3338
|
+
size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
|
|
2472
3339
|
return false;
|
|
2473
3340
|
case CONTAIN:
|
|
2474
3341
|
case CLOSEST_CORNER:
|
|
2475
|
-
size = 2 /* CLOSEST_CORNER */;
|
|
3342
|
+
size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
|
|
2476
3343
|
return false;
|
|
2477
3344
|
case FARTHEST_CORNER:
|
|
2478
|
-
size = 3 /* FARTHEST_CORNER */;
|
|
3345
|
+
size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2479
3346
|
return false;
|
|
2480
3347
|
}
|
|
2481
3348
|
}
|
|
@@ -2494,12 +3361,12 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2494
3361
|
stops.push(colorStop);
|
|
2495
3362
|
}
|
|
2496
3363
|
});
|
|
2497
|
-
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
|
|
3364
|
+
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* CSSImageType.RADIAL_GRADIENT */ };
|
|
2498
3365
|
};
|
|
2499
3366
|
|
|
2500
3367
|
var prefixRadialGradient = function (context, tokens) {
|
|
2501
|
-
var shape = 0 /* CIRCLE */;
|
|
2502
|
-
var size = 3 /* FARTHEST_CORNER */;
|
|
3368
|
+
var shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
3369
|
+
var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2503
3370
|
var stops = [];
|
|
2504
3371
|
var position = [];
|
|
2505
3372
|
parseFunctionArgs(tokens).forEach(function (arg, i) {
|
|
@@ -2533,24 +3400,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2533
3400
|
if (isIdentToken(token)) {
|
|
2534
3401
|
switch (token.value) {
|
|
2535
3402
|
case CIRCLE:
|
|
2536
|
-
shape = 0 /* CIRCLE */;
|
|
3403
|
+
shape = 0 /* CSSRadialShape.CIRCLE */;
|
|
2537
3404
|
return false;
|
|
2538
3405
|
case ELLIPSE:
|
|
2539
|
-
shape = 1 /* ELLIPSE */;
|
|
3406
|
+
shape = 1 /* CSSRadialShape.ELLIPSE */;
|
|
2540
3407
|
return false;
|
|
2541
3408
|
case CONTAIN:
|
|
2542
3409
|
case CLOSEST_SIDE:
|
|
2543
|
-
size = 0 /* CLOSEST_SIDE */;
|
|
3410
|
+
size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
|
|
2544
3411
|
return false;
|
|
2545
3412
|
case FARTHEST_SIDE:
|
|
2546
|
-
size = 1 /* FARTHEST_SIDE */;
|
|
3413
|
+
size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
|
|
2547
3414
|
return false;
|
|
2548
3415
|
case CLOSEST_CORNER:
|
|
2549
|
-
size = 2 /* CLOSEST_CORNER */;
|
|
3416
|
+
size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
|
|
2550
3417
|
return false;
|
|
2551
3418
|
case COVER:
|
|
2552
3419
|
case FARTHEST_CORNER:
|
|
2553
|
-
size = 3 /* FARTHEST_CORNER */;
|
|
3420
|
+
size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
|
|
2554
3421
|
return false;
|
|
2555
3422
|
}
|
|
2556
3423
|
}
|
|
@@ -2569,36 +3436,36 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2569
3436
|
stops.push(colorStop);
|
|
2570
3437
|
}
|
|
2571
3438
|
});
|
|
2572
|
-
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
|
|
3439
|
+
return { size: size, shape: shape, stops: stops, position: position, type: 2 /* CSSImageType.RADIAL_GRADIENT */ };
|
|
2573
3440
|
};
|
|
2574
3441
|
|
|
2575
3442
|
var isLinearGradient = function (background) {
|
|
2576
|
-
return background.type === 1 /* LINEAR_GRADIENT */;
|
|
3443
|
+
return background.type === 1 /* CSSImageType.LINEAR_GRADIENT */;
|
|
2577
3444
|
};
|
|
2578
3445
|
var isRadialGradient = function (background) {
|
|
2579
|
-
return background.type === 2 /* RADIAL_GRADIENT */;
|
|
3446
|
+
return background.type === 2 /* CSSImageType.RADIAL_GRADIENT */;
|
|
2580
3447
|
};
|
|
2581
3448
|
var image = {
|
|
2582
3449
|
name: 'image',
|
|
2583
3450
|
parse: function (context, value) {
|
|
2584
|
-
if (value.type === 22 /* URL_TOKEN */) {
|
|
2585
|
-
var image_1 = { url: value.value, type: 0 /* URL */ };
|
|
3451
|
+
if (value.type === 22 /* TokenType.URL_TOKEN */) {
|
|
3452
|
+
var image_1 = { url: value.value, type: 0 /* CSSImageType.URL */ };
|
|
2586
3453
|
context.cache.addImage(value.value);
|
|
2587
3454
|
return image_1;
|
|
2588
3455
|
}
|
|
2589
|
-
if (value.type === 18 /* FUNCTION */) {
|
|
3456
|
+
if (value.type === 18 /* TokenType.FUNCTION */) {
|
|
2590
3457
|
var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name];
|
|
2591
3458
|
if (typeof imageFunction === 'undefined') {
|
|
2592
|
-
throw new Error("Attempting to parse an unsupported image function \""
|
|
3459
|
+
throw new Error("Attempting to parse an unsupported image function \"".concat(value.name, "\""));
|
|
2593
3460
|
}
|
|
2594
3461
|
return imageFunction(context, value.values);
|
|
2595
3462
|
}
|
|
2596
|
-
throw new Error("Unsupported image type "
|
|
3463
|
+
throw new Error("Unsupported image type ".concat(value.type));
|
|
2597
3464
|
}
|
|
2598
3465
|
};
|
|
2599
3466
|
function isSupportedImage(value) {
|
|
2600
|
-
return (!(value.type === 20 /* IDENT_TOKEN */ && value.value === 'none') &&
|
|
2601
|
-
(value.type !== 18 /* FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]));
|
|
3467
|
+
return (!(value.type === 20 /* TokenType.IDENT_TOKEN */ && value.value === 'none') &&
|
|
3468
|
+
(value.type !== 18 /* TokenType.FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]));
|
|
2602
3469
|
}
|
|
2603
3470
|
var SUPPORTED_IMAGE_FUNCTIONS = {
|
|
2604
3471
|
'linear-gradient': linearGradient,
|
|
@@ -2617,14 +3484,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2617
3484
|
var backgroundImage = {
|
|
2618
3485
|
name: 'background-image',
|
|
2619
3486
|
initialValue: 'none',
|
|
2620
|
-
type: 1 /* LIST */,
|
|
3487
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2621
3488
|
prefix: false,
|
|
2622
3489
|
parse: function (context, tokens) {
|
|
2623
3490
|
if (tokens.length === 0) {
|
|
2624
3491
|
return [];
|
|
2625
3492
|
}
|
|
2626
3493
|
var first = tokens[0];
|
|
2627
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
3494
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
2628
3495
|
return [];
|
|
2629
3496
|
}
|
|
2630
3497
|
return tokens
|
|
@@ -2637,18 +3504,18 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2637
3504
|
name: 'background-origin',
|
|
2638
3505
|
initialValue: 'border-box',
|
|
2639
3506
|
prefix: false,
|
|
2640
|
-
type: 1 /* LIST */,
|
|
3507
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2641
3508
|
parse: function (_context, tokens) {
|
|
2642
3509
|
return tokens.map(function (token) {
|
|
2643
3510
|
if (isIdentToken(token)) {
|
|
2644
3511
|
switch (token.value) {
|
|
2645
3512
|
case 'padding-box':
|
|
2646
|
-
return 1 /* PADDING_BOX */;
|
|
3513
|
+
return 1 /* BACKGROUND_ORIGIN.PADDING_BOX */;
|
|
2647
3514
|
case 'content-box':
|
|
2648
|
-
return 2 /* CONTENT_BOX */;
|
|
3515
|
+
return 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */;
|
|
2649
3516
|
}
|
|
2650
3517
|
}
|
|
2651
|
-
return 0 /* BORDER_BOX */;
|
|
3518
|
+
return 0 /* BACKGROUND_ORIGIN.BORDER_BOX */;
|
|
2652
3519
|
});
|
|
2653
3520
|
}
|
|
2654
3521
|
};
|
|
@@ -2656,7 +3523,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2656
3523
|
var backgroundPosition = {
|
|
2657
3524
|
name: 'background-position',
|
|
2658
3525
|
initialValue: '0% 0%',
|
|
2659
|
-
type: 1 /* LIST */,
|
|
3526
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2660
3527
|
prefix: false,
|
|
2661
3528
|
parse: function (_context, tokens) {
|
|
2662
3529
|
return parseFunctionArgs(tokens)
|
|
@@ -2669,7 +3536,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2669
3536
|
name: 'background-repeat',
|
|
2670
3537
|
initialValue: 'repeat',
|
|
2671
3538
|
prefix: false,
|
|
2672
|
-
type: 1 /* LIST */,
|
|
3539
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2673
3540
|
parse: function (_context, tokens) {
|
|
2674
3541
|
return parseFunctionArgs(tokens)
|
|
2675
3542
|
.map(function (values) {
|
|
@@ -2684,16 +3551,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2684
3551
|
var parseBackgroundRepeat = function (value) {
|
|
2685
3552
|
switch (value) {
|
|
2686
3553
|
case 'no-repeat':
|
|
2687
|
-
return 1 /* NO_REPEAT */;
|
|
3554
|
+
return 1 /* BACKGROUND_REPEAT.NO_REPEAT */;
|
|
2688
3555
|
case 'repeat-x':
|
|
2689
3556
|
case 'repeat no-repeat':
|
|
2690
|
-
return 2 /* REPEAT_X */;
|
|
3557
|
+
return 2 /* BACKGROUND_REPEAT.REPEAT_X */;
|
|
2691
3558
|
case 'repeat-y':
|
|
2692
3559
|
case 'no-repeat repeat':
|
|
2693
|
-
return 3 /* REPEAT_Y */;
|
|
3560
|
+
return 3 /* BACKGROUND_REPEAT.REPEAT_Y */;
|
|
2694
3561
|
case 'repeat':
|
|
2695
3562
|
default:
|
|
2696
|
-
return 0 /* REPEAT */;
|
|
3563
|
+
return 0 /* BACKGROUND_REPEAT.REPEAT */;
|
|
2697
3564
|
}
|
|
2698
3565
|
};
|
|
2699
3566
|
|
|
@@ -2707,7 +3574,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2707
3574
|
name: 'background-size',
|
|
2708
3575
|
initialValue: '0',
|
|
2709
3576
|
prefix: false,
|
|
2710
|
-
type: 1 /* LIST */,
|
|
3577
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2711
3578
|
parse: function (_context, tokens) {
|
|
2712
3579
|
return parseFunctionArgs(tokens).map(function (values) { return values.filter(isBackgroundSizeInfoToken); });
|
|
2713
3580
|
}
|
|
@@ -2717,10 +3584,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2717
3584
|
};
|
|
2718
3585
|
|
|
2719
3586
|
var borderColorForSide = function (side) { return ({
|
|
2720
|
-
name: "border-"
|
|
3587
|
+
name: "border-".concat(side, "-color"),
|
|
2721
3588
|
initialValue: 'transparent',
|
|
2722
3589
|
prefix: false,
|
|
2723
|
-
type: 3 /* TYPE_VALUE */,
|
|
3590
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2724
3591
|
format: 'color'
|
|
2725
3592
|
}); };
|
|
2726
3593
|
var borderTopColor = borderColorForSide('top');
|
|
@@ -2729,10 +3596,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2729
3596
|
var borderLeftColor = borderColorForSide('left');
|
|
2730
3597
|
|
|
2731
3598
|
var borderRadiusForSide = function (side) { return ({
|
|
2732
|
-
name: "border-radius-"
|
|
3599
|
+
name: "border-radius-".concat(side),
|
|
2733
3600
|
initialValue: '0 0',
|
|
2734
3601
|
prefix: false,
|
|
2735
|
-
type: 1 /* LIST */,
|
|
3602
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2736
3603
|
parse: function (_context, tokens) {
|
|
2737
3604
|
return parseLengthPercentageTuple(tokens.filter(isLengthPercentage));
|
|
2738
3605
|
}
|
|
@@ -2743,22 +3610,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2743
3610
|
var borderBottomLeftRadius = borderRadiusForSide('bottom-left');
|
|
2744
3611
|
|
|
2745
3612
|
var borderStyleForSide = function (side) { return ({
|
|
2746
|
-
name: "border-"
|
|
3613
|
+
name: "border-".concat(side, "-style"),
|
|
2747
3614
|
initialValue: 'solid',
|
|
2748
3615
|
prefix: false,
|
|
2749
|
-
type: 2 /* IDENT_VALUE */,
|
|
3616
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2750
3617
|
parse: function (_context, style) {
|
|
2751
3618
|
switch (style) {
|
|
2752
3619
|
case 'none':
|
|
2753
|
-
return 0 /* NONE */;
|
|
3620
|
+
return 0 /* BORDER_STYLE.NONE */;
|
|
2754
3621
|
case 'dashed':
|
|
2755
|
-
return 2 /* DASHED */;
|
|
3622
|
+
return 2 /* BORDER_STYLE.DASHED */;
|
|
2756
3623
|
case 'dotted':
|
|
2757
|
-
return 3 /* DOTTED */;
|
|
3624
|
+
return 3 /* BORDER_STYLE.DOTTED */;
|
|
2758
3625
|
case 'double':
|
|
2759
|
-
return 4 /* DOUBLE */;
|
|
3626
|
+
return 4 /* BORDER_STYLE.DOUBLE */;
|
|
2760
3627
|
}
|
|
2761
|
-
return 1 /* SOLID */;
|
|
3628
|
+
return 1 /* BORDER_STYLE.SOLID */;
|
|
2762
3629
|
}
|
|
2763
3630
|
}); };
|
|
2764
3631
|
var borderTopStyle = borderStyleForSide('top');
|
|
@@ -2767,9 +3634,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2767
3634
|
var borderLeftStyle = borderStyleForSide('left');
|
|
2768
3635
|
|
|
2769
3636
|
var borderWidthForSide = function (side) { return ({
|
|
2770
|
-
name: "border-"
|
|
3637
|
+
name: "border-".concat(side, "-width"),
|
|
2771
3638
|
initialValue: '0',
|
|
2772
|
-
type: 0 /* VALUE */,
|
|
3639
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2773
3640
|
prefix: false,
|
|
2774
3641
|
parse: function (_context, token) {
|
|
2775
3642
|
if (isDimensionToken(token)) {
|
|
@@ -2787,7 +3654,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2787
3654
|
name: "color",
|
|
2788
3655
|
initialValue: 'transparent',
|
|
2789
3656
|
prefix: false,
|
|
2790
|
-
type: 3 /* TYPE_VALUE */,
|
|
3657
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
2791
3658
|
format: 'color'
|
|
2792
3659
|
};
|
|
2793
3660
|
|
|
@@ -2795,14 +3662,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2795
3662
|
name: 'direction',
|
|
2796
3663
|
initialValue: 'ltr',
|
|
2797
3664
|
prefix: false,
|
|
2798
|
-
type: 2 /* IDENT_VALUE */,
|
|
3665
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2799
3666
|
parse: function (_context, direction) {
|
|
2800
3667
|
switch (direction) {
|
|
2801
3668
|
case 'rtl':
|
|
2802
|
-
return 1 /* RTL */;
|
|
3669
|
+
return 1 /* DIRECTION.RTL */;
|
|
2803
3670
|
case 'ltr':
|
|
2804
3671
|
default:
|
|
2805
|
-
return 0 /* LTR */;
|
|
3672
|
+
return 0 /* DIRECTION.LTR */;
|
|
2806
3673
|
}
|
|
2807
3674
|
}
|
|
2808
3675
|
};
|
|
@@ -2811,97 +3678,97 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2811
3678
|
name: 'display',
|
|
2812
3679
|
initialValue: 'inline-block',
|
|
2813
3680
|
prefix: false,
|
|
2814
|
-
type: 1 /* LIST */,
|
|
3681
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
2815
3682
|
parse: function (_context, tokens) {
|
|
2816
3683
|
return tokens.filter(isIdentToken).reduce(function (bit, token) {
|
|
2817
|
-
return bit | parseDisplayValue(token.value);
|
|
2818
|
-
}, 0 /* NONE */);
|
|
3684
|
+
return bit | parseDisplayValue$1(token.value);
|
|
3685
|
+
}, 0 /* DISPLAY.NONE */);
|
|
2819
3686
|
}
|
|
2820
3687
|
};
|
|
2821
|
-
var parseDisplayValue = function (display) {
|
|
3688
|
+
var parseDisplayValue$1 = function (display) {
|
|
2822
3689
|
switch (display) {
|
|
2823
3690
|
case 'block':
|
|
2824
3691
|
case '-webkit-box':
|
|
2825
|
-
return 2 /* BLOCK */;
|
|
3692
|
+
return 2 /* DISPLAY.BLOCK */;
|
|
2826
3693
|
case 'inline':
|
|
2827
|
-
return 4 /* INLINE */;
|
|
3694
|
+
return 4 /* DISPLAY.INLINE */;
|
|
2828
3695
|
case 'run-in':
|
|
2829
|
-
return 8 /* RUN_IN */;
|
|
3696
|
+
return 8 /* DISPLAY.RUN_IN */;
|
|
2830
3697
|
case 'flow':
|
|
2831
|
-
return 16 /* FLOW */;
|
|
3698
|
+
return 16 /* DISPLAY.FLOW */;
|
|
2832
3699
|
case 'flow-root':
|
|
2833
|
-
return 32 /* FLOW_ROOT */;
|
|
3700
|
+
return 32 /* DISPLAY.FLOW_ROOT */;
|
|
2834
3701
|
case 'table':
|
|
2835
|
-
return 64 /* TABLE */;
|
|
3702
|
+
return 64 /* DISPLAY.TABLE */;
|
|
2836
3703
|
case 'flex':
|
|
2837
3704
|
case '-webkit-flex':
|
|
2838
|
-
return 128 /* FLEX */;
|
|
3705
|
+
return 128 /* DISPLAY.FLEX */;
|
|
2839
3706
|
case 'grid':
|
|
2840
3707
|
case '-ms-grid':
|
|
2841
|
-
return 256 /* GRID */;
|
|
3708
|
+
return 256 /* DISPLAY.GRID */;
|
|
2842
3709
|
case 'ruby':
|
|
2843
|
-
return 512 /* RUBY */;
|
|
3710
|
+
return 512 /* DISPLAY.RUBY */;
|
|
2844
3711
|
case 'subgrid':
|
|
2845
|
-
return 1024 /* SUBGRID */;
|
|
3712
|
+
return 1024 /* DISPLAY.SUBGRID */;
|
|
2846
3713
|
case 'list-item':
|
|
2847
|
-
return 2048 /* LIST_ITEM */;
|
|
3714
|
+
return 2048 /* DISPLAY.LIST_ITEM */;
|
|
2848
3715
|
case 'table-row-group':
|
|
2849
|
-
return 4096 /* TABLE_ROW_GROUP */;
|
|
3716
|
+
return 4096 /* DISPLAY.TABLE_ROW_GROUP */;
|
|
2850
3717
|
case 'table-header-group':
|
|
2851
|
-
return 8192 /* TABLE_HEADER_GROUP */;
|
|
3718
|
+
return 8192 /* DISPLAY.TABLE_HEADER_GROUP */;
|
|
2852
3719
|
case 'table-footer-group':
|
|
2853
|
-
return 16384 /* TABLE_FOOTER_GROUP */;
|
|
3720
|
+
return 16384 /* DISPLAY.TABLE_FOOTER_GROUP */;
|
|
2854
3721
|
case 'table-row':
|
|
2855
|
-
return 32768 /* TABLE_ROW */;
|
|
3722
|
+
return 32768 /* DISPLAY.TABLE_ROW */;
|
|
2856
3723
|
case 'table-cell':
|
|
2857
|
-
return 65536 /* TABLE_CELL */;
|
|
3724
|
+
return 65536 /* DISPLAY.TABLE_CELL */;
|
|
2858
3725
|
case 'table-column-group':
|
|
2859
|
-
return 131072 /* TABLE_COLUMN_GROUP */;
|
|
3726
|
+
return 131072 /* DISPLAY.TABLE_COLUMN_GROUP */;
|
|
2860
3727
|
case 'table-column':
|
|
2861
|
-
return 262144 /* TABLE_COLUMN */;
|
|
3728
|
+
return 262144 /* DISPLAY.TABLE_COLUMN */;
|
|
2862
3729
|
case 'table-caption':
|
|
2863
|
-
return 524288 /* TABLE_CAPTION */;
|
|
3730
|
+
return 524288 /* DISPLAY.TABLE_CAPTION */;
|
|
2864
3731
|
case 'ruby-base':
|
|
2865
|
-
return 1048576 /* RUBY_BASE */;
|
|
3732
|
+
return 1048576 /* DISPLAY.RUBY_BASE */;
|
|
2866
3733
|
case 'ruby-text':
|
|
2867
|
-
return 2097152 /* RUBY_TEXT */;
|
|
3734
|
+
return 2097152 /* DISPLAY.RUBY_TEXT */;
|
|
2868
3735
|
case 'ruby-base-container':
|
|
2869
|
-
return 4194304 /* RUBY_BASE_CONTAINER */;
|
|
3736
|
+
return 4194304 /* DISPLAY.RUBY_BASE_CONTAINER */;
|
|
2870
3737
|
case 'ruby-text-container':
|
|
2871
|
-
return 8388608 /* RUBY_TEXT_CONTAINER */;
|
|
3738
|
+
return 8388608 /* DISPLAY.RUBY_TEXT_CONTAINER */;
|
|
2872
3739
|
case 'contents':
|
|
2873
|
-
return 16777216 /* CONTENTS */;
|
|
3740
|
+
return 16777216 /* DISPLAY.CONTENTS */;
|
|
2874
3741
|
case 'inline-block':
|
|
2875
|
-
return 33554432 /* INLINE_BLOCK */;
|
|
3742
|
+
return 33554432 /* DISPLAY.INLINE_BLOCK */;
|
|
2876
3743
|
case 'inline-list-item':
|
|
2877
|
-
return 67108864 /* INLINE_LIST_ITEM */;
|
|
3744
|
+
return 67108864 /* DISPLAY.INLINE_LIST_ITEM */;
|
|
2878
3745
|
case 'inline-table':
|
|
2879
|
-
return 134217728 /* INLINE_TABLE */;
|
|
3746
|
+
return 134217728 /* DISPLAY.INLINE_TABLE */;
|
|
2880
3747
|
case 'inline-flex':
|
|
2881
|
-
return 268435456 /* INLINE_FLEX */;
|
|
3748
|
+
return 268435456 /* DISPLAY.INLINE_FLEX */;
|
|
2882
3749
|
case 'inline-grid':
|
|
2883
|
-
return 536870912 /* INLINE_GRID */;
|
|
3750
|
+
return 536870912 /* DISPLAY.INLINE_GRID */;
|
|
2884
3751
|
}
|
|
2885
|
-
return 0 /* NONE */;
|
|
3752
|
+
return 0 /* DISPLAY.NONE */;
|
|
2886
3753
|
};
|
|
2887
3754
|
|
|
2888
3755
|
var float = {
|
|
2889
3756
|
name: 'float',
|
|
2890
3757
|
initialValue: 'none',
|
|
2891
3758
|
prefix: false,
|
|
2892
|
-
type: 2 /* IDENT_VALUE */,
|
|
3759
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2893
3760
|
parse: function (_context, float) {
|
|
2894
3761
|
switch (float) {
|
|
2895
3762
|
case 'left':
|
|
2896
|
-
return 1 /* LEFT */;
|
|
3763
|
+
return 1 /* FLOAT.LEFT */;
|
|
2897
3764
|
case 'right':
|
|
2898
|
-
return 2 /* RIGHT */;
|
|
3765
|
+
return 2 /* FLOAT.RIGHT */;
|
|
2899
3766
|
case 'inline-start':
|
|
2900
|
-
return 3 /* INLINE_START */;
|
|
3767
|
+
return 3 /* FLOAT.INLINE_START */;
|
|
2901
3768
|
case 'inline-end':
|
|
2902
|
-
return 4 /* INLINE_END */;
|
|
3769
|
+
return 4 /* FLOAT.INLINE_END */;
|
|
2903
3770
|
}
|
|
2904
|
-
return 0 /* NONE */;
|
|
3771
|
+
return 0 /* FLOAT.NONE */;
|
|
2905
3772
|
}
|
|
2906
3773
|
};
|
|
2907
3774
|
|
|
@@ -2909,15 +3776,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2909
3776
|
name: 'letter-spacing',
|
|
2910
3777
|
initialValue: '0',
|
|
2911
3778
|
prefix: false,
|
|
2912
|
-
type: 0 /* VALUE */,
|
|
3779
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2913
3780
|
parse: function (_context, token) {
|
|
2914
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'normal') {
|
|
3781
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'normal') {
|
|
2915
3782
|
return 0;
|
|
2916
3783
|
}
|
|
2917
|
-
if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
3784
|
+
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
2918
3785
|
return token.number;
|
|
2919
3786
|
}
|
|
2920
|
-
if (token.type === 15 /* DIMENSION_TOKEN */) {
|
|
3787
|
+
if (token.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
2921
3788
|
return token.number;
|
|
2922
3789
|
}
|
|
2923
3790
|
return 0;
|
|
@@ -2933,7 +3800,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2933
3800
|
name: 'line-break',
|
|
2934
3801
|
initialValue: 'normal',
|
|
2935
3802
|
prefix: false,
|
|
2936
|
-
type: 2 /* IDENT_VALUE */,
|
|
3803
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2937
3804
|
parse: function (_context, lineBreak) {
|
|
2938
3805
|
switch (lineBreak) {
|
|
2939
3806
|
case 'strict':
|
|
@@ -2949,13 +3816,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2949
3816
|
name: 'line-height',
|
|
2950
3817
|
initialValue: 'normal',
|
|
2951
3818
|
prefix: false,
|
|
2952
|
-
type: 4 /* TOKEN_VALUE */
|
|
3819
|
+
type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
|
|
2953
3820
|
};
|
|
2954
3821
|
var computeLineHeight = function (token, fontSize) {
|
|
2955
3822
|
if (isIdentToken(token) && token.value === 'normal') {
|
|
2956
3823
|
return 1.2 * fontSize;
|
|
2957
3824
|
}
|
|
2958
|
-
else if (token.type === 17 /* NUMBER_TOKEN */) {
|
|
3825
|
+
else if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
2959
3826
|
return fontSize * token.number;
|
|
2960
3827
|
}
|
|
2961
3828
|
else if (isLengthPercentage(token)) {
|
|
@@ -2967,10 +3834,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2967
3834
|
var listStyleImage = {
|
|
2968
3835
|
name: 'list-style-image',
|
|
2969
3836
|
initialValue: 'none',
|
|
2970
|
-
type: 0 /* VALUE */,
|
|
3837
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
2971
3838
|
prefix: false,
|
|
2972
3839
|
parse: function (context, token) {
|
|
2973
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
|
|
3840
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
|
|
2974
3841
|
return null;
|
|
2975
3842
|
}
|
|
2976
3843
|
return image.parse(context, token);
|
|
@@ -2981,14 +3848,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2981
3848
|
name: 'list-style-position',
|
|
2982
3849
|
initialValue: 'outside',
|
|
2983
3850
|
prefix: false,
|
|
2984
|
-
type: 2 /* IDENT_VALUE */,
|
|
3851
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
2985
3852
|
parse: function (_context, position) {
|
|
2986
3853
|
switch (position) {
|
|
2987
3854
|
case 'inside':
|
|
2988
|
-
return 0 /* INSIDE */;
|
|
3855
|
+
return 0 /* LIST_STYLE_POSITION.INSIDE */;
|
|
2989
3856
|
case 'outside':
|
|
2990
3857
|
default:
|
|
2991
|
-
return 1 /* OUTSIDE */;
|
|
3858
|
+
return 1 /* LIST_STYLE_POSITION.OUTSIDE */;
|
|
2992
3859
|
}
|
|
2993
3860
|
}
|
|
2994
3861
|
};
|
|
@@ -2997,127 +3864,127 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
2997
3864
|
name: 'list-style-type',
|
|
2998
3865
|
initialValue: 'none',
|
|
2999
3866
|
prefix: false,
|
|
3000
|
-
type: 2 /* IDENT_VALUE */,
|
|
3867
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3001
3868
|
parse: function (_context, type) {
|
|
3002
3869
|
switch (type) {
|
|
3003
3870
|
case 'disc':
|
|
3004
|
-
return 0 /* DISC */;
|
|
3871
|
+
return 0 /* LIST_STYLE_TYPE.DISC */;
|
|
3005
3872
|
case 'circle':
|
|
3006
|
-
return 1 /* CIRCLE */;
|
|
3873
|
+
return 1 /* LIST_STYLE_TYPE.CIRCLE */;
|
|
3007
3874
|
case 'square':
|
|
3008
|
-
return 2 /* SQUARE */;
|
|
3875
|
+
return 2 /* LIST_STYLE_TYPE.SQUARE */;
|
|
3009
3876
|
case 'decimal':
|
|
3010
|
-
return 3 /* DECIMAL */;
|
|
3877
|
+
return 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
3011
3878
|
case 'cjk-decimal':
|
|
3012
|
-
return 4 /* CJK_DECIMAL */;
|
|
3879
|
+
return 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */;
|
|
3013
3880
|
case 'decimal-leading-zero':
|
|
3014
|
-
return 5 /* DECIMAL_LEADING_ZERO */;
|
|
3881
|
+
return 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */;
|
|
3015
3882
|
case 'lower-roman':
|
|
3016
|
-
return 6 /* LOWER_ROMAN */;
|
|
3883
|
+
return 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */;
|
|
3017
3884
|
case 'upper-roman':
|
|
3018
|
-
return 7 /* UPPER_ROMAN */;
|
|
3885
|
+
return 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */;
|
|
3019
3886
|
case 'lower-greek':
|
|
3020
|
-
return 8 /* LOWER_GREEK */;
|
|
3887
|
+
return 8 /* LIST_STYLE_TYPE.LOWER_GREEK */;
|
|
3021
3888
|
case 'lower-alpha':
|
|
3022
|
-
return 9 /* LOWER_ALPHA */;
|
|
3889
|
+
return 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */;
|
|
3023
3890
|
case 'upper-alpha':
|
|
3024
|
-
return 10 /* UPPER_ALPHA */;
|
|
3891
|
+
return 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */;
|
|
3025
3892
|
case 'arabic-indic':
|
|
3026
|
-
return 11 /* ARABIC_INDIC */;
|
|
3893
|
+
return 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */;
|
|
3027
3894
|
case 'armenian':
|
|
3028
|
-
return 12 /* ARMENIAN */;
|
|
3895
|
+
return 12 /* LIST_STYLE_TYPE.ARMENIAN */;
|
|
3029
3896
|
case 'bengali':
|
|
3030
|
-
return 13 /* BENGALI */;
|
|
3897
|
+
return 13 /* LIST_STYLE_TYPE.BENGALI */;
|
|
3031
3898
|
case 'cambodian':
|
|
3032
|
-
return 14 /* CAMBODIAN */;
|
|
3899
|
+
return 14 /* LIST_STYLE_TYPE.CAMBODIAN */;
|
|
3033
3900
|
case 'cjk-earthly-branch':
|
|
3034
|
-
return 15 /* CJK_EARTHLY_BRANCH */;
|
|
3901
|
+
return 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */;
|
|
3035
3902
|
case 'cjk-heavenly-stem':
|
|
3036
|
-
return 16 /* CJK_HEAVENLY_STEM */;
|
|
3903
|
+
return 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */;
|
|
3037
3904
|
case 'cjk-ideographic':
|
|
3038
|
-
return 17 /* CJK_IDEOGRAPHIC */;
|
|
3905
|
+
return 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */;
|
|
3039
3906
|
case 'devanagari':
|
|
3040
|
-
return 18 /* DEVANAGARI */;
|
|
3907
|
+
return 18 /* LIST_STYLE_TYPE.DEVANAGARI */;
|
|
3041
3908
|
case 'ethiopic-numeric':
|
|
3042
|
-
return 19 /* ETHIOPIC_NUMERIC */;
|
|
3909
|
+
return 19 /* LIST_STYLE_TYPE.ETHIOPIC_NUMERIC */;
|
|
3043
3910
|
case 'georgian':
|
|
3044
|
-
return 20 /* GEORGIAN */;
|
|
3911
|
+
return 20 /* LIST_STYLE_TYPE.GEORGIAN */;
|
|
3045
3912
|
case 'gujarati':
|
|
3046
|
-
return 21 /* GUJARATI */;
|
|
3913
|
+
return 21 /* LIST_STYLE_TYPE.GUJARATI */;
|
|
3047
3914
|
case 'gurmukhi':
|
|
3048
|
-
return 22 /* GURMUKHI */;
|
|
3915
|
+
return 22 /* LIST_STYLE_TYPE.GURMUKHI */;
|
|
3049
3916
|
case 'hebrew':
|
|
3050
|
-
return 22 /* HEBREW */;
|
|
3917
|
+
return 22 /* LIST_STYLE_TYPE.HEBREW */;
|
|
3051
3918
|
case 'hiragana':
|
|
3052
|
-
return 23 /* HIRAGANA */;
|
|
3919
|
+
return 23 /* LIST_STYLE_TYPE.HIRAGANA */;
|
|
3053
3920
|
case 'hiragana-iroha':
|
|
3054
|
-
return 24 /* HIRAGANA_IROHA */;
|
|
3921
|
+
return 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */;
|
|
3055
3922
|
case 'japanese-formal':
|
|
3056
|
-
return 25 /* JAPANESE_FORMAL */;
|
|
3923
|
+
return 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */;
|
|
3057
3924
|
case 'japanese-informal':
|
|
3058
|
-
return 26 /* JAPANESE_INFORMAL */;
|
|
3925
|
+
return 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */;
|
|
3059
3926
|
case 'kannada':
|
|
3060
|
-
return 27 /* KANNADA */;
|
|
3927
|
+
return 27 /* LIST_STYLE_TYPE.KANNADA */;
|
|
3061
3928
|
case 'katakana':
|
|
3062
|
-
return 28 /* KATAKANA */;
|
|
3929
|
+
return 28 /* LIST_STYLE_TYPE.KATAKANA */;
|
|
3063
3930
|
case 'katakana-iroha':
|
|
3064
|
-
return 29 /* KATAKANA_IROHA */;
|
|
3931
|
+
return 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */;
|
|
3065
3932
|
case 'khmer':
|
|
3066
|
-
return 30 /* KHMER */;
|
|
3933
|
+
return 30 /* LIST_STYLE_TYPE.KHMER */;
|
|
3067
3934
|
case 'korean-hangul-formal':
|
|
3068
|
-
return 31 /* KOREAN_HANGUL_FORMAL */;
|
|
3935
|
+
return 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */;
|
|
3069
3936
|
case 'korean-hanja-formal':
|
|
3070
|
-
return 32 /* KOREAN_HANJA_FORMAL */;
|
|
3937
|
+
return 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */;
|
|
3071
3938
|
case 'korean-hanja-informal':
|
|
3072
|
-
return 33 /* KOREAN_HANJA_INFORMAL */;
|
|
3939
|
+
return 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */;
|
|
3073
3940
|
case 'lao':
|
|
3074
|
-
return 34 /* LAO */;
|
|
3941
|
+
return 34 /* LIST_STYLE_TYPE.LAO */;
|
|
3075
3942
|
case 'lower-armenian':
|
|
3076
|
-
return 35 /* LOWER_ARMENIAN */;
|
|
3943
|
+
return 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */;
|
|
3077
3944
|
case 'malayalam':
|
|
3078
|
-
return 36 /* MALAYALAM */;
|
|
3945
|
+
return 36 /* LIST_STYLE_TYPE.MALAYALAM */;
|
|
3079
3946
|
case 'mongolian':
|
|
3080
|
-
return 37 /* MONGOLIAN */;
|
|
3947
|
+
return 37 /* LIST_STYLE_TYPE.MONGOLIAN */;
|
|
3081
3948
|
case 'myanmar':
|
|
3082
|
-
return 38 /* MYANMAR */;
|
|
3949
|
+
return 38 /* LIST_STYLE_TYPE.MYANMAR */;
|
|
3083
3950
|
case 'oriya':
|
|
3084
|
-
return 39 /* ORIYA */;
|
|
3951
|
+
return 39 /* LIST_STYLE_TYPE.ORIYA */;
|
|
3085
3952
|
case 'persian':
|
|
3086
|
-
return 40 /* PERSIAN */;
|
|
3953
|
+
return 40 /* LIST_STYLE_TYPE.PERSIAN */;
|
|
3087
3954
|
case 'simp-chinese-formal':
|
|
3088
|
-
return 41 /* SIMP_CHINESE_FORMAL */;
|
|
3955
|
+
return 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */;
|
|
3089
3956
|
case 'simp-chinese-informal':
|
|
3090
|
-
return 42 /* SIMP_CHINESE_INFORMAL */;
|
|
3957
|
+
return 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */;
|
|
3091
3958
|
case 'tamil':
|
|
3092
|
-
return 43 /* TAMIL */;
|
|
3959
|
+
return 43 /* LIST_STYLE_TYPE.TAMIL */;
|
|
3093
3960
|
case 'telugu':
|
|
3094
|
-
return 44 /* TELUGU */;
|
|
3961
|
+
return 44 /* LIST_STYLE_TYPE.TELUGU */;
|
|
3095
3962
|
case 'thai':
|
|
3096
|
-
return 45 /* THAI */;
|
|
3963
|
+
return 45 /* LIST_STYLE_TYPE.THAI */;
|
|
3097
3964
|
case 'tibetan':
|
|
3098
|
-
return 46 /* TIBETAN */;
|
|
3965
|
+
return 46 /* LIST_STYLE_TYPE.TIBETAN */;
|
|
3099
3966
|
case 'trad-chinese-formal':
|
|
3100
|
-
return 47 /* TRAD_CHINESE_FORMAL */;
|
|
3967
|
+
return 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */;
|
|
3101
3968
|
case 'trad-chinese-informal':
|
|
3102
|
-
return 48 /* TRAD_CHINESE_INFORMAL */;
|
|
3969
|
+
return 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */;
|
|
3103
3970
|
case 'upper-armenian':
|
|
3104
|
-
return 49 /* UPPER_ARMENIAN */;
|
|
3971
|
+
return 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */;
|
|
3105
3972
|
case 'disclosure-open':
|
|
3106
|
-
return 50 /* DISCLOSURE_OPEN */;
|
|
3973
|
+
return 50 /* LIST_STYLE_TYPE.DISCLOSURE_OPEN */;
|
|
3107
3974
|
case 'disclosure-closed':
|
|
3108
|
-
return 51 /* DISCLOSURE_CLOSED */;
|
|
3975
|
+
return 51 /* LIST_STYLE_TYPE.DISCLOSURE_CLOSED */;
|
|
3109
3976
|
case 'none':
|
|
3110
3977
|
default:
|
|
3111
|
-
return -1 /* NONE */;
|
|
3978
|
+
return -1 /* LIST_STYLE_TYPE.NONE */;
|
|
3112
3979
|
}
|
|
3113
3980
|
}
|
|
3114
3981
|
};
|
|
3115
3982
|
|
|
3116
3983
|
var marginForSide = function (side) { return ({
|
|
3117
|
-
name: "margin-"
|
|
3984
|
+
name: "margin-".concat(side),
|
|
3118
3985
|
initialValue: '0',
|
|
3119
3986
|
prefix: false,
|
|
3120
|
-
type: 4 /* TOKEN_VALUE */
|
|
3987
|
+
type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
|
|
3121
3988
|
}); };
|
|
3122
3989
|
var marginTop = marginForSide('top');
|
|
3123
3990
|
var marginRight = marginForSide('right');
|
|
@@ -3128,21 +3995,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3128
3995
|
name: 'overflow',
|
|
3129
3996
|
initialValue: 'visible',
|
|
3130
3997
|
prefix: false,
|
|
3131
|
-
type: 1 /* LIST */,
|
|
3998
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3132
3999
|
parse: function (_context, tokens) {
|
|
3133
4000
|
return tokens.filter(isIdentToken).map(function (overflow) {
|
|
3134
4001
|
switch (overflow.value) {
|
|
3135
4002
|
case 'hidden':
|
|
3136
|
-
return 1 /* HIDDEN */;
|
|
4003
|
+
return 1 /* OVERFLOW.HIDDEN */;
|
|
3137
4004
|
case 'scroll':
|
|
3138
|
-
return 2 /* SCROLL */;
|
|
4005
|
+
return 2 /* OVERFLOW.SCROLL */;
|
|
3139
4006
|
case 'clip':
|
|
3140
|
-
return 3 /* CLIP */;
|
|
4007
|
+
return 3 /* OVERFLOW.CLIP */;
|
|
3141
4008
|
case 'auto':
|
|
3142
|
-
return 4 /* AUTO */;
|
|
4009
|
+
return 4 /* OVERFLOW.AUTO */;
|
|
3143
4010
|
case 'visible':
|
|
3144
4011
|
default:
|
|
3145
|
-
return 0 /* VISIBLE */;
|
|
4012
|
+
return 0 /* OVERFLOW.VISIBLE */;
|
|
3146
4013
|
}
|
|
3147
4014
|
});
|
|
3148
4015
|
}
|
|
@@ -3152,23 +4019,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3152
4019
|
name: 'overflow-wrap',
|
|
3153
4020
|
initialValue: 'normal',
|
|
3154
4021
|
prefix: false,
|
|
3155
|
-
type: 2 /* IDENT_VALUE */,
|
|
4022
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3156
4023
|
parse: function (_context, overflow) {
|
|
3157
4024
|
switch (overflow) {
|
|
3158
4025
|
case 'break-word':
|
|
3159
|
-
return "break-word" /* BREAK_WORD */;
|
|
4026
|
+
return "break-word" /* OVERFLOW_WRAP.BREAK_WORD */;
|
|
3160
4027
|
case 'normal':
|
|
3161
4028
|
default:
|
|
3162
|
-
return "normal" /* NORMAL */;
|
|
4029
|
+
return "normal" /* OVERFLOW_WRAP.NORMAL */;
|
|
3163
4030
|
}
|
|
3164
4031
|
}
|
|
3165
4032
|
};
|
|
3166
4033
|
|
|
3167
4034
|
var paddingForSide = function (side) { return ({
|
|
3168
|
-
name: "padding-"
|
|
4035
|
+
name: "padding-".concat(side),
|
|
3169
4036
|
initialValue: '0',
|
|
3170
4037
|
prefix: false,
|
|
3171
|
-
type: 3 /* TYPE_VALUE */,
|
|
4038
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3172
4039
|
format: 'length-percentage'
|
|
3173
4040
|
}); };
|
|
3174
4041
|
var paddingTop = paddingForSide('top');
|
|
@@ -3180,17 +4047,17 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3180
4047
|
name: 'text-align',
|
|
3181
4048
|
initialValue: 'left',
|
|
3182
4049
|
prefix: false,
|
|
3183
|
-
type: 2 /* IDENT_VALUE */,
|
|
4050
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3184
4051
|
parse: function (_context, textAlign) {
|
|
3185
4052
|
switch (textAlign) {
|
|
3186
4053
|
case 'right':
|
|
3187
|
-
return 2 /* RIGHT */;
|
|
4054
|
+
return 2 /* TEXT_ALIGN.RIGHT */;
|
|
3188
4055
|
case 'center':
|
|
3189
4056
|
case 'justify':
|
|
3190
|
-
return 1 /* CENTER */;
|
|
4057
|
+
return 1 /* TEXT_ALIGN.CENTER */;
|
|
3191
4058
|
case 'left':
|
|
3192
4059
|
default:
|
|
3193
|
-
return 0 /* LEFT */;
|
|
4060
|
+
return 0 /* TEXT_ALIGN.LEFT */;
|
|
3194
4061
|
}
|
|
3195
4062
|
}
|
|
3196
4063
|
};
|
|
@@ -3199,26 +4066,26 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3199
4066
|
name: 'position',
|
|
3200
4067
|
initialValue: 'static',
|
|
3201
4068
|
prefix: false,
|
|
3202
|
-
type: 2 /* IDENT_VALUE */,
|
|
4069
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3203
4070
|
parse: function (_context, position) {
|
|
3204
4071
|
switch (position) {
|
|
3205
4072
|
case 'relative':
|
|
3206
|
-
return 1 /* RELATIVE */;
|
|
4073
|
+
return 1 /* POSITION.RELATIVE */;
|
|
3207
4074
|
case 'absolute':
|
|
3208
|
-
return 2 /* ABSOLUTE */;
|
|
4075
|
+
return 2 /* POSITION.ABSOLUTE */;
|
|
3209
4076
|
case 'fixed':
|
|
3210
|
-
return 3 /* FIXED */;
|
|
4077
|
+
return 3 /* POSITION.FIXED */;
|
|
3211
4078
|
case 'sticky':
|
|
3212
|
-
return 4 /* STICKY */;
|
|
4079
|
+
return 4 /* POSITION.STICKY */;
|
|
3213
4080
|
}
|
|
3214
|
-
return 0 /* STATIC */;
|
|
4081
|
+
return 0 /* POSITION.STATIC */;
|
|
3215
4082
|
}
|
|
3216
4083
|
};
|
|
3217
4084
|
|
|
3218
4085
|
var textShadow = {
|
|
3219
4086
|
name: 'text-shadow',
|
|
3220
4087
|
initialValue: 'none',
|
|
3221
|
-
type: 1 /* LIST */,
|
|
4088
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3222
4089
|
prefix: false,
|
|
3223
4090
|
parse: function (context, tokens) {
|
|
3224
4091
|
if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
|
|
@@ -3259,17 +4126,17 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3259
4126
|
name: 'text-transform',
|
|
3260
4127
|
initialValue: 'none',
|
|
3261
4128
|
prefix: false,
|
|
3262
|
-
type: 2 /* IDENT_VALUE */,
|
|
4129
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3263
4130
|
parse: function (_context, textTransform) {
|
|
3264
4131
|
switch (textTransform) {
|
|
3265
4132
|
case 'uppercase':
|
|
3266
|
-
return 2 /* UPPERCASE */;
|
|
4133
|
+
return 2 /* TEXT_TRANSFORM.UPPERCASE */;
|
|
3267
4134
|
case 'lowercase':
|
|
3268
|
-
return 1 /* LOWERCASE */;
|
|
4135
|
+
return 1 /* TEXT_TRANSFORM.LOWERCASE */;
|
|
3269
4136
|
case 'capitalize':
|
|
3270
|
-
return 3 /* CAPITALIZE */;
|
|
4137
|
+
return 3 /* TEXT_TRANSFORM.CAPITALIZE */;
|
|
3271
4138
|
}
|
|
3272
|
-
return 0 /* NONE */;
|
|
4139
|
+
return 0 /* TEXT_TRANSFORM.NONE */;
|
|
3273
4140
|
}
|
|
3274
4141
|
};
|
|
3275
4142
|
|
|
@@ -3277,15 +4144,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3277
4144
|
name: 'transform',
|
|
3278
4145
|
initialValue: 'none',
|
|
3279
4146
|
prefix: true,
|
|
3280
|
-
type: 0 /* VALUE */,
|
|
4147
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3281
4148
|
parse: function (_context, token) {
|
|
3282
|
-
if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
|
|
4149
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
|
|
3283
4150
|
return null;
|
|
3284
4151
|
}
|
|
3285
|
-
if (token.type === 18 /* FUNCTION */) {
|
|
4152
|
+
if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
3286
4153
|
var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
|
|
3287
4154
|
if (typeof transformFunction === 'undefined') {
|
|
3288
|
-
throw new Error("Attempting to parse an unsupported transform function \""
|
|
4155
|
+
throw new Error("Attempting to parse an unsupported transform function \"".concat(token.name, "\""));
|
|
3289
4156
|
}
|
|
3290
4157
|
return transformFunction(token.values);
|
|
3291
4158
|
}
|
|
@@ -3293,12 +4160,12 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3293
4160
|
}
|
|
3294
4161
|
};
|
|
3295
4162
|
var matrix = function (args) {
|
|
3296
|
-
var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
4163
|
+
var values = args.filter(function (arg) { return arg.type === 17 /* TokenType.NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
3297
4164
|
return values.length === 6 ? values : null;
|
|
3298
4165
|
};
|
|
3299
4166
|
// doesn't support 3D transforms at the moment
|
|
3300
4167
|
var matrix3d = function (args) {
|
|
3301
|
-
var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
4168
|
+
var values = args.filter(function (arg) { return arg.type === 17 /* TokenType.NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
|
|
3302
4169
|
var a1 = values[0], b1 = values[1]; var a2 = values[4], b2 = values[5]; var a4 = values[12], b4 = values[13]; return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null;
|
|
3303
4170
|
};
|
|
3304
4171
|
var SUPPORTED_TRANSFORM_FUNCTIONS = {
|
|
@@ -3307,7 +4174,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3307
4174
|
};
|
|
3308
4175
|
|
|
3309
4176
|
var DEFAULT_VALUE = {
|
|
3310
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
4177
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
3311
4178
|
number: 50,
|
|
3312
4179
|
flags: FLAG_INTEGER
|
|
3313
4180
|
};
|
|
@@ -3316,7 +4183,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3316
4183
|
name: 'transform-origin',
|
|
3317
4184
|
initialValue: '50% 50%',
|
|
3318
4185
|
prefix: true,
|
|
3319
|
-
type: 1 /* LIST */,
|
|
4186
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3320
4187
|
parse: function (_context, tokens) {
|
|
3321
4188
|
var origins = tokens.filter(isLengthPercentage);
|
|
3322
4189
|
if (origins.length !== 2) {
|
|
@@ -3330,16 +4197,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3330
4197
|
name: 'visible',
|
|
3331
4198
|
initialValue: 'none',
|
|
3332
4199
|
prefix: false,
|
|
3333
|
-
type: 2 /* IDENT_VALUE */,
|
|
4200
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3334
4201
|
parse: function (_context, visibility) {
|
|
3335
4202
|
switch (visibility) {
|
|
3336
4203
|
case 'hidden':
|
|
3337
|
-
return 1 /* HIDDEN */;
|
|
4204
|
+
return 1 /* VISIBILITY.HIDDEN */;
|
|
3338
4205
|
case 'collapse':
|
|
3339
|
-
return 2 /* COLLAPSE */;
|
|
4206
|
+
return 2 /* VISIBILITY.COLLAPSE */;
|
|
3340
4207
|
case 'visible':
|
|
3341
4208
|
default:
|
|
3342
|
-
return 0 /* VISIBLE */;
|
|
4209
|
+
return 0 /* VISIBILITY.VISIBLE */;
|
|
3343
4210
|
}
|
|
3344
4211
|
}
|
|
3345
4212
|
};
|
|
@@ -3354,7 +4221,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3354
4221
|
name: 'word-break',
|
|
3355
4222
|
initialValue: 'normal',
|
|
3356
4223
|
prefix: false,
|
|
3357
|
-
type: 2 /* IDENT_VALUE */,
|
|
4224
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3358
4225
|
parse: function (_context, wordBreak) {
|
|
3359
4226
|
switch (wordBreak) {
|
|
3360
4227
|
case 'break-all':
|
|
@@ -3372,9 +4239,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3372
4239
|
name: 'z-index',
|
|
3373
4240
|
initialValue: 'auto',
|
|
3374
4241
|
prefix: false,
|
|
3375
|
-
type: 0 /* VALUE */,
|
|
4242
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3376
4243
|
parse: function (_context, token) {
|
|
3377
|
-
if (token.type === 20 /* IDENT_TOKEN */) {
|
|
4244
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
3378
4245
|
return { auto: true, order: 0 };
|
|
3379
4246
|
}
|
|
3380
4247
|
if (isNumberToken(token)) {
|
|
@@ -3387,7 +4254,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3387
4254
|
var time = {
|
|
3388
4255
|
name: 'time',
|
|
3389
4256
|
parse: function (_context, value) {
|
|
3390
|
-
if (value.type === 15 /* DIMENSION_TOKEN */) {
|
|
4257
|
+
if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
3391
4258
|
switch (value.unit.toLowerCase()) {
|
|
3392
4259
|
case 's':
|
|
3393
4260
|
return 1000 * value.number;
|
|
@@ -3402,7 +4269,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3402
4269
|
var opacity = {
|
|
3403
4270
|
name: 'opacity',
|
|
3404
4271
|
initialValue: '1',
|
|
3405
|
-
type: 0 /* VALUE */,
|
|
4272
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3406
4273
|
prefix: false,
|
|
3407
4274
|
parse: function (_context, token) {
|
|
3408
4275
|
if (isNumberToken(token)) {
|
|
@@ -3416,7 +4283,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3416
4283
|
name: "text-decoration-color",
|
|
3417
4284
|
initialValue: 'transparent',
|
|
3418
4285
|
prefix: false,
|
|
3419
|
-
type: 3 /* TYPE_VALUE */,
|
|
4286
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3420
4287
|
format: 'color'
|
|
3421
4288
|
};
|
|
3422
4289
|
|
|
@@ -3424,24 +4291,24 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3424
4291
|
name: 'text-decoration-line',
|
|
3425
4292
|
initialValue: 'none',
|
|
3426
4293
|
prefix: false,
|
|
3427
|
-
type: 1 /* LIST */,
|
|
4294
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3428
4295
|
parse: function (_context, tokens) {
|
|
3429
4296
|
return tokens
|
|
3430
4297
|
.filter(isIdentToken)
|
|
3431
4298
|
.map(function (token) {
|
|
3432
4299
|
switch (token.value) {
|
|
3433
4300
|
case 'underline':
|
|
3434
|
-
return 1 /* UNDERLINE */;
|
|
4301
|
+
return 1 /* TEXT_DECORATION_LINE.UNDERLINE */;
|
|
3435
4302
|
case 'overline':
|
|
3436
|
-
return 2 /* OVERLINE */;
|
|
4303
|
+
return 2 /* TEXT_DECORATION_LINE.OVERLINE */;
|
|
3437
4304
|
case 'line-through':
|
|
3438
|
-
return 3 /* LINE_THROUGH */;
|
|
4305
|
+
return 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */;
|
|
3439
4306
|
case 'none':
|
|
3440
|
-
return 4 /* BLINK */;
|
|
4307
|
+
return 4 /* TEXT_DECORATION_LINE.BLINK */;
|
|
3441
4308
|
}
|
|
3442
|
-
return 0 /* NONE */;
|
|
4309
|
+
return 0 /* TEXT_DECORATION_LINE.NONE */;
|
|
3443
4310
|
})
|
|
3444
|
-
.filter(function (line) { return line !== 0 /* NONE */; });
|
|
4311
|
+
.filter(function (line) { return line !== 0 /* TEXT_DECORATION_LINE.NONE */; });
|
|
3445
4312
|
}
|
|
3446
4313
|
};
|
|
3447
4314
|
|
|
@@ -3449,20 +4316,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3449
4316
|
name: "font-family",
|
|
3450
4317
|
initialValue: '',
|
|
3451
4318
|
prefix: false,
|
|
3452
|
-
type: 1 /* LIST */,
|
|
4319
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3453
4320
|
parse: function (_context, tokens) {
|
|
3454
4321
|
var accumulator = [];
|
|
3455
4322
|
var results = [];
|
|
3456
4323
|
tokens.forEach(function (token) {
|
|
3457
4324
|
switch (token.type) {
|
|
3458
|
-
case 20 /* IDENT_TOKEN */:
|
|
3459
|
-
case 0 /* STRING_TOKEN */:
|
|
4325
|
+
case 20 /* TokenType.IDENT_TOKEN */:
|
|
4326
|
+
case 0 /* TokenType.STRING_TOKEN */:
|
|
3460
4327
|
accumulator.push(token.value);
|
|
3461
4328
|
break;
|
|
3462
|
-
case 17 /* NUMBER_TOKEN */:
|
|
4329
|
+
case 17 /* TokenType.NUMBER_TOKEN */:
|
|
3463
4330
|
accumulator.push(token.number.toString());
|
|
3464
4331
|
break;
|
|
3465
|
-
case 4 /* COMMA_TOKEN */:
|
|
4332
|
+
case 4 /* TokenType.COMMA_TOKEN */:
|
|
3466
4333
|
results.push(accumulator.join(' '));
|
|
3467
4334
|
accumulator.length = 0;
|
|
3468
4335
|
break;
|
|
@@ -3471,7 +4338,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3471
4338
|
if (accumulator.length) {
|
|
3472
4339
|
results.push(accumulator.join(' '));
|
|
3473
4340
|
}
|
|
3474
|
-
return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'"
|
|
4341
|
+
return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'".concat(result, "'")); });
|
|
3475
4342
|
}
|
|
3476
4343
|
};
|
|
3477
4344
|
|
|
@@ -3479,14 +4346,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3479
4346
|
name: "font-size",
|
|
3480
4347
|
initialValue: '0',
|
|
3481
4348
|
prefix: false,
|
|
3482
|
-
type: 3 /* TYPE_VALUE */,
|
|
4349
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3483
4350
|
format: 'length'
|
|
3484
4351
|
};
|
|
3485
4352
|
|
|
3486
4353
|
var fontWeight = {
|
|
3487
4354
|
name: 'font-weight',
|
|
3488
4355
|
initialValue: 'normal',
|
|
3489
|
-
type: 0 /* VALUE */,
|
|
4356
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3490
4357
|
prefix: false,
|
|
3491
4358
|
parse: function (_context, token) {
|
|
3492
4359
|
if (isNumberToken(token)) {
|
|
@@ -3508,7 +4375,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3508
4375
|
var fontVariant = {
|
|
3509
4376
|
name: 'font-variant',
|
|
3510
4377
|
initialValue: 'none',
|
|
3511
|
-
type: 1 /* LIST */,
|
|
4378
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3512
4379
|
prefix: false,
|
|
3513
4380
|
parse: function (_context, tokens) {
|
|
3514
4381
|
return tokens.filter(isIdentToken).map(function (token) { return token.value; });
|
|
@@ -3519,16 +4386,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3519
4386
|
name: 'font-style',
|
|
3520
4387
|
initialValue: 'normal',
|
|
3521
4388
|
prefix: false,
|
|
3522
|
-
type: 2 /* IDENT_VALUE */,
|
|
4389
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
3523
4390
|
parse: function (_context, overflow) {
|
|
3524
4391
|
switch (overflow) {
|
|
3525
4392
|
case 'oblique':
|
|
3526
|
-
return "oblique" /* OBLIQUE */;
|
|
4393
|
+
return "oblique" /* FONT_STYLE.OBLIQUE */;
|
|
3527
4394
|
case 'italic':
|
|
3528
|
-
return "italic" /* ITALIC */;
|
|
4395
|
+
return "italic" /* FONT_STYLE.ITALIC */;
|
|
3529
4396
|
case 'normal':
|
|
3530
4397
|
default:
|
|
3531
|
-
return "normal" /* NORMAL */;
|
|
4398
|
+
return "normal" /* FONT_STYLE.NORMAL */;
|
|
3532
4399
|
}
|
|
3533
4400
|
}
|
|
3534
4401
|
};
|
|
@@ -3538,14 +4405,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3538
4405
|
var content = {
|
|
3539
4406
|
name: 'content',
|
|
3540
4407
|
initialValue: 'none',
|
|
3541
|
-
type: 1 /* LIST */,
|
|
4408
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3542
4409
|
prefix: false,
|
|
3543
4410
|
parse: function (_context, tokens) {
|
|
3544
4411
|
if (tokens.length === 0) {
|
|
3545
4412
|
return [];
|
|
3546
4413
|
}
|
|
3547
4414
|
var first = tokens[0];
|
|
3548
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4415
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3549
4416
|
return [];
|
|
3550
4417
|
}
|
|
3551
4418
|
return tokens;
|
|
@@ -3556,13 +4423,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3556
4423
|
name: 'counter-increment',
|
|
3557
4424
|
initialValue: 'none',
|
|
3558
4425
|
prefix: true,
|
|
3559
|
-
type: 1 /* LIST */,
|
|
4426
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3560
4427
|
parse: function (_context, tokens) {
|
|
3561
4428
|
if (tokens.length === 0) {
|
|
3562
4429
|
return null;
|
|
3563
4430
|
}
|
|
3564
4431
|
var first = tokens[0];
|
|
3565
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4432
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3566
4433
|
return null;
|
|
3567
4434
|
}
|
|
3568
4435
|
var increments = [];
|
|
@@ -3570,7 +4437,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3570
4437
|
for (var i = 0; i < filtered.length; i++) {
|
|
3571
4438
|
var counter = filtered[i];
|
|
3572
4439
|
var next = filtered[i + 1];
|
|
3573
|
-
if (counter.type === 20 /* IDENT_TOKEN */) {
|
|
4440
|
+
if (counter.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
3574
4441
|
var increment = next && isNumberToken(next) ? next.number : 1;
|
|
3575
4442
|
increments.push({ counter: counter.value, increment: increment });
|
|
3576
4443
|
}
|
|
@@ -3583,7 +4450,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3583
4450
|
name: 'counter-reset',
|
|
3584
4451
|
initialValue: 'none',
|
|
3585
4452
|
prefix: true,
|
|
3586
|
-
type: 1 /* LIST */,
|
|
4453
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3587
4454
|
parse: function (_context, tokens) {
|
|
3588
4455
|
if (tokens.length === 0) {
|
|
3589
4456
|
return [];
|
|
@@ -3606,7 +4473,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3606
4473
|
name: 'duration',
|
|
3607
4474
|
initialValue: '0s',
|
|
3608
4475
|
prefix: false,
|
|
3609
|
-
type: 1 /* LIST */,
|
|
4476
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3610
4477
|
parse: function (context, tokens) {
|
|
3611
4478
|
return tokens.filter(isDimensionToken).map(function (token) { return time.parse(context, token); });
|
|
3612
4479
|
}
|
|
@@ -3616,13 +4483,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3616
4483
|
name: 'quotes',
|
|
3617
4484
|
initialValue: 'none',
|
|
3618
4485
|
prefix: true,
|
|
3619
|
-
type: 1 /* LIST */,
|
|
4486
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3620
4487
|
parse: function (_context, tokens) {
|
|
3621
4488
|
if (tokens.length === 0) {
|
|
3622
4489
|
return null;
|
|
3623
4490
|
}
|
|
3624
4491
|
var first = tokens[0];
|
|
3625
|
-
if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
|
|
4492
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
3626
4493
|
return null;
|
|
3627
4494
|
}
|
|
3628
4495
|
var quotes = [];
|
|
@@ -3652,7 +4519,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3652
4519
|
var boxShadow = {
|
|
3653
4520
|
name: 'box-shadow',
|
|
3654
4521
|
initialValue: 'none',
|
|
3655
|
-
type: 1 /* LIST */,
|
|
4522
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3656
4523
|
prefix: false,
|
|
3657
4524
|
parse: function (context, tokens) {
|
|
3658
4525
|
if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
|
|
@@ -3701,20 +4568,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3701
4568
|
name: 'paint-order',
|
|
3702
4569
|
initialValue: 'normal',
|
|
3703
4570
|
prefix: false,
|
|
3704
|
-
type: 1 /* LIST */,
|
|
4571
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
3705
4572
|
parse: function (_context, tokens) {
|
|
3706
|
-
var DEFAULT_VALUE = [0 /* FILL */, 1 /* STROKE */, 2 /* MARKERS */];
|
|
4573
|
+
var DEFAULT_VALUE = [0 /* PAINT_ORDER_LAYER.FILL */, 1 /* PAINT_ORDER_LAYER.STROKE */, 2 /* PAINT_ORDER_LAYER.MARKERS */];
|
|
3707
4574
|
var layers = [];
|
|
3708
4575
|
tokens.filter(isIdentToken).forEach(function (token) {
|
|
3709
4576
|
switch (token.value) {
|
|
3710
4577
|
case 'stroke':
|
|
3711
|
-
layers.push(1 /* STROKE */);
|
|
4578
|
+
layers.push(1 /* PAINT_ORDER_LAYER.STROKE */);
|
|
3712
4579
|
break;
|
|
3713
4580
|
case 'fill':
|
|
3714
|
-
layers.push(0 /* FILL */);
|
|
4581
|
+
layers.push(0 /* PAINT_ORDER_LAYER.FILL */);
|
|
3715
4582
|
break;
|
|
3716
4583
|
case 'markers':
|
|
3717
|
-
layers.push(2 /* MARKERS */);
|
|
4584
|
+
layers.push(2 /* PAINT_ORDER_LAYER.MARKERS */);
|
|
3718
4585
|
break;
|
|
3719
4586
|
}
|
|
3720
4587
|
});
|
|
@@ -3731,14 +4598,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3731
4598
|
name: "-webkit-text-stroke-color",
|
|
3732
4599
|
initialValue: 'currentcolor',
|
|
3733
4600
|
prefix: false,
|
|
3734
|
-
type: 3 /* TYPE_VALUE */,
|
|
4601
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
3735
4602
|
format: 'color'
|
|
3736
4603
|
};
|
|
3737
4604
|
|
|
3738
4605
|
var webkitTextStrokeWidth = {
|
|
3739
4606
|
name: "-webkit-text-stroke-width",
|
|
3740
4607
|
initialValue: '0',
|
|
3741
|
-
type: 0 /* VALUE */,
|
|
4608
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
3742
4609
|
prefix: false,
|
|
3743
4610
|
parse: function (_context, token) {
|
|
3744
4611
|
if (isDimensionToken(token)) {
|
|
@@ -3748,6 +4615,31 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3748
4615
|
}
|
|
3749
4616
|
};
|
|
3750
4617
|
|
|
4618
|
+
var objectFit = {
|
|
4619
|
+
name: 'objectFit',
|
|
4620
|
+
initialValue: 'fill',
|
|
4621
|
+
prefix: false,
|
|
4622
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
4623
|
+
parse: function (_context, tokens) {
|
|
4624
|
+
return tokens.filter(isIdentToken).reduce(function (bit, token) {
|
|
4625
|
+
return bit | parseDisplayValue(token.value);
|
|
4626
|
+
}, 0 /* OBJECT_FIT.FILL */);
|
|
4627
|
+
}
|
|
4628
|
+
};
|
|
4629
|
+
var parseDisplayValue = function (display) {
|
|
4630
|
+
switch (display) {
|
|
4631
|
+
case 'contain':
|
|
4632
|
+
return 2 /* OBJECT_FIT.CONTAIN */;
|
|
4633
|
+
case 'cover':
|
|
4634
|
+
return 4 /* OBJECT_FIT.COVER */;
|
|
4635
|
+
case 'none':
|
|
4636
|
+
return 8 /* OBJECT_FIT.NONE */;
|
|
4637
|
+
case 'scale-down':
|
|
4638
|
+
return 16 /* OBJECT_FIT.SCALE_DOWN */;
|
|
4639
|
+
}
|
|
4640
|
+
return 0 /* OBJECT_FIT.FILL */;
|
|
4641
|
+
};
|
|
4642
|
+
|
|
3751
4643
|
var CSSParsedDeclaration = /** @class */ (function () {
|
|
3752
4644
|
function CSSParsedDeclaration(context, declaration) {
|
|
3753
4645
|
var _a, _b;
|
|
@@ -3818,9 +4710,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3818
4710
|
this.webkitTextStrokeWidth = parse(context, webkitTextStrokeWidth, declaration.webkitTextStrokeWidth);
|
|
3819
4711
|
this.wordBreak = parse(context, wordBreak, declaration.wordBreak);
|
|
3820
4712
|
this.zIndex = parse(context, zIndex, declaration.zIndex);
|
|
4713
|
+
this.objectFit = parse(context, objectFit, declaration.objectFit);
|
|
3821
4714
|
}
|
|
3822
4715
|
CSSParsedDeclaration.prototype.isVisible = function () {
|
|
3823
|
-
return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBLE */;
|
|
4716
|
+
return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBILITY.VISIBLE */;
|
|
3824
4717
|
};
|
|
3825
4718
|
CSSParsedDeclaration.prototype.isTransparent = function () {
|
|
3826
4719
|
return isTransparent(this.backgroundColor);
|
|
@@ -3829,21 +4722,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3829
4722
|
return this.transform !== null;
|
|
3830
4723
|
};
|
|
3831
4724
|
CSSParsedDeclaration.prototype.isPositioned = function () {
|
|
3832
|
-
return this.position !== 0 /* STATIC */;
|
|
4725
|
+
return this.position !== 0 /* POSITION.STATIC */;
|
|
3833
4726
|
};
|
|
3834
4727
|
CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () {
|
|
3835
4728
|
return this.isPositioned() && !this.zIndex.auto;
|
|
3836
4729
|
};
|
|
3837
4730
|
CSSParsedDeclaration.prototype.isFloating = function () {
|
|
3838
|
-
return this.float !== 0 /* NONE */;
|
|
4731
|
+
return this.float !== 0 /* FLOAT.NONE */;
|
|
3839
4732
|
};
|
|
3840
4733
|
CSSParsedDeclaration.prototype.isInlineLevel = function () {
|
|
3841
|
-
return (contains(this.display, 4 /* INLINE */) ||
|
|
3842
|
-
contains(this.display, 33554432 /* INLINE_BLOCK */) ||
|
|
3843
|
-
contains(this.display, 268435456 /* INLINE_FLEX */) ||
|
|
3844
|
-
contains(this.display, 536870912 /* INLINE_GRID */) ||
|
|
3845
|
-
contains(this.display, 67108864 /* INLINE_LIST_ITEM */) ||
|
|
3846
|
-
contains(this.display, 134217728 /* INLINE_TABLE */));
|
|
4734
|
+
return (contains(this.display, 4 /* DISPLAY.INLINE */) ||
|
|
4735
|
+
contains(this.display, 33554432 /* DISPLAY.INLINE_BLOCK */) ||
|
|
4736
|
+
contains(this.display, 268435456 /* DISPLAY.INLINE_FLEX */) ||
|
|
4737
|
+
contains(this.display, 536870912 /* DISPLAY.INLINE_GRID */) ||
|
|
4738
|
+
contains(this.display, 67108864 /* DISPLAY.INLINE_LIST_ITEM */) ||
|
|
4739
|
+
contains(this.display, 134217728 /* DISPLAY.INLINE_TABLE */));
|
|
3847
4740
|
};
|
|
3848
4741
|
return CSSParsedDeclaration;
|
|
3849
4742
|
}());
|
|
@@ -3868,16 +4761,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3868
4761
|
tokenizer.write(value);
|
|
3869
4762
|
var parser = new Parser(tokenizer.read());
|
|
3870
4763
|
switch (descriptor.type) {
|
|
3871
|
-
case 2 /* IDENT_VALUE */:
|
|
4764
|
+
case 2 /* PropertyDescriptorParsingType.IDENT_VALUE */:
|
|
3872
4765
|
var token = parser.parseComponentValue();
|
|
3873
4766
|
return descriptor.parse(context, isIdentToken(token) ? token.value : descriptor.initialValue);
|
|
3874
|
-
case 0 /* VALUE */:
|
|
4767
|
+
case 0 /* PropertyDescriptorParsingType.VALUE */:
|
|
3875
4768
|
return descriptor.parse(context, parser.parseComponentValue());
|
|
3876
|
-
case 1 /* LIST */:
|
|
4769
|
+
case 1 /* PropertyDescriptorParsingType.LIST */:
|
|
3877
4770
|
return descriptor.parse(context, parser.parseComponentValues());
|
|
3878
|
-
case 4 /* TOKEN_VALUE */:
|
|
4771
|
+
case 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */:
|
|
3879
4772
|
return parser.parseComponentValue();
|
|
3880
|
-
case 3 /* TYPE_VALUE */:
|
|
4773
|
+
case 3 /* PropertyDescriptorParsingType.TYPE_VALUE */:
|
|
3881
4774
|
switch (descriptor.format) {
|
|
3882
4775
|
case 'angle':
|
|
3883
4776
|
return angle.parse(context, parser.parseComponentValue());
|
|
@@ -3903,20 +4796,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3903
4796
|
var attribute = element.getAttribute(elementDebuggerAttribute);
|
|
3904
4797
|
switch (attribute) {
|
|
3905
4798
|
case 'all':
|
|
3906
|
-
return 1 /* ALL */;
|
|
4799
|
+
return 1 /* DebuggerType.ALL */;
|
|
3907
4800
|
case 'clone':
|
|
3908
|
-
return 2 /* CLONE */;
|
|
4801
|
+
return 2 /* DebuggerType.CLONE */;
|
|
3909
4802
|
case 'parse':
|
|
3910
|
-
return 3 /* PARSE */;
|
|
4803
|
+
return 3 /* DebuggerType.PARSE */;
|
|
3911
4804
|
case 'render':
|
|
3912
|
-
return 4 /* RENDER */;
|
|
4805
|
+
return 4 /* DebuggerType.RENDER */;
|
|
3913
4806
|
default:
|
|
3914
|
-
return 0 /* NONE */;
|
|
4807
|
+
return 0 /* DebuggerType.NONE */;
|
|
3915
4808
|
}
|
|
3916
4809
|
};
|
|
3917
4810
|
var isDebugging = function (element, type) {
|
|
3918
4811
|
var elementType = getElementDebugType(element);
|
|
3919
|
-
return elementType === 1 /* ALL */ || type === elementType;
|
|
4812
|
+
return elementType === 1 /* DebuggerType.ALL */ || type === elementType;
|
|
3920
4813
|
};
|
|
3921
4814
|
|
|
3922
4815
|
var ElementContainer = /** @class */ (function () {
|
|
@@ -3925,7 +4818,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3925
4818
|
this.textNodes = [];
|
|
3926
4819
|
this.elements = [];
|
|
3927
4820
|
this.flags = 0;
|
|
3928
|
-
if (isDebugging(element, 3 /* PARSE */)) {
|
|
4821
|
+
if (isDebugging(element, 3 /* DebuggerType.PARSE */)) {
|
|
3929
4822
|
debugger;
|
|
3930
4823
|
}
|
|
3931
4824
|
this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null));
|
|
@@ -3939,8 +4832,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
3939
4832
|
}
|
|
3940
4833
|
}
|
|
3941
4834
|
this.bounds = parseBounds(this.context, element);
|
|
3942
|
-
if (isDebugging(element, 4 /* RENDER */)) {
|
|
3943
|
-
this.flags |= 16 /* DEBUG_RENDER */;
|
|
4835
|
+
if (isDebugging(element, 4 /* DebuggerType.RENDER */)) {
|
|
4836
|
+
this.flags |= 16 /* FLAGS.DEBUG_RENDER */;
|
|
3944
4837
|
}
|
|
3945
4838
|
}
|
|
3946
4839
|
return ElementContainer;
|
|
@@ -4334,7 +5227,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4334
5227
|
var range = document.createRange();
|
|
4335
5228
|
if (range.getBoundingClientRect) {
|
|
4336
5229
|
var testElement = document.createElement('boundtest');
|
|
4337
|
-
testElement.style.height = TEST_HEIGHT
|
|
5230
|
+
testElement.style.height = "".concat(TEST_HEIGHT, "px");
|
|
4338
5231
|
testElement.style.display = 'block';
|
|
4339
5232
|
document.body.appendChild(testElement);
|
|
4340
5233
|
range.selectNode(testElement);
|
|
@@ -4424,8 +5317,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4424
5317
|
ctx.fillStyle = 'red';
|
|
4425
5318
|
ctx.fillRect(0, 0, size, size);
|
|
4426
5319
|
var node = document.createElement('div');
|
|
4427
|
-
node.style.backgroundImage = "url("
|
|
4428
|
-
node.style.height = size
|
|
5320
|
+
node.style.backgroundImage = "url(".concat(greenImageSrc, ")");
|
|
5321
|
+
node.style.height = "".concat(size, "px");
|
|
4429
5322
|
// Firefox 55 does not render inline <img /> tags
|
|
4430
5323
|
return isGreenPixel(data)
|
|
4431
5324
|
? loadSerializedSVG$1(createForeignObjectSVG(size, size, 0, 0, node))
|
|
@@ -4458,7 +5351,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4458
5351
|
var img = new Image();
|
|
4459
5352
|
img.onload = function () { return resolve(img); };
|
|
4460
5353
|
img.onerror = reject;
|
|
4461
|
-
img.src = "data:image/svg+xml;charset=utf-8,"
|
|
5354
|
+
img.src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svg)));
|
|
4462
5355
|
});
|
|
4463
5356
|
};
|
|
4464
5357
|
var FEATURES = {
|
|
@@ -4602,7 +5495,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4602
5495
|
var breakWords = function (str, styles) {
|
|
4603
5496
|
var breaker = LineBreaker(str, {
|
|
4604
5497
|
lineBreak: styles.lineBreak,
|
|
4605
|
-
wordBreak: styles.overflowWrap === "break-word" /* BREAK_WORD */ ? 'break-word' : styles.wordBreak
|
|
5498
|
+
wordBreak: styles.overflowWrap === "break-word" /* OVERFLOW_WRAP.BREAK_WORD */ ? 'break-word' : styles.wordBreak
|
|
4606
5499
|
});
|
|
4607
5500
|
var words = [];
|
|
4608
5501
|
var bk;
|
|
@@ -4643,11 +5536,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4643
5536
|
}());
|
|
4644
5537
|
var transform = function (text, transform) {
|
|
4645
5538
|
switch (transform) {
|
|
4646
|
-
case 1 /* LOWERCASE */:
|
|
5539
|
+
case 1 /* TEXT_TRANSFORM.LOWERCASE */:
|
|
4647
5540
|
return text.toLowerCase();
|
|
4648
|
-
case 3 /* CAPITALIZE */:
|
|
5541
|
+
case 3 /* TEXT_TRANSFORM.CAPITALIZE */:
|
|
4649
5542
|
return text.replace(CAPITALIZE, capitalize);
|
|
4650
|
-
case 2 /* UPPERCASE */:
|
|
5543
|
+
case 2 /* TEXT_TRANSFORM.UPPERCASE */:
|
|
4651
5544
|
return text.toUpperCase();
|
|
4652
5545
|
default:
|
|
4653
5546
|
return text;
|
|
@@ -4692,9 +5585,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4692
5585
|
var _this = _super.call(this, context, img) || this;
|
|
4693
5586
|
var s = new XMLSerializer();
|
|
4694
5587
|
var bounds = parseBounds(context, img);
|
|
4695
|
-
img.setAttribute('width', bounds.width
|
|
4696
|
-
img.setAttribute('height', bounds.height
|
|
4697
|
-
_this.svg = "data:image/svg+xml,"
|
|
5588
|
+
img.setAttribute('width', "".concat(bounds.width, "px"));
|
|
5589
|
+
img.setAttribute('height', "".concat(bounds.height, "px"));
|
|
5590
|
+
_this.svg = "data:image/svg+xml,".concat(encodeURIComponent(s.serializeToString(img)));
|
|
4698
5591
|
_this.intrinsicWidth = img.width.baseVal.value;
|
|
4699
5592
|
_this.intrinsicHeight = img.height.baseVal.value;
|
|
4700
5593
|
_this.context.cache.addImage(_this.svg);
|
|
@@ -4726,7 +5619,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4726
5619
|
|
|
4727
5620
|
var CHECKBOX_BORDER_RADIUS = [
|
|
4728
5621
|
{
|
|
4729
|
-
type: 15 /* DIMENSION_TOKEN */,
|
|
5622
|
+
type: 15 /* TokenType.DIMENSION_TOKEN */,
|
|
4730
5623
|
flags: 0,
|
|
4731
5624
|
unit: 'px',
|
|
4732
5625
|
number: 3
|
|
@@ -4734,7 +5627,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4734
5627
|
];
|
|
4735
5628
|
var RADIO_BORDER_RADIUS = [
|
|
4736
5629
|
{
|
|
4737
|
-
type: 16 /* PERCENTAGE_TOKEN */,
|
|
5630
|
+
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
4738
5631
|
flags: 0,
|
|
4739
5632
|
number: 50
|
|
4740
5633
|
}
|
|
@@ -4779,9 +5672,9 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4779
5672
|
_this.styles.borderRightStyle =
|
|
4780
5673
|
_this.styles.borderBottomStyle =
|
|
4781
5674
|
_this.styles.borderLeftStyle =
|
|
4782
|
-
1 /* SOLID */;
|
|
4783
|
-
_this.styles.backgroundClip = [0 /* BORDER_BOX */];
|
|
4784
|
-
_this.styles.backgroundOrigin = [0 /* BORDER_BOX */];
|
|
5675
|
+
1 /* BORDER_STYLE.SOLID */;
|
|
5676
|
+
_this.styles.backgroundClip = [0 /* BACKGROUND_CLIP.BORDER_BOX */];
|
|
5677
|
+
_this.styles.backgroundOrigin = [0 /* BACKGROUND_ORIGIN.BORDER_BOX */];
|
|
4785
5678
|
_this.bounds = reformatInputBounds(_this.bounds);
|
|
4786
5679
|
}
|
|
4787
5680
|
switch (_this.type) {
|
|
@@ -4863,7 +5756,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4863
5756
|
var parseNodeTree = function (context, node, parent, root) {
|
|
4864
5757
|
for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) {
|
|
4865
5758
|
nextNode = childNode.nextSibling;
|
|
4866
|
-
|
|
5759
|
+
// Fixes #2238 #1624 - Fix the issue of TextNode content being overlooked in rendering due to being perceived as blank by trim().
|
|
5760
|
+
if (isTextNode(childNode) && childNode.data.length > 0) {
|
|
4867
5761
|
parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
|
|
4868
5762
|
}
|
|
4869
5763
|
else if (isElementNode(childNode)) {
|
|
@@ -4874,13 +5768,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4874
5768
|
var container = createContainer(context, childNode);
|
|
4875
5769
|
if (container.styles.isVisible()) {
|
|
4876
5770
|
if (createsRealStackingContext(childNode, container, root)) {
|
|
4877
|
-
container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
|
|
5771
|
+
container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
|
|
4878
5772
|
}
|
|
4879
5773
|
else if (createsStackingContext(container.styles)) {
|
|
4880
|
-
container.flags |= 2 /* CREATES_STACKING_CONTEXT */;
|
|
5774
|
+
container.flags |= 2 /* FLAGS.CREATES_STACKING_CONTEXT */;
|
|
4881
5775
|
}
|
|
4882
5776
|
if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) {
|
|
4883
|
-
container.flags |= 8 /* IS_LIST_OWNER */;
|
|
5777
|
+
container.flags |= 8 /* FLAGS.IS_LIST_OWNER */;
|
|
4884
5778
|
}
|
|
4885
5779
|
parent.elements.push(container);
|
|
4886
5780
|
if (childNode.shadowRoot) {
|
|
@@ -4928,7 +5822,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
4928
5822
|
};
|
|
4929
5823
|
var parseTree = function (context, element) {
|
|
4930
5824
|
var container = createContainer(context, element);
|
|
4931
|
-
container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
|
|
5825
|
+
container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
|
|
4932
5826
|
parseNodeTree(context, element, container, container);
|
|
4933
5827
|
return container;
|
|
4934
5828
|
};
|
|
@@ -5196,7 +6090,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5196
6090
|
var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
|
|
5197
6091
|
var createCJKCounter = function (value, numbers, multipliers, negativeSign, suffix, flags) {
|
|
5198
6092
|
if (value < -9999 || value > 9999) {
|
|
5199
|
-
return createCounterText(value, 4 /* CJK_DECIMAL */, suffix.length > 0);
|
|
6093
|
+
return createCounterText(value, 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */, suffix.length > 0);
|
|
5200
6094
|
}
|
|
5201
6095
|
var tmp = Math.abs(value);
|
|
5202
6096
|
var string = suffix;
|
|
@@ -5232,101 +6126,101 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5232
6126
|
var koreanSuffix = appendSuffix ? ', ' : '';
|
|
5233
6127
|
var spaceSuffix = appendSuffix ? ' ' : '';
|
|
5234
6128
|
switch (type) {
|
|
5235
|
-
case 0 /* DISC */:
|
|
6129
|
+
case 0 /* LIST_STYLE_TYPE.DISC */:
|
|
5236
6130
|
return '•' + spaceSuffix;
|
|
5237
|
-
case 1 /* CIRCLE */:
|
|
6131
|
+
case 1 /* LIST_STYLE_TYPE.CIRCLE */:
|
|
5238
6132
|
return '◦' + spaceSuffix;
|
|
5239
|
-
case 2 /* SQUARE */:
|
|
6133
|
+
case 2 /* LIST_STYLE_TYPE.SQUARE */:
|
|
5240
6134
|
return '◾' + spaceSuffix;
|
|
5241
|
-
case 5 /* DECIMAL_LEADING_ZERO */:
|
|
6135
|
+
case 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */:
|
|
5242
6136
|
var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
|
5243
|
-
return string.length < 4 ? "0"
|
|
5244
|
-
case 4 /* CJK_DECIMAL */:
|
|
6137
|
+
return string.length < 4 ? "0".concat(string) : string;
|
|
6138
|
+
case 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */:
|
|
5245
6139
|
return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix);
|
|
5246
|
-
case 6 /* LOWER_ROMAN */:
|
|
5247
|
-
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
|
|
5248
|
-
case 7 /* UPPER_ROMAN */:
|
|
5249
|
-
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix);
|
|
5250
|
-
case 8 /* LOWER_GREEK */:
|
|
6140
|
+
case 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */:
|
|
6141
|
+
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix).toLowerCase();
|
|
6142
|
+
case 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */:
|
|
6143
|
+
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6144
|
+
case 8 /* LIST_STYLE_TYPE.LOWER_GREEK */:
|
|
5251
6145
|
return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
|
|
5252
|
-
case 9 /* LOWER_ALPHA */:
|
|
6146
|
+
case 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */:
|
|
5253
6147
|
return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
|
|
5254
|
-
case 10 /* UPPER_ALPHA */:
|
|
6148
|
+
case 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */:
|
|
5255
6149
|
return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
|
|
5256
|
-
case 11 /* ARABIC_INDIC */:
|
|
6150
|
+
case 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */:
|
|
5257
6151
|
return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
|
|
5258
|
-
case 12 /* ARMENIAN */:
|
|
5259
|
-
case 49 /* UPPER_ARMENIAN */:
|
|
5260
|
-
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix);
|
|
5261
|
-
case 35 /* LOWER_ARMENIAN */:
|
|
5262
|
-
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
|
|
5263
|
-
case 13 /* BENGALI */:
|
|
6152
|
+
case 12 /* LIST_STYLE_TYPE.ARMENIAN */:
|
|
6153
|
+
case 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */:
|
|
6154
|
+
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6155
|
+
case 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */:
|
|
6156
|
+
return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix).toLowerCase();
|
|
6157
|
+
case 13 /* LIST_STYLE_TYPE.BENGALI */:
|
|
5264
6158
|
return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
|
|
5265
|
-
case 14 /* CAMBODIAN */:
|
|
5266
|
-
case 30 /* KHMER */:
|
|
6159
|
+
case 14 /* LIST_STYLE_TYPE.CAMBODIAN */:
|
|
6160
|
+
case 30 /* LIST_STYLE_TYPE.KHMER */:
|
|
5267
6161
|
return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
|
|
5268
|
-
case 15 /* CJK_EARTHLY_BRANCH */:
|
|
6162
|
+
case 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */:
|
|
5269
6163
|
return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix);
|
|
5270
|
-
case 16 /* CJK_HEAVENLY_STEM */:
|
|
6164
|
+
case 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */:
|
|
5271
6165
|
return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix);
|
|
5272
|
-
case 17 /* CJK_IDEOGRAPHIC */:
|
|
5273
|
-
case 48 /* TRAD_CHINESE_INFORMAL */:
|
|
6166
|
+
case 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */:
|
|
6167
|
+
case 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */:
|
|
5274
6168
|
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5275
|
-
case 47 /* TRAD_CHINESE_FORMAL */:
|
|
6169
|
+
case 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */:
|
|
5276
6170
|
return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5277
|
-
case 42 /* SIMP_CHINESE_INFORMAL */:
|
|
6171
|
+
case 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */:
|
|
5278
6172
|
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5279
|
-
case 41 /* SIMP_CHINESE_FORMAL */:
|
|
6173
|
+
case 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */:
|
|
5280
6174
|
return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
|
5281
|
-
case 26 /* JAPANESE_INFORMAL */:
|
|
6175
|
+
case 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */:
|
|
5282
6176
|
return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0);
|
|
5283
|
-
case 25 /* JAPANESE_FORMAL */:
|
|
6177
|
+
case 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */:
|
|
5284
6178
|
return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5285
|
-
case 31 /* KOREAN_HANGUL_FORMAL */:
|
|
6179
|
+
case 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */:
|
|
5286
6180
|
return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5287
|
-
case 33 /* KOREAN_HANJA_INFORMAL */:
|
|
6181
|
+
case 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */:
|
|
5288
6182
|
return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0);
|
|
5289
|
-
case 32 /* KOREAN_HANJA_FORMAL */:
|
|
6183
|
+
case 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */:
|
|
5290
6184
|
return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
|
5291
|
-
case 18 /* DEVANAGARI */:
|
|
6185
|
+
case 18 /* LIST_STYLE_TYPE.DEVANAGARI */:
|
|
5292
6186
|
return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix);
|
|
5293
|
-
case 20 /* GEORGIAN */:
|
|
5294
|
-
return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* DECIMAL */, defaultSuffix);
|
|
5295
|
-
case 21 /* GUJARATI */:
|
|
6187
|
+
case 20 /* LIST_STYLE_TYPE.GEORGIAN */:
|
|
6188
|
+
return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6189
|
+
case 21 /* LIST_STYLE_TYPE.GUJARATI */:
|
|
5296
6190
|
return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix);
|
|
5297
|
-
case 22 /* GURMUKHI */:
|
|
6191
|
+
case 22 /* LIST_STYLE_TYPE.GURMUKHI */:
|
|
5298
6192
|
return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix);
|
|
5299
|
-
case 22 /* HEBREW */:
|
|
5300
|
-
return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* DECIMAL */, defaultSuffix);
|
|
5301
|
-
case 23 /* HIRAGANA */:
|
|
6193
|
+
case 22 /* LIST_STYLE_TYPE.HEBREW */:
|
|
6194
|
+
return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
|
|
6195
|
+
case 23 /* LIST_STYLE_TYPE.HIRAGANA */:
|
|
5302
6196
|
return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん');
|
|
5303
|
-
case 24 /* HIRAGANA_IROHA */:
|
|
6197
|
+
case 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */:
|
|
5304
6198
|
return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす');
|
|
5305
|
-
case 27 /* KANNADA */:
|
|
6199
|
+
case 27 /* LIST_STYLE_TYPE.KANNADA */:
|
|
5306
6200
|
return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
|
|
5307
|
-
case 28 /* KATAKANA */:
|
|
6201
|
+
case 28 /* LIST_STYLE_TYPE.KATAKANA */:
|
|
5308
6202
|
return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix);
|
|
5309
|
-
case 29 /* KATAKANA_IROHA */:
|
|
6203
|
+
case 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */:
|
|
5310
6204
|
return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix);
|
|
5311
|
-
case 34 /* LAO */:
|
|
6205
|
+
case 34 /* LIST_STYLE_TYPE.LAO */:
|
|
5312
6206
|
return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix);
|
|
5313
|
-
case 37 /* MONGOLIAN */:
|
|
6207
|
+
case 37 /* LIST_STYLE_TYPE.MONGOLIAN */:
|
|
5314
6208
|
return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix);
|
|
5315
|
-
case 38 /* MYANMAR */:
|
|
6209
|
+
case 38 /* LIST_STYLE_TYPE.MYANMAR */:
|
|
5316
6210
|
return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix);
|
|
5317
|
-
case 39 /* ORIYA */:
|
|
6211
|
+
case 39 /* LIST_STYLE_TYPE.ORIYA */:
|
|
5318
6212
|
return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix);
|
|
5319
|
-
case 40 /* PERSIAN */:
|
|
6213
|
+
case 40 /* LIST_STYLE_TYPE.PERSIAN */:
|
|
5320
6214
|
return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix);
|
|
5321
|
-
case 43 /* TAMIL */:
|
|
6215
|
+
case 43 /* LIST_STYLE_TYPE.TAMIL */:
|
|
5322
6216
|
return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix);
|
|
5323
|
-
case 44 /* TELUGU */:
|
|
6217
|
+
case 44 /* LIST_STYLE_TYPE.TELUGU */:
|
|
5324
6218
|
return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix);
|
|
5325
|
-
case 45 /* THAI */:
|
|
6219
|
+
case 45 /* LIST_STYLE_TYPE.THAI */:
|
|
5326
6220
|
return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix);
|
|
5327
|
-
case 46 /* TIBETAN */:
|
|
6221
|
+
case 46 /* LIST_STYLE_TYPE.TIBETAN */:
|
|
5328
6222
|
return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix);
|
|
5329
|
-
case 3 /* DECIMAL */:
|
|
6223
|
+
case 3 /* LIST_STYLE_TYPE.DECIMAL */:
|
|
5330
6224
|
default:
|
|
5331
6225
|
return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
|
5332
6226
|
}
|
|
@@ -5376,7 +6270,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5376
6270
|
onclone = this.options.onclone;
|
|
5377
6271
|
referenceElement = this.clonedReferenceElement;
|
|
5378
6272
|
if (typeof referenceElement === 'undefined') {
|
|
5379
|
-
return [2 /*return*/, Promise.reject("Error finding the "
|
|
6273
|
+
return [2 /*return*/, Promise.reject("Error finding the ".concat(this.referenceElement.nodeName, " in the cloned document"))];
|
|
5380
6274
|
}
|
|
5381
6275
|
if (!(documentClone.fonts && documentClone.fonts.ready)) return [3 /*break*/, 2];
|
|
5382
6276
|
return [4 /*yield*/, documentClone.fonts.ready];
|
|
@@ -5399,16 +6293,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5399
6293
|
}
|
|
5400
6294
|
});
|
|
5401
6295
|
}); });
|
|
6296
|
+
var adoptedNode = documentClone.adoptNode(this.documentElement);
|
|
6297
|
+
/**
|
|
6298
|
+
* The baseURI of the document will be lost after documentClone.open().
|
|
6299
|
+
* We can avoid it by adding <base> element.
|
|
6300
|
+
* */
|
|
6301
|
+
addBase(adoptedNode, documentClone);
|
|
5402
6302
|
documentClone.open();
|
|
5403
|
-
documentClone.write(serializeDoctype(document.doctype)
|
|
6303
|
+
documentClone.write("".concat(serializeDoctype(document.doctype), "<html></html>"));
|
|
5404
6304
|
// Chrome scrolls the parent document for some reason after the write to the cloned window???
|
|
5405
6305
|
restoreOwnerScroll(this.referenceElement.ownerDocument, scrollX, scrollY);
|
|
5406
|
-
documentClone.replaceChild(
|
|
6306
|
+
documentClone.replaceChild(adoptedNode, documentClone.documentElement);
|
|
5407
6307
|
documentClone.close();
|
|
5408
6308
|
return iframeLoad;
|
|
5409
6309
|
};
|
|
5410
6310
|
DocumentCloner.prototype.createElementClone = function (node) {
|
|
5411
|
-
if (isDebugging(node, 2 /* CLONE */)) {
|
|
6311
|
+
if (isDebugging(node, 2 /* DebuggerType.CLONE */)) {
|
|
5412
6312
|
debugger;
|
|
5413
6313
|
}
|
|
5414
6314
|
if (isCanvasElement(node)) {
|
|
@@ -5481,7 +6381,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5481
6381
|
clonedCanvas.width = canvas.width;
|
|
5482
6382
|
clonedCanvas.height = canvas.height;
|
|
5483
6383
|
var ctx = canvas.getContext('2d');
|
|
5484
|
-
var clonedCtx = clonedCanvas.getContext('2d');
|
|
6384
|
+
var clonedCtx = clonedCanvas.getContext('2d', { willReadFrequently: true });
|
|
5485
6385
|
if (clonedCtx) {
|
|
5486
6386
|
if (!this.options.allowTaint && ctx) {
|
|
5487
6387
|
clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
|
|
@@ -5616,16 +6516,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5616
6516
|
var anonymousReplacedElement = document.createElement('html2canvaspseudoelement');
|
|
5617
6517
|
copyCSSStyles(style, anonymousReplacedElement);
|
|
5618
6518
|
declaration.content.forEach(function (token) {
|
|
5619
|
-
if (token.type === 0 /* STRING_TOKEN */) {
|
|
6519
|
+
if (token.type === 0 /* TokenType.STRING_TOKEN */) {
|
|
5620
6520
|
anonymousReplacedElement.appendChild(document.createTextNode(token.value));
|
|
5621
6521
|
}
|
|
5622
|
-
else if (token.type === 22 /* URL_TOKEN */) {
|
|
6522
|
+
else if (token.type === 22 /* TokenType.URL_TOKEN */) {
|
|
5623
6523
|
var img = document.createElement('img');
|
|
5624
6524
|
img.src = token.value;
|
|
5625
6525
|
img.style.opacity = '1';
|
|
5626
6526
|
anonymousReplacedElement.appendChild(img);
|
|
5627
6527
|
}
|
|
5628
|
-
else if (token.type === 18 /* FUNCTION */) {
|
|
6528
|
+
else if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
5629
6529
|
if (token.name === 'attr') {
|
|
5630
6530
|
var attr = token.values.filter(isIdentToken);
|
|
5631
6531
|
if (attr.length) {
|
|
@@ -5638,7 +6538,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5638
6538
|
var counterState = _this.counters.getCounterValue(counter.value);
|
|
5639
6539
|
var counterType = counterStyle && isIdentToken(counterStyle)
|
|
5640
6540
|
? listStyleType.parse(_this.context, counterStyle.value)
|
|
5641
|
-
: 3 /* DECIMAL */;
|
|
6541
|
+
: 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
5642
6542
|
anonymousReplacedElement.appendChild(document.createTextNode(createCounterText(counterState, counterType, false)));
|
|
5643
6543
|
}
|
|
5644
6544
|
}
|
|
@@ -5648,8 +6548,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5648
6548
|
var counterStates = _this.counters.getCounterValues(counter.value);
|
|
5649
6549
|
var counterType_1 = counterStyle && isIdentToken(counterStyle)
|
|
5650
6550
|
? listStyleType.parse(_this.context, counterStyle.value)
|
|
5651
|
-
: 3 /* DECIMAL */;
|
|
5652
|
-
var separator = delim && delim.type === 0 /* STRING_TOKEN */ ? delim.value : '';
|
|
6551
|
+
: 3 /* LIST_STYLE_TYPE.DECIMAL */;
|
|
6552
|
+
var separator = delim && delim.type === 0 /* TokenType.STRING_TOKEN */ ? delim.value : '';
|
|
5653
6553
|
var text = counterStates
|
|
5654
6554
|
.map(function (value) { return createCounterText(value, counterType_1, false); })
|
|
5655
6555
|
.join(separator);
|
|
@@ -5658,7 +6558,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5658
6558
|
}
|
|
5659
6559
|
else ;
|
|
5660
6560
|
}
|
|
5661
|
-
else if (token.type === 20 /* IDENT_TOKEN */) {
|
|
6561
|
+
else if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
5662
6562
|
switch (token.value) {
|
|
5663
6563
|
case 'open-quote':
|
|
5664
6564
|
anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, _this.quoteDepth++, true)));
|
|
@@ -5672,10 +6572,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5672
6572
|
}
|
|
5673
6573
|
}
|
|
5674
6574
|
});
|
|
5675
|
-
anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE
|
|
6575
|
+
anonymousReplacedElement.className = "".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE, " ").concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER);
|
|
5676
6576
|
var newClassName = pseudoElt === PseudoElementType.BEFORE
|
|
5677
|
-
? " "
|
|
5678
|
-
: " "
|
|
6577
|
+
? " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE)
|
|
6578
|
+
: " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER);
|
|
5679
6579
|
if (isSVGElementNode(clone)) {
|
|
5680
6580
|
clone.className.baseValue += newClassName;
|
|
5681
6581
|
}
|
|
@@ -5774,10 +6674,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5774
6674
|
str += doctype.internalSubset;
|
|
5775
6675
|
}
|
|
5776
6676
|
if (doctype.publicId) {
|
|
5777
|
-
str += "\""
|
|
6677
|
+
str += "\"".concat(doctype.publicId, "\"");
|
|
5778
6678
|
}
|
|
5779
6679
|
if (doctype.systemId) {
|
|
5780
|
-
str += "\""
|
|
6680
|
+
str += "\"".concat(doctype.systemId, "\"");
|
|
5781
6681
|
}
|
|
5782
6682
|
str += '>';
|
|
5783
6683
|
}
|
|
@@ -5801,7 +6701,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5801
6701
|
var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after';
|
|
5802
6702
|
var PSEUDO_HIDE_ELEMENT_STYLE = "{\n content: \"\" !important;\n display: none !important;\n}";
|
|
5803
6703
|
var createPseudoHideStyles = function (body) {
|
|
5804
|
-
createStyles(body, "."
|
|
6704
|
+
createStyles(body, ".".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE).concat(PSEUDO_BEFORE).concat(PSEUDO_HIDE_ELEMENT_STYLE, "\n .").concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER).concat(PSEUDO_AFTER).concat(PSEUDO_HIDE_ELEMENT_STYLE));
|
|
5805
6705
|
};
|
|
5806
6706
|
var createStyles = function (body, styles) {
|
|
5807
6707
|
var document = body.ownerDocument;
|
|
@@ -5811,6 +6711,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5811
6711
|
body.appendChild(style);
|
|
5812
6712
|
}
|
|
5813
6713
|
};
|
|
6714
|
+
var addBase = function (targetELement, referenceDocument) {
|
|
6715
|
+
var _a;
|
|
6716
|
+
var baseNode = referenceDocument.createElement('base');
|
|
6717
|
+
baseNode.href = referenceDocument.baseURI;
|
|
6718
|
+
var headEle = targetELement.getElementsByTagName('head').item(0);
|
|
6719
|
+
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);
|
|
6720
|
+
};
|
|
5814
6721
|
|
|
5815
6722
|
var CacheStorage = /** @class */ (function () {
|
|
5816
6723
|
function CacheStorage() {
|
|
@@ -5888,7 +6795,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5888
6795
|
src = _a.sent();
|
|
5889
6796
|
_a.label = 2;
|
|
5890
6797
|
case 2:
|
|
5891
|
-
this.context.logger.debug("Added image "
|
|
6798
|
+
this.context.logger.debug("Added image ".concat(key.substring(0, 256)));
|
|
5892
6799
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
5893
6800
|
var img = new Image();
|
|
5894
6801
|
img.onload = function () { return resolve(img); };
|
|
@@ -5903,7 +6810,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5903
6810
|
setTimeout(function () { return resolve(img); }, 500);
|
|
5904
6811
|
}
|
|
5905
6812
|
if (_this._options.imageTimeout > 0) {
|
|
5906
|
-
setTimeout(function () { return reject("Timed out ("
|
|
6813
|
+
setTimeout(function () { return reject("Timed out (".concat(_this._options.imageTimeout, "ms) loading image")); }, _this._options.imageTimeout);
|
|
5907
6814
|
}
|
|
5908
6815
|
})];
|
|
5909
6816
|
case 3: return [2 /*return*/, _a.sent()];
|
|
@@ -5940,19 +6847,19 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5940
6847
|
}
|
|
5941
6848
|
}
|
|
5942
6849
|
else {
|
|
5943
|
-
reject("Failed to proxy resource "
|
|
6850
|
+
reject("Failed to proxy resource ".concat(key, " with status code ").concat(xhr.status));
|
|
5944
6851
|
}
|
|
5945
6852
|
};
|
|
5946
6853
|
xhr.onerror = reject;
|
|
5947
6854
|
var queryString = proxy.indexOf('?') > -1 ? '&' : '?';
|
|
5948
|
-
xhr.open('GET', ""
|
|
6855
|
+
xhr.open('GET', "".concat(proxy).concat(queryString, "url=").concat(encodeURIComponent(src), "&responseType=").concat(responseType));
|
|
5949
6856
|
if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
|
|
5950
6857
|
xhr.responseType = responseType;
|
|
5951
6858
|
}
|
|
5952
6859
|
if (_this._options.imageTimeout) {
|
|
5953
6860
|
var timeout_1 = _this._options.imageTimeout;
|
|
5954
6861
|
xhr.timeout = timeout_1;
|
|
5955
|
-
xhr.ontimeout = function () { return reject("Timed out ("
|
|
6862
|
+
xhr.ontimeout = function () { return reject("Timed out (".concat(timeout_1, "ms) proxying ").concat(key)); };
|
|
5956
6863
|
}
|
|
5957
6864
|
xhr.send();
|
|
5958
6865
|
});
|
|
@@ -5970,7 +6877,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5970
6877
|
|
|
5971
6878
|
var Vector = /** @class */ (function () {
|
|
5972
6879
|
function Vector(x, y) {
|
|
5973
|
-
this.type = 0 /* VECTOR */;
|
|
6880
|
+
this.type = 0 /* PathType.VECTOR */;
|
|
5974
6881
|
this.x = x;
|
|
5975
6882
|
this.y = y;
|
|
5976
6883
|
}
|
|
@@ -5985,7 +6892,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
5985
6892
|
};
|
|
5986
6893
|
var BezierCurve = /** @class */ (function () {
|
|
5987
6894
|
function BezierCurve(start, startControl, endControl, end) {
|
|
5988
|
-
this.type = 1 /* BEZIER_CURVE */;
|
|
6895
|
+
this.type = 1 /* PathType.BEZIER_CURVE */;
|
|
5989
6896
|
this.start = start;
|
|
5990
6897
|
this.startControl = startControl;
|
|
5991
6898
|
this.endControl = endControl;
|
|
@@ -6008,7 +6915,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6008
6915
|
};
|
|
6009
6916
|
return BezierCurve;
|
|
6010
6917
|
}());
|
|
6011
|
-
var isBezierCurve = function (path) { return path.type === 1 /* BEZIER_CURVE */; };
|
|
6918
|
+
var isBezierCurve = function (path) { return path.type === 1 /* PathType.BEZIER_CURVE */; };
|
|
6012
6919
|
|
|
6013
6920
|
var BoundCurves = /** @class */ (function () {
|
|
6014
6921
|
function BoundCurves(element) {
|
|
@@ -6195,8 +7102,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6195
7102
|
this.offsetX = offsetX;
|
|
6196
7103
|
this.offsetY = offsetY;
|
|
6197
7104
|
this.matrix = matrix;
|
|
6198
|
-
this.type = 0 /* TRANSFORM */;
|
|
6199
|
-
this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
|
|
7105
|
+
this.type = 0 /* EffectType.TRANSFORM */;
|
|
7106
|
+
this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
|
|
6200
7107
|
}
|
|
6201
7108
|
return TransformEffect;
|
|
6202
7109
|
}());
|
|
@@ -6204,23 +7111,23 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6204
7111
|
function ClipEffect(path, target) {
|
|
6205
7112
|
this.path = path;
|
|
6206
7113
|
this.target = target;
|
|
6207
|
-
this.type = 1 /* CLIP */;
|
|
7114
|
+
this.type = 1 /* EffectType.CLIP */;
|
|
6208
7115
|
}
|
|
6209
7116
|
return ClipEffect;
|
|
6210
7117
|
}());
|
|
6211
7118
|
var OpacityEffect = /** @class */ (function () {
|
|
6212
7119
|
function OpacityEffect(opacity) {
|
|
6213
7120
|
this.opacity = opacity;
|
|
6214
|
-
this.type = 2 /* OPACITY */;
|
|
6215
|
-
this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
|
|
7121
|
+
this.type = 2 /* EffectType.OPACITY */;
|
|
7122
|
+
this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
|
|
6216
7123
|
}
|
|
6217
7124
|
return OpacityEffect;
|
|
6218
7125
|
}());
|
|
6219
7126
|
var isTransformEffect = function (effect) {
|
|
6220
|
-
return effect.type === 0 /* TRANSFORM */;
|
|
7127
|
+
return effect.type === 0 /* EffectType.TRANSFORM */;
|
|
6221
7128
|
};
|
|
6222
|
-
var isClipEffect = function (effect) { return effect.type === 1 /* CLIP */; };
|
|
6223
|
-
var isOpacityEffect = function (effect) { return effect.type === 2 /* OPACITY */; };
|
|
7129
|
+
var isClipEffect = function (effect) { return effect.type === 1 /* EffectType.CLIP */; };
|
|
7130
|
+
var isOpacityEffect = function (effect) { return effect.type === 2 /* EffectType.OPACITY */; };
|
|
6224
7131
|
|
|
6225
7132
|
var equalPath = function (a, b) {
|
|
6226
7133
|
if (a.length === b.length) {
|
|
@@ -6272,34 +7179,34 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6272
7179
|
var matrix = this.container.styles.transform;
|
|
6273
7180
|
this.effects.push(new TransformEffect(offsetX, offsetY, matrix));
|
|
6274
7181
|
}
|
|
6275
|
-
if (this.container.styles.overflowX !== 0 /* VISIBLE */) {
|
|
7182
|
+
if (this.container.styles.overflowX !== 0 /* OVERFLOW.VISIBLE */) {
|
|
6276
7183
|
var borderBox = calculateBorderBoxPath(this.curves);
|
|
6277
7184
|
var paddingBox = calculatePaddingBoxPath(this.curves);
|
|
6278
7185
|
if (equalPath(borderBox, paddingBox)) {
|
|
6279
|
-
this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
|
|
7186
|
+
this.effects.push(new ClipEffect(borderBox, 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */));
|
|
6280
7187
|
}
|
|
6281
7188
|
else {
|
|
6282
|
-
this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */));
|
|
6283
|
-
this.effects.push(new ClipEffect(paddingBox, 4 /* CONTENT */));
|
|
7189
|
+
this.effects.push(new ClipEffect(borderBox, 2 /* EffectTarget.BACKGROUND_BORDERS */));
|
|
7190
|
+
this.effects.push(new ClipEffect(paddingBox, 4 /* EffectTarget.CONTENT */));
|
|
6284
7191
|
}
|
|
6285
7192
|
}
|
|
6286
7193
|
}
|
|
6287
7194
|
ElementPaint.prototype.getEffects = function (target) {
|
|
6288
|
-
var inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(this.container.styles.position) === -1;
|
|
7195
|
+
var inFlow = [2 /* POSITION.ABSOLUTE */, 3 /* POSITION.FIXED */].indexOf(this.container.styles.position) === -1;
|
|
6289
7196
|
var parent = this.parent;
|
|
6290
7197
|
var effects = this.effects.slice(0);
|
|
6291
7198
|
while (parent) {
|
|
6292
7199
|
var croplessEffects = parent.effects.filter(function (effect) { return !isClipEffect(effect); });
|
|
6293
|
-
if (inFlow || parent.container.styles.position !== 0 /* STATIC */ || !parent.parent) {
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
if (parent.container.styles.overflowX !== 0 /* VISIBLE */) {
|
|
7200
|
+
if (inFlow || parent.container.styles.position !== 0 /* POSITION.STATIC */ || !parent.parent) {
|
|
7201
|
+
inFlow = [2 /* POSITION.ABSOLUTE */, 3 /* POSITION.FIXED */].indexOf(parent.container.styles.position) === -1;
|
|
7202
|
+
if (parent.container.styles.overflowX !== 0 /* OVERFLOW.VISIBLE */) {
|
|
6297
7203
|
var borderBox = calculateBorderBoxPath(parent.curves);
|
|
6298
7204
|
var paddingBox = calculatePaddingBoxPath(parent.curves);
|
|
6299
7205
|
if (!equalPath(borderBox, paddingBox)) {
|
|
6300
|
-
effects.unshift(new ClipEffect(paddingBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
|
|
7206
|
+
effects.unshift(new ClipEffect(paddingBox, 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */));
|
|
6301
7207
|
}
|
|
6302
7208
|
}
|
|
7209
|
+
effects.unshift.apply(effects, croplessEffects);
|
|
6303
7210
|
}
|
|
6304
7211
|
else {
|
|
6305
7212
|
effects.unshift.apply(effects, croplessEffects);
|
|
@@ -6312,13 +7219,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6312
7219
|
}());
|
|
6313
7220
|
var parseStackTree = function (parent, stackingContext, realStackingContext, listItems) {
|
|
6314
7221
|
parent.container.elements.forEach(function (child) {
|
|
6315
|
-
var treatAsRealStackingContext = contains(child.flags, 4 /* CREATES_REAL_STACKING_CONTEXT */);
|
|
6316
|
-
var createsStackingContext = contains(child.flags, 2 /* CREATES_STACKING_CONTEXT */);
|
|
7222
|
+
var treatAsRealStackingContext = contains(child.flags, 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */);
|
|
7223
|
+
var createsStackingContext = contains(child.flags, 2 /* FLAGS.CREATES_STACKING_CONTEXT */);
|
|
6317
7224
|
var paintContainer = new ElementPaint(child, parent);
|
|
6318
|
-
if (contains(child.styles.display, 2048 /* LIST_ITEM */)) {
|
|
7225
|
+
if (contains(child.styles.display, 2048 /* DISPLAY.LIST_ITEM */)) {
|
|
6319
7226
|
listItems.push(paintContainer);
|
|
6320
7227
|
}
|
|
6321
|
-
var listOwnerItems = contains(child.flags, 8 /* IS_LIST_OWNER */) ? [] : listItems;
|
|
7228
|
+
var listOwnerItems = contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */) ? [] : listItems;
|
|
6322
7229
|
if (treatAsRealStackingContext || createsStackingContext) {
|
|
6323
7230
|
var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext;
|
|
6324
7231
|
var stack = new StackingContext(paintContainer);
|
|
@@ -6375,7 +7282,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6375
7282
|
}
|
|
6376
7283
|
parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems);
|
|
6377
7284
|
}
|
|
6378
|
-
if (contains(child.flags, 8 /* IS_LIST_OWNER */)) {
|
|
7285
|
+
if (contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */)) {
|
|
6379
7286
|
processListItems(child, listOwnerItems);
|
|
6380
7287
|
}
|
|
6381
7288
|
});
|
|
@@ -6516,19 +7423,19 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6516
7423
|
};
|
|
6517
7424
|
|
|
6518
7425
|
var calculateBackgroundPositioningArea = function (backgroundOrigin, element) {
|
|
6519
|
-
if (backgroundOrigin === 0 /* BORDER_BOX */) {
|
|
7426
|
+
if (backgroundOrigin === 0 /* BACKGROUND_ORIGIN.BORDER_BOX */) {
|
|
6520
7427
|
return element.bounds;
|
|
6521
7428
|
}
|
|
6522
|
-
if (backgroundOrigin === 2 /* CONTENT_BOX */) {
|
|
7429
|
+
if (backgroundOrigin === 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */) {
|
|
6523
7430
|
return contentBox(element);
|
|
6524
7431
|
}
|
|
6525
7432
|
return paddingBox(element);
|
|
6526
7433
|
};
|
|
6527
7434
|
var calculateBackgroundPaintingArea = function (backgroundClip, element) {
|
|
6528
|
-
if (backgroundClip === 0 /* BORDER_BOX */) {
|
|
7435
|
+
if (backgroundClip === 0 /* BACKGROUND_CLIP.BORDER_BOX */) {
|
|
6529
7436
|
return element.bounds;
|
|
6530
7437
|
}
|
|
6531
|
-
if (backgroundClip === 2 /* CONTENT_BOX */) {
|
|
7438
|
+
if (backgroundClip === 2 /* BACKGROUND_CLIP.CONTENT_BOX */) {
|
|
6532
7439
|
return contentBox(element);
|
|
6533
7440
|
}
|
|
6534
7441
|
return paddingBox(element);
|
|
@@ -6542,6 +7449,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6542
7449
|
var path = calculateBackgroundRepeatPath(getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea);
|
|
6543
7450
|
var offsetX = Math.round(backgroundPositioningArea.left + position[0]);
|
|
6544
7451
|
var offsetY = Math.round(backgroundPositioningArea.top + position[1]);
|
|
7452
|
+
sizeWidth = Math.max(1, sizeWidth);
|
|
7453
|
+
sizeHeight = Math.max(1, sizeHeight);
|
|
6545
7454
|
return [path, offsetX, offsetY, sizeWidth, sizeHeight];
|
|
6546
7455
|
};
|
|
6547
7456
|
var isAuto = function (token) { return isIdentToken(token) && token.value === BACKGROUND_SIZE.AUTO; };
|
|
@@ -6656,21 +7565,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6656
7565
|
var x = _a[0], y = _a[1];
|
|
6657
7566
|
var width = _b[0], height = _b[1];
|
|
6658
7567
|
switch (repeat) {
|
|
6659
|
-
case 2 /* REPEAT_X */:
|
|
7568
|
+
case 2 /* BACKGROUND_REPEAT.REPEAT_X */:
|
|
6660
7569
|
return [
|
|
6661
7570
|
new Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)),
|
|
6662
7571
|
new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)),
|
|
6663
7572
|
new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)),
|
|
6664
7573
|
new Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y))
|
|
6665
7574
|
];
|
|
6666
|
-
case 3 /* REPEAT_Y */:
|
|
7575
|
+
case 3 /* BACKGROUND_REPEAT.REPEAT_Y */:
|
|
6667
7576
|
return [
|
|
6668
7577
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)),
|
|
6669
7578
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)),
|
|
6670
7579
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)),
|
|
6671
7580
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top))
|
|
6672
7581
|
];
|
|
6673
|
-
case 1 /* NO_REPEAT */:
|
|
7582
|
+
case 1 /* BACKGROUND_REPEAT.NO_REPEAT */:
|
|
6674
7583
|
return [
|
|
6675
7584
|
new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)),
|
|
6676
7585
|
new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)),
|
|
@@ -6730,7 +7639,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6730
7639
|
return { baseline: baseline, middle: middle };
|
|
6731
7640
|
};
|
|
6732
7641
|
FontMetrics.prototype.getMetrics = function (fontFamily, fontSize) {
|
|
6733
|
-
var key = fontFamily
|
|
7642
|
+
var key = "".concat(fontFamily, " ").concat(fontSize);
|
|
6734
7643
|
if (typeof this._data[key] === 'undefined') {
|
|
6735
7644
|
this._data[key] = this.parseMetrics(fontFamily, fontSize);
|
|
6736
7645
|
}
|
|
@@ -6758,15 +7667,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6758
7667
|
if (!options.canvas) {
|
|
6759
7668
|
_this.canvas.width = Math.floor(options.width * options.scale);
|
|
6760
7669
|
_this.canvas.height = Math.floor(options.height * options.scale);
|
|
6761
|
-
_this.canvas.style.width = options.width
|
|
6762
|
-
_this.canvas.style.height = options.height
|
|
7670
|
+
_this.canvas.style.width = "".concat(options.width, "px");
|
|
7671
|
+
_this.canvas.style.height = "".concat(options.height, "px");
|
|
6763
7672
|
}
|
|
6764
7673
|
_this.fontMetrics = new FontMetrics(document);
|
|
6765
7674
|
_this.ctx.scale(_this.options.scale, _this.options.scale);
|
|
6766
7675
|
_this.ctx.translate(-options.x, -options.y);
|
|
6767
7676
|
_this.ctx.textBaseline = 'bottom';
|
|
6768
7677
|
_this._activeEffects = [];
|
|
6769
|
-
_this.context.logger.debug("Canvas renderer initialized ("
|
|
7678
|
+
_this.context.logger.debug("Canvas renderer initialized (".concat(options.width, "x").concat(options.height, ") with scale ").concat(options.scale));
|
|
6770
7679
|
return _this;
|
|
6771
7680
|
}
|
|
6772
7681
|
CanvasRenderer.prototype.applyEffects = function (effects) {
|
|
@@ -6818,7 +7727,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6818
7727
|
return __generator(this, function (_a) {
|
|
6819
7728
|
switch (_a.label) {
|
|
6820
7729
|
case 0:
|
|
6821
|
-
if (contains(paint.container.flags, 16 /* DEBUG_RENDER */)) {
|
|
7730
|
+
if (contains(paint.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
|
|
6822
7731
|
debugger;
|
|
6823
7732
|
}
|
|
6824
7733
|
if (!paint.container.styles.isVisible()) return [3 /*break*/, 3];
|
|
@@ -6837,7 +7746,15 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6837
7746
|
CanvasRenderer.prototype.renderTextWithLetterSpacing = function (text, letterSpacing, baseline) {
|
|
6838
7747
|
var _this = this;
|
|
6839
7748
|
if (letterSpacing === 0) {
|
|
6840
|
-
|
|
7749
|
+
// Fixed an issue with characters moving up in non-Firefox.
|
|
7750
|
+
// https://github.com/niklasvh/html2canvas/issues/2107#issuecomment-692462900
|
|
7751
|
+
if (navigator.userAgent.indexOf('Firefox') === -1) {
|
|
7752
|
+
this.ctx.textBaseline = 'ideographic';
|
|
7753
|
+
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
|
7754
|
+
}
|
|
7755
|
+
else {
|
|
7756
|
+
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + baseline);
|
|
7757
|
+
}
|
|
6841
7758
|
}
|
|
6842
7759
|
else {
|
|
6843
7760
|
var letters = segmentGraphemes(text.text);
|
|
@@ -6853,8 +7770,8 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6853
7770
|
.join('');
|
|
6854
7771
|
var fontFamily = fixIOSSystemFonts(styles.fontFamily).join(', ');
|
|
6855
7772
|
var fontSize = isDimensionToken(styles.fontSize)
|
|
6856
|
-
? ""
|
|
6857
|
-
: styles.fontSize.number
|
|
7773
|
+
? "".concat(styles.fontSize.number).concat(styles.fontSize.unit)
|
|
7774
|
+
: "".concat(styles.fontSize.number, "px");
|
|
6858
7775
|
return [
|
|
6859
7776
|
[styles.fontStyle, fontVariant, styles.fontWeight, fontSize, fontFamily].join(' '),
|
|
6860
7777
|
fontFamily,
|
|
@@ -6863,22 +7780,21 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6863
7780
|
};
|
|
6864
7781
|
CanvasRenderer.prototype.renderTextNode = function (text, styles) {
|
|
6865
7782
|
return __awaiter(this, void 0, void 0, function () {
|
|
6866
|
-
var
|
|
7783
|
+
var font, paintOrder;
|
|
6867
7784
|
var _this = this;
|
|
6868
|
-
return __generator(this, function (
|
|
6869
|
-
|
|
7785
|
+
return __generator(this, function (_a) {
|
|
7786
|
+
font = this.createFontStyle(styles)[0];
|
|
6870
7787
|
this.ctx.font = font;
|
|
6871
|
-
this.ctx.direction = styles.direction === 1 /* RTL */ ? 'rtl' : 'ltr';
|
|
7788
|
+
this.ctx.direction = styles.direction === 1 /* DIRECTION.RTL */ ? 'rtl' : 'ltr';
|
|
6872
7789
|
this.ctx.textAlign = 'left';
|
|
6873
7790
|
this.ctx.textBaseline = 'alphabetic';
|
|
6874
|
-
_b = this.fontMetrics.getMetrics(fontFamily, fontSize), baseline = _b.baseline, middle = _b.middle;
|
|
6875
7791
|
paintOrder = styles.paintOrder;
|
|
6876
7792
|
text.textBounds.forEach(function (text) {
|
|
6877
7793
|
paintOrder.forEach(function (paintOrderLayer) {
|
|
6878
7794
|
switch (paintOrderLayer) {
|
|
6879
|
-
case 0 /* FILL */:
|
|
7795
|
+
case 0 /* PAINT_ORDER_LAYER.FILL */:
|
|
6880
7796
|
_this.ctx.fillStyle = asString(styles.color);
|
|
6881
|
-
_this.renderTextWithLetterSpacing(text, styles.letterSpacing,
|
|
7797
|
+
_this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
|
|
6882
7798
|
var textShadows = styles.textShadow;
|
|
6883
7799
|
if (textShadows.length && text.text.trim().length) {
|
|
6884
7800
|
textShadows
|
|
@@ -6889,7 +7805,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6889
7805
|
_this.ctx.shadowOffsetX = textShadow.offsetX.number * _this.options.scale;
|
|
6890
7806
|
_this.ctx.shadowOffsetY = textShadow.offsetY.number * _this.options.scale;
|
|
6891
7807
|
_this.ctx.shadowBlur = textShadow.blur.number;
|
|
6892
|
-
_this.renderTextWithLetterSpacing(text, styles.letterSpacing,
|
|
7808
|
+
_this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
|
|
6893
7809
|
});
|
|
6894
7810
|
_this.ctx.shadowColor = '';
|
|
6895
7811
|
_this.ctx.shadowOffsetX = 0;
|
|
@@ -6898,32 +7814,30 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6898
7814
|
}
|
|
6899
7815
|
if (styles.textDecorationLine.length) {
|
|
6900
7816
|
_this.ctx.fillStyle = asString(styles.textDecorationColor || styles.color);
|
|
7817
|
+
var decorationLineHeight_1 = 1;
|
|
6901
7818
|
styles.textDecorationLine.forEach(function (textDecorationLine) {
|
|
7819
|
+
// Fix the issue where textDecorationLine exhibits x-axis positioning errors on high-resolution devices due to varying devicePixelRatio, corrected by using relative values of element heights.
|
|
6902
7820
|
switch (textDecorationLine) {
|
|
6903
|
-
case 1 /* UNDERLINE */:
|
|
6904
|
-
|
|
6905
|
-
// TODO As some browsers display the line as more than 1px if the font-size is big,
|
|
6906
|
-
// need to take that into account both in position and size
|
|
6907
|
-
_this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1);
|
|
7821
|
+
case 1 /* TEXT_DECORATION_LINE.UNDERLINE */:
|
|
7822
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top + text.bounds.height - decorationLineHeight_1, text.bounds.width, decorationLineHeight_1);
|
|
6908
7823
|
break;
|
|
6909
|
-
case 2 /* OVERLINE */:
|
|
6910
|
-
_this.ctx.fillRect(text.bounds.left,
|
|
7824
|
+
case 2 /* TEXT_DECORATION_LINE.OVERLINE */:
|
|
7825
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top, text.bounds.width, decorationLineHeight_1);
|
|
6911
7826
|
break;
|
|
6912
|
-
case 3 /* LINE_THROUGH */:
|
|
6913
|
-
|
|
6914
|
-
_this.ctx.fillRect(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1);
|
|
7827
|
+
case 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */:
|
|
7828
|
+
_this.ctx.fillRect(text.bounds.left, text.bounds.top + (text.bounds.height / 2 - decorationLineHeight_1 / 2), text.bounds.width, decorationLineHeight_1);
|
|
6915
7829
|
break;
|
|
6916
7830
|
}
|
|
6917
7831
|
});
|
|
6918
7832
|
}
|
|
6919
7833
|
break;
|
|
6920
|
-
case 1 /* STROKE */:
|
|
7834
|
+
case 1 /* PAINT_ORDER_LAYER.STROKE */:
|
|
6921
7835
|
if (styles.webkitTextStrokeWidth && text.text.trim().length) {
|
|
6922
7836
|
_this.ctx.strokeStyle = asString(styles.webkitTextStrokeColor);
|
|
6923
7837
|
_this.ctx.lineWidth = styles.webkitTextStrokeWidth;
|
|
6924
7838
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6925
7839
|
_this.ctx.lineJoin = !!window.chrome ? 'miter' : 'round';
|
|
6926
|
-
_this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top +
|
|
7840
|
+
_this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
|
6927
7841
|
}
|
|
6928
7842
|
_this.ctx.strokeStyle = '';
|
|
6929
7843
|
_this.ctx.lineWidth = 0;
|
|
@@ -6937,13 +7851,89 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6937
7851
|
});
|
|
6938
7852
|
};
|
|
6939
7853
|
CanvasRenderer.prototype.renderReplacedElement = function (container, curves, image) {
|
|
6940
|
-
|
|
7854
|
+
var intrinsicWidth = image.naturalWidth || container.intrinsicWidth;
|
|
7855
|
+
var intrinsicHeight = image.naturalHeight || container.intrinsicHeight;
|
|
7856
|
+
if (image && intrinsicWidth > 0 && intrinsicHeight > 0) {
|
|
6941
7857
|
var box = contentBox(container);
|
|
6942
7858
|
var path = calculatePaddingBoxPath(curves);
|
|
6943
7859
|
this.path(path);
|
|
6944
7860
|
this.ctx.save();
|
|
6945
7861
|
this.ctx.clip();
|
|
6946
|
-
|
|
7862
|
+
var sx = 0, sy = 0, sw = intrinsicWidth, sh = intrinsicHeight, dx = box.left, dy = box.top, dw = box.width, dh = box.height;
|
|
7863
|
+
var objectFit = container.styles.objectFit;
|
|
7864
|
+
var boxRatio = dw / dh;
|
|
7865
|
+
var imgRatio = sw / sh;
|
|
7866
|
+
if (objectFit === 2 /* OBJECT_FIT.CONTAIN */) {
|
|
7867
|
+
if (imgRatio > boxRatio) {
|
|
7868
|
+
dh = dw / imgRatio;
|
|
7869
|
+
dy += (box.height - dh) / 2;
|
|
7870
|
+
}
|
|
7871
|
+
else {
|
|
7872
|
+
dw = dh * imgRatio;
|
|
7873
|
+
dx += (box.width - dw) / 2;
|
|
7874
|
+
}
|
|
7875
|
+
}
|
|
7876
|
+
else if (objectFit === 4 /* OBJECT_FIT.COVER */) {
|
|
7877
|
+
if (imgRatio > boxRatio) {
|
|
7878
|
+
sw = sh * boxRatio;
|
|
7879
|
+
sx += (intrinsicWidth - sw) / 2;
|
|
7880
|
+
}
|
|
7881
|
+
else {
|
|
7882
|
+
sh = sw / boxRatio;
|
|
7883
|
+
sy += (intrinsicHeight - sh) / 2;
|
|
7884
|
+
}
|
|
7885
|
+
}
|
|
7886
|
+
else if (objectFit === 8 /* OBJECT_FIT.NONE */) {
|
|
7887
|
+
if (sw > dw) {
|
|
7888
|
+
sx += (sw - dw) / 2;
|
|
7889
|
+
sw = dw;
|
|
7890
|
+
}
|
|
7891
|
+
else {
|
|
7892
|
+
dx += (dw - sw) / 2;
|
|
7893
|
+
dw = sw;
|
|
7894
|
+
}
|
|
7895
|
+
if (sh > dh) {
|
|
7896
|
+
sy += (sh - dh) / 2;
|
|
7897
|
+
sh = dh;
|
|
7898
|
+
}
|
|
7899
|
+
else {
|
|
7900
|
+
dy += (dh - sh) / 2;
|
|
7901
|
+
dh = sh;
|
|
7902
|
+
}
|
|
7903
|
+
}
|
|
7904
|
+
else if (objectFit === 16 /* OBJECT_FIT.SCALE_DOWN */) {
|
|
7905
|
+
var containW = imgRatio > boxRatio ? dw : dh * imgRatio;
|
|
7906
|
+
var noneW = sw > dw ? sw : dw;
|
|
7907
|
+
if (containW < noneW) {
|
|
7908
|
+
if (imgRatio > boxRatio) {
|
|
7909
|
+
dh = dw / imgRatio;
|
|
7910
|
+
dy += (box.height - dh) / 2;
|
|
7911
|
+
}
|
|
7912
|
+
else {
|
|
7913
|
+
dw = dh * imgRatio;
|
|
7914
|
+
dx += (box.width - dw) / 2;
|
|
7915
|
+
}
|
|
7916
|
+
}
|
|
7917
|
+
else {
|
|
7918
|
+
if (sw > dw) {
|
|
7919
|
+
sx += (sw - dw) / 2;
|
|
7920
|
+
sw = dw;
|
|
7921
|
+
}
|
|
7922
|
+
else {
|
|
7923
|
+
dx += (dw - sw) / 2;
|
|
7924
|
+
dw = sw;
|
|
7925
|
+
}
|
|
7926
|
+
if (sh > dh) {
|
|
7927
|
+
sy += (sh - dh) / 2;
|
|
7928
|
+
sh = dh;
|
|
7929
|
+
}
|
|
7930
|
+
else {
|
|
7931
|
+
dy += (dh - sh) / 2;
|
|
7932
|
+
dh = sh;
|
|
7933
|
+
}
|
|
7934
|
+
}
|
|
7935
|
+
}
|
|
7936
|
+
this.ctx.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh);
|
|
6947
7937
|
this.ctx.restore();
|
|
6948
7938
|
}
|
|
6949
7939
|
};
|
|
@@ -6953,7 +7943,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6953
7943
|
return __generator(this, function (_c) {
|
|
6954
7944
|
switch (_c.label) {
|
|
6955
7945
|
case 0:
|
|
6956
|
-
this.applyEffects(paint.getEffects(4 /* CONTENT */));
|
|
7946
|
+
this.applyEffects(paint.getEffects(4 /* EffectTarget.CONTENT */));
|
|
6957
7947
|
container = paint.container;
|
|
6958
7948
|
curves = paint.curves;
|
|
6959
7949
|
styles = container.styles;
|
|
@@ -6981,7 +7971,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6981
7971
|
return [3 /*break*/, 8];
|
|
6982
7972
|
case 7:
|
|
6983
7973
|
_c.sent();
|
|
6984
|
-
this.context.logger.error("Error loading image "
|
|
7974
|
+
this.context.logger.error("Error loading image ".concat(container.src));
|
|
6985
7975
|
return [3 /*break*/, 8];
|
|
6986
7976
|
case 8:
|
|
6987
7977
|
if (container instanceof CanvasElementContainer) {
|
|
@@ -6998,7 +7988,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
6998
7988
|
return [3 /*break*/, 12];
|
|
6999
7989
|
case 11:
|
|
7000
7990
|
_c.sent();
|
|
7001
|
-
this.context.logger.error("Error loading svg "
|
|
7991
|
+
this.context.logger.error("Error loading svg ".concat(container.svg.substring(0, 255)));
|
|
7002
7992
|
return [3 /*break*/, 12];
|
|
7003
7993
|
case 12:
|
|
7004
7994
|
if (!(container instanceof IFrameElementContainer && container.tree)) return [3 /*break*/, 14];
|
|
@@ -7058,10 +8048,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7058
8048
|
bounds = contentBox(container);
|
|
7059
8049
|
x = 0;
|
|
7060
8050
|
switch (container.styles.textAlign) {
|
|
7061
|
-
case 1 /* CENTER */:
|
|
8051
|
+
case 1 /* TEXT_ALIGN.CENTER */:
|
|
7062
8052
|
x += bounds.width / 2;
|
|
7063
8053
|
break;
|
|
7064
|
-
case 2 /* RIGHT */:
|
|
8054
|
+
case 2 /* TEXT_ALIGN.RIGHT */:
|
|
7065
8055
|
x += bounds.width;
|
|
7066
8056
|
break;
|
|
7067
8057
|
}
|
|
@@ -7079,10 +8069,10 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7079
8069
|
this.ctx.textBaseline = 'alphabetic';
|
|
7080
8070
|
this.ctx.textAlign = 'left';
|
|
7081
8071
|
}
|
|
7082
|
-
if (!contains(container.styles.display, 2048 /* LIST_ITEM */)) return [3 /*break*/, 20];
|
|
8072
|
+
if (!contains(container.styles.display, 2048 /* DISPLAY.LIST_ITEM */)) return [3 /*break*/, 20];
|
|
7083
8073
|
if (!(container.styles.listStyleImage !== null)) return [3 /*break*/, 19];
|
|
7084
8074
|
img = container.styles.listStyleImage;
|
|
7085
|
-
if (!(img.type === 0 /* URL */)) return [3 /*break*/, 18];
|
|
8075
|
+
if (!(img.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 18];
|
|
7086
8076
|
image = void 0;
|
|
7087
8077
|
url = img.url;
|
|
7088
8078
|
_c.label = 15;
|
|
@@ -7095,11 +8085,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7095
8085
|
return [3 /*break*/, 18];
|
|
7096
8086
|
case 17:
|
|
7097
8087
|
_c.sent();
|
|
7098
|
-
this.context.logger.error("Error loading list-style-image "
|
|
8088
|
+
this.context.logger.error("Error loading list-style-image ".concat(url));
|
|
7099
8089
|
return [3 /*break*/, 18];
|
|
7100
8090
|
case 18: return [3 /*break*/, 20];
|
|
7101
8091
|
case 19:
|
|
7102
|
-
if (paint.listValue && container.styles.listStyleType !== -1 /* NONE */) {
|
|
8092
|
+
if (paint.listValue && container.styles.listStyleType !== -1 /* LIST_STYLE_TYPE.NONE */) {
|
|
7103
8093
|
fontFamily = this.createFontStyle(styles)[0];
|
|
7104
8094
|
this.ctx.font = fontFamily;
|
|
7105
8095
|
this.ctx.fillStyle = asString(styles.color);
|
|
@@ -7122,7 +8112,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7122
8112
|
return __generator(this, function (_p) {
|
|
7123
8113
|
switch (_p.label) {
|
|
7124
8114
|
case 0:
|
|
7125
|
-
if (contains(stack.element.container.flags, 16 /* DEBUG_RENDER */)) {
|
|
8115
|
+
if (contains(stack.element.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
|
|
7126
8116
|
debugger;
|
|
7127
8117
|
}
|
|
7128
8118
|
// https://www.w3.org/TR/css-position-3/#painting-order
|
|
@@ -7270,10 +8260,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7270
8260
|
this.ctx.translate(-offsetX, -offsetY);
|
|
7271
8261
|
};
|
|
7272
8262
|
CanvasRenderer.prototype.resizeImage = function (image, width, height) {
|
|
8263
|
+
// https://github.com/niklasvh/html2canvas/pull/2911
|
|
8264
|
+
// if (image.width === width && image.height === height) {
|
|
8265
|
+
// return image;
|
|
8266
|
+
// }
|
|
7273
8267
|
var _a;
|
|
7274
|
-
if (image.width === width && image.height === height) {
|
|
7275
|
-
return image;
|
|
7276
|
-
}
|
|
7277
8268
|
var ownerDocument = (_a = this.canvas.ownerDocument) !== null && _a !== void 0 ? _a : document;
|
|
7278
8269
|
var canvas = ownerDocument.createElement('canvas');
|
|
7279
8270
|
canvas.width = Math.max(1, width);
|
|
@@ -7290,11 +8281,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7290
8281
|
case 0:
|
|
7291
8282
|
index = container.styles.backgroundImage.length - 1;
|
|
7292
8283
|
_loop_1 = function (backgroundImage) {
|
|
7293
|
-
var image, url, _c, path, x, y, width, height, pattern, _d, path, x, y, width, height, _e, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _f, path, left, top_1, width, height, position, x, y, _g, rx, ry, radialGradient_1, midX, midY, f, invF;
|
|
8284
|
+
var image, url, imageWidth, imageHeight, _c, path, x, y, width, height, pattern, _d, path, x, y, width, height, _e, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _f, path, left, top_1, width, height, position, x, y, _g, rx, ry, radialGradient_1, midX, midY, f, invF;
|
|
7294
8285
|
return __generator(this, function (_h) {
|
|
7295
8286
|
switch (_h.label) {
|
|
7296
8287
|
case 0:
|
|
7297
|
-
if (!(backgroundImage.type === 0 /* URL */)) return [3 /*break*/, 5];
|
|
8288
|
+
if (!(backgroundImage.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 5];
|
|
7298
8289
|
image = void 0;
|
|
7299
8290
|
url = backgroundImage.url;
|
|
7300
8291
|
_h.label = 1;
|
|
@@ -7306,14 +8297,16 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7306
8297
|
return [3 /*break*/, 4];
|
|
7307
8298
|
case 3:
|
|
7308
8299
|
_h.sent();
|
|
7309
|
-
this_1.context.logger.error("Error loading background-image "
|
|
8300
|
+
this_1.context.logger.error("Error loading background-image ".concat(url));
|
|
7310
8301
|
return [3 /*break*/, 4];
|
|
7311
8302
|
case 4:
|
|
7312
8303
|
if (image) {
|
|
8304
|
+
imageWidth = isNaN(image.width) || image.width === 0 ? 1 : image.width;
|
|
8305
|
+
imageHeight = isNaN(image.height) || image.height === 0 ? 1 : image.height;
|
|
7313
8306
|
_c = calculateBackgroundRendering(container, index, [
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
8307
|
+
imageWidth,
|
|
8308
|
+
imageHeight,
|
|
8309
|
+
imageWidth / imageHeight
|
|
7317
8310
|
]), path = _c[0], x = _c[1], y = _c[2], width = _c[3], height = _c[4];
|
|
7318
8311
|
pattern = this_1.ctx.createPattern(this_1.resizeImage(image, width, height), 'repeat');
|
|
7319
8312
|
this_1.renderRepeat(path, pattern, x, y);
|
|
@@ -7438,7 +8431,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7438
8431
|
return __generator(this, function (_a) {
|
|
7439
8432
|
switch (_a.label) {
|
|
7440
8433
|
case 0:
|
|
7441
|
-
this.applyEffects(paint.getEffects(2 /* BACKGROUND_BORDERS */));
|
|
8434
|
+
this.applyEffects(paint.getEffects(2 /* EffectTarget.BACKGROUND_BORDERS */));
|
|
7442
8435
|
styles = paint.container.styles;
|
|
7443
8436
|
hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
|
|
7444
8437
|
borders = [
|
|
@@ -7494,20 +8487,20 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7494
8487
|
case 3:
|
|
7495
8488
|
if (!(_i < borders_1.length)) return [3 /*break*/, 13];
|
|
7496
8489
|
border = borders_1[_i];
|
|
7497
|
-
if (!(border.style !== 0 /* NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
|
|
7498
|
-
if (!(border.style === 2 /* DASHED */)) return [3 /*break*/, 5];
|
|
7499
|
-
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* DASHED */)];
|
|
8490
|
+
if (!(border.style !== 0 /* BORDER_STYLE.NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
|
|
8491
|
+
if (!(border.style === 2 /* BORDER_STYLE.DASHED */)) return [3 /*break*/, 5];
|
|
8492
|
+
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* BORDER_STYLE.DASHED */)];
|
|
7500
8493
|
case 4:
|
|
7501
8494
|
_a.sent();
|
|
7502
8495
|
return [3 /*break*/, 11];
|
|
7503
8496
|
case 5:
|
|
7504
|
-
if (!(border.style === 3 /* DOTTED */)) return [3 /*break*/, 7];
|
|
7505
|
-
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* DOTTED */)];
|
|
8497
|
+
if (!(border.style === 3 /* BORDER_STYLE.DOTTED */)) return [3 /*break*/, 7];
|
|
8498
|
+
return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* BORDER_STYLE.DOTTED */)];
|
|
7506
8499
|
case 6:
|
|
7507
8500
|
_a.sent();
|
|
7508
8501
|
return [3 /*break*/, 11];
|
|
7509
8502
|
case 7:
|
|
7510
|
-
if (!(border.style === 4 /* DOUBLE */)) return [3 /*break*/, 9];
|
|
8503
|
+
if (!(border.style === 4 /* BORDER_STYLE.DOUBLE */)) return [3 /*break*/, 9];
|
|
7511
8504
|
return [4 /*yield*/, this.renderDoubleBorder(border.color, border.width, side, paint.curves)];
|
|
7512
8505
|
case 8:
|
|
7513
8506
|
_a.sent();
|
|
@@ -7534,7 +8527,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7534
8527
|
this.ctx.save();
|
|
7535
8528
|
strokePaths = parsePathForBorderStroke(curvePoints, side);
|
|
7536
8529
|
boxPaths = parsePathForBorder(curvePoints, side);
|
|
7537
|
-
if (style === 2 /* DASHED */) {
|
|
8530
|
+
if (style === 2 /* BORDER_STYLE.DASHED */) {
|
|
7538
8531
|
this.path(boxPaths);
|
|
7539
8532
|
this.ctx.clip();
|
|
7540
8533
|
}
|
|
@@ -7561,7 +8554,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7561
8554
|
length = Math.abs(startY - endY);
|
|
7562
8555
|
}
|
|
7563
8556
|
this.ctx.beginPath();
|
|
7564
|
-
if (style === 3 /* DOTTED */) {
|
|
8557
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7565
8558
|
this.formatPath(strokePaths);
|
|
7566
8559
|
}
|
|
7567
8560
|
else {
|
|
@@ -7569,7 +8562,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7569
8562
|
}
|
|
7570
8563
|
dashLength = width < 3 ? width * 3 : width * 2;
|
|
7571
8564
|
spaceLength = width < 3 ? width * 2 : width;
|
|
7572
|
-
if (style === 3 /* DOTTED */) {
|
|
8565
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7573
8566
|
dashLength = width;
|
|
7574
8567
|
spaceLength = width;
|
|
7575
8568
|
}
|
|
@@ -7592,14 +8585,14 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7592
8585
|
: maxSpace;
|
|
7593
8586
|
}
|
|
7594
8587
|
if (useLineDash) {
|
|
7595
|
-
if (style === 3 /* DOTTED */) {
|
|
8588
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7596
8589
|
this.ctx.setLineDash([0, dashLength + spaceLength]);
|
|
7597
8590
|
}
|
|
7598
8591
|
else {
|
|
7599
8592
|
this.ctx.setLineDash([dashLength, spaceLength]);
|
|
7600
8593
|
}
|
|
7601
8594
|
}
|
|
7602
|
-
if (style === 3 /* DOTTED */) {
|
|
8595
|
+
if (style === 3 /* BORDER_STYLE.DOTTED */) {
|
|
7603
8596
|
this.ctx.lineCap = 'round';
|
|
7604
8597
|
this.ctx.lineWidth = width;
|
|
7605
8598
|
}
|
|
@@ -7610,7 +8603,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7610
8603
|
this.ctx.stroke();
|
|
7611
8604
|
this.ctx.setLineDash([]);
|
|
7612
8605
|
// dashed round edge gap
|
|
7613
|
-
if (style === 2 /* DASHED */) {
|
|
8606
|
+
if (style === 2 /* BORDER_STYLE.DASHED */) {
|
|
7614
8607
|
if (isBezierCurve(boxPaths[0])) {
|
|
7615
8608
|
path1 = boxPaths[3];
|
|
7616
8609
|
path2 = boxPaths[0];
|
|
@@ -7667,22 +8660,22 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7667
8660
|
};
|
|
7668
8661
|
var calculateBackgroundCurvedPaintingArea = function (clip, curves) {
|
|
7669
8662
|
switch (clip) {
|
|
7670
|
-
case 0 /* BORDER_BOX */:
|
|
8663
|
+
case 0 /* BACKGROUND_CLIP.BORDER_BOX */:
|
|
7671
8664
|
return calculateBorderBoxPath(curves);
|
|
7672
|
-
case 2 /* CONTENT_BOX */:
|
|
8665
|
+
case 2 /* BACKGROUND_CLIP.CONTENT_BOX */:
|
|
7673
8666
|
return calculateContentBoxPath(curves);
|
|
7674
|
-
case 1 /* PADDING_BOX */:
|
|
8667
|
+
case 1 /* BACKGROUND_CLIP.PADDING_BOX */:
|
|
7675
8668
|
default:
|
|
7676
8669
|
return calculatePaddingBoxPath(curves);
|
|
7677
8670
|
}
|
|
7678
8671
|
};
|
|
7679
8672
|
var canvasTextAlign = function (textAlign) {
|
|
7680
8673
|
switch (textAlign) {
|
|
7681
|
-
case 1 /* CENTER */:
|
|
8674
|
+
case 1 /* TEXT_ALIGN.CENTER */:
|
|
7682
8675
|
return 'center';
|
|
7683
|
-
case 2 /* RIGHT */:
|
|
8676
|
+
case 2 /* TEXT_ALIGN.RIGHT */:
|
|
7684
8677
|
return 'right';
|
|
7685
|
-
case 0 /* LEFT */:
|
|
8678
|
+
case 0 /* TEXT_ALIGN.LEFT */:
|
|
7686
8679
|
default:
|
|
7687
8680
|
return 'left';
|
|
7688
8681
|
}
|
|
@@ -7704,11 +8697,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7704
8697
|
_this.options = options;
|
|
7705
8698
|
_this.canvas.width = Math.floor(options.width * options.scale);
|
|
7706
8699
|
_this.canvas.height = Math.floor(options.height * options.scale);
|
|
7707
|
-
_this.canvas.style.width = options.width
|
|
7708
|
-
_this.canvas.style.height = options.height
|
|
8700
|
+
_this.canvas.style.width = "".concat(options.width, "px");
|
|
8701
|
+
_this.canvas.style.height = "".concat(options.height, "px");
|
|
7709
8702
|
_this.ctx.scale(_this.options.scale, _this.options.scale);
|
|
7710
8703
|
_this.ctx.translate(-options.x, -options.y);
|
|
7711
|
-
_this.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("
|
|
8704
|
+
_this.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (".concat(options.width, "x").concat(options.height, " at ").concat(options.x, ",").concat(options.y, ") with scale ").concat(options.scale));
|
|
7712
8705
|
return _this;
|
|
7713
8706
|
}
|
|
7714
8707
|
ForeignObjectRenderer.prototype.render = function (element) {
|
|
@@ -7740,7 +8733,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7740
8733
|
resolve(img);
|
|
7741
8734
|
};
|
|
7742
8735
|
img.onerror = reject;
|
|
7743
|
-
img.src = "data:image/svg+xml;charset=utf-8,"
|
|
8736
|
+
img.src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svg)));
|
|
7744
8737
|
});
|
|
7745
8738
|
};
|
|
7746
8739
|
|
|
@@ -7761,7 +8754,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7761
8754
|
// eslint-disable-next-line no-console
|
|
7762
8755
|
if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
|
|
7763
8756
|
// eslint-disable-next-line no-console
|
|
7764
|
-
console.debug.apply(console, __spreadArray([this.id, this.getTime()
|
|
8757
|
+
console.debug.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7765
8758
|
}
|
|
7766
8759
|
else {
|
|
7767
8760
|
this.info.apply(this, args);
|
|
@@ -7781,7 +8774,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7781
8774
|
// eslint-disable-next-line no-console
|
|
7782
8775
|
if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
|
|
7783
8776
|
// eslint-disable-next-line no-console
|
|
7784
|
-
console.info.apply(console, __spreadArray([this.id, this.getTime()
|
|
8777
|
+
console.info.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7785
8778
|
}
|
|
7786
8779
|
}
|
|
7787
8780
|
};
|
|
@@ -7795,7 +8788,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7795
8788
|
// eslint-disable-next-line no-console
|
|
7796
8789
|
if (typeof window !== 'undefined' && window.console && typeof console.warn === 'function') {
|
|
7797
8790
|
// eslint-disable-next-line no-console
|
|
7798
|
-
console.warn.apply(console, __spreadArray([this.id, this.getTime()
|
|
8791
|
+
console.warn.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7799
8792
|
}
|
|
7800
8793
|
else {
|
|
7801
8794
|
this.info.apply(this, args);
|
|
@@ -7812,7 +8805,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7812
8805
|
// eslint-disable-next-line no-console
|
|
7813
8806
|
if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
|
|
7814
8807
|
// eslint-disable-next-line no-console
|
|
7815
|
-
console.error.apply(console, __spreadArray([this.id, this.getTime()
|
|
8808
|
+
console.error.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
|
|
7816
8809
|
}
|
|
7817
8810
|
else {
|
|
7818
8811
|
this.info.apply(this, args);
|
|
@@ -7827,7 +8820,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7827
8820
|
function Context(options, windowBounds) {
|
|
7828
8821
|
var _a;
|
|
7829
8822
|
this.windowBounds = windowBounds;
|
|
7830
|
-
this.instanceName = "#"
|
|
8823
|
+
this.instanceName = "#".concat(Context.instanceCount++);
|
|
7831
8824
|
this.logger = new Logger({ id: this.instanceName, enabled: options.logging });
|
|
7832
8825
|
this.cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new Cache(this, options);
|
|
7833
8826
|
}
|
|
@@ -7882,7 +8875,7 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7882
8875
|
inlineImages: foreignObjectRendering,
|
|
7883
8876
|
copyStyles: foreignObjectRendering
|
|
7884
8877
|
};
|
|
7885
|
-
context.logger.debug("Starting document clone with size "
|
|
8878
|
+
context.logger.debug("Starting document clone with size ".concat(windowBounds.width, "x").concat(windowBounds.height, " scrolled to ").concat(-windowBounds.left, ",").concat(-windowBounds.top));
|
|
7886
8879
|
documentCloner = new DocumentCloner(context, element, cloneOptions);
|
|
7887
8880
|
clonedElement = documentCloner.clonedReferenceElement;
|
|
7888
8881
|
if (!clonedElement) {
|
|
@@ -7912,13 +8905,13 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7912
8905
|
canvas = _u.sent();
|
|
7913
8906
|
return [3 /*break*/, 5];
|
|
7914
8907
|
case 3:
|
|
7915
|
-
context.logger.debug("Document cloned, element located at "
|
|
8908
|
+
context.logger.debug("Document cloned, element located at ".concat(left, ",").concat(top, " with size ").concat(width, "x").concat(height, " using computed rendering"));
|
|
7916
8909
|
context.logger.debug("Starting DOM parsing");
|
|
7917
8910
|
root = parseTree(context, clonedElement);
|
|
7918
8911
|
if (backgroundColor === root.styles.backgroundColor) {
|
|
7919
8912
|
root.styles.backgroundColor = COLORS.TRANSPARENT;
|
|
7920
8913
|
}
|
|
7921
|
-
context.logger.debug("Starting renderer for element at "
|
|
8914
|
+
context.logger.debug("Starting renderer for element at ".concat(renderOptions.x, ",").concat(renderOptions.y, " with size ").concat(renderOptions.width, "x").concat(renderOptions.height));
|
|
7922
8915
|
renderer = new CanvasRenderer(context, renderOptions);
|
|
7923
8916
|
return [4 /*yield*/, renderer.render(root)];
|
|
7924
8917
|
case 4:
|
|
@@ -7960,11 +8953,11 @@ var html2canvas = createCommonjsModule(function (module, exports) {
|
|
|
7960
8953
|
|
|
7961
8954
|
return html2canvas;
|
|
7962
8955
|
|
|
7963
|
-
}))
|
|
7964
|
-
//# sourceMappingURL=html2canvas.js.map
|
|
8956
|
+
}));
|
|
8957
|
+
//# sourceMappingURL=html2canvas-pro.js.map
|
|
7965
8958
|
});
|
|
7966
8959
|
|
|
7967
|
-
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)}}";
|
|
8960
|
+
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,.feedback-footer-text{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)}}";
|
|
7968
8961
|
|
|
7969
8962
|
const FeedbackModal = class {
|
|
7970
8963
|
constructor(hostRef) {
|
|
@@ -8194,6 +9187,7 @@ const FeedbackModal = class {
|
|
|
8194
9187
|
this.ratingMode = 'thumbs';
|
|
8195
9188
|
this.ratingPlaceholder = 'Was this page helpful?';
|
|
8196
9189
|
this.ratingStarsPlaceholder = 'How would you rate this page?';
|
|
9190
|
+
this.footerText = '';
|
|
8197
9191
|
this.showModal = false;
|
|
8198
9192
|
this.showScreenshotMode = false;
|
|
8199
9193
|
this.showScreenshotTopBar = false;
|
|
@@ -8244,7 +9238,7 @@ const FeedbackModal = class {
|
|
|
8244
9238
|
captureScreenshot() {
|
|
8245
9239
|
return new Promise((resolve, reject) => {
|
|
8246
9240
|
requestAnimationFrame(() => {
|
|
8247
|
-
|
|
9241
|
+
html2canvasPro(document.body, {
|
|
8248
9242
|
x: window.scrollX,
|
|
8249
9243
|
y: window.scrollY,
|
|
8250
9244
|
width: window.innerWidth,
|
|
@@ -8279,7 +9273,7 @@ const FeedbackModal = class {
|
|
|
8279
9273
|
} }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "#5F6368", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { d: "M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17" })))))) : (h("div", { class: "feedback-modal-rating-content" }, h("span", { class: "feedback-modal-input-heading" }, this.ratingStarsPlaceholder), h("div", { class: "feedback-modal-rating-buttons feedback-modal-rating-buttons--stars" }, [1, 2, 3, 4, 5].map((rating) => (h("button", { key: rating, class: `feedback-modal-rating-button ${this.selectedRating >= rating ? 'feedback-modal-rating-button--selected' : ''}`, onClick: (event) => {
|
|
8280
9274
|
event.preventDefault();
|
|
8281
9275
|
this.handleRatingChange(rating);
|
|
8282
|
-
} }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: "#5F6368", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" })))))))))), h("div", { class: "feedback-modal-text" }, h("textarea", { placeholder: this.messagePlaceholder, value: this.formMessage, onInput: (event) => this.handleMessageInput(event) })), !this.hideEmail && (h("div", { class: "feedback-modal-email" }, h("input", { placeholder: this.emailPlaceholder, type: "email", onInput: (event) => this.handleEmailInput(event), value: this.formEmail }))), h("div", { class: "feedback-verification" }, h("input", { type: "text", name: "verification", style: { display: 'none' }, onInput: (event) => this.handleVerification(event), value: this.formVerification })), !this.hidePrivacyPolicy && (h("div", { class: "feedback-modal-privacy" }, h("input", { type: "checkbox", id: "privacyPolicy", onChange: (ev) => this.handleCheckboxChange(ev), required: true }), h("span", { innerHTML: this.privacyPolicyText }))), h("div", { class: `feedback-modal-buttons ${this.hideScreenshotButton ? 'single' : ''}` }, !this.hideScreenshotButton && (h("button", { type: "button", class: `feedback-modal-button feedback-modal-button--screenshot ${this.encodedScreenshot ? "feedback-modal-button--active" : ""}`, onClick: this.openScreenShot, disabled: this.sending }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 -960 960 960", width: "24" }, h("path", { d: "M680-80v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-200v-200h80v120h120v80H200Zm0-360v-200h200v80H280v120h-80Zm480 0v-120H560v-80h200v200h-80Z" })), this.screenshotButtonText)), h("button", { class: "feedback-modal-button feedback-modal-button--submit", type: "submit", disabled: this.sending }, this.sendButtonText)))) : this.formSuccess && !this.formError ? (h("div", { class: "feedback-modal-success" }, h("p", { class: "feedback-modal-message" }, this.successMessage))) : this.formError && this.formErrorStatus == 404 ? (h("p", { class: "feedback-modal-message" }, this.errorMessage404)) : this.formError && this.formErrorStatus == 403 ? (h("p", { class: "feedback-modal-message" }, this.errorMessage403)) : this.formError ? (h("p", { class: "feedback-modal-message" }, this.errorMessage)) : h("span", null)), h("div", { class: "feedback-modal-footer", style: { display: this.whitelabel ? 'none' : 'block' } },
|
|
9276
|
+
} }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: "#5F6368", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" })))))))))), h("div", { class: "feedback-modal-text" }, h("textarea", { placeholder: this.messagePlaceholder, value: this.formMessage, onInput: (event) => this.handleMessageInput(event) })), !this.hideEmail && (h("div", { class: "feedback-modal-email" }, h("input", { placeholder: this.emailPlaceholder, type: "email", onInput: (event) => this.handleEmailInput(event), value: this.formEmail }))), h("div", { class: "feedback-verification" }, h("input", { type: "text", name: "verification", style: { display: 'none' }, onInput: (event) => this.handleVerification(event), value: this.formVerification })), !this.hidePrivacyPolicy && (h("div", { class: "feedback-modal-privacy" }, h("input", { type: "checkbox", id: "privacyPolicy", onChange: (ev) => this.handleCheckboxChange(ev), required: true }), h("span", { innerHTML: this.privacyPolicyText }))), h("div", { class: `feedback-modal-buttons ${this.hideScreenshotButton ? 'single' : ''}` }, !this.hideScreenshotButton && (h("button", { type: "button", class: `feedback-modal-button feedback-modal-button--screenshot ${this.encodedScreenshot ? "feedback-modal-button--active" : ""}`, onClick: this.openScreenShot, disabled: this.sending }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 -960 960 960", width: "24" }, h("path", { d: "M680-80v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-200v-200h80v120h120v80H200Zm0-360v-200h200v80H280v120h-80Zm480 0v-120H560v-80h200v200h-80Z" })), this.screenshotButtonText)), h("button", { class: "feedback-modal-button feedback-modal-button--submit", type: "submit", disabled: this.sending }, this.sendButtonText)))) : this.formSuccess && !this.formError ? (h("div", { class: "feedback-modal-success" }, h("p", { class: "feedback-modal-message" }, this.successMessage))) : this.formError && this.formErrorStatus == 404 ? (h("p", { class: "feedback-modal-message" }, this.errorMessage404)) : this.formError && this.formErrorStatus == 403 ? (h("p", { class: "feedback-modal-message" }, this.errorMessage403)) : this.formError ? (h("p", { class: "feedback-modal-message" }, this.errorMessage)) : h("span", null)), h("div", { class: "feedback-modal-footer" }, h("div", { class: "feedback-logo", style: { display: this.whitelabel ? 'none' : 'block' } }, "Powered by ", h("a", { target: "_blank", href: "https://pushfeedback.com" }, "PushFeedback.com"), this.footerText && h("span", { class: "feedback-footer-text", innerHTML: this.footerText })))))));
|
|
8283
9277
|
}
|
|
8284
9278
|
componentDidRender() {
|
|
8285
9279
|
if (this.showModal) {
|