@pisell/utils 3.0.6 → 3.0.7

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 (200) hide show
  1. package/es/arrayUtils.d.ts +23 -26
  2. package/es/arrayUtils.js +157 -97
  3. package/es/common/index.d.ts +5 -0
  4. package/es/common/index.js +5 -0
  5. package/es/common/stateHelper.d.ts +2 -6
  6. package/es/common/stateHelper.js +24 -22
  7. package/es/common/types.d.ts +10 -13
  8. package/es/common/types.js +1 -0
  9. package/es/componentStorage.d.ts +25 -27
  10. package/es/componentStorage.js +130 -94
  11. package/es/constants/index.js +9 -7
  12. package/es/date.js +53 -36
  13. package/es/document.js +67 -43
  14. package/es/escPosPrinter/EscPosPrinter.js +490 -353
  15. package/es/escPosPrinter/index.d.ts +9 -9
  16. package/es/escPosPrinter/index.js +52 -37
  17. package/es/firebase/config/index.js +54 -0
  18. package/es/firebase/index.js +232 -0
  19. package/es/format.d.ts +15 -12
  20. package/es/format.js +156 -89
  21. package/es/image.js +60 -48
  22. package/es/index.d.ts +24 -39
  23. package/es/index.js +35 -40
  24. package/es/jsBridge/index.d.ts +4 -8
  25. package/es/jsBridge/index.js +55 -56
  26. package/es/jsBridge/regDeviceApi.js +126 -87
  27. package/es/jsBridge/types.d.ts +115 -95
  28. package/es/jsBridge/types.js +1 -0
  29. package/es/locales.d.ts +8 -11
  30. package/es/locales.js +96 -77
  31. package/es/log.d.ts +6 -11
  32. package/es/log.js +59 -37
  33. package/es/miniRedux.d.ts +13 -20
  34. package/es/miniRedux.js +76 -42
  35. package/es/number-input/hooks/index.d.ts +4 -0
  36. package/es/number-input/hooks/index.js +5 -0
  37. package/es/number-input/hooks/useNumberInputState.d.ts +2 -6
  38. package/es/number-input/hooks/useNumberInputState.js +128 -71
  39. package/es/number-input/index.d.ts +14 -0
  40. package/es/number-input/index.js +21 -0
  41. package/es/number-input/types.d.ts +88 -88
  42. package/es/number-input/types.js +1 -0
  43. package/es/number-input/utils/formatter.d.ts +10 -13
  44. package/es/number-input/utils/formatter.js +77 -51
  45. package/es/number-input/utils/index.d.ts +7 -0
  46. package/es/number-input/utils/index.js +8 -0
  47. package/es/number-input/utils/validation.d.ts +2 -7
  48. package/es/number-input/utils/validation.js +66 -51
  49. package/es/otherUtils.d.ts +9 -12
  50. package/es/otherUtils.js +129 -71
  51. package/es/platform.d.ts +9 -12
  52. package/es/platform.js +85 -61
  53. package/es/select/hooks/index.d.ts +5 -0
  54. package/es/select/hooks/index.js +6 -0
  55. package/es/select/hooks/useDebouncedSearch.d.ts +1 -4
  56. package/es/select/hooks/useDebouncedSearch.js +53 -39
  57. package/es/select/hooks/useSelectState.d.ts +7 -7
  58. package/es/select/hooks/useSelectState.js +113 -56
  59. package/es/select/index.d.ts +8 -7
  60. package/es/select/index.js +13 -0
  61. package/es/select/types.d.ts +211 -211
  62. package/es/select/types.js +1 -0
  63. package/es/select/utils/filterOptions.d.ts +6 -7
  64. package/es/select/utils/filterOptions.js +31 -26
  65. package/es/select/utils/helpers.d.ts +9 -10
  66. package/es/select/utils/helpers.js +52 -42
  67. package/es/select/utils/index.d.ts +7 -4
  68. package/es/select/utils/index.js +8 -0
  69. package/es/select/utils/sortOptions.d.ts +5 -6
  70. package/es/select/utils/sortOptions.js +31 -19
  71. package/es/select/utils/tagAggregation.d.ts +6 -6
  72. package/es/select/utils/tagAggregation.js +47 -34
  73. package/es/text-input/hooks/index.d.ts +4 -0
  74. package/es/text-input/hooks/index.js +5 -0
  75. package/es/text-input/hooks/useTextInputState.d.ts +2 -6
  76. package/es/text-input/hooks/useTextInputState.js +126 -69
  77. package/es/text-input/index.d.ts +14 -0
  78. package/es/text-input/index.js +20 -0
  79. package/es/text-input/types.d.ts +48 -48
  80. package/es/text-input/types.js +1 -0
  81. package/es/text-input/utils/index.d.ts +5 -0
  82. package/es/text-input/utils/index.js +7 -0
  83. package/es/text-input/utils/validation.d.ts +2 -7
  84. package/es/text-input/utils/validation.js +70 -50
  85. package/es/typeUtils.js +84 -61
  86. package/es/walletValidity.d.ts +42 -44
  87. package/es/walletValidity.js +557 -396
  88. package/es/weighing.d.ts +45 -48
  89. package/es/weighing.js +106 -83
  90. package/lib/arrayUtils.d.ts +23 -26
  91. package/lib/arrayUtils.js +111 -101
  92. package/lib/common/index.d.ts +5 -0
  93. package/lib/common/index.js +29 -0
  94. package/lib/common/stateHelper.d.ts +2 -6
  95. package/lib/common/stateHelper.js +32 -21
  96. package/lib/common/types.d.ts +10 -13
  97. package/lib/common/types.js +17 -0
  98. package/lib/componentStorage.d.ts +25 -27
  99. package/lib/componentStorage.js +126 -96
  100. package/lib/constants/index.js +36 -7
  101. package/lib/date.js +65 -43
  102. package/lib/document.js +62 -46
  103. package/lib/escPosPrinter/EscPosPrinter.js +403 -327
  104. package/lib/escPosPrinter/index.d.ts +9 -9
  105. package/lib/escPosPrinter/index.js +84 -38
  106. package/lib/firebase/config/index.js +79 -0
  107. package/lib/firebase/index.js +180 -0
  108. package/lib/format.d.ts +15 -12
  109. package/lib/format.js +133 -91
  110. package/lib/image.js +74 -48
  111. package/lib/index.d.ts +24 -39
  112. package/lib/index.js +80 -137
  113. package/lib/jsBridge/index.d.ts +4 -8
  114. package/lib/jsBridge/index.js +76 -57
  115. package/lib/jsBridge/regDeviceApi.js +133 -86
  116. package/lib/jsBridge/types.d.ts +115 -95
  117. package/lib/jsBridge/types.js +17 -0
  118. package/lib/locales.d.ts +8 -11
  119. package/lib/locales.js +90 -79
  120. package/lib/log.d.ts +6 -11
  121. package/lib/log.js +61 -37
  122. package/lib/miniRedux.d.ts +13 -20
  123. package/lib/miniRedux.js +89 -43
  124. package/lib/number-input/hooks/index.d.ts +4 -0
  125. package/lib/number-input/hooks/index.js +29 -0
  126. package/lib/number-input/hooks/useNumberInputState.d.ts +2 -6
  127. package/lib/number-input/hooks/useNumberInputState.js +81 -71
  128. package/lib/number-input/index.d.ts +14 -0
  129. package/lib/number-input/index.js +41 -0
  130. package/lib/number-input/types.d.ts +88 -88
  131. package/lib/number-input/types.js +17 -0
  132. package/lib/number-input/utils/formatter.d.ts +10 -13
  133. package/lib/number-input/utils/formatter.js +49 -52
  134. package/lib/number-input/utils/index.d.ts +7 -0
  135. package/lib/number-input/utils/index.js +39 -0
  136. package/lib/number-input/utils/validation.d.ts +2 -7
  137. package/lib/number-input/utils/validation.js +52 -50
  138. package/lib/otherUtils.d.ts +9 -12
  139. package/lib/otherUtils.js +98 -86
  140. package/lib/platform.d.ts +9 -12
  141. package/lib/platform.js +123 -68
  142. package/lib/select/hooks/index.d.ts +5 -0
  143. package/lib/select/hooks/index.js +34 -0
  144. package/lib/select/hooks/useDebouncedSearch.d.ts +1 -4
  145. package/lib/select/hooks/useDebouncedSearch.js +41 -40
  146. package/lib/select/hooks/useSelectState.d.ts +7 -7
  147. package/lib/select/hooks/useSelectState.js +93 -58
  148. package/lib/select/index.d.ts +8 -7
  149. package/lib/select/index.js +53 -0
  150. package/lib/select/types.d.ts +211 -211
  151. package/lib/select/types.js +17 -0
  152. package/lib/select/utils/filterOptions.d.ts +6 -7
  153. package/lib/select/utils/filterOptions.js +37 -26
  154. package/lib/select/utils/helpers.d.ts +9 -10
  155. package/lib/select/utils/helpers.js +41 -45
  156. package/lib/select/utils/index.d.ts +7 -4
  157. package/lib/select/utils/index.js +48 -0
  158. package/lib/select/utils/sortOptions.d.ts +5 -6
  159. package/lib/select/utils/sortOptions.js +39 -18
  160. package/lib/select/utils/tagAggregation.d.ts +6 -6
  161. package/lib/select/utils/tagAggregation.js +41 -33
  162. package/lib/text-input/hooks/index.d.ts +4 -0
  163. package/lib/text-input/hooks/index.js +29 -0
  164. package/lib/text-input/hooks/useTextInputState.d.ts +2 -6
  165. package/lib/text-input/hooks/useTextInputState.js +79 -69
  166. package/lib/text-input/index.d.ts +14 -0
  167. package/lib/text-input/index.js +35 -0
  168. package/lib/text-input/types.d.ts +48 -48
  169. package/lib/text-input/types.js +17 -0
  170. package/lib/text-input/utils/index.d.ts +5 -0
  171. package/lib/text-input/utils/index.js +32 -0
  172. package/lib/text-input/utils/validation.d.ts +2 -7
  173. package/lib/text-input/utils/validation.js +58 -49
  174. package/lib/typeUtils.js +73 -68
  175. package/lib/walletValidity.d.ts +42 -44
  176. package/lib/walletValidity.js +393 -410
  177. package/lib/weighing.d.ts +45 -48
  178. package/lib/weighing.js +149 -104
  179. package/package.json +1 -1
  180. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +0 -27
  181. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +0 -12
  182. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +0 -25
  183. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +0 -14
  184. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +0 -9
  185. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +0 -11
  186. package/es/date.d.ts +0 -31
  187. package/es/document.d.ts +0 -16
  188. package/es/image.d.ts +0 -14
  189. package/es/typeUtils.d.ts +0 -45
  190. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +0 -27
  191. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +0 -12
  192. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +0 -25
  193. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +0 -14
  194. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +0 -9
  195. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +0 -16
  196. package/lib/_virtual/_rolldown/runtime.js +0 -23
  197. package/lib/date.d.ts +0 -31
  198. package/lib/document.d.ts +0 -16
  199. package/lib/image.d.ts +0 -14
  200. package/lib/typeUtils.d.ts +0 -45
@@ -1,405 +1,481 @@
1
- const ALIGN_LEFT = 0;
2
- const ALIGN_CENTER = 1;
3
- const ALIGN_RIGHT = 2;
4
- const EscPosPrinter = function(dotsPerLine) {
5
- if (dotsPerLine != 384 && dotsPerLine != 576) dotsPerLine = 384;
6
- this.widthOfColumns = new Array(6);
7
- this.dotsPerLine = dotsPerLine;
8
- this.charHSize = 1;
9
- this.orderData = "";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/escPosPrinter/EscPosPrinter.js
20
+ var EscPosPrinter_exports = {};
21
+ __export(EscPosPrinter_exports, {
22
+ ALIGN_CENTER: () => ALIGN_CENTER,
23
+ ALIGN_LEFT: () => ALIGN_LEFT,
24
+ ALIGN_RIGHT: () => ALIGN_RIGHT,
25
+ HRI_POS_ABOVE: () => HRI_POS_ABOVE,
26
+ HRI_POS_BELOW: () => HRI_POS_BELOW,
27
+ MAX_COLUMNS: () => MAX_COLUMNS,
28
+ columnWidthWithAlignment: () => columnWidthWithAlignment,
29
+ default: () => EscPosPrinter_default
30
+ });
31
+ module.exports = __toCommonJS(EscPosPrinter_exports);
32
+ var MAX_COLUMNS = 6;
33
+ var ALIGN_LEFT = 0;
34
+ var ALIGN_CENTER = 1;
35
+ var ALIGN_RIGHT = 2;
36
+ var HRI_POS_ABOVE = 1;
37
+ var HRI_POS_BELOW = 2;
38
+ var EscPosPrinter = function(dotsPerLine) {
39
+ if (dotsPerLine != 384 && dotsPerLine != 576)
40
+ dotsPerLine = 384;
41
+ this.widthOfColumns = new Array(MAX_COLUMNS);
42
+ this.dotsPerLine = dotsPerLine;
43
+ this.charHSize = 1;
44
+ this.orderData = "";
10
45
  };
11
46
  function _numToHexStr(n, bytes) {
12
- var str = "";
13
- var v;
14
- for (var i = 0; i < bytes; i++) {
15
- v = n & 255;
16
- if (v < 16) str += "0" + v.toString(16);
17
- else str += v.toString(16);
18
- n >>= 8;
19
- }
20
- return str;
47
+ var str = "";
48
+ var v;
49
+ for (var i = 0; i < bytes; i++) {
50
+ v = n & 255;
51
+ if (v < 16) str += "0" + v.toString(16);
52
+ else str += v.toString(16);
53
+ n >>= 8;
54
+ }
55
+ return str;
21
56
  }
22
57
  function _unicodeToUtf8(unicode) {
23
- var c1, c2, c3, c4;
24
- if (unicode < 0) return "";
25
- if (unicode <= 127) {
26
- c1 = unicode & 127;
27
- return _numToHexStr(c1, 1);
28
- }
29
- if (unicode <= 2047) {
30
- c1 = unicode >> 6 & 31 | 192;
31
- c2 = unicode & 63 | 128;
32
- return _numToHexStr(c1, 1) + _numToHexStr(c2, 1);
33
- }
34
- if (unicode <= 65535) {
35
- c1 = unicode >> 12 & 15 | 224;
36
- c2 = unicode >> 6 & 63 | 128;
37
- c3 = unicode & 63 | 128;
38
- return _numToHexStr(c1, 1) + _numToHexStr(c2, 1) + _numToHexStr(c3, 1);
39
- }
40
- if (unicode <= 1114111) {
41
- c1 = unicode >> 18 & 7 | 240;
42
- c2 = unicode >> 12 & 63 | 128;
43
- c3 = unicode >> 6 & 63 | 128;
44
- c4 = unicode & 63 | 128;
45
- return _numToHexStr(c1, 1) + _numToHexStr(c2, 1) + _numToHexStr(c3, 1) + _numToHexStr(c4, 1);
46
- }
47
- return "";
58
+ var c1, c2, c3, c4;
59
+ if (unicode < 0) return "";
60
+ if (unicode <= 127) {
61
+ c1 = unicode & 127;
62
+ return _numToHexStr(c1, 1);
63
+ }
64
+ if (unicode <= 2047) {
65
+ c1 = unicode >> 6 & 31 | 192;
66
+ c2 = unicode & 63 | 128;
67
+ return _numToHexStr(c1, 1) + _numToHexStr(c2, 1);
68
+ }
69
+ if (unicode <= 65535) {
70
+ c1 = unicode >> 12 & 15 | 224;
71
+ c2 = unicode >> 6 & 63 | 128;
72
+ c3 = unicode & 63 | 128;
73
+ return _numToHexStr(c1, 1) + _numToHexStr(c2, 1) + _numToHexStr(c3, 1);
74
+ }
75
+ if (unicode <= 1114111) {
76
+ c1 = unicode >> 18 & 7 | 240;
77
+ c2 = unicode >> 12 & 63 | 128;
78
+ c3 = unicode >> 6 & 63 | 128;
79
+ c4 = unicode & 63 | 128;
80
+ return _numToHexStr(c1, 1) + _numToHexStr(c2, 1) + _numToHexStr(c3, 1) + _numToHexStr(c4, 1);
81
+ }
82
+ return "";
48
83
  }
49
84
  EscPosPrinter.prototype.clear = function() {
50
- this.orderData = "";
85
+ this.orderData = "";
51
86
  };
52
87
  EscPosPrinter.prototype.print = function(host, sn, copies) {
53
- var that = this;
54
- return new Promise(function(resolve, reject) {
55
- var xmlobj = new XMLHttpRequest();
56
- xmlobj.timeout = 1e4;
57
- var url = "https://" + host + "/cgi-bin/print.cgi?sn=" + sn + "&copies=" + copies;
58
- xmlobj.open("POST", url, true);
59
- xmlobj.onreadystatechange = function() {
60
- if (xmlobj.readyState === XMLHttpRequest.DONE) if (xmlobj.status.toString(10) === "200") resolve(/task_id: (\d+)/.exec(xmlobj.responseText)[1] || "");
61
- else reject(xmlobj.responseText);
62
- };
63
- xmlobj.setRequestHeader("Content-Type", "text/plain; charset=utf-8");
64
- xmlobj.send(that.orderData);
65
- });
88
+ var that = this;
89
+ return new Promise(function(resolve, reject) {
90
+ var xmlobj = new XMLHttpRequest();
91
+ xmlobj.timeout = 1e4;
92
+ var url = "https://" + host + "/cgi-bin/print.cgi?sn=" + sn + "&copies=" + copies;
93
+ xmlobj.open("POST", url, true);
94
+ xmlobj.onreadystatechange = function() {
95
+ if (xmlobj.readyState === XMLHttpRequest.DONE) {
96
+ if (xmlobj.status.toString(10) === "200") {
97
+ var re = /task_id: (\d+)/;
98
+ var matches = re.exec(xmlobj.responseText);
99
+ resolve(matches[1] || "");
100
+ } else {
101
+ reject(xmlobj.responseText);
102
+ }
103
+ }
104
+ };
105
+ xmlobj.setRequestHeader("Content-Type", "text/plain; charset=utf-8");
106
+ xmlobj.send(that.orderData);
107
+ });
66
108
  };
67
109
  EscPosPrinter.prototype.queryStatus = function(host, sn, task_id) {
68
- return new Promise(function(resolve, reject) {
69
- var xmlobj = new XMLHttpRequest();
70
- xmlobj.timeout = 1e4;
71
- var url = "https://" + host + "/cgi-bin/status.cgi?sn=" + sn + "&task_id=" + task_id;
72
- xmlobj.open("POST", url, true);
73
- xmlobj.onreadystatechange = function() {
74
- if (xmlobj.readyState === XMLHttpRequest.DONE) if (xmlobj.status.toString(10) === "200") resolve(xmlobj.responseText);
75
- else reject(xmlobj.responseText);
76
- };
77
- xmlobj.setRequestHeader("Content-Type", "text/plain; charset=utf-8");
78
- xmlobj.send();
79
- });
110
+ return new Promise(function(resolve, reject) {
111
+ var xmlobj = new XMLHttpRequest();
112
+ xmlobj.timeout = 1e4;
113
+ var url = "https://" + host + "/cgi-bin/status.cgi?sn=" + sn + "&task_id=" + task_id;
114
+ xmlobj.open("POST", url, true);
115
+ xmlobj.onreadystatechange = function() {
116
+ if (xmlobj.readyState === XMLHttpRequest.DONE) {
117
+ if (xmlobj.status.toString(10) === "200") {
118
+ resolve(xmlobj.responseText);
119
+ } else {
120
+ reject(xmlobj.responseText);
121
+ }
122
+ }
123
+ };
124
+ xmlobj.setRequestHeader("Content-Type", "text/plain; charset=utf-8");
125
+ xmlobj.send();
126
+ });
80
127
  };
81
128
  EscPosPrinter.prototype.appendText = function(str) {
82
- for (var i = 0; i < str.length; i++) this.orderData += _unicodeToUtf8(str.charCodeAt(i));
129
+ for (var i = 0; i < str.length; i++)
130
+ this.orderData += _unicodeToUtf8(str.charCodeAt(i));
83
131
  };
84
132
  EscPosPrinter.prototype.lineFeed = function(n) {
85
- for (var i = 0; i < n; i++) this.orderData += "0a";
133
+ for (var i = 0; i < n; i++) this.orderData += "0a";
86
134
  };
87
135
  EscPosPrinter.prototype.restoreDefaultSettings = function() {
88
- this.charHSize = 1;
89
- this.orderData += "1b40";
136
+ this.charHSize = 1;
137
+ this.orderData += "1b40";
90
138
  };
91
139
  EscPosPrinter.prototype.restoreDefaultLineSpacing = function() {
92
- this.orderData += "1b32";
140
+ this.orderData += "1b32";
93
141
  };
94
142
  EscPosPrinter.prototype.setLineSpacing = function(n) {
95
- if (n >= 0 && n <= 255) this.orderData += "1b33" + _numToHexStr(n, 1);
143
+ if (n >= 0 && n <= 255) this.orderData += "1b33" + _numToHexStr(n, 1);
96
144
  };
97
145
  EscPosPrinter.prototype.setPrintModes = function(bold, double_h, double_w) {
98
- var n = 0;
99
- if (bold) n |= 8;
100
- if (double_h) n |= 16;
101
- if (double_w) n |= 32;
102
- this.charHSize = double_w ? 2 : 1;
103
- this.orderData += "1b21" + _numToHexStr(n, 1);
146
+ var n = 0;
147
+ if (bold) n |= 8;
148
+ if (double_h) n |= 16;
149
+ if (double_w) n |= 32;
150
+ this.charHSize = double_w ? 2 : 1;
151
+ this.orderData += "1b21" + _numToHexStr(n, 1);
104
152
  };
105
153
  EscPosPrinter.prototype.setCharacterSize = function(h, w) {
106
- var n = 0;
107
- if (h >= 1 && h <= 8) n |= h - 1;
108
- if (w >= 1 && w <= 8) {
109
- n |= w - 1 << 4;
110
- this.charHSize = w;
111
- }
112
- this.orderData += "1d21" + _numToHexStr(n, 1);
154
+ var n = 0;
155
+ if (h >= 1 && h <= 8) n |= h - 1;
156
+ if (w >= 1 && w <= 8) {
157
+ n |= w - 1 << 4;
158
+ this.charHSize = w;
159
+ }
160
+ this.orderData += "1d21" + _numToHexStr(n, 1);
113
161
  };
114
162
  EscPosPrinter.prototype.horizontalTab = function(n) {
115
- for (var i = 0; i < n; i++) this.orderData += "09";
163
+ for (var i = 0; i < n; i++) this.orderData += "09";
116
164
  };
117
165
  EscPosPrinter.prototype.setAbsolutePrintPosition = function(n) {
118
- if (n >= 0 && n <= 65535) this.orderData += "1b24" + _numToHexStr(n, 2);
166
+ if (n >= 0 && n <= 65535) this.orderData += "1b24" + _numToHexStr(n, 2);
119
167
  };
120
168
  EscPosPrinter.prototype.setRelativePrintPosition = function(n) {
121
- if (n >= -32768 && n <= 32767) this.orderData += "1b5c" + _numToHexStr(n, 2);
169
+ if (n >= -32768 && n <= 32767) this.orderData += "1b5c" + _numToHexStr(n, 2);
122
170
  };
123
171
  EscPosPrinter.prototype.setAlignment = function(n) {
124
- if (n >= 0 && n <= 2) this.orderData += "1b61" + _numToHexStr(n, 1);
172
+ if (n >= 0 && n <= 2) this.orderData += "1b61" + _numToHexStr(n, 1);
125
173
  };
126
174
  EscPosPrinter.prototype.cutPaper = function(fullCut) {
127
- this.orderData += "1d56" + (fullCut ? "30" : "31");
175
+ this.orderData += "1d56" + (fullCut ? "30" : "31");
128
176
  };
129
177
  EscPosPrinter.prototype.postponedCutPaper = function(fullCut, n) {
130
- if (n >= 0 && n <= 255) this.orderData += "1d56" + (fullCut ? "61" : "62") + _numToHexStr(n, 1);
178
+ if (n >= 0 && n <= 255)
179
+ this.orderData += "1d56" + (fullCut ? "61" : "62") + _numToHexStr(n, 1);
131
180
  };
132
181
  function _widthOfChar(c) {
133
- if (c >= 32 && c <= 879 || c >= 65377 && c <= 65439) return 12;
134
- if (c == 8208 || c >= 8211 && c <= 8214 || c >= 8216 && c <= 8217 || c >= 8220 && c <= 8221 || c >= 8229 && c <= 8230 || c >= 8240 && c <= 8243 || c == 8245 || c == 8251) return 24;
135
- if (c >= 4352 && c <= 4607 || c >= 9312 && c <= 9471 || c >= 9632 && c <= 10175 || c >= 11904 && c <= 12255 || c >= 12288 && c <= 12687 || c >= 12704 && c <= 12783 || c >= 12800 && c <= 40959 || c >= 44032 && c <= 55295 || c >= 63744 && c <= 64255 || c >= 65072 && c <= 65103 || c >= 126976 && c <= 129535) return 24;
136
- if (c >= 65281 && c <= 65374 || c >= 65504 && c <= 65509) return 24;
137
- return 0;
182
+ if (c >= 32 && c <= 879 || c >= 65377 && c <= 65439)
183
+ return 12;
184
+ if (c == 8208 || c >= 8211 && c <= 8214 || c >= 8216 && c <= 8217 || c >= 8220 && c <= 8221 || c >= 8229 && c <= 8230 || c >= 8240 && c <= 8243 || c == 8245 || c == 8251)
185
+ return 24;
186
+ if (c >= 4352 && c <= 4607 || c >= 9312 && c <= 9471 || c >= 9632 && c <= 10175 || c >= 11904 && c <= 12255 || c >= 12288 && c <= 12687 || c >= 12704 && c <= 12783 || c >= 12800 && c <= 40959 || c >= 44032 && c <= 55295 || c >= 63744 && c <= 64255 || c >= 65072 && c <= 65103 || c >= 126976 && c <= 129535)
187
+ return 24;
188
+ if (c >= 65281 && c <= 65374 || c >= 65504 && c <= 65509)
189
+ return 24;
190
+ return 0;
138
191
  }
139
192
  function columnWidthWithAlignment(width, alignment) {
140
- return width & 65535 | (alignment & 3) << 16;
193
+ return width & 65535 | (alignment & 3) << 16;
141
194
  }
142
195
  function _columnWidth(v) {
143
- return v & 65535;
196
+ return v & 65535;
144
197
  }
145
198
  function _columnAlignment(v) {
146
- return v >> 16 & 3;
199
+ return v >> 16 & 3;
147
200
  }
148
201
  EscPosPrinter.prototype.setColumnWidths = function() {
149
- var i, remain, width, alignment;
150
- if (arguments.length == 0) return;
151
- for (i = 0; i < 6; i++) this.widthOfColumns[i] = 0;
152
- remain = this.dotsPerLine;
153
- for (i = 0; i < arguments.length; i++) {
154
- if (i == 6) return;
155
- width = _columnWidth(arguments[i]);
156
- alignment = _columnAlignment(arguments[i]);
157
- if (width == 0 || width > remain) {
158
- this.widthOfColumns[i] = columnWidthWithAlignment(remain, alignment);
159
- return;
160
- }
161
- this.widthOfColumns[i] = arguments[i];
162
- remain -= width;
163
- }
202
+ var i, remain, width, alignment;
203
+ if (arguments.length == 0) return;
204
+ for (i = 0; i < MAX_COLUMNS; i++) this.widthOfColumns[i] = 0;
205
+ remain = this.dotsPerLine;
206
+ for (i = 0; i < arguments.length; i++) {
207
+ if (i == MAX_COLUMNS)
208
+ return;
209
+ width = _columnWidth(arguments[i]);
210
+ alignment = _columnAlignment(arguments[i]);
211
+ if (width == 0 || width > remain) {
212
+ this.widthOfColumns[i] = columnWidthWithAlignment(remain, alignment);
213
+ return;
214
+ }
215
+ this.widthOfColumns[i] = arguments[i];
216
+ remain -= width;
217
+ }
164
218
  };
165
219
  EscPosPrinter.prototype.printInColumns = function() {
166
- var strcurr = new Array(6);
167
- var strrem = new Array(6);
168
- var strwidth = new Array(6);
169
- var i, j, c, w, columns, width, alignment, pos;
170
- var done;
171
- if (arguments.length == 0) return;
172
- columns = 0;
173
- for (i = 0; i < arguments.length; i++) {
174
- if (i == 6 || this.widthOfColumns[i] == 0) break;
175
- strcurr[i] = "";
176
- strrem[i] = arguments[i];
177
- columns++;
178
- }
179
- do {
180
- done = true;
181
- pos = 0;
182
- for (i = 0; i < columns; i++) {
183
- width = _columnWidth(this.widthOfColumns[i]);
184
- if (strrem[i].length == 0) {
185
- pos += width;
186
- continue;
187
- }
188
- done = false;
189
- strcurr[i] = "";
190
- strwidth[i] = 0;
191
- for (j = 0; j < strrem[i].length; j++) {
192
- c = strrem[i].charCodeAt(j);
193
- if (c == 10) {
194
- j++;
195
- break;
196
- } else {
197
- w = _widthOfChar(c);
198
- if (w == 0) {
199
- c = "?";
200
- w = 12;
201
- }
202
- w *= this.charHSize;
203
- if (strwidth[i] + w > width) break;
204
- else {
205
- strcurr[i] += String.fromCharCode(c);
206
- strwidth[i] += w;
207
- }
208
- }
209
- }
210
- if (j < strrem[i].length) strrem[i] = strrem[i].substring(j);
211
- else strrem[i] = "";
212
- alignment = _columnAlignment(this.widthOfColumns[i]);
213
- switch (alignment) {
214
- case 1:
215
- this.setAbsolutePrintPosition(pos + (width - strwidth[i]) / 2);
216
- break;
217
- case 2:
218
- this.setAbsolutePrintPosition(pos + (width - strwidth[i]));
219
- break;
220
- default:
221
- this.setAbsolutePrintPosition(pos);
222
- break;
223
- }
224
- this.appendText(strcurr[i]);
225
- pos += width;
226
- }
227
- if (!done) this.lineFeed(1);
228
- } while (!done);
220
+ var strcurr = new Array(MAX_COLUMNS);
221
+ var strrem = new Array(MAX_COLUMNS);
222
+ var strwidth = new Array(MAX_COLUMNS);
223
+ var i, j, c, w, columns, width, alignment, pos;
224
+ var done;
225
+ if (arguments.length == 0) return;
226
+ columns = 0;
227
+ for (i = 0; i < arguments.length; i++) {
228
+ if (i == MAX_COLUMNS || this.widthOfColumns[i] == 0) break;
229
+ strcurr[i] = "";
230
+ strrem[i] = arguments[i];
231
+ columns++;
232
+ }
233
+ do {
234
+ done = true;
235
+ pos = 0;
236
+ for (i = 0; i < columns; i++) {
237
+ width = _columnWidth(this.widthOfColumns[i]);
238
+ if (strrem[i].length == 0) {
239
+ pos += width;
240
+ continue;
241
+ }
242
+ done = false;
243
+ strcurr[i] = "";
244
+ strwidth[i] = 0;
245
+ for (j = 0; j < strrem[i].length; j++) {
246
+ c = strrem[i].charCodeAt(j);
247
+ if (c == 10) {
248
+ j++;
249
+ break;
250
+ } else {
251
+ w = _widthOfChar(c);
252
+ if (w == 0) {
253
+ c = "?";
254
+ w = 12;
255
+ }
256
+ w *= this.charHSize;
257
+ if (strwidth[i] + w > width) {
258
+ break;
259
+ } else {
260
+ strcurr[i] += String.fromCharCode(c);
261
+ strwidth[i] += w;
262
+ }
263
+ }
264
+ }
265
+ if (j < strrem[i].length) strrem[i] = strrem[i].substring(j);
266
+ else strrem[i] = "";
267
+ alignment = _columnAlignment(this.widthOfColumns[i]);
268
+ switch (alignment) {
269
+ case ALIGN_CENTER:
270
+ this.setAbsolutePrintPosition(pos + (width - strwidth[i]) / 2);
271
+ break;
272
+ case ALIGN_RIGHT:
273
+ this.setAbsolutePrintPosition(pos + (width - strwidth[i]));
274
+ break;
275
+ default:
276
+ this.setAbsolutePrintPosition(pos);
277
+ break;
278
+ }
279
+ this.appendText(strcurr[i]);
280
+ pos += width;
281
+ }
282
+ if (!done) this.lineFeed(1);
283
+ } while (!done);
229
284
  };
230
285
  EscPosPrinter.prototype.appendBarcode = function(hri_pos, height, module_size, barcode_type, text) {
231
- var text_length = text.length;
232
- if (text_length == 0) return;
233
- if (text_length > 255) text_length = 255;
234
- if (height < 1) height = 1;
235
- else if (height > 255) height = 255;
236
- if (module_size < 1) module_size = 1;
237
- else if (module_size > 6) module_size = 6;
238
- this.orderData += "1d48" + _numToHexStr(hri_pos & 3, 1);
239
- this.orderData += "1d6600";
240
- this.orderData += "1d68" + _numToHexStr(height, 1);
241
- this.orderData += "1d77" + _numToHexStr(module_size, 1);
242
- this.orderData += "1d6b" + _numToHexStr(barcode_type, 1) + _numToHexStr(text_length, 1);
243
- for (var i = 0; i < text_length; i++) this.orderData += _numToHexStr(text.charCodeAt(i), 1);
286
+ var text_length = text.length;
287
+ if (text_length == 0) return;
288
+ if (text_length > 255) text_length = 255;
289
+ if (height < 1) height = 1;
290
+ else if (height > 255) height = 255;
291
+ if (module_size < 1) module_size = 1;
292
+ else if (module_size > 6) module_size = 6;
293
+ this.orderData += "1d48" + _numToHexStr(hri_pos & 3, 1);
294
+ this.orderData += "1d6600";
295
+ this.orderData += "1d68" + _numToHexStr(height, 1);
296
+ this.orderData += "1d77" + _numToHexStr(module_size, 1);
297
+ this.orderData += "1d6b" + _numToHexStr(barcode_type, 1) + _numToHexStr(text_length, 1);
298
+ for (var i = 0; i < text_length; i++)
299
+ this.orderData += _numToHexStr(text.charCodeAt(i), 1);
244
300
  };
245
301
  EscPosPrinter.prototype.appendQRcode = function(module_size, ec_level, text) {
246
- var text_length = text.length;
247
- if (text_length == 0) return;
248
- if (text_length > 65535) text_length = 65535;
249
- if (module_size < 1) module_size = 1;
250
- else if (module_size > 16) module_size = 16;
251
- if (ec_level < 0) ec_level = 0;
252
- else if (ec_level > 3) ec_level = 3;
253
- this.orderData += "1d286b040031410000";
254
- this.orderData += "1d286b03003143" + _numToHexStr(module_size, 1);
255
- this.orderData += "1d286b03003145" + _numToHexStr(ec_level + 48, 1);
256
- this.orderData += "1d286b" + _numToHexStr(text_length + 3, 2) + "315030";
257
- for (var i = 0; i < text_length; i++) this.orderData += _numToHexStr(text.charCodeAt(i), 1);
258
- this.orderData += "1d286b0300315130";
302
+ var text_length = text.length;
303
+ if (text_length == 0) return;
304
+ if (text_length > 65535) text_length = 65535;
305
+ if (module_size < 1) module_size = 1;
306
+ else if (module_size > 16) module_size = 16;
307
+ if (ec_level < 0) ec_level = 0;
308
+ else if (ec_level > 3) ec_level = 3;
309
+ this.orderData += "1d286b040031410000";
310
+ this.orderData += "1d286b03003143" + _numToHexStr(module_size, 1);
311
+ this.orderData += "1d286b03003145" + _numToHexStr(ec_level + 48, 1);
312
+ this.orderData += "1d286b" + _numToHexStr(text_length + 3, 2) + "315030";
313
+ for (var i = 0; i < text_length; i++)
314
+ this.orderData += _numToHexStr(text.charCodeAt(i), 1);
315
+ this.orderData += "1d286b0300315130";
259
316
  };
260
317
  function _diffuseDither(src_data, width, height) {
261
- if (width <= 0 || height <= 0) return null;
262
- if (src_data.length < width * height) return null;
263
- var bmwidth = width + 7 >> 3;
264
- var dst_data = new Array(bmwidth * height);
265
- var line_buffer = new Array(2 * width);
266
- var i, p, q, x, y, mask;
267
- var line1, line2, b1, b2, tmp;
268
- var err, e1, e3, e5, e7;
269
- var not_last_line;
270
- line1 = 0;
271
- line2 = 1;
272
- for (i = 0; i < width; i++) {
273
- line_buffer[i] = 0;
274
- line_buffer[width + i] = src_data[i];
275
- }
276
- for (y = 0; y < height; y++) {
277
- tmp = line1;
278
- line1 = line2;
279
- line2 = tmp;
280
- not_last_line = y < height - 1;
281
- if (not_last_line) {
282
- p = (y + 1) * width;
283
- for (i = 0; i < width; i++) {
284
- line_buffer[line2 * width + i] = src_data[p];
285
- p++;
286
- }
287
- }
288
- q = y * bmwidth;
289
- for (i = 0; i < bmwidth; i++) {
290
- dst_data[q] = 0;
291
- q++;
292
- }
293
- b1 = 0;
294
- b2 = 0;
295
- q = y * bmwidth;
296
- mask = 128;
297
- for (x = 1; x <= width; x++) {
298
- var idx = line1 * width + b1;
299
- if (line_buffer[idx] < 128) {
300
- err = line_buffer[idx];
301
- dst_data[q] |= mask;
302
- } else err = line_buffer[idx] - 255;
303
- b1++;
304
- if (mask == 1) {
305
- q++;
306
- mask = 128;
307
- } else mask >>= 1;
308
- e7 = err * 7 + 8 >> 4;
309
- e5 = err * 5 + 8 >> 4;
310
- e3 = err * 3 + 8 >> 4;
311
- e1 = err - (e7 + e5 + e3);
312
- if (x < width) line_buffer[line1 * width + b1] += e7;
313
- if (not_last_line) {
314
- line_buffer[line2 * width + b2] += e5;
315
- if (x > 1) line_buffer[line2 * width + b2 - 1] += e3;
316
- if (x < width) line_buffer[line2 * width + b2 + 1] += e1;
317
- }
318
- b2++;
319
- }
320
- }
321
- return dst_data;
318
+ if (width <= 0 || height <= 0) return null;
319
+ if (src_data.length < width * height) return null;
320
+ var bmwidth = width + 7 >> 3;
321
+ var dst_data = new Array(bmwidth * height);
322
+ var line_buffer = new Array(2 * width);
323
+ var i, p, q, x, y, mask;
324
+ var line1, line2, b1, b2, tmp;
325
+ var err, e1, e3, e5, e7;
326
+ var not_last_line;
327
+ line1 = 0;
328
+ line2 = 1;
329
+ for (i = 0; i < width; i++) {
330
+ line_buffer[i] = 0;
331
+ line_buffer[width + i] = src_data[i];
332
+ }
333
+ for (y = 0; y < height; y++) {
334
+ tmp = line1;
335
+ line1 = line2;
336
+ line2 = tmp;
337
+ not_last_line = y < height - 1;
338
+ if (not_last_line) {
339
+ p = (y + 1) * width;
340
+ for (i = 0; i < width; i++) {
341
+ line_buffer[line2 * width + i] = src_data[p];
342
+ p++;
343
+ }
344
+ }
345
+ q = y * bmwidth;
346
+ for (i = 0; i < bmwidth; i++) {
347
+ dst_data[q] = 0;
348
+ q++;
349
+ }
350
+ b1 = 0;
351
+ b2 = 0;
352
+ q = y * bmwidth;
353
+ mask = 128;
354
+ for (x = 1; x <= width; x++) {
355
+ var idx = line1 * width + b1;
356
+ if (line_buffer[idx] < 128) {
357
+ err = line_buffer[idx];
358
+ dst_data[q] |= mask;
359
+ } else {
360
+ err = line_buffer[idx] - 255;
361
+ }
362
+ b1++;
363
+ if (mask == 1) {
364
+ q++;
365
+ mask = 128;
366
+ } else {
367
+ mask >>= 1;
368
+ }
369
+ e7 = err * 7 + 8 >> 4;
370
+ e5 = err * 5 + 8 >> 4;
371
+ e3 = err * 3 + 8 >> 4;
372
+ e1 = err - (e7 + e5 + e3);
373
+ if (x < width) line_buffer[line1 * width + b1] += e7;
374
+ if (not_last_line) {
375
+ line_buffer[line2 * width + b2] += e5;
376
+ if (x > 1) line_buffer[line2 * width + b2 - 1] += e3;
377
+ if (x < width) line_buffer[line2 * width + b2 + 1] += e1;
378
+ }
379
+ b2++;
380
+ }
381
+ }
382
+ return dst_data;
322
383
  }
323
384
  function _thresholdDither(src_data, width, height) {
324
- if (width <= 0 || height <= 0) return null;
325
- if (src_data.length < width * height) return null;
326
- var bmwidth = width + 7 >> 3;
327
- var dst_data = new Array(bmwidth * height);
328
- var p = 0, q = 0, k, x, y, mask;
329
- for (y = 0; y < height; y++) {
330
- k = q;
331
- mask = 128;
332
- for (x = 0; x < width; x++) {
333
- if (src_data[p] < 128) dst_data[k] |= mask;
334
- p++;
335
- if (mask == 1) {
336
- k++;
337
- mask = 128;
338
- } else mask >>= 1;
339
- }
340
- q += bmwidth;
341
- }
342
- return dst_data;
385
+ if (width <= 0 || height <= 0) return null;
386
+ if (src_data.length < width * height) return null;
387
+ var bmwidth = width + 7 >> 3;
388
+ var dst_data = new Array(bmwidth * height);
389
+ var p, q, k, x, y, mask;
390
+ p = 0;
391
+ q = 0;
392
+ for (y = 0; y < height; y++) {
393
+ k = q;
394
+ mask = 128;
395
+ for (x = 0; x < width; x++) {
396
+ if (src_data[p] < 128) {
397
+ dst_data[k] |= mask;
398
+ }
399
+ p++;
400
+ if (mask == 1) {
401
+ k++;
402
+ mask = 128;
403
+ } else {
404
+ mask >>= 1;
405
+ }
406
+ }
407
+ q += bmwidth;
408
+ }
409
+ return dst_data;
343
410
  }
344
411
  function _convertToGray(imgdata, width, height) {
345
- var gray_data = new Array(width * height);
346
- var i = 0, j = 0, x, y, r, g, b;
347
- for (y = 0; y < height; y++) for (x = 0; x < width; x++) {
348
- r = imgdata.data[j++] & 255;
349
- g = imgdata.data[j++] & 255;
350
- b = imgdata.data[j++] & 255;
351
- j++;
352
- gray_data[i++] = r * 11 + g * 16 + b * 5 >> 5 & 255;
353
- }
354
- return gray_data;
412
+ var gray_data = new Array(width * height);
413
+ var i = 0, j = 0, x, y, r, g, b;
414
+ for (y = 0; y < height; y++) {
415
+ for (x = 0; x < width; x++) {
416
+ r = imgdata.data[j++] & 255;
417
+ g = imgdata.data[j++] & 255;
418
+ b = imgdata.data[j++] & 255;
419
+ j++;
420
+ gray_data[i++] = r * 11 + g * 16 + b * 5 >> 5 & 255;
421
+ }
422
+ }
423
+ return gray_data;
355
424
  }
356
425
  EscPosPrinter.prototype.appendImage = function(imgdata, dither) {
357
- var gray_data, mono_data;
358
- var w = imgdata.width;
359
- var h = imgdata.height;
360
- gray_data = _convertToGray(imgdata, w, h);
361
- if (dither == "diffuse") mono_data = _diffuseDither(gray_data, w, h);
362
- else mono_data = _thresholdDither(gray_data, w, h);
363
- w = w + 7 >> 3;
364
- this.orderData += "1d763000";
365
- this.orderData += _numToHexStr(w, 2);
366
- this.orderData += _numToHexStr(h, 2);
367
- for (var i = 0; i < mono_data.length; i++) this.orderData += _numToHexStr(mono_data[i] & 255, 1);
426
+ var gray_data, mono_data;
427
+ var w = imgdata.width;
428
+ var h = imgdata.height;
429
+ gray_data = _convertToGray(imgdata, w, h);
430
+ if (dither == "diffuse") mono_data = _diffuseDither(gray_data, w, h);
431
+ else
432
+ mono_data = _thresholdDither(gray_data, w, h);
433
+ w = w + 7 >> 3;
434
+ this.orderData += "1d763000";
435
+ this.orderData += _numToHexStr(w, 2);
436
+ this.orderData += _numToHexStr(h, 2);
437
+ for (var i = 0; i < mono_data.length; i++)
438
+ this.orderData += _numToHexStr(mono_data[i] & 255, 1);
368
439
  };
369
440
  EscPosPrinter.prototype.enterPageMode = function() {
370
- this.orderData += "1b4c";
441
+ this.orderData += "1b4c";
371
442
  };
372
443
  EscPosPrinter.prototype.setPrintAreaInPageMode = function(x, y, w, h) {
373
- this.orderData += "1b57";
374
- this.orderData += _numToHexStr(x, 2);
375
- this.orderData += _numToHexStr(y, 2);
376
- this.orderData += _numToHexStr(w, 2);
377
- this.orderData += _numToHexStr(h, 2);
444
+ this.orderData += "1b57";
445
+ this.orderData += _numToHexStr(x, 2);
446
+ this.orderData += _numToHexStr(y, 2);
447
+ this.orderData += _numToHexStr(w, 2);
448
+ this.orderData += _numToHexStr(h, 2);
378
449
  };
379
450
  EscPosPrinter.prototype.setPrintDirectionInPageMode = function(dir) {
380
- if (dir >= 0 && dir <= 3) this.orderData += "1b54" + _numToHexStr(dir, 1);
451
+ if (dir >= 0 && dir <= 3) this.orderData += "1b54" + _numToHexStr(dir, 1);
381
452
  };
382
453
  EscPosPrinter.prototype.setAbsolutePrintPositionInPageMode = function(n) {
383
- if (n >= 0 && n <= 65535) this.orderData += "1d24" + _numToHexStr(n, 2);
454
+ if (n >= 0 && n <= 65535) this.orderData += "1d24" + _numToHexStr(n, 2);
384
455
  };
385
456
  EscPosPrinter.prototype.setRelativePrintPositionInPageMode = function(n) {
386
- if (n >= -32768 && n <= 32767) this.orderData += "1d5c" + _numToHexStr(n, 2);
457
+ if (n >= -32768 && n <= 32767) this.orderData += "1d5c" + _numToHexStr(n, 2);
387
458
  };
388
459
  EscPosPrinter.prototype.printAndExitPageMode = function() {
389
- this.orderData += "0c";
460
+ this.orderData += "0c";
390
461
  };
391
462
  EscPosPrinter.prototype.printInPageMode = function() {
392
- this.orderData += "1b0c";
463
+ this.orderData += "1b0c";
393
464
  };
394
465
  EscPosPrinter.prototype.clearInPageMode = function() {
395
- this.orderData += "18";
466
+ this.orderData += "18";
396
467
  };
397
468
  EscPosPrinter.prototype.exitPageMode = function() {
398
- this.orderData += "1b53";
399
- };
400
- //#endregion
401
- exports.ALIGN_CENTER = ALIGN_CENTER;
402
- exports.ALIGN_LEFT = ALIGN_LEFT;
403
- exports.ALIGN_RIGHT = ALIGN_RIGHT;
404
- exports.columnWidthWithAlignment = columnWidthWithAlignment;
405
- exports.default = EscPosPrinter;
469
+ this.orderData += "1b53";
470
+ };
471
+ var EscPosPrinter_default = EscPosPrinter;
472
+ // Annotate the CommonJS export names for ESM import in node:
473
+ 0 && (module.exports = {
474
+ ALIGN_CENTER,
475
+ ALIGN_LEFT,
476
+ ALIGN_RIGHT,
477
+ HRI_POS_ABOVE,
478
+ HRI_POS_BELOW,
479
+ MAX_COLUMNS,
480
+ columnWidthWithAlignment
481
+ });