@embedpdf/plugin-search 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 CloudPDF
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1,310 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ SEARCH_PLUGIN_ID: () => SEARCH_PLUGIN_ID,
24
+ SearchPlugin: () => SearchPlugin,
25
+ SearchPluginPackage: () => SearchPluginPackage,
26
+ initialState: () => initialState,
27
+ manifest: () => manifest
28
+ });
29
+ module.exports = __toCommonJS(index_exports);
30
+
31
+ // src/lib/search-plugin.ts
32
+ var import_core = require("@embedpdf/core");
33
+
34
+ // src/lib/actions.ts
35
+ var START_SEARCH_SESSION = "START_SEARCH_SESSION";
36
+ var STOP_SEARCH_SESSION = "STOP_SEARCH_SESSION";
37
+ var SET_SEARCH_FLAGS = "SET_SEARCH_FLAGS";
38
+ var SET_SHOW_ALL_RESULTS = "SET_SHOW_ALL_RESULTS";
39
+ var START_SEARCH = "START_SEARCH";
40
+ var SET_SEARCH_RESULTS = "SET_SEARCH_RESULTS";
41
+ var SET_ACTIVE_RESULT_INDEX = "SET_ACTIVE_RESULT_INDEX";
42
+ function startSearchSession() {
43
+ return { type: START_SEARCH_SESSION };
44
+ }
45
+ function stopSearchSession() {
46
+ return { type: STOP_SEARCH_SESSION };
47
+ }
48
+ function setSearchFlags(flags) {
49
+ return { type: SET_SEARCH_FLAGS, payload: flags };
50
+ }
51
+ function setShowAllResults(showAll) {
52
+ return { type: SET_SHOW_ALL_RESULTS, payload: showAll };
53
+ }
54
+ function startSearch(query) {
55
+ return { type: START_SEARCH, payload: query };
56
+ }
57
+ function setSearchResults(results, total, activeResultIndex) {
58
+ return { type: SET_SEARCH_RESULTS, payload: { results, total, activeResultIndex } };
59
+ }
60
+ function setActiveResultIndex(index) {
61
+ return { type: SET_ACTIVE_RESULT_INDEX, payload: index };
62
+ }
63
+
64
+ // src/lib/search-plugin.ts
65
+ var SearchPlugin = class extends import_core.BasePlugin {
66
+ constructor(id, registry, engine) {
67
+ super(id, registry);
68
+ this.searchStop$ = (0, import_core.createBehaviorEmitter)();
69
+ this.searchStart$ = (0, import_core.createBehaviorEmitter)();
70
+ this.searchResult$ = (0, import_core.createBehaviorEmitter)();
71
+ this.searchActiveResultChange$ = (0, import_core.createBehaviorEmitter)();
72
+ this.searchResultState$ = (0, import_core.createBehaviorEmitter)();
73
+ this.engine = engine;
74
+ this.loader = this.registry.getPlugin("loader").provides();
75
+ this.loader.onDocumentLoaded(this.handleDocumentLoaded.bind(this));
76
+ this.loader.onLoaderEvent(this.handleLoaderEvent.bind(this));
77
+ }
78
+ handleDocumentLoaded(doc) {
79
+ this.currentDocument = doc;
80
+ if (this.getState().active) {
81
+ this.startSearchSession();
82
+ }
83
+ }
84
+ handleLoaderEvent(event) {
85
+ if (event.type === "error" || event.type === "start" && this.currentDocument) {
86
+ if (this.getState().active) {
87
+ this.stopSearchSession();
88
+ }
89
+ this.currentDocument = void 0;
90
+ }
91
+ }
92
+ async initialize(config) {
93
+ this.dispatch(setSearchFlags(config.flags || []));
94
+ this.dispatch(
95
+ setShowAllResults(config.showAllResults !== void 0 ? config.showAllResults : true)
96
+ );
97
+ }
98
+ onStoreUpdated(_prevState, newState) {
99
+ this.searchResultState$.emit({
100
+ results: newState.results,
101
+ activeResultIndex: newState.activeResultIndex,
102
+ showAllResults: newState.showAllResults,
103
+ active: newState.active
104
+ });
105
+ }
106
+ buildCapability() {
107
+ return {
108
+ startSearch: this.startSearchSession.bind(this),
109
+ stopSearch: this.stopSearchSession.bind(this),
110
+ searchAllPages: this.searchAllPages.bind(this),
111
+ nextResult: this.nextResult.bind(this),
112
+ previousResult: this.previousResult.bind(this),
113
+ goToResult: this.goToResult.bind(this),
114
+ setShowAllResults: (showAll) => this.dispatch(setShowAllResults(showAll)),
115
+ getShowAllResults: () => this.getState().showAllResults,
116
+ onSearchResult: this.searchResult$.on,
117
+ onSearchStart: this.searchStart$.on,
118
+ onSearchStop: this.searchStop$.on,
119
+ onActiveResultChange: this.searchActiveResultChange$.on,
120
+ onSearchResultStateChange: this.searchResultState$.on,
121
+ onStateChange: (handler) => {
122
+ const unsubscribe = this.subscribe((_, state) => handler(state));
123
+ return unsubscribe;
124
+ },
125
+ getFlags: () => this.getState().flags,
126
+ setFlags: (flags) => this.setFlags(flags)
127
+ };
128
+ }
129
+ setFlags(flags) {
130
+ const state = this.getState();
131
+ this.dispatch(setSearchFlags(flags));
132
+ if (state.active) {
133
+ this.searchAllPages(state.query, true);
134
+ }
135
+ }
136
+ notifySearchStart() {
137
+ this.searchStart$.emit();
138
+ }
139
+ notifySearchStop() {
140
+ this.searchStop$.emit();
141
+ }
142
+ notifyActiveResultChange(index) {
143
+ this.searchActiveResultChange$.emit(index);
144
+ }
145
+ startSearchSession() {
146
+ if (!this.currentDocument) {
147
+ return;
148
+ }
149
+ this.dispatch(startSearchSession());
150
+ this.notifySearchStart();
151
+ }
152
+ stopSearchSession() {
153
+ if (!this.currentDocument || !this.getState().active) {
154
+ return;
155
+ }
156
+ this.dispatch(stopSearchSession());
157
+ this.notifySearchStop();
158
+ }
159
+ async searchAllPages(keyword, force = false) {
160
+ const trimmedKeyword = keyword.trim();
161
+ const state = this.getState();
162
+ if (state.query === trimmedKeyword && !force) {
163
+ return { results: state.results, total: state.total };
164
+ }
165
+ this.dispatch(startSearch(trimmedKeyword));
166
+ if (!trimmedKeyword) {
167
+ this.dispatch(setSearchResults([], 0, -1));
168
+ return { results: [], total: 0 };
169
+ }
170
+ if (!this.currentDocument) {
171
+ this.dispatch(setSearchResults([], 0, -1));
172
+ return { results: [], total: 0 };
173
+ }
174
+ if (!state.active) {
175
+ this.startSearchSession();
176
+ }
177
+ return new Promise((resolve) => {
178
+ this.engine.searchAllPages(this.currentDocument, trimmedKeyword, state.flags).wait(
179
+ (results) => {
180
+ const activeResultIndex = results.total > 0 ? 0 : -1;
181
+ this.dispatch(setSearchResults(results.results, results.total, activeResultIndex));
182
+ this.searchResult$.emit(results);
183
+ if (results.total > 0) {
184
+ this.notifyActiveResultChange(0);
185
+ }
186
+ resolve(results);
187
+ },
188
+ (error) => {
189
+ console.error("Error during search:", error);
190
+ this.dispatch(setSearchResults([], 0, -1));
191
+ resolve({ results: [], total: 0 });
192
+ }
193
+ );
194
+ });
195
+ }
196
+ nextResult() {
197
+ const state = this.getState();
198
+ if (state.results.length === 0) {
199
+ return -1;
200
+ }
201
+ const nextIndex = state.activeResultIndex >= state.results.length - 1 ? 0 : state.activeResultIndex + 1;
202
+ return this.goToResult(nextIndex);
203
+ }
204
+ previousResult() {
205
+ const state = this.getState();
206
+ if (state.results.length === 0) {
207
+ return -1;
208
+ }
209
+ const prevIndex = state.activeResultIndex <= 0 ? state.results.length - 1 : state.activeResultIndex - 1;
210
+ return this.goToResult(prevIndex);
211
+ }
212
+ goToResult(index) {
213
+ const state = this.getState();
214
+ if (state.results.length === 0 || index < 0 || index >= state.results.length) {
215
+ return -1;
216
+ }
217
+ this.dispatch(setActiveResultIndex(index));
218
+ this.notifyActiveResultChange(index);
219
+ return index;
220
+ }
221
+ async destroy() {
222
+ if (this.getState().active && this.currentDocument) {
223
+ this.stopSearchSession();
224
+ }
225
+ this.searchResult$.clear();
226
+ this.searchStart$.clear();
227
+ this.searchStop$.clear();
228
+ this.searchActiveResultChange$.clear();
229
+ this.searchResultState$.clear();
230
+ }
231
+ };
232
+ SearchPlugin.id = "search";
233
+
234
+ // src/lib/manifest.ts
235
+ var SEARCH_PLUGIN_ID = "search";
236
+ var manifest = {
237
+ id: SEARCH_PLUGIN_ID,
238
+ name: "Search Plugin",
239
+ version: "1.0.0",
240
+ provides: ["search"],
241
+ requires: ["loader"],
242
+ optional: [],
243
+ defaultConfig: {
244
+ enabled: true,
245
+ flags: []
246
+ }
247
+ };
248
+
249
+ // src/lib/reducer.ts
250
+ var initialState = {
251
+ flags: [],
252
+ results: [],
253
+ total: 0,
254
+ activeResultIndex: -1,
255
+ showAllResults: true,
256
+ query: "",
257
+ loading: false,
258
+ active: false
259
+ };
260
+ var searchReducer = (state = initialState, action) => {
261
+ switch (action.type) {
262
+ case START_SEARCH_SESSION:
263
+ return { ...state, active: true };
264
+ case STOP_SEARCH_SESSION:
265
+ return {
266
+ ...state,
267
+ results: [],
268
+ total: 0,
269
+ activeResultIndex: -1,
270
+ query: "",
271
+ loading: false,
272
+ active: false
273
+ };
274
+ case SET_SEARCH_FLAGS:
275
+ return { ...state, flags: action.payload };
276
+ case SET_SHOW_ALL_RESULTS:
277
+ return { ...state, showAllResults: action.payload };
278
+ case START_SEARCH:
279
+ return { ...state, loading: true, query: action.payload };
280
+ case SET_SEARCH_RESULTS:
281
+ return {
282
+ ...state,
283
+ results: action.payload.results,
284
+ total: action.payload.total,
285
+ activeResultIndex: action.payload.activeResultIndex,
286
+ loading: false
287
+ };
288
+ case SET_ACTIVE_RESULT_INDEX:
289
+ return { ...state, activeResultIndex: action.payload };
290
+ default:
291
+ return state;
292
+ }
293
+ };
294
+
295
+ // src/lib/index.ts
296
+ var SearchPluginPackage = {
297
+ manifest,
298
+ create: (registry, engine) => new SearchPlugin(SEARCH_PLUGIN_ID, registry, engine),
299
+ reducer: searchReducer,
300
+ initialState
301
+ };
302
+ // Annotate the CommonJS export names for ESM import in node:
303
+ 0 && (module.exports = {
304
+ SEARCH_PLUGIN_ID,
305
+ SearchPlugin,
306
+ SearchPluginPackage,
307
+ initialState,
308
+ manifest
309
+ });
310
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/lib/search-plugin.ts","../src/lib/actions.ts","../src/lib/manifest.ts","../src/lib/reducer.ts","../src/lib/index.ts"],"sourcesContent":["export * from './lib';\n","import { BasePlugin, createBehaviorEmitter, PluginRegistry } from '@embedpdf/core';\nimport {\n MatchFlag,\n PdfDocumentObject,\n SearchAllPagesResult,\n TaskError,\n PdfEngine,\n} from '@embedpdf/models';\nimport { SearchPluginConfig, SearchCapability, SearchState, SearchResultState } from './types';\nimport { LoaderCapability, LoaderEvent, LoaderPlugin } from '@embedpdf/plugin-loader';\nimport {\n startSearchSession,\n stopSearchSession,\n setSearchFlags,\n setShowAllResults,\n startSearch,\n setSearchResults,\n setActiveResultIndex,\n SearchAction,\n} from './actions';\n\nexport class SearchPlugin extends BasePlugin<\n SearchPluginConfig,\n SearchCapability,\n SearchState,\n SearchAction\n> {\n static readonly id = 'search' as const;\n private loader: LoaderCapability;\n private currentDocument?: PdfDocumentObject;\n private engine: PdfEngine;\n\n private readonly searchStop$ = createBehaviorEmitter();\n private readonly searchStart$ = createBehaviorEmitter();\n private readonly searchResult$ = createBehaviorEmitter<SearchAllPagesResult>();\n private readonly searchActiveResultChange$ = createBehaviorEmitter<number>();\n private readonly searchResultState$ = createBehaviorEmitter<SearchResultState>();\n\n constructor(id: string, registry: PluginRegistry, engine: PdfEngine) {\n super(id, registry);\n this.engine = engine;\n this.loader = this.registry.getPlugin<LoaderPlugin>('loader')!.provides();\n\n this.loader.onDocumentLoaded(this.handleDocumentLoaded.bind(this));\n this.loader.onLoaderEvent(this.handleLoaderEvent.bind(this));\n }\n\n private handleDocumentLoaded(doc: PdfDocumentObject): void {\n this.currentDocument = doc;\n if (this.getState().active) {\n this.startSearchSession();\n }\n }\n\n private handleLoaderEvent(event: LoaderEvent): void {\n if (event.type === 'error' || (event.type === 'start' && this.currentDocument)) {\n if (this.getState().active) {\n this.stopSearchSession();\n }\n this.currentDocument = undefined;\n }\n }\n\n async initialize(config: SearchPluginConfig): Promise<void> {\n this.dispatch(setSearchFlags(config.flags || []));\n this.dispatch(\n setShowAllResults(config.showAllResults !== undefined ? config.showAllResults : true),\n );\n }\n\n override onStoreUpdated(_prevState: SearchState, newState: SearchState): void {\n this.searchResultState$.emit({\n results: newState.results,\n activeResultIndex: newState.activeResultIndex,\n showAllResults: newState.showAllResults,\n active: newState.active,\n });\n }\n\n protected buildCapability(): SearchCapability {\n return {\n startSearch: this.startSearchSession.bind(this),\n stopSearch: this.stopSearchSession.bind(this),\n searchAllPages: this.searchAllPages.bind(this),\n nextResult: this.nextResult.bind(this),\n previousResult: this.previousResult.bind(this),\n goToResult: this.goToResult.bind(this),\n setShowAllResults: (showAll) => this.dispatch(setShowAllResults(showAll)),\n getShowAllResults: () => this.getState().showAllResults,\n onSearchResult: this.searchResult$.on,\n onSearchStart: this.searchStart$.on,\n onSearchStop: this.searchStop$.on,\n onActiveResultChange: this.searchActiveResultChange$.on,\n onSearchResultStateChange: this.searchResultState$.on,\n onStateChange: (handler) => {\n const unsubscribe = this.subscribe((_, state) => handler(state));\n return unsubscribe;\n },\n getFlags: () => this.getState().flags,\n setFlags: (flags) => this.setFlags(flags),\n };\n }\n\n private setFlags(flags: MatchFlag[]): void {\n const state = this.getState();\n this.dispatch(setSearchFlags(flags));\n if (state.active) {\n this.searchAllPages(state.query, true);\n }\n }\n\n private notifySearchStart(): void {\n this.searchStart$.emit();\n }\n\n private notifySearchStop(): void {\n this.searchStop$.emit();\n }\n\n private notifyActiveResultChange(index: number): void {\n this.searchActiveResultChange$.emit(index);\n }\n\n private startSearchSession(): void {\n if (!this.currentDocument) {\n return;\n }\n this.dispatch(startSearchSession());\n this.notifySearchStart();\n }\n\n private stopSearchSession(): void {\n if (!this.currentDocument || !this.getState().active) {\n return;\n }\n this.dispatch(stopSearchSession());\n this.notifySearchStop();\n }\n\n private async searchAllPages(\n keyword: string,\n force: boolean = false,\n ): Promise<SearchAllPagesResult> {\n const trimmedKeyword = keyword.trim();\n const state = this.getState();\n\n if (state.query === trimmedKeyword && !force) {\n return { results: state.results, total: state.total };\n }\n\n this.dispatch(startSearch(trimmedKeyword));\n\n if (!trimmedKeyword) {\n this.dispatch(setSearchResults([], 0, -1));\n return { results: [], total: 0 };\n }\n if (!this.currentDocument) {\n this.dispatch(setSearchResults([], 0, -1));\n return { results: [], total: 0 };\n }\n\n if (!state.active) {\n this.startSearchSession();\n }\n\n return new Promise<SearchAllPagesResult>((resolve) => {\n this.engine.searchAllPages(this.currentDocument!, trimmedKeyword, state.flags).wait(\n (results) => {\n const activeResultIndex = results.total > 0 ? 0 : -1;\n this.dispatch(setSearchResults(results.results, results.total, activeResultIndex));\n this.searchResult$.emit(results);\n if (results.total > 0) {\n this.notifyActiveResultChange(0);\n }\n resolve(results);\n },\n (error: TaskError<any>) => {\n console.error('Error during search:', error);\n this.dispatch(setSearchResults([], 0, -1));\n resolve({ results: [], total: 0 });\n },\n );\n });\n }\n\n private nextResult(): number {\n const state = this.getState();\n if (state.results.length === 0) {\n return -1;\n }\n const nextIndex =\n state.activeResultIndex >= state.results.length - 1 ? 0 : state.activeResultIndex + 1;\n return this.goToResult(nextIndex);\n }\n\n private previousResult(): number {\n const state = this.getState();\n if (state.results.length === 0) {\n return -1;\n }\n const prevIndex =\n state.activeResultIndex <= 0 ? state.results.length - 1 : state.activeResultIndex - 1;\n return this.goToResult(prevIndex);\n }\n\n private goToResult(index: number): number {\n const state = this.getState();\n if (state.results.length === 0 || index < 0 || index >= state.results.length) {\n return -1;\n }\n this.dispatch(setActiveResultIndex(index));\n this.notifyActiveResultChange(index);\n return index;\n }\n\n async destroy(): Promise<void> {\n if (this.getState().active && this.currentDocument) {\n this.stopSearchSession();\n }\n this.searchResult$.clear();\n this.searchStart$.clear();\n this.searchStop$.clear();\n this.searchActiveResultChange$.clear();\n this.searchResultState$.clear();\n }\n}\n","import { Action } from '@embedpdf/core';\nimport { MatchFlag, SearchResult } from '@embedpdf/models';\n\n// Action Types\nexport const START_SEARCH_SESSION = 'START_SEARCH_SESSION';\nexport const STOP_SEARCH_SESSION = 'STOP_SEARCH_SESSION';\nexport const SET_SEARCH_FLAGS = 'SET_SEARCH_FLAGS';\nexport const SET_SHOW_ALL_RESULTS = 'SET_SHOW_ALL_RESULTS';\nexport const START_SEARCH = 'START_SEARCH';\nexport const SET_SEARCH_RESULTS = 'SET_SEARCH_RESULTS';\nexport const SET_ACTIVE_RESULT_INDEX = 'SET_ACTIVE_RESULT_INDEX';\n\n// Action Interfaces\nexport interface StartSearchSessionAction extends Action {\n type: typeof START_SEARCH_SESSION;\n}\n\nexport interface StopSearchSessionAction extends Action {\n type: typeof STOP_SEARCH_SESSION;\n}\n\nexport interface SetSearchFlagsAction extends Action {\n type: typeof SET_SEARCH_FLAGS;\n payload: MatchFlag[];\n}\n\nexport interface SetShowAllResultsAction extends Action {\n type: typeof SET_SHOW_ALL_RESULTS;\n payload: boolean;\n}\n\nexport interface StartSearchAction extends Action {\n type: typeof START_SEARCH;\n payload: string;\n}\n\nexport interface SetSearchResultsAction extends Action {\n type: typeof SET_SEARCH_RESULTS;\n payload: {\n results: SearchResult[];\n total: number;\n activeResultIndex: number;\n };\n}\n\nexport interface SetActiveResultIndexAction extends Action {\n type: typeof SET_ACTIVE_RESULT_INDEX;\n payload: number;\n}\n\n// Union Type for All Actions\nexport type SearchAction =\n | StartSearchSessionAction\n | StopSearchSessionAction\n | SetSearchFlagsAction\n | SetShowAllResultsAction\n | StartSearchAction\n | SetSearchResultsAction\n | SetActiveResultIndexAction;\n\n// Action Creators\nexport function startSearchSession(): StartSearchSessionAction {\n return { type: START_SEARCH_SESSION };\n}\n\nexport function stopSearchSession(): StopSearchSessionAction {\n return { type: STOP_SEARCH_SESSION };\n}\n\nexport function setSearchFlags(flags: MatchFlag[]): SetSearchFlagsAction {\n return { type: SET_SEARCH_FLAGS, payload: flags };\n}\n\nexport function setShowAllResults(showAll: boolean): SetShowAllResultsAction {\n return { type: SET_SHOW_ALL_RESULTS, payload: showAll };\n}\n\nexport function startSearch(query: string): StartSearchAction {\n return { type: START_SEARCH, payload: query };\n}\n\nexport function setSearchResults(\n results: SearchResult[],\n total: number,\n activeResultIndex: number,\n): SetSearchResultsAction {\n return { type: SET_SEARCH_RESULTS, payload: { results, total, activeResultIndex } };\n}\n\nexport function setActiveResultIndex(index: number): SetActiveResultIndexAction {\n return { type: SET_ACTIVE_RESULT_INDEX, payload: index };\n}\n","import { PluginManifest } from '@embedpdf/core';\nimport { SearchPluginConfig } from './types';\n\nexport const SEARCH_PLUGIN_ID = 'search';\n\nexport const manifest: PluginManifest<SearchPluginConfig> = {\n id: SEARCH_PLUGIN_ID,\n name: 'Search Plugin',\n version: '1.0.0',\n provides: ['search'],\n requires: ['loader'],\n optional: [],\n defaultConfig: {\n enabled: true,\n flags: [],\n },\n};\n","import { Reducer } from '@embedpdf/core';\nimport { SearchState } from './types';\nimport {\n START_SEARCH_SESSION,\n STOP_SEARCH_SESSION,\n SET_SEARCH_FLAGS,\n SET_SHOW_ALL_RESULTS,\n START_SEARCH,\n SET_SEARCH_RESULTS,\n SET_ACTIVE_RESULT_INDEX,\n SearchAction,\n} from './actions';\n\nexport const initialState: SearchState = {\n flags: [],\n results: [],\n total: 0,\n activeResultIndex: -1,\n showAllResults: true,\n query: '',\n loading: false,\n active: false,\n};\n\nexport const searchReducer: Reducer<SearchState, SearchAction> = (state = initialState, action) => {\n switch (action.type) {\n case START_SEARCH_SESSION:\n return { ...state, active: true };\n\n case STOP_SEARCH_SESSION:\n return {\n ...state,\n results: [],\n total: 0,\n activeResultIndex: -1,\n query: '',\n loading: false,\n active: false,\n };\n\n case SET_SEARCH_FLAGS:\n return { ...state, flags: action.payload };\n\n case SET_SHOW_ALL_RESULTS:\n return { ...state, showAllResults: action.payload };\n\n case START_SEARCH:\n return { ...state, loading: true, query: action.payload };\n\n case SET_SEARCH_RESULTS:\n return {\n ...state,\n results: action.payload.results,\n total: action.payload.total,\n activeResultIndex: action.payload.activeResultIndex,\n loading: false,\n };\n\n case SET_ACTIVE_RESULT_INDEX:\n return { ...state, activeResultIndex: action.payload };\n\n default:\n return state;\n }\n};\n","import { PluginPackage } from '@embedpdf/core';\nimport { SearchPlugin } from './search-plugin';\nimport { manifest, SEARCH_PLUGIN_ID } from './manifest';\nimport { SearchPluginConfig, SearchState } from './types';\nimport { searchReducer, initialState } from './reducer';\nimport { SearchAction } from './actions';\n\nexport const SearchPluginPackage: PluginPackage<\n SearchPlugin,\n SearchPluginConfig,\n SearchState,\n SearchAction\n> = {\n manifest,\n create: (registry, engine) => new SearchPlugin(SEARCH_PLUGIN_ID, registry, engine),\n reducer: searchReducer,\n initialState,\n};\n\nexport * from './search-plugin';\nexport * from './types';\nexport * from './manifest';\nexport { initialState };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAkE;;;ACI3D,IAAM,uBAAuB;AAC7B,IAAM,sBAAsB;AAC5B,IAAM,mBAAmB;AACzB,IAAM,uBAAuB;AAC7B,IAAM,eAAe;AACrB,IAAM,qBAAqB;AAC3B,IAAM,0BAA0B;AAmDhC,SAAS,qBAA+C;AAC7D,SAAO,EAAE,MAAM,qBAAqB;AACtC;AAEO,SAAS,oBAA6C;AAC3D,SAAO,EAAE,MAAM,oBAAoB;AACrC;AAEO,SAAS,eAAe,OAA0C;AACvE,SAAO,EAAE,MAAM,kBAAkB,SAAS,MAAM;AAClD;AAEO,SAAS,kBAAkB,SAA2C;AAC3E,SAAO,EAAE,MAAM,sBAAsB,SAAS,QAAQ;AACxD;AAEO,SAAS,YAAY,OAAkC;AAC5D,SAAO,EAAE,MAAM,cAAc,SAAS,MAAM;AAC9C;AAEO,SAAS,iBACd,SACA,OACA,mBACwB;AACxB,SAAO,EAAE,MAAM,oBAAoB,SAAS,EAAE,SAAS,OAAO,kBAAkB,EAAE;AACpF;AAEO,SAAS,qBAAqB,OAA2C;AAC9E,SAAO,EAAE,MAAM,yBAAyB,SAAS,MAAM;AACzD;;;ADtEO,IAAM,eAAN,cAA2B,uBAKhC;AAAA,EAYA,YAAY,IAAY,UAA0B,QAAmB;AACnE,UAAM,IAAI,QAAQ;AAPpB,SAAiB,kBAAc,mCAAsB;AACrD,SAAiB,mBAAe,mCAAsB;AACtD,SAAiB,oBAAgB,mCAA4C;AAC7E,SAAiB,gCAA4B,mCAA8B;AAC3E,SAAiB,yBAAqB,mCAAyC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,EACV,OAAO;AAAA,EACP,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ;AACV;AAEO,IAAM,gBAAoD,CAAC,QAAQ,cAAc,WAAW;AACjG,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,QAAQ,KAAK;AAAA,IAElC,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,SAAS,CAAC;AAAA,QACV,OAAO;AAAA,QACP,mBAAmB;AAAA,QACnB,OAAO;AAAA,QACP,SAAS;AAAA,QACT,QAAQ;AAAA,MACV;AAAA,IAEF,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,OAAO,OAAO,QAAQ;AAAA,IAE3C,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,gBAAgB,OAAO,QAAQ;AAAA,IAEpD,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,SAAS,MAAM,OAAO,OAAO,QAAQ;AAAA,IAE1D,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,SAAS,OAAO,QAAQ;AAAA,QACxB,OAAO,OAAO,QAAQ;AAAA,QACtB,mBAAmB,OAAO,QAAQ;AAAA,QAClC,SAAS;AAAA,MACX;AAAA,IAEF,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,mBAAmB,OAAO,QAAQ;AAAA,IAEvD;AACE,aAAO;AAAA,EACX;AACF;;;ACzDO,IAAM,sBAKT;AAAA,EACF;AAAA,EACA,QAAQ,CAAC,UAAU,WAAW,IAAI,aAAa,kBAAkB,UAAU,MAAM;AAAA,EACjF,SAAS;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,225 @@
1
+ import { BasePluginConfig, EventHook, Action, BasePlugin, PluginRegistry, PluginManifest, PluginPackage } from '@embedpdf/core';
2
+ import { MatchFlag, SearchAllPagesResult, SearchResult, PdfEngine } from '@embedpdf/models';
3
+
4
+ interface SearchPluginConfig extends BasePluginConfig {
5
+ flags?: MatchFlag[];
6
+ /**
7
+ * Whether to show all search results or only the active one
8
+ * @default true
9
+ */
10
+ showAllResults?: boolean;
11
+ }
12
+ interface SearchResultState {
13
+ /**
14
+ * Current search results from last search operation
15
+ */
16
+ results: SearchResult[];
17
+ /**
18
+ * Current active result index (0-based)
19
+ */
20
+ activeResultIndex: number;
21
+ /**
22
+ * Whether to show all search results or only the active one
23
+ */
24
+ showAllResults: boolean;
25
+ /**
26
+ * Whether search is currently active
27
+ */
28
+ active: boolean;
29
+ }
30
+ interface SearchState {
31
+ flags: MatchFlag[];
32
+ /**
33
+ * Current search results from last search operation
34
+ */
35
+ results: SearchResult[];
36
+ /**
37
+ * Total number of search results
38
+ */
39
+ total: number;
40
+ /**
41
+ * Current active result index (0-based)
42
+ */
43
+ activeResultIndex: number;
44
+ /**
45
+ * Whether to show all search results or only the active one
46
+ */
47
+ showAllResults: boolean;
48
+ /**
49
+ * Current search query
50
+ */
51
+ query: string;
52
+ /**
53
+ * Whether a search operation is in progress
54
+ */
55
+ loading: boolean;
56
+ /**
57
+ * Whether search is currently active
58
+ */
59
+ active: boolean;
60
+ }
61
+ interface SearchCapability {
62
+ /**
63
+ * Start a search session
64
+ */
65
+ startSearch: () => void;
66
+ /**
67
+ * Stop the active search session
68
+ */
69
+ stopSearch: () => void;
70
+ /**
71
+ * Search for all occurrences of the keyword throughout the document
72
+ * @param keyword - Text to search for
73
+ * @returns Promise that resolves to all search results or empty result if none found
74
+ */
75
+ searchAllPages: (keyword: string) => Promise<SearchAllPagesResult>;
76
+ /**
77
+ * Navigate to the next search result
78
+ * @returns The new active result index
79
+ */
80
+ nextResult: () => number;
81
+ /**
82
+ * Navigate to the previous search result
83
+ * @returns The new active result index
84
+ */
85
+ previousResult: () => number;
86
+ /**
87
+ * Go to a specific search result by index
88
+ * @param index - The index of the result to go to
89
+ * @returns The new active result index
90
+ */
91
+ goToResult: (index: number) => number;
92
+ /**
93
+ * Toggle visibility of all search results
94
+ * @param showAll - Whether to show all results or only the active one
95
+ */
96
+ setShowAllResults: (showAll: boolean) => void;
97
+ /**
98
+ * Get current state of search results visibility
99
+ * @returns Whether all results are visible
100
+ */
101
+ getShowAllResults: () => boolean;
102
+ /**
103
+ * Subscribe to search results
104
+ * @param handler - Handler function to receive search results
105
+ * @returns Function to unsubscribe the handler
106
+ */
107
+ onSearchResult: EventHook<SearchAllPagesResult>;
108
+ /**
109
+ * Subscribe to search session start events
110
+ * @param handler - Handler function called when search session starts
111
+ * @returns Function to unsubscribe the handler
112
+ */
113
+ onSearchStart: EventHook;
114
+ /**
115
+ * Subscribe to search session stop events
116
+ * @param handler - Handler function called when search session stops
117
+ * @returns Function to unsubscribe the handler
118
+ */
119
+ onSearchStop: EventHook;
120
+ /**
121
+ * Subscribe to active result change events
122
+ * @param handler - Handler function called when active result changes
123
+ * @returns Function to unsubscribe the handler
124
+ */
125
+ onActiveResultChange: EventHook<number>;
126
+ /**
127
+ * Subscribe to search result state change events
128
+ * @param handler - Handler function called when search state changes
129
+ * @returns Function to unsubscribe the handler
130
+ */
131
+ onSearchResultStateChange: EventHook<SearchResultState>;
132
+ /**
133
+ * Get the current search flags
134
+ * @returns Array of active search flags
135
+ */
136
+ getFlags: () => MatchFlag[];
137
+ /**
138
+ * Set the search flags
139
+ * @param flags - Array of search flags to use
140
+ */
141
+ setFlags: (flags: MatchFlag[]) => void;
142
+ /**
143
+ * Subscribe to state change events
144
+ * @param handler - Handler function called when state changes
145
+ * @returns Function to unsubscribe the handler
146
+ */
147
+ onStateChange: (handler: (state: SearchState) => void) => () => void;
148
+ }
149
+
150
+ declare const START_SEARCH_SESSION = "START_SEARCH_SESSION";
151
+ declare const STOP_SEARCH_SESSION = "STOP_SEARCH_SESSION";
152
+ declare const SET_SEARCH_FLAGS = "SET_SEARCH_FLAGS";
153
+ declare const SET_SHOW_ALL_RESULTS = "SET_SHOW_ALL_RESULTS";
154
+ declare const START_SEARCH = "START_SEARCH";
155
+ declare const SET_SEARCH_RESULTS = "SET_SEARCH_RESULTS";
156
+ declare const SET_ACTIVE_RESULT_INDEX = "SET_ACTIVE_RESULT_INDEX";
157
+ interface StartSearchSessionAction extends Action {
158
+ type: typeof START_SEARCH_SESSION;
159
+ }
160
+ interface StopSearchSessionAction extends Action {
161
+ type: typeof STOP_SEARCH_SESSION;
162
+ }
163
+ interface SetSearchFlagsAction extends Action {
164
+ type: typeof SET_SEARCH_FLAGS;
165
+ payload: MatchFlag[];
166
+ }
167
+ interface SetShowAllResultsAction extends Action {
168
+ type: typeof SET_SHOW_ALL_RESULTS;
169
+ payload: boolean;
170
+ }
171
+ interface StartSearchAction extends Action {
172
+ type: typeof START_SEARCH;
173
+ payload: string;
174
+ }
175
+ interface SetSearchResultsAction extends Action {
176
+ type: typeof SET_SEARCH_RESULTS;
177
+ payload: {
178
+ results: SearchResult[];
179
+ total: number;
180
+ activeResultIndex: number;
181
+ };
182
+ }
183
+ interface SetActiveResultIndexAction extends Action {
184
+ type: typeof SET_ACTIVE_RESULT_INDEX;
185
+ payload: number;
186
+ }
187
+ type SearchAction = StartSearchSessionAction | StopSearchSessionAction | SetSearchFlagsAction | SetShowAllResultsAction | StartSearchAction | SetSearchResultsAction | SetActiveResultIndexAction;
188
+
189
+ declare class SearchPlugin extends BasePlugin<SearchPluginConfig, SearchCapability, SearchState, SearchAction> {
190
+ static readonly id: "search";
191
+ private loader;
192
+ private currentDocument?;
193
+ private engine;
194
+ private readonly searchStop$;
195
+ private readonly searchStart$;
196
+ private readonly searchResult$;
197
+ private readonly searchActiveResultChange$;
198
+ private readonly searchResultState$;
199
+ constructor(id: string, registry: PluginRegistry, engine: PdfEngine);
200
+ private handleDocumentLoaded;
201
+ private handleLoaderEvent;
202
+ initialize(config: SearchPluginConfig): Promise<void>;
203
+ onStoreUpdated(_prevState: SearchState, newState: SearchState): void;
204
+ protected buildCapability(): SearchCapability;
205
+ private setFlags;
206
+ private notifySearchStart;
207
+ private notifySearchStop;
208
+ private notifyActiveResultChange;
209
+ private startSearchSession;
210
+ private stopSearchSession;
211
+ private searchAllPages;
212
+ private nextResult;
213
+ private previousResult;
214
+ private goToResult;
215
+ destroy(): Promise<void>;
216
+ }
217
+
218
+ declare const initialState: SearchState;
219
+
220
+ declare const SEARCH_PLUGIN_ID = "search";
221
+ declare const manifest: PluginManifest<SearchPluginConfig>;
222
+
223
+ declare const SearchPluginPackage: PluginPackage<SearchPlugin, SearchPluginConfig, SearchState, SearchAction>;
224
+
225
+ export { SEARCH_PLUGIN_ID, type SearchCapability, SearchPlugin, type SearchPluginConfig, SearchPluginPackage, type SearchResultState, type SearchState, initialState, manifest };