Skip to content

Commit 17da474

Browse files
committed
feat: add removed Projector types
1 parent a80cc43 commit 17da474

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

projector.ts

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Denops } from "@denops/std";
22
import type { IdItem } from "@vim-fall/core/item";
3-
import type { Projector, ProjectParams } from "@vim-fall/core/projector";
43

54
import type { FirstType, LastType } from "./util/_typeutil.ts";
65
import { defineSource, type Source } from "./source.ts";
@@ -12,6 +11,42 @@ import {
1211
deriveArray,
1312
} from "./util/derivable.ts";
1413

14+
/**
15+
* Parameters for projecting items.
16+
*/
17+
export type ProjectParams<T> = {
18+
/**
19+
* Async iterable of items to project.
20+
*/
21+
readonly items: AsyncIterable<IdItem<T>>;
22+
};
23+
24+
/**
25+
* Projector that processes items from the source or curator.
26+
*
27+
* Generally, the projector has the following two roles:
28+
*
29+
* 1. Filter items from the source or curator based on criteria other than user input (Filter)
30+
* 2. Transform items from the source or curator to adapt the item type for further processing (Modifier)
31+
*
32+
* In built-in extensions, projectors are categorized into the two types above.
33+
*/
34+
export type Projector<T, U = T> = {
35+
/**
36+
* Projects items for further processing.
37+
*
38+
* @param denops - The Denops instance.
39+
* @param params - Parameters specifying the items to project.
40+
* @param options - Additional options, including an abort signal.
41+
* @returns An async iterator over the projected `IdItem` elements of type `U`.
42+
*/
43+
project(
44+
denops: Denops,
45+
params: ProjectParams<T>,
46+
options: { signal?: AbortSignal },
47+
): AsyncIterableIterator<IdItem<U>>;
48+
};
49+
1550
/**
1651
* Defines a projector responsible for transforming or filtering items.
1752
*
@@ -103,5 +138,3 @@ export function pipeProjectors<
103138
}) as R;
104139
}
105140
}
106-
107-
export type * from "@vim-fall/core/projector";

0 commit comments

Comments
 (0)