@embedpdf/plugin-search 3.0.0-next.14 → 3.0.0-next.16

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,42 @@
1
+ let _embedpdf_core = require("@embedpdf/core");
2
+ require("@embedpdf/engine-core/runtime");
3
+ //#region src/token.ts
4
+ /** The package token — created once here; `contract.ts` re-exports it and
5
+ * `host-contract.ts` widens it. */
6
+ const SearchToken = (0, _embedpdf_core.createCapabilityToken)("search", {
7
+ hint: "add searchPlugin() from '@embedpdf/plugin-search' to your plugins list",
8
+ promises: {
9
+ search: true,
10
+ refresh: true,
11
+ findAll: true
12
+ }
13
+ });
14
+ //#endregion
15
+ //#region src/contract.ts
16
+ /** What the search settings are when the app registers none. */
17
+ const SEARCH_DEFAULTS = {
18
+ reveal: {
19
+ anchor: { y: .35 },
20
+ behavior: "smooth"
21
+ },
22
+ highlight: {
23
+ color: "#ffd500",
24
+ activeColor: "#ff9632",
25
+ blendMode: "multiply"
26
+ }
27
+ };
28
+ //#endregion
29
+ Object.defineProperty(exports, "SEARCH_DEFAULTS", {
30
+ enumerable: true,
31
+ get: function() {
32
+ return SEARCH_DEFAULTS;
33
+ }
34
+ });
35
+ Object.defineProperty(exports, "SearchToken", {
36
+ enumerable: true,
37
+ get: function() {
38
+ return SearchToken;
39
+ }
40
+ });
41
+
42
+ //# sourceMappingURL=contract-6pr6LBhA.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-6pr6LBhA.cjs","names":[],"sources":["../src/token.ts","../src/contract.ts"],"sourcesContent":["/** The package token — created once here; `contract.ts` re-exports it and\n * `host-contract.ts` widens it. */\nimport { createCapabilityToken } from '@embedpdf/core';\n\nimport type { SearchCapability } from './contract';\n\nexport const SearchToken = createCapabilityToken<SearchCapability>('search', {\n hint: \"add searchPlugin() from '@embedpdf/plugin-search' to your plugins list\",\n // Without a document, an adapter's stand-in rejects these with `not-ready`, as the\n // capability would; the type asks for every member that returns a promise.\n promises: {\n search: true,\n refresh: true,\n findAll: true,\n },\n});\n","import {\n type DeepPartial,\n type EventHook,\n type OperationOptions,\n type PageRef,\n type PluginErrorInfo,\n type SettingsApi,\n} from '@embedpdf/core';\nimport type { Rect } from '@embedpdf/core-geometry';\nimport type { RevealAnchor, ScrollBehaviorKind } from '@embedpdf/plugin-stage/contract';\nimport type { PdfTextSegment, SearchQuery, SearchSnippet } from '@embedpdf/engine-core/runtime';\n\nexport { validateSearchQuery, validateSearchRegex } from '@embedpdf/engine-core/runtime';\nexport type {\n SearchQuery,\n SearchQueryIssue,\n SearchQueryValidation,\n SearchRegexValidation,\n SearchSnippet,\n} from '@embedpdf/engine-core/runtime';\n\n/**\n * One merged visual line of a match in page space, as the engine's layout\n * gives it (selection's `SelectionSegment` is the same line). `quad` is the\n * geometric authority, its corners named in the line's own frame; `rect` its\n * bounds; `advance` the reading direction along the baseline.\n */\nexport type TextSegment = PdfTextSegment;\n\n/**\n * One match. `page` is the durable page identity, `pageIndex` its display\n * index at the time of the match. `start`/`count` are a range of the page's\n * characters, so a hit goes straight to `selection.select(hit)` or a markup\n * annotation without re-searching.\n */\nexport interface SearchHit {\n readonly page: PageRef;\n readonly pageIndex: number;\n readonly start: number;\n readonly count: number;\n /** Visual-line segments in page space — the drawing input. */\n readonly segments: readonly TextSegment[];\n /** Union of the segments — the reveal target. Absent for matches with no drawable geometry. */\n readonly bounds?: Rect;\n readonly snippet?: SearchSnippet;\n}\n\n/**\n * `searching`: the scan is walking pages, hits are usable as they stream in.\n * `cancelled`: the scan was stopped by `cancel()`; the hits found so far stay.\n */\nexport type SearchStatus = 'idle' | 'searching' | 'complete' | 'cancelled' | 'error';\n\nexport interface SearchProgress {\n readonly pagesSearched: number;\n readonly pageCount: number;\n}\n\n// ── settings ──────────────────────────────────────────────────────────────\n\n/** How a match arrives in view when you move to it: forwarded to the Stage's positioned reveal. */\nexport interface SearchReveal {\n /** Where the match lands in the view: `{ y: 0.35 }` puts it 35% of the way down, like a browser's find bar. */\n readonly anchor: RevealAnchor;\n /** Glide there (`'smooth'`) or jump (`'instant'`). */\n readonly behavior: ScrollBehaviorKind;\n}\n\n/** The `reveal` setting for one call: what the call leaves out comes from the setting. */\nexport type SearchRevealOptions = Partial<SearchReveal>;\n\n/** How the highlights mix with the page: a CSS `mix-blend-mode` keyword. */\nexport type SearchBlendMode =\n | 'normal'\n | 'multiply'\n | 'screen'\n | 'overlay'\n | 'darken'\n | 'lighten'\n | 'color-dodge'\n | 'color-burn'\n | 'hard-light'\n | 'soft-light'\n | 'difference'\n | 'exclusion'\n | 'hue'\n | 'saturation'\n | 'color'\n | 'luminosity';\n\n/**\n * The search plugin's settings. `searchPlugin(config)` registers them over\n * {@link SEARCH_DEFAULTS}, and `updateSettings()` changes them for every\n * document while the app runs. The highlight's three can also come from CSS\n * (`--epdf-search-highlight`, `--epdf-search-highlight-active`,\n * `--epdf-search-blend-mode`), which wins over the setting.\n */\nexport interface SearchSettings {\n /** Where a match lands when `nextHit()`, `previousHit()` or `goToHit()` moves to it. */\n readonly reveal: SearchReveal;\n readonly highlight: {\n /** The highlight of every match. */\n readonly color: string;\n /** The highlight of the active match. */\n readonly activeColor: string;\n /**\n * `'multiply'` is a real highlighter: the text stays crisp through the\n * color and only the paper tints. On dark or scanned pages, where a\n * multiplied highlight disappears, use `'normal'` with translucent colors.\n */\n readonly blendMode: SearchBlendMode;\n };\n}\n\n/** What the search settings are when the app registers none. */\nexport const SEARCH_DEFAULTS: SearchSettings = {\n reveal: { anchor: { y: 0.35 }, behavior: 'smooth' },\n highlight: { color: '#ffd500', activeColor: '#ff9632', blendMode: 'multiply' },\n};\n\n/** What `searchPlugin(config)` takes: any of the settings, merged over the defaults. */\nexport type SearchConfig = DeepPartial<SearchSettings>;\n\n// ── verbs ─────────────────────────────────────────────────────────────────\n\nexport interface SearchOptions extends OperationOptions {\n /**\n * Where to start: a page's ref or its index. Defaults to the Stage's\n * current page (viewport-first) when a Stage is installed.\n */\n readonly from?: PageRef | number;\n}\n\nexport interface SearchFindAllOptions extends OperationOptions {\n /**\n * Pin whether hits carry snippets. By default they do, falling back to none\n * when snippets are denied; pass `false` when only geometry is needed.\n */\n readonly snippets?: boolean;\n}\n\n/** What a `search()` resolved to: it finished, a newer search replaced it, or it was cancelled. */\nexport interface SearchResult {\n readonly status: 'complete' | 'superseded' | 'cancelled';\n readonly hitCount: number;\n}\n\nexport interface SearchHitFilter {\n /** One page's hits: its ref or its index. */\n readonly page?: PageRef | number;\n}\n\n// ── events ────────────────────────────────────────────────────────────────\n\nexport interface SearchStartedEvent {\n readonly query: SearchQuery;\n}\n/**\n * The search's progress changed: how many pages were searched, of how many,\n * and the matches found so far. The same values `getProgress()` and\n * `getHitCount()` return from then on.\n */\nexport interface SearchProgressChangedEvent extends SearchProgress {\n readonly hitCount: number;\n}\nexport interface SearchCompletedEvent {\n readonly hitCount: number;\n}\nexport interface SearchCancelledEvent {\n readonly reason: 'superseded' | 'cancelled' | 'cleared';\n}\nexport interface SearchFailedEvent {\n readonly error: PluginErrorInfo;\n}\nexport interface SearchActiveHitChangedEvent {\n readonly index: number;\n readonly hit: SearchHit | null;\n}\nexport type SearchClearedEvent = Record<string, never>;\n\n/**\n * The search plugin is a find service (`findAll`) plus one user-visible\n * search session per document (`search` and everything below it). The\n * sidebar, the highlight layer and next/previous render the session. Its\n * settings (`getSettings`, `updateSettings`, `resetSettings`,\n * `onSettingsChanged`) belong to the plugin, not to a document: a change\n * reaches every open document.\n */\nexport interface SearchCapability extends SettingsApi<SearchSettings> {\n /**\n * Would a search be served now: `doc.text.search`. With `snippets: true`\n * it also needs `doc.text.copy`, because a snippet reproduces document text.\n */\n canSearch(options?: { readonly snippets?: boolean }): boolean;\n\n // ── the session ─────────────────────────────────────────────────────────\n /**\n * Start a new search. A newer search supersedes and aborts a running one.\n * Hits stream into the session as they are found; the first hit becomes\n * active but the camera does not move until you navigate. Resolves when\n * the scan completes, is superseded, or is cancelled (also through\n * `options.signal`); rejects only on a real failure, `permission-denied`\n * without `doc.text.search`, or `not-found` for a `from` page that isn't in\n * the document. A refusal only rejects: the session stays as it was and no\n * event fires. An empty `query.text` is identical to `clear()`. Fires\n * `onStarted`, `onProgressChanged` as each slice of pages is searched, then\n * `onCompleted`, `onCancelled` or `onFailed`.\n */\n search(query: SearchQuery, options?: SearchOptions): Promise<SearchResult>;\n /**\n * Re-run the current query from scratch (the plugin does this itself after\n * document mutations). Resolves and rejects as `search()` does.\n */\n refresh(options?: OperationOptions): Promise<SearchResult>;\n /** Stop the scan and keep the hits found so far. */\n cancel(): void;\n /** Stop the scan and drop the session. */\n clear(): void;\n\n /** Step to the next / previous hit, wrapping, and reveal it. */\n nextHit(options?: SearchRevealOptions): SearchHit | null;\n previousHit(options?: SearchRevealOptions): SearchHit | null;\n /**\n * Make a hit the active one and reveal it: the hit itself, such as the one\n * `<SearchLayer onHitClick>` hands you, or its index (which wraps). Returns\n * the hit, or null when there are no hits or the given one isn't among them.\n */\n goToHit(hit: SearchHit | number, options?: SearchRevealOptions): SearchHit | null;\n /** Bring the active hit back into view without changing it. */\n revealActiveHit(options?: SearchRevealOptions): void;\n\n getQuery(): SearchQuery | null;\n getStatus(): SearchStatus;\n /**\n * Hits found so far, or those on one page. Reference-stable (per page too)\n * until new hits land there. Empty for a page that isn't in the document,\n * so a layer that reads while its page is deleted still renders.\n */\n listHits(filter?: SearchHitFilter): readonly SearchHit[];\n /** How many hits were found so far, or on one page; 0 for a page that isn't in the document. */\n getHitCount(page?: PageRef | number): number;\n listPagesWithHits(): readonly PageRef[];\n /** `-1` when no hit is active. */\n getActiveHitIndex(): number;\n getActiveHit(): SearchHit | null;\n getProgress(): SearchProgress;\n getError(): PluginErrorInfo | null;\n\n // ── the service ─────────────────────────────────────────────────────────\n /**\n * Run a query to completion and return every hit, touching no session\n * state. Scans in natural page order; concurrent calls are independent.\n * Rejects `operation-cancelled` when `options.signal` aborts, and\n * `permission-denied` without `doc.text.search`.\n */\n findAll(query: SearchQuery, options?: SearchFindAllOptions): Promise<readonly SearchHit[]>;\n\n readonly onStarted: EventHook<SearchStartedEvent>;\n /**\n * `getProgress()` changed: once per slice of pages a search gets through,\n * and back to none when a new search starts or the session is cleared.\n */\n readonly onProgressChanged: EventHook<SearchProgressChangedEvent>;\n readonly onCompleted: EventHook<SearchCompletedEvent>;\n readonly onCancelled: EventHook<SearchCancelledEvent>;\n readonly onFailed: EventHook<SearchFailedEvent>;\n readonly onActiveHitChanged: EventHook<SearchActiveHitChangedEvent>;\n readonly onCleared: EventHook<SearchClearedEvent>;\n}\n\nexport { SearchToken } from './token';\n"],"mappings":";;;;;AAMA,MAAa,eAAA,GAAA,eAAA,sBAAA,CAAsD,UAAU;CAC3E,MAAM;CAGN,UAAU;EACR,QAAQ;EACR,SAAS;EACT,SAAS;CACX;AACF,CAAC;;;;ACoGD,MAAa,kBAAkC;CAC7C,QAAQ;EAAE,QAAQ,EAAE,GAAG,IAAK;EAAG,UAAU;CAAS;CAClD,WAAW;EAAE,OAAO;EAAW,aAAa;EAAW,WAAW;CAAW;AAC/E"}
@@ -0,0 +1,214 @@
1
+ import { DeepPartial, EventHook, OperationOptions, PageRef, PluginErrorInfo, SettingsApi } from "@embedpdf/core";
2
+ import { RevealAnchor, ScrollBehaviorKind } from "@embedpdf/plugin-stage/contract";
3
+ import { PdfTextSegment, SearchQuery, SearchQuery as SearchQuery$1, SearchQueryIssue, SearchQueryValidation, SearchRegexValidation, SearchSnippet, SearchSnippet as SearchSnippet$1, validateSearchQuery, validateSearchRegex } from "@embedpdf/engine-core/runtime";
4
+ import { Rect } from "@embedpdf/core-geometry";
5
+ //#region src/token.d.ts
6
+ declare const SearchToken: import("@embedpdf/core").CapabilityToken<SearchCapability>;
7
+ //#endregion
8
+ //#region src/contract.d.ts
9
+ /**
10
+ * One merged visual line of a match in page space, as the engine's layout
11
+ * gives it (selection's `SelectionSegment` is the same line). `quad` is the
12
+ * geometric authority, its corners named in the line's own frame; `rect` its
13
+ * bounds; `advance` the reading direction along the baseline.
14
+ */
15
+ type TextSegment = PdfTextSegment;
16
+ /**
17
+ * One match. `page` is the durable page identity, `pageIndex` its display
18
+ * index at the time of the match. `start`/`count` are a range of the page's
19
+ * characters, so a hit goes straight to `selection.select(hit)` or a markup
20
+ * annotation without re-searching.
21
+ */
22
+ interface SearchHit {
23
+ readonly page: PageRef;
24
+ readonly pageIndex: number;
25
+ readonly start: number;
26
+ readonly count: number;
27
+ /** Visual-line segments in page space — the drawing input. */
28
+ readonly segments: readonly TextSegment[];
29
+ /** Union of the segments — the reveal target. Absent for matches with no drawable geometry. */
30
+ readonly bounds?: Rect;
31
+ readonly snippet?: SearchSnippet;
32
+ }
33
+ /**
34
+ * `searching`: the scan is walking pages, hits are usable as they stream in.
35
+ * `cancelled`: the scan was stopped by `cancel()`; the hits found so far stay.
36
+ */
37
+ type SearchStatus = 'idle' | 'searching' | 'complete' | 'cancelled' | 'error';
38
+ interface SearchProgress {
39
+ readonly pagesSearched: number;
40
+ readonly pageCount: number;
41
+ }
42
+ /** How a match arrives in view when you move to it: forwarded to the Stage's positioned reveal. */
43
+ interface SearchReveal {
44
+ /** Where the match lands in the view: `{ y: 0.35 }` puts it 35% of the way down, like a browser's find bar. */
45
+ readonly anchor: RevealAnchor;
46
+ /** Glide there (`'smooth'`) or jump (`'instant'`). */
47
+ readonly behavior: ScrollBehaviorKind;
48
+ }
49
+ /** The `reveal` setting for one call: what the call leaves out comes from the setting. */
50
+ type SearchRevealOptions = Partial<SearchReveal>;
51
+ /** How the highlights mix with the page: a CSS `mix-blend-mode` keyword. */
52
+ type SearchBlendMode = 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';
53
+ /**
54
+ * The search plugin's settings. `searchPlugin(config)` registers them over
55
+ * {@link SEARCH_DEFAULTS}, and `updateSettings()` changes them for every
56
+ * document while the app runs. The highlight's three can also come from CSS
57
+ * (`--epdf-search-highlight`, `--epdf-search-highlight-active`,
58
+ * `--epdf-search-blend-mode`), which wins over the setting.
59
+ */
60
+ interface SearchSettings {
61
+ /** Where a match lands when `nextHit()`, `previousHit()` or `goToHit()` moves to it. */
62
+ readonly reveal: SearchReveal;
63
+ readonly highlight: {
64
+ /** The highlight of every match. */
65
+ readonly color: string;
66
+ /** The highlight of the active match. */
67
+ readonly activeColor: string;
68
+ /**
69
+ * `'multiply'` is a real highlighter: the text stays crisp through the
70
+ * color and only the paper tints. On dark or scanned pages, where a
71
+ * multiplied highlight disappears, use `'normal'` with translucent colors.
72
+ */
73
+ readonly blendMode: SearchBlendMode;
74
+ };
75
+ }
76
+ /** What the search settings are when the app registers none. */
77
+ declare const SEARCH_DEFAULTS: SearchSettings;
78
+ /** What `searchPlugin(config)` takes: any of the settings, merged over the defaults. */
79
+ type SearchConfig = DeepPartial<SearchSettings>;
80
+ interface SearchOptions extends OperationOptions {
81
+ /**
82
+ * Where to start: a page's ref or its index. Defaults to the Stage's
83
+ * current page (viewport-first) when a Stage is installed.
84
+ */
85
+ readonly from?: PageRef | number;
86
+ }
87
+ interface SearchFindAllOptions extends OperationOptions {
88
+ /**
89
+ * Pin whether hits carry snippets. By default they do, falling back to none
90
+ * when snippets are denied; pass `false` when only geometry is needed.
91
+ */
92
+ readonly snippets?: boolean;
93
+ }
94
+ /** What a `search()` resolved to: it finished, a newer search replaced it, or it was cancelled. */
95
+ interface SearchResult {
96
+ readonly status: 'complete' | 'superseded' | 'cancelled';
97
+ readonly hitCount: number;
98
+ }
99
+ interface SearchHitFilter {
100
+ /** One page's hits: its ref or its index. */
101
+ readonly page?: PageRef | number;
102
+ }
103
+ interface SearchStartedEvent {
104
+ readonly query: SearchQuery;
105
+ }
106
+ /**
107
+ * The search's progress changed: how many pages were searched, of how many,
108
+ * and the matches found so far. The same values `getProgress()` and
109
+ * `getHitCount()` return from then on.
110
+ */
111
+ interface SearchProgressChangedEvent extends SearchProgress {
112
+ readonly hitCount: number;
113
+ }
114
+ interface SearchCompletedEvent {
115
+ readonly hitCount: number;
116
+ }
117
+ interface SearchCancelledEvent {
118
+ readonly reason: 'superseded' | 'cancelled' | 'cleared';
119
+ }
120
+ interface SearchFailedEvent {
121
+ readonly error: PluginErrorInfo;
122
+ }
123
+ interface SearchActiveHitChangedEvent {
124
+ readonly index: number;
125
+ readonly hit: SearchHit | null;
126
+ }
127
+ type SearchClearedEvent = Record<string, never>;
128
+ /**
129
+ * The search plugin is a find service (`findAll`) plus one user-visible
130
+ * search session per document (`search` and everything below it). The
131
+ * sidebar, the highlight layer and next/previous render the session. Its
132
+ * settings (`getSettings`, `updateSettings`, `resetSettings`,
133
+ * `onSettingsChanged`) belong to the plugin, not to a document: a change
134
+ * reaches every open document.
135
+ */
136
+ interface SearchCapability extends SettingsApi<SearchSettings> {
137
+ /**
138
+ * Would a search be served now: `doc.text.search`. With `snippets: true`
139
+ * it also needs `doc.text.copy`, because a snippet reproduces document text.
140
+ */
141
+ canSearch(options?: {
142
+ readonly snippets?: boolean;
143
+ }): boolean;
144
+ /**
145
+ * Start a new search. A newer search supersedes and aborts a running one.
146
+ * Hits stream into the session as they are found; the first hit becomes
147
+ * active but the camera does not move until you navigate. Resolves when
148
+ * the scan completes, is superseded, or is cancelled (also through
149
+ * `options.signal`); rejects only on a real failure, `permission-denied`
150
+ * without `doc.text.search`, or `not-found` for a `from` page that isn't in
151
+ * the document. A refusal only rejects: the session stays as it was and no
152
+ * event fires. An empty `query.text` is identical to `clear()`. Fires
153
+ * `onStarted`, `onProgressChanged` as each slice of pages is searched, then
154
+ * `onCompleted`, `onCancelled` or `onFailed`.
155
+ */
156
+ search(query: SearchQuery, options?: SearchOptions): Promise<SearchResult>;
157
+ /**
158
+ * Re-run the current query from scratch (the plugin does this itself after
159
+ * document mutations). Resolves and rejects as `search()` does.
160
+ */
161
+ refresh(options?: OperationOptions): Promise<SearchResult>;
162
+ /** Stop the scan and keep the hits found so far. */
163
+ cancel(): void;
164
+ /** Stop the scan and drop the session. */
165
+ clear(): void;
166
+ /** Step to the next / previous hit, wrapping, and reveal it. */
167
+ nextHit(options?: SearchRevealOptions): SearchHit | null;
168
+ previousHit(options?: SearchRevealOptions): SearchHit | null;
169
+ /**
170
+ * Make a hit the active one and reveal it: the hit itself, such as the one
171
+ * `<SearchLayer onHitClick>` hands you, or its index (which wraps). Returns
172
+ * the hit, or null when there are no hits or the given one isn't among them.
173
+ */
174
+ goToHit(hit: SearchHit | number, options?: SearchRevealOptions): SearchHit | null;
175
+ /** Bring the active hit back into view without changing it. */
176
+ revealActiveHit(options?: SearchRevealOptions): void;
177
+ getQuery(): SearchQuery | null;
178
+ getStatus(): SearchStatus;
179
+ /**
180
+ * Hits found so far, or those on one page. Reference-stable (per page too)
181
+ * until new hits land there. Empty for a page that isn't in the document,
182
+ * so a layer that reads while its page is deleted still renders.
183
+ */
184
+ listHits(filter?: SearchHitFilter): readonly SearchHit[];
185
+ /** How many hits were found so far, or on one page; 0 for a page that isn't in the document. */
186
+ getHitCount(page?: PageRef | number): number;
187
+ listPagesWithHits(): readonly PageRef[];
188
+ /** `-1` when no hit is active. */
189
+ getActiveHitIndex(): number;
190
+ getActiveHit(): SearchHit | null;
191
+ getProgress(): SearchProgress;
192
+ getError(): PluginErrorInfo | null;
193
+ /**
194
+ * Run a query to completion and return every hit, touching no session
195
+ * state. Scans in natural page order; concurrent calls are independent.
196
+ * Rejects `operation-cancelled` when `options.signal` aborts, and
197
+ * `permission-denied` without `doc.text.search`.
198
+ */
199
+ findAll(query: SearchQuery, options?: SearchFindAllOptions): Promise<readonly SearchHit[]>;
200
+ readonly onStarted: EventHook<SearchStartedEvent>;
201
+ /**
202
+ * `getProgress()` changed: once per slice of pages a search gets through,
203
+ * and back to none when a new search starts or the session is cleared.
204
+ */
205
+ readonly onProgressChanged: EventHook<SearchProgressChangedEvent>;
206
+ readonly onCompleted: EventHook<SearchCompletedEvent>;
207
+ readonly onCancelled: EventHook<SearchCancelledEvent>;
208
+ readonly onFailed: EventHook<SearchFailedEvent>;
209
+ readonly onActiveHitChanged: EventHook<SearchActiveHitChangedEvent>;
210
+ readonly onCleared: EventHook<SearchClearedEvent>;
211
+ }
212
+ //#endregion
213
+ export { SearchToken as A, SearchSettings as C, TextSegment as D, SearchStatus as E, validateSearchQuery as O, SearchRevealOptions as S, SearchStartedEvent as T, SearchQueryIssue as _, SearchCapability as a, SearchResult as b, SearchConfig as c, SearchHit as d, SearchHitFilter as f, SearchQuery$1 as g, SearchProgressChangedEvent as h, SearchCancelledEvent as i, validateSearchRegex as k, SearchFailedEvent as l, SearchProgress as m, SearchActiveHitChangedEvent as n, SearchClearedEvent as o, SearchOptions as p, SearchBlendMode as r, SearchCompletedEvent as s, SEARCH_DEFAULTS as t, SearchFindAllOptions as u, SearchQueryValidation as v, SearchSnippet$1 as w, SearchReveal as x, SearchRegexValidation as y };
214
+ //# sourceMappingURL=contract-B7maCczh.d.ts.map
@@ -0,0 +1,214 @@
1
+ import { DeepPartial, EventHook, OperationOptions, PageRef, PluginErrorInfo, SettingsApi } from "@embedpdf/core";
2
+ import { Rect } from "@embedpdf/core-geometry";
3
+ import { RevealAnchor, ScrollBehaviorKind } from "@embedpdf/plugin-stage/contract";
4
+ import { PdfTextSegment, SearchQuery, SearchQuery as SearchQuery$1, SearchQueryIssue, SearchQueryValidation, SearchRegexValidation, SearchSnippet, SearchSnippet as SearchSnippet$1, validateSearchQuery, validateSearchRegex } from "@embedpdf/engine-core/runtime";
5
+ //#region src/token.d.ts
6
+ declare const SearchToken: import("@embedpdf/core").CapabilityToken<SearchCapability>;
7
+ //#endregion
8
+ //#region src/contract.d.ts
9
+ /**
10
+ * One merged visual line of a match in page space, as the engine's layout
11
+ * gives it (selection's `SelectionSegment` is the same line). `quad` is the
12
+ * geometric authority, its corners named in the line's own frame; `rect` its
13
+ * bounds; `advance` the reading direction along the baseline.
14
+ */
15
+ type TextSegment = PdfTextSegment;
16
+ /**
17
+ * One match. `page` is the durable page identity, `pageIndex` its display
18
+ * index at the time of the match. `start`/`count` are a range of the page's
19
+ * characters, so a hit goes straight to `selection.select(hit)` or a markup
20
+ * annotation without re-searching.
21
+ */
22
+ interface SearchHit {
23
+ readonly page: PageRef;
24
+ readonly pageIndex: number;
25
+ readonly start: number;
26
+ readonly count: number;
27
+ /** Visual-line segments in page space — the drawing input. */
28
+ readonly segments: readonly TextSegment[];
29
+ /** Union of the segments — the reveal target. Absent for matches with no drawable geometry. */
30
+ readonly bounds?: Rect;
31
+ readonly snippet?: SearchSnippet;
32
+ }
33
+ /**
34
+ * `searching`: the scan is walking pages, hits are usable as they stream in.
35
+ * `cancelled`: the scan was stopped by `cancel()`; the hits found so far stay.
36
+ */
37
+ type SearchStatus = 'idle' | 'searching' | 'complete' | 'cancelled' | 'error';
38
+ interface SearchProgress {
39
+ readonly pagesSearched: number;
40
+ readonly pageCount: number;
41
+ }
42
+ /** How a match arrives in view when you move to it: forwarded to the Stage's positioned reveal. */
43
+ interface SearchReveal {
44
+ /** Where the match lands in the view: `{ y: 0.35 }` puts it 35% of the way down, like a browser's find bar. */
45
+ readonly anchor: RevealAnchor;
46
+ /** Glide there (`'smooth'`) or jump (`'instant'`). */
47
+ readonly behavior: ScrollBehaviorKind;
48
+ }
49
+ /** The `reveal` setting for one call: what the call leaves out comes from the setting. */
50
+ type SearchRevealOptions = Partial<SearchReveal>;
51
+ /** How the highlights mix with the page: a CSS `mix-blend-mode` keyword. */
52
+ type SearchBlendMode = 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';
53
+ /**
54
+ * The search plugin's settings. `searchPlugin(config)` registers them over
55
+ * {@link SEARCH_DEFAULTS}, and `updateSettings()` changes them for every
56
+ * document while the app runs. The highlight's three can also come from CSS
57
+ * (`--epdf-search-highlight`, `--epdf-search-highlight-active`,
58
+ * `--epdf-search-blend-mode`), which wins over the setting.
59
+ */
60
+ interface SearchSettings {
61
+ /** Where a match lands when `nextHit()`, `previousHit()` or `goToHit()` moves to it. */
62
+ readonly reveal: SearchReveal;
63
+ readonly highlight: {
64
+ /** The highlight of every match. */
65
+ readonly color: string;
66
+ /** The highlight of the active match. */
67
+ readonly activeColor: string;
68
+ /**
69
+ * `'multiply'` is a real highlighter: the text stays crisp through the
70
+ * color and only the paper tints. On dark or scanned pages, where a
71
+ * multiplied highlight disappears, use `'normal'` with translucent colors.
72
+ */
73
+ readonly blendMode: SearchBlendMode;
74
+ };
75
+ }
76
+ /** What the search settings are when the app registers none. */
77
+ declare const SEARCH_DEFAULTS: SearchSettings;
78
+ /** What `searchPlugin(config)` takes: any of the settings, merged over the defaults. */
79
+ type SearchConfig = DeepPartial<SearchSettings>;
80
+ interface SearchOptions extends OperationOptions {
81
+ /**
82
+ * Where to start: a page's ref or its index. Defaults to the Stage's
83
+ * current page (viewport-first) when a Stage is installed.
84
+ */
85
+ readonly from?: PageRef | number;
86
+ }
87
+ interface SearchFindAllOptions extends OperationOptions {
88
+ /**
89
+ * Pin whether hits carry snippets. By default they do, falling back to none
90
+ * when snippets are denied; pass `false` when only geometry is needed.
91
+ */
92
+ readonly snippets?: boolean;
93
+ }
94
+ /** What a `search()` resolved to: it finished, a newer search replaced it, or it was cancelled. */
95
+ interface SearchResult {
96
+ readonly status: 'complete' | 'superseded' | 'cancelled';
97
+ readonly hitCount: number;
98
+ }
99
+ interface SearchHitFilter {
100
+ /** One page's hits: its ref or its index. */
101
+ readonly page?: PageRef | number;
102
+ }
103
+ interface SearchStartedEvent {
104
+ readonly query: SearchQuery;
105
+ }
106
+ /**
107
+ * The search's progress changed: how many pages were searched, of how many,
108
+ * and the matches found so far. The same values `getProgress()` and
109
+ * `getHitCount()` return from then on.
110
+ */
111
+ interface SearchProgressChangedEvent extends SearchProgress {
112
+ readonly hitCount: number;
113
+ }
114
+ interface SearchCompletedEvent {
115
+ readonly hitCount: number;
116
+ }
117
+ interface SearchCancelledEvent {
118
+ readonly reason: 'superseded' | 'cancelled' | 'cleared';
119
+ }
120
+ interface SearchFailedEvent {
121
+ readonly error: PluginErrorInfo;
122
+ }
123
+ interface SearchActiveHitChangedEvent {
124
+ readonly index: number;
125
+ readonly hit: SearchHit | null;
126
+ }
127
+ type SearchClearedEvent = Record<string, never>;
128
+ /**
129
+ * The search plugin is a find service (`findAll`) plus one user-visible
130
+ * search session per document (`search` and everything below it). The
131
+ * sidebar, the highlight layer and next/previous render the session. Its
132
+ * settings (`getSettings`, `updateSettings`, `resetSettings`,
133
+ * `onSettingsChanged`) belong to the plugin, not to a document: a change
134
+ * reaches every open document.
135
+ */
136
+ interface SearchCapability extends SettingsApi<SearchSettings> {
137
+ /**
138
+ * Would a search be served now: `doc.text.search`. With `snippets: true`
139
+ * it also needs `doc.text.copy`, because a snippet reproduces document text.
140
+ */
141
+ canSearch(options?: {
142
+ readonly snippets?: boolean;
143
+ }): boolean;
144
+ /**
145
+ * Start a new search. A newer search supersedes and aborts a running one.
146
+ * Hits stream into the session as they are found; the first hit becomes
147
+ * active but the camera does not move until you navigate. Resolves when
148
+ * the scan completes, is superseded, or is cancelled (also through
149
+ * `options.signal`); rejects only on a real failure, `permission-denied`
150
+ * without `doc.text.search`, or `not-found` for a `from` page that isn't in
151
+ * the document. A refusal only rejects: the session stays as it was and no
152
+ * event fires. An empty `query.text` is identical to `clear()`. Fires
153
+ * `onStarted`, `onProgressChanged` as each slice of pages is searched, then
154
+ * `onCompleted`, `onCancelled` or `onFailed`.
155
+ */
156
+ search(query: SearchQuery, options?: SearchOptions): Promise<SearchResult>;
157
+ /**
158
+ * Re-run the current query from scratch (the plugin does this itself after
159
+ * document mutations). Resolves and rejects as `search()` does.
160
+ */
161
+ refresh(options?: OperationOptions): Promise<SearchResult>;
162
+ /** Stop the scan and keep the hits found so far. */
163
+ cancel(): void;
164
+ /** Stop the scan and drop the session. */
165
+ clear(): void;
166
+ /** Step to the next / previous hit, wrapping, and reveal it. */
167
+ nextHit(options?: SearchRevealOptions): SearchHit | null;
168
+ previousHit(options?: SearchRevealOptions): SearchHit | null;
169
+ /**
170
+ * Make a hit the active one and reveal it: the hit itself, such as the one
171
+ * `<SearchLayer onHitClick>` hands you, or its index (which wraps). Returns
172
+ * the hit, or null when there are no hits or the given one isn't among them.
173
+ */
174
+ goToHit(hit: SearchHit | number, options?: SearchRevealOptions): SearchHit | null;
175
+ /** Bring the active hit back into view without changing it. */
176
+ revealActiveHit(options?: SearchRevealOptions): void;
177
+ getQuery(): SearchQuery | null;
178
+ getStatus(): SearchStatus;
179
+ /**
180
+ * Hits found so far, or those on one page. Reference-stable (per page too)
181
+ * until new hits land there. Empty for a page that isn't in the document,
182
+ * so a layer that reads while its page is deleted still renders.
183
+ */
184
+ listHits(filter?: SearchHitFilter): readonly SearchHit[];
185
+ /** How many hits were found so far, or on one page; 0 for a page that isn't in the document. */
186
+ getHitCount(page?: PageRef | number): number;
187
+ listPagesWithHits(): readonly PageRef[];
188
+ /** `-1` when no hit is active. */
189
+ getActiveHitIndex(): number;
190
+ getActiveHit(): SearchHit | null;
191
+ getProgress(): SearchProgress;
192
+ getError(): PluginErrorInfo | null;
193
+ /**
194
+ * Run a query to completion and return every hit, touching no session
195
+ * state. Scans in natural page order; concurrent calls are independent.
196
+ * Rejects `operation-cancelled` when `options.signal` aborts, and
197
+ * `permission-denied` without `doc.text.search`.
198
+ */
199
+ findAll(query: SearchQuery, options?: SearchFindAllOptions): Promise<readonly SearchHit[]>;
200
+ readonly onStarted: EventHook<SearchStartedEvent>;
201
+ /**
202
+ * `getProgress()` changed: once per slice of pages a search gets through,
203
+ * and back to none when a new search starts or the session is cleared.
204
+ */
205
+ readonly onProgressChanged: EventHook<SearchProgressChangedEvent>;
206
+ readonly onCompleted: EventHook<SearchCompletedEvent>;
207
+ readonly onCancelled: EventHook<SearchCancelledEvent>;
208
+ readonly onFailed: EventHook<SearchFailedEvent>;
209
+ readonly onActiveHitChanged: EventHook<SearchActiveHitChangedEvent>;
210
+ readonly onCleared: EventHook<SearchClearedEvent>;
211
+ }
212
+ //#endregion
213
+ export { SearchToken as A, SearchSettings as C, TextSegment as D, SearchStatus as E, validateSearchQuery as O, SearchRevealOptions as S, SearchStartedEvent as T, SearchQueryIssue as _, SearchCapability as a, SearchResult as b, SearchConfig as c, SearchHit as d, SearchHitFilter as f, SearchQuery$1 as g, SearchProgressChangedEvent as h, SearchCancelledEvent as i, validateSearchRegex as k, SearchFailedEvent as l, SearchProgress as m, SearchActiveHitChangedEvent as n, SearchClearedEvent as o, SearchOptions as p, SearchBlendMode as r, SearchCompletedEvent as s, SEARCH_DEFAULTS as t, SearchFindAllOptions as u, SearchQueryValidation as v, SearchSnippet$1 as w, SearchReveal as x, SearchRegexValidation as y };
214
+ //# sourceMappingURL=contract-DqeptOSn.d.cts.map
@@ -0,0 +1,31 @@
1
+ import { createCapabilityToken } from "@embedpdf/core";
2
+ import { validateSearchQuery, validateSearchRegex } from "@embedpdf/engine-core/runtime";
3
+ //#region src/token.ts
4
+ /** The package token — created once here; `contract.ts` re-exports it and
5
+ * `host-contract.ts` widens it. */
6
+ const SearchToken = createCapabilityToken("search", {
7
+ hint: "add searchPlugin() from '@embedpdf/plugin-search' to your plugins list",
8
+ promises: {
9
+ search: true,
10
+ refresh: true,
11
+ findAll: true
12
+ }
13
+ });
14
+ //#endregion
15
+ //#region src/contract.ts
16
+ /** What the search settings are when the app registers none. */
17
+ const SEARCH_DEFAULTS = {
18
+ reveal: {
19
+ anchor: { y: .35 },
20
+ behavior: "smooth"
21
+ },
22
+ highlight: {
23
+ color: "#ffd500",
24
+ activeColor: "#ff9632",
25
+ blendMode: "multiply"
26
+ }
27
+ };
28
+ //#endregion
29
+ export { SearchToken as i, validateSearchQuery as n, validateSearchRegex as r, SEARCH_DEFAULTS as t };
30
+
31
+ //# sourceMappingURL=contract-uWSW5IYM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-uWSW5IYM.js","names":[],"sources":["../src/token.ts","../src/contract.ts"],"sourcesContent":["/** The package token — created once here; `contract.ts` re-exports it and\n * `host-contract.ts` widens it. */\nimport { createCapabilityToken } from '@embedpdf/core';\n\nimport type { SearchCapability } from './contract';\n\nexport const SearchToken = createCapabilityToken<SearchCapability>('search', {\n hint: \"add searchPlugin() from '@embedpdf/plugin-search' to your plugins list\",\n // Without a document, an adapter's stand-in rejects these with `not-ready`, as the\n // capability would; the type asks for every member that returns a promise.\n promises: {\n search: true,\n refresh: true,\n findAll: true,\n },\n});\n","import {\n type DeepPartial,\n type EventHook,\n type OperationOptions,\n type PageRef,\n type PluginErrorInfo,\n type SettingsApi,\n} from '@embedpdf/core';\nimport type { Rect } from '@embedpdf/core-geometry';\nimport type { RevealAnchor, ScrollBehaviorKind } from '@embedpdf/plugin-stage/contract';\nimport type { PdfTextSegment, SearchQuery, SearchSnippet } from '@embedpdf/engine-core/runtime';\n\nexport { validateSearchQuery, validateSearchRegex } from '@embedpdf/engine-core/runtime';\nexport type {\n SearchQuery,\n SearchQueryIssue,\n SearchQueryValidation,\n SearchRegexValidation,\n SearchSnippet,\n} from '@embedpdf/engine-core/runtime';\n\n/**\n * One merged visual line of a match in page space, as the engine's layout\n * gives it (selection's `SelectionSegment` is the same line). `quad` is the\n * geometric authority, its corners named in the line's own frame; `rect` its\n * bounds; `advance` the reading direction along the baseline.\n */\nexport type TextSegment = PdfTextSegment;\n\n/**\n * One match. `page` is the durable page identity, `pageIndex` its display\n * index at the time of the match. `start`/`count` are a range of the page's\n * characters, so a hit goes straight to `selection.select(hit)` or a markup\n * annotation without re-searching.\n */\nexport interface SearchHit {\n readonly page: PageRef;\n readonly pageIndex: number;\n readonly start: number;\n readonly count: number;\n /** Visual-line segments in page space — the drawing input. */\n readonly segments: readonly TextSegment[];\n /** Union of the segments — the reveal target. Absent for matches with no drawable geometry. */\n readonly bounds?: Rect;\n readonly snippet?: SearchSnippet;\n}\n\n/**\n * `searching`: the scan is walking pages, hits are usable as they stream in.\n * `cancelled`: the scan was stopped by `cancel()`; the hits found so far stay.\n */\nexport type SearchStatus = 'idle' | 'searching' | 'complete' | 'cancelled' | 'error';\n\nexport interface SearchProgress {\n readonly pagesSearched: number;\n readonly pageCount: number;\n}\n\n// ── settings ──────────────────────────────────────────────────────────────\n\n/** How a match arrives in view when you move to it: forwarded to the Stage's positioned reveal. */\nexport interface SearchReveal {\n /** Where the match lands in the view: `{ y: 0.35 }` puts it 35% of the way down, like a browser's find bar. */\n readonly anchor: RevealAnchor;\n /** Glide there (`'smooth'`) or jump (`'instant'`). */\n readonly behavior: ScrollBehaviorKind;\n}\n\n/** The `reveal` setting for one call: what the call leaves out comes from the setting. */\nexport type SearchRevealOptions = Partial<SearchReveal>;\n\n/** How the highlights mix with the page: a CSS `mix-blend-mode` keyword. */\nexport type SearchBlendMode =\n | 'normal'\n | 'multiply'\n | 'screen'\n | 'overlay'\n | 'darken'\n | 'lighten'\n | 'color-dodge'\n | 'color-burn'\n | 'hard-light'\n | 'soft-light'\n | 'difference'\n | 'exclusion'\n | 'hue'\n | 'saturation'\n | 'color'\n | 'luminosity';\n\n/**\n * The search plugin's settings. `searchPlugin(config)` registers them over\n * {@link SEARCH_DEFAULTS}, and `updateSettings()` changes them for every\n * document while the app runs. The highlight's three can also come from CSS\n * (`--epdf-search-highlight`, `--epdf-search-highlight-active`,\n * `--epdf-search-blend-mode`), which wins over the setting.\n */\nexport interface SearchSettings {\n /** Where a match lands when `nextHit()`, `previousHit()` or `goToHit()` moves to it. */\n readonly reveal: SearchReveal;\n readonly highlight: {\n /** The highlight of every match. */\n readonly color: string;\n /** The highlight of the active match. */\n readonly activeColor: string;\n /**\n * `'multiply'` is a real highlighter: the text stays crisp through the\n * color and only the paper tints. On dark or scanned pages, where a\n * multiplied highlight disappears, use `'normal'` with translucent colors.\n */\n readonly blendMode: SearchBlendMode;\n };\n}\n\n/** What the search settings are when the app registers none. */\nexport const SEARCH_DEFAULTS: SearchSettings = {\n reveal: { anchor: { y: 0.35 }, behavior: 'smooth' },\n highlight: { color: '#ffd500', activeColor: '#ff9632', blendMode: 'multiply' },\n};\n\n/** What `searchPlugin(config)` takes: any of the settings, merged over the defaults. */\nexport type SearchConfig = DeepPartial<SearchSettings>;\n\n// ── verbs ─────────────────────────────────────────────────────────────────\n\nexport interface SearchOptions extends OperationOptions {\n /**\n * Where to start: a page's ref or its index. Defaults to the Stage's\n * current page (viewport-first) when a Stage is installed.\n */\n readonly from?: PageRef | number;\n}\n\nexport interface SearchFindAllOptions extends OperationOptions {\n /**\n * Pin whether hits carry snippets. By default they do, falling back to none\n * when snippets are denied; pass `false` when only geometry is needed.\n */\n readonly snippets?: boolean;\n}\n\n/** What a `search()` resolved to: it finished, a newer search replaced it, or it was cancelled. */\nexport interface SearchResult {\n readonly status: 'complete' | 'superseded' | 'cancelled';\n readonly hitCount: number;\n}\n\nexport interface SearchHitFilter {\n /** One page's hits: its ref or its index. */\n readonly page?: PageRef | number;\n}\n\n// ── events ────────────────────────────────────────────────────────────────\n\nexport interface SearchStartedEvent {\n readonly query: SearchQuery;\n}\n/**\n * The search's progress changed: how many pages were searched, of how many,\n * and the matches found so far. The same values `getProgress()` and\n * `getHitCount()` return from then on.\n */\nexport interface SearchProgressChangedEvent extends SearchProgress {\n readonly hitCount: number;\n}\nexport interface SearchCompletedEvent {\n readonly hitCount: number;\n}\nexport interface SearchCancelledEvent {\n readonly reason: 'superseded' | 'cancelled' | 'cleared';\n}\nexport interface SearchFailedEvent {\n readonly error: PluginErrorInfo;\n}\nexport interface SearchActiveHitChangedEvent {\n readonly index: number;\n readonly hit: SearchHit | null;\n}\nexport type SearchClearedEvent = Record<string, never>;\n\n/**\n * The search plugin is a find service (`findAll`) plus one user-visible\n * search session per document (`search` and everything below it). The\n * sidebar, the highlight layer and next/previous render the session. Its\n * settings (`getSettings`, `updateSettings`, `resetSettings`,\n * `onSettingsChanged`) belong to the plugin, not to a document: a change\n * reaches every open document.\n */\nexport interface SearchCapability extends SettingsApi<SearchSettings> {\n /**\n * Would a search be served now: `doc.text.search`. With `snippets: true`\n * it also needs `doc.text.copy`, because a snippet reproduces document text.\n */\n canSearch(options?: { readonly snippets?: boolean }): boolean;\n\n // ── the session ─────────────────────────────────────────────────────────\n /**\n * Start a new search. A newer search supersedes and aborts a running one.\n * Hits stream into the session as they are found; the first hit becomes\n * active but the camera does not move until you navigate. Resolves when\n * the scan completes, is superseded, or is cancelled (also through\n * `options.signal`); rejects only on a real failure, `permission-denied`\n * without `doc.text.search`, or `not-found` for a `from` page that isn't in\n * the document. A refusal only rejects: the session stays as it was and no\n * event fires. An empty `query.text` is identical to `clear()`. Fires\n * `onStarted`, `onProgressChanged` as each slice of pages is searched, then\n * `onCompleted`, `onCancelled` or `onFailed`.\n */\n search(query: SearchQuery, options?: SearchOptions): Promise<SearchResult>;\n /**\n * Re-run the current query from scratch (the plugin does this itself after\n * document mutations). Resolves and rejects as `search()` does.\n */\n refresh(options?: OperationOptions): Promise<SearchResult>;\n /** Stop the scan and keep the hits found so far. */\n cancel(): void;\n /** Stop the scan and drop the session. */\n clear(): void;\n\n /** Step to the next / previous hit, wrapping, and reveal it. */\n nextHit(options?: SearchRevealOptions): SearchHit | null;\n previousHit(options?: SearchRevealOptions): SearchHit | null;\n /**\n * Make a hit the active one and reveal it: the hit itself, such as the one\n * `<SearchLayer onHitClick>` hands you, or its index (which wraps). Returns\n * the hit, or null when there are no hits or the given one isn't among them.\n */\n goToHit(hit: SearchHit | number, options?: SearchRevealOptions): SearchHit | null;\n /** Bring the active hit back into view without changing it. */\n revealActiveHit(options?: SearchRevealOptions): void;\n\n getQuery(): SearchQuery | null;\n getStatus(): SearchStatus;\n /**\n * Hits found so far, or those on one page. Reference-stable (per page too)\n * until new hits land there. Empty for a page that isn't in the document,\n * so a layer that reads while its page is deleted still renders.\n */\n listHits(filter?: SearchHitFilter): readonly SearchHit[];\n /** How many hits were found so far, or on one page; 0 for a page that isn't in the document. */\n getHitCount(page?: PageRef | number): number;\n listPagesWithHits(): readonly PageRef[];\n /** `-1` when no hit is active. */\n getActiveHitIndex(): number;\n getActiveHit(): SearchHit | null;\n getProgress(): SearchProgress;\n getError(): PluginErrorInfo | null;\n\n // ── the service ─────────────────────────────────────────────────────────\n /**\n * Run a query to completion and return every hit, touching no session\n * state. Scans in natural page order; concurrent calls are independent.\n * Rejects `operation-cancelled` when `options.signal` aborts, and\n * `permission-denied` without `doc.text.search`.\n */\n findAll(query: SearchQuery, options?: SearchFindAllOptions): Promise<readonly SearchHit[]>;\n\n readonly onStarted: EventHook<SearchStartedEvent>;\n /**\n * `getProgress()` changed: once per slice of pages a search gets through,\n * and back to none when a new search starts or the session is cleared.\n */\n readonly onProgressChanged: EventHook<SearchProgressChangedEvent>;\n readonly onCompleted: EventHook<SearchCompletedEvent>;\n readonly onCancelled: EventHook<SearchCancelledEvent>;\n readonly onFailed: EventHook<SearchFailedEvent>;\n readonly onActiveHitChanged: EventHook<SearchActiveHitChangedEvent>;\n readonly onCleared: EventHook<SearchClearedEvent>;\n}\n\nexport { SearchToken } from './token';\n"],"mappings":";;;;;AAMA,MAAa,cAAc,sBAAwC,UAAU;CAC3E,MAAM;CAGN,UAAU;EACR,QAAQ;EACR,SAAS;EACT,SAAS;CACX;AACF,CAAC;;;;ACoGD,MAAa,kBAAkC;CAC7C,QAAQ;EAAE,QAAQ,EAAE,GAAG,IAAK;EAAG,UAAU;CAAS;CAClD,WAAW;EAAE,OAAO;EAAW,aAAa;EAAW,WAAW;CAAW;AAC/E"}
package/dist/contract.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_contract = require("./contract-4PZsI7Ty.cjs");
2
+ const require_contract = require("./contract-6pr6LBhA.cjs");
3
3
  let _embedpdf_engine_core_runtime = require("@embedpdf/engine-core/runtime");
4
+ exports.SEARCH_DEFAULTS = require_contract.SEARCH_DEFAULTS;
4
5
  exports.SearchToken = require_contract.SearchToken;
5
6
  Object.defineProperty(exports, "validateSearchQuery", {
6
7
  enumerable: true,
@@ -1,2 +1,2 @@
1
- import { _ as SearchToken, a as SearchSnippet, d as SearchFindAllOptions, f as SearchHit, g as SearchStatus, h as SearchState, i as SearchRegexValidation, l as SearchCapability, m as SearchRevealOptions, n as SearchQueryIssue, o as validateSearchQuery, p as SearchPluginConfig, r as SearchQueryValidation, s as validateSearchRegex, t as SearchQuery, u as SearchExecOptions } from "./contract-CSb66POC.cjs";
2
- export { type SearchCapability, type SearchExecOptions, type SearchFindAllOptions, type SearchHit, type SearchPluginConfig, type SearchQuery, type SearchQueryIssue, type SearchQueryValidation, type SearchRegexValidation, type SearchRevealOptions, type SearchSnippet, type SearchState, type SearchStatus, SearchToken, validateSearchQuery, validateSearchRegex };
1
+ import { A as SearchToken, C as SearchSettings, D as TextSegment, E as SearchStatus, O as validateSearchQuery, S as SearchRevealOptions, T as SearchStartedEvent, _ as SearchQueryIssue, a as SearchCapability, b as SearchResult, c as SearchConfig, d as SearchHit, f as SearchHitFilter, g as SearchQuery, h as SearchProgressChangedEvent, i as SearchCancelledEvent, k as validateSearchRegex, l as SearchFailedEvent, m as SearchProgress, n as SearchActiveHitChangedEvent, o as SearchClearedEvent, p as SearchOptions, r as SearchBlendMode, s as SearchCompletedEvent, t as SEARCH_DEFAULTS, u as SearchFindAllOptions, v as SearchQueryValidation, w as SearchSnippet, x as SearchReveal, y as SearchRegexValidation } from "./contract-DqeptOSn.cjs";
2
+ export { SEARCH_DEFAULTS, SearchActiveHitChangedEvent, SearchBlendMode, SearchCancelledEvent, SearchCapability, SearchClearedEvent, SearchCompletedEvent, SearchConfig, SearchFailedEvent, SearchFindAllOptions, SearchHit, SearchHitFilter, SearchOptions, SearchProgress, SearchProgressChangedEvent, type SearchQuery, type SearchQueryIssue, type SearchQueryValidation, type SearchRegexValidation, SearchResult, SearchReveal, SearchRevealOptions, SearchSettings, type SearchSnippet, SearchStartedEvent, SearchStatus, SearchToken, TextSegment, validateSearchQuery, validateSearchRegex };
@@ -1,2 +1,2 @@
1
- import { _ as SearchToken, a as SearchSnippet, d as SearchFindAllOptions, f as SearchHit, g as SearchStatus, h as SearchState, i as SearchRegexValidation, l as SearchCapability, m as SearchRevealOptions, n as SearchQueryIssue, o as validateSearchQuery, p as SearchPluginConfig, r as SearchQueryValidation, s as validateSearchRegex, t as SearchQuery, u as SearchExecOptions } from "./contract-Cj4xgdMj.js";
2
- export { type SearchCapability, type SearchExecOptions, type SearchFindAllOptions, type SearchHit, type SearchPluginConfig, type SearchQuery, type SearchQueryIssue, type SearchQueryValidation, type SearchRegexValidation, type SearchRevealOptions, type SearchSnippet, type SearchState, type SearchStatus, SearchToken, validateSearchQuery, validateSearchRegex };
1
+ import { A as SearchToken, C as SearchSettings, D as TextSegment, E as SearchStatus, O as validateSearchQuery, S as SearchRevealOptions, T as SearchStartedEvent, _ as SearchQueryIssue, a as SearchCapability, b as SearchResult, c as SearchConfig, d as SearchHit, f as SearchHitFilter, g as SearchQuery, h as SearchProgressChangedEvent, i as SearchCancelledEvent, k as validateSearchRegex, l as SearchFailedEvent, m as SearchProgress, n as SearchActiveHitChangedEvent, o as SearchClearedEvent, p as SearchOptions, r as SearchBlendMode, s as SearchCompletedEvent, t as SEARCH_DEFAULTS, u as SearchFindAllOptions, v as SearchQueryValidation, w as SearchSnippet, x as SearchReveal, y as SearchRegexValidation } from "./contract-B7maCczh.js";
2
+ export { SEARCH_DEFAULTS, SearchActiveHitChangedEvent, SearchBlendMode, SearchCancelledEvent, SearchCapability, SearchClearedEvent, SearchCompletedEvent, SearchConfig, SearchFailedEvent, SearchFindAllOptions, SearchHit, SearchHitFilter, SearchOptions, SearchProgress, SearchProgressChangedEvent, type SearchQuery, type SearchQueryIssue, type SearchQueryValidation, type SearchRegexValidation, SearchResult, SearchReveal, SearchRevealOptions, SearchSettings, type SearchSnippet, SearchStartedEvent, SearchStatus, SearchToken, TextSegment, validateSearchQuery, validateSearchRegex };
package/dist/contract.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as validateSearchRegex, r as SearchToken, t as validateSearchQuery } from "./contract-YzH14CUn.js";
2
- export { SearchToken, validateSearchQuery, validateSearchRegex };
1
+ import { i as SearchToken, n as validateSearchQuery, r as validateSearchRegex, t as SEARCH_DEFAULTS } from "./contract-uWSW5IYM.js";
2
+ export { SEARCH_DEFAULTS, SearchToken, validateSearchQuery, validateSearchRegex };