@lijian-ui/dsh-file-manager 0.2.3 → 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 (96) 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 +27305 -270
  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.map +1 -1
  16. package/lib/types/client/locales.d.ts +3 -0
  17. package/lib/types/client/locales.d.ts.map +1 -1
  18. package/lib/types/client/mount.d.ts +1 -1
  19. package/lib/types/client/mount.d.ts.map +1 -1
  20. package/lib/types/client/preview/PreviewPanel.d.ts +2 -1
  21. package/lib/types/client/preview/PreviewPanel.d.ts.map +1 -1
  22. package/lib/types/client/preview/PreviewToolbar.d.ts +3 -1
  23. package/lib/types/client/preview/PreviewToolbar.d.ts.map +1 -1
  24. package/lib/types/client/preview/content.d.ts +3 -1
  25. package/lib/types/client/preview/content.d.ts.map +1 -1
  26. package/lib/types/client/preview/office.d.ts +23 -0
  27. package/lib/types/client/preview/office.d.ts.map +1 -0
  28. package/lib/types/client/reference.d.ts +17 -0
  29. package/lib/types/client/reference.d.ts.map +1 -1
  30. package/lib/types/client/store.d.ts.map +1 -1
  31. package/lib/types/host/fs-service.d.ts.map +1 -1
  32. package/lib/types/host/office-preview.d.ts +13 -0
  33. package/lib/types/host/office-preview.d.ts.map +1 -0
  34. package/lib/types/host/routes.d.ts.map +1 -1
  35. package/lib/types/index.d.ts.map +1 -1
  36. package/package.json +19 -4
  37. package/src/client/FileManagerSettingsCard.tsx +117 -117
  38. package/src/client/PluginSettingsCard.tsx +337 -337
  39. package/src/client/chat/file-ref.ts +144 -144
  40. package/src/client/chat/mermaid-chat.tsx +102 -102
  41. package/src/client/chat/placeholder-hint.tsx +46 -46
  42. package/src/client/components/ExplorerPanel.tsx +534 -534
  43. package/src/client/components/FileIcon.tsx +46 -46
  44. package/src/client/components/ScmPanel.tsx +480 -480
  45. package/src/client/components/a11y.ts +20 -20
  46. package/src/client/components/icons.tsx +274 -274
  47. package/src/client/components/overlay.tsx +225 -225
  48. package/src/client/drag/DragFileInlay.tsx +89 -89
  49. package/src/client/drag/file-drag.ts +67 -67
  50. package/src/client/drag.ts +154 -154
  51. package/src/client/file-source.ts +34 -0
  52. package/src/client/fileType.ts +32 -5
  53. package/src/client/hooks/useResizableSplit.ts +91 -91
  54. package/src/client/hooks/useStore.ts +15 -15
  55. package/src/client/index.ts +42 -3
  56. package/src/client/layout.ts +523 -523
  57. package/src/client/locales.ts +6 -0
  58. package/src/client/maximize.ts +34 -34
  59. package/src/client/mount.tsx +2 -1
  60. package/src/client/persist.ts +194 -194
  61. package/src/client/picker/FilePickerModal.tsx +526 -526
  62. package/src/client/picker/file-picker.ts +86 -86
  63. package/src/client/preview/PreviewPanel.tsx +7 -1
  64. package/src/client/preview/PreviewTabs.tsx +159 -159
  65. package/src/client/preview/PreviewToolbar.tsx +3 -2
  66. package/src/client/preview/content.tsx +7 -2
  67. package/src/client/preview/markdown.ts +351 -351
  68. package/src/client/preview/mermaid.ts +274 -274
  69. package/src/client/preview/office.tsx +321 -0
  70. package/src/client/reference.ts +49 -0
  71. package/src/client/settings-card.module.css +316 -316
  72. package/src/client/settings-form.ts +451 -451
  73. package/src/client/store.ts +17 -12
  74. package/src/client/styles/drag.module.css +30 -30
  75. package/src/client/styles/explorer.module.css +371 -371
  76. package/src/client/styles/picker.module.css +344 -344
  77. package/src/client/styles/preview.module.css +3 -1
  78. package/src/client/styles/scm.module.css +380 -380
  79. package/src/client/styles/tokens.module.css +376 -371
  80. package/src/core/types.ts +162 -162
  81. package/src/host/fs-service.ts +7 -1
  82. package/src/host/gate.ts +73 -73
  83. package/src/host/git-runner.ts +116 -116
  84. package/src/host/git-service.ts +395 -395
  85. package/src/host/loopback.ts +63 -63
  86. package/src/host/office-preview.ts +399 -0
  87. package/src/host/poll-guard.ts +109 -109
  88. package/src/host/routes.ts +72 -1
  89. package/src/index.ts +3 -1
  90. package/src/mount-once.ts +48 -48
  91. package/lib/types/client/chat/AttachedFilesDock.d.ts +0 -51
  92. package/lib/types/client/chat/AttachedFilesDock.d.ts.map +0 -1
  93. package/lib/types/client/floating.d.ts +0 -27
  94. package/lib/types/client/floating.d.ts.map +0 -1
  95. package/lib/types/client/mention.d.ts +0 -44
  96. package/lib/types/client/mention.d.ts.map +0 -1
@@ -1,116 +1,116 @@
1
- // Generated by scripts/sync-shared.mjs from shared/host/git-runner.ts. Do not edit this copy; edit the shared source and run "node scripts/sync-shared.mjs".
2
- /**
3
- * Shared host git subprocess plumbing: the run result shape, the runner seam,
4
- * the collected-output cap, and the production runner over the subprocess
5
- * service. Packages receive this file as a generated copy via
6
- * scripts/sync-shared.mjs; edit the shared source and re-run the sync instead
7
- * of editing a copy.
8
- *
9
- * The context shape is declared structurally so this module stays
10
- * self-contained (shared/ has no cordis dependency): any context whose
11
- * `subprocess` satisfies SubprocessServiceLike works, which the plugin
12
- * contexts do.
13
- * @module dsh-web-ui-shared/host/git-runner
14
- */
15
-
16
- /** One finished git invocation. */
17
- export interface GitRunResult {
18
- exitCode: number | null
19
- stdout: string
20
- stderr: string
21
- }
22
-
23
- /** The spawn seam the service runs git through (subprocess service in production). */
24
- export interface GitRunner {
25
- run(argv: readonly string[], cwd: string): Promise<GitRunResult>
26
- }
27
-
28
- /** Collected-output cap for one git command. */
29
- export const OUTPUT_CAP_BYTES = 1 << 20
30
-
31
- /** The subprocess service surface this runner consumes (structural). */
32
- export interface SubprocessServiceLike {
33
- spawn(spec: {
34
- argv: readonly string[]
35
- cwd: string
36
- stdio: {
37
- stdin: 'ignore'
38
- stdout: { maxBytes: number }
39
- stderr: { maxBytes: number }
40
- }
41
- graceMs: number
42
- }): {
43
- done: Promise<{ exitCode: number | null }>
44
- collected: {
45
- stdout?: { readFrom(offset: number): { text: string } }
46
- stderr?: { readFrom(offset: number): { text: string } }
47
- }
48
- }
49
- }
50
-
51
- /** Per-package knobs for the shared production runner. */
52
- export interface GitRunnerOptions {
53
- /** Build the full spawn argv from the git args (default ['git', ...argv]). */
54
- spawnArgv?: (argv: readonly string[]) => readonly string[]
55
- /** degrade turns spawn/run failures into exitCode 127 results instead of throwing. */
56
- failureMode?: 'throw' | 'degrade'
57
- /** console.error tag for degrade mode. */
58
- errorTag?: string
59
- }
60
-
61
- /**
62
- * Production runner over the subprocess service: one managed child per
63
- * command, bounded collect on both streams. Degrade mode keeps the SCM tab
64
- * showing the friendly "not a git repository" state instead of a bare 400
65
- * when git is missing or the subprocess service fails.
66
- * @param ctx - context carrying the subprocess service.
67
- * @param options - per-package behavior knobs.
68
- * @returns the runner.
69
- */
70
- export function subprocessRunner(ctx: { subprocess: SubprocessServiceLike }, options: GitRunnerOptions = {}): GitRunner {
71
- const spawnArgv = options.spawnArgv ?? ((argv) => ['git', ...argv])
72
- const degrade = options.failureMode === 'degrade'
73
- const errorTag = options.errorTag ?? 'git'
74
- const failure = (prefix: string, error: unknown): GitRunResult => ({
75
- exitCode: 127,
76
- stdout: '',
77
- stderr: prefix + (error instanceof Error ? error.message : String(error)),
78
- })
79
- return {
80
- async run(argv, cwd) {
81
- const spec = {
82
- argv: spawnArgv(argv),
83
- cwd,
84
- stdio: {
85
- stdin: 'ignore' as const,
86
- stdout: { maxBytes: OUTPUT_CAP_BYTES },
87
- stderr: { maxBytes: OUTPUT_CAP_BYTES },
88
- },
89
- graceMs: 10_000,
90
- }
91
- if (degrade) {
92
- let handle
93
- try {
94
- handle = ctx.subprocess.spawn(spec)
95
- } catch (error) {
96
- console.error('[' + errorTag + '] git spawn failed:', error)
97
- return failure('git: spawn failed: ', error)
98
- }
99
- try {
100
- const outcome = await handle.done
101
- const stdout = handle.collected.stdout?.readFrom(0).text ?? ''
102
- const stderr = handle.collected.stderr?.readFrom(0).text ?? ''
103
- return { exitCode: outcome.exitCode, stdout, stderr }
104
- } catch (error) {
105
- console.error('[' + errorTag + '] git run failed:', error)
106
- return failure('git: run failed: ', error)
107
- }
108
- }
109
- const handle = ctx.subprocess.spawn(spec)
110
- const outcome = await handle.done
111
- const stdout = handle.collected.stdout?.readFrom(0).text ?? ''
112
- const stderr = handle.collected.stderr?.readFrom(0).text ?? ''
113
- return { exitCode: outcome.exitCode, stdout, stderr }
114
- },
115
- }
116
- }
1
+ // Generated by scripts/sync-shared.mjs from shared/host/git-runner.ts. Do not edit this copy; edit the shared source and run "node scripts/sync-shared.mjs".
2
+ /**
3
+ * Shared host git subprocess plumbing: the run result shape, the runner seam,
4
+ * the collected-output cap, and the production runner over the subprocess
5
+ * service. Packages receive this file as a generated copy via
6
+ * scripts/sync-shared.mjs; edit the shared source and re-run the sync instead
7
+ * of editing a copy.
8
+ *
9
+ * The context shape is declared structurally so this module stays
10
+ * self-contained (shared/ has no cordis dependency): any context whose
11
+ * `subprocess` satisfies SubprocessServiceLike works, which the plugin
12
+ * contexts do.
13
+ * @module dsh-web-ui-shared/host/git-runner
14
+ */
15
+
16
+ /** One finished git invocation. */
17
+ export interface GitRunResult {
18
+ exitCode: number | null
19
+ stdout: string
20
+ stderr: string
21
+ }
22
+
23
+ /** The spawn seam the service runs git through (subprocess service in production). */
24
+ export interface GitRunner {
25
+ run(argv: readonly string[], cwd: string): Promise<GitRunResult>
26
+ }
27
+
28
+ /** Collected-output cap for one git command. */
29
+ export const OUTPUT_CAP_BYTES = 1 << 20
30
+
31
+ /** The subprocess service surface this runner consumes (structural). */
32
+ export interface SubprocessServiceLike {
33
+ spawn(spec: {
34
+ argv: readonly string[]
35
+ cwd: string
36
+ stdio: {
37
+ stdin: 'ignore'
38
+ stdout: { maxBytes: number }
39
+ stderr: { maxBytes: number }
40
+ }
41
+ graceMs: number
42
+ }): {
43
+ done: Promise<{ exitCode: number | null }>
44
+ collected: {
45
+ stdout?: { readFrom(offset: number): { text: string } }
46
+ stderr?: { readFrom(offset: number): { text: string } }
47
+ }
48
+ }
49
+ }
50
+
51
+ /** Per-package knobs for the shared production runner. */
52
+ export interface GitRunnerOptions {
53
+ /** Build the full spawn argv from the git args (default ['git', ...argv]). */
54
+ spawnArgv?: (argv: readonly string[]) => readonly string[]
55
+ /** degrade turns spawn/run failures into exitCode 127 results instead of throwing. */
56
+ failureMode?: 'throw' | 'degrade'
57
+ /** console.error tag for degrade mode. */
58
+ errorTag?: string
59
+ }
60
+
61
+ /**
62
+ * Production runner over the subprocess service: one managed child per
63
+ * command, bounded collect on both streams. Degrade mode keeps the SCM tab
64
+ * showing the friendly "not a git repository" state instead of a bare 400
65
+ * when git is missing or the subprocess service fails.
66
+ * @param ctx - context carrying the subprocess service.
67
+ * @param options - per-package behavior knobs.
68
+ * @returns the runner.
69
+ */
70
+ export function subprocessRunner(ctx: { subprocess: SubprocessServiceLike }, options: GitRunnerOptions = {}): GitRunner {
71
+ const spawnArgv = options.spawnArgv ?? ((argv) => ['git', ...argv])
72
+ const degrade = options.failureMode === 'degrade'
73
+ const errorTag = options.errorTag ?? 'git'
74
+ const failure = (prefix: string, error: unknown): GitRunResult => ({
75
+ exitCode: 127,
76
+ stdout: '',
77
+ stderr: prefix + (error instanceof Error ? error.message : String(error)),
78
+ })
79
+ return {
80
+ async run(argv, cwd) {
81
+ const spec = {
82
+ argv: spawnArgv(argv),
83
+ cwd,
84
+ stdio: {
85
+ stdin: 'ignore' as const,
86
+ stdout: { maxBytes: OUTPUT_CAP_BYTES },
87
+ stderr: { maxBytes: OUTPUT_CAP_BYTES },
88
+ },
89
+ graceMs: 10_000,
90
+ }
91
+ if (degrade) {
92
+ let handle
93
+ try {
94
+ handle = ctx.subprocess.spawn(spec)
95
+ } catch (error) {
96
+ console.error('[' + errorTag + '] git spawn failed:', error)
97
+ return failure('git: spawn failed: ', error)
98
+ }
99
+ try {
100
+ const outcome = await handle.done
101
+ const stdout = handle.collected.stdout?.readFrom(0).text ?? ''
102
+ const stderr = handle.collected.stderr?.readFrom(0).text ?? ''
103
+ return { exitCode: outcome.exitCode, stdout, stderr }
104
+ } catch (error) {
105
+ console.error('[' + errorTag + '] git run failed:', error)
106
+ return failure('git: run failed: ', error)
107
+ }
108
+ }
109
+ const handle = ctx.subprocess.spawn(spec)
110
+ const outcome = await handle.done
111
+ const stdout = handle.collected.stdout?.readFrom(0).text ?? ''
112
+ const stderr = handle.collected.stderr?.readFrom(0).text ?? ''
113
+ return { exitCode: outcome.exitCode, stdout, stderr }
114
+ },
115
+ }
116
+ }