@embedpdf/plugin-pan 1.3.16 → 1.4.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.
@@ -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
+ 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=u(),t=i.proxy({get provides(){return e.provides},isPanning:!1});return i.user_effect((()=>{if(e.provides)return e.provides.onPanModeChange((e=>{t.isPanning=e}))})),t},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 capability = usePanCapability();\n\n const state = $state({\n get provides() {\n return capability.provides;\n },\n isPanning: false,\n });\n\n $effect(() => {\n if (!capability.provides) return;\n return capability.provides.onPanModeChange((isPanningState) => {\n state.isPanning = isPanningState;\n });\n });\n\n return state;\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","capability","state","isPanning","onPanModeChange","isPanningState"],"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,yEFFhF,MAAAC,EAAavB,IAEbwB,WACA,YAAAtB,GACK,OAAAqB,EAAWrB,QACpB,EACAuB,WAAW,IAUN,OAPPnB,EAAAC,kBACO,GAAAgB,EAAWrB,SACT,OAAAqB,EAAWrB,SAASwB,iBAAiBC,IAC1CH,EAAMC,UAAYE,CAAA,GACnB,IAGIH,CAAA"}
@@ -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,48 @@
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 capability = usePanCapability();
11
+ const state = $.proxy({
12
+ get provides() {
13
+ return capability.provides;
14
+ },
15
+ isPanning: false
16
+ });
17
+ $.user_effect(() => {
18
+ if (!capability.provides) return;
19
+ return capability.provides.onPanModeChange((isPanningState) => {
20
+ state.isPanning = isPanningState;
21
+ });
22
+ });
23
+ return state;
24
+ };
25
+ function PanMode($$anchor, $$props) {
26
+ $.push($$props, true);
27
+ const { provides: pan } = usePanCapability();
28
+ const { plugin: panPlugin } = usePanPlugin();
29
+ $.user_effect(() => {
30
+ var _a;
31
+ if (!pan || !panPlugin) return;
32
+ const mode = ((_a = panPlugin.config) == null ? void 0 : _a.defaultMode) ?? "never";
33
+ const SUPPORT_TOUCH = typeof window !== "undefined" && ("ontouchstart" in window || navigator.maxTouchPoints > 0);
34
+ if (mode === "mobile" && SUPPORT_TOUCH) {
35
+ pan.makePanDefault();
36
+ }
37
+ });
38
+ $.pop();
39
+ }
40
+ const PanPluginPackage = createPluginPackage(PanPluginPackage$1).addUtility(PanMode).build();
41
+ export {
42
+ PanMode,
43
+ PanPluginPackage,
44
+ usePan,
45
+ usePanCapability,
46
+ usePanPlugin
47
+ };
48
+ //# 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 capability = usePanCapability();\n\n const state = $state({\n get provides() {\n return capability.provides;\n },\n isPanning: false,\n });\n\n $effect(() => {\n if (!capability.provides) return;\n return capability.provides.onPanModeChange((isPanningState) => {\n state.isPanning = isPanningState;\n });\n });\n\n return state;\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;AACpB,QAAA,aAAa,iBAAiB;QAE9B;IACA,IAAA,WAAW;AACN,aAAA,WAAW;AAAA,IACpB;AAAA,IACA,WAAW;AAAA;AAGb,IAAA,kBAAc;AACP,QAAA,CAAA,WAAW,SAAU;AACnB,WAAA,WAAW,SAAS,gBAAiB,CAAA,mBAAmB;AAC7D,YAAM,YAAY;AAAA,KACnB;AAAA,GACF;SAEM;AACT;oCCxBA;;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.16",
3
+ "version": "1.4.1",
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.16"
37
+ "@embedpdf/models": "1.4.1"
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.16",
39
- "@embedpdf/plugin-viewport": "1.3.16"
42
+ "@embedpdf/build": "1.1.0",
43
+ "@embedpdf/plugin-interaction-manager": "1.4.1",
44
+ "@embedpdf/plugin-viewport": "1.4.1"
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.16",
47
- "@embedpdf/plugin-interaction-manager": "1.3.16",
48
- "@embedpdf/plugin-viewport": "1.3.16"
51
+ "svelte": ">=5 <6",
52
+ "@embedpdf/core": "1.4.1",
53
+ "@embedpdf/plugin-interaction-manager": "1.4.1",
54
+ "@embedpdf/plugin-viewport": "1.4.1"
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"