vitepress-plugin-filelist 0.2.3 → 0.3.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.
- package/README.md +20 -0
- package/dist/client/browser/index.d.ts +25 -0
- package/dist/client/browser/index.js +468 -119
- package/dist/client/ssr/index.d.ts +25 -0
- package/dist/client/ssr/index.js +215 -28
- package/dist/client/style.css +580 -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
|
|
@@ -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;
|
|
@@ -33,6 +34,23 @@ interface FileListLabels {
|
|
|
33
34
|
previewFailed: string;
|
|
34
35
|
batchFailed: string;
|
|
35
36
|
defaultZip: string;
|
|
37
|
+
/** Text button that clears the selection (wide layout). */
|
|
38
|
+
clear: string;
|
|
39
|
+
/** Accessible name of the clear-selection button. */
|
|
40
|
+
clearSelection: string;
|
|
41
|
+
/** `{size}` total, used for the selection and the footer. */
|
|
42
|
+
totalSize: string;
|
|
43
|
+
/** `{count}` files inside a loaded folder. */
|
|
44
|
+
folderItems: string;
|
|
45
|
+
/** Label of the compact sort select shown in narrow containers. */
|
|
46
|
+
sortBy: string;
|
|
47
|
+
selectAll: string;
|
|
48
|
+
/** Accessible name of a row checkbox, `{name}`. */
|
|
49
|
+
selectItem: string;
|
|
50
|
+
/** Accessible name of the expand button, `{name}`. */
|
|
51
|
+
expand: string;
|
|
52
|
+
/** Accessible name of the collapse button, `{name}`. */
|
|
53
|
+
collapse: string;
|
|
36
54
|
}
|
|
37
55
|
interface FileListSource {
|
|
38
56
|
/** OpenList path, directory or single file. */
|
|
@@ -186,6 +204,13 @@ export declare function uniqueEntryName(name: string, used: Set<string>): string
|
|
|
186
204
|
export declare function formatSize(size: number): string;
|
|
187
205
|
export declare function formatDate(iso: string): string;
|
|
188
206
|
export declare function extOf(name: string): string;
|
|
207
|
+
export type FileKind = 'doc' | 'sheet' | 'slide' | 'pdf' | 'image' | 'media' | 'archive' | 'code' | 'other';
|
|
208
|
+
/** Rough file family, used to colour the type badge. */
|
|
209
|
+
export declare function fileKind(name: string): FileKind;
|
|
210
|
+
/** Sum of the `size` of the given entries, ignoring missing or invalid sizes. */
|
|
211
|
+
export declare function totalSize(items: Array<{
|
|
212
|
+
size?: number;
|
|
213
|
+
}>): number;
|
|
189
214
|
export declare function compareNodes(a: SortableNode, b: SortableNode, key: SortKey, ascending?: boolean): number;
|
|
190
215
|
/**
|
|
191
216
|
* Register `<FileList>` and `<VPFileList>` globally.
|