qrcode-svg-ts
Advanced tools
Comparing version 1.0.7 to 1.1.0
105
index.d.ts
@@ -1,59 +0,56 @@ | ||
declare namespace QRCodeSVG { | ||
type SaveCallBack = (error:any, result:any) => void | ||
declare type QRCodeSVGSaveCallBack = (error:any, result:any) => void | ||
interface Options { | ||
/** | ||
* 二维码内容 | ||
*/ | ||
content: string | ||
/** | ||
* 二维码边距默认为0 | ||
*/ | ||
padding?: number | ||
/** | ||
* 二维码颜色 默认黑色 | ||
*/ | ||
color?: string | ||
/** | ||
* 二维码背景色 默认白色 | ||
*/ | ||
background?: string | ||
/** | ||
* 容错级别 默认 H | ||
*/ | ||
ecl?: 'L'|'M'|'H'|'Q' | ||
/** | ||
* 将模块(正方形)连接成一个形状,加入 SVGpath元素,推荐用于 Web 和响应式使用,默认值:false | ||
*/ | ||
join?: boolean | ||
/** | ||
* 创建一个正方形作为图案,然后填充画布,默认值:false,请参见下面的输出示例 | ||
*/ | ||
predefined?: boolean | ||
/** | ||
* 应用缩进和新行,默认:true | ||
*/ | ||
pretty?: boolean | ||
/** | ||
* 交换 X 和 Y 模块,仅当您对某些 QR 阅读器有问题时,默认:false | ||
*/ | ||
swap?: boolean | ||
/** | ||
* 在 SVG 文档之前添加 XML 声明,即<?xml version="1.0" standalone="yes"?>,默认值:true | ||
*/ | ||
xmlDeclaration?: boolean | ||
/** | ||
* 包装元素,默认:svg, | ||
* - svgwidth: 使用和属性填充 SVG 文档中的正方形height,建议在二维码为静态(精确大小)的情况下转换为光栅图像或 PDF | ||
* - svg-viewbox: 使用属性填充 SVG 文档中的viewBox正方形,推荐用于响应式网页 | ||
* - g: 在元素中放置正方形g,当您需要在单个 SVG 文档中放置多个 QR 码时很有用 | ||
* - none: 没有包装 | ||
*/ | ||
container?: 'svg' | 'svg-viewbox' | 'g' | 'none' | ||
} | ||
declare interface QRCodeSVGOptions { | ||
/** | ||
* 二维码内容 | ||
*/ | ||
content: string | ||
/** | ||
* 二维码边距默认为0 | ||
*/ | ||
padding?: number | ||
/** | ||
* 二维码颜色 默认黑色 | ||
*/ | ||
color?: string | ||
/** | ||
* 二维码背景色 默认白色 | ||
*/ | ||
background?: string | ||
/** | ||
* 容错级别 默认 H | ||
*/ | ||
ecl?: 'L'|'M'|'H'|'Q' | ||
/** | ||
* 将模块(正方形)连接成一个形状,加入 SVGpath元素,推荐用于 Web 和响应式使用,默认值:true | ||
*/ | ||
join?: boolean | ||
/** | ||
* 创建一个正方形作为图案,然后填充画布,默认值:false,请参见下面的输出示例 | ||
*/ | ||
predefined?: boolean | ||
/** | ||
* 应用缩进和新行,默认:true | ||
*/ | ||
pretty?: boolean | ||
/** | ||
* 交换 X 和 Y 模块,仅当您对某些 QR 阅读器有问题时,默认:false | ||
*/ | ||
swap?: boolean | ||
/** | ||
* 在 SVG 文档之前添加 XML 声明,即<?xml version="1.0" standalone="yes"?>,默认值:true | ||
*/ | ||
xmlDeclaration?: boolean | ||
/** | ||
* 包装元素,默认:svg, | ||
* - svgwidth: 使用和属性填充 SVG 文档中的正方形height,建议在二维码为静态(精确大小)的情况下转换为光栅图像或 PDF | ||
* - svg-viewbox: 使用属性填充 SVG 文档中的viewBox正方形,推荐用于响应式网页 | ||
* - g: 在元素中放置正方形g,当您需要在单个 SVG 文档中放置多个 QR 码时很有用 | ||
* - none: 没有包装 | ||
*/ | ||
container?: 'svg' | 'svg-viewbox' | 'g' | 'none' | ||
} | ||
} | ||
declare const QRCodeSVG: { | ||
@@ -60,0 +57,0 @@ new(options: QRCodeSVG.Options); |
@@ -751,3 +751,4 @@ /** | ||
background: "#ffffff", | ||
ecl: "H" | ||
ecl: "H", | ||
join: true | ||
}; | ||
@@ -754,0 +755,0 @@ |
{ | ||
"name": "qrcode-svg-ts", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"description": "A simple QR Code generator in pure JavaScript", | ||
@@ -10,3 +10,5 @@ "author": "SHLYREN", | ||
"scripts": { | ||
"test": "node demo.js" | ||
"minify": "node minify.js", | ||
"test": "node demo.js", | ||
"example": "open ./examples/index.html" | ||
}, | ||
@@ -29,4 +31,4 @@ "bin": { | ||
"devDependencies": { | ||
"minify": "^4.1.3" | ||
} | ||
} |
@@ -52,3 +52,3 @@ ## Introduction | ||
* **ecl** - error correction level: `L`, `M`, `H`, `Q`. default: `H` | ||
* **join** - join modules (squares) into one shape, into the SVG `path` element, **recommended** for web and responsive use, default: `false` | ||
* **join** - join modules (squares) into one shape, into the SVG `path` element, **recommended** for web and responsive use, default: `true` | ||
* **predefined** - to create a squares as pattern, then populate the canvas, default: `false`, see the output examples below | ||
@@ -184,3 +184,3 @@ * **pretty** - apply indents and new lines, default: `true` | ||
```javascript | ||
var QRCode = require('qrcode-svg'); | ||
var QRCode = require('qrcode-svg-ts'); | ||
var svg = new QRCode('hello').svg(); | ||
@@ -198,3 +198,3 @@ ... | ||
```javascript | ||
var QRCode = require('qrcode-svg'); | ||
var QRCode = require('qrcode-svg-ts'); | ||
@@ -256,5 +256,5 @@ var hello = new QRCode("Hello World!"); | ||
<div id="container"></div> | ||
<script src="dist/qrcode.min.js"></script> | ||
<script src="./dist/index.min.js"></script> | ||
<script> | ||
var qrcode = new QRCode({ | ||
var qrcode = new QRCodeSVG({ | ||
content: "Hello World!", | ||
@@ -261,0 +261,0 @@ container: "svg-viewbox", //Responsive use |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
67031
9
1058
1
1
3