reykit 1.0.142 → 1.0.143
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 +8 -7
- package/dist/src/image.d.ts +3 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49440,15 +49440,16 @@ 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
|
|
49444
|
-
|
|
49445
|
-
|
|
49446
|
-
|
|
49447
|
-
|
|
49443
|
+
async function SI(a, i) {
|
|
49444
|
+
let u = i && i.element;
|
|
49445
|
+
const d = i && i.width, m = (i && i.margin) ?? 0, g = await cC.toDataURL(a, { width: d, margin: m });
|
|
49446
|
+
if (u !== void 0) {
|
|
49447
|
+
if (typeof u == "string") {
|
|
49448
|
+
const v = document.getElementById(u);
|
|
49448
49449
|
if (!v) throw new Error("element id not exists");
|
|
49449
|
-
|
|
49450
|
+
u = v;
|
|
49450
49451
|
}
|
|
49451
|
-
|
|
49452
|
+
u.setAttribute("src", g);
|
|
49452
49453
|
}
|
|
49453
49454
|
return g;
|
|
49454
49455
|
}
|
package/dist/src/image.d.ts
CHANGED
|
@@ -21,13 +21,14 @@ export declare function downloadQrcode(text: string, fileName?: string): Promise
|
|
|
21
21
|
* Generate QRCode URL and set to element `src` attribute.
|
|
22
22
|
*
|
|
23
23
|
* @param text - QRCode Text.
|
|
24
|
-
* @param element - Element instance or id.
|
|
24
|
+
* @param options.element - Element instance or id.
|
|
25
25
|
* - `undefined` : Not set.
|
|
26
26
|
* @param options.width - Width of Minimum pixel.
|
|
27
27
|
* @param options.margin - Number of margin blank square.
|
|
28
28
|
* @returns QR code URL.
|
|
29
29
|
*/
|
|
30
|
-
export declare function getQrcodeUrl(text: string,
|
|
30
|
+
export declare function getQrcodeUrl(text: string, options?: {
|
|
31
|
+
element?: HTMLElement | string;
|
|
31
32
|
width?: number;
|
|
32
33
|
margin?: number;
|
|
33
34
|
}): Promise<string>;
|