@embedpdf/react 3.0.0-next.3 → 3.0.0-next.5

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.
Files changed (57) hide show
  1. package/dist/{AnnotationListSnapshot-W0RCsyDE-dWna4TTJ.d.cts → AnnotationListSnapshot-CHjkcIaL-CMHGL8-D.d.cts} +19 -2
  2. package/dist/{AnnotationListSnapshot-W0RCsyDE-dWna4TTJ.d.ts → AnnotationListSnapshot-CHjkcIaL-CMHGL8-D.d.ts} +19 -2
  3. package/dist/anchored.cjs +89 -0
  4. package/dist/anchored.cjs.map +1 -0
  5. package/dist/anchored.d.cts +45 -0
  6. package/dist/anchored.d.ts +45 -0
  7. package/dist/anchored.js +60 -0
  8. package/dist/anchored.js.map +1 -0
  9. package/dist/annotation-menu.cjs +33 -84
  10. package/dist/annotation-menu.cjs.map +1 -1
  11. package/dist/annotation-menu.d.cts +28 -2
  12. package/dist/annotation-menu.d.ts +28 -2
  13. package/dist/annotation-menu.js +27 -78
  14. package/dist/annotation-menu.js.map +1 -1
  15. package/dist/annotation.cjs +689 -16
  16. package/dist/annotation.cjs.map +1 -0
  17. package/dist/annotation.d.cts +119 -2
  18. package/dist/annotation.d.ts +119 -2
  19. package/dist/annotation.js +678 -3
  20. package/dist/annotation.js.map +1 -0
  21. package/dist/form.cjs +1 -1
  22. package/dist/form.d.cts +2 -2
  23. package/dist/form.d.ts +2 -2
  24. package/dist/form.js +1 -1
  25. package/dist/index.cjs +14 -3
  26. package/dist/index.d.cts +5 -4
  27. package/dist/index.d.ts +5 -4
  28. package/dist/index.js +4 -3
  29. package/dist/interaction.cjs +1 -1
  30. package/dist/interaction.js +1 -1
  31. package/dist/page-view.cjs +58 -36
  32. package/dist/page-view.cjs.map +1 -1
  33. package/dist/page-view.js +54 -34
  34. package/dist/page-view.js.map +1 -1
  35. package/dist/search.cjs +36 -19
  36. package/dist/search.cjs.map +1 -1
  37. package/dist/search.d.cts +1 -1
  38. package/dist/search.d.ts +1 -1
  39. package/dist/search.js +36 -19
  40. package/dist/search.js.map +1 -1
  41. package/dist/selection.cjs +73 -22
  42. package/dist/selection.cjs.map +1 -1
  43. package/dist/selection.d.cts +35 -2
  44. package/dist/selection.d.ts +35 -2
  45. package/dist/selection.js +66 -23
  46. package/dist/selection.js.map +1 -1
  47. package/dist/stage.cjs +33 -1
  48. package/dist/stage.cjs.map +1 -1
  49. package/dist/stage.js +33 -1
  50. package/dist/stage.js.map +1 -1
  51. package/package.json +27 -23
  52. package/dist/annotation-B6jwfTCh.d.cts +0 -173
  53. package/dist/annotation-Ct6dFtzJ.cjs +0 -913
  54. package/dist/annotation-Ct6dFtzJ.cjs.map +0 -1
  55. package/dist/annotation-DjGWJljY.js +0 -829
  56. package/dist/annotation-DjGWJljY.js.map +0 -1
  57. 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