@embedpdf/plugin-selection 3.0.0-next.4 → 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.
- package/dist/index.cjs +20 -399
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -172
- package/dist/index.d.ts +13 -172
- package/dist/index.js +18 -389
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +11 -0
- package/dist/internal.d.cts +62 -0
- package/dist/internal.d.ts +62 -0
- package/dist/internal.js +2 -0
- package/dist/reducer-CZG2TZgo.js +688 -0
- package/dist/reducer-CZG2TZgo.js.map +1 -0
- package/dist/reducer-Dyf8p5h-.cjs +741 -0
- package/dist/reducer-Dyf8p5h-.cjs.map +1 -0
- package/dist/types-DtWaZIsm.d.cts +286 -0
- package/dist/types-DtWaZIsm.d.ts +286 -0
- package/package.json +9 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,185 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { PageGeometrySnapshot, PageTextLayout, PdfPoint, PdfQuad, PdfRect, PdfTextSegment } from "@embedpdf/engine-core/runtime";
|
|
4
|
-
import { InteractionCapability, InteractionHandler } from "@embedpdf/plugin-interaction";
|
|
5
|
-
//#region src/geometry.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* One merged visual line of a selection, in content space — the structural
|
|
8
|
-
* twin of the engine's `PdfTextSegment`. `quad` carries frame-geometric
|
|
9
|
-
* corner semantics (upper = ascent side, start = the frame's −x); `advance`
|
|
10
|
-
* is the READING direction along the baseline (+1 = toward `end`), derived
|
|
11
|
-
* from the glyph sequence — geometry and bidi stay separate concerns.
|
|
12
|
-
* `rect` is the content-space AABB.
|
|
13
|
-
*/
|
|
14
|
-
interface SelectionSegment {
|
|
15
|
-
quad: TextQuad;
|
|
16
|
-
rect: Rect;
|
|
17
|
-
advance: 1 | -1;
|
|
18
|
-
}
|
|
19
|
-
/** A page's cached selection geometry: the canonical layout + the seam. */
|
|
20
|
-
interface SelectionPageGeometry {
|
|
21
|
-
layout: PageTextLayout;
|
|
22
|
-
toContent: Mat2D<'pdf', 'content'>;
|
|
23
|
-
fromContent: Mat2D<'content', 'pdf'>;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Build a page's selection geometry. Page display rotation does NOT enter
|
|
27
|
-
* here — the overlay rides the page's CSS rotation, so content space stays
|
|
28
|
-
* un-rotated (the crop-relative y-flip is the only conversion; zoom = 1,
|
|
29
|
-
* the viewer's zoom is applied later by `PageTransform.pageToContent`).
|
|
30
|
-
*/
|
|
31
|
-
declare function buildSelectionPageGeometry(snapshot: PageGeometrySnapshot, crop: PdfRect, rotation: 0 | 90 | 180 | 270, userUnit: number): SelectionPageGeometry;
|
|
32
|
-
/** A content-space pointer point in the layout's PDF space. */
|
|
33
|
-
declare function contentPointToPdf(geom: SelectionPageGeometry, p: Point): PdfPoint;
|
|
34
|
-
/**
|
|
35
|
-
* A canonical PDF quad in content space. Engine quads carry frame-geometric
|
|
36
|
-
* slot semantics (`p1..p4` = upper-start, upper-end, lower-start,
|
|
37
|
-
* lower-end) — a trusted producer, so the y-flip maps corners straight onto
|
|
38
|
-
* their names; imported-annotation normalization does NOT apply here.
|
|
39
|
-
*/
|
|
40
|
-
declare function toContentTextQuad(geom: SelectionPageGeometry, quad: PdfQuad): TextQuad;
|
|
41
|
-
/** A canonical segment in content space (`rect` recomputed from the mapped
|
|
42
|
-
* quad so the pair can never drift). */
|
|
43
|
-
declare function toContentSegment(geom: SelectionPageGeometry, segment: PdfTextSegment): SelectionSegment;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/types.d.ts
|
|
46
|
-
/** A glyph address: a page + a flat glyph index within that page's geometry. */
|
|
47
|
-
interface GlyphPointer {
|
|
48
|
-
pon: PageObjectNumber;
|
|
49
|
-
glyph: number;
|
|
50
|
-
}
|
|
51
|
-
/** Anchor = where the drag began, focus = the current end. Inclusive. */
|
|
52
|
-
interface SelectionRange {
|
|
53
|
-
anchor: GlyphPointer;
|
|
54
|
-
focus: GlyphPointer;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* A selection boundary, anchored to the boundary GLYPH's own oriented cell.
|
|
58
|
-
* `advance` is the reading direction of the segment it belongs to (+1 = the
|
|
59
|
-
* frame's +x), so caret consumers place at the trailing edge without
|
|
60
|
-
* re-deriving bidi from geometry. `rect` is the AABB (scroll targets).
|
|
61
|
-
*/
|
|
62
|
-
interface SelectionEndpoint {
|
|
63
|
-
pon: PageObjectNumber;
|
|
64
|
-
glyphQuad: TextQuad;
|
|
65
|
-
advance: 1 | -1;
|
|
66
|
-
rect: Rect;
|
|
67
|
-
}
|
|
68
|
-
interface SelectionSnapshot {
|
|
69
|
-
/** Per-page canonical segments — the ONE geometry consumers act on.
|
|
70
|
-
* Boxes are derived views (`segment.rect`, or `rectsForPage()`). */
|
|
71
|
-
pages: Array<{
|
|
72
|
-
pon: PageObjectNumber;
|
|
73
|
-
segments: SelectionSegment[];
|
|
74
|
-
}>;
|
|
75
|
-
start: SelectionEndpoint | null;
|
|
76
|
-
end: SelectionEndpoint | null;
|
|
77
|
-
direction: 'forward' | 'backward';
|
|
78
|
-
}
|
|
79
|
-
interface SelectionState {
|
|
80
|
-
selection: SelectionRange | null;
|
|
81
|
-
/** Derived per-line segments per page, in CONTENT space (y-down, PDF units). */
|
|
82
|
-
segments: Record<number, SelectionSegment[]>;
|
|
83
|
-
/** Pages whose text geometry has loaded (so the layer re-renders when ready). */
|
|
84
|
-
loaded: Record<number, boolean>;
|
|
85
|
-
/** When a consumer owns the selection visual (e.g. a markup tool draws its own
|
|
86
|
-
* preview), the default highlight rects are suppressed. */
|
|
87
|
-
highlightHidden: boolean;
|
|
88
|
-
}
|
|
89
|
-
type SelectionAction = {
|
|
90
|
-
type: 'PAGE_LOADED';
|
|
91
|
-
pon: PageObjectNumber;
|
|
92
|
-
} | {
|
|
93
|
-
type: 'SET';
|
|
94
|
-
selection: SelectionRange;
|
|
95
|
-
segments: Record<number, SelectionSegment[]>;
|
|
96
|
-
} | {
|
|
97
|
-
type: 'CLEAR';
|
|
98
|
-
} | {
|
|
99
|
-
type: 'SET_HIGHLIGHT_HIDDEN';
|
|
100
|
-
hidden: boolean;
|
|
101
|
-
};
|
|
102
|
-
interface SelectionCapability {
|
|
103
|
-
/** Warm a page's text geometry (idempotent). Layers call this when a page mounts. */
|
|
104
|
-
ensurePage(pon: PageObjectNumber): void;
|
|
105
|
-
isLoaded(pon: PageObjectNumber): boolean;
|
|
106
|
-
/** Is a content-space point on (or near) text? Drives the I-beam vs pointer cursor. */
|
|
107
|
-
isOverText(pon: PageObjectNumber, point: Point): boolean;
|
|
108
|
-
/** Begin a caret selection at a page point. Returns false if not near any text. */
|
|
109
|
-
beginAt(pon: PageObjectNumber, point: Point): boolean;
|
|
110
|
-
/** Double-click: select the word around the point. */
|
|
111
|
-
selectWord(pon: PageObjectNumber, point: Point): void;
|
|
112
|
-
/** Triple-click: select the whole visual line around the point. */
|
|
113
|
-
selectLine(pon: PageObjectNumber, point: Point): void;
|
|
114
|
-
/** Extend the current selection to a page point (drag). */
|
|
115
|
-
extendTo(pon: PageObjectNumber, point: Point): void;
|
|
116
|
-
end(): void;
|
|
117
|
-
clear(): void;
|
|
118
|
-
/** Coherent read-model for consumers that create annotations or selection UI. */
|
|
119
|
-
snapshot(): SelectionSnapshot;
|
|
120
|
-
/** Per-line oriented segments for a page, in content space — the layer's input. */
|
|
121
|
-
segmentsForPage(pon: PageObjectNumber): SelectionSegment[];
|
|
122
|
-
/** The segments' AABBs — for consumers that genuinely want boxes (scroll,
|
|
123
|
-
* conservative regions). Never a substitute for the oriented quads in
|
|
124
|
-
* geometry that gets drawn or persisted. */
|
|
125
|
-
rectsForPage(pon: PageObjectNumber): Rect[];
|
|
126
|
-
hasSelection(): boolean;
|
|
127
|
-
/** The pages the current selection covers (those with at least one rect) — so a
|
|
128
|
-
* cross-page action (e.g. text-markup creation) can fan out per page. */
|
|
129
|
-
selectedPages(): PageObjectNumber[];
|
|
130
|
-
/** Fires whenever the selection rects change (e.g. drag-extend) — for live preview. */
|
|
131
|
-
onChange(cb: () => void): () => void;
|
|
132
|
-
/** Fires when a selection gesture ends (pointer-up) — the commit point. */
|
|
133
|
-
onCommit(cb: () => void): () => void;
|
|
134
|
-
/** Suppress / restore the default highlight visual (a consumer drawing its own). */
|
|
135
|
-
setHighlightVisible(visible: boolean): void;
|
|
136
|
-
highlightVisible(): boolean;
|
|
137
|
-
}
|
|
138
|
-
declare const SelectionToken: import("@embedpdf/core").CapabilityToken<SelectionCapability>;
|
|
139
|
-
//#endregion
|
|
1
|
+
import { a as SelectionHostCapability, c as SelectionRangeInput, f as TextPosition, h as SelectionSegment, i as SelectionEndpoint, l as SelectionSnapshot, n as SelectionAction, o as SelectionMenuAnchor, p as TextRange, r as SelectionCapability, u as SelectionState } from "./types-DtWaZIsm.cjs";
|
|
2
|
+
import { CapabilityToken } from "@embedpdf/core";
|
|
140
3
|
//#region src/selection.plugin.d.ts
|
|
141
4
|
/**
|
|
142
5
|
* Text selection — document-scoped, requires the interaction hub. In `init` it
|
|
143
6
|
* registers ITS pointer handler with the hub; the hub owns the pointer stream
|
|
144
7
|
* and arbitration. Works with `<Stage>` or a standalone `<PageView>` — selection
|
|
145
8
|
* only needs the page coordinate context + the engine's text geometry.
|
|
146
|
-
*/
|
|
147
|
-
declare const selectionPlugin: () => import("@embedpdf/core").PluginDef<SelectionState, SelectionAction, SelectionCapability>;
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region src/capability.d.ts
|
|
150
|
-
/**
|
|
151
|
-
* The selection capability. The reducer state holds the selection range, the
|
|
152
|
-
* derived content-space segments (per page), and per-page loaded flags; the
|
|
153
|
-
* (large, non-serializable) per-page canonical layout is cached HERE in the
|
|
154
|
-
* closure. Segmentation itself is the engine-core text layout — selection
|
|
155
|
-
* owns gestures and state, never how glyphs become lines.
|
|
156
9
|
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* page in the span and re-runs whenever a mid-span page finishes loading.
|
|
10
|
+
* Registry/content invalidation is wired inside the capability itself
|
|
11
|
+
* (revision watch + document event subscription), so headless/programmatic
|
|
12
|
+
* use gets the same reconciliation as the full viewer.
|
|
161
13
|
*/
|
|
162
|
-
declare
|
|
14
|
+
declare const selectionPlugin: () => import("@embedpdf/core").PluginDef<SelectionState, SelectionAction, SelectionHostCapability>;
|
|
163
15
|
//#endregion
|
|
164
|
-
//#region src/
|
|
16
|
+
//#region src/index.d.ts
|
|
165
17
|
/**
|
|
166
|
-
* The
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* - single click → deselect; records an anchor but selects NOTHING until
|
|
171
|
-
* the pointer moves past the drag threshold (Chrome/Acrobat feel)
|
|
172
|
-
* - single-click + drag → caret selection from the anchor (extends across pages)
|
|
173
|
-
* - double-click → select the word
|
|
174
|
-
* - triple-click → select the visual line
|
|
175
|
-
* - down off-text → deselect, and DON'T capture (so it can't block)
|
|
176
|
-
* - hover → I-beam only when over text, else the pointer cursor
|
|
18
|
+
* The selection capability token, narrowed to the public
|
|
19
|
+
* {@link SelectionCapability} lens. It is the SAME runtime token the plugin
|
|
20
|
+
* provides — the host-only surface (pointer gestures, geometry warming) is
|
|
21
|
+
* reachable only via `@embedpdf/plugin-selection/internal`.
|
|
177
22
|
*/
|
|
178
|
-
declare
|
|
179
|
-
//#endregion
|
|
180
|
-
//#region src/reducer.d.ts
|
|
181
|
-
declare const initialSelectionState: SelectionState;
|
|
182
|
-
declare const selectionReducer: (state: SelectionState, action: SelectionAction) => SelectionState;
|
|
23
|
+
declare const SelectionToken: CapabilityToken<SelectionCapability>;
|
|
183
24
|
//#endregion
|
|
184
|
-
export { type
|
|
25
|
+
export { type SelectionCapability, type SelectionEndpoint, type SelectionMenuAnchor, type SelectionRangeInput, type SelectionSegment, type SelectionSnapshot, SelectionToken, type TextPosition, type TextRange, selectionPlugin };
|
|
185
26
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,185 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Mat2D, Point, Rect, TextQuad } from "@embedpdf/core-geometry";
|
|
4
|
-
import { PageGeometrySnapshot, PageTextLayout, PdfPoint, PdfQuad, PdfRect, PdfTextSegment } from "@embedpdf/engine-core/runtime";
|
|
5
|
-
//#region src/geometry.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* One merged visual line of a selection, in content space — the structural
|
|
8
|
-
* twin of the engine's `PdfTextSegment`. `quad` carries frame-geometric
|
|
9
|
-
* corner semantics (upper = ascent side, start = the frame's −x); `advance`
|
|
10
|
-
* is the READING direction along the baseline (+1 = toward `end`), derived
|
|
11
|
-
* from the glyph sequence — geometry and bidi stay separate concerns.
|
|
12
|
-
* `rect` is the content-space AABB.
|
|
13
|
-
*/
|
|
14
|
-
interface SelectionSegment {
|
|
15
|
-
quad: TextQuad;
|
|
16
|
-
rect: Rect;
|
|
17
|
-
advance: 1 | -1;
|
|
18
|
-
}
|
|
19
|
-
/** A page's cached selection geometry: the canonical layout + the seam. */
|
|
20
|
-
interface SelectionPageGeometry {
|
|
21
|
-
layout: PageTextLayout;
|
|
22
|
-
toContent: Mat2D<'pdf', 'content'>;
|
|
23
|
-
fromContent: Mat2D<'content', 'pdf'>;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Build a page's selection geometry. Page display rotation does NOT enter
|
|
27
|
-
* here — the overlay rides the page's CSS rotation, so content space stays
|
|
28
|
-
* un-rotated (the crop-relative y-flip is the only conversion; zoom = 1,
|
|
29
|
-
* the viewer's zoom is applied later by `PageTransform.pageToContent`).
|
|
30
|
-
*/
|
|
31
|
-
declare function buildSelectionPageGeometry(snapshot: PageGeometrySnapshot, crop: PdfRect, rotation: 0 | 90 | 180 | 270, userUnit: number): SelectionPageGeometry;
|
|
32
|
-
/** A content-space pointer point in the layout's PDF space. */
|
|
33
|
-
declare function contentPointToPdf(geom: SelectionPageGeometry, p: Point): PdfPoint;
|
|
34
|
-
/**
|
|
35
|
-
* A canonical PDF quad in content space. Engine quads carry frame-geometric
|
|
36
|
-
* slot semantics (`p1..p4` = upper-start, upper-end, lower-start,
|
|
37
|
-
* lower-end) — a trusted producer, so the y-flip maps corners straight onto
|
|
38
|
-
* their names; imported-annotation normalization does NOT apply here.
|
|
39
|
-
*/
|
|
40
|
-
declare function toContentTextQuad(geom: SelectionPageGeometry, quad: PdfQuad): TextQuad;
|
|
41
|
-
/** A canonical segment in content space (`rect` recomputed from the mapped
|
|
42
|
-
* quad so the pair can never drift). */
|
|
43
|
-
declare function toContentSegment(geom: SelectionPageGeometry, segment: PdfTextSegment): SelectionSegment;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/types.d.ts
|
|
46
|
-
/** A glyph address: a page + a flat glyph index within that page's geometry. */
|
|
47
|
-
interface GlyphPointer {
|
|
48
|
-
pon: PageObjectNumber;
|
|
49
|
-
glyph: number;
|
|
50
|
-
}
|
|
51
|
-
/** Anchor = where the drag began, focus = the current end. Inclusive. */
|
|
52
|
-
interface SelectionRange {
|
|
53
|
-
anchor: GlyphPointer;
|
|
54
|
-
focus: GlyphPointer;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* A selection boundary, anchored to the boundary GLYPH's own oriented cell.
|
|
58
|
-
* `advance` is the reading direction of the segment it belongs to (+1 = the
|
|
59
|
-
* frame's +x), so caret consumers place at the trailing edge without
|
|
60
|
-
* re-deriving bidi from geometry. `rect` is the AABB (scroll targets).
|
|
61
|
-
*/
|
|
62
|
-
interface SelectionEndpoint {
|
|
63
|
-
pon: PageObjectNumber;
|
|
64
|
-
glyphQuad: TextQuad;
|
|
65
|
-
advance: 1 | -1;
|
|
66
|
-
rect: Rect;
|
|
67
|
-
}
|
|
68
|
-
interface SelectionSnapshot {
|
|
69
|
-
/** Per-page canonical segments — the ONE geometry consumers act on.
|
|
70
|
-
* Boxes are derived views (`segment.rect`, or `rectsForPage()`). */
|
|
71
|
-
pages: Array<{
|
|
72
|
-
pon: PageObjectNumber;
|
|
73
|
-
segments: SelectionSegment[];
|
|
74
|
-
}>;
|
|
75
|
-
start: SelectionEndpoint | null;
|
|
76
|
-
end: SelectionEndpoint | null;
|
|
77
|
-
direction: 'forward' | 'backward';
|
|
78
|
-
}
|
|
79
|
-
interface SelectionState {
|
|
80
|
-
selection: SelectionRange | null;
|
|
81
|
-
/** Derived per-line segments per page, in CONTENT space (y-down, PDF units). */
|
|
82
|
-
segments: Record<number, SelectionSegment[]>;
|
|
83
|
-
/** Pages whose text geometry has loaded (so the layer re-renders when ready). */
|
|
84
|
-
loaded: Record<number, boolean>;
|
|
85
|
-
/** When a consumer owns the selection visual (e.g. a markup tool draws its own
|
|
86
|
-
* preview), the default highlight rects are suppressed. */
|
|
87
|
-
highlightHidden: boolean;
|
|
88
|
-
}
|
|
89
|
-
type SelectionAction = {
|
|
90
|
-
type: 'PAGE_LOADED';
|
|
91
|
-
pon: PageObjectNumber;
|
|
92
|
-
} | {
|
|
93
|
-
type: 'SET';
|
|
94
|
-
selection: SelectionRange;
|
|
95
|
-
segments: Record<number, SelectionSegment[]>;
|
|
96
|
-
} | {
|
|
97
|
-
type: 'CLEAR';
|
|
98
|
-
} | {
|
|
99
|
-
type: 'SET_HIGHLIGHT_HIDDEN';
|
|
100
|
-
hidden: boolean;
|
|
101
|
-
};
|
|
102
|
-
interface SelectionCapability {
|
|
103
|
-
/** Warm a page's text geometry (idempotent). Layers call this when a page mounts. */
|
|
104
|
-
ensurePage(pon: PageObjectNumber): void;
|
|
105
|
-
isLoaded(pon: PageObjectNumber): boolean;
|
|
106
|
-
/** Is a content-space point on (or near) text? Drives the I-beam vs pointer cursor. */
|
|
107
|
-
isOverText(pon: PageObjectNumber, point: Point): boolean;
|
|
108
|
-
/** Begin a caret selection at a page point. Returns false if not near any text. */
|
|
109
|
-
beginAt(pon: PageObjectNumber, point: Point): boolean;
|
|
110
|
-
/** Double-click: select the word around the point. */
|
|
111
|
-
selectWord(pon: PageObjectNumber, point: Point): void;
|
|
112
|
-
/** Triple-click: select the whole visual line around the point. */
|
|
113
|
-
selectLine(pon: PageObjectNumber, point: Point): void;
|
|
114
|
-
/** Extend the current selection to a page point (drag). */
|
|
115
|
-
extendTo(pon: PageObjectNumber, point: Point): void;
|
|
116
|
-
end(): void;
|
|
117
|
-
clear(): void;
|
|
118
|
-
/** Coherent read-model for consumers that create annotations or selection UI. */
|
|
119
|
-
snapshot(): SelectionSnapshot;
|
|
120
|
-
/** Per-line oriented segments for a page, in content space — the layer's input. */
|
|
121
|
-
segmentsForPage(pon: PageObjectNumber): SelectionSegment[];
|
|
122
|
-
/** The segments' AABBs — for consumers that genuinely want boxes (scroll,
|
|
123
|
-
* conservative regions). Never a substitute for the oriented quads in
|
|
124
|
-
* geometry that gets drawn or persisted. */
|
|
125
|
-
rectsForPage(pon: PageObjectNumber): Rect[];
|
|
126
|
-
hasSelection(): boolean;
|
|
127
|
-
/** The pages the current selection covers (those with at least one rect) — so a
|
|
128
|
-
* cross-page action (e.g. text-markup creation) can fan out per page. */
|
|
129
|
-
selectedPages(): PageObjectNumber[];
|
|
130
|
-
/** Fires whenever the selection rects change (e.g. drag-extend) — for live preview. */
|
|
131
|
-
onChange(cb: () => void): () => void;
|
|
132
|
-
/** Fires when a selection gesture ends (pointer-up) — the commit point. */
|
|
133
|
-
onCommit(cb: () => void): () => void;
|
|
134
|
-
/** Suppress / restore the default highlight visual (a consumer drawing its own). */
|
|
135
|
-
setHighlightVisible(visible: boolean): void;
|
|
136
|
-
highlightVisible(): boolean;
|
|
137
|
-
}
|
|
138
|
-
declare const SelectionToken: import("@embedpdf/core").CapabilityToken<SelectionCapability>;
|
|
139
|
-
//#endregion
|
|
1
|
+
import { a as SelectionHostCapability, c as SelectionRangeInput, f as TextPosition, h as SelectionSegment, i as SelectionEndpoint, l as SelectionSnapshot, n as SelectionAction, o as SelectionMenuAnchor, p as TextRange, r as SelectionCapability, u as SelectionState } from "./types-DtWaZIsm.js";
|
|
2
|
+
import { CapabilityToken } from "@embedpdf/core";
|
|
140
3
|
//#region src/selection.plugin.d.ts
|
|
141
4
|
/**
|
|
142
5
|
* Text selection — document-scoped, requires the interaction hub. In `init` it
|
|
143
6
|
* registers ITS pointer handler with the hub; the hub owns the pointer stream
|
|
144
7
|
* and arbitration. Works with `<Stage>` or a standalone `<PageView>` — selection
|
|
145
8
|
* only needs the page coordinate context + the engine's text geometry.
|
|
146
|
-
*/
|
|
147
|
-
declare const selectionPlugin: () => import("@embedpdf/core").PluginDef<SelectionState, SelectionAction, SelectionCapability>;
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region src/capability.d.ts
|
|
150
|
-
/**
|
|
151
|
-
* The selection capability. The reducer state holds the selection range, the
|
|
152
|
-
* derived content-space segments (per page), and per-page loaded flags; the
|
|
153
|
-
* (large, non-serializable) per-page canonical layout is cached HERE in the
|
|
154
|
-
* closure. Segmentation itself is the engine-core text layout — selection
|
|
155
|
-
* owns gestures and state, never how glyphs become lines.
|
|
156
9
|
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* page in the span and re-runs whenever a mid-span page finishes loading.
|
|
10
|
+
* Registry/content invalidation is wired inside the capability itself
|
|
11
|
+
* (revision watch + document event subscription), so headless/programmatic
|
|
12
|
+
* use gets the same reconciliation as the full viewer.
|
|
161
13
|
*/
|
|
162
|
-
declare
|
|
14
|
+
declare const selectionPlugin: () => import("@embedpdf/core").PluginDef<SelectionState, SelectionAction, SelectionHostCapability>;
|
|
163
15
|
//#endregion
|
|
164
|
-
//#region src/
|
|
16
|
+
//#region src/index.d.ts
|
|
165
17
|
/**
|
|
166
|
-
* The
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* - single click → deselect; records an anchor but selects NOTHING until
|
|
171
|
-
* the pointer moves past the drag threshold (Chrome/Acrobat feel)
|
|
172
|
-
* - single-click + drag → caret selection from the anchor (extends across pages)
|
|
173
|
-
* - double-click → select the word
|
|
174
|
-
* - triple-click → select the visual line
|
|
175
|
-
* - down off-text → deselect, and DON'T capture (so it can't block)
|
|
176
|
-
* - hover → I-beam only when over text, else the pointer cursor
|
|
18
|
+
* The selection capability token, narrowed to the public
|
|
19
|
+
* {@link SelectionCapability} lens. It is the SAME runtime token the plugin
|
|
20
|
+
* provides — the host-only surface (pointer gestures, geometry warming) is
|
|
21
|
+
* reachable only via `@embedpdf/plugin-selection/internal`.
|
|
177
22
|
*/
|
|
178
|
-
declare
|
|
179
|
-
//#endregion
|
|
180
|
-
//#region src/reducer.d.ts
|
|
181
|
-
declare const initialSelectionState: SelectionState;
|
|
182
|
-
declare const selectionReducer: (state: SelectionState, action: SelectionAction) => SelectionState;
|
|
23
|
+
declare const SelectionToken: CapabilityToken<SelectionCapability>;
|
|
183
24
|
//#endregion
|
|
184
|
-
export { type
|
|
25
|
+
export { type SelectionCapability, type SelectionEndpoint, type SelectionMenuAnchor, type SelectionRangeInput, type SelectionSegment, type SelectionSnapshot, SelectionToken, type TextPosition, type TextRange, selectionPlugin };
|
|
185
26
|
//# sourceMappingURL=index.d.ts.map
|