@embedpdf/plugin-pan 1.0.26 → 1.1.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/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +13 -10
- package/dist/vue/index.js.map +1 -1
- package/package.json +7 -7
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"),n=require("@embedpdf/plugin-pan"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),n=require("@embedpdf/plugin-pan"),a=require("vue"),t=require("@embedpdf/core/vue"),o=()=>t.usePlugin(n.PanPlugin.id),i=()=>t.useCapability(n.PanPlugin.id),r=a.defineComponent({__name:"pan-mode",setup(e){const{provides:n}=i(),{plugin:t}=o();return a.onMounted((()=>{a.watchEffect((()=>{var e;if(!n.value||!t.value)return;const a=(null==(e=t.value.config)?void 0:e.defaultMode)??"never",o="undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0);"mobile"===a&&o&&n.value.makePanDefault()}))})),(e,n)=>null}}),u=e.createPluginPackage(n.PanPluginPackage).addUtility(r).build();exports.PanMode=r,exports.PanPluginPackage=u,exports.usePan=()=>{const{provides:e}=i(),n=a.ref(!1);return a.watch(e,((e,a,t)=>{if(e){t(e.onPanModeChange((e=>{n.value=e})))}}),{immediate:!0}),{provides:e,isPanning:n}},exports.usePanCapability=i,exports.usePanPlugin=o,Object.keys(n).forEach((e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>n[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-pan.ts","../../src/vue/components/pan-mode.vue","../../src/vue/index.ts"],"sourcesContent":["import { ref,
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/vue/hooks/use-pan.ts","../../src/vue/components/pan-mode.vue","../../src/vue/index.ts"],"sourcesContent":["import { ref, watch } from 'vue';\nimport { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { PanPlugin } from '@embedpdf/plugin-pan';\n\nexport const usePanPlugin = () => usePlugin<PanPlugin>(PanPlugin.id);\nexport const usePanCapability = () => useCapability<PanPlugin>(PanPlugin.id);\n\nexport const usePan = () => {\n const { provides } = usePanCapability();\n const isPanning = ref(false);\n\n watch(\n provides,\n (providesValue, _, onCleanup) => {\n if (providesValue) {\n const unsubscribe = providesValue.onPanModeChange((panning) => {\n isPanning.value = panning;\n });\n onCleanup(unsubscribe);\n }\n },\n { immediate: true },\n );\n\n return {\n provides,\n isPanning,\n };\n};\n","<template>\n <!-- This component is only used to make the pan mode default when the plugin is initialized -->\n</template>\n\n<script setup lang=\"ts\">\nimport { onMounted, watchEffect } from 'vue';\nimport { usePanCapability, usePanPlugin } from '../hooks/use-pan';\n\nconst { provides: pan } = usePanCapability();\nconst { plugin: panPlugin } = usePanPlugin();\n\nonMounted(() => {\n watchEffect(() => {\n if (!pan.value || !panPlugin.value) return;\n\n const mode = panPlugin.value.config?.defaultMode ?? 'never';\n const SUPPORT_TOUCH =\n typeof window !== 'undefined' && ('ontouchstart' in window || navigator.maxTouchPoints > 0);\n\n if (mode === 'mobile' && SUPPORT_TOUCH) {\n pan.value.makePanDefault();\n }\n });\n});\n</script>\n","import { createPluginPackage } from '@embedpdf/core';\nimport { PanPluginPackage as BasePanPackage } from '@embedpdf/plugin-pan';\nimport { PanMode } from './components';\n\nexport * from './hooks';\nexport * from './components';\nexport * from '@embedpdf/plugin-pan';\n\nexport const PanPluginPackage = createPluginPackage(BasePanPackage).addUtility(PanMode).build();\n"],"names":["usePanPlugin","usePlugin","PanPlugin","id","usePanCapability","useCapability","provides","pan","plugin","panPlugin","onMounted","watchEffect","value","mode","_a","config","defaultMode","SUPPORT_TOUCH","window","navigator","maxTouchPoints","makePanDefault","PanPluginPackage","createPluginPackage","BasePanPackage","addUtility","PanMode","build","isPanning","ref","vue$1","watch","providesValue","_","onCleanup","onPanModeChange","panning","immediate"],"mappings":"qMAIaA,EAAe,IAAMC,YAAqBC,EAAAA,UAAUC,IACpDC,EAAmB,IAAMC,gBAAyBH,EAAAA,UAAUC,oDCGzE,MAAQG,SAAUC,GAAQH,KAClBI,OAAQC,GAAcT,WAE9BU,EAAAA,WAAU,KACRC,EAAAA,aAAY,WACV,IAAKJ,EAAIK,QAAUH,EAAUG,MAAO,OAEpC,MAAMC,GAAO,OAAAC,EAAAL,EAAUG,MAAMG,iBAAQC,cAAe,QAC9CC,EACc,oBAAXC,SAA2B,iBAAkBA,QAAUC,UAAUC,eAAiB,GAE9E,WAATP,GAAqBI,GACvBV,EAAIK,MAAMS,gBAAe,GAE5B,mBCdUC,EAAmBC,EAAoBA,oBAAAC,EAAcF,kBAAEG,WAAWC,GAASC,oEFDlE,KACd,MAAArB,SAAEA,GAAaF,IACfwB,EAAYC,OAAI,GAef,OAbPC,EAAAC,MACEzB,GACA,CAAC0B,EAAeC,EAAGC,KACjB,GAAIF,EAAe,CAIjBE,EAHoBF,EAAcG,iBAAiBC,IACjDR,EAAUhB,MAAQwB,CAAA,IAEC,IAGzB,CAAEC,WAAW,IAGR,CACL/B,WACAsB,YACF"}
|
package/dist/vue/index.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { createPluginPackage } from "@embedpdf/core";
|
|
2
2
|
import { PanPlugin, PanPluginPackage as PanPluginPackage$1 } from "@embedpdf/plugin-pan";
|
|
3
3
|
export * from "@embedpdf/plugin-pan";
|
|
4
|
-
import { ref,
|
|
4
|
+
import { ref, watch, defineComponent, onMounted, watchEffect } from "vue";
|
|
5
5
|
import { useCapability, usePlugin } from "@embedpdf/core/vue";
|
|
6
6
|
const usePanPlugin = () => usePlugin(PanPlugin.id);
|
|
7
7
|
const usePanCapability = () => useCapability(PanPlugin.id);
|
|
8
8
|
const usePan = () => {
|
|
9
9
|
const { provides } = usePanCapability();
|
|
10
10
|
const isPanning = ref(false);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
watch(
|
|
12
|
+
provides,
|
|
13
|
+
(providesValue, _, onCleanup) => {
|
|
14
|
+
if (providesValue) {
|
|
15
|
+
const unsubscribe = providesValue.onPanModeChange((panning) => {
|
|
16
|
+
isPanning.value = panning;
|
|
17
|
+
});
|
|
18
|
+
onCleanup(unsubscribe);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{ immediate: true }
|
|
22
|
+
);
|
|
20
23
|
return {
|
|
21
24
|
provides,
|
|
22
25
|
isPanning
|
package/dist/vue/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/vue/hooks/use-pan.ts","../../src/vue/components/pan-mode.vue","../../src/vue/index.ts"],"sourcesContent":["import { ref,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/vue/hooks/use-pan.ts","../../src/vue/components/pan-mode.vue","../../src/vue/index.ts"],"sourcesContent":["import { ref, watch } from 'vue';\nimport { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { PanPlugin } from '@embedpdf/plugin-pan';\n\nexport const usePanPlugin = () => usePlugin<PanPlugin>(PanPlugin.id);\nexport const usePanCapability = () => useCapability<PanPlugin>(PanPlugin.id);\n\nexport const usePan = () => {\n const { provides } = usePanCapability();\n const isPanning = ref(false);\n\n watch(\n provides,\n (providesValue, _, onCleanup) => {\n if (providesValue) {\n const unsubscribe = providesValue.onPanModeChange((panning) => {\n isPanning.value = panning;\n });\n onCleanup(unsubscribe);\n }\n },\n { immediate: true },\n );\n\n return {\n provides,\n isPanning,\n };\n};\n","<template>\n <!-- This component is only used to make the pan mode default when the plugin is initialized -->\n</template>\n\n<script setup lang=\"ts\">\nimport { onMounted, watchEffect } from 'vue';\nimport { usePanCapability, usePanPlugin } from '../hooks/use-pan';\n\nconst { provides: pan } = usePanCapability();\nconst { plugin: panPlugin } = usePanPlugin();\n\nonMounted(() => {\n watchEffect(() => {\n if (!pan.value || !panPlugin.value) return;\n\n const mode = panPlugin.value.config?.defaultMode ?? 'never';\n const SUPPORT_TOUCH =\n typeof window !== 'undefined' && ('ontouchstart' in window || navigator.maxTouchPoints > 0);\n\n if (mode === 'mobile' && SUPPORT_TOUCH) {\n pan.value.makePanDefault();\n }\n });\n});\n</script>\n","import { createPluginPackage } from '@embedpdf/core';\nimport { PanPluginPackage as BasePanPackage } from '@embedpdf/plugin-pan';\nimport { PanMode } from './components';\n\nexport * from './hooks';\nexport * from './components';\nexport * from '@embedpdf/plugin-pan';\n\nexport const PanPluginPackage = createPluginPackage(BasePanPackage).addUtility(PanMode).build();\n"],"names":["BasePanPackage","PanMode"],"mappings":";;;;;AAIO,MAAM,eAAe,MAAM,UAAqB,UAAU,EAAE;AAC5D,MAAM,mBAAmB,MAAM,cAAyB,UAAU,EAAE;AAEpE,MAAM,SAAS,MAAM;AACpB,QAAA,EAAE,SAAS,IAAI,iBAAiB;AAChC,QAAA,YAAY,IAAI,KAAK;AAE3B;AAAA,IACE;AAAA,IACA,CAAC,eAAe,GAAG,cAAc;AAC/B,UAAI,eAAe;AACjB,cAAM,cAAc,cAAc,gBAAgB,CAAC,YAAY;AAC7D,oBAAU,QAAQ;AAAA,QAAA,CACnB;AACD,kBAAU,WAAW;AAAA,MAAA;AAAA,IAEzB;AAAA,IACA,EAAE,WAAW,KAAK;AAAA,EACpB;AAEO,SAAA;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;;;;ACpBA,UAAM,EAAE,UAAU,IAAI,IAAI,iBAAiB;AAC3C,UAAM,EAAE,QAAQ,UAAU,IAAI,aAAa;AAE3C,cAAU,MAAM;AACd,kBAAY,MAAM;;AAChB,YAAI,CAAC,IAAI,SAAS,CAAC,UAAU,MAAO;AAEpC,cAAM,SAAO,eAAU,MAAM,WAAhB,mBAAwB,gBAAe;AACpD,cAAM,gBACJ,OAAO,WAAW,gBAAgB,kBAAkB,UAAU,UAAU,iBAAiB;AAEvF,YAAA,SAAS,YAAY,eAAe;AACtC,cAAI,MAAM,eAAe;AAAA,QAAA;AAAA,MAC3B,CACD;AAAA,IAAA,CACF;;;;;;ACfM,MAAM,mBAAmB,oBAAoBA,kBAAc,EAAE,WAAWC,SAAO,EAAE,MAAM;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/plugin-pan",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -28,23 +28,23 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@embedpdf/models": "1.
|
|
31
|
+
"@embedpdf/models": "1.1.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/react": "^18.2.0",
|
|
35
35
|
"typescript": "^5.0.0",
|
|
36
36
|
"@embedpdf/build": "1.0.0",
|
|
37
|
-
"@embedpdf/plugin-interaction-manager": "1.
|
|
38
|
-
"@embedpdf/plugin-viewport": "1.
|
|
37
|
+
"@embedpdf/plugin-interaction-manager": "1.1.1",
|
|
38
|
+
"@embedpdf/plugin-viewport": "1.1.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=16.8.0",
|
|
42
42
|
"react-dom": ">=16.8.0",
|
|
43
43
|
"preact": "^10.26.4",
|
|
44
44
|
"vue": ">=3.2.0",
|
|
45
|
-
"@embedpdf/core": "1.
|
|
46
|
-
"@embedpdf/plugin-
|
|
47
|
-
"@embedpdf/plugin-
|
|
45
|
+
"@embedpdf/core": "1.1.1",
|
|
46
|
+
"@embedpdf/plugin-viewport": "1.1.1",
|
|
47
|
+
"@embedpdf/plugin-interaction-manager": "1.1.1"
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
50
|
"dist",
|