Skip to content

Commit 3f640e1

Browse files
committed
feat: Copied core part from vim-fall
1 parent 4333b12 commit 3f640e1

File tree

20 files changed

+640
-0
lines changed

20 files changed

+640
-0
lines changed

.github/workflows/jsr.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: jsr
2+
3+
env:
4+
DENO_VERSION: 1.x
5+
6+
on:
7+
push:
8+
tags:
9+
- "v*"
10+
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- uses: denoland/setup-deno@v1
23+
with:
24+
deno-version: ${{ env.DENO_VERSION }}
25+
- name: Publish
26+
run: |
27+
deno run -A jsr:@david/publish-on-tag@0.1.4

.github/workflows/test.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
check:
12+
strategy:
13+
matrix:
14+
runner:
15+
- ubuntu-latest
16+
deno_version:
17+
- "1.x"
18+
- "2.x"
19+
runs-on: ${{ matrix.runner }}
20+
steps:
21+
- run: git config --global core.autocrlf false
22+
if: runner.os == 'Windows'
23+
- uses: actions/checkout@v4
24+
- uses: denoland/setup-deno@v1.1.4
25+
with:
26+
deno-version: "${{ matrix.deno_version }}"
27+
- uses: actions/cache@v4
28+
with:
29+
key: deno-${{ hashFiles('**/*') }}
30+
restore-keys: deno-
31+
path: |
32+
/home/runner/.cache/deno/deps/https/deno.land
33+
- name: Lint check
34+
run: deno lint
35+
- name: Format check
36+
run: deno fmt --check
37+
- name: Type check
38+
run: deno task check
39+
40+
test:
41+
strategy:
42+
matrix:
43+
runner:
44+
- windows-latest
45+
- macos-latest
46+
- ubuntu-latest
47+
deno_version:
48+
- "1.x"
49+
- "2.x"
50+
runs-on: ${{ matrix.runner }}
51+
timeout-minutes: 15
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- uses: denoland/setup-deno@v1.1.4
56+
with:
57+
deno-version: "${{ matrix.deno_version }}"
58+
59+
- name: Test
60+
run: deno task test:coverage
61+
timeout-minutes: 15
62+
63+
- run: |
64+
deno task coverage --lcov > coverage.lcov
65+
66+
- uses: codecov/codecov-action@v4
67+
with:
68+
os: ${{ runner.os }}
69+
files: ./coverage.lcov
70+
token: ${{ secrets.CODECOV_TOKEN }}
71+
72+
jsr-publish:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v4
76+
- uses: denoland/setup-deno@v1
77+
with:
78+
deno-version: ${{ env.DENO_VERSION }}
79+
- name: Publish (dry-run)
80+
run: |
81+
deno publish --dry-run

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.tool-versions
2+
.coverage
3+
deno.lock

.gitmessage

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
# **Conventional Commits**
3+
#
4+
# <type>[optional scope]: <description>
5+
#
6+
# feat: feature (minor)
7+
# deps: dependencies (minor/patch)
8+
# fix: bug fix (patch)
9+
# refactor: refactoring code
10+
# test: test fix; no code change
11+
# docs: documentation fix; no code change
12+
# style: formatting, missing semi colons, etc; no code change
13+
# chore: updating build tasks, package manager configs, etc; no code change
14+
#
15+
# **Install**
16+
#
17+
# git config commit.template .gitmessage
18+
#
19+
# **Reference**
20+
#
21+
# - https://www.conventionalcommits.org/en/v1.0.0/

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright 2024 Alisue <lambdalisue@gmail.com>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.
20+

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# 🍂 fall-core
2+
3+
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4+
5+
Core types for [Fall](https://github.com/vim-fall/fall), a Vim/Neovim Fuzzy
6+
Finder plugin powered by [Denops](https://github.com/vim-denops/denops.vim).
7+
8+
> [!WARNING]
9+
>
10+
> This module is for internal use only. It is not intended to be used by others.
11+
12+
## License
13+
14+
The code in this repository follows the MIT license, as detailed in
15+
[LICENSE](./LICENSE). Contributors must agree that any modifications submitted
16+
to this repository also adhere to the license.

_typeutil.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type Promish<T> = T | Promise<T>;

action.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type { Denops } from "@denops/std";
2+
3+
import type { Promish } from "./_typeutil.ts";
4+
import type { IdItem } from "./item.ts";
5+
6+
export type InvokeParams<T> = {
7+
/**
8+
* The item under the cursor.
9+
*/
10+
readonly item?: IdItem<T> | undefined;
11+
/**
12+
* The selected items.
13+
*/
14+
readonly selectedItems?: readonly IdItem<T>[] | undefined;
15+
/**
16+
* The filtered items.
17+
*/
18+
readonly filteredItems: readonly IdItem<T>[];
19+
};
20+
21+
export type Action<T> = {
22+
/**
23+
* Invoke the action.
24+
*
25+
* @param denops The Denops instance.
26+
* @param params The parameters for invoking the action.
27+
* @param options The options.
28+
* @returns If the picker should not be closed, return `true`.
29+
*/
30+
invoke(
31+
denops: Denops,
32+
params: InvokeParams<T>,
33+
options: { signal?: AbortSignal },
34+
): Promish<void | true>;
35+
};

coordinator.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type { Border, Theme } from "./theme.ts";
2+
3+
export type Size = {
4+
width: number;
5+
height: number;
6+
};
7+
8+
export type Dimension = Size & {
9+
col: number;
10+
row: number;
11+
};
12+
13+
export type Style = {
14+
input: Border;
15+
list: Border;
16+
preview?: Border;
17+
};
18+
19+
export type Layout = {
20+
input: Dimension;
21+
list: Dimension;
22+
preview?: Dimension;
23+
};
24+
25+
export type Coordinator = {
26+
/**
27+
* Style of the picker components.
28+
*/
29+
style(theme: Theme): Style;
30+
31+
/**
32+
* Layout of the picker components.
33+
*/
34+
layout(screen: Size): Layout;
35+
};

curator.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import type { Denops } from "@denops/std";
2+
3+
import type { IdItem } from "./item.ts";
4+
5+
export type CurateParams = {
6+
/**
7+
* The arguments passed to the picker.
8+
*/
9+
readonly args: readonly string[];
10+
/**
11+
* User input query.
12+
*/
13+
readonly query: string;
14+
};
15+
16+
export type Curator<T> = {
17+
/**
18+
* Curate items.
19+
*
20+
* @param denops The Denops instance.
21+
* @param params The parameters to curate items.
22+
* @param options The options.
23+
* @param options.signal The signal to cancel the operation.
24+
*/
25+
curate(
26+
denops: Denops,
27+
params: CurateParams,
28+
options: { signal?: AbortSignal },
29+
): AsyncIterableIterator<IdItem<T>>;
30+
};

0 commit comments

Comments
 (0)