@embedpdf/plugin-capture 1.0.20 → 1.0.21
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/preact/index.cjs +1 -1
- package/dist/preact/index.js +1 -0
- package/dist/preact/index.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -0
- package/dist/react/index.js.map +1 -1
- package/dist/shared-preact/index.d.ts +1 -0
- package/dist/shared-react/index.d.ts +1 -0
- package/dist/vue/components/index.d.ts +1 -0
- package/dist/vue/components/marquee-capture.vue.d.ts +16 -0
- package/dist/vue/hooks/index.d.ts +1 -0
- package/dist/vue/hooks/use-capture.d.ts +3 -0
- package/dist/vue/index.cjs +2 -0
- package/dist/vue/index.cjs.map +1 -0
- package/dist/vue/index.d.ts +3 -0
- package/dist/vue/index.js +60 -0
- package/dist/vue/index.js.map +1 -0
- package/package.json +16 -9
- package/dist/preact/interaction-manager.d.ts +0 -1
- package/dist/react/interaction-manager.d.ts +0 -1
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/preact"),r=require("@embedpdf/plugin-capture"),t=require("preact/jsx-runtime"),i=require("preact/hooks"),a=()=>e.useCapability(r.CapturePlugin.id);exports.MarqueeCapture=({pageIndex:e,scale:r,className:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core/preact"),r=require("@embedpdf/plugin-capture"),t=require("preact/jsx-runtime"),i=require("preact/hooks"),a=()=>e.useCapability(r.CapturePlugin.id);exports.MarqueeCapture=({pageIndex:e,scale:r,className:o,stroke:s="rgba(33,150,243,0.8)",fill:u="rgba(33,150,243,0.15)"})=>{const{provides:p}=a(),[l,n]=i.useState(null);return i.useEffect((()=>{if(p)return p.registerMarqueeOnPage({pageIndex:e,scale:r,callback:{onPreview:n}})}),[p,e,r]),l?t.jsx("div",{style:{position:"absolute",pointerEvents:"none",left:l.origin.x*r,top:l.origin.y*r,width:l.size.width*r,height:l.size.height*r,border:`1px solid ${s}`,background:u,boxSizing:"border-box"},className:o}):null},exports.useCaptureCapability=a,exports.useCapturePlugin=()=>e.usePlugin(r.CapturePlugin.id),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/preact/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useCapability, usePlugin } from "@embedpdf/core/preact";
|
|
2
2
|
import { CapturePlugin } from "@embedpdf/plugin-capture";
|
|
3
|
+
export * from "@embedpdf/plugin-capture";
|
|
3
4
|
import { jsx } from "preact/jsx-runtime";
|
|
4
5
|
import { useState, useEffect } from "preact/hooks";
|
|
5
6
|
const useCaptureCapability = () => useCapability(CapturePlugin.id);
|
package/dist/preact/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-capture.ts","../../src/shared/components/marquee-capture.tsx"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { CapturePlugin } from '@embedpdf/plugin-capture';\n\nexport const useCaptureCapability = () => useCapability<CapturePlugin>(CapturePlugin.id);\nexport const useCapturePlugin = () => usePlugin<CapturePlugin>(CapturePlugin.id);\n","import { useEffect, useState } from '@framework';\nimport { Rect } from '@embedpdf/models';\n\nimport { useCaptureCapability } from '../hooks/use-capture';\n\ninterface MarqueeCaptureProps {\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nexport const MarqueeCapture = ({\n pageIndex,\n scale,\n className,\n stroke = 'rgba(33,150,243,0.8)',\n fill = 'rgba(33,150,243,0.15)',\n}: MarqueeCaptureProps) => {\n const { provides: capturePlugin } = useCaptureCapability();\n const [rect, setRect] = useState<Rect | null>(null);\n\n useEffect(() => {\n if (!capturePlugin) return;\n return capturePlugin.registerMarqueeOnPage({\n pageIndex,\n scale,\n callback: {\n onPreview: setRect,\n },\n });\n }, [capturePlugin, pageIndex, scale]);\n\n if (!rect) return null;\n\n return (\n <div\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n left: rect.origin.x * scale,\n top: rect.origin.y * scale,\n width: rect.size.width * scale,\n height: rect.size.height * scale,\n border: `1px solid ${stroke}`,\n background: fill,\n boxSizing: 'border-box',\n }}\n className={className}\n />\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-capture.ts","../../src/shared/components/marquee-capture.tsx"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { CapturePlugin } from '@embedpdf/plugin-capture';\n\nexport const useCaptureCapability = () => useCapability<CapturePlugin>(CapturePlugin.id);\nexport const useCapturePlugin = () => usePlugin<CapturePlugin>(CapturePlugin.id);\n","import { useEffect, useState } from '@framework';\nimport { Rect } from '@embedpdf/models';\n\nimport { useCaptureCapability } from '../hooks/use-capture';\n\ninterface MarqueeCaptureProps {\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nexport const MarqueeCapture = ({\n pageIndex,\n scale,\n className,\n stroke = 'rgba(33,150,243,0.8)',\n fill = 'rgba(33,150,243,0.15)',\n}: MarqueeCaptureProps) => {\n const { provides: capturePlugin } = useCaptureCapability();\n const [rect, setRect] = useState<Rect | null>(null);\n\n useEffect(() => {\n if (!capturePlugin) return;\n return capturePlugin.registerMarqueeOnPage({\n pageIndex,\n scale,\n callback: {\n onPreview: setRect,\n },\n });\n }, [capturePlugin, pageIndex, scale]);\n\n if (!rect) return null;\n\n return (\n <div\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n left: rect.origin.x * scale,\n top: rect.origin.y * scale,\n width: rect.size.width * scale,\n height: rect.size.height * scale,\n border: `1px solid ${stroke}`,\n background: fill,\n boxSizing: 'border-box',\n }}\n className={className}\n />\n );\n};\n"],"names":[],"mappings":";;;;;AAGO,MAAM,uBAAuB,MAAM,cAA6B,cAAc,EAAE;AAChF,MAAM,mBAAmB,MAAM,UAAyB,cAAc,EAAE;ACaxE,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,OAAO;AACT,MAA2B;AACzB,QAAM,EAAE,UAAU,cAAc,IAAI,qBAAqB;AACzD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAsB,IAAI;AAElD,YAAU,MAAM;AACd,QAAI,CAAC,cAAe;AACpB,WAAO,cAAc,sBAAsB;AAAA,MACzC;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,WAAW;AAAA,MAAA;AAAA,IACb,CACD;AAAA,EACA,GAAA,CAAC,eAAe,WAAW,KAAK,CAAC;AAEhC,MAAA,CAAC,KAAa,QAAA;AAGhB,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,eAAe;AAAA,QACf,MAAM,KAAK,OAAO,IAAI;AAAA,QACtB,KAAK,KAAK,OAAO,IAAI;AAAA,QACrB,OAAO,KAAK,KAAK,QAAQ;AAAA,QACzB,QAAQ,KAAK,KAAK,SAAS;AAAA,QAC3B,QAAQ,aAAa,MAAM;AAAA,QAC3B,YAAY;AAAA,QACZ,WAAW;AAAA,MACb;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
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/react"),r=require("@embedpdf/plugin-capture"),t=require("react/jsx-runtime"),i=require("react"),a=()=>e.useCapability(r.CapturePlugin.id);exports.MarqueeCapture=({pageIndex:e,scale:r,className:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core/react"),r=require("@embedpdf/plugin-capture"),t=require("react/jsx-runtime"),i=require("react"),a=()=>e.useCapability(r.CapturePlugin.id);exports.MarqueeCapture=({pageIndex:e,scale:r,className:s,stroke:o="rgba(33,150,243,0.8)",fill:u="rgba(33,150,243,0.15)"})=>{const{provides:l}=a(),[n,p]=i.useState(null);return i.useEffect((()=>{if(l)return l.registerMarqueeOnPage({pageIndex:e,scale:r,callback:{onPreview:p}})}),[l,e,r]),n?t.jsx("div",{style:{position:"absolute",pointerEvents:"none",left:n.origin.x*r,top:n.origin.y*r,width:n.size.width*r,height:n.size.height*r,border:`1px solid ${o}`,background:u,boxSizing:"border-box"},className:s}):null},exports.useCaptureCapability=a,exports.useCapturePlugin=()=>e.usePlugin(r.CapturePlugin.id),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.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useCapability, usePlugin } from "@embedpdf/core/react";
|
|
2
2
|
import { CapturePlugin } from "@embedpdf/plugin-capture";
|
|
3
|
+
export * from "@embedpdf/plugin-capture";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
import { useState, useEffect } from "react";
|
|
5
6
|
const useCaptureCapability = () => useCapability(CapturePlugin.id);
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-capture.ts","../../src/shared/components/marquee-capture.tsx"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { CapturePlugin } from '@embedpdf/plugin-capture';\n\nexport const useCaptureCapability = () => useCapability<CapturePlugin>(CapturePlugin.id);\nexport const useCapturePlugin = () => usePlugin<CapturePlugin>(CapturePlugin.id);\n","import { useEffect, useState } from '@framework';\nimport { Rect } from '@embedpdf/models';\n\nimport { useCaptureCapability } from '../hooks/use-capture';\n\ninterface MarqueeCaptureProps {\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nexport const MarqueeCapture = ({\n pageIndex,\n scale,\n className,\n stroke = 'rgba(33,150,243,0.8)',\n fill = 'rgba(33,150,243,0.15)',\n}: MarqueeCaptureProps) => {\n const { provides: capturePlugin } = useCaptureCapability();\n const [rect, setRect] = useState<Rect | null>(null);\n\n useEffect(() => {\n if (!capturePlugin) return;\n return capturePlugin.registerMarqueeOnPage({\n pageIndex,\n scale,\n callback: {\n onPreview: setRect,\n },\n });\n }, [capturePlugin, pageIndex, scale]);\n\n if (!rect) return null;\n\n return (\n <div\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n left: rect.origin.x * scale,\n top: rect.origin.y * scale,\n width: rect.size.width * scale,\n height: rect.size.height * scale,\n border: `1px solid ${stroke}`,\n background: fill,\n boxSizing: 'border-box',\n }}\n className={className}\n />\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-capture.ts","../../src/shared/components/marquee-capture.tsx"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { CapturePlugin } from '@embedpdf/plugin-capture';\n\nexport const useCaptureCapability = () => useCapability<CapturePlugin>(CapturePlugin.id);\nexport const useCapturePlugin = () => usePlugin<CapturePlugin>(CapturePlugin.id);\n","import { useEffect, useState } from '@framework';\nimport { Rect } from '@embedpdf/models';\n\nimport { useCaptureCapability } from '../hooks/use-capture';\n\ninterface MarqueeCaptureProps {\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nexport const MarqueeCapture = ({\n pageIndex,\n scale,\n className,\n stroke = 'rgba(33,150,243,0.8)',\n fill = 'rgba(33,150,243,0.15)',\n}: MarqueeCaptureProps) => {\n const { provides: capturePlugin } = useCaptureCapability();\n const [rect, setRect] = useState<Rect | null>(null);\n\n useEffect(() => {\n if (!capturePlugin) return;\n return capturePlugin.registerMarqueeOnPage({\n pageIndex,\n scale,\n callback: {\n onPreview: setRect,\n },\n });\n }, [capturePlugin, pageIndex, scale]);\n\n if (!rect) return null;\n\n return (\n <div\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n left: rect.origin.x * scale,\n top: rect.origin.y * scale,\n width: rect.size.width * scale,\n height: rect.size.height * scale,\n border: `1px solid ${stroke}`,\n background: fill,\n boxSizing: 'border-box',\n }}\n className={className}\n />\n );\n};\n"],"names":[],"mappings":";;;;;AAGO,MAAM,uBAAuB,MAAM,cAA6B,cAAc,EAAE;AAChF,MAAM,mBAAmB,MAAM,UAAyB,cAAc,EAAE;ACaxE,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,OAAO;AACT,MAA2B;AACzB,QAAM,EAAE,UAAU,cAAc,IAAI,qBAAqB;AACzD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAsB,IAAI;AAElD,YAAU,MAAM;AACd,QAAI,CAAC,cAAe;AACpB,WAAO,cAAc,sBAAsB;AAAA,MACzC;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,WAAW;AAAA,MAAA;AAAA,IACb,CACD;AAAA,EACA,GAAA,CAAC,eAAe,WAAW,KAAK,CAAC;AAEhC,MAAA,CAAC,KAAa,QAAA;AAGhB,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,eAAe;AAAA,QACf,MAAM,KAAK,OAAO,IAAI;AAAA,QACtB,KAAK,KAAK,OAAO,IAAI;AAAA,QACrB,OAAO,KAAK,KAAK,QAAQ;AAAA,QACzB,QAAQ,KAAK,KAAK,SAAS;AAAA,QAC3B,QAAQ,aAAa,MAAM;AAAA,QAC3B,YAAY;AAAA,QACZ,WAAW;AAAA,MACb;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MarqueeCapture } from './marquee-capture.vue';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface MarqueeCaptureProps {
|
|
2
|
+
/** Index of the page this layer lives on */
|
|
3
|
+
pageIndex: number;
|
|
4
|
+
/** Scale of the page */
|
|
5
|
+
scale: number;
|
|
6
|
+
/** Optional CSS class applied to the marquee rectangle */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Stroke / fill colours (defaults below) */
|
|
9
|
+
stroke?: string;
|
|
10
|
+
fill?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: import('vue').DefineComponent<MarqueeCaptureProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<MarqueeCaptureProps> & Readonly<{}>, {
|
|
13
|
+
fill: string;
|
|
14
|
+
stroke: string;
|
|
15
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-capture';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CapturePlugin } from '../../lib/index.ts';
|
|
2
|
+
export declare const useCaptureCapability: () => import('@embedpdf/core/vue').CapabilityState<Readonly<import('../../lib/index.ts').CaptureCapability>>;
|
|
3
|
+
export declare const useCapturePlugin: () => import('@embedpdf/core/vue').PluginState<CapturePlugin>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core/vue"),a=require("@embedpdf/plugin-capture"),t=require("vue"),l=()=>e.useCapability(a.CapturePlugin.id),r=t.defineComponent({__name:"marquee-capture",props:{pageIndex:{},scale:{},className:{},stroke:{default:"rgba(33,150,243,0.8)"},fill:{default:"rgba(33,150,243,0.15)"}},setup(e){const a=e,{provides:r}=l(),o=t.ref(null);let u;return t.onMounted((()=>{r.value&&(u=r.value.registerMarqueeOnPage({pageIndex:a.pageIndex,scale:a.scale,callback:{onPreview:e=>{o.value=e}}}))})),t.onUnmounted((()=>{null==u||u()})),(e,a)=>o.value?(t.openBlock(),t.createElementBlock("div",{key:0,style:t.normalizeStyle({position:"absolute",pointerEvents:"none",left:o.value.origin.x*e.scale+"px",top:o.value.origin.y*e.scale+"px",width:o.value.size.width*e.scale+"px",height:o.value.size.height*e.scale+"px",border:`1px solid ${e.stroke}`,background:e.fill,boxSizing:"border-box"}),class:t.normalizeClass(e.className)},null,6)):t.createCommentVNode("",!0)}});exports.MarqueeCapture=r,exports.useCaptureCapability=l,exports.useCapturePlugin=()=>e.usePlugin(a.CapturePlugin.id),Object.keys(a).forEach((e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>a[e]})}));
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/vue/hooks/use-capture.ts","../../src/vue/components/marquee-capture.vue"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { CapturePlugin } from '@embedpdf/plugin-capture';\n\nexport const useCaptureCapability = () => useCapability<CapturePlugin>(CapturePlugin.id);\nexport const useCapturePlugin = () => usePlugin<CapturePlugin>(CapturePlugin.id);\n","<template>\n <div\n v-if=\"rect\"\n :style=\"{\n position: 'absolute',\n pointerEvents: 'none',\n left: `${rect.origin.x * scale}px`,\n top: `${rect.origin.y * scale}px`,\n width: `${rect.size.width * scale}px`,\n height: `${rect.size.height * scale}px`,\n border: `1px solid ${stroke}`,\n background: fill,\n boxSizing: 'border-box',\n }\"\n :class=\"className\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, onMounted, onUnmounted } from 'vue';\nimport type { Rect } from '@embedpdf/models';\nimport { useCaptureCapability } from '../hooks/use-capture';\n\ninterface MarqueeCaptureProps {\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nconst props = withDefaults(defineProps<MarqueeCaptureProps>(), {\n stroke: 'rgba(33,150,243,0.8)',\n fill: 'rgba(33,150,243,0.15)',\n});\n\nconst { provides: capturePlugin } = useCaptureCapability();\nconst rect = ref<Rect | null>(null);\n\nlet unregister: (() => void) | undefined;\n\nonMounted(() => {\n if (!capturePlugin.value) return;\n\n unregister = capturePlugin.value.registerMarqueeOnPage({\n pageIndex: props.pageIndex,\n scale: props.scale,\n callback: {\n onPreview: (newRect) => {\n rect.value = newRect;\n },\n },\n });\n});\n\nonUnmounted(() => {\n unregister?.();\n});\n</script>\n"],"names":["useCaptureCapability","useCapability","CapturePlugin","id","props","__props","provides","capturePlugin","rect","ref","unregister","onMounted","value","registerMarqueeOnPage","pageIndex","scale","callback","onPreview","newRect","onUnmounted","_createElementBlock","style","_normalizeStyle","left","origin","x","top","y","width","size","height","stroke","fill","class","className","usePlugin"],"mappings":"6KAGaA,EAAuB,IAAMC,gBAA6BC,EAAAA,cAAcC,qLCgCrF,MAAMC,EAAQC,GAKNC,SAAUC,GAAkBP,IAC9BQ,EAAOC,MAAiB,MAE1B,IAAAC,SAEJC,EAAAA,WAAU,KACHJ,EAAcK,QAENF,EAAAH,EAAcK,MAAMC,sBAAsB,CACrDC,UAAWV,EAAMU,UACjBC,MAAOX,EAAMW,MACbC,SAAU,CACRC,UAAYC,IACVV,EAAKI,MAAQM,CAAA,KAGlB,IAGHC,EAAAA,aAAY,KACG,MAAAT,GAAAA,GAAA,WA1DLF,EAAII,qBADZQ,EAAAA,mBAcE,MAAA,OAZCC,MAAKC,EAAAA,eAAA,0CAA4EC,KAAAf,EAAAI,MAAKY,OAAOC,EAAIV,EAAKA,MAArB,KAAyCW,IAAAlB,EAAAI,MAAKY,OAAOG,EAAIZ,EAAKA,MAArB,KAA2Ca,MAAApB,EAAAI,MAAKiB,KAAKD,MAAQb,EAAKA,MAAvB,KAA8Ce,OAAAtB,EAAAI,MAAKiB,KAAKC,OAASf,EAAKA,MAAxB,yBAAyDgB,EAAMA,oBAAsBC,EAAIA,8BAW5SC,uBAAOC,EAASA,qIDVW,IAAMC,YAAyBjC,EAAAA,cAAcC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useCapability, usePlugin } from "@embedpdf/core/vue";
|
|
2
|
+
import { CapturePlugin } from "@embedpdf/plugin-capture";
|
|
3
|
+
export * from "@embedpdf/plugin-capture";
|
|
4
|
+
import { defineComponent, ref, onMounted, onUnmounted, createElementBlock, createCommentVNode, openBlock, normalizeClass, normalizeStyle } from "vue";
|
|
5
|
+
const useCaptureCapability = () => useCapability(CapturePlugin.id);
|
|
6
|
+
const useCapturePlugin = () => usePlugin(CapturePlugin.id);
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
__name: "marquee-capture",
|
|
9
|
+
props: {
|
|
10
|
+
pageIndex: {},
|
|
11
|
+
scale: {},
|
|
12
|
+
className: {},
|
|
13
|
+
stroke: { default: "rgba(33,150,243,0.8)" },
|
|
14
|
+
fill: { default: "rgba(33,150,243,0.15)" }
|
|
15
|
+
},
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
const { provides: capturePlugin } = useCaptureCapability();
|
|
19
|
+
const rect = ref(null);
|
|
20
|
+
let unregister;
|
|
21
|
+
onMounted(() => {
|
|
22
|
+
if (!capturePlugin.value) return;
|
|
23
|
+
unregister = capturePlugin.value.registerMarqueeOnPage({
|
|
24
|
+
pageIndex: props.pageIndex,
|
|
25
|
+
scale: props.scale,
|
|
26
|
+
callback: {
|
|
27
|
+
onPreview: (newRect) => {
|
|
28
|
+
rect.value = newRect;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
onUnmounted(() => {
|
|
34
|
+
unregister == null ? void 0 : unregister();
|
|
35
|
+
});
|
|
36
|
+
return (_ctx, _cache) => {
|
|
37
|
+
return rect.value ? (openBlock(), createElementBlock("div", {
|
|
38
|
+
key: 0,
|
|
39
|
+
style: normalizeStyle({
|
|
40
|
+
position: "absolute",
|
|
41
|
+
pointerEvents: "none",
|
|
42
|
+
left: `${rect.value.origin.x * _ctx.scale}px`,
|
|
43
|
+
top: `${rect.value.origin.y * _ctx.scale}px`,
|
|
44
|
+
width: `${rect.value.size.width * _ctx.scale}px`,
|
|
45
|
+
height: `${rect.value.size.height * _ctx.scale}px`,
|
|
46
|
+
border: `1px solid ${_ctx.stroke}`,
|
|
47
|
+
background: _ctx.fill,
|
|
48
|
+
boxSizing: "border-box"
|
|
49
|
+
}),
|
|
50
|
+
class: normalizeClass(_ctx.className)
|
|
51
|
+
}, null, 6)) : createCommentVNode("", true);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
_sfc_main as MarqueeCapture,
|
|
57
|
+
useCaptureCapability,
|
|
58
|
+
useCapturePlugin
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/vue/hooks/use-capture.ts","../../src/vue/components/marquee-capture.vue"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { CapturePlugin } from '@embedpdf/plugin-capture';\n\nexport const useCaptureCapability = () => useCapability<CapturePlugin>(CapturePlugin.id);\nexport const useCapturePlugin = () => usePlugin<CapturePlugin>(CapturePlugin.id);\n","<template>\n <div\n v-if=\"rect\"\n :style=\"{\n position: 'absolute',\n pointerEvents: 'none',\n left: `${rect.origin.x * scale}px`,\n top: `${rect.origin.y * scale}px`,\n width: `${rect.size.width * scale}px`,\n height: `${rect.size.height * scale}px`,\n border: `1px solid ${stroke}`,\n background: fill,\n boxSizing: 'border-box',\n }\"\n :class=\"className\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, onMounted, onUnmounted } from 'vue';\nimport type { Rect } from '@embedpdf/models';\nimport { useCaptureCapability } from '../hooks/use-capture';\n\ninterface MarqueeCaptureProps {\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nconst props = withDefaults(defineProps<MarqueeCaptureProps>(), {\n stroke: 'rgba(33,150,243,0.8)',\n fill: 'rgba(33,150,243,0.15)',\n});\n\nconst { provides: capturePlugin } = useCaptureCapability();\nconst rect = ref<Rect | null>(null);\n\nlet unregister: (() => void) | undefined;\n\nonMounted(() => {\n if (!capturePlugin.value) return;\n\n unregister = capturePlugin.value.registerMarqueeOnPage({\n pageIndex: props.pageIndex,\n scale: props.scale,\n callback: {\n onPreview: (newRect) => {\n rect.value = newRect;\n },\n },\n });\n});\n\nonUnmounted(() => {\n unregister?.();\n});\n</script>\n"],"names":["_createElementBlock","_normalizeStyle","scale","stroke","fill","className"],"mappings":";;;;AAGO,MAAM,uBAAuB,MAAM,cAA6B,cAAc,EAAE;AAChF,MAAM,mBAAmB,MAAM,UAAyB,cAAc,EAAE;;;;;;;;;;;AC+B/E,UAAM,QAAQ;AAKd,UAAM,EAAE,UAAU,cAAc,IAAI,qBAAqB;AACnD,UAAA,OAAO,IAAiB,IAAI;AAE9B,QAAA;AAEJ,cAAU,MAAM;AACV,UAAA,CAAC,cAAc,MAAO;AAEb,mBAAA,cAAc,MAAM,sBAAsB;AAAA,QACrD,WAAW,MAAM;AAAA,QACjB,OAAO,MAAM;AAAA,QACb,UAAU;AAAA,UACR,WAAW,CAAC,YAAY;AACtB,iBAAK,QAAQ;AAAA,UAAA;AAAA,QACf;AAAA,MACF,CACD;AAAA,IAAA,CACF;AAED,gBAAY,MAAM;AACH;AAAA,IAAA,CACd;;aA3DS,KAAI,sBADZA,mBAcE,OAAA;AAAA;QAZC,OAAKC,eAAA;AAAA;;UAA4E,MAAA,GAAA,KAAA,MAAK,OAAO,IAAIC,KAAK,KAAA;AAAA,UAAoB,KAAA,GAAA,KAAA,MAAK,OAAO,IAAIA,KAAK,KAAA;AAAA,UAAsB,OAAA,GAAA,KAAA,MAAK,KAAK,QAAQA,KAAK,KAAA;AAAA,UAAuB,QAAA,GAAA,KAAA,MAAK,KAAK,SAASA,KAAK,KAAA;AAAA,+BAAiCC,KAAM,MAAA;AAAA,sBAAsBC,KAAI;AAAA;;QAW5S,sBAAOC,KAAS,SAAA;AAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/plugin-capture",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -20,26 +20,32 @@
|
|
|
20
20
|
"types": "./dist/react/index.d.ts",
|
|
21
21
|
"import": "./dist/react/index.js",
|
|
22
22
|
"require": "./dist/react/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./vue": {
|
|
25
|
+
"types": "./dist/vue/index.d.ts",
|
|
26
|
+
"import": "./dist/vue/index.js",
|
|
27
|
+
"require": "./dist/vue/index.cjs"
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
30
|
"dependencies": {
|
|
26
|
-
"@embedpdf/models": "1.0.
|
|
31
|
+
"@embedpdf/models": "1.0.21"
|
|
27
32
|
},
|
|
28
33
|
"devDependencies": {
|
|
29
34
|
"@types/react": "^18.2.0",
|
|
30
35
|
"typescript": "^5.0.0",
|
|
31
36
|
"@embedpdf/build": "1.0.0",
|
|
32
|
-
"@embedpdf/core": "1.0.
|
|
33
|
-
"@embedpdf/plugin-
|
|
34
|
-
"@embedpdf/plugin-
|
|
37
|
+
"@embedpdf/core": "1.0.21",
|
|
38
|
+
"@embedpdf/plugin-render": "1.0.21",
|
|
39
|
+
"@embedpdf/plugin-interaction-manager": "1.0.21"
|
|
35
40
|
},
|
|
36
41
|
"peerDependencies": {
|
|
37
42
|
"react": ">=16.8.0",
|
|
38
43
|
"react-dom": ">=16.8.0",
|
|
39
44
|
"preact": "^10.26.4",
|
|
40
|
-
"
|
|
41
|
-
"@embedpdf/
|
|
42
|
-
"@embedpdf/plugin-interaction-manager": "1.0.
|
|
45
|
+
"vue": ">=3.2.0",
|
|
46
|
+
"@embedpdf/core": "1.0.21",
|
|
47
|
+
"@embedpdf/plugin-interaction-manager": "1.0.21",
|
|
48
|
+
"@embedpdf/plugin-render": "1.0.21"
|
|
43
49
|
},
|
|
44
50
|
"files": [
|
|
45
51
|
"dist",
|
|
@@ -61,7 +67,8 @@
|
|
|
61
67
|
"build:base": "vite build --mode base",
|
|
62
68
|
"build:react": "vite build --mode react",
|
|
63
69
|
"build:preact": "vite build --mode preact",
|
|
64
|
-
"build": "
|
|
70
|
+
"build:vue": "vite build --mode vue",
|
|
71
|
+
"build": "pnpm run clean && concurrently -c auto -n base,react,preact,vue \"vite build --mode base\" \"vite build --mode react\" \"vite build --mode preact\" \"vite build --mode vue\"",
|
|
65
72
|
"clean": "rimraf dist",
|
|
66
73
|
"lint": "eslint src --color",
|
|
67
74
|
"lint:fix": "eslint src --color --fix"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@embedpdf/plugin-interaction-manager/preact';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@embedpdf/plugin-interaction-manager/react';
|