@qr-platform/qr-code.js 0.11.1 → 0.11.2
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.md +2 -1
- package/docs/api-reference-guide.md +1 -1
- package/docs/documentation.md +4 -1
- package/docs/usage-guide.md +2 -1
- package/lib/core/qr-code-js.d.ts +2 -2
- package/lib/index.js +1 -1
- package/lib/node/core/qr-code-js.d.ts +2 -2
- package/lib/node/types/helper.d.ts +3 -0
- package/lib/node.js +1 -1
- package/lib/types/helper.d.ts +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -78,7 +78,8 @@ const qrCode = new QRCodeJs(options);
|
|
|
78
78
|
// 3. Append to a container element (in browser)
|
|
79
79
|
const container = document.getElementById('qr-container');
|
|
80
80
|
if (container) {
|
|
81
|
-
|
|
81
|
+
// Remove any existing content before appending the QR code
|
|
82
|
+
qrCode.append(container, { clearContainer: true });
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
// Or get SVG string (Browser or Node.js)
|
|
@@ -82,7 +82,7 @@ qrCode.append(document.getElementById('qr-container'));
|
|
|
82
82
|
|
|
83
83
|
| Method | Parameters | Description |
|
|
84
84
|
| :------------------ | :------------------------------------------------------------------------- | :-------------------------------------------------------------------------- |
|
|
85
|
-
| `append` | `container: HTMLElement` | Appends the QR code to a container element. Returns `QRCodeJs \| undefined`. |
|
|
85
|
+
| `append` | `container: HTMLElement, options?: { clearContainer?: boolean }` | Appends the QR code to a container element. Returns `QRCodeJs \| undefined`. |
|
|
86
86
|
| `serialize` | `inverted?: boolean` | Converts the QR code to an SVG string. Returns `Promise<string \| undefined>`. |
|
|
87
87
|
| `download` | `downloadOptions?: { name?: string; extension: 'svg' \| 'png' \| 'jpeg' \| 'webp' }, canvasOptions?: CanvasOptions` | Downloads the QR code as a file. Returns `Promise<void>`. |
|
|
88
88
|
| `update` | `options?: RecursivePartial<Options>` | Updates the QR code with new options. Returns `void`. |
|
package/docs/documentation.md
CHANGED
|
@@ -1656,7 +1656,10 @@ new QRCodeJs(options: QRCodeJsOptions)
|
|
|
1656
1656
|
Appends the QR code to a container element.
|
|
1657
1657
|
|
|
1658
1658
|
```typescript
|
|
1659
|
-
qrCode.append(
|
|
1659
|
+
qrCode.append(
|
|
1660
|
+
container: HTMLElement,
|
|
1661
|
+
options?: { clearContainer?: boolean }
|
|
1662
|
+
): QRCodeJs | undefined
|
|
1660
1663
|
```
|
|
1661
1664
|
|
|
1662
1665
|
#### `serialize()`
|
package/docs/usage-guide.md
CHANGED
|
@@ -486,8 +486,9 @@ if (validationResult.isValid) {
|
|
|
486
486
|
|
|
487
487
|
#### Methods
|
|
488
488
|
|
|
489
|
-
- **`append(container: HTMLElement): void`**
|
|
489
|
+
- **`append(container: HTMLElement, options?: { clearContainer?: boolean }): void`**
|
|
490
490
|
Appends the QR code to a specified container element.
|
|
491
|
+
If `clearContainer` is `true`, the container's existing contents are removed before appending.
|
|
491
492
|
|
|
492
493
|
- **`serialize(): Promise<string | undefined>`**
|
|
493
494
|
Converts the QR code to an SVG string.
|
package/lib/core/qr-code-js.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CanvasOptions } from '~/utils/canvas-options';
|
|
2
|
-
import { MethodOverrideOptions, RecursivePartial } from '../types/helper';
|
|
2
|
+
import { AppendOptions, MethodOverrideOptions, RecursivePartial } from '../types/helper';
|
|
3
3
|
import { SettingsOptions } from '../types/settings-options';
|
|
4
4
|
import { StyleOptions } from '../types/style-options';
|
|
5
5
|
import { QRTextTemplateDefinition, TextOptions } from '../types/text-options';
|
|
@@ -140,7 +140,7 @@ export declare class QRCodeJs {
|
|
|
140
140
|
setDescription(description?: string): this;
|
|
141
141
|
setMetadata(metadata?: Record<string, any>): this;
|
|
142
142
|
update(options?: RecursivePartial<Options>): Promise<void>;
|
|
143
|
-
append(container?: HTMLElement): this;
|
|
143
|
+
append(container?: HTMLElement, options?: AppendOptions): this;
|
|
144
144
|
applyExtension(extension: ExtensionFunction): Promise<void>;
|
|
145
145
|
deleteExtension(): Promise<void>;
|
|
146
146
|
serialize(inverted?: boolean): Promise<string | undefined>;
|