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