taro-bluetooth-print 2.8.4 → 2.9.1

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +53 -4
  3. package/dist/index.cjs.js +1 -1
  4. package/dist/index.es.js +1 -1
  5. package/dist/index.umd.js +1 -1
  6. package/dist/types/core/BluetoothPrinter.d.ts +21 -4
  7. package/dist/types/core/di/Container.d.ts +84 -0
  8. package/dist/types/core/di/Tokens.d.ts +29 -0
  9. package/dist/types/core/di/index.d.ts +3 -0
  10. package/dist/types/core/event/EventBus.d.ts +66 -0
  11. package/dist/types/core/event/index.d.ts +2 -0
  12. package/dist/types/core/index.d.ts +5 -4
  13. package/dist/types/core/plugin/PluginManager.d.ts +64 -0
  14. package/dist/types/core/plugin/index.d.ts +2 -0
  15. package/dist/types/device/MultiPrinterManager.d.ts +2 -0
  16. package/dist/types/errors/CommandBuildError.d.ts +40 -0
  17. package/dist/types/errors/ConnectionError.d.ts +45 -0
  18. package/dist/types/errors/PrintJobError.d.ts +42 -0
  19. package/dist/types/errors/index.d.ts +9 -0
  20. package/dist/types/factory/PrinterFactory.d.ts +108 -0
  21. package/dist/types/factory/di-factory.d.ts +52 -0
  22. package/dist/types/factory/index.d.ts +6 -0
  23. package/dist/types/index.d.ts +9 -1
  24. package/dist/types/providers/ServiceProvider.d.ts +56 -0
  25. package/dist/types/providers/index.d.ts +2 -0
  26. package/dist/types/services/interfaces/ICommandBuilder.d.ts +123 -0
  27. package/dist/types/services/interfaces/IConnectionManager.d.ts +49 -0
  28. package/dist/types/services/interfaces/IPrintJobManager.d.ts +67 -0
  29. package/dist/types/services/interfaces/index.d.ts +6 -233
  30. package/dist/types/template/TemplateEngine.d.ts +24 -68
  31. package/dist/types/template/engines/TemplateRenderer.d.ts +71 -0
  32. package/dist/types/template/parsers/TemplateParser.d.ts +23 -0
  33. package/dist/types/utils/index.d.ts +8 -0
  34. package/dist/types/utils/logger.d.ts +4 -3
  35. package/dist/types/utils/outputLimiter.d.ts +87 -0
  36. package/dist/types/utils/validation.d.ts +11 -309
  37. package/dist/types/utils/validators/array.d.ts +19 -0
  38. package/dist/types/utils/validators/buffer.d.ts +18 -0
  39. package/dist/types/utils/validators/chain.d.ts +31 -0
  40. package/dist/types/utils/validators/common.d.ts +22 -0
  41. package/dist/types/utils/validators/number.d.ts +20 -0
  42. package/dist/types/utils/validators/object.d.ts +24 -0
  43. package/dist/types/utils/validators/printer.d.ts +40 -0
  44. package/dist/types/utils/validators/types.d.ts +125 -0
  45. package/dist/types/utils/validators/uuid.d.ts +23 -0
  46. package/package.json +1 -1
  47. package/src/core/BluetoothPrinter.ts +48 -50
  48. package/src/core/di/Container.ts +330 -0
  49. package/src/core/di/Tokens.ts +45 -0
  50. package/src/core/di/index.ts +3 -0
  51. package/src/core/event/EventBus.ts +251 -0
  52. package/src/core/event/index.ts +2 -0
  53. package/src/core/index.ts +10 -4
  54. package/src/core/plugin/PluginManager.ts +161 -0
  55. package/src/core/plugin/index.ts +2 -0
  56. package/src/device/MultiPrinterManager.ts +15 -6
  57. package/src/errors/CommandBuildError.ts +72 -0
  58. package/src/errors/ConnectionError.ts +78 -0
  59. package/src/errors/PrintJobError.ts +75 -0
  60. package/src/errors/index.ts +10 -0
  61. package/src/factory/PrinterFactory.ts +139 -0
  62. package/src/factory/di-factory.ts +61 -0
  63. package/src/factory/index.ts +12 -0
  64. package/src/index.ts +61 -1
  65. package/src/providers/ServiceProvider.ts +213 -0
  66. package/src/providers/index.ts +2 -0
  67. package/src/services/interfaces/ICommandBuilder.ts +145 -0
  68. package/src/services/interfaces/IConnectionManager.ts +58 -0
  69. package/src/services/interfaces/IPrintJobManager.ts +83 -0
  70. package/src/services/interfaces/index.ts +5 -265
  71. package/src/template/TemplateEngine.ts +27 -792
  72. package/src/template/engines/TemplateRenderer.ts +762 -0
  73. package/src/template/parsers/TemplateParser.ts +94 -0
  74. package/src/utils/index.ts +9 -0
  75. package/src/utils/logger.ts +17 -4
  76. package/src/utils/outputLimiter.ts +227 -0
  77. package/src/utils/validation.ts +21 -1138
  78. package/src/utils/validators/array.ts +95 -0
  79. package/src/utils/validators/buffer.ts +81 -0
  80. package/src/utils/validators/chain.ts +181 -0
  81. package/src/utils/validators/common.ts +216 -0
  82. package/src/utils/validators/number.ts +101 -0
  83. package/src/utils/validators/object.ts +63 -0
  84. package/src/utils/validators/printer.ts +294 -0
  85. package/src/utils/validators/types.ts +105 -0
  86. package/src/utils/validators/uuid.ts +49 -0
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Service Provider Module
3
+ *
4
+ * 将现有服务层注册到 DI 容器
5
+ */
6
+ /**
7
+ * 服务提供者配置选项
8
+ */
9
+ export interface ServiceProviderOptions {
10
+ /** 是否启用全局事件总线 */
11
+ useGlobalEventBus?: boolean;
12
+ /** 自定义配置 */
13
+ config?: Record<string, unknown>;
14
+ }
15
+ /**
16
+ * 注册所有服务到 DI 容器
17
+ */
18
+ export declare function registerServices(options?: ServiceProviderOptions): void;
19
+ /**
20
+ * 创建配置好的服务提供者
21
+ */
22
+ export declare function createServiceProvider(options?: ServiceProviderOptions): {
23
+ /** 获取连接管理器 */
24
+ getConnectionManager: () => unknown;
25
+ /** 获取打印任务管理器 */
26
+ getPrintJobManager: () => unknown;
27
+ /** 获取命令构建器 */
28
+ getCommandBuilder: () => unknown;
29
+ /** 获取设备管理器 */
30
+ getDeviceManager: () => unknown;
31
+ /** 获取打印队列 */
32
+ getPrintQueue: () => unknown;
33
+ /** 获取离线缓存 */
34
+ getOfflineCache: () => unknown;
35
+ /** 获取配置管理器 */
36
+ getConfigManager: () => unknown;
37
+ /** 获取打印机状态服务 */
38
+ getPrinterStatus: () => unknown;
39
+ /** 获取打印历史服务 */
40
+ getPrintHistory: () => unknown;
41
+ /** 获取打印统计服务 */
42
+ getPrintStatistics: () => unknown;
43
+ /** 获取云打印管理器 */
44
+ getCloudPrintManager: () => unknown;
45
+ /** 获取定时重试管理器 */
46
+ getScheduledRetryManager: () => unknown;
47
+ /** 获取批量打印管理器 */
48
+ getBatchPrintManager: () => unknown;
49
+ /** 获取事件总线 */
50
+ getEventBus: () => unknown;
51
+ /** 获取插件管理器 */
52
+ getPluginManager: () => unknown;
53
+ /** 获取适配器 */
54
+ getAdapter: () => unknown;
55
+ };
56
+ export type ServiceProvider = ReturnType<typeof createServiceProvider>;
@@ -0,0 +1,2 @@
1
+ export { registerServices, createServiceProvider } from './ServiceProvider';
2
+ export type { ServiceProviderOptions, ServiceProvider } from './ServiceProvider';
@@ -0,0 +1,123 @@
1
+ import { IQrOptions } from '../../types';
2
+ import { TextAlign, TextStyle } from '../../formatter';
3
+ import { BarcodeOptions } from '../../barcode';
4
+ /**
5
+ * Command Builder Interface
6
+ *
7
+ * Builds print commands using the printer driver
8
+ */
9
+ export interface ICommandBuilder {
10
+ /**
11
+ * Adds text to the print queue
12
+ *
13
+ * @param content - Text content
14
+ * @param encoding - Text encoding
15
+ * @returns this - For method chaining
16
+ */
17
+ text(content: string, encoding?: string): this;
18
+ /**
19
+ * Adds line feeds to the print queue
20
+ *
21
+ * @param lines - Number of lines to feed
22
+ * @returns this - For method chaining
23
+ */
24
+ feed(lines?: number): this;
25
+ /**
26
+ * Adds a paper cut command to the print queue
27
+ *
28
+ * @returns this - For method chaining
29
+ */
30
+ cut(): this;
31
+ /**
32
+ * Adds an image to the print queue
33
+ *
34
+ * @param data - Image data as Uint8Array
35
+ * @param width - Image width
36
+ * @param height - Image height
37
+ * @returns this - For method chaining
38
+ */
39
+ image(data: Uint8Array, width: number, height: number): this;
40
+ /**
41
+ * Adds a QR code to the print queue
42
+ *
43
+ * @param content - QR code content
44
+ * @param options - QR code options
45
+ * @returns this - For method chaining
46
+ */
47
+ qr(content: string, options?: IQrOptions): this;
48
+ /**
49
+ * Clears the print queue
50
+ *
51
+ * @returns this - For method chaining
52
+ */
53
+ clear(): this;
54
+ /**
55
+ * Sets text alignment
56
+ *
57
+ * @param alignment - Text alignment (left, center, right)
58
+ * @returns this - For method chaining
59
+ */
60
+ align(alignment: TextAlign): this;
61
+ /**
62
+ * Sets character size (width and height scale)
63
+ *
64
+ * @param width - Width scale factor (1-8)
65
+ * @param height - Height scale factor (1-8)
66
+ * @returns this - For method chaining
67
+ */
68
+ setSize(width: number, height: number): this;
69
+ /**
70
+ * Sets bold text mode
71
+ *
72
+ * @param enabled - Enable or disable bold
73
+ * @returns this - For method chaining
74
+ */
75
+ setBold(enabled: boolean): this;
76
+ /**
77
+ * Sets underline text mode
78
+ *
79
+ * @param enabled - Enable or disable underline
80
+ * @returns this - For method chaining
81
+ */
82
+ setUnderline(enabled: boolean): this;
83
+ /**
84
+ * Sets inverse printing mode (white on black)
85
+ *
86
+ * @param enabled - Enable or disable inverse
87
+ * @returns this - For method chaining
88
+ */
89
+ setInverse(enabled: boolean): this;
90
+ /**
91
+ * Sets multiple text style properties at once
92
+ *
93
+ * @param style - Text style configuration
94
+ * @returns this - For method chaining
95
+ */
96
+ setStyle(style: TextStyle): this;
97
+ /**
98
+ * Resets all text formatting to default
99
+ *
100
+ * @returns this - For method chaining
101
+ */
102
+ resetStyle(): this;
103
+ /**
104
+ * Adds a 1D barcode to the print queue
105
+ *
106
+ * @param content - Barcode content/data
107
+ * @param options - Barcode options
108
+ * @returns this - For method chaining
109
+ */
110
+ barcode(content: string, options: BarcodeOptions): this;
111
+ /**
112
+ * Gets the current buffer
113
+ *
114
+ * @returns Uint8Array - Current print buffer
115
+ */
116
+ getBuffer(): Uint8Array;
117
+ /**
118
+ * Gets the total number of bytes in the buffer
119
+ *
120
+ * @returns number - Total bytes
121
+ */
122
+ getTotalBytes(): number;
123
+ }
@@ -0,0 +1,49 @@
1
+ import { PrinterState, IPrinterAdapter } from '../../types';
2
+ /**
3
+ * Connection Manager Interface
4
+ *
5
+ * Manages Bluetooth device connections
6
+ */
7
+ export interface IConnectionManager {
8
+ /**
9
+ * Connects to a Bluetooth device
10
+ *
11
+ * @param deviceId - Bluetooth device ID
12
+ * @param options - Connection options
13
+ * @returns Promise<void>
14
+ */
15
+ connect(deviceId: string, options?: {
16
+ retries?: number;
17
+ timeout?: number;
18
+ }): Promise<void>;
19
+ /**
20
+ * Disconnects from the current device
21
+ *
22
+ * @returns Promise<void>
23
+ */
24
+ disconnect(): Promise<void>;
25
+ /**
26
+ * Checks if a device is connected
27
+ *
28
+ * @returns boolean - True if connected, false otherwise
29
+ */
30
+ isConnected(): boolean;
31
+ /**
32
+ * Gets the current device ID
33
+ *
34
+ * @returns string | null - Device ID or null if not connected
35
+ */
36
+ getDeviceId(): string | null;
37
+ /**
38
+ * Gets the current connection state
39
+ *
40
+ * @returns PrinterState - Current state
41
+ */
42
+ getState(): PrinterState;
43
+ /**
44
+ * Gets the printer adapter instance
45
+ *
46
+ * @returns IPrinterAdapter - Printer adapter
47
+ */
48
+ getAdapter(): IPrinterAdapter;
49
+ }
@@ -0,0 +1,67 @@
1
+ import { IAdapterOptions } from '../../types';
2
+ /**
3
+ * Print Job Manager Interface
4
+ *
5
+ * Manages print jobs, including pause/resume/cancel functionality
6
+ */
7
+ export interface IPrintJobManager {
8
+ /**
9
+ * Starts a print job
10
+ *
11
+ * @param buffer - Print data buffer
12
+ * @returns Promise<void>
13
+ */
14
+ start(buffer: Uint8Array, options?: {
15
+ jobId?: string;
16
+ }): Promise<void>;
17
+ /**
18
+ * Pauses the current print job
19
+ */
20
+ pause(): void;
21
+ /**
22
+ * Resumes a paused print job
23
+ *
24
+ * @returns Promise<void>
25
+ */
26
+ resume(jobId?: string): Promise<void>;
27
+ /**
28
+ * Cancels the current print job
29
+ */
30
+ cancel(): void;
31
+ /**
32
+ * Gets the number of bytes remaining to print
33
+ *
34
+ * @returns number - Bytes remaining
35
+ */
36
+ remaining(): number;
37
+ /**
38
+ * Checks if the print job is paused
39
+ *
40
+ * @returns boolean - True if paused, false otherwise
41
+ */
42
+ isPaused(): boolean;
43
+ /**
44
+ * Checks if a print job is in progress
45
+ *
46
+ * @returns boolean - True if in progress, false otherwise
47
+ */
48
+ isInProgress(): boolean;
49
+ /**
50
+ * Sets adapter options for write operations
51
+ *
52
+ * @param options - Adapter options
53
+ */
54
+ setOptions(options: IAdapterOptions): void;
55
+ /**
56
+ * Sets the progress callback
57
+ *
58
+ * @param callback - Progress callback function
59
+ */
60
+ setProgressCallback(callback?: (sent: number, total: number) => void): void;
61
+ /**
62
+ * Sets the job state change callback
63
+ *
64
+ * @param callback - Job state change callback function
65
+ */
66
+ setJobStateCallback(callback?: (state: 'in-progress' | 'paused' | 'completed' | 'cancelled') => void): void;
67
+ }
@@ -1,237 +1,10 @@
1
- import { IAdapterOptions, IQrOptions, PrinterState, IPrinterAdapter } from '../../types';
2
- import { TextAlign, TextStyle } from '../../formatter';
3
- import { BarcodeOptions } from '../../barcode';
4
1
  /**
5
- * Connection Manager Interface
2
+ * Service Interfaces
6
3
  *
7
- * Manages Bluetooth device connections
8
- */
9
- export interface IConnectionManager {
10
- /**
11
- * Connects to a Bluetooth device
12
- *
13
- * @param deviceId - Bluetooth device ID
14
- * @param options - Connection options
15
- * @returns Promise<void>
16
- */
17
- connect(deviceId: string, options?: {
18
- retries?: number;
19
- timeout?: number;
20
- }): Promise<void>;
21
- /**
22
- * Disconnects from the current device
23
- *
24
- * @returns Promise<void>
25
- */
26
- disconnect(): Promise<void>;
27
- /**
28
- * Checks if a device is connected
29
- *
30
- * @returns boolean - True if connected, false otherwise
31
- */
32
- isConnected(): boolean;
33
- /**
34
- * Gets the current device ID
35
- *
36
- * @returns string | null - Device ID or null if not connected
37
- */
38
- getDeviceId(): string | null;
39
- /**
40
- * Gets the current connection state
41
- *
42
- * @returns PrinterState - Current state
43
- */
44
- getState(): PrinterState;
45
- /**
46
- * Gets the printer adapter instance
47
- *
48
- * @returns IPrinterAdapter - Printer adapter
49
- */
50
- getAdapter(): IPrinterAdapter;
51
- }
52
- /**
53
- * Print Job Manager Interface
54
- *
55
- * Manages print jobs, including pause/resume/cancel functionality
56
- */
57
- export interface IPrintJobManager {
58
- /**
59
- * Starts a print job
60
- *
61
- * @param buffer - Print data buffer
62
- * @returns Promise<void>
63
- */
64
- start(buffer: Uint8Array, options?: {
65
- jobId?: string;
66
- }): Promise<void>;
67
- /**
68
- * Pauses the current print job
69
- */
70
- pause(): void;
71
- /**
72
- * Resumes a paused print job
73
- *
74
- * @returns Promise<void>
75
- */
76
- resume(jobId?: string): Promise<void>;
77
- /**
78
- * Cancels the current print job
79
- */
80
- cancel(): void;
81
- /**
82
- * Gets the number of bytes remaining to print
83
- *
84
- * @returns number - Bytes remaining
85
- */
86
- remaining(): number;
87
- /**
88
- * Checks if the print job is paused
89
- *
90
- * @returns boolean - True if paused, false otherwise
91
- */
92
- isPaused(): boolean;
93
- /**
94
- * Checks if a print job is in progress
95
- *
96
- * @returns boolean - True if in progress, false otherwise
97
- */
98
- isInProgress(): boolean;
99
- /**
100
- * Sets adapter options for write operations
101
- *
102
- * @param options - Adapter options
103
- */
104
- setOptions(options: IAdapterOptions): void;
105
- /**
106
- * Sets the progress callback
107
- *
108
- * @param callback - Progress callback function
109
- */
110
- setProgressCallback(callback?: (sent: number, total: number) => void): void;
111
- /**
112
- * Sets the job state change callback
113
- *
114
- * @param callback - Job state change callback function
115
- */
116
- setJobStateCallback(callback?: (state: 'in-progress' | 'paused' | 'completed' | 'cancelled') => void): void;
117
- }
118
- /**
119
- * Command Builder Interface
4
+ * Defines the interfaces for the core services used by BluetoothPrinter
120
5
  *
121
- * Builds print commands using the printer driver
6
+ * @packageDocumentation
122
7
  */
123
- export interface ICommandBuilder {
124
- /**
125
- * Adds text to the print queue
126
- *
127
- * @param content - Text content
128
- * @param encoding - Text encoding
129
- * @returns this - For method chaining
130
- */
131
- text(content: string, encoding?: string): this;
132
- /**
133
- * Adds line feeds to the print queue
134
- *
135
- * @param lines - Number of lines to feed
136
- * @returns this - For method chaining
137
- */
138
- feed(lines?: number): this;
139
- /**
140
- * Adds a paper cut command to the print queue
141
- *
142
- * @returns this - For method chaining
143
- */
144
- cut(): this;
145
- /**
146
- * Adds an image to the print queue
147
- *
148
- * @param data - Image data as Uint8Array
149
- * @param width - Image width
150
- * @param height - Image height
151
- * @returns this - For method chaining
152
- */
153
- image(data: Uint8Array, width: number, height: number): this;
154
- /**
155
- * Adds a QR code to the print queue
156
- *
157
- * @param content - QR code content
158
- * @param options - QR code options
159
- * @returns this - For method chaining
160
- */
161
- qr(content: string, options?: IQrOptions): this;
162
- /**
163
- * Clears the print queue
164
- *
165
- * @returns this - For method chaining
166
- */
167
- clear(): this;
168
- /**
169
- * Sets text alignment
170
- *
171
- * @param alignment - Text alignment (left, center, right)
172
- * @returns this - For method chaining
173
- */
174
- align(alignment: TextAlign): this;
175
- /**
176
- * Sets character size (width and height scale)
177
- *
178
- * @param width - Width scale factor (1-8)
179
- * @param height - Height scale factor (1-8)
180
- * @returns this - For method chaining
181
- */
182
- setSize(width: number, height: number): this;
183
- /**
184
- * Sets bold text mode
185
- *
186
- * @param enabled - Enable or disable bold
187
- * @returns this - For method chaining
188
- */
189
- setBold(enabled: boolean): this;
190
- /**
191
- * Sets underline text mode
192
- *
193
- * @param enabled - Enable or disable underline
194
- * @returns this - For method chaining
195
- */
196
- setUnderline(enabled: boolean): this;
197
- /**
198
- * Sets inverse printing mode (white on black)
199
- *
200
- * @param enabled - Enable or disable inverse
201
- * @returns this - For method chaining
202
- */
203
- setInverse(enabled: boolean): this;
204
- /**
205
- * Sets multiple text style properties at once
206
- *
207
- * @param style - Text style configuration
208
- * @returns this - For method chaining
209
- */
210
- setStyle(style: TextStyle): this;
211
- /**
212
- * Resets all text formatting to default
213
- *
214
- * @returns this - For method chaining
215
- */
216
- resetStyle(): this;
217
- /**
218
- * Adds a 1D barcode to the print queue
219
- *
220
- * @param content - Barcode content/data
221
- * @param options - Barcode options
222
- * @returns this - For method chaining
223
- */
224
- barcode(content: string, options: BarcodeOptions): this;
225
- /**
226
- * Gets the current buffer
227
- *
228
- * @returns Uint8Array - Current print buffer
229
- */
230
- getBuffer(): Uint8Array;
231
- /**
232
- * Gets the total number of bytes in the buffer
233
- *
234
- * @returns number - Total bytes
235
- */
236
- getTotalBytes(): number;
237
- }
8
+ export type { IConnectionManager } from './IConnectionManager';
9
+ export type { IPrintJobManager } from './IPrintJobManager';
10
+ export type { ICommandBuilder } from './ICommandBuilder';
@@ -1,5 +1,19 @@
1
- import { TextAlign } from '../formatter';
2
- import { BarcodeFormat } from '../barcode';
1
+ /**
2
+ * Template Engine
3
+ *
4
+ * Provides template parsing and rendering for receipts and labels.
5
+ * Supports variable substitution, conditional rendering, loops, and border/table drawing.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const engine = new TemplateEngine();
10
+ * const commands = engine.renderReceipt({
11
+ * store: { name: 'My Store' },
12
+ * items: [{ name: 'Item 1', quantity: 2, price: 10 }],
13
+ * payment: { total: 20, method: 'Cash' }
14
+ * });
15
+ * ```
16
+ */
3
17
  /**
4
18
  * Template type
5
19
  */
@@ -64,7 +78,7 @@ export interface LabelData {
64
78
  name: string;
65
79
  price: number;
66
80
  barcode?: string;
67
- barcodeFormat?: BarcodeFormat;
81
+ barcodeFormat?: import('../barcode').BarcodeFormat;
68
82
  spec?: string;
69
83
  productionDate?: string;
70
84
  expiryDate?: string;
@@ -155,9 +169,9 @@ export interface TableColumn {
155
169
  /** Width of column in characters */
156
170
  width: number;
157
171
  /** Text alignment for header */
158
- headerAlign?: TextAlign;
172
+ headerAlign?: import('../formatter').TextAlign;
159
173
  /** Text alignment for cells */
160
- cellAlign?: TextAlign;
174
+ cellAlign?: import('../formatter').TextAlign;
161
175
  }
162
176
  /**
163
177
  * Table row data
@@ -186,7 +200,7 @@ export interface TableElement {
186
200
  export type TemplateElement = {
187
201
  type: 'text';
188
202
  content: string;
189
- align?: TextAlign;
203
+ align?: import('../formatter').TextAlign;
190
204
  size?: number;
191
205
  bold?: boolean;
192
206
  } | {
@@ -205,7 +219,7 @@ export type TemplateElement = {
205
219
  } | {
206
220
  type: 'barcode';
207
221
  content: string;
208
- format: BarcodeFormat;
222
+ format: import('../barcode').BarcodeFormat;
209
223
  height?: number;
210
224
  } | {
211
225
  type: 'feed';
@@ -247,15 +261,13 @@ export interface ITemplateEngine {
247
261
  }
248
262
  /**
249
263
  * Template Engine class
250
- * Renders print templates to ESC/POS commands
264
+ * Facade for template parsing and rendering
251
265
  */
252
266
  export declare class TemplateEngine implements ITemplateEngine {
253
267
  private readonly logger;
254
- private readonly formatter;
255
- private readonly barcodeGenerator;
256
- private readonly driver;
268
+ private readonly parser;
269
+ private readonly renderer;
257
270
  private readonly templates;
258
- private readonly paperWidth;
259
271
  /**
260
272
  * Creates a new TemplateEngine instance
261
273
  */
@@ -284,61 +296,5 @@ export declare class TemplateEngine implements ITemplateEngine {
284
296
  * Validate template data
285
297
  */
286
298
  validate(template: TemplateDefinition, data: Record<string, unknown>): ValidationResult;
287
- /**
288
- * Render a single template element
289
- */
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;
319
- /**
320
- * Render a separator line
321
- */
322
- private renderLine;
323
- /**
324
- * Format an item line with columns
325
- */
326
- private formatItemLine;
327
- /**
328
- * Substitute variables in a string
329
- */
330
- private substituteVariables;
331
- /**
332
- * Get nested value from object
333
- */
334
- private getNestedValue;
335
- /**
336
- * Format a value with optional format string
337
- */
338
- private formatValue;
339
- /**
340
- * Combine multiple command arrays into one
341
- */
342
- private combineCommands;
343
299
  }
344
300
  export declare const templateEngine: TemplateEngine;