taro-bluetooth-print 2.5.0 → 2.6.0

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/logo.svg ADDED
@@ -0,0 +1,17 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
2
+ <!-- Background circle -->
3
+ <circle cx="32" cy="32" r="30" fill="#10b981" opacity="0.1"/>
4
+ <circle cx="32" cy="32" r="28" fill="#10b981" opacity="0.2"/>
5
+ <!-- Printer body -->
6
+ <rect x="12" y="20" width="40" height="28" rx="4" fill="#10b981"/>
7
+ <!-- Paper slot -->
8
+ <rect x="16" y="8" width="32" height="16" rx="2" fill="#ffffff" stroke="#10b981" stroke-width="2"/>
9
+ <!-- Paper lines -->
10
+ <line x1="20" y1="14" x2="36" y2="14" stroke="#10b981" stroke-width="2" stroke-linecap="round"/>
11
+ <line x1="20" y1="18" x2="30" y2="18" stroke="#10b981" stroke-width="2" stroke-linecap="round"/>
12
+ <!-- Bluetooth symbol -->
13
+ <path d="M32 26 L36 30 L32 34 L28 30 Z" fill="#ffffff"/>
14
+ <line x1="32" y1="30" x2="32" y2="38" stroke="#ffffff" stroke-width="2" stroke-linecap="round"/>
15
+ <!-- Feed button -->
16
+ <rect x="46" y="36" width="4" height="6" rx="1" fill="#ffffff" opacity="0.6"/>
17
+ </svg>
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "taro-bluetooth-print",
3
+ "short_name": "蓝牙打印",
4
+ "description": "轻量级、高性能的热敏/标签蓝牙打印库",
5
+ "start_url": "/taro-bluetooth-print/",
6
+ "display": "standalone",
7
+ "background_color": "#ffffff",
8
+ "theme_color": "#10b981",
9
+ "icons": [
10
+ {
11
+ "src": "/logo.svg",
12
+ "sizes": "any",
13
+ "type": "image/svg+xml"
14
+ }
15
+ ],
16
+ "categories": ["developer tools", "utilities"]
17
+ }
@@ -12,6 +12,47 @@ export interface WebBluetoothRequestOptions {
12
12
  acceptAllDevices?: boolean;
13
13
  /** Optional services to access */
14
14
  optionalServices?: string[];
15
+ /** Minimum RSSI signal strength (dBm) to accept device */
16
+ minRSSI?: number;
17
+ /** Filter by device name (exact or partial match) */
18
+ name?: string;
19
+ /** Filter by manufacturer data patterns */
20
+ manufacturerDataFilter?: Array<{
21
+ companyIdentifier: number;
22
+ dataPrefix?: Uint8Array;
23
+ }>;
24
+ }
25
+ /**
26
+ * Discovered device information
27
+ */
28
+ export interface DiscoveredDevice {
29
+ /** Device instance */
30
+ device: BluetoothDevice;
31
+ /** Device name */
32
+ name: string;
33
+ /** Device ID */
34
+ deviceId: string;
35
+ /** RSSI signal strength (dBm) */
36
+ rssi?: number;
37
+ /** Timestamp when device was discovered */
38
+ discoveredAt: number;
39
+ /** Manufacturer data if available */
40
+ manufacturerData?: Map<number, Uint8Array>;
41
+ }
42
+ /**
43
+ * Device filter options for scanning
44
+ */
45
+ export interface DeviceFilterOptions {
46
+ /** Minimum RSSI threshold (dBm) */
47
+ minRSSI?: number;
48
+ /** Maximum RSSI threshold (dBm) */
49
+ maxRSSI?: number;
50
+ /** Name prefix filter */
51
+ namePrefix?: string;
52
+ /** Name exact match filter */
53
+ name?: string;
54
+ /** Service UUIDs to filter */
55
+ serviceUUIDs?: string[];
15
56
  }
16
57
  /**
17
58
  * Web Bluetooth adapter for H5 environment
@@ -29,6 +70,8 @@ export interface WebBluetoothRequestOptions {
29
70
  */
30
71
  export declare class WebBluetoothAdapter extends BaseAdapter {
31
72
  private devices;
73
+ private discoveredDevices;
74
+ private connectionCleanupTimeout;
32
75
  /**
33
76
  * Check if Web Bluetooth API is supported in the current browser
34
77
  * @returns True if Web Bluetooth is supported
@@ -52,10 +95,12 @@ export declare class WebBluetoothAdapter extends BaseAdapter {
52
95
  connect(deviceId: string): Promise<void>;
53
96
  /**
54
97
  * Disconnect from a Bluetooth device
98
+ * Enhanced to properly clean up all resources and event listeners
55
99
  *
56
100
  * @param deviceId - Bluetooth device ID
101
+ * @param force - If true, force disconnection even if device not found in cache
57
102
  */
58
- disconnect(deviceId: string): Promise<void>;
103
+ disconnect(deviceId: string, force?: boolean): void;
59
104
  /**
60
105
  * Write data to the Bluetooth device
61
106
  *
@@ -65,6 +110,42 @@ export declare class WebBluetoothAdapter extends BaseAdapter {
65
110
  * @throws {BluetoothPrintError} When write fails
66
111
  */
67
112
  write(deviceId: string, buffer: ArrayBuffer, options?: IAdapterOptions): Promise<void>;
113
+ /**
114
+ * Get device ID from a BluetoothDevice instance
115
+ * Handles different browser implementations
116
+ *
117
+ * @param device - BluetoothDevice instance
118
+ * @returns Device ID string
119
+ */
120
+ getDeviceId(device: BluetoothDevice): string;
121
+ /**
122
+ * Get device information including RSSI
123
+ *
124
+ * @param deviceId - Bluetooth device ID
125
+ * @returns Device info object with RSSI and metadata
126
+ */
127
+ getDeviceInfo(deviceId: string): {
128
+ deviceId: string;
129
+ name: string;
130
+ rssi?: number;
131
+ connected: boolean;
132
+ } | null;
133
+ /**
134
+ * Filter discovered devices by criteria
135
+ *
136
+ * @param devices - Array of discovered devices
137
+ * @param filter - Filter criteria
138
+ * @returns Filtered array of devices
139
+ */
140
+ filterDevices(devices: DiscoveredDevice[], filter: DeviceFilterOptions): DiscoveredDevice[];
141
+ /**
142
+ * Sort devices by signal strength (RSSI)
143
+ *
144
+ * @param devices - Array of discovered devices
145
+ * @param ascending - Sort in ascending order (weakest first), default false (strongest first)
146
+ * @returns Sorted array
147
+ */
148
+ sortByRSSI(devices: DiscoveredDevice[], ascending?: boolean): DiscoveredDevice[];
68
149
  /**
69
150
  * Build request options for navigator.bluetooth.requestDevice
70
151
  */
@@ -89,4 +170,9 @@ export declare class WebBluetoothAdapter extends BaseAdapter {
89
170
  * Clean up device information
90
171
  */
91
172
  private cleanupDeviceInfo;
173
+ /**
174
+ * Generate a fallback device ID when device.id is not available
175
+ * Uses device name + first seen timestamp as identifier
176
+ */
177
+ private generateFallbackDeviceId;
92
178
  }
@@ -2,7 +2,7 @@
2
2
  * Adapters barrel export
3
3
  */
4
4
  export { BaseAdapter, MiniProgramAdapter } from './BaseAdapter';
5
- export type { MiniProgramBLEApi, ServiceInfo, BLECharacteristic, BLECharacteristicProperties } from './BaseAdapter';
5
+ export type { MiniProgramBLEApi, ServiceInfo, BLECharacteristic, BLECharacteristicProperties, } from './BaseAdapter';
6
6
  export { TaroAdapter } from './TaroAdapter';
7
7
  export { AlipayAdapter } from './AlipayAdapter';
8
8
  export { BaiduAdapter } from './BaiduAdapter';
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Barcode Generator
3
3
  *
4
- * Generates ESC/POS commands for printing 1D barcodes.
5
- * Supports Code128, Code39, EAN-13, EAN-8, UPC-A, ITF, and CODABAR formats.
4
+ * Generates ESC/POS commands for printing 1D barcodes and 2D codes.
5
+ * Supports Code128, Code39, EAN-13, EAN-8, UPC-A, ITF, CODABAR, QR_CODE, and PDF417 formats.
6
6
  *
7
7
  * @example
8
8
  * ```typescript
@@ -31,7 +31,11 @@ export declare enum BarcodeFormat {
31
31
  /** ITF (Interleaved 2 of 5) - Even number of digits */
32
32
  ITF = "ITF",
33
33
  /** CODABAR - Numeric with special start/stop chars */
34
- CODABAR = "CODABAR"
34
+ CODABAR = "CODABAR",
35
+ /** QR Code - 2D matrix code */
36
+ QR_CODE = "QR_CODE",
37
+ /** PDF417 - 2D stacked barcode */
38
+ PDF417 = "PDF417"
35
39
  }
36
40
  /**
37
41
  * Barcode configuration options
@@ -47,6 +51,16 @@ export interface BarcodeOptions {
47
51
  showText?: boolean;
48
52
  /** Text position */
49
53
  textPosition?: 'above' | 'below' | 'both' | 'none';
54
+ /** QR code error correction level (L/M/Q/H, default: M) */
55
+ errorCorrection?: 'L' | 'M' | 'Q' | 'H';
56
+ /** QR code model (1 or 2, default: 2) */
57
+ qrModel?: 1 | 2;
58
+ /** PDF417 compression mode (0-3, default: 2) */
59
+ pdf417Compression?: 0 | 1 | 2 | 3;
60
+ /** PDF417 security level (0-8, default: 2) */
61
+ pdf417Security?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
62
+ /** PDF417 columns (1-30, default: 2) */
63
+ pdf417Columns?: number;
50
64
  }
51
65
  /**
52
66
  * Validation result
@@ -74,7 +88,7 @@ export interface IBarcodeGenerator {
74
88
  }
75
89
  /**
76
90
  * Barcode Generator class
77
- * Generates ESC/POS commands for 1D barcodes
91
+ * Generates ESC/POS commands for 1D barcodes and 2D codes
78
92
  */
79
93
  export declare class BarcodeGenerator implements IBarcodeGenerator {
80
94
  /**
@@ -85,6 +99,29 @@ export declare class BarcodeGenerator implements IBarcodeGenerator {
85
99
  * @returns Array of ESC/POS command buffers
86
100
  */
87
101
  generate(content: string, options: BarcodeOptions): Uint8Array[];
102
+ /**
103
+ * Generate 1D barcode commands
104
+ */
105
+ private generate1DBarcode;
106
+ /**
107
+ * Generate QR code commands using ESC/POS GS k 80-83
108
+ *
109
+ * @param content - QR code content
110
+ * @param options - QR code options
111
+ * @returns Array of ESC/POS command buffers
112
+ */
113
+ private generateQRCode;
114
+ /**
115
+ * Generate PDF417 commands using ESC/POS GS k 81
116
+ *
117
+ * PDF417 is a 2D stacked barcode format supported by many thermal printers.
118
+ * The printer will handle the actual encoding and generation of the PDF417 symbol.
119
+ *
120
+ * @param content - PDF417 content (text data)
121
+ * @param options - PDF417 options
122
+ * @returns Array of ESC/POS command buffers
123
+ */
124
+ private generatePDF417;
88
125
  /**
89
126
  * Validate barcode content for the specified format
90
127
  *
@@ -93,6 +130,14 @@ export declare class BarcodeGenerator implements IBarcodeGenerator {
93
130
  * @returns Validation result
94
131
  */
95
132
  validate(content: string, format: BarcodeFormat): ValidationResult;
133
+ /**
134
+ * Validate QR code content
135
+ */
136
+ private validateQRCode;
137
+ /**
138
+ * Validate PDF417 content
139
+ */
140
+ private validatePDF417;
96
141
  /**
97
142
  * Get list of supported barcode formats
98
143
  *
@@ -139,6 +184,10 @@ export declare class BarcodeGenerator implements IBarcodeGenerator {
139
184
  * Encode content for ESC/POS barcode command
140
185
  */
141
186
  private encodeContent;
187
+ /**
188
+ * Encode string to UTF-8 bytes
189
+ */
190
+ private encodeUTF8;
142
191
  /**
143
192
  * Get text position code
144
193
  */
@@ -151,5 +200,13 @@ export declare class BarcodeGenerator implements IBarcodeGenerator {
151
200
  * Clamp width to valid range (2-6)
152
201
  */
153
202
  private clampWidth;
203
+ /**
204
+ * Clamp QR code size to valid range (1-16)
205
+ */
206
+ private clampQRSize;
207
+ /**
208
+ * Clamp PDF417 columns to valid range (1-30)
209
+ */
210
+ private clampPDF417Columns;
154
211
  }
155
212
  export declare const barcodeGenerator: BarcodeGenerator;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Barcode Generator Module
3
- * 条码生成模块 - 负责一维条码生成
3
+ * 条码生成模块 - 负责一维条码和二维条码生成
4
4
  */
5
5
  export { BarcodeGenerator, barcodeGenerator, BarcodeFormat } from './BarcodeGenerator';
6
6
  export type { BarcodeOptions, ValidationResult, IBarcodeGenerator } from './BarcodeGenerator';
@@ -69,6 +69,117 @@ export interface LabelData {
69
69
  productionDate?: string;
70
70
  expiryDate?: string;
71
71
  }
72
+ /**
73
+ * Loop element for iterating over arrays
74
+ */
75
+ export interface LoopElement {
76
+ /** Element type identifier */
77
+ type: 'loop';
78
+ /** Variable name to iterate over (array) */
79
+ items: string;
80
+ /** Item variable name for each iteration */
81
+ itemVar: string;
82
+ /** Index variable name (optional) */
83
+ indexVar?: string;
84
+ /** Template elements to render for each item */
85
+ elements: TemplateElement[];
86
+ /** Separator between iterations (optional) */
87
+ separator?: string;
88
+ }
89
+ /**
90
+ * Condition element for conditional rendering
91
+ */
92
+ export interface ConditionElement {
93
+ /** Element type identifier */
94
+ type: 'condition';
95
+ /** Variable name to evaluate */
96
+ variable: string;
97
+ /** Operator for comparison */
98
+ operator: 'exists' | 'not_exists' | 'equals' | 'not_equals' | 'gt' | 'gte' | 'lt' | 'lte' | 'truthy' | 'falsy';
99
+ /** Value to compare against (for binary operators) */
100
+ value?: unknown;
101
+ /** Elements to render when condition is true */
102
+ then: TemplateElement[];
103
+ /** Elements to render when condition is false (optional) */
104
+ else?: TemplateElement[];
105
+ }
106
+ /**
107
+ * Border style for box/table drawing
108
+ */
109
+ export type BorderStyle = 'single' | 'double' | 'thick' | 'rounded' | 'dashed' | 'none';
110
+ /**
111
+ * Border element for drawing boxes/lines
112
+ */
113
+ export interface BorderElement {
114
+ /** Element type identifier */
115
+ type: 'border';
116
+ /** Border style */
117
+ style?: BorderStyle;
118
+ /** Top-left corner character */
119
+ topLeft?: string;
120
+ /** Top-right corner character */
121
+ topRight?: string;
122
+ /** Bottom-left corner character */
123
+ bottomLeft?: string;
124
+ /** Bottom-right corner character */
125
+ bottomRight?: string;
126
+ /** Top border character */
127
+ top?: string;
128
+ /** Bottom border character */
129
+ bottom?: string;
130
+ /** Left border character */
131
+ left?: string;
132
+ /** Right border character */
133
+ right?: string;
134
+ /** Intersection character */
135
+ cross?: string;
136
+ /** Whether to draw top border */
137
+ drawTop?: boolean;
138
+ /** Whether to draw bottom border */
139
+ drawBottom?: boolean;
140
+ /** Whether to draw left border */
141
+ drawLeft?: boolean;
142
+ /** Whether to draw right border */
143
+ drawRight?: boolean;
144
+ /** Whether to fill inside with spaces */
145
+ filled?: boolean;
146
+ /** Inner padding (default: 0) */
147
+ padding?: number;
148
+ }
149
+ /**
150
+ * Table column definition
151
+ */
152
+ export interface TableColumn {
153
+ /** Column header text */
154
+ header: string;
155
+ /** Width of column in characters */
156
+ width: number;
157
+ /** Text alignment for header */
158
+ headerAlign?: TextAlign;
159
+ /** Text alignment for cells */
160
+ cellAlign?: TextAlign;
161
+ }
162
+ /**
163
+ * Table row data
164
+ */
165
+ export type TableRowData = Record<string, string | number>;
166
+ /**
167
+ * Table element for drawing table-like structures
168
+ */
169
+ export interface TableElement {
170
+ /** Element type identifier */
171
+ type: 'table';
172
+ /** Table columns definition */
173
+ columns: TableColumn[];
174
+ /** Variable name of array to render as rows */
175
+ rowsVar: string;
176
+ /** Whether to draw header row */
177
+ showHeader?: boolean;
178
+ /** Border style for table */
179
+ borderStyle?: BorderStyle;
180
+ /** Whether to alternate row shading */
181
+ alternateRows?: boolean;
182
+ }
72
183
  /**
73
184
  * Template element types
74
185
  */
@@ -103,7 +214,7 @@ export type TemplateElement = {
103
214
  type: 'variable';
104
215
  name: string;
105
216
  format?: string;
106
- };
217
+ } | LoopElement | ConditionElement | BorderElement | TableElement;
107
218
  /**
108
219
  * Template definition
109
220
  */
@@ -177,6 +288,34 @@ export declare class TemplateEngine implements ITemplateEngine {
177
288
  * Render a single template element
178
289
  */
179
290
  private renderElement;
291
+ /**
292
+ * Render a loop element
293
+ */
294
+ private renderLoop;
295
+ /**
296
+ * Render a condition element
297
+ */
298
+ private renderCondition;
299
+ /**
300
+ * Evaluate a condition
301
+ */
302
+ private evaluateCondition;
303
+ /**
304
+ * Render a border element
305
+ */
306
+ private renderBorder;
307
+ /**
308
+ * Render a table element
309
+ */
310
+ private renderTable;
311
+ /**
312
+ * Align text within a specified width
313
+ */
314
+ private alignText;
315
+ /**
316
+ * Render standard elements (text, line, image, qrcode, barcode, feed, variable)
317
+ */
318
+ private renderStandardElement;
180
319
  /**
181
320
  * Render a separator line
182
321
  */
@@ -0,0 +1,191 @@
1
+ /**
2
+ * UUID Utility Module
3
+ *
4
+ * Provides UUID generation and parsing utilities for device identification,
5
+ * job tracking, and unique identifier generation.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { generateUUID, parseUUID, isValidUUID } from '@/utils/uuid';
10
+ *
11
+ * const id = generateUUID(); // v4 UUID
12
+ * const parsed = parseUUID(id);
13
+ * const valid = isValidUUID(id);
14
+ * ```
15
+ */
16
+ /**
17
+ * UUID version numbers
18
+ */
19
+ export declare enum UUIDVersion {
20
+ /** Version 1: Timestamp-based */
21
+ V1 = 1,
22
+ /** Version 4: Random */
23
+ V4 = 4,
24
+ /** Version 7: Unix Epoch time-based (recommended) */
25
+ V7 = 7
26
+ }
27
+ /**
28
+ * Parsed UUID structure
29
+ */
30
+ export interface ParsedUUID {
31
+ /** Raw UUID string */
32
+ raw: string;
33
+ /** UUID version */
34
+ version: UUIDVersion;
35
+ /** Variant bits */
36
+ variant: number;
37
+ /** Time component (for V1, V7) in milliseconds since epoch */
38
+ timestamp?: number;
39
+ /** Node identifier bytes (for V1) */
40
+ node?: string;
41
+ /** Random bytes (for V4) */
42
+ random?: string;
43
+ /** Whether the UUID is valid */
44
+ valid: boolean;
45
+ }
46
+ /**
47
+ * UUID format options
48
+ */
49
+ export interface UUIDOptions {
50
+ /** Uppercase hex output */
51
+ uppercase?: boolean;
52
+ /** Include hyphens (default: true) */
53
+ hyphenated?: boolean;
54
+ /** UUID version to generate (default: V4) */
55
+ version?: UUIDVersion;
56
+ }
57
+ /**
58
+ * UUID validation result
59
+ */
60
+ export interface UUIDValidationResult {
61
+ /** Whether the UUID is valid */
62
+ valid: boolean;
63
+ /** Version of the UUID if valid */
64
+ version?: UUIDVersion;
65
+ /** Error message if invalid */
66
+ error?: string;
67
+ }
68
+ /**
69
+ * UUID namespace for generating namespaced UUIDs (V5)
70
+ */
71
+ export interface UUIDNamespace {
72
+ /** Namespace UUID */
73
+ uuid: string;
74
+ /** Namespace name */
75
+ name: string;
76
+ }
77
+ /**
78
+ * Predefined namespaces for namespaced UUIDs (RFC 4122)
79
+ */
80
+ export declare const UUID_NAMESPACES: Record<string, UUIDNamespace>;
81
+ /**
82
+ * Generate a random UUID
83
+ *
84
+ * @param version - UUID version to generate (default: V4)
85
+ * @param options - Generation options
86
+ * @returns Generated UUID string
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * const uuid = generateUUID();
91
+ * const uuidV7 = generateUUID(UUIDVersion.V7, { uppercase: true });
92
+ * ```
93
+ */
94
+ export declare function generateUUID(version?: UUIDVersion, options?: UUIDOptions): string;
95
+ /**
96
+ * Parse a UUID string into its components
97
+ *
98
+ * @param uuid - UUID string to parse
99
+ * @returns Parsed UUID structure
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * const parsed = parseUUID('550e8400-e29b-41d4-a716-446655440000');
104
+ * console.log(parsed.version); // 4
105
+ * console.log(parsed.valid); // true
106
+ * ```
107
+ */
108
+ export declare function parseUUID(uuid: string): ParsedUUID;
109
+ /**
110
+ * Validate a UUID string
111
+ *
112
+ * @param uuid - UUID string to validate
113
+ * @returns Validation result
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * const result = isValidUUID('550e8400-e29b-41d4-a716-446655440000');
118
+ * if (result.valid) {
119
+ * console.log(`Valid UUID v${result.version}`);
120
+ * }
121
+ * ```
122
+ */
123
+ export declare function isValidUUID(uuid: string): UUIDValidationResult;
124
+ /**
125
+ * Extract timestamp from a time-based UUID (v1 or v7)
126
+ *
127
+ * @param uuid - UUID string
128
+ * @returns Timestamp in milliseconds, or null if not a time-based UUID
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * const timestamp = getUUIDTimestamp('07c450b0-7d4a-11ed-a1eb-0242ac120002');
133
+ * console.log(new Date(timestamp ?? 0));
134
+ * ```
135
+ */
136
+ export declare function getUUIDTimestamp(uuid: string): number | null;
137
+ /**
138
+ * Compare two UUIDs chronologically (for time-based UUIDs)
139
+ *
140
+ * @param uuidA - First UUID
141
+ * @param uuidB - Second UUID
142
+ * @returns -1 if A < B, 0 if equal, 1 if A > B
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * const order = compareUUIDs(uuid1, uuid2);
147
+ * ```
148
+ */
149
+ export declare function compareUUIDs(uuidA: string, uuidB: string): number;
150
+ /**
151
+ * Convert UUID to bytes (Uint8Array)
152
+ *
153
+ * @param uuid - UUID string
154
+ * @returns UUID as 16-byte array
155
+ */
156
+ export declare function uuidToBytes(uuid: string): Uint8Array;
157
+ /**
158
+ * Convert bytes to UUID string
159
+ *
160
+ * @param bytes - 16-byte array
161
+ * @param hyphenated - Include hyphens (default: true)
162
+ * @returns UUID string
163
+ */
164
+ export declare function bytesToUUID(bytes: Uint8Array, hyphenated?: boolean): string;
165
+ /**
166
+ * Generate a short ID (8-12 character hex string)
167
+ * Useful for display purposes like job IDs
168
+ *
169
+ * @param length - Length of ID (default: 8)
170
+ * @returns Short hex ID
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * const shortId = generateShortId(8); // e.g., 'a3f2b1c9'
175
+ * ```
176
+ */
177
+ export declare function generateShortId(length?: number): string;
178
+ /**
179
+ * Generate a namespaced UUID (v5)
180
+ *
181
+ * @param namespace - Namespace UUID
182
+ * @param name - Name within namespace
183
+ * @param options - Generation options
184
+ * @returns Namespaced UUID
185
+ *
186
+ * @example
187
+ * ```typescript
188
+ * const uuid = generateNamespacedUUID(UUID_NAMESPACES.NAMESPACE_DNS, 'example.com');
189
+ * ```
190
+ */
191
+ export declare function generateNamespacedUUID(namespace: string, name: string, options?: UUIDOptions): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taro-bluetooth-print",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "Taro 蓝牙打印库 v2.4 - 轻量级、高性能、跨平台支持微信、支付宝、百度、字节跳动小程序及H5 Web Bluetooth",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",