@p10node/office-engine 0.2.3 → 0.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.
@@ -10,7 +10,7 @@ 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 ("false" to hide);
13
+ * Attributes: src, name, editable, toolbar / thumbnails / save / download / file-menu / open / capture-select-all ("false" to turn off);
14
14
  * real-time collaboration: collab (hub WebSocket URL), room, user (display name), base (snapshot seq `src` was opened at).
15
15
  * Property: `file` (File/Blob/ArrayBuffer) for local data.
16
16
  */
@@ -57,5 +57,10 @@ export interface DocViewerProps {
57
57
  * edits it together through the hub at `transport` (see src/collab).
58
58
  */
59
59
  collab?: CollabOptions;
60
+ /**
61
+ * Ctrl/⌘+A anywhere on the page selects the document (text fields outside the viewer keep their own).
62
+ * Default true. With false the shortcut works from the viewer only (its content or toolbar).
63
+ */
64
+ captureSelectAll?: boolean;
60
65
  }
61
66
  export declare function DocViewer(props: DocViewerProps): import("react").JSX.Element;
@@ -27,11 +27,17 @@ export interface ViewerApi {
27
27
  fileOps: {
28
28
  current: FileOps | null;
29
29
  };
30
+ /** set by the mounted view (see useSelectAll): Ctrl/⌘+A */
31
+ selectAll: {
32
+ current: (() => void) | null;
33
+ };
30
34
  }
31
35
  export declare const ViewerContext: import("react").Context<ViewerApi>;
32
36
  export declare const useViewer: () => ViewerApi;
33
37
  /** Publishes the view's file operations (latest closure each render) to the File menu. */
34
38
  export declare function useFileOps(ops: FileOps): void;
39
+ /** Publishes the view's select-all: Ctrl/⌘+A from the viewer chrome or, with `captureSelectAll`, from anywhere on the page. */
40
+ export declare function useSelectAll(fn: () => void): void;
35
41
  /** Renders the editor bar into the viewer's toolbar row. */
36
42
  export declare function EditorBar({ children }: {
37
43
  children: ReactNode;
@@ -18,3 +18,10 @@ export declare function useMediaUrl(client: DocumentClient, path: string | undef
18
18
  export declare function lowerIndex(arr: ArrayLike<number>, v: number): number;
19
19
  export declare function useLatest<T>(v: T): import("react").RefObject<T>;
20
20
  export declare function useStableCallback<A extends unknown[], R>(fn: (...a: A) => R): (...a: A) => R;
21
+ /** A control that takes typed text: Ctrl/⌘+A selects its own content. */
22
+ export declare function isTextEntry(target: EventTarget | null): boolean;
23
+ /**
24
+ * Focuses `el` so keyboard shortcuts work without a click. The focus stays where it is when a control
25
+ * outside the viewer has it (a host page form); the viewer's own chrome (or the page body) yields.
26
+ */
27
+ export declare function claimFocus(el: HTMLElement | null): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@p10node/office-engine",
3
- "version": "0.2.3",
3
+ "version": "0.3.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",