@embedpdf/plugin-render 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,127 @@
1
+ import { _ as PageViewDemand, i as PageLayerOptions, r as PageImage, s as RenderCapability, v as TilePaintPlan } from "./contract-uc5nOice.cjs";
2
+ import { AnnotationAppearanceImage, AnnotationRef, EventHook, OperationOptions, PageLayerRights, PageRef, PageRenderViewport, PluginErrorInfo } from "@embedpdf/core";
3
+ //#region src/host-contract.d.ts
4
+ /** Layer-facing paint settings (resolved config the view layers need). Reference-stable. */
5
+ interface PaintSettings {
6
+ /** Whether the tile plane is enabled at all (`tiles: false` opts out). */
7
+ readonly tiles: boolean;
8
+ }
9
+ interface RenderSourceOptions extends PageLayerOptions {
10
+ /** Device px per PDF point (the page transform's `renderScale`). */
11
+ scale: number;
12
+ /**
13
+ * The view the picture is for (the page context's `view`): the engine ranks
14
+ * the render by where the page is in that view (`doc.with({ view })`).
15
+ */
16
+ view?: string;
17
+ }
18
+ /**
19
+ * One view's tile surface. Identity (the view) is bound at creation; every
20
+ * call addresses that view's own state for the given page, so two views
21
+ * showing the same page plan independently — a thumbnail rail's
22
+ * never-engaging demand cannot disturb the main view's tiles.
23
+ *
24
+ * Reads are pure: `setDemand` is the one call that schedules fetches and
25
+ * re-plans; `getPlan` returns the paint plan that demand produced (memoized: the
26
+ * same object until the demand, an epoch, or a tile arrival changes it, so
27
+ * layers subscribe with plain `Object.is`). Handles are reference-stable per
28
+ * view id and reference-counted: every `createViewDemand` pairs with one
29
+ * `dispose`.
30
+ */
31
+ interface ViewDemand {
32
+ /** What this view wants for a page right now. Idempotent; schedules the want set. */
33
+ setDemand(page: PageRef, demand: PageViewDemand, options?: PageLayerOptions): void;
34
+ /** The current paint plan for a page under this view's demand. Pure. */
35
+ getPlan(page: PageRef): TilePaintPlan;
36
+ /** The image for this plan key had a presentation opportunity. */
37
+ markPainted(page: PageRef, key: string): void;
38
+ /** The inverse report: this plan key's element left the DOM. */
39
+ markUnpainted(page: PageRef, key: string): void;
40
+ /** This view unmounted its tile plane for the page: abort in-flight tile
41
+ * fetches, drop its own bookkeeping (resolved bytes stay cached). */
42
+ release(page: PageRef): void;
43
+ /** Release every page of this view and drop the handle's reference. */
44
+ dispose(): void;
45
+ }
46
+ /** Whose pictures: a page's annotations, or its form widgets. */
47
+ type AppearanceFamily = 'annotations' | 'widgets';
48
+ /** One of an owner's items on a page, at the version of its picture. */
49
+ interface AppearanceItem {
50
+ readonly ref: AnnotationRef;
51
+ /** Moves when the engine draws the item again (`pictureVersion`): its pictures are fetched again. */
52
+ readonly version: number;
53
+ }
54
+ /** What {@link RenderHostCapability.renderAppearances} takes. */
55
+ interface AppearancesOptions extends OperationOptions {
56
+ readonly family: AppearanceFamily;
57
+ /** Device px per PDF point, conformed through {@link RenderHostCapability.getAppearanceScale}. */
58
+ readonly scale: number;
59
+ /** The owner's items on the page whose pictures it wants, each at its version. */
60
+ readonly items: readonly AppearanceItem[];
61
+ }
62
+ /** The engine's picture of an item in one of its states, and the version of the item it shows. */
63
+ interface AppearancePicture extends AnnotationAppearanceImage {
64
+ readonly version: number;
65
+ }
66
+ interface RenderCompletedEvent {
67
+ readonly page: PageRef;
68
+ readonly key: string;
69
+ }
70
+ interface RenderFailedEvent {
71
+ readonly page: PageRef;
72
+ readonly key: string;
73
+ readonly error: PluginErrorInfo;
74
+ }
75
+ interface RenderHostCapability extends RenderCapability {
76
+ /**
77
+ * The viewer door: render a page at the scale a view shows it, conformed
78
+ * through the resolved render points (strategy ∧ policy): the exact
79
+ * demand capped at the pixel budget under `continuous`, the advertised
80
+ * ladder under a lattice — with same-key asks collapsing in the raster
81
+ * store. Layers key their fetch on {@link getSourceKey}.
82
+ */
83
+ renderSource(page: PageRef, options: RenderSourceOptions & OperationOptions): Promise<PageImage>;
84
+ /**
85
+ * The identity of the raster `renderSource` would produce — conformed
86
+ * width + the parts it draws + epoch (+ format), as one stable string.
87
+ * Under a lattice it moves only at rung crossings; under exact-mode
88
+ * `continuous` it tracks the demand and is constant above the budget.
89
+ */
90
+ getSourceKey(page: PageRef, options: RenderSourceOptions): string;
91
+ /** The canonical viewport a desired scale conforms to for this page (always width-kind). */
92
+ conformViewport(page: PageRef, scale: number): PageRenderViewport;
93
+ getPaintSettings(): PaintSettings;
94
+ /**
95
+ * What the user may read of the parts a picture draws beside the page
96
+ * content, so a view that leaves one part to a layer of its own can still
97
+ * ask for the other. The same object until a right changes.
98
+ */
99
+ getLayerRights(): PageLayerRights;
100
+ /** This view's tile surface. Stable per view id; pair with `dispose`. */
101
+ createViewDemand(viewId: string): ViewDemand;
102
+ /**
103
+ * The engine's pictures of the owner's items on a page (`family`): each
104
+ * item's look at rest, in every state it stores, each labelled with its
105
+ * state and tagged with the item's version, so a checkbox switches picture
106
+ * with no request, and a layer can tell a picture older than its item.
107
+ * The owner keys the ask on its items' versions: asks for the same page,
108
+ * family, scale and items share one fetch, and the last few sets of each
109
+ * page are kept. Rejects `permission-denied` without `doc.annotate.read`
110
+ * (annotations) or `doc.forms.read` (widgets).
111
+ */
112
+ renderAppearances(page: PageRef, options: AppearancesOptions): Promise<readonly AppearancePicture[]>;
113
+ /**
114
+ * An item's last pictures, every state, kept a while after it left its page:
115
+ * an undo that brings it back shows them at once. Empty for one never drawn.
116
+ */
117
+ keptAppearances(family: AppearanceFamily, item: AnnotationRef): readonly AppearancePicture[];
118
+ /** The appearance scale a render scale conforms to under the deployment's policy. */
119
+ getAppearanceScale(renderScale: number): number;
120
+ /** A base raster resolved / failed (the conforming and exact doors alike). */
121
+ readonly onRenderCompleted: EventHook<RenderCompletedEvent>;
122
+ readonly onRenderFailed: EventHook<RenderFailedEvent>;
123
+ }
124
+ declare const RenderToken: import("@embedpdf/core").CapabilityToken<RenderHostCapability>;
125
+ //#endregion
126
+ export { PaintSettings as a, RenderHostCapability as c, ViewDemand as d, AppearancesOptions as i, RenderSourceOptions as l, AppearanceItem as n, RenderCompletedEvent as o, AppearancePicture as r, RenderFailedEvent as s, AppearanceFamily as t, RenderToken as u };
127
+ //# sourceMappingURL=host-contract-CTOQn0Xz.d.cts.map
@@ -0,0 +1,127 @@
1
+ import { _ as PageViewDemand, i as PageLayerOptions, r as PageImage, s as RenderCapability, v as TilePaintPlan } from "./contract-uc5nOice.js";
2
+ import { AnnotationAppearanceImage, AnnotationRef, EventHook, OperationOptions, PageLayerRights, PageRef, PageRenderViewport, PluginErrorInfo } from "@embedpdf/core";
3
+ //#region src/host-contract.d.ts
4
+ /** Layer-facing paint settings (resolved config the view layers need). Reference-stable. */
5
+ interface PaintSettings {
6
+ /** Whether the tile plane is enabled at all (`tiles: false` opts out). */
7
+ readonly tiles: boolean;
8
+ }
9
+ interface RenderSourceOptions extends PageLayerOptions {
10
+ /** Device px per PDF point (the page transform's `renderScale`). */
11
+ scale: number;
12
+ /**
13
+ * The view the picture is for (the page context's `view`): the engine ranks
14
+ * the render by where the page is in that view (`doc.with({ view })`).
15
+ */
16
+ view?: string;
17
+ }
18
+ /**
19
+ * One view's tile surface. Identity (the view) is bound at creation; every
20
+ * call addresses that view's own state for the given page, so two views
21
+ * showing the same page plan independently — a thumbnail rail's
22
+ * never-engaging demand cannot disturb the main view's tiles.
23
+ *
24
+ * Reads are pure: `setDemand` is the one call that schedules fetches and
25
+ * re-plans; `getPlan` returns the paint plan that demand produced (memoized: the
26
+ * same object until the demand, an epoch, or a tile arrival changes it, so
27
+ * layers subscribe with plain `Object.is`). Handles are reference-stable per
28
+ * view id and reference-counted: every `createViewDemand` pairs with one
29
+ * `dispose`.
30
+ */
31
+ interface ViewDemand {
32
+ /** What this view wants for a page right now. Idempotent; schedules the want set. */
33
+ setDemand(page: PageRef, demand: PageViewDemand, options?: PageLayerOptions): void;
34
+ /** The current paint plan for a page under this view's demand. Pure. */
35
+ getPlan(page: PageRef): TilePaintPlan;
36
+ /** The image for this plan key had a presentation opportunity. */
37
+ markPainted(page: PageRef, key: string): void;
38
+ /** The inverse report: this plan key's element left the DOM. */
39
+ markUnpainted(page: PageRef, key: string): void;
40
+ /** This view unmounted its tile plane for the page: abort in-flight tile
41
+ * fetches, drop its own bookkeeping (resolved bytes stay cached). */
42
+ release(page: PageRef): void;
43
+ /** Release every page of this view and drop the handle's reference. */
44
+ dispose(): void;
45
+ }
46
+ /** Whose pictures: a page's annotations, or its form widgets. */
47
+ type AppearanceFamily = 'annotations' | 'widgets';
48
+ /** One of an owner's items on a page, at the version of its picture. */
49
+ interface AppearanceItem {
50
+ readonly ref: AnnotationRef;
51
+ /** Moves when the engine draws the item again (`pictureVersion`): its pictures are fetched again. */
52
+ readonly version: number;
53
+ }
54
+ /** What {@link RenderHostCapability.renderAppearances} takes. */
55
+ interface AppearancesOptions extends OperationOptions {
56
+ readonly family: AppearanceFamily;
57
+ /** Device px per PDF point, conformed through {@link RenderHostCapability.getAppearanceScale}. */
58
+ readonly scale: number;
59
+ /** The owner's items on the page whose pictures it wants, each at its version. */
60
+ readonly items: readonly AppearanceItem[];
61
+ }
62
+ /** The engine's picture of an item in one of its states, and the version of the item it shows. */
63
+ interface AppearancePicture extends AnnotationAppearanceImage {
64
+ readonly version: number;
65
+ }
66
+ interface RenderCompletedEvent {
67
+ readonly page: PageRef;
68
+ readonly key: string;
69
+ }
70
+ interface RenderFailedEvent {
71
+ readonly page: PageRef;
72
+ readonly key: string;
73
+ readonly error: PluginErrorInfo;
74
+ }
75
+ interface RenderHostCapability extends RenderCapability {
76
+ /**
77
+ * The viewer door: render a page at the scale a view shows it, conformed
78
+ * through the resolved render points (strategy ∧ policy): the exact
79
+ * demand capped at the pixel budget under `continuous`, the advertised
80
+ * ladder under a lattice — with same-key asks collapsing in the raster
81
+ * store. Layers key their fetch on {@link getSourceKey}.
82
+ */
83
+ renderSource(page: PageRef, options: RenderSourceOptions & OperationOptions): Promise<PageImage>;
84
+ /**
85
+ * The identity of the raster `renderSource` would produce — conformed
86
+ * width + the parts it draws + epoch (+ format), as one stable string.
87
+ * Under a lattice it moves only at rung crossings; under exact-mode
88
+ * `continuous` it tracks the demand and is constant above the budget.
89
+ */
90
+ getSourceKey(page: PageRef, options: RenderSourceOptions): string;
91
+ /** The canonical viewport a desired scale conforms to for this page (always width-kind). */
92
+ conformViewport(page: PageRef, scale: number): PageRenderViewport;
93
+ getPaintSettings(): PaintSettings;
94
+ /**
95
+ * What the user may read of the parts a picture draws beside the page
96
+ * content, so a view that leaves one part to a layer of its own can still
97
+ * ask for the other. The same object until a right changes.
98
+ */
99
+ getLayerRights(): PageLayerRights;
100
+ /** This view's tile surface. Stable per view id; pair with `dispose`. */
101
+ createViewDemand(viewId: string): ViewDemand;
102
+ /**
103
+ * The engine's pictures of the owner's items on a page (`family`): each
104
+ * item's look at rest, in every state it stores, each labelled with its
105
+ * state and tagged with the item's version, so a checkbox switches picture
106
+ * with no request, and a layer can tell a picture older than its item.
107
+ * The owner keys the ask on its items' versions: asks for the same page,
108
+ * family, scale and items share one fetch, and the last few sets of each
109
+ * page are kept. Rejects `permission-denied` without `doc.annotate.read`
110
+ * (annotations) or `doc.forms.read` (widgets).
111
+ */
112
+ renderAppearances(page: PageRef, options: AppearancesOptions): Promise<readonly AppearancePicture[]>;
113
+ /**
114
+ * An item's last pictures, every state, kept a while after it left its page:
115
+ * an undo that brings it back shows them at once. Empty for one never drawn.
116
+ */
117
+ keptAppearances(family: AppearanceFamily, item: AnnotationRef): readonly AppearancePicture[];
118
+ /** The appearance scale a render scale conforms to under the deployment's policy. */
119
+ getAppearanceScale(renderScale: number): number;
120
+ /** A base raster resolved / failed (the conforming and exact doors alike). */
121
+ readonly onRenderCompleted: EventHook<RenderCompletedEvent>;
122
+ readonly onRenderFailed: EventHook<RenderFailedEvent>;
123
+ }
124
+ declare const RenderToken: import("@embedpdf/core").CapabilityToken<RenderHostCapability>;
125
+ //#endregion
126
+ export { PaintSettings as a, RenderHostCapability as c, ViewDemand as d, AppearancesOptions as i, RenderSourceOptions as l, AppearanceItem as n, RenderCompletedEvent as o, AppearancePicture as r, RenderFailedEvent as s, AppearanceFamily as t, RenderToken as u };
127
+ //# sourceMappingURL=host-contract-CsjZjWjb.d.ts.map