@qr-platform/qr-code.js 0.10.2 → 0.10.4
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 +12 -0
- package/README.md +15 -10
- package/docs/advanced-examples.md +135 -8
- package/docs/api-reference-guide.md +19 -13
- package/docs/documentation.md +197 -121
- package/docs/examples.md +179 -6
- package/docs/typescript-types-definitions.md +53 -14
- package/docs/usage-guide.md +143 -111
- package/lib/core/qr-code-js.d.ts +17 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +1 -1
- package/lib/node/core/qr-code-js.d.ts +17 -0
- package/lib/node/index.d.ts +8 -0
- package/lib/node/node.d.ts +8 -0
- package/lib/node/types/settings-options.d.ts +1 -0
- package/lib/node.d.ts +8 -0
- package/lib/node.js +1 -1
- package/lib/types/settings-options.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @qr-platform/qr-code-js
|
|
2
2
|
|
|
3
|
+
## 0.10.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1692491: Add metadata support (id, name, description) in QRCodeJs and QRCodeBuilder for enhanced configuration options
|
|
8
|
+
|
|
9
|
+
## 0.10.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 093f83a: Updated documentation for useSettings, setSettings, setData, useData, setOptions, useOptions methods
|
|
14
|
+
|
|
3
15
|
## 0.10.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -14,9 +14,13 @@ QRCode.js is a professional JavaScript/TypeScript library for creating customize
|
|
|
14
14
|
* **Core QR Code Generation**: Encode any text, URL, or data.
|
|
15
15
|
* **Highly Customizable:** Control dot shapes, colors, sizes, corner styles, and background.
|
|
16
16
|
* **Gradients:** Apply linear or radial gradients to dots, corners, and backgrounds.
|
|
17
|
-
* **Image Embedding:** Embed logos or other images in the center, as an overlay, or as a background.
|
|
18
|
-
* **Borders (Free & Premium):** Add basic borders (with branding in free version) or advanced, customizable borders with text/images (Premium).
|
|
17
|
+
* **Image Embedding:** Embed logos or other images in the center, as an overlay, or as a background. Control image precedence with global `QRCodeJs.setImage()` or builder `useImage()`, both supporting an `override` option.
|
|
18
|
+
* **Borders (Free & Premium):** Add basic borders (with branding in free version) or advanced, customizable borders with text/images (Premium). Control text precedence with `QRCodeJs.setText()` or builder `useText()`, both supporting an `override` option.
|
|
19
19
|
* **Flexible Border Configuration:** Set global border defaults (`setBorder`/`setBorderId`) or use the builder pattern (`useBorder`/`useBorderId`) for instance-specific borders.
|
|
20
|
+
* **Templates & Styles**: Use predefined templates and styles, or create your own for consistent branding. Apply them globally with `QRCodeJs.setTemplate()` / `QRCodeJs.setStyle()` or per-instance with the builder's `useTemplate()` / `useStyle()`.
|
|
21
|
+
* **Comprehensive Configuration:**
|
|
22
|
+
* Use `QRCodeJs.setData()`, `QRCodeJs.setOptions()`, and `QRCodeJs.setSettings()` for powerful global default configurations, with `override` options for strong precedence.
|
|
23
|
+
* Employ the builder pattern's `useData()`, `useOptions()`, and `useSettings()` for instance-specific comprehensive setups, also with `override` capabilities. `useSettings()` resets prior builder steps to establish a new baseline.
|
|
20
24
|
* **Flexible Output:** Generate QR codes as SVG elements in the browser or SVG strings in Node.js.
|
|
21
25
|
* **Download Options:** Download QR codes as SVG, PNG, JPEG, or WEBP.
|
|
22
26
|
* **TypeScript Support:** Fully typed for a better development experience.
|
|
@@ -104,8 +108,9 @@ qrCode.serialize().then(svgString => {
|
|
|
104
108
|
| `image` | URL/Buffer/Blob of image to embed. | `'logo.png'` |
|
|
105
109
|
| `imageOptions` | Options for the embedded image (size, margin). | `{ imageSize: 0.3, margin: 2 }` |
|
|
106
110
|
| `borderOptions` | **Premium.** Options for decorative borders. | `{ hasBorder: true, thickness: 20, ... }` |
|
|
111
|
+
| `SettingsOptions` | Comprehensive object for `setSettings`/`useSettings`. | `{ templateId: '...', data: '...', ...}` |
|
|
107
112
|
|
|
108
|
-
#### For a full list of options, see the [API Reference Guide](https://qr-platform.github.io/qr-code.js/docs/api-reference-guide.html).
|
|
113
|
+
#### For a full list of options and detailed explanations of `SettingsOptions`, `setData`, `setOptions`, and their builder counterparts, see the [API Reference Guide](https://qr-platform.github.io/qr-code.js/docs/api-reference-guide.html) and [Usage Guide](https://qr-platform.github.io/qr-code.js/docs/usage-guide.html).
|
|
109
114
|
|
|
110
115
|
## 🎨 Examples
|
|
111
116
|
|
|
@@ -200,13 +205,13 @@ const qrPremium = new QRCodeJs({
|
|
|
200
205
|
|
|
201
206
|
## 📚 Documentation
|
|
202
207
|
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
208
|
+
* **[Full Documentation](./docs/documentation.md#start)**: The main guide covering all features, options, and concepts.
|
|
209
|
+
* **[API Reference](./docs/api-reference-guide.md#start)**: Detailed reference for all classes, methods, and types.
|
|
210
|
+
* **[Usage Guide](./docs/usage-guide.md#start)**: Practical examples and explanations for common use cases.
|
|
211
|
+
* **[Basic Examples](./docs/examples.md#start)**: Simple examples to get started quickly.
|
|
212
|
+
* **[Advanced Examples](./docs/advanced-examples.md#start)**: Demonstrations of complex configurations and feature combinations, including `setSettings` and `useSettings`.
|
|
213
|
+
* **[License Management](./docs/license-management.md#start)**: Information on activating and managing premium features.
|
|
209
214
|
|
|
210
215
|
## 📜 License
|
|
211
216
|
|
|
212
|
-
This Software is licensed, not sold, by QR-Platform ("Licensor") for use only under the terms of this license. The source code for the Software is proprietary, confidential, and is **not** provided or licensed under this agreement. Licensor reserves all rights not expressly granted to User - see the [LICENSE](https://qr-platform.github.io/qr-code.js/LICENSE.md) file for details. Premium features require a separate commercial license from [QR-Platform](https://www.qr-platform.com).
|
|
217
|
+
This Software is licensed, not sold, by QR-Platform ("Licensor") for use only under the terms of this license. The source code for the Software is proprietary, confidential, and is **not** provided or licensed under this agreement. Licensor reserves all rights not expressly granted to User - see the [LICENSE](https://qr-platform.github.io/qr-code.js/LICENSE.md) file for details. Premium features require a separate commercial license from [QR-Platform](https://www.qr-platform.com).
|
|
@@ -375,6 +375,127 @@ QRCodeJs.setImage(null);
|
|
|
375
375
|
|
|
376
376
|
---
|
|
377
377
|
|
|
378
|
+
### Comprehensive Configuration with `SettingsOptions` (`setSettings` and `useSettings`)
|
|
379
|
+
|
|
380
|
+
Demonstrates using `QRCodeJs.setSettings()` for establishing global presets and `QRCodeJs.useSettings()` for applying comprehensive configurations within a builder chain. These methods utilize the `SettingsOptions` interface.
|
|
381
|
+
|
|
382
|
+
**Example 1: Defining and Applying a Global Preset with `QRCodeJs.setSettings()`**
|
|
383
|
+
|
|
384
|
+
`QRCodeJs.setSettings()` acts as a macro, calling other static setters like `setData()`, `setImage()`, `setTemplate()`, `setStyle()`, `setOptions()`, etc., based on the provided `SettingsOptions`. It overrides/resets previous static configurations for the aspects it covers.
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
// Define a comprehensive global preset using SettingsOptions
|
|
388
|
+
const companyGlobalPreset: SettingsOptions = {
|
|
389
|
+
name: 'CompanyStandardGlobalQR',
|
|
390
|
+
data: 'https://company.com/global-default', // Will call QRCodeJs.setData()
|
|
391
|
+
image: 'https://company.com/assets/global-logo.png', // Will call QRCodeJs.setImage()
|
|
392
|
+
templateId: 'dots', // Assumes 'dots' template exists, will call QRCodeJs.setTemplateId()
|
|
393
|
+
style: { // Will call QRCodeJs.setStyle()
|
|
394
|
+
dotsOptions: { color: '#003366' }, // Company dark blue
|
|
395
|
+
backgroundOptions: { color: '#EFEFEF' }
|
|
396
|
+
},
|
|
397
|
+
borderOptions: { // Will call QRCodeJs.setBorder()
|
|
398
|
+
hasBorder: true,
|
|
399
|
+
thickness: 12,
|
|
400
|
+
color: '#003366'
|
|
401
|
+
},
|
|
402
|
+
options: { // Will call QRCodeJs.setOptions()
|
|
403
|
+
margin: 8,
|
|
404
|
+
qrOptions: { errorCorrectionLevel: 'Q' }
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
// Apply the preset globally
|
|
409
|
+
QRCodeJs.setSettings(companyGlobalPreset);
|
|
410
|
+
|
|
411
|
+
// This QR code will inherit all settings from companyGlobalPreset
|
|
412
|
+
const qrFromGlobalSettings = new QRCodeJs({
|
|
413
|
+
// Data is inherited from companyGlobalPreset.data
|
|
414
|
+
// Image, template, style, border, margin, EC level are also inherited.
|
|
415
|
+
});
|
|
416
|
+
qrFromGlobalSettings.append(document.getElementById('global-settings-preset-container'));
|
|
417
|
+
|
|
418
|
+
// Another instance, overriding only the data from the global preset
|
|
419
|
+
const qrOverrideGlobalData = new QRCodeJs({
|
|
420
|
+
data: 'https://company.com/specific-product-page' // Overrides companyGlobalPreset.data
|
|
421
|
+
});
|
|
422
|
+
qrOverrideGlobalData.append(document.getElementById('global-settings-override-data-container'));
|
|
423
|
+
|
|
424
|
+
// Clear all global settings when done if they are not needed for subsequent QRs
|
|
425
|
+
// QRCodeJs.setSettings(null);
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
**Example 2: Using `QRCodeJs.useSettings()` in a Builder Chain**
|
|
429
|
+
|
|
430
|
+
`QRCodeBuilder.useSettings()` resets any configurations previously applied to *that builder instance* and establishes the provided `SettingsOptions` as the new baseline.
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
const eventSpecificBuilderConfig: SettingsOptions = {
|
|
434
|
+
name: 'TechConferenceBuilderQR',
|
|
435
|
+
data: 'https://techconf.example/main-schedule', // Baseline data for this builder
|
|
436
|
+
image: 'https://techconf.example/assets/event-logo-qr.png', // Baseline image
|
|
437
|
+
styleId: 'modern-dark', // Assumes 'modern-dark' style ID exists
|
|
438
|
+
text: { // Border text configuration (will be part of the baseline)
|
|
439
|
+
topValue: 'Tech Conference 2024',
|
|
440
|
+
bottomValue: 'Scan for Schedule & Info'
|
|
441
|
+
},
|
|
442
|
+
borderOptions: { // Baseline border
|
|
443
|
+
hasBorder: true,
|
|
444
|
+
thickness: 20,
|
|
445
|
+
color: '#2C3E50',
|
|
446
|
+
radius: '8px'
|
|
447
|
+
},
|
|
448
|
+
options: { // Baseline general options
|
|
449
|
+
qrOptions: { errorCorrectionLevel: 'H' },
|
|
450
|
+
isResponsive: true,
|
|
451
|
+
margin: 12
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
// Start with a base template (will be reset), apply comprehensive settings, then further customize
|
|
456
|
+
const qrEventSpecialBuilder = QRCodeJs.useTemplate('dots') // This 'dots' template will be reset by useSettings
|
|
457
|
+
.useStyle({ dotsOptions: { color: 'red' }}) // This style will also be reset
|
|
458
|
+
.useSettings(eventSpecificBuilderConfig) // Applies the full eventSpecificConfig, resetting prior builder steps
|
|
459
|
+
.useStyle({ // Further refine the style from the useSettings baseline
|
|
460
|
+
dotsOptions: { gradient: { type: 'linear', colorStops: [{offset:0, color:'#5DADE2'}, {offset:1, color:'#2E86C1'}] } }
|
|
461
|
+
})
|
|
462
|
+
.options({ // Final data override and other specific options
|
|
463
|
+
data: 'https://techconf.example/live-updates-feed', // Overrides data from eventSpecificBuilderConfig
|
|
464
|
+
margin: 6 // Overrides margin from eventSpecificBuilderConfig.options
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
qrEventSpecialBuilder.append(document.getElementById('builder-usesettings-container'));
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
**Example 3: Showcasing `overrideOpts` with Static `setData` and `setOptions`**
|
|
471
|
+
|
|
472
|
+
The `overrideOpts: { override: true }` parameter makes static settings "sticky", meaning they are harder to override by instance options or non-overriding builder methods.
|
|
473
|
+
|
|
474
|
+
```typescript
|
|
475
|
+
// Set data with override:true; it will take precedence over instance data
|
|
476
|
+
QRCodeJs.setData('https://permanent-global-link.com', { override: true });
|
|
477
|
+
|
|
478
|
+
// Set some options with override:true
|
|
479
|
+
QRCodeJs.setOptions(
|
|
480
|
+
{ dotsOptions: { type: 'star', color: 'gold' }, margin: 0, shape: 'circle' },
|
|
481
|
+
{ override: true }
|
|
482
|
+
);
|
|
483
|
+
|
|
484
|
+
const qrStaticOverridesDemo = new QRCodeJs({
|
|
485
|
+
data: 'https://this-data-is-ignored-by-instance.com', // Will use 'https://permanent-global-link.com'
|
|
486
|
+
dotsOptions: { type: 'square', color: 'black' }, // Will use star, gold (type and color overridden)
|
|
487
|
+
margin: 20, // Will use 0 (overridden)
|
|
488
|
+
shape: 'square' // Will use 'circle' (overridden)
|
|
489
|
+
});
|
|
490
|
+
qrStaticOverridesDemo.append(document.getElementById('static-override-example-container'));
|
|
491
|
+
|
|
492
|
+
// Clear static settings when done to avoid affecting other examples
|
|
493
|
+
QRCodeJs.setData(null); // This clears the override as well
|
|
494
|
+
QRCodeJs.setOptions(null); // This clears the override as well
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
378
499
|
### Border Options and Decorations (Premium Feature)
|
|
379
500
|
|
|
380
501
|
Uses premium border features for advanced styling and text. Requires a license.
|
|
@@ -387,10 +508,13 @@ Uses premium border features for advanced styling and text. Requires a license.
|
|
|
387
508
|
|
|
388
509
|
// Setting global text with override that will take precedence
|
|
389
510
|
// even over text specified in instance options
|
|
390
|
-
QRCodeJs.setText(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
511
|
+
QRCodeJs.setText(
|
|
512
|
+
{
|
|
513
|
+
topValue: 'GLOBAL OVERRIDE TEXT',
|
|
514
|
+
bottomValue: 'PRIORITY FOOTER TEXT'
|
|
515
|
+
},
|
|
516
|
+
{ override: true } // MethodOverrideOptions
|
|
517
|
+
);
|
|
394
518
|
|
|
395
519
|
// Even when an instance specifies border text, the global one with override will be used
|
|
396
520
|
const qrTextOverride = new QRCodeJs({
|
|
@@ -414,10 +538,13 @@ const qrTextOverride = new QRCodeJs({
|
|
|
414
538
|
qrTextOverride.append(document.getElementById('text-override-container'));
|
|
415
539
|
|
|
416
540
|
// Using the builder pattern with text override
|
|
417
|
-
const qrBuilderTextOverride = QRCodeJs.useText(
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
541
|
+
const qrBuilderTextOverride = QRCodeJs.useText(
|
|
542
|
+
{
|
|
543
|
+
leftValue: 'LEFT OVERRIDE TEXT',
|
|
544
|
+
rightValue: 'RIGHT OVERRIDE TEXT'
|
|
545
|
+
},
|
|
546
|
+
{ override: true } // MethodOverrideOptions
|
|
547
|
+
)
|
|
421
548
|
.options({
|
|
422
549
|
data: 'https://example.com/builder-text-override-example',
|
|
423
550
|
borderOptions: {
|
|
@@ -90,22 +90,26 @@ qrCode.append(document.getElementById('qr-container'));
|
|
|
90
90
|
| `setTemplateId` | `templateId: string` | Sets a global default template by its ID. Returns `void`. |
|
|
91
91
|
| `setStyle` | `styleNameOrOptions: string \| StyleOptions` | Sets a global default style (by name or options object) for subsequent instances. Returns `void`. |
|
|
92
92
|
| `setStyleId` | `styleId: string` | Sets a global default style by its ID. Returns `void`. |
|
|
93
|
-
| `setText` | `textNameOrOptions: string \| TextOptions \| null,
|
|
94
|
-
| `setTextId` | `textId: string \| null,
|
|
93
|
+
| `setText` | `textNameOrOptions: string \| TextOptions \| null, overrideOpts?: MethodOverrideOptions` | Sets a global default text configuration for border text. With `{ override: true }`, the text will take precedence over any instance-specific border text. Returns `void`. |
|
|
94
|
+
| `setTextId` | `textId: string \| null, overrideOpts?: MethodOverrideOptions` | Sets a global default text configuration by its ID. With `{ override: true }`, the text will take precedence over any instance-specific border text. Returns `void`. |
|
|
95
95
|
| `setBorder` | `borderNameOrOptions: string \| RecursivePartial<BorderOptions>` | Sets a global default border configuration (by name or options object) for subsequent instances. Returns `void`. |
|
|
96
96
|
| `setBorderId` | `borderId: string` | Sets a global default border configuration by its ID. Returns `void`. |
|
|
97
|
-
| `setImage` | `imageUrl: string \| DataURL \| null,
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
97
|
+
| `setImage` | `imageUrl: string \| DataURL \| null, overrideOpts?: MethodOverrideOptions` | Sets a global default image URL for subsequent instances. With `{ override: true }`, the image will take precedence over any instance-specific images. Returns `typeof QRCodeJs`. |
|
|
98
|
+
| `setData` | `data: string \| null, overrideOpts?: MethodOverrideOptions` | **(Static)** Sets a global default data string for subsequent `QRCodeJs` instances. If `overrideOpts.override` is `true`, this data will take precedence over data set by other means (e.g., in constructor options or through `useData` without override). Returns `typeof QRCodeJs`. |
|
|
99
|
+
| `setOptions` | `options: RecursivePartial<Options> \| null, overrideOpts?: MethodOverrideOptions` | **(Static)** Sets global default options for subsequent `QRCodeJs` instances. These are merged deeply with other defaults and instance-specific options. If `overrideOpts.override` is `true`, these options take higher precedence over options set by other means for the properties they cover. Returns `typeof QRCodeJs`. |
|
|
100
|
+
| `setSettings` | `settings: SettingsOptions \| null` | **(Static)** Sets multiple global defaults at once using a comprehensive `SettingsOptions` object. This acts as a macro, internally calling other static setters (like `setTemplate`, `setStyle`, `setData`, `setImage`, `setOptions`, etc.) based on the properties provided in the `settings` object. It will override/reset any previously set static configurations for the aspects it covers. Passing `null` clears all static configurations. Returns `typeof QRCodeJs`. |
|
|
100
101
|
| `useTemplate` | `templateNameOrOptions: string \| RecursivePartial<Options>` | Initiates a builder pattern pre-configured with a template (by name or options object). Returns `QRCodeBuilder`. |
|
|
101
102
|
| `useTemplateId` | `templateId: string` | Initiates a builder pattern pre-configured with a template by its ID. Returns `QRCodeBuilder`. |
|
|
102
103
|
| `useStyle` | `styleNameOrOptions: string \| StyleOptions` | Initiates a builder pattern pre-configured with a style (by name or options object). Returns `QRCodeBuilder`. |
|
|
103
104
|
| `useStyleId` | `styleId: string` | Initiates a builder pattern pre-configured with a style by its ID. Returns `QRCodeBuilder`. |
|
|
104
|
-
| `useText` | `textNameOrOptions: string \| TextOptions,
|
|
105
|
-
| `useTextId` | `textId: string,
|
|
105
|
+
| `useText` | `textNameOrOptions: string \| TextOptions, overrideOpts?: MethodOverrideOptions` | Initiates a builder pattern pre-configured with text for border sides. With `{ override: true }`, the text will take precedence over any text set in final options. Returns `QRCodeBuilder`. |
|
|
106
|
+
| `useTextId` | `textId: string, overrideOpts?: MethodOverrideOptions` | Initiates a builder pattern pre-configured with text by its ID. With `{ override: true }`, the text will take precedence over any text set in final options. Returns `QRCodeBuilder`. |
|
|
106
107
|
| `useBorder` | `borderNameOrOptions: string \| BorderOptions` | Initiates a builder pattern pre-configured with a border configuration (by name or options object). Returns `QRCodeBuilder`. |
|
|
107
108
|
| `useBorderId` | `borderId: string` | Initiates a builder pattern pre-configured with a border configuration by its ID. Returns `QRCodeBuilder`. |
|
|
108
|
-
| `useImage` | `imageUrl: string \| DataURL,
|
|
109
|
+
| `useImage` | `imageUrl: string \| DataURL, overrideOpts?: MethodOverrideOptions` | Initiates a builder pattern pre-configured with an image URL. If `overrideOpts.override` is `true`, this image will take precedence over any image set in the final `.options()` call or by other non-overriding builder methods. Returns `QRCodeBuilder`. |
|
|
110
|
+
| `useData` | `data: string, overrideOpts?: MethodOverrideOptions` | Applies a data string to the current builder configuration. If `overrideOpts.override` is `true`, this data will take precedence over data provided in the final `.options()` call or by other non-overriding builder methods. Returns `QRCodeBuilder`. |
|
|
111
|
+
| `useOptions` | `options: RecursivePartial<Options>, overrideOpts?: MethodOverrideOptions` | Applies a partial options object to the current builder configuration. If `overrideOpts.override` is `true`, these options take higher precedence over options provided in the final `.options()` call or by other non-overriding builder methods for the properties they cover. Returns `QRCodeBuilder`. |
|
|
112
|
+
| `useSettings` | `settings: SettingsOptions` | Applies a comprehensive `SettingsOptions` object as a new baseline for the builder chain. This will **reset** any configurations previously applied to *that builder instance* via methods like `useTemplate()`, `useStyle()`, `useData()`, `useOptions()`, etc. Subsequent builder methods will modify this new baseline. Returns `QRCodeBuilder`. |
|
|
109
113
|
| `validateScanning` | `validatorId?: string, debug?: boolean` | **(Premium method)** Validates that the QR code is scannable. Returns `Promise<ScanValidatorResponse>`. |
|
|
110
114
|
|
|
111
115
|
---
|
|
@@ -298,13 +302,15 @@ const qr3 = QRCodeJs.useTemplate('basic')
|
|
|
298
302
|
| :------------ | :------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------- |
|
|
299
303
|
| `useTemplate` | `templateNameOrOptions: string \| RecursivePartial<Options>` | Applies a template's options to the current configuration. Options from subsequent calls take precedence. Returns `this`. |
|
|
300
304
|
| `useStyle` | `styleNameOrOptions: string \| StyleOptions` | Applies style options (mapping them to `Options`) to the current configuration. Returns `this`. |
|
|
301
|
-
| `useText` | `textNameOrOptions: string \| TextOptions,
|
|
302
|
-
| `useTextId` | `textId: string,
|
|
305
|
+
| `useText` | `textNameOrOptions: string \| TextOptions, overrideOpts?: MethodOverrideOptions` | Applies text configuration for border sides. With `{ override: true}`, text will take precedence over any text set in final options. Returns `this`. |
|
|
306
|
+
| `useTextId` | `textId: string, overrideOpts?: MethodOverrideOptions` | Applies text configuration by its ID. With `{ override: true}`, text will take precedence over any text set in final options. Returns `this`. |
|
|
303
307
|
| `useBorder` | `borderNameOrOptions: string \| BorderOptions` | Applies border configuration (by name or options object) to the current configuration. Returns `this`. |
|
|
304
308
|
| `useBorderId` | `borderId: string` | Applies border configuration by its ID to the current configuration. Returns `this`. |
|
|
305
|
-
| `useImage` | `imageUrl: string,
|
|
306
|
-
| `
|
|
307
|
-
| `
|
|
309
|
+
| `useImage` | `imageUrl: string, overrideOpts?: MethodOverrideOptions` | Sets the image URL for the current configuration. If `overrideOpts.override` is `true`, this image will take precedence over any image set in the final `.options()` call. Returns `this`. |
|
|
310
|
+
| `useData` | `data: string, overrideOpts?: MethodOverrideOptions` | Applies a data string to the current builder configuration. If `overrideOpts.override` is `true`, this data will take precedence over data provided in the final `.options()` call. Returns `this`. |
|
|
311
|
+
| `useOptions` | `options: RecursivePartial<Options>, overrideOpts?: MethodOverrideOptions` | Applies a partial options object to the current builder configuration. If `overrideOpts.override` is `true`, these options take higher precedence over options provided in the final `.options()` call for the properties they cover. Returns `this`. |
|
|
312
|
+
| `useSettings` | `settings: SettingsOptions` | Applies a comprehensive `SettingsOptions` object as a new baseline for the builder chain. This will **reset** any configurations previously applied to *that builder instance* via other `use` methods. Subsequent builder methods modify this new baseline. Returns `this`. |
|
|
313
|
+
| `options` | `options: RecursivePartial<Options>` | Merges the provided `Options` into the current configuration and creates and returns the final `QRCodeJs` instance. |
|
|
308
314
|
| `build` | - | Creates and returns the final `QRCodeJs` instance based on the accumulated configuration. |
|
|
309
315
|
### See Also
|
|
310
316
|
- [QRCode.js Documentation](./documentation.md#start)
|