@embedpdf/plugin-print 2.0.0-next.0 → 2.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/models"),r="print",i={id:r,name:"Print Plugin",version:"1.0.0",provides:["print"],requires:[],optional:[],defaultConfig:{
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/models"),r="print",i={id:r,name:"Print Plugin",version:"1.0.0",provides:["print"],requires:[],optional:[],defaultConfig:{}},n=class extends e.BasePlugin{constructor(t,r,i){super(t,r),this.printReady$=e.createEmitter()}buildCapability(){return{print:e=>this.print(e),forDocument:e=>this.createPrintScope(e)}}createPrintScope(e){return{print:t=>this.print(t,e)}}print(e,r){const i=r??this.getActiveDocumentId(),n=e??{},s=new t.Task;s.progress({stage:"preparing",message:"Preparing document..."});return this.preparePrintDocument(n,i).wait(e=>{s.progress({stage:"document-ready",message:"Document prepared successfully"}),this.printReady$.emit({documentId:i,options:n,buffer:e,task:s})},e=>s.fail(e)),s}preparePrintDocument(e,r){const i=this.coreState.core.documents[r];return(null==i?void 0:i.document)?this.engine.preparePrintDocument(i.document,e):t.PdfTaskHelper.reject({code:t.PdfErrorCode.DocNotOpen,message:`Document ${r} not found`})}onPrintRequest(e){return this.printReady$.on(e)}async initialize(e){this.logger.info("PrintPlugin","Initialize","Print plugin initialized")}async destroy(){this.printReady$.clear(),await super.destroy()}};n.id="print";let s=n;const o={manifest:i,create:(e,t)=>new s(r,e,t),reducer:()=>{},initialState:{}};exports.PRINT_PLUGIN_ID=r,exports.PrintPlugin=s,exports.PrintPluginPackage=o,exports.manifest=i;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/lib/manifest.ts","../src/lib/print-plugin.ts","../src/lib/index.ts"],"sourcesContent":["import { PluginManifest } from '@embedpdf/core';\nimport { PrintPluginConfig } from './types';\n\nexport const PRINT_PLUGIN_ID = 'print';\n\nexport const manifest: PluginManifest<PrintPluginConfig> = {\n id: PRINT_PLUGIN_ID,\n name: 'Print Plugin',\n version: '1.0.0',\n provides: ['print'],\n requires: [],\n optional: [],\n defaultConfig: {
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/lib/manifest.ts","../src/lib/print-plugin.ts","../src/lib/index.ts"],"sourcesContent":["import { PluginManifest } from '@embedpdf/core';\nimport { PrintPluginConfig } from './types';\n\nexport const PRINT_PLUGIN_ID = 'print';\n\nexport const manifest: PluginManifest<PrintPluginConfig> = {\n id: PRINT_PLUGIN_ID,\n name: 'Print Plugin',\n version: '1.0.0',\n provides: ['print'],\n requires: [],\n optional: [],\n defaultConfig: {},\n};\n","import { BasePlugin, createEmitter, Listener, PluginRegistry, Unsubscribe } from '@embedpdf/core';\nimport {\n PdfErrorCode,\n PdfErrorReason,\n PdfPrintOptions,\n PdfTaskHelper,\n Task,\n} from '@embedpdf/models';\n\nimport {\n PrintCapability,\n PrintPluginConfig,\n PrintProgress,\n PrintReadyEvent,\n PrintScope,\n} from './types';\n\nexport class PrintPlugin extends BasePlugin<PrintPluginConfig, PrintCapability> {\n static readonly id = 'print' as const;\n\n private readonly printReady$ = createEmitter<PrintReadyEvent>();\n\n constructor(id: string, registry: PluginRegistry, _config: PrintPluginConfig) {\n super(id, registry);\n }\n\n // ─────────────────────────────────────────────────────────\n // Capability\n // ─────────────────────────────────────────────────────────\n\n protected buildCapability(): PrintCapability {\n return {\n // Active document operations\n print: (options?: PdfPrintOptions) => this.print(options),\n\n // Document-scoped operations\n forDocument: (documentId: string) => this.createPrintScope(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Document Scoping\n // ─────────────────────────────────────────────────────────\n\n private createPrintScope(documentId: string): PrintScope {\n return {\n print: (options?: PdfPrintOptions) => this.print(options, documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Core Operations\n // ─────────────────────────────────────────────────────────\n\n private print(\n options?: PdfPrintOptions,\n documentId?: string,\n ): Task<ArrayBuffer, PdfErrorReason, PrintProgress> {\n const id = documentId ?? this.getActiveDocumentId();\n const printOptions = options ?? {};\n const task = new Task<ArrayBuffer, PdfErrorReason, PrintProgress>();\n\n task.progress({ stage: 'preparing', message: 'Preparing document...' });\n\n const prepare = this.preparePrintDocument(printOptions, id);\n prepare.wait(\n (buffer) => {\n task.progress({ stage: 'document-ready', message: 'Document prepared successfully' });\n // Emit buffer + task for the framework layer to display & trigger print\n this.printReady$.emit({\n documentId: id,\n options: printOptions,\n buffer,\n task,\n });\n },\n (error) => task.fail(error),\n );\n\n return task;\n }\n\n private preparePrintDocument(\n options: PdfPrintOptions,\n documentId: string,\n ): Task<ArrayBuffer, PdfErrorReason> {\n const coreDoc = this.coreState.core.documents[documentId];\n\n if (!coreDoc?.document) {\n return PdfTaskHelper.reject({\n code: PdfErrorCode.DocNotOpen,\n message: `Document ${documentId} not found`,\n });\n }\n\n return this.engine.preparePrintDocument(coreDoc.document, options);\n }\n\n // ─────────────────────────────────────────────────────────\n // Event Listeners\n // ─────────────────────────────────────────────────────────\n\n public onPrintRequest(listener: Listener<PrintReadyEvent>): Unsubscribe {\n return this.printReady$.on(listener);\n }\n\n // ─────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────\n\n async initialize(_: PrintPluginConfig): Promise<void> {\n this.logger.info('PrintPlugin', 'Initialize', 'Print plugin initialized');\n }\n\n async destroy(): Promise<void> {\n this.printReady$.clear();\n await super.destroy();\n }\n}\n","import { PluginPackage } from '@embedpdf/core';\nimport { manifest, PRINT_PLUGIN_ID } from './manifest';\nimport { PrintPluginConfig } from './types';\nimport { PrintPlugin } from './print-plugin';\n\nexport const PrintPluginPackage: PluginPackage<PrintPlugin, PrintPluginConfig> = {\n manifest,\n create: (registry, config) => new PrintPlugin(PRINT_PLUGIN_ID, registry, config),\n reducer: () => {},\n initialState: {},\n};\n\nexport * from './print-plugin';\nexport * from './types';\nexport * from './manifest';\n"],"names":["PRINT_PLUGIN_ID","manifest","id","name","version","provides","requires","optional","defaultConfig","_PrintPlugin","BasePlugin","constructor","registry","_config","super","this","printReady$","createEmitter","buildCapability","print","options","forDocument","documentId","createPrintScope","getActiveDocumentId","printOptions","task","Task","progress","stage","message","preparePrintDocument","wait","buffer","emit","error","fail","coreDoc","coreState","core","documents","document","engine","PdfTaskHelper","reject","code","PdfErrorCode","DocNotOpen","onPrintRequest","listener","on","initialize","_","logger","info","destroy","clear","PrintPlugin","PrintPluginPackage","create","config","reducer","initialState"],"mappings":"gJAGaA,EAAkB,QAElBC,EAA8C,CACzDC,GAAIF,EACJG,KAAM,eACNC,QAAS,QACTC,SAAU,CAAC,SACXC,SAAU,GACVC,SAAU,GACVC,cAAe,CAAA,GCKJC,EAAN,cAA0BC,EAAAA,WAK/B,WAAAC,CAAYT,EAAYU,EAA0BC,GAChDC,MAAMZ,EAAIU,GAHZG,KAAiBC,YAAcC,iBAI/B,CAMU,eAAAC,GACR,MAAO,CAELC,MAAQC,GAA8BL,KAAKI,MAAMC,GAGjDC,YAAcC,GAAuBP,KAAKQ,iBAAiBD,GAE/D,CAMQ,gBAAAC,CAAiBD,GACvB,MAAO,CACLH,MAAQC,GAA8BL,KAAKI,MAAMC,EAASE,GAE9D,CAMQ,KAAAH,CACNC,EACAE,GAEA,MAAMpB,EAAKoB,GAAcP,KAAKS,sBACxBC,EAAeL,GAAW,CAAA,EAC1BM,EAAO,IAAIC,OAEjBD,EAAKE,SAAS,CAAEC,MAAO,YAAaC,QAAS,0BAiB7C,OAfgBf,KAAKgB,qBAAqBN,EAAcvB,GAChD8B,KACLC,IACCP,EAAKE,SAAS,CAAEC,MAAO,iBAAkBC,QAAS,mCAElDf,KAAKC,YAAYkB,KAAK,CACpBZ,WAAYpB,EACZkB,QAASK,EACTQ,SACAP,UAGHS,GAAUT,EAAKU,KAAKD,IAGhBT,CACT,CAEQ,oBAAAK,CACNX,EACAE,GAEA,MAAMe,EAAUtB,KAAKuB,UAAUC,KAAKC,UAAUlB,GAE9C,aAAKe,WAASI,UAOP1B,KAAK2B,OAAOX,qBAAqBM,EAAQI,SAAUrB,GANjDuB,EAAAA,cAAcC,OAAO,CAC1BC,KAAMC,EAAAA,aAAaC,WACnBjB,QAAS,YAAYR,eAK3B,CAMO,cAAA0B,CAAeC,GACpB,OAAOlC,KAAKC,YAAYkC,GAAGD,EAC7B,CAMA,gBAAME,CAAWC,GACfrC,KAAKsC,OAAOC,KAAK,cAAe,aAAc,2BAChD,CAEA,aAAMC,GACJxC,KAAKC,YAAYwC,cACX1C,MAAMyC,SACd,GAnGA9C,EAAgBP,GAAK,QADhB,IAAMuD,EAANhD,ECZA,MAAMiD,EAAoE,CAC/EzD,WACA0D,OAAQ,CAAC/C,EAAUgD,IAAW,IAAIH,EAAYzD,EAAiBY,EAAUgD,GACzEC,QAAS,OACTC,aAAc,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/lib/manifest.ts","../src/lib/print-plugin.ts","../src/lib/index.ts"],"sourcesContent":["import { PluginManifest } from '@embedpdf/core';\nimport { PrintPluginConfig } from './types';\n\nexport const PRINT_PLUGIN_ID = 'print';\n\nexport const manifest: PluginManifest<PrintPluginConfig> = {\n id: PRINT_PLUGIN_ID,\n name: 'Print Plugin',\n version: '1.0.0',\n provides: ['print'],\n requires: [],\n optional: [],\n defaultConfig: {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/lib/manifest.ts","../src/lib/print-plugin.ts","../src/lib/index.ts"],"sourcesContent":["import { PluginManifest } from '@embedpdf/core';\nimport { PrintPluginConfig } from './types';\n\nexport const PRINT_PLUGIN_ID = 'print';\n\nexport const manifest: PluginManifest<PrintPluginConfig> = {\n id: PRINT_PLUGIN_ID,\n name: 'Print Plugin',\n version: '1.0.0',\n provides: ['print'],\n requires: [],\n optional: [],\n defaultConfig: {},\n};\n","import { BasePlugin, createEmitter, Listener, PluginRegistry, Unsubscribe } from '@embedpdf/core';\nimport {\n PdfErrorCode,\n PdfErrorReason,\n PdfPrintOptions,\n PdfTaskHelper,\n Task,\n} from '@embedpdf/models';\n\nimport {\n PrintCapability,\n PrintPluginConfig,\n PrintProgress,\n PrintReadyEvent,\n PrintScope,\n} from './types';\n\nexport class PrintPlugin extends BasePlugin<PrintPluginConfig, PrintCapability> {\n static readonly id = 'print' as const;\n\n private readonly printReady$ = createEmitter<PrintReadyEvent>();\n\n constructor(id: string, registry: PluginRegistry, _config: PrintPluginConfig) {\n super(id, registry);\n }\n\n // ─────────────────────────────────────────────────────────\n // Capability\n // ─────────────────────────────────────────────────────────\n\n protected buildCapability(): PrintCapability {\n return {\n // Active document operations\n print: (options?: PdfPrintOptions) => this.print(options),\n\n // Document-scoped operations\n forDocument: (documentId: string) => this.createPrintScope(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Document Scoping\n // ─────────────────────────────────────────────────────────\n\n private createPrintScope(documentId: string): PrintScope {\n return {\n print: (options?: PdfPrintOptions) => this.print(options, documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Core Operations\n // ─────────────────────────────────────────────────────────\n\n private print(\n options?: PdfPrintOptions,\n documentId?: string,\n ): Task<ArrayBuffer, PdfErrorReason, PrintProgress> {\n const id = documentId ?? this.getActiveDocumentId();\n const printOptions = options ?? {};\n const task = new Task<ArrayBuffer, PdfErrorReason, PrintProgress>();\n\n task.progress({ stage: 'preparing', message: 'Preparing document...' });\n\n const prepare = this.preparePrintDocument(printOptions, id);\n prepare.wait(\n (buffer) => {\n task.progress({ stage: 'document-ready', message: 'Document prepared successfully' });\n // Emit buffer + task for the framework layer to display & trigger print\n this.printReady$.emit({\n documentId: id,\n options: printOptions,\n buffer,\n task,\n });\n },\n (error) => task.fail(error),\n );\n\n return task;\n }\n\n private preparePrintDocument(\n options: PdfPrintOptions,\n documentId: string,\n ): Task<ArrayBuffer, PdfErrorReason> {\n const coreDoc = this.coreState.core.documents[documentId];\n\n if (!coreDoc?.document) {\n return PdfTaskHelper.reject({\n code: PdfErrorCode.DocNotOpen,\n message: `Document ${documentId} not found`,\n });\n }\n\n return this.engine.preparePrintDocument(coreDoc.document, options);\n }\n\n // ─────────────────────────────────────────────────────────\n // Event Listeners\n // ─────────────────────────────────────────────────────────\n\n public onPrintRequest(listener: Listener<PrintReadyEvent>): Unsubscribe {\n return this.printReady$.on(listener);\n }\n\n // ─────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────\n\n async initialize(_: PrintPluginConfig): Promise<void> {\n this.logger.info('PrintPlugin', 'Initialize', 'Print plugin initialized');\n }\n\n async destroy(): Promise<void> {\n this.printReady$.clear();\n await super.destroy();\n }\n}\n","import { PluginPackage } from '@embedpdf/core';\nimport { manifest, PRINT_PLUGIN_ID } from './manifest';\nimport { PrintPluginConfig } from './types';\nimport { PrintPlugin } from './print-plugin';\n\nexport const PrintPluginPackage: PluginPackage<PrintPlugin, PrintPluginConfig> = {\n manifest,\n create: (registry, config) => new PrintPlugin(PRINT_PLUGIN_ID, registry, config),\n reducer: () => {},\n initialState: {},\n};\n\nexport * from './print-plugin';\nexport * from './types';\nexport * from './manifest';\n"],"names":[],"mappings":";;AAGO,MAAM,kBAAkB;AAExB,MAAM,WAA8C;AAAA,EACzD,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU,CAAC,OAAO;AAAA,EAClB,UAAU,CAAA;AAAA,EACV,UAAU,CAAA;AAAA,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H;AAEA,WAAO,KAAK,OAAO,qBAAqB,QAAQ,UAAU,OAAO;AAAA,EACnE;AAAA;AAAA;AAAA;AAAA,EAMO,eAAe,UAAkD;AACtE,WAAO,KAAK,YAAY,GAAG,QAAQ;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,WAAW,GAAqC;AACpD,SAAK,OAAO,KAAK,eAAe,cAAc,0BAA0B;AAAA,EAC1E;AAAA,EAEA,MAAM,UAAyB;AAC7B,SAAK,YAAY,MAAA;AACjB,UAAM,MAAM,QAAA;AAAA,EACd;AACF;AApGE,aAAgB,KAAK;AADhB,IAAM,cAAN;ACZA,MAAM,qBAAoE;AAAA,EAC/E;AAAA,EACA,QAAQ,CAAC,UAAU,WAAW,IAAI,YAAY,iBAAiB,UAAU,MAAM;AAAA,EAC/E,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,cAAc,CAAA;AAChB;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/plugin-print",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@embedpdf/models": "2.0.0-next.
|
|
37
|
+
"@embedpdf/models": "2.0.0-next.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/react": "^18.2.0",
|
|
41
41
|
"@types/react-dom": "^18.2.0",
|
|
42
42
|
"typescript": "^5.0.0",
|
|
43
|
-
"@embedpdf/
|
|
44
|
-
"@embedpdf/
|
|
43
|
+
"@embedpdf/core": "2.0.0-next.2",
|
|
44
|
+
"@embedpdf/build": "1.1.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": ">=18.0.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"preact": "^10.26.4",
|
|
50
50
|
"vue": ">=3.2.0",
|
|
51
51
|
"svelte": ">=5 <6",
|
|
52
|
-
"@embedpdf/core": "2.0.0-next.
|
|
52
|
+
"@embedpdf/core": "2.0.0-next.2"
|
|
53
53
|
},
|
|
54
54
|
"files": [
|
|
55
55
|
"dist",
|