@rdlabo/capacitor-brotherprint 8.2.1 → 8.2.2-beta.pr46.shaa6a47e6cbc3c
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/README.md +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +6 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces.d.ts +2 -1
- package/dist/esm/interfaces.js.map +1 -1
- package/dist/plugin.cjs.js +6 -8
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +6 -8
- package/dist/plugin.js.map +1 -1
- package/docs/connection-management.md +80 -44
- package/docs/helper-design.md +20 -4
- package/docs/search.md +4 -2
- package/ios/Sources/BrotherPrintPlugin/BrotherPrintPlugin.swift +85 -30
- package/ios/Sources/BrotherPrintPlugin/Model/PrinterModel.swift +38 -68
- package/ios/Sources/BrotherPrintPlugin/Model/PrinterSettingsModel.swift +61 -65
- package/ios/Tests/BrotherPrintPluginTests/BrotherPrintPluginTests.swift +83 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -289,7 +289,7 @@ These are optional. If these are not set, default values are assigned by the pri
|
|
|
289
289
|
|
|
290
290
|
#### BRLMSearchOption
|
|
291
291
|
|
|
292
|
-
<code>{ /** * 'usb' is android only, and now developing. */ port: <a href="#brlmprinterport">BRLMPrinterPort</a>; /** * searchDuration is the time to end search for devices. * default is 15 seconds. *
|
|
292
|
+
<code>{ /** * 'usb' is android only, and now developing. */ port: <a href="#brlmprinterport">BRLMPrinterPort</a>; /** * searchDuration is the time to end search for devices. * default is 15 seconds. * Used for Wi-Fi, BLE, and the iOS Bluetooth accessory picker wait. * Timing out does not dismiss the system accessory picker; close it before retrying. */ searchDuration: number; /** * Android Bluetooth Classic only. Include only devices whose Bluetooth class * reports a printer. Defaults to false; ignored for other ports and on iOS. * This does not identify Brother devices. Devices with an unknown class are excluded when true. */ bluetoothPrintersOnly?: boolean; }</code>
|
|
293
293
|
|
|
294
294
|
|
|
295
295
|
#### isChannelAvailableResult
|
package/dist/docs.json
CHANGED
|
@@ -929,7 +929,7 @@
|
|
|
929
929
|
"docs": "",
|
|
930
930
|
"types": [
|
|
931
931
|
{
|
|
932
|
-
"text": "{\n /**\n * 'usb' is android only, and now developing.\n */\n port: BRLMPrinterPort;\n\n /**\n * searchDuration is the time to end search for devices.\n * default is 15 seconds.\n *
|
|
932
|
+
"text": "{\n /**\n * 'usb' is android only, and now developing.\n */\n port: BRLMPrinterPort;\n\n /**\n * searchDuration is the time to end search for devices.\n * default is 15 seconds.\n * Used for Wi-Fi, BLE, and the iOS Bluetooth accessory picker wait.\n * Timing out does not dismiss the system accessory picker; close it before retrying.\n */\n searchDuration: number;\n /**\n * Android Bluetooth Classic only. Include only devices whose Bluetooth class\n * reports a printer. Defaults to false; ignored for other ports and on iOS.\n * This does not identify Brother devices. Devices with an unknown class are excluded when true.\n */\n bluetoothPrintersOnly?: boolean;\n}",
|
|
933
933
|
"complexTypes": [
|
|
934
934
|
"BRLMPrinterPort"
|
|
935
935
|
]
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export * from './brother-printer.enum';
|
|
|
10
10
|
export { BrotherPrint };
|
|
11
11
|
export * from './printer';
|
|
12
12
|
/** Collect discovery results, waiting for earlier helper calls to finish. */
|
|
13
|
-
export declare function searchBrotherPrinters(options: BRLMSearchOption,
|
|
13
|
+
export declare function searchBrotherPrinters(options: BRLMSearchOption, _model?: BRLMPrinterModelName): Promise<BRLMChannelResult[]>;
|
|
14
14
|
/**
|
|
15
15
|
* Reuse a matching, available previous channel; otherwise discover printers.
|
|
16
16
|
* The caller owns storage. USB always discovers again through the native permission flow.
|
|
@@ -44,7 +44,7 @@ export declare class BrotherPrinterSession {
|
|
|
44
44
|
constructor(options?: BrotherPrinterSessionOptions);
|
|
45
45
|
get closed(): boolean;
|
|
46
46
|
get printers(): readonly BRLMChannelResult[];
|
|
47
|
-
search(options: BRLMSearchOption,
|
|
47
|
+
search(options: BRLMSearchOption, _model?: BRLMPrinterModelName): Promise<readonly BRLMChannelResult[]>;
|
|
48
48
|
prepare(options: BRLMSearchOption, model: BRLMPrinterModelName, previous?: BRLMChannelResult | null): Promise<readonly BRLMChannelResult[]>;
|
|
49
49
|
/** Forget the remembered connection. Storage removal errors propagate to the caller. */
|
|
50
50
|
clearSavedPrinter(): Promise<void>;
|
package/dist/esm/index.js
CHANGED
|
@@ -32,8 +32,8 @@ function queueConnection(run) {
|
|
|
32
32
|
return result;
|
|
33
33
|
}
|
|
34
34
|
/** Collect discovery results, waiting for earlier helper calls to finish. */
|
|
35
|
-
export function searchBrotherPrinters(options,
|
|
36
|
-
return queueConnection(() => discoverPrinters(options
|
|
35
|
+
export function searchBrotherPrinters(options, _model) {
|
|
36
|
+
return queueConnection(() => discoverPrinters(options));
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Reuse a matching, available previous channel; otherwise discover printers.
|
|
@@ -53,13 +53,11 @@ export function checkBrotherPrinterChannel(channel) {
|
|
|
53
53
|
return result;
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
async function discoverPrinters(options,
|
|
56
|
+
async function discoverPrinters(options, active = () => true) {
|
|
57
57
|
const printers = [];
|
|
58
58
|
const listener = await BrotherPrint.addListener(BrotherPrintEventsEnum.onPrinterAvailable, (printer) => {
|
|
59
59
|
if (printer.port !== options.port)
|
|
60
60
|
return;
|
|
61
|
-
if (printer.port !== BRLMPrinterPort.usb && model !== undefined && brotherPrinterModel(printer.modelName) !== model)
|
|
62
|
-
return;
|
|
63
61
|
const index = printers.findIndex((current) => current.port === printer.port && current.channelInfo === printer.channelInfo);
|
|
64
62
|
if (index < 0)
|
|
65
63
|
printers.push(printer);
|
|
@@ -78,7 +76,7 @@ async function preparePrinters(options, model, previous, active = () => true) {
|
|
|
78
76
|
if (available.result)
|
|
79
77
|
return [previous];
|
|
80
78
|
}
|
|
81
|
-
return active() ? discoverPrinters(options,
|
|
79
|
+
return active() ? discoverPrinters(options, active) : [];
|
|
82
80
|
}
|
|
83
81
|
/** One print screen's discovery results and event subscriptions. Create a new session after disposal. */
|
|
84
82
|
export class BrotherPrinterSession {
|
|
@@ -101,8 +99,8 @@ export class BrotherPrinterSession {
|
|
|
101
99
|
get printers() {
|
|
102
100
|
return __classPrivateFieldGet(this, _BrotherPrinterSession_printers, "f");
|
|
103
101
|
}
|
|
104
|
-
search(options,
|
|
105
|
-
return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_discover).call(this, () => discoverPrinters(options,
|
|
102
|
+
search(options, _model) {
|
|
103
|
+
return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_discover).call(this, () => discoverPrinters(options, () => !__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f")));
|
|
106
104
|
}
|
|
107
105
|
prepare(options, model, previous) {
|
|
108
106
|
return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_discover).call(this, async () => {
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,YAAY,GAAG,cAAc,CAAqB,cAAc,EAAE;IACtE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;CAChE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AA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;IAC/C,OAAO,eAAe,CAAC,KAAK,IAAI,EAAE;QAChC,IAAI,uBAAA,IAAI,qCAAQ;YAAE,OAAO,EAAE,CAAC;QAC5B,uBAAA,IAAI,mCAAa,EAAE,MAAA,CAAC;QACpB,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC7B,IAAI,uBAAA,IAAI,qCAAQ;gBAAE,OAAO,EAAE,CAAC;YAC5B,uBAAA,IAAI,mCAAa,QAAQ,MAAA,CAAC;YAC1B,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\nimport { registerPlugin } from '@capacitor/core';\n\nimport type { BRLMPrinterModelName } from './brother-printer.enum';\nimport { BRLMPrinterPort } from './brother-printer.enum';\nimport type { BrotherPrintPlugin } from './definitions';\nimport { BrotherPrintEventsEnum } from './events.enum';\nimport type { BRLMChannelResult, BRLMPrintOptions, BRLMSearchOption, ErrorInfo } from './interfaces';\nimport { brotherPrinterModel } from './printer';\n\nconst BrotherPrint = registerPlugin<BrotherPrintPlugin>('BrotherPrint', {\n web: () => import('./web').then((m) => new m.BrotherPrintWeb()),\n});\n\nexport * from './definitions';\nexport * from './web';\nexport * from './events.enum';\nexport * from './interfaces';\nexport * from './brother-printer.enum';\nexport { BrotherPrint };\n\nexport * from './printer';\n\n// Native discovery events are shared. Keep each helper call's listener scoped to its turn.\nlet connectionQueue: Promise<unknown> = Promise.resolve();\n\nfunction queueConnection<T>(run: () => Promise<T>): Promise<T> {\n const result = connectionQueue.then(run);\n connectionQueue = result.catch(() => undefined);\n return result;\n}\n\n/** Collect discovery results, waiting for earlier helper calls to finish. */\nexport function searchBrotherPrinters(\n options: BRLMSearchOption,\n model?: BRLMPrinterModelName,\n): Promise<BRLMChannelResult[]> {\n return queueConnection(() => discoverPrinters(options, model));\n}\n\n/**\n * Reuse a matching, available previous channel; otherwise discover printers.\n * The caller owns storage. USB always discovers again through the native permission flow.\n * Availability errors propagate; only an unavailable channel triggers discovery.\n */\nexport function prepareBrotherPrinters(\n options: BRLMSearchOption,\n model: BRLMPrinterModelName,\n previous?: BRLMChannelResult | null,\n): Promise<BRLMChannelResult[]> {\n return queueConnection(() => preparePrinters(options, model, previous));\n}\n\n/**\n * Check an explicitly selected address without discovery or fallback to another printer.\n * Port must be supplied; an address does not identify its transport or printer model.\n */\nexport function checkBrotherPrinterChannel(channel: Pick<BRLMChannelResult, 'port' | 'channelInfo'>): Promise<boolean> {\n return queueConnection(async () => {\n const { result } = await BrotherPrint.isChannelAvailable({\n modelName: '',\n serialNumber: '',\n macAddress: '',\n nodeName: '',\n location: '',\n ...channel,\n });\n return result;\n });\n}\n\nasync function discoverPrinters(\n options: BRLMSearchOption,\n model?: BRLMPrinterModelName,\n active: () => boolean = () => true,\n): Promise<BRLMChannelResult[]> {\n const printers: BRLMChannelResult[] = [];\n const listener = await BrotherPrint.addListener(BrotherPrintEventsEnum.onPrinterAvailable, (printer) => {\n if (printer.port !== options.port) return;\n if (printer.port !== BRLMPrinterPort.usb && model !== undefined && brotherPrinterModel(printer.modelName) !== model)\n return;\n const index = printers.findIndex(\n (current) => current.port === printer.port && current.channelInfo === printer.channelInfo,\n );\n if (index < 0) printers.push(printer);\n else printers[index] = printer;\n });\n await (active() ? BrotherPrint.search(options) : Promise.resolve()).finally(() => listener.remove());\n return printers;\n}\n\nasync function preparePrinters(\n options: BRLMSearchOption,\n model: BRLMPrinterModelName,\n previous?: BRLMChannelResult | null,\n active: () => boolean = () => true,\n): Promise<BRLMChannelResult[]> {\n if (\n options.port !== BRLMPrinterPort.usb &&\n previous?.port === options.port &&\n previous.channelInfo.trim() &&\n brotherPrinterModel(previous.modelName) === model\n ) {\n const available = await BrotherPrint.isChannelAvailable(previous);\n if (available.result) return [previous];\n }\n return active() ? discoverPrinters(options, model, active) : [];\n}\n\nexport interface BrotherPrinterEvents {\n onPrint?: () => void;\n onPrintError?: (info: ErrorInfo) => void;\n onPrintFailedCommunication?: (info: ErrorInfo) => void;\n}\n\n/** String storage callbacks; both synchronous and asynchronous stores are supported. */\nexport interface BrotherPrinterStorage {\n get(key: string): string | null | undefined | Promise<string | null | undefined>;\n set(key: string, value: string): unknown;\n remove(key: string): unknown;\n}\n\nexport interface BrotherPrinterSessionOptions {\n storage?: BrotherPrinterStorage;\n /** Defaults to `brotherprint:`. The session appends `last-printer`. */\n storagePrefix?: string;\n}\n\n/** One print screen's discovery results and event subscriptions. Create a new session after disposal. */\nexport class BrotherPrinterSession {\n #closed = false;\n #printers: BRLMChannelResult[] = [];\n #listeners: Promise<PluginListenerHandle>[] = [];\n #listening?: Promise<void>;\n #disposal?: Promise<void>;\n readonly #storage?: BrotherPrinterStorage;\n readonly #storageKey: string;\n\n constructor(options: BrotherPrinterSessionOptions = {}) {\n this.#storage = options.storage;\n this.#storageKey = `${options.storagePrefix ?? 'brotherprint:'}last-printer`;\n }\n\n get closed(): boolean {\n return this.#closed;\n }\n\n get printers(): readonly BRLMChannelResult[] {\n return this.#printers;\n }\n\n search(options: BRLMSearchOption, model?: BRLMPrinterModelName): Promise<readonly BRLMChannelResult[]> {\n return this.#discover(() => discoverPrinters(options, model, () => !this.#closed));\n }\n\n prepare(\n options: BRLMSearchOption,\n model: BRLMPrinterModelName,\n previous?: BRLMChannelResult | null,\n ): Promise<readonly BRLMChannelResult[]> {\n return this.#discover(async () => {\n const saved = previous === undefined ? await this.#readSavedPrinter().catch(() => undefined) : previous;\n if (this.#closed) return [];\n return preparePrinters(options, model, saved, () => !this.#closed);\n });\n }\n\n async #readSavedPrinter(): Promise<BRLMChannelResult | undefined> {\n const value = await this.#storage?.get(this.#storageKey);\n if (!value) return undefined;\n const channel = JSON.parse(value);\n if (\n channel &&\n Object.values(BRLMPrinterPort).includes(channel.port) &&\n ['modelName', 'channelInfo', 'serialNumber', 'macAddress', 'nodeName', 'location'].every(\n (key) => typeof channel[key] === 'string',\n )\n )\n return channel;\n return undefined;\n }\n\n /** Forget the remembered connection. Storage removal errors propagate to the caller. */\n async clearSavedPrinter(): Promise<void> {\n await this.#storage?.remove(this.#storageKey);\n }\n\n async #savePrinter(options: BRLMPrintOptions): Promise<void> {\n if (!this.#storage || !options.port || !options.channelInfo?.trim()) return;\n const found = this.#printers.find(\n (printer) => printer.port === options.port && printer.channelInfo === options.channelInfo,\n );\n const channel: BRLMChannelResult = {\n serialNumber: '',\n macAddress: '',\n nodeName: '',\n location: '',\n ...found,\n port: options.port,\n channelInfo: options.channelInfo,\n modelName: options.modelName,\n };\n await this.#storage.set(this.#storageKey, JSON.stringify(channel));\n }\n\n #discover(run: () => Promise<BRLMChannelResult[]>): Promise<readonly BRLMChannelResult[]> {\n return queueConnection(async () => {\n if (this.#closed) return [];\n this.#printers = [];\n return run().then((printers) => {\n if (this.#closed) return [];\n this.#printers = printers;\n return printers;\n });\n });\n }\n\n /** Register print notifications once. Callbacks stop immediately when disposed. */\n listen(events: BrotherPrinterEvents): Promise<void> {\n if (this.#closed) return Promise.resolve();\n if (!this.#listening) {\n this.#listeners = [\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrint, () => {\n if (!this.#closed) events.onPrint?.();\n }),\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrintError, (info) => {\n if (!this.#closed) events.onPrintError?.(info);\n }),\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrintFailedCommunication, (info) => {\n if (!this.#closed) events.onPrintFailedCommunication?.(info);\n }),\n ];\n this.#listening = Promise.all(this.#listeners).then(() => undefined);\n }\n return this.#listening;\n }\n\n /** A closed session cannot start another print. Already started native printing is awaited. */\n async printImage(options: BRLMPrintOptions): Promise<void> {\n if (this.#closed) return;\n if (this.#storage) await this.#savePrinter(options).catch(() => undefined);\n if (!this.#closed) await BrotherPrint.printImage(options);\n }\n\n /** Invalidate pending work immediately, then remove this session's print listeners. */\n dispose(): Promise<void> {\n this.#closed = true;\n this.#printers = [];\n this.#disposal ??= Promise.all(this.#listeners.map((listener) => listener.then((handle) => handle.remove()))).then(\n () => undefined,\n );\n return this.#disposal;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,YAAY,GAAG,cAAc,CAAqB,cAAc,EAAE;IACtE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;CAChE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,cAAc,WAAW,CAAC;AAE1B,2FAA2F;AAC3F,IAAI,eAAe,GAAqB,OAAO,CAAC,OAAO,EAAE,CAAC;AAE1D,SAAS,eAAe,CAAI,GAAqB;IAC/C,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzC,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,qBAAqB,CACnC,OAAyB,EACzB,MAA6B;IAE7B,OAAO,eAAe,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;;;GAI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CAAC,WAAW,CAC1F,CAAC;IACF,MAAM,OAAO,iCACX,YAAY,EAAE,EAAE,EAChB,UAAU,EAAE,EAAE,EACd,QAAQ,EAAE,EAAE,EACZ,QAAQ,EAAE,EAAE,IACT,KAAK,KACR,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,SAAS,EAAE,OAAO,CAAC,SAAS,GAC7B,CAAC;IACF,MAAM,uBAAA,IAAI,sCAAS,CAAC,GAAG,CAAC,uBAAA,IAAI,yCAAY,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;AACrE,CAAC,6EAES,GAAuC;IAC/C,OAAO,eAAe,CAAC,KAAK,IAAI,EAAE;QAChC,IAAI,uBAAA,IAAI,qCAAQ;YAAE,OAAO,EAAE,CAAC;QAC5B,uBAAA,IAAI,mCAAa,EAAE,MAAA,CAAC;QACpB,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC7B,IAAI,uBAAA,IAAI,qCAAQ;gBAAE,OAAO,EAAE,CAAC;YAC5B,uBAAA,IAAI,mCAAa,QAAQ,MAAA,CAAC;YAC1B,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\nimport { registerPlugin } from '@capacitor/core';\n\nimport type { BRLMPrinterModelName } from './brother-printer.enum';\nimport { BRLMPrinterPort } from './brother-printer.enum';\nimport type { BrotherPrintPlugin } from './definitions';\nimport { BrotherPrintEventsEnum } from './events.enum';\nimport type { BRLMChannelResult, BRLMPrintOptions, BRLMSearchOption, ErrorInfo } from './interfaces';\nimport { brotherPrinterModel } from './printer';\n\nconst BrotherPrint = registerPlugin<BrotherPrintPlugin>('BrotherPrint', {\n web: () => import('./web').then((m) => new m.BrotherPrintWeb()),\n});\n\nexport * from './definitions';\nexport * from './web';\nexport * from './events.enum';\nexport * from './interfaces';\nexport * from './brother-printer.enum';\nexport { BrotherPrint };\n\nexport * from './printer';\n\n// Native discovery events are shared. Keep each helper call's listener scoped to its turn.\nlet connectionQueue: Promise<unknown> = Promise.resolve();\n\nfunction queueConnection<T>(run: () => Promise<T>): Promise<T> {\n const result = connectionQueue.then(run);\n connectionQueue = result.catch(() => undefined);\n return result;\n}\n\n/** Collect discovery results, waiting for earlier helper calls to finish. */\nexport function searchBrotherPrinters(\n options: BRLMSearchOption,\n _model?: BRLMPrinterModelName,\n): Promise<BRLMChannelResult[]> {\n return queueConnection(() => discoverPrinters(options));\n}\n\n/**\n * Reuse a matching, available previous channel; otherwise discover printers.\n * The caller owns storage. USB always discovers again through the native permission flow.\n * Availability errors propagate; only an unavailable channel triggers discovery.\n */\nexport function prepareBrotherPrinters(\n options: BRLMSearchOption,\n model: BRLMPrinterModelName,\n previous?: BRLMChannelResult | null,\n): Promise<BRLMChannelResult[]> {\n return queueConnection(() => preparePrinters(options, model, previous));\n}\n\n/**\n * Check an explicitly selected address without discovery or fallback to another printer.\n * Port must be supplied; an address does not identify its transport or printer model.\n */\nexport function checkBrotherPrinterChannel(channel: Pick<BRLMChannelResult, 'port' | 'channelInfo'>): Promise<boolean> {\n return queueConnection(async () => {\n const { result } = await BrotherPrint.isChannelAvailable({\n modelName: '',\n serialNumber: '',\n macAddress: '',\n nodeName: '',\n location: '',\n ...channel,\n });\n return result;\n });\n}\n\nasync function discoverPrinters(\n options: BRLMSearchOption,\n active: () => boolean = () => true,\n): Promise<BRLMChannelResult[]> {\n const printers: BRLMChannelResult[] = [];\n const listener = await BrotherPrint.addListener(BrotherPrintEventsEnum.onPrinterAvailable, (printer) => {\n if (printer.port !== options.port) return;\n const index = printers.findIndex(\n (current) => current.port === printer.port && current.channelInfo === printer.channelInfo,\n );\n if (index < 0) printers.push(printer);\n else printers[index] = printer;\n });\n await (active() ? BrotherPrint.search(options) : Promise.resolve()).finally(() => listener.remove());\n return printers;\n}\n\nasync function preparePrinters(\n options: BRLMSearchOption,\n model: BRLMPrinterModelName,\n previous?: BRLMChannelResult | null,\n active: () => boolean = () => true,\n): Promise<BRLMChannelResult[]> {\n if (\n options.port !== BRLMPrinterPort.usb &&\n previous?.port === options.port &&\n previous.channelInfo.trim() &&\n brotherPrinterModel(previous.modelName) === model\n ) {\n const available = await BrotherPrint.isChannelAvailable(previous);\n if (available.result) return [previous];\n }\n return active() ? discoverPrinters(options, active) : [];\n}\n\nexport interface BrotherPrinterEvents {\n onPrint?: () => void;\n onPrintError?: (info: ErrorInfo) => void;\n onPrintFailedCommunication?: (info: ErrorInfo) => void;\n}\n\n/** String storage callbacks; both synchronous and asynchronous stores are supported. */\nexport interface BrotherPrinterStorage {\n get(key: string): string | null | undefined | Promise<string | null | undefined>;\n set(key: string, value: string): unknown;\n remove(key: string): unknown;\n}\n\nexport interface BrotherPrinterSessionOptions {\n storage?: BrotherPrinterStorage;\n /** Defaults to `brotherprint:`. The session appends `last-printer`. */\n storagePrefix?: string;\n}\n\n/** One print screen's discovery results and event subscriptions. Create a new session after disposal. */\nexport class BrotherPrinterSession {\n #closed = false;\n #printers: BRLMChannelResult[] = [];\n #listeners: Promise<PluginListenerHandle>[] = [];\n #listening?: Promise<void>;\n #disposal?: Promise<void>;\n readonly #storage?: BrotherPrinterStorage;\n readonly #storageKey: string;\n\n constructor(options: BrotherPrinterSessionOptions = {}) {\n this.#storage = options.storage;\n this.#storageKey = `${options.storagePrefix ?? 'brotherprint:'}last-printer`;\n }\n\n get closed(): boolean {\n return this.#closed;\n }\n\n get printers(): readonly BRLMChannelResult[] {\n return this.#printers;\n }\n\n search(options: BRLMSearchOption, _model?: BRLMPrinterModelName): Promise<readonly BRLMChannelResult[]> {\n return this.#discover(() => discoverPrinters(options, () => !this.#closed));\n }\n\n prepare(\n options: BRLMSearchOption,\n model: BRLMPrinterModelName,\n previous?: BRLMChannelResult | null,\n ): Promise<readonly BRLMChannelResult[]> {\n return this.#discover(async () => {\n const saved = previous === undefined ? await this.#readSavedPrinter().catch(() => undefined) : previous;\n if (this.#closed) return [];\n return preparePrinters(options, model, saved, () => !this.#closed);\n });\n }\n\n async #readSavedPrinter(): Promise<BRLMChannelResult | undefined> {\n const value = await this.#storage?.get(this.#storageKey);\n if (!value) return undefined;\n const channel = JSON.parse(value);\n if (\n channel &&\n Object.values(BRLMPrinterPort).includes(channel.port) &&\n ['modelName', 'channelInfo', 'serialNumber', 'macAddress', 'nodeName', 'location'].every(\n (key) => typeof channel[key] === 'string',\n )\n )\n return channel;\n return undefined;\n }\n\n /** Forget the remembered connection. Storage removal errors propagate to the caller. */\n async clearSavedPrinter(): Promise<void> {\n await this.#storage?.remove(this.#storageKey);\n }\n\n async #savePrinter(options: BRLMPrintOptions): Promise<void> {\n if (!this.#storage || !options.port || !options.channelInfo?.trim()) return;\n const found = this.#printers.find(\n (printer) => printer.port === options.port && printer.channelInfo === options.channelInfo,\n );\n const channel: BRLMChannelResult = {\n serialNumber: '',\n macAddress: '',\n nodeName: '',\n location: '',\n ...found,\n port: options.port,\n channelInfo: options.channelInfo,\n modelName: options.modelName,\n };\n await this.#storage.set(this.#storageKey, JSON.stringify(channel));\n }\n\n #discover(run: () => Promise<BRLMChannelResult[]>): Promise<readonly BRLMChannelResult[]> {\n return queueConnection(async () => {\n if (this.#closed) return [];\n this.#printers = [];\n return run().then((printers) => {\n if (this.#closed) return [];\n this.#printers = printers;\n return printers;\n });\n });\n }\n\n /** Register print notifications once. Callbacks stop immediately when disposed. */\n listen(events: BrotherPrinterEvents): Promise<void> {\n if (this.#closed) return Promise.resolve();\n if (!this.#listening) {\n this.#listeners = [\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrint, () => {\n if (!this.#closed) events.onPrint?.();\n }),\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrintError, (info) => {\n if (!this.#closed) events.onPrintError?.(info);\n }),\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrintFailedCommunication, (info) => {\n if (!this.#closed) events.onPrintFailedCommunication?.(info);\n }),\n ];\n this.#listening = Promise.all(this.#listeners).then(() => undefined);\n }\n return this.#listening;\n }\n\n /** A closed session cannot start another print. Already started native printing is awaited. */\n async printImage(options: BRLMPrintOptions): Promise<void> {\n if (this.#closed) return;\n if (this.#storage) await this.#savePrinter(options).catch(() => undefined);\n if (!this.#closed) await BrotherPrint.printImage(options);\n }\n\n /** Invalidate pending work immediately, then remove this session's print listeners. */\n dispose(): Promise<void> {\n this.#closed = true;\n this.#printers = [];\n this.#disposal ??= Promise.all(this.#listeners.map((listener) => listener.then((handle) => handle.remove()))).then(\n () => undefined,\n );\n return this.#disposal;\n }\n}\n"]}
|
package/dist/esm/interfaces.d.ts
CHANGED
|
@@ -121,7 +121,8 @@ export type BRLMSearchOption = {
|
|
|
121
121
|
/**
|
|
122
122
|
* searchDuration is the time to end search for devices.
|
|
123
123
|
* default is 15 seconds.
|
|
124
|
-
*
|
|
124
|
+
* Used for Wi-Fi, BLE, and the iOS Bluetooth accessory picker wait.
|
|
125
|
+
* Timing out does not dismiss the system accessory picker; close it before retrying.
|
|
125
126
|
*/
|
|
126
127
|
searchDuration: number;
|
|
127
128
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n BRLMPrinterLabelName,\n BRLMPrinterModelName,\n BRLMPrinterAutoCutType,\n BRLMPrinterCompressMode,\n BRLMPrinterHalftone,\n BRLMPrinterHalftoneThresholdType,\n BRLMPrinterHorizontalAlignment,\n BRLMPrinterNumberOfCopies,\n BRLMPrinterPrintQuality,\n BRLMPrinterImageRotation,\n BRLMPrinterScaleMode,\n BRLMPrinterScaleValueType,\n BRLMPrinterVerticalAlignment,\n BRLMPrinterCustomPaperType,\n BRLMPrinterCustomPaperUnit,\n BRLMPrinterPort,\n} from './brother-printer.enum';\n\nexport type BRLMChannelResult = {\n port: BRLMPrinterPort;\n modelName: string;\n serialNumber: string;\n macAddress: string;\n nodeName: string;\n location: string;\n\n /**\n * This need to connect to the printer.\n * wifi: IP Address\n * bluetooth: macAddress\n * bluetoothLowEnergy: modelName for bluetoothLowEnergy\n */\n channelInfo: string;\n};\n\nexport type BRLMPrintOptions = {\n encodedImage: string;\n\n /**\n * Should use enum BRLMPrinterModelName\n */\n modelName: BRLMPrinterModelName;\n} & Partial<BRLMChannelResult> &\n (BRLMPrinterQLModelSettings | BRLMPrinterTDModelSettings);\n\nexport type isChannelAvailableResult = {\n result: boolean;\n};\n\nexport type BRLMPrinterTDModelSettings = {\n /**\n * Should use enum BRKMPrinterCustomPaperType\n */\n paperType: BRLMPrinterCustomPaperType;\n\n /**\n * The width of the label. For example, the RD-U04J1 is 60.0 wide.\n */\n tapeWidth: number;\n\n /**\n * The length of the label. For example, the RD-U04J1 is 60.0 wide.\n */\n tapeLength: number;\n\n /**\n * It is the difference between a sticker and a mount.\n * For example, the RD-U04J1 is `1.0, 2.0, 1.0, 2.0`\n */\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n\n /**\n * The spacing between seals. For example, the RD-U04J1 is 0.2.\n */\n gapLength: number;\n\n paperMarkPosition: number;\n paperMarkLength: number;\n\n /**\n * Should use enum BRKMPrinterCustomPaperUnit.\n * For example, the RD-U04J1 is mm.\n */\n paperUnit: BRLMPrinterCustomPaperUnit;\n};\n\nexport type BRLMPrinterQLModelSettings = {\n /**\n * Should use enum BRLMPrinterLabelName\n */\n labelName: BRLMPrinterLabelName;\n} & BRLMPrinterSettings;\n\n/**\n * These are optional. If these are not set, default values are assigned by the printer.\n */\nexport type BRLMPrinterSettings = {\n /**\n * The number of copies you print.\n */\n numberOfCopies?: BRLMPrinterNumberOfCopies;\n\n /**\n * Whether the auto-cut is enabled or not. If true, your printer cut the paper each page.\n */\n autoCut?: BRLMPrinterAutoCutType;\n\n /**\n * A scale mode that specifies how your data is scaled in a print area of your printer.\n */\n scaleMode?: BRLMPrinterScaleMode;\n\n /**\n * A scale value. This is effective when ScaleMode is ScaleValue.\n */\n scaleValue?: BRLMPrinterScaleValueType;\n\n /**\n * A way to rasterize your data.\n */\n halftone?: BRLMPrinterHalftone;\n\n /**\n * A threshold value. This is effective when the Halftone is Threshold.\n */\n halftoneThreshold?: BRLMPrinterHalftoneThresholdType;\n\n /**\n * An image rotation that specifies the angle in which your data is placed in the print area. Rotation direction is clockwise.\n */\n imageRotation?: BRLMPrinterImageRotation;\n\n /**\n * A vertical alignment that specifies how your data is placed in the printable area.\n */\n verticalAlignment?: BRLMPrinterVerticalAlignment;\n\n /**\n * A horizontal alignment that specifies how your data is placed in the printable area.\n */\n horizontalAlignment?: BRLMPrinterHorizontalAlignment;\n\n /**\n * A compress mode that specifies how to compress your data.\n * note: This is ios only.\n */\n compressMode?: BRLMPrinterCompressMode;\n\n /**\n * A priority that is print speed or print quality. Whether or not this has an effect is depend on your printer.\n */\n printQuality?: BRLMPrinterPrintQuality;\n};\n\nexport type BRLMSearchOption = {\n /**\n * 'usb' is android only, and now developing.\n */\n port: BRLMPrinterPort;\n\n /**\n * searchDuration is the time to end search for devices.\n * default is 15 seconds.\n *
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n BRLMPrinterLabelName,\n BRLMPrinterModelName,\n BRLMPrinterAutoCutType,\n BRLMPrinterCompressMode,\n BRLMPrinterHalftone,\n BRLMPrinterHalftoneThresholdType,\n BRLMPrinterHorizontalAlignment,\n BRLMPrinterNumberOfCopies,\n BRLMPrinterPrintQuality,\n BRLMPrinterImageRotation,\n BRLMPrinterScaleMode,\n BRLMPrinterScaleValueType,\n BRLMPrinterVerticalAlignment,\n BRLMPrinterCustomPaperType,\n BRLMPrinterCustomPaperUnit,\n BRLMPrinterPort,\n} from './brother-printer.enum';\n\nexport type BRLMChannelResult = {\n port: BRLMPrinterPort;\n modelName: string;\n serialNumber: string;\n macAddress: string;\n nodeName: string;\n location: string;\n\n /**\n * This need to connect to the printer.\n * wifi: IP Address\n * bluetooth: macAddress\n * bluetoothLowEnergy: modelName for bluetoothLowEnergy\n */\n channelInfo: string;\n};\n\nexport type BRLMPrintOptions = {\n encodedImage: string;\n\n /**\n * Should use enum BRLMPrinterModelName\n */\n modelName: BRLMPrinterModelName;\n} & Partial<BRLMChannelResult> &\n (BRLMPrinterQLModelSettings | BRLMPrinterTDModelSettings);\n\nexport type isChannelAvailableResult = {\n result: boolean;\n};\n\nexport type BRLMPrinterTDModelSettings = {\n /**\n * Should use enum BRKMPrinterCustomPaperType\n */\n paperType: BRLMPrinterCustomPaperType;\n\n /**\n * The width of the label. For example, the RD-U04J1 is 60.0 wide.\n */\n tapeWidth: number;\n\n /**\n * The length of the label. For example, the RD-U04J1 is 60.0 wide.\n */\n tapeLength: number;\n\n /**\n * It is the difference between a sticker and a mount.\n * For example, the RD-U04J1 is `1.0, 2.0, 1.0, 2.0`\n */\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n\n /**\n * The spacing between seals. For example, the RD-U04J1 is 0.2.\n */\n gapLength: number;\n\n paperMarkPosition: number;\n paperMarkLength: number;\n\n /**\n * Should use enum BRKMPrinterCustomPaperUnit.\n * For example, the RD-U04J1 is mm.\n */\n paperUnit: BRLMPrinterCustomPaperUnit;\n};\n\nexport type BRLMPrinterQLModelSettings = {\n /**\n * Should use enum BRLMPrinterLabelName\n */\n labelName: BRLMPrinterLabelName;\n} & BRLMPrinterSettings;\n\n/**\n * These are optional. If these are not set, default values are assigned by the printer.\n */\nexport type BRLMPrinterSettings = {\n /**\n * The number of copies you print.\n */\n numberOfCopies?: BRLMPrinterNumberOfCopies;\n\n /**\n * Whether the auto-cut is enabled or not. If true, your printer cut the paper each page.\n */\n autoCut?: BRLMPrinterAutoCutType;\n\n /**\n * A scale mode that specifies how your data is scaled in a print area of your printer.\n */\n scaleMode?: BRLMPrinterScaleMode;\n\n /**\n * A scale value. This is effective when ScaleMode is ScaleValue.\n */\n scaleValue?: BRLMPrinterScaleValueType;\n\n /**\n * A way to rasterize your data.\n */\n halftone?: BRLMPrinterHalftone;\n\n /**\n * A threshold value. This is effective when the Halftone is Threshold.\n */\n halftoneThreshold?: BRLMPrinterHalftoneThresholdType;\n\n /**\n * An image rotation that specifies the angle in which your data is placed in the print area. Rotation direction is clockwise.\n */\n imageRotation?: BRLMPrinterImageRotation;\n\n /**\n * A vertical alignment that specifies how your data is placed in the printable area.\n */\n verticalAlignment?: BRLMPrinterVerticalAlignment;\n\n /**\n * A horizontal alignment that specifies how your data is placed in the printable area.\n */\n horizontalAlignment?: BRLMPrinterHorizontalAlignment;\n\n /**\n * A compress mode that specifies how to compress your data.\n * note: This is ios only.\n */\n compressMode?: BRLMPrinterCompressMode;\n\n /**\n * A priority that is print speed or print quality. Whether or not this has an effect is depend on your printer.\n */\n printQuality?: BRLMPrinterPrintQuality;\n};\n\nexport type BRLMSearchOption = {\n /**\n * 'usb' is android only, and now developing.\n */\n port: BRLMPrinterPort;\n\n /**\n * searchDuration is the time to end search for devices.\n * default is 15 seconds.\n * Used for Wi-Fi, BLE, and the iOS Bluetooth accessory picker wait.\n * Timing out does not dismiss the system accessory picker; close it before retrying.\n */\n searchDuration: number;\n /**\n * Android Bluetooth Classic only. Include only devices whose Bluetooth class\n * reports a printer. Defaults to false; ignored for other ports and on iOS.\n * This does not identify Brother devices. Devices with an unknown class are excluded when true.\n */\n bluetoothPrintersOnly?: boolean;\n};\n\nexport type ErrorInfo = {\n message: string;\n code: number;\n};\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -270,8 +270,8 @@ function queueConnection(run) {
|
|
|
270
270
|
return result;
|
|
271
271
|
}
|
|
272
272
|
/** Collect discovery results, waiting for earlier helper calls to finish. */
|
|
273
|
-
function searchBrotherPrinters(options,
|
|
274
|
-
return queueConnection(() => discoverPrinters(options
|
|
273
|
+
function searchBrotherPrinters(options, _model) {
|
|
274
|
+
return queueConnection(() => discoverPrinters(options));
|
|
275
275
|
}
|
|
276
276
|
/**
|
|
277
277
|
* Reuse a matching, available previous channel; otherwise discover printers.
|
|
@@ -291,13 +291,11 @@ function checkBrotherPrinterChannel(channel) {
|
|
|
291
291
|
return result;
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
|
-
async function discoverPrinters(options,
|
|
294
|
+
async function discoverPrinters(options, active = () => true) {
|
|
295
295
|
const printers = [];
|
|
296
296
|
const listener = await BrotherPrint.addListener(exports.BrotherPrintEventsEnum.onPrinterAvailable, (printer) => {
|
|
297
297
|
if (printer.port !== options.port)
|
|
298
298
|
return;
|
|
299
|
-
if (printer.port !== exports.BRLMPrinterPort.usb && model !== undefined && brotherPrinterModel(printer.modelName) !== model)
|
|
300
|
-
return;
|
|
301
299
|
const index = printers.findIndex((current) => current.port === printer.port && current.channelInfo === printer.channelInfo);
|
|
302
300
|
if (index < 0)
|
|
303
301
|
printers.push(printer);
|
|
@@ -316,7 +314,7 @@ async function preparePrinters(options, model, previous, active = () => true) {
|
|
|
316
314
|
if (available.result)
|
|
317
315
|
return [previous];
|
|
318
316
|
}
|
|
319
|
-
return active() ? discoverPrinters(options,
|
|
317
|
+
return active() ? discoverPrinters(options, active) : [];
|
|
320
318
|
}
|
|
321
319
|
/** One print screen's discovery results and event subscriptions. Create a new session after disposal. */
|
|
322
320
|
class BrotherPrinterSession {
|
|
@@ -339,8 +337,8 @@ class BrotherPrinterSession {
|
|
|
339
337
|
get printers() {
|
|
340
338
|
return __classPrivateFieldGet(this, _BrotherPrinterSession_printers, "f");
|
|
341
339
|
}
|
|
342
|
-
search(options,
|
|
343
|
-
return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_discover).call(this, () => discoverPrinters(options,
|
|
340
|
+
search(options, _model) {
|
|
341
|
+
return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_discover).call(this, () => discoverPrinters(options, () => !__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f")));
|
|
344
342
|
}
|
|
345
343
|
prepare(options, model, previous) {
|
|
346
344
|
return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_discover).call(this, async () => {
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/brother-printer.enum.js","esm/events.enum.js","esm/models.js","esm/printer.js","esm/web.js","esm/index.js"],"sourcesContent":["export var BRLMPrinterPort;\n(function (BRLMPrinterPort) {\n BRLMPrinterPort[\"usb\"] = \"usb\";\n BRLMPrinterPort[\"wifi\"] = \"wifi\";\n BRLMPrinterPort[\"bluetooth\"] = \"bluetooth\";\n BRLMPrinterPort[\"bluetoothLowEnergy\"] = \"bluetoothLowEnergy\";\n})(BRLMPrinterPort || (BRLMPrinterPort = {}));\nexport var BRLMPrinterCustomPaperUnit;\n(function (BRLMPrinterCustomPaperUnit) {\n BRLMPrinterCustomPaperUnit[\"mm\"] = \"mm\";\n BRLMPrinterCustomPaperUnit[\"inch\"] = \"inch\";\n})(BRLMPrinterCustomPaperUnit || (BRLMPrinterCustomPaperUnit = {}));\nexport var BRLMPrinterCustomPaperType;\n(function (BRLMPrinterCustomPaperType) {\n BRLMPrinterCustomPaperType[\"rollPaper\"] = \"rollPaper\";\n BRLMPrinterCustomPaperType[\"dieCutPaper\"] = \"dieCutPaper\";\n BRLMPrinterCustomPaperType[\"markRollPaper\"] = \"markRollPaper\";\n})(BRLMPrinterCustomPaperType || (BRLMPrinterCustomPaperType = {}));\n/**\n * Note: If you update this file, you should update the following files:\n * - ios/Plugin/Model/PrinterModel.swift\n *\n * And name is follow android naming convention.\n * Android naming: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printermodel.html\n */\nexport var BRLMPrinterModelName;\n(function (BRLMPrinterModelName) {\n BRLMPrinterModelName[\"QL_800\"] = \"QL_800\";\n BRLMPrinterModelName[\"QL_810W\"] = \"QL_810W\";\n BRLMPrinterModelName[\"QL_820NWB\"] = \"QL_820NWB\";\n BRLMPrinterModelName[\"TD_2320D_203\"] = \"TD_2320D_203\";\n BRLMPrinterModelName[\"TD_2030AD\"] = \"TD_2030AD\";\n BRLMPrinterModelName[\"TD_2350D_300\"] = \"TD_2350D_300\";\n})(BRLMPrinterModelName || (BRLMPrinterModelName = {}));\n/**\n * Android naming: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android/labelinfo.html\n */\nexport var BRLMPrinterLabelName;\n(function (BRLMPrinterLabelName) {\n BRLMPrinterLabelName[\"DieCutW17H54\"] = \"DieCutW17H54\";\n BRLMPrinterLabelName[\"DieCutW17H87\"] = \"DieCutW17H87\";\n BRLMPrinterLabelName[\"DieCutW23H23\"] = \"DieCutW23H23\";\n BRLMPrinterLabelName[\"DieCutW29H42\"] = \"DieCutW29H42\";\n BRLMPrinterLabelName[\"DieCutW29H90\"] = \"DieCutW29H90\";\n BRLMPrinterLabelName[\"DieCutW38H90\"] = \"DieCutW38H90\";\n BRLMPrinterLabelName[\"DieCutW39H48\"] = \"DieCutW39H48\";\n BRLMPrinterLabelName[\"DieCutW52H29\"] = \"DieCutW52H29\";\n BRLMPrinterLabelName[\"DieCutW62H29\"] = \"DieCutW62H29\";\n BRLMPrinterLabelName[\"DieCutW62H60\"] = \"DieCutW62H60\";\n BRLMPrinterLabelName[\"DieCutW62H75\"] = \"DieCutW62H75\";\n BRLMPrinterLabelName[\"DieCutW62H100\"] = \"DieCutW62H100\";\n BRLMPrinterLabelName[\"DieCutW60H86\"] = \"DieCutW60H86\";\n BRLMPrinterLabelName[\"DieCutW54H29\"] = \"DieCutW54H29\";\n BRLMPrinterLabelName[\"DieCutW102H51\"] = \"DieCutW102H51\";\n BRLMPrinterLabelName[\"DieCutW102H152\"] = \"DieCutW102H152\";\n BRLMPrinterLabelName[\"DieCutW103H164\"] = \"DieCutW103H164\";\n BRLMPrinterLabelName[\"RollW12\"] = \"RollW12\";\n BRLMPrinterLabelName[\"RollW29\"] = \"RollW29\";\n BRLMPrinterLabelName[\"RollW38\"] = \"RollW38\";\n BRLMPrinterLabelName[\"RollW50\"] = \"RollW50\";\n BRLMPrinterLabelName[\"RollW54\"] = \"RollW54\";\n BRLMPrinterLabelName[\"RollW62\"] = \"RollW62\";\n BRLMPrinterLabelName[\"RollW62RB\"] = \"RollW62RB\";\n BRLMPrinterLabelName[\"RollW102\"] = \"RollW102\";\n BRLMPrinterLabelName[\"RollW103\"] = \"RollW103\";\n BRLMPrinterLabelName[\"DTRollW90\"] = \"DTRollW90\";\n BRLMPrinterLabelName[\"DTRollW102\"] = \"DTRollW102\";\n BRLMPrinterLabelName[\"DTRollW102H51\"] = \"DTRollW102H51\";\n BRLMPrinterLabelName[\"DTRollW102H152\"] = \"DTRollW102H152\";\n BRLMPrinterLabelName[\"RoundW12DIA\"] = \"RoundW12DIA\";\n BRLMPrinterLabelName[\"RoundW24DIA\"] = \"RoundW24DIA\";\n BRLMPrinterLabelName[\"RoundW58DIA\"] = \"RoundW58DIA\";\n /**\n * For TD series\n * @url https://www.brother.co.jp/product/labelprinter/td2350d/accessory/index.aspx\n */\n BRLMPrinterLabelName[\"RDDieCutW60H60\"] = \"RDDieCutW60H60\";\n BRLMPrinterLabelName[\"RDDieCutW50H30\"] = \"RDDieCutW50H30\";\n BRLMPrinterLabelName[\"RDDieCutW40H60\"] = \"RDDieCutW40H60\";\n BRLMPrinterLabelName[\"RDDieCutW40H50\"] = \"RDDieCutW40H50\";\n BRLMPrinterLabelName[\"RDDieCutW40H40\"] = \"RDDieCutW40H40\";\n BRLMPrinterLabelName[\"RDDieCutW30H30\"] = \"RDDieCutW30H30\";\n BRLMPrinterLabelName[\"RDDieCutW50H35\"] = \"RDDieCutW50H35\";\n BRLMPrinterLabelName[\"RDDieCutW60H80\"] = \"RDDieCutW60H80\";\n BRLMPrinterLabelName[\"RDDieCutW60H100\"] = \"RDDieCutW60H100\";\n})(BRLMPrinterLabelName || (BRLMPrinterLabelName = {}));\n/**\n * @url https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#imagerotation\n */\nexport var BRLMPrinterImageRotation;\n(function (BRLMPrinterImageRotation) {\n BRLMPrinterImageRotation[\"Rotate0\"] = \"Rotate0\";\n BRLMPrinterImageRotation[\"Rotate90\"] = \"Rotate90\";\n BRLMPrinterImageRotation[\"Rotate180\"] = \"Rotate180\";\n BRLMPrinterImageRotation[\"Rotate270\"] = \"Rotate270\";\n})(BRLMPrinterImageRotation || (BRLMPrinterImageRotation = {}));\n/**\n * url https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#scalemode\n */\nexport var BRLMPrinterScaleMode;\n(function (BRLMPrinterScaleMode) {\n BRLMPrinterScaleMode[\"ActualSize\"] = \"ActualSize\";\n BRLMPrinterScaleMode[\"FitPageAspect\"] = \"FitPageAspect\";\n BRLMPrinterScaleMode[\"FitPaperAspect\"] = \"FitPaperAspect\";\n BRLMPrinterScaleMode[\"ScaleValue\"] = \"ScaleValue\";\n})(BRLMPrinterScaleMode || (BRLMPrinterScaleMode = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#halftone\n */\nexport var BRLMPrinterHalftone;\n(function (BRLMPrinterHalftone) {\n BRLMPrinterHalftone[\"Threshold\"] = \"Threshold\";\n BRLMPrinterHalftone[\"ErrorDiffusion\"] = \"ErrorDiffusion\";\n BRLMPrinterHalftone[\"PatternDither\"] = \"PatternDither\";\n})(BRLMPrinterHalftone || (BRLMPrinterHalftone = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#verticalalignment\n */\nexport var BRLMPrinterVerticalAlignment;\n(function (BRLMPrinterVerticalAlignment) {\n BRLMPrinterVerticalAlignment[\"Top\"] = \"Top\";\n BRLMPrinterVerticalAlignment[\"Center\"] = \"Center\";\n BRLMPrinterVerticalAlignment[\"Bottom\"] = \"Bottom\";\n})(BRLMPrinterVerticalAlignment || (BRLMPrinterVerticalAlignment = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#horizontalalignment\n */\nexport var BRLMPrinterHorizontalAlignment;\n(function (BRLMPrinterHorizontalAlignment) {\n BRLMPrinterHorizontalAlignment[\"Left\"] = \"Left\";\n BRLMPrinterHorizontalAlignment[\"Center\"] = \"Center\";\n BRLMPrinterHorizontalAlignment[\"Right\"] = \"Right\";\n})(BRLMPrinterHorizontalAlignment || (BRLMPrinterHorizontalAlignment = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#compressmode\n */\nexport var BRLMPrinterCompressMode;\n(function (BRLMPrinterCompressMode) {\n BRLMPrinterCompressMode[\"None\"] = \"None\";\n BRLMPrinterCompressMode[\"Tiff\"] = \"Tiff\";\n BRLMPrinterCompressMode[\"Mode9\"] = \"Mode9\";\n})(BRLMPrinterCompressMode || (BRLMPrinterCompressMode = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#printquality\n */\nexport var BRLMPrinterPrintQuality;\n(function (BRLMPrinterPrintQuality) {\n BRLMPrinterPrintQuality[\"Best\"] = \"Best\";\n BRLMPrinterPrintQuality[\"Fast\"] = \"Fast\";\n})(BRLMPrinterPrintQuality || (BRLMPrinterPrintQuality = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#resolution\n */\n// export enum BRLMPrinterPrintResolution {\n// Low = 'Low',\n// Normal = 'Normal',\n// High = 'High',\n// }\n//# sourceMappingURL=brother-printer.enum.js.map","export var BrotherPrintEventsEnum;\n(function (BrotherPrintEventsEnum) {\n BrotherPrintEventsEnum[\"onPrinterAvailable\"] = \"onPrinterAvailable\";\n BrotherPrintEventsEnum[\"onPrint\"] = \"onPrint\";\n BrotherPrintEventsEnum[\"onPrintFailedCommunication\"] = \"onPrintFailedCommunication\";\n BrotherPrintEventsEnum[\"onPrintError\"] = \"onPrintError\";\n})(BrotherPrintEventsEnum || (BrotherPrintEventsEnum = {}));\n//# sourceMappingURL=events.enum.js.map","import { BRLMPrinterModelName as Model, BRLMPrinterPort as Port } from './brother-printer.enum';\nexport const printerPorts = {\n [Model.QL_800]: [Port.usb],\n [Model.QL_810W]: [Port.wifi, Port.usb],\n [Model.QL_820NWB]: [Port.wifi, Port.bluetooth, Port.usb],\n [Model.TD_2320D_203]: [Port.wifi, Port.usb],\n [Model.TD_2030AD]: [Port.usb],\n [Model.TD_2350D_300]: [Port.wifi, Port.bluetooth, Port.usb, Port.bluetoothLowEnergy],\n};\n//# sourceMappingURL=models.js.map","import { Capacitor } from '@capacitor/core';\nimport { BRLMPrinterModelName, BRLMPrinterPort } from './brother-printer.enum';\nimport { printerPorts } from './models';\n/** Common display names for connection transports. */\nexport function brotherPrinterPortLabel(port) {\n switch (port) {\n case BRLMPrinterPort.wifi:\n return 'Wi-Fi';\n case BRLMPrinterPort.bluetooth:\n return 'Bluetooth';\n case BRLMPrinterPort.bluetoothLowEnergy:\n return 'Bluetooth LE';\n case BRLMPrinterPort.usb:\n return 'USB';\n default:\n return '';\n }\n}\n/** Connection choices for the existing models. USB is Android-only; wifi also covers Ethernet. */\nexport function brotherPrinterPorts(model, isAndroid = Capacitor.getPlatform() === 'android') {\n if (!Object.values(BRLMPrinterModelName).includes(model))\n return [];\n return printerPorts[model].filter((port) => isAndroid || port !== BRLMPrinterPort.usb);\n}\n/** Keep a supported saved port; otherwise prefer USB for QL-800/810W on Android. */\nexport function resolveBrotherPrinterPort(model, saved) {\n const ports = brotherPrinterPorts(model);\n if (saved && ports.includes(saved))\n return saved;\n if (ports.includes(BRLMPrinterPort.usb) &&\n (model === BRLMPrinterModelName.QL_800 || model === BRLMPrinterModelName.QL_810W))\n return BRLMPrinterPort.usb;\n return ports[0];\n}\n/** Match discovery names to an existing model enum, including documented product aliases. */\nexport function brotherPrinterModel(name) {\n const key = name\n .trim()\n .toUpperCase()\n .replace(/^BROTHER\\s+/, '')\n .replace(/[-_ ]/g, '');\n // Product names omit TD resolution; QL-820NWBc and TD-2030A use the existing enum spellings.\n const product = key === 'QL820NWBC' ? 'QL820NWB' : key === 'TD2030A' ? 'TD2030AD' : key;\n return Object.values(BRLMPrinterModelName).find((model) => model.replace(/_/g, '') === product || model.replace(/_(203|300)$/, '').replace(/_/g, '') === product);\n}\n//# sourceMappingURL=printer.js.map","import { WebPlugin } from '@capacitor/core';\nexport class BrotherPrintWeb extends WebPlugin {\n async printImage(options) {\n console.log('printImage', options);\n }\n async isChannelAvailable(options) {\n console.log('isChannelAvailable', options);\n return {\n result: false,\n };\n }\n async search(options) {\n console.log('search', options);\n }\n async cancelSearchWiFiPrinter() {\n console.log('cancelSearchWiFiPrinter');\n }\n async cancelSearchBluetoothPrinter() {\n console.log('cancelSearchBluetoothPrinter');\n }\n}\n//# sourceMappingURL=web.js.map","var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _BrotherPrinterSession_instances, _BrotherPrinterSession_closed, _BrotherPrinterSession_printers, _BrotherPrinterSession_listeners, _BrotherPrinterSession_listening, _BrotherPrinterSession_disposal, _BrotherPrinterSession_storage, _BrotherPrinterSession_storageKey, _BrotherPrinterSession_readSavedPrinter, _BrotherPrinterSession_savePrinter, _BrotherPrinterSession_discover;\nimport { registerPlugin } from '@capacitor/core';\nimport { BRLMPrinterPort } from './brother-printer.enum';\nimport { BrotherPrintEventsEnum } from './events.enum';\nimport { brotherPrinterModel } from './printer';\nconst BrotherPrint = registerPlugin('BrotherPrint', {\n web: () => import('./web').then((m) => new m.BrotherPrintWeb()),\n});\nexport * from './definitions';\nexport * from './web';\nexport * from './events.enum';\nexport * from './interfaces';\nexport * from './brother-printer.enum';\nexport { BrotherPrint };\nexport * from './printer';\n// Native discovery events are shared. Keep each helper call's listener scoped to its turn.\nlet connectionQueue = Promise.resolve();\nfunction queueConnection(run) {\n const result = connectionQueue.then(run);\n connectionQueue = result.catch(() => undefined);\n return result;\n}\n/** Collect discovery results, waiting for earlier helper calls to finish. */\nexport function searchBrotherPrinters(options, model) {\n return queueConnection(() => discoverPrinters(options, model));\n}\n/**\n * Reuse a matching, available previous channel; otherwise discover printers.\n * The caller owns storage. USB always discovers again through the native permission flow.\n * Availability errors propagate; only an unavailable channel triggers discovery.\n */\nexport function prepareBrotherPrinters(options, model, previous) {\n return queueConnection(() => preparePrinters(options, model, previous));\n}\n/**\n * Check an explicitly selected address without discovery or fallback to another printer.\n * Port must be supplied; an address does not identify its transport or printer model.\n */\nexport function checkBrotherPrinterChannel(channel) {\n return queueConnection(async () => {\n const { result } = await BrotherPrint.isChannelAvailable(Object.assign({ modelName: '', serialNumber: '', macAddress: '', nodeName: '', location: '' }, channel));\n return result;\n });\n}\nasync function discoverPrinters(options, model, active = () => true) {\n const printers = [];\n const listener = await BrotherPrint.addListener(BrotherPrintEventsEnum.onPrinterAvailable, (printer) => {\n if (printer.port !== options.port)\n return;\n if (printer.port !== BRLMPrinterPort.usb && model !== undefined && brotherPrinterModel(printer.modelName) !== model)\n return;\n const index = printers.findIndex((current) => current.port === printer.port && current.channelInfo === printer.channelInfo);\n if (index < 0)\n printers.push(printer);\n else\n printers[index] = printer;\n });\n await (active() ? BrotherPrint.search(options) : Promise.resolve()).finally(() => listener.remove());\n return printers;\n}\nasync function preparePrinters(options, model, previous, active = () => true) {\n if (options.port !== BRLMPrinterPort.usb &&\n (previous === null || previous === void 0 ? void 0 : previous.port) === options.port &&\n previous.channelInfo.trim() &&\n brotherPrinterModel(previous.modelName) === model) {\n const available = await BrotherPrint.isChannelAvailable(previous);\n if (available.result)\n return [previous];\n }\n return active() ? discoverPrinters(options, model, active) : [];\n}\n/** One print screen's discovery results and event subscriptions. Create a new session after disposal. */\nexport class BrotherPrinterSession {\n constructor(options = {}) {\n var _a;\n _BrotherPrinterSession_instances.add(this);\n _BrotherPrinterSession_closed.set(this, false);\n _BrotherPrinterSession_printers.set(this, []);\n _BrotherPrinterSession_listeners.set(this, []);\n _BrotherPrinterSession_listening.set(this, void 0);\n _BrotherPrinterSession_disposal.set(this, void 0);\n _BrotherPrinterSession_storage.set(this, void 0);\n _BrotherPrinterSession_storageKey.set(this, void 0);\n __classPrivateFieldSet(this, _BrotherPrinterSession_storage, options.storage, \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_storageKey, `${(_a = options.storagePrefix) !== null && _a !== void 0 ? _a : 'brotherprint:'}last-printer`, \"f\");\n }\n get closed() {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\");\n }\n get printers() {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_printers, \"f\");\n }\n search(options, model) {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_discover).call(this, () => discoverPrinters(options, model, () => !__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\")));\n }\n prepare(options, model, previous) {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_discover).call(this, async () => {\n const saved = previous === undefined ? await __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_readSavedPrinter).call(this).catch(() => undefined) : previous;\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return [];\n return preparePrinters(options, model, saved, () => !__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"));\n });\n }\n /** Forget the remembered connection. Storage removal errors propagate to the caller. */\n async clearSavedPrinter() {\n var _a;\n await ((_a = __classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\")) === null || _a === void 0 ? void 0 : _a.remove(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, \"f\")));\n }\n /** Register print notifications once. Callbacks stop immediately when disposed. */\n listen(events) {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return Promise.resolve();\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_listening, \"f\")) {\n __classPrivateFieldSet(this, _BrotherPrinterSession_listeners, [\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrint, () => {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n (_a = events.onPrint) === null || _a === void 0 ? void 0 : _a.call(events);\n }),\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrintError, (info) => {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n (_a = events.onPrintError) === null || _a === void 0 ? void 0 : _a.call(events, info);\n }),\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrintFailedCommunication, (info) => {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n (_a = events.onPrintFailedCommunication) === null || _a === void 0 ? void 0 : _a.call(events, info);\n }),\n ], \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_listening, Promise.all(__classPrivateFieldGet(this, _BrotherPrinterSession_listeners, \"f\")).then(() => undefined), \"f\");\n }\n return __classPrivateFieldGet(this, _BrotherPrinterSession_listening, \"f\");\n }\n /** A closed session cannot start another print. Already started native printing is awaited. */\n async printImage(options) {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return;\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\"))\n await __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_savePrinter).call(this, options).catch(() => undefined);\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n await BrotherPrint.printImage(options);\n }\n /** Invalidate pending work immediately, then remove this session's print listeners. */\n dispose() {\n var _a;\n __classPrivateFieldSet(this, _BrotherPrinterSession_closed, true, \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_printers, [], \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_disposal, (_a = __classPrivateFieldGet(this, _BrotherPrinterSession_disposal, \"f\")) !== null && _a !== void 0 ? _a : Promise.all(__classPrivateFieldGet(this, _BrotherPrinterSession_listeners, \"f\").map((listener) => listener.then((handle) => handle.remove()))).then(() => undefined), \"f\");\n return __classPrivateFieldGet(this, _BrotherPrinterSession_disposal, \"f\");\n }\n}\n_BrotherPrinterSession_closed = new WeakMap(), _BrotherPrinterSession_printers = new WeakMap(), _BrotherPrinterSession_listeners = new WeakMap(), _BrotherPrinterSession_listening = new WeakMap(), _BrotherPrinterSession_disposal = new WeakMap(), _BrotherPrinterSession_storage = new WeakMap(), _BrotherPrinterSession_storageKey = new WeakMap(), _BrotherPrinterSession_instances = new WeakSet(), _BrotherPrinterSession_readSavedPrinter = async function _BrotherPrinterSession_readSavedPrinter() {\n var _a;\n const value = await ((_a = __classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\")) === null || _a === void 0 ? void 0 : _a.get(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, \"f\")));\n if (!value)\n return undefined;\n const channel = JSON.parse(value);\n if (channel &&\n Object.values(BRLMPrinterPort).includes(channel.port) &&\n ['modelName', 'channelInfo', 'serialNumber', 'macAddress', 'nodeName', 'location'].every((key) => typeof channel[key] === 'string'))\n return channel;\n return undefined;\n}, _BrotherPrinterSession_savePrinter = async function _BrotherPrinterSession_savePrinter(options) {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\") || !options.port || !((_a = options.channelInfo) === null || _a === void 0 ? void 0 : _a.trim()))\n return;\n const found = __classPrivateFieldGet(this, _BrotherPrinterSession_printers, \"f\").find((printer) => printer.port === options.port && printer.channelInfo === options.channelInfo);\n const channel = Object.assign(Object.assign({ serialNumber: '', macAddress: '', nodeName: '', location: '' }, found), { port: options.port, channelInfo: options.channelInfo, modelName: options.modelName });\n await __classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\").set(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, \"f\"), JSON.stringify(channel));\n}, _BrotherPrinterSession_discover = function _BrotherPrinterSession_discover(run) {\n return queueConnection(async () => {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return [];\n __classPrivateFieldSet(this, _BrotherPrinterSession_printers, [], \"f\");\n return run().then((printers) => {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return [];\n __classPrivateFieldSet(this, _BrotherPrinterSession_printers, printers, \"f\");\n return printers;\n });\n });\n};\n//# sourceMappingURL=index.js.map"],"names":["BRLMPrinterPort","BRLMPrinterCustomPaperUnit","BRLMPrinterCustomPaperType","BRLMPrinterModelName","BRLMPrinterLabelName","BRLMPrinterImageRotation","BRLMPrinterScaleMode","BRLMPrinterHalftone","BRLMPrinterVerticalAlignment","BRLMPrinterHorizontalAlignment","BRLMPrinterCompressMode","BRLMPrinterPrintQuality","BrotherPrintEventsEnum","Model","Port","Capacitor","WebPlugin","this","registerPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG,KAAK;AAClC,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM;AACpC,IAAI,eAAe,CAAC,WAAW,CAAC,GAAG,WAAW;AAC9C,IAAI,eAAe,CAAC,oBAA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AC9E,QAAQ,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK;AACxC,YAAY,IAAI,sBAAsB,CAAC,IAAI,EAAE,6BAA6B,EAAE,GAAG,CAAC;AAChF,gBAAgB,OAAO,EAAE;AACzB,YAAY,sBAAsB,CAAC,IAAI,EAAE,+BAA+B,EAAE,QAAQ,EAAE,GAAG,CAAC;AACxF,YAAY,OAAO,QAAQ;AAC3B,QAAQ,CAAC,CAAC;AACV,IAAI,CAAC,CAAC;AACN,CAAC;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/brother-printer.enum.js","esm/events.enum.js","esm/models.js","esm/printer.js","esm/web.js","esm/index.js"],"sourcesContent":["export var BRLMPrinterPort;\n(function (BRLMPrinterPort) {\n BRLMPrinterPort[\"usb\"] = \"usb\";\n BRLMPrinterPort[\"wifi\"] = \"wifi\";\n BRLMPrinterPort[\"bluetooth\"] = \"bluetooth\";\n BRLMPrinterPort[\"bluetoothLowEnergy\"] = \"bluetoothLowEnergy\";\n})(BRLMPrinterPort || (BRLMPrinterPort = {}));\nexport var BRLMPrinterCustomPaperUnit;\n(function (BRLMPrinterCustomPaperUnit) {\n BRLMPrinterCustomPaperUnit[\"mm\"] = \"mm\";\n BRLMPrinterCustomPaperUnit[\"inch\"] = \"inch\";\n})(BRLMPrinterCustomPaperUnit || (BRLMPrinterCustomPaperUnit = {}));\nexport var BRLMPrinterCustomPaperType;\n(function (BRLMPrinterCustomPaperType) {\n BRLMPrinterCustomPaperType[\"rollPaper\"] = \"rollPaper\";\n BRLMPrinterCustomPaperType[\"dieCutPaper\"] = \"dieCutPaper\";\n BRLMPrinterCustomPaperType[\"markRollPaper\"] = \"markRollPaper\";\n})(BRLMPrinterCustomPaperType || (BRLMPrinterCustomPaperType = {}));\n/**\n * Note: If you update this file, you should update the following files:\n * - ios/Plugin/Model/PrinterModel.swift\n *\n * And name is follow android naming convention.\n * Android naming: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printermodel.html\n */\nexport var BRLMPrinterModelName;\n(function (BRLMPrinterModelName) {\n BRLMPrinterModelName[\"QL_800\"] = \"QL_800\";\n BRLMPrinterModelName[\"QL_810W\"] = \"QL_810W\";\n BRLMPrinterModelName[\"QL_820NWB\"] = \"QL_820NWB\";\n BRLMPrinterModelName[\"TD_2320D_203\"] = \"TD_2320D_203\";\n BRLMPrinterModelName[\"TD_2030AD\"] = \"TD_2030AD\";\n BRLMPrinterModelName[\"TD_2350D_300\"] = \"TD_2350D_300\";\n})(BRLMPrinterModelName || (BRLMPrinterModelName = {}));\n/**\n * Android naming: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android/labelinfo.html\n */\nexport var BRLMPrinterLabelName;\n(function (BRLMPrinterLabelName) {\n BRLMPrinterLabelName[\"DieCutW17H54\"] = \"DieCutW17H54\";\n BRLMPrinterLabelName[\"DieCutW17H87\"] = \"DieCutW17H87\";\n BRLMPrinterLabelName[\"DieCutW23H23\"] = \"DieCutW23H23\";\n BRLMPrinterLabelName[\"DieCutW29H42\"] = \"DieCutW29H42\";\n BRLMPrinterLabelName[\"DieCutW29H90\"] = \"DieCutW29H90\";\n BRLMPrinterLabelName[\"DieCutW38H90\"] = \"DieCutW38H90\";\n BRLMPrinterLabelName[\"DieCutW39H48\"] = \"DieCutW39H48\";\n BRLMPrinterLabelName[\"DieCutW52H29\"] = \"DieCutW52H29\";\n BRLMPrinterLabelName[\"DieCutW62H29\"] = \"DieCutW62H29\";\n BRLMPrinterLabelName[\"DieCutW62H60\"] = \"DieCutW62H60\";\n BRLMPrinterLabelName[\"DieCutW62H75\"] = \"DieCutW62H75\";\n BRLMPrinterLabelName[\"DieCutW62H100\"] = \"DieCutW62H100\";\n BRLMPrinterLabelName[\"DieCutW60H86\"] = \"DieCutW60H86\";\n BRLMPrinterLabelName[\"DieCutW54H29\"] = \"DieCutW54H29\";\n BRLMPrinterLabelName[\"DieCutW102H51\"] = \"DieCutW102H51\";\n BRLMPrinterLabelName[\"DieCutW102H152\"] = \"DieCutW102H152\";\n BRLMPrinterLabelName[\"DieCutW103H164\"] = \"DieCutW103H164\";\n BRLMPrinterLabelName[\"RollW12\"] = \"RollW12\";\n BRLMPrinterLabelName[\"RollW29\"] = \"RollW29\";\n BRLMPrinterLabelName[\"RollW38\"] = \"RollW38\";\n BRLMPrinterLabelName[\"RollW50\"] = \"RollW50\";\n BRLMPrinterLabelName[\"RollW54\"] = \"RollW54\";\n BRLMPrinterLabelName[\"RollW62\"] = \"RollW62\";\n BRLMPrinterLabelName[\"RollW62RB\"] = \"RollW62RB\";\n BRLMPrinterLabelName[\"RollW102\"] = \"RollW102\";\n BRLMPrinterLabelName[\"RollW103\"] = \"RollW103\";\n BRLMPrinterLabelName[\"DTRollW90\"] = \"DTRollW90\";\n BRLMPrinterLabelName[\"DTRollW102\"] = \"DTRollW102\";\n BRLMPrinterLabelName[\"DTRollW102H51\"] = \"DTRollW102H51\";\n BRLMPrinterLabelName[\"DTRollW102H152\"] = \"DTRollW102H152\";\n BRLMPrinterLabelName[\"RoundW12DIA\"] = \"RoundW12DIA\";\n BRLMPrinterLabelName[\"RoundW24DIA\"] = \"RoundW24DIA\";\n BRLMPrinterLabelName[\"RoundW58DIA\"] = \"RoundW58DIA\";\n /**\n * For TD series\n * @url https://www.brother.co.jp/product/labelprinter/td2350d/accessory/index.aspx\n */\n BRLMPrinterLabelName[\"RDDieCutW60H60\"] = \"RDDieCutW60H60\";\n BRLMPrinterLabelName[\"RDDieCutW50H30\"] = \"RDDieCutW50H30\";\n BRLMPrinterLabelName[\"RDDieCutW40H60\"] = \"RDDieCutW40H60\";\n BRLMPrinterLabelName[\"RDDieCutW40H50\"] = \"RDDieCutW40H50\";\n BRLMPrinterLabelName[\"RDDieCutW40H40\"] = \"RDDieCutW40H40\";\n BRLMPrinterLabelName[\"RDDieCutW30H30\"] = \"RDDieCutW30H30\";\n BRLMPrinterLabelName[\"RDDieCutW50H35\"] = \"RDDieCutW50H35\";\n BRLMPrinterLabelName[\"RDDieCutW60H80\"] = \"RDDieCutW60H80\";\n BRLMPrinterLabelName[\"RDDieCutW60H100\"] = \"RDDieCutW60H100\";\n})(BRLMPrinterLabelName || (BRLMPrinterLabelName = {}));\n/**\n * @url https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#imagerotation\n */\nexport var BRLMPrinterImageRotation;\n(function (BRLMPrinterImageRotation) {\n BRLMPrinterImageRotation[\"Rotate0\"] = \"Rotate0\";\n BRLMPrinterImageRotation[\"Rotate90\"] = \"Rotate90\";\n BRLMPrinterImageRotation[\"Rotate180\"] = \"Rotate180\";\n BRLMPrinterImageRotation[\"Rotate270\"] = \"Rotate270\";\n})(BRLMPrinterImageRotation || (BRLMPrinterImageRotation = {}));\n/**\n * url https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#scalemode\n */\nexport var BRLMPrinterScaleMode;\n(function (BRLMPrinterScaleMode) {\n BRLMPrinterScaleMode[\"ActualSize\"] = \"ActualSize\";\n BRLMPrinterScaleMode[\"FitPageAspect\"] = \"FitPageAspect\";\n BRLMPrinterScaleMode[\"FitPaperAspect\"] = \"FitPaperAspect\";\n BRLMPrinterScaleMode[\"ScaleValue\"] = \"ScaleValue\";\n})(BRLMPrinterScaleMode || (BRLMPrinterScaleMode = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#halftone\n */\nexport var BRLMPrinterHalftone;\n(function (BRLMPrinterHalftone) {\n BRLMPrinterHalftone[\"Threshold\"] = \"Threshold\";\n BRLMPrinterHalftone[\"ErrorDiffusion\"] = \"ErrorDiffusion\";\n BRLMPrinterHalftone[\"PatternDither\"] = \"PatternDither\";\n})(BRLMPrinterHalftone || (BRLMPrinterHalftone = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#verticalalignment\n */\nexport var BRLMPrinterVerticalAlignment;\n(function (BRLMPrinterVerticalAlignment) {\n BRLMPrinterVerticalAlignment[\"Top\"] = \"Top\";\n BRLMPrinterVerticalAlignment[\"Center\"] = \"Center\";\n BRLMPrinterVerticalAlignment[\"Bottom\"] = \"Bottom\";\n})(BRLMPrinterVerticalAlignment || (BRLMPrinterVerticalAlignment = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#horizontalalignment\n */\nexport var BRLMPrinterHorizontalAlignment;\n(function (BRLMPrinterHorizontalAlignment) {\n BRLMPrinterHorizontalAlignment[\"Left\"] = \"Left\";\n BRLMPrinterHorizontalAlignment[\"Center\"] = \"Center\";\n BRLMPrinterHorizontalAlignment[\"Right\"] = \"Right\";\n})(BRLMPrinterHorizontalAlignment || (BRLMPrinterHorizontalAlignment = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#compressmode\n */\nexport var BRLMPrinterCompressMode;\n(function (BRLMPrinterCompressMode) {\n BRLMPrinterCompressMode[\"None\"] = \"None\";\n BRLMPrinterCompressMode[\"Tiff\"] = \"Tiff\";\n BRLMPrinterCompressMode[\"Mode9\"] = \"Mode9\";\n})(BRLMPrinterCompressMode || (BRLMPrinterCompressMode = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#printquality\n */\nexport var BRLMPrinterPrintQuality;\n(function (BRLMPrinterPrintQuality) {\n BRLMPrinterPrintQuality[\"Best\"] = \"Best\";\n BRLMPrinterPrintQuality[\"Fast\"] = \"Fast\";\n})(BRLMPrinterPrintQuality || (BRLMPrinterPrintQuality = {}));\n/**\n * url: https://support.brother.co.jp/j/s/support/html/mobilesdk/reference/android_v4/printimagesettings.html#resolution\n */\n// export enum BRLMPrinterPrintResolution {\n// Low = 'Low',\n// Normal = 'Normal',\n// High = 'High',\n// }\n//# sourceMappingURL=brother-printer.enum.js.map","export var BrotherPrintEventsEnum;\n(function (BrotherPrintEventsEnum) {\n BrotherPrintEventsEnum[\"onPrinterAvailable\"] = \"onPrinterAvailable\";\n BrotherPrintEventsEnum[\"onPrint\"] = \"onPrint\";\n BrotherPrintEventsEnum[\"onPrintFailedCommunication\"] = \"onPrintFailedCommunication\";\n BrotherPrintEventsEnum[\"onPrintError\"] = \"onPrintError\";\n})(BrotherPrintEventsEnum || (BrotherPrintEventsEnum = {}));\n//# sourceMappingURL=events.enum.js.map","import { BRLMPrinterModelName as Model, BRLMPrinterPort as Port } from './brother-printer.enum';\nexport const printerPorts = {\n [Model.QL_800]: [Port.usb],\n [Model.QL_810W]: [Port.wifi, Port.usb],\n [Model.QL_820NWB]: [Port.wifi, Port.bluetooth, Port.usb],\n [Model.TD_2320D_203]: [Port.wifi, Port.usb],\n [Model.TD_2030AD]: [Port.usb],\n [Model.TD_2350D_300]: [Port.wifi, Port.bluetooth, Port.usb, Port.bluetoothLowEnergy],\n};\n//# sourceMappingURL=models.js.map","import { Capacitor } from '@capacitor/core';\nimport { BRLMPrinterModelName, BRLMPrinterPort } from './brother-printer.enum';\nimport { printerPorts } from './models';\n/** Common display names for connection transports. */\nexport function brotherPrinterPortLabel(port) {\n switch (port) {\n case BRLMPrinterPort.wifi:\n return 'Wi-Fi';\n case BRLMPrinterPort.bluetooth:\n return 'Bluetooth';\n case BRLMPrinterPort.bluetoothLowEnergy:\n return 'Bluetooth LE';\n case BRLMPrinterPort.usb:\n return 'USB';\n default:\n return '';\n }\n}\n/** Connection choices for the existing models. USB is Android-only; wifi also covers Ethernet. */\nexport function brotherPrinterPorts(model, isAndroid = Capacitor.getPlatform() === 'android') {\n if (!Object.values(BRLMPrinterModelName).includes(model))\n return [];\n return printerPorts[model].filter((port) => isAndroid || port !== BRLMPrinterPort.usb);\n}\n/** Keep a supported saved port; otherwise prefer USB for QL-800/810W on Android. */\nexport function resolveBrotherPrinterPort(model, saved) {\n const ports = brotherPrinterPorts(model);\n if (saved && ports.includes(saved))\n return saved;\n if (ports.includes(BRLMPrinterPort.usb) &&\n (model === BRLMPrinterModelName.QL_800 || model === BRLMPrinterModelName.QL_810W))\n return BRLMPrinterPort.usb;\n return ports[0];\n}\n/** Match discovery names to an existing model enum, including documented product aliases. */\nexport function brotherPrinterModel(name) {\n const key = name\n .trim()\n .toUpperCase()\n .replace(/^BROTHER\\s+/, '')\n .replace(/[-_ ]/g, '');\n // Product names omit TD resolution; QL-820NWBc and TD-2030A use the existing enum spellings.\n const product = key === 'QL820NWBC' ? 'QL820NWB' : key === 'TD2030A' ? 'TD2030AD' : key;\n return Object.values(BRLMPrinterModelName).find((model) => model.replace(/_/g, '') === product || model.replace(/_(203|300)$/, '').replace(/_/g, '') === product);\n}\n//# sourceMappingURL=printer.js.map","import { WebPlugin } from '@capacitor/core';\nexport class BrotherPrintWeb extends WebPlugin {\n async printImage(options) {\n console.log('printImage', options);\n }\n async isChannelAvailable(options) {\n console.log('isChannelAvailable', options);\n return {\n result: false,\n };\n }\n async search(options) {\n console.log('search', options);\n }\n async cancelSearchWiFiPrinter() {\n console.log('cancelSearchWiFiPrinter');\n }\n async cancelSearchBluetoothPrinter() {\n console.log('cancelSearchBluetoothPrinter');\n }\n}\n//# sourceMappingURL=web.js.map","var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _BrotherPrinterSession_instances, _BrotherPrinterSession_closed, _BrotherPrinterSession_printers, _BrotherPrinterSession_listeners, _BrotherPrinterSession_listening, _BrotherPrinterSession_disposal, _BrotherPrinterSession_storage, _BrotherPrinterSession_storageKey, _BrotherPrinterSession_readSavedPrinter, _BrotherPrinterSession_savePrinter, _BrotherPrinterSession_discover;\nimport { registerPlugin } from '@capacitor/core';\nimport { BRLMPrinterPort } from './brother-printer.enum';\nimport { BrotherPrintEventsEnum } from './events.enum';\nimport { brotherPrinterModel } from './printer';\nconst BrotherPrint = registerPlugin('BrotherPrint', {\n web: () => import('./web').then((m) => new m.BrotherPrintWeb()),\n});\nexport * from './definitions';\nexport * from './web';\nexport * from './events.enum';\nexport * from './interfaces';\nexport * from './brother-printer.enum';\nexport { BrotherPrint };\nexport * from './printer';\n// Native discovery events are shared. Keep each helper call's listener scoped to its turn.\nlet connectionQueue = Promise.resolve();\nfunction queueConnection(run) {\n const result = connectionQueue.then(run);\n connectionQueue = result.catch(() => undefined);\n return result;\n}\n/** Collect discovery results, waiting for earlier helper calls to finish. */\nexport function searchBrotherPrinters(options, _model) {\n return queueConnection(() => discoverPrinters(options));\n}\n/**\n * Reuse a matching, available previous channel; otherwise discover printers.\n * The caller owns storage. USB always discovers again through the native permission flow.\n * Availability errors propagate; only an unavailable channel triggers discovery.\n */\nexport function prepareBrotherPrinters(options, model, previous) {\n return queueConnection(() => preparePrinters(options, model, previous));\n}\n/**\n * Check an explicitly selected address without discovery or fallback to another printer.\n * Port must be supplied; an address does not identify its transport or printer model.\n */\nexport function checkBrotherPrinterChannel(channel) {\n return queueConnection(async () => {\n const { result } = await BrotherPrint.isChannelAvailable(Object.assign({ modelName: '', serialNumber: '', macAddress: '', nodeName: '', location: '' }, channel));\n return result;\n });\n}\nasync function discoverPrinters(options, active = () => true) {\n const printers = [];\n const listener = await BrotherPrint.addListener(BrotherPrintEventsEnum.onPrinterAvailable, (printer) => {\n if (printer.port !== options.port)\n return;\n const index = printers.findIndex((current) => current.port === printer.port && current.channelInfo === printer.channelInfo);\n if (index < 0)\n printers.push(printer);\n else\n printers[index] = printer;\n });\n await (active() ? BrotherPrint.search(options) : Promise.resolve()).finally(() => listener.remove());\n return printers;\n}\nasync function preparePrinters(options, model, previous, active = () => true) {\n if (options.port !== BRLMPrinterPort.usb &&\n (previous === null || previous === void 0 ? void 0 : previous.port) === options.port &&\n previous.channelInfo.trim() &&\n brotherPrinterModel(previous.modelName) === model) {\n const available = await BrotherPrint.isChannelAvailable(previous);\n if (available.result)\n return [previous];\n }\n return active() ? discoverPrinters(options, active) : [];\n}\n/** One print screen's discovery results and event subscriptions. Create a new session after disposal. */\nexport class BrotherPrinterSession {\n constructor(options = {}) {\n var _a;\n _BrotherPrinterSession_instances.add(this);\n _BrotherPrinterSession_closed.set(this, false);\n _BrotherPrinterSession_printers.set(this, []);\n _BrotherPrinterSession_listeners.set(this, []);\n _BrotherPrinterSession_listening.set(this, void 0);\n _BrotherPrinterSession_disposal.set(this, void 0);\n _BrotherPrinterSession_storage.set(this, void 0);\n _BrotherPrinterSession_storageKey.set(this, void 0);\n __classPrivateFieldSet(this, _BrotherPrinterSession_storage, options.storage, \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_storageKey, `${(_a = options.storagePrefix) !== null && _a !== void 0 ? _a : 'brotherprint:'}last-printer`, \"f\");\n }\n get closed() {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\");\n }\n get printers() {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_printers, \"f\");\n }\n search(options, _model) {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_discover).call(this, () => discoverPrinters(options, () => !__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\")));\n }\n prepare(options, model, previous) {\n return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_discover).call(this, async () => {\n const saved = previous === undefined ? await __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_readSavedPrinter).call(this).catch(() => undefined) : previous;\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return [];\n return preparePrinters(options, model, saved, () => !__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"));\n });\n }\n /** Forget the remembered connection. Storage removal errors propagate to the caller. */\n async clearSavedPrinter() {\n var _a;\n await ((_a = __classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\")) === null || _a === void 0 ? void 0 : _a.remove(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, \"f\")));\n }\n /** Register print notifications once. Callbacks stop immediately when disposed. */\n listen(events) {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return Promise.resolve();\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_listening, \"f\")) {\n __classPrivateFieldSet(this, _BrotherPrinterSession_listeners, [\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrint, () => {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n (_a = events.onPrint) === null || _a === void 0 ? void 0 : _a.call(events);\n }),\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrintError, (info) => {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n (_a = events.onPrintError) === null || _a === void 0 ? void 0 : _a.call(events, info);\n }),\n BrotherPrint.addListener(BrotherPrintEventsEnum.onPrintFailedCommunication, (info) => {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n (_a = events.onPrintFailedCommunication) === null || _a === void 0 ? void 0 : _a.call(events, info);\n }),\n ], \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_listening, Promise.all(__classPrivateFieldGet(this, _BrotherPrinterSession_listeners, \"f\")).then(() => undefined), \"f\");\n }\n return __classPrivateFieldGet(this, _BrotherPrinterSession_listening, \"f\");\n }\n /** A closed session cannot start another print. Already started native printing is awaited. */\n async printImage(options) {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return;\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\"))\n await __classPrivateFieldGet(this, _BrotherPrinterSession_instances, \"m\", _BrotherPrinterSession_savePrinter).call(this, options).catch(() => undefined);\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n await BrotherPrint.printImage(options);\n }\n /** Invalidate pending work immediately, then remove this session's print listeners. */\n dispose() {\n var _a;\n __classPrivateFieldSet(this, _BrotherPrinterSession_closed, true, \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_printers, [], \"f\");\n __classPrivateFieldSet(this, _BrotherPrinterSession_disposal, (_a = __classPrivateFieldGet(this, _BrotherPrinterSession_disposal, \"f\")) !== null && _a !== void 0 ? _a : Promise.all(__classPrivateFieldGet(this, _BrotherPrinterSession_listeners, \"f\").map((listener) => listener.then((handle) => handle.remove()))).then(() => undefined), \"f\");\n return __classPrivateFieldGet(this, _BrotherPrinterSession_disposal, \"f\");\n }\n}\n_BrotherPrinterSession_closed = new WeakMap(), _BrotherPrinterSession_printers = new WeakMap(), _BrotherPrinterSession_listeners = new WeakMap(), _BrotherPrinterSession_listening = new WeakMap(), _BrotherPrinterSession_disposal = new WeakMap(), _BrotherPrinterSession_storage = new WeakMap(), _BrotherPrinterSession_storageKey = new WeakMap(), _BrotherPrinterSession_instances = new WeakSet(), _BrotherPrinterSession_readSavedPrinter = async function _BrotherPrinterSession_readSavedPrinter() {\n var _a;\n const value = await ((_a = __classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\")) === null || _a === void 0 ? void 0 : _a.get(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, \"f\")));\n if (!value)\n return undefined;\n const channel = JSON.parse(value);\n if (channel &&\n Object.values(BRLMPrinterPort).includes(channel.port) &&\n ['modelName', 'channelInfo', 'serialNumber', 'macAddress', 'nodeName', 'location'].every((key) => typeof channel[key] === 'string'))\n return channel;\n return undefined;\n}, _BrotherPrinterSession_savePrinter = async function _BrotherPrinterSession_savePrinter(options) {\n var _a;\n if (!__classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\") || !options.port || !((_a = options.channelInfo) === null || _a === void 0 ? void 0 : _a.trim()))\n return;\n const found = __classPrivateFieldGet(this, _BrotherPrinterSession_printers, \"f\").find((printer) => printer.port === options.port && printer.channelInfo === options.channelInfo);\n const channel = Object.assign(Object.assign({ serialNumber: '', macAddress: '', nodeName: '', location: '' }, found), { port: options.port, channelInfo: options.channelInfo, modelName: options.modelName });\n await __classPrivateFieldGet(this, _BrotherPrinterSession_storage, \"f\").set(__classPrivateFieldGet(this, _BrotherPrinterSession_storageKey, \"f\"), JSON.stringify(channel));\n}, _BrotherPrinterSession_discover = function _BrotherPrinterSession_discover(run) {\n return queueConnection(async () => {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return [];\n __classPrivateFieldSet(this, _BrotherPrinterSession_printers, [], \"f\");\n return run().then((printers) => {\n if (__classPrivateFieldGet(this, _BrotherPrinterSession_closed, \"f\"))\n return [];\n __classPrivateFieldSet(this, _BrotherPrinterSession_printers, printers, \"f\");\n return printers;\n });\n });\n};\n//# sourceMappingURL=index.js.map"],"names":["BRLMPrinterPort","BRLMPrinterCustomPaperUnit","BRLMPrinterCustomPaperType","BRLMPrinterModelName","BRLMPrinterLabelName","BRLMPrinterImageRotation","BRLMPrinterScaleMode","BRLMPrinterHalftone","BRLMPrinterVerticalAlignment","BRLMPrinterHorizontalAlignment","BRLMPrinterCompressMode","BRLMPrinterPrintQuality","BrotherPrintEventsEnum","Model","Port","Capacitor","WebPlugin","this","registerPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG,KAAK;AAClC,IAAI,eAAe,CAAC,MAAM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,EAAE,6BAA6B,EAAE,GAAG,CAAC;AAChF,gBAAgB,OAAO,EAAE;AACzB,YAAY,sBAAsB,CAAC,IAAI,EAAE,+BAA+B,EAAE,QAAQ,EAAE,GAAG,CAAC;AACxF,YAAY,OAAO,QAAQ;AAC3B,QAAQ,CAAC,CAAC;AACV,IAAI,CAAC,CAAC;AACN,CAAC;;;;;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -269,8 +269,8 @@ var capacitorExample = (function (exports, core) {
|
|
|
269
269
|
return result;
|
|
270
270
|
}
|
|
271
271
|
/** Collect discovery results, waiting for earlier helper calls to finish. */
|
|
272
|
-
function searchBrotherPrinters(options,
|
|
273
|
-
return queueConnection(() => discoverPrinters(options
|
|
272
|
+
function searchBrotherPrinters(options, _model) {
|
|
273
|
+
return queueConnection(() => discoverPrinters(options));
|
|
274
274
|
}
|
|
275
275
|
/**
|
|
276
276
|
* Reuse a matching, available previous channel; otherwise discover printers.
|
|
@@ -290,13 +290,11 @@ var capacitorExample = (function (exports, core) {
|
|
|
290
290
|
return result;
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
|
-
async function discoverPrinters(options,
|
|
293
|
+
async function discoverPrinters(options, active = () => true) {
|
|
294
294
|
const printers = [];
|
|
295
295
|
const listener = await BrotherPrint.addListener(exports.BrotherPrintEventsEnum.onPrinterAvailable, (printer) => {
|
|
296
296
|
if (printer.port !== options.port)
|
|
297
297
|
return;
|
|
298
|
-
if (printer.port !== exports.BRLMPrinterPort.usb && model !== undefined && brotherPrinterModel(printer.modelName) !== model)
|
|
299
|
-
return;
|
|
300
298
|
const index = printers.findIndex((current) => current.port === printer.port && current.channelInfo === printer.channelInfo);
|
|
301
299
|
if (index < 0)
|
|
302
300
|
printers.push(printer);
|
|
@@ -315,7 +313,7 @@ var capacitorExample = (function (exports, core) {
|
|
|
315
313
|
if (available.result)
|
|
316
314
|
return [previous];
|
|
317
315
|
}
|
|
318
|
-
return active() ? discoverPrinters(options,
|
|
316
|
+
return active() ? discoverPrinters(options, active) : [];
|
|
319
317
|
}
|
|
320
318
|
/** One print screen's discovery results and event subscriptions. Create a new session after disposal. */
|
|
321
319
|
class BrotherPrinterSession {
|
|
@@ -338,8 +336,8 @@ var capacitorExample = (function (exports, core) {
|
|
|
338
336
|
get printers() {
|
|
339
337
|
return __classPrivateFieldGet(this, _BrotherPrinterSession_printers, "f");
|
|
340
338
|
}
|
|
341
|
-
search(options,
|
|
342
|
-
return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_discover).call(this, () => discoverPrinters(options,
|
|
339
|
+
search(options, _model) {
|
|
340
|
+
return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_discover).call(this, () => discoverPrinters(options, () => !__classPrivateFieldGet(this, _BrotherPrinterSession_closed, "f")));
|
|
343
341
|
}
|
|
344
342
|
prepare(options, model, previous) {
|
|
345
343
|
return __classPrivateFieldGet(this, _BrotherPrinterSession_instances, "m", _BrotherPrinterSession_discover).call(this, async () => {
|