@embedpdf/react 3.0.0-next.1 → 3.0.0-next.10
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.
- package/dist/AnnotationListSnapshot-DDxHpJQU-BG32YXxG.d.cts +347 -0
- package/dist/AnnotationListSnapshot-DDxHpJQU-BG32YXxG.d.ts +347 -0
- package/dist/anchored.cjs +89 -0
- package/dist/anchored.cjs.map +1 -0
- package/dist/anchored.d.cts +45 -0
- package/dist/anchored.d.ts +45 -0
- package/dist/anchored.js +60 -0
- package/dist/anchored.js.map +1 -0
- package/dist/annotation-menu.cjs +33 -84
- package/dist/annotation-menu.cjs.map +1 -1
- package/dist/annotation-menu.d.cts +28 -2
- package/dist/annotation-menu.d.ts +28 -2
- package/dist/annotation-menu.js +27 -78
- package/dist/annotation-menu.js.map +1 -1
- package/dist/annotation.cjs +752 -16
- package/dist/annotation.cjs.map +1 -0
- package/dist/annotation.d.cts +159 -2
- package/dist/annotation.d.ts +159 -2
- package/dist/annotation.js +737 -3
- package/dist/annotation.js.map +1 -0
- package/dist/commands.js +1 -0
- package/dist/commands.js.map +1 -1
- package/dist/form.cjs +3 -3
- package/dist/form.cjs.map +1 -1
- package/dist/form.d.cts +2 -2
- package/dist/form.d.ts +2 -2
- package/dist/form.js +3 -3
- package/dist/form.js.map +1 -1
- package/dist/index.cjs +34 -5
- package/dist/index.d.cts +14 -8
- package/dist/index.d.ts +14 -8
- package/dist/index.js +8 -6
- package/dist/interaction.cjs +17 -4
- package/dist/interaction.cjs.map +1 -1
- package/dist/interaction.d.cts +2 -2
- package/dist/interaction.d.ts +2 -2
- package/dist/interaction.js +7 -5
- package/dist/interaction.js.map +1 -1
- package/dist/link.cjs +29 -6
- package/dist/link.cjs.map +1 -1
- package/dist/link.d.cts +12 -3
- package/dist/link.d.ts +12 -3
- package/dist/link.js +31 -8
- package/dist/link.js.map +1 -1
- package/dist/metadata.js +1 -0
- package/dist/metadata.js.map +1 -1
- package/dist/page-edit.js +1 -0
- package/dist/page-edit.js.map +1 -1
- package/dist/page-view.cjs +62 -38
- package/dist/page-view.cjs.map +1 -1
- package/dist/page-view.js +59 -37
- package/dist/page-view.js.map +1 -1
- package/dist/redaction.js +1 -0
- package/dist/redaction.js.map +1 -1
- package/dist/render.cjs +67 -50
- package/dist/render.cjs.map +1 -1
- package/dist/render.d.cts +6 -19
- package/dist/render.d.ts +6 -19
- package/dist/render.js +71 -52
- package/dist/render.js.map +1 -1
- package/dist/rolldown-runtime-BBjsoOtd.js +27 -0
- package/dist/{runtime-DV98q7I0.d.ts → runtime-Cvi0wQ4d.d.cts} +23 -10
- package/dist/{runtime-CMxIuF2O.d.cts → runtime-DXxr8T4L.d.ts} +23 -10
- package/dist/runtime.cjs +6 -5
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +7 -5
- package/dist/runtime.js.map +1 -1
- package/dist/search.cjs +36 -19
- package/dist/search.cjs.map +1 -1
- package/dist/search.d.cts +1 -1
- package/dist/search.d.ts +1 -1
- package/dist/search.js +36 -19
- package/dist/search.js.map +1 -1
- package/dist/selection.cjs +217 -22
- package/dist/selection.cjs.map +1 -1
- package/dist/selection.d.cts +60 -2
- package/dist/selection.d.ts +60 -2
- package/dist/selection.js +214 -27
- package/dist/selection.js.map +1 -1
- package/dist/shell.js +1 -0
- package/dist/shell.js.map +1 -1
- package/dist/stage.cjs +47 -146
- package/dist/stage.cjs.map +1 -1
- package/dist/stage.d.cts +18 -5
- package/dist/stage.d.ts +18 -5
- package/dist/stage.js +50 -148
- package/dist/stage.js.map +1 -1
- package/dist/stamp.js +1 -0
- package/dist/stamp.js.map +1 -1
- package/dist/toolbar.js +1 -0
- package/dist/toolbar.js.map +1 -1
- package/dist/views.js +1 -0
- package/dist/views.js.map +1 -1
- package/package.json +27 -26
- package/dist/AnnotationListSnapshot-W0RCsyDE-dWna4TTJ.d.cts +0 -2593
- package/dist/AnnotationListSnapshot-W0RCsyDE-dWna4TTJ.d.ts +0 -2593
- package/dist/annotation-B6jwfTCh.d.cts +0 -173
- package/dist/annotation-Ct6dFtzJ.cjs +0 -913
- package/dist/annotation-Ct6dFtzJ.cjs.map +0 -1
- package/dist/annotation-DjGWJljY.js +0 -829
- package/dist/annotation-DjGWJljY.js.map +0 -1
- package/dist/annotation-nUMefyjw.d.ts +0 -173
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { t as AnnotationDTO } from "./AnnotationListSnapshot-W0RCsyDE-dWna4TTJ.cjs";
|
|
2
|
-
import { o as PageContextValue } from "./runtime-CMxIuF2O.cjs";
|
|
3
|
-
import { Behavior, FilePickerProvider, SelectionFlags, SelectionFlags as SelectionFlags$1, SelectionProps, SelectionProps as SelectionProps$1 } from "@embedpdf/plugin-annotation";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import { AnnotationFlags, AnnotationProps, AnnotationProps as AnnotationProps$1, AnnotationPropsPatch, AnnotationPropsPatch as AnnotationPropsPatch$1, Border, CreationDraftAnchor, Geom, LineEnding, LineEndings, PropKey, PropSpec, Rect, RenderItem, RenderItem as RenderItem$1, Style, TextAlign, TextStyle, Vec } from "@embedpdf/core-annotation";
|
|
6
|
-
import { Rect as Rect$1 } from "@embedpdf/core-geometry";
|
|
7
|
-
//#region src/internal/annotation-menu-position.d.ts
|
|
8
|
-
type AnnotationMenuPlacement = 'top' | 'right' | 'bottom' | 'left';
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/annotation.d.ts
|
|
11
|
-
/**
|
|
12
|
-
* What an annotation renderer receives: the projected item (its `box` is LIVE —
|
|
13
|
-
* it follows drags), the page context, the engine's baked /AP raster (the
|
|
14
|
-
* "picture"), the default visual (`native` — wrap it or ignore it), and
|
|
15
|
-
* whether this entry currently OWNS the pointer (`interactive`). While not
|
|
16
|
-
* interactive the layer renders your component pointer-locked: the annotation
|
|
17
|
-
* stays a first-class citizen of the annotation plane (select/move/resize).
|
|
18
|
-
*/
|
|
19
|
-
interface AnnotationRendererProps {
|
|
20
|
-
item: RenderItem;
|
|
21
|
-
page: PageContextValue;
|
|
22
|
-
appearance: {
|
|
23
|
-
url: string;
|
|
24
|
-
box: Rect;
|
|
25
|
-
} | null;
|
|
26
|
-
native: React.ReactNode;
|
|
27
|
-
interactive: boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* ONE rule: "for THESE annotations, render THIS component, and it owns the
|
|
31
|
-
* pointer WHEN …". The two shapes:
|
|
32
|
-
*
|
|
33
|
-
* - `{ for, component, interactive? }` — your own rule. Without
|
|
34
|
-
* `interactive` it is a pure SKIN: pixels only, mechanically
|
|
35
|
-
* pointer-locked, the annotation plane keeps selection/move/resize. With
|
|
36
|
-
* `interactive` (boolean or live predicate) the layer registers a plugin
|
|
37
|
-
* Behavior for you: while it holds, the annotation plane stands down
|
|
38
|
-
* (hit-test-inert) and your component owns the input.
|
|
39
|
-
* - `{ behavior, component }` — the renderer for a PLUGIN-registered
|
|
40
|
-
* behavior (the form plugin's fill controls via `formWidgetRenderer`);
|
|
41
|
-
* the plugin decides engagement, never the app.
|
|
42
|
-
*
|
|
43
|
-
* Resolution: ownership beats skin — an ENGAGED behavior's component is
|
|
44
|
-
* authoritative; `for` rules apply only to plane-owned annotations, first
|
|
45
|
-
* match wins. Define entries OUTSIDE render (module scope or useMemo): entry
|
|
46
|
-
* identity keys the behavior registration.
|
|
47
|
-
*/
|
|
48
|
-
type AnnotationRenderer = {
|
|
49
|
-
behavior: string;
|
|
50
|
-
component: React.ComponentType<AnnotationRendererProps>;
|
|
51
|
-
} | {
|
|
52
|
-
/** Stable id for the auto-registered behavior (optional; generated). */
|
|
53
|
-
id?: string;
|
|
54
|
-
for: Behavior['matches'];
|
|
55
|
-
component: React.ComponentType<AnnotationRendererProps>;
|
|
56
|
-
interactive?: boolean | (() => boolean);
|
|
57
|
-
};
|
|
58
|
-
interface AnnotationLayerProps {
|
|
59
|
-
/** Annotation renderers — skins and interactive takeovers ({@link AnnotationRenderer}). */
|
|
60
|
-
renderers?: AnnotationRenderer[];
|
|
61
|
-
}
|
|
62
|
-
declare function AnnotationLayer({ renderers }?: AnnotationLayerProps): import("react/jsx-runtime").JSX.Element;
|
|
63
|
-
/**
|
|
64
|
-
* The default file-picker provider: the built-in file dialog (from
|
|
65
|
-
* `@embedpdf/web`), honouring the tool's `accept` filter. This is the ADAPTER
|
|
66
|
-
* fulfilling the plugin's DOM-free port — the dialog lives here, in the
|
|
67
|
-
* framework layer, never in the plugin. A picked `File` carries its own name
|
|
68
|
-
* and mime, so it goes straight through as the engine's file source.
|
|
69
|
-
*/
|
|
70
|
-
declare const filePickerProvider: FilePickerProvider;
|
|
71
|
-
/**
|
|
72
|
-
* Install the file-picker provider for the active document — the ONE port
|
|
73
|
-
* behind every click-then-pick tool (a stamp `'prompt'` source, the file-
|
|
74
|
-
* attachment tool). Call ONCE at a document-scoped spot (not inside
|
|
75
|
-
* `<AnnotationLayer>`, which is per page). Defaults to
|
|
76
|
-
* {@link filePickerProvider}, so a bare `useFilePickerProvider()` makes all of
|
|
77
|
-
* them work out of the box; pass a custom provider (asset library, cloud
|
|
78
|
-
* drive — switch on `req.subtype` / `req.toolId`) or `null` to make
|
|
79
|
-
* click-then-pick tools inert. Cleared on unmount.
|
|
80
|
-
*/
|
|
81
|
-
declare function useFilePickerProvider(provider?: FilePickerProvider | null): void;
|
|
82
|
-
declare function useAnnotation(): import("@embedpdf/plugin-annotation").AnnotationCapability;
|
|
83
|
-
declare function useAnnotationSelection(): string[];
|
|
84
|
-
/** The selected annotations as engine DTOs — for selection-aware toolbars/sidebars. */
|
|
85
|
-
declare function useAnnotationSelected(): AnnotationDTO[];
|
|
86
|
-
/**
|
|
87
|
-
* A tool's RESOLVED defaults (base + per-tool override) as a full flat props
|
|
88
|
-
* bag, subscribed so a `setDefaults` re-renders the consumer. Use this — not the
|
|
89
|
-
* imperative `useAnnotation().currentDefaults(id)` — to drive default-editing
|
|
90
|
-
* controls, so they reflect changes live. Pair with `propsForTool(id)` for the
|
|
91
|
-
* specs to render.
|
|
92
|
-
*/
|
|
93
|
-
declare function useAnnotationDefaults(toolId: string): AnnotationProps;
|
|
94
|
-
/**
|
|
95
|
-
* The selection's editable properties — ordered specs shared by every selected
|
|
96
|
-
* kind, current values, and which keys are mixed. THE hook a property sidebar
|
|
97
|
-
* renders from; write back with `useAnnotation().updateSelection({ [key]: v })`.
|
|
98
|
-
* Reference-stable between model changes (the capability memoizes by model
|
|
99
|
-
* identity), so the default equality is enough.
|
|
100
|
-
*/
|
|
101
|
-
declare function useSelectionProps(): SelectionProps;
|
|
102
|
-
/**
|
|
103
|
-
* The selection's `/F` annotation flags — per-flag `true`/`false`, `null` where
|
|
104
|
-
* the selected annotations disagree (render an indeterminate control), `null`
|
|
105
|
-
* overall when nothing is selected. Write back with
|
|
106
|
-
* `useAnnotation().updateSelectionFlags({ locked: true })`. Reference-stable
|
|
107
|
-
* between model changes, like {@link useSelectionProps}.
|
|
108
|
-
*/
|
|
109
|
-
declare function useSelectionFlags(): SelectionFlags | null;
|
|
110
|
-
/** The selection's menu anchor: the primary page + the union box of the selection
|
|
111
|
-
* on that page (content space). */
|
|
112
|
-
type SelectionAnchor = {
|
|
113
|
-
pon: number;
|
|
114
|
-
bounds: Rect;
|
|
115
|
-
knob?: Vec;
|
|
116
|
-
};
|
|
117
|
-
/** Structural equality for the selection anchor — keeps the menu from re-rendering
|
|
118
|
-
* on unrelated dispatches (the capability returns a fresh object each call). */
|
|
119
|
-
declare function sameAnchor(a: SelectionAnchor | null, b: SelectionAnchor | null): boolean;
|
|
120
|
-
/** What a menu's render prop receives: the live selection (engine DTOs) + the
|
|
121
|
-
* selection-scoped intents. Fully headless — you render all UI. */
|
|
122
|
-
interface AnnotationMenuRenderArgs {
|
|
123
|
-
selected: ReturnType<typeof useAnnotationSelected>;
|
|
124
|
-
deleteSelection: () => void;
|
|
125
|
-
deselect: () => void;
|
|
126
|
-
/** Restyle the selection with a flat props patch (see `useSelectionProps`). */
|
|
127
|
-
updateSelection: (patch: AnnotationPropsPatch) => void;
|
|
128
|
-
/** Rotate the current selection a quarter-turn clockwise about its centre. */
|
|
129
|
-
rotate90: () => void;
|
|
130
|
-
/** Reset the current selection to its as-authored orientation. */
|
|
131
|
-
resetRotation: () => void;
|
|
132
|
-
/** Group the current selection into one unit (selecting any member then
|
|
133
|
-
* selects all). */
|
|
134
|
-
group: () => Promise<void>;
|
|
135
|
-
/** Ungroup the group(s) the current selection touches. */
|
|
136
|
-
ungroup: () => Promise<void>;
|
|
137
|
-
/** Whether {@link group} would do something for the current selection. */
|
|
138
|
-
canGroup: boolean;
|
|
139
|
-
/** Whether {@link ungroup} would do something for the current selection. */
|
|
140
|
-
canUngroup: boolean;
|
|
141
|
-
}
|
|
142
|
-
interface AnnotationMenuProps {
|
|
143
|
-
children: (args: AnnotationMenuRenderArgs) => React.ReactNode;
|
|
144
|
-
/** Gap in screen px between the selection box and the menu (default 8). */
|
|
145
|
-
gap?: number;
|
|
146
|
-
/** Where to place the menu relative to the selection box. Default 'top'. */
|
|
147
|
-
placement?: AnnotationMenuPlacement;
|
|
148
|
-
}
|
|
149
|
-
declare function sameCreationDraftAnchor(a: CreationDraftAnchor | null, b: CreationDraftAnchor | null): boolean;
|
|
150
|
-
interface AnnotationDraftMenuRenderArgs extends CreationDraftAnchor {
|
|
151
|
-
finish: () => void;
|
|
152
|
-
cancel: () => void;
|
|
153
|
-
}
|
|
154
|
-
interface AnnotationDraftMenuProps {
|
|
155
|
-
children: (args: AnnotationDraftMenuRenderArgs) => React.ReactNode;
|
|
156
|
-
/** Gap in screen px between the draft anchor and the menu (default 8). */
|
|
157
|
-
gap?: number;
|
|
158
|
-
/** Where to place the menu relative to the draft anchor. Default 'top'. */
|
|
159
|
-
placement?: AnnotationMenuPlacement;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* The Stage-FREE selection menu, for `<PageView>` (no camera). It transforms a
|
|
163
|
-
* selected content rect to client px via `page.toClientRect`, then renders an
|
|
164
|
-
* UPRIGHT menu through a portal to
|
|
165
|
-
* `document.body` (so it never rotates with the page nor clips at a container
|
|
166
|
-
* edge). Re-measures on scroll/resize. For `<Stage>`, prefer `<AnnotationMenu>`
|
|
167
|
-
* from `@embedpdf/react/annotation-menu` (camera-driven, more responsive).
|
|
168
|
-
*/
|
|
169
|
-
declare function PageAnnotationMenu({ children, gap, placement }: AnnotationMenuProps): React.ReactPortal | null;
|
|
170
|
-
declare function PageAnnotationDraftMenu({ children, gap, placement }: AnnotationDraftMenuProps): React.ReactPortal | null;
|
|
171
|
-
//#endregion
|
|
172
|
-
export { useAnnotation as A, SelectionProps$1 as C, filePickerProvider as D, TextStyle as E, useSelectionFlags as F, useSelectionProps as I, AnnotationMenuPlacement as L, useAnnotationSelected as M, useAnnotationSelection as N, sameAnchor as O, useFilePickerProvider as P, SelectionFlags$1 as S, TextAlign as T, PageAnnotationMenu as _, AnnotationLayerProps as a, RenderItem$1 as b, AnnotationProps$1 as c, AnnotationRendererProps as d, Border as f, PageAnnotationDraftMenu as g, LineEndings as h, AnnotationLayer as i, useAnnotationDefaults as j, sameCreationDraftAnchor as k, AnnotationPropsPatch$1 as l, LineEnding as m, AnnotationDraftMenuRenderArgs as n, AnnotationMenuProps as o, Geom as p, AnnotationFlags as r, AnnotationMenuRenderArgs as s, AnnotationDraftMenuProps as t, AnnotationRenderer as u, PropKey as v, Style as w, SelectionAnchor as x, PropSpec as y };
|
|
173
|
-
//# sourceMappingURL=annotation-B6jwfTCh.d.cts.map
|