@thermal-label/brother-ql-core 0.0.1 → 0.3.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/__tests__/devices.test.js +16 -2
- package/dist/__tests__/devices.test.js.map +1 -1
- package/dist/__tests__/media.test.js +37 -6
- package/dist/__tests__/media.test.js.map +1 -1
- package/dist/__tests__/pack-bits.test.d.ts +2 -0
- package/dist/__tests__/pack-bits.test.d.ts.map +1 -0
- package/dist/__tests__/pack-bits.test.js +90 -0
- package/dist/__tests__/pack-bits.test.js.map +1 -0
- package/dist/__tests__/preview.test.d.ts +2 -0
- package/dist/__tests__/preview.test.d.ts.map +1 -0
- package/dist/__tests__/preview.test.js +41 -0
- package/dist/__tests__/preview.test.js.map +1 -0
- package/dist/__tests__/protocol.test.js +46 -1
- package/dist/__tests__/protocol.test.js.map +1 -1
- package/dist/__tests__/status.test.js +28 -22
- package/dist/__tests__/status.test.js.map +1 -1
- package/dist/devices.d.ts +40 -21
- package/dist/devices.d.ts.map +1 -1
- package/dist/devices.js +38 -20
- package/dist/devices.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/media.d.ts +43 -4
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +92 -24
- package/dist/media.js.map +1 -1
- package/dist/orientation.d.ts +11 -0
- package/dist/orientation.d.ts.map +1 -0
- package/dist/orientation.js +10 -0
- package/dist/orientation.js.map +1 -0
- package/dist/pack-bits.d.ts +20 -0
- package/dist/pack-bits.d.ts.map +1 -0
- package/dist/pack-bits.js +61 -0
- package/dist/pack-bits.js.map +1 -0
- package/dist/preview.d.ts +13 -0
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +31 -0
- package/dist/preview.js.map +1 -0
- package/dist/protocol.d.ts +2 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +14 -8
- package/dist/protocol.js.map +1 -1
- package/dist/status.d.ts +20 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +59 -45
- package/dist/status.js.map +1 -1
- package/dist/types.d.ts +46 -30
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -2
- package/src/__tests__/devices.test.ts +18 -2
- package/src/__tests__/media.test.ts +39 -6
- package/src/__tests__/pack-bits.test.ts +92 -0
- package/src/__tests__/preview.test.ts +52 -0
- package/src/__tests__/protocol.test.ts +47 -1
- package/src/__tests__/status.test.ts +31 -22
- package/src/devices.ts +41 -22
- package/src/index.ts +45 -11
- package/src/media.ts +105 -27
- package/src/orientation.ts +11 -0
- package/src/pack-bits.ts +64 -0
- package/src/preview.ts +35 -0
- package/src/protocol.ts +16 -9
- package/src/status.ts +62 -47
- package/src/types.ts +52 -32
package/src/types.ts
CHANGED
|
@@ -1,43 +1,74 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { LabelBitmap } from '@mbtech-nl/bitmap';
|
|
2
|
+
import type {
|
|
3
|
+
DeviceDescriptor,
|
|
4
|
+
MediaDescriptor,
|
|
5
|
+
PrintOptions,
|
|
6
|
+
PrinterStatus,
|
|
7
|
+
} from '@thermal-label/contracts';
|
|
2
8
|
|
|
3
9
|
export type MediaType = 'continuous' | 'die-cut';
|
|
4
10
|
export type HeadWidth = 720 | 1296;
|
|
5
11
|
export type ColorMode = 'single' | 'two-color';
|
|
6
12
|
export type NetworkSupport = 'none' | 'wifi' | 'wired' | 'wifi+wired';
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Brother QL device descriptor.
|
|
16
|
+
*
|
|
17
|
+
* Extends the contracts base with QL-specific fields: head geometry,
|
|
18
|
+
* protocol feature flags, and the optional mass-storage PID for Editor
|
|
19
|
+
* Lite mode.
|
|
20
|
+
*
|
|
21
|
+
* **Bluetooth on the QL-820NWB / 820NWBc**: not exposed over GATT.
|
|
22
|
+
* Classic Bluetooth (SPP) is paired at the OS level; the kernel/driver
|
|
23
|
+
* exposes an RFCOMM serial port, reachable via the `'serial'` transport
|
|
24
|
+
* in Node.js and the `'web-serial'` transport in Chrome/Edge. macOS has
|
|
25
|
+
* dropped classic Bluetooth SPP — no serial route there.
|
|
26
|
+
*/
|
|
27
|
+
export interface BrotherQLDevice extends DeviceDescriptor {
|
|
28
|
+
family: 'brother-ql';
|
|
10
29
|
vid: number;
|
|
11
30
|
pid: number;
|
|
12
31
|
headPins: HeadWidth;
|
|
13
32
|
bytesPerRow: number;
|
|
14
33
|
twoColor: boolean;
|
|
15
34
|
network: NetworkSupport;
|
|
16
|
-
bluetooth: boolean;
|
|
17
35
|
autocut: boolean;
|
|
18
36
|
compression: boolean;
|
|
19
37
|
editorLite: boolean;
|
|
38
|
+
/** Alternate PID seen when the printer is in Editor Lite mass-storage mode. */
|
|
20
39
|
massStoragePid?: number;
|
|
21
40
|
}
|
|
22
41
|
|
|
23
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Brother QL media descriptor.
|
|
44
|
+
*
|
|
45
|
+
* Extends `MediaDescriptor` with the dots-based geometry the raster
|
|
46
|
+
* encoder needs. The base `palette` field flips the driver into
|
|
47
|
+
* multi-plane mode — only DK-22251 declares one in the registry.
|
|
48
|
+
*/
|
|
49
|
+
export interface BrotherQLMedia extends MediaDescriptor {
|
|
24
50
|
id: number;
|
|
25
|
-
name: string;
|
|
26
51
|
type: MediaType;
|
|
27
|
-
widthMm: number;
|
|
28
|
-
lengthMm: number;
|
|
29
52
|
printAreaDots: number;
|
|
30
53
|
leftMarginPins: number;
|
|
31
54
|
rightMarginPins: number;
|
|
55
|
+
/** Die-cut masked area in dots (registration windows). */
|
|
32
56
|
dieCutMaskedAreaDots?: number;
|
|
33
|
-
|
|
34
|
-
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Brother QL status — contracts `PrinterStatus` plus the
|
|
61
|
+
* `editorLiteMode` flag (pre-paired QL-820NWB silently drops raster
|
|
62
|
+
* jobs when in Editor Lite mode; callers need to know).
|
|
63
|
+
*/
|
|
64
|
+
export interface BrotherQLStatus extends PrinterStatus {
|
|
65
|
+
editorLiteMode: boolean;
|
|
35
66
|
}
|
|
36
67
|
|
|
37
68
|
export interface PageData {
|
|
38
69
|
bitmap: LabelBitmap;
|
|
39
70
|
redBitmap?: LabelBitmap;
|
|
40
|
-
media:
|
|
71
|
+
media: BrotherQLMedia;
|
|
41
72
|
options?: PageOptions;
|
|
42
73
|
}
|
|
43
74
|
|
|
@@ -53,25 +84,14 @@ export interface JobOptions {
|
|
|
53
84
|
copies?: number;
|
|
54
85
|
}
|
|
55
86
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
rotate?: 0 | 90 | 180 | 270;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface PrinterStatus {
|
|
70
|
-
ready: boolean;
|
|
71
|
-
mediaWidthMm: number;
|
|
72
|
-
mediaLengthMm: number;
|
|
73
|
-
mediaType: MediaType | null;
|
|
74
|
-
errors: string[];
|
|
75
|
-
editorLiteMode: boolean;
|
|
76
|
-
rawBytes: Uint8Array;
|
|
87
|
+
/**
|
|
88
|
+
* Per-call print options for `BrotherQLPrinter.print()`.
|
|
89
|
+
*
|
|
90
|
+
* Extends the cross-driver `PrintOptions` with QL-specific knobs. The
|
|
91
|
+
* `rotate` override picks the rotation angle passed to
|
|
92
|
+
* `renderImage` / `renderMultiPlaneImage` — `'auto'` (the default)
|
|
93
|
+
* defers to the media's `defaultOrientation` heuristic.
|
|
94
|
+
*/
|
|
95
|
+
export interface BrotherQLPrintOptions extends PrintOptions {
|
|
96
|
+
rotate?: 'auto' | 0 | 90 | 180 | 270;
|
|
77
97
|
}
|