@lijian-ui/dsh-file-manager 0.2.2 → 0.2.4
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 +38 -38
- package/README.i18n.yaml +6 -6
- package/README.md +66 -66
- package/README.zh.md +66 -66
- package/cordis.patch.yml +13 -13
- package/lib/client.js +27354 -355
- package/lib/client.js.map +1 -1
- package/lib/index.js +474 -42
- package/lib/tsconfig.client.tsbuildinfo +1 -1
- package/lib/tsconfig.host.tsbuildinfo +1 -1
- package/lib/types/client/file-source.d.ts +10 -0
- package/lib/types/client/file-source.d.ts.map +1 -1
- package/lib/types/client/fileType.d.ts +19 -4
- package/lib/types/client/fileType.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +0 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +3 -0
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/mount.d.ts +1 -1
- package/lib/types/client/mount.d.ts.map +1 -1
- package/lib/types/client/picker/FilePickerModal.d.ts +8 -6
- package/lib/types/client/picker/FilePickerModal.d.ts.map +1 -1
- package/lib/types/client/preview/PreviewPanel.d.ts +2 -1
- package/lib/types/client/preview/PreviewPanel.d.ts.map +1 -1
- package/lib/types/client/preview/PreviewToolbar.d.ts +3 -1
- package/lib/types/client/preview/PreviewToolbar.d.ts.map +1 -1
- package/lib/types/client/preview/content.d.ts +3 -1
- package/lib/types/client/preview/content.d.ts.map +1 -1
- package/lib/types/client/preview/office.d.ts +23 -0
- package/lib/types/client/preview/office.d.ts.map +1 -0
- package/lib/types/client/reference.d.ts +23 -10
- package/lib/types/client/reference.d.ts.map +1 -1
- package/lib/types/client/store.d.ts.map +1 -1
- package/lib/types/host/fs-service.d.ts.map +1 -1
- package/lib/types/host/office-preview.d.ts +13 -0
- package/lib/types/host/office-preview.d.ts.map +1 -0
- package/lib/types/host/routes.d.ts.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +19 -4
- package/src/client/DockItem.tsx +1 -1
- package/src/client/FileManagerSettingsCard.tsx +117 -117
- package/src/client/PluginSettingsCard.tsx +337 -337
- package/src/client/chat/file-ref.ts +144 -144
- package/src/client/chat/mermaid-chat.tsx +102 -102
- package/src/client/chat/placeholder-hint.tsx +46 -46
- package/src/client/components/ExplorerPanel.tsx +534 -534
- package/src/client/components/FileIcon.tsx +46 -46
- package/src/client/components/ScmPanel.tsx +480 -480
- package/src/client/components/a11y.ts +20 -20
- package/src/client/components/icons.tsx +274 -274
- package/src/client/components/overlay.tsx +225 -225
- package/src/client/drag/DragFileInlay.tsx +89 -89
- package/src/client/drag/file-drag.ts +67 -67
- package/src/client/drag.ts +154 -154
- package/src/client/file-source.ts +34 -0
- package/src/client/fileType.ts +32 -5
- package/src/client/hooks/useResizableSplit.ts +91 -91
- package/src/client/hooks/useStore.ts +15 -15
- package/src/client/index.ts +45 -17
- package/src/client/layout.ts +523 -523
- package/src/client/locales.ts +6 -0
- package/src/client/maximize.ts +34 -34
- package/src/client/mount.tsx +2 -1
- package/src/client/persist.ts +194 -194
- package/src/client/picker/FilePickerModal.tsx +526 -507
- package/src/client/picker/file-picker.ts +86 -86
- package/src/client/preview/PreviewPanel.tsx +8 -1
- package/src/client/preview/PreviewTabs.tsx +159 -159
- package/src/client/preview/PreviewToolbar.tsx +3 -2
- package/src/client/preview/content.tsx +7 -2
- package/src/client/preview/markdown.ts +351 -351
- package/src/client/preview/mermaid.ts +274 -274
- package/src/client/preview/office.tsx +321 -0
- package/src/client/reference.ts +62 -8
- package/src/client/settings-card.module.css +316 -316
- package/src/client/settings-form.ts +451 -451
- package/src/client/store.ts +17 -12
- package/src/client/styles/drag.module.css +30 -30
- package/src/client/styles/explorer.module.css +371 -371
- package/src/client/styles/picker.module.css +344 -344
- package/src/client/styles/preview.module.css +18 -11
- package/src/client/styles/scm.module.css +380 -380
- package/src/client/styles/tokens.module.css +376 -367
- package/src/core/types.ts +162 -162
- package/src/host/fs-service.ts +7 -1
- package/src/host/gate.ts +73 -73
- package/src/host/git-runner.ts +116 -116
- package/src/host/git-service.ts +395 -395
- package/src/host/loopback.ts +63 -63
- package/src/host/office-preview.ts +399 -0
- package/src/host/poll-guard.ts +109 -109
- package/src/host/routes.ts +72 -1
- package/src/index.ts +3 -1
- package/src/mount-once.ts +48 -48
- package/lib/types/client/chat/AttachedFilesDock.d.ts +0 -51
- package/lib/types/client/chat/AttachedFilesDock.d.ts.map +0 -1
- package/lib/types/client/floating.d.ts +0 -27
- package/lib/types/client/floating.d.ts.map +0 -1
- package/lib/types/client/mention.d.ts +0 -44
- package/lib/types/client/mention.d.ts.map +0 -1
- package/src/client/styles/chip.module.css +0 -38
package/src/client/store.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import type { FileRead, FsEntry, GitStatusView, PreviewContentType, SearchHit } from '../core/types.ts'
|
|
14
14
|
import type { PanelApi } from './api.ts'
|
|
15
|
-
import { detectContentType, isTextType,
|
|
15
|
+
import { detectContentType, isStreamedType, isTextType, rawPreviewUrl, tabIdOf } from './fileType.ts'
|
|
16
16
|
import { t } from './locales.ts'
|
|
17
17
|
import {
|
|
18
18
|
createDebounced, evictPreviewScopes, readJson, readStoredNumber, writeJson, writeStoredNumber,
|
|
@@ -185,9 +185,11 @@ export function layoutSetRoot(store: LayoutStore, root: string, previewOpen: boo
|
|
|
185
185
|
let collapsed = prev.explorerCollapsed
|
|
186
186
|
if (prev.root !== root) {
|
|
187
187
|
try {
|
|
188
|
-
|
|
188
|
+
const stored = localStorage.getItem(collapseKey(root))
|
|
189
|
+
// No stored preference => default to collapsed (panel starts closed).
|
|
190
|
+
collapsed = stored === null ? true : stored === 'collapsed'
|
|
189
191
|
} catch {
|
|
190
|
-
collapsed =
|
|
192
|
+
collapsed = true
|
|
191
193
|
}
|
|
192
194
|
}
|
|
193
195
|
// Maximize is a transient layout state: it must never leak from one
|
|
@@ -897,15 +899,16 @@ export function createPreviewStore(api: PanelApi): PreviewStore {
|
|
|
897
899
|
...prev,
|
|
898
900
|
tabs: prev.tabs.map((item) => (item.id === id ? { ...item, loading: true, error: null } : item)),
|
|
899
901
|
}))
|
|
900
|
-
// Pdf tabs never fetch through /read: the raw route streams the
|
|
901
|
-
// straight into the preview iframe, so the tab content is
|
|
902
|
-
|
|
902
|
+
// Pdf/office tabs never fetch through /read: the raw route streams the
|
|
903
|
+
// bytes straight into the preview viewer/iframe, so the tab content is
|
|
904
|
+
// the route URL.
|
|
905
|
+
if (isStreamedType(tab.contentType)) {
|
|
903
906
|
handle.update((prev) => {
|
|
904
907
|
if (prev.root !== root) return prev
|
|
905
908
|
return {
|
|
906
909
|
...prev,
|
|
907
910
|
tabs: prev.tabs.map((item) => (item.id === id
|
|
908
|
-
? { ...item, loading: false, content:
|
|
911
|
+
? { ...item, loading: false, content: rawPreviewUrl(root, item.path, Date.now()), updated: false }
|
|
909
912
|
: item)),
|
|
910
913
|
}
|
|
911
914
|
})
|
|
@@ -1116,7 +1119,9 @@ export function createPreviewStore(api: PanelApi): PreviewStore {
|
|
|
1116
1119
|
async saveTab(id: string) {
|
|
1117
1120
|
const state = handle.getSnapshot()
|
|
1118
1121
|
const tab = state.tabs.find((item) => item.id === id)
|
|
1119
|
-
if (tab === undefined || tab.content === null ||
|
|
1122
|
+
if (tab === undefined || tab.content === null || tab.diff !== undefined) return
|
|
1123
|
+
// Text (and other line-based) tabs save through the plain write route.
|
|
1124
|
+
if (!isTextType(tab.contentType)) return
|
|
1120
1125
|
const sentContent = tab.content
|
|
1121
1126
|
handle.update((prev) => ({
|
|
1122
1127
|
...prev,
|
|
@@ -1165,13 +1170,13 @@ export function createPreviewStore(api: PanelApi): PreviewStore {
|
|
|
1165
1170
|
}))
|
|
1166
1171
|
return
|
|
1167
1172
|
}
|
|
1168
|
-
if (tab.contentType
|
|
1169
|
-
// Streamed tab: re-point the iframe at the raw route with a
|
|
1170
|
-
// nonce so the browser re-fetches the bytes (no /read round-trip).
|
|
1173
|
+
if (isStreamedType(tab.contentType)) {
|
|
1174
|
+
// Streamed tab: re-point the viewer/iframe at the raw route with a
|
|
1175
|
+
// fresh nonce so the browser re-fetches the bytes (no /read round-trip).
|
|
1171
1176
|
handle.update((prev) => ({
|
|
1172
1177
|
...prev,
|
|
1173
1178
|
tabs: prev.tabs.map((item) => (item.id === id
|
|
1174
|
-
? { ...item, content:
|
|
1179
|
+
? { ...item, content: rawPreviewUrl(state.root, item.path, Date.now()), updated: false, error: null }
|
|
1175
1180
|
: item)),
|
|
1176
1181
|
}))
|
|
1177
1182
|
return
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Composer dock drag inlay: a zero-height strip above the composer card
|
|
3
|
-
* that appears while an explorer file row is dragged over the page. Uses
|
|
4
|
-
* the panel's own token palette so the hint follows the active theme.
|
|
5
|
-
* @module dsh-filemgr/client/styles/drag
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
.strip {
|
|
9
|
-
display: none;
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
width: 100%;
|
|
12
|
-
max-width: var(--dsh-composer-card-max-width, 720px);
|
|
13
|
-
align-items: center;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
margin: 0 auto;
|
|
16
|
-
border: 1px dashed var(--aion-primary);
|
|
17
|
-
border-radius: 8px;
|
|
18
|
-
color: var(--aion-text-primary);
|
|
19
|
-
background-color: color-mix(in srgb, var(--aion-primary) 10%, transparent);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.stripActive {
|
|
23
|
-
display: flex;
|
|
24
|
-
height: 26px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.stripText {
|
|
28
|
-
font-size: 12px;
|
|
29
|
-
line-height: 18px;
|
|
30
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Composer dock drag inlay: a zero-height strip above the composer card
|
|
3
|
+
* that appears while an explorer file row is dragged over the page. Uses
|
|
4
|
+
* the panel's own token palette so the hint follows the active theme.
|
|
5
|
+
* @module dsh-filemgr/client/styles/drag
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.strip {
|
|
9
|
+
display: none;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
width: 100%;
|
|
12
|
+
max-width: var(--dsh-composer-card-max-width, 720px);
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
margin: 0 auto;
|
|
16
|
+
border: 1px dashed var(--aion-primary);
|
|
17
|
+
border-radius: 8px;
|
|
18
|
+
color: var(--aion-text-primary);
|
|
19
|
+
background-color: color-mix(in srgb, var(--aion-primary) 10%, transparent);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.stripActive {
|
|
23
|
+
display: flex;
|
|
24
|
+
height: 26px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.stripText {
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
line-height: 18px;
|
|
30
|
+
}
|