@univerjs-pro/pdfs-ui 1.0.0-alpha.8
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 +46 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/locale/ar-SA.js +1 -0
- package/lib/cjs/locale/ca-ES.js +1 -0
- package/lib/cjs/locale/de-DE.js +1 -0
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/es-ES.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/fr-FR.js +1 -0
- package/lib/cjs/locale/id-ID.js +1 -0
- package/lib/cjs/locale/it-IT.js +1 -0
- package/lib/cjs/locale/ja-JP.js +1 -0
- package/lib/cjs/locale/ko-KR.js +1 -0
- package/lib/cjs/locale/pl-PL.js +1 -0
- package/lib/cjs/locale/pt-BR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/sk-SK.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-HK.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/index.js +1 -0
- package/lib/es/locale/ar-SA.js +1 -0
- package/lib/es/locale/ca-ES.js +1 -0
- package/lib/es/locale/de-DE.js +1 -0
- package/lib/es/locale/en-US.js +1 -0
- package/lib/es/locale/es-ES.js +1 -0
- package/lib/es/locale/fa-IR.js +1 -0
- package/lib/es/locale/fr-FR.js +1 -0
- package/lib/es/locale/id-ID.js +1 -0
- package/lib/es/locale/it-IT.js +1 -0
- package/lib/es/locale/ja-JP.js +1 -0
- package/lib/es/locale/ko-KR.js +1 -0
- package/lib/es/locale/pl-PL.js +1 -0
- package/lib/es/locale/pt-BR.js +1 -0
- package/lib/es/locale/ru-RU.js +1 -0
- package/lib/es/locale/sk-SK.js +1 -0
- package/lib/es/locale/vi-VN.js +1 -0
- package/lib/es/locale/zh-CN.js +1 -0
- package/lib/es/locale/zh-HK.js +1 -0
- package/lib/es/locale/zh-TW.js +1 -0
- package/lib/index.css +520 -0
- package/lib/index.js +1 -0
- package/lib/locale/ar-SA.js +1 -0
- package/lib/locale/ca-ES.js +1 -0
- package/lib/locale/de-DE.js +1 -0
- package/lib/locale/en-US.js +1 -0
- package/lib/locale/es-ES.js +1 -0
- package/lib/locale/fa-IR.js +1 -0
- package/lib/locale/fr-FR.js +1 -0
- package/lib/locale/id-ID.js +1 -0
- package/lib/locale/it-IT.js +1 -0
- package/lib/locale/ja-JP.js +1 -0
- package/lib/locale/ko-KR.js +1 -0
- package/lib/locale/pl-PL.js +1 -0
- package/lib/locale/pt-BR.js +1 -0
- package/lib/locale/ru-RU.js +1 -0
- package/lib/locale/sk-SK.js +1 -0
- package/lib/locale/vi-VN.js +1 -0
- package/lib/locale/zh-CN.js +1 -0
- package/lib/locale/zh-HK.js +1 -0
- package/lib/locale/zh-TW.js +1 -0
- package/lib/types/commands/command-ids.d.ts +1 -0
- package/lib/types/commands/mutations/pdf-history.mutation.d.ts +9 -0
- package/lib/types/commands/operations/pdf-editor.operation.d.ts +22 -0
- package/lib/types/commands/operations/pdf-insert.operation.d.ts +17 -0
- package/lib/types/commands/operations/pdf-page-thumbnail.operation.d.ts +7 -0
- package/lib/types/config/config.d.ts +13 -0
- package/lib/types/context-menu/pdf-context-menu-position.d.ts +5 -0
- package/lib/types/controllers/components.controller.d.ts +9 -0
- package/lib/types/controllers/pdf-editor-unit.controller.d.ts +15 -0
- package/lib/types/controllers/pdf-inspector.controller.d.ts +12 -0
- package/lib/types/controllers/pdf-page-thumbnail-contextmenu.controller.d.ts +8 -0
- package/lib/types/controllers/pdf-ribbon.controller.d.ts +6 -0
- package/lib/types/controllers/pdf-ui.controller.d.ts +9 -0
- package/lib/types/editor/TextColorPicker.d.ts +11 -0
- package/lib/types/editor/canvas-text-edit-bridge.d.ts +23 -0
- package/lib/types/editor/canvas-text-editor.d.ts +69 -0
- package/lib/types/editor/chrome-model.d.ts +61 -0
- package/lib/types/editor/context-menu-model.d.ts +17 -0
- package/lib/types/editor/form-field-targets.d.ts +8 -0
- package/lib/types/editor/form-field-values.d.ts +16 -0
- package/lib/types/editor/geometry.d.ts +18 -0
- package/lib/types/editor/inspector-geometry.d.ts +13 -0
- package/lib/types/editor/inspector-model.d.ts +75 -0
- package/lib/types/editor/keyboard-controller.d.ts +32 -0
- package/lib/types/editor/list-layout.d.ts +21 -0
- package/lib/types/editor/managed-image-insert.d.ts +41 -0
- package/lib/types/editor/native-targets.d.ts +32 -0
- package/lib/types/editor/native-text-edit.d.ts +9 -0
- package/lib/types/editor/overlay-renderer.d.ts +63 -0
- package/lib/types/editor/paragraph-autofit.d.ts +31 -0
- package/lib/types/editor/pointer-controller.d.ts +76 -0
- package/lib/types/editor/pointer-frame-coalescer.d.ts +11 -0
- package/lib/types/editor/story-layout.d.ts +100 -0
- package/lib/types/editor/table-insertion.d.ts +17 -0
- package/lib/types/editor/table-layout.d.ts +32 -0
- package/lib/types/editor/table-renderer.d.ts +6 -0
- package/lib/types/editor/text-layout.d.ts +74 -0
- package/lib/types/index.d.ts +15 -0
- package/lib/types/locale/ar-SA.d.ts +3 -0
- package/lib/types/locale/ca-ES.d.ts +3 -0
- package/lib/types/locale/de-DE.d.ts +3 -0
- package/lib/types/locale/en-US.d.ts +212 -0
- package/lib/types/locale/es-ES.d.ts +3 -0
- package/lib/types/locale/fa-IR.d.ts +3 -0
- package/lib/types/locale/fr-FR.d.ts +3 -0
- package/lib/types/locale/id-ID.d.ts +3 -0
- package/lib/types/locale/it-IT.d.ts +3 -0
- package/lib/types/locale/ja-JP.d.ts +3 -0
- package/lib/types/locale/ko-KR.d.ts +3 -0
- package/lib/types/locale/pl-PL.d.ts +3 -0
- package/lib/types/locale/pt-BR.d.ts +3 -0
- package/lib/types/locale/ru-RU.d.ts +3 -0
- package/lib/types/locale/sk-SK.d.ts +3 -0
- package/lib/types/locale/types.d.ts +3 -0
- package/lib/types/locale/vi-VN.d.ts +3 -0
- package/lib/types/locale/zh-CN.d.ts +3 -0
- package/lib/types/locale/zh-HK.d.ts +3 -0
- package/lib/types/locale/zh-TW.d.ts +3 -0
- package/lib/types/menu/pdf-canvas-contextmenu.menu.d.ts +9 -0
- package/lib/types/menu/pdf-page-thumbnail.menu.d.ts +7 -0
- package/lib/types/menu/pdf-ribbon.menu.d.ts +27 -0
- package/lib/types/menu/schema.d.ts +4 -0
- package/lib/types/plugin.d.ts +19 -0
- package/lib/types/render/canvas-backend.d.ts +29 -0
- package/lib/types/render/canvas-group-compositor.d.ts +54 -0
- package/lib/types/render/canvas-renderer.d.ts +29 -0
- package/lib/types/render/canvas-shading.d.ts +12 -0
- package/lib/types/render/canvas-text.d.ts +15 -0
- package/lib/types/render/canvas-types.d.ts +3 -0
- package/lib/types/render/decode-manifest.d.ts +210 -0
- package/lib/types/render/document-json.d.ts +3 -0
- package/lib/types/render/document-object-renderer.d.ts +21 -0
- package/lib/types/render/font-outline.d.ts +27 -0
- package/lib/types/render/font-render-report.d.ts +71 -0
- package/lib/types/render/image-resolver.d.ts +30 -0
- package/lib/types/render/pdf-canvas-render-session.d.ts +34 -0
- package/lib/types/render/pdf-page-thumbnail-renderer.d.ts +49 -0
- package/lib/types/render/pdf-page-thumbnail-worker-client.d.ts +44 -0
- package/lib/types/render/pdf-page-thumbnail.worker.d.ts +9 -0
- package/lib/types/render/source-eraser.d.ts +18 -0
- package/lib/types/render/source-suppression.d.ts +10 -0
- package/lib/types/render/viewport.d.ts +21 -0
- package/lib/types/services/pdf-editor-command.service.d.ts +59 -0
- package/lib/types/services/pdf-editor-runtime.service.d.ts +62 -0
- package/lib/types/services/pdf-insert.service.d.ts +58 -0
- package/lib/types/services/pdf-managed-image-runtime.adapter.d.ts +37 -0
- package/lib/types/services/pdf-page-region-index.service.d.ts +48 -0
- package/lib/types/services/pdf-page-thumbnail-action.service.d.ts +15 -0
- package/lib/types/services/pdf-page-thumbnail-context.service.d.ts +36 -0
- package/lib/types/services/pdf-page-thumbnail-unit-action.service.d.ts +18 -0
- package/lib/types/services/pdf-render-resource-resolvers.d.ts +6 -0
- package/lib/types/views/PdfCanvasView.d.ts +2 -0
- package/lib/types/views/PdfFooter.d.ts +2 -0
- package/lib/types/views/PdfInsertTableMenu.d.ts +2 -0
- package/lib/types/views/PdfInspectorPanel.d.ts +3 -0
- package/lib/types/views/PdfPageThumbnailBar.d.ts +2 -0
- package/lib/types/views/PdfTableThemeGallery.d.ts +8 -0
- package/lib/types/views/PdfToolbar.d.ts +2 -0
- package/lib/types/views/pdf-canvas-pixel-alignment.d.ts +1 -0
- package/lib/types/views/pdf-canvas-text-edit-state.d.ts +34 -0
- package/lib/types/views/pdf-thumbnail-virtualizer.d.ts +22 -0
- package/lib/types/views/pdf-workbench-state.d.ts +8 -0
- package/lib/umd/index.js +1 -0
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -0
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/es-ES.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/fr-FR.js +1 -0
- package/lib/umd/locale/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -0
- package/lib/umd/locale/ko-KR.js +1 -0
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/sk-SK.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfPageCacheEpoch } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfCanvasRenderOptions } from './canvas-renderer';
|
|
3
|
+
export interface IPdfPageThumbnailViewportInput {
|
|
4
|
+
pageWidthPt: number;
|
|
5
|
+
pageHeightPt: number;
|
|
6
|
+
rotation: 0 | 90 | 180 | 270;
|
|
7
|
+
maxWidthCssPx: number;
|
|
8
|
+
maxHeightCssPx: number;
|
|
9
|
+
devicePixelRatio?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface IPdfPageThumbnailViewport {
|
|
12
|
+
widthCssPx: number;
|
|
13
|
+
heightCssPx: number;
|
|
14
|
+
widthDevicePx: number;
|
|
15
|
+
heightDevicePx: number;
|
|
16
|
+
devicePixelRatio: number;
|
|
17
|
+
zoom: number;
|
|
18
|
+
}
|
|
19
|
+
export interface IPdfPageThumbnailRenderInput {
|
|
20
|
+
document: IPdfDocument;
|
|
21
|
+
pageId: string;
|
|
22
|
+
canvas: HTMLCanvasElement;
|
|
23
|
+
epoch: IPdfPageCacheEpoch;
|
|
24
|
+
maxWidthCssPx: number;
|
|
25
|
+
maxHeightCssPx: number;
|
|
26
|
+
devicePixelRatio?: number;
|
|
27
|
+
renderOptions?: Omit<IPdfCanvasRenderOptions, 'zoom' | 'devicePixelRatio' | 'scheduler'>;
|
|
28
|
+
}
|
|
29
|
+
export interface IPdfPageThumbnailRenderer {
|
|
30
|
+
render(input: IPdfPageThumbnailRenderInput): IPdfPageThumbnailViewport;
|
|
31
|
+
schedule(input: IPdfPageThumbnailRenderInput): () => void;
|
|
32
|
+
invalidate(documentId: string, pageId?: string): void;
|
|
33
|
+
reset(): void;
|
|
34
|
+
getCacheSize(): number;
|
|
35
|
+
}
|
|
36
|
+
export interface IPdfPageThumbnailWorkerRenderer {
|
|
37
|
+
render(input: IPdfPageThumbnailRenderInput, viewport: IPdfPageThumbnailViewport, signal?: AbortSignal): Promise<ImageBitmap | undefined>;
|
|
38
|
+
reset(): void;
|
|
39
|
+
}
|
|
40
|
+
export interface IPdfPageThumbnailRendererOptions {
|
|
41
|
+
maxEntries?: number;
|
|
42
|
+
createCanvas?: () => HTMLCanvasElement;
|
|
43
|
+
renderPage?: (document: IPdfDocument, pageId: string, canvas: HTMLCanvasElement, options: Omit<IPdfCanvasRenderOptions, 'scheduler'>) => unknown;
|
|
44
|
+
schedule?: (callback: () => void) => unknown;
|
|
45
|
+
cancelScheduled?: (handle: unknown) => void;
|
|
46
|
+
workerRenderer?: IPdfPageThumbnailWorkerRenderer | null;
|
|
47
|
+
}
|
|
48
|
+
export declare function calculatePdfPageThumbnailViewport(input: IPdfPageThumbnailViewportInput): IPdfPageThumbnailViewport;
|
|
49
|
+
export declare function createPdfPageThumbnailRenderer(options?: IPdfPageThumbnailRendererOptions): IPdfPageThumbnailRenderer;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfSourceSuppression, PdfAssetId, PdfObjectId } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfPageThumbnailViewport, IPdfPageThumbnailWorkerRenderer } from './pdf-page-thumbnail-renderer';
|
|
3
|
+
export interface IPdfThumbnailWorkerImage {
|
|
4
|
+
assetId: PdfAssetId;
|
|
5
|
+
bitmap: ImageBitmap;
|
|
6
|
+
}
|
|
7
|
+
export interface IPdfThumbnailWorkerRenderOptions {
|
|
8
|
+
background?: string;
|
|
9
|
+
showPageBoundary?: boolean;
|
|
10
|
+
showRawObjects?: boolean;
|
|
11
|
+
showAnnotations?: boolean;
|
|
12
|
+
showAnnotationBounds?: boolean;
|
|
13
|
+
enableTransparencyGroups?: boolean;
|
|
14
|
+
preferPageRaster?: boolean;
|
|
15
|
+
disableGroupCompositor?: boolean;
|
|
16
|
+
suppressedDisplayOperationIds?: string[];
|
|
17
|
+
suppressedObjectIds?: PdfObjectId[];
|
|
18
|
+
sourceSuppressions?: IPdfSourceSuppression[];
|
|
19
|
+
}
|
|
20
|
+
export interface IPdfThumbnailWorkerRenderRequest {
|
|
21
|
+
type: 'render';
|
|
22
|
+
id: number;
|
|
23
|
+
document: IPdfDocument;
|
|
24
|
+
pageId: string;
|
|
25
|
+
viewport: IPdfPageThumbnailViewport;
|
|
26
|
+
options: IPdfThumbnailWorkerRenderOptions;
|
|
27
|
+
images: IPdfThumbnailWorkerImage[];
|
|
28
|
+
pageRaster?: ImageBitmap;
|
|
29
|
+
}
|
|
30
|
+
export type PdfThumbnailWorkerResponse = {
|
|
31
|
+
type: 'rendered';
|
|
32
|
+
id: number;
|
|
33
|
+
bitmap: ImageBitmap;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'failed';
|
|
36
|
+
id: number;
|
|
37
|
+
error: string;
|
|
38
|
+
};
|
|
39
|
+
export interface IPdfPageThumbnailWorkerRendererOptions {
|
|
40
|
+
createWorker?: () => Worker;
|
|
41
|
+
createImageBitmap?: (source: ImageBitmapSource) => Promise<ImageBitmap>;
|
|
42
|
+
workerURL?: string | URL | Worker;
|
|
43
|
+
}
|
|
44
|
+
export declare function createPdfPageThumbnailWorkerRenderer(options?: IPdfPageThumbnailWorkerRendererOptions): IPdfPageThumbnailWorkerRenderer | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IPdfThumbnailWorkerRenderRequest, PdfThumbnailWorkerResponse } from './pdf-page-thumbnail-worker-client';
|
|
2
|
+
interface IPdfThumbnailWorkerScope {
|
|
3
|
+
readonly document?: unknown;
|
|
4
|
+
onmessage: ((event: MessageEvent<IPdfThumbnailWorkerRenderRequest>) => void) | null;
|
|
5
|
+
postMessage(message: PdfThumbnailWorkerResponse, transfer?: Transferable[]): void;
|
|
6
|
+
}
|
|
7
|
+
/** Starts the dedicated PDF thumbnail worker entry. */
|
|
8
|
+
export declare function startPdfPageThumbnailWorker(scope?: IPdfThumbnailWorkerScope): void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfPage } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfCanvasSourceSuppressionMatcher } from './source-suppression';
|
|
3
|
+
import type { IPdfCanvasViewport } from './viewport';
|
|
4
|
+
export interface IPdfRasterSourceEraserOptions {
|
|
5
|
+
document: IPdfDocument;
|
|
6
|
+
page: IPdfPage;
|
|
7
|
+
context: CanvasRenderingContext2D;
|
|
8
|
+
viewport: IPdfCanvasViewport;
|
|
9
|
+
sourceSuppressionMatcher: IPdfCanvasSourceSuppressionMatcher;
|
|
10
|
+
background: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Page rasters are the most faithful preview for imported PDFs, but they still
|
|
14
|
+
* contain native operators that were promoted into editable overlay objects.
|
|
15
|
+
* Erase only those promoted source regions so the rest of the page can stay on
|
|
16
|
+
* the high-fidelity raster path.
|
|
17
|
+
*/
|
|
18
|
+
export declare function drawPdfRasterSourceErasers(options: IPdfRasterSourceEraserOptions): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IPdfSourceOperationPathSegment, IPdfSourceSuppression, PdfDisplayOperation, PdfDisplayOperationId } from '@univerjs-pro/pdfs';
|
|
2
|
+
export interface IPdfCanvasSourceSuppressionOptions {
|
|
3
|
+
suppressedDisplayOperationIds?: Iterable<PdfDisplayOperationId>;
|
|
4
|
+
sourceSuppressions?: Iterable<IPdfSourceSuppression>;
|
|
5
|
+
}
|
|
6
|
+
export interface IPdfCanvasSourceSuppressionMatcher {
|
|
7
|
+
readonly hasSuppressions: boolean;
|
|
8
|
+
isSuppressed(op: PdfDisplayOperation, operationPath: IPdfSourceOperationPathSegment[]): boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function createPdfCanvasSourceSuppressionMatcher(options: IPdfCanvasSourceSuppressionOptions): IPdfCanvasSourceSuppressionMatcher;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IPdfPage, PdfRectPt } from '@univerjs-pro/pdfs';
|
|
2
|
+
export interface IPdfCanvasViewportOptions {
|
|
3
|
+
zoom?: number;
|
|
4
|
+
devicePixelRatio?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IPdfCanvasViewport {
|
|
7
|
+
zoom: number;
|
|
8
|
+
devicePixelRatio: number;
|
|
9
|
+
widthCssPx: number;
|
|
10
|
+
heightCssPx: number;
|
|
11
|
+
widthDevicePx: number;
|
|
12
|
+
heightDevicePx: number;
|
|
13
|
+
canvasScaleX: number;
|
|
14
|
+
canvasScaleY: number;
|
|
15
|
+
rotation: 0 | 90 | 180 | 270;
|
|
16
|
+
visibleBox: PdfRectPt;
|
|
17
|
+
mediaBox: PdfRectPt;
|
|
18
|
+
contentOffsetXCssPx: number;
|
|
19
|
+
contentOffsetYCssPx: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function createPdfCanvasViewport(page: IPdfPage, options?: IPdfCanvasViewportOptions): IPdfCanvasViewport;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { IPdfEditorCommand, IPdfEditorCommandResult, PdfEditorActorId, PdfEditorClientId, PdfEditorGeneratedIdPrefix } from '@univerjs-pro/pdfs';
|
|
2
|
+
import { Disposable, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';
|
|
3
|
+
import { IPdfEditorRuntimeService } from './pdf-editor-runtime.service';
|
|
4
|
+
/** Outcome category for a UI command entering the formal PDF Unit path. */
|
|
5
|
+
export declare enum PdfEditorCommandExecutionStatus {
|
|
6
|
+
ACCEPTED = "accepted",
|
|
7
|
+
REJECTED = "rejected",
|
|
8
|
+
UNIT_NOT_FOUND = "unit-not-found",
|
|
9
|
+
RUNTIME_NOT_FOUND = "runtime-not-found",
|
|
10
|
+
INVALID_RESULT = "invalid-result"
|
|
11
|
+
}
|
|
12
|
+
/** Local identity and deterministic clock supplied by a UI controller. */
|
|
13
|
+
export interface IPdfEditorCommandExecutionOptions {
|
|
14
|
+
actorId: PdfEditorActorId;
|
|
15
|
+
clientId?: PdfEditorClientId;
|
|
16
|
+
now?: number;
|
|
17
|
+
createId?: (prefix: PdfEditorGeneratedIdPrefix) => string;
|
|
18
|
+
}
|
|
19
|
+
/** Structured result returned to ribbon, pointer, keyboard, or panel callers. */
|
|
20
|
+
export interface IPdfEditorCommandExecutionResult {
|
|
21
|
+
accepted: boolean;
|
|
22
|
+
status: PdfEditorCommandExecutionStatus;
|
|
23
|
+
unitId: string;
|
|
24
|
+
revision?: number;
|
|
25
|
+
result?: IPdfEditorCommandResult;
|
|
26
|
+
}
|
|
27
|
+
/** Executes headless PDF editor commands against a formal PDF Unit. */
|
|
28
|
+
export interface IPdfEditorCommandService {
|
|
29
|
+
execute<TInput>(unitId: string, command: IPdfEditorCommand<TInput>, input: TInput, options: IPdfEditorCommandExecutionOptions): Promise<IPdfEditorCommandExecutionResult>;
|
|
30
|
+
commit(unitId: string, result: IPdfEditorCommandResult, options: IPdfEditorCommandExecutionOptions): Promise<IPdfEditorCommandExecutionResult>;
|
|
31
|
+
undo(unitId: string, options: IPdfEditorCommandExecutionOptions): Promise<IPdfEditorCommandExecutionResult>;
|
|
32
|
+
redo(unitId: string, options: IPdfEditorCommandExecutionOptions): Promise<IPdfEditorCommandExecutionResult>;
|
|
33
|
+
applyHistory(unitId: string, batchId: string, direction: 'undo' | 'redo', options: IPdfEditorCommandExecutionOptions): IPdfEditorCommandExecutionResult;
|
|
34
|
+
}
|
|
35
|
+
export declare const IPdfEditorCommandService: import("@wendellhu/redi").IdentifierDecorator<IPdfEditorCommandService>;
|
|
36
|
+
/**
|
|
37
|
+
* Bridges UI intent to the authoritative PDF Unit mutation. Local state is
|
|
38
|
+
* updated only after the durable mutation has been accepted by Core.
|
|
39
|
+
*/
|
|
40
|
+
export declare class PdfEditorCommandService extends Disposable implements IPdfEditorCommandService {
|
|
41
|
+
private readonly _commandService;
|
|
42
|
+
private readonly _undoRedoService;
|
|
43
|
+
private readonly _instanceService;
|
|
44
|
+
private readonly _runtimeService;
|
|
45
|
+
private readonly _idCounters;
|
|
46
|
+
constructor(_commandService: ICommandService, _undoRedoService: IUndoRedoService, _instanceService: IUniverInstanceService, _runtimeService: IPdfEditorRuntimeService);
|
|
47
|
+
execute<TInput>(unitId: string, command: IPdfEditorCommand<TInput>, input: TInput, options: IPdfEditorCommandExecutionOptions): Promise<IPdfEditorCommandExecutionResult>;
|
|
48
|
+
commit(unitId: string, result: IPdfEditorCommandResult, options: IPdfEditorCommandExecutionOptions): Promise<IPdfEditorCommandExecutionResult>;
|
|
49
|
+
undo(unitId: string, _options: IPdfEditorCommandExecutionOptions): Promise<IPdfEditorCommandExecutionResult>;
|
|
50
|
+
redo(unitId: string, _options: IPdfEditorCommandExecutionOptions): Promise<IPdfEditorCommandExecutionResult>;
|
|
51
|
+
applyHistory(unitId: string, batchId: string, direction: 'undo' | 'redo', options: IPdfEditorCommandExecutionOptions): IPdfEditorCommandExecutionResult;
|
|
52
|
+
private _commitResult;
|
|
53
|
+
private _executeStandardHistory;
|
|
54
|
+
private _executeHistorySync;
|
|
55
|
+
private _reconcileActivePage;
|
|
56
|
+
private _updateLocalResult;
|
|
57
|
+
private _createId;
|
|
58
|
+
private _failure;
|
|
59
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { IPdfEditorMutationBatch, IPdfEditorStateParts, IPdfEditorViewportState, IPdfEphemeralEditorState, IPdfLocalEditorState, IPdfPageCacheEpoch, PdfDocumentModel, PdfPageId } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { Observable } from 'rxjs';
|
|
3
|
+
import { Disposable } from '@univerjs/core';
|
|
4
|
+
/** Kind of change emitted by the local PDF editor runtime store. */
|
|
5
|
+
export declare enum PdfEditorRuntimeEventType {
|
|
6
|
+
ATTACHED = "attached",
|
|
7
|
+
UNIT_UPDATED = "unit-updated",
|
|
8
|
+
LOCAL_UPDATED = "local-updated",
|
|
9
|
+
EPHEMERAL_UPDATED = "ephemeral-updated",
|
|
10
|
+
VIEWPORT_UPDATED = "viewport-updated",
|
|
11
|
+
DETACHED = "detached"
|
|
12
|
+
}
|
|
13
|
+
/** Client-only state associated with one live PDF Unit. */
|
|
14
|
+
export interface IPdfEditorRuntimeState {
|
|
15
|
+
readonly unitId: string;
|
|
16
|
+
readonly local: IPdfLocalEditorState;
|
|
17
|
+
readonly ephemeral: IPdfEphemeralEditorState;
|
|
18
|
+
}
|
|
19
|
+
/** Notification emitted after a runtime state transition. */
|
|
20
|
+
export interface IPdfEditorRuntimeEvent {
|
|
21
|
+
readonly type: PdfEditorRuntimeEventType;
|
|
22
|
+
readonly unitId: string;
|
|
23
|
+
readonly state?: IPdfEditorRuntimeState;
|
|
24
|
+
}
|
|
25
|
+
/** Local runtime store consumed by PDF UI controllers and services. */
|
|
26
|
+
export interface IPdfEditorRuntimeService {
|
|
27
|
+
readonly changed$: Observable<IPdfEditorRuntimeEvent>;
|
|
28
|
+
attachUnit(model: PdfDocumentModel): IPdfEditorRuntimeState;
|
|
29
|
+
detachUnit(unitId: string): boolean;
|
|
30
|
+
getState(unitId: string): IPdfEditorRuntimeState | undefined;
|
|
31
|
+
getStateParts(unitId: string): IPdfEditorStateParts | undefined;
|
|
32
|
+
refreshUnit(unitId: string): boolean;
|
|
33
|
+
updateLocal(unitId: string, updater: (state: IPdfLocalEditorState) => IPdfLocalEditorState): IPdfEditorRuntimeState | undefined;
|
|
34
|
+
updateEphemeral(unitId: string, updater: (state: IPdfEphemeralEditorState) => IPdfEphemeralEditorState): IPdfEditorRuntimeState | undefined;
|
|
35
|
+
updateViewport(unitId: string, patch: Partial<IPdfEditorViewportState>): IPdfEditorRuntimeState | undefined;
|
|
36
|
+
recordMutationBatch(unitId: string, batch: IPdfEditorMutationBatch, notify?: boolean): boolean;
|
|
37
|
+
getPageRevision(unitId: string, pageId: PdfPageId): number;
|
|
38
|
+
getPageCacheEpoch(unitId: string, pageId: PdfPageId, resourceRevision?: number): IPdfPageCacheEpoch | undefined;
|
|
39
|
+
}
|
|
40
|
+
export declare const IPdfEditorRuntimeService: import("@wendellhu/redi").IdentifierDecorator<IPdfEditorRuntimeService>;
|
|
41
|
+
/**
|
|
42
|
+
* Owns state that belongs to the browser editor lifecycle rather than the PDF
|
|
43
|
+
* Unit snapshot. Durable state is deliberately read from the Unit on demand.
|
|
44
|
+
*/
|
|
45
|
+
export declare class PdfEditorRuntimeService extends Disposable implements IPdfEditorRuntimeService {
|
|
46
|
+
private readonly _records;
|
|
47
|
+
private readonly _changed$;
|
|
48
|
+
readonly changed$: Observable<IPdfEditorRuntimeEvent>;
|
|
49
|
+
attachUnit(model: PdfDocumentModel): IPdfEditorRuntimeState;
|
|
50
|
+
detachUnit(unitId: string): boolean;
|
|
51
|
+
getState(unitId: string): IPdfEditorRuntimeState | undefined;
|
|
52
|
+
getStateParts(unitId: string): IPdfEditorStateParts | undefined;
|
|
53
|
+
refreshUnit(unitId: string): boolean;
|
|
54
|
+
updateLocal(unitId: string, updater: (state: IPdfLocalEditorState) => IPdfLocalEditorState): IPdfEditorRuntimeState | undefined;
|
|
55
|
+
updateEphemeral(unitId: string, updater: (state: IPdfEphemeralEditorState) => IPdfEphemeralEditorState): IPdfEditorRuntimeState | undefined;
|
|
56
|
+
updateViewport(unitId: string, patch: Partial<IPdfEditorViewportState>): IPdfEditorRuntimeState | undefined;
|
|
57
|
+
recordMutationBatch(unitId: string, batch: IPdfEditorMutationBatch, notify?: boolean): boolean;
|
|
58
|
+
getPageRevision(unitId: string, pageId: PdfPageId): number;
|
|
59
|
+
getPageCacheEpoch(unitId: string, pageId: PdfPageId, resourceRevision?: number): IPdfPageCacheEpoch | undefined;
|
|
60
|
+
dispose(): void;
|
|
61
|
+
private _emit;
|
|
62
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { IPdfDurableEditState, PdfDurableResourceBinding, PdfListPresetId } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { Observable } from 'rxjs';
|
|
3
|
+
import type { IPdfFontOutline } from '../render/font-outline';
|
|
4
|
+
import { Disposable, Injector, IUniverInstanceService } from '@univerjs/core';
|
|
5
|
+
import { IPdfEditorCommandService } from './pdf-editor-command.service';
|
|
6
|
+
import { IPdfEditorRuntimeService } from './pdf-editor-runtime.service';
|
|
7
|
+
export interface IPdfInsertTableOptions {
|
|
8
|
+
rows: number;
|
|
9
|
+
columns: number;
|
|
10
|
+
}
|
|
11
|
+
/** Executes the PDF insertion actions exposed by the standard Univer ribbon. */
|
|
12
|
+
export declare class PdfInsertService extends Disposable {
|
|
13
|
+
private readonly _instanceService;
|
|
14
|
+
private readonly _commandService;
|
|
15
|
+
private readonly _runtimeService;
|
|
16
|
+
private readonly _imageAdapter;
|
|
17
|
+
private readonly _imageIoService;
|
|
18
|
+
private readonly _fontFaces;
|
|
19
|
+
private readonly _fontOutlines;
|
|
20
|
+
private readonly _loadingFontAssets;
|
|
21
|
+
private readonly _failedFontAssets;
|
|
22
|
+
private readonly _loadingFontOutlines;
|
|
23
|
+
private readonly _failedFontOutlines;
|
|
24
|
+
private readonly _fontResourceUrls;
|
|
25
|
+
private readonly _fontChangedSubject;
|
|
26
|
+
private readonly _resourceChangedSubject;
|
|
27
|
+
private readonly _textEditRequestedSubject;
|
|
28
|
+
private readonly _textEditExitRequestedSubject;
|
|
29
|
+
private readonly _imageChangedSubscription;
|
|
30
|
+
private _fontGeneration;
|
|
31
|
+
private _resourceRevision;
|
|
32
|
+
private _fontResourcesDisposed;
|
|
33
|
+
readonly imageChanged$: Observable<number>;
|
|
34
|
+
readonly fontChanged$: Observable<number>;
|
|
35
|
+
readonly resourceChanged$: Observable<number>;
|
|
36
|
+
readonly textEditRequested$: Observable<string>;
|
|
37
|
+
readonly textEditExitRequested$: Observable<string>;
|
|
38
|
+
constructor(_instanceService: IUniverInstanceService, _commandService: IPdfEditorCommandService, _runtimeService: IPdfEditorRuntimeService, injector: Injector);
|
|
39
|
+
getResourceRevision(): number;
|
|
40
|
+
requestTextEditExit(unitId: string): void;
|
|
41
|
+
insertTextBox(): Promise<boolean>;
|
|
42
|
+
insertParagraph(): Promise<boolean>;
|
|
43
|
+
insertDivider(): Promise<boolean>;
|
|
44
|
+
insertTable(options: IPdfInsertTableOptions): Promise<boolean>;
|
|
45
|
+
insertList(presetId: PdfListPresetId): Promise<boolean>;
|
|
46
|
+
insertImage(file: File): Promise<boolean>;
|
|
47
|
+
insertPage(): Promise<boolean>;
|
|
48
|
+
resolveManagedImage(editState: Pick<IPdfDurableEditState, 'managedResources'>, assetId: string): CanvasImageSource | undefined;
|
|
49
|
+
resolveResourceImage(binding: PdfDurableResourceBinding | undefined): CanvasImageSource | undefined;
|
|
50
|
+
resolveResourceFontFamily(binding: PdfDurableResourceBinding | undefined, assetId: string): string | undefined;
|
|
51
|
+
resolveResourceFontOutline(binding: PdfDurableResourceBinding | undefined, assetId: string): IPdfFontOutline | undefined;
|
|
52
|
+
dispose(): void;
|
|
53
|
+
private _loadResourceFont;
|
|
54
|
+
private _loadResourceFontOutline;
|
|
55
|
+
private _getFontResourceUrl;
|
|
56
|
+
private _notifyResourceChanged;
|
|
57
|
+
private _getContext;
|
|
58
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Injector } from '@univerjs/core';
|
|
2
|
+
import type { Observable } from 'rxjs';
|
|
3
|
+
import { ImageSourceType } from '@univerjs/core';
|
|
4
|
+
export interface IPdfResolvedManagedImage {
|
|
5
|
+
source: string;
|
|
6
|
+
imageSourceType: ImageSourceType.UUID;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
mimeType?: string;
|
|
10
|
+
fileName?: string;
|
|
11
|
+
byteLength?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Runtime boundary for temporary and server-backed managed PDF images. */
|
|
14
|
+
export interface IPdfManagedImageRuntimeAdapter {
|
|
15
|
+
readonly changed$: Observable<number>;
|
|
16
|
+
save(file: File): Promise<IPdfResolvedManagedImage>;
|
|
17
|
+
resolve(source: string): CanvasImageSource | undefined;
|
|
18
|
+
release(source: string): void;
|
|
19
|
+
dispose(): void;
|
|
20
|
+
}
|
|
21
|
+
export interface IPdfDecodedManagedImage {
|
|
22
|
+
image: CanvasImageSource;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
}
|
|
26
|
+
export interface IPdfManagedImageRuntimeAdapterOptions {
|
|
27
|
+
createSource?: () => string;
|
|
28
|
+
decode?: (file: File) => Promise<IPdfDecodedManagedImage>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Keep browser-decoded images in memory while returning metadata that is safe
|
|
32
|
+
* to persist in PDF editor state. No file bytes or data URLs cross this API.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createPdfInMemoryManagedImageRuntimeAdapter(options?: IPdfManagedImageRuntimeAdapterOptions): IPdfManagedImageRuntimeAdapter;
|
|
35
|
+
/** Uses Univer's configured image service for durable collaboration resources. */
|
|
36
|
+
export declare function createPdfImageIoManagedImageRuntimeAdapter(injector: Injector, options?: IPdfManagedImageRuntimeAdapterOptions): IPdfManagedImageRuntimeAdapter;
|
|
37
|
+
export declare function isSupportedBrowserImageMimeType(mimeType: string): boolean;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfEditorFormFieldHitTarget, IPdfEditorNativeFormXObjectHitTarget, IPdfEditorNativeTextHitTarget, IPdfEditorSession, IPdfPage, IPdfPageCacheEpoch, PdfDisplayListId, PdfDocumentModel, PdfObjectId, PdfPageId } from '@univerjs-pro/pdfs';
|
|
2
|
+
import { Disposable } from '@univerjs/core';
|
|
3
|
+
export interface IPdfPageRegion {
|
|
4
|
+
readonly pageId: PdfPageId;
|
|
5
|
+
readonly pageIndex: number;
|
|
6
|
+
readonly page: IPdfPage;
|
|
7
|
+
readonly document: IPdfDocument;
|
|
8
|
+
readonly objectIds: readonly PdfObjectId[];
|
|
9
|
+
readonly rootDisplayListIds: readonly PdfDisplayListId[];
|
|
10
|
+
readonly displayListIds: readonly PdfDisplayListId[];
|
|
11
|
+
readonly nativeTextTargets: readonly IPdfEditorNativeTextHitTarget[];
|
|
12
|
+
readonly nativeFormXObjectTargets: readonly IPdfEditorNativeFormXObjectHitTarget[];
|
|
13
|
+
readonly formFieldTargets: readonly IPdfEditorFormFieldHitTarget[];
|
|
14
|
+
}
|
|
15
|
+
export interface IPdfPageRegionIndexService {
|
|
16
|
+
attachUnit(model: PdfDocumentModel): void;
|
|
17
|
+
detachUnit(unitId: string): boolean;
|
|
18
|
+
preparePage(model: PdfDocumentModel, pageId: PdfPageId, sourcePage?: IPdfPage): IPdfPageRegion | undefined;
|
|
19
|
+
activatePage(model: PdfDocumentModel, pageId: PdfPageId, pageOrder?: readonly IPdfPage[]): () => void;
|
|
20
|
+
peekPage(unitId: string, pageId: PdfPageId): IPdfPageRegion | undefined;
|
|
21
|
+
getPageIndex(model: PdfDocumentModel, pageId: PdfPageId): number;
|
|
22
|
+
getPageProjection(model: PdfDocumentModel, pageId: PdfPageId, session: IPdfEditorSession, variant?: string, epoch?: IPdfPageCacheEpoch): IPdfDocument | undefined;
|
|
23
|
+
}
|
|
24
|
+
export interface IPdfPageRegionScheduler {
|
|
25
|
+
schedule(callback: () => void): unknown;
|
|
26
|
+
cancel(handle: unknown): void;
|
|
27
|
+
}
|
|
28
|
+
export declare const IPdfPageRegionIndexService: import("@wendellhu/redi").IdentifierDecorator<IPdfPageRegionIndexService>;
|
|
29
|
+
/** Runtime-only page index and derived page cache owned by live PDF units. */
|
|
30
|
+
export declare class PdfPageRegionIndexService extends Disposable implements IPdfPageRegionIndexService {
|
|
31
|
+
private readonly _capacity;
|
|
32
|
+
private readonly _scheduler;
|
|
33
|
+
private readonly _records;
|
|
34
|
+
private readonly _pageOrderIndexes;
|
|
35
|
+
constructor(_capacity?: number, _scheduler?: IPdfPageRegionScheduler);
|
|
36
|
+
attachUnit(model: PdfDocumentModel): void;
|
|
37
|
+
detachUnit(unitId: string): boolean;
|
|
38
|
+
preparePage(model: PdfDocumentModel, pageId: PdfPageId, sourcePage?: IPdfPage): IPdfPageRegion | undefined;
|
|
39
|
+
activatePage(model: PdfDocumentModel, pageId: PdfPageId, pageOrder?: readonly IPdfPage[]): () => void;
|
|
40
|
+
peekPage(unitId: string, pageId: PdfPageId): IPdfPageRegion | undefined;
|
|
41
|
+
getPageIndex(model: PdfDocumentModel, pageId: PdfPageId): number;
|
|
42
|
+
getPageProjection(model: PdfDocumentModel, pageId: PdfPageId, session: IPdfEditorSession, variant?: string, epoch?: IPdfPageCacheEpoch): IPdfDocument | undefined;
|
|
43
|
+
dispose(): void;
|
|
44
|
+
private _ensureRecord;
|
|
45
|
+
private _destroyRecord;
|
|
46
|
+
private _touch;
|
|
47
|
+
private _getPageOrderIndex;
|
|
48
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IPdfPageThumbnailActionState, IPdfPageThumbnailContext } from './pdf-page-thumbnail-context.service';
|
|
2
|
+
/** Command-backed actions exposed by a PDF page thumbnail. */
|
|
3
|
+
export declare enum PdfPageThumbnailAction {
|
|
4
|
+
MOVE_UP = "move-up",
|
|
5
|
+
MOVE_DOWN = "move-down",
|
|
6
|
+
COPY = "copy",
|
|
7
|
+
ROTATE_CLOCKWISE = "rotate-clockwise",
|
|
8
|
+
DELETE = "delete"
|
|
9
|
+
}
|
|
10
|
+
/** Host adapter that maps page-rail intent onto PDF mutations. */
|
|
11
|
+
export interface IPdfPageThumbnailActionService {
|
|
12
|
+
getState(context: IPdfPageThumbnailContext): IPdfPageThumbnailActionState;
|
|
13
|
+
execute(action: PdfPageThumbnailAction, context: IPdfPageThumbnailContext): Promise<boolean>;
|
|
14
|
+
}
|
|
15
|
+
export declare const IPdfPageThumbnailActionService: import("@wendellhu/redi").IdentifierDecorator<IPdfPageThumbnailActionService>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import { Disposable } from '@univerjs/core';
|
|
3
|
+
/** The one PDF page targeted by a page-rail context menu. */
|
|
4
|
+
export interface IPdfPageThumbnailContext {
|
|
5
|
+
unitId: string;
|
|
6
|
+
pageId: string;
|
|
7
|
+
pageIndex: number;
|
|
8
|
+
pageCount: number;
|
|
9
|
+
}
|
|
10
|
+
/** Availability derived from the target page's current position. */
|
|
11
|
+
export interface IPdfPageThumbnailActionState {
|
|
12
|
+
canMoveUp: boolean;
|
|
13
|
+
canMoveDown: boolean;
|
|
14
|
+
canCopy: boolean;
|
|
15
|
+
canRotateClockwise: boolean;
|
|
16
|
+
canDelete: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Owns transient single-page context-menu state outside the PDF model. */
|
|
19
|
+
export interface IPdfPageThumbnailContextService {
|
|
20
|
+
readonly context: IPdfPageThumbnailContext | null;
|
|
21
|
+
readonly context$: Observable<IPdfPageThumbnailContext | null>;
|
|
22
|
+
setContext(context: IPdfPageThumbnailContext): void;
|
|
23
|
+
clearContext(): void;
|
|
24
|
+
}
|
|
25
|
+
export declare const IPdfPageThumbnailContextService: import("@wendellhu/redi").IdentifierDecorator<IPdfPageThumbnailContextService>;
|
|
26
|
+
/** Default transient context store used by formal and standalone PDF hosts. */
|
|
27
|
+
export declare class PdfPageThumbnailContextService extends Disposable implements IPdfPageThumbnailContextService {
|
|
28
|
+
private readonly _context$;
|
|
29
|
+
readonly context$: Observable<IPdfPageThumbnailContext | null>;
|
|
30
|
+
get context(): IPdfPageThumbnailContext | null;
|
|
31
|
+
setContext(context: IPdfPageThumbnailContext): void;
|
|
32
|
+
clearContext(): void;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
}
|
|
35
|
+
/** Resolve page actions without consulting mutable document state. */
|
|
36
|
+
export declare function getPdfPageThumbnailActionState(context: IPdfPageThumbnailContext): IPdfPageThumbnailActionState;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IPdfPageThumbnailActionService } from './pdf-page-thumbnail-action.service';
|
|
2
|
+
import type { IPdfPageThumbnailActionState, IPdfPageThumbnailContext } from './pdf-page-thumbnail-context.service';
|
|
3
|
+
import { IUniverInstanceService } from '@univerjs/core';
|
|
4
|
+
import { IPdfEditorCommandService } from './pdf-editor-command.service';
|
|
5
|
+
import { IPdfEditorRuntimeService } from './pdf-editor-runtime.service';
|
|
6
|
+
import { PdfPageThumbnailAction } from './pdf-page-thumbnail-action.service';
|
|
7
|
+
/** Formal Unit adapter for page-rail operations. */
|
|
8
|
+
export declare class PdfPageThumbnailUnitActionService implements IPdfPageThumbnailActionService {
|
|
9
|
+
private readonly _instanceService;
|
|
10
|
+
private readonly _commandService;
|
|
11
|
+
private readonly _runtimeService;
|
|
12
|
+
private _copyId;
|
|
13
|
+
constructor(_instanceService: IUniverInstanceService, _commandService: IPdfEditorCommandService, _runtimeService: IPdfEditorRuntimeService);
|
|
14
|
+
getState(context: IPdfPageThumbnailContext): IPdfPageThumbnailActionState;
|
|
15
|
+
execute(action: PdfPageThumbnailAction, context: IPdfPageThumbnailContext): Promise<boolean>;
|
|
16
|
+
private _resolve;
|
|
17
|
+
private _createCopyPageId;
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PdfDocumentModel } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfCanvasRenderOptions } from '../render/canvas-renderer';
|
|
3
|
+
import type { PdfInsertService } from './pdf-insert.service';
|
|
4
|
+
type PdfRenderResourceResolvers = Pick<IPdfCanvasRenderOptions, 'fontFamilyResolver' | 'fontOutlineResolver' | 'imageResolver' | 'pageRasterResolver' | 'preferPageRaster'>;
|
|
5
|
+
export declare function createPdfRenderResourceResolvers(model: PdfDocumentModel, insertService: PdfInsertService, generation?: string | number): PdfRenderResourceResolvers;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IPdfTableObject, IPdfTableStyleOptions, IPdfTableThemePalette } from '@univerjs-pro/pdfs';
|
|
2
|
+
export interface IPdfTableThemeGalleryProps {
|
|
3
|
+
table: IPdfTableObject;
|
|
4
|
+
palette?: IPdfTableThemePalette;
|
|
5
|
+
onApplyTheme: (styleId: string) => void;
|
|
6
|
+
onChangeOptions: (options: IPdfTableStyleOptions) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function PdfTableThemeGallery(props: IPdfTableThemeGalleryProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDevicePixelSnapOffset(cssCoordinate: number, devicePixelRatio: number): number;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IPdfEditorSession, IPdfPageCacheEpoch, PdfPageId } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfCanvasTextEditController, IPdfCanvasTextEditState } from '../editor/canvas-text-editor';
|
|
3
|
+
interface IPdfCanvasTextEditControllerRef {
|
|
4
|
+
current: Pick<IPdfCanvasTextEditController, 'cancel' | 'getState'> | undefined;
|
|
5
|
+
}
|
|
6
|
+
export interface IPdfCanvasBaseRenderKeyInput {
|
|
7
|
+
unitId: string;
|
|
8
|
+
pageId: string;
|
|
9
|
+
zoom: number;
|
|
10
|
+
devicePixelRatio: number;
|
|
11
|
+
epoch: IPdfPageCacheEpoch;
|
|
12
|
+
activeTextObjectId?: string;
|
|
13
|
+
selectedObjectIds: readonly string[];
|
|
14
|
+
/** Draft-only fields are accepted to make their exclusion explicit. */
|
|
15
|
+
draftText?: unknown;
|
|
16
|
+
selectionRange?: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** Stable key for work that must not rerun for draft text or caret changes. */
|
|
19
|
+
export declare function createPdfCanvasBaseRenderKey(input: IPdfCanvasBaseRenderKeyInput): string;
|
|
20
|
+
/** Take the current edit value and synchronously leave edit mode before saving it. */
|
|
21
|
+
export declare function takePdfCanvasTextEditState(controllerRef: IPdfCanvasTextEditControllerRef): IPdfCanvasTextEditState | undefined;
|
|
22
|
+
export declare function shouldResetPdfCanvasTextEdit(baselineRevision: number | undefined, currentRevision: number | undefined): boolean;
|
|
23
|
+
/** A style-only revision may keep the active draft when its source text still matches. */
|
|
24
|
+
export declare function canRebasePdfCanvasTextEdit(state: IPdfCanvasTextEditState, session: IPdfEditorSession): boolean;
|
|
25
|
+
export declare function shouldSyncPdfCanvasWorkingSession(activeTextEdit: boolean, pointerActive: boolean): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Keep untouched promoted native text on the authoritative page raster.
|
|
28
|
+
*
|
|
29
|
+
* Promotion is needed to enter edit mode, but it is not itself a visual edit.
|
|
30
|
+
* Until a text/style/geometry patch exists, omit the replacement only from the
|
|
31
|
+
* display session so the persisted source and editor history remain intact.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createPdfCanvasDisplaySession(session: IPdfEditorSession, activeTextObjectId?: string, pageId?: PdfPageId): IPdfEditorSession;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface IPdfThumbnailVirtualRangeInput {
|
|
2
|
+
itemCount: number;
|
|
3
|
+
scrollTop: number;
|
|
4
|
+
viewportHeight: number;
|
|
5
|
+
rowHeight: number;
|
|
6
|
+
overscan?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface IPdfThumbnailVirtualRange {
|
|
9
|
+
startIndex: number;
|
|
10
|
+
endIndex: number;
|
|
11
|
+
offsetTop: number;
|
|
12
|
+
totalHeight: number;
|
|
13
|
+
}
|
|
14
|
+
export interface IPdfThumbnailScrollTopInput {
|
|
15
|
+
itemCount: number;
|
|
16
|
+
itemIndex: number;
|
|
17
|
+
scrollTop: number;
|
|
18
|
+
viewportHeight: number;
|
|
19
|
+
rowHeight: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function calculatePdfThumbnailVirtualRange(input: IPdfThumbnailVirtualRangeInput): IPdfThumbnailVirtualRange;
|
|
22
|
+
export declare function calculatePdfThumbnailScrollTop(input: IPdfThumbnailScrollTopInput): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfEditorViewportState, PdfDocumentModel } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfEditorRuntimeService } from '../services/pdf-editor-runtime.service';
|
|
3
|
+
export declare function usePdfWorkbench(): {
|
|
4
|
+
document?: IPdfDocument;
|
|
5
|
+
model?: PdfDocumentModel;
|
|
6
|
+
viewport?: IPdfEditorViewportState;
|
|
7
|
+
};
|
|
8
|
+
export declare function updatePdfWorkbenchViewport(runtimeService: IPdfEditorRuntimeService, unitId: string, patch: Partial<IPdfEditorViewportState>): void;
|