@embedpdf/plugin-spread 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.
- package/dist/shared/hooks/index.d.ts +1 -0
- package/dist/shared/hooks/use-spread.d.ts +15 -0
- package/dist/shared/index.d.ts +2 -0
- package/dist/svelte/hooks/index.d.ts +1 -0
- package/dist/svelte/hooks/use-spread.svelte.d.ts +27 -0
- package/dist/svelte/index.cjs +2 -0
- package/dist/svelte/index.cjs.map +1 -0
- package/dist/svelte/index.d.ts +2 -0
- package/dist/svelte/index.js +30 -0
- package/dist/svelte/index.js.map +1 -0
- package/package.json +15 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-spread';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SpreadMode, SpreadPlugin } from '../../index.ts';
|
|
2
|
+
export declare const useSpreadPlugin: () => {
|
|
3
|
+
plugin: SpreadPlugin | null;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
ready: Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useSpreadCapability: () => {
|
|
8
|
+
provides: Readonly<import('../../index.ts').SpreadCapability> | null;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
ready: Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export declare const useSpread: () => {
|
|
13
|
+
provides: Readonly<import('../../index.ts').SpreadCapability> | null;
|
|
14
|
+
spreadMode: SpreadMode;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-spread.svelte';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SpreadMode, SpreadPlugin } from '../../lib/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to get the spread plugin's capability API.
|
|
4
|
+
* This provides methods for controlling spread mode.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useSpreadCapability: () => {
|
|
7
|
+
provides: Readonly<import('../../lib/index.ts').SpreadCapability> | null;
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
ready: Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Hook to get the raw spread plugin instance.
|
|
13
|
+
* Useful for accessing plugin-specific properties or methods not exposed in the capability.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useSpreadPlugin: () => {
|
|
16
|
+
plugin: SpreadPlugin | null;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
ready: Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Hook to manage spread mode state and listen to changes.
|
|
22
|
+
* Returns the capability provider and reactive spread mode.
|
|
23
|
+
*/
|
|
24
|
+
export declare const useSpread: () => {
|
|
25
|
+
readonly provides: Readonly<import('../../lib/index.ts').SpreadCapability> | null;
|
|
26
|
+
spreadMode: SpreadMode;
|
|
27
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("svelte/internal/client"),r=require("@embedpdf/core/svelte"),t=require("@embedpdf/plugin-spread");function o(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const t in e)if("default"!==t){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}return r.default=e,Object.freeze(r)}const p=o(e),d=()=>r.useCapability(t.SpreadPlugin.id);exports.useSpread=()=>{const e=d(),r=p.proxy({get provides(){return e.provides},spreadMode:t.SpreadMode.None});return p.user_effect((()=>{if(!e.provides)return;r.spreadMode=e.provides.getSpreadMode();return e.provides.onSpreadChange((e=>{r.spreadMode=e}))})),r},exports.useSpreadCapability=d,exports.useSpreadPlugin=()=>r.usePlugin(t.SpreadPlugin.id),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-spread.svelte.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { SpreadMode, SpreadPlugin } from '@embedpdf/plugin-spread';\n\n/**\n * Hook to get the spread plugin's capability API.\n * This provides methods for controlling spread mode.\n */\nexport const useSpreadCapability = () => useCapability<SpreadPlugin>(SpreadPlugin.id);\n\n/**\n * Hook to get the raw spread plugin instance.\n * Useful for accessing plugin-specific properties or methods not exposed in the capability.\n */\nexport const useSpreadPlugin = () => usePlugin<SpreadPlugin>(SpreadPlugin.id);\n\n/**\n * Hook to manage spread mode state and listen to changes.\n * Returns the capability provider and reactive spread mode.\n */\nexport const useSpread = () => {\n const capability = useSpreadCapability();\n\n const state = $state({\n get provides() {\n return capability.provides;\n },\n spreadMode: SpreadMode.None as SpreadMode,\n });\n\n $effect(() => {\n if (!capability.provides) return;\n\n // Set initial spread mode\n state.spreadMode = capability.provides.getSpreadMode();\n\n // Subscribe to spread mode changes\n const unsubscribe = capability.provides.onSpreadChange((newSpreadMode) => {\n state.spreadMode = newSpreadMode;\n });\n\n return unsubscribe;\n });\n\n return state;\n};\n"],"names":["useSpreadCapability","useCapability","SpreadPlugin","id","capability","state","provides","spreadMode","SpreadMode","None","$","user_effect","getSpreadMode","onSpreadChange","newSpreadMode","usePlugin"],"mappings":"0dAOaA,EAA4B,IAAAC,gBAA4BC,EAAAA,aAAaC,2BAa1E,MAAAC,EAAaJ,IAEbK,WACA,YAAAC,GACK,OAAAF,EAAWE,QACpB,EACAC,WAAYC,EAAAA,WAAWC,OAiBlB,OAdPC,EAAAC,kBACO,IAAAP,EAAWE,SAAU,OAGpBD,EAAAE,WAAaH,EAAWE,SAASM,gBAOhC,OAJaR,EAAWE,SAASO,gBAAgBC,IACtDT,EAAME,WAAaO,CAAA,GAGd,IAGFT,CAAA,wDA9B4B,IAAAU,YAAwBb,EAAAA,aAAaC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as $ from "svelte/internal/client";
|
|
2
|
+
import { useCapability, usePlugin } from "@embedpdf/core/svelte";
|
|
3
|
+
import { SpreadPlugin, SpreadMode } from "@embedpdf/plugin-spread";
|
|
4
|
+
export * from "@embedpdf/plugin-spread";
|
|
5
|
+
const useSpreadCapability = () => useCapability(SpreadPlugin.id);
|
|
6
|
+
const useSpreadPlugin = () => usePlugin(SpreadPlugin.id);
|
|
7
|
+
const useSpread = () => {
|
|
8
|
+
const capability = useSpreadCapability();
|
|
9
|
+
const state = $.proxy({
|
|
10
|
+
get provides() {
|
|
11
|
+
return capability.provides;
|
|
12
|
+
},
|
|
13
|
+
spreadMode: SpreadMode.None
|
|
14
|
+
});
|
|
15
|
+
$.user_effect(() => {
|
|
16
|
+
if (!capability.provides) return;
|
|
17
|
+
state.spreadMode = capability.provides.getSpreadMode();
|
|
18
|
+
const unsubscribe = capability.provides.onSpreadChange((newSpreadMode) => {
|
|
19
|
+
state.spreadMode = newSpreadMode;
|
|
20
|
+
});
|
|
21
|
+
return unsubscribe;
|
|
22
|
+
});
|
|
23
|
+
return state;
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
useSpread,
|
|
27
|
+
useSpreadCapability,
|
|
28
|
+
useSpreadPlugin
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/svelte/hooks/use-spread.svelte.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { SpreadMode, SpreadPlugin } from '@embedpdf/plugin-spread';\n\n/**\n * Hook to get the spread plugin's capability API.\n * This provides methods for controlling spread mode.\n */\nexport const useSpreadCapability = () => useCapability<SpreadPlugin>(SpreadPlugin.id);\n\n/**\n * Hook to get the raw spread plugin instance.\n * Useful for accessing plugin-specific properties or methods not exposed in the capability.\n */\nexport const useSpreadPlugin = () => usePlugin<SpreadPlugin>(SpreadPlugin.id);\n\n/**\n * Hook to manage spread mode state and listen to changes.\n * Returns the capability provider and reactive spread mode.\n */\nexport const useSpread = () => {\n const capability = useSpreadCapability();\n\n const state = $state({\n get provides() {\n return capability.provides;\n },\n spreadMode: SpreadMode.None as SpreadMode,\n });\n\n $effect(() => {\n if (!capability.provides) return;\n\n // Set initial spread mode\n state.spreadMode = capability.provides.getSpreadMode();\n\n // Subscribe to spread mode changes\n const unsubscribe = capability.provides.onSpreadChange((newSpreadMode) => {\n state.spreadMode = newSpreadMode;\n });\n\n return unsubscribe;\n });\n\n return state;\n};\n"],"names":[],"mappings":";;;;AAOa,MAAA,sBAA4B,MAAA,cAA4B,aAAa,EAAE;AAMvE,MAAA,kBAAwB,MAAA,UAAwB,aAAa,EAAE;AAM/D,MAAA,kBAAkB;AACvB,QAAA,aAAa,oBAAoB;QAEjC;IACA,IAAA,WAAW;AACN,aAAA,WAAW;AAAA,IACpB;AAAA,IACA,YAAY,WAAW;AAAA;AAGzB,IAAA,kBAAc;AACP,QAAA,CAAA,WAAW,SAAU;AAGpB,UAAA,aAAa,WAAW,SAAS,cAAc;UAG/C,cAAc,WAAW,SAAS,eAAA,CAAgB,kBAAkB;AACxE,YAAM,aAAa;AAAA,KACpB;WAEM;AAAA,GACR;SAEM;AACT;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/plugin-spread",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,25 +26,31 @@
|
|
|
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.
|
|
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/
|
|
38
|
-
"@embedpdf/
|
|
39
|
-
"@embedpdf/plugin-loader": "1.
|
|
42
|
+
"@embedpdf/core": "1.4.1",
|
|
43
|
+
"@embedpdf/build": "1.1.0",
|
|
44
|
+
"@embedpdf/plugin-loader": "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
|
-
"
|
|
47
|
-
"@embedpdf/
|
|
51
|
+
"svelte": ">=5 <6",
|
|
52
|
+
"@embedpdf/core": "1.4.1",
|
|
53
|
+
"@embedpdf/plugin-loader": "1.4.1"
|
|
48
54
|
},
|
|
49
55
|
"files": [
|
|
50
56
|
"dist",
|
|
@@ -67,7 +73,8 @@
|
|
|
67
73
|
"build:react": "vite build --mode react",
|
|
68
74
|
"build:preact": "vite build --mode preact",
|
|
69
75
|
"build:vue": "vite build --mode vue",
|
|
70
|
-
"build": "
|
|
76
|
+
"build:svelte": "vite build --mode svelte",
|
|
77
|
+
"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\"",
|
|
71
78
|
"clean": "rimraf dist",
|
|
72
79
|
"lint": "eslint src --color",
|
|
73
80
|
"lint:fix": "eslint src --color --fix"
|