@embedpdf/plugin-viewport 1.5.0 → 2.0.0-next.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.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +499 -111
- package/dist/index.js.map +1 -1
- package/dist/lib/actions.d.ts +77 -9
- package/dist/lib/types.d.ts +55 -12
- package/dist/lib/viewport-plugin.d.ts +24 -9
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +40 -15
- package/dist/preact/index.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +40 -15
- package/dist/react/index.js.map +1 -1
- package/dist/shared/components/viewport.d.ts +5 -1
- package/dist/shared/hooks/use-viewport-ref.d.ts +1 -1
- package/dist/shared/hooks/use-viewport.d.ts +11 -1
- package/dist/shared-preact/components/viewport.d.ts +5 -1
- package/dist/shared-preact/hooks/use-viewport-ref.d.ts +1 -1
- package/dist/shared-preact/hooks/use-viewport.d.ts +11 -1
- package/dist/shared-react/components/viewport.d.ts +5 -1
- package/dist/shared-react/hooks/use-viewport-ref.d.ts +1 -1
- package/dist/shared-react/hooks/use-viewport.d.ts +11 -1
- package/dist/svelte/components/Viewport.svelte.d.ts +4 -0
- package/dist/svelte/hooks/use-viewport-ref.svelte.d.ts +5 -1
- package/dist/svelte/hooks/use-viewport.svelte.d.ts +15 -4
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.cjs.map +1 -1
- package/dist/svelte/index.js +86 -21
- package/dist/svelte/index.js.map +1 -1
- package/dist/vue/components/viewport.vue.d.ts +9 -2
- package/dist/vue/hooks/use-viewport-ref.d.ts +6 -1
- package/dist/vue/hooks/use-viewport.d.ts +12 -1
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +66 -38
- package/dist/vue/index.js.map +1 -1
- package/package.json +5 -5
package/dist/preact/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-viewport.ts","../../src/shared/hooks/use-viewport-ref.ts","../../src/shared/components/viewport.tsx"],"sourcesContent":["import { useEffect, useState } from '@framework';\nimport { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { ScrollActivity, ViewportPlugin } from '@embedpdf/plugin-viewport';\n\nexport const useViewportPlugin = () => usePlugin<ViewportPlugin>(ViewportPlugin.id);\nexport const useViewportCapability = () => useCapability<ViewportPlugin>(ViewportPlugin.id);\n\nexport const useViewportScrollActivity = () => {\n const { provides } = useViewportCapability();\n const [scrollActivity, setScrollActivity] = useState<ScrollActivity>({\n isScrolling: false,\n isSmoothScrolling: false,\n });\n\n useEffect(() => {\n if (!provides) return;\n\n return provides.onScrollActivity(setScrollActivity);\n }, [provides]);\n\n return scrollActivity;\n};\n","import { Rect } from '@embedpdf/models';\nimport { useLayoutEffect, useRef } from '@framework';\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-viewport.ts","../../src/shared/hooks/use-viewport-ref.ts","../../src/shared/components/viewport.tsx"],"sourcesContent":["import { useEffect, useState } from '@framework';\nimport { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { GateChangeEvent, ScrollActivity, ViewportPlugin } from '@embedpdf/plugin-viewport';\n\nexport const useViewportPlugin = () => usePlugin<ViewportPlugin>(ViewportPlugin.id);\nexport const useViewportCapability = () => useCapability<ViewportPlugin>(ViewportPlugin.id);\n\n/**\n * Hook to get the gated state of the viewport for a specific document.\n * The viewport children are not rendered when gated.\n * @param documentId Document ID.\n */\nexport const useIsViewportGated = (documentId: string) => {\n const { provides } = useViewportCapability();\n const [isGated, setIsGated] = useState(provides?.isGated(documentId) ?? false);\n\n useEffect(() => {\n if (!provides) return;\n\n // Set initial state\n setIsGated(provides.isGated(documentId));\n\n // Subscribe to gate state changes\n return provides.onGateChange((event: GateChangeEvent) => {\n if (event.documentId === documentId) {\n setIsGated(event.isGated);\n }\n });\n }, [provides, documentId]);\n\n return isGated;\n};\n\n/**\n * Hook to get scroll activity for a specific document\n * @param documentId Document ID.\n */\nexport const useViewportScrollActivity = (documentId: string) => {\n const { provides } = useViewportCapability();\n const [scrollActivity, setScrollActivity] = useState<ScrollActivity>({\n isScrolling: false,\n isSmoothScrolling: false,\n });\n\n useEffect(() => {\n if (!provides) return;\n\n // Subscribe to scroll activity events\n return provides.onScrollActivity((event) => {\n // Filter by documentId if provided\n if (event.documentId === documentId) {\n setScrollActivity(event.activity);\n }\n });\n }, [provides, documentId]);\n\n return scrollActivity;\n};\n","import { Rect } from '@embedpdf/models';\nimport { useLayoutEffect, useRef } from '@framework';\nimport { useViewportPlugin } from './use-viewport';\n\nexport function useViewportRef(documentId: string) {\n const { plugin: viewportPlugin } = useViewportPlugin();\n const containerRef = useRef<HTMLDivElement>(null);\n\n useLayoutEffect(() => {\n if (!viewportPlugin) return;\n\n const container = containerRef.current;\n if (!container) return;\n\n // Register this viewport for the document\n try {\n viewportPlugin.registerViewport(documentId);\n } catch (error) {\n console.error(`Failed to register viewport for document ${documentId}:`, error);\n return;\n }\n\n // Provide rect calculator\n const provideRect = (): Rect => {\n const r = container.getBoundingClientRect();\n return {\n origin: { x: r.left, y: r.top },\n size: { width: r.width, height: r.height },\n };\n };\n viewportPlugin.registerBoundingRectProvider(documentId, provideRect);\n\n // On scroll\n const onScroll = () => {\n viewportPlugin.setViewportScrollMetrics(documentId, {\n scrollTop: container.scrollTop,\n scrollLeft: container.scrollLeft,\n });\n };\n container.addEventListener('scroll', onScroll);\n\n // On resize\n const resizeObserver = new ResizeObserver(() => {\n viewportPlugin.setViewportResizeMetrics(documentId, {\n width: container.offsetWidth,\n height: container.offsetHeight,\n clientWidth: container.clientWidth,\n clientHeight: container.clientHeight,\n scrollTop: container.scrollTop,\n scrollLeft: container.scrollLeft,\n scrollWidth: container.scrollWidth,\n scrollHeight: container.scrollHeight,\n });\n });\n resizeObserver.observe(container);\n\n // Subscribe to scroll requests for this document\n const unsubscribeScrollRequest = viewportPlugin.onScrollRequest(\n documentId,\n ({ x, y, behavior = 'auto' }) => {\n requestAnimationFrame(() => {\n container.scrollTo({ left: x, top: y, behavior });\n });\n },\n );\n\n // Cleanup\n return () => {\n viewportPlugin.unregisterViewport(documentId);\n viewportPlugin.registerBoundingRectProvider(documentId, null);\n resizeObserver.disconnect();\n container.removeEventListener('scroll', onScroll);\n unsubscribeScrollRequest();\n };\n }, [viewportPlugin, documentId]);\n\n return containerRef;\n}\n","import { ReactNode, useEffect, useState, HTMLAttributes } from '@framework';\nimport { useIsViewportGated, useViewportCapability } from '../hooks';\nimport { useViewportRef } from '../hooks/use-viewport-ref';\n\ntype ViewportProps = HTMLAttributes<HTMLDivElement> & {\n children: ReactNode;\n /**\n * The ID of the document that this viewport displays\n */\n documentId: string;\n};\n\nexport function Viewport({ children, documentId, ...props }: ViewportProps) {\n const [viewportGap, setViewportGap] = useState(0);\n const viewportRef = useViewportRef(documentId);\n const { provides: viewportProvides } = useViewportCapability();\n const isGated = useIsViewportGated(documentId);\n\n useEffect(() => {\n if (viewportProvides) {\n setViewportGap(viewportProvides.getViewportGap());\n }\n }, [viewportProvides]);\n\n const { style, ...restProps } = props;\n return (\n <div\n {...restProps}\n ref={viewportRef}\n style={{\n width: '100%',\n height: '100%',\n overflow: 'auto',\n ...(typeof style === 'object' ? style : {}),\n padding: `${viewportGap}px`,\n }}\n >\n {!isGated && children}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;AAIO,MAAM,oBAAoB,MAAM,UAA0B,eAAe,EAAE;AAC3E,MAAM,wBAAwB,MAAM,cAA8B,eAAe,EAAE;AAOnF,MAAM,qBAAqB,CAAC,eAAuB;AACxD,QAAM,EAAE,SAAA,IAAa,sBAAA;AACrB,QAAM,CAAC,SAAS,UAAU,IAAI,UAAS,qCAAU,QAAQ,gBAAe,KAAK;AAE7E,YAAU,MAAM;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QAAM,EAAE,OAAO,GAAG,UAAA,IAAc;AAChC,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,GAAI,OAAO,UAAU,WAAW,QAAQ,CAAA;AAAA,QACxC,SAAS,GAAG,WAAW;AAAA,MAAA;AAAA,MAGxB,WAAC,WAAW;AAAA,IAAA;AAAA,EAAA;AAGnB;"}
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),r=require("@embedpdf/core/react"),o=require("@embedpdf/plugin-viewport"),i=()=>r.usePlugin(o.ViewportPlugin.id),s=()=>r.useCapability(o.ViewportPlugin.id);function l(){const{plugin:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),r=require("@embedpdf/core/react"),o=require("@embedpdf/plugin-viewport"),i=()=>r.usePlugin(o.ViewportPlugin.id),s=()=>r.useCapability(o.ViewportPlugin.id),n=e=>{const{provides:r}=s(),[o,i]=t.useState((null==r?void 0:r.isGated(e))??!1);return t.useEffect(()=>{if(r)return i(r.isGated(e)),r.onGateChange(t=>{t.documentId===e&&i(t.isGated)})},[r,e]),o};function l(e){const{plugin:r}=i(),o=t.useRef(null);return t.useLayoutEffect(()=>{if(!r)return;const t=o.current;if(!t)return;try{r.registerViewport(e)}catch(l){return void console.error(`Failed to register viewport for document ${e}:`,l)}r.registerBoundingRectProvider(e,()=>{const e=t.getBoundingClientRect();return{origin:{x:e.left,y:e.top},size:{width:e.width,height:e.height}}});const i=()=>{r.setViewportScrollMetrics(e,{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft})};t.addEventListener("scroll",i);const s=new ResizeObserver(()=>{r.setViewportResizeMetrics(e,{width:t.offsetWidth,height:t.offsetHeight,clientWidth:t.clientWidth,clientHeight:t.clientHeight,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight})});s.observe(t);const n=r.onScrollRequest(e,({x:e,y:r,behavior:o="auto"})=>{requestAnimationFrame(()=>{t.scrollTo({left:e,top:r,behavior:o})})});return()=>{r.unregisterViewport(e),r.registerBoundingRectProvider(e,null),s.disconnect(),t.removeEventListener("scroll",i),n()}},[r,e]),o}exports.Viewport=function({children:r,documentId:o,...i}){const[c,u]=t.useState(0),d=l(o),{provides:p}=s(),a=n(o);t.useEffect(()=>{p&&u(p.getViewportGap())},[p]);const{style:f,...g}=i;return e.jsx("div",{...g,ref:d,style:{width:"100%",height:"100%",overflow:"auto",..."object"==typeof f?f:{},padding:`${c}px`},children:!a&&r})},exports.useIsViewportGated=n,exports.useViewportCapability=s,exports.useViewportPlugin=i,exports.useViewportRef=l,exports.useViewportScrollActivity=e=>{const{provides:r}=s(),[o,i]=t.useState({isScrolling:!1,isSmoothScrolling:!1});return t.useEffect(()=>{if(r)return r.onScrollActivity(t=>{t.documentId===e&&i(t.activity)})},[r,e]),o},Object.keys(o).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>o[e]})});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/react/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/shared/hooks/use-viewport.ts","../../src/shared/hooks/use-viewport-ref.ts","../../src/shared/components/viewport.tsx"],"sourcesContent":["import { useEffect, useState } from '@framework';\nimport { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { ScrollActivity, ViewportPlugin } from '@embedpdf/plugin-viewport';\n\nexport const useViewportPlugin = () => usePlugin<ViewportPlugin>(ViewportPlugin.id);\nexport const useViewportCapability = () => useCapability<ViewportPlugin>(ViewportPlugin.id);\n\nexport const useViewportScrollActivity = () => {\n const { provides } = useViewportCapability();\n const [scrollActivity, setScrollActivity] = useState<ScrollActivity>({\n isScrolling: false,\n isSmoothScrolling: false,\n });\n\n useEffect(() => {\n if (!provides) return;\n\n return provides.onScrollActivity(setScrollActivity);\n }, [provides]);\n\n return scrollActivity;\n};\n","import { Rect } from '@embedpdf/models';\nimport { useLayoutEffect, useRef } from '@framework';\
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/shared/hooks/use-viewport.ts","../../src/shared/hooks/use-viewport-ref.ts","../../src/shared/components/viewport.tsx"],"sourcesContent":["import { useEffect, useState } from '@framework';\nimport { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { GateChangeEvent, ScrollActivity, ViewportPlugin } from '@embedpdf/plugin-viewport';\n\nexport const useViewportPlugin = () => usePlugin<ViewportPlugin>(ViewportPlugin.id);\nexport const useViewportCapability = () => useCapability<ViewportPlugin>(ViewportPlugin.id);\n\n/**\n * Hook to get the gated state of the viewport for a specific document.\n * The viewport children are not rendered when gated.\n * @param documentId Document ID.\n */\nexport const useIsViewportGated = (documentId: string) => {\n const { provides } = useViewportCapability();\n const [isGated, setIsGated] = useState(provides?.isGated(documentId) ?? false);\n\n useEffect(() => {\n if (!provides) return;\n\n // Set initial state\n setIsGated(provides.isGated(documentId));\n\n // Subscribe to gate state changes\n return provides.onGateChange((event: GateChangeEvent) => {\n if (event.documentId === documentId) {\n setIsGated(event.isGated);\n }\n });\n }, [provides, documentId]);\n\n return isGated;\n};\n\n/**\n * Hook to get scroll activity for a specific document\n * @param documentId Document ID.\n */\nexport const useViewportScrollActivity = (documentId: string) => {\n const { provides } = useViewportCapability();\n const [scrollActivity, setScrollActivity] = useState<ScrollActivity>({\n isScrolling: false,\n isSmoothScrolling: false,\n });\n\n useEffect(() => {\n if (!provides) return;\n\n // Subscribe to scroll activity events\n return provides.onScrollActivity((event) => {\n // Filter by documentId if provided\n if (event.documentId === documentId) {\n setScrollActivity(event.activity);\n }\n });\n }, [provides, documentId]);\n\n return scrollActivity;\n};\n","import { Rect } from '@embedpdf/models';\nimport { useLayoutEffect, useRef } from '@framework';\nimport { useViewportPlugin } from './use-viewport';\n\nexport function useViewportRef(documentId: string) {\n const { plugin: viewportPlugin } = useViewportPlugin();\n const containerRef = useRef<HTMLDivElement>(null);\n\n useLayoutEffect(() => {\n if (!viewportPlugin) return;\n\n const container = containerRef.current;\n if (!container) return;\n\n // Register this viewport for the document\n try {\n viewportPlugin.registerViewport(documentId);\n } catch (error) {\n console.error(`Failed to register viewport for document ${documentId}:`, error);\n return;\n }\n\n // Provide rect calculator\n const provideRect = (): Rect => {\n const r = container.getBoundingClientRect();\n return {\n origin: { x: r.left, y: r.top },\n size: { width: r.width, height: r.height },\n };\n };\n viewportPlugin.registerBoundingRectProvider(documentId, provideRect);\n\n // On scroll\n const onScroll = () => {\n viewportPlugin.setViewportScrollMetrics(documentId, {\n scrollTop: container.scrollTop,\n scrollLeft: container.scrollLeft,\n });\n };\n container.addEventListener('scroll', onScroll);\n\n // On resize\n const resizeObserver = new ResizeObserver(() => {\n viewportPlugin.setViewportResizeMetrics(documentId, {\n width: container.offsetWidth,\n height: container.offsetHeight,\n clientWidth: container.clientWidth,\n clientHeight: container.clientHeight,\n scrollTop: container.scrollTop,\n scrollLeft: container.scrollLeft,\n scrollWidth: container.scrollWidth,\n scrollHeight: container.scrollHeight,\n });\n });\n resizeObserver.observe(container);\n\n // Subscribe to scroll requests for this document\n const unsubscribeScrollRequest = viewportPlugin.onScrollRequest(\n documentId,\n ({ x, y, behavior = 'auto' }) => {\n requestAnimationFrame(() => {\n container.scrollTo({ left: x, top: y, behavior });\n });\n },\n );\n\n // Cleanup\n return () => {\n viewportPlugin.unregisterViewport(documentId);\n viewportPlugin.registerBoundingRectProvider(documentId, null);\n resizeObserver.disconnect();\n container.removeEventListener('scroll', onScroll);\n unsubscribeScrollRequest();\n };\n }, [viewportPlugin, documentId]);\n\n return containerRef;\n}\n","import { ReactNode, useEffect, useState, HTMLAttributes } from '@framework';\nimport { useIsViewportGated, useViewportCapability } from '../hooks';\nimport { useViewportRef } from '../hooks/use-viewport-ref';\n\ntype ViewportProps = HTMLAttributes<HTMLDivElement> & {\n children: ReactNode;\n /**\n * The ID of the document that this viewport displays\n */\n documentId: string;\n};\n\nexport function Viewport({ children, documentId, ...props }: ViewportProps) {\n const [viewportGap, setViewportGap] = useState(0);\n const viewportRef = useViewportRef(documentId);\n const { provides: viewportProvides } = useViewportCapability();\n const isGated = useIsViewportGated(documentId);\n\n useEffect(() => {\n if (viewportProvides) {\n setViewportGap(viewportProvides.getViewportGap());\n }\n }, [viewportProvides]);\n\n const { style, ...restProps } = props;\n return (\n <div\n {...restProps}\n ref={viewportRef}\n style={{\n width: '100%',\n height: '100%',\n overflow: 'auto',\n ...(typeof style === 'object' ? style : {}),\n padding: `${viewportGap}px`,\n }}\n >\n {!isGated && children}\n </div>\n );\n}\n"],"names":["useViewportPlugin","usePlugin","ViewportPlugin","id","useViewportCapability","useCapability","useIsViewportGated","documentId","provides","isGated","setIsGated","useState","useEffect","onGateChange","event","useViewportRef","plugin","viewportPlugin","containerRef","useRef","useLayoutEffect","container","current","registerViewport","error","console","registerBoundingRectProvider","r","getBoundingClientRect","origin","x","left","y","top","size","width","height","onScroll","setViewportScrollMetrics","scrollTop","scrollLeft","addEventListener","resizeObserver","ResizeObserver","setViewportResizeMetrics","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","observe","unsubscribeScrollRequest","onScrollRequest","behavior","requestAnimationFrame","scrollTo","unregisterViewport","disconnect","removeEventListener","children","props","viewportGap","setViewportGap","viewportRef","viewportProvides","getViewportGap","style","restProps","jsx","ref","overflow","padding","scrollActivity","setScrollActivity","isScrolling","isSmoothScrolling","onScrollActivity","activity"],"mappings":"iNAIaA,EAAoB,IAAMC,YAA0BC,EAAAA,eAAeC,IACnEC,EAAwB,IAAMC,gBAA8BH,EAAAA,eAAeC,I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,IAAGE,IAAGsB,WAAW,WAClBC,sBAAsB,KACpBlC,EAAUmC,SAAS,CAAEzB,KAAMD,EAAGG,IAAKD,EAAGsB,iBAM5C,MAAO,KACLrC,EAAewC,mBAAmBlD,GAClCU,EAAeS,6BAA6BnB,EAAY,MACxDmC,EAAegB,aACfrC,EAAUsC,oBAAoB,SAAUtB,GACxCe,MAED,CAACnC,EAAgBV,IAEbW,CACT,kBCjEO,UAAkB0C,SAAEA,EAAArD,WAAUA,KAAesD,IAClD,MAAOC,EAAaC,GAAkBpD,EAAAA,SAAS,GACzCqD,EAAcjD,EAAeR,IAC3BC,SAAUyD,GAAqB7D,IACjCK,EAAUH,EAAmBC,GAEnCK,EAAAA,UAAU,KACJqD,GACFF,EAAeE,EAAiBC,mBAEjC,CAACD,IAEJ,MAAME,MAAEA,KAAUC,GAAcP,EAChC,OACEQ,EAAAA,IAAC,MAAA,IACKD,EACJE,IAAKN,EACLG,MAAO,CACLhC,MAAO,OACPC,OAAQ,OACRmC,SAAU,UACW,iBAAVJ,EAAqBA,EAAQ,CAAA,EACxCK,QAAS,GAAGV,OAGbF,UAACnD,GAAWmD,GAGnB,sJFH0CrD,IACxC,MAAMC,SAAEA,GAAaJ,KACdqE,EAAgBC,GAAqB/D,WAAyB,CACnEgE,aAAa,EACbC,mBAAmB,IAerB,OAZAhE,EAAAA,UAAU,KACR,GAAKJ,EAGL,OAAOA,EAASqE,iBAAkB/D,IAE5BA,EAAMP,aAAeA,GACvBmE,EAAkB5D,EAAMgE,aAG3B,CAACtE,EAAUD,IAEPkE"}
|
package/dist/react/index.js
CHANGED
|
@@ -5,7 +5,21 @@ import { ViewportPlugin } from "@embedpdf/plugin-viewport";
|
|
|
5
5
|
export * from "@embedpdf/plugin-viewport";
|
|
6
6
|
const useViewportPlugin = () => usePlugin(ViewportPlugin.id);
|
|
7
7
|
const useViewportCapability = () => useCapability(ViewportPlugin.id);
|
|
8
|
-
const
|
|
8
|
+
const useIsViewportGated = (documentId) => {
|
|
9
|
+
const { provides } = useViewportCapability();
|
|
10
|
+
const [isGated, setIsGated] = useState((provides == null ? void 0 : provides.isGated(documentId)) ?? false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!provides) return;
|
|
13
|
+
setIsGated(provides.isGated(documentId));
|
|
14
|
+
return provides.onGateChange((event) => {
|
|
15
|
+
if (event.documentId === documentId) {
|
|
16
|
+
setIsGated(event.isGated);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}, [provides, documentId]);
|
|
20
|
+
return isGated;
|
|
21
|
+
};
|
|
22
|
+
const useViewportScrollActivity = (documentId) => {
|
|
9
23
|
const { provides } = useViewportCapability();
|
|
10
24
|
const [scrollActivity, setScrollActivity] = useState({
|
|
11
25
|
isScrolling: false,
|
|
@@ -13,18 +27,27 @@ const useViewportScrollActivity = () => {
|
|
|
13
27
|
});
|
|
14
28
|
useEffect(() => {
|
|
15
29
|
if (!provides) return;
|
|
16
|
-
return provides.onScrollActivity(
|
|
17
|
-
|
|
30
|
+
return provides.onScrollActivity((event) => {
|
|
31
|
+
if (event.documentId === documentId) {
|
|
32
|
+
setScrollActivity(event.activity);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}, [provides, documentId]);
|
|
18
36
|
return scrollActivity;
|
|
19
37
|
};
|
|
20
|
-
function useViewportRef() {
|
|
38
|
+
function useViewportRef(documentId) {
|
|
21
39
|
const { plugin: viewportPlugin } = useViewportPlugin();
|
|
22
40
|
const containerRef = useRef(null);
|
|
23
41
|
useLayoutEffect(() => {
|
|
24
42
|
if (!viewportPlugin) return;
|
|
25
43
|
const container = containerRef.current;
|
|
26
44
|
if (!container) return;
|
|
27
|
-
|
|
45
|
+
try {
|
|
46
|
+
viewportPlugin.registerViewport(documentId);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error(`Failed to register viewport for document ${documentId}:`, error);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
28
51
|
const provideRect = () => {
|
|
29
52
|
const r = container.getBoundingClientRect();
|
|
30
53
|
return {
|
|
@@ -32,17 +55,16 @@ function useViewportRef() {
|
|
|
32
55
|
size: { width: r.width, height: r.height }
|
|
33
56
|
};
|
|
34
57
|
};
|
|
35
|
-
viewportPlugin.registerBoundingRectProvider(provideRect);
|
|
58
|
+
viewportPlugin.registerBoundingRectProvider(documentId, provideRect);
|
|
36
59
|
const onScroll = () => {
|
|
37
|
-
viewportPlugin.setViewportScrollMetrics({
|
|
60
|
+
viewportPlugin.setViewportScrollMetrics(documentId, {
|
|
38
61
|
scrollTop: container.scrollTop,
|
|
39
62
|
scrollLeft: container.scrollLeft
|
|
40
63
|
});
|
|
41
64
|
};
|
|
42
65
|
container.addEventListener("scroll", onScroll);
|
|
43
66
|
const resizeObserver = new ResizeObserver(() => {
|
|
44
|
-
|
|
45
|
-
viewportPlugin.setViewportResizeMetrics({
|
|
67
|
+
viewportPlugin.setViewportResizeMetrics(documentId, {
|
|
46
68
|
width: container.offsetWidth,
|
|
47
69
|
height: container.offsetHeight,
|
|
48
70
|
clientWidth: container.clientWidth,
|
|
@@ -55,6 +77,7 @@ function useViewportRef() {
|
|
|
55
77
|
});
|
|
56
78
|
resizeObserver.observe(container);
|
|
57
79
|
const unsubscribeScrollRequest = viewportPlugin.onScrollRequest(
|
|
80
|
+
documentId,
|
|
58
81
|
({ x, y, behavior = "auto" }) => {
|
|
59
82
|
requestAnimationFrame(() => {
|
|
60
83
|
container.scrollTo({ left: x, top: y, behavior });
|
|
@@ -62,19 +85,20 @@ function useViewportRef() {
|
|
|
62
85
|
}
|
|
63
86
|
);
|
|
64
87
|
return () => {
|
|
65
|
-
|
|
88
|
+
viewportPlugin.unregisterViewport(documentId);
|
|
89
|
+
viewportPlugin.registerBoundingRectProvider(documentId, null);
|
|
66
90
|
resizeObserver.disconnect();
|
|
67
|
-
viewportPlugin.registerBoundingRectProvider(null);
|
|
68
91
|
container.removeEventListener("scroll", onScroll);
|
|
69
92
|
unsubscribeScrollRequest();
|
|
70
93
|
};
|
|
71
|
-
}, [viewportPlugin]);
|
|
94
|
+
}, [viewportPlugin, documentId]);
|
|
72
95
|
return containerRef;
|
|
73
96
|
}
|
|
74
|
-
function Viewport({ children, ...props }) {
|
|
97
|
+
function Viewport({ children, documentId, ...props }) {
|
|
75
98
|
const [viewportGap, setViewportGap] = useState(0);
|
|
76
|
-
const viewportRef = useViewportRef();
|
|
99
|
+
const viewportRef = useViewportRef(documentId);
|
|
77
100
|
const { provides: viewportProvides } = useViewportCapability();
|
|
101
|
+
const isGated = useIsViewportGated(documentId);
|
|
78
102
|
useEffect(() => {
|
|
79
103
|
if (viewportProvides) {
|
|
80
104
|
setViewportGap(viewportProvides.getViewportGap());
|
|
@@ -93,12 +117,13 @@ function Viewport({ children, ...props }) {
|
|
|
93
117
|
...typeof style === "object" ? style : {},
|
|
94
118
|
padding: `${viewportGap}px`
|
|
95
119
|
},
|
|
96
|
-
children
|
|
120
|
+
children: !isGated && children
|
|
97
121
|
}
|
|
98
122
|
);
|
|
99
123
|
}
|
|
100
124
|
export {
|
|
101
125
|
Viewport,
|
|
126
|
+
useIsViewportGated,
|
|
102
127
|
useViewportCapability,
|
|
103
128
|
useViewportPlugin,
|
|
104
129
|
useViewportRef,
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-viewport.ts","../../src/shared/hooks/use-viewport-ref.ts","../../src/shared/components/viewport.tsx"],"sourcesContent":["import { useEffect, useState } from '@framework';\nimport { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { ScrollActivity, ViewportPlugin } from '@embedpdf/plugin-viewport';\n\nexport const useViewportPlugin = () => usePlugin<ViewportPlugin>(ViewportPlugin.id);\nexport const useViewportCapability = () => useCapability<ViewportPlugin>(ViewportPlugin.id);\n\nexport const useViewportScrollActivity = () => {\n const { provides } = useViewportCapability();\n const [scrollActivity, setScrollActivity] = useState<ScrollActivity>({\n isScrolling: false,\n isSmoothScrolling: false,\n });\n\n useEffect(() => {\n if (!provides) return;\n\n return provides.onScrollActivity(setScrollActivity);\n }, [provides]);\n\n return scrollActivity;\n};\n","import { Rect } from '@embedpdf/models';\nimport { useLayoutEffect, useRef } from '@framework';\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-viewport.ts","../../src/shared/hooks/use-viewport-ref.ts","../../src/shared/components/viewport.tsx"],"sourcesContent":["import { useEffect, useState } from '@framework';\nimport { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport { GateChangeEvent, ScrollActivity, ViewportPlugin } from '@embedpdf/plugin-viewport';\n\nexport const useViewportPlugin = () => usePlugin<ViewportPlugin>(ViewportPlugin.id);\nexport const useViewportCapability = () => useCapability<ViewportPlugin>(ViewportPlugin.id);\n\n/**\n * Hook to get the gated state of the viewport for a specific document.\n * The viewport children are not rendered when gated.\n * @param documentId Document ID.\n */\nexport const useIsViewportGated = (documentId: string) => {\n const { provides } = useViewportCapability();\n const [isGated, setIsGated] = useState(provides?.isGated(documentId) ?? false);\n\n useEffect(() => {\n if (!provides) return;\n\n // Set initial state\n setIsGated(provides.isGated(documentId));\n\n // Subscribe to gate state changes\n return provides.onGateChange((event: GateChangeEvent) => {\n if (event.documentId === documentId) {\n setIsGated(event.isGated);\n }\n });\n }, [provides, documentId]);\n\n return isGated;\n};\n\n/**\n * Hook to get scroll activity for a specific document\n * @param documentId Document ID.\n */\nexport const useViewportScrollActivity = (documentId: string) => {\n const { provides } = useViewportCapability();\n const [scrollActivity, setScrollActivity] = useState<ScrollActivity>({\n isScrolling: false,\n isSmoothScrolling: false,\n });\n\n useEffect(() => {\n if (!provides) return;\n\n // Subscribe to scroll activity events\n return provides.onScrollActivity((event) => {\n // Filter by documentId if provided\n if (event.documentId === documentId) {\n setScrollActivity(event.activity);\n }\n });\n }, [provides, documentId]);\n\n return scrollActivity;\n};\n","import { Rect } from '@embedpdf/models';\nimport { useLayoutEffect, useRef } from '@framework';\nimport { useViewportPlugin } from './use-viewport';\n\nexport function useViewportRef(documentId: string) {\n const { plugin: viewportPlugin } = useViewportPlugin();\n const containerRef = useRef<HTMLDivElement>(null);\n\n useLayoutEffect(() => {\n if (!viewportPlugin) return;\n\n const container = containerRef.current;\n if (!container) return;\n\n // Register this viewport for the document\n try {\n viewportPlugin.registerViewport(documentId);\n } catch (error) {\n console.error(`Failed to register viewport for document ${documentId}:`, error);\n return;\n }\n\n // Provide rect calculator\n const provideRect = (): Rect => {\n const r = container.getBoundingClientRect();\n return {\n origin: { x: r.left, y: r.top },\n size: { width: r.width, height: r.height },\n };\n };\n viewportPlugin.registerBoundingRectProvider(documentId, provideRect);\n\n // On scroll\n const onScroll = () => {\n viewportPlugin.setViewportScrollMetrics(documentId, {\n scrollTop: container.scrollTop,\n scrollLeft: container.scrollLeft,\n });\n };\n container.addEventListener('scroll', onScroll);\n\n // On resize\n const resizeObserver = new ResizeObserver(() => {\n viewportPlugin.setViewportResizeMetrics(documentId, {\n width: container.offsetWidth,\n height: container.offsetHeight,\n clientWidth: container.clientWidth,\n clientHeight: container.clientHeight,\n scrollTop: container.scrollTop,\n scrollLeft: container.scrollLeft,\n scrollWidth: container.scrollWidth,\n scrollHeight: container.scrollHeight,\n });\n });\n resizeObserver.observe(container);\n\n // Subscribe to scroll requests for this document\n const unsubscribeScrollRequest = viewportPlugin.onScrollRequest(\n documentId,\n ({ x, y, behavior = 'auto' }) => {\n requestAnimationFrame(() => {\n container.scrollTo({ left: x, top: y, behavior });\n });\n },\n );\n\n // Cleanup\n return () => {\n viewportPlugin.unregisterViewport(documentId);\n viewportPlugin.registerBoundingRectProvider(documentId, null);\n resizeObserver.disconnect();\n container.removeEventListener('scroll', onScroll);\n unsubscribeScrollRequest();\n };\n }, [viewportPlugin, documentId]);\n\n return containerRef;\n}\n","import { ReactNode, useEffect, useState, HTMLAttributes } from '@framework';\nimport { useIsViewportGated, useViewportCapability } from '../hooks';\nimport { useViewportRef } from '../hooks/use-viewport-ref';\n\ntype ViewportProps = HTMLAttributes<HTMLDivElement> & {\n children: ReactNode;\n /**\n * The ID of the document that this viewport displays\n */\n documentId: string;\n};\n\nexport function Viewport({ children, documentId, ...props }: ViewportProps) {\n const [viewportGap, setViewportGap] = useState(0);\n const viewportRef = useViewportRef(documentId);\n const { provides: viewportProvides } = useViewportCapability();\n const isGated = useIsViewportGated(documentId);\n\n useEffect(() => {\n if (viewportProvides) {\n setViewportGap(viewportProvides.getViewportGap());\n }\n }, [viewportProvides]);\n\n const { style, ...restProps } = props;\n return (\n <div\n {...restProps}\n ref={viewportRef}\n style={{\n width: '100%',\n height: '100%',\n overflow: 'auto',\n ...(typeof style === 'object' ? style : {}),\n padding: `${viewportGap}px`,\n }}\n >\n {!isGated && children}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;AAIO,MAAM,oBAAoB,MAAM,UAA0B,eAAe,EAAE;AAC3E,MAAM,wBAAwB,MAAM,cAA8B,eAAe,EAAE;AAOnF,MAAM,qBAAqB,CAAC,eAAuB;AACxD,QAAM,EAAE,SAAA,IAAa,sBAAA;AACrB,QAAM,CAAC,SAAS,UAAU,IAAI,UAAS,qCAAU,QAAQ,gBAAe,KAAK;AAE7E,YAAU,MAAM;AACd,QAAI,CAAC,SAAU;AAGf,eAAW,SAAS,QAAQ,UAAU,CAAC;AAGvC,WAAO,SAAS,aAAa,CAAC,UAA2B;AACvD,UAAI,MAAM,eAAe,YAAY;AACnC,mBAAW,MAAM,OAAO;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,UAAU,UAAU,CAAC;AAEzB,SAAO;AACT;AAMO,MAAM,4BAA4B,CAAC,eAAuB;AAC/D,QAAM,EAAE,SAAA,IAAa,sBAAA;AACrB,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAyB;AAAA,IACnE,aAAa;AAAA,IACb,mBAAmB;AAAA,EAAA,CACpB;AAED,YAAU,MAAM;AACd,QAAI,CAAC,SAAU;AAGf,WAAO,SAAS,iBAAiB,CAAC,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5
|
+
* The ID of the document that this viewport displays
|
|
6
|
+
*/
|
|
7
|
+
documentId: string;
|
|
4
8
|
};
|
|
5
|
-
export declare function Viewport({ children, ...props }: ViewportProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function Viewport({ children, documentId, ...props }: ViewportProps): import("react/jsx-runtime").JSX.Element;
|
|
6
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useViewportRef(): import('react').RefObject<HTMLDivElement>;
|
|
1
|
+
export declare function useViewportRef(documentId: string): import('react').RefObject<HTMLDivElement>;
|
|
@@ -9,4 +9,14 @@ export declare const useViewportCapability: () => {
|
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
ready: Promise<void>;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Hook to get the gated state of the viewport for a specific document.
|
|
14
|
+
* The viewport children are not rendered when gated.
|
|
15
|
+
* @param documentId Document ID.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useIsViewportGated: (documentId: string) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Hook to get scroll activity for a specific document
|
|
20
|
+
* @param documentId Document ID.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useViewportScrollActivity: (documentId: string) => ScrollActivity;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ReactNode, HTMLAttributes } from '../../preact/adapter.ts';
|
|
2
2
|
type ViewportProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
3
|
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* The ID of the document that this viewport displays
|
|
6
|
+
*/
|
|
7
|
+
documentId: string;
|
|
4
8
|
};
|
|
5
|
-
export declare function Viewport({ children, ...props }: ViewportProps): import("preact").JSX.Element;
|
|
9
|
+
export declare function Viewport({ children, documentId, ...props }: ViewportProps): import("preact").JSX.Element;
|
|
6
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useViewportRef(): import('preact').RefObject<HTMLDivElement>;
|
|
1
|
+
export declare function useViewportRef(documentId: string): import('preact').RefObject<HTMLDivElement>;
|
|
@@ -9,4 +9,14 @@ export declare const useViewportCapability: () => {
|
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
ready: Promise<void>;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Hook to get the gated state of the viewport for a specific document.
|
|
14
|
+
* The viewport children are not rendered when gated.
|
|
15
|
+
* @param documentId Document ID.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useIsViewportGated: (documentId: string) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Hook to get scroll activity for a specific document
|
|
20
|
+
* @param documentId Document ID.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useViewportScrollActivity: (documentId: string) => ScrollActivity;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ReactNode, HTMLAttributes } from '../../react/adapter.ts';
|
|
2
2
|
type ViewportProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
3
|
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* The ID of the document that this viewport displays
|
|
6
|
+
*/
|
|
7
|
+
documentId: string;
|
|
4
8
|
};
|
|
5
|
-
export declare function Viewport({ children, ...props }: ViewportProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function Viewport({ children, documentId, ...props }: ViewportProps): import("react/jsx-runtime").JSX.Element;
|
|
6
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useViewportRef(): import('react').RefObject<HTMLDivElement>;
|
|
1
|
+
export declare function useViewportRef(documentId: string): import('react').RefObject<HTMLDivElement>;
|
|
@@ -9,4 +9,14 @@ export declare const useViewportCapability: () => {
|
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
ready: Promise<void>;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Hook to get the gated state of the viewport for a specific document.
|
|
14
|
+
* The viewport children are not rendered when gated.
|
|
15
|
+
* @param documentId Document ID.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useIsViewportGated: (documentId: string) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Hook to get scroll activity for a specific document
|
|
20
|
+
* @param documentId Document ID.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useViewportScrollActivity: (documentId: string) => ScrollActivity;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'svelte/elements';
|
|
2
2
|
import { Snippet } from 'svelte';
|
|
3
3
|
type ViewportProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
/**
|
|
5
|
+
* The ID of the document that this viewport displays
|
|
6
|
+
*/
|
|
7
|
+
documentId: string;
|
|
4
8
|
children: Snippet;
|
|
5
9
|
class?: string;
|
|
6
10
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Hook to get a ref for the viewport container element with automatic setup/teardown
|
|
3
|
+
* @param getDocumentId Function that returns the document ID
|
|
4
|
+
*/
|
|
5
|
+
export declare function useViewportRef(getDocumentId: () => string | null): {
|
|
2
6
|
containerRef: HTMLDivElement | null;
|
|
3
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ViewportPlugin } from '../../lib/index.ts';
|
|
1
|
+
import { ScrollActivity, ViewportPlugin } from '../../lib/index.ts';
|
|
2
2
|
export declare const useViewportPlugin: () => {
|
|
3
3
|
plugin: ViewportPlugin | null;
|
|
4
4
|
isLoading: boolean;
|
|
@@ -9,7 +9,18 @@ export declare const useViewportCapability: () => {
|
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
ready: Promise<void>;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Hook to get the gated state of the viewport for a specific document.
|
|
14
|
+
* The viewport children are not rendered when gated.
|
|
15
|
+
* @param getDocumentId Function that returns the document ID
|
|
16
|
+
*/
|
|
17
|
+
export declare const useIsViewportGated: (getDocumentId: () => string | null) => {
|
|
18
|
+
readonly current: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Hook to get scroll activity for a specific document
|
|
22
|
+
* @param getDocumentId Function that returns the document ID
|
|
23
|
+
*/
|
|
24
|
+
export declare const useViewportScrollActivity: (getDocumentId: () => string | null) => {
|
|
25
|
+
readonly current: ScrollActivity;
|
|
15
26
|
};
|
package/dist/svelte/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("svelte/internal/disclose-version");const e=require("svelte/internal/client"),t=require("@embedpdf/core/svelte"),r=require("@embedpdf/plugin-viewport");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("svelte/internal/disclose-version");const e=require("svelte/internal/client"),t=require("@embedpdf/core/svelte"),r=require("@embedpdf/plugin-viewport");function o(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const r in e)if("default"!==r){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}const i=o(e),s=()=>t.usePlugin(r.ViewportPlugin.id),n=()=>t.useCapability(r.ViewportPlugin.id),l=e=>{const t=n();let r=i.state(!1);const o=i.derived(e);return i.user_effect(()=>{const e=t.provides,s=i.get(o);if(e&&s)return i.set(r,e.isGated(s),!0),e.onGateChange(e=>{e.documentId===s&&i.set(r,e.isGated,!0)});i.set(r,!1)}),{get current(){return i.get(r)}}};function c(e){const{plugin:t}=s();let r=i.state(null);const o=i.derived(e);return i.user_pre_effect(()=>{if(!t)return;const e=i.get(r),s=i.get(o);if(!e||!s)return;try{t.registerViewport(s)}catch(u){return void console.error(`Failed to register viewport for document ${s}:`,u)}t.registerBoundingRectProvider(s,()=>{const t=e.getBoundingClientRect();return{origin:{x:t.left,y:t.top},size:{width:t.width,height:t.height}}});const n=()=>{t.setViewportScrollMetrics(s,{scrollTop:e.scrollTop,scrollLeft:e.scrollLeft})};e.addEventListener("scroll",n);const l=new ResizeObserver(()=>{t.setViewportResizeMetrics(s,{width:e.offsetWidth,height:e.offsetHeight,clientWidth:e.clientWidth,clientHeight:e.clientHeight,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,scrollWidth:e.scrollWidth,scrollHeight:e.scrollHeight})});l.observe(e);const c=t.onScrollRequest(s,({x:t,y:r,behavior:o="auto"})=>{requestAnimationFrame(()=>{e.scrollTo({left:t,top:r,behavior:o})})});return()=>{t.unregisterViewport(s),t.registerBoundingRectProvider(s,null),e.removeEventListener("scroll",n),l.disconnect(),c()}}),{get containerRef(){return i.get(r)},set containerRef(e){i.set(r,e,!0)}}}var u=i.from_html("<div><!></div>");exports.Viewport=function(e,t){i.push(t,!0);let r=i.rest_props(t,["$$slots","$$events","$$legacy","documentId","children","class"]),o=i.state(0);const s=c(()=>t.documentId),d=n(),p=l(()=>t.documentId);i.user_effect(()=>{d.provides&&i.set(o,d.provides.getViewportGap(),!0)});var a=u();i.attribute_effect(a,()=>({...r,class:t.class,[i.STYLE]:{width:"100%",height:"100%",overflow:"auto",padding:`${i.get(o)}px`}}));var g=i.child(a),f=e=>{var r=i.comment(),o=i.first_child(r);i.snippet(o,()=>t.children),i.append(e,r)};i.if(g,e=>{p.current||e(f)}),i.reset(a),i.bind_this(a,e=>s.containerRef=e,()=>null==s?void 0:s.containerRef),i.append(e,a),i.pop()},exports.useIsViewportGated=l,exports.useViewportCapability=n,exports.useViewportPlugin=s,exports.useViewportRef=c,exports.useViewportScrollActivity=e=>{const t=n();let r=i.state(i.proxy({isScrolling:!1,isSmoothScrolling:!1}));const o=i.derived(e);return i.user_effect(()=>{const e=t.provides,s=i.get(o);if(e&&s)return e.onScrollActivity(e=>{e.documentId===s&&i.set(r,e.activity,!0)});i.set(r,{isScrolling:!1,isSmoothScrolling:!1},!0)}),{get current(){return i.get(r)}}},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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/svelte/hooks/use-viewport.svelte.ts","../../src/svelte/hooks/use-viewport-ref.svelte.ts","../../src/svelte/components/Viewport.svelte"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { ScrollActivity, ViewportPlugin } from '@embedpdf/plugin-viewport';\n\nexport const useViewportPlugin = () => usePlugin<ViewportPlugin>(ViewportPlugin.id);\nexport const useViewportCapability = () => useCapability<ViewportPlugin>(ViewportPlugin.id);\n\nexport const
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/svelte/hooks/use-viewport.svelte.ts","../../src/svelte/hooks/use-viewport-ref.svelte.ts","../../src/svelte/components/Viewport.svelte"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { GateChangeEvent, ScrollActivity, ViewportPlugin } from '@embedpdf/plugin-viewport';\n\nexport const useViewportPlugin = () => usePlugin<ViewportPlugin>(ViewportPlugin.id);\nexport const useViewportCapability = () => useCapability<ViewportPlugin>(ViewportPlugin.id);\n\n/**\n * Hook to get the gated state of the viewport for a specific document.\n * The viewport children are not rendered when gated.\n * @param getDocumentId Function that returns the document ID\n */\nexport const useIsViewportGated = (getDocumentId: () => string | null) => {\n const capability = useViewportCapability();\n\n let isGated = $state(false);\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n $effect(() => {\n const provides = capability.provides;\n const docId = documentId;\n\n if (!provides || !docId) {\n isGated = false;\n return;\n }\n\n // Set initial state\n isGated = provides.isGated(docId);\n\n // Subscribe to gate state changes\n return provides.onGateChange((event: GateChangeEvent) => {\n if (event.documentId === docId) {\n isGated = event.isGated;\n }\n });\n });\n\n return {\n get current() {\n return isGated;\n },\n };\n};\n\n/**\n * Hook to get scroll activity for a specific document\n * @param getDocumentId Function that returns the document ID\n */\nexport const useViewportScrollActivity = (getDocumentId: () => string | null) => {\n const capability = useViewportCapability();\n\n let scrollActivity = $state<ScrollActivity>({\n isScrolling: false,\n isSmoothScrolling: false,\n });\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n $effect(() => {\n const provides = capability.provides;\n const docId = documentId;\n\n if (!provides || !docId) {\n scrollActivity = {\n isScrolling: false,\n isSmoothScrolling: false,\n };\n return;\n }\n\n // Subscribe to scroll activity events\n return provides.onScrollActivity((event) => {\n // Filter by documentId\n if (event.documentId === docId) {\n scrollActivity = event.activity;\n }\n });\n });\n\n return {\n get current() {\n return scrollActivity;\n },\n };\n};\n","import { type Rect } from '@embedpdf/models';\nimport { useViewportPlugin } from './use-viewport.svelte';\n\n/**\n * Hook to get a ref for the viewport container element with automatic setup/teardown\n * @param getDocumentId Function that returns the document ID\n */\nexport function useViewportRef(getDocumentId: () => string | null) {\n const { plugin } = useViewportPlugin();\n\n let containerRef = $state<HTMLDivElement | null>(null);\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n $effect.pre(() => {\n if (!plugin) return;\n\n const container = containerRef;\n const docId = documentId;\n if (!container || !docId) return;\n\n // Register this viewport for the document\n try {\n plugin.registerViewport(docId);\n } catch (error) {\n console.error(`Failed to register viewport for document ${docId}:`, error);\n return;\n }\n\n // Provide rect calculator\n const provideRect = (): Rect => {\n const r = container.getBoundingClientRect();\n return {\n origin: { x: r.left, y: r.top },\n size: { width: r.width, height: r.height },\n };\n };\n plugin.registerBoundingRectProvider(docId, provideRect);\n\n // On scroll\n const onScroll = () => {\n plugin.setViewportScrollMetrics(docId, {\n scrollTop: container.scrollTop,\n scrollLeft: container.scrollLeft,\n });\n };\n container.addEventListener('scroll', onScroll);\n\n // On resize\n const resizeObserver = new ResizeObserver(() => {\n plugin.setViewportResizeMetrics(docId, {\n width: container.offsetWidth,\n height: container.offsetHeight,\n clientWidth: container.clientWidth,\n clientHeight: container.clientHeight,\n scrollTop: container.scrollTop,\n scrollLeft: container.scrollLeft,\n scrollWidth: container.scrollWidth,\n scrollHeight: container.scrollHeight,\n });\n });\n resizeObserver.observe(container);\n\n // Subscribe to scroll requests for this document\n const unsubscribeScrollRequest = plugin.onScrollRequest(\n docId,\n ({ x, y, behavior = 'auto' }) => {\n requestAnimationFrame(() => {\n container.scrollTo({ left: x, top: y, behavior });\n });\n },\n );\n\n // Store cleanup function\n return () => {\n plugin.unregisterViewport(docId);\n plugin.registerBoundingRectProvider(docId, null);\n container.removeEventListener('scroll', onScroll);\n resizeObserver.disconnect();\n unsubscribeScrollRequest();\n };\n });\n\n return {\n get containerRef() {\n return containerRef;\n },\n set containerRef(el: HTMLDivElement | null) {\n containerRef = el;\n },\n };\n}\n","<script lang=\"ts\">\n import { useIsViewportGated, useViewportCapability, useViewportRef } from '../hooks';\n import type { HTMLAttributes } from 'svelte/elements';\n import type { Snippet } from 'svelte';\n\n type ViewportProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The ID of the document that this viewport displays\n */\n documentId: string;\n children: Snippet;\n class?: string;\n };\n\n let { documentId, children, class: propsClass, ...restProps }: ViewportProps = $props();\n\n let viewportGap = $state(0);\n\n const viewportRef = useViewportRef(() => documentId);\n const viewportCapability = useViewportCapability();\n const isGated = useIsViewportGated(() => documentId);\n\n $effect(() => {\n if (viewportCapability.provides) {\n viewportGap = viewportCapability.provides.getViewportGap();\n }\n });\n</script>\n\n<div\n {...restProps}\n bind:this={viewportRef.containerRef}\n style:width=\"100%\"\n style:height=\"100%\"\n style:overflow=\"auto\"\n style:padding={`${viewportGap}px`}\n class={propsClass}\n>\n {#if !isGated.current}\n {@render children()}\n {/if}\n</div>\n"],"names":["useViewportPlugin","usePlugin","ViewportPlugin","id","useViewportCapability","useCapability","useIsViewportGated","getDocumentId","capability","isGated","documentId","$","user_effect","provides","docId","set","onGateChange","event","current","useViewportRef","plugin","containerRef","user_pre_effect","container","registerViewport","error","console","registerBoundingRectProvider","r","getBoundingClientRect","origin","x","left","y","top","size","width","height","onScroll","setViewportScrollMetrics","scrollTop","scrollLeft","addEventListener","resizeObserver","ResizeObserver","setViewportResizeMetrics","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","observe","unsubscribeScrollRequest","onScrollRequest","behavior","requestAnimationFrame","scrollTo","unregisterViewport","removeEventListener","disconnect","el","restProps","rest_props","$$props","viewportGap","viewportRef","viewportCapability","getViewportGap","$$render","consequent","bind_this","div","$$value","scrollActivity","isScrolling","isSmoothScrolling","onScrollActivity","activity"],"mappings":"wgBAGaA,EAAA,IAA0BC,YAA0BC,EAAAA,eAAeC,IACnEC,EAAA,IAA8BC,gBAA8BH,EAAAA,eAAeC,IAO3EG,EAAsBC,IAC3B,MAAAC,EAAaJ,IAEf,IAAAK,WAAiB,GAGf,MAAAC,YAAsBH,UAE5BI,EAAAC,uBACQC,EAAWL,EAAWK,SACtBC,QAAQJ,MAETG,GAAaC,EASX,OAHPH,EAAAI,IAAAN,EAAUI,EAASJ,QAAQK,IAAK,GAGzBD,EAASG,aAAcC,IACxBA,EAAMP,aAAeI,SACvBL,EAAUQ,EAAMR,SAAA,KAVlBE,EAAAI,IAAAN,GAAU,MAgBR,WAAAS,gBACKT,EACT,aCnCYU,EAAeZ,GACrB,MAAAa,OAAAA,GAAWpB,IAEf,IAAAqB,UAA6C,MAG3C,MAAAX,YAAsBH,UAE5BI,EAAAW,yBACOF,EAAA,OAEC,MAAAG,QAAYF,GACZP,QAAQJ,GACT,IAAAa,IAAcT,EAAA,WAIjBM,EAAOI,iBAAiBV,EAC1B,OAASW,eACPC,QAAQD,MAAA,4CAAkDX,KAAUW,EAEtE,CAUAL,EAAOO,6BAA6Bb,aAN5Bc,EAAIL,EAAUM,+BAElBC,QAAUC,EAAGH,EAAEI,KAAMC,EAAGL,EAAEM,KAC1BC,MAAQC,MAAOR,EAAEQ,MAAOC,OAAQT,EAAES,WAMh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