reykit 1.0.140 → 1.0.142

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 CHANGED
@@ -49440,23 +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, {
49444
- width: u,
49445
- margin: d = 4
49446
- }) {
49447
- if (typeof i == "string") {
49448
- const g = document.getElementById(i);
49449
- if (!g) throw new Error("element id not exists");
49450
- i = g;
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);
49451
49452
  }
49452
- const m = await cC.toDataURL(a, { width: u, margin: d });
49453
- i.setAttribute("src", m);
49453
+ return g;
49454
49454
  }
49455
49455
  const EI = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49456
49456
  __proto__: null,
49457
49457
  downloadQrcode: xI,
49458
- openQrcode: bI,
49459
- setElementQrcode: SI
49458
+ getQrcodeUrl: SI,
49459
+ openQrcode: bI
49460
49460
  }, Symbol.toStringTag, { value: "Module" }));
49461
49461
  async function RI(a, i) {
49462
49462
  let {
@@ -5,7 +5,7 @@
5
5
  * @Explain : Image methods.
6
6
  */
7
7
  /**
8
- * Generate and browser open qrcode file.
8
+ * Generate and browser open QR code file.
9
9
  *
10
10
  * @param text - QRCode Text.
11
11
  */
@@ -13,19 +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 - QRCode 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
- * Set qrcode URL to element `src` attribute.
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
+ * - `undefined` : Not set.
25
26
  * @param options.width - Width of Minimum pixel.
26
27
  * @param options.margin - Number of margin blank square.
28
+ * @returns QR code URL.
27
29
  */
28
- export declare function setElementQrcode(text: string, element: HTMLElement | string, { width, margin }: {
30
+ export declare function getQrcodeUrl(text: string, element?: HTMLElement | string, options?: {
29
31
  width?: number;
30
32
  margin?: number;
31
- }): Promise<void>;
33
+ }): Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reykit",
3
- "version": "1.0.140",
3
+ "version": "1.0.142",
4
4
  "description": "Kit method set.",
5
5
  "author": "reyxbo",
6
6
  "keywords": [