html2canvas-pro 2.6.1 → 2.6.2
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/README.md +6 -0
- package/dist/html2canvas-pro.cjs +440 -404
- package/dist/html2canvas-pro.cjs.map +1 -1
- package/dist/html2canvas-pro.esm.js +440 -404
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +440 -404
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +6 -6
- package/dist/types/core/performance-monitor.d.ts +5 -4
- package/dist/types/css/index.d.ts +4 -0
- package/dist/types/css/property-descriptors/contain.d.ts +7 -0
- package/dist/types/css/property-descriptors/will-change.d.ts +7 -0
- package/dist/types/render/canvas/canvas-renderer.d.ts +15 -0
- package/dist/types/render/matrix.d.ts +43 -0
- package/package.json +15 -15
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* html2canvas-pro 2.6.
|
|
2
|
+
* html2canvas-pro 2.6.2 <https://yorickshan.github.io/html2canvas-pro/>
|
|
3
3
|
* Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
|
|
4
4
|
* Released under MIT License
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
// src/config.ts
|
|
7
7
|
/**
|
|
8
8
|
* Html2Canvas Configuration
|
|
9
9
|
*
|
|
@@ -46,8 +46,7 @@ var Html2CanvasConfig = class Html2CanvasConfig {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
|
|
50
|
-
//#region src/core/validator.ts
|
|
49
|
+
// src/core/validator.ts
|
|
51
50
|
/**
|
|
52
51
|
* Input Validator
|
|
53
52
|
*
|
|
@@ -435,8 +434,7 @@ function createDefaultValidator(config = {}) {
|
|
|
435
434
|
...config
|
|
436
435
|
});
|
|
437
436
|
}
|
|
438
|
-
|
|
439
|
-
//#region src/core/performance-monitor.ts
|
|
437
|
+
// src/core/performance-monitor.ts
|
|
440
438
|
/**
|
|
441
439
|
* Performance Monitor
|
|
442
440
|
*
|
|
@@ -445,7 +443,8 @@ function createDefaultValidator(config = {}) {
|
|
|
445
443
|
*
|
|
446
444
|
* Usage:
|
|
447
445
|
* ```typescript
|
|
448
|
-
*
|
|
446
|
+
* // Standalone (logs disabled) or with the render pipeline's context.
|
|
447
|
+
* const monitor = new PerformanceMonitor(null);
|
|
449
448
|
*
|
|
450
449
|
* monitor.start('clone');
|
|
451
450
|
* await cloneDocument();
|
|
@@ -455,13 +454,13 @@ function createDefaultValidator(config = {}) {
|
|
|
455
454
|
* ```
|
|
456
455
|
*/
|
|
457
456
|
var PerformanceMonitor = class {
|
|
458
|
-
|
|
457
|
+
logger;
|
|
459
458
|
activeMetrics = /* @__PURE__ */ new Map();
|
|
460
459
|
completedMetrics = [];
|
|
461
460
|
enabled;
|
|
462
461
|
getTime;
|
|
463
|
-
constructor(
|
|
464
|
-
this.
|
|
462
|
+
constructor(logger, enabled = true) {
|
|
463
|
+
this.logger = logger;
|
|
465
464
|
this.enabled = enabled;
|
|
466
465
|
this.getTime = typeof performance !== "undefined" && typeof performance.now === "function" ? () => performance.now() : () => Date.now();
|
|
467
466
|
}
|
|
@@ -473,7 +472,7 @@ var PerformanceMonitor = class {
|
|
|
473
472
|
*/
|
|
474
473
|
start(name, metadata) {
|
|
475
474
|
if (!this.enabled) return;
|
|
476
|
-
if (this.activeMetrics.has(name)) this.
|
|
475
|
+
if (this.activeMetrics.has(name)) this.logger?.warn(`Performance metric '${name}' already started. Overwriting.`);
|
|
477
476
|
this.activeMetrics.set(name, {
|
|
478
477
|
name,
|
|
479
478
|
startTime: this.getTime(),
|
|
@@ -490,14 +489,14 @@ var PerformanceMonitor = class {
|
|
|
490
489
|
if (!this.enabled) return;
|
|
491
490
|
const metric = this.activeMetrics.get(name);
|
|
492
491
|
if (!metric) {
|
|
493
|
-
this.
|
|
492
|
+
this.logger?.warn(`Performance metric '${name}' not found. Was start() called?`);
|
|
494
493
|
return;
|
|
495
494
|
}
|
|
496
495
|
metric.endTime = this.getTime();
|
|
497
496
|
metric.duration = metric.endTime - metric.startTime;
|
|
498
497
|
this.completedMetrics.push(metric);
|
|
499
498
|
this.activeMetrics.delete(name);
|
|
500
|
-
this.
|
|
499
|
+
this.logger?.debug(`⏱️ ${name}: ${metric.duration.toFixed(2)}ms`, metric.metadata);
|
|
501
500
|
return metric;
|
|
502
501
|
}
|
|
503
502
|
/**
|
|
@@ -577,11 +576,12 @@ var PerformanceMonitor = class {
|
|
|
577
576
|
* Log performance summary to console
|
|
578
577
|
*/
|
|
579
578
|
logSummary() {
|
|
580
|
-
if (!this.enabled || this.completedMetrics.length === 0 || !this.
|
|
579
|
+
if (!this.enabled || this.completedMetrics.length === 0 || !this.logger) return;
|
|
580
|
+
const logger = this.logger;
|
|
581
581
|
const summary = this.getSummary();
|
|
582
|
-
|
|
582
|
+
logger.info(`\n📊 Performance Summary (Total: ${summary.totalDuration.toFixed(2)}ms):`);
|
|
583
583
|
summary.breakdown.sort((a, b) => b.duration - a.duration).forEach((item) => {
|
|
584
|
-
|
|
584
|
+
logger.info(` ${item.name.padEnd(20)} ${item.duration.toFixed(2).padStart(8)}ms ${item.percentage.padStart(6)}`);
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
587
|
/**
|
|
@@ -605,8 +605,7 @@ var PerformanceMonitor = class {
|
|
|
605
605
|
return Array.from(this.activeMetrics.keys());
|
|
606
606
|
}
|
|
607
607
|
};
|
|
608
|
-
|
|
609
|
-
//#region src/css/layout/bounds.ts
|
|
608
|
+
// src/css/layout/bounds.ts
|
|
610
609
|
var Bounds = class Bounds {
|
|
611
610
|
left;
|
|
612
611
|
top;
|
|
@@ -642,8 +641,7 @@ const parseDocumentSize = (document) => {
|
|
|
642
641
|
if (!body || !documentElement) throw new Error(`Unable to get document size`);
|
|
643
642
|
return new Bounds(0, 0, Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth)), Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight)));
|
|
644
643
|
};
|
|
645
|
-
|
|
646
|
-
//#region src/core/util.ts
|
|
644
|
+
// src/core/util.ts
|
|
647
645
|
/**
|
|
648
646
|
* Indexed access where the shape/arity is guaranteed by construction (the CSS
|
|
649
647
|
* grammar or a preceding length check). Throws on the impossible case instead
|
|
@@ -721,8 +719,7 @@ const stringToNumber = (codePoints) => {
|
|
|
721
719
|
const exp = exponent.length ? parseInt(String.fromCodePoint(...exponent), 10) : 0;
|
|
722
720
|
return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
|
|
723
721
|
};
|
|
724
|
-
|
|
725
|
-
//#region src/css/syntax/token-singletons.ts
|
|
722
|
+
// src/css/syntax/token-singletons.ts
|
|
726
723
|
const LEFT_PARENTHESIS_TOKEN = { type: 2 };
|
|
727
724
|
const RIGHT_PARENTHESIS_TOKEN = { type: 3 };
|
|
728
725
|
const COMMA_TOKEN = { type: 4 };
|
|
@@ -744,8 +741,7 @@ const LEFT_SQUARE_BRACKET_TOKEN = { type: 28 };
|
|
|
744
741
|
const RIGHT_SQUARE_BRACKET_TOKEN = { type: 29 };
|
|
745
742
|
const WHITESPACE_TOKEN = { type: 31 };
|
|
746
743
|
const EOF_TOKEN = { type: 32 };
|
|
747
|
-
|
|
748
|
-
//#region src/css/syntax/tokenizer.ts
|
|
744
|
+
// src/css/syntax/tokenizer.ts
|
|
749
745
|
var Tokenizer = class Tokenizer {
|
|
750
746
|
static _pool = [];
|
|
751
747
|
static MAX_POOL_SIZE = 40;
|
|
@@ -1201,8 +1197,7 @@ var Tokenizer = class Tokenizer {
|
|
|
1201
1197
|
}
|
|
1202
1198
|
}
|
|
1203
1199
|
};
|
|
1204
|
-
|
|
1205
|
-
//#region src/css/syntax/parser.ts
|
|
1200
|
+
// src/css/syntax/parser.ts
|
|
1206
1201
|
var Parser = class Parser {
|
|
1207
1202
|
_tokens;
|
|
1208
1203
|
constructor(tokens) {
|
|
@@ -1311,8 +1306,7 @@ const isEndingTokenFor = (token, type) => {
|
|
|
1311
1306
|
if (type === 28 && token.type === 29) return true;
|
|
1312
1307
|
return type === 2 && token.type === 3;
|
|
1313
1308
|
};
|
|
1314
|
-
|
|
1315
|
-
//#region src/css/types/safe-eval.ts
|
|
1309
|
+
// src/css/types/safe-eval.ts
|
|
1316
1310
|
/**
|
|
1317
1311
|
* Safe arithmetic expression evaluator — replaces `new Function()`.
|
|
1318
1312
|
*
|
|
@@ -1370,8 +1364,7 @@ const safeEvalArithmetic = (expr) => {
|
|
|
1370
1364
|
}
|
|
1371
1365
|
return stack.length === 1 ? stack[0] ?? NaN : NaN;
|
|
1372
1366
|
};
|
|
1373
|
-
|
|
1374
|
-
//#region src/css/types/color-math.ts
|
|
1367
|
+
// src/css/types/color-math.ts
|
|
1375
1368
|
/**
|
|
1376
1369
|
* Color mathematics utilities
|
|
1377
1370
|
* Extracted to break circular dependency between srgb.ts and color-utilities.ts
|
|
@@ -1392,8 +1385,7 @@ const multiplyMatrices = (A, B) => {
|
|
|
1392
1385
|
A[6] * B[0] + A[7] * B[1] + A[8] * B[2]
|
|
1393
1386
|
];
|
|
1394
1387
|
};
|
|
1395
|
-
|
|
1396
|
-
//#region src/css/types/color-spaces/srgb.ts
|
|
1388
|
+
// src/css/types/color-spaces/srgb.ts
|
|
1397
1389
|
/**
|
|
1398
1390
|
* SRGB related functions
|
|
1399
1391
|
*/
|
|
@@ -1502,11 +1494,9 @@ const srgbLinearFromXYZ = (args) => {
|
|
|
1502
1494
|
args[3]
|
|
1503
1495
|
];
|
|
1504
1496
|
};
|
|
1505
|
-
|
|
1506
|
-
//#region src/css/types/length.ts
|
|
1497
|
+
// src/css/types/length.ts
|
|
1507
1498
|
const isLength = (token) => token.type === 17 || token.type === 15;
|
|
1508
|
-
|
|
1509
|
-
//#region src/css/types/length-percentage.ts
|
|
1499
|
+
// src/css/types/length-percentage.ts
|
|
1510
1500
|
const isLengthPercentage = (token) => token.type === 16 || isLength(token) || isCalcWithPercentage(token);
|
|
1511
1501
|
/**
|
|
1512
1502
|
* Check if a token is a CalcWithPercentage deferred token.
|
|
@@ -1630,8 +1620,7 @@ const getAbsoluteValue = (token, parent) => {
|
|
|
1630
1620
|
}
|
|
1631
1621
|
return token.number;
|
|
1632
1622
|
};
|
|
1633
|
-
|
|
1634
|
-
//#region src/css/types/angle.ts
|
|
1623
|
+
// src/css/types/angle.ts
|
|
1635
1624
|
const DEG = "deg";
|
|
1636
1625
|
const GRAD = "grad";
|
|
1637
1626
|
const RAD = "rad";
|
|
@@ -1684,8 +1673,7 @@ const parseNamedSide = (tokens) => {
|
|
|
1684
1673
|
return 0;
|
|
1685
1674
|
};
|
|
1686
1675
|
const deg = (deg) => Math.PI * deg / 180;
|
|
1687
|
-
|
|
1688
|
-
//#region src/css/types/color-utilities.ts
|
|
1676
|
+
// src/css/types/color-utilities.ts
|
|
1689
1677
|
const isTransparent = (color) => (255 & color) === 0;
|
|
1690
1678
|
const asString = (color) => {
|
|
1691
1679
|
const alpha = 255 & color;
|
|
@@ -2140,8 +2128,7 @@ const convertXyz50 = (args) => {
|
|
|
2140
2128
|
args[3]
|
|
2141
2129
|
]);
|
|
2142
2130
|
};
|
|
2143
|
-
|
|
2144
|
-
//#region src/css/types/color-spaces/p3.ts
|
|
2131
|
+
// src/css/types/color-spaces/p3.ts
|
|
2145
2132
|
/**
|
|
2146
2133
|
* Display-P3 related functions
|
|
2147
2134
|
*/
|
|
@@ -2259,8 +2246,7 @@ const convertP3 = (args) => {
|
|
|
2259
2246
|
args[3]
|
|
2260
2247
|
]);
|
|
2261
2248
|
};
|
|
2262
|
-
|
|
2263
|
-
//#region src/css/types/color-spaces/a98.ts
|
|
2249
|
+
// src/css/types/color-spaces/a98.ts
|
|
2264
2250
|
/**
|
|
2265
2251
|
* A98-RGB related functions
|
|
2266
2252
|
*/
|
|
@@ -2366,8 +2352,7 @@ const convertA98rgb = (args) => {
|
|
|
2366
2352
|
args[3]
|
|
2367
2353
|
]);
|
|
2368
2354
|
};
|
|
2369
|
-
|
|
2370
|
-
//#region src/css/types/color-spaces/pro-photo.ts
|
|
2355
|
+
// src/css/types/color-spaces/pro-photo.ts
|
|
2371
2356
|
/**
|
|
2372
2357
|
* Pro Photo related functions
|
|
2373
2358
|
*/
|
|
@@ -2492,8 +2477,7 @@ const convertProPhoto = (args) => {
|
|
|
2492
2477
|
args[3]
|
|
2493
2478
|
]);
|
|
2494
2479
|
};
|
|
2495
|
-
|
|
2496
|
-
//#region src/css/types/color-spaces/rec2020.ts
|
|
2480
|
+
// src/css/types/color-spaces/rec2020.ts
|
|
2497
2481
|
/**
|
|
2498
2482
|
* REC2020 related functions
|
|
2499
2483
|
*/
|
|
@@ -2614,8 +2598,7 @@ const convertRec2020 = (args) => {
|
|
|
2614
2598
|
args[3]
|
|
2615
2599
|
]);
|
|
2616
2600
|
};
|
|
2617
|
-
|
|
2618
|
-
//#region src/css/types/functions/color-mix.ts
|
|
2601
|
+
// src/css/types/functions/color-mix.ts
|
|
2619
2602
|
const HUE_DEG_INDEX = {
|
|
2620
2603
|
lch: 2,
|
|
2621
2604
|
oklch: 2,
|
|
@@ -3001,8 +2984,7 @@ const colorMix = (context, args) => {
|
|
|
3001
2984
|
return 0;
|
|
3002
2985
|
}
|
|
3003
2986
|
};
|
|
3004
|
-
|
|
3005
|
-
//#region src/css/types/color.ts
|
|
2987
|
+
// src/css/types/color.ts
|
|
3006
2988
|
const color$1 = {
|
|
3007
2989
|
name: "color",
|
|
3008
2990
|
parse: (context, value) => {
|
|
@@ -3406,8 +3388,7 @@ const COLORS = {
|
|
|
3406
3388
|
YELLOW: 4294902015,
|
|
3407
3389
|
YELLOWGREEN: 2597139199
|
|
3408
3390
|
};
|
|
3409
|
-
|
|
3410
|
-
//#region src/dom/node-type-guards.ts
|
|
3391
|
+
// src/dom/node-type-guards.ts
|
|
3411
3392
|
/**
|
|
3412
3393
|
* DOM Node Type Guards
|
|
3413
3394
|
*
|
|
@@ -3463,8 +3444,7 @@ const VOID_OR_REPLACED_TAGS = /* @__PURE__ */ new Set([
|
|
|
3463
3444
|
* SVG elements also do not support pseudo-elements.
|
|
3464
3445
|
*/
|
|
3465
3446
|
const canHavePseudoElements = (element) => !isSVGElementNode(element) && !VOID_OR_REPLACED_TAGS.has(element.tagName);
|
|
3466
|
-
|
|
3467
|
-
//#region src/css/property-descriptors/list-style-type.ts
|
|
3447
|
+
// src/css/property-descriptors/list-style-type.ts
|
|
3468
3448
|
const listStyleType = {
|
|
3469
3449
|
name: "list-style-type",
|
|
3470
3450
|
initialValue: "none",
|
|
@@ -3529,11 +3509,9 @@ const listStyleType = {
|
|
|
3529
3509
|
}
|
|
3530
3510
|
}
|
|
3531
3511
|
};
|
|
3532
|
-
|
|
3533
|
-
//#region src/core/bitwise.ts
|
|
3512
|
+
// src/core/bitwise.ts
|
|
3534
3513
|
const contains = (bit, value) => (bit & value) !== 0;
|
|
3535
|
-
|
|
3536
|
-
//#region src/css/types/functions/counter.ts
|
|
3514
|
+
// src/css/types/functions/counter.ts
|
|
3537
3515
|
var CounterState = class {
|
|
3538
3516
|
counters = {};
|
|
3539
3517
|
getCounterValue(name) {
|
|
@@ -3949,8 +3927,7 @@ const createCounterText = (value, type, appendSuffix) => {
|
|
|
3949
3927
|
default: return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
|
3950
3928
|
}
|
|
3951
3929
|
};
|
|
3952
|
-
|
|
3953
|
-
//#region src/css/property-descriptors/display.ts
|
|
3930
|
+
// src/css/property-descriptors/display.ts
|
|
3954
3931
|
const display = {
|
|
3955
3932
|
name: "display",
|
|
3956
3933
|
initialValue: "inline-block",
|
|
@@ -3999,8 +3976,7 @@ const parseDisplayValue$1 = (display) => {
|
|
|
3999
3976
|
}
|
|
4000
3977
|
return 0;
|
|
4001
3978
|
};
|
|
4002
|
-
|
|
4003
|
-
//#region src/css/property-descriptors/float.ts
|
|
3979
|
+
// src/css/property-descriptors/float.ts
|
|
4004
3980
|
const float = {
|
|
4005
3981
|
name: "float",
|
|
4006
3982
|
initialValue: "none",
|
|
@@ -4016,8 +3992,7 @@ const float = {
|
|
|
4016
3992
|
return 0;
|
|
4017
3993
|
}
|
|
4018
3994
|
};
|
|
4019
|
-
|
|
4020
|
-
//#region src/css/property-descriptors/overflow.ts
|
|
3995
|
+
// src/css/property-descriptors/overflow.ts
|
|
4021
3996
|
const overflow = {
|
|
4022
3997
|
name: "overflow",
|
|
4023
3998
|
initialValue: "visible",
|
|
@@ -4035,8 +4010,7 @@ const overflow = {
|
|
|
4035
4010
|
});
|
|
4036
4011
|
}
|
|
4037
4012
|
};
|
|
4038
|
-
|
|
4039
|
-
//#region src/css/property-descriptors/text-decoration-color.ts
|
|
4013
|
+
// src/css/property-descriptors/text-decoration-color.ts
|
|
4040
4014
|
const textDecorationColor = {
|
|
4041
4015
|
name: `text-decoration-color`,
|
|
4042
4016
|
initialValue: "transparent",
|
|
@@ -4044,8 +4018,7 @@ const textDecorationColor = {
|
|
|
4044
4018
|
type: 3,
|
|
4045
4019
|
format: "color"
|
|
4046
4020
|
};
|
|
4047
|
-
|
|
4048
|
-
//#region src/css/property-descriptors/text-decoration-line.ts
|
|
4021
|
+
// src/css/property-descriptors/text-decoration-line.ts
|
|
4049
4022
|
const textDecorationLine = {
|
|
4050
4023
|
name: "text-decoration-line",
|
|
4051
4024
|
initialValue: "none",
|
|
@@ -4063,8 +4036,7 @@ const textDecorationLine = {
|
|
|
4063
4036
|
}).filter((line) => line !== 0);
|
|
4064
4037
|
}
|
|
4065
4038
|
};
|
|
4066
|
-
|
|
4067
|
-
//#region src/css/property-descriptors/content.ts
|
|
4039
|
+
// src/css/property-descriptors/content.ts
|
|
4068
4040
|
const content = {
|
|
4069
4041
|
name: "content",
|
|
4070
4042
|
initialValue: "none",
|
|
@@ -4077,8 +4049,7 @@ const content = {
|
|
|
4077
4049
|
return tokens;
|
|
4078
4050
|
}
|
|
4079
4051
|
};
|
|
4080
|
-
|
|
4081
|
-
//#region src/css/property-descriptors/quotes.ts
|
|
4052
|
+
// src/css/property-descriptors/quotes.ts
|
|
4082
4053
|
const quotes = {
|
|
4083
4054
|
name: "quotes",
|
|
4084
4055
|
initialValue: "none",
|
|
@@ -4108,8 +4079,7 @@ const getQuote = (quotes, depth, open) => {
|
|
|
4108
4079
|
if (!quote) return "";
|
|
4109
4080
|
return open ? quote.open : quote.close;
|
|
4110
4081
|
};
|
|
4111
|
-
|
|
4112
|
-
//#region src/css/property-descriptors/counter-increment.ts
|
|
4082
|
+
// src/css/property-descriptors/counter-increment.ts
|
|
4113
4083
|
/** Shared counter-ID parsing: returns next number or a fallback default. */
|
|
4114
4084
|
const parseCounterValue = (tokens, defaultNumber) => {
|
|
4115
4085
|
const entries = [];
|
|
@@ -4139,8 +4109,7 @@ const counterIncrement = {
|
|
|
4139
4109
|
}));
|
|
4140
4110
|
}
|
|
4141
4111
|
};
|
|
4142
|
-
|
|
4143
|
-
//#region src/css/property-descriptors/counter-reset.ts
|
|
4112
|
+
// src/css/property-descriptors/counter-reset.ts
|
|
4144
4113
|
const counterReset = {
|
|
4145
4114
|
name: "counter-reset",
|
|
4146
4115
|
initialValue: "none",
|
|
@@ -4154,8 +4123,7 @@ const counterReset = {
|
|
|
4154
4123
|
}));
|
|
4155
4124
|
}
|
|
4156
4125
|
};
|
|
4157
|
-
|
|
4158
|
-
//#region src/css/property-descriptors/background-clip.ts
|
|
4126
|
+
// src/css/property-descriptors/background-clip.ts
|
|
4159
4127
|
const backgroundClip = {
|
|
4160
4128
|
name: "background-clip",
|
|
4161
4129
|
initialValue: "border-box",
|
|
@@ -4172,8 +4140,7 @@ const backgroundClip = {
|
|
|
4172
4140
|
});
|
|
4173
4141
|
}
|
|
4174
4142
|
};
|
|
4175
|
-
|
|
4176
|
-
//#region src/css/property-descriptors/background-color.ts
|
|
4143
|
+
// src/css/property-descriptors/background-color.ts
|
|
4177
4144
|
const backgroundColor = {
|
|
4178
4145
|
name: `background-color`,
|
|
4179
4146
|
initialValue: "transparent",
|
|
@@ -4181,8 +4148,7 @@ const backgroundColor = {
|
|
|
4181
4148
|
type: 3,
|
|
4182
4149
|
format: "color"
|
|
4183
4150
|
};
|
|
4184
|
-
|
|
4185
|
-
//#region src/css/types/functions/gradient.ts
|
|
4151
|
+
// src/css/types/functions/gradient.ts
|
|
4186
4152
|
const parseColorStop = (context, args) => {
|
|
4187
4153
|
const color = color$1.parse(context, at(args, 0));
|
|
4188
4154
|
const stop = args[1];
|
|
@@ -4318,8 +4284,7 @@ const calculateRadius = (gradient, x, y, width, height) => {
|
|
|
4318
4284
|
}
|
|
4319
4285
|
return [rx, ry];
|
|
4320
4286
|
};
|
|
4321
|
-
|
|
4322
|
-
//#region src/css/types/functions/linear-gradient.ts
|
|
4287
|
+
// src/css/types/functions/linear-gradient.ts
|
|
4323
4288
|
const linearGradient = (context, tokens) => {
|
|
4324
4289
|
let angle$2 = deg(180);
|
|
4325
4290
|
const stops = [];
|
|
@@ -4343,8 +4308,7 @@ const linearGradient = (context, tokens) => {
|
|
|
4343
4308
|
type: 1
|
|
4344
4309
|
};
|
|
4345
4310
|
};
|
|
4346
|
-
|
|
4347
|
-
//#region src/css/types/functions/-prefix-linear-gradient.ts
|
|
4311
|
+
// src/css/types/functions/-prefix-linear-gradient.ts
|
|
4348
4312
|
const prefixLinearGradient = (context, tokens) => {
|
|
4349
4313
|
let angle$1 = deg(180);
|
|
4350
4314
|
const stops = [];
|
|
@@ -4373,8 +4337,7 @@ const prefixLinearGradient = (context, tokens) => {
|
|
|
4373
4337
|
type: 1
|
|
4374
4338
|
};
|
|
4375
4339
|
};
|
|
4376
|
-
|
|
4377
|
-
//#region src/css/types/functions/-webkit-gradient.ts
|
|
4340
|
+
// src/css/types/functions/-webkit-gradient.ts
|
|
4378
4341
|
const webkitGradient = (context, tokens) => {
|
|
4379
4342
|
const angle = deg(180);
|
|
4380
4343
|
const stops = [];
|
|
@@ -4436,8 +4399,7 @@ const webkitGradient = (context, tokens) => {
|
|
|
4436
4399
|
type
|
|
4437
4400
|
};
|
|
4438
4401
|
};
|
|
4439
|
-
|
|
4440
|
-
//#region src/css/types/functions/radial-gradient.ts
|
|
4402
|
+
// src/css/types/functions/radial-gradient.ts
|
|
4441
4403
|
const CLOSEST_SIDE = "closest-side";
|
|
4442
4404
|
const FARTHEST_SIDE = "farthest-side";
|
|
4443
4405
|
const CLOSEST_CORNER = "closest-corner";
|
|
@@ -4517,8 +4479,7 @@ const radialGradient = (context, tokens) => {
|
|
|
4517
4479
|
type: 2
|
|
4518
4480
|
};
|
|
4519
4481
|
};
|
|
4520
|
-
|
|
4521
|
-
//#region src/css/types/functions/-prefix-radial-gradient.ts
|
|
4482
|
+
// src/css/types/functions/-prefix-radial-gradient.ts
|
|
4522
4483
|
const prefixRadialGradient = (context, tokens) => {
|
|
4523
4484
|
let shape = 1;
|
|
4524
4485
|
let size = 3;
|
|
@@ -4589,16 +4550,14 @@ const prefixRadialGradient = (context, tokens) => {
|
|
|
4589
4550
|
type: 2
|
|
4590
4551
|
};
|
|
4591
4552
|
};
|
|
4592
|
-
|
|
4593
|
-
//#region src/css/types/functions/repeating-linear-gradient.ts
|
|
4553
|
+
// src/css/types/functions/repeating-linear-gradient.ts
|
|
4594
4554
|
const repeatingLinearGradient = (context, tokens) => {
|
|
4595
4555
|
return {
|
|
4596
4556
|
...linearGradient(context, tokens),
|
|
4597
4557
|
type: 3
|
|
4598
4558
|
};
|
|
4599
4559
|
};
|
|
4600
|
-
|
|
4601
|
-
//#region src/css/types/functions/repeating-radial-gradient.ts
|
|
4560
|
+
// src/css/types/functions/repeating-radial-gradient.ts
|
|
4602
4561
|
/**
|
|
4603
4562
|
* repeating-radial-gradient shares the radial-gradient grammar exactly; only
|
|
4604
4563
|
* the image type differs, which switches the renderer to periodic stops.
|
|
@@ -4609,8 +4568,7 @@ const repeatingRadialGradient = (context, tokens) => {
|
|
|
4609
4568
|
type: 4
|
|
4610
4569
|
};
|
|
4611
4570
|
};
|
|
4612
|
-
|
|
4613
|
-
//#region src/css/types/functions/conic-gradient.ts
|
|
4571
|
+
// src/css/types/functions/conic-gradient.ts
|
|
4614
4572
|
/**
|
|
4615
4573
|
* conic-gradient( [ from <angle> ]? [ at <position> ]?, <color-stop-list> )
|
|
4616
4574
|
*
|
|
@@ -4680,8 +4638,7 @@ const repeatingConicGradient = (context, tokens) => {
|
|
|
4680
4638
|
type: 6
|
|
4681
4639
|
};
|
|
4682
4640
|
};
|
|
4683
|
-
|
|
4684
|
-
//#region src/css/types/functions/image-set.ts
|
|
4641
|
+
// src/css/types/functions/image-set.ts
|
|
4685
4642
|
const parseResolution = (token) => {
|
|
4686
4643
|
if (!token) return 1;
|
|
4687
4644
|
if (isDimensionToken(token)) {
|
|
@@ -4715,8 +4672,7 @@ const imageSet = (context, tokens) => {
|
|
|
4715
4672
|
const chosen = at(satisfying.length > 0 ? satisfying : candidates.slice().sort((a, b) => b.resolution - a.resolution), 0);
|
|
4716
4673
|
return image.parse(context, chosen.imageToken);
|
|
4717
4674
|
};
|
|
4718
|
-
|
|
4719
|
-
//#region src/css/types/image.ts
|
|
4675
|
+
// src/css/types/image.ts
|
|
4720
4676
|
const isLinearGradient = (background) => {
|
|
4721
4677
|
return background.type === 1;
|
|
4722
4678
|
};
|
|
@@ -4786,8 +4742,7 @@ const SUPPORTED_IMAGE_FUNCTIONS = {
|
|
|
4786
4742
|
"image-set": imageSet,
|
|
4787
4743
|
"-webkit-image-set": imageSet
|
|
4788
4744
|
};
|
|
4789
|
-
|
|
4790
|
-
//#region src/css/property-descriptors/background-image.ts
|
|
4745
|
+
// src/css/property-descriptors/background-image.ts
|
|
4791
4746
|
const backgroundImage = {
|
|
4792
4747
|
name: "background-image",
|
|
4793
4748
|
initialValue: "none",
|
|
@@ -4801,8 +4756,7 @@ const backgroundImage = {
|
|
|
4801
4756
|
return tokens.filter((value) => nonFunctionArgSeparator(value) && isSupportedImage(value)).map((value) => image.parse(context, value));
|
|
4802
4757
|
}
|
|
4803
4758
|
};
|
|
4804
|
-
|
|
4805
|
-
//#region src/css/property-descriptors/background-origin.ts
|
|
4759
|
+
// src/css/property-descriptors/background-origin.ts
|
|
4806
4760
|
const backgroundOrigin = {
|
|
4807
4761
|
name: "background-origin",
|
|
4808
4762
|
initialValue: "border-box",
|
|
@@ -4818,8 +4772,7 @@ const backgroundOrigin = {
|
|
|
4818
4772
|
});
|
|
4819
4773
|
}
|
|
4820
4774
|
};
|
|
4821
|
-
|
|
4822
|
-
//#region src/css/property-descriptors/background-position.ts
|
|
4775
|
+
// src/css/property-descriptors/background-position.ts
|
|
4823
4776
|
const backgroundPosition = {
|
|
4824
4777
|
name: "background-position",
|
|
4825
4778
|
initialValue: "0% 0%",
|
|
@@ -4831,8 +4784,7 @@ const backgroundPosition = {
|
|
|
4831
4784
|
}).map(parseLengthPercentageTuple);
|
|
4832
4785
|
}
|
|
4833
4786
|
};
|
|
4834
|
-
|
|
4835
|
-
//#region src/css/property-descriptors/background-repeat.ts
|
|
4787
|
+
// src/css/property-descriptors/background-repeat.ts
|
|
4836
4788
|
const backgroundRepeat = {
|
|
4837
4789
|
name: "background-repeat",
|
|
4838
4790
|
initialValue: "repeat",
|
|
@@ -4852,8 +4804,7 @@ const parseBackgroundRepeat = (value) => {
|
|
|
4852
4804
|
default: return 0;
|
|
4853
4805
|
}
|
|
4854
4806
|
};
|
|
4855
|
-
|
|
4856
|
-
//#region src/css/property-descriptors/background-size.ts
|
|
4807
|
+
// src/css/property-descriptors/background-size.ts
|
|
4857
4808
|
const backgroundSize = {
|
|
4858
4809
|
name: "background-size",
|
|
4859
4810
|
initialValue: "0",
|
|
@@ -4864,8 +4815,7 @@ const backgroundSize = {
|
|
|
4864
4815
|
}
|
|
4865
4816
|
};
|
|
4866
4817
|
const isBackgroundSizeInfoToken = (value) => isIdentToken(value) || isLengthPercentage(value);
|
|
4867
|
-
|
|
4868
|
-
//#region src/css/property-descriptors/border-color.ts
|
|
4818
|
+
// src/css/property-descriptors/border-color.ts
|
|
4869
4819
|
const borderColorForSide = (side) => ({
|
|
4870
4820
|
name: `border-${side}-color`,
|
|
4871
4821
|
initialValue: "transparent",
|
|
@@ -4877,8 +4827,7 @@ const borderTopColor = borderColorForSide("top");
|
|
|
4877
4827
|
const borderRightColor = borderColorForSide("right");
|
|
4878
4828
|
const borderBottomColor = borderColorForSide("bottom");
|
|
4879
4829
|
const borderLeftColor = borderColorForSide("left");
|
|
4880
|
-
|
|
4881
|
-
//#region src/css/property-descriptors/border-radius.ts
|
|
4830
|
+
// src/css/property-descriptors/border-radius.ts
|
|
4882
4831
|
const borderRadiusForSide = (side) => ({
|
|
4883
4832
|
name: `border-${side}-radius`,
|
|
4884
4833
|
initialValue: "0 0",
|
|
@@ -4890,8 +4839,7 @@ const borderTopLeftRadius = borderRadiusForSide("top-left");
|
|
|
4890
4839
|
const borderTopRightRadius = borderRadiusForSide("top-right");
|
|
4891
4840
|
const borderBottomRightRadius = borderRadiusForSide("bottom-right");
|
|
4892
4841
|
const borderBottomLeftRadius = borderRadiusForSide("bottom-left");
|
|
4893
|
-
|
|
4894
|
-
//#region src/css/property-descriptors/border-style.ts
|
|
4842
|
+
// src/css/property-descriptors/border-style.ts
|
|
4895
4843
|
const borderStyleForSide = (side) => ({
|
|
4896
4844
|
name: `border-${side}-style`,
|
|
4897
4845
|
initialValue: "solid",
|
|
@@ -4911,8 +4859,7 @@ const borderTopStyle = borderStyleForSide("top");
|
|
|
4911
4859
|
const borderRightStyle = borderStyleForSide("right");
|
|
4912
4860
|
const borderBottomStyle = borderStyleForSide("bottom");
|
|
4913
4861
|
const borderLeftStyle = borderStyleForSide("left");
|
|
4914
|
-
|
|
4915
|
-
//#region src/css/property-descriptors/border-width.ts
|
|
4862
|
+
// src/css/property-descriptors/border-width.ts
|
|
4916
4863
|
const borderWidthForSide = (side) => ({
|
|
4917
4864
|
name: `border-${side}-width`,
|
|
4918
4865
|
initialValue: "0",
|
|
@@ -4927,8 +4874,7 @@ const borderTopWidth = borderWidthForSide("top");
|
|
|
4927
4874
|
const borderRightWidth = borderWidthForSide("right");
|
|
4928
4875
|
const borderBottomWidth = borderWidthForSide("bottom");
|
|
4929
4876
|
const borderLeftWidth = borderWidthForSide("left");
|
|
4930
|
-
|
|
4931
|
-
//#region src/css/property-descriptors/clip-path.ts
|
|
4877
|
+
// src/css/property-descriptors/clip-path.ts
|
|
4932
4878
|
const NONE = { type: 0 };
|
|
4933
4879
|
/**
|
|
4934
4880
|
* Parse a shape-radius token: <length-percentage> | closest-side | farthest-side.
|
|
@@ -5149,8 +5095,7 @@ const clipPath = {
|
|
|
5149
5095
|
return NONE;
|
|
5150
5096
|
}
|
|
5151
5097
|
};
|
|
5152
|
-
|
|
5153
|
-
//#region src/css/property-descriptors/color.ts
|
|
5098
|
+
// src/css/property-descriptors/color.ts
|
|
5154
5099
|
const color = {
|
|
5155
5100
|
name: `color`,
|
|
5156
5101
|
initialValue: "transparent",
|
|
@@ -5158,8 +5103,7 @@ const color = {
|
|
|
5158
5103
|
type: 3,
|
|
5159
5104
|
format: "color"
|
|
5160
5105
|
};
|
|
5161
|
-
|
|
5162
|
-
//#region src/css/property-descriptors/direction.ts
|
|
5106
|
+
// src/css/property-descriptors/direction.ts
|
|
5163
5107
|
const direction = {
|
|
5164
5108
|
name: "direction",
|
|
5165
5109
|
initialValue: "ltr",
|
|
@@ -5172,8 +5116,7 @@ const direction = {
|
|
|
5172
5116
|
}
|
|
5173
5117
|
}
|
|
5174
5118
|
};
|
|
5175
|
-
|
|
5176
|
-
//#region src/css/property-descriptors/font-family.ts
|
|
5119
|
+
// src/css/property-descriptors/font-family.ts
|
|
5177
5120
|
const fontFamily = {
|
|
5178
5121
|
name: `font-family`,
|
|
5179
5122
|
initialValue: "",
|
|
@@ -5210,8 +5153,7 @@ const fontFamily = {
|
|
|
5210
5153
|
return results.map((result, index) => quoted[index] || result.indexOf(" ") !== -1 ? `'${result.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\a ").replace(/\r/g, "\\d ").replace(/\f/g, "\\c ")}'` : result);
|
|
5211
5154
|
}
|
|
5212
5155
|
};
|
|
5213
|
-
|
|
5214
|
-
//#region src/css/property-descriptors/font-size.ts
|
|
5156
|
+
// src/css/property-descriptors/font-size.ts
|
|
5215
5157
|
const fontSize = {
|
|
5216
5158
|
name: `font-size`,
|
|
5217
5159
|
initialValue: "0",
|
|
@@ -5219,8 +5161,7 @@ const fontSize = {
|
|
|
5219
5161
|
type: 3,
|
|
5220
5162
|
format: "length"
|
|
5221
5163
|
};
|
|
5222
|
-
|
|
5223
|
-
//#region src/css/property-descriptors/letter-spacing.ts
|
|
5164
|
+
// src/css/property-descriptors/letter-spacing.ts
|
|
5224
5165
|
const letterSpacing = {
|
|
5225
5166
|
name: "letter-spacing",
|
|
5226
5167
|
initialValue: "0",
|
|
@@ -5233,8 +5174,7 @@ const letterSpacing = {
|
|
|
5233
5174
|
return 0;
|
|
5234
5175
|
}
|
|
5235
5176
|
};
|
|
5236
|
-
|
|
5237
|
-
//#region src/css/property-descriptors/line-break.ts
|
|
5177
|
+
// src/css/property-descriptors/line-break.ts
|
|
5238
5178
|
const lineBreak = {
|
|
5239
5179
|
name: "line-break",
|
|
5240
5180
|
initialValue: "normal",
|
|
@@ -5247,8 +5187,7 @@ const lineBreak = {
|
|
|
5247
5187
|
}
|
|
5248
5188
|
}
|
|
5249
5189
|
};
|
|
5250
|
-
|
|
5251
|
-
//#region src/css/property-descriptors/line-height.ts
|
|
5190
|
+
// src/css/property-descriptors/line-height.ts
|
|
5252
5191
|
const lineHeight = {
|
|
5253
5192
|
name: "line-height",
|
|
5254
5193
|
initialValue: "normal",
|
|
@@ -5261,8 +5200,7 @@ const computeLineHeight = (token, fontSize) => {
|
|
|
5261
5200
|
else if (isLengthPercentage(token)) return getAbsoluteValue(token, fontSize);
|
|
5262
5201
|
return fontSize;
|
|
5263
5202
|
};
|
|
5264
|
-
|
|
5265
|
-
//#region src/css/property-descriptors/list-style-image.ts
|
|
5203
|
+
// src/css/property-descriptors/list-style-image.ts
|
|
5266
5204
|
const listStyleImage = {
|
|
5267
5205
|
name: "list-style-image",
|
|
5268
5206
|
initialValue: "none",
|
|
@@ -5275,8 +5213,7 @@ const listStyleImage = {
|
|
|
5275
5213
|
return image.parse(context, token);
|
|
5276
5214
|
}
|
|
5277
5215
|
};
|
|
5278
|
-
|
|
5279
|
-
//#region src/css/property-descriptors/list-style-position.ts
|
|
5216
|
+
// src/css/property-descriptors/list-style-position.ts
|
|
5280
5217
|
const listStylePosition = {
|
|
5281
5218
|
name: "list-style-position",
|
|
5282
5219
|
initialValue: "outside",
|
|
@@ -5289,8 +5226,7 @@ const listStylePosition = {
|
|
|
5289
5226
|
}
|
|
5290
5227
|
}
|
|
5291
5228
|
};
|
|
5292
|
-
|
|
5293
|
-
//#region src/css/property-descriptors/margin.ts
|
|
5229
|
+
// src/css/property-descriptors/margin.ts
|
|
5294
5230
|
const marginForSide = (side) => ({
|
|
5295
5231
|
name: `margin-${side}`,
|
|
5296
5232
|
initialValue: "0",
|
|
@@ -5301,8 +5237,7 @@ const marginTop = marginForSide("top");
|
|
|
5301
5237
|
const marginRight = marginForSide("right");
|
|
5302
5238
|
const marginBottom = marginForSide("bottom");
|
|
5303
5239
|
const marginLeft = marginForSide("left");
|
|
5304
|
-
|
|
5305
|
-
//#region src/css/property-descriptors/overflow-wrap.ts
|
|
5240
|
+
// src/css/property-descriptors/overflow-wrap.ts
|
|
5306
5241
|
const overflowWrap = {
|
|
5307
5242
|
name: "overflow-wrap",
|
|
5308
5243
|
initialValue: "normal",
|
|
@@ -5315,8 +5250,7 @@ const overflowWrap = {
|
|
|
5315
5250
|
}
|
|
5316
5251
|
}
|
|
5317
5252
|
};
|
|
5318
|
-
|
|
5319
|
-
//#region src/css/property-descriptors/padding.ts
|
|
5253
|
+
// src/css/property-descriptors/padding.ts
|
|
5320
5254
|
const paddingForSide = (side) => ({
|
|
5321
5255
|
name: `padding-${side}`,
|
|
5322
5256
|
initialValue: "0",
|
|
@@ -5328,8 +5262,7 @@ const paddingTop = paddingForSide("top");
|
|
|
5328
5262
|
const paddingRight = paddingForSide("right");
|
|
5329
5263
|
const paddingBottom = paddingForSide("bottom");
|
|
5330
5264
|
const paddingLeft = paddingForSide("left");
|
|
5331
|
-
|
|
5332
|
-
//#region src/css/property-descriptors/text-align.ts
|
|
5265
|
+
// src/css/property-descriptors/text-align.ts
|
|
5333
5266
|
const textAlign = {
|
|
5334
5267
|
name: "text-align",
|
|
5335
5268
|
initialValue: "left",
|
|
@@ -5344,8 +5277,7 @@ const textAlign = {
|
|
|
5344
5277
|
}
|
|
5345
5278
|
}
|
|
5346
5279
|
};
|
|
5347
|
-
|
|
5348
|
-
//#region src/css/property-descriptors/position.ts
|
|
5280
|
+
// src/css/property-descriptors/position.ts
|
|
5349
5281
|
const position = {
|
|
5350
5282
|
name: "position",
|
|
5351
5283
|
initialValue: "static",
|
|
@@ -5361,8 +5293,7 @@ const position = {
|
|
|
5361
5293
|
return 0;
|
|
5362
5294
|
}
|
|
5363
5295
|
};
|
|
5364
|
-
|
|
5365
|
-
//#region src/css/property-descriptors/text-shadow.ts
|
|
5296
|
+
// src/css/property-descriptors/text-shadow.ts
|
|
5366
5297
|
const textShadow = {
|
|
5367
5298
|
name: "text-shadow",
|
|
5368
5299
|
initialValue: "none",
|
|
@@ -5392,8 +5323,7 @@ const textShadow = {
|
|
|
5392
5323
|
});
|
|
5393
5324
|
}
|
|
5394
5325
|
};
|
|
5395
|
-
|
|
5396
|
-
//#region src/css/property-descriptors/text-transform.ts
|
|
5326
|
+
// src/css/property-descriptors/text-transform.ts
|
|
5397
5327
|
const textTransform = {
|
|
5398
5328
|
name: "text-transform",
|
|
5399
5329
|
initialValue: "none",
|
|
@@ -5408,8 +5338,7 @@ const textTransform = {
|
|
|
5408
5338
|
return 0;
|
|
5409
5339
|
}
|
|
5410
5340
|
};
|
|
5411
|
-
|
|
5412
|
-
//#region src/css/property-descriptors/transform.ts
|
|
5341
|
+
// src/css/property-descriptors/transform.ts
|
|
5413
5342
|
const transform$1 = {
|
|
5414
5343
|
name: "transform",
|
|
5415
5344
|
initialValue: "none",
|
|
@@ -5464,8 +5393,7 @@ const SUPPORTED_TRANSFORM_FUNCTIONS = {
|
|
|
5464
5393
|
matrix3d,
|
|
5465
5394
|
rotate: rotate$1
|
|
5466
5395
|
};
|
|
5467
|
-
|
|
5468
|
-
//#region src/css/property-descriptors/transform-origin.ts
|
|
5396
|
+
// src/css/property-descriptors/transform-origin.ts
|
|
5469
5397
|
const DEFAULT_VALUE = {
|
|
5470
5398
|
type: 16,
|
|
5471
5399
|
number: 50,
|
|
@@ -5483,8 +5411,7 @@ const transformOrigin = {
|
|
|
5483
5411
|
return [at(origins, 0), at(origins, 1)];
|
|
5484
5412
|
}
|
|
5485
5413
|
};
|
|
5486
|
-
|
|
5487
|
-
//#region src/css/property-descriptors/rotate.ts
|
|
5414
|
+
// src/css/property-descriptors/rotate.ts
|
|
5488
5415
|
const rotate = {
|
|
5489
5416
|
name: "rotate",
|
|
5490
5417
|
initialValue: "none",
|
|
@@ -5499,8 +5426,7 @@ const rotate = {
|
|
|
5499
5426
|
return null;
|
|
5500
5427
|
}
|
|
5501
5428
|
};
|
|
5502
|
-
|
|
5503
|
-
//#region src/css/property-descriptors/visibility.ts
|
|
5429
|
+
// src/css/property-descriptors/visibility.ts
|
|
5504
5430
|
const visibility = {
|
|
5505
5431
|
name: "visibility",
|
|
5506
5432
|
initialValue: "none",
|
|
@@ -5514,8 +5440,7 @@ const visibility = {
|
|
|
5514
5440
|
}
|
|
5515
5441
|
}
|
|
5516
5442
|
};
|
|
5517
|
-
|
|
5518
|
-
//#region src/css/property-descriptors/word-break.ts
|
|
5443
|
+
// src/css/property-descriptors/word-break.ts
|
|
5519
5444
|
const wordBreak = {
|
|
5520
5445
|
name: "word-break",
|
|
5521
5446
|
initialValue: "normal",
|
|
@@ -5529,8 +5454,7 @@ const wordBreak = {
|
|
|
5529
5454
|
}
|
|
5530
5455
|
}
|
|
5531
5456
|
};
|
|
5532
|
-
|
|
5533
|
-
//#region src/css/property-descriptors/white-space.ts
|
|
5457
|
+
// src/css/property-descriptors/white-space.ts
|
|
5534
5458
|
const whiteSpace = {
|
|
5535
5459
|
name: "white-space",
|
|
5536
5460
|
initialValue: "normal",
|
|
@@ -5546,8 +5470,7 @@ const whiteSpace = {
|
|
|
5546
5470
|
}
|
|
5547
5471
|
}
|
|
5548
5472
|
};
|
|
5549
|
-
|
|
5550
|
-
//#region src/css/property-descriptors/writing-mode.ts
|
|
5473
|
+
// src/css/property-descriptors/writing-mode.ts
|
|
5551
5474
|
const isVerticalWritingMode = (writingMode) => writingMode !== 0;
|
|
5552
5475
|
const isSidewaysWritingMode = (writingMode) => writingMode === 3 || writingMode === 4;
|
|
5553
5476
|
const writingMode = {
|
|
@@ -5565,8 +5488,7 @@ const writingMode = {
|
|
|
5565
5488
|
}
|
|
5566
5489
|
}
|
|
5567
5490
|
};
|
|
5568
|
-
|
|
5569
|
-
//#region src/css/property-descriptors/z-index.ts
|
|
5491
|
+
// src/css/property-descriptors/z-index.ts
|
|
5570
5492
|
const zIndex = {
|
|
5571
5493
|
name: "z-index",
|
|
5572
5494
|
initialValue: "auto",
|
|
@@ -5584,8 +5506,7 @@ const zIndex = {
|
|
|
5584
5506
|
throw new Error(`Invalid z-index number parsed`);
|
|
5585
5507
|
}
|
|
5586
5508
|
};
|
|
5587
|
-
|
|
5588
|
-
//#region src/css/types/time.ts
|
|
5509
|
+
// src/css/types/time.ts
|
|
5589
5510
|
const time = {
|
|
5590
5511
|
name: "time",
|
|
5591
5512
|
parse: (_context, value) => {
|
|
@@ -5596,8 +5517,7 @@ const time = {
|
|
|
5596
5517
|
throw new Error(`Unsupported time type`);
|
|
5597
5518
|
}
|
|
5598
5519
|
};
|
|
5599
|
-
|
|
5600
|
-
//#region src/css/property-descriptors/opacity.ts
|
|
5520
|
+
// src/css/property-descriptors/opacity.ts
|
|
5601
5521
|
const opacity = {
|
|
5602
5522
|
name: "opacity",
|
|
5603
5523
|
initialValue: "1",
|
|
@@ -5608,8 +5528,7 @@ const opacity = {
|
|
|
5608
5528
|
return 1;
|
|
5609
5529
|
}
|
|
5610
5530
|
};
|
|
5611
|
-
|
|
5612
|
-
//#region src/css/property-descriptors/text-decoration-style.ts
|
|
5531
|
+
// src/css/property-descriptors/text-decoration-style.ts
|
|
5613
5532
|
const textDecorationStyle = {
|
|
5614
5533
|
name: "text-decoration-style",
|
|
5615
5534
|
initialValue: "solid",
|
|
@@ -5625,8 +5544,7 @@ const textDecorationStyle = {
|
|
|
5625
5544
|
}
|
|
5626
5545
|
}
|
|
5627
5546
|
};
|
|
5628
|
-
|
|
5629
|
-
//#region src/css/property-descriptors/text-decoration-thickness.ts
|
|
5547
|
+
// src/css/property-descriptors/text-decoration-thickness.ts
|
|
5630
5548
|
const textDecorationThickness = {
|
|
5631
5549
|
name: "text-decoration-thickness",
|
|
5632
5550
|
initialValue: "auto",
|
|
@@ -5641,8 +5559,7 @@ const textDecorationThickness = {
|
|
|
5641
5559
|
return "auto";
|
|
5642
5560
|
}
|
|
5643
5561
|
};
|
|
5644
|
-
|
|
5645
|
-
//#region src/css/property-descriptors/text-underline-offset.ts
|
|
5562
|
+
// src/css/property-descriptors/text-underline-offset.ts
|
|
5646
5563
|
const textUnderlineOffset = {
|
|
5647
5564
|
name: "text-underline-offset",
|
|
5648
5565
|
initialValue: "auto",
|
|
@@ -5656,8 +5573,7 @@ const textUnderlineOffset = {
|
|
|
5656
5573
|
return "auto";
|
|
5657
5574
|
}
|
|
5658
5575
|
};
|
|
5659
|
-
|
|
5660
|
-
//#region src/css/property-descriptors/font-weight.ts
|
|
5576
|
+
// src/css/property-descriptors/font-weight.ts
|
|
5661
5577
|
const fontWeight = {
|
|
5662
5578
|
name: "font-weight",
|
|
5663
5579
|
initialValue: "normal",
|
|
@@ -5672,8 +5588,7 @@ const fontWeight = {
|
|
|
5672
5588
|
return 400;
|
|
5673
5589
|
}
|
|
5674
5590
|
};
|
|
5675
|
-
|
|
5676
|
-
//#region src/css/property-descriptors/font-variant.ts
|
|
5591
|
+
// src/css/property-descriptors/font-variant.ts
|
|
5677
5592
|
const fontVariant = {
|
|
5678
5593
|
name: "font-variant",
|
|
5679
5594
|
initialValue: "none",
|
|
@@ -5683,8 +5598,7 @@ const fontVariant = {
|
|
|
5683
5598
|
return tokens.filter(isIdentToken).map((token) => token.value);
|
|
5684
5599
|
}
|
|
5685
5600
|
};
|
|
5686
|
-
|
|
5687
|
-
//#region src/css/property-descriptors/font-style.ts
|
|
5601
|
+
// src/css/property-descriptors/font-style.ts
|
|
5688
5602
|
const fontStyle = {
|
|
5689
5603
|
name: "font-style",
|
|
5690
5604
|
initialValue: "normal",
|
|
@@ -5698,8 +5612,7 @@ const fontStyle = {
|
|
|
5698
5612
|
}
|
|
5699
5613
|
}
|
|
5700
5614
|
};
|
|
5701
|
-
|
|
5702
|
-
//#region src/css/property-descriptors/duration.ts
|
|
5615
|
+
// src/css/property-descriptors/duration.ts
|
|
5703
5616
|
const duration = {
|
|
5704
5617
|
name: "duration",
|
|
5705
5618
|
initialValue: "0s",
|
|
@@ -5709,8 +5622,7 @@ const duration = {
|
|
|
5709
5622
|
return tokens.filter(isDimensionToken).map((token) => time.parse(context, token));
|
|
5710
5623
|
}
|
|
5711
5624
|
};
|
|
5712
|
-
|
|
5713
|
-
//#region src/css/property-descriptors/box-shadow.ts
|
|
5625
|
+
// src/css/property-descriptors/box-shadow.ts
|
|
5714
5626
|
const boxShadow = {
|
|
5715
5627
|
name: "box-shadow",
|
|
5716
5628
|
initialValue: "none",
|
|
@@ -5744,8 +5656,7 @@ const boxShadow = {
|
|
|
5744
5656
|
});
|
|
5745
5657
|
}
|
|
5746
5658
|
};
|
|
5747
|
-
|
|
5748
|
-
//#region src/css/property-descriptors/paint-order.ts
|
|
5659
|
+
// src/css/property-descriptors/paint-order.ts
|
|
5749
5660
|
const paintOrder = {
|
|
5750
5661
|
name: "paint-order",
|
|
5751
5662
|
initialValue: "normal",
|
|
@@ -5775,8 +5686,7 @@ const paintOrder = {
|
|
|
5775
5686
|
return layers;
|
|
5776
5687
|
}
|
|
5777
5688
|
};
|
|
5778
|
-
|
|
5779
|
-
//#region src/css/property-descriptors/webkit-text-stroke-color.ts
|
|
5689
|
+
// src/css/property-descriptors/webkit-text-stroke-color.ts
|
|
5780
5690
|
const webkitTextStrokeColor = {
|
|
5781
5691
|
name: `-webkit-text-stroke-color`,
|
|
5782
5692
|
initialValue: "currentcolor",
|
|
@@ -5784,8 +5694,7 @@ const webkitTextStrokeColor = {
|
|
|
5784
5694
|
type: 3,
|
|
5785
5695
|
format: "color"
|
|
5786
5696
|
};
|
|
5787
|
-
|
|
5788
|
-
//#region src/css/property-descriptors/webkit-text-stroke-width.ts
|
|
5697
|
+
// src/css/property-descriptors/webkit-text-stroke-width.ts
|
|
5789
5698
|
const webkitTextStrokeWidth = {
|
|
5790
5699
|
name: `-webkit-text-stroke-width`,
|
|
5791
5700
|
initialValue: "0",
|
|
@@ -5796,8 +5705,7 @@ const webkitTextStrokeWidth = {
|
|
|
5796
5705
|
return 0;
|
|
5797
5706
|
}
|
|
5798
5707
|
};
|
|
5799
|
-
|
|
5800
|
-
//#region src/css/property-descriptors/webkit-line-clamp.ts
|
|
5708
|
+
// src/css/property-descriptors/webkit-line-clamp.ts
|
|
5801
5709
|
/**
|
|
5802
5710
|
* -webkit-line-clamp property descriptor
|
|
5803
5711
|
* Used with display: -webkit-box and -webkit-box-orient: vertical
|
|
@@ -5814,8 +5722,7 @@ const webkitLineClamp = {
|
|
|
5814
5722
|
return 0;
|
|
5815
5723
|
}
|
|
5816
5724
|
};
|
|
5817
|
-
|
|
5818
|
-
//#region src/css/property-descriptors/object-fit.ts
|
|
5725
|
+
// src/css/property-descriptors/object-fit.ts
|
|
5819
5726
|
const objectFit = {
|
|
5820
5727
|
name: "object-fit",
|
|
5821
5728
|
initialValue: "fill",
|
|
@@ -5836,8 +5743,7 @@ const parseDisplayValue = (display) => {
|
|
|
5836
5743
|
}
|
|
5837
5744
|
return 0;
|
|
5838
5745
|
};
|
|
5839
|
-
|
|
5840
|
-
//#region src/css/property-descriptors/text-overflow.ts
|
|
5746
|
+
// src/css/property-descriptors/text-overflow.ts
|
|
5841
5747
|
const textOverflow = {
|
|
5842
5748
|
name: "text-overflow",
|
|
5843
5749
|
initialValue: "clip",
|
|
@@ -5850,8 +5756,7 @@ const textOverflow = {
|
|
|
5850
5756
|
}
|
|
5851
5757
|
}
|
|
5852
5758
|
};
|
|
5853
|
-
|
|
5854
|
-
//#region src/css/property-descriptors/image-rendering.ts
|
|
5759
|
+
// src/css/property-descriptors/image-rendering.ts
|
|
5855
5760
|
const imageRendering = {
|
|
5856
5761
|
name: "image-rendering",
|
|
5857
5762
|
initialValue: "auto",
|
|
@@ -5870,8 +5775,7 @@ const imageRendering = {
|
|
|
5870
5775
|
}
|
|
5871
5776
|
}
|
|
5872
5777
|
};
|
|
5873
|
-
|
|
5874
|
-
//#region src/css/property-descriptors/mix-blend-mode.ts
|
|
5778
|
+
// src/css/property-descriptors/mix-blend-mode.ts
|
|
5875
5779
|
const MIX_BLEND_MODE$1 = {
|
|
5876
5780
|
NORMAL: "normal",
|
|
5877
5781
|
MULTIPLY: "multiply",
|
|
@@ -5900,8 +5804,7 @@ const mixBlendMode = {
|
|
|
5900
5804
|
return VALID_VALUES$1.has(token) ? token : MIX_BLEND_MODE$1.NORMAL;
|
|
5901
5805
|
}
|
|
5902
5806
|
};
|
|
5903
|
-
|
|
5904
|
-
//#region src/css/property-descriptors/filter.ts
|
|
5807
|
+
// src/css/property-descriptors/filter.ts
|
|
5905
5808
|
const filter = {
|
|
5906
5809
|
name: "filter",
|
|
5907
5810
|
initialValue: "none",
|
|
@@ -5971,8 +5874,7 @@ const renderFilterArgs = (values) => {
|
|
|
5971
5874
|
}
|
|
5972
5875
|
return parts.join("").trim();
|
|
5973
5876
|
};
|
|
5974
|
-
|
|
5975
|
-
//#region src/css/property-descriptors/font-variant-ligatures.ts
|
|
5877
|
+
// src/css/property-descriptors/font-variant-ligatures.ts
|
|
5976
5878
|
const fontVariantLigatures = {
|
|
5977
5879
|
name: "font-variant-ligatures",
|
|
5978
5880
|
initialValue: "normal",
|
|
@@ -5993,8 +5895,7 @@ const fontVariantLigatures = {
|
|
|
5993
5895
|
}
|
|
5994
5896
|
}
|
|
5995
5897
|
};
|
|
5996
|
-
|
|
5997
|
-
//#region src/css/property-descriptors/zoom.ts
|
|
5898
|
+
// src/css/property-descriptors/zoom.ts
|
|
5998
5899
|
const zoom = {
|
|
5999
5900
|
name: "zoom",
|
|
6000
5901
|
initialValue: "1",
|
|
@@ -6006,8 +5907,7 @@ const zoom = {
|
|
|
6006
5907
|
return 1;
|
|
6007
5908
|
}
|
|
6008
5909
|
};
|
|
6009
|
-
|
|
6010
|
-
//#region src/css/property-descriptors/object-position.ts
|
|
5910
|
+
// src/css/property-descriptors/object-position.ts
|
|
6011
5911
|
const objectPosition = {
|
|
6012
5912
|
name: "object-position",
|
|
6013
5913
|
initialValue: "50% 50%",
|
|
@@ -6069,8 +5969,7 @@ const backgroundBlendMode = {
|
|
|
6069
5969
|
return modes.length > 0 ? modes : ["normal"];
|
|
6070
5970
|
}
|
|
6071
5971
|
};
|
|
6072
|
-
|
|
6073
|
-
//#region src/css/property-descriptors/border-image-source.ts
|
|
5972
|
+
// src/css/property-descriptors/border-image-source.ts
|
|
6074
5973
|
const borderImageSource = {
|
|
6075
5974
|
name: "border-image-source",
|
|
6076
5975
|
initialValue: "none",
|
|
@@ -6084,8 +5983,7 @@ const borderImageSource = {
|
|
|
6084
5983
|
return image.parse(context, at(filtered, 0));
|
|
6085
5984
|
}
|
|
6086
5985
|
};
|
|
6087
|
-
|
|
6088
|
-
//#region src/css/property-descriptors/border-image-slice.ts
|
|
5986
|
+
// src/css/property-descriptors/border-image-slice.ts
|
|
6089
5987
|
const fillSides$1 = (sides) => {
|
|
6090
5988
|
const result = [...sides];
|
|
6091
5989
|
if (result.length === 1) {
|
|
@@ -6134,8 +6032,7 @@ const borderImageSlice = {
|
|
|
6134
6032
|
};
|
|
6135
6033
|
}
|
|
6136
6034
|
};
|
|
6137
|
-
|
|
6138
|
-
//#region src/css/property-descriptors/border-image-repeat.ts
|
|
6035
|
+
// src/css/property-descriptors/border-image-repeat.ts
|
|
6139
6036
|
const parseRepeatValue = (value) => {
|
|
6140
6037
|
switch (value) {
|
|
6141
6038
|
case "repeat": return 1;
|
|
@@ -6160,8 +6057,7 @@ const borderImageRepeat = {
|
|
|
6160
6057
|
};
|
|
6161
6058
|
}
|
|
6162
6059
|
};
|
|
6163
|
-
|
|
6164
|
-
//#region src/css/property-descriptors/box-decoration-break.ts
|
|
6060
|
+
// src/css/property-descriptors/box-decoration-break.ts
|
|
6165
6061
|
const boxDecorationBreak = {
|
|
6166
6062
|
name: "box-decoration-break",
|
|
6167
6063
|
initialValue: "slice",
|
|
@@ -6174,8 +6070,7 @@ const boxDecorationBreak = {
|
|
|
6174
6070
|
}
|
|
6175
6071
|
}
|
|
6176
6072
|
};
|
|
6177
|
-
|
|
6178
|
-
//#region src/css/property-descriptors/accent-color.ts
|
|
6073
|
+
// src/css/property-descriptors/accent-color.ts
|
|
6179
6074
|
const accentColor = {
|
|
6180
6075
|
name: "accent-color",
|
|
6181
6076
|
initialValue: "auto",
|
|
@@ -6186,8 +6081,7 @@ const accentColor = {
|
|
|
6186
6081
|
return color$1.parse(context, token);
|
|
6187
6082
|
}
|
|
6188
6083
|
};
|
|
6189
|
-
|
|
6190
|
-
//#region src/css/property-descriptors/webkit-text-fill-color.ts
|
|
6084
|
+
// src/css/property-descriptors/webkit-text-fill-color.ts
|
|
6191
6085
|
const webkitTextFillColor = {
|
|
6192
6086
|
name: "-webkit-text-fill-color",
|
|
6193
6087
|
initialValue: "currentcolor",
|
|
@@ -6198,8 +6092,7 @@ const webkitTextFillColor = {
|
|
|
6198
6092
|
return color$1.parse(context, token);
|
|
6199
6093
|
}
|
|
6200
6094
|
};
|
|
6201
|
-
|
|
6202
|
-
//#region src/css/property-descriptors/isolation.ts
|
|
6095
|
+
// src/css/property-descriptors/isolation.ts
|
|
6203
6096
|
const isolation = {
|
|
6204
6097
|
name: "isolation",
|
|
6205
6098
|
initialValue: "auto",
|
|
@@ -6209,8 +6102,52 @@ const isolation = {
|
|
|
6209
6102
|
return value === "isolate" ? 1 : 0;
|
|
6210
6103
|
}
|
|
6211
6104
|
};
|
|
6212
|
-
|
|
6213
|
-
|
|
6105
|
+
// src/css/property-descriptors/will-change.ts
|
|
6106
|
+
const STACKING_HINTS = /* @__PURE__ */ new Set([
|
|
6107
|
+
"transform",
|
|
6108
|
+
"translate",
|
|
6109
|
+
"rotate",
|
|
6110
|
+
"scale",
|
|
6111
|
+
"opacity",
|
|
6112
|
+
"filter",
|
|
6113
|
+
"backdrop-filter",
|
|
6114
|
+
"mix-blend-mode",
|
|
6115
|
+
"isolation",
|
|
6116
|
+
"clip-path",
|
|
6117
|
+
"mask",
|
|
6118
|
+
"mask-image",
|
|
6119
|
+
"mask-border",
|
|
6120
|
+
"perspective",
|
|
6121
|
+
"contain",
|
|
6122
|
+
"offset-path",
|
|
6123
|
+
"offset-distance",
|
|
6124
|
+
"offset-rotate",
|
|
6125
|
+
"top",
|
|
6126
|
+
"left",
|
|
6127
|
+
"bottom",
|
|
6128
|
+
"right",
|
|
6129
|
+
"z-index"
|
|
6130
|
+
]);
|
|
6131
|
+
const willChange = {
|
|
6132
|
+
name: "will-change",
|
|
6133
|
+
initialValue: "auto",
|
|
6134
|
+
prefix: false,
|
|
6135
|
+
type: 1,
|
|
6136
|
+
parse: (_context, tokens) => {
|
|
6137
|
+
return tokens.some((token) => isIdentToken(token) && STACKING_HINTS.has(token.value)) ? 1 : 0;
|
|
6138
|
+
}
|
|
6139
|
+
};
|
|
6140
|
+
// src/css/property-descriptors/contain.ts
|
|
6141
|
+
const contain = {
|
|
6142
|
+
name: "contain",
|
|
6143
|
+
initialValue: "none",
|
|
6144
|
+
prefix: false,
|
|
6145
|
+
type: 2,
|
|
6146
|
+
parse: (_context, value) => {
|
|
6147
|
+
return /\b(paint|strict|content)\b/.test(value) ? 1 : 0;
|
|
6148
|
+
}
|
|
6149
|
+
};
|
|
6150
|
+
// src/css/property-descriptors/outline.ts
|
|
6214
6151
|
const outlineStyle = {
|
|
6215
6152
|
name: "outline-style",
|
|
6216
6153
|
initialValue: "none",
|
|
@@ -6253,8 +6190,7 @@ const outlineOffset = {
|
|
|
6253
6190
|
return isDimensionToken(token) || isNumberToken(token) ? token.number : 0;
|
|
6254
6191
|
}
|
|
6255
6192
|
};
|
|
6256
|
-
|
|
6257
|
-
//#region src/css/property-descriptors/backdrop-filter.ts
|
|
6193
|
+
// src/css/property-descriptors/backdrop-filter.ts
|
|
6258
6194
|
const backdropFilter = {
|
|
6259
6195
|
name: "backdrop-filter",
|
|
6260
6196
|
initialValue: "none",
|
|
@@ -6262,8 +6198,7 @@ const backdropFilter = {
|
|
|
6262
6198
|
type: 1,
|
|
6263
6199
|
parse: (context, tokens) => filter.parse(context, tokens)
|
|
6264
6200
|
};
|
|
6265
|
-
|
|
6266
|
-
//#region src/css/property-descriptors/mask.ts
|
|
6201
|
+
// src/css/property-descriptors/mask.ts
|
|
6267
6202
|
const maskImage = {
|
|
6268
6203
|
name: "mask-image",
|
|
6269
6204
|
initialValue: "none",
|
|
@@ -6293,8 +6228,7 @@ const maskSize = {
|
|
|
6293
6228
|
type: 1,
|
|
6294
6229
|
parse: backgroundSize.parse
|
|
6295
6230
|
};
|
|
6296
|
-
|
|
6297
|
-
//#region src/css/property-descriptors/text-emphasis.ts
|
|
6231
|
+
// src/css/property-descriptors/text-emphasis.ts
|
|
6298
6232
|
const SHAPES = [
|
|
6299
6233
|
"dot",
|
|
6300
6234
|
"circle",
|
|
@@ -6369,8 +6303,7 @@ const textEmphasisPosition = {
|
|
|
6369
6303
|
};
|
|
6370
6304
|
}
|
|
6371
6305
|
};
|
|
6372
|
-
|
|
6373
|
-
//#region src/css/property-descriptors/border-image-width.ts
|
|
6306
|
+
// src/css/property-descriptors/border-image-width.ts
|
|
6374
6307
|
const fillSides = (sides) => {
|
|
6375
6308
|
const result = [...sides];
|
|
6376
6309
|
if (result.length === 1) {
|
|
@@ -6467,8 +6400,7 @@ const borderImageOutset = {
|
|
|
6467
6400
|
};
|
|
6468
6401
|
}
|
|
6469
6402
|
};
|
|
6470
|
-
|
|
6471
|
-
//#region src/css/property-descriptors/webkit-box-reflect.ts
|
|
6403
|
+
// src/css/property-descriptors/webkit-box-reflect.ts
|
|
6472
6404
|
/**
|
|
6473
6405
|
* -webkit-box-reflect: <direction> <offset>? <mask-image>?
|
|
6474
6406
|
*
|
|
@@ -6512,8 +6444,7 @@ const webkitBoxReflect = {
|
|
|
6512
6444
|
};
|
|
6513
6445
|
}
|
|
6514
6446
|
};
|
|
6515
|
-
|
|
6516
|
-
//#region src/css/property-descriptors/translate.ts
|
|
6447
|
+
// src/css/property-descriptors/translate.ts
|
|
6517
6448
|
const translate = {
|
|
6518
6449
|
name: "translate",
|
|
6519
6450
|
initialValue: "none",
|
|
@@ -6526,8 +6457,7 @@ const translate = {
|
|
|
6526
6457
|
return [at(values, 0), values.length > 1 ? at(values, 1) : ZERO_LENGTH];
|
|
6527
6458
|
}
|
|
6528
6459
|
};
|
|
6529
|
-
|
|
6530
|
-
//#region src/css/property-descriptors/scale.ts
|
|
6460
|
+
// src/css/property-descriptors/scale.ts
|
|
6531
6461
|
const scale = {
|
|
6532
6462
|
name: "scale",
|
|
6533
6463
|
initialValue: "none",
|
|
@@ -6562,8 +6492,7 @@ const STYLESHEET_READY_TIMEOUT_MS = 1e4;
|
|
|
6562
6492
|
* never fires, the mount is rejected instead of hanging forever.
|
|
6563
6493
|
*/
|
|
6564
6494
|
const IFRAME_LOAD_WATCHDOG_MS = 6e4;
|
|
6565
|
-
|
|
6566
|
-
//#region src/css/parse.ts
|
|
6495
|
+
// src/css/parse.ts
|
|
6567
6496
|
const STANDARD_PROPERTIES = [
|
|
6568
6497
|
[
|
|
6569
6498
|
"animationDuration",
|
|
@@ -7000,6 +6929,16 @@ const STANDARD_PROPERTIES = [
|
|
|
7000
6929
|
isolation,
|
|
7001
6930
|
"isolation"
|
|
7002
6931
|
],
|
|
6932
|
+
[
|
|
6933
|
+
"willChange",
|
|
6934
|
+
willChange,
|
|
6935
|
+
"will-change"
|
|
6936
|
+
],
|
|
6937
|
+
[
|
|
6938
|
+
"contain",
|
|
6939
|
+
contain,
|
|
6940
|
+
"contain"
|
|
6941
|
+
],
|
|
7003
6942
|
[
|
|
7004
6943
|
"outlineColor",
|
|
7005
6944
|
outlineColor,
|
|
@@ -7131,8 +7070,7 @@ const parse = (context, descriptor, style) => {
|
|
|
7131
7070
|
}
|
|
7132
7071
|
return result;
|
|
7133
7072
|
};
|
|
7134
|
-
|
|
7135
|
-
//#region src/css/grouped/border-styles.ts
|
|
7073
|
+
// src/css/grouped/border-styles.ts
|
|
7136
7074
|
/**
|
|
7137
7075
|
* Read-only grouped accessor for border-related CSS properties.
|
|
7138
7076
|
*
|
|
@@ -7209,8 +7147,7 @@ var BorderStyles = class {
|
|
|
7209
7147
|
return this.styles.boxShadow;
|
|
7210
7148
|
}
|
|
7211
7149
|
};
|
|
7212
|
-
|
|
7213
|
-
//#region src/css/grouped/background-styles.ts
|
|
7150
|
+
// src/css/grouped/background-styles.ts
|
|
7214
7151
|
/**
|
|
7215
7152
|
* Read-only grouped accessor for background-related CSS properties.
|
|
7216
7153
|
*
|
|
@@ -7248,8 +7185,7 @@ var BackgroundStyles = class {
|
|
|
7248
7185
|
return this.styles.backgroundBlendMode;
|
|
7249
7186
|
}
|
|
7250
7187
|
};
|
|
7251
|
-
|
|
7252
|
-
//#region src/css/grouped/font-styles.ts
|
|
7188
|
+
// src/css/grouped/font-styles.ts
|
|
7253
7189
|
/**
|
|
7254
7190
|
* Read-only grouped accessor for font/text-related CSS properties.
|
|
7255
7191
|
*
|
|
@@ -7344,8 +7280,7 @@ var FontStyles = class {
|
|
|
7344
7280
|
return this.styles.paintOrder;
|
|
7345
7281
|
}
|
|
7346
7282
|
};
|
|
7347
|
-
|
|
7348
|
-
//#region src/css/grouped/layout-styles.ts
|
|
7283
|
+
// src/css/grouped/layout-styles.ts
|
|
7349
7284
|
/**
|
|
7350
7285
|
* Read-only grouped accessor for layout/display/positioning CSS properties.
|
|
7351
7286
|
*
|
|
@@ -7473,8 +7408,7 @@ var LayoutStyles = class {
|
|
|
7473
7408
|
return this.styles.isInlineLevel();
|
|
7474
7409
|
}
|
|
7475
7410
|
};
|
|
7476
|
-
|
|
7477
|
-
//#region src/css/index.ts
|
|
7411
|
+
// src/css/index.ts
|
|
7478
7412
|
var CSSParsedDeclaration = class {
|
|
7479
7413
|
animationDuration;
|
|
7480
7414
|
backgroundClip;
|
|
@@ -7568,6 +7502,8 @@ var CSSParsedDeclaration = class {
|
|
|
7568
7502
|
accentColor;
|
|
7569
7503
|
webkitTextFillColor;
|
|
7570
7504
|
isolation;
|
|
7505
|
+
willChange;
|
|
7506
|
+
contain;
|
|
7571
7507
|
outlineColor;
|
|
7572
7508
|
outlineStyle;
|
|
7573
7509
|
outlineWidth;
|
|
@@ -7666,8 +7602,7 @@ var CSSParsedCounterDeclaration = class {
|
|
|
7666
7602
|
this.counterReset = parse(context, counterReset, declaration.counterReset);
|
|
7667
7603
|
}
|
|
7668
7604
|
};
|
|
7669
|
-
|
|
7670
|
-
//#region src/core/debugger.ts
|
|
7605
|
+
// src/core/debugger.ts
|
|
7671
7606
|
const elementDebuggerAttribute = "data-html2canvas-debug";
|
|
7672
7607
|
const getElementDebugType = (element) => {
|
|
7673
7608
|
if (typeof element.getAttribute !== "function") return 0;
|
|
@@ -7683,8 +7618,7 @@ const isDebugging = (element, type) => {
|
|
|
7683
7618
|
const elementType = getElementDebugType(element);
|
|
7684
7619
|
return elementType === 1 || type === elementType;
|
|
7685
7620
|
};
|
|
7686
|
-
|
|
7687
|
-
//#region src/dom/adopted-styles.ts
|
|
7621
|
+
// src/dom/adopted-styles.ts
|
|
7688
7622
|
/**
|
|
7689
7623
|
* Constructable stylesheet cloning (adoptedStyleSheets).
|
|
7690
7624
|
*
|
|
@@ -7725,8 +7659,7 @@ const createAdoptedStylesElement = (styleDocument, sheets, nonce) => {
|
|
|
7725
7659
|
if (nonce) style.nonce = nonce;
|
|
7726
7660
|
return style;
|
|
7727
7661
|
};
|
|
7728
|
-
|
|
7729
|
-
//#region src/dom/slot-cloner.ts
|
|
7662
|
+
// src/dom/slot-cloner.ts
|
|
7730
7663
|
/** Exported for reuse in document-cloner.ts */
|
|
7731
7664
|
const IGNORE_ATTRIBUTE = "data-html2canvas-ignore";
|
|
7732
7665
|
/**
|
|
@@ -7863,8 +7796,7 @@ var SlotCloner = class {
|
|
|
7863
7796
|
if (style) target.appendChild(style);
|
|
7864
7797
|
}
|
|
7865
7798
|
};
|
|
7866
|
-
|
|
7867
|
-
//#region src/dom/copy-css-styles.ts
|
|
7799
|
+
// src/dom/copy-css-styles.ts
|
|
7868
7800
|
/**
|
|
7869
7801
|
* Computed-style copying for cloned elements.
|
|
7870
7802
|
*
|
|
@@ -7892,8 +7824,7 @@ const copyCSSStyles = (style, target) => {
|
|
|
7892
7824
|
if (parts.length > 0) target.style.cssText = parts.join(";") + ";";
|
|
7893
7825
|
return target;
|
|
7894
7826
|
};
|
|
7895
|
-
|
|
7896
|
-
//#region src/dom/pseudo-content.ts
|
|
7827
|
+
// src/dom/pseudo-content.ts
|
|
7897
7828
|
/**
|
|
7898
7829
|
* Pseudo-element (::before / ::after) content resolution.
|
|
7899
7830
|
*
|
|
@@ -7999,8 +7930,7 @@ var PseudoContentResolver = class {
|
|
|
7999
7930
|
return anonymousReplacedElement;
|
|
8000
7931
|
}
|
|
8001
7932
|
};
|
|
8002
|
-
|
|
8003
|
-
//#region src/core/abort-helper.ts
|
|
7933
|
+
// src/core/abort-helper.ts
|
|
8004
7934
|
/**
|
|
8005
7935
|
* AbortSignal helper utilities.
|
|
8006
7936
|
*/
|
|
@@ -8015,8 +7945,7 @@ var PseudoContentResolver = class {
|
|
|
8015
7945
|
const throwIfAborted = (signal) => {
|
|
8016
7946
|
if (signal?.aborted) throw new DOMException("The operation was aborted.", "AbortError");
|
|
8017
7947
|
};
|
|
8018
|
-
|
|
8019
|
-
//#region src/dom/iframe-mount.ts
|
|
7948
|
+
// src/dom/iframe-mount.ts
|
|
8020
7949
|
const trustedTypePolicies = /* @__PURE__ */ new WeakMap();
|
|
8021
7950
|
/**
|
|
8022
7951
|
* Resolve the Trusted Types policy used for writing the clone document.
|
|
@@ -8191,6 +8120,11 @@ const stylesheetsReady = (documentClone, logger, signal, timeoutMs = STYLESHEET_
|
|
|
8191
8120
|
pending.push(new Promise((resolve) => {
|
|
8192
8121
|
let elapsed = 0;
|
|
8193
8122
|
const timer = setInterval(() => {
|
|
8123
|
+
if (signal?.aborted) {
|
|
8124
|
+
clearInterval(timer);
|
|
8125
|
+
resolve();
|
|
8126
|
+
return;
|
|
8127
|
+
}
|
|
8194
8128
|
elapsed += 50;
|
|
8195
8129
|
const currentSheet = style.sheet;
|
|
8196
8130
|
if (currentSheet && isSheetFullyApplied(currentSheet) || elapsed >= timeoutMs) {
|
|
@@ -8361,8 +8295,7 @@ const mountCloneInIFrame = (context, ownerDocument, windowSize, mount) => {
|
|
|
8361
8295
|
throw error;
|
|
8362
8296
|
});
|
|
8363
8297
|
};
|
|
8364
|
-
|
|
8365
|
-
//#region src/dom/document-cloner.ts
|
|
8298
|
+
// src/dom/document-cloner.ts
|
|
8366
8299
|
/**
|
|
8367
8300
|
* Find the parent ShadowRoot of an element, if any
|
|
8368
8301
|
* @param element - The element to check
|
|
@@ -8605,8 +8538,7 @@ var DocumentCloner = class {
|
|
|
8605
8538
|
return false;
|
|
8606
8539
|
}
|
|
8607
8540
|
};
|
|
8608
|
-
|
|
8609
|
-
//#region src/dom/dom-normalizer.ts
|
|
8541
|
+
// src/dom/dom-normalizer.ts
|
|
8610
8542
|
/**
|
|
8611
8543
|
* Normalize element styles for accurate rendering
|
|
8612
8544
|
* This includes disabling animations and neutralizing transforms.
|
|
@@ -8694,8 +8626,7 @@ var DOMNormalizer = class {
|
|
|
8694
8626
|
if (originalStyles.scale !== void 0) element.style.scale = originalStyles.scale;
|
|
8695
8627
|
}
|
|
8696
8628
|
};
|
|
8697
|
-
|
|
8698
|
-
//#region src/dom/filter-reference.ts
|
|
8629
|
+
// src/dom/filter-reference.ts
|
|
8699
8630
|
const SVG_NS$1 = "http://www.w3.org/2000/svg";
|
|
8700
8631
|
const XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
8701
8632
|
const REGION_DEFAULTS = {
|
|
@@ -8803,8 +8734,7 @@ function inlinePresentation(source, copy) {
|
|
|
8803
8734
|
}
|
|
8804
8735
|
});
|
|
8805
8736
|
}
|
|
8806
|
-
|
|
8807
|
-
//#region src/dom/element-container.ts
|
|
8737
|
+
// src/dom/element-container.ts
|
|
8808
8738
|
var ElementContainer = class {
|
|
8809
8739
|
context;
|
|
8810
8740
|
styles;
|
|
@@ -8869,8 +8799,7 @@ var ElementContainer = class {
|
|
|
8869
8799
|
for (const child of this.elements) child.restoreTree();
|
|
8870
8800
|
}
|
|
8871
8801
|
};
|
|
8872
|
-
|
|
8873
|
-
//#region src/core/features.ts
|
|
8802
|
+
// src/core/features.ts
|
|
8874
8803
|
/**
|
|
8875
8804
|
* Runtime feature detection.
|
|
8876
8805
|
*
|
|
@@ -8956,8 +8885,7 @@ const FEATURES = {
|
|
|
8956
8885
|
return value;
|
|
8957
8886
|
}
|
|
8958
8887
|
};
|
|
8959
|
-
|
|
8960
|
-
//#region src/css/layout/text.ts
|
|
8888
|
+
// src/css/layout/text.ts
|
|
8961
8889
|
var TextBounds = class {
|
|
8962
8890
|
text;
|
|
8963
8891
|
bounds;
|
|
@@ -9032,8 +8960,7 @@ const breakText = (value, styles) => {
|
|
|
9032
8960
|
if (isVerticalWritingMode(styles.writingMode)) return segmentGraphemes(value);
|
|
9033
8961
|
return styles.letterSpacing !== 0 ? segmentGraphemes(value) : segmentWords(value);
|
|
9034
8962
|
};
|
|
9035
|
-
|
|
9036
|
-
//#region src/dom/text-container.ts
|
|
8963
|
+
// src/dom/text-container.ts
|
|
9037
8964
|
var TextContainer = class {
|
|
9038
8965
|
text;
|
|
9039
8966
|
textBounds;
|
|
@@ -9056,8 +8983,7 @@ const capitalize = (m, p1, p2) => {
|
|
|
9056
8983
|
if (m.length > 0) return p1 + p2.toUpperCase();
|
|
9057
8984
|
return m;
|
|
9058
8985
|
};
|
|
9059
|
-
|
|
9060
|
-
//#region src/dom/replaced-elements/image-element-container.ts
|
|
8986
|
+
// src/dom/replaced-elements/image-element-container.ts
|
|
9061
8987
|
var ImageElementContainer = class extends ElementContainer {
|
|
9062
8988
|
src;
|
|
9063
8989
|
intrinsicWidth;
|
|
@@ -9070,8 +8996,7 @@ var ImageElementContainer = class extends ElementContainer {
|
|
|
9070
8996
|
this.context.cache.addImage(this.src);
|
|
9071
8997
|
}
|
|
9072
8998
|
};
|
|
9073
|
-
|
|
9074
|
-
//#region src/dom/replaced-elements/canvas-element-container.ts
|
|
8999
|
+
// src/dom/replaced-elements/canvas-element-container.ts
|
|
9075
9000
|
var CanvasElementContainer = class extends ElementContainer {
|
|
9076
9001
|
canvas;
|
|
9077
9002
|
intrinsicWidth;
|
|
@@ -9083,8 +9008,7 @@ var CanvasElementContainer = class extends ElementContainer {
|
|
|
9083
9008
|
this.intrinsicHeight = canvas.height;
|
|
9084
9009
|
}
|
|
9085
9010
|
};
|
|
9086
|
-
|
|
9087
|
-
//#region src/dom/replaced-elements/svg-element-container.ts
|
|
9011
|
+
// src/dom/replaced-elements/svg-element-container.ts
|
|
9088
9012
|
const BOX_OFFSET_PROPERTIES = [
|
|
9089
9013
|
"position",
|
|
9090
9014
|
"inset",
|
|
@@ -9134,8 +9058,7 @@ var SVGElementContainer = class extends ElementContainer {
|
|
|
9134
9058
|
this.context.cache.addImage(this.svg);
|
|
9135
9059
|
}
|
|
9136
9060
|
};
|
|
9137
|
-
|
|
9138
|
-
//#region src/dom/elements/li-element-container.ts
|
|
9061
|
+
// src/dom/elements/li-element-container.ts
|
|
9139
9062
|
var LIElementContainer = class extends ElementContainer {
|
|
9140
9063
|
value;
|
|
9141
9064
|
constructor(context, element, options = {}) {
|
|
@@ -9143,8 +9066,7 @@ var LIElementContainer = class extends ElementContainer {
|
|
|
9143
9066
|
this.value = element.value;
|
|
9144
9067
|
}
|
|
9145
9068
|
};
|
|
9146
|
-
|
|
9147
|
-
//#region src/dom/elements/ol-element-container.ts
|
|
9069
|
+
// src/dom/elements/ol-element-container.ts
|
|
9148
9070
|
var OLElementContainer = class extends ElementContainer {
|
|
9149
9071
|
start;
|
|
9150
9072
|
reversed;
|
|
@@ -9154,8 +9076,7 @@ var OLElementContainer = class extends ElementContainer {
|
|
|
9154
9076
|
this.reversed = typeof element.reversed === "boolean" && element.reversed === true;
|
|
9155
9077
|
}
|
|
9156
9078
|
};
|
|
9157
|
-
|
|
9158
|
-
//#region src/dom/replaced-elements/input-element-container.ts
|
|
9079
|
+
// src/dom/replaced-elements/input-element-container.ts
|
|
9159
9080
|
const CHECKBOX_BORDER_RADIUS = [{
|
|
9160
9081
|
type: 15,
|
|
9161
9082
|
flags: 0,
|
|
@@ -9210,8 +9131,7 @@ var InputElementContainer = class extends ElementContainer {
|
|
|
9210
9131
|
}
|
|
9211
9132
|
}
|
|
9212
9133
|
};
|
|
9213
|
-
|
|
9214
|
-
//#region src/dom/elements/select-element-container.ts
|
|
9134
|
+
// src/dom/elements/select-element-container.ts
|
|
9215
9135
|
var SelectElementContainer = class extends ElementContainer {
|
|
9216
9136
|
value;
|
|
9217
9137
|
constructor(context, element, options = {}) {
|
|
@@ -9220,8 +9140,7 @@ var SelectElementContainer = class extends ElementContainer {
|
|
|
9220
9140
|
this.value = option ? option.text || "" : "";
|
|
9221
9141
|
}
|
|
9222
9142
|
};
|
|
9223
|
-
|
|
9224
|
-
//#region src/dom/elements/textarea-element-container.ts
|
|
9143
|
+
// src/dom/elements/textarea-element-container.ts
|
|
9225
9144
|
var TextareaElementContainer = class extends ElementContainer {
|
|
9226
9145
|
value;
|
|
9227
9146
|
constructor(context, element, options = {}) {
|
|
@@ -9229,8 +9148,7 @@ var TextareaElementContainer = class extends ElementContainer {
|
|
|
9229
9148
|
this.value = element.value;
|
|
9230
9149
|
}
|
|
9231
9150
|
};
|
|
9232
|
-
|
|
9233
|
-
//#region src/dom/replaced-elements/iframe-element-container.ts
|
|
9151
|
+
// src/dom/replaced-elements/iframe-element-container.ts
|
|
9234
9152
|
var IFrameElementContainer = class extends ElementContainer {
|
|
9235
9153
|
src;
|
|
9236
9154
|
width;
|
|
@@ -9261,8 +9179,7 @@ var IFrameElementContainer = class extends ElementContainer {
|
|
|
9261
9179
|
}
|
|
9262
9180
|
}
|
|
9263
9181
|
};
|
|
9264
|
-
|
|
9265
|
-
//#region src/dom/node-parser.ts
|
|
9182
|
+
// src/dom/node-parser.ts
|
|
9266
9183
|
const LIST_OWNERS = [
|
|
9267
9184
|
"OL",
|
|
9268
9185
|
"UL",
|
|
@@ -9328,15 +9245,14 @@ const parseTree = (context, element, options = {}) => {
|
|
|
9328
9245
|
return container;
|
|
9329
9246
|
};
|
|
9330
9247
|
const createsRealStackingContext = (node, container, root) => {
|
|
9331
|
-
return container.styles.isPositionedWithZIndex() || container.styles.opacity < 1 || Boolean(container.styles.filter) || Boolean(container.styles.backdropFilter) || container.styles.maskImage.length > 0 || Boolean(container.styles.webkitBoxReflect) || container.styles.isolation === 1 || container.styles.isTransformed() || isBodyElement(node) && root.styles.isTransparent();
|
|
9248
|
+
return container.styles.isPositionedWithZIndex() || container.styles.opacity < 1 || Boolean(container.styles.filter) || Boolean(container.styles.backdropFilter) || container.styles.maskImage.length > 0 || Boolean(container.styles.webkitBoxReflect) || container.styles.isolation === 1 || container.styles.willChange === 1 || container.styles.contain === 1 || container.styles.isTransformed() || isBodyElement(node) && root.styles.isTransparent();
|
|
9332
9249
|
};
|
|
9333
9250
|
const createsStackingContext = (styles) => {
|
|
9334
9251
|
if (styles.isPositioned() || styles.isFloating()) return true;
|
|
9335
9252
|
if (styles.mixBlendMode !== MIX_BLEND_MODE$1.NORMAL) return true;
|
|
9336
9253
|
return contains(styles.display, 268435456) || contains(styles.display, 33554432) || contains(styles.display, 536870912) || contains(styles.display, 134217728);
|
|
9337
9254
|
};
|
|
9338
|
-
|
|
9339
|
-
//#region src/render/path.ts
|
|
9255
|
+
// src/render/path.ts
|
|
9340
9256
|
const equalPath = (a, b) => {
|
|
9341
9257
|
if (a.length === b.length) return a.some((v, i) => v === b[i]);
|
|
9342
9258
|
return false;
|
|
@@ -9352,8 +9268,7 @@ const transformPath = (path, deltaX, deltaY, deltaW, deltaH) => {
|
|
|
9352
9268
|
return point;
|
|
9353
9269
|
});
|
|
9354
9270
|
};
|
|
9355
|
-
|
|
9356
|
-
//#region src/render/vector.ts
|
|
9271
|
+
// src/render/vector.ts
|
|
9357
9272
|
var Vector = class Vector {
|
|
9358
9273
|
type;
|
|
9359
9274
|
x;
|
|
@@ -9367,8 +9282,7 @@ var Vector = class Vector {
|
|
|
9367
9282
|
return new Vector(this.x + deltaX, this.y + deltaY);
|
|
9368
9283
|
}
|
|
9369
9284
|
};
|
|
9370
|
-
|
|
9371
|
-
//#region src/render/bezier-curve.ts
|
|
9285
|
+
// src/render/bezier-curve.ts
|
|
9372
9286
|
const lerp = (a, b, t) => {
|
|
9373
9287
|
return new Vector(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
|
|
9374
9288
|
};
|
|
@@ -9402,8 +9316,7 @@ var BezierCurve = class BezierCurve {
|
|
|
9402
9316
|
}
|
|
9403
9317
|
};
|
|
9404
9318
|
const isBezierCurve = (path) => path.type === 1;
|
|
9405
|
-
|
|
9406
|
-
//#region src/render/bound-curves.ts
|
|
9319
|
+
// src/render/bound-curves.ts
|
|
9407
9320
|
var BoundCurves = class {
|
|
9408
9321
|
topLeftBorderDoubleOuterBox;
|
|
9409
9322
|
topRightBorderDoubleOuterBox;
|
|
@@ -9527,8 +9440,7 @@ const calculatePaddingBoxPath = (curves) => {
|
|
|
9527
9440
|
curves.bottomLeftPaddingBox
|
|
9528
9441
|
];
|
|
9529
9442
|
};
|
|
9530
|
-
|
|
9531
|
-
//#region src/render/effects.ts
|
|
9443
|
+
// src/render/effects.ts
|
|
9532
9444
|
var TransformEffect = class {
|
|
9533
9445
|
offsetX;
|
|
9534
9446
|
offsetY;
|
|
@@ -9735,8 +9647,7 @@ const isOpacityEffect = (effect) => effect.type === 2;
|
|
|
9735
9647
|
const isClipPathEffect = (effect) => effect.type === 3;
|
|
9736
9648
|
const isBlendEffect = (effect) => effect.type === 4;
|
|
9737
9649
|
const isFilterEffect = (effect) => effect.type === 5;
|
|
9738
|
-
|
|
9739
|
-
//#region src/render/stacking-context.ts
|
|
9650
|
+
// src/render/stacking-context.ts
|
|
9740
9651
|
var StackingContext = class {
|
|
9741
9652
|
element;
|
|
9742
9653
|
negativeZIndex;
|
|
@@ -10059,8 +9970,7 @@ const parseStackingContexts = (container) => {
|
|
|
10059
9970
|
processListItems(paintContainer.container, listItems);
|
|
10060
9971
|
return root;
|
|
10061
9972
|
};
|
|
10062
|
-
|
|
10063
|
-
//#region src/render/canvas/gradient-rasterizer.ts
|
|
9973
|
+
// src/render/canvas/gradient-rasterizer.ts
|
|
10064
9974
|
const clampStop = (stop) => Math.min(1, Math.max(0, stop));
|
|
10065
9975
|
/**
|
|
10066
9976
|
* Stack the one-cycle stop list periodically across [0, 1]. Returns null for
|
|
@@ -10139,8 +10049,7 @@ const rasterizeRadialGradient = (ownerDocument, rx, ry, stops, repeating = false
|
|
|
10139
10049
|
ry
|
|
10140
10050
|
};
|
|
10141
10051
|
};
|
|
10142
|
-
|
|
10143
|
-
//#region src/render/box-sizing.ts
|
|
10052
|
+
// src/render/box-sizing.ts
|
|
10144
10053
|
const paddingBox = (element) => {
|
|
10145
10054
|
const bounds = element.bounds;
|
|
10146
10055
|
const styles = element.styles;
|
|
@@ -10155,8 +10064,7 @@ const contentBox = (element) => {
|
|
|
10155
10064
|
const paddingBottom = getAbsoluteValue(styles.paddingBottom, bounds.width);
|
|
10156
10065
|
return bounds.add(paddingLeft + styles.borderLeftWidth, paddingTop + styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth + paddingLeft + paddingRight), -(styles.borderTopWidth + styles.borderBottomWidth + paddingTop + paddingBottom));
|
|
10157
10066
|
};
|
|
10158
|
-
|
|
10159
|
-
//#region src/render/background.ts
|
|
10067
|
+
// src/render/background.ts
|
|
10160
10068
|
const calculateBackgroundPositioningArea = (backgroundOrigin, element) => {
|
|
10161
10069
|
if (backgroundOrigin === 0) return element.bounds;
|
|
10162
10070
|
if (backgroundOrigin === 2) return contentBox(element);
|
|
@@ -10257,8 +10165,7 @@ const calculateBackgroundRepeatPath = (repeat, [x, y], [width, height], backgrou
|
|
|
10257
10165
|
];
|
|
10258
10166
|
}
|
|
10259
10167
|
};
|
|
10260
|
-
|
|
10261
|
-
//#region src/render/canvas/filter-surface.ts
|
|
10168
|
+
// src/render/canvas/filter-surface.ts
|
|
10262
10169
|
var FilterSurfaceError = class extends Error {};
|
|
10263
10170
|
const releaseSurface = (canvas) => {
|
|
10264
10171
|
canvas.width = canvas.height = 0;
|
|
@@ -10773,8 +10680,91 @@ function cropSurface(bounds, viewport, margin, scale) {
|
|
|
10773
10680
|
const bottom = Math.ceil(Math.min(bounds.top + bounds.height, area.top + area.height) * scale) / scale;
|
|
10774
10681
|
return new Bounds(left, top, Math.max(0, right - left), Math.max(0, bottom - top));
|
|
10775
10682
|
}
|
|
10776
|
-
|
|
10777
|
-
|
|
10683
|
+
// src/render/matrix.ts
|
|
10684
|
+
/**
|
|
10685
|
+
* 2D affine matrix utilities for the composited-surface render path.
|
|
10686
|
+
*
|
|
10687
|
+
* Matrices use the canvas `transform(a, b, c, d, e, f)` column-vector
|
|
10688
|
+
* convention:
|
|
10689
|
+
*
|
|
10690
|
+
* | a c e | | x' | | a·x + c·y + e |
|
|
10691
|
+
* | b d f | × | y' | = | b·x + d·y + f |
|
|
10692
|
+
* | 0 0 1 | | 1 | | 1 |
|
|
10693
|
+
*
|
|
10694
|
+
* `TransformEffect` carries the same tuple order, so effects and bounds can
|
|
10695
|
+
* share these helpers. Composition follows the canvas post-multiply rule:
|
|
10696
|
+
* `multiplyMatrix(ancestor, own)` equals `ancestor` followed by `own`.
|
|
10697
|
+
*/
|
|
10698
|
+
const IDENTITY_MATRIX = [
|
|
10699
|
+
1,
|
|
10700
|
+
0,
|
|
10701
|
+
0,
|
|
10702
|
+
1,
|
|
10703
|
+
0,
|
|
10704
|
+
0
|
|
10705
|
+
];
|
|
10706
|
+
const isIdentityMatrix = (m) => m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1 && m[4] === 0 && m[5] === 0;
|
|
10707
|
+
/**
|
|
10708
|
+
* Compose two transforms: the result applies `a` first, then `b`
|
|
10709
|
+
* (canvas post-multiply, matching successive `ctx.transform` calls).
|
|
10710
|
+
*/
|
|
10711
|
+
const multiplyMatrix = (a, b) => [
|
|
10712
|
+
a[0] * b[0] + a[2] * b[1],
|
|
10713
|
+
a[1] * b[0] + a[3] * b[1],
|
|
10714
|
+
a[0] * b[2] + a[2] * b[3],
|
|
10715
|
+
a[1] * b[2] + a[3] * b[3],
|
|
10716
|
+
a[0] * b[4] + a[2] * b[5] + a[4],
|
|
10717
|
+
a[1] * b[4] + a[3] * b[5] + a[5]
|
|
10718
|
+
];
|
|
10719
|
+
/** Apply a matrix to a point, returning the mapped [x, y]. */
|
|
10720
|
+
const applyMatrixToPoint = (m, x, y) => [m[0] * x + m[2] * y + m[4], m[1] * x + m[3] * y + m[5]];
|
|
10721
|
+
/**
|
|
10722
|
+
* Map a layout-space Bounds through the matrix and return the axis-aligned
|
|
10723
|
+
* bounding box of the four transformed corners. Non-uniform scales and
|
|
10724
|
+
* rotations grow the box; this is intentionally conservative.
|
|
10725
|
+
*/
|
|
10726
|
+
const transformBoundsToAabb = (m, bounds) => {
|
|
10727
|
+
const corners = [
|
|
10728
|
+
applyMatrixToPoint(m, bounds.left, bounds.top),
|
|
10729
|
+
applyMatrixToPoint(m, bounds.left + bounds.width, bounds.top),
|
|
10730
|
+
applyMatrixToPoint(m, bounds.left, bounds.top + bounds.height),
|
|
10731
|
+
applyMatrixToPoint(m, bounds.left + bounds.width, bounds.top + bounds.height)
|
|
10732
|
+
];
|
|
10733
|
+
const left = Math.min(...corners.map((p) => p[0]));
|
|
10734
|
+
const right = Math.max(...corners.map((p) => p[0]));
|
|
10735
|
+
const top = Math.min(...corners.map((p) => p[1]));
|
|
10736
|
+
const bottom = Math.max(...corners.map((p) => p[1]));
|
|
10737
|
+
return new Bounds(left, top, right - left, bottom - top);
|
|
10738
|
+
};
|
|
10739
|
+
/**
|
|
10740
|
+
* Invert an affine matrix. Returns null for singular matrices
|
|
10741
|
+
* (zero-scale transforms have no meaningful inverse).
|
|
10742
|
+
*/
|
|
10743
|
+
const invertMatrix = (m) => {
|
|
10744
|
+
const det = m[0] * m[3] - m[1] * m[2];
|
|
10745
|
+
if (!Number.isFinite(det) || det === 0) return null;
|
|
10746
|
+
const invDet = 1 / det;
|
|
10747
|
+
return [
|
|
10748
|
+
m[3] * invDet,
|
|
10749
|
+
-m[1] * invDet,
|
|
10750
|
+
-m[2] * invDet,
|
|
10751
|
+
m[0] * invDet,
|
|
10752
|
+
(m[2] * m[5] - m[3] * m[4]) * invDet,
|
|
10753
|
+
(m[1] * m[4] - m[0] * m[5]) * invDet
|
|
10754
|
+
];
|
|
10755
|
+
};
|
|
10756
|
+
/**
|
|
10757
|
+
* Map a visual-space viewport back into the layout space of `m`'s inputs.
|
|
10758
|
+
* Used where a crop window (visual coordinates) must select content measured
|
|
10759
|
+
* in layout coordinates: the conservative answer is the AABB of the inverse
|
|
10760
|
+
* viewport corners.
|
|
10761
|
+
*/
|
|
10762
|
+
const inverseTransformBoundsToAabb = (m, bounds) => {
|
|
10763
|
+
const inverse = invertMatrix(m);
|
|
10764
|
+
if (!inverse) return null;
|
|
10765
|
+
return transformBoundsToAabb(inverse, bounds);
|
|
10766
|
+
};
|
|
10767
|
+
// src/render/canvas/text/text-decoration-renderer.ts
|
|
10778
10768
|
var TextDecorationRenderer = class {
|
|
10779
10769
|
ctx;
|
|
10780
10770
|
constructor(ctx) {
|
|
@@ -10862,8 +10852,7 @@ var TextDecorationRenderer = class {
|
|
|
10862
10852
|
this.ctx.restore();
|
|
10863
10853
|
}
|
|
10864
10854
|
};
|
|
10865
|
-
|
|
10866
|
-
//#region src/render/canvas/font-utils.ts
|
|
10855
|
+
// src/render/canvas/font-utils.ts
|
|
10867
10856
|
/**
|
|
10868
10857
|
* Font measurement utility
|
|
10869
10858
|
*
|
|
@@ -10898,8 +10887,7 @@ const measureFontMetrics = (ctx, fallback) => {
|
|
|
10898
10887
|
const measureBaseline = (ctx, fallback) => {
|
|
10899
10888
|
return measureFontMetrics(ctx, fallback).baseline;
|
|
10900
10889
|
};
|
|
10901
|
-
|
|
10902
|
-
//#region src/render/canvas/text-renderer.ts
|
|
10890
|
+
// src/render/canvas/text-renderer.ts
|
|
10903
10891
|
const TEXT_OVERFLOW_EPSILON = 1;
|
|
10904
10892
|
/**
|
|
10905
10893
|
* Detect CJK (Chinese, Japanese, Korean) characters in a string.
|
|
@@ -11325,8 +11313,7 @@ var TextRenderer = class {
|
|
|
11325
11313
|
}
|
|
11326
11314
|
}
|
|
11327
11315
|
};
|
|
11328
|
-
|
|
11329
|
-
//#region src/render/canvas/canvas-path.ts
|
|
11316
|
+
// src/render/canvas/canvas-path.ts
|
|
11330
11317
|
const formatCanvasPath = (ctx, paths) => {
|
|
11331
11318
|
paths.forEach((point, index) => {
|
|
11332
11319
|
const start = isBezierCurve(point) ? point.start : point;
|
|
@@ -11340,8 +11327,7 @@ const createCanvasPath = (ctx, paths) => {
|
|
|
11340
11327
|
formatCanvasPath(ctx, paths);
|
|
11341
11328
|
ctx.closePath();
|
|
11342
11329
|
};
|
|
11343
|
-
|
|
11344
|
-
//#region src/core/lru-map.ts
|
|
11330
|
+
// src/core/lru-map.ts
|
|
11345
11331
|
/**
|
|
11346
11332
|
* Generic LRU (Least-Recently-Used) wrapper over a native `Map`.
|
|
11347
11333
|
*
|
|
@@ -11399,8 +11385,7 @@ var LRUMap = class {
|
|
|
11399
11385
|
this._map.clear();
|
|
11400
11386
|
}
|
|
11401
11387
|
};
|
|
11402
|
-
|
|
11403
|
-
//#region src/render/canvas/background-renderer.ts
|
|
11388
|
+
// src/render/canvas/background-renderer.ts
|
|
11404
11389
|
/**
|
|
11405
11390
|
* Background Renderer
|
|
11406
11391
|
*
|
|
@@ -11763,8 +11748,7 @@ var BackgroundRenderer = class {
|
|
|
11763
11748
|
createCanvasPath(this.ctx, paths);
|
|
11764
11749
|
}
|
|
11765
11750
|
};
|
|
11766
|
-
|
|
11767
|
-
//#region src/render/border.ts
|
|
11751
|
+
// src/render/border.ts
|
|
11768
11752
|
const parsePathForBorder = (curves, borderSide) => {
|
|
11769
11753
|
switch (borderSide) {
|
|
11770
11754
|
case 0: return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftPaddingBox, curves.topRightBorderBox, curves.topRightPaddingBox);
|
|
@@ -11817,8 +11801,7 @@ const createPathFromCurves = (outer1, inner1, outer2, inner2) => {
|
|
|
11817
11801
|
else path.push(inner1);
|
|
11818
11802
|
return path;
|
|
11819
11803
|
};
|
|
11820
|
-
|
|
11821
|
-
//#region src/render/canvas/border-renderer.ts
|
|
11804
|
+
// src/render/canvas/border-renderer.ts
|
|
11822
11805
|
/**
|
|
11823
11806
|
* Border Renderer
|
|
11824
11807
|
*
|
|
@@ -11952,8 +11935,7 @@ var BorderRenderer = class {
|
|
|
11952
11935
|
this.ctx.restore();
|
|
11953
11936
|
}
|
|
11954
11937
|
};
|
|
11955
|
-
|
|
11956
|
-
//#region src/render/canvas/border-image-renderer.ts
|
|
11938
|
+
// src/render/canvas/border-image-renderer.ts
|
|
11957
11939
|
/**
|
|
11958
11940
|
* Resolve border-image-width to per-side pixel widths. `auto` uses the
|
|
11959
11941
|
* corresponding border width, numbers multiply it, lengths are absolute and
|
|
@@ -12161,8 +12143,7 @@ var BorderImageRenderer = class {
|
|
|
12161
12143
|
this.ctx.restore();
|
|
12162
12144
|
}
|
|
12163
12145
|
};
|
|
12164
|
-
|
|
12165
|
-
//#region src/render/canvas/effects-renderer.ts
|
|
12146
|
+
// src/render/canvas/effects-renderer.ts
|
|
12166
12147
|
/**
|
|
12167
12148
|
* Effects Renderer
|
|
12168
12149
|
*
|
|
@@ -12310,8 +12291,7 @@ var EffectsRenderer = class {
|
|
|
12310
12291
|
return this.activeEffects.length > 0;
|
|
12311
12292
|
}
|
|
12312
12293
|
};
|
|
12313
|
-
|
|
12314
|
-
//#region src/render/canvas/mask-renderer.ts
|
|
12294
|
+
// src/render/canvas/mask-renderer.ts
|
|
12315
12295
|
/**
|
|
12316
12296
|
* Mask Renderer
|
|
12317
12297
|
*
|
|
@@ -12458,8 +12438,7 @@ const paintMaskLayers = async (ctx, layers, styles, area, matchImage) => {
|
|
|
12458
12438
|
} else paintGradientLayer(ctx, layer, area);
|
|
12459
12439
|
}
|
|
12460
12440
|
};
|
|
12461
|
-
|
|
12462
|
-
//#region src/render/object-fit.ts
|
|
12441
|
+
// src/render/object-fit.ts
|
|
12463
12442
|
const calculateObjectFitRendering = (intrinsicWidth, intrinsicHeight, box, objectFit, objectPosition) => {
|
|
12464
12443
|
let sx = 0;
|
|
12465
12444
|
let sy = 0;
|
|
@@ -12545,8 +12524,7 @@ const calculateObjectFitRendering = (intrinsicWidth, intrinsicHeight, box, objec
|
|
|
12545
12524
|
dh
|
|
12546
12525
|
};
|
|
12547
12526
|
};
|
|
12548
|
-
|
|
12549
|
-
//#region src/render/canvas/content-renderer.ts
|
|
12527
|
+
// src/render/canvas/content-renderer.ts
|
|
12550
12528
|
/**
|
|
12551
12529
|
* Render replaced elements: Image, Canvas, SVG, IFrame.
|
|
12552
12530
|
*/
|
|
@@ -12767,8 +12745,7 @@ const canvasTextAlign = (textAlign) => {
|
|
|
12767
12745
|
default: return "left";
|
|
12768
12746
|
}
|
|
12769
12747
|
};
|
|
12770
|
-
|
|
12771
|
-
//#region src/render/canvas/box-shadow-geometry.ts
|
|
12748
|
+
// src/render/canvas/box-shadow-geometry.ts
|
|
12772
12749
|
const shadowRadius = (radius, spread) => {
|
|
12773
12750
|
const delta = spread > radius ? spread * (1 + Math.pow(radius / spread - 1, 3)) : spread;
|
|
12774
12751
|
return Math.max(0, radius + delta);
|
|
@@ -12812,8 +12789,7 @@ const spreadShadowPath = (paths, spread) => {
|
|
|
12812
12789
|
return new BezierCurve(resize(point.start), resize(point.startControl), resize(point.endControl), resize(point.end));
|
|
12813
12790
|
});
|
|
12814
12791
|
};
|
|
12815
|
-
|
|
12816
|
-
//#region src/render/canvas/box-shadow-transform.ts
|
|
12792
|
+
// src/render/canvas/box-shadow-transform.ts
|
|
12817
12793
|
const shadowSpace = (matrix, width, height) => {
|
|
12818
12794
|
const { a, b, c, d, e, f } = matrix;
|
|
12819
12795
|
if (![
|
|
@@ -12856,8 +12832,7 @@ const shadowSpace = (matrix, width, height) => {
|
|
|
12856
12832
|
uniform: Math.abs(xx - yy) <= tolerance && Math.abs(xy) <= tolerance
|
|
12857
12833
|
};
|
|
12858
12834
|
};
|
|
12859
|
-
|
|
12860
|
-
//#region src/render/canvas/box-shadow-painter.ts
|
|
12835
|
+
// src/render/canvas/box-shadow-painter.ts
|
|
12861
12836
|
const complement = (ctx, rect, hole) => {
|
|
12862
12837
|
ctx.beginPath();
|
|
12863
12838
|
ctx.rect(rect.left, rect.top, rect.width, rect.height);
|
|
@@ -12985,8 +12960,7 @@ const paintBoxShadow = async (ctx, paint, shadow, options, budget) => {
|
|
|
12985
12960
|
ctx.restore();
|
|
12986
12961
|
}
|
|
12987
12962
|
};
|
|
12988
|
-
|
|
12989
|
-
//#region src/render/canvas/text-clip-renderer.ts
|
|
12963
|
+
// src/render/canvas/text-clip-renderer.ts
|
|
12990
12964
|
var TextClipRenderer = class {
|
|
12991
12965
|
ctx;
|
|
12992
12966
|
context;
|
|
@@ -13146,8 +13120,7 @@ var TextClipRenderer = class {
|
|
|
13146
13120
|
return canvases.length ? canvases : null;
|
|
13147
13121
|
}
|
|
13148
13122
|
};
|
|
13149
|
-
|
|
13150
|
-
//#region src/render/canvas/canvas-renderer.ts
|
|
13123
|
+
// src/render/canvas/canvas-renderer.ts
|
|
13151
13124
|
var CanvasRenderer = class CanvasRenderer {
|
|
13152
13125
|
surfaceRoot;
|
|
13153
13126
|
surfaceBudget;
|
|
@@ -13225,7 +13198,9 @@ var CanvasRenderer = class CanvasRenderer {
|
|
|
13225
13198
|
const hasMask = styles.maskImage.length > 0;
|
|
13226
13199
|
const reflect = styles.webkitBoxReflect;
|
|
13227
13200
|
const hasBlend = styles.mixBlendMode !== MIX_BLEND_MODE$1.NORMAL;
|
|
13228
|
-
|
|
13201
|
+
const reflectTransformed = reflect && !isIdentityMatrix(this.ancestorTransform(stack.element));
|
|
13202
|
+
if (reflectTransformed) this.context.logger.warn("-webkit-box-reflect under an ancestor transform is not supported; the reflection is skipped for this subtree");
|
|
13203
|
+
if (stack.element !== this.surfaceRoot && !this.legacySubtree && !reflectTransformed && (hasMask || reflect || hasBlend || filter !== null && (hasFilter || styles.opacity < 1)) && this.canComposite(stack.element)) {
|
|
13229
13204
|
if (!await this.renderCompositedStack(stack, filter, hasMask, reflect, hasBlend)) {
|
|
13230
13205
|
this.legacySubtree = true;
|
|
13231
13206
|
try {
|
|
@@ -13242,7 +13217,7 @@ var CanvasRenderer = class CanvasRenderer {
|
|
|
13242
13217
|
canComposite(paint) {
|
|
13243
13218
|
const supported = (container) => {
|
|
13244
13219
|
const styles = container.styles;
|
|
13245
|
-
return
|
|
13220
|
+
return styles.clipPath.type === 0 && !contains(styles.display, 2048) && parseFilterChain(styles.filter) !== null;
|
|
13246
13221
|
};
|
|
13247
13222
|
const subtree = (container) => supported(container) && container.elements.every(subtree);
|
|
13248
13223
|
let ancestor = paint.parent;
|
|
@@ -13252,25 +13227,82 @@ var CanvasRenderer = class CanvasRenderer {
|
|
|
13252
13227
|
}
|
|
13253
13228
|
return subtree(paint.container);
|
|
13254
13229
|
}
|
|
13230
|
+
/**
|
|
13231
|
+
* Root-to-element transform accumulated from the ancestor chain's
|
|
13232
|
+
* TransformEffects (including zoom), stopping at the surface root. The
|
|
13233
|
+
* element's own TransformEffect is intentionally excluded: inside the
|
|
13234
|
+
* offscreen surface it is still applied by the normal effects pass, and
|
|
13235
|
+
* at composition time it is filtered from the recomposed effect list.
|
|
13236
|
+
*/
|
|
13237
|
+
ancestorTransform(paint) {
|
|
13238
|
+
const chain = [];
|
|
13239
|
+
let node = paint;
|
|
13240
|
+
while (node && node !== this.surfaceRoot) {
|
|
13241
|
+
for (const effect of node.effects) if (isTransformEffect(effect)) chain.push(effect);
|
|
13242
|
+
node = node.parent;
|
|
13243
|
+
}
|
|
13244
|
+
if (chain.length === 0) return IDENTITY_MATRIX;
|
|
13245
|
+
let matrix = IDENTITY_MATRIX;
|
|
13246
|
+
for (let i = chain.length - 1; i >= 0; i--) {
|
|
13247
|
+
const effect = at(chain, i);
|
|
13248
|
+
const anchored = multiplyMatrix(multiplyMatrix([
|
|
13249
|
+
1,
|
|
13250
|
+
0,
|
|
13251
|
+
0,
|
|
13252
|
+
1,
|
|
13253
|
+
effect.offsetX,
|
|
13254
|
+
effect.offsetY
|
|
13255
|
+
], effect.matrix), [
|
|
13256
|
+
1,
|
|
13257
|
+
0,
|
|
13258
|
+
0,
|
|
13259
|
+
1,
|
|
13260
|
+
-effect.offsetX,
|
|
13261
|
+
-effect.offsetY
|
|
13262
|
+
]);
|
|
13263
|
+
matrix = multiplyMatrix(matrix, anchored);
|
|
13264
|
+
}
|
|
13265
|
+
return matrix;
|
|
13266
|
+
}
|
|
13255
13267
|
async renderCompositedStack(stack, filter, hasMask, reflect, hasBlend = false) {
|
|
13256
13268
|
const signal = this.options.signal;
|
|
13257
13269
|
if (signal?.aborted) throw new DOMException("The operation was aborted.", "AbortError");
|
|
13258
13270
|
const container = stack.element.container;
|
|
13259
|
-
const
|
|
13271
|
+
const ancestorMatrix = this.ancestorTransform(stack.element);
|
|
13272
|
+
const ownTransforms = stack.element.effects.filter(isTransformEffect);
|
|
13273
|
+
let chainMatrix = ancestorMatrix;
|
|
13274
|
+
for (const effect of ownTransforms) chainMatrix = multiplyMatrix(chainMatrix, multiplyMatrix(multiplyMatrix([
|
|
13275
|
+
1,
|
|
13276
|
+
0,
|
|
13277
|
+
0,
|
|
13278
|
+
1,
|
|
13279
|
+
effect.offsetX,
|
|
13280
|
+
effect.offsetY
|
|
13281
|
+
], effect.matrix), [
|
|
13282
|
+
1,
|
|
13283
|
+
0,
|
|
13284
|
+
0,
|
|
13285
|
+
1,
|
|
13286
|
+
-effect.offsetX,
|
|
13287
|
+
-effect.offsetY
|
|
13288
|
+
]));
|
|
13289
|
+
const layoutBounds = surfaceBounds(container);
|
|
13290
|
+
const bounds = cropSurface(isIdentityMatrix(chainMatrix) ? layoutBounds : transformBoundsToAabb(chainMatrix, layoutBounds), new Bounds(this.options.x, this.options.y, this.options.width, this.options.height), filter ? filterOutset(filter, container.filterReferences) : 0, this.options.scale);
|
|
13260
13291
|
if (!bounds.width || !bounds.height) return true;
|
|
13261
13292
|
const reserved = reserveSurface(this.surfaceBudget, Math.ceil(bounds.width * this.options.scale), Math.ceil(bounds.height * this.options.scale));
|
|
13262
13293
|
if (!reserved) {
|
|
13263
|
-
this.context.logger.
|
|
13294
|
+
this.context.logger.warn("Filter surface budget exceeded; mask/filter/blend effects are dropped for this subtree");
|
|
13264
13295
|
return false;
|
|
13265
13296
|
}
|
|
13297
|
+
const surfaceWindow = isIdentityMatrix(ancestorMatrix) || !hasMask ? bounds : inverseTransformBoundsToAabb(ancestorMatrix, bounds) ?? bounds;
|
|
13266
13298
|
const options = {
|
|
13267
13299
|
...this.options,
|
|
13268
13300
|
canvas: void 0,
|
|
13269
13301
|
backgroundColor: null,
|
|
13270
|
-
x:
|
|
13271
|
-
y:
|
|
13272
|
-
width:
|
|
13273
|
-
height:
|
|
13302
|
+
x: surfaceWindow.left,
|
|
13303
|
+
y: surfaceWindow.top,
|
|
13304
|
+
width: surfaceWindow.width,
|
|
13305
|
+
height: surfaceWindow.height
|
|
13274
13306
|
};
|
|
13275
13307
|
let source;
|
|
13276
13308
|
let filtered;
|
|
@@ -13281,15 +13313,15 @@ var CanvasRenderer = class CanvasRenderer {
|
|
|
13281
13313
|
if (filter) filtered = await renderFilterSurface(source.canvas, filter, container.styles.opacity, options.scale, signal, {
|
|
13282
13314
|
references: container.filterReferences,
|
|
13283
13315
|
origin: {
|
|
13284
|
-
x: container.bounds.left -
|
|
13285
|
-
y: container.bounds.top -
|
|
13316
|
+
x: container.bounds.left - surfaceWindow.left,
|
|
13317
|
+
y: container.bounds.top - surfaceWindow.top
|
|
13286
13318
|
}
|
|
13287
13319
|
});
|
|
13288
13320
|
const composited = filtered ?? source.canvas;
|
|
13289
|
-
if (hasMask) await this.applyMask(composited, stack.element.container.styles, bounds);
|
|
13321
|
+
if (hasMask) await this.applyMask(composited, stack.element.container.styles, surfaceWindow, container.bounds, ownTransforms);
|
|
13290
13322
|
if (signal?.aborted) throw new DOMException("The operation was aborted.", "AbortError");
|
|
13291
13323
|
const own = stack.element.effects;
|
|
13292
|
-
const effects = stack.element.getEffects(4, this.surfaceRoot).filter((effect) => !own.includes(effect) || !isFilterEffect(effect) && !isOpacityEffect(effect) && !isBlendEffect(effect) && !isClipEffect(effect));
|
|
13324
|
+
const effects = stack.element.getEffects(4, this.surfaceRoot).filter((effect) => !own.includes(effect) || !isFilterEffect(effect) && !isOpacityEffect(effect) && !isBlendEffect(effect) && !isClipEffect(effect) && !isTransformEffect(effect));
|
|
13293
13325
|
this.effectsRenderer.applyEffects(effects);
|
|
13294
13326
|
if (hasBlend) {
|
|
13295
13327
|
this.ctx.save();
|
|
@@ -13313,8 +13345,15 @@ var CanvasRenderer = class CanvasRenderer {
|
|
|
13313
13345
|
* Composite an alpha mask onto a finished element surface: all mask
|
|
13314
13346
|
* layers are painted additively into a mask surface, then kept pixels are
|
|
13315
13347
|
* selected with destination-in.
|
|
13348
|
+
*
|
|
13349
|
+
* Coordinate spaces: the source surface paints in LAYOUT space (the
|
|
13350
|
+
* ancestor TransformEffects stay active on the main canvas and transform
|
|
13351
|
+
* the draw-back), so the mask must be painted in layout space too —
|
|
13352
|
+
* anchored to the element's border box (containerBounds) — riding ONLY
|
|
13353
|
+
* the element's own transform effects, which apply inside the surface
|
|
13354
|
+
* rather than at draw-back.
|
|
13316
13355
|
*/
|
|
13317
|
-
async applyMask(surface, styles,
|
|
13356
|
+
async applyMask(surface, styles, surfaceWindow, containerBounds, ownTransforms) {
|
|
13318
13357
|
const ctx = surface.getContext("2d");
|
|
13319
13358
|
if (!ctx) return;
|
|
13320
13359
|
const maskCanvas = this.context.resourceDocument.createElement("canvas");
|
|
@@ -13326,14 +13365,21 @@ var CanvasRenderer = class CanvasRenderer {
|
|
|
13326
13365
|
return;
|
|
13327
13366
|
}
|
|
13328
13367
|
maskCtx.scale(this.options.scale, this.options.scale);
|
|
13329
|
-
maskCtx.translate(-
|
|
13368
|
+
maskCtx.translate(-surfaceWindow.left, -surfaceWindow.top);
|
|
13369
|
+
for (let i = ownTransforms.length - 1; i >= 0; i--) {
|
|
13370
|
+
const effect = at(ownTransforms, i);
|
|
13371
|
+
maskCtx.translate(effect.offsetX, effect.offsetY);
|
|
13372
|
+
maskCtx.transform(...effect.matrix);
|
|
13373
|
+
maskCtx.translate(-effect.offsetX, -effect.offsetY);
|
|
13374
|
+
}
|
|
13375
|
+
const layoutArea = {
|
|
13376
|
+
left: containerBounds.left,
|
|
13377
|
+
top: containerBounds.top,
|
|
13378
|
+
width: containerBounds.width,
|
|
13379
|
+
height: containerBounds.height
|
|
13380
|
+
};
|
|
13330
13381
|
try {
|
|
13331
|
-
await paintMaskLayers(maskCtx, styles.maskImage, styles,
|
|
13332
|
-
left: bounds.left,
|
|
13333
|
-
top: bounds.top,
|
|
13334
|
-
width: bounds.width,
|
|
13335
|
-
height: bounds.height
|
|
13336
|
-
}, async (url) => await this.context.cache.match(url));
|
|
13382
|
+
await paintMaskLayers(maskCtx, styles.maskImage, styles, layoutArea, async (url) => await this.context.cache.match(url));
|
|
13337
13383
|
} catch (error) {
|
|
13338
13384
|
this.context.logger.error(`Error rendering mask-image: ${error instanceof Error ? error.message : error}`);
|
|
13339
13385
|
releaseSurface(maskCanvas);
|
|
@@ -13477,7 +13523,7 @@ var CanvasRenderer = class CanvasRenderer {
|
|
|
13477
13523
|
y: this.options.y,
|
|
13478
13524
|
width: this.options.width,
|
|
13479
13525
|
height: this.options.height
|
|
13480
|
-
}, (ctx, opts) => new CanvasRenderer(ctx, opts), container, curves, styles, (c, cv, img) => this.renderReplacedElement(c, cv, img));
|
|
13526
|
+
}, (ctx, opts) => new CanvasRenderer(ctx, opts, void 0, this.surfaceBudget), container, curves, styles, (c, cv, img) => this.renderReplacedElement(c, cv, img));
|
|
13481
13527
|
renderFormElements(this.ctx, this.textRenderer, this.path.bind(this), container, styles);
|
|
13482
13528
|
await renderListMarker(this.ctx, this.context, this.textRenderer, paint, container, styles);
|
|
13483
13529
|
}
|
|
@@ -13873,8 +13919,7 @@ const calculateBackgroundCurvedPaintingArea = (clip, curves) => {
|
|
|
13873
13919
|
const hasTextBackgroundClip = (styles) => {
|
|
13874
13920
|
return styles.backgroundClip.some((clip) => clip === 3);
|
|
13875
13921
|
};
|
|
13876
|
-
|
|
13877
|
-
//#region src/render/canvas/foreignobject-renderer.ts
|
|
13922
|
+
// src/render/canvas/foreignobject-renderer.ts
|
|
13878
13923
|
var ForeignObjectRenderer = class {
|
|
13879
13924
|
canvas;
|
|
13880
13925
|
ctx;
|
|
@@ -13939,8 +13984,7 @@ const stripRootOffsets = (element) => {
|
|
|
13939
13984
|
for (const [property, value] of previous) style[property] = value;
|
|
13940
13985
|
};
|
|
13941
13986
|
};
|
|
13942
|
-
|
|
13943
|
-
//#region src/core/logger.ts
|
|
13987
|
+
// src/core/logger.ts
|
|
13944
13988
|
var Logger = class {
|
|
13945
13989
|
id;
|
|
13946
13990
|
enabled;
|
|
@@ -13977,8 +14021,7 @@ var Logger = class {
|
|
|
13977
14021
|
}
|
|
13978
14022
|
}
|
|
13979
14023
|
};
|
|
13980
|
-
|
|
13981
|
-
//#region src/core/cache-storage.ts
|
|
14024
|
+
// src/core/cache-storage.ts
|
|
13982
14025
|
var Cache = class {
|
|
13983
14026
|
context;
|
|
13984
14027
|
_options;
|
|
@@ -14223,8 +14266,7 @@ const isInlineImage = (src) => INLINE_IMG.test(src);
|
|
|
14223
14266
|
const isInlineBase64Image = (src) => INLINE_BASE64.test(src);
|
|
14224
14267
|
const isBlobImage = (src) => src.substring(0, 4) === "blob";
|
|
14225
14268
|
const isSVG = (src) => src.slice(-3).toLowerCase() === "svg" || INLINE_SVG.test(src);
|
|
14226
|
-
|
|
14227
|
-
//#region src/core/origin-checker.ts
|
|
14269
|
+
// src/core/origin-checker.ts
|
|
14228
14270
|
/**
|
|
14229
14271
|
* Origin Checker
|
|
14230
14272
|
*
|
|
@@ -14276,8 +14318,7 @@ var OriginChecker = class {
|
|
|
14276
14318
|
return this.origin;
|
|
14277
14319
|
}
|
|
14278
14320
|
};
|
|
14279
|
-
|
|
14280
|
-
//#region src/core/context.ts
|
|
14321
|
+
// src/core/context.ts
|
|
14281
14322
|
var Context = class Context {
|
|
14282
14323
|
static instanceCount = 1;
|
|
14283
14324
|
instanceName = `#${Context.instanceCount++}`;
|
|
@@ -14324,8 +14365,7 @@ var Context = class Context {
|
|
|
14324
14365
|
this._windowBounds = this._windowBounds.add(left, top, 0, 0);
|
|
14325
14366
|
}
|
|
14326
14367
|
};
|
|
14327
|
-
|
|
14328
|
-
//#region src/core/config-assembler.ts
|
|
14368
|
+
// src/core/config-assembler.ts
|
|
14329
14369
|
/**
|
|
14330
14370
|
* Coerce known numeric options from string (or other) values to actual numbers.
|
|
14331
14371
|
* Mutates the opts object in place — this is intentionally a normalisation
|
|
@@ -14402,8 +14442,7 @@ const assembleRenderOptions = (opts, backgroundColor, left, top, width, height,
|
|
|
14402
14442
|
imageSmoothing: opts.imageSmoothing,
|
|
14403
14443
|
imageSmoothingQuality: opts.imageSmoothingQuality
|
|
14404
14444
|
});
|
|
14405
|
-
|
|
14406
|
-
//#region src/core/background-parser.ts
|
|
14445
|
+
// src/core/background-parser.ts
|
|
14407
14446
|
/**
|
|
14408
14447
|
* Resolve the background colour for the rendered canvas, following CSS
|
|
14409
14448
|
* background propagation rules:
|
|
@@ -14424,8 +14463,7 @@ const parseBackgroundColor = (context, element, backgroundColorOverride) => {
|
|
|
14424
14463
|
const defaultBackgroundColor = typeof backgroundColorOverride === "string" ? parseColor(context, backgroundColorOverride) : backgroundColorOverride === null ? 0 : 4294967295;
|
|
14425
14464
|
return element === ownerDocument.documentElement ? isTransparent(documentBackgroundColor) ? isTransparent(bodyBackgroundColor) ? defaultBackgroundColor : bodyBackgroundColor : documentBackgroundColor : defaultBackgroundColor;
|
|
14426
14465
|
};
|
|
14427
|
-
|
|
14428
|
-
//#region src/core/render-element.ts
|
|
14466
|
+
// src/core/render-element.ts
|
|
14429
14467
|
const emitProgress = (onProgress, context, phase, progress) => {
|
|
14430
14468
|
if (!onProgress) return;
|
|
14431
14469
|
try {
|
|
@@ -14454,7 +14492,7 @@ const renderElement = async (element, opts, config) => {
|
|
|
14454
14492
|
const windowBounds = new Bounds(windowOptions.scrollX, windowOptions.scrollY, windowOptions.windowWidth, windowOptions.windowHeight);
|
|
14455
14493
|
const context = new Context(contextOptions, windowBounds, config);
|
|
14456
14494
|
const performanceMonitoring = opts.enablePerformanceMonitoring ?? opts.logging ?? false;
|
|
14457
|
-
const perfMonitor = new PerformanceMonitor(context, performanceMonitoring);
|
|
14495
|
+
const perfMonitor = new PerformanceMonitor(context.logger, performanceMonitoring);
|
|
14458
14496
|
perfMonitor.start("total", {
|
|
14459
14497
|
width: windowOptions.windowWidth,
|
|
14460
14498
|
height: windowOptions.windowHeight
|
|
@@ -14523,8 +14561,7 @@ const renderElement = async (element, opts, config) => {
|
|
|
14523
14561
|
emitProgress(opts.onProgress, context, "render", 100);
|
|
14524
14562
|
return canvas;
|
|
14525
14563
|
};
|
|
14526
|
-
|
|
14527
|
-
//#region src/index.ts
|
|
14564
|
+
// src/index.ts
|
|
14528
14565
|
/**
|
|
14529
14566
|
* Renders an HTML element to a `<canvas>` element.
|
|
14530
14567
|
*
|
|
@@ -14560,7 +14597,6 @@ const html2canvas = (element, options = {}, config) => {
|
|
|
14560
14597
|
});
|
|
14561
14598
|
return renderElement(element, options, finalConfig);
|
|
14562
14599
|
};
|
|
14563
|
-
//#endregion
|
|
14564
14600
|
export { Html2CanvasConfig, PerformanceMonitor, Validator, createDefaultValidator, html2canvas as default, html2canvas };
|
|
14565
14601
|
|
|
14566
14602
|
//# sourceMappingURL=html2canvas-pro.esm.js.map
|