vitepress-plugin-filelist 0.0.0-stage → 0.1.1
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 +21 -0
- package/README.md +173 -2
- package/dist/client/browser/index.d.ts +179 -0
- package/dist/client/browser/index.js +834 -0
- package/dist/client/ssr/index.d.ts +179 -0
- package/dist/client/ssr/index.js +513 -0
- package/dist/client/style.css +319 -0
- package/dist/node/index.d.ts +18 -0
- package/dist/node/index.js +24 -0
- package/package.json +67 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EduSprout contributors
|
|
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/README.md
CHANGED
|
@@ -1,3 +1,174 @@
|
|
|
1
|
-
#
|
|
1
|
+
# vitepress-plugin-filelist
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
OpenList file browser for VitePress — tree view, batch ZIP download, folder password and token support.
|
|
4
|
+
|
|
5
|
+
VitePress 的 OpenList 文件浏览组件:树形展开、勾选批量打包、目录密码、token,直接调用 OpenList 接口。
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 📁 Tree view with lazy-loaded folders
|
|
10
|
+
- ✅ Checkbox selection, folder selects its loaded children
|
|
11
|
+
- 📦 Batch download as ZIP (via `fflate`), with progress
|
|
12
|
+
- ⬇️ Single file download and preview (`/d/`, `/p/`, `fs/get` raw URL)
|
|
13
|
+
- 🔐 Folder password prompt, optional read-only token
|
|
14
|
+
- 🔎 Filter current tree, sortable name / size / date
|
|
15
|
+
- 🌐 Uses `/api/fs/list`, `/api/fs/get`, `/api/public/settings`
|
|
16
|
+
- 🧪 Demo mode with built-in fake data when `base` is empty
|
|
17
|
+
- SSR safe (network requests only run on the client)
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add -D vitepress-plugin-filelist
|
|
23
|
+
# or: npm i -D vitepress-plugin-filelist
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage with vitepress-tuck
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
// .vitepress/config.ts
|
|
30
|
+
import { defineConfig } from 'vitepress-tuck'
|
|
31
|
+
import fileList from 'vitepress-plugin-filelist'
|
|
32
|
+
|
|
33
|
+
export default defineConfig({
|
|
34
|
+
plugins: [fileList()],
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// .vitepress/theme/index.ts
|
|
40
|
+
import type { Theme } from 'vitepress'
|
|
41
|
+
import enhanceApp from 'virtual:enhance-app'
|
|
42
|
+
import DefaultTheme from 'vitepress/theme'
|
|
43
|
+
|
|
44
|
+
export default {
|
|
45
|
+
extends: DefaultTheme,
|
|
46
|
+
enhanceApp(ctx) {
|
|
47
|
+
enhanceApp(ctx)
|
|
48
|
+
},
|
|
49
|
+
} satisfies Theme
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```md
|
|
53
|
+
<FileList base="https://pan.example.com" path="/课程资料" />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Usage with plain VitePress
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
// .vitepress/theme/index.ts
|
|
60
|
+
import DefaultTheme from 'vitepress/theme'
|
|
61
|
+
import { enhanceAppWithFileList } from 'vitepress-plugin-filelist/client'
|
|
62
|
+
import 'vitepress-plugin-filelist/style.css'
|
|
63
|
+
|
|
64
|
+
export default {
|
|
65
|
+
extends: DefaultTheme,
|
|
66
|
+
enhanceApp(ctx) {
|
|
67
|
+
enhanceAppWithFileList(ctx)
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Props
|
|
73
|
+
|
|
74
|
+
| Prop | Type | Default | Description |
|
|
75
|
+
| --- | --- | --- | --- |
|
|
76
|
+
| `base` | `string` | `''` | OpenList base URL. Empty = demo mode |
|
|
77
|
+
| `path` | `string` | `'/'` | Initial directory |
|
|
78
|
+
| `token` | `string` | `''` | Optional read-only token (guest when omitted) |
|
|
79
|
+
| `password` | `string` | `''` | Folder password; can also be entered at runtime |
|
|
80
|
+
| `title` | `string` | `''` | Toolbar title; falls back to OpenList `site_title` |
|
|
81
|
+
| `locale` | `'zh-CN' \| 'en-US'` | `'zh-CN'` | Built-in label preset |
|
|
82
|
+
| `labels` | `Partial<FileListLabels>` | `undefined` | Per-key label overrides |
|
|
83
|
+
|
|
84
|
+
Both `<FileList>` and `<VPFileList>` are registered.
|
|
85
|
+
|
|
86
|
+
## i18n
|
|
87
|
+
|
|
88
|
+
```md
|
|
89
|
+
<FileList locale="en-US" base="https://pan.example.com" />
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Override individual labels on top of the preset:
|
|
93
|
+
|
|
94
|
+
```md
|
|
95
|
+
<FileList
|
|
96
|
+
:labels="{ batch: '下载全部', loaded: '共 {count} 个文件' }"
|
|
97
|
+
base="https://pan.example.com"
|
|
98
|
+
/>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Available presets: `zh-CN`, `en-US`. Placeholders use `{count}`, `{percent}`, `{message}`, `{name}` and are replaced by `formatLabel()`. The full key list is exported as `FileListLabels`:
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import type { FileListLabels } from 'vitepress-plugin-filelist/client'
|
|
105
|
+
import { fileListLocales, formatLabel, resolveLabels } from 'vitepress-plugin-filelist/client'
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## OpenList requirements
|
|
109
|
+
|
|
110
|
+
1. **Guest read access** — enable the guest user, or pass a read-only `token`.
|
|
111
|
+
2. **CORS** — OpenList's `cors.allow_origins` must include your site origin (default `*`).
|
|
112
|
+
3. **Same protocol** — an HTTPS page cannot call an HTTP OpenList (mixed content).
|
|
113
|
+
4. **Token is public** — only ship a read-only token that can be revoked.
|
|
114
|
+
|
|
115
|
+
The component calls:
|
|
116
|
+
|
|
117
|
+
| Endpoint | Purpose |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| `POST /api/fs/list` | Directory listing (`per_page: 0`) |
|
|
120
|
+
| `POST /api/fs/get` | `raw_url` for download / preview / ZIP; falls back to `/d/...?sign=` |
|
|
121
|
+
| `GET /api/public/settings` | `site_title` fallback |
|
|
122
|
+
| `GET /d/...` `GET /p/...` | Download / preview links generated by OpenList |
|
|
123
|
+
|
|
124
|
+
## Exports
|
|
125
|
+
|
|
126
|
+
| Entry | Contents |
|
|
127
|
+
| --- | --- |
|
|
128
|
+
| `vitepress-plugin-filelist` | `fileList` plugin (default export) |
|
|
129
|
+
| `vitepress-plugin-filelist/client` | `FileList`, `VPFileList`, `enhanceAppWithFileList`, types |
|
|
130
|
+
| `vitepress-plugin-filelist/style.css` | Component styles |
|
|
131
|
+
|
|
132
|
+
## Compatibility
|
|
133
|
+
|
|
134
|
+
Peer dependency allows VitePress 1.x and 2.0 alpha: `^1.0.0 || ^2.0.0-alpha.0`.
|
|
135
|
+
|
|
136
|
+
Tested locally against VitePress `2.0.0-alpha.21` on Node 22:
|
|
137
|
+
|
|
138
|
+
| Package manager | Install | Build |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| npm 10 | ✅ | ✅ |
|
|
141
|
+
| pnpm 11.25 | ✅ | ✅ |
|
|
142
|
+
| yarn 1.22 (classic) | ✅ | ✅ |
|
|
143
|
+
| bun 1.4 | ✅ | ✅ |
|
|
144
|
+
| deno 2.9 | ✅ `deno install` | ❌ fails while Vite/rolldown loads the config |
|
|
145
|
+
|
|
146
|
+
Deno can install the npm dependency, but building a VitePress site with Deno currently fails inside rolldown (`stream did not contain valid UTF-8`). Use Node for builds.
|
|
147
|
+
|
|
148
|
+
## Notes
|
|
149
|
+
|
|
150
|
+
- Batch ZIP downloads files through `raw_url` (OpenList `/p/` proxy), which keeps CORS on the OpenList origin.
|
|
151
|
+
- Select-all only counts already-loaded files; the footer reports how many folders are still collapsed.
|
|
152
|
+
- Directory listings are requested with `per_page: 0` (all entries). Very large folders may be slow; pagination is not implemented yet.
|
|
153
|
+
|
|
154
|
+
## Development
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npm install
|
|
158
|
+
npm run build # dist/node, dist/client/ssr, dist/client/browser, style.css
|
|
159
|
+
npm run typecheck
|
|
160
|
+
npm test # Vitest: utils + locale helpers
|
|
161
|
+
npm run pack:check
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The demo site in `demo/` installs the package through `file:..`:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
cd demo
|
|
168
|
+
npm install
|
|
169
|
+
npm run build
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
MIT
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { EnhanceAppContext } from "vitepress/client";
|
|
2
|
+
type FileListLocale = 'zh-CN' | 'en-US';
|
|
3
|
+
interface FileListLabels {
|
|
4
|
+
allFiles: string;
|
|
5
|
+
demoBadge: string;
|
|
6
|
+
filter: string;
|
|
7
|
+
refresh: string;
|
|
8
|
+
batch: string;
|
|
9
|
+
batchCount: string;
|
|
10
|
+
batching: string;
|
|
11
|
+
passwordPrompt: string;
|
|
12
|
+
passwordPlaceholder: string;
|
|
13
|
+
open: string;
|
|
14
|
+
columnName: string;
|
|
15
|
+
columnSize: string;
|
|
16
|
+
columnDate: string;
|
|
17
|
+
loading: string;
|
|
18
|
+
loadFailed: string;
|
|
19
|
+
guestHint: string;
|
|
20
|
+
corsHint: string;
|
|
21
|
+
retry: string;
|
|
22
|
+
empty: string;
|
|
23
|
+
preview: string;
|
|
24
|
+
download: string;
|
|
25
|
+
loaded: string;
|
|
26
|
+
selected: string;
|
|
27
|
+
unloaded: string;
|
|
28
|
+
folderFailed: string;
|
|
29
|
+
demoDownload: string;
|
|
30
|
+
demoPreview: string;
|
|
31
|
+
demoBatch: string;
|
|
32
|
+
downloadFailed: string;
|
|
33
|
+
previewFailed: string;
|
|
34
|
+
batchFailed: string;
|
|
35
|
+
defaultZip: string;
|
|
36
|
+
}
|
|
37
|
+
interface FileListProps {
|
|
38
|
+
/** OpenList base URL, e.g. `https://pan.example.com`. Empty string enables demo mode. */
|
|
39
|
+
base?: string;
|
|
40
|
+
/** Initial directory, defaults to `/`. */
|
|
41
|
+
path?: string;
|
|
42
|
+
/** Optional read-only token. Guest access is used when omitted. */
|
|
43
|
+
token?: string;
|
|
44
|
+
/** Folder password. The component also asks at runtime when OpenList reports one. */
|
|
45
|
+
password?: string;
|
|
46
|
+
/** Toolbar title. Falls back to `site_title` from `/api/public/settings`. */
|
|
47
|
+
title?: string;
|
|
48
|
+
/** Built-in locale. Defaults to `zh-CN`. */
|
|
49
|
+
locale?: FileListLocale;
|
|
50
|
+
/** Per-key label overrides on top of the locale preset. */
|
|
51
|
+
labels?: Partial<FileListLabels>;
|
|
52
|
+
}
|
|
53
|
+
/** Shape of one entry returned by `POST /api/fs/list`. */
|
|
54
|
+
interface OpenListEntry {
|
|
55
|
+
name: string;
|
|
56
|
+
size: number;
|
|
57
|
+
is_dir: boolean;
|
|
58
|
+
modified: string;
|
|
59
|
+
created?: string;
|
|
60
|
+
sign?: string;
|
|
61
|
+
thumb?: string;
|
|
62
|
+
type?: number;
|
|
63
|
+
}
|
|
64
|
+
declare const _default: import("vue").DefineComponent<FileListProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FileListProps> & Readonly<{}>, {
|
|
65
|
+
base: string;
|
|
66
|
+
path: string;
|
|
67
|
+
token: string;
|
|
68
|
+
password: string;
|
|
69
|
+
title: string;
|
|
70
|
+
locale: FileListLocale;
|
|
71
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
72
|
+
declare global {
|
|
73
|
+
const __VLS_intrinsicElements: __VLS_IntrinsicElements;
|
|
74
|
+
const __VLS_directiveBindingRestFields: {
|
|
75
|
+
instance: null;
|
|
76
|
+
oldValue: null;
|
|
77
|
+
modifiers: any;
|
|
78
|
+
dir: any;
|
|
79
|
+
};
|
|
80
|
+
const __VLS_unref: typeof import('vue').unref;
|
|
81
|
+
const __VLS_placeholder: any;
|
|
82
|
+
type __VLS_NativeElements = __VLS_SpreadMerge<SVGElementTagNameMap, HTMLElementTagNameMap>;
|
|
83
|
+
type __VLS_IntrinsicElements = import('vue/jsx-runtime').JSX.IntrinsicElements;
|
|
84
|
+
type __VLS_Element = import('vue/jsx-runtime').JSX.Element;
|
|
85
|
+
type __VLS_GlobalComponents = import('vue').GlobalComponents;
|
|
86
|
+
type __VLS_GlobalDirectives = import('vue').GlobalDirectives;
|
|
87
|
+
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
|
|
88
|
+
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
|
|
89
|
+
type __VLS_SpreadMerge<A, B> = Omit<A, keyof B> & B;
|
|
90
|
+
type __VLS_WithComponent<N0 extends string, LocalComponents, Self, N1 extends string, N2 extends string, N3 extends string> = N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N1]; } : N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N2]; } : N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N3]; } : Self extends object ? { [K in N0]: Self; } : N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N1]; } : N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N2]; } : N3 extends keyof __VLS_GlobalComponents ? N3 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N3]; } : { [K in N0]: unknown; };
|
|
91
|
+
type __VLS_FunctionalComponentProps<T, K> = '__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends {
|
|
92
|
+
__ctx?: {
|
|
93
|
+
props?: infer P;
|
|
94
|
+
};
|
|
95
|
+
} ? NonNullable<P> : never : T extends ((props: infer P, ...args: any) => any) ? P : {};
|
|
96
|
+
type __VLS_IsFunction<T, K> = K extends keyof T ? __VLS_IsAny<T[K]> extends false ? unknown extends T[K] ? false : true : false : false;
|
|
97
|
+
type __VLS_NormalizeComponentEvent<Props, Events, onEvent extends keyof Props, Event extends keyof Events, CamelizedEvent extends keyof Events> = (__VLS_IsFunction<Props, onEvent> extends true ? Props : __VLS_IsFunction<Events, Event> extends true ? { [K in onEvent]?: Events[Event]; } : __VLS_IsFunction<Events, CamelizedEvent> extends true ? { [K in onEvent]?: Events[CamelizedEvent]; } : Props) & Record<string, unknown>;
|
|
98
|
+
type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
|
|
99
|
+
type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends ((...args: infer A) => infer R) ? U extends T ? never : __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R) : never;
|
|
100
|
+
type __VLS_OverloadUnion<T> = Exclude<__VLS_OverloadUnionInner<(() => never) & T>, T extends (() => never) ? never : () => never>;
|
|
101
|
+
type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends (infer F) ? F extends ((event: infer E, ...args: infer A) => any) ? { [K in E & string]: (...args: A) => void; } : never : never;
|
|
102
|
+
type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<__VLS_UnionToIntersection<__VLS_ConstructorOverloads<T> & { [K in keyof T]: T[K] extends any[] ? {
|
|
103
|
+
(...args: T[K]): void;
|
|
104
|
+
} : never; }>>;
|
|
105
|
+
type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
|
106
|
+
type __VLS_PickFunctionalComponentCtx<T, K> = NonNullable<__VLS_PickNotAny<'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends {
|
|
107
|
+
__ctx?: infer Ctx;
|
|
108
|
+
} ? Ctx : never : any, T extends ((props: any, ctx: infer Ctx) => any) ? Ctx : any>>;
|
|
109
|
+
type __VLS_UseTemplateRef<T> = Readonly<import('vue').ShallowRef<T | null>>;
|
|
110
|
+
function __VLS_getVForSourceType<T extends number | string | any[] | Iterable<any>>(source: T): [item: T extends number ? number : T extends string ? string : T extends any[] ? T[number] : T extends Iterable<infer T1> ? T1 : any, index: number][];
|
|
111
|
+
function __VLS_getVForSourceType<T>(source: T): [item: T[keyof T], key: keyof T, index: number][];
|
|
112
|
+
function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
|
|
113
|
+
function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
|
|
114
|
+
function __VLS_asFunctionalDirective<T>(dir: T): T extends import('vue').ObjectDirective ? NonNullable<T['created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted']> : T extends ((...args: any) => any) ? T : (arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown) => void;
|
|
115
|
+
function __VLS_makeOptional<T>(t: T): { [K in keyof T]?: T[K]; };
|
|
116
|
+
function __VLS_asFunctionalComponent<T, K = T extends (new (...args: any) => any) ? InstanceType<T> : unknown>(t: T, instance?: K): T extends (new (...args: any) => any) ? (props: (K extends {
|
|
117
|
+
$props: infer Props;
|
|
118
|
+
} ? Props : any) & Record<string, unknown>, ctx?: any) => __VLS_Element & {
|
|
119
|
+
__ctx?: {
|
|
120
|
+
attrs?: any;
|
|
121
|
+
slots?: K extends {
|
|
122
|
+
$slots: infer Slots;
|
|
123
|
+
} ? Slots : any;
|
|
124
|
+
emit?: K extends {
|
|
125
|
+
$emit: infer Emit;
|
|
126
|
+
} ? Emit : any;
|
|
127
|
+
expose?(exposed: K): void;
|
|
128
|
+
props?: (K extends {
|
|
129
|
+
$props: infer Props;
|
|
130
|
+
} ? Props : any) & Record<string, unknown>;
|
|
131
|
+
};
|
|
132
|
+
} : T extends (() => any) ? (props: {}, ctx?: any) => ReturnType<T> : T extends ((...args: any) => any) ? T : (_: {} & Record<string, unknown>, ctx?: any) => {
|
|
133
|
+
__ctx?: {
|
|
134
|
+
attrs?: any;
|
|
135
|
+
expose?: any;
|
|
136
|
+
slots?: any;
|
|
137
|
+
emit?: any;
|
|
138
|
+
props?: {} & Record<string, unknown>;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): 2 extends Parameters<T>['length'] ? [any] : [];
|
|
142
|
+
function __VLS_asFunctionalElement<T>(tag: T, endTag?: T): (attrs: T & Record<string, unknown>) => void;
|
|
143
|
+
function __VLS_asFunctionalSlot<S>(slot: S): S extends (() => infer R) ? (props: {}) => R : NonNullable<S>;
|
|
144
|
+
function __VLS_tryAsConstant<const T>(t: T): T;
|
|
145
|
+
}
|
|
146
|
+
export declare const fileListLocales: Record<FileListLocale, FileListLabels>;
|
|
147
|
+
export declare function formatLabel(template: string, values?: Record<string, string | number>): string;
|
|
148
|
+
export declare function resolveLabels(locale?: FileListLocale, overrides?: Partial<FileListLabels>): FileListLabels;
|
|
149
|
+
export interface SortableNode {
|
|
150
|
+
name: string;
|
|
151
|
+
size: number;
|
|
152
|
+
is_dir: boolean;
|
|
153
|
+
modified: string;
|
|
154
|
+
}
|
|
155
|
+
export type SortKey = 'name' | 'size' | 'modified';
|
|
156
|
+
export declare function joinPath(parent: string, name: string): string;
|
|
157
|
+
export declare function encodePath(path: string): string;
|
|
158
|
+
export declare function formatSize(size: number): string;
|
|
159
|
+
export declare function formatDate(iso: string): string;
|
|
160
|
+
export declare function extOf(name: string): string;
|
|
161
|
+
export declare function compareNodes(a: SortableNode, b: SortableNode, key: SortKey, ascending?: boolean): number;
|
|
162
|
+
/**
|
|
163
|
+
* Register `<FileList>` and `<VPFileList>` globally.
|
|
164
|
+
*
|
|
165
|
+
* ```ts
|
|
166
|
+
* // .vitepress/theme/index.ts
|
|
167
|
+
* import DefaultTheme from 'vitepress/theme'
|
|
168
|
+
* import { enhanceAppWithFileList } from 'vitepress-plugin-filelist/client'
|
|
169
|
+
*
|
|
170
|
+
* export default {
|
|
171
|
+
* extends: DefaultTheme,
|
|
172
|
+
* enhanceApp(ctx) {
|
|
173
|
+
* enhanceAppWithFileList(ctx)
|
|
174
|
+
* },
|
|
175
|
+
* }
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
export declare function enhanceAppWithFileList({ app }: EnhanceAppContext): void;
|
|
179
|
+
export { _default as FileList, _default as VPFileList, type FileListLabels, type FileListLocale, type FileListProps, type OpenListEntry };
|