@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,31 @@
|
|
|
1
|
+
import type { PdfEmu, PdfRect } from '@univerjs-pro/pdfs';
|
|
2
|
+
export interface IPdfEditorParagraphAutoFitInput {
|
|
3
|
+
/** Current paragraph box in editor model coordinates. */
|
|
4
|
+
bbox: PdfRect;
|
|
5
|
+
/** Smallest height retained when text becomes shorter. */
|
|
6
|
+
autoFitMinHeight?: PdfEmu;
|
|
7
|
+
/** Height measured by the shared story layout in CSS pixels. */
|
|
8
|
+
requiredHeightCssPx: number;
|
|
9
|
+
/** Current page zoom used by the story layout. */
|
|
10
|
+
zoom: number;
|
|
11
|
+
/** Bottom edge of the editable page region in model coordinates. */
|
|
12
|
+
pageBottom: PdfEmu;
|
|
13
|
+
}
|
|
14
|
+
export interface IPdfEditorParagraphAutoFitResult {
|
|
15
|
+
/** Downward-growing box ready for an atomic paragraph edit command. */
|
|
16
|
+
bbox: PdfRect;
|
|
17
|
+
/** Unclamped measured height in editor model coordinates. */
|
|
18
|
+
requiredHeight: PdfEmu;
|
|
19
|
+
/** Height applied after minimum-height and page-boundary rules. */
|
|
20
|
+
appliedHeight: PdfEmu;
|
|
21
|
+
/** Whether the paragraph still needs more vertical space than the page allows. */
|
|
22
|
+
overflow: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolve paragraph auto-fit without mutating editor state.
|
|
26
|
+
*
|
|
27
|
+
* Paragraphs retain their left, top and right edges and only grow downward.
|
|
28
|
+
* Keeping this policy pure lets the Canvas editor, inspector and commands use
|
|
29
|
+
* the same geometry before committing text and transform in one mutation.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolvePdfEditorParagraphAutoFit(input: IPdfEditorParagraphAutoFitInput): IPdfEditorParagraphAutoFitResult;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { IPdfEditorCommandResult, IPdfEditorFormFieldHitTarget, IPdfEditorNativeFormXObjectHitTarget, IPdfEditorNativeImageHitTarget, IPdfEditorNativeTextHitTarget, IPdfEditorSession, PdfEditorGeneratedIdPrefix, PdfFormFieldType, PdfJsonValue, PdfObjectId, PdfPageId, PdfPoint } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfCanvasViewport } from '../render/viewport';
|
|
3
|
+
import { PdfEditorHitTestMode } from '@univerjs-pro/pdfs';
|
|
4
|
+
export interface IPdfEditorPointerControllerOptions {
|
|
5
|
+
pageId: PdfPageId;
|
|
6
|
+
actorId: string;
|
|
7
|
+
viewport: IPdfCanvasViewport;
|
|
8
|
+
getSession: () => IPdfEditorSession;
|
|
9
|
+
setSession?: (session: IPdfEditorSession) => void;
|
|
10
|
+
setPreviewSession?: (session: IPdfEditorSession | undefined) => void;
|
|
11
|
+
clientId?: string;
|
|
12
|
+
toleranceCssPx?: number;
|
|
13
|
+
now?: () => number;
|
|
14
|
+
createId?: (prefix: PdfEditorGeneratedIdPrefix) => string;
|
|
15
|
+
getNativeImageTargets?: (input: IPdfEditorNativeHitTargetRequest) => IPdfEditorNativeImageHitTarget[];
|
|
16
|
+
getNativeFormXObjectTargets?: (input: IPdfEditorNativeHitTargetRequest) => IPdfEditorNativeFormXObjectHitTarget[];
|
|
17
|
+
getNativeTextTargets?: (input: IPdfEditorNativeHitTargetRequest) => IPdfEditorNativeTextHitTarget[];
|
|
18
|
+
getFormFieldTargets?: (input: IPdfEditorNativeHitTargetRequest) => IPdfEditorFormFieldHitTarget[];
|
|
19
|
+
}
|
|
20
|
+
export interface IPdfEditorNativeHitTargetRequest {
|
|
21
|
+
pageId: PdfPageId;
|
|
22
|
+
cssPoint: [number, number];
|
|
23
|
+
modelPoint: PdfPoint;
|
|
24
|
+
mode: PdfEditorHitTestMode;
|
|
25
|
+
}
|
|
26
|
+
export interface IPdfEditorPointerDownInput {
|
|
27
|
+
cssPoint: [number, number];
|
|
28
|
+
pageId?: PdfPageId;
|
|
29
|
+
mode?: PdfEditorHitTestMode;
|
|
30
|
+
toleranceCssPx?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface IPdfEditorPointerResult {
|
|
33
|
+
session: IPdfEditorSession;
|
|
34
|
+
modelPoint: PdfPoint;
|
|
35
|
+
commandResults?: IPdfEditorCommandResult[];
|
|
36
|
+
preview?: boolean;
|
|
37
|
+
committed?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface IPdfEditorTextEditInput {
|
|
40
|
+
objectId: PdfObjectId;
|
|
41
|
+
text: string;
|
|
42
|
+
pageId?: PdfPageId;
|
|
43
|
+
}
|
|
44
|
+
export interface IPdfEditorFormFieldEditInput {
|
|
45
|
+
pageId?: PdfPageId;
|
|
46
|
+
fieldObjectId: PdfObjectId;
|
|
47
|
+
widgetObjectId?: PdfObjectId;
|
|
48
|
+
fieldName?: string;
|
|
49
|
+
fieldType?: PdfFormFieldType;
|
|
50
|
+
value?: PdfJsonValue;
|
|
51
|
+
previousValue?: PdfJsonValue;
|
|
52
|
+
choices?: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface IPdfEditorPointerController {
|
|
55
|
+
pointerDown(input: IPdfEditorPointerDownInput): IPdfEditorPointerResult;
|
|
56
|
+
pointerMove(input: IPdfEditorPointerDownInput): IPdfEditorPointerResult;
|
|
57
|
+
pointerUp(input: IPdfEditorPointerDownInput): IPdfEditorPointerResult;
|
|
58
|
+
pointerCancel(): void;
|
|
59
|
+
doubleClick(input: IPdfEditorPointerDownInput): IPdfEditorPointerResult;
|
|
60
|
+
commitTextEdit(input: IPdfEditorTextEditInput): IPdfEditorPointerResult;
|
|
61
|
+
commitFormFieldEdit(input: IPdfEditorFormFieldEditInput): IPdfEditorPointerResult;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Convert page-local CSS coordinates into PDF editor model coordinates.
|
|
65
|
+
*
|
|
66
|
+
* This is intentionally hosted in pdfs-ui because CSS pixels and zoom are UI
|
|
67
|
+
* concerns. The editor package receives EMU model coordinates only.
|
|
68
|
+
*/
|
|
69
|
+
export declare function cssPointToPdfEditorModelPoint(cssPoint: [number, number], viewport: IPdfCanvasViewport): PdfPoint;
|
|
70
|
+
/**
|
|
71
|
+
* Create a small pointer bridge from canvas events to editor selection.
|
|
72
|
+
*
|
|
73
|
+
* This controller does not render or mutate PDF content. It only converts
|
|
74
|
+
* coordinates, invokes editor commands, and stores the resulting session.
|
|
75
|
+
*/
|
|
76
|
+
export declare function createPdfEditorPointerController(options: IPdfEditorPointerControllerOptions): IPdfEditorPointerController;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IPointerFrameCoalescer<T> {
|
|
2
|
+
push(value: T): void;
|
|
3
|
+
cancel(): void;
|
|
4
|
+
}
|
|
5
|
+
/** Coalesce pointer values to the latest sample delivered once per frame. */
|
|
6
|
+
export declare function createPointerFrameCoalescer<T>(scheduleFrame: (callback: () => void) => unknown, cancelFrame: (handle: unknown) => void, handler: (value: T) => void): IPointerFrameCoalescer<T>;
|
|
7
|
+
export interface ITargetOperationGuard {
|
|
8
|
+
run<T>(targetId: string, operation: () => Promise<T>): Promise<T>;
|
|
9
|
+
}
|
|
10
|
+
/** Reuse an in-flight operation when the same target is requested repeatedly. */
|
|
11
|
+
export declare function createTargetOperationGuard(): ITargetOperationGuard;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfTextStory, IPdfTextStoryRun, PdfColor, PdfId, PdfTextRunId } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfFontFamilyResolver } from '../render/decode-manifest';
|
|
3
|
+
import type { IPdfEditorCanvasTextBoxCssPx } from './text-layout';
|
|
4
|
+
export interface IPdfEditorTextStoryLayoutInput {
|
|
5
|
+
story: IPdfTextStory;
|
|
6
|
+
boxCssPx: IPdfEditorCanvasTextBoxCssPx;
|
|
7
|
+
measureText: (text: string, font: string) => number;
|
|
8
|
+
maxHeightCssPx?: number;
|
|
9
|
+
paddingCssPx?: number;
|
|
10
|
+
fontSizeScale?: number;
|
|
11
|
+
document?: IPdfDocument;
|
|
12
|
+
fontFamilyResolver?: IPdfFontFamilyResolver;
|
|
13
|
+
}
|
|
14
|
+
export interface IPdfEditorTextStorySpanLayout {
|
|
15
|
+
runId: PdfTextRunId;
|
|
16
|
+
text: string;
|
|
17
|
+
startOffset: number;
|
|
18
|
+
endOffset: number;
|
|
19
|
+
runStartOffset: number;
|
|
20
|
+
runEndOffset: number;
|
|
21
|
+
x: number;
|
|
22
|
+
width: number;
|
|
23
|
+
font: string;
|
|
24
|
+
fontSizeCssPx: number;
|
|
25
|
+
fill: PdfColor | undefined;
|
|
26
|
+
}
|
|
27
|
+
export interface IPdfEditorTextStoryLineLayout {
|
|
28
|
+
blockId: PdfId;
|
|
29
|
+
text: string;
|
|
30
|
+
startOffset: number;
|
|
31
|
+
endOffset: number;
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
baselineY: number;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
font: string;
|
|
38
|
+
fontSizeCssPx: number;
|
|
39
|
+
fill: PdfColor | undefined;
|
|
40
|
+
spans: IPdfEditorTextStorySpanLayout[];
|
|
41
|
+
}
|
|
42
|
+
export interface IPdfEditorTextStoryBlockLayout {
|
|
43
|
+
blockId: PdfId;
|
|
44
|
+
text: string;
|
|
45
|
+
startOffset: number;
|
|
46
|
+
endOffset: number;
|
|
47
|
+
y: number;
|
|
48
|
+
bottom: number;
|
|
49
|
+
marker?: string;
|
|
50
|
+
markerX?: number;
|
|
51
|
+
markerBaselineY?: number;
|
|
52
|
+
markerFont?: string;
|
|
53
|
+
markerFill?: PdfColor;
|
|
54
|
+
bodyX: number;
|
|
55
|
+
lines: IPdfEditorTextStoryLineLayout[];
|
|
56
|
+
runRanges: IPdfEditorTextStoryRunRange[];
|
|
57
|
+
}
|
|
58
|
+
export interface IPdfEditorTextStoryLayout {
|
|
59
|
+
text: string;
|
|
60
|
+
textLength: number;
|
|
61
|
+
blocks: IPdfEditorTextStoryBlockLayout[];
|
|
62
|
+
contentHeightCssPx: number;
|
|
63
|
+
requiredHeightCssPx: number;
|
|
64
|
+
appliedHeightCssPx: number;
|
|
65
|
+
overflow: boolean;
|
|
66
|
+
measureText: (text: string, font: string) => number;
|
|
67
|
+
}
|
|
68
|
+
export interface IPdfEditorTextStoryTextTarget {
|
|
69
|
+
blockId: PdfId;
|
|
70
|
+
offset: number;
|
|
71
|
+
storyOffset: number;
|
|
72
|
+
runId: PdfTextRunId;
|
|
73
|
+
runOffset: number;
|
|
74
|
+
}
|
|
75
|
+
export interface IPdfEditorTextStoryTextRect {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
80
|
+
}
|
|
81
|
+
interface IPdfEditorTextStoryRunRange {
|
|
82
|
+
runId: PdfTextRunId;
|
|
83
|
+
run: IPdfTextStoryRun;
|
|
84
|
+
startOffset: number;
|
|
85
|
+
endOffset: number;
|
|
86
|
+
font: string;
|
|
87
|
+
fontSizeCssPx: number;
|
|
88
|
+
}
|
|
89
|
+
/** Lay out paragraph and list blocks while preserving run and block addressability. */
|
|
90
|
+
export declare function layoutPdfEditorTextStory(input: IPdfEditorTextStoryLayoutInput): IPdfEditorTextStoryLayout;
|
|
91
|
+
/** Resolve the nearest editable run and block offset for a Canvas point. */
|
|
92
|
+
export declare function getPdfEditorTextStoryTargetAtPoint(layout: IPdfEditorTextStoryLayout, point: readonly [number, number]): IPdfEditorTextStoryTextTarget | undefined;
|
|
93
|
+
/** Resolve a block-local caret offset to its wrapped Canvas rectangle. */
|
|
94
|
+
export declare function getPdfEditorTextStoryCaretRect(layout: IPdfEditorTextStoryLayout, blockId: PdfId, offset: number): IPdfEditorTextStoryTextRect | undefined;
|
|
95
|
+
/** Resolve a block-local text range into one rectangle per wrapped line. */
|
|
96
|
+
export declare function getPdfEditorTextStorySelectionRects(layout: IPdfEditorTextStoryLayout, blockId: PdfId, range: {
|
|
97
|
+
start: number;
|
|
98
|
+
end: number;
|
|
99
|
+
}): IPdfEditorTextStoryTextRect[];
|
|
100
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PdfEmu, PdfRect } from '@univerjs-pro/pdfs';
|
|
2
|
+
/** Inputs needed to place a newly created structured table on a PDF page. */
|
|
3
|
+
export interface IPdfEditorTableInsertionLayoutInput {
|
|
4
|
+
viewportWidthCssPx: number;
|
|
5
|
+
viewportHeightCssPx: number;
|
|
6
|
+
zoom: number;
|
|
7
|
+
rows: number;
|
|
8
|
+
columns: number;
|
|
9
|
+
}
|
|
10
|
+
/** Model geometry and first-cell focus point for a newly created PDF table. */
|
|
11
|
+
export interface IPdfEditorTableInsertionLayout {
|
|
12
|
+
bbox: PdfRect;
|
|
13
|
+
padding: PdfEmu;
|
|
14
|
+
firstCellCssPoint: [number, number];
|
|
15
|
+
}
|
|
16
|
+
/** Calculate bounded page placement without changing the requested table structure. */
|
|
17
|
+
export declare function createPdfEditorTableInsertionLayout(input: IPdfEditorTableInsertionLayoutInput): IPdfEditorTableInsertionLayout;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfTableCell, IPdfTableCellStyle, IPdfTableObject, IPdfTextStory, PdfPoint } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfFontFamilyResolver } from '../render/decode-manifest';
|
|
3
|
+
import type { IPdfEditorCssBox } from './geometry';
|
|
4
|
+
import type { IPdfEditorTextStoryLayout } from './story-layout';
|
|
5
|
+
export interface IPdfEditorTableLayoutInput {
|
|
6
|
+
table: IPdfTableObject;
|
|
7
|
+
stories: Readonly<Record<string, IPdfTextStory>>;
|
|
8
|
+
zoom: number;
|
|
9
|
+
measureText: (text: string, font: string) => number;
|
|
10
|
+
document?: IPdfDocument;
|
|
11
|
+
fontFamilyResolver?: IPdfFontFamilyResolver;
|
|
12
|
+
}
|
|
13
|
+
export interface IPdfEditorTableCellLayout {
|
|
14
|
+
cell: IPdfTableCell;
|
|
15
|
+
style: IPdfTableCellStyle;
|
|
16
|
+
outerBoxCssPx: IPdfEditorCssBox;
|
|
17
|
+
contentBoxCssPx: IPdfEditorCssBox;
|
|
18
|
+
story?: IPdfTextStory;
|
|
19
|
+
storyLayout?: IPdfEditorTextStoryLayout;
|
|
20
|
+
textOffsetYCssPx: number;
|
|
21
|
+
overflow: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface IPdfEditorTableLayout {
|
|
24
|
+
table: IPdfTableObject;
|
|
25
|
+
zoom: number;
|
|
26
|
+
boxCssPx: IPdfEditorCssBox;
|
|
27
|
+
cells: IPdfEditorTableCellLayout[];
|
|
28
|
+
}
|
|
29
|
+
/** Lay out a structured table and every cell story from one shared geometry source. */
|
|
30
|
+
export declare function layoutPdfEditorTable(input: IPdfEditorTableLayoutInput): IPdfEditorTableLayout;
|
|
31
|
+
/** Resolve the cell owning a Canvas point with deterministic shared-edge ownership. */
|
|
32
|
+
export declare function getPdfEditorTableCellAtPoint(layout: IPdfEditorTableLayout, point: PdfPoint): IPdfEditorTableCellLayout | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IPdfEditorTableLayout } from './table-layout';
|
|
2
|
+
export interface IPdfEditorTableRenderOptions {
|
|
3
|
+
showOverflow?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/** Draw one structured PDF table from the shared table layout. */
|
|
6
|
+
export declare function renderPdfEditorTableToCanvas(context: CanvasRenderingContext2D, layout: IPdfEditorTableLayout, options?: IPdfEditorTableRenderOptions): void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfTextRun, PdfPoint, PdfRect } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfFontFamilyResolver } from '../render/decode-manifest';
|
|
3
|
+
import { PdfTextAnchor } from '@univerjs-pro/pdfs';
|
|
4
|
+
export interface IPdfEditorTextFontResolveOptions {
|
|
5
|
+
document?: IPdfDocument;
|
|
6
|
+
fontFamilyResolver?: IPdfFontFamilyResolver;
|
|
7
|
+
}
|
|
8
|
+
export interface IPdfEditorTextMeasureInput extends IPdfEditorTextFontResolveOptions {
|
|
9
|
+
origin: PdfPoint;
|
|
10
|
+
text: string;
|
|
11
|
+
runs: IPdfTextRun[];
|
|
12
|
+
measureText: (text: string, font: string) => number;
|
|
13
|
+
paddingCssPx?: number;
|
|
14
|
+
lineHeight?: number;
|
|
15
|
+
minWidthCssPx?: number;
|
|
16
|
+
minHeightCssPx?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface IPdfEditorCanvasTextBoxCssPx {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
}
|
|
24
|
+
export interface IPdfEditorCanvasTextLayoutInput extends IPdfEditorTextFontResolveOptions {
|
|
25
|
+
boxCssPx: IPdfEditorCanvasTextBoxCssPx;
|
|
26
|
+
text: string;
|
|
27
|
+
runs: IPdfTextRun[];
|
|
28
|
+
measureText: (text: string, font: string) => number;
|
|
29
|
+
paddingCssPx?: number;
|
|
30
|
+
lineHeight?: number;
|
|
31
|
+
fontSizeScale?: number;
|
|
32
|
+
textAnchor?: PdfTextAnchor;
|
|
33
|
+
}
|
|
34
|
+
export interface IPdfEditorCanvasTextLineLayout {
|
|
35
|
+
lineIndex: number;
|
|
36
|
+
text: string;
|
|
37
|
+
startOffset: number;
|
|
38
|
+
endOffset: number;
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
baselineY: number;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
font: string;
|
|
45
|
+
fontSizeCssPx: number;
|
|
46
|
+
}
|
|
47
|
+
export interface IPdfEditorCanvasTextLayout {
|
|
48
|
+
text: string;
|
|
49
|
+
textLength: number;
|
|
50
|
+
boxCssPx: IPdfEditorCanvasTextBoxCssPx;
|
|
51
|
+
paddingCssPx: number;
|
|
52
|
+
lineHeightCssPx: number;
|
|
53
|
+
fontSizeCssPx: number;
|
|
54
|
+
font: string;
|
|
55
|
+
lines: IPdfEditorCanvasTextLineLayout[];
|
|
56
|
+
measureText: (text: string, font: string) => number;
|
|
57
|
+
}
|
|
58
|
+
export interface IPdfEditorCanvasTextRectCssPx {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
}
|
|
64
|
+
export declare function resolvePdfEditorTextRunCssFontFamily(run: Pick<IPdfTextRun, 'fontId' | 'fontFamily'>, options?: IPdfEditorTextFontResolveOptions): string;
|
|
65
|
+
export declare function createPdfEditorTextRunCanvasFont(run: Pick<IPdfTextRun, 'bold' | 'italic' | 'fontFamily' | 'fontId'>, fontSizeCssPx: number, options?: IPdfEditorTextFontResolveOptions): string;
|
|
66
|
+
export declare function measurePdfEditorTextBoxContent(input: IPdfEditorTextMeasureInput): PdfRect;
|
|
67
|
+
export declare function layoutPdfEditorCanvasText(input: IPdfEditorCanvasTextLayoutInput): IPdfEditorCanvasTextLayout;
|
|
68
|
+
export declare function getPdfEditorCanvasTextCaretRect(layout: IPdfEditorCanvasTextLayout, offset: number): IPdfEditorCanvasTextRectCssPx;
|
|
69
|
+
export declare function getPdfEditorCanvasTextOffsetAtPoint(layout: IPdfEditorCanvasTextLayout, point: readonly [number, number]): number;
|
|
70
|
+
export declare function getPdfEditorCanvasTextSelectionRects(layout: IPdfEditorCanvasTextLayout, range: {
|
|
71
|
+
start: number;
|
|
72
|
+
end: number;
|
|
73
|
+
}): IPdfEditorCanvasTextRectCssPx[];
|
|
74
|
+
export declare function splitEditorTextLines(text: string): string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './global.css';
|
|
2
|
+
export { PdfInsertDividerOperation, PdfInsertListOperation, PdfInsertPageOperation, PdfInsertParagraphOperation, PdfInsertTableOperation, PdfInsertTextBoxOperation, } from './commands/operations/pdf-insert.operation';
|
|
3
|
+
export type { IUniverPdfsUIConfig } from './config/config';
|
|
4
|
+
export { PdfEditorUnitController } from './controllers/pdf-editor-unit.controller';
|
|
5
|
+
export { disposePdfWorkbenchOwnersBestEffort, fitPdfManagedImageIntoPage, getPdfPageVisibleModelBox, preparePdfManagedImageInsertion, resolvePdfManagedImageRuntimeSource, } from './editor/managed-image-insert';
|
|
6
|
+
export { UniverPdfsUIPlugin } from './plugin';
|
|
7
|
+
export type { IPdfCanvasGroupCompositor } from './render/canvas-group-compositor';
|
|
8
|
+
export { renderPdfPageToCanvas } from './render/canvas-renderer';
|
|
9
|
+
export { startPdfPageThumbnailWorker } from './render/pdf-page-thumbnail.worker';
|
|
10
|
+
export { IPdfEditorRuntimeService, PdfEditorRuntimeEventType, PdfEditorRuntimeService, } from './services/pdf-editor-runtime.service';
|
|
11
|
+
export { PdfInsertService } from './services/pdf-insert.service';
|
|
12
|
+
export { createPdfInMemoryManagedImageRuntimeAdapter } from './services/pdf-managed-image-runtime.adapter';
|
|
13
|
+
export type { IPdfManagedImageRuntimeAdapter, IPdfManagedImageRuntimeAdapterOptions, } from './services/pdf-managed-image-runtime.adapter';
|
|
14
|
+
export { PdfPageRegionIndexService } from './services/pdf-page-region-index.service';
|
|
15
|
+
export { IPdfPageThumbnailActionService, PdfPageThumbnailAction, } from './services/pdf-page-thumbnail-action.service';
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
declare const locale: {
|
|
2
|
+
'pdfs-ui': {
|
|
3
|
+
workbench: {
|
|
4
|
+
title: string;
|
|
5
|
+
aria: {
|
|
6
|
+
ribbonTabs: string;
|
|
7
|
+
pages: string;
|
|
8
|
+
properties: string;
|
|
9
|
+
};
|
|
10
|
+
tabs: {
|
|
11
|
+
start: string;
|
|
12
|
+
insert: string;
|
|
13
|
+
view: string;
|
|
14
|
+
};
|
|
15
|
+
pageRail: {
|
|
16
|
+
newPage: string;
|
|
17
|
+
};
|
|
18
|
+
empty: {
|
|
19
|
+
noDocument: string;
|
|
20
|
+
noPages: string;
|
|
21
|
+
};
|
|
22
|
+
status: {
|
|
23
|
+
page: string;
|
|
24
|
+
zoom: string;
|
|
25
|
+
};
|
|
26
|
+
sidebar: {
|
|
27
|
+
properties: string;
|
|
28
|
+
};
|
|
29
|
+
demo: {
|
|
30
|
+
sample: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
ribbon: {
|
|
34
|
+
groups: {
|
|
35
|
+
file: string;
|
|
36
|
+
edit: string;
|
|
37
|
+
transform: string;
|
|
38
|
+
insert: string;
|
|
39
|
+
display: string;
|
|
40
|
+
};
|
|
41
|
+
actions: {
|
|
42
|
+
importPdf: string;
|
|
43
|
+
importPdfAsNew: string;
|
|
44
|
+
appendPdf: string;
|
|
45
|
+
exportPdf: string;
|
|
46
|
+
undo: string;
|
|
47
|
+
redo: string;
|
|
48
|
+
select: string;
|
|
49
|
+
text: string;
|
|
50
|
+
flipHorizontal: string;
|
|
51
|
+
flipVertical: string;
|
|
52
|
+
textBox: string;
|
|
53
|
+
image: string;
|
|
54
|
+
divider: string;
|
|
55
|
+
table: string;
|
|
56
|
+
list: string;
|
|
57
|
+
annotations: string;
|
|
58
|
+
bounds: string;
|
|
59
|
+
raw: string;
|
|
60
|
+
};
|
|
61
|
+
listPresets: {
|
|
62
|
+
bullet: string;
|
|
63
|
+
hollowBullet: string;
|
|
64
|
+
square: string;
|
|
65
|
+
diamond: string;
|
|
66
|
+
check: string;
|
|
67
|
+
arrow: string;
|
|
68
|
+
decimal: string;
|
|
69
|
+
parenDecimal: string;
|
|
70
|
+
decimalNested: string;
|
|
71
|
+
upperAlpha: string;
|
|
72
|
+
lowerAlpha: string;
|
|
73
|
+
leadingZero: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
tableSizePicker: {
|
|
77
|
+
customSize: string;
|
|
78
|
+
rows: string;
|
|
79
|
+
columns: string;
|
|
80
|
+
insert: string;
|
|
81
|
+
insertTable: string;
|
|
82
|
+
};
|
|
83
|
+
tableTheme: {
|
|
84
|
+
tableTheme: string;
|
|
85
|
+
tableLook: string;
|
|
86
|
+
headerRow: string;
|
|
87
|
+
footerRow: string;
|
|
88
|
+
bandedRows: string;
|
|
89
|
+
bandedColumns: string;
|
|
90
|
+
firstColumn: string;
|
|
91
|
+
lastColumn: string;
|
|
92
|
+
bestMatch: string;
|
|
93
|
+
light: string;
|
|
94
|
+
medium: string;
|
|
95
|
+
minimal: string;
|
|
96
|
+
};
|
|
97
|
+
contextMenu: {
|
|
98
|
+
addText: string;
|
|
99
|
+
editText: string;
|
|
100
|
+
editValue: string;
|
|
101
|
+
copy: string;
|
|
102
|
+
paste: string;
|
|
103
|
+
replaceImage: string;
|
|
104
|
+
cropImage: string;
|
|
105
|
+
flipHorizontal: string;
|
|
106
|
+
flipVertical: string;
|
|
107
|
+
bringForward: string;
|
|
108
|
+
sendBackward: string;
|
|
109
|
+
exportPatch: string;
|
|
110
|
+
delete: string;
|
|
111
|
+
};
|
|
112
|
+
pageThumbnail: {
|
|
113
|
+
moveUp: string;
|
|
114
|
+
moveDown: string;
|
|
115
|
+
copy: string;
|
|
116
|
+
rotateClockwise: string;
|
|
117
|
+
delete: string;
|
|
118
|
+
};
|
|
119
|
+
exportPatch: {
|
|
120
|
+
title: string;
|
|
121
|
+
summary: string;
|
|
122
|
+
json: string;
|
|
123
|
+
exportEditedJson: string;
|
|
124
|
+
};
|
|
125
|
+
inspector: {
|
|
126
|
+
titles: {
|
|
127
|
+
text: string;
|
|
128
|
+
image: string;
|
|
129
|
+
formXObject: string;
|
|
130
|
+
formField: string;
|
|
131
|
+
page: string;
|
|
132
|
+
nativeSource: string;
|
|
133
|
+
object: string;
|
|
134
|
+
document: string;
|
|
135
|
+
tableCell: string;
|
|
136
|
+
};
|
|
137
|
+
sections: {
|
|
138
|
+
text: string;
|
|
139
|
+
image: string;
|
|
140
|
+
cell: string;
|
|
141
|
+
source: string;
|
|
142
|
+
formField: string;
|
|
143
|
+
page: string;
|
|
144
|
+
document: string;
|
|
145
|
+
transform: string;
|
|
146
|
+
arrange: string;
|
|
147
|
+
paragraph: string;
|
|
148
|
+
};
|
|
149
|
+
fields: {
|
|
150
|
+
fontFamily: string;
|
|
151
|
+
fontSize: string;
|
|
152
|
+
bold: string;
|
|
153
|
+
italic: string;
|
|
154
|
+
underline: string;
|
|
155
|
+
background: string;
|
|
156
|
+
verticalAlign: string;
|
|
157
|
+
objectRef: string;
|
|
158
|
+
displayLists: string;
|
|
159
|
+
fieldName: string;
|
|
160
|
+
fieldType: string;
|
|
161
|
+
pageId: string;
|
|
162
|
+
operators: string;
|
|
163
|
+
documentId: string;
|
|
164
|
+
revision: string;
|
|
165
|
+
x: string;
|
|
166
|
+
y: string;
|
|
167
|
+
width: string;
|
|
168
|
+
height: string;
|
|
169
|
+
align: string;
|
|
170
|
+
lineHeight: string;
|
|
171
|
+
leftIndent: string;
|
|
172
|
+
firstLine: string;
|
|
173
|
+
rightIndent: string;
|
|
174
|
+
before: string;
|
|
175
|
+
after: string;
|
|
176
|
+
horizontal: string;
|
|
177
|
+
vertical: string;
|
|
178
|
+
left: string;
|
|
179
|
+
center: string;
|
|
180
|
+
right: string;
|
|
181
|
+
top: string;
|
|
182
|
+
middle: string;
|
|
183
|
+
bottom: string;
|
|
184
|
+
pageGeometry: string;
|
|
185
|
+
crop: string;
|
|
186
|
+
cropLeft: string;
|
|
187
|
+
cropBottom: string;
|
|
188
|
+
cropRight: string;
|
|
189
|
+
cropTop: string;
|
|
190
|
+
sideLeft: string;
|
|
191
|
+
sideTop: string;
|
|
192
|
+
sideRight: string;
|
|
193
|
+
sideBottom: string;
|
|
194
|
+
};
|
|
195
|
+
actions: {
|
|
196
|
+
replaceImage: string;
|
|
197
|
+
cropImage: string;
|
|
198
|
+
resetCrop: string;
|
|
199
|
+
flipHorizontal: string;
|
|
200
|
+
flipVertical: string;
|
|
201
|
+
addText: string;
|
|
202
|
+
finishEditing: string;
|
|
203
|
+
pageGeometry: string;
|
|
204
|
+
exportPatch: string;
|
|
205
|
+
bringForward: string;
|
|
206
|
+
sendBackward: string;
|
|
207
|
+
rotate90: string;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
export default locale;
|