@embedpdf/plugin-export 2.0.0 → 2.0.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.
|
@@ -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, 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","
|
|
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","a","root","$$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,gBAORC,EAACC,gBAADD,EAACE,GAAkC1B,EAAa0B,EAAA,IAAb1B,cAAnCwB,UAFD,CCnBO,MAAMG,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.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, 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
|
|
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;MAGF,IAAC,KAAA;cAAD,GAAC,CAAA,YAAkC,gBAAa,SAAA,MAAb,aAAa;qBAAhD,CAAC;;AAFF;ACnBO,MAAM,sBAAsB,oBAAoBA,qBAAiB,EACrE,WAAW,QAAQ,EACnB,MAAA;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/plugin-export",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.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": "2.0.
|
|
37
|
+
"@embedpdf/models": "2.0.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/react": "^18.2.0",
|
|
41
41
|
"typescript": "^5.0.0",
|
|
42
|
-
"@embedpdf/core": "2.0.
|
|
42
|
+
"@embedpdf/core": "2.0.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": "2.0.
|
|
51
|
+
"@embedpdf/core": "2.0.1"
|
|
52
52
|
},
|
|
53
53
|
"files": [
|
|
54
54
|
"dist",
|