This commit is contained in:
魏啾
2024-04-30 18:07:59 +08:00
parent b72c4d7af1
commit 56863dd624
1369 changed files with 156460 additions and 0 deletions

187
node_modules/html2canvas/dist/lib/render/background.js generated vendored Normal file
View File

@@ -0,0 +1,187 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateBackgroundRepeatPath = exports.getBackgroundValueForIndex = exports.calculateBackgroundSize = exports.isAuto = exports.calculateBackgroundRendering = exports.calculateBackgroundPaintingArea = exports.calculateBackgroundPositioningArea = void 0;
var background_size_1 = require("../css/property-descriptors/background-size");
var vector_1 = require("./vector");
var length_percentage_1 = require("../css/types/length-percentage");
var parser_1 = require("../css/syntax/parser");
var box_sizing_1 = require("./box-sizing");
var calculateBackgroundPositioningArea = function (backgroundOrigin, element) {
if (backgroundOrigin === 0 /* BORDER_BOX */) {
return element.bounds;
}
if (backgroundOrigin === 2 /* CONTENT_BOX */) {
return box_sizing_1.contentBox(element);
}
return box_sizing_1.paddingBox(element);
};
exports.calculateBackgroundPositioningArea = calculateBackgroundPositioningArea;
var calculateBackgroundPaintingArea = function (backgroundClip, element) {
if (backgroundClip === 0 /* BORDER_BOX */) {
return element.bounds;
}
if (backgroundClip === 2 /* CONTENT_BOX */) {
return box_sizing_1.contentBox(element);
}
return box_sizing_1.paddingBox(element);
};
exports.calculateBackgroundPaintingArea = calculateBackgroundPaintingArea;
var calculateBackgroundRendering = function (container, index, intrinsicSize) {
var backgroundPositioningArea = exports.calculateBackgroundPositioningArea(exports.getBackgroundValueForIndex(container.styles.backgroundOrigin, index), container);
var backgroundPaintingArea = exports.calculateBackgroundPaintingArea(exports.getBackgroundValueForIndex(container.styles.backgroundClip, index), container);
var backgroundImageSize = exports.calculateBackgroundSize(exports.getBackgroundValueForIndex(container.styles.backgroundSize, index), intrinsicSize, backgroundPositioningArea);
var sizeWidth = backgroundImageSize[0], sizeHeight = backgroundImageSize[1];
var position = length_percentage_1.getAbsoluteValueForTuple(exports.getBackgroundValueForIndex(container.styles.backgroundPosition, index), backgroundPositioningArea.width - sizeWidth, backgroundPositioningArea.height - sizeHeight);
var path = exports.calculateBackgroundRepeatPath(exports.getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea);
var offsetX = Math.round(backgroundPositioningArea.left + position[0]);
var offsetY = Math.round(backgroundPositioningArea.top + position[1]);
return [path, offsetX, offsetY, sizeWidth, sizeHeight];
};
exports.calculateBackgroundRendering = calculateBackgroundRendering;
var isAuto = function (token) { return parser_1.isIdentToken(token) && token.value === background_size_1.BACKGROUND_SIZE.AUTO; };
exports.isAuto = isAuto;
var hasIntrinsicValue = function (value) { return typeof value === 'number'; };
var calculateBackgroundSize = function (size, _a, bounds) {
var intrinsicWidth = _a[0], intrinsicHeight = _a[1], intrinsicProportion = _a[2];
var first = size[0], second = size[1];
if (!first) {
return [0, 0];
}
if (length_percentage_1.isLengthPercentage(first) && second && length_percentage_1.isLengthPercentage(second)) {
return [length_percentage_1.getAbsoluteValue(first, bounds.width), length_percentage_1.getAbsoluteValue(second, bounds.height)];
}
var hasIntrinsicProportion = hasIntrinsicValue(intrinsicProportion);
if (parser_1.isIdentToken(first) && (first.value === background_size_1.BACKGROUND_SIZE.CONTAIN || first.value === background_size_1.BACKGROUND_SIZE.COVER)) {
if (hasIntrinsicValue(intrinsicProportion)) {
var targetRatio = bounds.width / bounds.height;
return targetRatio < intrinsicProportion !== (first.value === background_size_1.BACKGROUND_SIZE.COVER)
? [bounds.width, bounds.width / intrinsicProportion]
: [bounds.height * intrinsicProportion, bounds.height];
}
return [bounds.width, bounds.height];
}
var hasIntrinsicWidth = hasIntrinsicValue(intrinsicWidth);
var hasIntrinsicHeight = hasIntrinsicValue(intrinsicHeight);
var hasIntrinsicDimensions = hasIntrinsicWidth || hasIntrinsicHeight;
// If the background-size is auto or auto auto:
if (exports.isAuto(first) && (!second || exports.isAuto(second))) {
// If the image has both horizontal and vertical intrinsic dimensions, it's rendered at that size.
if (hasIntrinsicWidth && hasIntrinsicHeight) {
return [intrinsicWidth, intrinsicHeight];
}
// If the image has no intrinsic dimensions and has no intrinsic proportions,
// it's rendered at the size of the background positioning area.
if (!hasIntrinsicProportion && !hasIntrinsicDimensions) {
return [bounds.width, bounds.height];
}
// TODO If the image has no intrinsic dimensions but has intrinsic proportions, it's rendered as if contain had been specified instead.
// If the image has only one intrinsic dimension and has intrinsic proportions, it's rendered at the size corresponding to that one dimension.
// The other dimension is computed using the specified dimension and the intrinsic proportions.
if (hasIntrinsicDimensions && hasIntrinsicProportion) {
var width_1 = hasIntrinsicWidth
? intrinsicWidth
: intrinsicHeight * intrinsicProportion;
var height_1 = hasIntrinsicHeight
? intrinsicHeight
: intrinsicWidth / intrinsicProportion;
return [width_1, height_1];
}
// If the image has only one intrinsic dimension but has no intrinsic proportions,
// it's rendered using the specified dimension and the other dimension of the background positioning area.
var width_2 = hasIntrinsicWidth ? intrinsicWidth : bounds.width;
var height_2 = hasIntrinsicHeight ? intrinsicHeight : bounds.height;
return [width_2, height_2];
}
// If the image has intrinsic proportions, it's stretched to the specified dimension.
// The unspecified dimension is computed using the specified dimension and the intrinsic proportions.
if (hasIntrinsicProportion) {
var width_3 = 0;
var height_3 = 0;
if (length_percentage_1.isLengthPercentage(first)) {
width_3 = length_percentage_1.getAbsoluteValue(first, bounds.width);
}
else if (length_percentage_1.isLengthPercentage(second)) {
height_3 = length_percentage_1.getAbsoluteValue(second, bounds.height);
}
if (exports.isAuto(first)) {
width_3 = height_3 * intrinsicProportion;
}
else if (!second || exports.isAuto(second)) {
height_3 = width_3 / intrinsicProportion;
}
return [width_3, height_3];
}
// If the image has no intrinsic proportions, it's stretched to the specified dimension.
// The unspecified dimension is computed using the image's corresponding intrinsic dimension,
// if there is one. If there is no such intrinsic dimension,
// it becomes the corresponding dimension of the background positioning area.
var width = null;
var height = null;
if (length_percentage_1.isLengthPercentage(first)) {
width = length_percentage_1.getAbsoluteValue(first, bounds.width);
}
else if (second && length_percentage_1.isLengthPercentage(second)) {
height = length_percentage_1.getAbsoluteValue(second, bounds.height);
}
if (width !== null && (!second || exports.isAuto(second))) {
height =
hasIntrinsicWidth && hasIntrinsicHeight
? (width / intrinsicWidth) * intrinsicHeight
: bounds.height;
}
if (height !== null && exports.isAuto(first)) {
width =
hasIntrinsicWidth && hasIntrinsicHeight
? (height / intrinsicHeight) * intrinsicWidth
: bounds.width;
}
if (width !== null && height !== null) {
return [width, height];
}
throw new Error("Unable to calculate background-size for element");
};
exports.calculateBackgroundSize = calculateBackgroundSize;
var getBackgroundValueForIndex = function (values, index) {
var value = values[index];
if (typeof value === 'undefined') {
return values[0];
}
return value;
};
exports.getBackgroundValueForIndex = getBackgroundValueForIndex;
var calculateBackgroundRepeatPath = function (repeat, _a, _b, backgroundPositioningArea, backgroundPaintingArea) {
var x = _a[0], y = _a[1];
var width = _b[0], height = _b[1];
switch (repeat) {
case 2 /* REPEAT_X */:
return [
new vector_1.Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)),
new vector_1.Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)),
new vector_1.Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)),
new vector_1.Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y))
];
case 3 /* REPEAT_Y */:
return [
new vector_1.Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)),
new vector_1.Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)),
new vector_1.Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)),
new vector_1.Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top))
];
case 1 /* NO_REPEAT */:
return [
new vector_1.Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)),
new vector_1.Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)),
new vector_1.Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y + height)),
new vector_1.Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y + height))
];
default:
return [
new vector_1.Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.top)),
new vector_1.Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.top)),
new vector_1.Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top)),
new vector_1.Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top))
];
}
};
exports.calculateBackgroundRepeatPath = calculateBackgroundRepeatPath;
//# sourceMappingURL=background.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBezierCurve = exports.BezierCurve = void 0;
var vector_1 = require("./vector");
var lerp = function (a, b, t) {
return new vector_1.Vector(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
};
var BezierCurve = /** @class */ (function () {
function BezierCurve(start, startControl, endControl, end) {
this.type = 1 /* BEZIER_CURVE */;
this.start = start;
this.startControl = startControl;
this.endControl = endControl;
this.end = end;
}
BezierCurve.prototype.subdivide = function (t, firstHalf) {
var ab = lerp(this.start, this.startControl, t);
var bc = lerp(this.startControl, this.endControl, t);
var cd = lerp(this.endControl, this.end, t);
var abbc = lerp(ab, bc, t);
var bccd = lerp(bc, cd, t);
var dest = lerp(abbc, bccd, t);
return firstHalf ? new BezierCurve(this.start, ab, abbc, dest) : new BezierCurve(dest, bccd, cd, this.end);
};
BezierCurve.prototype.add = function (deltaX, deltaY) {
return new BezierCurve(this.start.add(deltaX, deltaY), this.startControl.add(deltaX, deltaY), this.endControl.add(deltaX, deltaY), this.end.add(deltaX, deltaY));
};
BezierCurve.prototype.reverse = function () {
return new BezierCurve(this.end, this.endControl, this.startControl, this.start);
};
return BezierCurve;
}());
exports.BezierCurve = BezierCurve;
var isBezierCurve = function (path) { return path.type === 1 /* BEZIER_CURVE */; };
exports.isBezierCurve = isBezierCurve;
//# sourceMappingURL=bezier-curve.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bezier-curve.js","sourceRoot":"","sources":["../../../src/render/bezier-curve.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAGhC,IAAM,IAAI,GAAG,UAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IACzC,OAAO,IAAI,eAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF;IAOI,qBAAY,KAAa,EAAE,YAAoB,EAAE,UAAkB,EAAE,GAAW;QAC5E,IAAI,CAAC,IAAI,uBAAwB,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAED,+BAAS,GAAT,UAAU,CAAS,EAAE,SAAkB;QACnC,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;QAClD,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACvD,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC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canvas/dist/lib/render/border.js generated vendored Normal file
View File

@@ -0,0 +1,105 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parsePathForBorderStroke = exports.parsePathForBorderDoubleInner = exports.parsePathForBorderDoubleOuter = exports.parsePathForBorder = void 0;
var bezier_curve_1 = require("./bezier-curve");
var parsePathForBorder = function (curves, borderSide) {
switch (borderSide) {
case 0:
return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftPaddingBox, curves.topRightBorderBox, curves.topRightPaddingBox);
case 1:
return createPathFromCurves(curves.topRightBorderBox, curves.topRightPaddingBox, curves.bottomRightBorderBox, curves.bottomRightPaddingBox);
case 2:
return createPathFromCurves(curves.bottomRightBorderBox, curves.bottomRightPaddingBox, curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox);
case 3:
default:
return createPathFromCurves(curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox, curves.topLeftBorderBox, curves.topLeftPaddingBox);
}
};
exports.parsePathForBorder = parsePathForBorder;
var parsePathForBorderDoubleOuter = function (curves, borderSide) {
switch (borderSide) {
case 0:
return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftBorderDoubleOuterBox, curves.topRightBorderBox, curves.topRightBorderDoubleOuterBox);
case 1:
return createPathFromCurves(curves.topRightBorderBox, curves.topRightBorderDoubleOuterBox, curves.bottomRightBorderBox, curves.bottomRightBorderDoubleOuterBox);
case 2:
return createPathFromCurves(curves.bottomRightBorderBox, curves.bottomRightBorderDoubleOuterBox, curves.bottomLeftBorderBox, curves.bottomLeftBorderDoubleOuterBox);
case 3:
default:
return createPathFromCurves(curves.bottomLeftBorderBox, curves.bottomLeftBorderDoubleOuterBox, curves.topLeftBorderBox, curves.topLeftBorderDoubleOuterBox);
}
};
exports.parsePathForBorderDoubleOuter = parsePathForBorderDoubleOuter;
var parsePathForBorderDoubleInner = function (curves, borderSide) {
switch (borderSide) {
case 0:
return createPathFromCurves(curves.topLeftBorderDoubleInnerBox, curves.topLeftPaddingBox, curves.topRightBorderDoubleInnerBox, curves.topRightPaddingBox);
case 1:
return createPathFromCurves(curves.topRightBorderDoubleInnerBox, curves.topRightPaddingBox, curves.bottomRightBorderDoubleInnerBox, curves.bottomRightPaddingBox);
case 2:
return createPathFromCurves(curves.bottomRightBorderDoubleInnerBox, curves.bottomRightPaddingBox, curves.bottomLeftBorderDoubleInnerBox, curves.bottomLeftPaddingBox);
case 3:
default:
return createPathFromCurves(curves.bottomLeftBorderDoubleInnerBox, curves.bottomLeftPaddingBox, curves.topLeftBorderDoubleInnerBox, curves.topLeftPaddingBox);
}
};
exports.parsePathForBorderDoubleInner = parsePathForBorderDoubleInner;
var parsePathForBorderStroke = function (curves, borderSide) {
switch (borderSide) {
case 0:
return createStrokePathFromCurves(curves.topLeftBorderStroke, curves.topRightBorderStroke);
case 1:
return createStrokePathFromCurves(curves.topRightBorderStroke, curves.bottomRightBorderStroke);
case 2:
return createStrokePathFromCurves(curves.bottomRightBorderStroke, curves.bottomLeftBorderStroke);
case 3:
default:
return createStrokePathFromCurves(curves.bottomLeftBorderStroke, curves.topLeftBorderStroke);
}
};
exports.parsePathForBorderStroke = parsePathForBorderStroke;
var createStrokePathFromCurves = function (outer1, outer2) {
var path = [];
if (bezier_curve_1.isBezierCurve(outer1)) {
path.push(outer1.subdivide(0.5, false));
}
else {
path.push(outer1);
}
if (bezier_curve_1.isBezierCurve(outer2)) {
path.push(outer2.subdivide(0.5, true));
}
else {
path.push(outer2);
}
return path;
};
var createPathFromCurves = function (outer1, inner1, outer2, inner2) {
var path = [];
if (bezier_curve_1.isBezierCurve(outer1)) {
path.push(outer1.subdivide(0.5, false));
}
else {
path.push(outer1);
}
if (bezier_curve_1.isBezierCurve(outer2)) {
path.push(outer2.subdivide(0.5, true));
}
else {
path.push(outer2);
}
if (bezier_curve_1.isBezierCurve(inner2)) {
path.push(inner2.subdivide(0.5, true).reverse());
}
else {
path.push(inner2);
}
if (bezier_curve_1.isBezierCurve(inner1)) {
path.push(inner1.subdivide(0.5, false).reverse());
}
else {
path.push(inner1);
}
return path;
};
//# sourceMappingURL=border.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"border.js","sourceRoot":"","sources":["../../../src/render/border.ts"],"names":[],"mappings":";;;AAEA,+CAA6C;AAEtC,IAAM,kBAAkB,GAAG,UAAC,MAAmB,EAAE,UAAkB;IACtE,QAAQ,UAAU,EAAE;QAChB,KAAK,CAAC;YACF,OAAO,oBAAoB,CACvB,MAAM,CAAC,gBAAgB,EACvB,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,kBAAkB,CAC5B,CAAC;QACN,KAAK,CAAC;YACF,OAAO,oBAAoB,CACvB,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,kBAAkB,EACzB,MAAM,CAAC,oBAAoB,EAC3B,MAAM,CAAC,qBAAqB,CAC/B,CAAC;QACN,KAAK,CAAC;YACF,OAAO,oBAAoB,CACvB,MAAM,CAAC,oBAAoB,EAC3B,MAAM,CAAC,qBAAqB,EAC5B,MAAM,CAAC,mBAAmB,EAC1B,MAAM,CAAC,oBAAoB,CAC9B,CAAC;QACN,KAAK,CAAC,CAAC;QACP;YACI,OAAO,oBAAoB,CACvB,MAAM,CAAC,mBAAmB,EAC1B,MAAM,CAAC,oBAAoB,EAC3B,MAAM,CAAC,gBAAgB,EACvB,MAAM,CAAC,iBAAiB,CAC3B,CAAC;KACT;AACL,CAAC,CAAC;AAhCW,QAAA,kBAAkB,sBAgC7B;AAEK,IAAM,6BAA6B,GAAG,UAAC,MAAmB,EAAE,UAAkB;IACjF,QAAQ,UAAU,EAAE;QAChB,KAAK,CAAC;YACF,OAAO,oBAAoB,CACvB,MAAM,CAAC,gBAAgB,EACvB,MAAM,CAAC,2BAA2B,EAClC,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,4BAA4B,CACtC,CAAC;QACN,KAAK,CAAC;YACF,OAAO,oBAAoB,CACvB,MAAM,CAAC,iBAAiB,EACxB,MAAM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AAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;KAC3C;SAAM;QACH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACrB;IAED,IAAI,4BAAa,CAAC,MAAM,CAAC,EAAE;QACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;KAC1C;SAAM;QACH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACrB;IAED,IAAI,4BAAa,CAAC,MAAM,CAAC,EAAE;QACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KACpD;SAAM;QACH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACrB;IAED,IAAI,4BAAa,CAAC,MAAM,CAAC,EAAE;QACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KACrD;SAAM;QACH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACrB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC"}

View File

@@ -0,0 +1,190 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculatePaddingBoxPath = exports.calculateContentBoxPath = exports.calculateBorderBoxPath = exports.BoundCurves = void 0;
var length_percentage_1 = require("../css/types/length-percentage");
var vector_1 = require("./vector");
var bezier_curve_1 = require("./bezier-curve");
var BoundCurves = /** @class */ (function () {
function BoundCurves(element) {
var styles = element.styles;
var bounds = element.bounds;
var _a = length_percentage_1.getAbsoluteValueForTuple(styles.borderTopLeftRadius, bounds.width, bounds.height), tlh = _a[0], tlv = _a[1];
var _b = length_percentage_1.getAbsoluteValueForTuple(styles.borderTopRightRadius, bounds.width, bounds.height), trh = _b[0], trv = _b[1];
var _c = length_percentage_1.getAbsoluteValueForTuple(styles.borderBottomRightRadius, bounds.width, bounds.height), brh = _c[0], brv = _c[1];
var _d = length_percentage_1.getAbsoluteValueForTuple(styles.borderBottomLeftRadius, bounds.width, bounds.height), blh = _d[0], blv = _d[1];
var factors = [];
factors.push((tlh + trh) / bounds.width);
factors.push((blh + brh) / bounds.width);
factors.push((tlv + blv) / bounds.height);
factors.push((trv + brv) / bounds.height);
var maxFactor = Math.max.apply(Math, factors);
if (maxFactor > 1) {
tlh /= maxFactor;
tlv /= maxFactor;
trh /= maxFactor;
trv /= maxFactor;
brh /= maxFactor;
brv /= maxFactor;
blh /= maxFactor;
blv /= maxFactor;
}
var topWidth = bounds.width - trh;
var rightHeight = bounds.height - brv;
var bottomWidth = bounds.width - brh;
var leftHeight = bounds.height - blv;
var borderTopWidth = styles.borderTopWidth;
var borderRightWidth = styles.borderRightWidth;
var borderBottomWidth = styles.borderBottomWidth;
var borderLeftWidth = styles.borderLeftWidth;
var paddingTop = length_percentage_1.getAbsoluteValue(styles.paddingTop, element.bounds.width);
var paddingRight = length_percentage_1.getAbsoluteValue(styles.paddingRight, element.bounds.width);
var paddingBottom = length_percentage_1.getAbsoluteValue(styles.paddingBottom, element.bounds.width);
var paddingLeft = length_percentage_1.getAbsoluteValue(styles.paddingLeft, element.bounds.width);
this.topLeftBorderDoubleOuterBox =
tlh > 0 || tlv > 0
? getCurvePoints(bounds.left + borderLeftWidth / 3, bounds.top + borderTopWidth / 3, tlh - borderLeftWidth / 3, tlv - borderTopWidth / 3, CORNER.TOP_LEFT)
: new vector_1.Vector(bounds.left + borderLeftWidth / 3, bounds.top + borderTopWidth / 3);
this.topRightBorderDoubleOuterBox =
tlh > 0 || tlv > 0
? getCurvePoints(bounds.left + topWidth, bounds.top + borderTopWidth / 3, trh - borderRightWidth / 3, trv - borderTopWidth / 3, CORNER.TOP_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width - borderRightWidth / 3, bounds.top + borderTopWidth / 3);
this.bottomRightBorderDoubleOuterBox =
brh > 0 || brv > 0
? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh - borderRightWidth / 3, brv - borderBottomWidth / 3, CORNER.BOTTOM_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width - borderRightWidth / 3, bounds.top + bounds.height - borderBottomWidth / 3);
this.bottomLeftBorderDoubleOuterBox =
blh > 0 || blv > 0
? getCurvePoints(bounds.left + borderLeftWidth / 3, bounds.top + leftHeight, blh - borderLeftWidth / 3, blv - borderBottomWidth / 3, CORNER.BOTTOM_LEFT)
: new vector_1.Vector(bounds.left + borderLeftWidth / 3, bounds.top + bounds.height - borderBottomWidth / 3);
this.topLeftBorderDoubleInnerBox =
tlh > 0 || tlv > 0
? getCurvePoints(bounds.left + (borderLeftWidth * 2) / 3, bounds.top + (borderTopWidth * 2) / 3, tlh - (borderLeftWidth * 2) / 3, tlv - (borderTopWidth * 2) / 3, CORNER.TOP_LEFT)
: new vector_1.Vector(bounds.left + (borderLeftWidth * 2) / 3, bounds.top + (borderTopWidth * 2) / 3);
this.topRightBorderDoubleInnerBox =
tlh > 0 || tlv > 0
? getCurvePoints(bounds.left + topWidth, bounds.top + (borderTopWidth * 2) / 3, trh - (borderRightWidth * 2) / 3, trv - (borderTopWidth * 2) / 3, CORNER.TOP_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width - (borderRightWidth * 2) / 3, bounds.top + (borderTopWidth * 2) / 3);
this.bottomRightBorderDoubleInnerBox =
brh > 0 || brv > 0
? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh - (borderRightWidth * 2) / 3, brv - (borderBottomWidth * 2) / 3, CORNER.BOTTOM_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width - (borderRightWidth * 2) / 3, bounds.top + bounds.height - (borderBottomWidth * 2) / 3);
this.bottomLeftBorderDoubleInnerBox =
blh > 0 || blv > 0
? getCurvePoints(bounds.left + (borderLeftWidth * 2) / 3, bounds.top + leftHeight, blh - (borderLeftWidth * 2) / 3, blv - (borderBottomWidth * 2) / 3, CORNER.BOTTOM_LEFT)
: new vector_1.Vector(bounds.left + (borderLeftWidth * 2) / 3, bounds.top + bounds.height - (borderBottomWidth * 2) / 3);
this.topLeftBorderStroke =
tlh > 0 || tlv > 0
? getCurvePoints(bounds.left + borderLeftWidth / 2, bounds.top + borderTopWidth / 2, tlh - borderLeftWidth / 2, tlv - borderTopWidth / 2, CORNER.TOP_LEFT)
: new vector_1.Vector(bounds.left + borderLeftWidth / 2, bounds.top + borderTopWidth / 2);
this.topRightBorderStroke =
tlh > 0 || tlv > 0
? getCurvePoints(bounds.left + topWidth, bounds.top + borderTopWidth / 2, trh - borderRightWidth / 2, trv - borderTopWidth / 2, CORNER.TOP_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width - borderRightWidth / 2, bounds.top + borderTopWidth / 2);
this.bottomRightBorderStroke =
brh > 0 || brv > 0
? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh - borderRightWidth / 2, brv - borderBottomWidth / 2, CORNER.BOTTOM_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width - borderRightWidth / 2, bounds.top + bounds.height - borderBottomWidth / 2);
this.bottomLeftBorderStroke =
blh > 0 || blv > 0
? getCurvePoints(bounds.left + borderLeftWidth / 2, bounds.top + leftHeight, blh - borderLeftWidth / 2, blv - borderBottomWidth / 2, CORNER.BOTTOM_LEFT)
: new vector_1.Vector(bounds.left + borderLeftWidth / 2, bounds.top + bounds.height - borderBottomWidth / 2);
this.topLeftBorderBox =
tlh > 0 || tlv > 0
? getCurvePoints(bounds.left, bounds.top, tlh, tlv, CORNER.TOP_LEFT)
: new vector_1.Vector(bounds.left, bounds.top);
this.topRightBorderBox =
trh > 0 || trv > 0
? getCurvePoints(bounds.left + topWidth, bounds.top, trh, trv, CORNER.TOP_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width, bounds.top);
this.bottomRightBorderBox =
brh > 0 || brv > 0
? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh, brv, CORNER.BOTTOM_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width, bounds.top + bounds.height);
this.bottomLeftBorderBox =
blh > 0 || blv > 0
? getCurvePoints(bounds.left, bounds.top + leftHeight, blh, blv, CORNER.BOTTOM_LEFT)
: new vector_1.Vector(bounds.left, bounds.top + bounds.height);
this.topLeftPaddingBox =
tlh > 0 || tlv > 0
? getCurvePoints(bounds.left + borderLeftWidth, bounds.top + borderTopWidth, Math.max(0, tlh - borderLeftWidth), Math.max(0, tlv - borderTopWidth), CORNER.TOP_LEFT)
: new vector_1.Vector(bounds.left + borderLeftWidth, bounds.top + borderTopWidth);
this.topRightPaddingBox =
trh > 0 || trv > 0
? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width - borderRightWidth), bounds.top + borderTopWidth, topWidth > bounds.width + borderRightWidth ? 0 : Math.max(0, trh - borderRightWidth), Math.max(0, trv - borderTopWidth), CORNER.TOP_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width - borderRightWidth, bounds.top + borderTopWidth);
this.bottomRightPaddingBox =
brh > 0 || brv > 0
? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - borderLeftWidth), bounds.top + Math.min(rightHeight, bounds.height - borderBottomWidth), Math.max(0, brh - borderRightWidth), Math.max(0, brv - borderBottomWidth), CORNER.BOTTOM_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width - borderRightWidth, bounds.top + bounds.height - borderBottomWidth);
this.bottomLeftPaddingBox =
blh > 0 || blv > 0
? getCurvePoints(bounds.left + borderLeftWidth, bounds.top + Math.min(leftHeight, bounds.height - borderBottomWidth), Math.max(0, blh - borderLeftWidth), Math.max(0, blv - borderBottomWidth), CORNER.BOTTOM_LEFT)
: new vector_1.Vector(bounds.left + borderLeftWidth, bounds.top + bounds.height - borderBottomWidth);
this.topLeftContentBox =
tlh > 0 || tlv > 0
? getCurvePoints(bounds.left + borderLeftWidth + paddingLeft, bounds.top + borderTopWidth + paddingTop, Math.max(0, tlh - (borderLeftWidth + paddingLeft)), Math.max(0, tlv - (borderTopWidth + paddingTop)), CORNER.TOP_LEFT)
: new vector_1.Vector(bounds.left + borderLeftWidth + paddingLeft, bounds.top + borderTopWidth + paddingTop);
this.topRightContentBox =
trh > 0 || trv > 0
? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borderLeftWidth + paddingLeft), bounds.top + borderTopWidth + paddingTop, topWidth > bounds.width + borderLeftWidth + paddingLeft ? 0 : trh - borderLeftWidth + paddingLeft, trv - (borderTopWidth + paddingTop), CORNER.TOP_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width - (borderRightWidth + paddingRight), bounds.top + borderTopWidth + paddingTop);
this.bottomRightContentBox =
brh > 0 || brv > 0
? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - (borderLeftWidth + paddingLeft)), bounds.top + Math.min(rightHeight, bounds.height + borderTopWidth + paddingTop), Math.max(0, brh - (borderRightWidth + paddingRight)), brv - (borderBottomWidth + paddingBottom), CORNER.BOTTOM_RIGHT)
: new vector_1.Vector(bounds.left + bounds.width - (borderRightWidth + paddingRight), bounds.top + bounds.height - (borderBottomWidth + paddingBottom));
this.bottomLeftContentBox =
blh > 0 || blv > 0
? getCurvePoints(bounds.left + borderLeftWidth + paddingLeft, bounds.top + leftHeight, Math.max(0, blh - (borderLeftWidth + paddingLeft)), blv - (borderBottomWidth + paddingBottom), CORNER.BOTTOM_LEFT)
: new vector_1.Vector(bounds.left + borderLeftWidth + paddingLeft, bounds.top + bounds.height - (borderBottomWidth + paddingBottom));
}
return BoundCurves;
}());
exports.BoundCurves = BoundCurves;
var CORNER;
(function (CORNER) {
CORNER[CORNER["TOP_LEFT"] = 0] = "TOP_LEFT";
CORNER[CORNER["TOP_RIGHT"] = 1] = "TOP_RIGHT";
CORNER[CORNER["BOTTOM_RIGHT"] = 2] = "BOTTOM_RIGHT";
CORNER[CORNER["BOTTOM_LEFT"] = 3] = "BOTTOM_LEFT";
})(CORNER || (CORNER = {}));
var getCurvePoints = function (x, y, r1, r2, position) {
var kappa = 4 * ((Math.sqrt(2) - 1) / 3);
var ox = r1 * kappa; // control point offset horizontal
var oy = r2 * kappa; // control point offset vertical
var xm = x + r1; // x-middle
var ym = y + r2; // y-middle
switch (position) {
case CORNER.TOP_LEFT:
return new bezier_curve_1.BezierCurve(new vector_1.Vector(x, ym), new vector_1.Vector(x, ym - oy), new vector_1.Vector(xm - ox, y), new vector_1.Vector(xm, y));
case CORNER.TOP_RIGHT:
return new bezier_curve_1.BezierCurve(new vector_1.Vector(x, y), new vector_1.Vector(x + ox, y), new vector_1.Vector(xm, ym - oy), new vector_1.Vector(xm, ym));
case CORNER.BOTTOM_RIGHT:
return new bezier_curve_1.BezierCurve(new vector_1.Vector(xm, y), new vector_1.Vector(xm, y + oy), new vector_1.Vector(x + ox, ym), new vector_1.Vector(x, ym));
case CORNER.BOTTOM_LEFT:
default:
return new bezier_curve_1.BezierCurve(new vector_1.Vector(xm, ym), new vector_1.Vector(xm - ox, ym), new vector_1.Vector(x, y + oy), new vector_1.Vector(x, y));
}
};
var calculateBorderBoxPath = function (curves) {
return [curves.topLeftBorderBox, curves.topRightBorderBox, curves.bottomRightBorderBox, curves.bottomLeftBorderBox];
};
exports.calculateBorderBoxPath = calculateBorderBoxPath;
var calculateContentBoxPath = function (curves) {
return [
curves.topLeftContentBox,
curves.topRightContentBox,
curves.bottomRightContentBox,
curves.bottomLeftContentBox
];
};
exports.calculateContentBoxPath = calculateContentBoxPath;
var calculatePaddingBoxPath = function (curves) {
return [
curves.topLeftPaddingBox,
curves.topRightPaddingBox,
curves.bottomRightPaddingBox,
curves.bottomLeftPaddingBox
];
};
exports.calculatePaddingBoxPath = calculatePaddingBoxPath;
//# sourceMappingURL=bound-curves.js.map

File diff suppressed because one or more lines are too long

21
node_modules/html2canvas/dist/lib/render/box-sizing.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.contentBox = exports.paddingBox = void 0;
var length_percentage_1 = require("../css/types/length-percentage");
var paddingBox = function (element) {
var bounds = element.bounds;
var styles = element.styles;
return bounds.add(styles.borderLeftWidth, styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth), -(styles.borderTopWidth + styles.borderBottomWidth));
};
exports.paddingBox = paddingBox;
var contentBox = function (element) {
var styles = element.styles;
var bounds = element.bounds;
var paddingLeft = length_percentage_1.getAbsoluteValue(styles.paddingLeft, bounds.width);
var paddingRight = length_percentage_1.getAbsoluteValue(styles.paddingRight, bounds.width);
var paddingTop = length_percentage_1.getAbsoluteValue(styles.paddingTop, bounds.width);
var paddingBottom = length_percentage_1.getAbsoluteValue(styles.paddingBottom, bounds.width);
return bounds.add(paddingLeft + styles.borderLeftWidth, paddingTop + styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth + paddingLeft + paddingRight), -(styles.borderTopWidth + styles.borderBottomWidth + paddingTop + paddingBottom));
};
exports.contentBox = contentBox;
//# sourceMappingURL=box-sizing.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"box-sizing.js","sourceRoot":"","sources":["../../../src/render/box-sizing.ts"],"names":[],"mappings":";;;AAAA,oEAAgE;AAIzD,IAAM,UAAU,GAAG,UAAC,OAAyB;IAChD,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,OAAO,MAAM,CAAC,GAAG,CACb,MAAM,CAAC,eAAe,EACtB,MAAM,CAAC,cAAc,EACrB,CAAC,CAAC,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC,eAAe,CAAC,EACnD,CAAC,CAAC,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC,CACtD,CAAC;AACN,CAAC,CAAC;AATW,QAAA,UAAU,cASrB;AAEK,IAAM,UAAU,GAAG,UAAC,OAAyB;IAChD,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAE9B,IAAM,WAAW,GAAG,oCAAgB,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,IAAM,YAAY,GAAG,oCAAgB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACzE,IAAM,UAAU,GAAG,oCAAgB,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACrE,IAAM,aAAa,GAAG,oCAAgB,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAE3E,OAAO,MAAM,CAAC,GAAG,CACb,WAAW,GAAG,MAAM,CAAC,eAAe,EACpC,UAAU,GAAG,MAAM,CAAC,cAAc,EAClC,CAAC,CAAC,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC,eAAe,GAAG,WAAW,GAAG,YAAY,CAAC,EAChF,CAAC,CAAC,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,iBAAiB,GAAG,UAAU,GAAG,aAAa,CAAC,CACnF,CAAC;AACN,CAAC,CAAC;AAfW,QAAA,UAAU,cAerB"}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,108 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadSerializedSVG = exports.ForeignObjectRenderer = void 0;
var features_1 = require("../../core/features");
var color_1 = require("../../css/types/color");
var renderer_1 = require("../renderer");
var ForeignObjectRenderer = /** @class */ (function (_super) {
__extends(ForeignObjectRenderer, _super);
function ForeignObjectRenderer(context, options) {
var _this = _super.call(this, context, options) || this;
_this.canvas = options.canvas ? options.canvas : document.createElement('canvas');
_this.ctx = _this.canvas.getContext('2d');
_this.options = options;
_this.canvas.width = Math.floor(options.width * options.scale);
_this.canvas.height = Math.floor(options.height * options.scale);
_this.canvas.style.width = options.width + "px";
_this.canvas.style.height = options.height + "px";
_this.ctx.scale(_this.options.scale, _this.options.scale);
_this.ctx.translate(-options.x, -options.y);
_this.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + options.scale);
return _this;
}
ForeignObjectRenderer.prototype.render = function (element) {
return __awaiter(this, void 0, void 0, function () {
var svg, img;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
svg = features_1.createForeignObjectSVG(this.options.width * this.options.scale, this.options.height * this.options.scale, this.options.scale, this.options.scale, element);
return [4 /*yield*/, exports.loadSerializedSVG(svg)];
case 1:
img = _a.sent();
if (this.options.backgroundColor) {
this.ctx.fillStyle = color_1.asString(this.options.backgroundColor);
this.ctx.fillRect(0, 0, this.options.width * this.options.scale, this.options.height * this.options.scale);
}
this.ctx.drawImage(img, -this.options.x * this.options.scale, -this.options.y * this.options.scale);
return [2 /*return*/, this.canvas];
}
});
});
};
return ForeignObjectRenderer;
}(renderer_1.Renderer));
exports.ForeignObjectRenderer = ForeignObjectRenderer;
var loadSerializedSVG = function (svg) {
return new Promise(function (resolve, reject) {
var img = new Image();
img.onload = function () {
resolve(img);
};
img.onerror = reject;
img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
});
};
exports.loadSerializedSVG = loadSerializedSVG;
//# sourceMappingURL=foreignobject-renderer.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"fore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A1CD,CAA2C,mBAAQ,GA0ClD;AA1CY,sDAAqB;AA4C3B,IAAM,iBAAiB,GAAG,UAAC,GAAS;IACvC,OAAA,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QACxB,IAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,GAAG,CAAC,MAAM,GAAG;YACT,OAAO,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC,CAAC;QACF,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;QAErB,GAAG,CAAC,GAAG,GAAG,sCAAoC,kBAAkB,CAAC,IAAI,aAAa,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAG,CAAC;IACnH,CAAC,CAAC;AARF,CAQE,CAAC;AATM,QAAA,iBAAiB,qBASvB"}

41
node_modules/html2canvas/dist/lib/render/effects.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isOpacityEffect = exports.isClipEffect = exports.isTransformEffect = exports.OpacityEffect = exports.ClipEffect = exports.TransformEffect = void 0;
var TransformEffect = /** @class */ (function () {
function TransformEffect(offsetX, offsetY, matrix) {
this.offsetX = offsetX;
this.offsetY = offsetY;
this.matrix = matrix;
this.type = 0 /* TRANSFORM */;
this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
}
return TransformEffect;
}());
exports.TransformEffect = TransformEffect;
var ClipEffect = /** @class */ (function () {
function ClipEffect(path, target) {
this.path = path;
this.target = target;
this.type = 1 /* CLIP */;
}
return ClipEffect;
}());
exports.ClipEffect = ClipEffect;
var OpacityEffect = /** @class */ (function () {
function OpacityEffect(opacity) {
this.opacity = opacity;
this.type = 2 /* OPACITY */;
this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
}
return OpacityEffect;
}());
exports.OpacityEffect = OpacityEffect;
var isTransformEffect = function (effect) {
return effect.type === 0 /* TRANSFORM */;
};
exports.isTransformEffect = isTransformEffect;
var isClipEffect = function (effect) { return effect.type === 1 /* CLIP */; };
exports.isClipEffect = isClipEffect;
var isOpacityEffect = function (effect) { return effect.type === 2 /* OPACITY */; };
exports.isOpacityEffect = isOpacityEffect;
//# sourceMappingURL=effects.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"effects.js","sourceRoot":"","sources":["../../../src/render/effects.ts"],"names":[],"mappings":";;;AAmBA;IAII,yBAAqB,OAAe,EAAW,OAAe,EAAW,MAAc;QAAlE,YAAO,GAAP,OAAO,CAAQ;QAAW,YAAO,GAAP,OAAO,CAAQ;QAAW,WAAM,GAAN,MAAM,CAAQ;QAH9E,SAAI,qBAAoC;QACxC,WAAM,GAAW,4CAAsD,CAAC;IAES,CAAC;IAC/F,sBAAC;AAAD,CAAC,AALD,IAKC;AALY,0CAAe;AAO5B;IAGI,oBAAqB,IAAY,EAAW,MAAoB;QAA3C,SAAI,GAAJ,IAAI,CAAQ;QAAW,WAAM,GAAN,MAAM,CAAc;QAFvD,SAAI,gBAA+B;IAEuB,CAAC;IACxE,iBAAC;AAAD,CAAC,AAJD,IAIC;AAJY,gCAAU;AAMvB;IAII,uBAAqB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAH3B,SAAI,mBAAkC;QACtC,WAAM,GAAW,4CAAsD,CAAC;IAE1C,CAAC;IAC5C,oBAAC;AAAD,CAAC,AALD,IAKC;AALY,sCAAa;AAOnB,IAAM,iBAAiB,GAAG,UAAC,MAAsB;IACpD,OAAA,MAAM,CAAC,IAAI,sBAAyB;AAApC,CAAoC,CAAC;AAD5B,QAAA,iBAAiB,qBACW;AAClC,IAAM,YAAY,GAAG,UAAC,MAAsB,IAA2B,OAAA,MAAM,CAAC,IAAI,iBAAoB,EAA/B,CAA+B,CAAC;AAAjG,QAAA,YAAY,gBAAqF;AACvG,IAAM,eAAe,GAAG,UAAC,MAAsB,IAA8B,OAAA,MAAM,CAAC,IAAI,oBAAuB,EAAlC,CAAkC,CAAC;AAA1G,QAAA,eAAe,mBAA2F"}

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FontMetrics = void 0;
var util_1 = require("../core/util");
var SAMPLE_TEXT = 'Hidden Text';
var FontMetrics = /** @class */ (function () {
function FontMetrics(document) {
this._data = {};
this._document = document;
}
FontMetrics.prototype.parseMetrics = function (fontFamily, fontSize) {
var container = this._document.createElement('div');
var img = this._document.createElement('img');
var span = this._document.createElement('span');
var body = this._document.body;
container.style.visibility = 'hidden';
container.style.fontFamily = fontFamily;
container.style.fontSize = fontSize;
container.style.margin = '0';
container.style.padding = '0';
container.style.whiteSpace = 'nowrap';
body.appendChild(container);
img.src = util_1.SMALL_IMAGE;
img.width = 1;
img.height = 1;
img.style.margin = '0';
img.style.padding = '0';
img.style.verticalAlign = 'baseline';
span.style.fontFamily = fontFamily;
span.style.fontSize = fontSize;
span.style.margin = '0';
span.style.padding = '0';
span.appendChild(this._document.createTextNode(SAMPLE_TEXT));
container.appendChild(span);
container.appendChild(img);
var baseline = img.offsetTop - span.offsetTop + 2;
container.removeChild(span);
container.appendChild(this._document.createTextNode(SAMPLE_TEXT));
container.style.lineHeight = 'normal';
img.style.verticalAlign = 'super';
var middle = img.offsetTop - container.offsetTop + 2;
body.removeChild(container);
return { baseline: baseline, middle: middle };
};
FontMetrics.prototype.getMetrics = function (fontFamily, fontSize) {
var key = fontFamily + " " + fontSize;
if (typeof this._data[key] === 'undefined') {
this._data[key] = this.parseMetrics(fontFamily, fontSize);
}
return this._data[key];
};
return FontMetrics;
}());
exports.FontMetrics = FontMetrics;
//# sourceMappingURL=font-metrics.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"font-metrics.js","sourceRoot":"","sources":["../../../src/render/font-metrics.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AAMzC,IAAM,WAAW,GAAG,aAAa,CAAC;AAElC;IAII,qBAAY,QAAkB;QAC1B,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,SAA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 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transformPath = exports.equalPath = void 0;
var equalPath = function (a, b) {
if (a.length === b.length) {
return a.some(function (v, i) { return v === b[i]; });
}
return false;
};
exports.equalPath = equalPath;
var transformPath = function (path, deltaX, deltaY, deltaW, deltaH) {
return path.map(function (point, index) {
switch (index) {
case 0:
return point.add(deltaX, deltaY);
case 1:
return point.add(deltaX + deltaW, deltaY);
case 2:
return point.add(deltaX + deltaW, deltaY + deltaH);
case 3:
return point.add(deltaX, deltaY + deltaH);
}
return point;
});
};
exports.transformPath = transformPath;
//# sourceMappingURL=path.js.map

1
node_modules/html2canvas/dist/lib/render/path.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/render/path.ts"],"names":[],"mappings":";;;AAYO,IAAM,SAAS,GAAG,UAAC,CAAS,EAAE,CAAS;IAC1C,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE;QACvB,OAAO,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAV,CAAU,CAAC,CAAC;KACvC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AANW,QAAA,SAAS,aAMpB;AAEK,IAAM,aAAa,GAAG,UAAC,IAAY,EAAE,MAAc,EAAE,MAAc,EAAE,MAAc,EAAE,MAAc;IACtG,OAAO,IAAI,CAAC,GAAG,CAAC,UAAC,KAAK,EAAE,KAAK;QACzB,QAAQ,KAAK,EAAE;YACX,KAAK,CAAC;gBACF,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACrC,KAAK,CAAC;gBACF,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC;YAC9C,KAAK,CAAC;gBACF,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;YACvD,KAAK,CAAC;gBACF,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;SACjD;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAdW,QAAA,aAAa,iBAcxB"}

12
node_modules/html2canvas/dist/lib/render/renderer.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Renderer = void 0;
var Renderer = /** @class */ (function () {
function Renderer(context, options) {
this.context = context;
this.options = options;
}
return Renderer;
}());
exports.Renderer = Renderer;
//# sourceMappingURL=renderer.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/render/renderer.ts"],"names":[],"mappings":";;;AAGA;IACI,kBAA+B,OAAgB,EAAqB,OAA6B;QAAlE,YAAO,GAAP,OAAO,CAAS;QAAqB,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;IACzG,eAAC;AAAD,CAAC,AAFD,IAEC;AAFY,4BAAQ"}

View File

@@ -0,0 +1,172 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseStackingContexts = exports.ElementPaint = exports.StackingContext = void 0;
var bitwise_1 = require("../core/bitwise");
var bound_curves_1 = require("./bound-curves");
var effects_1 = require("./effects");
var path_1 = require("./path");
var ol_element_container_1 = require("../dom/elements/ol-element-container");
var li_element_container_1 = require("../dom/elements/li-element-container");
var counter_1 = require("../css/types/functions/counter");
var StackingContext = /** @class */ (function () {
function StackingContext(container) {
this.element = container;
this.inlineLevel = [];
this.nonInlineLevel = [];
this.negativeZIndex = [];
this.zeroOrAutoZIndexOrTransformedOrOpacity = [];
this.positiveZIndex = [];
this.nonPositionedFloats = [];
this.nonPositionedInlineLevel = [];
}
return StackingContext;
}());
exports.StackingContext = StackingContext;
var ElementPaint = /** @class */ (function () {
function ElementPaint(container, parent) {
this.container = container;
this.parent = parent;
this.effects = [];
this.curves = new bound_curves_1.BoundCurves(this.container);
if (this.container.styles.opacity < 1) {
this.effects.push(new effects_1.OpacityEffect(this.container.styles.opacity));
}
if (this.container.styles.transform !== null) {
var offsetX = this.container.bounds.left + this.container.styles.transformOrigin[0].number;
var offsetY = this.container.bounds.top + this.container.styles.transformOrigin[1].number;
var matrix = this.container.styles.transform;
this.effects.push(new effects_1.TransformEffect(offsetX, offsetY, matrix));
}
if (this.container.styles.overflowX !== 0 /* VISIBLE */) {
var borderBox = bound_curves_1.calculateBorderBoxPath(this.curves);
var paddingBox = bound_curves_1.calculatePaddingBoxPath(this.curves);
if (path_1.equalPath(borderBox, paddingBox)) {
this.effects.push(new effects_1.ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
}
else {
this.effects.push(new effects_1.ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */));
this.effects.push(new effects_1.ClipEffect(paddingBox, 4 /* CONTENT */));
}
}
}
ElementPaint.prototype.getEffects = function (target) {
var inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(this.container.styles.position) === -1;
var parent = this.parent;
var effects = this.effects.slice(0);
while (parent) {
var croplessEffects = parent.effects.filter(function (effect) { return !effects_1.isClipEffect(effect); });
if (inFlow || parent.container.styles.position !== 0 /* STATIC */ || !parent.parent) {
effects.unshift.apply(effects, croplessEffects);
inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(parent.container.styles.position) === -1;
if (parent.container.styles.overflowX !== 0 /* VISIBLE */) {
var borderBox = bound_curves_1.calculateBorderBoxPath(parent.curves);
var paddingBox = bound_curves_1.calculatePaddingBoxPath(parent.curves);
if (!path_1.equalPath(borderBox, paddingBox)) {
effects.unshift(new effects_1.ClipEffect(paddingBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
}
}
}
else {
effects.unshift.apply(effects, croplessEffects);
}
parent = parent.parent;
}
return effects.filter(function (effect) { return bitwise_1.contains(effect.target, target); });
};
return ElementPaint;
}());
exports.ElementPaint = ElementPaint;
var parseStackTree = function (parent, stackingContext, realStackingContext, listItems) {
parent.container.elements.forEach(function (child) {
var treatAsRealStackingContext = bitwise_1.contains(child.flags, 4 /* CREATES_REAL_STACKING_CONTEXT */);
var createsStackingContext = bitwise_1.contains(child.flags, 2 /* CREATES_STACKING_CONTEXT */);
var paintContainer = new ElementPaint(child, parent);
if (bitwise_1.contains(child.styles.display, 2048 /* LIST_ITEM */)) {
listItems.push(paintContainer);
}
var listOwnerItems = bitwise_1.contains(child.flags, 8 /* IS_LIST_OWNER */) ? [] : listItems;
if (treatAsRealStackingContext || createsStackingContext) {
var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext;
var stack = new StackingContext(paintContainer);
if (child.styles.isPositioned() || child.styles.opacity < 1 || child.styles.isTransformed()) {
var order_1 = child.styles.zIndex.order;
if (order_1 < 0) {
var index_1 = 0;
parentStack.negativeZIndex.some(function (current, i) {
if (order_1 > current.element.container.styles.zIndex.order) {
index_1 = i;
return false;
}
else if (index_1 > 0) {
return true;
}
return false;
});
parentStack.negativeZIndex.splice(index_1, 0, stack);
}
else if (order_1 > 0) {
var index_2 = 0;
parentStack.positiveZIndex.some(function (current, i) {
if (order_1 >= current.element.container.styles.zIndex.order) {
index_2 = i + 1;
return false;
}
else if (index_2 > 0) {
return true;
}
return false;
});
parentStack.positiveZIndex.splice(index_2, 0, stack);
}
else {
parentStack.zeroOrAutoZIndexOrTransformedOrOpacity.push(stack);
}
}
else {
if (child.styles.isFloating()) {
parentStack.nonPositionedFloats.push(stack);
}
else {
parentStack.nonPositionedInlineLevel.push(stack);
}
}
parseStackTree(paintContainer, stack, treatAsRealStackingContext ? stack : realStackingContext, listOwnerItems);
}
else {
if (child.styles.isInlineLevel()) {
stackingContext.inlineLevel.push(paintContainer);
}
else {
stackingContext.nonInlineLevel.push(paintContainer);
}
parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems);
}
if (bitwise_1.contains(child.flags, 8 /* IS_LIST_OWNER */)) {
processListItems(child, listOwnerItems);
}
});
};
var processListItems = function (owner, elements) {
var numbering = owner instanceof ol_element_container_1.OLElementContainer ? owner.start : 1;
var reversed = owner instanceof ol_element_container_1.OLElementContainer ? owner.reversed : false;
for (var i = 0; i < elements.length; i++) {
var item = elements[i];
if (item.container instanceof li_element_container_1.LIElementContainer &&
typeof item.container.value === 'number' &&
item.container.value !== 0) {
numbering = item.container.value;
}
item.listValue = counter_1.createCounterText(numbering, item.container.styles.listStyleType, true);
numbering += reversed ? -1 : 1;
}
};
var parseStackingContexts = function (container) {
var paintContainer = new ElementPaint(container, null);
var root = new StackingContext(paintContainer);
var listItems = [];
parseStackTree(paintContainer, root, root, listItems);
processListItems(paintContainer.container, listItems);
return root;
};
exports.parseStackingContexts = parseStackingContexts;
//# sourceMappingURL=stacking-context.js.map

File diff suppressed because one or more lines are too long

18
node_modules/html2canvas/dist/lib/render/vector.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isVector = exports.Vector = void 0;
var Vector = /** @class */ (function () {
function Vector(x, y) {
this.type = 0 /* VECTOR */;
this.x = x;
this.y = y;
}
Vector.prototype.add = function (deltaX, deltaY) {
return new Vector(this.x + deltaX, this.y + deltaY);
};
return Vector;
}());
exports.Vector = Vector;
var isVector = function (path) { return path.type === 0 /* VECTOR */; };
exports.isVector = isVector;
//# sourceMappingURL=vector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"vector.js","sourceRoot":"","sources":["../../../src/render/vector.ts"],"names":[],"mappings":";;;AAEA;IAKI,gBAAY,CAAS,EAAE,CAAS;QAC5B,IAAI,CAAC,IAAI,iBAAkB,CAAC;QAC5B,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAED,oBAAG,GAAH,UAAI,MAAc,EAAE,MAAc;QAC9B,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;IACxD,CAAC;IACL,aAAC;AAAD,CAAC,AAdD,IAcC;AAdY,wBAAM;AAgBZ,IAAM,QAAQ,GAAG,UAAC,IAAU,IAAqB,OAAA,IAAI,CAAC,IAAI,mBAAoB,EAA7B,CAA6B,CAAC;AAAzE,QAAA,QAAQ,YAAiE"}