@embedpdf/plugin-stage 3.0.0-next.13 → 3.0.0-next.15

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.
@@ -0,0 +1,95 @@
1
+ import { A as StageCapability, I as StageSettings, U as ViewportPoint, z as StageViewState } from "./contract-DZR_jRer.cjs";
2
+ import { PageRef, Unsubscribe } from "@embedpdf/core";
3
+ import { Point as Point$1, Rect as Rect$1 } from "@embedpdf/core-geometry";
4
+ import { Camera, Camera as Camera$1, ScrollMetrics, Size, Size as Size$1 } from "@embedpdf/core-stage";
5
+ //#region src/model.d.ts
6
+ interface StageState extends StageSettings {
7
+ readonly camera: Camera;
8
+ /**
9
+ * One-way render-commit latch. False while the initial viewport-driven
10
+ * placement is unresolved; true only after its camera and settings writes
11
+ * have completed. Page and scroll screen-space reads refuse to answer while
12
+ * false, so an adapter can never paint the placeholder camera at the origin.
13
+ */
14
+ readonly placed: boolean;
15
+ /**
16
+ * Names of the responsive rules currently matching the box, in source order.
17
+ * State (not derived) so `matchesRule()` is reactive in every framework.
18
+ */
19
+ readonly activeRules: readonly string[];
20
+ /**
21
+ * False while the zoom is in motion, true once it has rested (about 150 ms
22
+ * of frames without a zoom write). Device-snapping of page origins is gated
23
+ * on this: a continuous zoom and a snapped origin cannot coexist without the
24
+ * anchor point jittering ±0.5 device px per step, so pages place
25
+ * fractionally while zooming and snap once at rest. Pans always snap (a pure
26
+ * translation has no anchor error).
27
+ */
28
+ readonly cameraResting: boolean;
29
+ /** The container size the host reported, in viewport px. */
30
+ readonly viewport: Size;
31
+ /**
32
+ * Device pixels per view pixel (web: `window.devicePixelRatio`). Feeds each
33
+ * page's transform so bitmaps render crisp and boxes land on the device
34
+ * grid. Defaults to 1.
35
+ */
36
+ readonly dpr: number;
37
+ /**
38
+ * The current page index, valid in both flows. Navigation sets it; in
39
+ * continuous flow manipulation derives it from the camera; in paged flow
40
+ * panning never moves it (the scene is a one-item slice at this page).
41
+ * An index, so it survives spread and layout regrouping.
42
+ */
43
+ readonly cursor: number;
44
+ /**
45
+ * What last drove the camera or cursor: `'programmatic'` for the arrival
46
+ * and reveal verbs (the ones action executors use), `'user'` for direct
47
+ * manipulation (wheel, drag, scrollbars, embedder scroll calls). The
48
+ * page-state feed hands it to the actions plugin, whose cascade budget
49
+ * counts only programmatic rounds, so user scrolling is never throttled.
50
+ */
51
+ readonly motionCause: 'user' | 'programmatic';
52
+ }
53
+ //#endregion
54
+ //#region src/host-contract.d.ts
55
+ /**
56
+ * The host lens: what the surface binding, the gesture controller and sibling
57
+ * plugins need. The same runtime token as the public contract, typed wider.
58
+ */
59
+ interface StageHostCapability extends StageCapability {
60
+ /**
61
+ * Report the container box (ResizeObserver); the first real size triggers placement. After
62
+ * that, a box with no area (hidden, or taken out of the page) keeps the last real viewport.
63
+ */
64
+ setViewportSize(size: Size$1): void;
65
+ /** Report the device pixel ratio so page transforms render crisp. */
66
+ setDevicePixelRatio(ratio: number): void;
67
+ /** Bracket a direct-manipulation gesture (touch pan / pinch); `elastic` enables rubber-band. */
68
+ beginGesture(options?: {
69
+ elastic?: boolean;
70
+ }): void;
71
+ endGesture(): void;
72
+ /** Momentum pan from a release velocity in viewport px/s. */
73
+ fling(velocityX: number, velocityY: number): void;
74
+ /** The touch double-tap zoom ladder around a viewport point. */
75
+ doubleTapZoom(point: ViewportPoint): void;
76
+ /** Zoom by a factor holding a viewport point fixed — the pinch primitive. */
77
+ zoomAround(point: ViewportPoint, factor: number): void;
78
+ /** The camera as a native scroller, in viewport px. Reference-stable. */
79
+ getScrollMetrics(): ScrollMetrics;
80
+ worldToViewport(world: Point$1): ViewportPoint;
81
+ viewportToWorld(point: ViewportPoint): Point$1;
82
+ pageToWorld(page: PageRef, point: Point$1): Point$1 | null;
83
+ /** Offer a candidate initial view; the highest-priority non-null wins at placement. */
84
+ provideInitialView(priority: number, provider: () => StageViewState | null): Unsubscribe;
85
+ /** Resolve the registered providers once (else reset). Called when the viewport is ready. */
86
+ placeInitial(): void;
87
+ /** Re-resolve the zoom intent against the current scene (wired to the page registry). */
88
+ refit(): void;
89
+ /** This lens's identity — the stage plugin id; pointer samples are stamped with it. */
90
+ getLensId(): string;
91
+ }
92
+ declare const StageToken: import("@embedpdf/core").CapabilityToken<StageHostCapability>;
93
+ //#endregion
94
+ export { Size$1 as a, StageState as c, ScrollMetrics as i, Point$1 as n, StageHostCapability as o, Rect$1 as r, StageToken as s, Camera$1 as t };
95
+ //# sourceMappingURL=host-contract-CPtbnJ4j.d.cts.map
@@ -0,0 +1,95 @@
1
+ import { A as StageCapability, I as StageSettings, U as ViewportPoint, z as StageViewState } from "./contract-CjHtrfJj.js";
2
+ import { PageRef, Unsubscribe } from "@embedpdf/core";
3
+ import { Camera, Camera as Camera$1, ScrollMetrics, Size, Size as Size$1 } from "@embedpdf/core-stage";
4
+ import { Point as Point$1, Rect as Rect$1 } from "@embedpdf/core-geometry";
5
+ //#region src/model.d.ts
6
+ interface StageState extends StageSettings {
7
+ readonly camera: Camera;
8
+ /**
9
+ * One-way render-commit latch. False while the initial viewport-driven
10
+ * placement is unresolved; true only after its camera and settings writes
11
+ * have completed. Page and scroll screen-space reads refuse to answer while
12
+ * false, so an adapter can never paint the placeholder camera at the origin.
13
+ */
14
+ readonly placed: boolean;
15
+ /**
16
+ * Names of the responsive rules currently matching the box, in source order.
17
+ * State (not derived) so `matchesRule()` is reactive in every framework.
18
+ */
19
+ readonly activeRules: readonly string[];
20
+ /**
21
+ * False while the zoom is in motion, true once it has rested (about 150 ms
22
+ * of frames without a zoom write). Device-snapping of page origins is gated
23
+ * on this: a continuous zoom and a snapped origin cannot coexist without the
24
+ * anchor point jittering ±0.5 device px per step, so pages place
25
+ * fractionally while zooming and snap once at rest. Pans always snap (a pure
26
+ * translation has no anchor error).
27
+ */
28
+ readonly cameraResting: boolean;
29
+ /** The container size the host reported, in viewport px. */
30
+ readonly viewport: Size;
31
+ /**
32
+ * Device pixels per view pixel (web: `window.devicePixelRatio`). Feeds each
33
+ * page's transform so bitmaps render crisp and boxes land on the device
34
+ * grid. Defaults to 1.
35
+ */
36
+ readonly dpr: number;
37
+ /**
38
+ * The current page index, valid in both flows. Navigation sets it; in
39
+ * continuous flow manipulation derives it from the camera; in paged flow
40
+ * panning never moves it (the scene is a one-item slice at this page).
41
+ * An index, so it survives spread and layout regrouping.
42
+ */
43
+ readonly cursor: number;
44
+ /**
45
+ * What last drove the camera or cursor: `'programmatic'` for the arrival
46
+ * and reveal verbs (the ones action executors use), `'user'` for direct
47
+ * manipulation (wheel, drag, scrollbars, embedder scroll calls). The
48
+ * page-state feed hands it to the actions plugin, whose cascade budget
49
+ * counts only programmatic rounds, so user scrolling is never throttled.
50
+ */
51
+ readonly motionCause: 'user' | 'programmatic';
52
+ }
53
+ //#endregion
54
+ //#region src/host-contract.d.ts
55
+ /**
56
+ * The host lens: what the surface binding, the gesture controller and sibling
57
+ * plugins need. The same runtime token as the public contract, typed wider.
58
+ */
59
+ interface StageHostCapability extends StageCapability {
60
+ /**
61
+ * Report the container box (ResizeObserver); the first real size triggers placement. After
62
+ * that, a box with no area (hidden, or taken out of the page) keeps the last real viewport.
63
+ */
64
+ setViewportSize(size: Size$1): void;
65
+ /** Report the device pixel ratio so page transforms render crisp. */
66
+ setDevicePixelRatio(ratio: number): void;
67
+ /** Bracket a direct-manipulation gesture (touch pan / pinch); `elastic` enables rubber-band. */
68
+ beginGesture(options?: {
69
+ elastic?: boolean;
70
+ }): void;
71
+ endGesture(): void;
72
+ /** Momentum pan from a release velocity in viewport px/s. */
73
+ fling(velocityX: number, velocityY: number): void;
74
+ /** The touch double-tap zoom ladder around a viewport point. */
75
+ doubleTapZoom(point: ViewportPoint): void;
76
+ /** Zoom by a factor holding a viewport point fixed — the pinch primitive. */
77
+ zoomAround(point: ViewportPoint, factor: number): void;
78
+ /** The camera as a native scroller, in viewport px. Reference-stable. */
79
+ getScrollMetrics(): ScrollMetrics;
80
+ worldToViewport(world: Point$1): ViewportPoint;
81
+ viewportToWorld(point: ViewportPoint): Point$1;
82
+ pageToWorld(page: PageRef, point: Point$1): Point$1 | null;
83
+ /** Offer a candidate initial view; the highest-priority non-null wins at placement. */
84
+ provideInitialView(priority: number, provider: () => StageViewState | null): Unsubscribe;
85
+ /** Resolve the registered providers once (else reset). Called when the viewport is ready. */
86
+ placeInitial(): void;
87
+ /** Re-resolve the zoom intent against the current scene (wired to the page registry). */
88
+ refit(): void;
89
+ /** This lens's identity — the stage plugin id; pointer samples are stamped with it. */
90
+ getLensId(): string;
91
+ }
92
+ declare const StageToken: import("@embedpdf/core").CapabilityToken<StageHostCapability>;
93
+ //#endregion
94
+ export { Size$1 as a, StageState as c, ScrollMetrics as i, Point$1 as n, StageHostCapability as o, Rect$1 as r, StageToken as s, Camera$1 as t };
95
+ //# sourceMappingURL=host-contract-Du5tEZ4h.d.ts.map