@marianmeres/stuic 3.32.0 → 3.32.2
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.
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<script lang="ts">
|
|
13
|
-
import Book, { computeBookPageSize } from "./Book.svelte";
|
|
13
|
+
import Book, { computeBookPageSize, type BookPage } from "./Book.svelte";
|
|
14
14
|
import { waitForTwoRepaints } from "../../utils/paint.js";
|
|
15
15
|
|
|
16
|
+
let bookRef: ReturnType<typeof Book> | undefined = $state();
|
|
17
|
+
|
|
16
18
|
let {
|
|
17
19
|
pages,
|
|
18
20
|
minPageWidth = 150,
|
|
@@ -34,6 +36,17 @@
|
|
|
34
36
|
let resizing = $state(false);
|
|
35
37
|
let measured = $state(false);
|
|
36
38
|
|
|
39
|
+
// ---- Proxy API (safe no-ops during remount) ----
|
|
40
|
+
|
|
41
|
+
export function next() { bookRef?.next(); }
|
|
42
|
+
export function previous() { bookRef?.previous(); }
|
|
43
|
+
export function goTo(spreadIndex: number) { bookRef?.goTo(spreadIndex); }
|
|
44
|
+
export function goToPage(pageId: BookPage["id"]) { bookRef?.goToPage(pageId); }
|
|
45
|
+
export function zoomIn() { bookRef?.zoomIn(); }
|
|
46
|
+
export function zoomOut() { bookRef?.zoomOut(); }
|
|
47
|
+
export function resetZoom() { bookRef?.resetZoom(); }
|
|
48
|
+
export function getCollection() { return bookRef?.getCollection(); }
|
|
49
|
+
|
|
37
50
|
// Dynamically size the book to fill available container space.
|
|
38
51
|
// We own the single/dual page decision (responsive={false}) to avoid feedback loops —
|
|
39
52
|
// the Book's internal responsive detection uses bind:clientWidth which conflicts with
|
|
@@ -104,6 +117,7 @@
|
|
|
104
117
|
>
|
|
105
118
|
{#if measured}
|
|
106
119
|
<Book
|
|
120
|
+
bind:this={bookRef}
|
|
107
121
|
{pages}
|
|
108
122
|
responsive={false}
|
|
109
123
|
singlePage={forceSingle}
|
|
@@ -5,6 +5,16 @@ export interface Props extends Omit<BookProps, "responsive" | "singlePage"> {
|
|
|
5
5
|
/** Resize debounce delay in ms (default: 150) */
|
|
6
6
|
debounce?: number;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
import { type BookPage } from "./Book.svelte";
|
|
9
|
+
declare const BookResponsive: import("svelte").Component<Props, {
|
|
10
|
+
next: () => void;
|
|
11
|
+
previous: () => void;
|
|
12
|
+
goTo: (spreadIndex: number) => void;
|
|
13
|
+
goToPage: (pageId: BookPage["id"]) => void;
|
|
14
|
+
zoomIn: () => void;
|
|
15
|
+
zoomOut: () => void;
|
|
16
|
+
resetZoom: () => void;
|
|
17
|
+
getCollection: () => import("./Book.svelte").BookCollection | undefined;
|
|
18
|
+
}, "activeSpread">;
|
|
9
19
|
type BookResponsive = ReturnType<typeof BookResponsive>;
|
|
10
20
|
export default BookResponsive;
|
package/dist/utils/debounce.d.ts
CHANGED
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
* input.addEventListener('input', (e) => debouncedSearch(e.target.value));
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
|
-
export declare function debounce<T extends (...args:
|
|
13
|
+
export declare function debounce<T extends (...args: any[]) => any>(fn: T, wait: number): (...args: Parameters<T>) => void;
|
package/dist/utils/debounce.js
CHANGED
package/dist/utils/throttle.d.ts
CHANGED
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
* // handleScroll will be called at most once every 300ms
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
export declare function throttle<T extends (...args:
|
|
20
|
+
export declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): (...args: Parameters<T>) => void;
|
package/dist/utils/throttle.js
CHANGED