@yudaocode/univer-pdfs-ui 0.0.0-stage → 1.6.205

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.
@@ -0,0 +1,243 @@
1
+ import * as _univerjs_core from '@univerjs/core';
2
+ import { Disposable, ICommandService, IOperation, Plugin, Injector, UniverInstanceType } from '@univerjs/core';
3
+ import { IMenuManagerService, IUIPartsService, ISidebarService, ComponentManager, IconManager } from '@univerjs/ui';
4
+ import { PdfElementType, IPdfjsAssetsConfig, IPdfExportOptions, PdfInteractionMode, PdfDisplayUnit, IPdfImportOutcome, IPdfPageSize } from '@yudaocode/univer-pdfs';
5
+ import { Observable } from 'rxjs';
6
+ export { default as PdfsUIEnUS } from './locale/en-US.js';
7
+ export { IPdfsUILocale, default as PdfsUIZhCN } from './locale/zh-CN.js';
8
+ import React from 'react';
9
+
10
+ type PdfModalTabMode = 'preview' | 'json';
11
+ type PdfShapeKind = 'rect' | 'ellipse' | 'line' | 'highlight';
12
+ interface IReportWidgetsConfig {
13
+ qrcode?: boolean;
14
+ barcode?: boolean;
15
+ dynamicTable?: boolean;
16
+ }
17
+ interface IUniverPdfsUIFeatures {
18
+ datasetBinding?: boolean;
19
+ reportWidgets?: boolean | IReportWidgetsConfig;
20
+ basePdfOverlay?: boolean;
21
+ /** AI template copilot panel & toolbar button (default `true`) */
22
+ ai?: boolean;
23
+ /** Historical version snapshots panel (default `true`) */
24
+ versions?: boolean;
25
+ /** Optional Content Group `/OCProperties` layers panel (default `true`) */
26
+ layers?: boolean;
27
+ /** Embedded file `/EmbeddedFiles` attachments panel (default `true`) */
28
+ attachments?: boolean;
29
+ /** Page 90-degree rotation controls (default `true`) */
30
+ pageRotate?: boolean;
31
+ /** Page CropBox controls (default `true`) */
32
+ cropBox?: boolean;
33
+ /** Full-document & native-text find and replace panel (default `true`) */
34
+ findReplace?: boolean;
35
+ /** PDF `/Outlines` bookmarks panel (default `true`) */
36
+ bookmarks?: boolean;
37
+ /** Bates legal numbering panel (default `true`) */
38
+ bates?: boolean;
39
+ /** Page header & footer configuration panel (default `true`) */
40
+ headerFooter?: boolean;
41
+ /** Element hyperlink `/Subtype /Link` inspector (default `true`) */
42
+ links?: boolean;
43
+ /** Multi-column text flow controls (default `true`) */
44
+ textColumns?: boolean;
45
+ /** Per-page subtotal & grand-total table controls (default `true`) */
46
+ tableTotals?: boolean;
47
+ /** Freehand ink signature/annotation drawing mode (default `true`) */
48
+ ink?: boolean;
49
+ /** Interactive form-filling mode & form field validation/calc inspector (default `true`) */
50
+ form?: boolean;
51
+ /** AcroForm field auto-detect, export, & XFDF data I/O (default `true`) */
52
+ acroForm?: boolean;
53
+ /** Document metadata & annotation sanitization controls (default `true`) */
54
+ sanitize?: boolean;
55
+ /** Browser & silent hardware print actions (default `true`) */
56
+ print?: boolean;
57
+ /** Optional allowlist restricting insertable `PdfElementType` values (`null`/`undefined` = allow all) */
58
+ allowedElementTypes?: PdfElementType[] | null;
59
+ /** Optional allowlist restricting shape subtypes (`null`/`undefined` = allow all) */
60
+ allowedShapeTypes?: PdfShapeKind[] | null;
61
+ }
62
+ interface IResolvedPdfsUIFeatures {
63
+ datasetBinding: boolean;
64
+ qrcode: boolean;
65
+ barcode: boolean;
66
+ dynamicTable: boolean;
67
+ basePdfOverlay: boolean;
68
+ ai: boolean;
69
+ versions: boolean;
70
+ layers: boolean;
71
+ attachments: boolean;
72
+ pageRotate: boolean;
73
+ cropBox: boolean;
74
+ findReplace: boolean;
75
+ bookmarks: boolean;
76
+ bates: boolean;
77
+ headerFooter: boolean;
78
+ links: boolean;
79
+ textColumns: boolean;
80
+ tableTotals: boolean;
81
+ ink: boolean;
82
+ form: boolean;
83
+ acroForm: boolean;
84
+ sanitize: boolean;
85
+ print: boolean;
86
+ allowedElementTypes: PdfElementType[] | null;
87
+ allowedShapeTypes: PdfShapeKind[] | null;
88
+ }
89
+ declare function resolvePdfsUIFeatures(raw?: IUniverPdfsUIFeatures): IResolvedPdfsUIFeatures;
90
+ declare function isPdfElementTypeAllowed(elementType: PdfElementType, features: IResolvedPdfsUIFeatures): boolean;
91
+ declare function isPdfShapeTypeAllowed(shapeType: PdfShapeKind, features: IResolvedPdfsUIFeatures): boolean;
92
+ interface IPdfsUIFeatureService {
93
+ readonly features$: Observable<IResolvedPdfsUIFeatures>;
94
+ readonly modalTab$: Observable<PdfModalTabMode>;
95
+ readonly editorEnabled$: Observable<boolean>;
96
+ getFeatures(): IResolvedPdfsUIFeatures;
97
+ setFeatures(features: IUniverPdfsUIFeatures): void;
98
+ patchFeatures(patch: Partial<IResolvedPdfsUIFeatures>): void;
99
+ getModalTab(): PdfModalTabMode;
100
+ setModalTab(tab: PdfModalTabMode): void;
101
+ isEditorEnabled(): boolean;
102
+ setEditorEnabled(enabled: boolean): void;
103
+ }
104
+ declare const IPdfsUIFeatureService: _univerjs_core.IdentifierDecorator<IPdfsUIFeatureService>;
105
+ declare class PdfsUIFeatureService extends Disposable implements IPdfsUIFeatureService {
106
+ private readonly _features$;
107
+ private readonly _modalTab$;
108
+ private readonly _editorEnabled$;
109
+ readonly features$: Observable<IResolvedPdfsUIFeatures>;
110
+ readonly modalTab$: Observable<PdfModalTabMode>;
111
+ readonly editorEnabled$: Observable<boolean>;
112
+ constructor(initial?: IUniverPdfsUIFeatures, editorEnabled?: boolean);
113
+ dispose(): void;
114
+ getFeatures(): IResolvedPdfsUIFeatures;
115
+ setFeatures(features: IUniverPdfsUIFeatures): void;
116
+ patchFeatures(patch: Partial<IResolvedPdfsUIFeatures>): void;
117
+ getModalTab(): PdfModalTabMode;
118
+ setModalTab(tab: PdfModalTabMode): void;
119
+ isEditorEnabled(): boolean;
120
+ setEditorEnabled(enabled: boolean): void;
121
+ }
122
+
123
+ interface IUniverPdfsUIEditorConfig {
124
+ /** When `false`, mounts the PDF workspace in read-only viewer mode (default `true`) */
125
+ enabled?: boolean;
126
+ }
127
+ interface IUniverPdfsUIConfig {
128
+ /** Whether to open the right inspector sidebar by default when the editor loads */
129
+ defaultOpenInspector?: boolean;
130
+ /** Controls interactive editing vs read-only viewer mode (`{ enabled: false }`) */
131
+ editor?: IUniverPdfsUIEditorConfig;
132
+ /** Optional `pdfjs-dist` worker, CMap, and standard font asset configuration */
133
+ pdfjsAssets?: IPdfjsAssetsConfig;
134
+ /**
135
+ * Optional enterprise report, print-overlay, and granular UI capability flags.
136
+ */
137
+ features?: IUniverPdfsUIFeatures;
138
+ }
139
+ declare class PdfsUIController extends Disposable {
140
+ private readonly _config;
141
+ private readonly _commandService;
142
+ private readonly _menuManagerService;
143
+ private readonly _uiPartsService;
144
+ private readonly _sidebarService;
145
+ private readonly _componentManager;
146
+ private readonly _iconManager;
147
+ private _openInspectorTimer;
148
+ constructor(_config: Partial<IUniverPdfsUIConfig>, _commandService: ICommandService, _menuManagerService: IMenuManagerService, _uiPartsService: IUIPartsService, _sidebarService: ISidebarService, _componentManager: ComponentManager, _iconManager: IconManager);
149
+ private _initIcons;
150
+ private _initComponents;
151
+ private _initOperations;
152
+ private _initMenus;
153
+ private _initWorkbenchParts;
154
+ }
155
+
156
+ declare const PDF_INSPECTOR_SIDEBAR_ID = "univer.pdfs.inspector.sidebar";
157
+ declare const PDF_INSPECTOR_COMPONENT_KEY = "univer.pdfs.inspector.component";
158
+ declare function openPdfInspectorSidebar(sidebarService: ISidebarService): void;
159
+ declare const TogglePdfInspectorOperation: IOperation;
160
+ declare const OpenPdfPreviewOperation: IOperation<{
161
+ tab?: PdfModalTabMode;
162
+ }>;
163
+ declare function readBrowserFileAsOverlayOutcome(file: File, options?: {
164
+ password?: string;
165
+ }): Promise<IPdfImportOutcome>;
166
+ declare const UploadBasePdfOperation: IOperation<{
167
+ password?: string;
168
+ }>;
169
+ declare const SavePdfToHostOperation: IOperation;
170
+ interface IPrintPdfOperationParams {
171
+ unitId?: string;
172
+ pdfBytes?: Uint8Array;
173
+ data?: Record<string, unknown>;
174
+ options?: IPdfExportOptions;
175
+ }
176
+ /**
177
+ * Commits active inline edits, compiles PDF bytes if not pre-supplied, and triggers native browser printing
178
+ * via a hidden Blob `<iframe>`.
179
+ */
180
+ declare const PrintPdfOperation: IOperation<IPrintPdfOperationParams, Promise<boolean>>;
181
+ declare const SetPdfInteractionModeOperation: IOperation<{
182
+ mode: PdfInteractionMode;
183
+ }>;
184
+ declare const SelectActivePdfPageOperation: IOperation<{
185
+ pageId: string;
186
+ }>;
187
+ declare const SetPdfInkColorOperation: IOperation<{
188
+ color: string;
189
+ }>;
190
+ declare const InsertPdfPresetElementOperation: IOperation<{
191
+ preset: 'paragraph' | 'divider' | 'highlight' | 'underline-mark' | 'strike-mark';
192
+ }>;
193
+ declare const TogglePdfRulerOperation: IOperation;
194
+ declare const TogglePdfGridOperation: IOperation;
195
+ declare const TogglePdfCalibrationGridOperation: IOperation;
196
+ declare const TogglePdfMarginsOperation: IOperation;
197
+ declare const TogglePdfSnapOperation: IOperation;
198
+ declare const SwitchPdfDisplayUnitOperation: IOperation<{
199
+ unit?: PdfDisplayUnit;
200
+ }>;
201
+ declare const AdjustPdfZoomOperation: IOperation<{
202
+ delta?: number;
203
+ zoom?: number;
204
+ }>;
205
+ declare const UpdatePdfUIFeaturesOperation: IOperation<{
206
+ features?: IUniverPdfsUIFeatures;
207
+ patch?: Partial<IResolvedPdfsUIFeatures>;
208
+ editorEnabled?: boolean;
209
+ }>;
210
+
211
+ declare const UNIVER_PDFS_UI_PLUGIN_NAME = "UNIVER_PDFS_UI_PLUGIN";
212
+ declare class UniverPdfsUIPlugin extends Plugin {
213
+ private readonly _config;
214
+ protected readonly _injector: Injector;
215
+ static pluginName: string;
216
+ static packageName: string;
217
+ static type: UniverInstanceType;
218
+ constructor(_config: Partial<IUniverPdfsUIConfig> | undefined, _injector: Injector);
219
+ onStarting(): void;
220
+ }
221
+
222
+ declare function configurePdfjsAssets(assets?: IPdfjsAssetsConfig): void;
223
+ declare function getPdfjsAssetsConfig(): IPdfjsAssetsConfig | undefined;
224
+ /**
225
+ * Computes a collision-resistant full-payload dual-32-bit (64-bit) FNV-1a digest + byte length cache key.
226
+ * Two distinct PDFs of identical byte/base64 length will NEVER collide.
227
+ */
228
+ declare function computePdfDocumentCacheKey(input: string | Uint8Array): string;
229
+ declare function clearPdfDocumentCache(): Promise<void>;
230
+ declare function inspectSourcePdfPages(dataUri: string, assets?: IPdfjsAssetsConfig): Promise<IPdfPageSize[]>;
231
+ declare function renderSourcePdfPageToCanvas(canvas: HTMLCanvasElement, dataUri: string, pageNumber: number, targetWidthPx: number, targetHeightPx: number, assets?: IPdfjsAssetsConfig): Promise<void>;
232
+
233
+ declare const PdfCanvasView: React.FC;
234
+
235
+ declare const PdfStatusBar: React.FC;
236
+
237
+ declare const PdfInspectorPanel: React.FC;
238
+
239
+ declare const PdfLeftSidebar: React.FC;
240
+
241
+ declare const PdfPreviewModal: React.FC;
242
+
243
+ export { AdjustPdfZoomOperation, IPdfsUIFeatureService, type IPrintPdfOperationParams, type IReportWidgetsConfig, type IResolvedPdfsUIFeatures, type IUniverPdfsUIConfig, type IUniverPdfsUIEditorConfig, type IUniverPdfsUIFeatures, InsertPdfPresetElementOperation, OpenPdfPreviewOperation, PDF_INSPECTOR_COMPONENT_KEY, PDF_INSPECTOR_SIDEBAR_ID, PdfCanvasView, PdfInspectorPanel, PdfInspectorPanel as PdfInspectorSidebar, PdfLeftSidebar, PdfPreviewModal, type PdfShapeKind, PdfStatusBar, PdfsUIController, PdfsUIFeatureService, PrintPdfOperation, SavePdfToHostOperation, SelectActivePdfPageOperation, SetPdfInkColorOperation, SetPdfInteractionModeOperation, SwitchPdfDisplayUnitOperation, TogglePdfCalibrationGridOperation, TogglePdfGridOperation, TogglePdfInspectorOperation, TogglePdfMarginsOperation, TogglePdfRulerOperation, TogglePdfSnapOperation, UNIVER_PDFS_UI_PLUGIN_NAME, UniverPdfsUIPlugin, UpdatePdfUIFeaturesOperation, UploadBasePdfOperation, clearPdfDocumentCache, computePdfDocumentCacheKey, configurePdfjsAssets, getPdfjsAssetsConfig, inspectSourcePdfPages, isPdfElementTypeAllowed, isPdfShapeTypeAllowed, openPdfInspectorSidebar, readBrowserFileAsOverlayOutcome, renderSourcePdfPageToCanvas, resolvePdfsUIFeatures };
@@ -0,0 +1,5 @@
1
+ import { IPdfsUILocale } from './zh-CN.js';
2
+
3
+ declare const locale: IPdfsUILocale;
4
+
5
+ export { locale as default };
@@ -0,0 +1,70 @@
1
+ declare const locale: {
2
+ pdfs: {
3
+ ribbon: {
4
+ annotateTab: string;
5
+ selectMode: string;
6
+ panMode: string;
7
+ inkMode: string;
8
+ highlight: string;
9
+ underlineMark: string;
10
+ strikeMark: string;
11
+ insertText: string;
12
+ insertParagraph: string;
13
+ insertList: string;
14
+ insertDivider: string;
15
+ insertImage: string;
16
+ insertStaticTable: string;
17
+ insertTable: string;
18
+ insertQrCode: string;
19
+ insertBarcode: string;
20
+ insertShape: string;
21
+ insertStamp: string;
22
+ addPage: string;
23
+ alignLeft: string;
24
+ alignCenter: string;
25
+ alignRight: string;
26
+ alignTop: string;
27
+ alignMiddle: string;
28
+ alignBottom: string;
29
+ distributeH: string;
30
+ distributeV: string;
31
+ duplicate: string;
32
+ delete: string;
33
+ importPdf: string;
34
+ jsonExchange: string;
35
+ inspector: string;
36
+ previewPdf: string;
37
+ printPdf: string;
38
+ toggleRuler: string;
39
+ toggleGrid: string;
40
+ toggleMargins: string;
41
+ toggleSnap: string;
42
+ switchUnit: string;
43
+ zoomIn: string;
44
+ zoomOut: string;
45
+ zoomReset: string;
46
+ };
47
+ sidebar: {
48
+ pagesTab: string;
49
+ datasetsTab: string;
50
+ addPage: string;
51
+ deletePage: string;
52
+ inspectorTitle: string;
53
+ docProps: string;
54
+ elementProps: string;
55
+ };
56
+ statusbar: {
57
+ page: string;
58
+ elements: string;
59
+ ruler: string;
60
+ grid: string;
61
+ margins: string;
62
+ snap: string;
63
+ fitWidth: string;
64
+ };
65
+ };
66
+ };
67
+
68
+ type IPdfsUILocale = typeof locale;
69
+
70
+ export { type IPdfsUILocale, locale as default };
package/package.json CHANGED
@@ -1,6 +1,82 @@
1
1
  {
2
2
  "name": "@yudaocode/univer-pdfs-ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.6.205",
4
+ "description": "Univer PDFs UI plugin with native Univer Ribbon, Left Thumbnail Sidebar, Canvas Designer, and Inspector Sidebar",
5
+ "license": "Apache-2.0",
6
+ "homepage": "https://github.com/yudaocode/yudao-univer#readme",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/yudaocode/yudao-univer.git",
10
+ "directory": "packages/pdfs-ui"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/yudaocode/yudao-univer/issues"
14
+ },
15
+ "keywords": [
16
+ "univer",
17
+ "yudao",
18
+ "pdf",
19
+ "designer",
20
+ "ui",
21
+ "plugin"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public",
25
+ "registry": "https://registry.npmjs.org/"
26
+ },
27
+ "files": [
28
+ "lib"
29
+ ],
30
+ "main": "./lib/cjs/index.js",
31
+ "module": "./lib/es/index.js",
32
+ "types": "./lib/types/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./lib/types/index.d.ts",
36
+ "import": "./lib/es/index.js",
37
+ "require": "./lib/cjs/index.js"
38
+ },
39
+ "./locale/zh-CN": {
40
+ "types": "./lib/types/locale/zh-CN.d.ts",
41
+ "import": "./lib/es/locale/zh-CN.js",
42
+ "require": "./lib/cjs/locale/zh-CN.js"
43
+ },
44
+ "./locale/en-US": {
45
+ "types": "./lib/types/locale/en-US.d.ts",
46
+ "import": "./lib/es/locale/en-US.js",
47
+ "require": "./lib/cjs/locale/en-US.js"
48
+ },
49
+ "./lib/index.css": "./lib/index.css",
50
+ "./styles.css": "./lib/index.css",
51
+ "./package.json": "./package.json"
52
+ },
53
+ "dependencies": {
54
+ "pdfjs-dist": "^4.8.69"
55
+ },
56
+ "peerDependencies": {
57
+ "@univerjs/core": "^1.6.2",
58
+ "@univerjs/design": "^1.6.2",
59
+ "@univerjs/engine-render": "^1.6.2",
60
+ "@univerjs/ui": "^1.6.2",
61
+ "react": ">=18.0.0",
62
+ "react-dom": ">=18.0.0",
63
+ "rxjs": ">=7.0.0",
64
+ "@yudaocode/univer-pdfs": "^1.6.205"
65
+ },
66
+ "devDependencies": {
67
+ "@univerjs/core": "1.6.2",
68
+ "@univerjs/design": "1.6.2",
69
+ "@univerjs/engine-render": "1.6.2",
70
+ "@univerjs/icons": "^1.50.0",
71
+ "@univerjs/ui": "1.6.2",
72
+ "react": "^18.3.1",
73
+ "react-dom": "^18.3.1",
74
+ "rxjs": "^7.8.1",
75
+ "@yudaocode/univer-pdfs": "1.6.205"
76
+ },
77
+ "scripts": {
78
+ "build": "tsup",
79
+ "test": "vitest run",
80
+ "typecheck": "tsc --noEmit"
81
+ }
6
82
  }