@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.
Files changed (101) hide show
  1. package/LICENSE +38 -38
  2. package/README.i18n.yaml +6 -6
  3. package/README.md +66 -66
  4. package/README.zh.md +66 -66
  5. package/cordis.patch.yml +13 -13
  6. package/lib/client.js +27354 -355
  7. package/lib/client.js.map +1 -1
  8. package/lib/index.js +474 -42
  9. package/lib/tsconfig.client.tsbuildinfo +1 -1
  10. package/lib/tsconfig.host.tsbuildinfo +1 -1
  11. package/lib/types/client/file-source.d.ts +10 -0
  12. package/lib/types/client/file-source.d.ts.map +1 -1
  13. package/lib/types/client/fileType.d.ts +19 -4
  14. package/lib/types/client/fileType.d.ts.map +1 -1
  15. package/lib/types/client/index.d.ts +0 -1
  16. package/lib/types/client/index.d.ts.map +1 -1
  17. package/lib/types/client/locales.d.ts +3 -0
  18. package/lib/types/client/locales.d.ts.map +1 -1
  19. package/lib/types/client/mount.d.ts +1 -1
  20. package/lib/types/client/mount.d.ts.map +1 -1
  21. package/lib/types/client/picker/FilePickerModal.d.ts +8 -6
  22. package/lib/types/client/picker/FilePickerModal.d.ts.map +1 -1
  23. package/lib/types/client/preview/PreviewPanel.d.ts +2 -1
  24. package/lib/types/client/preview/PreviewPanel.d.ts.map +1 -1
  25. package/lib/types/client/preview/PreviewToolbar.d.ts +3 -1
  26. package/lib/types/client/preview/PreviewToolbar.d.ts.map +1 -1
  27. package/lib/types/client/preview/content.d.ts +3 -1
  28. package/lib/types/client/preview/content.d.ts.map +1 -1
  29. package/lib/types/client/preview/office.d.ts +23 -0
  30. package/lib/types/client/preview/office.d.ts.map +1 -0
  31. package/lib/types/client/reference.d.ts +23 -10
  32. package/lib/types/client/reference.d.ts.map +1 -1
  33. package/lib/types/client/store.d.ts.map +1 -1
  34. package/lib/types/host/fs-service.d.ts.map +1 -1
  35. package/lib/types/host/office-preview.d.ts +13 -0
  36. package/lib/types/host/office-preview.d.ts.map +1 -0
  37. package/lib/types/host/routes.d.ts.map +1 -1
  38. package/lib/types/index.d.ts.map +1 -1
  39. package/package.json +19 -4
  40. package/src/client/DockItem.tsx +1 -1
  41. package/src/client/FileManagerSettingsCard.tsx +117 -117
  42. package/src/client/PluginSettingsCard.tsx +337 -337
  43. package/src/client/chat/file-ref.ts +144 -144
  44. package/src/client/chat/mermaid-chat.tsx +102 -102
  45. package/src/client/chat/placeholder-hint.tsx +46 -46
  46. package/src/client/components/ExplorerPanel.tsx +534 -534
  47. package/src/client/components/FileIcon.tsx +46 -46
  48. package/src/client/components/ScmPanel.tsx +480 -480
  49. package/src/client/components/a11y.ts +20 -20
  50. package/src/client/components/icons.tsx +274 -274
  51. package/src/client/components/overlay.tsx +225 -225
  52. package/src/client/drag/DragFileInlay.tsx +89 -89
  53. package/src/client/drag/file-drag.ts +67 -67
  54. package/src/client/drag.ts +154 -154
  55. package/src/client/file-source.ts +34 -0
  56. package/src/client/fileType.ts +32 -5
  57. package/src/client/hooks/useResizableSplit.ts +91 -91
  58. package/src/client/hooks/useStore.ts +15 -15
  59. package/src/client/index.ts +45 -17
  60. package/src/client/layout.ts +523 -523
  61. package/src/client/locales.ts +6 -0
  62. package/src/client/maximize.ts +34 -34
  63. package/src/client/mount.tsx +2 -1
  64. package/src/client/persist.ts +194 -194
  65. package/src/client/picker/FilePickerModal.tsx +526 -507
  66. package/src/client/picker/file-picker.ts +86 -86
  67. package/src/client/preview/PreviewPanel.tsx +8 -1
  68. package/src/client/preview/PreviewTabs.tsx +159 -159
  69. package/src/client/preview/PreviewToolbar.tsx +3 -2
  70. package/src/client/preview/content.tsx +7 -2
  71. package/src/client/preview/markdown.ts +351 -351
  72. package/src/client/preview/mermaid.ts +274 -274
  73. package/src/client/preview/office.tsx +321 -0
  74. package/src/client/reference.ts +62 -8
  75. package/src/client/settings-card.module.css +316 -316
  76. package/src/client/settings-form.ts +451 -451
  77. package/src/client/store.ts +17 -12
  78. package/src/client/styles/drag.module.css +30 -30
  79. package/src/client/styles/explorer.module.css +371 -371
  80. package/src/client/styles/picker.module.css +344 -344
  81. package/src/client/styles/preview.module.css +18 -11
  82. package/src/client/styles/scm.module.css +380 -380
  83. package/src/client/styles/tokens.module.css +376 -367
  84. package/src/core/types.ts +162 -162
  85. package/src/host/fs-service.ts +7 -1
  86. package/src/host/gate.ts +73 -73
  87. package/src/host/git-runner.ts +116 -116
  88. package/src/host/git-service.ts +395 -395
  89. package/src/host/loopback.ts +63 -63
  90. package/src/host/office-preview.ts +399 -0
  91. package/src/host/poll-guard.ts +109 -109
  92. package/src/host/routes.ts +72 -1
  93. package/src/index.ts +3 -1
  94. package/src/mount-once.ts +48 -48
  95. package/lib/types/client/chat/AttachedFilesDock.d.ts +0 -51
  96. package/lib/types/client/chat/AttachedFilesDock.d.ts.map +0 -1
  97. package/lib/types/client/floating.d.ts +0 -27
  98. package/lib/types/client/floating.d.ts.map +0 -1
  99. package/lib/types/client/mention.d.ts +0 -44
  100. package/lib/types/client/mention.d.ts.map +0 -1
  101. package/src/client/styles/chip.module.css +0 -38
@@ -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, pdfPreviewUrl, tabIdOf } from './fileType.ts'
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
- collapsed = localStorage.getItem(collapseKey(root)) === 'collapsed'
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 = false
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 bytes
901
- // straight into the preview iframe, so the tab content is the route URL.
902
- if (tab.contentType === 'pdf') {
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: pdfPreviewUrl(root, item.path, Date.now()), updated: false }
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 || !isTextType(tab.contentType) || tab.diff !== undefined) return
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 === 'pdf') {
1169
- // Streamed tab: re-point the iframe at the raw route with a fresh
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: pdfPreviewUrl(state.root, item.path, Date.now()), updated: false, error: null }
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
+ }