@jaxzhou/dsh-file-explorer 0.1.6 → 0.1.8
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 +37 -18
- package/README.zh.md +28 -15
- package/lib/client.js +401 -336
- package/lib/client.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,9 +30,9 @@ Markdown behind it, a second document open beside it in its own tab, and an expo
|
|
|
30
30
|
of it to PDF.
|
|
31
31
|
|
|
32
32
|
**The recording is an older build than the list below.** It predates Mermaid
|
|
33
|
-
diagrams, the PDF and Office previews and
|
|
34
|
-
still shows an export handing the page to the browser's print dialog —
|
|
35
|
-
export does now.
|
|
33
|
+
diagrams, the PDF and Office previews, and downloading a file from the pane at
|
|
34
|
+
all, and it still shows an export handing the page to the browser's print dialog —
|
|
35
|
+
which no export does now.
|
|
36
36
|
|
|
37
37
|
## What you get
|
|
38
38
|
|
|
@@ -55,7 +55,7 @@ The right pane picks each tab's body from the file:
|
|
|
55
55
|
| **Source code** | Syntax highlighting, line numbers, and a copy button for 24 grammars: TypeScript/JavaScript, shell, Python, Ruby, Go, Rust, Java, C, C++, C#, Kotlin, Swift, PHP, YAML, TOML, INI, HTML, CSS, SCSS, Less, SQL, XML, Lua, MDX |
|
|
56
56
|
| **Images** | PNG, JPEG, GIF, WebP, AVIF, BMP, ICO and SVG, drawn to the pane. An SVG goes through `<img>`, so its scripts never run |
|
|
57
57
|
| **PDF** | Drawn by the browser's own PDF reader, from the file's bytes — so its text is real text |
|
|
58
|
-
| **Word, Excel, PowerPoint** | `.docx`, `.xlsx` and `.pptx` unpacked in the page: a document's headings, lists, tables, pictures and code; a workbook's sheets as a grid, with the dates it stores as numbers shown as dates; a deck's slides as an outline of their text and pictures |
|
|
58
|
+
| **Word, Excel, PowerPoint** | `.docx`, `.xlsx` and `.pptx` unpacked in the page: a document's headings, lists, quotes, tables, pictures and code, with each run's basic formatting — bold, italic, underline, strikethrough, super- and subscript, colour, highlight — and a paragraph's alignment; a workbook's sheets as a grid, with the dates it stores as numbers shown as dates; a deck's slides as an outline of their text and pictures |
|
|
59
59
|
| **Anything else** | Numbered plain text — an unmapped suffix (`.vue`, `.proto`, `.txt`) stays plain rather than guessing a wrong grammar. The legacy binary Office formats (`.doc`, `.xls`, `.ppt`) are not previewed: the pane says so and offers the download |
|
|
60
60
|
|
|
61
61
|
A **Mermaid** code fence (` ```mermaid `) is a diagram, not source, so the pane
|
|
@@ -68,14 +68,25 @@ source, with the failure named above it.
|
|
|
68
68
|
Text previews wrap at their spaces and keep every word whole; an image reads its
|
|
69
69
|
complete bytes.
|
|
70
70
|
|
|
71
|
-
Every preview carries **
|
|
72
|
-
itself — not a conversion of it
|
|
73
|
-
every kind of file, including the ones this pane will not draw.
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
Every preview carries one **Export** button in the pane's toolbar. Its first row
|
|
72
|
+
is **Download**, which saves the file itself — not a conversion of it — so that row
|
|
73
|
+
is there for every kind of file, including the ones this pane will not draw. **Its
|
|
74
|
+
size is not a limit**: a download is read a window at a time rather than all at
|
|
75
|
+
once, so a file larger than a preview can hold still saves normally — a 260 MB
|
|
76
|
+
release tarball included. Up to 32 MiB it goes quietly to the browser's downloads;
|
|
77
|
+
past that it asks where to put it and streams there, which keeps the memory it
|
|
78
|
+
costs flat however large the file is. Several downloads run at once, each with its
|
|
79
|
+
own row, its own progress and its own **Cancel**, and one failing leaves the
|
|
80
|
+
others alone.
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
Every text body carries **Copy**, which copies the file's own text — a rendered
|
|
83
|
+
Markdown document copies its Markdown source.
|
|
84
|
+
|
|
85
|
+
Every control in the pane is an icon rather than a word: its tooltip and its
|
|
86
|
+
accessible label name it, and a toggle states itself by its fill.
|
|
87
|
+
|
|
88
|
+
A rendered Markdown or HTML document adds two rows to that menu — **PDF** and
|
|
89
|
+
**Word** — and each **downloads a file directly**, with no print dialog:
|
|
79
90
|
|
|
80
91
|
| Format | What it is |
|
|
81
92
|
|---|---|
|
|
@@ -191,17 +202,25 @@ restart the profile.
|
|
|
191
202
|
diagram types Mermaid 11 carries; a malformed one keeps its source and names
|
|
192
203
|
the failure above it.
|
|
193
204
|
- **An Office preview is content, not layout.** A `.docx` shows its headings,
|
|
194
|
-
|
|
205
|
+
lists, quotes, tables and pictures, and the basic formatting its runs carry —
|
|
206
|
+
bold, italic, underline, strikethrough, super- and subscript, colour, highlight
|
|
207
|
+
— with each paragraph's alignment. A `.xlsx` shows its cells' values; a `.pptx`
|
|
195
208
|
shows each slide's text and pictures. What is *not* there is everything that
|
|
196
|
-
needs a layout engine and the fonts the file names:
|
|
197
|
-
|
|
198
|
-
|
|
209
|
+
needs a layout engine and the fonts the file names: font faces and sizes,
|
|
210
|
+
spacing and indents, columns and page breaks, headers and footers, table
|
|
211
|
+
borders and shading, charts, SmartArt, and animations. Formulas show the value
|
|
212
|
+
the file cached, not a recalculation.
|
|
199
213
|
- **Only the OOXML formats are read.** `.doc`, `.xls` and `.ppt` are the older
|
|
200
214
|
binary container, which this pane does not parse — it says so and offers the
|
|
201
215
|
download instead.
|
|
202
|
-
- **
|
|
203
|
-
|
|
204
|
-
rather than
|
|
216
|
+
- **A preview is bounded by one complete-file read**, 32 MiB by default in the
|
|
217
|
+
shipped Web composition: a larger PDF or Office package reports the refusal
|
|
218
|
+
rather than being shown cut. A **download** is not bounded that way — it pages
|
|
219
|
+
through the file — so something too large to preview can still be saved.
|
|
220
|
+
- **A large download goes through the browser's save dialog.** Past 32 MiB the
|
|
221
|
+
bytes stream into a file you pick, which is what keeps the memory cost flat; a
|
|
222
|
+
browser without that API collects the file first, so a very large download
|
|
223
|
+
there costs its own size in memory.
|
|
205
224
|
- **Long documents are cut at 60 PDF pages**, and an image past 8 MiB is left out;
|
|
206
225
|
both are stated here because a silent cut reads as a complete export.
|
|
207
226
|
|
package/README.zh.md
CHANGED
|
@@ -27,8 +27,9 @@ dsh --profile web
|
|
|
27
27
|
(含表格)、切到 **源码** 看它背后的 Markdown、在旁边用另一个标签打开第二份文档,
|
|
28
28
|
最后把它导出为 PDF。
|
|
29
29
|
|
|
30
|
-
**录屏来自比下面更早的版本。** 它早于 Mermaid 图表、PDF 与 Office
|
|
31
|
-
|
|
30
|
+
**录屏来自比下面更早的版本。** 它早于 Mermaid 图表、PDF 与 Office 预览,也早于
|
|
31
|
+
「在窗格里直接下载文件」,其中那次导出仍然把页面交给浏览器的打印对话框 —— 现在的
|
|
32
|
+
导出都不会。
|
|
32
33
|
|
|
33
34
|
## 能做什么
|
|
34
35
|
|
|
@@ -48,7 +49,7 @@ dsh --profile web
|
|
|
48
49
|
| **源码** | 24 种语法的语法高亮、行号与复制按钮:TypeScript/JavaScript、shell、Python、Ruby、Go、Rust、Java、C、C++、C#、Kotlin、Swift、PHP、YAML、TOML、INI、HTML、CSS、SCSS、Less、SQL、XML、Lua、MDX |
|
|
49
50
|
| **图片** | PNG、JPEG、GIF、WebP、AVIF、BMP、ICO、SVG,自动适配窗格。SVG 经 `<img>` 绘制,其中的脚本不会执行 |
|
|
50
51
|
| **PDF** | 交由浏览器自带的 PDF 阅读器绘制,用的是文件自身的字节 —— 因此其中的文字是真文字 |
|
|
51
|
-
| **Word / Excel / PowerPoint** | `.docx`、`.xlsx`、`.pptx`
|
|
52
|
+
| **Word / Excel / PowerPoint** | `.docx`、`.xlsx`、`.pptx` 在页面内解包:文档的标题、列表、引用、表格、图片与代码,并保留每段文字的基础格式——粗体、斜体、下划线、删除线、上/下标、颜色、高亮——以及段落的对齐方式;工作簿按工作表显示为网格,并以日期显示它按数字存储的日期;演示文稿按幻灯片显示其文字与图片的提纲 |
|
|
52
53
|
| **其它** | 带行号的纯文本 —— 未映射的后缀(`.vue`、`.proto`、`.txt`)保持纯文本,而不是猜测一个错误的高亮。旧版二进制 Office 格式(`.doc`、`.xls`、`.ppt`)不做预览:窗格会说明原因并提供下载 |
|
|
53
54
|
|
|
54
55
|
**Mermaid** 代码围栏(` ```mermaid `)是图表而不是源码,窗格会把它画出来:
|
|
@@ -58,13 +59,21 @@ dsh --profile web
|
|
|
58
59
|
|
|
59
60
|
文本预览在空格处折行、保持单词完整;图片读取完整字节。
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
每种预览的窗格工具栏里只有**一个导出按钮**,菜单第一行是 **下载**,保存的是文件本身
|
|
63
|
+
而不是它的某种转换 —— 因此这一行对**所有**文件类型都在,包括本窗格不绘制的那些。
|
|
64
|
+
**它不受文件大小限制**:下载按窗口逐段读取而不是一次性读完,所以比预览上限更大的
|
|
65
|
+
文件也能正常保存——260 MB 的发布包也不例外。32 MiB 以内静默存到浏览器的下载目录;
|
|
66
|
+
超过则询问保存位置并直接流式写入,因此内存占用与文件大小无关。可以同时进行多个下载,
|
|
67
|
+
每个都有自己的进度行和 **取消**,其中一个失败不影响其余。
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
每一种文本预览还有 **复制**,复制的是文件自身的文本——渲染态的 Markdown 复制的是它的
|
|
70
|
+
Markdown 源码。
|
|
71
|
+
|
|
72
|
+
窗格里的每个控件都是图标而不是文字:名称由悬浮提示与无障碍标签给出,开关状态由填充
|
|
73
|
+
色表示。
|
|
74
|
+
|
|
75
|
+
渲染态的 Markdown 与 HTML 会在该菜单里再加两行 —— **PDF** 与 **Word** ——
|
|
76
|
+
各自 **直接下载文件**(不走打印对话框):
|
|
68
77
|
|
|
69
78
|
| 格式 | 说明 |
|
|
70
79
|
|---|---|
|
|
@@ -164,14 +173,18 @@ profile。
|
|
|
164
173
|
其中的标签不可选中,且始终以白底绘制:PDF 页面与 Word 文档都是白底,为深色窗格
|
|
165
174
|
绘制的图在它们上面会看不见。绘制范围是 Mermaid 11 支持的图表类型;语法错误的
|
|
166
175
|
图表会保留源码,并在上方说明失败原因。
|
|
167
|
-
- **Office 预览是内容,不是排版**:`.docx`
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
176
|
+
- **Office 预览是内容,不是排版**:`.docx` 显示标题、列表、引用、表格、图片,以及每段
|
|
177
|
+
文字的基础格式——粗体、斜体、下划线、删除线、上/下标、颜色、高亮——和段落的对齐
|
|
178
|
+
方式;`.xlsx` 显示单元格的值;`.pptx` 显示每页的文字与图片。**没有**的是所有需要
|
|
179
|
+
排版引擎和文件所指定字体的东西:字体与字号、行距与缩进、分栏与分页、页眉页脚、
|
|
180
|
+
表格边框与底纹、图表、SmartArt、动画。公式显示文件缓存的值,不做重算。
|
|
171
181
|
- **只读取 OOXML 格式**:`.doc`、`.xls`、`.ppt` 是更早的二进制容器,本窗格不解析
|
|
172
182
|
—— 会说明这一点并提供下载。
|
|
173
|
-
-
|
|
174
|
-
|
|
183
|
+
- **预览受「完整读取」上限约束**:官方 Web 组合默认 32 MiB,超过的 PDF 或 Office
|
|
184
|
+
包会报告被拒绝,而不是截断后显示。**下载不受此限制** —— 它按窗口分页读取 —— 所以
|
|
185
|
+
预览不了的文件仍然可以保存。
|
|
186
|
+
- **大文件下载会走浏览器的保存对话框**:超过 32 MiB 时字节流式写入你选择的文件,
|
|
187
|
+
内存占用因此恒定;不支持该 API 的浏览器会先收集文件,此时超大下载会占用等量内存。
|
|
175
188
|
- **超长文档会在 60 页 PDF 处截断**,单张超过 8 MiB 的图片会被跳过;写在这里是因为
|
|
176
189
|
静默截断会被误认为完整导出。
|
|
177
190
|
|