vitepress-plugin-filelist 0.2.3 → 0.3.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/README.md +21 -1
- package/dist/client/browser/index.d.ts +26 -0
- package/dist/client/browser/index.js +464 -130
- package/dist/client/ssr/index.d.ts +26 -0
- package/dist/client/ssr/index.js +213 -40
- package/dist/client/style.css +576 -95
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
- ⬇️ 单文件下载与预览(`/d/`、`/p/`、`fs/get` 的 `raw_url`)
|
|
11
11
|
- 🔐 目录密码输入,可选只读 token
|
|
12
12
|
- 🔎 当前树过滤,按名称 / 大小 / 日期排序
|
|
13
|
+
- 🎨 紧凑表格:按文件类型着色的扩展名标签、层级引导线,跟随 VitePress 亮 / 暗主题
|
|
14
|
+
- 📱 窄容器(< 560px)自动切换为双行列表与 44px 触控区,勾选后工具栏变为吸顶操作条
|
|
13
15
|
- 🌐 使用 `/api/fs/list`、`/api/fs/get`、`/api/public/settings`
|
|
14
16
|
- 🧪 `base` 为空时使用内置演示数据
|
|
15
17
|
- SSR 安全(网络请求只在客户端执行)
|
|
@@ -112,6 +114,24 @@ interface FileListSource {
|
|
|
112
114
|
}
|
|
113
115
|
```
|
|
114
116
|
|
|
117
|
+
## 界面与布局
|
|
118
|
+
|
|
119
|
+
- 宽容器:表格布局(勾选 / 名称 / 大小 / 修改日期 / 操作),行高 40px;勾选文件后,工具栏原地变为操作条(已选数量、总大小、清除、下载 ZIP)
|
|
120
|
+
- 窄容器(组件宽度 < 560px,基于容器查询而非视口宽度,侧边栏挤压时同样生效):
|
|
121
|
+
- 隐藏“修改日期”列,大小与日期显示在文件名下方
|
|
122
|
+
- 行高 56px,复选框、展开、预览、下载的触控区不小于 44px
|
|
123
|
+
- 表头排序改为下拉选择
|
|
124
|
+
- 勾选后操作条吸附在组件顶部,位于 VitePress 导航栏 / “On this page” 栏下方,只在本组件范围内吸附
|
|
125
|
+
- 颜色全部取自 VitePress 主题变量,暗色模式自动适配
|
|
126
|
+
|
|
127
|
+
吸顶偏移默认根据 `.VPNav`、`.VPLocalNav` 的实际高度自动计算;自定义主题可手动指定:
|
|
128
|
+
|
|
129
|
+
```css
|
|
130
|
+
.fl-root {
|
|
131
|
+
--fl-sticky-top: 56px;
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
115
135
|
## 国际化
|
|
116
136
|
|
|
117
137
|
```md
|
|
@@ -181,7 +201,7 @@ Deno 可以安装 npm 依赖,但目前用 Deno 构建 VitePress 会在 rolldow
|
|
|
181
201
|
## 说明
|
|
182
202
|
|
|
183
203
|
- 批量 ZIP 通过 `raw_url`(OpenList `/p/` 代理)下载,CORS 保持在 OpenList 源上
|
|
184
|
-
-
|
|
204
|
+
- 表头全选只统计已加载的文件;勾选单个文件夹则会递归加载其全部子目录(目录很深或很多时会逐个请求,可能较慢)
|
|
185
205
|
- 目录以 `per_page: 0` 请求全部条目;超大目录可能较慢,暂未实现分页
|
|
186
206
|
|
|
187
207
|
## 开发
|
|
@@ -6,6 +6,7 @@ interface FileListLabels {
|
|
|
6
6
|
filter: string;
|
|
7
7
|
refresh: string;
|
|
8
8
|
batch: string;
|
|
9
|
+
/** @deprecated No longer shown; the selection count lives in the toolbar. */
|
|
9
10
|
batchCount: string;
|
|
10
11
|
batching: string;
|
|
11
12
|
passwordPrompt: string;
|
|
@@ -24,6 +25,7 @@ interface FileListLabels {
|
|
|
24
25
|
download: string;
|
|
25
26
|
loaded: string;
|
|
26
27
|
selected: string;
|
|
28
|
+
/** @deprecated No longer shown; the footer only shows loaded files and size. */
|
|
27
29
|
unloaded: string;
|
|
28
30
|
folderFailed: string;
|
|
29
31
|
demoDownload: string;
|
|
@@ -33,6 +35,23 @@ interface FileListLabels {
|
|
|
33
35
|
previewFailed: string;
|
|
34
36
|
batchFailed: string;
|
|
35
37
|
defaultZip: string;
|
|
38
|
+
/** Text button that clears the selection (wide layout). */
|
|
39
|
+
clear: string;
|
|
40
|
+
/** Accessible name of the clear-selection button. */
|
|
41
|
+
clearSelection: string;
|
|
42
|
+
/** `{size}` total, used for the selection and the footer. */
|
|
43
|
+
totalSize: string;
|
|
44
|
+
/** `{count}` files inside a loaded folder. */
|
|
45
|
+
folderItems: string;
|
|
46
|
+
/** Label of the compact sort select shown in narrow containers. */
|
|
47
|
+
sortBy: string;
|
|
48
|
+
selectAll: string;
|
|
49
|
+
/** Accessible name of a row checkbox, `{name}`. */
|
|
50
|
+
selectItem: string;
|
|
51
|
+
/** Accessible name of the expand button, `{name}`. */
|
|
52
|
+
expand: string;
|
|
53
|
+
/** Accessible name of the collapse button, `{name}`. */
|
|
54
|
+
collapse: string;
|
|
36
55
|
}
|
|
37
56
|
interface FileListSource {
|
|
38
57
|
/** OpenList path, directory or single file. */
|
|
@@ -186,6 +205,13 @@ export declare function uniqueEntryName(name: string, used: Set<string>): string
|
|
|
186
205
|
export declare function formatSize(size: number): string;
|
|
187
206
|
export declare function formatDate(iso: string): string;
|
|
188
207
|
export declare function extOf(name: string): string;
|
|
208
|
+
export type FileKind = 'doc' | 'sheet' | 'slide' | 'pdf' | 'image' | 'media' | 'archive' | 'code' | 'other';
|
|
209
|
+
/** Rough file family, used to colour the type badge. */
|
|
210
|
+
export declare function fileKind(name: string): FileKind;
|
|
211
|
+
/** Sum of the `size` of the given entries, ignoring missing or invalid sizes. */
|
|
212
|
+
export declare function totalSize(items: Array<{
|
|
213
|
+
size?: number;
|
|
214
|
+
}>): number;
|
|
189
215
|
export declare function compareNodes(a: SortableNode, b: SortableNode, key: SortKey, ascending?: boolean): number;
|
|
190
216
|
/**
|
|
191
217
|
* Register `<FileList>` and `<VPFileList>` globally.
|