qrcode.vue 3.9.0 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * qrcode.vue v3.9.0
2
+ * qrcode.vue v3.10.0
3
3
  * A Vue.js component to generate QRCode. Both support Vue 2 and Vue 3
4
4
  * © 2017-PRESENT @scopewu(https://github.com/scopewu)
5
5
  * MIT License.
@@ -910,11 +910,10 @@ var qrcodegen;
910
910
  var QR = qrcodegen;
911
911
 
912
912
  var _uid = 0;
913
- function getUid() {
914
- if (typeof vue.useId === 'function') {
915
- return "".concat(vue.useId(), "-").concat(_uid++);
916
- }
917
- return "vue-".concat(Math.random().toString(36).slice(2), "-").concat(_uid++);
913
+ function getUid(id) {
914
+ if (id)
915
+ return id;
916
+ return "v-".concat(_uid++);
918
917
  }
919
918
  var defaultErrorCorrectLevel = 'L';
920
919
  var DEFAULT_QR_SIZE = 100;
@@ -1074,6 +1073,14 @@ function useQRCode(props) {
1074
1073
  });
1075
1074
  return { margin: margin, numCells: numCells, cells: cells, fgPath: fgPath, imageProps: imageProps, imageBorderProps: imageBorderProps };
1076
1075
  }
1076
+ function downloadDataURLAsFile(data, filename) {
1077
+ var link = document.createElement('a');
1078
+ link.download = filename;
1079
+ link.href = data;
1080
+ document.body.appendChild(link);
1081
+ link.click();
1082
+ document.body.removeChild(link);
1083
+ }
1077
1084
  var QRCodeProps = {
1078
1085
  value: {
1079
1086
  type: String,
@@ -1099,41 +1106,39 @@ var QRCodeProps = {
1099
1106
  },
1100
1107
  margin: {
1101
1108
  type: Number,
1102
- required: false,
1103
1109
  default: DEFAULT_MARGIN,
1110
+ validator: function (m) { return m >= 0; },
1104
1111
  },
1105
1112
  imageSettings: {
1106
1113
  type: Object,
1107
- required: false,
1108
1114
  default: function () { return ({}); },
1109
1115
  },
1110
1116
  gradient: {
1111
1117
  type: Boolean,
1112
- required: false,
1113
1118
  default: false,
1114
1119
  },
1115
1120
  gradientType: {
1116
1121
  type: String,
1117
- required: false,
1118
1122
  default: 'linear',
1119
1123
  validator: function (t) { return ['linear', 'radial'].indexOf(t) > -1; },
1120
1124
  },
1121
1125
  gradientStartColor: {
1122
1126
  type: String,
1123
- required: false,
1124
1127
  default: '#000',
1125
1128
  },
1126
1129
  gradientEndColor: {
1127
1130
  type: String,
1128
- required: false,
1129
1131
  default: '#fff',
1130
1132
  },
1131
1133
  radius: {
1132
1134
  type: Number,
1133
- required: false,
1134
1135
  default: 0,
1135
1136
  validator: function (r) { return !isNaN(r) && r >= 0 && r <= 0.5; },
1136
1137
  },
1138
+ id: {
1139
+ type: String,
1140
+ required: false,
1141
+ },
1137
1142
  };
1138
1143
  var QRCodeVueProps = __assign(__assign({}, QRCodeProps), { renderAs: {
1139
1144
  type: String,
@@ -1144,9 +1149,10 @@ var QRCodeVueProps = __assign(__assign({}, QRCodeProps), { renderAs: {
1144
1149
  var QrcodeSvg = vue.defineComponent({
1145
1150
  name: 'QRCodeSvg',
1146
1151
  props: QRCodeProps,
1147
- setup: function (props) {
1152
+ setup: function (props, ctx) {
1148
1153
  var _a = useQRCode(props), numCells = _a.numCells, fgPath = _a.fgPath, imageProps = _a.imageProps, imageBorderProps = _a.imageBorderProps;
1149
- var uid = getUid();
1154
+ var svgEl = vue.ref();
1155
+ var uid = getUid(props.id);
1150
1156
  var qrGradientId = "qrcode.vue-gradient-".concat(uid);
1151
1157
  var qrLogoClipPathId = "qrcode.vue-logo-clip-path-".concat(uid);
1152
1158
  var gradientVNode = vue.computed(function () {
@@ -1194,15 +1200,32 @@ var QrcodeSvg = vue.defineComponent({
1194
1200
  }),
1195
1201
  ]);
1196
1202
  });
1203
+ var getSvgDataURL = function (svg) { return 'data:image/svg+xml;charset=utf-8,' +
1204
+ encodeURIComponent('<?xml version="1.0" standalone="no"?>' + new XMLSerializer().serializeToString(svg)); };
1205
+ ctx.expose({
1206
+ toDataURL: function () {
1207
+ var svg = svgEl.value;
1208
+ if (!svg)
1209
+ return;
1210
+ return getSvgDataURL(svg);
1211
+ },
1212
+ download: function (filename) {
1213
+ if (filename === void 0) { filename = 'qrcode.svg'; }
1214
+ var svg = svgEl.value;
1215
+ if (!svg)
1216
+ return;
1217
+ downloadDataURLAsFile(getSvgDataURL(svg), filename);
1218
+ },
1219
+ });
1197
1220
  return function () { return vue.h('svg', {
1221
+ ref: svgEl,
1198
1222
  width: props.size,
1199
1223
  height: props.size,
1200
1224
  xmlns: 'http://www.w3.org/2000/svg',
1201
1225
  viewBox: "0 0 ".concat(numCells.value, " ").concat(numCells.value),
1202
1226
  role: 'img',
1203
- 'aria-label': props.value,
1204
1227
  }, [
1205
- vue.h('defs', {}, [gradientVNode.value, clipPathVNode.value]),
1228
+ vue.h('defs', {}, [gradientVNode.value, clipPathVNode.value].filter(Boolean)),
1206
1229
  vue.h('rect', {
1207
1230
  width: '100%',
1208
1231
  height: '100%',
@@ -1221,7 +1244,7 @@ var QrcodeSvg = vue.defineComponent({
1221
1244
  rx: imageBorderProps.value.borderRadius,
1222
1245
  ry: imageBorderProps.value.borderRadius,
1223
1246
  }),
1224
- props.imageSettings.src && imageProps.value && vue.h('image', __assign(__assign({ href: props.imageSettings.src }, imageProps.value), (imageProps.value.borderRadius > 0 ? { 'clip-path': "url(#".concat(qrLogoClipPathId, ")") } : {}))),
1247
+ props.imageSettings.src && imageProps.value && vue.h('image', __assign({ href: props.imageSettings.src, crossorigin: props.imageSettings.crossOrigin, 'clip-path': imageProps.value.borderRadius > 0 ? "url(#".concat(qrLogoClipPathId, ")") : void 0 }, imageProps.value)),
1225
1248
  ]); };
1226
1249
  },
1227
1250
  });
@@ -1307,12 +1330,23 @@ var QrcodeCanvas = vue.defineComponent({
1307
1330
  }
1308
1331
  };
1309
1332
  vue.onMounted(generate);
1310
- vue.watchEffect(generate);
1333
+ vue.watchEffect(generate, { flush: 'post' });
1334
+ ctx.expose({
1335
+ toDataURL: function (type, quality) { var _a; return (_a = canvasEl.value) === null || _a === void 0 ? void 0 : _a.toDataURL(type, quality); },
1336
+ download: function (filename) {
1337
+ if (filename === void 0) { filename = 'qrcode.png'; }
1338
+ var canvas = canvasEl.value;
1339
+ if (!canvas)
1340
+ return;
1341
+ downloadDataURLAsFile(canvas.toDataURL('image/png'), filename);
1342
+ },
1343
+ });
1311
1344
  return function () { return vue.h(vue.Fragment, [
1312
- vue.h('canvas', __assign(__assign({}, ctx.attrs), { ref: canvasEl, role: 'img', 'aria-label': props.value, style: __assign(__assign({}, ctx.attrs.style), { width: "".concat(props.size, "px"), height: "".concat(props.size, "px") }) })),
1345
+ vue.h('canvas', __assign(__assign({}, ctx.attrs), { ref: canvasEl, role: 'img', style: __assign(__assign({}, ctx.attrs.style), { width: "".concat(props.size, "px"), height: "".concat(props.size, "px") }) })),
1313
1346
  props.imageSettings.src && vue.h('img', {
1314
1347
  ref: imageEl,
1315
1348
  src: props.imageSettings.src,
1349
+ crossorigin: props.imageSettings.crossOrigin,
1316
1350
  style: { display: 'none' },
1317
1351
  onLoad: generate,
1318
1352
  })
@@ -1322,8 +1356,14 @@ var QrcodeCanvas = vue.defineComponent({
1322
1356
  var QrcodeVue = vue.defineComponent({
1323
1357
  name: 'Qrcode',
1324
1358
  props: QRCodeVueProps,
1325
- setup: function (props) {
1359
+ setup: function (props, ctx) {
1360
+ var childRef = vue.ref();
1361
+ ctx.expose({
1362
+ toDataURL: function (type, quality) { var _a, _b; return (_b = (_a = childRef.value) === null || _a === void 0 ? void 0 : _a.toDataURL) === null || _b === void 0 ? void 0 : _b.call(_a, type, quality); },
1363
+ download: function (filename) { var _a, _b; return (_b = (_a = childRef.value) === null || _a === void 0 ? void 0 : _a.download) === null || _b === void 0 ? void 0 : _b.call(_a, filename); },
1364
+ });
1326
1365
  return function () { return vue.h(props.renderAs === 'svg' ? QrcodeSvg : QrcodeCanvas, {
1366
+ ref: childRef,
1327
1367
  value: props.value,
1328
1368
  size: props.size,
1329
1369
  margin: props.margin,
@@ -1336,6 +1376,7 @@ var QrcodeVue = vue.defineComponent({
1336
1376
  gradientStartColor: props.gradientStartColor,
1337
1377
  gradientEndColor: props.gradientEndColor,
1338
1378
  radius: props.radius,
1379
+ id: props.id,
1339
1380
  }); };
1340
1381
  },
1341
1382
  });
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * qrcode.vue v3.9.0
2
+ * qrcode.vue v3.10.0
3
3
  * A Vue.js component to generate QRCode. Both support Vue 2 and Vue 3
4
4
  * © 2017-PRESENT @scopewu(https://github.com/scopewu)
5
5
  * MIT License.
6
6
  */
7
- import { defineComponent, computed, h, ref, onMounted, watchEffect, Fragment, useId } from 'vue';
7
+ import { defineComponent, ref, computed, h, onMounted, watchEffect, Fragment } from 'vue';
8
8
 
9
9
  /******************************************************************************
10
10
  Copyright (c) Microsoft Corporation.
@@ -906,11 +906,10 @@ var qrcodegen;
906
906
  var QR = qrcodegen;
907
907
 
908
908
  var _uid = 0;
909
- function getUid() {
910
- if (typeof useId === 'function') {
911
- return "".concat(useId(), "-").concat(_uid++);
912
- }
913
- return "vue-".concat(Math.random().toString(36).slice(2), "-").concat(_uid++);
909
+ function getUid(id) {
910
+ if (id)
911
+ return id;
912
+ return "v-".concat(_uid++);
914
913
  }
915
914
  var defaultErrorCorrectLevel = 'L';
916
915
  var DEFAULT_QR_SIZE = 100;
@@ -1070,6 +1069,14 @@ function useQRCode(props) {
1070
1069
  });
1071
1070
  return { margin: margin, numCells: numCells, cells: cells, fgPath: fgPath, imageProps: imageProps, imageBorderProps: imageBorderProps };
1072
1071
  }
1072
+ function downloadDataURLAsFile(data, filename) {
1073
+ var link = document.createElement('a');
1074
+ link.download = filename;
1075
+ link.href = data;
1076
+ document.body.appendChild(link);
1077
+ link.click();
1078
+ document.body.removeChild(link);
1079
+ }
1073
1080
  var QRCodeProps = {
1074
1081
  value: {
1075
1082
  type: String,
@@ -1095,41 +1102,39 @@ var QRCodeProps = {
1095
1102
  },
1096
1103
  margin: {
1097
1104
  type: Number,
1098
- required: false,
1099
1105
  default: DEFAULT_MARGIN,
1106
+ validator: function (m) { return m >= 0; },
1100
1107
  },
1101
1108
  imageSettings: {
1102
1109
  type: Object,
1103
- required: false,
1104
1110
  default: function () { return ({}); },
1105
1111
  },
1106
1112
  gradient: {
1107
1113
  type: Boolean,
1108
- required: false,
1109
1114
  default: false,
1110
1115
  },
1111
1116
  gradientType: {
1112
1117
  type: String,
1113
- required: false,
1114
1118
  default: 'linear',
1115
1119
  validator: function (t) { return ['linear', 'radial'].indexOf(t) > -1; },
1116
1120
  },
1117
1121
  gradientStartColor: {
1118
1122
  type: String,
1119
- required: false,
1120
1123
  default: '#000',
1121
1124
  },
1122
1125
  gradientEndColor: {
1123
1126
  type: String,
1124
- required: false,
1125
1127
  default: '#fff',
1126
1128
  },
1127
1129
  radius: {
1128
1130
  type: Number,
1129
- required: false,
1130
1131
  default: 0,
1131
1132
  validator: function (r) { return !isNaN(r) && r >= 0 && r <= 0.5; },
1132
1133
  },
1134
+ id: {
1135
+ type: String,
1136
+ required: false,
1137
+ },
1133
1138
  };
1134
1139
  var QRCodeVueProps = __assign(__assign({}, QRCodeProps), { renderAs: {
1135
1140
  type: String,
@@ -1140,9 +1145,10 @@ var QRCodeVueProps = __assign(__assign({}, QRCodeProps), { renderAs: {
1140
1145
  var QrcodeSvg = defineComponent({
1141
1146
  name: 'QRCodeSvg',
1142
1147
  props: QRCodeProps,
1143
- setup: function (props) {
1148
+ setup: function (props, ctx) {
1144
1149
  var _a = useQRCode(props), numCells = _a.numCells, fgPath = _a.fgPath, imageProps = _a.imageProps, imageBorderProps = _a.imageBorderProps;
1145
- var uid = getUid();
1150
+ var svgEl = ref();
1151
+ var uid = getUid(props.id);
1146
1152
  var qrGradientId = "qrcode.vue-gradient-".concat(uid);
1147
1153
  var qrLogoClipPathId = "qrcode.vue-logo-clip-path-".concat(uid);
1148
1154
  var gradientVNode = computed(function () {
@@ -1190,15 +1196,32 @@ var QrcodeSvg = defineComponent({
1190
1196
  }),
1191
1197
  ]);
1192
1198
  });
1199
+ var getSvgDataURL = function (svg) { return 'data:image/svg+xml;charset=utf-8,' +
1200
+ encodeURIComponent('<?xml version="1.0" standalone="no"?>' + new XMLSerializer().serializeToString(svg)); };
1201
+ ctx.expose({
1202
+ toDataURL: function () {
1203
+ var svg = svgEl.value;
1204
+ if (!svg)
1205
+ return;
1206
+ return getSvgDataURL(svg);
1207
+ },
1208
+ download: function (filename) {
1209
+ if (filename === void 0) { filename = 'qrcode.svg'; }
1210
+ var svg = svgEl.value;
1211
+ if (!svg)
1212
+ return;
1213
+ downloadDataURLAsFile(getSvgDataURL(svg), filename);
1214
+ },
1215
+ });
1193
1216
  return function () { return h('svg', {
1217
+ ref: svgEl,
1194
1218
  width: props.size,
1195
1219
  height: props.size,
1196
1220
  xmlns: 'http://www.w3.org/2000/svg',
1197
1221
  viewBox: "0 0 ".concat(numCells.value, " ").concat(numCells.value),
1198
1222
  role: 'img',
1199
- 'aria-label': props.value,
1200
1223
  }, [
1201
- h('defs', {}, [gradientVNode.value, clipPathVNode.value]),
1224
+ h('defs', {}, [gradientVNode.value, clipPathVNode.value].filter(Boolean)),
1202
1225
  h('rect', {
1203
1226
  width: '100%',
1204
1227
  height: '100%',
@@ -1217,7 +1240,7 @@ var QrcodeSvg = defineComponent({
1217
1240
  rx: imageBorderProps.value.borderRadius,
1218
1241
  ry: imageBorderProps.value.borderRadius,
1219
1242
  }),
1220
- props.imageSettings.src && imageProps.value && h('image', __assign(__assign({ href: props.imageSettings.src }, imageProps.value), (imageProps.value.borderRadius > 0 ? { 'clip-path': "url(#".concat(qrLogoClipPathId, ")") } : {}))),
1243
+ props.imageSettings.src && imageProps.value && h('image', __assign({ href: props.imageSettings.src, crossorigin: props.imageSettings.crossOrigin, 'clip-path': imageProps.value.borderRadius > 0 ? "url(#".concat(qrLogoClipPathId, ")") : void 0 }, imageProps.value)),
1221
1244
  ]); };
1222
1245
  },
1223
1246
  });
@@ -1303,12 +1326,23 @@ var QrcodeCanvas = defineComponent({
1303
1326
  }
1304
1327
  };
1305
1328
  onMounted(generate);
1306
- watchEffect(generate);
1329
+ watchEffect(generate, { flush: 'post' });
1330
+ ctx.expose({
1331
+ toDataURL: function (type, quality) { var _a; return (_a = canvasEl.value) === null || _a === void 0 ? void 0 : _a.toDataURL(type, quality); },
1332
+ download: function (filename) {
1333
+ if (filename === void 0) { filename = 'qrcode.png'; }
1334
+ var canvas = canvasEl.value;
1335
+ if (!canvas)
1336
+ return;
1337
+ downloadDataURLAsFile(canvas.toDataURL('image/png'), filename);
1338
+ },
1339
+ });
1307
1340
  return function () { return h(Fragment, [
1308
- h('canvas', __assign(__assign({}, ctx.attrs), { ref: canvasEl, role: 'img', 'aria-label': props.value, style: __assign(__assign({}, ctx.attrs.style), { width: "".concat(props.size, "px"), height: "".concat(props.size, "px") }) })),
1341
+ h('canvas', __assign(__assign({}, ctx.attrs), { ref: canvasEl, role: 'img', style: __assign(__assign({}, ctx.attrs.style), { width: "".concat(props.size, "px"), height: "".concat(props.size, "px") }) })),
1309
1342
  props.imageSettings.src && h('img', {
1310
1343
  ref: imageEl,
1311
1344
  src: props.imageSettings.src,
1345
+ crossorigin: props.imageSettings.crossOrigin,
1312
1346
  style: { display: 'none' },
1313
1347
  onLoad: generate,
1314
1348
  })
@@ -1318,8 +1352,14 @@ var QrcodeCanvas = defineComponent({
1318
1352
  var QrcodeVue = defineComponent({
1319
1353
  name: 'Qrcode',
1320
1354
  props: QRCodeVueProps,
1321
- setup: function (props) {
1355
+ setup: function (props, ctx) {
1356
+ var childRef = ref();
1357
+ ctx.expose({
1358
+ toDataURL: function (type, quality) { var _a, _b; return (_b = (_a = childRef.value) === null || _a === void 0 ? void 0 : _a.toDataURL) === null || _b === void 0 ? void 0 : _b.call(_a, type, quality); },
1359
+ download: function (filename) { var _a, _b; return (_b = (_a = childRef.value) === null || _a === void 0 ? void 0 : _a.download) === null || _b === void 0 ? void 0 : _b.call(_a, filename); },
1360
+ });
1322
1361
  return function () { return h(props.renderAs === 'svg' ? QrcodeSvg : QrcodeCanvas, {
1362
+ ref: childRef,
1323
1363
  value: props.value,
1324
1364
  size: props.size,
1325
1365
  margin: props.margin,
@@ -1332,6 +1372,7 @@ var QrcodeVue = defineComponent({
1332
1372
  gradientStartColor: props.gradientStartColor,
1333
1373
  gradientEndColor: props.gradientEndColor,
1334
1374
  radius: props.radius,
1375
+ id: props.id,
1335
1376
  }); };
1336
1377
  },
1337
1378
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qrcode.vue",
3
- "version": "3.9.0",
3
+ "version": "3.10.0",
4
4
  "description": "A Vue.js component to generate QRCode. Both support Vue 2 and Vue 3",
5
5
  "type": "module",
6
6
  "main": "./dist/qrcode.vue.cjs.js",
@@ -8,18 +8,20 @@
8
8
  "browser": "./dist/qrcode.vue.browser.js",
9
9
  "unpkg": "./dist/qrcode.vue.browser.min.js",
10
10
  "jsdelivr": "./dist/qrcode.vue.browser.min.js",
11
- "types": "./dist/src/index.d.ts",
11
+ "types": "./dist/index.d.ts",
12
12
  "exports": {
13
13
  ".": {
14
- "types": "./dist/src/index.d.ts",
14
+ "types": "./dist/index.d.ts",
15
15
  "import": "./dist/qrcode.vue.esm.js",
16
16
  "require": "./dist/qrcode.vue.cjs.js"
17
17
  },
18
18
  "./package": "./package.json"
19
19
  },
20
20
  "scripts": {
21
- "dev": "rsbuild dev",
21
+ "dev": "node example/scripts/generate-i18n.mjs && rsbuild dev",
22
22
  "build": "rollup -c",
23
+ "build:example": "node example/scripts/generate-i18n.mjs && rsbuild build",
24
+ "generate:i18n": "node example/scripts/generate-i18n.mjs",
23
25
  "test": "rstest"
24
26
  },
25
27
  "repository": "https://github.com/scopewu/qrcode.vue.git",
@@ -50,13 +52,13 @@
50
52
  "dependencies": {},
51
53
  "devDependencies": {
52
54
  "@rollup/plugin-terser": "^1.0.0",
53
- "@rsbuild/core": "^2.0.1",
54
- "@rstest/core": "^0.9.9",
55
- "@vue/test-utils": "^2.4.6",
56
- "happy-dom": "^20.9.0",
57
- "rollup": "^4.60.2",
55
+ "@rsbuild/core": "^2.0.13",
56
+ "@rstest/core": "^0.10.4",
57
+ "@vue/test-utils": "^2.4.11",
58
+ "happy-dom": "^20.10.3",
59
+ "rollup": "^4.62.0",
58
60
  "rollup-plugin-typescript2": "^0.37.0",
59
61
  "typescript": "^5.9.3",
60
- "vue": "^3.5.29"
62
+ "vue": "^3.5.38"
61
63
  }
62
64
  }
@@ -1,2 +0,0 @@
1
- declare const _default: import("@rstest/core").RstestConfig;
2
- export default _default;
@@ -1,95 +0,0 @@
1
- declare namespace qrcodegen {
2
- type bit = number;
3
- type byte = number;
4
- type int = number;
5
- export class QrCode {
6
- readonly version: int;
7
- readonly errorCorrectionLevel: QrCode.Ecc;
8
- static encodeText(text: string, ecl: QrCode.Ecc): QrCode;
9
- static encodeBinary(data: Readonly<Array<byte>>, ecl: QrCode.Ecc): QrCode;
10
- static encodeSegments(segs: Readonly<Array<QrSegment>>, ecl: QrCode.Ecc, minVersion?: int, maxVersion?: int, mask?: int, boostEcl?: boolean): QrCode;
11
- readonly size: int;
12
- readonly mask: int;
13
- private readonly modules;
14
- private readonly isFunction;
15
- constructor(version: int, errorCorrectionLevel: QrCode.Ecc, dataCodewords: Readonly<Array<byte>>, msk: int);
16
- getModule(x: int, y: int): boolean;
17
- getModules(): boolean[][];
18
- private drawFunctionPatterns;
19
- private drawFormatBits;
20
- private drawVersion;
21
- private drawFinderPattern;
22
- private drawAlignmentPattern;
23
- private setFunctionModule;
24
- private addEccAndInterleave;
25
- private drawCodewords;
26
- private applyMask;
27
- private getPenaltyScore;
28
- private getAlignmentPatternPositions;
29
- private static getNumRawDataModules;
30
- private static getNumDataCodewords;
31
- private static reedSolomonComputeDivisor;
32
- private static reedSolomonComputeRemainder;
33
- private static reedSolomonMultiply;
34
- private finderPenaltyCountPatterns;
35
- private finderPenaltyTerminateAndCount;
36
- private finderPenaltyAddHistory;
37
- static readonly MIN_VERSION: int;
38
- static readonly MAX_VERSION: int;
39
- private static readonly PENALTY_N1;
40
- private static readonly PENALTY_N2;
41
- private static readonly PENALTY_N3;
42
- private static readonly PENALTY_N4;
43
- private static readonly ECC_CODEWORDS_PER_BLOCK;
44
- private static readonly NUM_ERROR_CORRECTION_BLOCKS;
45
- }
46
- export class QrSegment {
47
- readonly mode: QrSegment.Mode;
48
- readonly numChars: int;
49
- private readonly bitData;
50
- static makeBytes(data: Readonly<Array<byte>>): QrSegment;
51
- static makeNumeric(digits: string): QrSegment;
52
- static makeAlphanumeric(text: string): QrSegment;
53
- static makeSegments(text: string): Array<QrSegment>;
54
- static makeEci(assignVal: int): QrSegment;
55
- static isNumeric(text: string): boolean;
56
- static isAlphanumeric(text: string): boolean;
57
- constructor(mode: QrSegment.Mode, numChars: int, bitData: Array<bit>);
58
- getData(): Array<bit>;
59
- static getTotalBits(segs: Readonly<Array<QrSegment>>, version: int): number;
60
- private static toUtf8ByteArray;
61
- private static readonly NUMERIC_REGEX;
62
- private static readonly ALPHANUMERIC_REGEX;
63
- private static readonly ALPHANUMERIC_CHARSET;
64
- }
65
- export {};
66
- }
67
- declare namespace qrcodegen.QrCode {
68
- type int = number;
69
- export class Ecc {
70
- readonly ordinal: int;
71
- readonly formatBits: int;
72
- static readonly LOW: Ecc;
73
- static readonly MEDIUM: Ecc;
74
- static readonly QUARTILE: Ecc;
75
- static readonly HIGH: Ecc;
76
- private constructor();
77
- }
78
- export {};
79
- }
80
- declare namespace qrcodegen.QrSegment {
81
- type int = number;
82
- export class Mode {
83
- readonly modeBits: int;
84
- private readonly numBitsCharCount;
85
- static readonly NUMERIC: Mode;
86
- static readonly ALPHANUMERIC: Mode;
87
- static readonly BYTE: Mode;
88
- static readonly KANJI: Mode;
89
- static readonly ECI: Mode;
90
- private constructor();
91
- numCharCountBits(ver: int): int;
92
- }
93
- export {};
94
- }
95
- export default qrcodegen;