@deepseek-ai/dsh-client-ui-sidebar-documentpreview 0.1.6-alpha.2 → 0.1.7-alpha.2

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 (54) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +48 -20
  3. package/README.zh.md +48 -20
  4. package/lib/client.excel.js +133796 -0
  5. package/lib/client.js +3785 -791
  6. package/lib/client.pdf.js +37 -15
  7. package/lib/index.js +13 -6
  8. package/lib/types/client/TextPreview.d.ts +2 -2
  9. package/lib/types/client/document/contract.d.ts +44 -0
  10. package/lib/types/client/document/resource-group.d.ts +23 -0
  11. package/lib/types/client/excel/LazyExcelBody.d.ts +21 -0
  12. package/lib/types/client/excel/convert.d.ts +12 -0
  13. package/lib/types/client/excel/delimited.d.ts +10 -0
  14. package/lib/types/client/excel/error.d.ts +7 -0
  15. package/lib/types/client/excel/excel.d.ts +11 -0
  16. package/lib/types/client/excel/format.d.ts +9 -0
  17. package/lib/types/client/excel/index.d.ts +10 -0
  18. package/lib/types/client/excel/locales.d.ts +45 -0
  19. package/lib/types/client/excel/model.d.ts +35 -0
  20. package/lib/types/client/excel/parse.d.ts +12 -0
  21. package/lib/types/client/excel/worker.d.ts +2 -0
  22. package/lib/types/client/excel/xls.d.ts +18 -0
  23. package/lib/types/client/excel/xlsx-archive.d.ts +21 -0
  24. package/lib/types/client/excel/xlsx.d.ts +9 -0
  25. package/lib/types/client/face.d.ts +8 -2
  26. package/lib/types/client/failure-line.d.ts +10 -0
  27. package/lib/types/client/html/HtmlBody.d.ts +10 -4
  28. package/lib/types/client/html/basic-document.d.ts +7 -0
  29. package/lib/types/client/html/read-relative.d.ts +7 -6
  30. package/lib/types/client/image/ImageBody.d.ts +7 -8
  31. package/lib/types/client/image/locales.d.ts +12 -0
  32. package/lib/types/client/index.d.ts +2 -2
  33. package/lib/types/client/locales.d.ts +6 -0
  34. package/lib/types/client/markdown/MarkdownBody.d.ts +1 -1
  35. package/lib/types/client/markdown/path-images.d.ts +9 -0
  36. package/lib/types/client/office/FontNotice.d.ts +5 -7
  37. package/lib/types/client/office/OfficeBody.d.ts +4 -10
  38. package/lib/types/client/office/OfficeFontAction.d.ts +13 -0
  39. package/lib/types/client/office/face.d.ts +31 -0
  40. package/lib/types/client/office/locales.d.ts +2 -6
  41. package/lib/types/client/pdf/locales.d.ts +12 -0
  42. package/lib/types/client/pdf/pdf.d.ts +6 -1
  43. package/lib/types/client/pdf/store.d.ts +5 -2
  44. package/lib/types/client/rpc.d.ts +3 -11
  45. package/lib/types/client/store.d.ts +5 -0
  46. package/lib/types/client/zoom/ZoomControls.d.ts +21 -0
  47. package/lib/types/client/zoom/ZoomViewport.d.ts +25 -0
  48. package/lib/types/client/zoom/locales.d.ts +21 -0
  49. package/lib/types/client/zoom/store.d.ts +28 -0
  50. package/lib/types/client/zoom/types.d.ts +27 -0
  51. package/lib/types/config.d.ts +10 -0
  52. package/package.json +36 -24
  53. package/lib/types/client/code/languages.d.ts +0 -9
  54. package/lib/types/client/icons.d.ts +0 -14
@@ -1,7 +1,8 @@
1
- /** Complete image bytes rendered rounded within an inset frame, scaled down to the pane's width. */
1
+ /** Complete image bytes rendered in a shared zoom viewport. */
2
2
  import { type ReactNode } from 'react';
3
- import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
3
+ import type { PropsLocale, PropsStore } from '@deepseek-ai/dsh-client-ui-slots';
4
4
  import type { DocumentPreviewProps } from '../document/contract.ts';
5
+ import { type ZoomInjected, type ZoomStore } from '../zoom/store.ts';
5
6
  declare const IMAGE_MEDIA_TYPES: {
6
7
  readonly png: "image/png";
7
8
  readonly jpg: "image/jpeg";
@@ -14,7 +15,7 @@ declare const IMAGE_MEDIA_TYPES: {
14
15
  };
15
16
  type ImageMediaType = typeof IMAGE_MEDIA_TYPES[keyof typeof IMAGE_MEDIA_TYPES];
16
17
  /** Standard document props plus the image renderer's dictionary. */
17
- export type ImageBodyProps = DocumentPreviewProps & PropsLocale<'sidebarImage'>;
18
+ export type ImageBodyProps = DocumentPreviewProps & PropsLocale<'sidebarImage'> & PropsStore<ZoomStore> & ZoomInjected;
18
19
  /**
19
20
  * Resolve a supported filename to the media type assigned to its Blob.
20
21
  * @param path - decoded workspace file path.
@@ -22,12 +23,10 @@ export type ImageBodyProps = DocumentPreviewProps & PropsLocale<'sidebarImage'>;
22
23
  */
23
24
  export declare function imageMediaType(path: string): ImageMediaType | undefined;
24
25
  /**
25
- * Present complete image bytes fitted to the pane's width.
26
+ * Present complete image bytes with fit-width and fixed-scale viewing.
26
27
  * @param props - document bytes, resource identity, and locale.
27
- * @returns a rounded image scaled down to the pane's width at its aspect
28
- * ratio — a smaller image centres at its intrinsic size — whose containing
29
- * document body provides vertical scrolling.
28
+ * @returns a rounded image fitted or scaled at its intrinsic aspect ratio.
30
29
  */
31
- export declare function ImageBody({ content, resourceAddress, t }: ImageBodyProps): ReactNode;
30
+ export declare function ImageBody(props: ImageBodyProps): ReactNode;
32
31
  export {};
33
32
  //# sourceMappingURL=ImageBody.d.ts.map
@@ -5,6 +5,12 @@ export declare const zh: {
5
5
  loading: string;
6
6
  failed: string;
7
7
  unsupported: string;
8
+ zoomControls: "缩放控件";
9
+ zoomMenu: "选择缩放比例";
10
+ zoomOut: "缩小";
11
+ zoomIn: "放大";
12
+ zoomFitWidth: "适应宽度";
13
+ zoomValue: "{percent}%";
8
14
  };
9
15
  /** Image renderer dictionary keys. */
10
16
  export type ImagePreviewKey = keyof typeof zh;
@@ -15,6 +21,12 @@ export declare const en: {
15
21
  loading: string;
16
22
  failed: string;
17
23
  unsupported: string;
24
+ zoomControls: string;
25
+ zoomMenu: string;
26
+ zoomOut: string;
27
+ zoomIn: string;
28
+ zoomFitWidth: string;
29
+ zoomValue: string;
18
30
  };
19
31
  declare module '@deepseek-ai/dsh-client-ui-slots' {
20
32
  interface LocaleNamespaceMap {
@@ -40,12 +40,12 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
40
40
  }
41
41
  /**
42
42
  * Required browser services: the tab registry, the slot registry, copy, and the
43
- * Remote carrier with its `workspaceFiles` namespace.
43
+ * workspace Remote for bytes and paged text reads.
44
44
  */
45
45
  export declare const inject: string[];
46
46
  /**
47
47
  * Client plugin body: register the type, its dictionaries, its body, and its chip title.
48
- * @param ctx - client root context carrying the registry, the slots, copy, and the Remote face.
48
+ * @param ctx - client root context carrying the registry, slots, copy, and file readers.
49
49
  */
50
50
  export declare function apply(ctx: ClientContext): void;
51
51
  //# sourceMappingURL=index.d.ts.map
@@ -12,6 +12,9 @@ export declare const zh: {
12
12
  changed: string;
13
13
  reloadNow: string;
14
14
  reload: string;
15
+ autoRefresh: string;
16
+ 'autoRefresh.enable': string;
17
+ 'autoRefresh.disable': string;
15
18
  'wrap.enable': string;
16
19
  'wrap.disable': string;
17
20
  'wrap.aria': string;
@@ -36,6 +39,9 @@ export declare const en: {
36
39
  changed: string;
37
40
  reloadNow: string;
38
41
  reload: string;
42
+ autoRefresh: string;
43
+ 'autoRefresh.enable': string;
44
+ 'autoRefresh.disable': string;
39
45
  'wrap.enable': string;
40
46
  'wrap.disable': string;
41
47
  'wrap.aria': string;
@@ -8,5 +8,5 @@ export type MarkdownBodyProps = DocumentPreviewProps & PropsLocale<'documentMark
8
8
  * @param props - owner-loaded contents and localized primitive labels.
9
9
  * @returns Markdown content, or nothing for a non-text delivery.
10
10
  */
11
- export declare function MarkdownBody({ content, t }: MarkdownBodyProps): ReactNode;
11
+ export declare function MarkdownBody({ content, resourceAddress, useResource, t }: MarkdownBodyProps): ReactNode;
12
12
  //# sourceMappingURL=MarkdownBody.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Build a file URL, resolving relative destinations beside the previewed file.
3
+ * @param base - document base URI, including any deployment prefix.
4
+ * @param documentPath - absolute source path reported by the Host, when available.
5
+ * @param destination - authored Markdown image URL; query and fragment are not filename components.
6
+ * @returns an HTTP(S) file URL, or undefined for unsupported or malformed destinations.
7
+ */
8
+ export declare function markdownImageUrl(base: string, documentPath: string | undefined, destination: string): string | undefined;
9
+ //# sourceMappingURL=path-images.d.ts.map
@@ -1,16 +1,14 @@
1
- /** Missing-font notice and a non-modal details panel for one source version. */
1
+ /** Toolbar warning and non-modal details for the current preview’s missing fonts. */
2
2
  import { type ReactNode } from 'react';
3
3
  import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
4
4
  /** Notice inputs supplied by the document owner and Office locale registration. */
5
5
  export type FontNoticeProps = PropsLocale<'sidebarOffice'> & {
6
- readonly resourceAddress: string;
7
- readonly sourceVersion: string;
8
6
  readonly fonts: readonly string[];
9
7
  };
10
8
  /**
11
- * Show missing fonts; dismissal applies to the same source version while this component stays mounted.
12
- * @param props - source identity, converted content, and localized copy.
13
- * @returns a collapsible notice and its anchored details, or nothing when fonts are available.
9
+ * Show a warning while fonts are unavailable for the current preview.
10
+ * @param props - missing font families and localized copy.
11
+ * @returns a warning button and its anchored details, or nothing when fonts are available.
14
12
  */
15
- export declare function FontNotice({ resourceAddress, sourceVersion, fonts, t }: FontNoticeProps): ReactNode;
13
+ export declare function FontNotice({ fonts, t }: FontNoticeProps): ReactNode;
16
14
  //# sourceMappingURL=FontNotice.d.ts.map
@@ -1,11 +1,10 @@
1
- /** Office owns source loading, conversion failures, and font notices around the shared PDF view. */
1
+ /** Office presents retained conversion results and font notices around the shared PDF view. */
2
2
  import { type ReactNode } from 'react';
3
3
  import type { PropsLocale, PropsRenderSlots, PropsStore } from '@deepseek-ai/dsh-client-ui-slots';
4
- import type { RemoteFailure } from '@deepseek-ai/dsh-api-remotes/client';
5
4
  import type { TabId } from '@deepseek-ai/dsh-client-ui-dockkit';
6
5
  import type { UseSidebarRightTabInfo } from '@deepseek-ai/dsh-client-ui-sidebar-right/client';
7
6
  import type { DocumentBodyOwner, DocumentPreviewProps } from '../document/contract.ts';
8
- import type { ReadOfficeDocument } from './cache.ts';
7
+ import type { OfficeLoadInjected } from './face.ts';
9
8
  import type { OfficeStore } from './store.ts';
10
9
  declare module '@deepseek-ai/dsh-client-ui-slots' {
11
10
  interface SlotMap {
@@ -24,12 +23,7 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
24
23
  }
25
24
  }
26
25
  /** Office loading callbacks supplied by the registration's services. */
27
- export interface OfficeBodyInjected {
28
- readonly read: ReadOfficeDocument;
29
- /** @param failure - declared file-read failure or conversion exception message. @returns localized display text. */
30
- readonly describeFailure: (failure: RemoteFailure | {
31
- readonly message: string;
32
- }) => string;
26
+ export interface OfficeBodyInjected extends OfficeLoadInjected {
33
27
  /** @param tab - owning tab. @param signal - tab lifetime, including hidden bodies. */
34
28
  readonly retainTab: (tab: TabId, signal: AbortSignal) => void;
35
29
  }
@@ -38,7 +32,7 @@ export type OfficeBodyProps = DocumentPreviewProps & PropsStore<OfficeStore> & O
38
32
  /**
39
33
  * Load one Office revision and preserve its result while its tab remains open.
40
34
  * @param props - renderer loading request, tab state, conversion callbacks, and PDF slot.
41
- * @returns conversion status or the font notice and PDF scrollport.
35
+ * @returns conversion status or the PDF scrollport.
42
36
  */
43
37
  export declare function OfficeBody(props: OfficeBodyProps): ReactNode;
44
38
  //# sourceMappingURL=OfficeBody.d.ts.map
@@ -0,0 +1,13 @@
1
+ /** Font warning for the Office revision displayed by the document toolbar. */
2
+ import type { ReactNode } from 'react';
3
+ import type { PropsLocale, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots';
4
+ import type { OfficeStore } from './store.ts';
5
+ /** Office toolbar inputs share the body’s conversion result. */
6
+ export type OfficeFontActionProps = PropsRuntime<'sidebar.right.tab.document.action'> & PropsStore<OfficeStore> & PropsLocale<'sidebarOffice'>;
7
+ /**
8
+ * Expose font details only for the currently loaded Office revision.
9
+ * @param props - toolbar revision, tab reader, Office store, and localized copy.
10
+ * @returns the font warning, or nothing before conversion completes.
11
+ */
12
+ export declare function OfficeFontAction({ content, useTabInfo, useStore, t }: OfficeFontActionProps): ReactNode;
13
+ //# sourceMappingURL=OfficeFontAction.d.ts.map
@@ -0,0 +1,31 @@
1
+ /** Office conversion reads and settlements bound to the renderer's declared store. */
2
+ import type { BoundActions } from '@deepseek-ai/dsh-client-store';
3
+ import type { TabId } from '@deepseek-ai/dsh-client-ui-dockkit';
4
+ import type { SessionId } from '@deepseek-ai/dsh-session/types';
5
+ import type { RemoteFailure } from '@deepseek-ai/dsh-api-remotes/client';
6
+ import type { SessionFile } from '../rpc.ts';
7
+ import type { ReadOfficeDocument } from './cache.ts';
8
+ import type { OfficeStore } from './store.ts';
9
+ /** Conversion loading callback supplied to the Office body through Slot injection. */
10
+ export interface OfficeLoadInjected {
11
+ /**
12
+ * Read one conversion revision; cancellation suppresses its store writes and version report.
13
+ * @param tabId - owning tab.
14
+ * @param revision - requested content revision.
15
+ * @param file - addressed Session and source path.
16
+ * @param signal - request lifetime, cancelled on replacement, unmount, or tab closure.
17
+ * @param loaded - report the displayed source version to the document owner.
18
+ * @param failed - report a failed load to the document owner.
19
+ */
20
+ readonly load: (tabId: TabId, revision: number, file: SessionFile, signal: AbortSignal, loaded: (version: string) => void, failed: () => void) => void;
21
+ }
22
+ /**
23
+ * Bind Office reads to store actions without exposing Remote work to the component.
24
+ * @param read - authorized conversion reader, including Client cache reuse.
25
+ * @param describeFailure - localized conversion or source-access failure text.
26
+ * @returns Slot inject factory; the file address supplies the read's Session authority.
27
+ */
28
+ export declare function officeFace(read: ReadOfficeDocument, describeFailure: (failure: RemoteFailure | {
29
+ readonly message: string;
30
+ }) => string): (sessionId: SessionId, actions: BoundActions<OfficeStore>) => OfficeLoadInjected;
31
+ //# sourceMappingURL=face.d.ts.map
@@ -3,9 +3,7 @@ export declare const zh: {
3
3
  title: string;
4
4
  loading: string;
5
5
  retry: string;
6
- missingFonts: string;
7
- showMore: string;
8
- dismissNotice: string;
6
+ viewMissingFonts: string;
9
7
  missingFontsTitle: string;
10
8
  missingFontsDescription: string;
11
9
  missingFontsCount: string;
@@ -25,9 +23,7 @@ export declare const en: {
25
23
  title: string;
26
24
  loading: string;
27
25
  retry: string;
28
- missingFonts: string;
29
- showMore: string;
30
- dismissNotice: string;
26
+ viewMissingFonts: string;
31
27
  missingFontsTitle: string;
32
28
  missingFontsDescription: string;
33
29
  missingFontsCount: string;
@@ -9,6 +9,12 @@ export declare const zh: {
9
9
  workerFailed: string;
10
10
  unsupported: string;
11
11
  retry: string;
12
+ zoomControls: "缩放控件";
13
+ zoomMenu: "选择缩放比例";
14
+ zoomOut: "缩小";
15
+ zoomIn: "放大";
16
+ zoomFitWidth: "适应宽度";
17
+ zoomValue: "{percent}%";
12
18
  };
13
19
  /** PDF translation keys shared by both dictionaries. */
14
20
  export type PdfLocaleKey = keyof typeof zh;
@@ -23,6 +29,12 @@ export declare const en: {
23
29
  workerFailed: string;
24
30
  unsupported: string;
25
31
  retry: string;
32
+ zoomControls: string;
33
+ zoomMenu: string;
34
+ zoomOut: string;
35
+ zoomIn: string;
36
+ zoomFitWidth: string;
37
+ zoomValue: string;
26
38
  };
27
39
  declare module '@deepseek-ai/dsh-client-ui-slots' {
28
40
  interface LocaleNamespaceMap {
@@ -1,9 +1,10 @@
1
1
  /** PDF page presentation; binary content and tab information come from the document owner. */
2
- import { type ReactNode } from 'react';
2
+ import { type ComponentType, type ReactNode } from 'react';
3
3
  import type { PropsLocale, PropsStore } from '@deepseek-ai/dsh-client-ui-slots';
4
4
  import type { TabId } from '@deepseek-ai/dsh-client-ui-dockkit';
5
5
  import type { DocumentPreviewProps } from '../document/contract.ts';
6
6
  import type { PdfStore } from './store.ts';
7
+ import type { ZoomViewportProps } from '../zoom/ZoomViewport.tsx';
7
8
  /** A record's viewing preferences survive body unmounts and leave with the tab. */
8
9
  export interface PdfBodyInjected {
9
10
  /**
@@ -12,6 +13,10 @@ export interface PdfBodyInjected {
12
13
  * @param signal - tab-record lifetime, not body visibility.
13
14
  */
14
15
  readonly retainTab: (tabId: TabId, signal: AbortSignal) => void;
16
+ /** Main-bundle viewport reused by the lazy PDF body. */
17
+ readonly ZoomViewport: ComponentType<ZoomViewportProps>;
18
+ /** Main-bundle class implementing fit-width and fixed-size surfaces. */
19
+ readonly zoomSurfaceClass: string;
15
20
  }
16
21
  /** Standard document props plus the PDF entry's locale, viewing store, and lifetime callback. */
17
22
  export type PdfBodyProps = DocumentPreviewProps & PropsLocale<'sidebarPdf'> & PropsStore<PdfStore> & PdfBodyInjected;
@@ -1,9 +1,11 @@
1
1
  /** Restorable PDF viewing preferences; document objects and canvases remain component-local. */
2
2
  import { type EngineStoreHandle } from '@deepseek-ai/dsh-client-store';
3
3
  import type { TabId } from '@deepseek-ai/dsh-client-ui-dockkit';
4
- /** One tab's last visible page. */
4
+ import type { ZoomPreference } from '../zoom/types.ts';
5
+ /** One tab's last visible page and optional PDF zoom preference. */
5
6
  export interface PdfView {
6
7
  readonly page: number;
8
+ readonly zoom?: ZoomPreference;
7
9
  }
8
10
  /** Page state isolated by the owning tab record. */
9
11
  export interface PdfState {
@@ -11,10 +13,11 @@ export interface PdfState {
11
13
  }
12
14
  type PdfActions = {
13
15
  page: (draft: PdfState, tabId: TabId, page: number) => void;
16
+ zoom: (draft: PdfState, tabId: TabId, zoom: ZoomPreference) => void;
14
17
  forget: (draft: PdfState, tabId: TabId) => void;
15
18
  };
16
19
  /**
17
- * Declare the last visible page isolated by tab identity.
20
+ * Declare the last visible page and zoom preference isolated by tab identity.
18
21
  * @returns a store declaration instantiated by the document slot for each Session.
19
22
  */
20
23
  export declare function createPdfStore(): EngineStoreHandle<PdfState, PdfActions>;
@@ -57,21 +57,13 @@ export declare function hostFileOf(address: string): SessionFile;
57
57
  * @returns the read the face performs.
58
58
  */
59
59
  export declare function createReadPage(remote: WorkspaceFilesReadRemote): ReadWorkspaceFilePage;
60
- /** Complete document bytes borrowed read-only by renderers; copy before transferring to a Worker. */
61
- export type DocumentFileBytes = Omit<WorkspaceFileBytes, 'data'> & {
62
- readonly data: Uint8Array<ArrayBuffer>;
63
- };
60
+ /** Document bytes borrowed read-only by renderers; copy before transferring to a Worker. */
61
+ export type DocumentFileBytes = WorkspaceFileBytes<Uint8Array<ArrayBuffer>>;
64
62
  /**
65
63
  * Read a complete file through the Host endpoint.
66
64
  * @param file - Session and path decoded from the tab address.
67
65
  * @param signal - owning tab lifetime.
68
- * @returns complete binary bytes, including declared failures.
66
+ * @returns complete native bytes, including declared failures.
69
67
  */
70
68
  export type ReadDocumentBytes = (file: SessionFile, signal: AbortSignal) => Promise<RemoteResult<DocumentFileBytes>>;
71
- /**
72
- * Decode one successful Remote byte result for document renderers.
73
- * @param file - Host byte result with base64 data.
74
- * @returns the same metadata with native bytes; malformed base64 throws.
75
- */
76
- export declare function documentFileBytes(file: WorkspaceFileBytes): DocumentFileBytes;
77
69
  //# sourceMappingURL=rpc.d.ts.map
@@ -29,6 +29,8 @@ export interface TextPage {
29
29
  }
30
30
  /** One tab's pages and view. */
31
31
  export interface TextTabState {
32
+ autoRefresh: boolean;
33
+ resourcesDirty: boolean;
32
34
  /** Explicit viewer choice for this tab; absence follows automatic matching. */
33
35
  rendererId?: string;
34
36
  /** Current display-loading mode; absent before the first read. */
@@ -69,9 +71,12 @@ export interface TextState {
69
71
  export declare function fresh(): TextTabState;
70
72
  /** The preview store's write set; every action names the tab it writes. */
71
73
  type TextActions = {
74
+ toggledAutoRefresh: (draft: TextState, tabId: TabId) => void;
75
+ resourceChanged: (draft: TextState, tabId: TabId) => void;
72
76
  selected: (draft: TextState, tabId: TabId, rendererId: string | undefined) => void;
73
77
  loading: (draft: TextState, tabId: TabId, mode?: DocumentLoadMode, observedVersion?: string, contentRendererId?: string) => void;
74
78
  rendered: (draft: TextState, tabId: TabId, revision: number, version: string) => void;
79
+ rendererFailed: (draft: TextState, tabId: TabId, revision: number) => void;
75
80
  complete: (draft: TextState, tabId: TabId, file: DocumentFileBytes) => void;
76
81
  page: (draft: TextState, tabId: TabId, page: WorkspaceFileText) => void;
77
82
  failed: (draft: TextState, tabId: TabId, failure: RemoteFailure) => void;
@@ -0,0 +1,21 @@
1
+ import { type ZoomLabels } from './types.ts';
2
+ /** Live percentage display updated independently from the document tree. */
3
+ export interface ZoomControlsHandle {
4
+ /** @param zoom - current gesture scale multiplier. */
5
+ showZoom: (zoom: number) => void;
6
+ }
7
+ /**
8
+ * Present fit-width, fixed presets, and incremental controls.
9
+ * @param props - current resolved zoom, preference mode, labels, and callbacks.
10
+ * @returns a localized zoom toolbar.
11
+ */
12
+ export declare const ZoomControls: import("react").ForwardRefExoticComponent<{
13
+ readonly zoom: number;
14
+ readonly fitWidth: boolean;
15
+ readonly labels: ZoomLabels;
16
+ readonly visible: boolean;
17
+ readonly onZoom: (zoom: number) => void;
18
+ readonly onFitWidth: () => void;
19
+ readonly onActiveChange: (active: boolean) => void;
20
+ } & import("react").RefAttributes<ZoomControlsHandle>>;
21
+ //# sourceMappingURL=ZoomControls.d.ts.map
@@ -0,0 +1,25 @@
1
+ /** Shared zoom viewport, gesture handling, anchoring, and fit-width measurement. */
2
+ import { type ReactNode, type RefCallback } from 'react';
3
+ import { type ZoomLabels, type ZoomPreference } from './types.ts';
4
+ /** @returns an actual-size scale that only shrinks content wider than the viewport. */
5
+ export declare function fitWidthZoom(viewportWidth: number, intrinsicWidth: number | undefined, horizontalInset?: number): number;
6
+ /** Shared viewport inputs for renderer-owned content and tab state. */
7
+ export interface ZoomViewportProps {
8
+ readonly preference: ZoomPreference;
9
+ readonly intrinsicWidth: number | undefined;
10
+ readonly horizontalInset?: number;
11
+ readonly labels: ZoomLabels;
12
+ readonly signal: AbortSignal;
13
+ readonly scrollportRef: RefCallback<HTMLElement>;
14
+ readonly onPreference: (preference: ZoomPreference) => void;
15
+ readonly children: ReactNode;
16
+ }
17
+ /**
18
+ * Keep zoom controls and trackpad gestures independent from document rendering.
19
+ * @param props - renderer content, intrinsic width, tab preference, and localized labels.
20
+ * @returns the owned scrollport and floating zoom controls.
21
+ */
22
+ export declare function ZoomViewport(props: ZoomViewportProps): ReactNode;
23
+ /** Shared surface class for actual-size and fit-width layout. */
24
+ export declare const zoomSurfaceClass: string;
25
+ //# sourceMappingURL=ZoomViewport.d.ts.map
@@ -0,0 +1,21 @@
1
+ /** Shared zoom copy embedded into renderer-owned dictionaries. */
2
+ export declare const zoomZh: {
3
+ readonly zoomControls: "缩放控件";
4
+ readonly zoomMenu: "选择缩放比例";
5
+ readonly zoomOut: "缩小";
6
+ readonly zoomIn: "放大";
7
+ readonly zoomFitWidth: "适应宽度";
8
+ readonly zoomValue: "{percent}%";
9
+ };
10
+ /** Shared English zoom copy. */
11
+ export declare const zoomEn: {
12
+ zoomControls: string;
13
+ zoomMenu: string;
14
+ zoomOut: string;
15
+ zoomIn: string;
16
+ zoomFitWidth: string;
17
+ zoomValue: string;
18
+ };
19
+ /** Shared zoom dictionary keys. */
20
+ export type ZoomLocaleKey = keyof typeof zoomZh;
21
+ //# sourceMappingURL=locales.d.ts.map
@@ -0,0 +1,28 @@
1
+ /** Tab-local zoom preferences for renderers without additional view state. */
2
+ import { type EngineStoreHandle } from '@deepseek-ai/dsh-client-store';
3
+ import type { TabId } from '@deepseek-ai/dsh-client-ui-dockkit';
4
+ import { type ZoomPreference } from './types.ts';
5
+ /** Tab-lifetime callback supplied by a zoomable renderer registration. */
6
+ export interface ZoomInjected {
7
+ /** @param tabId - owning tab. @param signal - complete tab-record lifetime. */
8
+ readonly retainTab: (tabId: TabId, signal: AbortSignal) => void;
9
+ }
10
+ /** Zoom state isolated by the owning tab record. */
11
+ export interface ZoomState {
12
+ byTab: Record<TabId, ZoomPreference>;
13
+ }
14
+ type ZoomActions = {
15
+ zoom: (draft: ZoomState, tabId: TabId, preference: ZoomPreference) => void;
16
+ forget: (draft: ZoomState, tabId: TabId) => void;
17
+ };
18
+ /**
19
+ * Create tab-local zoom state for a document renderer registration.
20
+ * @returns a store declaration retaining zoom until its tab closes.
21
+ */
22
+ export declare function createZoomStore(): EngineStoreHandle<ZoomState, ZoomActions>;
23
+ /** Default zoom value for a tab without retained state. */
24
+ export declare const DEFAULT_ZOOM: ZoomPreference;
25
+ /** Store declaration used by image previews. */
26
+ export type ZoomStore = ReturnType<typeof createZoomStore>;
27
+ export {};
28
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1,27 @@
1
+ /** Automatic fit or an explicit actual-size scale selected by the reader. */
2
+ export type ZoomPreference = {
3
+ readonly kind: 'fit-width';
4
+ } | {
5
+ readonly kind: 'fixed';
6
+ readonly scale: number;
7
+ };
8
+ /** Default preference for a newly opened zoomable preview. */
9
+ export declare const FIT_WIDTH: ZoomPreference;
10
+ /** Minimum scale retained by a fixed zoom preference. */
11
+ export declare const MIN_FIXED_ZOOM = 0.25;
12
+ /** Maximum scale retained by a fixed zoom preference. */
13
+ export declare const MAX_FIXED_ZOOM = 4;
14
+ /** Scale interval used by the incremental controls. */
15
+ export declare const ZOOM_STEP = 0.25;
16
+ /** Fixed scale choices shown in the zoom menu. */
17
+ export declare const ZOOM_OPTIONS: readonly [0.25, 0.5, 1, 1.5, 2];
18
+ /** Localized copy consumed by the framework-free zoom controls. */
19
+ export interface ZoomLabels {
20
+ readonly controls: string;
21
+ readonly menu: string;
22
+ readonly out: string;
23
+ readonly into: string;
24
+ readonly fitWidth: string;
25
+ readonly value: (percent: number) => string;
26
+ }
27
+ //# sourceMappingURL=types.d.ts.map
@@ -13,9 +13,19 @@ export interface Config {
13
13
  /** Maximum readers including source and renderer metadata lookups. */
14
14
  maxReaders: number;
15
15
  };
16
+ /** Browser spreadsheet parser and dense cell allocation limits. */
17
+ excel: {
18
+ /** Maximum source file bytes. */
19
+ maxBytes: number;
20
+ /** Maximum combined rectangular cell area across worksheets. */
21
+ maxCells: number;
22
+ /** Maximum parser Worker lifetime in milliseconds. */
23
+ timeoutMs: number;
24
+ };
16
25
  }
17
26
  /** Deployment limits applied before Office preview registration. */
18
27
  export declare const Config: z<{
19
28
  office?: Partial<Config['office']>;
29
+ excel?: Partial<Config['excel']>;
20
30
  }, Config>;
21
31
  //# sourceMappingURL=config.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-client-ui-sidebar-documentpreview",
3
- "description": "Extensible document previews for Sidebar files: Office, Markdown, highlighted code, images, PDF, HTML, and plain text",
4
- "version": "0.1.6-alpha.2",
3
+ "description": "Extensible Sidebar previews for Office documents, spreadsheets, Markdown, code, images, PDF, HTML, and plain text",
4
+ "version": "0.1.7-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -30,45 +30,57 @@
30
30
  "inject": [
31
31
  "@deepseek-ai/dsh-api-gateway",
32
32
  "@deepseek-ai/dsh-api-workspace-files",
33
+ "@deepseek-ai/dsh-client-resources",
33
34
  "@deepseek-ai/dsh-client-ui-sidebar-right",
34
35
  "@deepseek-ai/dsh-client-ui-session",
35
36
  "@deepseek-ai/dsh-api-remotes",
36
- "@deepseek-ai/dsh-client-locale"
37
+ "@deepseek-ai/dsh-client-locale",
38
+ "@deepseek-ai/dsh-client-ui-settings"
37
39
  ],
38
40
  "platform": "web"
39
41
  }
40
42
  },
41
43
  "license": "MIT",
42
44
  "peerDependencies": {
43
- "@deepseek-ai/cordis": "^4.0.2"
45
+ "@deepseek-ai/cordis": "~4.0.4"
44
46
  },
45
47
  "devDependencies": {
48
+ "@fortune-sheet/core": "1.0.4",
49
+ "@fortune-sheet/react": "1.0.4",
46
50
  "@testing-library/react": "^16.1.0",
51
+ "@types/papaparse": "^5.3.16",
47
52
  "@types/react": "~18.3.1",
48
53
  "@types/react-dom": "~18.3.0",
49
54
  "clsx": "^2.0.0",
55
+ "dompurify": "^3.4.11",
56
+ "exceljs": "4.4.0",
57
+ "fast-xml-parser": "5.11.1",
58
+ "fflate": "^0.8.3",
59
+ "papaparse": "5.5.3",
50
60
  "pdfjs-dist": "6.3.289",
51
61
  "react": "^18.2.0",
52
62
  "react-dom": "^18.2.0",
53
- "@deepseek-ai/dsh-api-remotes": "^0.1.6-alpha.2",
54
- "@deepseek-ai/dsh-api-workspace-files": "^0.1.6-alpha.2",
55
- "@deepseek-ai/dsh-client-connection": "^0.1.6-alpha.2",
56
- "@deepseek-ai/dsh-api-gateway": "^0.1.6-alpha.2",
57
- "@deepseek-ai/dsh-client-resources": "^0.1.6-alpha.2",
58
- "@deepseek-ai/cordis": "^4.0.2",
59
- "@deepseek-ai/dsh-client-locale": "^0.1.6-alpha.2",
60
- "@deepseek-ai/dsh-client-test-runtime": "^0.1.6-alpha.2",
61
- "@deepseek-ai/dsh-client-ui-dockkit": "^0.1.6-alpha.2",
62
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.6-alpha.2",
63
- "@deepseek-ai/dsh-client-ui-session": "^0.1.6-alpha.2",
64
- "@deepseek-ai/dsh-host-webserver": "^0.1.6-alpha.2",
65
- "@deepseek-ai/dsh-client-ui-renderer": "^0.1.6-alpha.2",
66
- "@deepseek-ai/dsh-session": "^0.1.6-alpha.2",
67
- "@deepseek-ai/dsh-util-workspace-path": "^0.1.6-alpha.2",
68
- "@deepseek-ai/dsh-office-to-pdf": "^0.1.6-alpha.2",
69
- "@deepseek-ai/dsh-client-store": "^0.1.6-alpha.2",
70
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.6-alpha.2",
71
- "@deepseek-ai/dsh-client-ui-sidebar-right": "^0.1.6-alpha.2"
63
+ "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
64
+ "@deepseek-ai/cordis": "~4.0.4",
65
+ "@deepseek-ai/dsh-api-gateway": "0.1.7-alpha.2",
66
+ "@deepseek-ai/dsh-api-remotes": "0.1.7-alpha.2",
67
+ "@deepseek-ai/dsh-api-workspace-files": "0.1.7-alpha.2",
68
+ "@deepseek-ai/dsh-client-connection": "0.1.7-alpha.2",
69
+ "@deepseek-ai/dsh-client-locale": "0.1.7-alpha.2",
70
+ "@deepseek-ai/dsh-client-resources": "0.1.7-alpha.2",
71
+ "@deepseek-ai/dsh-client-store": "0.1.7-alpha.2",
72
+ "@deepseek-ai/dsh-client-test-runtime": "0.1.7-alpha.2",
73
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.7-alpha.2",
74
+ "@deepseek-ai/dsh-client-ui-renderer": "0.1.7-alpha.2",
75
+ "@deepseek-ai/dsh-client-ui-dockkit": "0.1.7-alpha.2",
76
+ "@deepseek-ai/dsh-client-ui-session": "0.1.7-alpha.2",
77
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.7-alpha.2",
78
+ "@deepseek-ai/dsh-client-ui-sidebar-right": "0.1.7-alpha.2",
79
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.7-alpha.2",
80
+ "@deepseek-ai/dsh-office-to-pdf": "0.1.7-alpha.2",
81
+ "@deepseek-ai/dsh-host-webserver": "0.1.7-alpha.2",
82
+ "@deepseek-ai/dsh-session": "0.1.7-alpha.2",
83
+ "@deepseek-ai/dsh-util-workspace-path": "0.1.7-alpha.2"
72
84
  },
73
85
  "files": [
74
86
  "lib/index.js",
@@ -77,7 +89,7 @@
77
89
  "lib/types/**/*.d.ts"
78
90
  ],
79
91
  "dependencies": {
80
- "@deepseek-ai/schemastery": "^3.18.2"
92
+ "@deepseek-ai/schemastery": "~3.18.4"
81
93
  },
82
94
  "scripts": {
83
95
  "bundle": "tsdown",
@@ -1,9 +0,0 @@
1
- /** Recognized suffixes shared by renderer selection and language hints. */
2
- export declare const CODE_EXTENSIONS: readonly string[];
3
- /**
4
- * Select the shared highlighter's grammar for a filename.
5
- * @param path - decoded source filename or path.
6
- * @returns a supported grammar hint, or undefined for other suffixes.
7
- */
8
- export declare function languageForPath(path: string): string | undefined;
9
- //# sourceMappingURL=languages.d.ts.map