@embedpdf/plugin-export 1.0.0 → 1.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.
@@ -21,15 +21,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var preact_exports = {};
22
22
  __export(preact_exports, {
23
23
  Download: () => Download,
24
- useExport: () => useExport,
25
- useExportCapability: () => useExportCapability
24
+ useExportCapability: () => useExportCapability,
25
+ useExportPlugin: () => useExportPlugin
26
26
  });
27
27
  module.exports = __toCommonJS(preact_exports);
28
28
 
29
29
  // src/preact/hooks/use-export.ts
30
30
  var import_preact = require("@embedpdf/core/preact");
31
31
  var import_plugin_export = require("@embedpdf/plugin-export");
32
- var useExport = () => (0, import_preact.usePlugin)(import_plugin_export.ExportPlugin.id);
32
+ var useExportPlugin = () => (0, import_preact.usePlugin)(import_plugin_export.ExportPlugin.id);
33
33
  var useExportCapability = () => (0, import_preact.useCapability)(import_plugin_export.ExportPlugin.id);
34
34
 
35
35
  // src/preact/components/download.tsx
@@ -62,7 +62,7 @@ function Download() {
62
62
  // Annotate the CommonJS export names for ESM import in node:
63
63
  0 && (module.exports = {
64
64
  Download,
65
- useExport,
66
- useExportCapability
65
+ useExportCapability,
66
+ useExportPlugin
67
67
  });
68
68
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/preact/index.ts","../../src/preact/hooks/use-export.ts","../../src/preact/components/download.tsx"],"sourcesContent":["export * from './hooks';\nexport * from './components';\n","import { useCapability, usePlugin } from '@embedpdf/core/preact';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExport = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","/** @jsxImportSource preact */\nimport { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from 'preact/hooks';\n\nimport { useExportCapability } from '../hooks';\n\nexport function Download() {\n const { provides: exportCapability } = useExportCapability();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportCapability) return;\n\n const unsub = exportCapability.onRequest(async (action) => {\n if (action === 'download') {\n const el = ref.current;\n if (!el) return;\n\n const task = exportCapability.saveAsCopy();\n task.wait((buffer) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = 'document.pdf';\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n }\n });\n\n return unsub;\n }, [exportCapability]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyC;AACzC,2BAA6B;AAEtB,IAAM,YAAY,UAAM,yBAAwB,kCAAa,EAAE;AAC/D,IAAM,sBAAsB,UAAM,6BAA4B,kCAAa,EAAE;;;ACHpF,oBAAuB;AACvB,mBAAkC;AA8BzB;AA1BF,SAAS,WAAW;AACzB,QAAM,EAAE,UAAU,iBAAiB,IAAI,oBAAoB;AAC3D,QAAM,UAAM,qBAA0B,IAAI;AAE1C,8BAAU,MAAM;AACd,QAAI,CAAC,iBAAkB;AAEvB,UAAM,QAAQ,iBAAiB,UAAU,OAAO,WAAW;AACzD,UAAI,WAAW,YAAY;AACzB,cAAM,KAAK,IAAI;AACf,YAAI,CAAC,GAAI;AAET,cAAM,OAAO,iBAAiB,WAAW;AACzC,aAAK,KAAK,CAAC,WAAW;AACpB,gBAAM,MAAM,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,aAAG,OAAO;AACV,aAAG,WAAW;AACd,aAAG,MAAM;AACT,cAAI,gBAAgB,GAAG;AAAA,QACzB,GAAG,oBAAM;AAAA,MACX;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO,4CAAC,OAAE,OAAO,EAAE,SAAS,OAAO,GAAG,KAAU;AAClD;","names":[]}
1
+ {"version":3,"sources":["../../src/preact/index.ts","../../src/preact/hooks/use-export.ts","../../src/preact/components/download.tsx"],"sourcesContent":["export * from './hooks';\nexport * from './components';\n","import { useCapability, usePlugin } from '@embedpdf/core/preact';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","/** @jsxImportSource preact */\nimport { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from 'preact/hooks';\n\nimport { useExportCapability } from '../hooks';\n\nexport function Download() {\n const { provides: exportCapability } = useExportCapability();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportCapability) return;\n\n const unsub = exportCapability.onRequest(async (action) => {\n if (action === 'download') {\n const el = ref.current;\n if (!el) return;\n\n const task = exportCapability.saveAsCopy();\n task.wait((buffer) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = 'document.pdf';\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n }\n });\n\n return unsub;\n }, [exportCapability]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyC;AACzC,2BAA6B;AAEtB,IAAM,kBAAkB,UAAM,yBAAwB,kCAAa,EAAE;AACrE,IAAM,sBAAsB,UAAM,6BAA4B,kCAAa,EAAE;;;ACHpF,oBAAuB;AACvB,mBAAkC;AA8BzB;AA1BF,SAAS,WAAW;AACzB,QAAM,EAAE,UAAU,iBAAiB,IAAI,oBAAoB;AAC3D,QAAM,UAAM,qBAA0B,IAAI;AAE1C,8BAAU,MAAM;AACd,QAAI,CAAC,iBAAkB;AAEvB,UAAM,QAAQ,iBAAiB,UAAU,OAAO,WAAW;AACzD,UAAI,WAAW,YAAY;AACzB,cAAM,KAAK,IAAI;AACf,YAAI,CAAC,GAAI;AAET,cAAM,OAAO,iBAAiB,WAAW;AACzC,aAAK,KAAK,CAAC,WAAW;AACpB,gBAAM,MAAM,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,aAAG,OAAO;AACV,aAAG,WAAW;AACd,aAAG,MAAM;AACT,cAAI,gBAAgB,GAAG;AAAA,QACzB,GAAG,oBAAM;AAAA,MACX;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO,4CAAC,OAAE,OAAO,EAAE,SAAS,OAAO,GAAG,KAAU;AAClD;","names":[]}
@@ -2,7 +2,7 @@ import * as _embedpdf_plugin_export from '@embedpdf/plugin-export';
2
2
  import { ExportPlugin } from '@embedpdf/plugin-export';
3
3
  import * as preact from 'preact';
4
4
 
5
- declare const useExport: () => {
5
+ declare const useExportPlugin: () => {
6
6
  plugin: ExportPlugin | null;
7
7
  isLoading: boolean;
8
8
  ready: Promise<void>;
@@ -15,4 +15,4 @@ declare const useExportCapability: () => {
15
15
 
16
16
  declare function Download(): preact.JSX.Element;
17
17
 
18
- export { Download, useExport, useExportCapability };
18
+ export { Download, useExportCapability, useExportPlugin };
@@ -2,7 +2,7 @@ import * as _embedpdf_plugin_export from '@embedpdf/plugin-export';
2
2
  import { ExportPlugin } from '@embedpdf/plugin-export';
3
3
  import * as preact from 'preact';
4
4
 
5
- declare const useExport: () => {
5
+ declare const useExportPlugin: () => {
6
6
  plugin: ExportPlugin | null;
7
7
  isLoading: boolean;
8
8
  ready: Promise<void>;
@@ -15,4 +15,4 @@ declare const useExportCapability: () => {
15
15
 
16
16
  declare function Download(): preact.JSX.Element;
17
17
 
18
- export { Download, useExport, useExportCapability };
18
+ export { Download, useExportCapability, useExportPlugin };
@@ -1,7 +1,7 @@
1
1
  // src/preact/hooks/use-export.ts
2
2
  import { useCapability, usePlugin } from "@embedpdf/core/preact";
3
3
  import { ExportPlugin } from "@embedpdf/plugin-export";
4
- var useExport = () => usePlugin(ExportPlugin.id);
4
+ var useExportPlugin = () => usePlugin(ExportPlugin.id);
5
5
  var useExportCapability = () => useCapability(ExportPlugin.id);
6
6
 
7
7
  // src/preact/components/download.tsx
@@ -33,7 +33,7 @@ function Download() {
33
33
  }
34
34
  export {
35
35
  Download,
36
- useExport,
37
- useExportCapability
36
+ useExportCapability,
37
+ useExportPlugin
38
38
  };
39
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/preact/hooks/use-export.ts","../../src/preact/components/download.tsx"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/preact';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExport = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","/** @jsxImportSource preact */\nimport { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from 'preact/hooks';\n\nimport { useExportCapability } from '../hooks';\n\nexport function Download() {\n const { provides: exportCapability } = useExportCapability();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportCapability) return;\n\n const unsub = exportCapability.onRequest(async (action) => {\n if (action === 'download') {\n const el = ref.current;\n if (!el) return;\n\n const task = exportCapability.saveAsCopy();\n task.wait((buffer) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = 'document.pdf';\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n }\n });\n\n return unsub;\n }, [exportCapability]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n"],"mappings":";AAAA,SAAS,eAAe,iBAAiB;AACzC,SAAS,oBAAoB;AAEtB,IAAM,YAAY,MAAM,UAAwB,aAAa,EAAE;AAC/D,IAAM,sBAAsB,MAAM,cAA4B,aAAa,EAAE;;;ACHpF,SAAS,cAAc;AACvB,SAAS,WAAW,cAAc;AA8BzB;AA1BF,SAAS,WAAW;AACzB,QAAM,EAAE,UAAU,iBAAiB,IAAI,oBAAoB;AAC3D,QAAM,MAAM,OAA0B,IAAI;AAE1C,YAAU,MAAM;AACd,QAAI,CAAC,iBAAkB;AAEvB,UAAM,QAAQ,iBAAiB,UAAU,OAAO,WAAW;AACzD,UAAI,WAAW,YAAY;AACzB,cAAM,KAAK,IAAI;AACf,YAAI,CAAC,GAAI;AAET,cAAM,OAAO,iBAAiB,WAAW;AACzC,aAAK,KAAK,CAAC,WAAW;AACpB,gBAAM,MAAM,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,aAAG,OAAO;AACV,aAAG,WAAW;AACd,aAAG,MAAM;AACT,cAAI,gBAAgB,GAAG;AAAA,QACzB,GAAG,MAAM;AAAA,MACX;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO,oBAAC,OAAE,OAAO,EAAE,SAAS,OAAO,GAAG,KAAU;AAClD;","names":[]}
1
+ {"version":3,"sources":["../../src/preact/hooks/use-export.ts","../../src/preact/components/download.tsx"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/preact';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExportPlugin = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","/** @jsxImportSource preact */\nimport { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from 'preact/hooks';\n\nimport { useExportCapability } from '../hooks';\n\nexport function Download() {\n const { provides: exportCapability } = useExportCapability();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportCapability) return;\n\n const unsub = exportCapability.onRequest(async (action) => {\n if (action === 'download') {\n const el = ref.current;\n if (!el) return;\n\n const task = exportCapability.saveAsCopy();\n task.wait((buffer) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = 'document.pdf';\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n }\n });\n\n return unsub;\n }, [exportCapability]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n"],"mappings":";AAAA,SAAS,eAAe,iBAAiB;AACzC,SAAS,oBAAoB;AAEtB,IAAM,kBAAkB,MAAM,UAAwB,aAAa,EAAE;AACrE,IAAM,sBAAsB,MAAM,cAA4B,aAAa,EAAE;;;ACHpF,SAAS,cAAc;AACvB,SAAS,WAAW,cAAc;AA8BzB;AA1BF,SAAS,WAAW;AACzB,QAAM,EAAE,UAAU,iBAAiB,IAAI,oBAAoB;AAC3D,QAAM,MAAM,OAA0B,IAAI;AAE1C,YAAU,MAAM;AACd,QAAI,CAAC,iBAAkB;AAEvB,UAAM,QAAQ,iBAAiB,UAAU,OAAO,WAAW;AACzD,UAAI,WAAW,YAAY;AACzB,cAAM,KAAK,IAAI;AACf,YAAI,CAAC,GAAI;AAET,cAAM,OAAO,iBAAiB,WAAW;AACzC,aAAK,KAAK,CAAC,WAAW;AACpB,gBAAM,MAAM,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,aAAG,OAAO;AACV,aAAG,WAAW;AACd,aAAG,MAAM;AACT,cAAI,gBAAgB,GAAG;AAAA,QACzB,GAAG,MAAM;AAAA,MACX;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO,oBAAC,OAAE,OAAO,EAAE,SAAS,OAAO,GAAG,KAAU;AAClD;","names":[]}
@@ -21,15 +21,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var react_exports = {};
22
22
  __export(react_exports, {
23
23
  Download: () => Download,
24
- useExport: () => useExport,
25
- useExportCapability: () => useExportCapability
24
+ useExportCapability: () => useExportCapability,
25
+ useExportPlugin: () => useExportPlugin
26
26
  });
27
27
  module.exports = __toCommonJS(react_exports);
28
28
 
29
29
  // src/react/hooks/use-export.ts
30
30
  var import_react = require("@embedpdf/core/react");
31
31
  var import_plugin_export = require("@embedpdf/plugin-export");
32
- var useExport = () => (0, import_react.usePlugin)(import_plugin_export.ExportPlugin.id);
32
+ var useExportPlugin = () => (0, import_react.usePlugin)(import_plugin_export.ExportPlugin.id);
33
33
  var useExportCapability = () => (0, import_react.useCapability)(import_plugin_export.ExportPlugin.id);
34
34
 
35
35
  // src/react/component/download.tsx
@@ -62,7 +62,7 @@ function Download() {
62
62
  // Annotate the CommonJS export names for ESM import in node:
63
63
  0 && (module.exports = {
64
64
  Download,
65
- useExport,
66
- useExportCapability
65
+ useExportCapability,
66
+ useExportPlugin
67
67
  });
68
68
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/index.ts","../../src/react/hooks/use-export.ts","../../src/react/component/download.tsx"],"sourcesContent":["export * from './hooks';\nexport * from './component';\n","import { useCapability, usePlugin } from '@embedpdf/core/react';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExport = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","import { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from 'react';\n\nimport { useExportCapability } from '../hooks';\n\nexport function Download() {\n const { provides: exportCapability } = useExportCapability();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportCapability) return;\n\n const unsub = exportCapability.onRequest(async (action) => {\n if (action === 'download') {\n const el = ref.current;\n if (!el) return;\n\n const task = exportCapability.saveAsCopy();\n task.wait((buffer) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = 'document.pdf';\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n }\n });\n\n return unsub;\n }, [exportCapability]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAyC;AACzC,2BAA6B;AAEtB,IAAM,YAAY,UAAM,wBAAwB,kCAAa,EAAE;AAC/D,IAAM,sBAAsB,UAAM,4BAA4B,kCAAa,EAAE;;;ACJpF,oBAAuB;AACvB,IAAAA,gBAAkC;AA8BzB;AA1BF,SAAS,WAAW;AACzB,QAAM,EAAE,UAAU,iBAAiB,IAAI,oBAAoB;AAC3D,QAAM,UAAM,sBAA0B,IAAI;AAE1C,+BAAU,MAAM;AACd,QAAI,CAAC,iBAAkB;AAEvB,UAAM,QAAQ,iBAAiB,UAAU,OAAO,WAAW;AACzD,UAAI,WAAW,YAAY;AACzB,cAAM,KAAK,IAAI;AACf,YAAI,CAAC,GAAI;AAET,cAAM,OAAO,iBAAiB,WAAW;AACzC,aAAK,KAAK,CAAC,WAAW;AACpB,gBAAM,MAAM,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,aAAG,OAAO;AACV,aAAG,WAAW;AACd,aAAG,MAAM;AACT,cAAI,gBAAgB,GAAG;AAAA,QACzB,GAAG,oBAAM;AAAA,MACX;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO,4CAAC,OAAE,OAAO,EAAE,SAAS,OAAO,GAAG,KAAU;AAClD;","names":["import_react"]}
1
+ {"version":3,"sources":["../../src/react/index.ts","../../src/react/hooks/use-export.ts","../../src/react/component/download.tsx"],"sourcesContent":["export * from './hooks';\nexport * from './component';\n","import { useCapability, usePlugin } from '@embedpdf/core/react';\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 'react';\n\nimport { useExportCapability } from '../hooks';\n\nexport function Download() {\n const { provides: exportCapability } = useExportCapability();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportCapability) return;\n\n const unsub = exportCapability.onRequest(async (action) => {\n if (action === 'download') {\n const el = ref.current;\n if (!el) return;\n\n const task = exportCapability.saveAsCopy();\n task.wait((buffer) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = 'document.pdf';\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n }\n });\n\n return unsub;\n }, [exportCapability]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAyC;AACzC,2BAA6B;AAEtB,IAAM,kBAAkB,UAAM,wBAAwB,kCAAa,EAAE;AACrE,IAAM,sBAAsB,UAAM,4BAA4B,kCAAa,EAAE;;;ACJpF,oBAAuB;AACvB,IAAAA,gBAAkC;AA8BzB;AA1BF,SAAS,WAAW;AACzB,QAAM,EAAE,UAAU,iBAAiB,IAAI,oBAAoB;AAC3D,QAAM,UAAM,sBAA0B,IAAI;AAE1C,+BAAU,MAAM;AACd,QAAI,CAAC,iBAAkB;AAEvB,UAAM,QAAQ,iBAAiB,UAAU,OAAO,WAAW;AACzD,UAAI,WAAW,YAAY;AACzB,cAAM,KAAK,IAAI;AACf,YAAI,CAAC,GAAI;AAET,cAAM,OAAO,iBAAiB,WAAW;AACzC,aAAK,KAAK,CAAC,WAAW;AACpB,gBAAM,MAAM,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,aAAG,OAAO;AACV,aAAG,WAAW;AACd,aAAG,MAAM;AACT,cAAI,gBAAgB,GAAG;AAAA,QACzB,GAAG,oBAAM;AAAA,MACX;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO,4CAAC,OAAE,OAAO,EAAE,SAAS,OAAO,GAAG,KAAU;AAClD;","names":["import_react"]}
@@ -2,7 +2,7 @@ import * as _embedpdf_plugin_export from '@embedpdf/plugin-export';
2
2
  import { ExportPlugin } from '@embedpdf/plugin-export';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
 
5
- declare const useExport: () => {
5
+ declare const useExportPlugin: () => {
6
6
  plugin: ExportPlugin | null;
7
7
  isLoading: boolean;
8
8
  ready: Promise<void>;
@@ -15,4 +15,4 @@ declare const useExportCapability: () => {
15
15
 
16
16
  declare function Download(): react_jsx_runtime.JSX.Element;
17
17
 
18
- export { Download, useExport, useExportCapability };
18
+ export { Download, useExportCapability, useExportPlugin };
@@ -2,7 +2,7 @@ import * as _embedpdf_plugin_export from '@embedpdf/plugin-export';
2
2
  import { ExportPlugin } from '@embedpdf/plugin-export';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
 
5
- declare const useExport: () => {
5
+ declare const useExportPlugin: () => {
6
6
  plugin: ExportPlugin | null;
7
7
  isLoading: boolean;
8
8
  ready: Promise<void>;
@@ -15,4 +15,4 @@ declare const useExportCapability: () => {
15
15
 
16
16
  declare function Download(): react_jsx_runtime.JSX.Element;
17
17
 
18
- export { Download, useExport, useExportCapability };
18
+ export { Download, useExportCapability, useExportPlugin };
@@ -1,7 +1,7 @@
1
1
  // src/react/hooks/use-export.ts
2
2
  import { useCapability, usePlugin } from "@embedpdf/core/react";
3
3
  import { ExportPlugin } from "@embedpdf/plugin-export";
4
- var useExport = () => usePlugin(ExportPlugin.id);
4
+ var useExportPlugin = () => usePlugin(ExportPlugin.id);
5
5
  var useExportCapability = () => useCapability(ExportPlugin.id);
6
6
 
7
7
  // src/react/component/download.tsx
@@ -33,7 +33,7 @@ function Download() {
33
33
  }
34
34
  export {
35
35
  Download,
36
- useExport,
37
- useExportCapability
36
+ useExportCapability,
37
+ useExportPlugin
38
38
  };
39
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/hooks/use-export.ts","../../src/react/component/download.tsx"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/react';\nimport { ExportPlugin } from '@embedpdf/plugin-export';\n\nexport const useExport = () => usePlugin<ExportPlugin>(ExportPlugin.id);\nexport const useExportCapability = () => useCapability<ExportPlugin>(ExportPlugin.id);\n","import { ignore } from '@embedpdf/models';\nimport { useEffect, useRef } from 'react';\n\nimport { useExportCapability } from '../hooks';\n\nexport function Download() {\n const { provides: exportCapability } = useExportCapability();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportCapability) return;\n\n const unsub = exportCapability.onRequest(async (action) => {\n if (action === 'download') {\n const el = ref.current;\n if (!el) return;\n\n const task = exportCapability.saveAsCopy();\n task.wait((buffer) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = 'document.pdf';\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n }\n });\n\n return unsub;\n }, [exportCapability]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n"],"mappings":";AAAA,SAAS,eAAe,iBAAiB;AACzC,SAAS,oBAAoB;AAEtB,IAAM,YAAY,MAAM,UAAwB,aAAa,EAAE;AAC/D,IAAM,sBAAsB,MAAM,cAA4B,aAAa,EAAE;;;ACJpF,SAAS,cAAc;AACvB,SAAS,WAAW,cAAc;AA8BzB;AA1BF,SAAS,WAAW;AACzB,QAAM,EAAE,UAAU,iBAAiB,IAAI,oBAAoB;AAC3D,QAAM,MAAM,OAA0B,IAAI;AAE1C,YAAU,MAAM;AACd,QAAI,CAAC,iBAAkB;AAEvB,UAAM,QAAQ,iBAAiB,UAAU,OAAO,WAAW;AACzD,UAAI,WAAW,YAAY;AACzB,cAAM,KAAK,IAAI;AACf,YAAI,CAAC,GAAI;AAET,cAAM,OAAO,iBAAiB,WAAW;AACzC,aAAK,KAAK,CAAC,WAAW;AACpB,gBAAM,MAAM,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,aAAG,OAAO;AACV,aAAG,WAAW;AACd,aAAG,MAAM;AACT,cAAI,gBAAgB,GAAG;AAAA,QACzB,GAAG,MAAM;AAAA,MACX;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO,oBAAC,OAAE,OAAO,EAAE,SAAS,OAAO,GAAG,KAAU;AAClD;","names":[]}
1
+ {"version":3,"sources":["../../src/react/hooks/use-export.ts","../../src/react/component/download.tsx"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/react';\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 'react';\n\nimport { useExportCapability } from '../hooks';\n\nexport function Download() {\n const { provides: exportCapability } = useExportCapability();\n const ref = useRef<HTMLAnchorElement>(null);\n\n useEffect(() => {\n if (!exportCapability) return;\n\n const unsub = exportCapability.onRequest(async (action) => {\n if (action === 'download') {\n const el = ref.current;\n if (!el) return;\n\n const task = exportCapability.saveAsCopy();\n task.wait((buffer) => {\n const url = URL.createObjectURL(new Blob([buffer]));\n el.href = url;\n el.download = 'document.pdf';\n el.click();\n URL.revokeObjectURL(url);\n }, ignore);\n }\n });\n\n return unsub;\n }, [exportCapability]);\n\n return <a style={{ display: 'none' }} ref={ref} />;\n}\n"],"mappings":";AAAA,SAAS,eAAe,iBAAiB;AACzC,SAAS,oBAAoB;AAEtB,IAAM,kBAAkB,MAAM,UAAwB,aAAa,EAAE;AACrE,IAAM,sBAAsB,MAAM,cAA4B,aAAa,EAAE;;;ACJpF,SAAS,cAAc;AACvB,SAAS,WAAW,cAAc;AA8BzB;AA1BF,SAAS,WAAW;AACzB,QAAM,EAAE,UAAU,iBAAiB,IAAI,oBAAoB;AAC3D,QAAM,MAAM,OAA0B,IAAI;AAE1C,YAAU,MAAM;AACd,QAAI,CAAC,iBAAkB;AAEvB,UAAM,QAAQ,iBAAiB,UAAU,OAAO,WAAW;AACzD,UAAI,WAAW,YAAY;AACzB,cAAM,KAAK,IAAI;AACf,YAAI,CAAC,GAAI;AAET,cAAM,OAAO,iBAAiB,WAAW;AACzC,aAAK,KAAK,CAAC,WAAW;AACpB,gBAAM,MAAM,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,aAAG,OAAO;AACV,aAAG,WAAW;AACd,aAAG,MAAM;AACT,cAAI,gBAAgB,GAAG;AAAA,QACzB,GAAG,MAAM;AAAA,MACX;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO,oBAAC,OAAE,OAAO,EAAE,SAAS,OAAO,GAAG,KAAU;AAClD;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/plugin-export",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -23,19 +23,19 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@embedpdf/models": "1.0.0"
26
+ "@embedpdf/models": "1.0.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/react": "^18.2.0",
30
30
  "tsup": "^8.0.0",
31
31
  "typescript": "^5.0.0",
32
- "@embedpdf/core": "1.0.0"
32
+ "@embedpdf/core": "1.0.1"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": ">=16.8.0",
36
36
  "react-dom": ">=16.8.0",
37
37
  "preact": "^10.26.4",
38
- "@embedpdf/core": "1.0.0"
38
+ "@embedpdf/core": "1.0.1"
39
39
  },
40
40
  "files": [
41
41
  "dist",