@moyarich/console-addon-search 0.1.0 → 0.2.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.
@@ -0,0 +1,50 @@
1
+ import type { AddonTranslations } from "./localization.cjs";
2
+ export { resolveAddonMessages as resolveConsoleSearchMessages } from "./localization.cjs";
3
+ export type { AddonTranslations as ConsoleSearchTranslations } from "./localization.cjs";
4
+ export { ConsoleSearchHighlight } from "./components/ConsoleSearchHighlight/ConsoleSearchHighlight.cjs";
5
+ export { ConsoleSearchControls } from "./components/ConsoleSearchControls/ConsoleSearchControls.cjs";
6
+ import { type ConsoleAddon } from "@moyarich/console-core";
7
+ export declare const CONSOLE_SEARCH_ADDON_ID = "@moyarich/console-addon-search";
8
+ export interface ConsoleSearchOptions {
9
+ caseSensitive?: boolean;
10
+ wholeWord?: boolean;
11
+ regex?: boolean;
12
+ }
13
+ export interface ConsoleSearchMatch {
14
+ id: string;
15
+ index: number;
16
+ text: string;
17
+ /** Offset of this occurrence within the searchable text. */
18
+ start: number;
19
+ end: number;
20
+ }
21
+ export interface ConsoleSearchState {
22
+ query: string;
23
+ options: ConsoleSearchOptions;
24
+ matches: readonly ConsoleSearchMatch[];
25
+ activeIndex: number;
26
+ error?: string;
27
+ }
28
+ export interface ConsoleSearchController {
29
+ getState(): ConsoleSearchState;
30
+ subscribe(listener: () => void): () => void;
31
+ setQuery(query: string): void;
32
+ setOptions(options: ConsoleSearchOptions): void;
33
+ refresh(): void;
34
+ next(): ConsoleSearchMatch | undefined;
35
+ previous(): ConsoleSearchMatch | undefined;
36
+ }
37
+ export declare const consoleSearchService: import("@moyarich/console-core").ConsoleServiceToken<ConsoleSearchController>;
38
+ export declare function findConsoleSearchMatches(entries: readonly {
39
+ id?: string;
40
+ text: string;
41
+ }[], query: string, options?: ConsoleSearchOptions): {
42
+ matches: ConsoleSearchMatch[];
43
+ error?: string;
44
+ };
45
+ export declare function createConsoleSearchAddon(options?: {
46
+ locale?: string;
47
+ translations?: AddonTranslations;
48
+ }): ConsoleAddon & {
49
+ controller: ConsoleSearchController;
50
+ };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- export { ConsoleSearchHighlight } from "./components/ConsoleSearchHighlight/ConsoleSearchHighlight";
2
- export { ConsoleSearchControls } from "./components/ConsoleSearchControls/ConsoleSearchControls";
1
+ import type { AddonTranslations } from "./localization.js";
2
+ export { resolveAddonMessages as resolveConsoleSearchMessages } from "./localization.js";
3
+ export type { AddonTranslations as ConsoleSearchTranslations } from "./localization.js";
4
+ export { ConsoleSearchHighlight } from "./components/ConsoleSearchHighlight/ConsoleSearchHighlight.js";
5
+ export { ConsoleSearchControls } from "./components/ConsoleSearchControls/ConsoleSearchControls.js";
3
6
  import { type ConsoleAddon } from "@moyarich/console-core";
4
7
  export declare const CONSOLE_SEARCH_ADDON_ID = "@moyarich/console-addon-search";
5
8
  export interface ConsoleSearchOptions {
@@ -39,6 +42,9 @@ export declare function findConsoleSearchMatches(entries: readonly {
39
42
  matches: ConsoleSearchMatch[];
40
43
  error?: string;
41
44
  };
42
- export declare function createConsoleSearchAddon(): ConsoleAddon & {
45
+ export declare function createConsoleSearchAddon(options?: {
46
+ locale?: string;
47
+ translations?: AddonTranslations;
48
+ }): ConsoleAddon & {
43
49
  controller: ConsoleSearchController;
44
50
  };