taro-bluetooth-print 2.3.1 → 2.4.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +6 -1
  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/config/PrinterConfigManager.d.ts +206 -0
  7. package/dist/types/config/index.d.ts +8 -0
  8. package/dist/types/device/MultiPrinterManager.d.ts +164 -0
  9. package/dist/types/device/index.d.ts +2 -0
  10. package/dist/types/index.d.ts +5 -1
  11. package/dist/types/services/BatchPrintManager.d.ts +205 -0
  12. package/dist/types/services/PrintHistory.d.ts +142 -0
  13. package/dist/types/services/PrintJobManager.d.ts +28 -4
  14. package/dist/types/services/PrinterStatus.d.ts +97 -0
  15. package/dist/types/services/index.d.ts +3 -0
  16. package/package.json +2 -2
  17. package/src/adapters/AlipayAdapter.ts +1 -0
  18. package/src/adapters/BaiduAdapter.ts +1 -0
  19. package/src/adapters/ByteDanceAdapter.ts +1 -0
  20. package/src/adapters/TaroAdapter.ts +1 -0
  21. package/src/adapters/WebBluetoothAdapter.ts +1 -1
  22. package/src/config/PrinterConfigManager.ts +519 -0
  23. package/src/config/index.ts +15 -0
  24. package/src/device/MultiPrinterManager.ts +470 -0
  25. package/src/device/index.ts +8 -0
  26. package/src/encoding/gbk-lite.ts +81 -76
  27. package/src/encoding/gbk-table.ts +14 -14
  28. package/src/index.ts +16 -1
  29. package/src/services/BatchPrintManager.ts +500 -0
  30. package/src/services/ConnectionManager.ts +4 -1
  31. package/src/services/PrintHistory.ts +336 -0
  32. package/src/services/PrintJobManager.ts +69 -9
  33. package/src/services/PrinterStatus.ts +267 -0
  34. package/src/services/index.ts +6 -0
  35. package/src/template/TemplateEngine.ts +4 -1
@@ -6,90 +6,95 @@
6
6
 
7
7
  // 排序后的 [unicode, gbk] 配对数组
8
8
  export const GBK_LITE: number[] = [
9
- 19968,8140, 20108,8249, 19977,8377, 22256,8859, 20116,8290, 20845,8467, 19971,8271, 20843,8465,
10
- 20057,8293, 21313,8405, 21103,8387, 20140,8266, 19978,8378, 20061,8297, 19990,8306, 20037,8333,
11
- 20035,8331, 20042,8338, 20054,8342, 20154,8278, 20799,8607, 21147,8389, 21253,8469, 21271,8487,
12
- 21340,8437, 21414,8494, 21442,8500, 19975,8375, 20184,8296, 20210,8346, 20237,8373, 20877,8569,
13
- 20004,8256, 21069,8549, 21129,8381, 20011,8257, 19981,8369, 19980,8368, 20820,8552, 20836,8568,
14
- 19976,8376, 20301,8421, 19985,8373, 20063,8302, 20195,8303, 20309,8425, 20320,8436, 20375,8475,
15
- 20445,8513, 20446,8514, 21040,8508, 20687,8611, 21306,8402, 20307,8427, 20241,8377, 20107,8249,
16
- 20225,8361, 21888,8944, 21912,8956, 21247,8481, 22825,9509, 21490,8530, 21543,8619, 21548,8624,
17
- 21589,8665, 21595,8671, 21628,8684, 21632,8688, 21647,8703, 21672,8728, 21710,8746, 21733,8769,
18
- 21736,8772, 21769,8781, 21809,8789, 21834,8814, 21916,8958, 21930,8970, 20045,8340, 20043,8339,
19
- 20053,8341, 20064,8304, 20102,8258, 20114,8262, 20117,8265, 22806,9508, 20845,8467, 21253,8469,
20
- 21280,8490, 21453,8517, 20184,8296, 20237,8373, 20426,8506, 20596,8556, 20351,8459, 21069,8549,
21
- 21407,8491, 20813,8553, 20167,8261, 21475,8523, 21147,8389, 21512,8676, 21246,8480, 21313,8405,
22
- 20320,8436, 20013,8259, 20057,8293, 20985,8565, 21253,8469, 20171,8265, 19968,8140, 20309,8425,
23
- 20102,8258, 20845,8467, 21040,8508, 21069,8549, 21129,8381, 21414,8494, 21442,8500, 19975,8375,
24
- 20184,8296, 20210,8346, 20237,8373, 20301,8421, 20877,8569, 21246,8480, 21512,8676, 21733,8769,
25
- 21888,8944, 21912,8956, 21916,8958, 21930,8970, 21834,8814, 20195,8303, 20006,8252, 20004,8256,
26
- 19979,8377, 20351,8459, 22825,9509, 21033,8483, 21247,8481, 20132,8264, 21453,8517, 20986,8566,
27
- 20154,8278, 20204,8348, 20055,8291, 20221,8369, 20307,8427, 20185,8297, 20311,8427, 20046,8340,
28
- 20381,8469, 20018,8260, 20173,8269, 20167,8261, 20843,8465, 20979,8563, 22806,9508, 19977,8377,
29
- 20108,8249, 19971,8271, 21103,8387, 20061,8297, 20114,8262, 20845,8467, 21253,8469, 21313,8405,
30
- 22825,9509, 19968,8140, 20116,8290, 20057,8293, 20140,8266, 19978,8378, 19990,8306, 20154,8278,
31
- 20799,8607, 21147,8389, 21271,8487, 21340,8437, 21414,8494, 21442,8500, 19975,8375, 20184,8296,
32
- 20210,8346, 20237,8373, 20301,8421, 20877,8569, 20195,8303, 20004,8256, 21069,8549, 21129,8381,
33
- 20011,8257, 19981,8369, 19980,8368, 20820,8552, 20836,8568, 19976,8376, 20301,8421, 19985,8373,
34
- 20063,8302, 20195,8303, 20309,8425, 20320,8436, 20375,8475, 20445,8513, 20446,8514, 21040,8508,
35
- 20687,8611, 21306,8402, 20307,8427, 20241,8377, 20107,8249, 20225,8361, 21888,8944, 21912,8956,
36
- 21247,8481, 22825,9509, 21490,8530, 21543,8619, 21548,8624, 21589,8665, 21595,8671, 21628,8684,
37
- 21632,8688, 21647,8703, 21672,8728, 21710,8746, 21733,8769, 21736,8772, 21769,8781, 21809,8789,
38
- 21834,8814, 21916,8958, 21930,8970, 20045,8340, 20043,8339, 20053,8341, 20064,8304, 20102,8258,
39
- 20114,8262, 20117,8265, 22806,9508, 20845,8467, 21253,8469, 21280,8490, 21453,8517, 20184,8296,
40
- 20237,8373, 20426,8506, 20596,8556, 20351,8459, 21069,8549, 21407,8491, 20813,8553, 20167,8261,
41
- 21475,8523, 21147,8389, 21512,8676, 21246,8480, 21313,8405, 20320,8436, 20013,8259, 20057,8293,
42
- 20985,8565, 21253,8469, 20171,8265, 19968,8140, 20309,8425, 20102,8258, 20845,8467, 21040,8508,
43
- 21069,8549, 21129,8381, 21414,8494, 21442,8500, 19975,8375, 20184,8296, 20210,8346, 20237,8373,
44
- 20301,8421, 20877,8569, 21246,8480, 21512,8676, 21733,8769, 21888,8944, 21912,8956, 21916,8958,
45
- 21930,8970, 21834,8814, 20195,8303, 20006,8252, 20004,8256, 19979,8377, 20351,8459, 22825,9509,
46
- 21033,8483, 21247,8481, 20132,8264, 21453,8517, 20986,8566, 20154,8278, 20204,8348, 20055,8291,
47
- 20221,8369, 20307,8427, 20185,8297, 20311,8427, 20046,8340, 20381,8469, 20018,8260, 20173,8269,
48
- 20167,8261, 20843,8465, 20979,8563, 22806,9508, 19977,8377, 20108,8249, 19971,8271, 21103,8387,
49
- 20061,8297, 20114,8262, 20845,8467, 21253,8469, 21313,8405, 22825,9509, 19968,8140, 20116,8290,
50
- 20057,8293, 20140,8266, 19978,8378, 19990,8306, 20154,8278, 20799,8607, 21147,8389, 21271,8487,
51
- 21340,8437, 21414,8494, 21442,8500, 19975,8375, 20184,8296, 20210,8346, 20237,8373, 20301,8421,
52
- 20877,8569, 20195,8303, 20004,8256, 21069,8549, 21129,8381, 20011,8257, 19981,8369, 19980,8368,
53
- 20820,8552, 20836,8568, 19976,8376, 20301,8421, 19985,8373, 20063,8302, 20195,8303, 20309,8425,
54
- 20320,8436, 20375,8475, 20445,8513, 20446,8514, 21040,8508, 20687,8611, 21306,8402, 20307,8427,
55
- 20241,8377, 20107,8249, 20225,8361, 21888,8944, 21912,8956, 21247,8481, 22825,9509, 21490,8530,
56
- 21543,8619, 21548,8624, 21589,8665, 21595,8671, 21628,8684, 21632,8688, 21647,8703, 21672,8728,
57
- 21710,8746, 21733,8769, 21736,8772, 21769,8781, 21809,8789, 21834,8814, 21916,8958, 21930,8970,
58
- 20045,8340, 20043,8339, 20053,8341, 20064,8304, 20102,8258, 20114,8262, 20117,8265, 22806,9508,
59
- 20845,8467, 21253,8469, 21280,8490, 21453,8517, 20184,8296, 20237,8373, 20426,8506, 20596,8556,
60
- 20351,8459, 21069,8549, 21407,8491, 20813,8553, 20167,8261, 21475,8523, 21147,8389, 21512,8676,
61
- 21246,8480, 21313,8405, 20320,8436, 20013,8259, 20057,8293, 20985,8565, 21253,8469, 20171,8265,
62
- 19968,8140, 20309,8425, 20102,8258, 20845,8467, 21040,8508, 21069,8549, 21129,8381, 21414,8494,
63
- 21442,8500, 19975,8375, 20184,8296, 20210,8346, 20237,8373, 20301,8421, 20877,8569, 21246,8480,
64
- 21512,8676, 21733,8769, 21888,8944, 21912,8956, 21916,8958, 21930,8970, 21834,8814, 20195,8303,
65
- 20006,8252, 20004,8256, 19979,8377, 20351,8459, 22825,9509, 21033,8483, 21247,8481, 20132,8264,
66
- 21453,8517, 20986,8566, 20154,8278, 20204,8348, 20055,8291, 20221,8369, 20307,8427, 20185,8297,
67
- 20311,8427, 20046,8340, 20381,8469, 20018,8260, 20173,8269, 20167,8261, 20843,8465, 20979,8563,
68
- 22806,9508, 19977,8377, 20108,8249, 19971,8271, 21103,8387, 20061,8297, 20114,8262, 20845,8467,
69
- 21253,8469, 21313,8405, 22825,9509, 19968,8140, 20116,8290, 20057,8293, 20140,8266, 19978,8378,
70
- 19990,8306, 20154,8278, 20799,8607, 21147,8389, 21271,8487, 21340,8437, 21414,8494, 21442,8500,
71
- 19975,8375, 20184,8296, 20210,8346, 20237,8373, 20301,8421, 20877,8569, 20195,8303, 20004,8256,
72
- 21069,8549, 21129,8381, 20011,8257, 19981,8369, 19980,8368, 20820,8552, 20836,8568, 19976,8376,
73
- 20301,8421, 19985,8373, 20063,8302, 20195,8303, 20309,8425, 20320,8436, 20375,8475, 20445,8513,
74
- 20446,8514, 21040,8508, 20687,8611, 21306,8402, 20307,8427, 20241,8377, 20107,8249, 20225,8361,
75
- 21888,8944, 21912,8956, 21247,8481, 22825,9509, 21490,8530, 21543,8619, 21548,8624, 21589,8665,
76
- 21595,8671, 21628,8684, 21632,8688, 21647,8703, 21672,8728, 21710,8746, 21733,8769, 21736,8772,
77
- 21769,8781, 21809,8789, 21834,8814, 21916,8958, 21930,8970, 20045,8340, 20043,8339, 20053,8341,
78
- 20064,8304, 20102,8258, 20114,8262, 20117,8265, 22806,9508, 20845,8467, 21253,8469, 21280,8490,
79
- 21453,8517, 20184,8296, 20237,8373, 20426,8506, 20596,8556, 20351,8459, 21069,8549, 21407,8491,
80
- 20813,8553, 20167,8261, 21475,8523, 21147,8389, 21512,8676, 21246,8480, 21313,8405, 20320,8436,
81
- 20013,8259, 20057,8293, 20985,8565, 21253,8469, 20171,8265,
9
+ 19968, 8140, 20108, 8249, 19977, 8377, 22256, 8859, 20116, 8290, 20845, 8467, 19971, 8271, 20843,
10
+ 8465, 20057, 8293, 21313, 8405, 21103, 8387, 20140, 8266, 19978, 8378, 20061, 8297, 19990, 8306,
11
+ 20037, 8333, 20035, 8331, 20042, 8338, 20054, 8342, 20154, 8278, 20799, 8607, 21147, 8389, 21253,
12
+ 8469, 21271, 8487, 21340, 8437, 21414, 8494, 21442, 8500, 19975, 8375, 20184, 8296, 20210, 8346,
13
+ 20237, 8373, 20877, 8569, 20004, 8256, 21069, 8549, 21129, 8381, 20011, 8257, 19981, 8369, 19980,
14
+ 8368, 20820, 8552, 20836, 8568, 19976, 8376, 20301, 8421, 19985, 8373, 20063, 8302, 20195, 8303,
15
+ 20309, 8425, 20320, 8436, 20375, 8475, 20445, 8513, 20446, 8514, 21040, 8508, 20687, 8611, 21306,
16
+ 8402, 20307, 8427, 20241, 8377, 20107, 8249, 20225, 8361, 21888, 8944, 21912, 8956, 21247, 8481,
17
+ 22825, 9509, 21490, 8530, 21543, 8619, 21548, 8624, 21589, 8665, 21595, 8671, 21628, 8684, 21632,
18
+ 8688, 21647, 8703, 21672, 8728, 21710, 8746, 21733, 8769, 21736, 8772, 21769, 8781, 21809, 8789,
19
+ 21834, 8814, 21916, 8958, 21930, 8970, 20045, 8340, 20043, 8339, 20053, 8341, 20064, 8304, 20102,
20
+ 8258, 20114, 8262, 20117, 8265, 22806, 9508, 20845, 8467, 21253, 8469, 21280, 8490, 21453, 8517,
21
+ 20184, 8296, 20237, 8373, 20426, 8506, 20596, 8556, 20351, 8459, 21069, 8549, 21407, 8491, 20813,
22
+ 8553, 20167, 8261, 21475, 8523, 21147, 8389, 21512, 8676, 21246, 8480, 21313, 8405, 20320, 8436,
23
+ 20013, 8259, 20057, 8293, 20985, 8565, 21253, 8469, 20171, 8265, 19968, 8140, 20309, 8425, 20102,
24
+ 8258, 20845, 8467, 21040, 8508, 21069, 8549, 21129, 8381, 21414, 8494, 21442, 8500, 19975, 8375,
25
+ 20184, 8296, 20210, 8346, 20237, 8373, 20301, 8421, 20877, 8569, 21246, 8480, 21512, 8676, 21733,
26
+ 8769, 21888, 8944, 21912, 8956, 21916, 8958, 21930, 8970, 21834, 8814, 20195, 8303, 20006, 8252,
27
+ 20004, 8256, 19979, 8377, 20351, 8459, 22825, 9509, 21033, 8483, 21247, 8481, 20132, 8264, 21453,
28
+ 8517, 20986, 8566, 20154, 8278, 20204, 8348, 20055, 8291, 20221, 8369, 20307, 8427, 20185, 8297,
29
+ 20311, 8427, 20046, 8340, 20381, 8469, 20018, 8260, 20173, 8269, 20167, 8261, 20843, 8465, 20979,
30
+ 8563, 22806, 9508, 19977, 8377, 20108, 8249, 19971, 8271, 21103, 8387, 20061, 8297, 20114, 8262,
31
+ 20845, 8467, 21253, 8469, 21313, 8405, 22825, 9509, 19968, 8140, 20116, 8290, 20057, 8293, 20140,
32
+ 8266, 19978, 8378, 19990, 8306, 20154, 8278, 20799, 8607, 21147, 8389, 21271, 8487, 21340, 8437,
33
+ 21414, 8494, 21442, 8500, 19975, 8375, 20184, 8296, 20210, 8346, 20237, 8373, 20301, 8421, 20877,
34
+ 8569, 20195, 8303, 20004, 8256, 21069, 8549, 21129, 8381, 20011, 8257, 19981, 8369, 19980, 8368,
35
+ 20820, 8552, 20836, 8568, 19976, 8376, 20301, 8421, 19985, 8373, 20063, 8302, 20195, 8303, 20309,
36
+ 8425, 20320, 8436, 20375, 8475, 20445, 8513, 20446, 8514, 21040, 8508, 20687, 8611, 21306, 8402,
37
+ 20307, 8427, 20241, 8377, 20107, 8249, 20225, 8361, 21888, 8944, 21912, 8956, 21247, 8481, 22825,
38
+ 9509, 21490, 8530, 21543, 8619, 21548, 8624, 21589, 8665, 21595, 8671, 21628, 8684, 21632, 8688,
39
+ 21647, 8703, 21672, 8728, 21710, 8746, 21733, 8769, 21736, 8772, 21769, 8781, 21809, 8789, 21834,
40
+ 8814, 21916, 8958, 21930, 8970, 20045, 8340, 20043, 8339, 20053, 8341, 20064, 8304, 20102, 8258,
41
+ 20114, 8262, 20117, 8265, 22806, 9508, 20845, 8467, 21253, 8469, 21280, 8490, 21453, 8517, 20184,
42
+ 8296, 20237, 8373, 20426, 8506, 20596, 8556, 20351, 8459, 21069, 8549, 21407, 8491, 20813, 8553,
43
+ 20167, 8261, 21475, 8523, 21147, 8389, 21512, 8676, 21246, 8480, 21313, 8405, 20320, 8436, 20013,
44
+ 8259, 20057, 8293, 20985, 8565, 21253, 8469, 20171, 8265, 19968, 8140, 20309, 8425, 20102, 8258,
45
+ 20845, 8467, 21040, 8508, 21069, 8549, 21129, 8381, 21414, 8494, 21442, 8500, 19975, 8375, 20184,
46
+ 8296, 20210, 8346, 20237, 8373, 20301, 8421, 20877, 8569, 21246, 8480, 21512, 8676, 21733, 8769,
47
+ 21888, 8944, 21912, 8956, 21916, 8958, 21930, 8970, 21834, 8814, 20195, 8303, 20006, 8252, 20004,
48
+ 8256, 19979, 8377, 20351, 8459, 22825, 9509, 21033, 8483, 21247, 8481, 20132, 8264, 21453, 8517,
49
+ 20986, 8566, 20154, 8278, 20204, 8348, 20055, 8291, 20221, 8369, 20307, 8427, 20185, 8297, 20311,
50
+ 8427, 20046, 8340, 20381, 8469, 20018, 8260, 20173, 8269, 20167, 8261, 20843, 8465, 20979, 8563,
51
+ 22806, 9508, 19977, 8377, 20108, 8249, 19971, 8271, 21103, 8387, 20061, 8297, 20114, 8262, 20845,
52
+ 8467, 21253, 8469, 21313, 8405, 22825, 9509, 19968, 8140, 20116, 8290, 20057, 8293, 20140, 8266,
53
+ 19978, 8378, 19990, 8306, 20154, 8278, 20799, 8607, 21147, 8389, 21271, 8487, 21340, 8437, 21414,
54
+ 8494, 21442, 8500, 19975, 8375, 20184, 8296, 20210, 8346, 20237, 8373, 20301, 8421, 20877, 8569,
55
+ 20195, 8303, 20004, 8256, 21069, 8549, 21129, 8381, 20011, 8257, 19981, 8369, 19980, 8368, 20820,
56
+ 8552, 20836, 8568, 19976, 8376, 20301, 8421, 19985, 8373, 20063, 8302, 20195, 8303, 20309, 8425,
57
+ 20320, 8436, 20375, 8475, 20445, 8513, 20446, 8514, 21040, 8508, 20687, 8611, 21306, 8402, 20307,
58
+ 8427, 20241, 8377, 20107, 8249, 20225, 8361, 21888, 8944, 21912, 8956, 21247, 8481, 22825, 9509,
59
+ 21490, 8530, 21543, 8619, 21548, 8624, 21589, 8665, 21595, 8671, 21628, 8684, 21632, 8688, 21647,
60
+ 8703, 21672, 8728, 21710, 8746, 21733, 8769, 21736, 8772, 21769, 8781, 21809, 8789, 21834, 8814,
61
+ 21916, 8958, 21930, 8970, 20045, 8340, 20043, 8339, 20053, 8341, 20064, 8304, 20102, 8258, 20114,
62
+ 8262, 20117, 8265, 22806, 9508, 20845, 8467, 21253, 8469, 21280, 8490, 21453, 8517, 20184, 8296,
63
+ 20237, 8373, 20426, 8506, 20596, 8556, 20351, 8459, 21069, 8549, 21407, 8491, 20813, 8553, 20167,
64
+ 8261, 21475, 8523, 21147, 8389, 21512, 8676, 21246, 8480, 21313, 8405, 20320, 8436, 20013, 8259,
65
+ 20057, 8293, 20985, 8565, 21253, 8469, 20171, 8265, 19968, 8140, 20309, 8425, 20102, 8258, 20845,
66
+ 8467, 21040, 8508, 21069, 8549, 21129, 8381, 21414, 8494, 21442, 8500, 19975, 8375, 20184, 8296,
67
+ 20210, 8346, 20237, 8373, 20301, 8421, 20877, 8569, 21246, 8480, 21512, 8676, 21733, 8769, 21888,
68
+ 8944, 21912, 8956, 21916, 8958, 21930, 8970, 21834, 8814, 20195, 8303, 20006, 8252, 20004, 8256,
69
+ 19979, 8377, 20351, 8459, 22825, 9509, 21033, 8483, 21247, 8481, 20132, 8264, 21453, 8517, 20986,
70
+ 8566, 20154, 8278, 20204, 8348, 20055, 8291, 20221, 8369, 20307, 8427, 20185, 8297, 20311, 8427,
71
+ 20046, 8340, 20381, 8469, 20018, 8260, 20173, 8269, 20167, 8261, 20843, 8465, 20979, 8563, 22806,
72
+ 9508, 19977, 8377, 20108, 8249, 19971, 8271, 21103, 8387, 20061, 8297, 20114, 8262, 20845, 8467,
73
+ 21253, 8469, 21313, 8405, 22825, 9509, 19968, 8140, 20116, 8290, 20057, 8293, 20140, 8266, 19978,
74
+ 8378, 19990, 8306, 20154, 8278, 20799, 8607, 21147, 8389, 21271, 8487, 21340, 8437, 21414, 8494,
75
+ 21442, 8500, 19975, 8375, 20184, 8296, 20210, 8346, 20237, 8373, 20301, 8421, 20877, 8569, 20195,
76
+ 8303, 20004, 8256, 21069, 8549, 21129, 8381, 20011, 8257, 19981, 8369, 19980, 8368, 20820, 8552,
77
+ 20836, 8568, 19976, 8376, 20301, 8421, 19985, 8373, 20063, 8302, 20195, 8303, 20309, 8425, 20320,
78
+ 8436, 20375, 8475, 20445, 8513, 20446, 8514, 21040, 8508, 20687, 8611, 21306, 8402, 20307, 8427,
79
+ 20241, 8377, 20107, 8249, 20225, 8361, 21888, 8944, 21912, 8956, 21247, 8481, 22825, 9509, 21490,
80
+ 8530, 21543, 8619, 21548, 8624, 21589, 8665, 21595, 8671, 21628, 8684, 21632, 8688, 21647, 8703,
81
+ 21672, 8728, 21710, 8746, 21733, 8769, 21736, 8772, 21769, 8781, 21809, 8789, 21834, 8814, 21916,
82
+ 8958, 21930, 8970, 20045, 8340, 20043, 8339, 20053, 8341, 20064, 8304, 20102, 8258, 20114, 8262,
83
+ 20117, 8265, 22806, 9508, 20845, 8467, 21253, 8469, 21280, 8490, 21453, 8517, 20184, 8296, 20237,
84
+ 8373, 20426, 8506, 20596, 8556, 20351, 8459, 21069, 8549, 21407, 8491, 20813, 8553, 20167, 8261,
85
+ 21475, 8523, 21147, 8389, 21512, 8676, 21246, 8480, 21313, 8405, 20320, 8436, 20013, 8259, 20057,
86
+ 8293, 20985, 8565, 21253, 8469, 20171, 8265,
82
87
  ];
83
88
 
84
89
  // 二分查找 - 必须在排序数组中使用
85
90
  export function binarySearchGbk(unicode: number): number | null {
86
91
  let left = 0;
87
92
  let right = GBK_LITE.length - 2;
88
-
93
+
89
94
  while (left <= right) {
90
95
  const mid = (left + right) >> 1;
91
96
  const midUnicode = GBK_LITE[mid];
92
-
97
+
93
98
  if (midUnicode === unicode) {
94
99
  const result = GBK_LITE[mid + 1];
95
100
  return result ?? null;
@@ -104,5 +109,5 @@ export function binarySearchGbk(unicode: number): number | null {
104
109
 
105
110
  // 快速检查字符是否在常用范围内
106
111
  export function isInCommonRange(unicode: number): boolean {
107
- return unicode >= 0x4E00 && unicode <= 0x9FA5;
112
+ return unicode >= 0x4e00 && unicode <= 0x9fa5;
108
113
  }
@@ -11,6 +11,7 @@
11
11
  */
12
12
 
13
13
  import { binarySearchGbk, isInCommonRange } from './gbk-lite';
14
+ import { GBK_DATA as FULL_GBK_DATA, BIG5_DATA as FULL_BIG5_DATA } from './gbk-data';
14
15
 
15
16
  // 懒加载完整编码数据
16
17
  let GBK_DATA: number[] | null = null;
@@ -18,17 +19,16 @@ let BIG5_DATA: number[] | null = null;
18
19
 
19
20
  function loadFullData() {
20
21
  if (!GBK_DATA) {
21
- const data = require('./gbk-data');
22
- GBK_DATA = data.GBK_DATA;
23
- BIG5_DATA = data.BIG5_DATA;
22
+ GBK_DATA = FULL_GBK_DATA;
23
+ BIG5_DATA = FULL_BIG5_DATA;
24
24
  }
25
- return { GBK_DATA: GBK_DATA!, BIG5_DATA: BIG5_DATA! };
25
+ return { GBK_DATA: GBK_DATA, BIG5_DATA: BIG5_DATA! };
26
26
  }
27
27
 
28
28
  // Unicode to GBK mapping table
29
29
  export const unicodeToGbk: Map<number, number> = new Map();
30
30
 
31
- // GBK to Unicode mapping table
31
+ // GBK to Unicode mapping table
32
32
  export const gbkToUnicode: Map<number, number> = new Map();
33
33
 
34
34
  // Unicode to Big5 mapping table
@@ -43,16 +43,16 @@ export const big5ToUnicode: Map<number, number> = new Map();
43
43
  */
44
44
  export function getGbkBytes(unicode: number): [number, number] | null {
45
45
  // ASCII 直接返回
46
- if (unicode >= 0x20 && unicode <= 0x7E) {
46
+ if (unicode >= 0x20 && unicode <= 0x7e) {
47
47
  return [0, unicode];
48
48
  }
49
-
49
+
50
50
  // 先查精简表
51
51
  const gbk = binarySearchGbk(unicode);
52
52
  if (gbk !== null) {
53
53
  return [(gbk >> 8) & 0xff, gbk & 0xff];
54
54
  }
55
-
55
+
56
56
  // 非常用字,懒加载完整表
57
57
  if (isInCommonRange(unicode)) {
58
58
  const { GBK_DATA } = loadFullData();
@@ -65,7 +65,7 @@ export function getGbkBytes(unicode: number): [number, number] | null {
65
65
  }
66
66
  }
67
67
  }
68
-
68
+
69
69
  return null;
70
70
  }
71
71
 
@@ -75,11 +75,11 @@ export function getGbkBytes(unicode: number): [number, number] | null {
75
75
  */
76
76
  export function getUnicodeFromGbk(high: number, low: number): number | null {
77
77
  const gbk = (high << 8) | low;
78
-
78
+
79
79
  // 先查缓存
80
80
  const cached = gbkToUnicode.get(gbk);
81
81
  if (cached !== undefined) return cached;
82
-
82
+
83
83
  // 懒加载完整表
84
84
  const { GBK_DATA } = loadFullData();
85
85
  for (let i = 0; i < GBK_DATA.length; i += 2) {
@@ -88,7 +88,7 @@ export function getUnicodeFromGbk(high: number, low: number): number | null {
88
88
  return result ?? null;
89
89
  }
90
90
  }
91
-
91
+
92
92
  return null;
93
93
  }
94
94
 
@@ -103,7 +103,7 @@ export function getBig5Bytes(unicode: number): [number, number] | null {
103
103
  const cachedValue = cached;
104
104
  return [(cachedValue >> 8) & 0xff, cachedValue & 0xff];
105
105
  }
106
-
106
+
107
107
  // 懒加载完整表
108
108
  const { BIG5_DATA } = loadFullData();
109
109
  for (let i = 0; i < BIG5_DATA.length; i += 2) {
@@ -114,7 +114,7 @@ export function getBig5Bytes(unicode: number): [number, number] | null {
114
114
  }
115
115
  }
116
116
  }
117
-
117
+
118
118
  return null;
119
119
  }
120
120
 
package/src/index.ts CHANGED
@@ -27,9 +27,17 @@ export type { WebBluetoothRequestOptions } from './adapters/WebBluetoothAdapter'
27
27
  export * from './services';
28
28
 
29
29
  // Device Management - 设备管理
30
- export { DeviceManager } from './device/DeviceManager';
30
+ export { DeviceManager, deviceManager } from './device/DeviceManager';
31
31
  export type { BluetoothDevice, ScanOptions, DeviceManagerEvents } from './device/DeviceManager';
32
32
 
33
+ export { MultiPrinterManager, multiPrinterManager } from './device/MultiPrinterManager';
34
+ export type {
35
+ PrinterConnection,
36
+ MultiConnectOptions,
37
+ BroadcastOptions,
38
+ MultiPrinterManagerEvents,
39
+ } from './device/MultiPrinterManager';
40
+
33
41
  // Print Queue - 打印队列
34
42
  export { PrintQueue } from './queue/PrintQueue';
35
43
  export type {
@@ -89,6 +97,13 @@ export type {
89
97
  LoggingConfig,
90
98
  } from './config/PrinterConfig';
91
99
 
100
+ export { PrinterConfigManager, printerConfigManager } from './config/PrinterConfigManager';
101
+ export type {
102
+ SavedPrinter,
103
+ GlobalConfig,
104
+ IConfigStorage,
105
+ } from './config/PrinterConfigManager';
106
+
92
107
  // Plugin System - 插件系统
93
108
  export { PluginManager } from './plugins/PluginManager';
94
109
  export { createLoggingPlugin, createRetryPlugin } from './plugins';