first commit
This commit is contained in:
commit
eb2f504652
32490 changed files with 5731109 additions and 0 deletions
10
node_modules/html2canvas/dist/lib/core/__mocks__/cache-storage.js
generated
vendored
Normal file
10
node_modules/html2canvas/dist/lib/core/__mocks__/cache-storage.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CacheStorage = void 0;
|
||||
var CacheStorage = /** @class */ (function () {
|
||||
function CacheStorage() {
|
||||
}
|
||||
return CacheStorage;
|
||||
}());
|
||||
exports.CacheStorage = CacheStorage;
|
||||
//# sourceMappingURL=cache-storage.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/__mocks__/cache-storage.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/__mocks__/cache-storage.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"cache-storage.js","sourceRoot":"","sources":["../../../../src/core/__mocks__/cache-storage.ts"],"names":[],"mappings":";;;AAAA;IAAA;IAA2B,CAAC;IAAD,mBAAC;AAAD,CAAC,AAA5B,IAA4B;AAAf,oCAAY"}
|
||||
22
node_modules/html2canvas/dist/lib/core/__mocks__/context.js
generated
vendored
Normal file
22
node_modules/html2canvas/dist/lib/core/__mocks__/context.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Context = void 0;
|
||||
var logger_1 = require("./logger");
|
||||
var Context = /** @class */ (function () {
|
||||
function Context() {
|
||||
var _this = this;
|
||||
this.logger = logger_1.logger;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
this._cache = {};
|
||||
this.cache = {
|
||||
addImage: jest.fn().mockImplementation(function (src) {
|
||||
var result = Promise.resolve();
|
||||
_this._cache[src] = result;
|
||||
return result;
|
||||
})
|
||||
};
|
||||
}
|
||||
return Context;
|
||||
}());
|
||||
exports.Context = Context;
|
||||
//# sourceMappingURL=context.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/__mocks__/context.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/__mocks__/context.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/core/__mocks__/context.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAExC;IAOI;QAAA,iBAQC;QAdQ,WAAM,GAAW,eAAM,CAAC;QACjC,8DAA8D;QACrD,WAAM,GAAkC,EAAE,CAAC;QAKhD,IAAI,CAAC,KAAK,GAAG;YACT,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAC,GAAW;gBAC/C,IAAM,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;gBACjC,KAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;gBAC1B,OAAO,MAAM,CAAC;YAClB,CAAC,CAAC;SACL,CAAC;IACN,CAAC;IACL,cAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,0BAAO"}
|
||||
12
node_modules/html2canvas/dist/lib/core/__mocks__/features.js
generated
vendored
Normal file
12
node_modules/html2canvas/dist/lib/core/__mocks__/features.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FEATURES = void 0;
|
||||
exports.FEATURES = {
|
||||
SUPPORT_RANGE_BOUNDS: true,
|
||||
SUPPORT_SVG_DRAWING: true,
|
||||
SUPPORT_FOREIGNOBJECT_DRAWING: true,
|
||||
SUPPORT_CORS_IMAGES: true,
|
||||
SUPPORT_RESPONSE_TYPE: true,
|
||||
SUPPORT_CORS_XHR: true
|
||||
};
|
||||
//# sourceMappingURL=features.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/__mocks__/features.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/__mocks__/features.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../../../src/core/__mocks__/features.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACpB,oBAAoB,EAAE,IAAI;IAC1B,mBAAmB,EAAE,IAAI;IACzB,6BAA6B,EAAE,IAAI;IACnC,mBAAmB,EAAE,IAAI;IACzB,qBAAqB,EAAE,IAAI;IAC3B,gBAAgB,EAAE,IAAI;CACzB,CAAC"}
|
||||
24
node_modules/html2canvas/dist/lib/core/__mocks__/logger.js
generated
vendored
Normal file
24
node_modules/html2canvas/dist/lib/core/__mocks__/logger.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.logger = exports.Logger = void 0;
|
||||
var Logger = /** @class */ (function () {
|
||||
function Logger() {
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
Logger.prototype.debug = function () { };
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
Logger.create = function () { };
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
Logger.destroy = function () { };
|
||||
Logger.getInstance = function () {
|
||||
return exports.logger;
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
Logger.prototype.info = function () { };
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
Logger.prototype.error = function () { };
|
||||
return Logger;
|
||||
}());
|
||||
exports.Logger = Logger;
|
||||
exports.logger = new Logger();
|
||||
//# sourceMappingURL=logger.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/__mocks__/logger.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/__mocks__/logger.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../src/core/__mocks__/logger.ts"],"names":[],"mappings":";;;AAAA;IAAA;IAmBA,CAAC;IAlBG,gEAAgE;IAChE,sBAAK,GAAL,cAAe,CAAC;IAEhB,gEAAgE;IACzD,aAAM,GAAb,cAAuB,CAAC;IAExB,gEAAgE;IACzD,cAAO,GAAd,cAAwB,CAAC;IAElB,kBAAW,GAAlB;QACI,OAAO,cAAM,CAAC;IAClB,CAAC;IAED,gEAAgE;IAChE,qBAAI,GAAJ,cAAc,CAAC;IAEf,gEAAgE;IAChE,sBAAK,GAAL,cAAe,CAAC;IACpB,aAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBY,wBAAM;AAqBN,QAAA,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC"}
|
||||
420
node_modules/html2canvas/dist/lib/core/__tests__/cache-storage.js
generated
vendored
Normal file
420
node_modules/html2canvas/dist/lib/core/__tests__/cache-storage.js
generated
vendored
Normal file
|
|
@ -0,0 +1,420 @@
|
|||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
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 });
|
||||
var assert_1 = require("assert");
|
||||
var features_1 = require("../features");
|
||||
var cache_storage_1 = require("../cache-storage");
|
||||
var context_1 = require("../context");
|
||||
var bounds_1 = require("../../css/layout/bounds");
|
||||
var proxy = 'http://example.com/proxy';
|
||||
var createMockContext = function (origin, opts) {
|
||||
if (opts === void 0) { opts = {}; }
|
||||
var context = {
|
||||
location: {
|
||||
href: origin
|
||||
},
|
||||
document: {
|
||||
createElement: function (_name) {
|
||||
var _href = '';
|
||||
return {
|
||||
set href(value) {
|
||||
_href = value;
|
||||
},
|
||||
get href() {
|
||||
return _href;
|
||||
},
|
||||
get protocol() {
|
||||
return new URL(_href).protocol;
|
||||
},
|
||||
get hostname() {
|
||||
return new URL(_href).hostname;
|
||||
},
|
||||
get port() {
|
||||
return new URL(_href).port;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
cache_storage_1.CacheStorage.setContext(context);
|
||||
return new context_1.Context(__assign({ logging: false, imageTimeout: 0, useCORS: false, allowTaint: false, proxy: proxy }, opts), new bounds_1.Bounds(0, 0, 0, 0));
|
||||
};
|
||||
var images = [];
|
||||
var xhr = [];
|
||||
var sleep = function (timeout) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, timeout); })];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
}); }); };
|
||||
var ImageMock = /** @class */ (function () {
|
||||
function ImageMock() {
|
||||
images.push(this);
|
||||
}
|
||||
return ImageMock;
|
||||
}());
|
||||
var XMLHttpRequestMock = /** @class */ (function () {
|
||||
function XMLHttpRequestMock() {
|
||||
this.sent = false;
|
||||
this.status = 500;
|
||||
this.timeout = 5000;
|
||||
xhr.push(this);
|
||||
}
|
||||
XMLHttpRequestMock.prototype.load = function (status, response) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
this.response = response;
|
||||
this.status = status;
|
||||
if (this.onload) {
|
||||
this.onload();
|
||||
}
|
||||
return [4 /*yield*/, sleep(0)];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
XMLHttpRequestMock.prototype.open = function (method, url) {
|
||||
this.method = method;
|
||||
this.url = url;
|
||||
};
|
||||
XMLHttpRequestMock.prototype.send = function () {
|
||||
this.sent = true;
|
||||
};
|
||||
return XMLHttpRequestMock;
|
||||
}());
|
||||
Object.defineProperty(global, 'Image', { value: ImageMock, writable: true });
|
||||
Object.defineProperty(global, 'XMLHttpRequest', {
|
||||
value: XMLHttpRequestMock,
|
||||
writable: true
|
||||
});
|
||||
var setFeatures = function (opts) {
|
||||
if (opts === void 0) { opts = {}; }
|
||||
var defaults = {
|
||||
SUPPORT_SVG_DRAWING: true,
|
||||
SUPPORT_CORS_IMAGES: true,
|
||||
SUPPORT_CORS_XHR: true,
|
||||
SUPPORT_RESPONSE_TYPE: false
|
||||
};
|
||||
Object.keys(defaults).forEach(function (key) {
|
||||
Object.defineProperty(features_1.FEATURES, key, {
|
||||
value: typeof opts[key] === 'boolean' ? opts[key] : defaults[key],
|
||||
writable: true
|
||||
});
|
||||
});
|
||||
};
|
||||
describe('cache-storage', function () {
|
||||
beforeEach(function () { return setFeatures(); });
|
||||
afterEach(function () {
|
||||
xhr.splice(0, xhr.length);
|
||||
images.splice(0, images.length);
|
||||
});
|
||||
it('addImage adds images to cache', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
cache = createMockContext('http://example.com', { proxy: null }).cache;
|
||||
return [4 /*yield*/, cache.addImage('http://example.com/test.jpg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [4 /*yield*/, cache.addImage('http://example.com/test2.jpg')];
|
||||
case 2:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(images.length, 2);
|
||||
assert_1.deepStrictEqual(images[0].src, 'http://example.com/test.jpg');
|
||||
assert_1.deepStrictEqual(images[1].src, 'http://example.com/test2.jpg');
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
it('addImage should not add duplicate entries', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
cache = createMockContext('http://example.com').cache;
|
||||
return [4 /*yield*/, cache.addImage('http://example.com/test.jpg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [4 /*yield*/, cache.addImage('http://example.com/test.jpg')];
|
||||
case 2:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(images.length, 1);
|
||||
assert_1.deepStrictEqual(images[0].src, 'http://example.com/test.jpg');
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
describe('svg', function () {
|
||||
it('should add svg images correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
cache = createMockContext('http://example.com').cache;
|
||||
return [4 /*yield*/, cache.addImage('http://example.com/test.svg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [4 /*yield*/, cache.addImage('http://example.com/test2.svg')];
|
||||
case 2:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(images.length, 2);
|
||||
assert_1.deepStrictEqual(images[0].src, 'http://example.com/test.svg');
|
||||
assert_1.deepStrictEqual(images[1].src, 'http://example.com/test2.svg');
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
it('should omit svg images if not supported', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
setFeatures({ SUPPORT_SVG_DRAWING: false });
|
||||
cache = createMockContext('http://example.com').cache;
|
||||
return [4 /*yield*/, cache.addImage('http://example.com/test.svg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [4 /*yield*/, cache.addImage('http://example.com/test2.svg')];
|
||||
case 2:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(images.length, 0);
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
});
|
||||
describe('cross-origin', function () {
|
||||
it('addImage should not add images it cannot load/render', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
cache = createMockContext('http://example.com', {
|
||||
proxy: undefined
|
||||
}).cache;
|
||||
return [4 /*yield*/, cache.addImage('http://html2canvas.hertzen.com/test.jpg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(images.length, 0);
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
it('addImage should add images if tainting enabled', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
cache = createMockContext('http://example.com', {
|
||||
allowTaint: true,
|
||||
proxy: undefined
|
||||
}).cache;
|
||||
return [4 /*yield*/, cache.addImage('http://html2canvas.hertzen.com/test.jpg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(images.length, 1);
|
||||
assert_1.deepStrictEqual(images[0].src, 'http://html2canvas.hertzen.com/test.jpg');
|
||||
assert_1.deepStrictEqual(images[0].crossOrigin, undefined);
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
it('addImage should add images if cors enabled', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
cache = createMockContext('http://example.com', { useCORS: true }).cache;
|
||||
return [4 /*yield*/, cache.addImage('http://html2canvas.hertzen.com/test.jpg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(images.length, 1);
|
||||
assert_1.deepStrictEqual(images[0].src, 'http://html2canvas.hertzen.com/test.jpg');
|
||||
assert_1.deepStrictEqual(images[0].crossOrigin, 'anonymous');
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
it('addImage should not add images if cors enabled but not supported', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
setFeatures({ SUPPORT_CORS_IMAGES: false });
|
||||
cache = createMockContext('http://example.com', {
|
||||
useCORS: true,
|
||||
proxy: undefined
|
||||
}).cache;
|
||||
return [4 /*yield*/, cache.addImage('http://html2canvas.hertzen.com/test.jpg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(images.length, 0);
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
it('addImage should not add images to proxy if cors enabled', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
cache = createMockContext('http://example.com', { useCORS: true }).cache;
|
||||
return [4 /*yield*/, cache.addImage('http://html2canvas.hertzen.com/test.jpg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(images.length, 1);
|
||||
assert_1.deepStrictEqual(images[0].src, 'http://html2canvas.hertzen.com/test.jpg');
|
||||
assert_1.deepStrictEqual(images[0].crossOrigin, 'anonymous');
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
it('addImage should use proxy ', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
cache = createMockContext('http://example.com').cache;
|
||||
return [4 /*yield*/, cache.addImage('http://html2canvas.hertzen.com/test.jpg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(xhr.length, 1);
|
||||
assert_1.deepStrictEqual(xhr[0].url, proxy + "?url=" + encodeURIComponent('http://html2canvas.hertzen.com/test.jpg') + "&responseType=text");
|
||||
return [4 /*yield*/, xhr[0].load(200, '<data response>')];
|
||||
case 2:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(images.length, 1);
|
||||
assert_1.deepStrictEqual(images[0].src, '<data response>');
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
it('proxy should respect imageTimeout', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache, e_1;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
cache = createMockContext('http://example.com', {
|
||||
imageTimeout: 10
|
||||
}).cache;
|
||||
return [4 /*yield*/, cache.addImage('http://html2canvas.hertzen.com/test.jpg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
assert_1.deepStrictEqual(xhr.length, 1);
|
||||
assert_1.deepStrictEqual(xhr[0].url, proxy + "?url=" + encodeURIComponent('http://html2canvas.hertzen.com/test.jpg') + "&responseType=text");
|
||||
assert_1.deepStrictEqual(xhr[0].timeout, 10);
|
||||
if (xhr[0].ontimeout) {
|
||||
xhr[0].ontimeout();
|
||||
}
|
||||
_a.label = 2;
|
||||
case 2:
|
||||
_a.trys.push([2, 4, , 5]);
|
||||
return [4 /*yield*/, cache.match('http://html2canvas.hertzen.com/test.jpg')];
|
||||
case 3:
|
||||
_a.sent();
|
||||
assert_1.fail('Expected result to timeout');
|
||||
return [3 /*break*/, 5];
|
||||
case 4:
|
||||
e_1 = _a.sent();
|
||||
return [3 /*break*/, 5];
|
||||
case 5: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
});
|
||||
it('match should return cache entry', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache, response;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
cache = createMockContext('http://example.com').cache;
|
||||
return [4 /*yield*/, cache.addImage('http://example.com/test.jpg')];
|
||||
case 1:
|
||||
_a.sent();
|
||||
if (images[0].onload) {
|
||||
images[0].onload();
|
||||
}
|
||||
return [4 /*yield*/, cache.match('http://example.com/test.jpg')];
|
||||
case 2:
|
||||
response = _a.sent();
|
||||
assert_1.deepStrictEqual(response.src, 'http://example.com/test.jpg');
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
it('image should respect imageTimeout', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cache, e_2;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
cache = createMockContext('http://example.com', { imageTimeout: 10 }).cache;
|
||||
cache.addImage('http://example.com/test.jpg');
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
_a.trys.push([1, 3, , 4]);
|
||||
return [4 /*yield*/, cache.match('http://example.com/test.jpg')];
|
||||
case 2:
|
||||
_a.sent();
|
||||
assert_1.fail('Expected result to timeout');
|
||||
return [3 /*break*/, 4];
|
||||
case 3:
|
||||
e_2 = _a.sent();
|
||||
return [3 /*break*/, 4];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
});
|
||||
//# sourceMappingURL=cache-storage.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/__tests__/cache-storage.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/__tests__/cache-storage.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
28
node_modules/html2canvas/dist/lib/core/__tests__/logger.js
generated
vendored
Normal file
28
node_modules/html2canvas/dist/lib/core/__tests__/logger.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var logger_1 = require("../logger");
|
||||
describe('logger', function () {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
var infoSpy;
|
||||
beforeEach(function () {
|
||||
infoSpy = jest.spyOn(console, 'info').mockImplementation(function () {
|
||||
// do nothing
|
||||
});
|
||||
});
|
||||
afterEach(function () {
|
||||
infoSpy.mockRestore();
|
||||
});
|
||||
it('should call console.info when logger enabled', function () {
|
||||
var id = Math.random().toString();
|
||||
var logger = new logger_1.Logger({ id: id, enabled: true });
|
||||
logger.info('testing');
|
||||
expect(infoSpy).toHaveBeenLastCalledWith(id, expect.stringMatching(/\d+ms/), 'testing');
|
||||
});
|
||||
it("shouldn't call console.info when logger disabled", function () {
|
||||
var id = Math.random().toString();
|
||||
var logger = new logger_1.Logger({ id: id, enabled: false });
|
||||
logger.info('testing');
|
||||
expect(infoSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=logger.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/__tests__/logger.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/__tests__/logger.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../src/core/__tests__/logger.ts"],"names":[],"mappings":";;AAAA,oCAAiC;AAEjC,QAAQ,CAAC,QAAQ,EAAE;IACf,8DAA8D;IAC9D,IAAI,OAAY,CAAC;IAEjB,UAAU,CAAC;QACP,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC;YACrD,aAAa;QACjB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC;QACN,OAAO,CAAC,WAAW,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE;QAC/C,IAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;QACpC,IAAM,MAAM,GAAG,IAAI,eAAM,CAAC,EAAC,EAAE,IAAA,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QAC/C,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvB,MAAM,CAAC,OAAO,CAAC,CAAC,wBAAwB,CAAC,EAAE,EAAE,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC;IAC5F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE;QACnD,IAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;QACpC,IAAM,MAAM,GAAG,IAAI,eAAM,CAAC,EAAC,EAAE,IAAA,EAAE,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC;QAChD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvB,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
||||
6
node_modules/html2canvas/dist/lib/core/bitwise.js
generated
vendored
Normal file
6
node_modules/html2canvas/dist/lib/core/bitwise.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.contains = void 0;
|
||||
var contains = function (bit, value) { return (bit & value) !== 0; };
|
||||
exports.contains = contains;
|
||||
//# sourceMappingURL=bitwise.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/bitwise.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/bitwise.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"bitwise.js","sourceRoot":"","sources":["../../../src/core/bitwise.ts"],"names":[],"mappings":";;;AAAO,IAAM,QAAQ,GAAG,UAAC,GAAW,EAAE,KAAa,IAAc,OAAA,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,EAAnB,CAAmB,CAAC;AAAxE,QAAA,QAAQ,YAAgE"}
|
||||
198
node_modules/html2canvas/dist/lib/core/cache-storage.js
generated
vendored
Normal file
198
node_modules/html2canvas/dist/lib/core/cache-storage.js
generated
vendored
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
"use strict";
|
||||
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.Cache = exports.CacheStorage = void 0;
|
||||
var features_1 = require("./features");
|
||||
var CacheStorage = /** @class */ (function () {
|
||||
function CacheStorage() {
|
||||
}
|
||||
CacheStorage.getOrigin = function (url) {
|
||||
var link = CacheStorage._link;
|
||||
if (!link) {
|
||||
return 'about:blank';
|
||||
}
|
||||
link.href = url;
|
||||
link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/
|
||||
return link.protocol + link.hostname + link.port;
|
||||
};
|
||||
CacheStorage.isSameOrigin = function (src) {
|
||||
return CacheStorage.getOrigin(src) === CacheStorage._origin;
|
||||
};
|
||||
CacheStorage.setContext = function (window) {
|
||||
CacheStorage._link = window.document.createElement('a');
|
||||
CacheStorage._origin = CacheStorage.getOrigin(window.location.href);
|
||||
};
|
||||
CacheStorage._origin = 'about:blank';
|
||||
return CacheStorage;
|
||||
}());
|
||||
exports.CacheStorage = CacheStorage;
|
||||
var Cache = /** @class */ (function () {
|
||||
function Cache(context, _options) {
|
||||
this.context = context;
|
||||
this._options = _options;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
this._cache = {};
|
||||
}
|
||||
Cache.prototype.addImage = function (src) {
|
||||
var result = Promise.resolve();
|
||||
if (this.has(src)) {
|
||||
return result;
|
||||
}
|
||||
if (isBlobImage(src) || isRenderable(src)) {
|
||||
(this._cache[src] = this.loadImage(src)).catch(function () {
|
||||
// prevent unhandled rejection
|
||||
});
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
Cache.prototype.match = function (src) {
|
||||
return this._cache[src];
|
||||
};
|
||||
Cache.prototype.loadImage = function (key) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var isSameOrigin, useCORS, useProxy, src;
|
||||
var _this = this;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
isSameOrigin = CacheStorage.isSameOrigin(key);
|
||||
useCORS = !isInlineImage(key) && this._options.useCORS === true && features_1.FEATURES.SUPPORT_CORS_IMAGES && !isSameOrigin;
|
||||
useProxy = !isInlineImage(key) &&
|
||||
!isSameOrigin &&
|
||||
!isBlobImage(key) &&
|
||||
typeof this._options.proxy === 'string' &&
|
||||
features_1.FEATURES.SUPPORT_CORS_XHR &&
|
||||
!useCORS;
|
||||
if (!isSameOrigin &&
|
||||
this._options.allowTaint === false &&
|
||||
!isInlineImage(key) &&
|
||||
!isBlobImage(key) &&
|
||||
!useProxy &&
|
||||
!useCORS) {
|
||||
return [2 /*return*/];
|
||||
}
|
||||
src = key;
|
||||
if (!useProxy) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, this.proxy(src)];
|
||||
case 1:
|
||||
src = _a.sent();
|
||||
_a.label = 2;
|
||||
case 2:
|
||||
this.context.logger.debug("Added image " + key.substring(0, 256));
|
||||
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
||||
var img = new Image();
|
||||
img.onload = function () { return resolve(img); };
|
||||
img.onerror = reject;
|
||||
//ios safari 10.3 taints canvas with data urls unless crossOrigin is set to anonymous
|
||||
if (isInlineBase64Image(src) || useCORS) {
|
||||
img.crossOrigin = 'anonymous';
|
||||
}
|
||||
img.src = src;
|
||||
if (img.complete === true) {
|
||||
// Inline XML images may fail to parse, throwing an Error later on
|
||||
setTimeout(function () { return resolve(img); }, 500);
|
||||
}
|
||||
if (_this._options.imageTimeout > 0) {
|
||||
setTimeout(function () { return reject("Timed out (" + _this._options.imageTimeout + "ms) loading image"); }, _this._options.imageTimeout);
|
||||
}
|
||||
})];
|
||||
case 3: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
Cache.prototype.has = function (key) {
|
||||
return typeof this._cache[key] !== 'undefined';
|
||||
};
|
||||
Cache.prototype.keys = function () {
|
||||
return Promise.resolve(Object.keys(this._cache));
|
||||
};
|
||||
Cache.prototype.proxy = function (src) {
|
||||
var _this = this;
|
||||
var proxy = this._options.proxy;
|
||||
if (!proxy) {
|
||||
throw new Error('No proxy defined');
|
||||
}
|
||||
var key = src.substring(0, 256);
|
||||
return new Promise(function (resolve, reject) {
|
||||
var responseType = features_1.FEATURES.SUPPORT_RESPONSE_TYPE ? 'blob' : 'text';
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
if (responseType === 'text') {
|
||||
resolve(xhr.response);
|
||||
}
|
||||
else {
|
||||
var reader_1 = new FileReader();
|
||||
reader_1.addEventListener('load', function () { return resolve(reader_1.result); }, false);
|
||||
reader_1.addEventListener('error', function (e) { return reject(e); }, false);
|
||||
reader_1.readAsDataURL(xhr.response);
|
||||
}
|
||||
}
|
||||
else {
|
||||
reject("Failed to proxy resource " + key + " with status code " + xhr.status);
|
||||
}
|
||||
};
|
||||
xhr.onerror = reject;
|
||||
var queryString = proxy.indexOf('?') > -1 ? '&' : '?';
|
||||
xhr.open('GET', "" + proxy + queryString + "url=" + encodeURIComponent(src) + "&responseType=" + responseType);
|
||||
if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
|
||||
xhr.responseType = responseType;
|
||||
}
|
||||
if (_this._options.imageTimeout) {
|
||||
var timeout_1 = _this._options.imageTimeout;
|
||||
xhr.timeout = timeout_1;
|
||||
xhr.ontimeout = function () { return reject("Timed out (" + timeout_1 + "ms) proxying " + key); };
|
||||
}
|
||||
xhr.send();
|
||||
});
|
||||
};
|
||||
return Cache;
|
||||
}());
|
||||
exports.Cache = Cache;
|
||||
var INLINE_SVG = /^data:image\/svg\+xml/i;
|
||||
var INLINE_BASE64 = /^data:image\/.*;base64,/i;
|
||||
var INLINE_IMG = /^data:image\/.*/i;
|
||||
var isRenderable = function (src) { return features_1.FEATURES.SUPPORT_SVG_DRAWING || !isSVG(src); };
|
||||
var isInlineImage = function (src) { return INLINE_IMG.test(src); };
|
||||
var isInlineBase64Image = function (src) { return INLINE_BASE64.test(src); };
|
||||
var isBlobImage = function (src) { return src.substr(0, 4) === 'blob'; };
|
||||
var isSVG = function (src) { return src.substr(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src); };
|
||||
//# sourceMappingURL=cache-storage.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/cache-storage.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/cache-storage.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
18
node_modules/html2canvas/dist/lib/core/context.js
generated
vendored
Normal file
18
node_modules/html2canvas/dist/lib/core/context.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Context = void 0;
|
||||
var logger_1 = require("./logger");
|
||||
var cache_storage_1 = require("./cache-storage");
|
||||
var Context = /** @class */ (function () {
|
||||
function Context(options, windowBounds) {
|
||||
var _a;
|
||||
this.windowBounds = windowBounds;
|
||||
this.instanceName = "#" + Context.instanceCount++;
|
||||
this.logger = new logger_1.Logger({ id: this.instanceName, enabled: options.logging });
|
||||
this.cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new cache_storage_1.Cache(this, options);
|
||||
}
|
||||
Context.instanceCount = 1;
|
||||
return Context;
|
||||
}());
|
||||
exports.Context = Context;
|
||||
//# sourceMappingURL=context.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/context.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/context.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/core/context.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,iDAAuD;AAQvD;IAOI,iBAAY,OAAuB,EAAS,YAAoB;;QAApB,iBAAY,GAAZ,YAAY,CAAQ;QAN/C,iBAAY,GAAG,MAAI,OAAO,CAAC,aAAa,EAAI,CAAC;QAO1D,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,EAAC,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,KAAK,GAAG,MAAA,OAAO,CAAC,KAAK,mCAAI,IAAI,qBAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IALc,qBAAa,GAAG,CAAC,CAAC;IAMrC,cAAC;CAAA,AAXD,IAWC;AAXY,0BAAO"}
|
||||
25
node_modules/html2canvas/dist/lib/core/debugger.js
generated
vendored
Normal file
25
node_modules/html2canvas/dist/lib/core/debugger.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isDebugging = void 0;
|
||||
var elementDebuggerAttribute = 'data-html2canvas-debug';
|
||||
var getElementDebugType = function (element) {
|
||||
var attribute = element.getAttribute(elementDebuggerAttribute);
|
||||
switch (attribute) {
|
||||
case 'all':
|
||||
return 1 /* ALL */;
|
||||
case 'clone':
|
||||
return 2 /* CLONE */;
|
||||
case 'parse':
|
||||
return 3 /* PARSE */;
|
||||
case 'render':
|
||||
return 4 /* RENDER */;
|
||||
default:
|
||||
return 0 /* NONE */;
|
||||
}
|
||||
};
|
||||
var isDebugging = function (element, type) {
|
||||
var elementType = getElementDebugType(element);
|
||||
return elementType === 1 /* ALL */ || type === elementType;
|
||||
};
|
||||
exports.isDebugging = isDebugging;
|
||||
//# sourceMappingURL=debugger.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/debugger.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/debugger.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"debugger.js","sourceRoot":"","sources":["../../../src/core/debugger.ts"],"names":[],"mappings":";;;AAAA,IAAM,wBAAwB,GAAG,wBAAwB,CAAC;AAS1D,IAAM,mBAAmB,GAAG,UAAC,OAAgB;IACzC,IAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,wBAAwB,CAAC,CAAC;IACjE,QAAQ,SAAS,EAAE;QACf,KAAK,KAAK;YACN,mBAAwB;QAC5B,KAAK,OAAO;YACR,qBAA0B;QAC9B,KAAK,OAAO;YACR,qBAA0B;QAC9B,KAAK,QAAQ;YACT,sBAA2B;QAC/B;YACI,oBAAyB;KAChC;AACL,CAAC,CAAC;AAEK,IAAM,WAAW,GAAG,UAAC,OAAgB,EAAE,IAA2C;IACrF,IAAM,WAAW,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,WAAW,gBAAqB,IAAI,IAAI,KAAK,WAAW,CAAC;AACpE,CAAC,CAAC;AAHW,QAAA,WAAW,eAGtB"}
|
||||
193
node_modules/html2canvas/dist/lib/core/features.js
generated
vendored
Normal file
193
node_modules/html2canvas/dist/lib/core/features.js
generated
vendored
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FEATURES = exports.loadSerializedSVG = exports.createForeignObjectSVG = void 0;
|
||||
var css_line_break_1 = require("css-line-break");
|
||||
var testRangeBounds = function (document) {
|
||||
var TEST_HEIGHT = 123;
|
||||
if (document.createRange) {
|
||||
var range = document.createRange();
|
||||
if (range.getBoundingClientRect) {
|
||||
var testElement = document.createElement('boundtest');
|
||||
testElement.style.height = TEST_HEIGHT + "px";
|
||||
testElement.style.display = 'block';
|
||||
document.body.appendChild(testElement);
|
||||
range.selectNode(testElement);
|
||||
var rangeBounds = range.getBoundingClientRect();
|
||||
var rangeHeight = Math.round(rangeBounds.height);
|
||||
document.body.removeChild(testElement);
|
||||
if (rangeHeight === TEST_HEIGHT) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var testIOSLineBreak = function (document) {
|
||||
var testElement = document.createElement('boundtest');
|
||||
testElement.style.width = '50px';
|
||||
testElement.style.display = 'block';
|
||||
testElement.style.fontSize = '12px';
|
||||
testElement.style.letterSpacing = '0px';
|
||||
testElement.style.wordSpacing = '0px';
|
||||
document.body.appendChild(testElement);
|
||||
var range = document.createRange();
|
||||
testElement.innerHTML = typeof ''.repeat === 'function' ? '👨'.repeat(10) : '';
|
||||
var node = testElement.firstChild;
|
||||
var textList = css_line_break_1.toCodePoints(node.data).map(function (i) { return css_line_break_1.fromCodePoint(i); });
|
||||
var offset = 0;
|
||||
var prev = {};
|
||||
// ios 13 does not handle range getBoundingClientRect line changes correctly #2177
|
||||
var supports = textList.every(function (text, i) {
|
||||
range.setStart(node, offset);
|
||||
range.setEnd(node, offset + text.length);
|
||||
var rect = range.getBoundingClientRect();
|
||||
offset += text.length;
|
||||
var boundAhead = rect.x > prev.x || rect.y > prev.y;
|
||||
prev = rect;
|
||||
if (i === 0) {
|
||||
return true;
|
||||
}
|
||||
return boundAhead;
|
||||
});
|
||||
document.body.removeChild(testElement);
|
||||
return supports;
|
||||
};
|
||||
var testCORS = function () { return typeof new Image().crossOrigin !== 'undefined'; };
|
||||
var testResponseType = function () { return typeof new XMLHttpRequest().responseType === 'string'; };
|
||||
var testSVG = function (document) {
|
||||
var img = new Image();
|
||||
var canvas = document.createElement('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
if (!ctx) {
|
||||
return false;
|
||||
}
|
||||
img.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";
|
||||
try {
|
||||
ctx.drawImage(img, 0, 0);
|
||||
canvas.toDataURL();
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
var isGreenPixel = function (data) {
|
||||
return data[0] === 0 && data[1] === 255 && data[2] === 0 && data[3] === 255;
|
||||
};
|
||||
var testForeignObject = function (document) {
|
||||
var canvas = document.createElement('canvas');
|
||||
var size = 100;
|
||||
canvas.width = size;
|
||||
canvas.height = size;
|
||||
var ctx = canvas.getContext('2d');
|
||||
if (!ctx) {
|
||||
return Promise.reject(false);
|
||||
}
|
||||
ctx.fillStyle = 'rgb(0, 255, 0)';
|
||||
ctx.fillRect(0, 0, size, size);
|
||||
var img = new Image();
|
||||
var greenImageSrc = canvas.toDataURL();
|
||||
img.src = greenImageSrc;
|
||||
var svg = exports.createForeignObjectSVG(size, size, 0, 0, img);
|
||||
ctx.fillStyle = 'red';
|
||||
ctx.fillRect(0, 0, size, size);
|
||||
return exports.loadSerializedSVG(svg)
|
||||
.then(function (img) {
|
||||
ctx.drawImage(img, 0, 0);
|
||||
var data = ctx.getImageData(0, 0, size, size).data;
|
||||
ctx.fillStyle = 'red';
|
||||
ctx.fillRect(0, 0, size, size);
|
||||
var node = document.createElement('div');
|
||||
node.style.backgroundImage = "url(" + greenImageSrc + ")";
|
||||
node.style.height = size + "px";
|
||||
// Firefox 55 does not render inline <img /> tags
|
||||
return isGreenPixel(data)
|
||||
? exports.loadSerializedSVG(exports.createForeignObjectSVG(size, size, 0, 0, node))
|
||||
: Promise.reject(false);
|
||||
})
|
||||
.then(function (img) {
|
||||
ctx.drawImage(img, 0, 0);
|
||||
// Edge does not render background-images
|
||||
return isGreenPixel(ctx.getImageData(0, 0, size, size).data);
|
||||
})
|
||||
.catch(function () { return false; });
|
||||
};
|
||||
var createForeignObjectSVG = function (width, height, x, y, node) {
|
||||
var xmlns = 'http://www.w3.org/2000/svg';
|
||||
var svg = document.createElementNS(xmlns, 'svg');
|
||||
var foreignObject = document.createElementNS(xmlns, 'foreignObject');
|
||||
svg.setAttributeNS(null, 'width', width.toString());
|
||||
svg.setAttributeNS(null, 'height', height.toString());
|
||||
foreignObject.setAttributeNS(null, 'width', '100%');
|
||||
foreignObject.setAttributeNS(null, 'height', '100%');
|
||||
foreignObject.setAttributeNS(null, 'x', x.toString());
|
||||
foreignObject.setAttributeNS(null, 'y', y.toString());
|
||||
foreignObject.setAttributeNS(null, 'externalResourcesRequired', 'true');
|
||||
svg.appendChild(foreignObject);
|
||||
foreignObject.appendChild(node);
|
||||
return svg;
|
||||
};
|
||||
exports.createForeignObjectSVG = createForeignObjectSVG;
|
||||
var loadSerializedSVG = function (svg) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var img = new Image();
|
||||
img.onload = function () { return resolve(img); };
|
||||
img.onerror = reject;
|
||||
img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
|
||||
});
|
||||
};
|
||||
exports.loadSerializedSVG = loadSerializedSVG;
|
||||
exports.FEATURES = {
|
||||
get SUPPORT_RANGE_BOUNDS() {
|
||||
'use strict';
|
||||
var value = testRangeBounds(document);
|
||||
Object.defineProperty(exports.FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value });
|
||||
return value;
|
||||
},
|
||||
get SUPPORT_WORD_BREAKING() {
|
||||
'use strict';
|
||||
var value = exports.FEATURES.SUPPORT_RANGE_BOUNDS && testIOSLineBreak(document);
|
||||
Object.defineProperty(exports.FEATURES, 'SUPPORT_WORD_BREAKING', { value: value });
|
||||
return value;
|
||||
},
|
||||
get SUPPORT_SVG_DRAWING() {
|
||||
'use strict';
|
||||
var value = testSVG(document);
|
||||
Object.defineProperty(exports.FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });
|
||||
return value;
|
||||
},
|
||||
get SUPPORT_FOREIGNOBJECT_DRAWING() {
|
||||
'use strict';
|
||||
var value = typeof Array.from === 'function' && typeof window.fetch === 'function'
|
||||
? testForeignObject(document)
|
||||
: Promise.resolve(false);
|
||||
Object.defineProperty(exports.FEATURES, 'SUPPORT_FOREIGNOBJECT_DRAWING', { value: value });
|
||||
return value;
|
||||
},
|
||||
get SUPPORT_CORS_IMAGES() {
|
||||
'use strict';
|
||||
var value = testCORS();
|
||||
Object.defineProperty(exports.FEATURES, 'SUPPORT_CORS_IMAGES', { value: value });
|
||||
return value;
|
||||
},
|
||||
get SUPPORT_RESPONSE_TYPE() {
|
||||
'use strict';
|
||||
var value = testResponseType();
|
||||
Object.defineProperty(exports.FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value });
|
||||
return value;
|
||||
},
|
||||
get SUPPORT_CORS_XHR() {
|
||||
'use strict';
|
||||
var value = 'withCredentials' in new XMLHttpRequest();
|
||||
Object.defineProperty(exports.FEATURES, 'SUPPORT_CORS_XHR', { value: value });
|
||||
return value;
|
||||
},
|
||||
get SUPPORT_NATIVE_TEXT_SEGMENTATION() {
|
||||
'use strict';
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
var value = !!(typeof Intl !== 'undefined' && Intl.Segmenter);
|
||||
Object.defineProperty(exports.FEATURES, 'SUPPORT_NATIVE_TEXT_SEGMENTATION', { value: value });
|
||||
return value;
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=features.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/features.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/features.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
88
node_modules/html2canvas/dist/lib/core/logger.js
generated
vendored
Normal file
88
node_modules/html2canvas/dist/lib/core/logger.js
generated
vendored
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
"use strict";
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
||||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
||||
to[j] = from[i];
|
||||
return to;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Logger = void 0;
|
||||
var Logger = /** @class */ (function () {
|
||||
function Logger(_a) {
|
||||
var id = _a.id, enabled = _a.enabled;
|
||||
this.id = id;
|
||||
this.enabled = enabled;
|
||||
this.start = Date.now();
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
Logger.prototype.debug = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
if (this.enabled) {
|
||||
// eslint-disable-next-line no-console
|
||||
if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
||||
}
|
||||
else {
|
||||
this.info.apply(this, args);
|
||||
}
|
||||
}
|
||||
};
|
||||
Logger.prototype.getTime = function () {
|
||||
return Date.now() - this.start;
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
Logger.prototype.info = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
if (this.enabled) {
|
||||
// eslint-disable-next-line no-console
|
||||
if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
||||
}
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
Logger.prototype.warn = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
if (this.enabled) {
|
||||
// eslint-disable-next-line no-console
|
||||
if (typeof window !== 'undefined' && window.console && typeof console.warn === 'function') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
||||
}
|
||||
else {
|
||||
this.info.apply(this, args);
|
||||
}
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
Logger.prototype.error = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
if (this.enabled) {
|
||||
// eslint-disable-next-line no-console
|
||||
if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
||||
}
|
||||
else {
|
||||
this.info.apply(this, args);
|
||||
}
|
||||
}
|
||||
};
|
||||
Logger.instances = {};
|
||||
return Logger;
|
||||
}());
|
||||
exports.Logger = Logger;
|
||||
//# sourceMappingURL=logger.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/logger.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/logger.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/core/logger.ts"],"names":[],"mappings":";;;;;;;;AAKA;IAOI,gBAAY,EAA4B;YAA3B,EAAE,QAAA,EAAE,OAAO,aAAA;QACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC5B,CAAC;IAED,8DAA8D;IAC9D,sBAAK,GAAL;QAAM,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACpB,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,sCAAsC;YACtC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,EAAE;gBACxF,sCAAsC;gBACtC,OAAO,CAAC,KAAK,OAAb,OAAO,iBAAO,IAAI,CAAC,EAAE,EAAK,IAAI,CAAC,OAAO,EAAE,OAAI,GAAK,IAAI,GAAE;aAC1D;iBAAM;gBACH,IAAI,CAAC,IAAI,OAAT,IAAI,EAAS,IAAI,EAAE;aACtB;SACJ;IACL,CAAC;IAED,wBAAO,GAAP;QACI,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;IACnC,CAAC;IAED,8DAA8D;IAC9D,qBAAI,GAAJ;QAAK,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACnB,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,sCAAsC;YACtC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE;gBACvF,sCAAsC;gBACtC,OAAO,CAAC,IAAI,OAAZ,OAAO,iBAAM,IAAI,CAAC,EAAE,EAAK,IAAI,CAAC,OAAO,EAAE,OAAI,GAAK,IAAI,GAAE;aACzD;SACJ;IACL,CAAC;IAED,8DAA8D;IAC9D,qBAAI,GAAJ;QAAK,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACnB,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,sCAAsC;YACtC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE;gBACvF,sCAAsC;gBACtC,OAAO,CAAC,IAAI,OAAZ,OAAO,iBAAM,IAAI,CAAC,EAAE,EAAK,IAAI,CAAC,OAAO,EAAE,OAAI,GAAK,IAAI,GAAE;aACzD;iBAAM;gBACH,IAAI,CAAC,IAAI,OAAT,IAAI,EAAS,IAAI,EAAE;aACtB;SACJ;IACL,CAAC;IAED,8DAA8D;IAC9D,sBAAK,GAAL;QAAM,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACpB,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,sCAAsC;YACtC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,EAAE;gBACxF,sCAAsC;gBACtC,OAAO,CAAC,KAAK,OAAb,OAAO,iBAAO,IAAI,CAAC,EAAE,EAAK,IAAI,CAAC,OAAO,EAAE,OAAI,GAAK,IAAI,GAAE;aAC1D;iBAAM;gBACH,IAAI,CAAC,IAAI,OAAT,IAAI,EAAS,IAAI,EAAE;aACtB;SACJ;IACL,CAAC;IAhEM,gBAAS,GAA4B,EAAE,CAAC;IAiEnD,aAAC;CAAA,AAlED,IAkEC;AAlEY,wBAAM"}
|
||||
5
node_modules/html2canvas/dist/lib/core/util.js
generated
vendored
Normal file
5
node_modules/html2canvas/dist/lib/core/util.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SMALL_IMAGE = void 0;
|
||||
exports.SMALL_IMAGE = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
|
||||
//# sourceMappingURL=util.js.map
|
||||
1
node_modules/html2canvas/dist/lib/core/util.js.map
generated
vendored
Normal file
1
node_modules/html2canvas/dist/lib/core/util.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/core/util.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,gFAAgF,CAAC"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue