@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
- declare const BookResponsive: import("svelte").Component<Props, {}, "activeSpread">;
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;
@@ -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: unknown[]) => unknown>(fn: T, wait: number): (...args: Parameters<T>) => void;
13
+ export declare function debounce<T extends (...args: any[]) => any>(fn: T, wait: number): (...args: Parameters<T>) => void;
@@ -10,6 +10,7 @@
10
10
  * input.addEventListener('input', (e) => debouncedSearch(e.target.value));
11
11
  * ```
12
12
  */
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
14
  export function debounce(fn, wait) {
14
15
  let timeout = null;
15
16
  return function (...args) {
@@ -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: unknown[]) => unknown>(func: T, limit: number): (...args: Parameters<T>) => void;
20
+ export declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): (...args: Parameters<T>) => void;
@@ -17,6 +17,7 @@
17
17
  * // handleScroll will be called at most once every 300ms
18
18
  * ```
19
19
  */
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
21
  export function throttle(func, limit) {
21
22
  let lastCall = 0;
22
23
  let timeout = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.32.0",
3
+ "version": "3.32.2",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",