reykit 1.0.139 → 1.0.141
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/dist/index.js +12 -9
- package/dist/src/image.d.ts +11 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49440,20 +49440,23 @@ async function xI(a, i = "qrcode.png") {
|
|
|
49440
49440
|
const u = await cC.toDataURL(a), m = await (await fetch(u)).blob();
|
|
49441
49441
|
kj(m, i);
|
|
49442
49442
|
}
|
|
49443
|
-
async function SI(a, i, u
|
|
49444
|
-
|
|
49445
|
-
|
|
49446
|
-
if (
|
|
49447
|
-
|
|
49443
|
+
async function SI(a, i, u) {
|
|
49444
|
+
const d = u && u.width, m = (u && u.margin) ?? 0, g = await cC.toDataURL(a, { width: d, margin: m });
|
|
49445
|
+
if (i !== void 0) {
|
|
49446
|
+
if (typeof i == "string") {
|
|
49447
|
+
const v = document.getElementById(i);
|
|
49448
|
+
if (!v) throw new Error("element id not exists");
|
|
49449
|
+
i = v;
|
|
49450
|
+
}
|
|
49451
|
+
i.setAttribute("src", g);
|
|
49448
49452
|
}
|
|
49449
|
-
|
|
49450
|
-
i.setAttribute("src", m);
|
|
49453
|
+
return g;
|
|
49451
49454
|
}
|
|
49452
49455
|
const EI = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
49453
49456
|
__proto__: null,
|
|
49454
49457
|
downloadQrcode: xI,
|
|
49455
|
-
|
|
49456
|
-
|
|
49458
|
+
generateElementQrcode: SI,
|
|
49459
|
+
openQrcode: bI
|
|
49457
49460
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
49458
49461
|
async function RI(a, i) {
|
|
49459
49462
|
let {
|
package/dist/src/image.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @Explain : Image methods.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* Generate and browser open
|
|
8
|
+
* Generate and browser open QR code file.
|
|
9
9
|
*
|
|
10
10
|
* @param text - QRCode Text.
|
|
11
11
|
*/
|
|
@@ -13,16 +13,21 @@ export declare function openQrcode(text: string): Promise<void>;
|
|
|
13
13
|
/**
|
|
14
14
|
* Generate and browser download qrcode file.
|
|
15
15
|
*
|
|
16
|
-
* @param text -
|
|
16
|
+
* @param text - QR code Text.
|
|
17
17
|
* @param fileName - File name.
|
|
18
18
|
*/
|
|
19
19
|
export declare function downloadQrcode(text: string, fileName?: string): Promise<void>;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Generate QRCode URL and set to element `src` attribute.
|
|
22
22
|
*
|
|
23
23
|
* @param text - QRCode Text.
|
|
24
24
|
* @param element - Element instance or id.
|
|
25
|
-
*
|
|
26
|
-
* @param
|
|
25
|
+
* - `undefined` : Not set.
|
|
26
|
+
* @param options.width - Width of Minimum pixel.
|
|
27
|
+
* @param options.margin - Number of margin blank square.
|
|
28
|
+
* @returns QR code URL.
|
|
27
29
|
*/
|
|
28
|
-
export declare function
|
|
30
|
+
export declare function generateElementQrcode(text: string, element?: HTMLElement | string, options?: {
|
|
31
|
+
width?: number;
|
|
32
|
+
margin?: number;
|
|
33
|
+
}): Promise<string>;
|