@embedpdf/plugin-export 1.5.0 → 2.0.0-next.1
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 +62 -26
- package/dist/index.js.map +1 -1
- package/dist/lib/export-plugin.d.ts +7 -5
- package/dist/lib/types.d.ts +10 -0
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +21 -18
- package/dist/preact/index.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +21 -18
- package/dist/react/index.js.map +1 -1
- package/dist/shared/component/download.d.ts +1 -4
- package/dist/shared/hooks/use-export.d.ts +7 -0
- package/dist/shared-preact/component/download.d.ts +1 -4
- package/dist/shared-preact/hooks/use-export.d.ts +7 -0
- package/dist/shared-react/component/download.d.ts +1 -4
- package/dist/shared-react/hooks/use-export.d.ts +7 -0
- package/dist/svelte/hooks/use-export.svelte.d.ts +10 -1
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.cjs.map +1 -1
- package/dist/svelte/index.js +25 -16
- package/dist/svelte/index.js.map +1 -1
- package/dist/vue/components/download.vue.d.ts +2 -4
- package/dist/vue/hooks/use-export.d.ts +8 -0
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +22 -18
- package/dist/vue/index.js.map +1 -1
- package/package.json +4 -4
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"),o=class extends e.BasePlugin{constructor(t,o,s){super(t,o),this.downloadRequest$=e.createEmitter(),this.config=s}
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/models"),o=class extends e.BasePlugin{constructor(t,o,s){super(t,o),this.downloadRequest$=e.createEmitter(),this.config=s}buildCapability(){return{saveAsCopy:()=>this.saveAsCopy(),download:()=>this.download(),forDocument:e=>this.createExportScope(e)}}createExportScope(e){return{saveAsCopy:()=>this.saveAsCopy(e),download:()=>this.download(e)}}download(e){const t=e??this.getActiveDocumentId();this.downloadRequest$.emit({documentId:t})}saveAsCopy(e){const o=e??this.getActiveDocumentId(),s=this.coreState.core.documents[o];return(null==s?void 0:s.document)?this.engine.saveAsCopy(s.document):t.PdfTaskHelper.reject({code:t.PdfErrorCode.DocNotOpen,message:`Document ${o} not found`})}saveAsCopyAndGetBufferAndName(e){const o=new t.Task,s=this.coreState.core.documents[e];return(null==s?void 0:s.document)?(this.saveAsCopy(e).wait(e=>{o.resolve({buffer:e,name:s.name??this.config.defaultFileName})},e=>o.fail(e)),o):t.PdfTaskHelper.reject({code:t.PdfErrorCode.DocNotOpen,message:`Document ${e} not found`})}onRequest(e){return this.downloadRequest$.on(e)}async initialize(e){this.logger.info("ExportPlugin","Initialize","Export plugin initialized")}async destroy(){this.downloadRequest$.clear(),await super.destroy()}};o.id="export";let s=o;const n="export",r={id:n,name:"Export Plugin",version:"1.0.0",provides:["export"],requires:[],optional:[],defaultConfig:{enabled:!0,defaultFileName:"document.pdf"}},i={manifest:r,create:(e,t)=>new s(n,e,t),reducer:()=>{},initialState:{}};exports.EXPORT_PLUGIN_ID=n,exports.ExportPlugin=s,exports.ExportPluginPackage=i,exports.manifest=r;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/lib/export-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, createEmitter, Listener, PluginRegistry
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/lib/export-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, createEmitter, Listener, PluginRegistry } from '@embedpdf/core';\nimport { PdfErrorCode, PdfErrorReason, PdfTaskHelper, Task } from '@embedpdf/models';\n\nimport {\n BufferAndName,\n ExportCapability,\n ExportPluginConfig,\n ExportScope,\n DownloadRequestEvent,\n} from './types';\n\nexport class ExportPlugin extends BasePlugin<ExportPluginConfig, ExportCapability> {\n static readonly id = 'export' as const;\n\n private readonly downloadRequest$ = createEmitter<DownloadRequestEvent>();\n private readonly config: ExportPluginConfig;\n\n constructor(id: string, registry: PluginRegistry, config: ExportPluginConfig) {\n super(id, registry);\n this.config = config;\n }\n\n // ─────────────────────────────────────────────────────────\n // Capability\n // ─────────────────────────────────────────────────────────\n\n protected buildCapability(): ExportCapability {\n return {\n // Active document operations\n saveAsCopy: () => this.saveAsCopy(),\n download: () => this.download(),\n\n // Document-scoped operations\n forDocument: (documentId: string) => this.createExportScope(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Document Scoping\n // ─────────────────────────────────────────────────────────\n\n private createExportScope(documentId: string): ExportScope {\n return {\n saveAsCopy: () => this.saveAsCopy(documentId),\n download: () => this.download(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Core Operations\n // ─────────────────────────────────────────────────────────\n\n private download(documentId?: string): void {\n const id = documentId ?? this.getActiveDocumentId();\n this.downloadRequest$.emit({ documentId: id });\n }\n\n private saveAsCopy(documentId?: string): Task<ArrayBuffer, PdfErrorReason> {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n return PdfTaskHelper.reject({\n code: PdfErrorCode.DocNotOpen,\n message: `Document ${id} not found`,\n });\n }\n\n return this.engine.saveAsCopy(coreDoc.document);\n }\n\n public saveAsCopyAndGetBufferAndName(documentId: string): Task<BufferAndName, PdfErrorReason> {\n const task = new Task<BufferAndName, 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 this.saveAsCopy(documentId).wait(\n (result) => {\n task.resolve({\n buffer: result,\n name: coreDoc.name ?? this.config.defaultFileName,\n });\n },\n (error) => task.fail(error),\n );\n\n return task;\n }\n\n // ─────────────────────────────────────────────────────────\n // Event Listeners\n // ─────────────────────────────────────────────────────────\n\n public onRequest(listener: Listener<DownloadRequestEvent>) {\n return this.downloadRequest$.on(listener);\n }\n\n // ─────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────\n\n async initialize(_: ExportPluginConfig): Promise<void> {\n this.logger.info('ExportPlugin', 'Initialize', 'Export plugin initialized');\n }\n\n async destroy(): Promise<void> {\n this.downloadRequest$.clear();\n await super.destroy();\n }\n}\n","import { PluginManifest } from '@embedpdf/core';\nimport { ExportPluginConfig } from './types';\n\nexport const EXPORT_PLUGIN_ID = 'export';\n\nexport const manifest: PluginManifest<ExportPluginConfig> = {\n id: EXPORT_PLUGIN_ID,\n name: 'Export Plugin',\n version: '1.0.0',\n provides: ['export'],\n requires: [],\n optional: [],\n defaultConfig: {\n enabled: true,\n defaultFileName: 'document.pdf',\n },\n};\n","import { PluginPackage } from '@embedpdf/core';\n\nimport { ExportPlugin } from './export-plugin';\nimport { manifest, EXPORT_PLUGIN_ID } from './manifest';\nimport { ExportPluginConfig } from './types';\n\nexport const ExportPluginPackage: PluginPackage<ExportPlugin, ExportPluginConfig> = {\n manifest,\n create: (registry, config) => new ExportPlugin(EXPORT_PLUGIN_ID, registry, config),\n reducer: () => {},\n initialState: {},\n};\n\nexport * from './export-plugin';\nexport * from './types';\nexport * from './manifest';\n"],"names":["_ExportPlugin","BasePlugin","constructor","id","registry","config","super","this","downloadRequest$","createEmitter","buildCapability","saveAsCopy","download","forDocument","documentId","createExportScope","getActiveDocumentId","emit","coreDoc","coreState","core","documents","document","engine","PdfTaskHelper","reject","code","PdfErrorCode","DocNotOpen","message","saveAsCopyAndGetBufferAndName","task","Task","wait","result","resolve","buffer","name","defaultFileName","error","fail","onRequest","listener","on","initialize","_","logger","info","destroy","clear","ExportPlugin","EXPORT_PLUGIN_ID","manifest","version","provides","requires","optional","defaultConfig","enabled","ExportPluginPackage","create","reducer","initialState"],"mappings":"gJAWaA,EAAN,cAA2BC,EAAAA,WAMhC,WAAAC,CAAYC,EAAYC,EAA0BC,GAChDC,MAAMH,EAAIC,GAJZG,KAAiBC,iBAAmBC,kBAKlCF,KAAKF,OAASA,CAChB,CAMU,eAAAK,GACR,MAAO,CAELC,WAAY,IAAMJ,KAAKI,aACvBC,SAAU,IAAML,KAAKK,WAGrBC,YAAcC,GAAuBP,KAAKQ,kBAAkBD,GAEhE,CAMQ,iBAAAC,CAAkBD,GACxB,MAAO,CACLH,WAAY,IAAMJ,KAAKI,WAAWG,GAClCF,SAAU,IAAML,KAAKK,SAASE,GAElC,CAMQ,QAAAF,CAASE,GACf,MAAMX,EAAKW,GAAcP,KAAKS,sBAC9BT,KAAKC,iBAAiBS,KAAK,CAAEH,WAAYX,GAC3C,CAEQ,UAAAQ,CAAWG,GACjB,MAAMX,EAAKW,GAAcP,KAAKS,sBACxBE,EAAUX,KAAKY,UAAUC,KAAKC,UAAUlB,GAE9C,aAAKe,WAASI,UAOPf,KAAKgB,OAAOZ,WAAWO,EAAQI,UAN7BE,EAAAA,cAAcC,OAAO,CAC1BC,KAAMC,EAAAA,aAAaC,WACnBC,QAAS,YAAY1B,eAK3B,CAEO,6BAAA2B,CAA8BhB,GACnC,MAAMiB,EAAO,IAAIC,OACXd,EAAUX,KAAKY,UAAUC,KAAKC,UAAUP,GAE9C,aAAKI,WAASI,WAOdf,KAAKI,WAAWG,GAAYmB,KACzBC,IACCH,EAAKI,QAAQ,CACXC,OAAQF,EACRG,KAAMnB,EAAQmB,MAAQ9B,KAAKF,OAAOiC,mBAGrCC,GAAUR,EAAKS,KAAKD,IAGhBR,GAhBEP,EAAAA,cAAcC,OAAO,CAC1BC,KAAMC,EAAAA,aAAaC,WACnBC,QAAS,YAAYf,eAe3B,CAMO,SAAA2B,CAAUC,GACf,OAAOnC,KAAKC,iBAAiBmC,GAAGD,EAClC,CAMA,gBAAME,CAAWC,GACftC,KAAKuC,OAAOC,KAAK,eAAgB,aAAc,4BACjD,CAEA,aAAMC,GACJzC,KAAKC,iBAAiByC,cAChB3C,MAAM0C,SACd,GAtGAhD,EAAgBG,GAAK,SADhB,IAAM+C,EAANlD,ECRA,MAAMmD,EAAmB,SAEnBC,EAA+C,CAC1DjD,GAAIgD,EACJd,KAAM,gBACNgB,QAAS,QACTC,SAAU,CAAC,UACXC,SAAU,GACVC,SAAU,GACVC,cAAe,CACbC,SAAS,EACTpB,gBAAiB,iBCRRqB,EAAuE,CAClFP,WACAQ,OAAQ,CAACxD,EAAUC,IAAW,IAAI6C,EAAaC,EAAkB/C,EAAUC,GAC3EwD,QAAS,OACTC,aAAc,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,49 +1,85 @@
|
|
|
1
1
|
import { BasePlugin, createEmitter } from "@embedpdf/core";
|
|
2
|
-
import {
|
|
2
|
+
import { PdfTaskHelper, PdfErrorCode, Task } from "@embedpdf/models";
|
|
3
3
|
const _ExportPlugin = class _ExportPlugin extends BasePlugin {
|
|
4
4
|
constructor(id, registry, config) {
|
|
5
5
|
super(id, registry);
|
|
6
6
|
this.downloadRequest$ = createEmitter();
|
|
7
7
|
this.config = config;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// ─────────────────────────────────────────────────────────
|
|
10
|
+
// Capability
|
|
11
|
+
// ─────────────────────────────────────────────────────────
|
|
11
12
|
buildCapability() {
|
|
12
13
|
return {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
// Active document operations
|
|
15
|
+
saveAsCopy: () => this.saveAsCopy(),
|
|
16
|
+
download: () => this.download(),
|
|
17
|
+
// Document-scoped operations
|
|
18
|
+
forDocument: (documentId) => this.createExportScope(documentId)
|
|
15
19
|
};
|
|
16
20
|
}
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
// ─────────────────────────────────────────────────────────
|
|
22
|
+
// Document Scoping
|
|
23
|
+
// ─────────────────────────────────────────────────────────
|
|
24
|
+
createExportScope(documentId) {
|
|
25
|
+
return {
|
|
26
|
+
saveAsCopy: () => this.saveAsCopy(documentId),
|
|
27
|
+
download: () => this.download(documentId)
|
|
28
|
+
};
|
|
19
29
|
}
|
|
20
|
-
|
|
21
|
-
|
|
30
|
+
// ─────────────────────────────────────────────────────────
|
|
31
|
+
// Core Operations
|
|
32
|
+
// ─────────────────────────────────────────────────────────
|
|
33
|
+
download(documentId) {
|
|
34
|
+
const id = documentId ?? this.getActiveDocumentId();
|
|
35
|
+
this.downloadRequest$.emit({ documentId: id });
|
|
22
36
|
}
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
if (!document)
|
|
37
|
+
saveAsCopy(documentId) {
|
|
38
|
+
const id = documentId ?? this.getActiveDocumentId();
|
|
39
|
+
const coreDoc = this.coreState.core.documents[id];
|
|
40
|
+
if (!(coreDoc == null ? void 0 : coreDoc.document)) {
|
|
27
41
|
return PdfTaskHelper.reject({
|
|
28
42
|
code: PdfErrorCode.DocNotOpen,
|
|
29
|
-
message:
|
|
30
|
-
});
|
|
31
|
-
this.saveAsCopy().wait((result) => {
|
|
32
|
-
task.resolve({
|
|
33
|
-
buffer: result,
|
|
34
|
-
name: document.name ?? this.config.defaultFileName
|
|
43
|
+
message: `Document ${id} not found`
|
|
35
44
|
});
|
|
36
|
-
}
|
|
37
|
-
return
|
|
45
|
+
}
|
|
46
|
+
return this.engine.saveAsCopy(coreDoc.document);
|
|
38
47
|
}
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
48
|
+
saveAsCopyAndGetBufferAndName(documentId) {
|
|
49
|
+
const task = new Task();
|
|
50
|
+
const coreDoc = this.coreState.core.documents[documentId];
|
|
51
|
+
if (!(coreDoc == null ? void 0 : coreDoc.document)) {
|
|
42
52
|
return PdfTaskHelper.reject({
|
|
43
53
|
code: PdfErrorCode.DocNotOpen,
|
|
44
|
-
message:
|
|
54
|
+
message: `Document ${documentId} not found`
|
|
45
55
|
});
|
|
46
|
-
|
|
56
|
+
}
|
|
57
|
+
this.saveAsCopy(documentId).wait(
|
|
58
|
+
(result) => {
|
|
59
|
+
task.resolve({
|
|
60
|
+
buffer: result,
|
|
61
|
+
name: coreDoc.name ?? this.config.defaultFileName
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
(error) => task.fail(error)
|
|
65
|
+
);
|
|
66
|
+
return task;
|
|
67
|
+
}
|
|
68
|
+
// ─────────────────────────────────────────────────────────
|
|
69
|
+
// Event Listeners
|
|
70
|
+
// ─────────────────────────────────────────────────────────
|
|
71
|
+
onRequest(listener) {
|
|
72
|
+
return this.downloadRequest$.on(listener);
|
|
73
|
+
}
|
|
74
|
+
// ─────────────────────────────────────────────────────────
|
|
75
|
+
// Lifecycle
|
|
76
|
+
// ─────────────────────────────────────────────────────────
|
|
77
|
+
async initialize(_) {
|
|
78
|
+
this.logger.info("ExportPlugin", "Initialize", "Export plugin initialized");
|
|
79
|
+
}
|
|
80
|
+
async destroy() {
|
|
81
|
+
this.downloadRequest$.clear();
|
|
82
|
+
await super.destroy();
|
|
47
83
|
}
|
|
48
84
|
};
|
|
49
85
|
_ExportPlugin.id = "export";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/lib/export-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, createEmitter, Listener, PluginRegistry
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/lib/export-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, createEmitter, Listener, PluginRegistry } from '@embedpdf/core';\nimport { PdfErrorCode, PdfErrorReason, PdfTaskHelper, Task } from '@embedpdf/models';\n\nimport {\n BufferAndName,\n ExportCapability,\n ExportPluginConfig,\n ExportScope,\n DownloadRequestEvent,\n} from './types';\n\nexport class ExportPlugin extends BasePlugin<ExportPluginConfig, ExportCapability> {\n static readonly id = 'export' as const;\n\n private readonly downloadRequest$ = createEmitter<DownloadRequestEvent>();\n private readonly config: ExportPluginConfig;\n\n constructor(id: string, registry: PluginRegistry, config: ExportPluginConfig) {\n super(id, registry);\n this.config = config;\n }\n\n // ─────────────────────────────────────────────────────────\n // Capability\n // ─────────────────────────────────────────────────────────\n\n protected buildCapability(): ExportCapability {\n return {\n // Active document operations\n saveAsCopy: () => this.saveAsCopy(),\n download: () => this.download(),\n\n // Document-scoped operations\n forDocument: (documentId: string) => this.createExportScope(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Document Scoping\n // ─────────────────────────────────────────────────────────\n\n private createExportScope(documentId: string): ExportScope {\n return {\n saveAsCopy: () => this.saveAsCopy(documentId),\n download: () => this.download(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Core Operations\n // ─────────────────────────────────────────────────────────\n\n private download(documentId?: string): void {\n const id = documentId ?? this.getActiveDocumentId();\n this.downloadRequest$.emit({ documentId: id });\n }\n\n private saveAsCopy(documentId?: string): Task<ArrayBuffer, PdfErrorReason> {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n return PdfTaskHelper.reject({\n code: PdfErrorCode.DocNotOpen,\n message: `Document ${id} not found`,\n });\n }\n\n return this.engine.saveAsCopy(coreDoc.document);\n }\n\n public saveAsCopyAndGetBufferAndName(documentId: string): Task<BufferAndName, PdfErrorReason> {\n const task = new Task<BufferAndName, 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 this.saveAsCopy(documentId).wait(\n (result) => {\n task.resolve({\n buffer: result,\n name: coreDoc.name ?? this.config.defaultFileName,\n });\n },\n (error) => task.fail(error),\n );\n\n return task;\n }\n\n // ─────────────────────────────────────────────────────────\n // Event Listeners\n // ─────────────────────────────────────────────────────────\n\n public onRequest(listener: Listener<DownloadRequestEvent>) {\n return this.downloadRequest$.on(listener);\n }\n\n // ─────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────\n\n async initialize(_: ExportPluginConfig): Promise<void> {\n this.logger.info('ExportPlugin', 'Initialize', 'Export plugin initialized');\n }\n\n async destroy(): Promise<void> {\n this.downloadRequest$.clear();\n await super.destroy();\n }\n}\n","import { PluginManifest } from '@embedpdf/core';\nimport { ExportPluginConfig } from './types';\n\nexport const EXPORT_PLUGIN_ID = 'export';\n\nexport const manifest: PluginManifest<ExportPluginConfig> = {\n id: EXPORT_PLUGIN_ID,\n name: 'Export Plugin',\n version: '1.0.0',\n provides: ['export'],\n requires: [],\n optional: [],\n defaultConfig: {\n enabled: true,\n defaultFileName: 'document.pdf',\n },\n};\n","import { PluginPackage } from '@embedpdf/core';\n\nimport { ExportPlugin } from './export-plugin';\nimport { manifest, EXPORT_PLUGIN_ID } from './manifest';\nimport { ExportPluginConfig } from './types';\n\nexport const ExportPluginPackage: PluginPackage<ExportPlugin, ExportPluginConfig> = {\n manifest,\n create: (registry, config) => new ExportPlugin(EXPORT_PLUGIN_ID, registry, config),\n reducer: () => {},\n initialState: {},\n};\n\nexport * from './export-plugin';\nexport * from './types';\nexport * from './manifest';\n"],"names":[],"mappings":";;AAWO,MAAM,gBAAN,MAAM,sBAAqB,WAAiD;AAAA,EAMjF,YAAY,IAAY,UAA0B,QAA4B;AAC5E,UAAM,IAAI,QAAQ;AAJpB,SAAiB,mBAAmB,cAAA;AAKlC,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAMU,kBAAoC;AAC5C,WAAO;AAAA;AAAA,MAEL,YAAY,MAAM,KAAK,WAAA;AAAA,MACvB,UAAU,MAAM,KAAK,SAAA;AAAA;AAAA,MAGrB,aAAa,CAAC,eAAuB,KAAK,kBAAkB,UAAU;AAAA,IAAA;AAAA,EAE1E;AAAA;AAAA;AAAA;AAAA,EAMQ,kBAAkB,YAAiC;AACzD,WAAO;AAAA,MACL,YAAY,MAAM,KAAK,WAAW,UAAU;AAAA,MAC5C,UAAU,MAAM,KAAK,SAAS,UAAU;AAAA,IAAA;AAAA,EAE5C;AAAA;AAAA;AAAA;AAAA,EAMQ,SAAS,YAA2B;AAC1C,UAAM,KAAK,cAAc,KAAK,oBAAA;AAC9B,SAAK,iBAAiB,KAAK,EAAE,YAAY,IAAI;AAAA,EAC/C;AAAA,EAEQ,WAAW,YAAwD;AACzE,UAAM,KAAK,cAAc,KAAK,oBAAA;AAC9B,UAAM,UAAU,KAAK,UAAU,KAAK,UAAU,EAAE;AAEhD,QAAI,EAAC,mCAAS,WAAU;AACtB,aAAO,cAAc,OAAO;AAAA,QAC1B,MAAM,aAAa;AAAA,QACnB,SAAS,YAAY,EAAE;AAAA,MAAA,CACxB;AAAA,IACH;AAEA,WAAO,KAAK,OAAO,WAAW,QAAQ,QAAQ;AAAA,EAChD;AAAA,EAEO,8BAA8B,YAAyD;AAC5F,UAAM,OAAO,IAAI,KAAA;AACjB,UAAM,UAAU,KAAK,UAAU,KAAK,UAAU,UAAU;AAExD,QAAI,EAAC,mCAAS,WAAU;AACtB,aAAO,cAAc,OAAO;AAAA,QAC1B,MAAM,aAAa;AAAA,QACnB,SAAS,YAAY,UAAU;AAAA,MAAA,CAChC;AAAA,IACH;AAEA,SAAK,WAAW,UAAU,EAAE;AAAA,MAC1B,CAAC,WAAW;AACV,aAAK,QAAQ;AAAA,UACX,QAAQ;AAAA,UACR,MAAM,QAAQ,QAAQ,KAAK,OAAO;AAAA,QAAA,CACnC;AAAA,MACH;AAAA,MACA,CAAC,UAAU,KAAK,KAAK,KAAK;AAAA,IAAA;AAG5B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAMO,UAAU,UAA0C;AACzD,WAAO,KAAK,iBAAiB,GAAG,QAAQ;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,WAAW,GAAsC;AACrD,SAAK,OAAO,KAAK,gBAAgB,cAAc,2BAA2B;AAAA,EAC5E;AAAA,EAEA,MAAM,UAAyB;AAC7B,SAAK,iBAAiB,MAAA;AACtB,UAAM,MAAM,QAAA;AAAA,EACd;AACF;AAvGE,cAAgB,KAAK;AADhB,IAAM,eAAN;ACRA,MAAM,mBAAmB;AAEzB,MAAM,WAA+C;AAAA,EAC1D,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU,CAAC,QAAQ;AAAA,EACnB,UAAU,CAAA;AAAA,EACV,UAAU,CAAA;AAAA,EACV,eAAe;AAAA,IACb,SAAS;AAAA,IACT,iBAAiB;AAAA,EAAA;AAErB;ACVO,MAAM,sBAAuE;AAAA,EAClF;AAAA,EACA,QAAQ,CAAC,UAAU,WAAW,IAAI,aAAa,kBAAkB,UAAU,MAAM;AAAA,EACjF,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,cAAc,CAAA;AAChB;"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { BasePlugin, Listener, PluginRegistry
|
|
1
|
+
import { BasePlugin, Listener, PluginRegistry } from '@embedpdf/core';
|
|
2
2
|
import { PdfErrorReason, Task } from '@embedpdf/models';
|
|
3
|
-
import { BufferAndName, ExportCapability, ExportPluginConfig } from './types';
|
|
3
|
+
import { BufferAndName, ExportCapability, ExportPluginConfig, DownloadRequestEvent } from './types';
|
|
4
4
|
export declare class ExportPlugin extends BasePlugin<ExportPluginConfig, ExportCapability> {
|
|
5
5
|
static readonly id: "export";
|
|
6
6
|
private readonly downloadRequest$;
|
|
7
7
|
private readonly config;
|
|
8
8
|
constructor(id: string, registry: PluginRegistry, config: ExportPluginConfig);
|
|
9
|
-
initialize(_: ExportPluginConfig): Promise<void>;
|
|
10
9
|
protected buildCapability(): ExportCapability;
|
|
11
|
-
|
|
10
|
+
private createExportScope;
|
|
12
11
|
private download;
|
|
13
|
-
saveAsCopyAndGetBufferAndName(): Task<BufferAndName, PdfErrorReason>;
|
|
14
12
|
private saveAsCopy;
|
|
13
|
+
saveAsCopyAndGetBufferAndName(documentId: string): Task<BufferAndName, PdfErrorReason>;
|
|
14
|
+
onRequest(listener: Listener<DownloadRequestEvent>): import('@embedpdf/core').Unsubscribe;
|
|
15
|
+
initialize(_: ExportPluginConfig): Promise<void>;
|
|
16
|
+
destroy(): Promise<void>;
|
|
15
17
|
}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -7,7 +7,17 @@ export interface BufferAndName {
|
|
|
7
7
|
buffer: ArrayBuffer;
|
|
8
8
|
name: string;
|
|
9
9
|
}
|
|
10
|
+
export interface DownloadRequestEvent {
|
|
11
|
+
documentId: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ExportScope {
|
|
14
|
+
saveAsCopy: () => Task<ArrayBuffer, PdfErrorReason>;
|
|
15
|
+
download: () => void;
|
|
16
|
+
}
|
|
10
17
|
export interface ExportCapability {
|
|
11
18
|
saveAsCopy: () => Task<ArrayBuffer, PdfErrorReason>;
|
|
12
19
|
download: () => void;
|
|
20
|
+
forDocument(documentId: string): ExportScope;
|
|
21
|
+
}
|
|
22
|
+
export interface ExportState {
|
|
13
23
|
}
|
package/dist/preact/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),r=require("@embedpdf/plugin-export"),t=require("preact/jsx-runtime"),o=require("@embedpdf/models"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),r=require("@embedpdf/plugin-export"),t=require("preact/jsx-runtime"),o=require("@embedpdf/models"),n=require("preact/hooks"),u=require("@embedpdf/core/preact"),i=()=>u.usePlugin(r.ExportPlugin.id),p=()=>u.useCapability(r.ExportPlugin.id);function s(){const{plugin:e}=i(),r=n.useRef(null);return n.useEffect(()=>{if(!e)return;return e.onRequest(t=>{const n=r.current;if(!n)return;e.saveAsCopyAndGetBufferAndName(t.documentId).wait(({buffer:e,name:r})=>{const t=URL.createObjectURL(new Blob([e]));n.href=t,n.download=r,n.click(),URL.revokeObjectURL(t)},o.ignore)})},[e]),t.jsx("a",{style:{display:"none"},ref:r})}const l=e.createPluginPackage(r.ExportPluginPackage).addUtility(s).build();exports.Download=s,exports.ExportPluginPackage=l,exports.useExport=e=>{const{provides:r}=p();return{provides:(null==r?void 0:r.forDocument(e))??null}},exports.useExportCapability=p,exports.useExportPlugin=i,Object.keys(r).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>r[e]})});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/shared/hooks/use-export.ts","../../src/shared/component/download.tsx","../../src/shared/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","import { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from '@framework';\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/shared/hooks/use-export.ts","../../src/shared/component/download.tsx","../../src/shared/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n\n/**\n * Hook for export capability for a specific document\n * @param documentId Document ID\n */\nexport const useExport = (documentId: string) => {\n const { provides } = useExportCapability();\n\n return {\n provides: provides?.forDocument(documentId) ?? null,\n };\n};\n","import { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from '@framework';\n\nimport { useExportPlugin } from '../hooks';\n\nexport function Download() {\n const { plugin: exportPlugin } = useExportPlugin();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportPlugin) return;\n\n const unsub = exportPlugin.onRequest((event) => {\n const el = ref.current;\n if (!el) return;\n\n const task = exportPlugin.saveAsCopyAndGetBufferAndName(event.documentId);\n task.wait(({ buffer, name }) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = name;\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n });\n\n return unsub;\n }, [exportPlugin]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n","import { createPluginPackage } from '@embedpdf/core';\nimport { ExportPluginPackage as BaseExportPackage } from '@embedpdf/plugin-export';\n\nimport { Download } from './component';\n\nexport * from './hooks';\nexport * from './component';\n\nexport * from '@embedpdf/plugin-export';\n\nexport const ExportPluginPackage = createPluginPackage(BaseExportPackage)\n .addUtility(Download)\n .build();\n"],"names":["useExportPlugin","usePlugin","ExportPlugin","id","useExportCapability","useCapability","Download","plugin","exportPlugin","ref","useRef","useEffect","onRequest","event","el","current","saveAsCopyAndGetBufferAndName","documentId","wait","buffer","name","url","URL","createObjectURL","Blob","href","download","click","revokeObjectURL","ignore","style","display","ExportPluginPackage","createPluginPackage","BaseExportPackage","addUtility","build","provides","forDocument"],"mappings":"kRAGaA,EAAkB,IAAMC,YAAwBC,EAAAA,aAAaC,IAC7DC,EAAsB,IAAMC,gBAA4BH,EAAAA,aAAaC,ICC3E,SAASG,IACd,MAAQC,OAAQC,GAAiBR,IAC3BS,EAAMC,EAAAA,OAA0B,MAsBtC,OApBAC,EAAAA,UAAU,KACR,IAAKH,EAAc,OAgBnB,OAdcA,EAAaI,UAAWC,IACpC,MAAMC,EAAKL,EAAIM,QACf,IAAKD,EAAI,OAEIN,EAAaQ,8BAA8BH,EAAMI,YACzDC,KAAK,EAAGC,SAAQC,WACnB,MAAMC,EAAMC,IAAIC,gBAAgB,IAAIC,KAAK,CAACL,KAC1CL,EAAGW,KAAOJ,EACVP,EAAGY,SAAWN,EACdN,EAAGa,QACHL,IAAIM,gBAAgBP,IACnBQ,EAAAA,WAIJ,CAACrB,UAEI,IAAA,CAAEsB,MAAO,CAAEC,QAAS,QAAUtB,OACxC,CCpBO,MAAMuB,EAAsBC,EAAAA,oBAAoBC,EAAAA,qBACpDC,WAAW7B,GACX8B,2EFFuBnB,IACxB,MAAMoB,SAAEA,GAAajC,IAErB,MAAO,CACLiC,UAAU,MAAAA,OAAA,EAAAA,EAAUC,YAAYrB,KAAe"}
|
package/dist/preact/index.js
CHANGED
|
@@ -4,38 +4,41 @@ export * from "@embedpdf/plugin-export";
|
|
|
4
4
|
import { jsx } from "preact/jsx-runtime";
|
|
5
5
|
import { ignore } from "@embedpdf/models";
|
|
6
6
|
import { useRef, useEffect } from "preact/hooks";
|
|
7
|
-
import {
|
|
7
|
+
import { usePlugin, useCapability } from "@embedpdf/core/preact";
|
|
8
8
|
const useExportPlugin = () => usePlugin(ExportPlugin.id);
|
|
9
9
|
const useExportCapability = () => useCapability(ExportPlugin.id);
|
|
10
|
-
|
|
11
|
-
const { provides
|
|
10
|
+
const useExport = (documentId) => {
|
|
11
|
+
const { provides } = useExportCapability();
|
|
12
|
+
return {
|
|
13
|
+
provides: (provides == null ? void 0 : provides.forDocument(documentId)) ?? null
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
function Download() {
|
|
12
17
|
const { plugin: exportPlugin } = useExportPlugin();
|
|
13
18
|
const ref = useRef(null);
|
|
14
19
|
useEffect(() => {
|
|
15
|
-
if (!exportCapability) return;
|
|
16
20
|
if (!exportPlugin) return;
|
|
17
|
-
const unsub = exportPlugin.onRequest((
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, ignore);
|
|
29
|
-
}
|
|
21
|
+
const unsub = exportPlugin.onRequest((event) => {
|
|
22
|
+
const el = ref.current;
|
|
23
|
+
if (!el) return;
|
|
24
|
+
const task = exportPlugin.saveAsCopyAndGetBufferAndName(event.documentId);
|
|
25
|
+
task.wait(({ buffer, name }) => {
|
|
26
|
+
const url = URL.createObjectURL(new Blob([buffer]));
|
|
27
|
+
el.href = url;
|
|
28
|
+
el.download = name;
|
|
29
|
+
el.click();
|
|
30
|
+
URL.revokeObjectURL(url);
|
|
31
|
+
}, ignore);
|
|
30
32
|
});
|
|
31
33
|
return unsub;
|
|
32
|
-
}, [
|
|
34
|
+
}, [exportPlugin]);
|
|
33
35
|
return /* @__PURE__ */ jsx("a", { style: { display: "none" }, ref });
|
|
34
36
|
}
|
|
35
37
|
const ExportPluginPackage = createPluginPackage(ExportPluginPackage$1).addUtility(Download).build();
|
|
36
38
|
export {
|
|
37
39
|
Download,
|
|
38
40
|
ExportPluginPackage,
|
|
41
|
+
useExport,
|
|
39
42
|
useExportCapability,
|
|
40
43
|
useExportPlugin
|
|
41
44
|
};
|
package/dist/preact/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-export.ts","../../src/shared/component/download.tsx","../../src/shared/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","import { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from '@framework';\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-export.ts","../../src/shared/component/download.tsx","../../src/shared/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n\n/**\n * Hook for export capability for a specific document\n * @param documentId Document ID\n */\nexport const useExport = (documentId: string) => {\n const { provides } = useExportCapability();\n\n return {\n provides: provides?.forDocument(documentId) ?? null,\n };\n};\n","import { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from '@framework';\n\nimport { useExportPlugin } from '../hooks';\n\nexport function Download() {\n const { plugin: exportPlugin } = useExportPlugin();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportPlugin) return;\n\n const unsub = exportPlugin.onRequest((event) => {\n const el = ref.current;\n if (!el) return;\n\n const task = exportPlugin.saveAsCopyAndGetBufferAndName(event.documentId);\n task.wait(({ buffer, name }) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = name;\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n });\n\n return unsub;\n }, [exportPlugin]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n","import { createPluginPackage } from '@embedpdf/core';\nimport { ExportPluginPackage as BaseExportPackage } from '@embedpdf/plugin-export';\n\nimport { Download } from './component';\n\nexport * from './hooks';\nexport * from './component';\n\nexport * from '@embedpdf/plugin-export';\n\nexport const ExportPluginPackage = createPluginPackage(BaseExportPackage)\n .addUtility(Download)\n .build();\n"],"names":["BaseExportPackage"],"mappings":";;;;;;;AAGO,MAAM,kBAAkB,MAAM,UAAwB,aAAa,EAAE;AACrE,MAAM,sBAAsB,MAAM,cAA4B,aAAa,EAAE;AAM7E,MAAM,YAAY,CAAC,eAAuB;AAC/C,QAAM,EAAE,SAAA,IAAa,oBAAA;AAErB,SAAO;AAAA,IACL,WAAU,qCAAU,YAAY,gBAAe;AAAA,EAAA;AAEnD;ACXO,SAAS,WAAW;AACzB,QAAM,EAAE,QAAQ,aAAA,IAAiB,gBAAA;AACjC,QAAM,MAAM,OAA0B,IAAI;AAE1C,YAAU,MAAM;AACd,QAAI,CAAC,aAAc;AAEnB,UAAM,QAAQ,aAAa,UAAU,CAAC,UAAU;AAC9C,YAAM,KAAK,IAAI;AACf,UAAI,CAAC,GAAI;AAET,YAAM,OAAO,aAAa,8BAA8B,MAAM,UAAU;AACxE,WAAK,KAAK,CAAC,EAAE,QAAQ,WAAW;AAC9B,cAAM,MAAM,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,WAAG,OAAO;AACV,WAAG,WAAW;AACd,WAAG,MAAA;AACH,YAAI,gBAAgB,GAAG;AAAA,MACzB,GAAG,MAAM;AAAA,IACX,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,YAAY,CAAC;AAEjB,6BAAQ,KAAA,EAAE,OAAO,EAAE,SAAS,OAAA,GAAU,KAAU;AAClD;ACpBO,MAAM,sBAAsB,oBAAoBA,qBAAiB,EACrE,WAAW,QAAQ,EACnB,MAAA;"}
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),r=require("@embedpdf/plugin-export"),t=require("react/jsx-runtime"),o=require("@embedpdf/models"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),r=require("@embedpdf/plugin-export"),t=require("react/jsx-runtime"),o=require("@embedpdf/models"),n=require("react"),u=require("@embedpdf/core/react"),i=()=>u.usePlugin(r.ExportPlugin.id),s=()=>u.useCapability(r.ExportPlugin.id);function l(){const{plugin:e}=i(),r=n.useRef(null);return n.useEffect(()=>{if(!e)return;return e.onRequest(t=>{const n=r.current;if(!n)return;e.saveAsCopyAndGetBufferAndName(t.documentId).wait(({buffer:e,name:r})=>{const t=URL.createObjectURL(new Blob([e]));n.href=t,n.download=r,n.click(),URL.revokeObjectURL(t)},o.ignore)})},[e]),t.jsx("a",{style:{display:"none"},ref:r})}const p=e.createPluginPackage(r.ExportPluginPackage).addUtility(l).build();exports.Download=l,exports.ExportPluginPackage=p,exports.useExport=e=>{const{provides:r}=s();return{provides:(null==r?void 0:r.forDocument(e))??null}},exports.useExportCapability=s,exports.useExportPlugin=i,Object.keys(r).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>r[e]})});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/react/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/shared/hooks/use-export.ts","../../src/shared/component/download.tsx","../../src/shared/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","import { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from '@framework';\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/shared/hooks/use-export.ts","../../src/shared/component/download.tsx","../../src/shared/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n\n/**\n * Hook for export capability for a specific document\n * @param documentId Document ID\n */\nexport const useExport = (documentId: string) => {\n const { provides } = useExportCapability();\n\n return {\n provides: provides?.forDocument(documentId) ?? null,\n };\n};\n","import { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from '@framework';\n\nimport { useExportPlugin } from '../hooks';\n\nexport function Download() {\n const { plugin: exportPlugin } = useExportPlugin();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportPlugin) return;\n\n const unsub = exportPlugin.onRequest((event) => {\n const el = ref.current;\n if (!el) return;\n\n const task = exportPlugin.saveAsCopyAndGetBufferAndName(event.documentId);\n task.wait(({ buffer, name }) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = name;\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n });\n\n return unsub;\n }, [exportPlugin]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n","import { createPluginPackage } from '@embedpdf/core';\nimport { ExportPluginPackage as BaseExportPackage } from '@embedpdf/plugin-export';\n\nimport { Download } from './component';\n\nexport * from './hooks';\nexport * from './component';\n\nexport * from '@embedpdf/plugin-export';\n\nexport const ExportPluginPackage = createPluginPackage(BaseExportPackage)\n .addUtility(Download)\n .build();\n"],"names":["useExportPlugin","usePlugin","ExportPlugin","id","useExportCapability","useCapability","Download","plugin","exportPlugin","ref","useRef","useEffect","onRequest","event","el","current","saveAsCopyAndGetBufferAndName","documentId","wait","buffer","name","url","URL","createObjectURL","Blob","href","download","click","revokeObjectURL","ignore","style","display","ExportPluginPackage","createPluginPackage","BaseExportPackage","addUtility","build","provides","forDocument"],"mappings":"yQAGaA,EAAkB,IAAMC,YAAwBC,EAAAA,aAAaC,IAC7DC,EAAsB,IAAMC,gBAA4BH,EAAAA,aAAaC,ICC3E,SAASG,IACd,MAAQC,OAAQC,GAAiBR,IAC3BS,EAAMC,EAAAA,OAA0B,MAsBtC,OApBAC,EAAAA,UAAU,KACR,IAAKH,EAAc,OAgBnB,OAdcA,EAAaI,UAAWC,IACpC,MAAMC,EAAKL,EAAIM,QACf,IAAKD,EAAI,OAEIN,EAAaQ,8BAA8BH,EAAMI,YACzDC,KAAK,EAAGC,SAAQC,WACnB,MAAMC,EAAMC,IAAIC,gBAAgB,IAAIC,KAAK,CAACL,KAC1CL,EAAGW,KAAOJ,EACVP,EAAGY,SAAWN,EACdN,EAAGa,QACHL,IAAIM,gBAAgBP,IACnBQ,EAAAA,WAIJ,CAACrB,UAEI,IAAA,CAAEsB,MAAO,CAAEC,QAAS,QAAUtB,OACxC,CCpBO,MAAMuB,EAAsBC,EAAAA,oBAAoBC,EAAAA,qBACpDC,WAAW7B,GACX8B,2EFFuBnB,IACxB,MAAMoB,SAAEA,GAAajC,IAErB,MAAO,CACLiC,UAAU,MAAAA,OAAA,EAAAA,EAAUC,YAAYrB,KAAe"}
|
package/dist/react/index.js
CHANGED
|
@@ -4,38 +4,41 @@ export * from "@embedpdf/plugin-export";
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { ignore } from "@embedpdf/models";
|
|
6
6
|
import { useRef, useEffect } from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { usePlugin, useCapability } from "@embedpdf/core/react";
|
|
8
8
|
const useExportPlugin = () => usePlugin(ExportPlugin.id);
|
|
9
9
|
const useExportCapability = () => useCapability(ExportPlugin.id);
|
|
10
|
-
|
|
11
|
-
const { provides
|
|
10
|
+
const useExport = (documentId) => {
|
|
11
|
+
const { provides } = useExportCapability();
|
|
12
|
+
return {
|
|
13
|
+
provides: (provides == null ? void 0 : provides.forDocument(documentId)) ?? null
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
function Download() {
|
|
12
17
|
const { plugin: exportPlugin } = useExportPlugin();
|
|
13
18
|
const ref = useRef(null);
|
|
14
19
|
useEffect(() => {
|
|
15
|
-
if (!exportCapability) return;
|
|
16
20
|
if (!exportPlugin) return;
|
|
17
|
-
const unsub = exportPlugin.onRequest((
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, ignore);
|
|
29
|
-
}
|
|
21
|
+
const unsub = exportPlugin.onRequest((event) => {
|
|
22
|
+
const el = ref.current;
|
|
23
|
+
if (!el) return;
|
|
24
|
+
const task = exportPlugin.saveAsCopyAndGetBufferAndName(event.documentId);
|
|
25
|
+
task.wait(({ buffer, name }) => {
|
|
26
|
+
const url = URL.createObjectURL(new Blob([buffer]));
|
|
27
|
+
el.href = url;
|
|
28
|
+
el.download = name;
|
|
29
|
+
el.click();
|
|
30
|
+
URL.revokeObjectURL(url);
|
|
31
|
+
}, ignore);
|
|
30
32
|
});
|
|
31
33
|
return unsub;
|
|
32
|
-
}, [
|
|
34
|
+
}, [exportPlugin]);
|
|
33
35
|
return /* @__PURE__ */ jsx("a", { style: { display: "none" }, ref });
|
|
34
36
|
}
|
|
35
37
|
const ExportPluginPackage = createPluginPackage(ExportPluginPackage$1).addUtility(Download).build();
|
|
36
38
|
export {
|
|
37
39
|
Download,
|
|
38
40
|
ExportPluginPackage,
|
|
41
|
+
useExport,
|
|
39
42
|
useExportCapability,
|
|
40
43
|
useExportPlugin
|
|
41
44
|
};
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-export.ts","../../src/shared/component/download.tsx","../../src/shared/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","import { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from '@framework';\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-export.ts","../../src/shared/component/download.tsx","../../src/shared/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n\n/**\n * Hook for export capability for a specific document\n * @param documentId Document ID\n */\nexport const useExport = (documentId: string) => {\n const { provides } = useExportCapability();\n\n return {\n provides: provides?.forDocument(documentId) ?? null,\n };\n};\n","import { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from '@framework';\n\nimport { useExportPlugin } from '../hooks';\n\nexport function Download() {\n const { plugin: exportPlugin } = useExportPlugin();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportPlugin) return;\n\n const unsub = exportPlugin.onRequest((event) => {\n const el = ref.current;\n if (!el) return;\n\n const task = exportPlugin.saveAsCopyAndGetBufferAndName(event.documentId);\n task.wait(({ buffer, name }) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = name;\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n });\n\n return unsub;\n }, [exportPlugin]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n","import { createPluginPackage } from '@embedpdf/core';\nimport { ExportPluginPackage as BaseExportPackage } from '@embedpdf/plugin-export';\n\nimport { Download } from './component';\n\nexport * from './hooks';\nexport * from './component';\n\nexport * from '@embedpdf/plugin-export';\n\nexport const ExportPluginPackage = createPluginPackage(BaseExportPackage)\n .addUtility(Download)\n .build();\n"],"names":["BaseExportPackage"],"mappings":";;;;;;;AAGO,MAAM,kBAAkB,MAAM,UAAwB,aAAa,EAAE;AACrE,MAAM,sBAAsB,MAAM,cAA4B,aAAa,EAAE;AAM7E,MAAM,YAAY,CAAC,eAAuB;AAC/C,QAAM,EAAE,SAAA,IAAa,oBAAA;AAErB,SAAO;AAAA,IACL,WAAU,qCAAU,YAAY,gBAAe;AAAA,EAAA;AAEnD;ACXO,SAAS,WAAW;AACzB,QAAM,EAAE,QAAQ,aAAA,IAAiB,gBAAA;AACjC,QAAM,MAAM,OAA0B,IAAI;AAE1C,YAAU,MAAM;AACd,QAAI,CAAC,aAAc;AAEnB,UAAM,QAAQ,aAAa,UAAU,CAAC,UAAU;AAC9C,YAAM,KAAK,IAAI;AACf,UAAI,CAAC,GAAI;AAET,YAAM,OAAO,aAAa,8BAA8B,MAAM,UAAU;AACxE,WAAK,KAAK,CAAC,EAAE,QAAQ,WAAW;AAC9B,cAAM,MAAM,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,WAAG,OAAO;AACV,WAAG,WAAW;AACd,WAAG,MAAA;AACH,YAAI,gBAAgB,GAAG;AAAA,MACzB,GAAG,MAAM;AAAA,IACX,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,YAAY,CAAC;AAEjB,6BAAQ,KAAA,EAAE,OAAO,EAAE,SAAS,OAAA,GAAU,KAAU;AAClD;ACpBO,MAAM,sBAAsB,oBAAoBA,qBAAiB,EACrE,WAAW,QAAQ,EACnB,MAAA;"}
|
|
@@ -9,3 +9,10 @@ export declare const useExportCapability: () => {
|
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
ready: Promise<void>;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Hook for export capability for a specific document
|
|
14
|
+
* @param documentId Document ID
|
|
15
|
+
*/
|
|
16
|
+
export declare const useExport: (documentId: string) => {
|
|
17
|
+
provides: import('../../index.ts').ExportScope | null;
|
|
18
|
+
};
|
|
@@ -9,3 +9,10 @@ export declare const useExportCapability: () => {
|
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
ready: Promise<void>;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Hook for export capability for a specific document
|
|
14
|
+
* @param documentId Document ID
|
|
15
|
+
*/
|
|
16
|
+
export declare const useExport: (documentId: string) => {
|
|
17
|
+
provides: import('../../lib/index.ts').ExportScope | null;
|
|
18
|
+
};
|
|
@@ -9,3 +9,10 @@ export declare const useExportCapability: () => {
|
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
ready: Promise<void>;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Hook for export capability for a specific document
|
|
14
|
+
* @param documentId Document ID
|
|
15
|
+
*/
|
|
16
|
+
export declare const useExport: (documentId: string) => {
|
|
17
|
+
provides: import('../../lib/index.ts').ExportScope | null;
|
|
18
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExportPlugin } from '../../lib/index.ts';
|
|
1
|
+
import { ExportPlugin, ExportScope } from '../../lib/index.ts';
|
|
2
2
|
export declare const useExportPlugin: () => {
|
|
3
3
|
plugin: ExportPlugin | null;
|
|
4
4
|
isLoading: boolean;
|
|
@@ -9,3 +9,12 @@ export declare const useExportCapability: () => {
|
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
ready: Promise<void>;
|
|
11
11
|
};
|
|
12
|
+
interface UseExportReturn {
|
|
13
|
+
provides: ExportScope | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Hook for export capability for a specific document
|
|
17
|
+
* @param getDocumentId Function that returns the document ID
|
|
18
|
+
*/
|
|
19
|
+
export declare const useExport: (getDocumentId: () => string | null) => UseExportReturn;
|
|
20
|
+
export {};
|
package/dist/svelte/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/plugin-export");require("svelte/internal/disclose-version");const r=require("svelte/internal/client"),o=require("@embedpdf/models"),n=require("@embedpdf/core/svelte");function i(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const r in e)if("default"!==r){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}const l=i(r),u=()=>n.usePlugin(t.ExportPlugin.id),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/plugin-export");require("svelte/internal/disclose-version");const r=require("svelte/internal/client"),o=require("@embedpdf/models"),n=require("@embedpdf/core/svelte");function i(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const r in e)if("default"!==r){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}const l=i(r),u=()=>n.usePlugin(t.ExportPlugin.id),s=()=>n.useCapability(t.ExportPlugin.id);var a=l.from_html('<a style="display: none" href="/" aria-label="Download link"></a>');function p(e,t){l.push(t,!0);const r=s(),n=u();let i;l.user_effect(()=>{if(!r.provides)return;if(!n.plugin)return;return n.plugin.onRequest(e=>{var t;const r=i;if(!r)return;const l=null==(t=n.plugin)?void 0:t.saveAsCopyAndGetBufferAndName(e.documentId);null==l||l.wait(({buffer:e,name:t})=>{const o=URL.createObjectURL(new Blob([e]));r.href=o,r.download=t,r.click(),URL.revokeObjectURL(o)},o.ignore)})});var p=a();l.bind_this(p,e=>i=e,()=>i),l.append(e,p),l.pop()}const c=e.createPluginPackage(t.ExportPluginPackage).addUtility(p).build();exports.Download=p,exports.ExportPluginPackage=c,exports.useExport=e=>{const t=s(),r=l.derived(e),o=l.derived(()=>t.provides&&l.get(r)?t.provides.forDocument(l.get(r)):null);return{get provides(){return l.get(o)}}},exports.useExportCapability=s,exports.useExportPlugin=u,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/svelte/hooks/use-export.svelte.ts","../../src/svelte/components/Download.svelte","../../src/svelte/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","<script lang=\"ts\">\n import { ignore } from '@embedpdf/models';\n import { useExportCapability, useExportPlugin } from '../hooks';\n\n const exportCapability = useExportCapability();\n const exportPlugin = useExportPlugin();\n\n let anchorElement: HTMLAnchorElement | undefined;\n\n $effect(() => {\n if (!exportCapability.provides) return;\n if (!exportPlugin.plugin) return;\n\n const unsub = exportPlugin.plugin.onRequest((
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/svelte/hooks/use-export.svelte.ts","../../src/svelte/components/Download.svelte","../../src/svelte/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { ExportPlugin, ExportScope } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n\n// Define the return type explicitly to maintain type safety\ninterface UseExportReturn {\n provides: ExportScope | null;\n}\n\n/**\n * Hook for export capability for a specific document\n * @param getDocumentId Function that returns the document ID\n */\nexport const useExport = (getDocumentId: () => string | null): UseExportReturn => {\n const capability = useExportCapability();\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n // Scoped capability for current docId\n const scopedProvides = $derived(\n capability.provides && documentId ? capability.provides.forDocument(documentId) : null,\n );\n\n return {\n get provides() {\n return scopedProvides;\n },\n };\n};\n","<script lang=\"ts\">\n import { ignore } from '@embedpdf/models';\n import { useExportCapability, useExportPlugin } from '../hooks';\n\n const exportCapability = useExportCapability();\n const exportPlugin = useExportPlugin();\n\n let anchorElement: HTMLAnchorElement | undefined;\n\n $effect(() => {\n if (!exportCapability.provides) return;\n if (!exportPlugin.plugin) return;\n\n const unsub = exportPlugin.plugin.onRequest((event) => {\n const el = anchorElement;\n if (!el) return;\n\n const task = exportPlugin.plugin?.saveAsCopyAndGetBufferAndName(event.documentId);\n task?.wait(({ buffer, name }) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = name;\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n });\n\n return unsub;\n });\n</script>\n\n<a style=\"display: none\" bind:this={anchorElement} href=\"/\" aria-label=\"Download link\"></a>\n","import { createPluginPackage } from '@embedpdf/core';\nimport { ExportPluginPackage as BaseExportPackage } from '@embedpdf/plugin-export';\n\nimport { Download } from './components';\n\nexport * from './hooks';\nexport * from './components';\n\nexport * from '@embedpdf/plugin-export';\n\nexport const ExportPluginPackage = createPluginPackage(BaseExportPackage)\n .addUtility(Download)\n .build();\n"],"names":["useExportPlugin","usePlugin","ExportPlugin","id","useExportCapability","useCapability","exportCapability","exportPlugin","anchorElement","$","user_effect","provides","plugin","onRequest","event","el","task","_a","saveAsCopyAndGetBufferAndName","documentId","wait","buffer","name","url","URL","createObjectURL","Blob","href","download","click","revokeObjectURL","ignore","bind_this","a","$$value","ExportPluginPackage","createPluginPackage","BaseExportPackage","addUtility","Download","build","getDocumentId","capability","scopedProvides","derived","forDocument"],"mappings":"skBAGaA,EAAA,IAAwBC,YAAwBC,EAAAA,aAAaC,IAC7DC,EAAA,IAA4BC,gBAA4BH,EAAAA,aAAaC,wHCA1E,MAAAG,EAAmBF,IACnBG,EAAeP,QAEjBQ,EAEJC,EAAAC,YAAO,KACA,IAAAJ,EAAiBK,SAAQ,OACzB,IAAAJ,EAAaK,OAAM,cAEVL,EAAaK,OAAOC,UAAWC,UACrC,MAAAC,EAAKP,MACNO,EAAE,aAEDC,EAAO,OAAAC,EAAAV,EAAaK,aAAb,EAAAK,EAAqBC,8BAA8BJ,EAAMK,YACtE,MAAAH,GAAAA,EAAMI,OAAQC,SAAQC,WACd,MAAAC,EAAMC,IAAIC,gBAAe,IAAKC,MAAML,KAC1CN,EAAGY,KAAOJ,EACVR,EAAGa,SAAWN,EACdP,EAAGc,QACHL,IAAIM,gBAAgBP,IACnBQ,EAAAA,sBAO2BtB,EAAAuB,UAAAC,EAAAC,GAAA1B,QAAAA,wBAFpC,CCnBO,MAAM2B,EAAsBC,EAAAA,oBAAoBC,EAAAA,qBACpDC,WAAWC,GACXC,2EFGuBC,IAClB,MAAAC,EAAatC,IAGbe,YAAsBsB,GAGtBE,EAAAlC,EAAAmC,QAAA,IACJF,EAAW/B,gBAAYQ,GAAauB,EAAW/B,SAASkC,kBAAY1B,IAAc,aAI9E,YAAAR,gBACKgC,EACT"}
|
package/dist/svelte/index.js
CHANGED
|
@@ -7,6 +7,16 @@ import { ignore } from "@embedpdf/models";
|
|
|
7
7
|
import { useCapability, usePlugin } from "@embedpdf/core/svelte";
|
|
8
8
|
const useExportPlugin = () => usePlugin(ExportPlugin.id);
|
|
9
9
|
const useExportCapability = () => useCapability(ExportPlugin.id);
|
|
10
|
+
const useExport = (getDocumentId) => {
|
|
11
|
+
const capability = useExportCapability();
|
|
12
|
+
const documentId = $.derived(getDocumentId);
|
|
13
|
+
const scopedProvides = $.derived(() => capability.provides && $.get(documentId) ? capability.provides.forDocument($.get(documentId)) : null);
|
|
14
|
+
return {
|
|
15
|
+
get provides() {
|
|
16
|
+
return $.get(scopedProvides);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
10
20
|
var root = $.from_html(`<a style="display: none" href="/" aria-label="Download link"></a>`);
|
|
11
21
|
function Download($$anchor, $$props) {
|
|
12
22
|
$.push($$props, true);
|
|
@@ -16,23 +26,21 @@ function Download($$anchor, $$props) {
|
|
|
16
26
|
$.user_effect(() => {
|
|
17
27
|
if (!exportCapability.provides) return;
|
|
18
28
|
if (!exportPlugin.plugin) return;
|
|
19
|
-
const unsub = exportPlugin.plugin.onRequest((
|
|
29
|
+
const unsub = exportPlugin.plugin.onRequest((event) => {
|
|
20
30
|
var _a;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
35
|
-
}
|
|
31
|
+
const el = anchorElement;
|
|
32
|
+
if (!el) return;
|
|
33
|
+
const task = (_a = exportPlugin.plugin) == null ? void 0 : _a.saveAsCopyAndGetBufferAndName(event.documentId);
|
|
34
|
+
task == null ? void 0 : task.wait(
|
|
35
|
+
({ buffer, name }) => {
|
|
36
|
+
const url = URL.createObjectURL(new Blob([buffer]));
|
|
37
|
+
el.href = url;
|
|
38
|
+
el.download = name;
|
|
39
|
+
el.click();
|
|
40
|
+
URL.revokeObjectURL(url);
|
|
41
|
+
},
|
|
42
|
+
ignore
|
|
43
|
+
);
|
|
36
44
|
});
|
|
37
45
|
return unsub;
|
|
38
46
|
});
|
|
@@ -45,6 +53,7 @@ const ExportPluginPackage = createPluginPackage(ExportPluginPackage$1).addUtilit
|
|
|
45
53
|
export {
|
|
46
54
|
Download,
|
|
47
55
|
ExportPluginPackage,
|
|
56
|
+
useExport,
|
|
48
57
|
useExportCapability,
|
|
49
58
|
useExportPlugin
|
|
50
59
|
};
|
package/dist/svelte/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/svelte/hooks/use-export.svelte.ts","../../src/svelte/components/Download.svelte","../../src/svelte/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","<script lang=\"ts\">\n import { ignore } from '@embedpdf/models';\n import { useExportCapability, useExportPlugin } from '../hooks';\n\n const exportCapability = useExportCapability();\n const exportPlugin = useExportPlugin();\n\n let anchorElement: HTMLAnchorElement | undefined;\n\n $effect(() => {\n if (!exportCapability.provides) return;\n if (!exportPlugin.plugin) return;\n\n const unsub = exportPlugin.plugin.onRequest((
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/svelte/hooks/use-export.svelte.ts","../../src/svelte/components/Download.svelte","../../src/svelte/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { ExportPlugin, ExportScope } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n\n// Define the return type explicitly to maintain type safety\ninterface UseExportReturn {\n provides: ExportScope | null;\n}\n\n/**\n * Hook for export capability for a specific document\n * @param getDocumentId Function that returns the document ID\n */\nexport const useExport = (getDocumentId: () => string | null): UseExportReturn => {\n const capability = useExportCapability();\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n // Scoped capability for current docId\n const scopedProvides = $derived(\n capability.provides && documentId ? capability.provides.forDocument(documentId) : null,\n );\n\n return {\n get provides() {\n return scopedProvides;\n },\n };\n};\n","<script lang=\"ts\">\n import { ignore } from '@embedpdf/models';\n import { useExportCapability, useExportPlugin } from '../hooks';\n\n const exportCapability = useExportCapability();\n const exportPlugin = useExportPlugin();\n\n let anchorElement: HTMLAnchorElement | undefined;\n\n $effect(() => {\n if (!exportCapability.provides) return;\n if (!exportPlugin.plugin) return;\n\n const unsub = exportPlugin.plugin.onRequest((event) => {\n const el = anchorElement;\n if (!el) return;\n\n const task = exportPlugin.plugin?.saveAsCopyAndGetBufferAndName(event.documentId);\n task?.wait(({ buffer, name }) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = name;\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n });\n\n return unsub;\n });\n</script>\n\n<a style=\"display: none\" bind:this={anchorElement} href=\"/\" aria-label=\"Download link\"></a>\n","import { createPluginPackage } from '@embedpdf/core';\nimport { ExportPluginPackage as BaseExportPackage } from '@embedpdf/plugin-export';\n\nimport { Download } from './components';\n\nexport * from './hooks';\nexport * from './components';\n\nexport * from '@embedpdf/plugin-export';\n\nexport const ExportPluginPackage = createPluginPackage(BaseExportPackage)\n .addUtility(Download)\n .build();\n"],"names":["BaseExportPackage"],"mappings":";;;;;;;AAGa,MAAA,kBAAA,MAAwB,UAAwB,aAAa,EAAE;AAC/D,MAAA,sBAAA,MAA4B,cAA4B,aAAa,EAAE;MAWvE,YAAA,CAAa,kBAAwD;AAC1E,QAAA,aAAa,oBAAA;AAGb,QAAA,uBAAsB,aAAA;AAGtB,QAAA,iBAAA,EAAA,QAAA,MACJ,WAAW,kBAAY,UAAA,IAAa,WAAW,SAAS,kBAAY,UAAU,CAAA,IAAI,IAAA;;IAI9E,IAAA,WAAW;mBACN,cAAA;AAAA,IACT;AAAA;AAEJ;;qCC/BA;;AAIQ,QAAA,mBAAmB,oBAAmB;AACtC,QAAA,eAAe,gBAAe;MAEhC;AAEJ,IAAA,YAAO,MAAO;AACP,QAAA,CAAA,iBAAiB,SAAQ;AACzB,QAAA,CAAA,aAAa,OAAM;UAElB,QAAQ,aAAa,OAAO,UAAS,CAAE,UAAU;;AAC/C,YAAA,KAAK;WACN,GAAE;YAED,QAAO,kBAAa,WAAb,mBAAqB,8BAA8B,MAAM;AACtE,mCAAM;AAAA,WAAQ,QAAQ,WAAW;AACzB,gBAAA,MAAM,IAAI,gBAAe,IAAK,MAAM,MAAM,CAAA,CAAA;AAChD,aAAG,OAAO;AACV,aAAG,WAAW;AACd,aAAG,MAAK;AACR,cAAI,gBAAgB,GAAG;AAAA,QACzB;AAAA,QAAG;AAAA;AAAA,IACL,CAAC;WAEM;AAAA,EACT,CAAC;;AAGiC,IAAA,UAAA,GAAA,CAAA,YAAA,+BAAA,aAAa;;;AAFjD;ACnBO,MAAM,sBAAsB,oBAAoBA,qBAAiB,EACrE,WAAW,QAAQ,EACnB,MAAA;"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
declare const _default: import('vue').DefineComponent<DownloadProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<DownloadProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
1
|
+
declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
5
3
|
export default _default;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
1
2
|
import { ExportPlugin } from '../../lib/index.ts';
|
|
2
3
|
export declare const useExportPlugin: () => import('@embedpdf/core/vue').PluginState<ExportPlugin>;
|
|
3
4
|
export declare const useExportCapability: () => import('@embedpdf/core/vue').CapabilityState<Readonly<import('../../lib/index.ts').ExportCapability>>;
|
|
5
|
+
/**
|
|
6
|
+
* Hook for export capability for a specific document
|
|
7
|
+
* @param documentId Document ID (can be ref, computed, getter, or plain value)
|
|
8
|
+
*/
|
|
9
|
+
export declare const useExport: (documentId: MaybeRefOrGetter<string>) => {
|
|
10
|
+
provides: import('vue').ComputedRef<import('../../lib/index.ts').ExportScope | null>;
|
|
11
|
+
};
|
package/dist/vue/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),o=require("@embedpdf/plugin-export"),r=require("vue"),t=require("@embedpdf/models"),n=require("@embedpdf/core/vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),o=require("@embedpdf/plugin-export"),r=require("vue"),t=require("@embedpdf/models"),n=require("@embedpdf/core/vue"),u=()=>n.usePlugin(o.ExportPlugin.id),l=()=>n.useCapability(o.ExportPlugin.id),a=r.defineComponent({__name:"download",setup(e){const{provides:o}=l(),{plugin:n}=u(),a=r.ref(null);let p=null;return r.onMounted(()=>{const e=o.value,r=n.value;e&&r&&(p=r.onRequest(e=>{const o=a.value;if(!o)return;r.saveAsCopyAndGetBufferAndName(e.documentId).wait(({buffer:e,name:r})=>{const t=URL.createObjectURL(new Blob([e]));o.href=t,o.download=r,o.click(),URL.revokeObjectURL(t)},t.ignore)}))}),r.onUnmounted(()=>{p&&p()}),(e,o)=>(r.openBlock(),r.createElementBlock("a",{ref_key:"anchorRef",ref:a,style:{display:"none"}},null,512))}}),p=e.createPluginPackage(o.ExportPluginPackage).addUtility(a).build();exports.Download=a,exports.ExportPluginPackage=p,exports.useExport=e=>{const{provides:o}=l();return{provides:r.computed(()=>{var t;return(null==(t=o.value)?void 0:t.forDocument(r.toValue(e)))??null})}},exports.useExportCapability=l,exports.useExportPlugin=u,Object.keys(o).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>o[e]})});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/vue/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/vue/hooks/use-export.ts","../../src/vue/components/download.vue","../../src/vue/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","<script setup lang=\"ts\">\nimport { ref, onMounted, onUnmounted } from 'vue';\nimport { ignore } from '@embedpdf/models';\nimport { Unsubscribe } from '@embedpdf/core';\n\nimport { useExportCapability, useExportPlugin } from '../hooks';\n\
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/vue/hooks/use-export.ts","../../src/vue/components/download.vue","../../src/vue/index.ts"],"sourcesContent":["import { computed, MaybeRefOrGetter, toValue } from 'vue';\nimport { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n\n/**\n * Hook for export capability for a specific document\n * @param documentId Document ID (can be ref, computed, getter, or plain value)\n */\nexport const useExport = (documentId: MaybeRefOrGetter<string>) => {\n const { provides } = useExportCapability();\n\n return {\n provides: computed(() => provides.value?.forDocument(toValue(documentId)) ?? null),\n };\n};\n","<script setup lang=\"ts\">\nimport { ref, onMounted, onUnmounted } from 'vue';\nimport { ignore } from '@embedpdf/models';\nimport { Unsubscribe } from '@embedpdf/core';\n\nimport { useExportCapability, useExportPlugin } from '../hooks';\n\nconst { provides: exportCapabilityRef } = useExportCapability();\nconst { plugin: exportPluginRef } = useExportPlugin();\nconst anchorRef = ref<HTMLAnchorElement | null>(null);\n\nlet unsubscribe: Unsubscribe | null = null;\n\nonMounted(() => {\n const exportCapability = exportCapabilityRef.value;\n const exportPlugin = exportPluginRef.value;\n\n if (!exportCapability || !exportPlugin) return;\n\n unsubscribe = exportPlugin.onRequest((event) => {\n const el = anchorRef.value;\n if (!el) return;\n\n const task = exportPlugin.saveAsCopyAndGetBufferAndName(event.documentId);\n task.wait(({ buffer, name }) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = name;\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n });\n});\n\nonUnmounted(() => {\n if (unsubscribe) {\n unsubscribe();\n }\n});\n</script>\n\n<template>\n <a ref=\"anchorRef\" style=\"display: none\" />\n</template>\n","import { createPluginPackage } from '@embedpdf/core';\nimport { ExportPluginPackage as BaseExportPackage } from '@embedpdf/plugin-export';\n\nimport { Download } from './components';\n\nexport * from './hooks';\nexport * from './components';\n\nexport * from '@embedpdf/plugin-export';\n\nexport const ExportPluginPackage = createPluginPackage(BaseExportPackage)\n .addUtility(Download)\n .build();\n"],"names":["useExportPlugin","usePlugin","ExportPlugin","id","useExportCapability","useCapability","provides","exportCapabilityRef","plugin","exportPluginRef","anchorRef","ref","unsubscribe","onMounted","exportCapability","value","exportPlugin","onRequest","event","el","saveAsCopyAndGetBufferAndName","documentId","wait","buffer","name","url","URL","createObjectURL","Blob","href","download","click","revokeObjectURL","ignore","onUnmounted","_createElementBlock","style","display","ExportPluginPackage","createPluginPackage","BaseExportPackage","addUtility","Download","build","computed","_a","forDocument","toValue"],"mappings":"sOAIaA,EAAkB,IAAMC,YAAwBC,EAAAA,aAAaC,IAC7DC,EAAsB,IAAMC,gBAA4BH,EAAAA,aAAaC,oDCElF,MAAQG,SAAUC,GAAwBH,KAClCI,OAAQC,GAAoBT,IAC9BU,EAAYC,EAAAA,IAA8B,MAEhD,IAAIC,EAAkC,YAEtCC,EAAAA,UAAU,KACR,MAAMC,EAAmBP,EAAoBQ,MACvCC,EAAeP,EAAgBM,MAEhCD,GAAqBE,IAE1BJ,EAAcI,EAAaC,UAAWC,IACpC,MAAMC,EAAKT,EAAUK,MACrB,IAAKI,EAAI,OAEIH,EAAaI,8BAA8BF,EAAMG,YACzDC,KAAK,EAAGC,SAAQC,WACnB,MAAMC,EAAMC,IAAIC,gBAAgB,IAAIC,KAAK,CAACL,KAC1CJ,EAAGU,KAAOJ,EACVN,EAAGW,SAAWN,EACdL,EAAGY,QACHL,IAAIM,gBAAgBP,IACnBQ,EAAAA,aAIPC,EAAAA,YAAY,KACNtB,GACFA,4BAMFuB,EAAAA,mBAA2C,IAAA,SAApC,YAAJxB,IAAID,EAAY0B,MAAA,CAAAC,QAAA,uBChCRC,EAAsBC,EAAAA,oBAAoBC,EAAAA,qBACpDC,WAAWC,GACXC,2EFDuBtB,IACxB,MAAMf,SAAEA,GAAaF,IAErB,MAAO,CACLE,SAAUsC,EAAAA,SAAS,WAAM,OAAA,OAAAC,EAAAvC,EAASS,YAAT,EAAA8B,EAAgBC,YAAYC,EAAAA,QAAQ1B,MAAgB"}
|
package/dist/vue/index.js
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { createPluginPackage } from "@embedpdf/core";
|
|
2
2
|
import { ExportPlugin, ExportPluginPackage as ExportPluginPackage$1 } from "@embedpdf/plugin-export";
|
|
3
3
|
export * from "@embedpdf/plugin-export";
|
|
4
|
-
import { defineComponent, ref, onMounted, onUnmounted, createElementBlock, openBlock } from "vue";
|
|
4
|
+
import { computed, toValue, defineComponent, ref, onMounted, onUnmounted, createElementBlock, openBlock } from "vue";
|
|
5
5
|
import { ignore } from "@embedpdf/models";
|
|
6
6
|
import { useCapability, usePlugin } from "@embedpdf/core/vue";
|
|
7
7
|
const useExportPlugin = () => usePlugin(ExportPlugin.id);
|
|
8
8
|
const useExportCapability = () => useCapability(ExportPlugin.id);
|
|
9
|
+
const useExport = (documentId) => {
|
|
10
|
+
const { provides } = useExportCapability();
|
|
11
|
+
return {
|
|
12
|
+
provides: computed(() => {
|
|
13
|
+
var _a;
|
|
14
|
+
return ((_a = provides.value) == null ? void 0 : _a.forDocument(toValue(documentId))) ?? null;
|
|
15
|
+
})
|
|
16
|
+
};
|
|
17
|
+
};
|
|
9
18
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
19
|
__name: "download",
|
|
11
|
-
props: {
|
|
12
|
-
fileName: {}
|
|
13
|
-
},
|
|
14
20
|
setup(__props) {
|
|
15
|
-
const props = __props;
|
|
16
21
|
const { provides: exportCapabilityRef } = useExportCapability();
|
|
17
22
|
const { plugin: exportPluginRef } = useExportPlugin();
|
|
18
23
|
const anchorRef = ref(null);
|
|
@@ -21,19 +26,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
21
26
|
const exportCapability = exportCapabilityRef.value;
|
|
22
27
|
const exportPlugin = exportPluginRef.value;
|
|
23
28
|
if (!exportCapability || !exportPlugin) return;
|
|
24
|
-
unsubscribe = exportPlugin.onRequest((
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, ignore);
|
|
36
|
-
}
|
|
29
|
+
unsubscribe = exportPlugin.onRequest((event) => {
|
|
30
|
+
const el = anchorRef.value;
|
|
31
|
+
if (!el) return;
|
|
32
|
+
const task = exportPlugin.saveAsCopyAndGetBufferAndName(event.documentId);
|
|
33
|
+
task.wait(({ buffer, name }) => {
|
|
34
|
+
const url = URL.createObjectURL(new Blob([buffer]));
|
|
35
|
+
el.href = url;
|
|
36
|
+
el.download = name;
|
|
37
|
+
el.click();
|
|
38
|
+
URL.revokeObjectURL(url);
|
|
39
|
+
}, ignore);
|
|
37
40
|
});
|
|
38
41
|
});
|
|
39
42
|
onUnmounted(() => {
|
|
@@ -54,6 +57,7 @@ const ExportPluginPackage = createPluginPackage(ExportPluginPackage$1).addUtilit
|
|
|
54
57
|
export {
|
|
55
58
|
_sfc_main as Download,
|
|
56
59
|
ExportPluginPackage,
|
|
60
|
+
useExport,
|
|
57
61
|
useExportCapability,
|
|
58
62
|
useExportPlugin
|
|
59
63
|
};
|
package/dist/vue/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/vue/hooks/use-export.ts","../../src/vue/components/download.vue","../../src/vue/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","<script setup lang=\"ts\">\nimport { ref, onMounted, onUnmounted } from 'vue';\nimport { ignore } from '@embedpdf/models';\nimport { Unsubscribe } from '@embedpdf/core';\n\nimport { useExportCapability, useExportPlugin } from '../hooks';\n\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/vue/hooks/use-export.ts","../../src/vue/components/download.vue","../../src/vue/index.ts"],"sourcesContent":["import { computed, MaybeRefOrGetter, toValue } from 'vue';\nimport { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n\n/**\n * Hook for export capability for a specific document\n * @param documentId Document ID (can be ref, computed, getter, or plain value)\n */\nexport const useExport = (documentId: MaybeRefOrGetter<string>) => {\n const { provides } = useExportCapability();\n\n return {\n provides: computed(() => provides.value?.forDocument(toValue(documentId)) ?? null),\n };\n};\n","<script setup lang=\"ts\">\nimport { ref, onMounted, onUnmounted } from 'vue';\nimport { ignore } from '@embedpdf/models';\nimport { Unsubscribe } from '@embedpdf/core';\n\nimport { useExportCapability, useExportPlugin } from '../hooks';\n\nconst { provides: exportCapabilityRef } = useExportCapability();\nconst { plugin: exportPluginRef } = useExportPlugin();\nconst anchorRef = ref<HTMLAnchorElement | null>(null);\n\nlet unsubscribe: Unsubscribe | null = null;\n\nonMounted(() => {\n const exportCapability = exportCapabilityRef.value;\n const exportPlugin = exportPluginRef.value;\n\n if (!exportCapability || !exportPlugin) return;\n\n unsubscribe = exportPlugin.onRequest((event) => {\n const el = anchorRef.value;\n if (!el) return;\n\n const task = exportPlugin.saveAsCopyAndGetBufferAndName(event.documentId);\n task.wait(({ buffer, name }) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = name;\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n });\n});\n\nonUnmounted(() => {\n if (unsubscribe) {\n unsubscribe();\n }\n});\n</script>\n\n<template>\n <a ref=\"anchorRef\" style=\"display: none\" />\n</template>\n","import { createPluginPackage } from '@embedpdf/core';\nimport { ExportPluginPackage as BaseExportPackage } from '@embedpdf/plugin-export';\n\nimport { Download } from './components';\n\nexport * from './hooks';\nexport * from './components';\n\nexport * from '@embedpdf/plugin-export';\n\nexport const ExportPluginPackage = createPluginPackage(BaseExportPackage)\n .addUtility(Download)\n .build();\n"],"names":["_createElementBlock","BaseExportPackage","Download"],"mappings":";;;;;;AAIO,MAAM,kBAAkB,MAAM,UAAwB,aAAa,EAAE;AACrE,MAAM,sBAAsB,MAAM,cAA4B,aAAa,EAAE;AAM7E,MAAM,YAAY,CAAC,eAAyC;AACjE,QAAM,EAAE,SAAA,IAAa,oBAAA;AAErB,SAAO;AAAA,IACL,UAAU,SAAS,MAAA;;AAAM,6BAAS,UAAT,mBAAgB,YAAY,QAAQ,UAAU,OAAM;AAAA,KAAI;AAAA,EAAA;AAErF;;;;ACVA,UAAM,EAAE,UAAU,oBAAA,IAAwB,oBAAA;AAC1C,UAAM,EAAE,QAAQ,gBAAA,IAAoB,gBAAA;AACpC,UAAM,YAAY,IAA8B,IAAI;AAEpD,QAAI,cAAkC;AAEtC,cAAU,MAAM;AACd,YAAM,mBAAmB,oBAAoB;AAC7C,YAAM,eAAe,gBAAgB;AAErC,UAAI,CAAC,oBAAoB,CAAC,aAAc;AAExC,oBAAc,aAAa,UAAU,CAAC,UAAU;AAC9C,cAAM,KAAK,UAAU;AACrB,YAAI,CAAC,GAAI;AAET,cAAM,OAAO,aAAa,8BAA8B,MAAM,UAAU;AACxE,aAAK,KAAK,CAAC,EAAE,QAAQ,WAAW;AAC9B,gBAAM,MAAM,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,aAAG,OAAO;AACV,aAAG,WAAW;AACd,aAAG,MAAA;AACH,cAAI,gBAAgB,GAAG;AAAA,QACzB,GAAG,MAAM;AAAA,MACX,CAAC;AAAA,IACH,CAAC;AAED,gBAAY,MAAM;AAChB,UAAI,aAAa;AACf,oBAAA;AAAA,MACF;AAAA,IACF,CAAC;;0BAICA,mBAA2C,KAAA;AAAA,iBAApC;AAAA,QAAJ,KAAI;AAAA,QAAY,OAAA,EAAA,WAAA,OAAA;AAAA,MAAA;;;;AChCd,MAAM,sBAAsB,oBAAoBC,qBAAiB,EACrE,WAAWC,SAAQ,EACnB,MAAA;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/plugin-export",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-next.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@embedpdf/models": "
|
|
37
|
+
"@embedpdf/models": "2.0.0-next.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/react": "^18.2.0",
|
|
41
41
|
"typescript": "^5.0.0",
|
|
42
|
-
"@embedpdf/core": "
|
|
42
|
+
"@embedpdf/core": "2.0.0-next.1",
|
|
43
43
|
"@embedpdf/build": "1.1.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"preact": "^10.26.4",
|
|
49
49
|
"vue": ">=3.2.0",
|
|
50
50
|
"svelte": ">=5 <6",
|
|
51
|
-
"@embedpdf/core": "
|
|
51
|
+
"@embedpdf/core": "2.0.0-next.1"
|
|
52
52
|
},
|
|
53
53
|
"files": [
|
|
54
54
|
"dist",
|