@embedpdf/plugin-pan 1.3.15 → 1.4.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.
@@ -0,0 +1 @@
1
+ export * from './pan-mode';
@@ -0,0 +1 @@
1
+ export declare const PanMode: () => null;
@@ -0,0 +1 @@
1
+ export * from './use-pan';
@@ -0,0 +1,15 @@
1
+ import { PanPlugin } from '../../index.ts';
2
+ export declare const usePanPlugin: () => {
3
+ plugin: PanPlugin | null;
4
+ isLoading: boolean;
5
+ ready: Promise<void>;
6
+ };
7
+ export declare const usePanCapability: () => {
8
+ provides: Readonly<import('../../index.ts').PanCapability> | null;
9
+ isLoading: boolean;
10
+ ready: Promise<void>;
11
+ };
12
+ export declare const usePan: () => {
13
+ provides: Readonly<import('../../index.ts').PanCapability> | null;
14
+ isPanning: boolean;
15
+ };
@@ -0,0 +1,4 @@
1
+ export * from './hooks';
2
+ export * from './components';
3
+ export * from '../index.ts';
4
+ export declare const PanPluginPackage: import('@embedpdf/core').WithAutoMount<import('@embedpdf/core').PluginPackage<import('../index.ts').PanPlugin, import('../index.ts').PanPluginConfig, unknown, import('@embedpdf/core').Action>>;
@@ -0,0 +1,3 @@
1
+ declare const PanMode: import('svelte', { with: { "resolution-mode": "import" } }).Component<Record<string, never>, {}, "">;
2
+ type PanMode = ReturnType<typeof PanMode>;
3
+ export default PanMode;
@@ -0,0 +1 @@
1
+ export { default as PanMode } from './PanMode.svelte';
@@ -0,0 +1 @@
1
+ export * from './use-pan.svelte';
@@ -0,0 +1,15 @@
1
+ import { PanPlugin } from '../../lib/index.ts';
2
+ export declare const usePanPlugin: () => {
3
+ plugin: PanPlugin | null;
4
+ isLoading: boolean;
5
+ ready: Promise<void>;
6
+ };
7
+ export declare const usePanCapability: () => {
8
+ provides: Readonly<import('../../lib/index.ts').PanCapability> | null;
9
+ isLoading: boolean;
10
+ ready: Promise<void>;
11
+ };
12
+ export declare const usePan: () => {
13
+ readonly provides: Readonly<import('../../lib/index.ts').PanCapability> | null;
14
+ readonly isPanning: boolean;
15
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/plugin-pan");require("svelte/internal/disclose-version");const n=require("svelte/internal/client"),r=require("@embedpdf/core/svelte");function o(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const i=o(n),a=()=>r.usePlugin(t.PanPlugin.id),u=()=>r.useCapability(t.PanPlugin.id);function s(e,t){i.push(t,!0);const{provides:n}=u(),{plugin:r}=a();i.user_effect((()=>{var e;if(!n||!r)return;const t=(null==(e=r.config)?void 0:e.defaultMode)??"never",o="undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0);"mobile"===t&&o&&n.makePanDefault()})),i.pop()}const l=e.createPluginPackage(t.PanPluginPackage).addUtility(s).build();exports.PanMode=s,exports.PanPluginPackage=l,exports.usePan=()=>{const e=i.derived(u),t=i.derived((()=>i.get(e).provides));let n=i.state(!1);return i.user_effect((()=>{if(i.get(t))return i.get(t).onPanModeChange((e=>{i.set(n,e,!0)}))})),{get provides(){return i.get(t)},get isPanning(){return i.get(n)}}},exports.usePanCapability=u,exports.usePanPlugin=a,Object.keys(t).forEach((e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})}));
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/svelte/hooks/use-pan.svelte.ts","../../src/svelte/components/PanMode.svelte","../../src/svelte/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\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 } = $derived(usePanCapability());\n let isPanning = $state(false);\n\n $effect(() => {\n if (!provides) return;\n return provides.onPanModeChange((isPanningState) => {\n isPanning = isPanningState;\n });\n });\n\n return {\n get provides() {\n return provides;\n },\n get isPanning() {\n return isPanning;\n },\n };\n};\n","<script lang=\"ts\">\n import { usePanCapability, usePanPlugin } from '../hooks';\n\n const { provides: pan } = usePanCapability();\n const { plugin: panPlugin } = usePanPlugin();\n\n $effect(() => {\n if (!pan || !panPlugin) return;\n\n const mode = panPlugin.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.makePanDefault();\n }\n });\n</script>\n\n<!-- This component is only used to make the pan mode default when the plugin is initialized. -->\n","import { createPluginPackage } from '@embedpdf/core';\nimport { PanPluginPackage as BasePanPackage } from '@embedpdf/plugin-pan';\n\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","$","user_effect","mode","_a","config","defaultMode","SUPPORT_TOUCH","window","navigator","maxTouchPoints","makePanDefault","PanPluginPackage","createPluginPackage","BasePanPackage","addUtility","PanMode","build","isPanning","get","onPanModeChange","isPanningState","$__namespace","set"],"mappings":"qiBAGaA,EAAqB,IAAAC,YAAqBC,EAAAA,UAAUC,IACpDC,EAAyB,IAAAC,gBAAyBH,EAAAA,UAAUC,uCCD/DG,SAAUC,GAAQH,KAClBI,OAAQC,GAAcT,IAE9BU,EAAAC,aAAc,WACP,IAAAJ,IAAQE,EAAS,OAEhB,MAAAG,GAAO,OAAAC,EAAAJ,EAAUK,aAAV,EAAAD,EAAkBE,cAAe,QACxCC,EACc,oBAAXC,SAA2B,iBAAkBA,QAAUC,UAAUC,eAAiB,GAE9E,WAATP,GAAqBI,GACvBT,EAAIa,gBACN,WAEJ,CCRO,MAAMC,EAAmBC,EAAoBA,oBAAAC,EAAcF,kBAAEG,WAAWC,GAASC,2FFFxDtB,GAAtBE,0BAAAA,WACJ,IAAAqB,WAAmB,UAEvBjB,EAAAC,2BACOL,GACE,OAAAI,EAAAkB,IAAAtB,GAASuB,iBAAiBC,IACnBC,EAAAC,IAAAL,EAAAG,GAAA,EAAA,GACb,KAIG,YAAAxB,gBACKA,EACT,EACI,aAAAqB,gBACKA"}
@@ -0,0 +1,4 @@
1
+ export * from './hooks';
2
+ export * from './components';
3
+ export * from '../lib/index.ts';
4
+ export declare const PanPluginPackage: import('@embedpdf/core').WithAutoMount<import('@embedpdf/core').PluginPackage<import('../lib/index.ts').PanPlugin, import('../lib/index.ts').PanPluginConfig, unknown, import('@embedpdf/core').Action>>;
@@ -0,0 +1,50 @@
1
+ import { createPluginPackage } from "@embedpdf/core";
2
+ import { PanPlugin, PanPluginPackage as PanPluginPackage$1 } from "@embedpdf/plugin-pan";
3
+ export * from "@embedpdf/plugin-pan";
4
+ import "svelte/internal/disclose-version";
5
+ import * as $ from "svelte/internal/client";
6
+ import { useCapability, usePlugin } from "@embedpdf/core/svelte";
7
+ const usePanPlugin = () => usePlugin(PanPlugin.id);
8
+ const usePanCapability = () => useCapability(PanPlugin.id);
9
+ const usePan = () => {
10
+ const $$d = $.derived(usePanCapability), provides = $.derived(() => $.get($$d).provides);
11
+ let isPanning = $.state(false);
12
+ $.user_effect(() => {
13
+ if (!$.get(provides)) return;
14
+ return $.get(provides).onPanModeChange((isPanningState) => {
15
+ $.set(isPanning, isPanningState, true);
16
+ });
17
+ });
18
+ return {
19
+ get provides() {
20
+ return $.get(provides);
21
+ },
22
+ get isPanning() {
23
+ return $.get(isPanning);
24
+ }
25
+ };
26
+ };
27
+ function PanMode($$anchor, $$props) {
28
+ $.push($$props, true);
29
+ const { provides: pan } = usePanCapability();
30
+ const { plugin: panPlugin } = usePanPlugin();
31
+ $.user_effect(() => {
32
+ var _a;
33
+ if (!pan || !panPlugin) return;
34
+ const mode = ((_a = panPlugin.config) == null ? void 0 : _a.defaultMode) ?? "never";
35
+ const SUPPORT_TOUCH = typeof window !== "undefined" && ("ontouchstart" in window || navigator.maxTouchPoints > 0);
36
+ if (mode === "mobile" && SUPPORT_TOUCH) {
37
+ pan.makePanDefault();
38
+ }
39
+ });
40
+ $.pop();
41
+ }
42
+ const PanPluginPackage = createPluginPackage(PanPluginPackage$1).addUtility(PanMode).build();
43
+ export {
44
+ PanMode,
45
+ PanPluginPackage,
46
+ usePan,
47
+ usePanCapability,
48
+ usePanPlugin
49
+ };
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/svelte/hooks/use-pan.svelte.ts","../../src/svelte/components/PanMode.svelte","../../src/svelte/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\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 } = $derived(usePanCapability());\n let isPanning = $state(false);\n\n $effect(() => {\n if (!provides) return;\n return provides.onPanModeChange((isPanningState) => {\n isPanning = isPanningState;\n });\n });\n\n return {\n get provides() {\n return provides;\n },\n get isPanning() {\n return isPanning;\n },\n };\n};\n","<script lang=\"ts\">\n import { usePanCapability, usePanPlugin } from '../hooks';\n\n const { provides: pan } = usePanCapability();\n const { plugin: panPlugin } = usePanPlugin();\n\n $effect(() => {\n if (!pan || !panPlugin) return;\n\n const mode = panPlugin.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.makePanDefault();\n }\n });\n</script>\n\n<!-- This component is only used to make the pan mode default when the plugin is initialized. -->\n","import { createPluginPackage } from '@embedpdf/core';\nimport { PanPluginPackage as BasePanPackage } from '@embedpdf/plugin-pan';\n\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"],"mappings":";;;;;;AAGa,MAAA,eAAqB,MAAA,UAAqB,UAAU,EAAE;AACtD,MAAA,mBAAyB,MAAA,cAAyB,UAAU,EAAE;AAE9D,MAAA,eAAe;wBACI,mBAAtB,sCAAA,QAAA;AACJ,MAAA,oBAAmB,KAAK;AAE5B,IAAA,kBAAc;eACP,QAAU,EAAA;AACR,WAAA,EAAA,IAAA,QAAA,EAAS,gBAAiB,CAAA,mBAAmB;AACtC,QAAA,IAAA,WAAA,gBAAA,IAAA;AAAA,KACb;AAAA,GACF;;IAGK,IAAA,WAAW;mBACN,QAAA;AAAA,IACT;AAAA,IACI,IAAA,YAAY;mBACP,SAAA;AAAA;;AAGb;oCCzBA;;UAGU,UAAU,IAAG,IAAK,iBAAgB;UAClC,QAAQ,UAAS,IAAK,aAAY;AAE1C,IAAA,YAAc,MAAA;;AACP,QAAA,CAAA,QAAQ,UAAS;AAEhB,UAAA,SAAO,eAAU,WAAV,mBAAkB,gBAAe;AACxC,UAAA,gBACG,OAAA,WAAW,gBAAgB,kBAAkB,UAAU,UAAU,iBAAiB;AAEvF,QAAA,SAAS,YAAY,eAAe;AACtC,UAAI,eAAc;AAAA,IACpB;AAAA,GACD;;AACH;ACRO,MAAM,mBAAmB,oBAAoBA,kBAAc,EAAE,WAAW,OAAO,EAAE,MAAM;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/plugin-pan",
3
- "version": "1.3.15",
3
+ "version": "1.4.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.cjs",
@@ -26,26 +26,32 @@
26
26
  "types": "./dist/vue/index.d.ts",
27
27
  "import": "./dist/vue/index.js",
28
28
  "require": "./dist/vue/index.cjs"
29
+ },
30
+ "./svelte": {
31
+ "types": "./dist/svelte/index.d.ts",
32
+ "import": "./dist/svelte/index.js",
33
+ "require": "./dist/svelte/index.cjs"
29
34
  }
30
35
  },
31
36
  "dependencies": {
32
- "@embedpdf/models": "1.3.15"
37
+ "@embedpdf/models": "1.4.0"
33
38
  },
34
39
  "devDependencies": {
35
40
  "@types/react": "^18.2.0",
36
41
  "typescript": "^5.0.0",
37
- "@embedpdf/build": "1.0.1",
38
- "@embedpdf/plugin-interaction-manager": "1.3.15",
39
- "@embedpdf/plugin-viewport": "1.3.15"
42
+ "@embedpdf/plugin-interaction-manager": "1.4.0",
43
+ "@embedpdf/build": "1.1.0",
44
+ "@embedpdf/plugin-viewport": "1.4.0"
40
45
  },
41
46
  "peerDependencies": {
42
47
  "react": ">=16.8.0",
43
48
  "react-dom": ">=16.8.0",
44
49
  "preact": "^10.26.4",
45
50
  "vue": ">=3.2.0",
46
- "@embedpdf/core": "1.3.15",
47
- "@embedpdf/plugin-viewport": "1.3.15",
48
- "@embedpdf/plugin-interaction-manager": "1.3.15"
51
+ "svelte": ">=5 <6",
52
+ "@embedpdf/core": "1.4.0",
53
+ "@embedpdf/plugin-viewport": "1.4.0",
54
+ "@embedpdf/plugin-interaction-manager": "1.4.0"
49
55
  },
50
56
  "files": [
51
57
  "dist",
@@ -68,7 +74,8 @@
68
74
  "build:react": "vite build --mode react",
69
75
  "build:preact": "vite build --mode preact",
70
76
  "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\"",
77
+ "build:svelte": "vite build --mode svelte",
78
+ "build": "pnpm run clean && concurrently -c auto -n base,react,preact,vue,svelte \"vite build --mode base\" \"vite build --mode react\" \"vite build --mode preact\" \"vite build --mode vue\" \"vite build --mode svelte\"",
72
79
  "clean": "rimraf dist",
73
80
  "lint": "eslint src --color",
74
81
  "lint:fix": "eslint src --color --fix"