@eternalheart/react-file-preview 1.1.5 → 1.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.
Files changed (85) hide show
  1. package/README.md +67 -2
  2. package/README.zh-CN.md +67 -2
  3. package/lib/FilePreviewContent.d.ts +8 -0
  4. package/lib/FilePreviewContent.d.ts.map +1 -1
  5. package/lib/FilePreviewEmbed.d.ts +5 -0
  6. package/lib/FilePreviewEmbed.d.ts.map +1 -1
  7. package/lib/FilePreviewModal.d.ts +5 -0
  8. package/lib/FilePreviewModal.d.ts.map +1 -1
  9. package/lib/components/ResizableSplit.d.ts +29 -0
  10. package/lib/components/ResizableSplit.d.ts.map +1 -0
  11. package/lib/hooks/useAudioPlayer.d.ts.map +1 -0
  12. package/lib/i18n/LocaleContext.d.ts +25 -0
  13. package/lib/i18n/LocaleContext.d.ts.map +1 -0
  14. package/lib/index.cjs +254 -22
  15. package/lib/index.cjs.map +1 -1
  16. package/lib/index.css +1 -1
  17. package/lib/index.d.ts +3 -0
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib/index.mjs +36798 -20162
  20. package/lib/index.mjs.map +1 -1
  21. package/lib/renderers/{AudioRenderer.d.ts → Audio/index.d.ts} +1 -1
  22. package/lib/renderers/Audio/index.d.ts.map +1 -0
  23. package/lib/renderers/Csv/index.d.ts +7 -0
  24. package/lib/renderers/Csv/index.d.ts.map +1 -0
  25. package/lib/renderers/{DocxRenderer.d.ts → Docx/index.d.ts} +1 -1
  26. package/lib/renderers/Docx/index.d.ts.map +1 -0
  27. package/lib/renderers/{EpubRenderer.d.ts → Epub/index.d.ts} +3 -3
  28. package/lib/renderers/Epub/index.d.ts.map +1 -0
  29. package/lib/renderers/Epub/toolbar.d.ts +13 -0
  30. package/lib/renderers/Epub/toolbar.d.ts.map +1 -0
  31. package/lib/renderers/{ImageRenderer.d.ts → Image/index.d.ts} +1 -1
  32. package/lib/renderers/Image/index.d.ts.map +1 -0
  33. package/lib/renderers/Image/toolbar.d.ts +15 -0
  34. package/lib/renderers/Image/toolbar.d.ts.map +1 -0
  35. package/lib/renderers/Json/index.d.ts +7 -0
  36. package/lib/renderers/Json/index.d.ts.map +1 -0
  37. package/lib/renderers/{MarkdownRenderer.d.ts → Markdown/index.d.ts} +1 -1
  38. package/lib/renderers/Markdown/index.d.ts.map +1 -0
  39. package/lib/renderers/Mobi/index.d.ts +15 -0
  40. package/lib/renderers/Mobi/index.d.ts.map +1 -0
  41. package/lib/renderers/Mobi/toolbar.d.ts +13 -0
  42. package/lib/renderers/Mobi/toolbar.d.ts.map +1 -0
  43. package/lib/renderers/{MsgRenderer.d.ts → Msg/index.d.ts} +1 -1
  44. package/lib/renderers/Msg/index.d.ts.map +1 -0
  45. package/lib/renderers/{PdfRenderer.d.ts → Pdf/index.d.ts} +2 -4
  46. package/lib/renderers/Pdf/index.d.ts.map +1 -0
  47. package/lib/renderers/Pdf/toolbar.d.ts +11 -0
  48. package/lib/renderers/Pdf/toolbar.d.ts.map +1 -0
  49. package/lib/renderers/{PptxRenderer.d.ts → Pptx/index.d.ts} +1 -1
  50. package/lib/renderers/Pptx/index.d.ts.map +1 -0
  51. package/lib/renderers/Subtitle/index.d.ts +7 -0
  52. package/lib/renderers/Subtitle/index.d.ts.map +1 -0
  53. package/lib/renderers/{TextRenderer.d.ts → Text/index.d.ts} +3 -1
  54. package/lib/renderers/Text/index.d.ts.map +1 -0
  55. package/lib/renderers/Text/toolbar.d.ts +12 -0
  56. package/lib/renderers/Text/toolbar.d.ts.map +1 -0
  57. package/lib/renderers/{UnsupportedRenderer.d.ts → Unsupported/index.d.ts} +1 -1
  58. package/lib/renderers/Unsupported/index.d.ts.map +1 -0
  59. package/lib/renderers/{VideoRenderer.d.ts → Video/index.d.ts} +1 -1
  60. package/lib/renderers/Video/index.d.ts.map +1 -0
  61. package/lib/renderers/{XlsxRenderer.d.ts → Xlsx/index.d.ts} +2 -1
  62. package/lib/renderers/Xlsx/index.d.ts.map +1 -0
  63. package/lib/renderers/Xml/index.d.ts +7 -0
  64. package/lib/renderers/Xml/index.d.ts.map +1 -0
  65. package/lib/renderers/Zip/index.d.ts +12 -0
  66. package/lib/renderers/Zip/index.d.ts.map +1 -0
  67. package/lib/renderers/Zip/toolbar.d.ts +13 -0
  68. package/lib/renderers/Zip/toolbar.d.ts.map +1 -0
  69. package/lib/renderers/toolbar.types.d.ts +17 -0
  70. package/lib/renderers/toolbar.types.d.ts.map +1 -0
  71. package/package.json +6 -4
  72. package/lib/renderers/AudioRenderer.d.ts.map +0 -1
  73. package/lib/renderers/DocxRenderer.d.ts.map +0 -1
  74. package/lib/renderers/EpubRenderer.d.ts.map +0 -1
  75. package/lib/renderers/ImageRenderer.d.ts.map +0 -1
  76. package/lib/renderers/MarkdownRenderer.d.ts.map +0 -1
  77. package/lib/renderers/MsgRenderer.d.ts.map +0 -1
  78. package/lib/renderers/PdfRenderer.d.ts.map +0 -1
  79. package/lib/renderers/PptxRenderer.d.ts.map +0 -1
  80. package/lib/renderers/TextRenderer.d.ts.map +0 -1
  81. package/lib/renderers/UnsupportedRenderer.d.ts.map +0 -1
  82. package/lib/renderers/VideoRenderer.d.ts.map +0 -1
  83. package/lib/renderers/XlsxRenderer.d.ts.map +0 -1
  84. package/lib/renderers/hooks/useAudioPlayer.d.ts.map +0 -1
  85. /package/lib/{renderers/hooks → hooks}/useAudioPlayer.d.ts +0 -0
package/README.md CHANGED
@@ -307,7 +307,27 @@ const files = [
307
307
  ### Code & Text
308
308
  - **Markdown**: GitHub Flavored Markdown, code highlighting
309
309
  - **Code Files**: JS, TS, Python, Java, C++, Go, Rust, and 40+ languages
310
- - **Text Files**: TXT, LOG, CSV, JSON, YAML, XML, etc.
310
+ - **Config/Logs**: YAML, TOML, INI, ENV, LOG, DIFF, PATCH, etc.
311
+
312
+ ### Structured Data
313
+ - **JSON**: Auto formatting + syntax highlighting
314
+ - **CSV/TSV**: Zero-dependency parser, table view with headers and row/column stats
315
+ - **XML**: `DOMParser` validation + pretty print + syntax highlighting
316
+
317
+ ### Subtitles & Lyrics
318
+ - **SRT / WebVTT**: Zero-dependency parser, structured cue list (index, time range, text)
319
+ - **LRC / Enhanced LRC**: Lyric files with `[mm:ss.xx]` line stamps (and inline `<mm:ss.xx>` per-word stamps for ELRC), with `[ti:][ar:][al:]` metadata header
320
+ - **ASS / SSA**: Advanced SubStation Alpha — extracts Dialogue events, strips `\N` `\h` and `{...}` override codes, surfaces Style names
321
+ - **TTML / DFXP**: W3C / Apple Music XML captions, supports `begin` / `end` / `dur` and `<br/>`
322
+
323
+ ### Archives
324
+ - **ZIP**: Tree view + inline preview for text/code/image entries, download fallback for other types
325
+
326
+ ### Outlook Email
327
+ - **MSG**: Headers, body rendering, attachment list
328
+
329
+ ### E-books
330
+ - **EPUB**: Chapter navigation, pagination
311
331
 
312
332
  ## 🎮 API Reference
313
333
 
@@ -321,6 +341,8 @@ const files = [
321
341
  | `onClose` | `() => void` | ✅ | Close callback |
322
342
  | `onNavigate` | `(index: number) => void` | ❌ | Navigation callback |
323
343
  | `customRenderers` | `CustomRenderer[]` | ❌ | Custom renderers for specific file types |
344
+ | `locale` | `Locale` | ❌ | UI language (`'zh-CN'` default, `'en-US'` built-in) |
345
+ | `messages` | `Partial<Record<Locale, Partial<Messages>>>` | ❌ | Custom translation overrides |
324
346
 
325
347
  ### FilePreviewEmbed Props
326
348
 
@@ -334,6 +356,8 @@ const files = [
334
356
  | `height` | `number \| string` | ❌ | `'100%'` | Container height |
335
357
  | `className` | `string` | ❌ | - | Extra class on the root wrapper |
336
358
  | `style` | `CSSProperties` | ❌ | - | Extra inline style on the root wrapper |
359
+ | `locale` | `Locale` | ❌ | `'zh-CN'` | UI language (`'zh-CN'` or `'en-US'`) |
360
+ | `messages` | `Partial<Record<Locale, Partial<Messages>>>` | ❌ | - | Custom translation overrides |
337
361
 
338
362
  > `FilePreviewEmbed` has no `isOpen` / `onClose`. To hide/show it, conditionally render it from the parent. It also hides the close button in the toolbar.
339
363
 
@@ -422,7 +446,48 @@ const files = [
422
446
  #### Text Files
423
447
  - **Markdown**: File extensions `.md` or `.markdown`
424
448
  - **Code**: Auto-detected by file extension (`.js`, `.ts`, `.py`, `.java`, etc.)
425
- - **Plain Text**: `text/plain`, `text/csv`, etc.
449
+ - **Config / Logs**: `.yaml`, `.yml`, `.toml`, `.ini`, `.conf`, `.env`, `.log`, `.diff`, `.patch`
450
+ - **Plain Text**: `text/plain`
451
+
452
+ #### Structured Data
453
+ - **JSON**: `application/json` (.json)
454
+ - **CSV / TSV**: `text/csv` (.csv), `text/tab-separated-values` (.tsv)
455
+ - **XML**: `application/xml`, `text/xml` (.xml)
456
+
457
+ #### Subtitles & Lyrics
458
+ - **SRT**: `application/x-subrip` (.srt)
459
+ - **WebVTT**: `text/vtt` (.vtt)
460
+ - **LRC**: (.lrc)
461
+ - **Enhanced LRC**: (.elrc)
462
+ - **ASS / SSA**: (.ass, .ssa)
463
+ - **TTML / DFXP**: `application/ttml+xml` (.ttml, .dfxp)
464
+
465
+ #### Archives
466
+ - **ZIP**: `application/zip`, `application/x-zip-compressed` (.zip)
467
+
468
+ #### Outlook Email
469
+ - **MSG**: `application/vnd.ms-outlook` (.msg)
470
+
471
+ #### E-books
472
+ - **EPUB**: `application/epub+zip` (.epub)
473
+
474
+ ## 🌐 Internationalization (i18n)
475
+
476
+ Built-in support for Chinese (default) and English. Zero external dependencies.
477
+
478
+ ```tsx
479
+ // Switch to English
480
+ <FilePreviewModal files={files} locale="en-US" ... />
481
+
482
+ // Override specific translations
483
+ <FilePreviewModal
484
+ files={files}
485
+ locale="en-US"
486
+ messages={{ 'en-US': { 'toolbar.zoom_in': 'Zoom ++' } }}
487
+ />
488
+ ```
489
+
490
+ Use `useTranslator()` hook in custom renderers to access the translation function.
426
491
 
427
492
  ## 🎨 Custom Styling
428
493
 
package/README.zh-CN.md CHANGED
@@ -305,7 +305,27 @@ const files = [
305
305
  ### 代码 & 文本
306
306
  - **Markdown**: GitHub Flavored Markdown,代码高亮
307
307
  - **代码文件**: JS, TS, Python, Java, C++, Go, Rust 等 40+ 种语言
308
- - **文本文件**: TXT, LOG, CSV, JSON, YAML, XML
308
+ - **配置 / 日志**: YAML, TOML, INI, ENV, LOG, DIFF, PATCH
309
+
310
+ ### 结构化数据
311
+ - **JSON**: 自动格式化 + 语法高亮
312
+ - **CSV / TSV**: 零依赖解析,表格视图 + 行列统计
313
+ - **XML**: `DOMParser` 校验 + 自动缩进 + 语法高亮
314
+
315
+ ### 字幕 / 歌词
316
+ - **SRT / WebVTT**: 零依赖解析,结构化 cue 列表(索引、时间区间、文本)
317
+ - **LRC / Enhanced LRC**: 歌词文件,`[mm:ss.xx]` 行时间戳(ELRC 额外支持行内 `<mm:ss.xx>` 逐字时间戳),自动解析 `[ti:][ar:][al:]` 等元数据
318
+ - **ASS / SSA**: Advanced SubStation Alpha,提取 Dialogue 事件,自动剥离 `\N` `\h` 与 `{...}` 样式覆盖码,展示 Style 标签
319
+ - **TTML / DFXP**: W3C / Apple Music 使用的 XML 字幕,支持 `begin` / `end` / `dur` 与 `<br/>`
320
+
321
+ ### 压缩包
322
+ - **ZIP**: 树形目录 + 内嵌预览文本/代码/图片,其他类型可下载导出
323
+
324
+ ### Outlook 邮件
325
+ - **MSG**: 邮件头、正文、附件列表
326
+
327
+ ### 电子书
328
+ - **EPUB**: 章节导航、翻页
309
329
 
310
330
  ## 🎮 API 参考
311
331
 
@@ -319,6 +339,8 @@ const files = [
319
339
  | `onClose` | `() => void` | ✅ | 关闭回调 |
320
340
  | `onNavigate` | `(index: number) => void` | ❌ | 导航回调 |
321
341
  | `customRenderers` | `CustomRenderer[]` | ❌ | 自定义渲染器 |
342
+ | `locale` | `Locale` | ❌ | 界面语言(默认 `'zh-CN'`,内置 `'en-US'`) |
343
+ | `messages` | `Partial<Record<Locale, Partial<Messages>>>` | ❌ | 自定义翻译覆盖 |
322
344
 
323
345
  ### FilePreviewEmbed Props
324
346
 
@@ -332,6 +354,8 @@ const files = [
332
354
  | `height` | `number \| string` | ❌ | `'100%'` | 容器高度 |
333
355
  | `className` | `string` | ❌ | - | 根节点额外 className |
334
356
  | `style` | `CSSProperties` | ❌ | - | 根节点额外内联样式 |
357
+ | `locale` | `Locale` | ❌ | `'zh-CN'` | 界面语言(`'zh-CN'` 或 `'en-US'`) |
358
+ | `messages` | `Partial<Record<Locale, Partial<Messages>>>` | ❌ | - | 自定义翻译覆盖 |
335
359
 
336
360
  > `FilePreviewEmbed` 没有 `isOpen` / `onClose`,若要显示/隐藏,请在父组件中条件渲染。同时它不会显示工具栏上的关闭按钮。
337
361
 
@@ -420,7 +444,48 @@ const files = [
420
444
  #### 文本文件
421
445
  - **Markdown**: 文件扩展名 `.md` 或 `.markdown`
422
446
  - **代码**: 根据文件扩展名自动识别 (`.js`, `.ts`, `.py`, `.java`, 等)
423
- - **纯文本**: `text/plain`, `text/csv`,
447
+ - **配置 / 日志**: `.yaml`, `.yml`, `.toml`, `.ini`, `.conf`, `.env`, `.log`, `.diff`, `.patch`
448
+ - **纯文本**: `text/plain`
449
+
450
+ #### 结构化数据
451
+ - **JSON**: `application/json` (.json)
452
+ - **CSV / TSV**: `text/csv` (.csv), `text/tab-separated-values` (.tsv)
453
+ - **XML**: `application/xml`, `text/xml` (.xml)
454
+
455
+ #### 字幕 / 歌词
456
+ - **SRT**: `application/x-subrip` (.srt)
457
+ - **WebVTT**: `text/vtt` (.vtt)
458
+ - **LRC**: (.lrc)
459
+ - **Enhanced LRC**: (.elrc)
460
+ - **ASS / SSA**: (.ass, .ssa)
461
+ - **TTML / DFXP**: `application/ttml+xml` (.ttml, .dfxp)
462
+
463
+ #### 压缩包
464
+ - **ZIP**: `application/zip`, `application/x-zip-compressed` (.zip)
465
+
466
+ #### Outlook 邮件
467
+ - **MSG**: `application/vnd.ms-outlook` (.msg)
468
+
469
+ #### 电子书
470
+ - **EPUB**: `application/epub+zip` (.epub)
471
+
472
+ ## 🌐 国际化(i18n)
473
+
474
+ 内置中文(默认)和英文,零外部依赖。
475
+
476
+ ```tsx
477
+ // 切换为英文
478
+ <FilePreviewModal files={files} locale="en-US" ... />
479
+
480
+ // 自定义覆盖某些翻译
481
+ <FilePreviewModal
482
+ files={files}
483
+ locale="en-US"
484
+ messages={{ 'en-US': { 'toolbar.zoom_in': 'Zoom ++' } }}
485
+ />
486
+ ```
487
+
488
+ 在自定义渲染器中可通过 `useTranslator()` hook 获取翻译函数。
424
489
 
425
490
  ## 🎨 自定义样式
426
491
 
@@ -1,3 +1,5 @@
1
+ import React from 'react';
2
+ import { type Locale, type Messages } from '@eternalheart/file-preview-core';
1
3
  import { PreviewFileInput, CustomRenderer } from './types';
2
4
  export interface FilePreviewContentProps {
3
5
  files: PreviewFileInput[];
@@ -8,6 +10,12 @@ export interface FilePreviewContentProps {
8
10
  mode?: 'modal' | 'embed';
9
11
  /** 关闭回调,仅 modal 模式使用 */
10
12
  onClose?: () => void;
13
+ /** ZIP 嵌套深度(内部使用),超过上限时不再递归渲染 ZIP */
14
+ zipNestingDepth?: number;
15
+ /** 国际化语言,默认 'zh-CN' */
16
+ locale?: Locale;
17
+ /** 用户自定义翻译字典,浅合并到内置字典之上 */
18
+ messages?: Partial<Record<Locale, Partial<Messages>>>;
11
19
  }
12
20
  export declare const FilePreviewContent: React.FC<FilePreviewContentProps>;
13
21
  //# sourceMappingURL=FilePreviewContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilePreviewContent.d.ts","sourceRoot":"","sources":["../src/FilePreviewContent.tsx"],"names":[],"mappings":"AAmCA,OAAO,EAAe,gBAAgB,EAAY,cAAc,EAAE,MAAM,SAAS,CAAC;AAgBlF,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,iCAAiC;IACjC,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACzB,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAkDD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA+gBhE,CAAC"}
1
+ {"version":3,"file":"FilePreviewContent.d.ts","sourceRoot":"","sources":["../src/FilePreviewContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAGjF,OAAO,EAAiC,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAmB,MAAM,iCAAiC,CAAC;AAU7H,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAyB3D,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,iCAAiC;IACjC,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACzB,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qCAAqC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;CACvD;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAqehE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { PreviewFileInput, CustomRenderer } from './types';
2
+ import type { Locale, Messages } from '@eternalheart/file-preview-core';
2
3
  interface FilePreviewEmbedProps {
3
4
  files: PreviewFileInput[];
4
5
  currentIndex?: number;
@@ -10,6 +11,10 @@ interface FilePreviewEmbedProps {
10
11
  height?: number | string;
11
12
  className?: string;
12
13
  style?: React.CSSProperties;
14
+ /** 国际化语言,默认 'zh-CN' */
15
+ locale?: Locale;
16
+ /** 用户自定义翻译字典 */
17
+ messages?: Partial<Record<Locale, Partial<Messages>>>;
13
18
  }
14
19
  export declare const FilePreviewEmbed: React.FC<FilePreviewEmbedProps>;
15
20
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"FilePreviewEmbed.d.ts","sourceRoot":"","sources":["../src/FilePreviewEmbed.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG3D,UAAU,qBAAqB;IAC7B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,uBAAuB;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,uBAAuB;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA0B5D,CAAC"}
1
+ {"version":3,"file":"FilePreviewEmbed.d.ts","sourceRoot":"","sources":["../src/FilePreviewEmbed.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAExE,UAAU,qBAAqB;IAC7B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,uBAAuB;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,uBAAuB;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,uBAAuB;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;CACvD;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA8B5D,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { PreviewFileInput, CustomRenderer } from './types';
2
+ import type { Locale, Messages } from '@eternalheart/file-preview-core';
2
3
  interface FilePreviewModalProps {
3
4
  files: PreviewFileInput[];
4
5
  currentIndex: number;
@@ -6,6 +7,10 @@ interface FilePreviewModalProps {
6
7
  onClose: () => void;
7
8
  onNavigate?: (index: number) => void;
8
9
  customRenderers?: CustomRenderer[];
10
+ /** 国际化语言,默认 'zh-CN' */
11
+ locale?: Locale;
12
+ /** 用户自定义翻译字典 */
13
+ messages?: Partial<Record<Locale, Partial<Messages>>>;
9
14
  }
10
15
  export declare const FilePreviewModal: React.FC<FilePreviewModalProps>;
11
16
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"FilePreviewModal.d.ts","sourceRoot":"","sources":["../src/FilePreviewModal.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG3D,UAAU,qBAAqB;IAC7B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;CACpC;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA8D5D,CAAC"}
1
+ {"version":3,"file":"FilePreviewModal.d.ts","sourceRoot":"","sources":["../src/FilePreviewModal.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAExE,UAAU,qBAAqB;IAC7B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,uBAAuB;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;CACvD;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAkE5D,CAAC"}
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ export interface ResizableSplitProps {
3
+ /** 左侧内容 */
4
+ left: React.ReactNode;
5
+ /** 右侧内容 */
6
+ right: React.ReactNode;
7
+ /** 左侧初始宽度(px);传入 storageKey 时会从 localStorage 读取 */
8
+ initialLeftWidth?: number;
9
+ /** 左侧最小宽度(px) */
10
+ minLeftWidth?: number;
11
+ /** 左侧最大宽度(px),同时不超过 `容器宽 - minRightWidth - 分隔线宽` */
12
+ maxLeftWidth?: number;
13
+ /** 右侧至少保留的宽度(px) */
14
+ minRightWidth?: number;
15
+ /** localStorage 持久化 key;不传则不持久化 */
16
+ storageKey?: string;
17
+ /** 启用横向拖动的媒体查询,默认 `(min-width: 768px)` */
18
+ desktopMedia?: string;
19
+ /** 容器额外类名 */
20
+ className?: string;
21
+ }
22
+ /**
23
+ * 通用可拖动分隔布局:
24
+ * - 桌面端(由 `desktopMedia` 判定)横向分两栏,中间分隔线可左右拖动调整左栏宽度
25
+ * - 移动端退化为上下堆叠,不显示分隔线
26
+ * - 可选 `storageKey` 将宽度持久化到 localStorage
27
+ */
28
+ export declare const ResizableSplit: React.FC<ResizableSplitProps>;
29
+ //# sourceMappingURL=ResizableSplit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResizableSplit.d.ts","sourceRoot":"","sources":["../../src/components/ResizableSplit.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAExE,MAAM,WAAW,mBAAmB;IAClC,WAAW;IACX,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,WAAW;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,mDAAmD;IACnD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAoGxD,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAudioPlayer.d.ts","sourceRoot":"","sources":["../../src/hooks/useAudioPlayer.ts"],"names":[],"mappings":"AAEA,UAAU,qBAAqB;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACtC;AAED,wBAAgB,cAAc,CAAC,EAC7B,GAAG,GACJ,EAAE,qBAAqB,GAAG,oBAAoB,CAyK9C"}
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { type Locale, type Messages, type Translator } from '@eternalheart/file-preview-core';
3
+ export interface LocaleContextValue {
4
+ locale: Locale;
5
+ t: Translator;
6
+ }
7
+ export interface LocaleProviderProps {
8
+ /** 当前语言,默认 'zh-CN' */
9
+ locale?: Locale;
10
+ /** 用户自定义字典,浅合并到内置字典之上 */
11
+ messages?: Partial<Record<Locale, Partial<Messages>>>;
12
+ children: React.ReactNode;
13
+ }
14
+ export declare const LocaleProvider: React.FC<LocaleProviderProps>;
15
+ /**
16
+ * 获取翻译函数。任意位置调用都安全:
17
+ * - 在 LocaleProvider 下 → 用 provider 提供的 translator
18
+ * - 否则 → 回落到 zh-CN 兜底 translator
19
+ */
20
+ export declare function useTranslator(): Translator;
21
+ /**
22
+ * 获取当前 locale。在 Provider 之外返回 'zh-CN'。
23
+ */
24
+ export declare function useLocale(): Locale;
25
+ //# sourceMappingURL=LocaleContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocaleContext.d.ts","sourceRoot":"","sources":["../../src/i18n/LocaleContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,UAAU,EAChB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,UAAU,CAAC;CACf;AAID,MAAM,WAAW,mBAAmB;IAClC,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAWxD,CAAC;AAcF;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAG1C;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAGlC"}