qrcode.vue 3.8.0 → 3.9.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.
- package/CHANGELOG.md +6 -0
- package/README-zh_cn.md +19 -0
- package/README.md +18 -0
- package/dist/qrcode.vue.browser.js +130 -75
- package/dist/qrcode.vue.browser.min.js +2 -2
- package/dist/qrcode.vue.cjs.js +130 -75
- package/dist/qrcode.vue.esm.js +131 -76
- package/dist/src/index.d.ts +50 -9
- package/package.json +8 -8
package/dist/qrcode.vue.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* qrcode.vue v3.
|
|
2
|
+
* qrcode.vue v3.9.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, h, ref, onMounted, watchEffect, Fragment,
|
|
7
|
+
import { defineComponent, computed, h, ref, onMounted, watchEffect, Fragment, useId } from 'vue';
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
10
10
|
Copyright (c) Microsoft Corporation.
|
|
@@ -905,6 +905,13 @@ var qrcodegen;
|
|
|
905
905
|
})(qrcodegen || (qrcodegen = {}));
|
|
906
906
|
var QR = qrcodegen;
|
|
907
907
|
|
|
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++);
|
|
914
|
+
}
|
|
908
915
|
var defaultErrorCorrectLevel = 'L';
|
|
909
916
|
var DEFAULT_QR_SIZE = 100;
|
|
910
917
|
var DEFAULT_MARGIN = 0;
|
|
@@ -929,42 +936,88 @@ var SUPPORTS_PATH2D = (function () {
|
|
|
929
936
|
function validErrorCorrectLevel(level) {
|
|
930
937
|
return level in ErrorCorrectLevelMap;
|
|
931
938
|
}
|
|
939
|
+
function getNeighborFlags(modules, row, col) {
|
|
940
|
+
var north = row > 0 ? modules[row - 1][col] : false;
|
|
941
|
+
var south = row < modules.length - 1 ? modules[row + 1][col] : false;
|
|
942
|
+
var west = col > 0 ? modules[row][col - 1] : false;
|
|
943
|
+
var east = col < modules[row].length - 1 ? modules[row][col + 1] : false;
|
|
944
|
+
return {
|
|
945
|
+
nw: !north && !west,
|
|
946
|
+
ne: !north && !east,
|
|
947
|
+
se: !south && !east,
|
|
948
|
+
sw: !south && !west,
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
function generateRoundedPath(modules, margin, radius) {
|
|
952
|
+
if (margin === void 0) { margin = 0; }
|
|
953
|
+
if (radius === void 0) { radius = 0; }
|
|
954
|
+
var pathSegments = [];
|
|
955
|
+
var r = Math.min(radius, 0.5);
|
|
956
|
+
for (var row = 0; row < modules.length; row++) {
|
|
957
|
+
for (var col = 0; col < modules[row].length; col++) {
|
|
958
|
+
if (!modules[row][col])
|
|
959
|
+
continue;
|
|
960
|
+
var _a = getNeighborFlags(modules, row, col), nw = _a.nw, ne = _a.ne, se = _a.se, sw = _a.sw;
|
|
961
|
+
var x = col + margin;
|
|
962
|
+
var y = row + margin;
|
|
963
|
+
pathSegments.push("M".concat(x + (nw ? r : 0), " ").concat(y), "L".concat(x + 1 - (ne ? r : 0), " ").concat(y));
|
|
964
|
+
if (ne) {
|
|
965
|
+
pathSegments.push("A".concat(r, " ").concat(r, " 0 0 1 ").concat(x + 1, " ").concat(y + r));
|
|
966
|
+
}
|
|
967
|
+
pathSegments.push("L".concat(x + 1, " ").concat(y + 1 - (se ? r : 0)));
|
|
968
|
+
if (se) {
|
|
969
|
+
pathSegments.push("A".concat(r, " ").concat(r, " 0 0 1 ").concat(x + 1 - r, " ").concat(y + 1));
|
|
970
|
+
}
|
|
971
|
+
pathSegments.push("L".concat(x + (sw ? r : 0), " ").concat(y + 1));
|
|
972
|
+
if (sw) {
|
|
973
|
+
pathSegments.push("A".concat(r, " ").concat(r, " 0 0 1 ").concat(x, " ").concat(y + 1 - r));
|
|
974
|
+
}
|
|
975
|
+
pathSegments.push("L".concat(x, " ").concat(y + (nw ? r : 0)));
|
|
976
|
+
if (nw) {
|
|
977
|
+
pathSegments.push("A".concat(r, " ").concat(r, " 0 0 1 ").concat(x + r, " ").concat(y));
|
|
978
|
+
}
|
|
979
|
+
pathSegments.push('z');
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
return pathSegments.join('');
|
|
983
|
+
}
|
|
932
984
|
function generatePath(modules, margin) {
|
|
933
985
|
if (margin === void 0) { margin = 0; }
|
|
934
|
-
var
|
|
935
|
-
|
|
986
|
+
var pathSegments = [];
|
|
987
|
+
for (var y = 0; y < modules.length; y++) {
|
|
988
|
+
var row = modules[y];
|
|
936
989
|
var start = null;
|
|
937
|
-
|
|
990
|
+
for (var x = 0; x < row.length; x++) {
|
|
991
|
+
var cell = row[x];
|
|
938
992
|
if (!cell && start !== null) {
|
|
939
993
|
// M0 0h7v1H0z injects the space with the move and drops the comma,
|
|
940
|
-
|
|
941
|
-
path += "M".concat(start + margin, " ").concat(y + margin, "h").concat(x - start, "v1H").concat(start + margin, "z");
|
|
994
|
+
pathSegments.push("M".concat(start + margin, " ").concat(y + margin, "h").concat(x - start, "v1H").concat(start + margin, "z"));
|
|
942
995
|
start = null;
|
|
943
|
-
|
|
996
|
+
continue;
|
|
944
997
|
}
|
|
945
998
|
// end of row, clean up or skip
|
|
946
999
|
if (x === row.length - 1) {
|
|
947
1000
|
if (!cell) {
|
|
948
1001
|
// We would have closed the op above already so this can only mean
|
|
949
1002
|
// 2+ light modules in a row.
|
|
950
|
-
|
|
1003
|
+
continue;
|
|
951
1004
|
}
|
|
952
1005
|
if (start === null) {
|
|
953
1006
|
// Just a single dark module.
|
|
954
|
-
|
|
1007
|
+
pathSegments.push("M".concat(x + margin, ",").concat(y + margin, " h1v1H").concat(x + margin, "z"));
|
|
955
1008
|
}
|
|
956
1009
|
else {
|
|
957
1010
|
// Otherwise finish the current line.
|
|
958
|
-
|
|
1011
|
+
pathSegments.push("M".concat(start + margin, ",").concat(y + margin, " h").concat(x + 1 - start, "v1H").concat(start + margin, "z"));
|
|
959
1012
|
}
|
|
960
|
-
|
|
1013
|
+
continue;
|
|
961
1014
|
}
|
|
962
1015
|
if (cell && start === null) {
|
|
963
1016
|
start = x;
|
|
964
1017
|
}
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
return
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
return pathSegments.join('');
|
|
968
1021
|
}
|
|
969
1022
|
function getImageSettings(cells, size, margin, imageSettings) {
|
|
970
1023
|
var width = imageSettings.width, height = imageSettings.height, imageX = imageSettings.x, imageY = imageSettings.y;
|
|
@@ -976,15 +1029,7 @@ function getImageSettings(cells, size, margin, imageSettings) {
|
|
|
976
1029
|
var x = imageX == null ? cells.length / 2 - w / 2 : imageX * scale;
|
|
977
1030
|
var y = imageY == null ? cells.length / 2 - h / 2 : imageY * scale;
|
|
978
1031
|
var borderRadius = (imageSettings.borderRadius || 0) * scale;
|
|
979
|
-
|
|
980
|
-
if (imageSettings.excavate) {
|
|
981
|
-
var floorX = Math.floor(x);
|
|
982
|
-
var floorY = Math.floor(y);
|
|
983
|
-
var ceilW = Math.ceil(w + x - floorX);
|
|
984
|
-
var ceilH = Math.ceil(h + y - floorY);
|
|
985
|
-
excavation = { x: floorX, y: floorY, w: ceilW, h: ceilH };
|
|
986
|
-
}
|
|
987
|
-
return { x: x, y: y, h: h, w: w, borderRadius: borderRadius, excavation: excavation };
|
|
1032
|
+
return { x: x, y: y, h: h, w: w, borderRadius: borderRadius };
|
|
988
1033
|
}
|
|
989
1034
|
function useQRCode(props) {
|
|
990
1035
|
var margin = computed(function () { var _a; return ((_a = props.margin) !== null && _a !== void 0 ? _a : DEFAULT_MARGIN) >>> 0; });
|
|
@@ -993,11 +1038,15 @@ function useQRCode(props) {
|
|
|
993
1038
|
return QR.QrCode.encodeText(props.value, ErrorCorrectLevelMap[level]).getModules();
|
|
994
1039
|
});
|
|
995
1040
|
var numCells = computed(function () { return cells.value.length + margin.value * 2; });
|
|
996
|
-
var fgPath = computed(function () {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
return { x: 0, y: 0, width: 0, height: 0, borderRadius: 0 };
|
|
1041
|
+
var fgPath = computed(function () {
|
|
1042
|
+
if (props.radius > 0) {
|
|
1043
|
+
return generateRoundedPath(cells.value, margin.value, props.radius);
|
|
1000
1044
|
}
|
|
1045
|
+
return generatePath(cells.value, margin.value);
|
|
1046
|
+
});
|
|
1047
|
+
var imageProps = computed(function () {
|
|
1048
|
+
if (!props.imageSettings.src)
|
|
1049
|
+
return null;
|
|
1001
1050
|
var settings = getImageSettings(cells.value, props.size, margin.value, props.imageSettings);
|
|
1002
1051
|
return {
|
|
1003
1052
|
x: settings.x + margin.value,
|
|
@@ -1008,7 +1057,7 @@ function useQRCode(props) {
|
|
|
1008
1057
|
};
|
|
1009
1058
|
});
|
|
1010
1059
|
var imageBorderProps = computed(function () {
|
|
1011
|
-
if (!props.imageSettings.excavate || !
|
|
1060
|
+
if (!props.imageSettings.excavate || !imageProps.value)
|
|
1012
1061
|
return null;
|
|
1013
1062
|
var borderThickness = IMAGE_EXCAVATE_THICKNESS / (props.size / numCells.value);
|
|
1014
1063
|
return {
|
|
@@ -1075,6 +1124,12 @@ var QRCodeProps = {
|
|
|
1075
1124
|
required: false,
|
|
1076
1125
|
default: '#fff',
|
|
1077
1126
|
},
|
|
1127
|
+
radius: {
|
|
1128
|
+
type: Number,
|
|
1129
|
+
required: false,
|
|
1130
|
+
default: 0,
|
|
1131
|
+
validator: function (r) { return !isNaN(r) && r >= 0 && r <= 0.5; },
|
|
1132
|
+
},
|
|
1078
1133
|
};
|
|
1079
1134
|
var QRCodeVueProps = __assign(__assign({}, QRCodeProps), { renderAs: {
|
|
1080
1135
|
type: String,
|
|
@@ -1087,8 +1142,10 @@ var QrcodeSvg = defineComponent({
|
|
|
1087
1142
|
props: QRCodeProps,
|
|
1088
1143
|
setup: function (props) {
|
|
1089
1144
|
var _a = useQRCode(props), numCells = _a.numCells, fgPath = _a.fgPath, imageProps = _a.imageProps, imageBorderProps = _a.imageBorderProps;
|
|
1090
|
-
var
|
|
1091
|
-
var
|
|
1145
|
+
var uid = getUid();
|
|
1146
|
+
var qrGradientId = "qrcode.vue-gradient-".concat(uid);
|
|
1147
|
+
var qrLogoClipPathId = "qrcode.vue-logo-clip-path-".concat(uid);
|
|
1148
|
+
var gradientVNode = computed(function () {
|
|
1092
1149
|
if (!props.gradient)
|
|
1093
1150
|
return null;
|
|
1094
1151
|
var gradientProps = props.gradientType === 'linear'
|
|
@@ -1115,12 +1172,11 @@ var QrcodeSvg = defineComponent({
|
|
|
1115
1172
|
style: { stopColor: props.gradientEndColor },
|
|
1116
1173
|
}),
|
|
1117
1174
|
]);
|
|
1118
|
-
};
|
|
1119
|
-
var
|
|
1120
|
-
|
|
1121
|
-
var borderRadius = imageProps.value.borderRadius;
|
|
1122
|
-
if (!props.imageSettings.src)
|
|
1175
|
+
});
|
|
1176
|
+
var clipPathVNode = computed(function () {
|
|
1177
|
+
if (!imageProps.value)
|
|
1123
1178
|
return null;
|
|
1179
|
+
var borderRadius = imageProps.value.borderRadius;
|
|
1124
1180
|
if (borderRadius <= 0)
|
|
1125
1181
|
return null;
|
|
1126
1182
|
return h('clipPath', { id: qrLogoClipPathId }, [
|
|
@@ -1133,15 +1189,16 @@ var QrcodeSvg = defineComponent({
|
|
|
1133
1189
|
ry: borderRadius,
|
|
1134
1190
|
}),
|
|
1135
1191
|
]);
|
|
1136
|
-
};
|
|
1192
|
+
});
|
|
1137
1193
|
return function () { return h('svg', {
|
|
1138
1194
|
width: props.size,
|
|
1139
1195
|
height: props.size,
|
|
1140
|
-
'shape-rendering': "crispEdges",
|
|
1141
1196
|
xmlns: 'http://www.w3.org/2000/svg',
|
|
1142
1197
|
viewBox: "0 0 ".concat(numCells.value, " ").concat(numCells.value),
|
|
1198
|
+
role: 'img',
|
|
1199
|
+
'aria-label': props.value,
|
|
1143
1200
|
}, [
|
|
1144
|
-
h('defs', {}, [
|
|
1201
|
+
h('defs', {}, [gradientVNode.value, clipPathVNode.value]),
|
|
1145
1202
|
h('rect', {
|
|
1146
1203
|
width: '100%',
|
|
1147
1204
|
height: '100%',
|
|
@@ -1160,7 +1217,7 @@ var QrcodeSvg = defineComponent({
|
|
|
1160
1217
|
rx: imageBorderProps.value.borderRadius,
|
|
1161
1218
|
ry: imageBorderProps.value.borderRadius,
|
|
1162
1219
|
}),
|
|
1163
|
-
props.imageSettings.src && h('image', __assign(__assign({ href: props.imageSettings.src }, imageProps.value), (imageProps.value.borderRadius > 0 ? { 'clip-path': "url(#".concat(qrLogoClipPathId, ")") } : {}))),
|
|
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, ")") } : {}))),
|
|
1164
1221
|
]); };
|
|
1165
1222
|
},
|
|
1166
1223
|
});
|
|
@@ -1168,9 +1225,18 @@ var QrcodeCanvas = defineComponent({
|
|
|
1168
1225
|
name: 'QRCodeCanvas',
|
|
1169
1226
|
props: QRCodeProps,
|
|
1170
1227
|
setup: function (props, ctx) {
|
|
1171
|
-
var _a = useQRCode(props), margin = _a.margin, cells = _a.cells, numCells = _a.numCells, imageProps = _a.imageProps, imageBorderProps = _a.imageBorderProps;
|
|
1228
|
+
var _a = useQRCode(props), margin = _a.margin, cells = _a.cells, numCells = _a.numCells, fgPath = _a.fgPath, imageProps = _a.imageProps, imageBorderProps = _a.imageBorderProps;
|
|
1172
1229
|
var canvasEl = ref(null);
|
|
1173
|
-
var
|
|
1230
|
+
var imageEl = ref(null);
|
|
1231
|
+
var drawRoundedRect = function (ctx, x, y, width, height, radius) {
|
|
1232
|
+
ctx.beginPath();
|
|
1233
|
+
if (ctx.roundRect) {
|
|
1234
|
+
ctx.roundRect(x, y, width, height, radius);
|
|
1235
|
+
}
|
|
1236
|
+
else {
|
|
1237
|
+
ctx.rect(x, y, width, height);
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1174
1240
|
var generate = function () {
|
|
1175
1241
|
var size = props.size, background = props.background, foreground = props.foreground, gradient = props.gradient, gradientType = props.gradientType, gradientStartColor = props.gradientStartColor, gradientEndColor = props.gradientEndColor;
|
|
1176
1242
|
var canvas = canvasEl.value;
|
|
@@ -1181,12 +1247,11 @@ var QrcodeCanvas = defineComponent({
|
|
|
1181
1247
|
if (!canvasCtx) {
|
|
1182
1248
|
return;
|
|
1183
1249
|
}
|
|
1184
|
-
var
|
|
1185
|
-
var image = imageRef.value;
|
|
1250
|
+
var image = imageEl.value;
|
|
1186
1251
|
var devicePixelRatio = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;
|
|
1187
1252
|
var scale = (size / numCells.value) * devicePixelRatio;
|
|
1188
1253
|
canvas.height = canvas.width = size * devicePixelRatio;
|
|
1189
|
-
canvasCtx.
|
|
1254
|
+
canvasCtx.setTransform(scale, 0, 0, scale, 0, 0);
|
|
1190
1255
|
canvasCtx.fillStyle = background;
|
|
1191
1256
|
canvasCtx.fillRect(0, 0, numCells.value, numCells.value);
|
|
1192
1257
|
if (gradient) {
|
|
@@ -1205,10 +1270,10 @@ var QrcodeCanvas = defineComponent({
|
|
|
1205
1270
|
canvasCtx.fillStyle = foreground;
|
|
1206
1271
|
}
|
|
1207
1272
|
if (SUPPORTS_PATH2D) {
|
|
1208
|
-
canvasCtx.fill(new Path2D(
|
|
1273
|
+
canvasCtx.fill(new Path2D(fgPath.value));
|
|
1209
1274
|
}
|
|
1210
1275
|
else {
|
|
1211
|
-
|
|
1276
|
+
cells.value.forEach(function (row, rdx) {
|
|
1212
1277
|
row.forEach(function (cell, cdx) {
|
|
1213
1278
|
if (cell) {
|
|
1214
1279
|
canvasCtx.fillRect(cdx + margin.value, rdx + margin.value, 1, 1);
|
|
@@ -1217,16 +1282,7 @@ var QrcodeCanvas = defineComponent({
|
|
|
1217
1282
|
});
|
|
1218
1283
|
}
|
|
1219
1284
|
var showImage = props.imageSettings.src && image && image.naturalWidth !== 0 && image.naturalHeight !== 0;
|
|
1220
|
-
if (showImage) {
|
|
1221
|
-
var drawRoundedRect = function (ctx, x, y, width, height, radius) {
|
|
1222
|
-
ctx.beginPath();
|
|
1223
|
-
if (ctx.roundRect) {
|
|
1224
|
-
ctx.roundRect(x, y, width, height, radius);
|
|
1225
|
-
}
|
|
1226
|
-
else {
|
|
1227
|
-
ctx.rect(x, y, width, height);
|
|
1228
|
-
}
|
|
1229
|
-
};
|
|
1285
|
+
if (showImage && imageProps.value) {
|
|
1230
1286
|
if (imageBorderProps.value) {
|
|
1231
1287
|
var imageBorder = imageBorderProps.value;
|
|
1232
1288
|
canvasCtx.fillStyle = props.background;
|
|
@@ -1248,11 +1304,10 @@ var QrcodeCanvas = defineComponent({
|
|
|
1248
1304
|
};
|
|
1249
1305
|
onMounted(generate);
|
|
1250
1306
|
watchEffect(generate);
|
|
1251
|
-
var style = ctx.attrs.style;
|
|
1252
1307
|
return function () { return h(Fragment, [
|
|
1253
|
-
h('canvas', __assign(__assign({}, ctx.attrs), { ref: canvasEl, style: __assign(__assign({}, style), { width: "".concat(props.size, "px"), height: "".concat(props.size, "px") }) })),
|
|
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") }) })),
|
|
1254
1309
|
props.imageSettings.src && h('img', {
|
|
1255
|
-
ref:
|
|
1310
|
+
ref: imageEl,
|
|
1256
1311
|
src: props.imageSettings.src,
|
|
1257
1312
|
style: { display: 'none' },
|
|
1258
1313
|
onLoad: generate,
|
|
@@ -1262,23 +1317,23 @@ var QrcodeCanvas = defineComponent({
|
|
|
1262
1317
|
});
|
|
1263
1318
|
var QrcodeVue = defineComponent({
|
|
1264
1319
|
name: 'Qrcode',
|
|
1265
|
-
render: function () {
|
|
1266
|
-
var _a = this.$props, renderAs = _a.renderAs, value = _a.value, size = _a.size, margin = _a.margin, level = _a.level, background = _a.background, foreground = _a.foreground, imageSettings = _a.imageSettings, gradient = _a.gradient, gradientType = _a.gradientType, gradientStartColor = _a.gradientStartColor, gradientEndColor = _a.gradientEndColor;
|
|
1267
|
-
return h(renderAs === 'svg' ? QrcodeSvg : QrcodeCanvas, {
|
|
1268
|
-
value: value,
|
|
1269
|
-
size: size,
|
|
1270
|
-
margin: margin,
|
|
1271
|
-
level: level,
|
|
1272
|
-
background: background,
|
|
1273
|
-
foreground: foreground,
|
|
1274
|
-
imageSettings: imageSettings,
|
|
1275
|
-
gradient: gradient,
|
|
1276
|
-
gradientType: gradientType,
|
|
1277
|
-
gradientStartColor: gradientStartColor,
|
|
1278
|
-
gradientEndColor: gradientEndColor,
|
|
1279
|
-
});
|
|
1280
|
-
},
|
|
1281
1320
|
props: QRCodeVueProps,
|
|
1321
|
+
setup: function (props) {
|
|
1322
|
+
return function () { return h(props.renderAs === 'svg' ? QrcodeSvg : QrcodeCanvas, {
|
|
1323
|
+
value: props.value,
|
|
1324
|
+
size: props.size,
|
|
1325
|
+
margin: props.margin,
|
|
1326
|
+
level: props.level,
|
|
1327
|
+
background: props.background,
|
|
1328
|
+
foreground: props.foreground,
|
|
1329
|
+
imageSettings: props.imageSettings,
|
|
1330
|
+
gradient: props.gradient,
|
|
1331
|
+
gradientType: props.gradientType,
|
|
1332
|
+
gradientStartColor: props.gradientStartColor,
|
|
1333
|
+
gradientEndColor: props.gradientEndColor,
|
|
1334
|
+
radius: props.radius,
|
|
1335
|
+
}); };
|
|
1336
|
+
},
|
|
1282
1337
|
});
|
|
1283
1338
|
|
|
1284
1339
|
export { QrcodeCanvas, QrcodeSvg, QrcodeVue as default };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropType } from 'vue';
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
export type Level = 'L' | 'M' | 'Q' | 'H';
|
|
3
3
|
export type RenderAs = 'canvas' | 'svg';
|
|
4
4
|
export type GradientType = 'linear' | 'radial';
|
|
@@ -6,12 +6,12 @@ export type ImageSettings = {
|
|
|
6
6
|
src: string;
|
|
7
7
|
x?: number;
|
|
8
8
|
y?: number;
|
|
9
|
-
height
|
|
10
|
-
width
|
|
9
|
+
height?: number;
|
|
10
|
+
width?: number;
|
|
11
11
|
excavate?: boolean;
|
|
12
12
|
borderRadius?: number;
|
|
13
13
|
};
|
|
14
|
-
export declare const QrcodeSvg: import("vue").DefineComponent<
|
|
14
|
+
export declare const QrcodeSvg: import("vue").DefineComponent<ExtractPropTypes<{
|
|
15
15
|
value: {
|
|
16
16
|
type: StringConstructor;
|
|
17
17
|
required: boolean;
|
|
@@ -65,9 +65,15 @@ export declare const QrcodeSvg: import("vue").DefineComponent<import("vue").Extr
|
|
|
65
65
|
required: boolean;
|
|
66
66
|
default: string;
|
|
67
67
|
};
|
|
68
|
+
radius: {
|
|
69
|
+
type: NumberConstructor;
|
|
70
|
+
required: boolean;
|
|
71
|
+
default: number;
|
|
72
|
+
validator: (r: any) => boolean;
|
|
73
|
+
};
|
|
68
74
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
69
75
|
[key: string]: any;
|
|
70
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<
|
|
76
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
71
77
|
value: {
|
|
72
78
|
type: StringConstructor;
|
|
73
79
|
required: boolean;
|
|
@@ -121,6 +127,12 @@ export declare const QrcodeSvg: import("vue").DefineComponent<import("vue").Extr
|
|
|
121
127
|
required: boolean;
|
|
122
128
|
default: string;
|
|
123
129
|
};
|
|
130
|
+
radius: {
|
|
131
|
+
type: NumberConstructor;
|
|
132
|
+
required: boolean;
|
|
133
|
+
default: number;
|
|
134
|
+
validator: (r: any) => boolean;
|
|
135
|
+
};
|
|
124
136
|
}>> & Readonly<{}>, {
|
|
125
137
|
value: string;
|
|
126
138
|
size: number;
|
|
@@ -133,8 +145,9 @@ export declare const QrcodeSvg: import("vue").DefineComponent<import("vue").Extr
|
|
|
133
145
|
gradientType: GradientType;
|
|
134
146
|
gradientStartColor: string;
|
|
135
147
|
gradientEndColor: string;
|
|
148
|
+
radius: number;
|
|
136
149
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
137
|
-
export declare const QrcodeCanvas: import("vue").DefineComponent<
|
|
150
|
+
export declare const QrcodeCanvas: import("vue").DefineComponent<ExtractPropTypes<{
|
|
138
151
|
value: {
|
|
139
152
|
type: StringConstructor;
|
|
140
153
|
required: boolean;
|
|
@@ -188,9 +201,15 @@ export declare const QrcodeCanvas: import("vue").DefineComponent<import("vue").E
|
|
|
188
201
|
required: boolean;
|
|
189
202
|
default: string;
|
|
190
203
|
};
|
|
204
|
+
radius: {
|
|
205
|
+
type: NumberConstructor;
|
|
206
|
+
required: boolean;
|
|
207
|
+
default: number;
|
|
208
|
+
validator: (r: any) => boolean;
|
|
209
|
+
};
|
|
191
210
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
192
211
|
[key: string]: any;
|
|
193
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<
|
|
212
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
194
213
|
value: {
|
|
195
214
|
type: StringConstructor;
|
|
196
215
|
required: boolean;
|
|
@@ -244,6 +263,12 @@ export declare const QrcodeCanvas: import("vue").DefineComponent<import("vue").E
|
|
|
244
263
|
required: boolean;
|
|
245
264
|
default: string;
|
|
246
265
|
};
|
|
266
|
+
radius: {
|
|
267
|
+
type: NumberConstructor;
|
|
268
|
+
required: boolean;
|
|
269
|
+
default: number;
|
|
270
|
+
validator: (r: any) => boolean;
|
|
271
|
+
};
|
|
247
272
|
}>> & Readonly<{}>, {
|
|
248
273
|
value: string;
|
|
249
274
|
size: number;
|
|
@@ -256,8 +281,9 @@ export declare const QrcodeCanvas: import("vue").DefineComponent<import("vue").E
|
|
|
256
281
|
gradientType: GradientType;
|
|
257
282
|
gradientStartColor: string;
|
|
258
283
|
gradientEndColor: string;
|
|
284
|
+
radius: number;
|
|
259
285
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
260
|
-
declare const QrcodeVue: import("vue").DefineComponent<
|
|
286
|
+
declare const QrcodeVue: import("vue").DefineComponent<ExtractPropTypes<{
|
|
261
287
|
renderAs: {
|
|
262
288
|
type: PropType<RenderAs>;
|
|
263
289
|
required: boolean;
|
|
@@ -317,7 +343,15 @@ declare const QrcodeVue: import("vue").DefineComponent<import("vue").ExtractProp
|
|
|
317
343
|
required: boolean;
|
|
318
344
|
default: string;
|
|
319
345
|
};
|
|
320
|
-
|
|
346
|
+
radius: {
|
|
347
|
+
type: NumberConstructor;
|
|
348
|
+
required: boolean;
|
|
349
|
+
default: number;
|
|
350
|
+
validator: (r: any) => boolean;
|
|
351
|
+
};
|
|
352
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
353
|
+
[key: string]: any;
|
|
354
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
321
355
|
renderAs: {
|
|
322
356
|
type: PropType<RenderAs>;
|
|
323
357
|
required: boolean;
|
|
@@ -377,6 +411,12 @@ declare const QrcodeVue: import("vue").DefineComponent<import("vue").ExtractProp
|
|
|
377
411
|
required: boolean;
|
|
378
412
|
default: string;
|
|
379
413
|
};
|
|
414
|
+
radius: {
|
|
415
|
+
type: NumberConstructor;
|
|
416
|
+
required: boolean;
|
|
417
|
+
default: number;
|
|
418
|
+
validator: (r: any) => boolean;
|
|
419
|
+
};
|
|
380
420
|
}>> & Readonly<{}>, {
|
|
381
421
|
value: string;
|
|
382
422
|
size: number;
|
|
@@ -389,6 +429,7 @@ declare const QrcodeVue: import("vue").DefineComponent<import("vue").ExtractProp
|
|
|
389
429
|
gradientType: GradientType;
|
|
390
430
|
gradientStartColor: string;
|
|
391
431
|
gradientEndColor: string;
|
|
432
|
+
radius: number;
|
|
392
433
|
renderAs: RenderAs;
|
|
393
434
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
394
435
|
export default QrcodeVue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qrcode.vue",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.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",
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@rollup/plugin-terser": "^0.
|
|
53
|
-
"@rsbuild/core": "^
|
|
54
|
-
"@rstest/core": "^0.
|
|
52
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
53
|
+
"@rsbuild/core": "^2.0.1",
|
|
54
|
+
"@rstest/core": "^0.9.9",
|
|
55
55
|
"@vue/test-utils": "^2.4.6",
|
|
56
|
-
"happy-dom": "^20.
|
|
57
|
-
"rollup": "^4.
|
|
58
|
-
"rollup-plugin-typescript2": "^0.
|
|
56
|
+
"happy-dom": "^20.9.0",
|
|
57
|
+
"rollup": "^4.60.2",
|
|
58
|
+
"rollup-plugin-typescript2": "^0.37.0",
|
|
59
59
|
"typescript": "^5.9.3",
|
|
60
|
-
"vue": "^3.5.
|
|
60
|
+
"vue": "^3.5.29"
|
|
61
61
|
}
|
|
62
62
|
}
|