html-to-image
Advanced tools
Comparing version 0.1.3 to 1.1.0
@@ -0,3 +1,4 @@ | ||
import { Options } from './index'; | ||
export declare function parseWebFontRules(clonedNode: HTMLElement): Promise<CSSRule[]>; | ||
export declare function embedWebFonts(clonedNode: HTMLElement, options: Object): Promise<HTMLElement>; | ||
export declare function embedWebFonts(clonedNode: HTMLElement, options: Options): Promise<HTMLElement>; | ||
export declare function getCssRules(styleSheets: CSSStyleSheet[]): Promise<CSSStyleRule[]>; |
@@ -8,3 +8,9 @@ /* tslint:disable:max-line-length */ | ||
const TIMEOUT = 30000; | ||
const cache = []; | ||
export function getBlobFromURL(url, options) { | ||
const root = url.split('?')[0]; | ||
const found = cache.find((item) => item.url === root); | ||
if (found) { | ||
return found.promise; | ||
} | ||
// cache bypass so we dont have CORS issues with cached images | ||
@@ -71,4 +77,6 @@ // ref: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache | ||
}); | ||
return deferred.catch(failed); | ||
const promise = deferred.catch(failed); | ||
cache.push({ promise, url: root }); | ||
return promise; | ||
} | ||
//# sourceMappingURL=getBlobFromURL.js.map |
@@ -41,6 +41,10 @@ export declare type Options = { | ||
/** | ||
* Defalut vlaue is the actual pixel ratio of the device. | ||
* Set 1 to use as initial-scale 1 for the image | ||
* The pixel ratio of captured image. Defalut is the actual pixel ratio of | ||
* the device. Set 1 to use as initial-scale 1 for the image | ||
*/ | ||
pixelRatio?: number; | ||
/** | ||
* Option to skip the fonts download and embed. | ||
*/ | ||
skipFonts?: boolean; | ||
}; | ||
@@ -47,0 +51,0 @@ export declare function toSvg(domNode: HTMLElement, options?: Options): Promise<string>; |
@@ -0,3 +1,4 @@ | ||
import { Options } from './index'; | ||
export declare function parseWebFontRules(clonedNode: HTMLElement): Promise<CSSRule[]>; | ||
export declare function embedWebFonts(clonedNode: HTMLElement, options: Object): Promise<HTMLElement>; | ||
export declare function embedWebFonts(clonedNode: HTMLElement, options: Options): Promise<HTMLElement>; | ||
export declare function getCssRules(styleSheets: CSSStyleSheet[]): Promise<CSSStyleRule[]>; |
@@ -11,3 +11,9 @@ "use strict"; | ||
var TIMEOUT = 30000; | ||
var cache = []; | ||
function getBlobFromURL(url, options) { | ||
var root = url.split('?')[0]; | ||
var found = cache.find(function (item) { return item.url === root; }); | ||
if (found) { | ||
return found.promise; | ||
} | ||
// cache bypass so we dont have CORS issues with cached images | ||
@@ -76,5 +82,7 @@ // ref: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache | ||
}); | ||
return deferred.catch(failed); | ||
var promise = deferred.catch(failed); | ||
cache.push({ promise: promise, url: root }); | ||
return promise; | ||
} | ||
exports.getBlobFromURL = getBlobFromURL; | ||
//# sourceMappingURL=getBlobFromURL.js.map |
@@ -41,6 +41,10 @@ export declare type Options = { | ||
/** | ||
* Defalut vlaue is the actual pixel ratio of the device. | ||
* Set 1 to use as initial-scale 1 for the image | ||
* The pixel ratio of captured image. Defalut is the actual pixel ratio of | ||
* the device. Set 1 to use as initial-scale 1 for the image | ||
*/ | ||
pixelRatio?: number; | ||
/** | ||
* Option to skip the fonts download and embed. | ||
*/ | ||
skipFonts?: boolean; | ||
}; | ||
@@ -47,0 +51,0 @@ export declare function toSvg(domNode: HTMLElement, options?: Options): Promise<string>; |
{ | ||
"name": "html-to-image", | ||
"version": "0.1.3", | ||
"version": "1.1.0", | ||
"description": "Generates an image from a DOM node using HTML5 canvas and SVG.", | ||
@@ -75,35 +75,35 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@commitlint/cli": "^8.2.0", | ||
"@commitlint/config-conventional": "^8.2.0", | ||
"@fortawesome/fontawesome-free": "^5.14.0", | ||
"@rollup/plugin-commonjs": "^12.0.0", | ||
"@rollup/plugin-node-resolve": "^8.0.0", | ||
"@rollup/plugin-typescript": "^4.1.2", | ||
"@types/jasmine": "^3.5.12", | ||
"@types/jquery": "^3.5.1", | ||
"@commitlint/cli": "^11.0.0", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@fortawesome/fontawesome-free": "^5.15.1", | ||
"@rollup/plugin-commonjs": "^15.1.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@rollup/plugin-typescript": "^6.0.0", | ||
"@types/jasmine": "^3.6.0", | ||
"@types/jquery": "^3.5.3", | ||
"coveralls": "^3.1.0", | ||
"devmoji": "^2.1.9", | ||
"husky": "^4.2.5", | ||
"husky": "^4.3.0", | ||
"imagediff": "^1.0.8", | ||
"jasmine-core": "^3.6.0", | ||
"karma": "^5.1.1", | ||
"karma": "^5.2.3", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-coverage": "^2.0.3", | ||
"karma-jasmine": "^3.3.1", | ||
"karma-jasmine": "^4.0.1", | ||
"karma-spec-reporter": "^0.0.32", | ||
"karma-typescript": "^5.0.3", | ||
"lint-staged": "^10.2.2", | ||
"karma-typescript": "^5.2.0", | ||
"lint-staged": "^10.4.2", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.0.5", | ||
"pretty-quick": "^2.0.1", | ||
"prettier": "^2.1.2", | ||
"pretty-quick": "^3.1.0", | ||
"rimraf": "^3.0.0", | ||
"rollup": "^2.10.5", | ||
"rollup": "^2.32.1", | ||
"rollup-plugin-filesize": "^9.0.0", | ||
"rollup-plugin-terser": "^5.3.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"tslib": "^2.0.0", | ||
"tslint": "^5.1.0", | ||
"tslint": "^6.1.3", | ||
"tslint-config-airbnb": "^5.11.2", | ||
"tslint-config-prettier": "^1.18.0", | ||
"tslint-eslint-rules": "^5.4.0", | ||
"typescript": "^3.9.6" | ||
"typescript": "^4.0.3" | ||
}, | ||
@@ -110,0 +110,0 @@ "repository": { |
@@ -9,3 +9,2 @@ # html-to-image | ||
[![Language](https://img.shields.io/badge/language-typescript-blue.svg?style=flat-square)](https://www.typescriptlang.org) | ||
[![build](https://img.shields.io/travis/bubkoo/html-to-image.svg?style=flat-square)](https://travis-ci.org/bubkoo/html-to-image) | ||
@@ -17,2 +16,3 @@ [![coverage](https://img.shields.io/coveralls/bubkoo/html-to-image/master.svg?style=flat-square)](https://coveralls.io/github/bubkoo/html-to-image) | ||
[![NPM Downloads](http://img.shields.io/npm/dm/html-to-image.svg?style=flat-square)](https://www.npmjs.com/package/html-to-image) | ||
[![devDependencies Status](https://david-dm.org/bubkoo/html-to-image/dev-status.svg?style=flat-square)](https://david-dm.org/bubkoo/html-to-image?type=dev) | ||
@@ -19,0 +19,0 @@ ## Install |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
161878
1986
1