@embedpdf/plugin-selection 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.
@@ -0,0 +1,11 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_reducer = require("./reducer-Dyf8p5h-.cjs");
3
+ exports.SelectionToken = require_reducer.SelectionToken;
4
+ exports.buildSelectionPageGeometry = require_reducer.buildSelectionPageGeometry;
5
+ exports.contentPointToPdf = require_reducer.contentPointToPdf;
6
+ exports.createSelectionCapability = require_reducer.createSelectionCapability;
7
+ exports.createTextSelectHandler = require_reducer.createTextSelectHandler;
8
+ exports.initialSelectionState = require_reducer.initialSelectionState;
9
+ exports.selectionReducer = require_reducer.selectionReducer;
10
+ exports.toContentSegment = require_reducer.toContentSegment;
11
+ exports.toContentTextQuad = require_reducer.toContentTextQuad;
@@ -0,0 +1,62 @@
1
+ import { _ as contentPointToPdf, a as SelectionHostCapability, d as SelectionToken, g as buildSelectionPageGeometry, m as SelectionPageGeometry, n as SelectionAction, s as SelectionRange, t as GlyphPointer, u as SelectionState, v as toContentSegment, y as toContentTextQuad } from "./types-DtWaZIsm.cjs";
2
+ import { PluginContext } from "@embedpdf/core";
3
+ import { InteractionCapability, InteractionHandler } from "@embedpdf/plugin-interaction";
4
+ //#region src/capability.d.ts
5
+ /**
6
+ * The selection capability — ONE closure returning the host lens (the
7
+ * public lens is the same object, narrowed at the package root).
8
+ *
9
+ * State model: the reducer holds the selection range and the derived
10
+ * content-space segments; the large, non-serializable per-page caches live
11
+ * HERE in the closure, split by what invalidates them:
12
+ *
13
+ * - `rawGeometry` — PDF-space geometry snapshots, rotation-independent
14
+ * (pages load normalized; see `PageRotateResult`). Dropped only when a
15
+ * page leaves the registry or page CONTENT changes (redaction apply /
16
+ * flatten).
17
+ * - `derived` — the content-space transform + layout, keyed by the
18
+ * layout params (crop/rotation/userUnit) so a view-rotate re-derives
19
+ * from the cached raw snapshot with NO refetch.
20
+ * - `textSnapshots` — per-page text (for `readText`), same content-only
21
+ * invalidation as `rawGeometry`.
22
+ *
23
+ * Permission model: `doc.text.select` gates geometry (selection exists),
24
+ * `doc.text.copy` gates text (extraction) — neither implies the other.
25
+ * Host gesture functions are INERT when select is denied (`ensurePage`
26
+ * no-ops, so nothing warms and nothing hit-tests: the pointer handler
27
+ * needs no special-casing); the public `select()` THROWS `PermissionDenied`
28
+ * so programmatic misuse is loud; `clear()` is always allowed. The engine
29
+ * independently enforces both scopes — these gates exist so the plugin
30
+ * never issues a request that is guaranteed to fail.
31
+ *
32
+ * Selection is cross-page: glyphs are ordered globally by (pageIndex,
33
+ * glyph), so a drag from page 2 into page 4 selects the tail of 2, all of
34
+ * 3, and the head of 4. `recompute` rebuilds the merged line segments for
35
+ * every loaded page in the span, re-runs whenever a mid-span page finishes
36
+ * loading, and CLAMPS stored endpoints once their page's geometry is known
37
+ * (so `selectAll`'s open-ended focus settles to the real last character).
38
+ */
39
+ declare function createSelectionCapability(ctx: PluginContext<SelectionState, SelectionAction>): SelectionHostCapability;
40
+ //#endregion
41
+ //#region src/handler.d.ts
42
+ /**
43
+ * The text-selection pointer handler. It is live only under tools that enable the
44
+ * `'text-select'` tag (the built-in `pointer` tool does; `pan` does not — so
45
+ * switching to pan disables text selection with zero special-casing here).
46
+ *
47
+ * - single click → deselect; records an anchor but selects NOTHING until
48
+ * the pointer moves past the drag threshold (Chrome/Acrobat feel)
49
+ * - single-click + drag → caret selection from the anchor (extends across pages)
50
+ * - double-click → select the word
51
+ * - triple-click → select the visual line
52
+ * - down off-text → deselect, and DON'T capture (so it can't block)
53
+ * - hover → I-beam only when over text, else the pointer cursor
54
+ */
55
+ declare function createTextSelectHandler(selection: SelectionHostCapability, interaction: InteractionCapability): InteractionHandler;
56
+ //#endregion
57
+ //#region src/reducer.d.ts
58
+ declare const initialSelectionState: SelectionState;
59
+ declare const selectionReducer: (state: SelectionState, action: SelectionAction) => SelectionState;
60
+ //#endregion
61
+ export { type GlyphPointer, type SelectionAction, type SelectionHostCapability, type SelectionPageGeometry, type SelectionRange, type SelectionState, SelectionToken, buildSelectionPageGeometry, contentPointToPdf, createSelectionCapability, createTextSelectHandler, initialSelectionState, selectionReducer, toContentSegment, toContentTextQuad };
62
+ //# sourceMappingURL=internal.d.cts.map
@@ -0,0 +1,62 @@
1
+ import { _ as contentPointToPdf, a as SelectionHostCapability, d as SelectionToken, g as buildSelectionPageGeometry, m as SelectionPageGeometry, n as SelectionAction, s as SelectionRange, t as GlyphPointer, u as SelectionState, v as toContentSegment, y as toContentTextQuad } from "./types-DtWaZIsm.js";
2
+ import { PluginContext } from "@embedpdf/core";
3
+ import { InteractionCapability, InteractionHandler } from "@embedpdf/plugin-interaction";
4
+ //#region src/capability.d.ts
5
+ /**
6
+ * The selection capability — ONE closure returning the host lens (the
7
+ * public lens is the same object, narrowed at the package root).
8
+ *
9
+ * State model: the reducer holds the selection range and the derived
10
+ * content-space segments; the large, non-serializable per-page caches live
11
+ * HERE in the closure, split by what invalidates them:
12
+ *
13
+ * - `rawGeometry` — PDF-space geometry snapshots, rotation-independent
14
+ * (pages load normalized; see `PageRotateResult`). Dropped only when a
15
+ * page leaves the registry or page CONTENT changes (redaction apply /
16
+ * flatten).
17
+ * - `derived` — the content-space transform + layout, keyed by the
18
+ * layout params (crop/rotation/userUnit) so a view-rotate re-derives
19
+ * from the cached raw snapshot with NO refetch.
20
+ * - `textSnapshots` — per-page text (for `readText`), same content-only
21
+ * invalidation as `rawGeometry`.
22
+ *
23
+ * Permission model: `doc.text.select` gates geometry (selection exists),
24
+ * `doc.text.copy` gates text (extraction) — neither implies the other.
25
+ * Host gesture functions are INERT when select is denied (`ensurePage`
26
+ * no-ops, so nothing warms and nothing hit-tests: the pointer handler
27
+ * needs no special-casing); the public `select()` THROWS `PermissionDenied`
28
+ * so programmatic misuse is loud; `clear()` is always allowed. The engine
29
+ * independently enforces both scopes — these gates exist so the plugin
30
+ * never issues a request that is guaranteed to fail.
31
+ *
32
+ * Selection is cross-page: glyphs are ordered globally by (pageIndex,
33
+ * glyph), so a drag from page 2 into page 4 selects the tail of 2, all of
34
+ * 3, and the head of 4. `recompute` rebuilds the merged line segments for
35
+ * every loaded page in the span, re-runs whenever a mid-span page finishes
36
+ * loading, and CLAMPS stored endpoints once their page's geometry is known
37
+ * (so `selectAll`'s open-ended focus settles to the real last character).
38
+ */
39
+ declare function createSelectionCapability(ctx: PluginContext<SelectionState, SelectionAction>): SelectionHostCapability;
40
+ //#endregion
41
+ //#region src/handler.d.ts
42
+ /**
43
+ * The text-selection pointer handler. It is live only under tools that enable the
44
+ * `'text-select'` tag (the built-in `pointer` tool does; `pan` does not — so
45
+ * switching to pan disables text selection with zero special-casing here).
46
+ *
47
+ * - single click → deselect; records an anchor but selects NOTHING until
48
+ * the pointer moves past the drag threshold (Chrome/Acrobat feel)
49
+ * - single-click + drag → caret selection from the anchor (extends across pages)
50
+ * - double-click → select the word
51
+ * - triple-click → select the visual line
52
+ * - down off-text → deselect, and DON'T capture (so it can't block)
53
+ * - hover → I-beam only when over text, else the pointer cursor
54
+ */
55
+ declare function createTextSelectHandler(selection: SelectionHostCapability, interaction: InteractionCapability): InteractionHandler;
56
+ //#endregion
57
+ //#region src/reducer.d.ts
58
+ declare const initialSelectionState: SelectionState;
59
+ declare const selectionReducer: (state: SelectionState, action: SelectionAction) => SelectionState;
60
+ //#endregion
61
+ export { type GlyphPointer, type SelectionAction, type SelectionHostCapability, type SelectionPageGeometry, type SelectionRange, type SelectionState, SelectionToken, buildSelectionPageGeometry, contentPointToPdf, createSelectionCapability, createTextSelectHandler, initialSelectionState, selectionReducer, toContentSegment, toContentTextQuad };
62
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1,2 @@
1
+ import { a as buildSelectionPageGeometry, c as toContentTextQuad, i as createSelectionCapability, l as SelectionToken, n as selectionReducer, o as contentPointToPdf, r as createTextSelectHandler, s as toContentSegment, t as initialSelectionState } from "./reducer-CZG2TZgo.js";
2
+ export { SelectionToken, buildSelectionPageGeometry, contentPointToPdf, createSelectionCapability, createTextSelectHandler, initialSelectionState, selectionReducer, toContentSegment, toContentTextQuad };