@embedpdf/plugin-export 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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),a=()=>n.usePlugin(t.ExportPlugin.id),u=()=>n.useCapability(t.ExportPlugin.id);var s=l.from_html('<a style="display: none" href="/" aria-label="Download link"></a>');function c(e,t){l.push(t,!0);const{provides:r}=u(),{plugin:n}=a();let i;l.user_effect((()=>{if(!r)return;if(!n)return;return n.onRequest((e=>{if("download"===e){const e=i;if(!e)return;n.saveAsCopyAndGetBufferAndName().wait((({buffer:t,name:r})=>{const o=URL.createObjectURL(new Blob([t]));e.href=o,e.download=r,e.click(),URL.revokeObjectURL(o)}),o.ignore)}}))}));var c=s();l.bind_this(c,(e=>i=e),(()=>i)),l.append(e,c),l.pop()}const p=e.createPluginPackage(t.ExportPluginPackage).addUtility(c).build();exports.Download=c,exports.ExportPluginPackage=p,exports.useExportCapability=u,exports.useExportPlugin=a,Object.keys(t).forEach((e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})}));
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),a=()=>n.useCapability(t.ExportPlugin.id);var s=l.from_html('<a style="display: none" href="/" aria-label="Download link"></a>');function c(e,t){l.push(t,!0);const r=a(),n=u();let i;l.user_effect((()=>{if(!r.provides)return;if(!n.plugin)return;return n.plugin.onRequest((e=>{var t;if("download"===e){const e=i;if(!e)return;const r=null==(t=n.plugin)?void 0:t.saveAsCopyAndGetBufferAndName();null==r||r.wait((({buffer:t,name:r})=>{const o=URL.createObjectURL(new Blob([t]));e.href=o,e.download=r,e.click(),URL.revokeObjectURL(o)}),o.ignore)}}))}));var c=s();l.bind_this(c,(e=>i=e),(()=>i)),l.append(e,c),l.pop()}const p=e.createPluginPackage(t.ExportPluginPackage).addUtility(c).build();exports.Download=c,exports.ExportPluginPackage=p,exports.useExportCapability=a,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 { provides: exportCapability } = useExportCapability();\n const { plugin: exportPlugin } = useExportPlugin();\n\n let anchorElement: HTMLAnchorElement | undefined;\n\n $effect(() => {\n if (!exportCapability) return;\n if (!exportPlugin) return;\n\n const unsub = exportPlugin.onRequest((action) => {\n if (action === 'download') {\n const el = anchorElement;\n if (!el) return;\n\n const task = exportPlugin.saveAsCopyAndGetBufferAndName();\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\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","provides","exportCapability","plugin","exportPlugin","anchorElement","$","user_effect","onRequest","action","el","saveAsCopyAndGetBufferAndName","wait","buffer","name","url","URL","createObjectURL","Blob","href","download","click","revokeObjectURL","ignore","bind_this","a","$$value","ExportPluginPackage","createPluginPackage","BaseExportPackage","addUtility","Download","build"],"mappings":"skBAGaA,EAAwB,IAAAC,YAAwBC,EAAAA,aAAaC,IAC7DC,EAA4B,IAAAC,gBAA4BH,EAAAA,aAAaC,8HCAxEG,SAAUC,GAAqBH,KAC/BI,OAAQC,GAAiBT,IAE7B,IAAAU,EAEJC,EAAAC,aAAc,SACPL,EAAgB,WAChBE,EAAY,OAkBV,OAhBOA,EAAaI,WAAWC,OACrB,aAAXA,EAAuB,CACnB,MAAAC,EAAKL,MACNK,EAAE,OAEMN,EAAaO,gCACrBC,QAAQC,SAAQC,WACb,MAAAC,EAAMC,IAAIC,gBAAoB,IAAAC,MAAML,KAC1CH,EAAGS,KAAOJ,EACVL,EAAGU,SAAWN,EACdJ,EAAGW,QACHL,IAAIM,gBAAgBP,EAAG,GACtBQ,EAAAA,OACL,IAGK,cAIyBjB,EAAAkB,UAAAC,GAAAC,GAAArB,UAAAA,yBAFpC,CCrBO,MAAMsB,EAAsBC,EAAoBA,oBAAAC,EAAiBF,qBACrEG,WAAWC,GACXC"}
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((action) => {\n if (action === 'download') {\n const el = anchorElement;\n if (!el) return;\n\n const task = exportPlugin.plugin?.saveAsCopyAndGetBufferAndName();\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\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","action","el","task","_a","saveAsCopyAndGetBufferAndName","wait","buffer","name","url","URL","createObjectURL","Blob","href","download","click","revokeObjectURL","ignore","bind_this","a","$$value","ExportPluginPackage","createPluginPackage","BaseExportPackage","addUtility","Download","build"],"mappings":"skBAGaA,EAAwB,IAAAC,YAAwBC,EAAAA,aAAaC,IAC7DC,EAA4B,IAAAC,gBAA4BH,EAAAA,aAAaC,wHCA1E,MAAAG,EAAmBF,IACnBG,EAAeP,IAEjB,IAAAQ,EAEJC,EAAAC,aAAc,KACP,IAAAJ,EAAiBK,SAAQ,OACzB,IAAAJ,EAAaK,OAAM,OAkBjB,OAhBOL,EAAaK,OAAOC,WAAWC,aAC5B,aAAXA,EAAuB,CACnB,MAAAC,EAAKP,MACNO,EAAE,OAED,MAAAC,EAAO,OAAAC,EAAaV,EAAAK,aAAQ,EAAAK,EAAAC,gCAC5B,MAAAF,GAAAA,EAAAG,QAAQC,SAAQC,WACd,MAAAC,EAAMC,IAAIC,gBAAoB,IAAAC,MAAML,KAC1CL,EAAGW,KAAOJ,EACVP,EAAGY,SAAWN,EACdN,EAAGa,QACHL,IAAIM,gBAAgBP,EAAG,GACtBQ,EAAAA,OACL,IAGK,cAIyBrB,EAAAsB,UAAAC,GAAAC,GAAAzB,UAAAA,yBAFpC,CCrBO,MAAM0B,EAAsBC,EAAoBA,oBAAAC,EAAiBF,qBACrEG,WAAWC,GACXC"}
@@ -10,18 +10,19 @@ const useExportCapability = () => useCapability(ExportPlugin.id);
10
10
  var root = $.from_html(`<a style="display: none" href="/" aria-label="Download link"></a>`);
11
11
  function Download($$anchor, $$props) {
12
12
  $.push($$props, true);
13
- const { provides: exportCapability } = useExportCapability();
14
- const { plugin: exportPlugin } = useExportPlugin();
13
+ const exportCapability = useExportCapability();
14
+ const exportPlugin = useExportPlugin();
15
15
  let anchorElement;
16
16
  $.user_effect(() => {
17
- if (!exportCapability) return;
18
- if (!exportPlugin) return;
19
- const unsub = exportPlugin.onRequest((action) => {
17
+ if (!exportCapability.provides) return;
18
+ if (!exportPlugin.plugin) return;
19
+ const unsub = exportPlugin.plugin.onRequest((action) => {
20
+ var _a;
20
21
  if (action === "download") {
21
22
  const el = anchorElement;
22
23
  if (!el) return;
23
- const task = exportPlugin.saveAsCopyAndGetBufferAndName();
24
- task.wait(
24
+ const task = (_a = exportPlugin.plugin) == null ? void 0 : _a.saveAsCopyAndGetBufferAndName();
25
+ task == null ? void 0 : task.wait(
25
26
  ({ buffer, name }) => {
26
27
  const url = URL.createObjectURL(new Blob([buffer]));
27
28
  el.href = url;
@@ -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 { provides: exportCapability } = useExportCapability();\n const { plugin: exportPlugin } = useExportPlugin();\n\n let anchorElement: HTMLAnchorElement | undefined;\n\n $effect(() => {\n if (!exportCapability) return;\n if (!exportPlugin) return;\n\n const unsub = exportPlugin.onRequest((action) => {\n if (action === 'download') {\n const el = anchorElement;\n if (!el) return;\n\n const task = exportPlugin.saveAsCopyAndGetBufferAndName();\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\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,kBAAwB,MAAA,UAAwB,aAAa,EAAE;AAC/D,MAAA,sBAA4B,MAAA,cAA4B,aAAa,EAAE;;qCCJpF;;UAIU,UAAU,iBAAgB,IAAK,oBAAmB;UAClD,QAAQ,aAAY,IAAK,gBAAe;MAE5C;AAEJ,IAAA,YAAc,MAAA;SACP,iBAAgB;SAChB,aAAY;AAEX,UAAA,QAAQ,aAAa,UAAS,CAAE,WAAW;UAC3C,WAAW,YAAY;AACnB,cAAA,KAAK;aACN,GAAE;cAED,OAAO,aAAa,8BAA6B;AACvD,aAAK;AAAA,aAAQ,QAAQ,WAAW;AACxB,kBAAA,MAAM,IAAI,gBAAoB,IAAA,MAAM,MAAM,CAAA,CAAA;AAChD,eAAG,OAAO;AACV,eAAG,WAAW;AACd,eAAG,MAAK;AACR,gBAAI,gBAAgB,GAAG;AAAA,UACxB;AAAA,UAAE;AAAA;MACL;AAAA,KACD;WAEM;AAAA,GACR;;AAGiC,IAAA,UAAA,GAAA,CAAA,YAAA,+BAAA,aAAa;;;AAFjD;ACrBO,MAAM,sBAAsB,oBAAoBA,qBAAiB,EACrE,WAAW,QAAQ,EACnB,MAAM;"}
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((action) => {\n if (action === 'download') {\n const el = anchorElement;\n if (!el) return;\n\n const task = exportPlugin.plugin?.saveAsCopyAndGetBufferAndName();\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\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,kBAAwB,MAAA,UAAwB,aAAa,EAAE;AAC/D,MAAA,sBAA4B,MAAA,cAA4B,aAAa,EAAE;;qCCJpF;;AAIQ,QAAA,mBAAmB,oBAAmB;AACtC,QAAA,eAAe,gBAAe;MAEhC;AAEJ,IAAA,YAAc,MAAA;AACP,QAAA,CAAA,iBAAiB,SAAQ;AACzB,QAAA,CAAA,aAAa,OAAM;UAElB,QAAQ,aAAa,OAAO,UAAS,CAAE,WAAW;;UAClD,WAAW,YAAY;AACnB,cAAA,KAAK;aACN,GAAE;AAED,cAAA,QAAO,kBAAa,WAAb,mBAAqB;AAClC,qCAAM;AAAA,aAAQ,QAAQ,WAAW;AACzB,kBAAA,MAAM,IAAI,gBAAoB,IAAA,MAAM,MAAM,CAAA,CAAA;AAChD,eAAG,OAAO;AACV,eAAG,WAAW;AACd,eAAG,MAAK;AACR,gBAAI,gBAAgB,GAAG;AAAA,UACxB;AAAA,UAAE;AAAA;AAAA,MACL;AAAA,KACD;WAEM;AAAA,GACR;;AAGiC,IAAA,UAAA,GAAA,CAAA,YAAA,+BAAA,aAAa;;;AAFjD;ACrBO,MAAM,sBAAsB,oBAAoBA,qBAAiB,EACrE,WAAW,QAAQ,EACnB,MAAM;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/plugin-export",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
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": "1.4.0"
37
+ "@embedpdf/models": "1.5.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/react": "^18.2.0",
41
41
  "typescript": "^5.0.0",
42
- "@embedpdf/core": "1.4.0",
42
+ "@embedpdf/core": "1.5.0",
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": "1.4.0"
51
+ "@embedpdf/core": "1.5.0"
52
52
  },
53
53
  "files": [
54
54
  "dist",