@embedpdf/plugin-scroll 2.0.0 → 2.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/svelte/hooks/use-scroll.svelte.ts","../../src/svelte/components/Scroller.svelte"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { ScrollPlugin, ScrollScope } from '@embedpdf/plugin-scroll';\n\nexport const useScrollPlugin = () => usePlugin<ScrollPlugin>(ScrollPlugin.id);\nexport const useScrollCapability = () => useCapability<ScrollPlugin>(ScrollPlugin.id);\n\n// Define the return type explicitly to maintain type safety\ninterface UseScrollReturn {\n provides: ScrollScope | null;\n state: {\n currentPage: number;\n totalPages: number;\n };\n}\n\n/**\n * Hook for scroll state for a specific document\n * @param documentId Document ID.\n */\nexport const useScroll = (getDocumentId: () => string | null): UseScrollReturn => {\n const capability = useScrollCapability();\n\n let state = $state({\n currentPage: 1,\n totalPages: 1,\n });\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n // Scoped capability for current docId\n const scopedProvides = $derived(\n capability.provides && documentId ? capability.provides.forDocument(documentId) : null,\n );\n\n $effect(() => {\n const provides = capability.provides;\n const docId = documentId;\n\n if (!provides || !docId) {\n state.currentPage = 1;\n state.totalPages = 1;\n return;\n }\n\n const scope = provides.forDocument(docId);\n\n // Initial values\n state.currentPage = scope.getCurrentPage();\n state.totalPages = scope.getTotalPages();\n\n // Subscribe to page changes for THIS docId\n return provides.onPageChange((event) => {\n if (event.documentId === docId) {\n state.currentPage = event.pageNumber;\n state.totalPages = event.totalPages;\n }\n });\n });\n\n return {\n get provides() {\n return scopedProvides;\n },\n get state() {\n return state;\n },\n };\n};\n","<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import type { HTMLAttributes } from 'svelte/elements';\n import { useScrollPlugin } from '../hooks';\n import { type ScrollerLayout, ScrollStrategy } from '@embedpdf/plugin-scroll';\n import type { PageLayout } from '@embedpdf/plugin-scroll';\n\n type ScrollerProps = HTMLAttributes<HTMLDivElement> & {\n documentId: string;\n renderPage: Snippet<[PageLayout]>;\n };\n\n let { documentId, renderPage, ...restProps }: ScrollerProps = $props();\n\n const { plugin: scrollPlugin } = useScrollPlugin();\n\n let layoutData = $state<{\n layout: ScrollerLayout | null;\n docId: string | null;\n }>({ layout: null, docId: null });\n\n $effect(() => {\n if (!scrollPlugin || !documentId) {\n layoutData = { layout: null, docId: null };\n return;\n }\n\n // When we get new data, store it along with the current documentId\n const unsubscribe = scrollPlugin.onScrollerData(documentId, (newLayout) => {\n layoutData = { layout: newLayout, docId: documentId };\n });\n\n // When the effect re-runs or component unmounts, clear the state\n return () => {\n unsubscribe();\n layoutData = { layout: null, docId: null };\n scrollPlugin.clearLayoutReady(documentId);\n };\n });\n\n // Only use layout if it matches the current documentId (prevents stale data)\n const scrollerLayout = $derived(layoutData.docId === documentId ? layoutData.layout : null);\n\n // Call setLayoutReady after layout is rendered (Svelte's equivalent to useLayoutEffect)\n $effect.pre(() => {\n if (!scrollPlugin || !documentId || !scrollerLayout) return;\n\n scrollPlugin.setLayoutReady(documentId);\n });\n</script>\n\n{#if scrollerLayout}\n <div\n {...restProps}\n style:width={`${scrollerLayout.totalWidth}px`}\n style:height={`${scrollerLayout.totalHeight}px`}\n style:position=\"relative\"\n style:box-sizing=\"border-box\"\n style:margin=\"0 auto\"\n style:display={scrollerLayout.strategy === ScrollStrategy.Horizontal ? 'flex' : undefined}\n style:flex-direction={scrollerLayout.strategy === ScrollStrategy.Horizontal ? 'row' : undefined}\n >\n <!-- Leading spacer -->\n <div\n style:width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? `${scrollerLayout.startSpacing}px`\n : '100%'}\n style:height={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? '100%'\n : `${scrollerLayout.startSpacing}px`}\n style:flex-shrink={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '0' : undefined}\n ></div>\n\n <!-- Page grid -->\n <div\n style:gap={`${scrollerLayout.pageGap}px`}\n style:display=\"flex\"\n style:align-items=\"center\"\n style:position=\"relative\"\n style:box-sizing=\"border-box\"\n style:flex-direction={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? 'row'\n : 'column'}\n style:min-height={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '100%' : undefined}\n style:min-width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? undefined\n : 'fit-content'}\n >\n {#each scrollerLayout.items as item (item.pageNumbers[0])}\n <div\n style:display=\"flex\"\n style:justify-content=\"center\"\n style:gap={`${scrollerLayout.pageGap}px`}\n >\n {#each item.pageLayouts as layout (layout.pageNumber)}\n <div\n style:width={`${layout.rotatedWidth}px`}\n style:height={`${layout.rotatedHeight}px`}\n >\n {@render renderPage(layout)}\n </div>\n {/each}\n </div>\n {/each}\n </div>\n\n <!-- Trailing spacer -->\n <div\n style:width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? `${scrollerLayout.endSpacing}px`\n : '100%'}\n style:height={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? '100%'\n : `${scrollerLayout.endSpacing}px`}\n style:flex-shrink={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '0' : undefined}\n ></div>\n </div>\n{/if}\n"],"names":["useScrollPlugin","usePlugin","ScrollPlugin","id","useScrollCapability","useCapability","restProps","$","rest_props","$$props","plugin","scrollPlugin","layoutData","layout","docId","user_effect","documentId","set","unsubscribe","onScrollerData","newLayout","clearLayoutReady","scrollerLayout","derived","get","user_pre_effect","setLayoutReady","width","totalWidth","height","totalHeight","strategy","ScrollStrategy","Horizontal","items","item","pageNumbers","$$anchor","pageLayouts","pageNumber","rotatedWidth","rotatedHeight","gap","pageGap","startSpacing","endSpacing","consequent","getDocumentId","capability","state","currentPage","totalPages","scopedProvides","provides","forDocument","scope","getCurrentPage","getTotalPages","onPageChange","event"],"mappings":"sgBAGaA,EAAA,IAAwBC,YAAwBC,EAA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aC,EAAAA,eAAeC,WACrD,OAAK,GAAA1B,EAAAiB,IACFF,GAAesB,qCACHtB,GAAeS,WAAaC,EAAAA,eAAeC,WAAa,SAAM,0BAKnES,IAAA,GAAAnC,EAAAiB,IAAAF,GAAeqB,uHAKPrB,GAAeS,WAAaC,EAAAA,eAAeC,WAC7D,MACA,4BACcX,GAAeS,WAAaC,EAAAA,eAAeC,WAAa,YAAS,oBAClEX,GAAeS,WAAaC,EAAAA,eAAeC,gBACxD,EACA,kDAsBSX,GAAeS,WAAaC,EAAAA,eAAeC,WAAS,GAAA1B,EAAAiB,IAC1DF,GAAeuB,eAClB,oBACUvB,GAAeS,WAAaC,EAAAA,eAAeC,WACrD,OAAK,GAAA1B,EAAAiB,IACFF,GAAeuB,mCACHvB,GAAeS,WAAaC,EAAAA,eAAeC,WAAa,SAAM,sCA/DlFX,MAAcwB,0BAFnB,oBD9B0BC,IAClB,MAAAC,EAAa5C,IAEf,IAAA6C,WACFC,YAAa,EACbC,WAAY,IAIR,MAAAnC,YAAsB+B,GAGtBK,EAAA7C,EAAAgB,QAAA,IACJyB,EAAWK,gBAAYrC,GAAagC,EAAWK,SAASC,kBAAYtC,IAAc,aAGpFT,EAAAQ,uBACQsC,EAAWL,EAAWK,SACtBvC,QAAQE,OAETqC,IAAavC,SAChBmC,EAAMC,YAAc,OACpBD,EAAME,WAAa,GAIf,MAAAI,EAAQF,EAASC,YAAYxC,GAO5B,OAJPmC,EAAMC,YAAcK,EAAMC,iBAC1BP,EAAME,WAAaI,EAAME,gBAGlBJ,EAASK,aAAcC,IACxBA,EAAM3C,aAAeF,IACvBmC,EAAMC,YAAcS,EAAMpB,WAC1BU,EAAME,WAAaQ,EAAMR,iBAMzB,YAAAE,gBACKD,EACT,EACI,SAAAH,UACKA,CACT"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/svelte/hooks/use-scroll.svelte.ts","../../src/svelte/components/Scroller.svelte"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { ScrollPlugin, ScrollScope } from '@embedpdf/plugin-scroll';\n\nexport const useScrollPlugin = () => usePlugin<ScrollPlugin>(ScrollPlugin.id);\nexport const useScrollCapability = () => useCapability<ScrollPlugin>(ScrollPlugin.id);\n\n// Define the return type explicitly to maintain type safety\ninterface UseScrollReturn {\n provides: ScrollScope | null;\n state: {\n currentPage: number;\n totalPages: number;\n };\n}\n\n/**\n * Hook for scroll state for a specific document\n * @param documentId Document ID.\n */\nexport const useScroll = (getDocumentId: () => string | null): UseScrollReturn => {\n const capability = useScrollCapability();\n\n let state = $state({\n currentPage: 1,\n totalPages: 1,\n });\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n // Scoped capability for current docId\n const scopedProvides = $derived(\n capability.provides && documentId ? capability.provides.forDocument(documentId) : null,\n );\n\n $effect(() => {\n const provides = capability.provides;\n const docId = documentId;\n\n if (!provides || !docId) {\n state.currentPage = 1;\n state.totalPages = 1;\n return;\n }\n\n const scope = provides.forDocument(docId);\n\n // Initial values\n state.currentPage = scope.getCurrentPage();\n state.totalPages = scope.getTotalPages();\n\n // Subscribe to page changes for THIS docId\n return provides.onPageChange((event) => {\n if (event.documentId === docId) {\n state.currentPage = event.pageNumber;\n state.totalPages = event.totalPages;\n }\n });\n });\n\n return {\n get provides() {\n return scopedProvides;\n },\n get state() {\n return state;\n },\n };\n};\n","<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import type { HTMLAttributes } from 'svelte/elements';\n import { useScrollPlugin } from '../hooks';\n import { type ScrollerLayout, ScrollStrategy } from '@embedpdf/plugin-scroll';\n import type { PageLayout } from '@embedpdf/plugin-scroll';\n\n type ScrollerProps = HTMLAttributes<HTMLDivElement> & {\n documentId: string;\n renderPage: Snippet<[PageLayout]>;\n };\n\n let { documentId, renderPage, ...restProps }: ScrollerProps = $props();\n\n const { plugin: scrollPlugin } = useScrollPlugin();\n\n let layoutData = $state<{\n layout: ScrollerLayout | null;\n docId: string | null;\n }>({ layout: null, docId: null });\n\n $effect(() => {\n if (!scrollPlugin || !documentId) {\n layoutData = { layout: null, docId: null };\n return;\n }\n\n // When we get new data, store it along with the current documentId\n const unsubscribe = scrollPlugin.onScrollerData(documentId, (newLayout) => {\n layoutData = { layout: newLayout, docId: documentId };\n });\n\n // When the effect re-runs or component unmounts, clear the state\n return () => {\n unsubscribe();\n layoutData = { layout: null, docId: null };\n scrollPlugin.clearLayoutReady(documentId);\n };\n });\n\n // Only use layout if it matches the current documentId (prevents stale data)\n const scrollerLayout = $derived(layoutData.docId === documentId ? layoutData.layout : null);\n\n // Call setLayoutReady after layout is rendered (Svelte's equivalent to useLayoutEffect)\n $effect.pre(() => {\n if (!scrollPlugin || !documentId || !scrollerLayout) return;\n\n scrollPlugin.setLayoutReady(documentId);\n });\n</script>\n\n{#if scrollerLayout}\n <div\n {...restProps}\n style:width={`${scrollerLayout.totalWidth}px`}\n style:height={`${scrollerLayout.totalHeight}px`}\n style:position=\"relative\"\n style:box-sizing=\"border-box\"\n style:margin=\"0 auto\"\n style:display={scrollerLayout.strategy === ScrollStrategy.Horizontal ? 'flex' : undefined}\n style:flex-direction={scrollerLayout.strategy === ScrollStrategy.Horizontal ? 'row' : undefined}\n >\n <!-- Leading spacer -->\n <div\n style:width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? `${scrollerLayout.startSpacing}px`\n : '100%'}\n style:height={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? '100%'\n : `${scrollerLayout.startSpacing}px`}\n style:flex-shrink={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '0' : undefined}\n ></div>\n\n <!-- Page grid -->\n <div\n style:gap={`${scrollerLayout.pageGap}px`}\n style:display=\"flex\"\n style:align-items=\"center\"\n style:position=\"relative\"\n style:box-sizing=\"border-box\"\n style:flex-direction={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? 'row'\n : 'column'}\n style:min-height={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '100%' : undefined}\n style:min-width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? undefined\n : 'fit-content'}\n >\n {#each scrollerLayout.items as item (item.pageNumbers[0])}\n <div\n style:display=\"flex\"\n style:justify-content=\"center\"\n style:gap={`${scrollerLayout.pageGap}px`}\n >\n {#each item.pageLayouts as layout (layout.pageNumber)}\n <div\n style:width={`${layout.rotatedWidth}px`}\n style:height={`${layout.rotatedHeight}px`}\n >\n {@render renderPage(layout)}\n </div>\n {/each}\n </div>\n {/each}\n </div>\n\n <!-- Trailing spacer -->\n <div\n style:width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? `${scrollerLayout.endSpacing}px`\n : '100%'}\n style:height={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? '100%'\n : `${scrollerLayout.endSpacing}px`}\n style:flex-shrink={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '0' : undefined}\n ></div>\n </div>\n{/if}\n"],"names":["useScrollPlugin","usePlugin","ScrollPlugin","id","useScrollCapability","useCapability","restProps","$","rest_props","$$props","plugin","scrollPlugin","layoutData","proxy","layout","docId","user_effect","documentId","set","unsubscribe","onScrollerData","newLayout","clearLayoutReady","scrollerLayout","derived","get","user_pre_effect","setLayoutReady","div","root_1","width","totalWidth","height","totalHeight","strategy","ScrollStrategy","Horizontal","div_1","div_2","each","items","item","pageNumbers","div_3","root_2","pageLayouts","pageNumber","$$anchor","div_4","root_3","styles_3","rotatedWidth","rotatedHeight","styles_2","gap","pageGap","div_5","styles","startSpacing","styles_1","styles_4","endSpacing","consequent","getDocumentId","capability","state","currentPage","totalPages","scopedProvides","provides","forDocument","scope","getCurrentPage","getTotalPages","onPageChange","event"],"mappings":"sgBAGaA,EAAA,IAAwBC,YAAwBC,EAAAA,aAAaC,IAC7DC,EAAA,IAA4BC,gBAA4BH,EAAAA,aAAaC,qLCQ/CG,EAASC,EAAAC,WAAAC,EAAA,mEAElCC,OAAQC,GAAiBX,QAE7BY,EAAaL,QAAMA,EAAAM,MAAA,CAGlBC,OAAQ,KAAMC,MAA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AcC,IACxBA,EAAM1D,aAAeF,IACvBkD,EAAMC,YAAcS,EAAM7B,WAC1BmB,EAAME,WAAaQ,EAAMR,iBAMzB,YAAAE,gBACKD,EACT,EACI,SAAAH,UACKA,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/svelte/hooks/use-scroll.svelte.ts","../../src/svelte/components/Scroller.svelte"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { ScrollPlugin, ScrollScope } from '@embedpdf/plugin-scroll';\n\nexport const useScrollPlugin = () => usePlugin<ScrollPlugin>(ScrollPlugin.id);\nexport const useScrollCapability = () => useCapability<ScrollPlugin>(ScrollPlugin.id);\n\n// Define the return type explicitly to maintain type safety\ninterface UseScrollReturn {\n provides: ScrollScope | null;\n state: {\n currentPage: number;\n totalPages: number;\n };\n}\n\n/**\n * Hook for scroll state for a specific document\n * @param documentId Document ID.\n */\nexport const useScroll = (getDocumentId: () => string | null): UseScrollReturn => {\n const capability = useScrollCapability();\n\n let state = $state({\n currentPage: 1,\n totalPages: 1,\n });\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n // Scoped capability for current docId\n const scopedProvides = $derived(\n capability.provides && documentId ? capability.provides.forDocument(documentId) : null,\n );\n\n $effect(() => {\n const provides = capability.provides;\n const docId = documentId;\n\n if (!provides || !docId) {\n state.currentPage = 1;\n state.totalPages = 1;\n return;\n }\n\n const scope = provides.forDocument(docId);\n\n // Initial values\n state.currentPage = scope.getCurrentPage();\n state.totalPages = scope.getTotalPages();\n\n // Subscribe to page changes for THIS docId\n return provides.onPageChange((event) => {\n if (event.documentId === docId) {\n state.currentPage = event.pageNumber;\n state.totalPages = event.totalPages;\n }\n });\n });\n\n return {\n get provides() {\n return scopedProvides;\n },\n get state() {\n return state;\n },\n };\n};\n","<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import type { HTMLAttributes } from 'svelte/elements';\n import { useScrollPlugin } from '../hooks';\n import { type ScrollerLayout, ScrollStrategy } from '@embedpdf/plugin-scroll';\n import type { PageLayout } from '@embedpdf/plugin-scroll';\n\n type ScrollerProps = HTMLAttributes<HTMLDivElement> & {\n documentId: string;\n renderPage: Snippet<[PageLayout]>;\n };\n\n let { documentId, renderPage, ...restProps }: ScrollerProps = $props();\n\n const { plugin: scrollPlugin } = useScrollPlugin();\n\n let layoutData = $state<{\n layout: ScrollerLayout | null;\n docId: string | null;\n }>({ layout: null, docId: null });\n\n $effect(() => {\n if (!scrollPlugin || !documentId) {\n layoutData = { layout: null, docId: null };\n return;\n }\n\n // When we get new data, store it along with the current documentId\n const unsubscribe = scrollPlugin.onScrollerData(documentId, (newLayout) => {\n layoutData = { layout: newLayout, docId: documentId };\n });\n\n // When the effect re-runs or component unmounts, clear the state\n return () => {\n unsubscribe();\n layoutData = { layout: null, docId: null };\n scrollPlugin.clearLayoutReady(documentId);\n };\n });\n\n // Only use layout if it matches the current documentId (prevents stale data)\n const scrollerLayout = $derived(layoutData.docId === documentId ? layoutData.layout : null);\n\n // Call setLayoutReady after layout is rendered (Svelte's equivalent to useLayoutEffect)\n $effect.pre(() => {\n if (!scrollPlugin || !documentId || !scrollerLayout) return;\n\n scrollPlugin.setLayoutReady(documentId);\n });\n</script>\n\n{#if scrollerLayout}\n <div\n {...restProps}\n style:width={`${scrollerLayout.totalWidth}px`}\n style:height={`${scrollerLayout.totalHeight}px`}\n style:position=\"relative\"\n style:box-sizing=\"border-box\"\n style:margin=\"0 auto\"\n style:display={scrollerLayout.strategy === ScrollStrategy.Horizontal ? 'flex' : undefined}\n style:flex-direction={scrollerLayout.strategy === ScrollStrategy.Horizontal ? 'row' : undefined}\n >\n <!-- Leading spacer -->\n <div\n style:width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? `${scrollerLayout.startSpacing}px`\n : '100%'}\n style:height={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? '100%'\n : `${scrollerLayout.startSpacing}px`}\n style:flex-shrink={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '0' : undefined}\n ></div>\n\n <!-- Page grid -->\n <div\n style:gap={`${scrollerLayout.pageGap}px`}\n style:display=\"flex\"\n style:align-items=\"center\"\n style:position=\"relative\"\n style:box-sizing=\"border-box\"\n style:flex-direction={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? 'row'\n : 'column'}\n style:min-height={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '100%' : undefined}\n style:min-width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? undefined\n : 'fit-content'}\n >\n {#each scrollerLayout.items as item (item.pageNumbers[0])}\n <div\n style:display=\"flex\"\n style:justify-content=\"center\"\n style:gap={`${scrollerLayout.pageGap}px`}\n >\n {#each item.pageLayouts as layout (layout.pageNumber)}\n <div\n style:width={`${layout.rotatedWidth}px`}\n style:height={`${layout.rotatedHeight}px`}\n >\n {@render renderPage(layout)}\n </div>\n {/each}\n </div>\n {/each}\n </div>\n\n <!-- Trailing spacer -->\n <div\n style:width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? `${scrollerLayout.endSpacing}px`\n : '100%'}\n style:height={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? '100%'\n : `${scrollerLayout.endSpacing}px`}\n style:flex-shrink={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '0' : undefined}\n ></div>\n </div>\n{/if}\n"],"names":["$$anchor"],"mappings":";;;;;AAGa,MAAA,kBAAA,MAAwB,UAAwB,aAAa,EAAE;AAC/D,MAAA,sBAAA,MAA4B,cAA4B,aAAa,EAAE;MAevE,YAAA,CAAa,kBAAwD;AAC1E,QAAA,aAAa,oBAAA;AAEf,MAAA,kBACF,aAAa,GACb,YAAY,GAAA;AAIR,QAAA,uBAAsB,aAAA;AAGtB,QAAA,iBAAA,EAAA,QAAA,MACJ,WAAW,kBAAY,UAAA,IAAa,WAAW,SAAS,kBAAY,UAAU,CAAA,IAAI,IAAA;AAGpF,IAAA,kBAAc;UACN,WAAW,WAAW;AACtB,UAAA,cAAQ,U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AAA;;;;;gBA/DlF,cAAc,EAAA,UAAA,UAAA;AAAA;;;;AAFnB;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/svelte/hooks/use-scroll.svelte.ts","../../src/svelte/components/Scroller.svelte"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport { ScrollPlugin, ScrollScope } from '@embedpdf/plugin-scroll';\n\nexport const useScrollPlugin = () => usePlugin<ScrollPlugin>(ScrollPlugin.id);\nexport const useScrollCapability = () => useCapability<ScrollPlugin>(ScrollPlugin.id);\n\n// Define the return type explicitly to maintain type safety\ninterface UseScrollReturn {\n provides: ScrollScope | null;\n state: {\n currentPage: number;\n totalPages: number;\n };\n}\n\n/**\n * Hook for scroll state for a specific document\n * @param documentId Document ID.\n */\nexport const useScroll = (getDocumentId: () => string | null): UseScrollReturn => {\n const capability = useScrollCapability();\n\n let state = $state({\n currentPage: 1,\n totalPages: 1,\n });\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n // Scoped capability for current docId\n const scopedProvides = $derived(\n capability.provides && documentId ? capability.provides.forDocument(documentId) : null,\n );\n\n $effect(() => {\n const provides = capability.provides;\n const docId = documentId;\n\n if (!provides || !docId) {\n state.currentPage = 1;\n state.totalPages = 1;\n return;\n }\n\n const scope = provides.forDocument(docId);\n\n // Initial values\n state.currentPage = scope.getCurrentPage();\n state.totalPages = scope.getTotalPages();\n\n // Subscribe to page changes for THIS docId\n return provides.onPageChange((event) => {\n if (event.documentId === docId) {\n state.currentPage = event.pageNumber;\n state.totalPages = event.totalPages;\n }\n });\n });\n\n return {\n get provides() {\n return scopedProvides;\n },\n get state() {\n return state;\n },\n };\n};\n","<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import type { HTMLAttributes } from 'svelte/elements';\n import { useScrollPlugin } from '../hooks';\n import { type ScrollerLayout, ScrollStrategy } from '@embedpdf/plugin-scroll';\n import type { PageLayout } from '@embedpdf/plugin-scroll';\n\n type ScrollerProps = HTMLAttributes<HTMLDivElement> & {\n documentId: string;\n renderPage: Snippet<[PageLayout]>;\n };\n\n let { documentId, renderPage, ...restProps }: ScrollerProps = $props();\n\n const { plugin: scrollPlugin } = useScrollPlugin();\n\n let layoutData = $state<{\n layout: ScrollerLayout | null;\n docId: string | null;\n }>({ layout: null, docId: null });\n\n $effect(() => {\n if (!scrollPlugin || !documentId) {\n layoutData = { layout: null, docId: null };\n return;\n }\n\n // When we get new data, store it along with the current documentId\n const unsubscribe = scrollPlugin.onScrollerData(documentId, (newLayout) => {\n layoutData = { layout: newLayout, docId: documentId };\n });\n\n // When the effect re-runs or component unmounts, clear the state\n return () => {\n unsubscribe();\n layoutData = { layout: null, docId: null };\n scrollPlugin.clearLayoutReady(documentId);\n };\n });\n\n // Only use layout if it matches the current documentId (prevents stale data)\n const scrollerLayout = $derived(layoutData.docId === documentId ? layoutData.layout : null);\n\n // Call setLayoutReady after layout is rendered (Svelte's equivalent to useLayoutEffect)\n $effect.pre(() => {\n if (!scrollPlugin || !documentId || !scrollerLayout) return;\n\n scrollPlugin.setLayoutReady(documentId);\n });\n</script>\n\n{#if scrollerLayout}\n <div\n {...restProps}\n style:width={`${scrollerLayout.totalWidth}px`}\n style:height={`${scrollerLayout.totalHeight}px`}\n style:position=\"relative\"\n style:box-sizing=\"border-box\"\n style:margin=\"0 auto\"\n style:display={scrollerLayout.strategy === ScrollStrategy.Horizontal ? 'flex' : undefined}\n style:flex-direction={scrollerLayout.strategy === ScrollStrategy.Horizontal ? 'row' : undefined}\n >\n <!-- Leading spacer -->\n <div\n style:width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? `${scrollerLayout.startSpacing}px`\n : '100%'}\n style:height={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? '100%'\n : `${scrollerLayout.startSpacing}px`}\n style:flex-shrink={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '0' : undefined}\n ></div>\n\n <!-- Page grid -->\n <div\n style:gap={`${scrollerLayout.pageGap}px`}\n style:display=\"flex\"\n style:align-items=\"center\"\n style:position=\"relative\"\n style:box-sizing=\"border-box\"\n style:flex-direction={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? 'row'\n : 'column'}\n style:min-height={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '100%' : undefined}\n style:min-width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? undefined\n : 'fit-content'}\n >\n {#each scrollerLayout.items as item (item.pageNumbers[0])}\n <div\n style:display=\"flex\"\n style:justify-content=\"center\"\n style:gap={`${scrollerLayout.pageGap}px`}\n >\n {#each item.pageLayouts as layout (layout.pageNumber)}\n <div\n style:width={`${layout.rotatedWidth}px`}\n style:height={`${layout.rotatedHeight}px`}\n >\n {@render renderPage(layout)}\n </div>\n {/each}\n </div>\n {/each}\n </div>\n\n <!-- Trailing spacer -->\n <div\n style:width={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? `${scrollerLayout.endSpacing}px`\n : '100%'}\n style:height={scrollerLayout.strategy === ScrollStrategy.Horizontal\n ? '100%'\n : `${scrollerLayout.endSpacing}px`}\n style:flex-shrink={scrollerLayout.strategy === ScrollStrategy.Horizontal ? '0' : undefined}\n ></div>\n </div>\n{/if}\n"],"names":["$$anchor"],"mappings":";;;;;AAGa,MAAA,kBAAA,MAAwB,UAAwB,aAAa,EAAE;AAC/D,MAAA,sBAAA,MAA4B,cAA4B,aAAa,EAAE;MAevE,YAAA,CAAa,kBAAwD;AAC1E,QAAA,aAAa,oBAAA;AAEf,MAAA,kBACF,aAAa,GACb,YAAY,GAAA;AAIR,QAAA,uBAAsB,aAAA;AAGtB,QAAA,iBAAA,EAAA,QAAA,MACJ,WAAW,kBAAY,UAAA,IAAa,WAAW,SAAS,kBAAY,UAAU,CAAA,IAAI,IAAA;AAGpF,IAAA,kBAAc;UACN,WAAW,WAAW;AACtB,UAAA,cAAQ,UAAA;SAET,YAAA,CAAa,OAAO;AACvB,YAAM,cAAc;AACpB,YAAM,aAAa;;IAErB;AAEM,UAAA,QAAQ,SA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c,EAAC,aAAa,eAAe,aAC7D,QACA;AAAA,8BACc,cAAc,EAAC,aAAa,eAAe,aAAa,SAAS;AAAA,6BAClE,cAAc,EAAC,aAAa,eAAe,aACxD,SACA;AAAA;+BAqBL,OAAE,IAAA,UAAA;AAAA,uBACY,cAAc,EAAC,aAAa,eAAe,aAAS,GAAA,EAAA,IAC1D,cAAc,EAAC,UAAU,OAC5B;AAAA,wBACU,cAAc,EAAC,aAAa,eAAe,aACrD,SAAK,GAAA,EAAA,IACF,cAAc,EAAC,UAAU;AAAA,+BACb,cAAc,EAAC,aAAa,eAAe,aAAa,MAAM;AAAA;;0BA9DpF,GAAE;AAAA;;gBADA,cAAc,EAAA,UAAA,UAAA;AAAA;;;;AAFnB;"}
@@ -2,7 +2,16 @@ interface ScrollerProps {
2
2
  documentId: string;
3
3
  }
4
4
  declare var __VLS_1: {
5
- page: any;
5
+ page: {
6
+ pageNumber: number;
7
+ pageIndex: number;
8
+ x: number;
9
+ y: number;
10
+ width: number;
11
+ height: number;
12
+ rotatedWidth: number;
13
+ rotatedHeight: number;
14
+ };
6
15
  };
7
16
  type __VLS_Slots = {} & {
8
17
  default?: (props: typeof __VLS_1) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/plugin-scroll",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.cjs",
@@ -35,15 +35,15 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@embedpdf/models": "2.0.0"
38
+ "@embedpdf/models": "2.0.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/react": "^18.2.0",
42
42
  "typescript": "^5.0.0",
43
- "@embedpdf/build": "1.1.0",
44
- "@embedpdf/plugin-viewport": "2.0.0",
45
- "@embedpdf/core": "2.0.0",
46
- "@embedpdf/plugin-spread": "2.0.0"
43
+ "@embedpdf/core": "2.0.1",
44
+ "@embedpdf/plugin-viewport": "2.0.1",
45
+ "@embedpdf/plugin-spread": "2.0.1",
46
+ "@embedpdf/build": "1.1.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "preact": "^10.26.4",
@@ -51,8 +51,8 @@
51
51
  "react-dom": ">=16.8.0",
52
52
  "vue": ">=3.2.0",
53
53
  "svelte": ">=5 <6",
54
- "@embedpdf/core": "2.0.0",
55
- "@embedpdf/plugin-viewport": "2.0.0"
54
+ "@embedpdf/core": "2.0.1",
55
+ "@embedpdf/plugin-viewport": "2.0.1"
56
56
  },
57
57
  "files": [
58
58
  "dist",