taro-bluetooth-print 2.4.1 → 2.5.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/CHANGELOG.md +23 -0
- package/README.md +10 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/adapters/QQAdapter.d.ts +22 -0
- package/dist/types/adapters/ReactNativeAdapter.d.ts +111 -0
- package/dist/types/adapters/index.d.ts +13 -0
- package/dist/types/drivers/StarPrinter.d.ts +243 -0
- package/dist/types/drivers/index.d.ts +1 -0
- package/dist/types/encoding/EncodingService.d.ts +41 -2
- package/dist/types/encoding/index.d.ts +2 -1
- package/dist/types/encoding/korean-japanese.d.ts +127 -0
- package/dist/types/services/BatchPrintManager.d.ts +98 -5
- package/dist/types/services/PrintStatistics.d.ts +189 -0
- package/dist/types/services/ScheduledRetryManager.d.ts +213 -0
- package/dist/types/services/index.d.ts +2 -0
- package/dist/types/utils/image.d.ts +40 -119
- package/dist/types/utils/platform.d.ts +2 -0
- package/package.json +1 -1
- package/src/adapters/AdapterFactory.ts +5 -0
- package/src/adapters/QQAdapter.ts +36 -0
- package/src/adapters/ReactNativeAdapter.ts +517 -0
- package/src/adapters/index.ts +14 -0
- package/src/drivers/StarPrinter.ts +555 -0
- package/src/drivers/index.ts +10 -0
- package/src/encoding/EncodingService.ts +261 -4
- package/src/encoding/index.ts +17 -1
- package/src/encoding/korean-japanese.ts +289 -0
- package/src/services/BatchPrintManager.ts +292 -16
- package/src/services/PrintStatistics.ts +504 -0
- package/src/services/ScheduledRetryManager.ts +564 -0
- package/src/services/index.ts +16 -0
- package/src/utils/image.ts +476 -342
- package/src/utils/platform.ts +20 -34
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.5.0] - 2026-03-26
|
|
9
|
+
|
|
10
|
+
### 新增
|
|
11
|
+
|
|
12
|
+
- **StarPrinter 驱动**: 新增 STAR TSP/SP700 系列协议支持,含完整 text/qr/barcode/image/cut/beep/bold/align 方法
|
|
13
|
+
- **韩日文编码支持**: EncodingService 扩展 EUC-KR(韩文)、Shift-JIS / ISO-2022-JP(日文)编码
|
|
14
|
+
- **QQ 小程序适配器**: 新增 QQAdapter,继承 MiniProgramAdapter,支持 QQ 小程序环境
|
|
15
|
+
- **React Native 适配器**: 新增 ReactNativeAdapter,基于 react-native-ble-plx 实现 IPrinterAdapter 接口
|
|
16
|
+
- **PrintStatistics 统计服务**: 追踪打印任务全生命周期,支持按日期/驱动分类统计、导出 JSON
|
|
17
|
+
- **ScheduledRetryManager 定时重试**: 支持指定时间自动重试、指数退避策略、进程重启后恢复调度
|
|
18
|
+
- **BatchPrintManager 批量增强**: 新增小任务合并(<50 bytes)、超时自动 flush、统一切刀指令
|
|
19
|
+
|
|
20
|
+
### 优化
|
|
21
|
+
|
|
22
|
+
- **ImageProcessing 图像处理**: 新增 4 种抖动算法(ordered halftone/sierra/stucki),新增图像预处理流水线(去噪/锐化/Gamma/色阶压缩),新增质量预设(draft/normal/high)
|
|
23
|
+
|
|
24
|
+
### 测试
|
|
25
|
+
|
|
26
|
+
- 新增 7 个测试文件,覆盖 StarPrinter、韩日文编码、新适配器、PrintStatistics、ScheduledRetryManager、BatchPrintManager 增强、ImageProcessing 增强
|
|
27
|
+
- 测试用例从 84 增至 334 个
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
8
31
|
## [2.4.1] - 2026-03-24
|
|
9
32
|
|
|
10
33
|
### 修复
|
package/README.md
CHANGED
|
@@ -34,9 +34,15 @@
|
|
|
34
34
|
- 🛠️ **TypeScript** - 完整的类型定义和 JSDoc
|
|
35
35
|
- 📡 **多打印机管理** - MultiPrinterManager 支持多设备并发
|
|
36
36
|
- 💰 **配置持久化** - PrinterConfigManager 保存打印机配置
|
|
37
|
-
- 📦 **批量打印优化** - BatchPrintManager
|
|
37
|
+
- 📦 **批量打印优化** - BatchPrintManager 合并小任务减少开销(含自动 flush 和统一切刀)
|
|
38
38
|
- 📜 **打印历史** - PrintHistory 追踪打印记录和统计
|
|
39
39
|
- 🖨️ **状态查询** - PrinterStatus 检测纸张/电量状态
|
|
40
|
+
- 📊 **统计分析** - PrintStatistics 追踪任务全生命周期,支持按日期/驱动分类
|
|
41
|
+
- ⏰ **定时重试** - ScheduledRetryManager 支持指定时间重试、指数退避、重启恢复
|
|
42
|
+
- 🖼️ **多抖动算法** - 6 种抖动算法( Floyd-Steinberg / Atkinson / Ordered / Halftone / Sierra / Stucki)
|
|
43
|
+
- 🎛️ **图像预处理** - 去噪 / 锐化 / Gamma 校正 / 色阶压缩
|
|
44
|
+
- 🏷️ **质量预设** - draft / normal / high 三档自动配置
|
|
45
|
+
- 🌐 **多编码支持** - GBK / GB2312 / Big5 / UTF-8 / EUC-KR / Shift-JIS / ISO-2022-JP
|
|
40
46
|
|
|
41
47
|
## 📦 安装
|
|
42
48
|
|
|
@@ -110,8 +116,9 @@ async function print() {
|
|
|
110
116
|
| 支付宝小程序 | `AlipayAdapter` | ✅ |
|
|
111
117
|
| 百度小程序 | `BaiduAdapter` | ✅ |
|
|
112
118
|
| 字节跳动小程序 | `ByteDanceAdapter` | ✅ |
|
|
119
|
+
| QQ 小程序 | `QQAdapter` | ✅ |
|
|
113
120
|
| 鸿蒙 HarmonyOS | `HarmonyOSAdapter` | ✅ |
|
|
114
|
-
| React Native | `
|
|
121
|
+
| React Native | `ReactNativeAdapter` | ✅ |
|
|
115
122
|
|
|
116
123
|
## 🖨️ 支持的驱动
|
|
117
124
|
|
|
@@ -121,6 +128,7 @@ async function print() {
|
|
|
121
128
|
| `TsplDriver` | TSPL | TSC 标签打印机 |
|
|
122
129
|
| `ZplDriver` | ZPL | Zebra 斑马标签打印机 |
|
|
123
130
|
| `CpclDriver` | CPCL | HP/霍尼韦尔移动打印机 |
|
|
131
|
+
| `StarPrinter` | STAR | STAR TSP/SP700 系列票据打印机 |
|
|
124
132
|
|
|
125
133
|
### 标签打印示例 (TSPL)
|
|
126
134
|
|