@p10node/office-engine 0.3.0 → 0.4.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.
@@ -10,7 +10,8 @@ export declare function mount(el: HTMLElement, options: MountOptions): MountedVi
10
10
  /**
11
11
  * `<office-viewer src="/file.xlsx" style="height:600px"></office-viewer>`
12
12
  * Rendered inside a shadow root so host page CSS cannot leak in.
13
- * Attributes: src, name, editable, toolbar / thumbnails / save / download / file-menu / open / capture-select-all ("false" to turn off);
13
+ * Attributes: src, name, editable, toolbar / thumbnails / save / download / file-menu / open / capture-select-all ("false" to turn off),
14
+ * theme ("light" | "dark" | "auto");
14
15
  * real-time collaboration: collab (hub WebSocket URL), room, user (display name), base (snapshot seq `src` was opened at).
15
16
  * Property: `file` (File/Blob/ArrayBuffer) for local data.
16
17
  */
@@ -8,6 +8,7 @@ export { SlideView } from './react/pptx/Slide';
8
8
  export { useDocument, type DocumentState } from './react/useDocument';
9
9
  export { injectStyles, stylesText } from './react/injectStyles';
10
10
  export type { Zoom } from './react/common/ZoomControl';
11
+ export type { Theme } from './react/common/hooks';
11
12
  export { DocumentClient, setDefaultWorker, type OpenOptions } from './core/worker/client';
12
13
  export type { DocSource } from './core/source';
13
14
  export type { DocKind } from './core/opc';
@@ -3,6 +3,7 @@ import type { DocSource } from '../core/source';
3
3
  import type { DocumentClient, OpenOptions } from '../core/worker/client';
4
4
  import type { Zoom } from './common/ZoomControl';
5
5
  import { type FileMenuItem } from './file/FileMenu';
6
+ import { type Theme } from './common/hooks';
6
7
  import type { CollabOptions } from '../collab';
7
8
  export interface DocViewerProps {
8
9
  /** File, Blob, ArrayBuffer, Uint8Array or URL (HTTP Range requests are used when the server supports them). */
@@ -25,6 +26,11 @@ export interface DocViewerProps {
25
26
  worker?: OpenOptions['worker'];
26
27
  /** Where to inject the stylesheet (document or a shadow root). */
27
28
  styleTarget?: Document | ShadowRoot;
29
+ /**
30
+ * Color scheme of the viewer chrome (bars, menus, dialogs): 'light', 'dark' or 'auto' (follows the OS / browser setting).
31
+ * The document itself keeps its own colors. Default 'light'.
32
+ */
33
+ theme?: Theme;
28
34
  onLoad?: (client: DocumentClient) => void;
29
35
  onError?: (error: Error) => void;
30
36
  /** Start in edit mode. Default false (view). */
@@ -1,6 +1,10 @@
1
1
  import { useLayoutEffect } from 'react';
2
2
  import type { DocumentClient } from '../../core/worker/client';
3
3
  export declare const useIsoLayoutEffect: typeof useLayoutEffect;
4
+ /** Color scheme of the viewer chrome: 'auto' follows the browser / OS setting (prefers-color-scheme). */
5
+ export type Theme = 'light' | 'dark' | 'auto';
6
+ /** Whether the dark theme applies for `theme`; 'auto' tracks prefers-color-scheme live. */
7
+ export declare function useDarkTheme(theme?: Theme): boolean;
4
8
  export declare function useForceUpdate(): [number, () => void];
5
9
  /** Element size via ResizeObserver. */
6
10
  export declare function useSize<T extends HTMLElement>(): [React.RefObject<T | null>, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@p10node/office-engine",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Browser engine to view DOCX, XLSX, PPTX progressively (worker-based, range-loading, virtualized React views)",
5
5
  "type": "module",
6
6
  "license": "MIT",