@eternalheart/react-file-preview 1.3.4 → 1.3.6

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 CHANGED
@@ -343,6 +343,8 @@ const files = [
343
343
  | `customRenderers` | `CustomRenderer[]` | ❌ | Custom renderers for specific file types |
344
344
  | `locale` | `Locale` | ❌ | UI language (`'zh-CN'` default, `'en-US'` built-in) |
345
345
  | `messages` | `Partial<Record<Locale, Partial<Messages>>>` | ❌ | Custom translation overrides |
346
+ | `headless` | `boolean` | ❌ | Headless mode — hides toolbar and navigation arrows |
347
+ | `theme` | `Theme` | ❌ | Theme mode: `'auto' \| 'dark' \| 'light'` (default `'dark'`) |
346
348
 
347
349
  ### FilePreviewEmbed Props
348
350
 
@@ -358,6 +360,8 @@ const files = [
358
360
  | `style` | `CSSProperties` | ❌ | - | Extra inline style on the root wrapper |
359
361
  | `locale` | `Locale` | ❌ | `'zh-CN'` | UI language (`'zh-CN'` or `'en-US'`) |
360
362
  | `messages` | `Partial<Record<Locale, Partial<Messages>>>` | ❌ | - | Custom translation overrides |
363
+ | `headless` | `boolean` | ❌ | `false` | Headless mode — hides toolbar and navigation arrows |
364
+ | `theme` | `Theme` | ❌ | `'dark'` | Theme mode: `'auto' \| 'dark' \| 'light'` |
361
365
 
362
366
  > `FilePreviewEmbed` has no `isOpen` / `onClose`. To hide/show it, conditionally render it from the parent. It also hides the close button in the toolbar.
363
367
 
package/README.zh-CN.md CHANGED
@@ -341,6 +341,8 @@ const files = [
341
341
  | `customRenderers` | `CustomRenderer[]` | ❌ | 自定义渲染器 |
342
342
  | `locale` | `Locale` | ❌ | 界面语言(默认 `'zh-CN'`,内置 `'en-US'`) |
343
343
  | `messages` | `Partial<Record<Locale, Partial<Messages>>>` | ❌ | 自定义翻译覆盖 |
344
+ | `headless` | `boolean` | ❌ | 无头模式,隐藏工具栏和导航箭头 |
345
+ | `theme` | `Theme` | ❌ | 主题模式: `'auto' \| 'dark' \| 'light'`(默认 `'dark'`) |
344
346
 
345
347
  ### FilePreviewEmbed Props
346
348
 
@@ -356,6 +358,8 @@ const files = [
356
358
  | `style` | `CSSProperties` | ❌ | - | 根节点额外内联样式 |
357
359
  | `locale` | `Locale` | ❌ | `'zh-CN'` | 界面语言(`'zh-CN'` 或 `'en-US'`) |
358
360
  | `messages` | `Partial<Record<Locale, Partial<Messages>>>` | ❌ | - | 自定义翻译覆盖 |
361
+ | `headless` | `boolean` | ❌ | `false` | 无头模式,隐藏工具栏和导航箭头 |
362
+ | `theme` | `Theme` | ❌ | `'dark'` | 主题模式: `'auto' \| 'dark' \| 'light'` |
359
363
 
360
364
  > `FilePreviewEmbed` 没有 `isOpen` / `onClose`,若要显示/隐藏,请在父组件中条件渲染。同时它不会显示工具栏上的关闭按钮。
361
365
 
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { type Locale, type Messages } from '@eternalheart/file-preview-core';
2
+ import { type Locale, type Messages, type Theme } from '@eternalheart/file-preview-core';
3
3
  import { PreviewFileInput, CustomRenderer } from './types';
4
+ import type { CustomRendererEventPayload } from '@eternalheart/file-preview-core';
4
5
  export interface FilePreviewContentProps {
5
6
  files: PreviewFileInput[];
6
7
  currentIndex: number;
@@ -16,6 +17,12 @@ export interface FilePreviewContentProps {
16
17
  locale?: Locale;
17
18
  /** 用户自定义翻译字典,浅合并到内置字典之上 */
18
19
  messages?: Partial<Record<Locale, Partial<Messages>>>;
20
+ /** 无头模式:隐藏工具栏和导航箭头,仅渲染文件内容 */
21
+ headless?: boolean;
22
+ /** 主题模式,默认 'dark' */
23
+ theme?: Theme;
24
+ /** 自定义渲染器派发的事件出口,载荷为 `{ name, payload, file }` */
25
+ onCustomEvent?: (event: CustomRendererEventPayload) => void;
19
26
  }
20
27
  export declare const FilePreviewContent: React.FC<FilePreviewContentProps>;
21
28
  //# sourceMappingURL=FilePreviewContent.d.ts.map
@@ -1 +1 @@
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;AAW7H,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,CA6ehE,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,KAAK,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAWzI,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAyB,MAAM,SAAS,CAAC;AAClF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAyBlF,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;IACtD,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,kDAAkD;IAClD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,CAAC;CAC7D;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA6hBhE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { PreviewFileInput, CustomRenderer } from './types';
2
- import type { Locale, Messages } from '@eternalheart/file-preview-core';
2
+ import type { Locale, Messages, Theme, CustomRendererEventPayload } from '@eternalheart/file-preview-core';
3
3
  interface FilePreviewEmbedProps {
4
4
  files: PreviewFileInput[];
5
5
  currentIndex?: number;
@@ -15,6 +15,12 @@ interface FilePreviewEmbedProps {
15
15
  locale?: Locale;
16
16
  /** 用户自定义翻译字典 */
17
17
  messages?: Partial<Record<Locale, Partial<Messages>>>;
18
+ /** 无头模式:隐藏工具栏和导航箭头 */
19
+ headless?: boolean;
20
+ /** 主题模式,默认 'dark' */
21
+ theme?: Theme;
22
+ /** 自定义渲染器派发的事件出口 */
23
+ onCustomEvent?: (event: CustomRendererEventPayload) => void;
18
24
  }
19
25
  export declare const FilePreviewEmbed: React.FC<FilePreviewEmbedProps>;
20
26
  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;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
+ {"version":3,"file":"FilePreviewEmbed.d.ts","sourceRoot":"","sources":["../src/FilePreviewEmbed.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE3G,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;IACtD,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,oBAAoB;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,CAAC;CAC7D;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsD5D,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { PreviewFileInput, CustomRenderer } from './types';
2
- import type { Locale, Messages } from '@eternalheart/file-preview-core';
2
+ import type { Locale, Messages, Theme, CustomRendererEventPayload } from '@eternalheart/file-preview-core';
3
3
  interface FilePreviewModalProps {
4
4
  files: PreviewFileInput[];
5
5
  currentIndex: number;
@@ -11,6 +11,12 @@ interface FilePreviewModalProps {
11
11
  locale?: Locale;
12
12
  /** 用户自定义翻译字典 */
13
13
  messages?: Partial<Record<Locale, Partial<Messages>>>;
14
+ /** 无头模式:隐藏工具栏和导航箭头 */
15
+ headless?: boolean;
16
+ /** 主题模式,默认 'dark' */
17
+ theme?: Theme;
18
+ /** 自定义渲染器派发的事件出口 */
19
+ onCustomEvent?: (event: CustomRendererEventPayload) => void;
14
20
  }
15
21
  export declare const FilePreviewModal: React.FC<FilePreviewModalProps>;
16
22
  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;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"}
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,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE3G,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;IACtD,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,oBAAoB;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,CAAC;CAC7D;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAyF5D,CAAC"}