@univerjs/docs 1.0.0-insiders.20260813-7c9aa50 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/README.md +0 -1
- package/lib/cjs/facade.js +395 -78
- package/lib/cjs/index.js +2734 -100
- package/lib/es/facade.js +390 -80
- package/lib/es/index.js +2703 -105
- package/lib/facade.js +390 -80
- package/lib/index.js +2703 -105
- package/lib/types/commands/commands/core-editing.command.d.ts +5 -1
- package/lib/types/commands/commands/set-document-permission.command.d.ts +27 -0
- package/lib/types/commands/commands/set-document-permissions.command.d.ts +17 -0
- package/lib/types/commands/mutations/core-editing.mutation-id.d.ts +16 -0
- package/lib/types/commands/mutations/core-editing.mutation.d.ts +22 -1
- package/lib/types/commands/mutations/doc-structure-mutation-validation.d.ts +18 -0
- package/lib/types/commands/mutations/set-document-permission-rule.mutation.d.ts +17 -0
- package/lib/types/commands/mutations/set-document-permission-rules.mutation.d.ts +17 -0
- package/lib/types/controllers/doc-permission.controller.d.ts +26 -0
- package/lib/types/facade/f-document-paragraph.d.ts +15 -2
- package/lib/types/facade/f-document-permission.d.ts +177 -0
- package/lib/types/facade/f-document-section.d.ts +43 -2
- package/lib/types/facade/f-document-text-range.d.ts +7 -1
- package/lib/types/facade/f-document.d.ts +63 -15
- package/lib/types/facade/f-univer.d.ts +5 -4
- package/lib/types/facade/index.d.ts +1 -0
- package/lib/types/facade/utils.d.ts +2 -1
- package/lib/types/index.d.ts +13 -1
- package/lib/types/layout-worker/config/config.d.ts +32 -0
- package/lib/types/layout-worker/document-font-metrics.d.ts +18 -0
- package/lib/types/layout-worker/font-loader.d.ts +26 -0
- package/lib/types/layout-worker/index.d.ts +73 -0
- package/lib/types/layout-worker/performance-tracker.d.ts +27 -0
- package/lib/types/layout-worker/protocol.d.ts +37 -0
- package/lib/types/layout-worker/worker.d.ts +51 -0
- package/lib/types/plugin.d.ts +1 -0
- package/lib/types/services/doc-interceptor/interceptor-const.d.ts +2 -1
- package/lib/types/services/doc-layout-executor.service.d.ts +224 -0
- package/lib/types/services/doc-selection-manager.service.d.ts +7 -1
- package/lib/types/services/doc-skeleton-manager.service.d.ts +6 -1
- package/lib/types/services/doc-state-change-manager.service.d.ts +3 -0
- package/lib/types/services/doc-state-emit.service.d.ts +1 -0
- package/lib/types/services/document-layout-snapshot.d.ts +22 -0
- package/lib/types/services/permission/document-permission-resolver.d.ts +27 -0
- package/lib/types/services/permission/document-permission-rule.model.d.ts +19 -0
- package/lib/types/services/permission/document-permission.d.ts +35 -0
- package/lib/types/services/permission/permission-point/document/comment.d.ts +27 -0
- package/lib/types/services/permission/permission-point/document/copy.d.ts +27 -0
- package/lib/types/services/permission/permission-point/document/editable.d.ts +27 -0
- package/lib/types/services/permission/permission-point/document/export.d.ts +27 -0
- package/lib/types/services/permission/permission-point/document/print.d.ts +27 -0
- package/lib/types/services/permission/permission-point/entity/edit.d.ts +28 -0
- package/lib/types/services/permission/permission-point/paragraph/edit.d.ts +28 -0
- package/lib/types/services/permission/permission-point/section/edit.d.ts +28 -0
- package/lib/umd/facade.js +3 -3
- package/lib/umd/index.js +2 -2
- package/package.json +7 -5
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
import type { DocumentDataModel, IDocumentBody, IDocumentData, IParagraphBorder, ISectionBreak, SectionType } from '@univerjs/core';
|
|
17
17
|
import type { IHeaderFooterProps } from '@univerjs/docs';
|
|
18
18
|
import type { IFDocumentTextRange } from './utils';
|
|
19
|
-
import { DocumentFlavor, ICommandService, Injector, IResourceLoaderService, IUniverInstanceService } from '@univerjs/core';
|
|
19
|
+
import { DocumentFlavor, ICommandService, Injector, IPermissionService, IResourceLoaderService, IUniverInstanceService } from '@univerjs/core';
|
|
20
20
|
import { FBaseInitialable } from '@univerjs/core/facade';
|
|
21
21
|
import { FDocumentParagraph } from './f-document-paragraph';
|
|
22
|
+
import { FDocumentObjectPermission, FDocumentPermission } from './f-document-permission';
|
|
22
23
|
import { FDocumentSection } from './f-document-section';
|
|
23
24
|
import { FDocumentTextRange } from './f-document-text-range';
|
|
24
25
|
export interface IFDocumentParagraphQuery {
|
|
@@ -64,11 +65,15 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
64
65
|
protected readonly _univerInstanceService: IUniverInstanceService;
|
|
65
66
|
protected readonly _resourceLoaderService: IResourceLoaderService;
|
|
66
67
|
private readonly _commandService;
|
|
68
|
+
private readonly _permissionService;
|
|
69
|
+
/**
|
|
70
|
+
* The document unit id used to identify this document in commands and snapshots.
|
|
71
|
+
*/
|
|
67
72
|
readonly id: string;
|
|
68
|
-
constructor(_documentDataModel: DocumentDataModel, _injector: Injector, _univerInstanceService: IUniverInstanceService, _resourceLoaderService: IResourceLoaderService, _commandService: ICommandService);
|
|
73
|
+
constructor(_documentDataModel: DocumentDataModel, _injector: Injector, _univerInstanceService: IUniverInstanceService, _resourceLoaderService: IResourceLoaderService, _commandService: ICommandService, _permissionService: IPermissionService);
|
|
69
74
|
/**
|
|
70
75
|
* Get the document data model of the document.
|
|
71
|
-
* @param {string} segmentId The segment id used to get the header/footer data model. Defaults to an empty string for the document data model of the document.
|
|
76
|
+
* @param {string} [segmentId] The segment id used to get the header/footer data model. Defaults to an empty string for the document data model of the document.
|
|
72
77
|
* @returns {DocumentDataModel} The document data model.
|
|
73
78
|
* @example
|
|
74
79
|
* ```typescript
|
|
@@ -99,7 +104,7 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
99
104
|
* Get the document body or header/footer body by the segment id.
|
|
100
105
|
* The main body has an empty segment id.
|
|
101
106
|
* The header and footer body have their respective segment ids.
|
|
102
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
107
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
103
108
|
* @returns {IDocumentBody} The document body.
|
|
104
109
|
* @example
|
|
105
110
|
* ```typescript
|
|
@@ -111,6 +116,7 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
111
116
|
* ```
|
|
112
117
|
*/
|
|
113
118
|
getBody(segmentId?: string): IDocumentBody;
|
|
119
|
+
/** Releases this facade's resources. Use `univerAPI.disposeUnit()` to unload the owning unit. */
|
|
114
120
|
dispose(): void;
|
|
115
121
|
/**
|
|
116
122
|
* Get the document id.
|
|
@@ -122,6 +128,36 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
122
128
|
* ```
|
|
123
129
|
*/
|
|
124
130
|
getId(): string;
|
|
131
|
+
/**
|
|
132
|
+
* Returns the Document unit permission facade.
|
|
133
|
+
* @returns {FDocumentPermission} Permission facade for Edit, Copy, Print, Export, and Comment.
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* const document = univerAPI.getActiveDocument();
|
|
137
|
+
* if (!document) throw new Error('No active Document.');
|
|
138
|
+
* await document.getPermission().setReadOnly();
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
getPermission(): FDocumentPermission;
|
|
142
|
+
/**
|
|
143
|
+
* Returns the permission facade for an entity with a stable id, such as a Table, Drawing, or Custom Block.
|
|
144
|
+
*
|
|
145
|
+
* Parent Section and Paragraph permission ceilings are resolved from the current Document model.
|
|
146
|
+
* @param {string} segmentId Segment id, or an empty string for the main body.
|
|
147
|
+
* @param {string} entityType Stable entity type used by the owning Doc feature.
|
|
148
|
+
* @param {string} entityId Stable entity id.
|
|
149
|
+
* @returns {FDocumentObjectPermission} Effective permission facade for the entity.
|
|
150
|
+
* @example Make one drawing read-only
|
|
151
|
+
* ```ts
|
|
152
|
+
* const document = univerAPI.getActiveDocument();
|
|
153
|
+
* if (!document) throw new Error('No active Document.');
|
|
154
|
+
* const snapshot = document.getDocumentDataModel().getSnapshot();
|
|
155
|
+
* const drawingId = snapshot.drawingsOrder?.[0];
|
|
156
|
+
* if (!drawingId) throw new Error('Drawing not found.');
|
|
157
|
+
* await document.getEntityPermission('', 'drawing', drawingId).setReadOnly();
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
getEntityPermission(segmentId: string, entityType: string, entityId: string): FDocumentObjectPermission;
|
|
125
161
|
/**
|
|
126
162
|
* Get the document name.
|
|
127
163
|
* @returns {string} The document name.
|
|
@@ -239,7 +275,7 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
239
275
|
redo(): boolean;
|
|
240
276
|
/**
|
|
241
277
|
* Ensure the page header segment exists and return its segment id.
|
|
242
|
-
* @param {number} pageIndex The zero-based page index. Defaults to the first page.
|
|
278
|
+
* @param {number} [pageIndex] The zero-based page index. Defaults to the first page.
|
|
243
279
|
* @returns {string} The header segment id.
|
|
244
280
|
* @example
|
|
245
281
|
* ```ts
|
|
@@ -251,7 +287,7 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
251
287
|
ensurePageHeader(pageIndex?: number): string;
|
|
252
288
|
/**
|
|
253
289
|
* Ensure the page footer segment exists and return its segment id.
|
|
254
|
-
* @param {number} pageIndex The zero-based page index. Defaults to the first page.
|
|
290
|
+
* @param {number} [pageIndex] The zero-based page index. Defaults to the first page.
|
|
255
291
|
* @returns {string} The footer segment id.
|
|
256
292
|
* @example
|
|
257
293
|
* ```ts
|
|
@@ -265,7 +301,7 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
265
301
|
* Insert plain text at a document body offset.
|
|
266
302
|
* @param {number} index The zero-based insertion offset.
|
|
267
303
|
* @param {string} text The plain text to insert.
|
|
268
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
304
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
269
305
|
* @returns {boolean} `true` if the edit was applied.
|
|
270
306
|
* @example
|
|
271
307
|
* ```ts
|
|
@@ -292,6 +328,8 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
292
328
|
* Traditional and Unspecified documents keep the legacy header/footer
|
|
293
329
|
* behavior. Modern documents reject this API. `marginHeader` and
|
|
294
330
|
* `marginFooter` use 96-DPI layout pixels.
|
|
331
|
+
* @param {IHeaderFooterProps} options Header/footer switches and margins to update. Omitted properties are preserved.
|
|
332
|
+
* @returns {boolean} Whether the update command succeeded.
|
|
295
333
|
* @example
|
|
296
334
|
* ```ts
|
|
297
335
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -309,7 +347,7 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
309
347
|
* The end offset is exclusive, and offsets are scoped to the selected body segment.
|
|
310
348
|
* @param {number} startOffset The inclusive start offset.
|
|
311
349
|
* @param {number} endOffset The exclusive end offset.
|
|
312
|
-
* @param {string} segmentId The header/footer segment id, or an empty string for the main body.
|
|
350
|
+
* @param {string} [segmentId] The header/footer segment id, or an empty string for the main body.
|
|
313
351
|
* @returns {FDocumentTextRange} A fixed text-range facade.
|
|
314
352
|
* @example
|
|
315
353
|
* ```ts
|
|
@@ -332,6 +370,8 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
332
370
|
getSections(): FDocumentSection[];
|
|
333
371
|
/**
|
|
334
372
|
* Returns a traditional section by zero-based index, or `null` in modern documents.
|
|
373
|
+
* @param {number} index Zero-based section index.
|
|
374
|
+
* @returns {FDocumentSection | null} The matching section, or `null` if none exists or the document is not Traditional.
|
|
335
375
|
* @example
|
|
336
376
|
* ```ts
|
|
337
377
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -342,6 +382,8 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
342
382
|
getSection(index: number): FDocumentSection | null;
|
|
343
383
|
/**
|
|
344
384
|
* Returns the traditional section containing a data-stream offset, or `null` in modern documents.
|
|
385
|
+
* @param {number} offset Zero-based data-stream offset in the main document body.
|
|
386
|
+
* @returns {FDocumentSection | null} The matching section, or `null` if none exists or the document is not Traditional.
|
|
345
387
|
* @example
|
|
346
388
|
* ```ts
|
|
347
389
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -410,6 +452,8 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
410
452
|
* In a single-column section, the traditional renderer advances to the next physical page.
|
|
411
453
|
* Modern documents must use ColumnGroup. Unspecified documents must resolve
|
|
412
454
|
* their flavor first. Both throw `DocsSectionUnsupportedDocumentFlavorError`.
|
|
455
|
+
* @param {number} offset Zero-based data-stream offset at which to insert the column break.
|
|
456
|
+
* @returns {boolean} Whether the insertion succeeded.
|
|
413
457
|
* @example
|
|
414
458
|
* ```ts
|
|
415
459
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -427,6 +471,10 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
427
471
|
* Inserts a horizontal rule using the existing paragraph `borderBottom` mechanism.
|
|
428
472
|
* The returned paragraph can be inspected or removed with normal paragraph APIs.
|
|
429
473
|
* Border width and padding are in points (pt).
|
|
474
|
+
* @param {number} offset Zero-based insertion offset in the selected body segment.
|
|
475
|
+
* @param {IParagraphBorder} [border] Bottom border appearance. Defaults to a solid gray 1 pt line with 5 pt padding.
|
|
476
|
+
* @param {string} [segmentId] Header/footer segment ID, or an empty string for the main body (default).
|
|
477
|
+
* @returns {FDocumentParagraph | null} The inserted paragraph, or `null` if insertion fails.
|
|
430
478
|
* @example
|
|
431
479
|
* ```ts
|
|
432
480
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -439,7 +487,7 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
439
487
|
insertHorizontalRule(offset: number, border?: IParagraphBorder, segmentId?: string): FDocumentParagraph | null;
|
|
440
488
|
/**
|
|
441
489
|
* Get all paragraphs in the document body or header/footer body by the segment id.
|
|
442
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
490
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
443
491
|
* @returns {FDocumentParagraph[]} An array of paragraph facade instances.
|
|
444
492
|
* @example
|
|
445
493
|
* ```ts
|
|
@@ -456,7 +504,7 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
456
504
|
/**
|
|
457
505
|
* Get a paragraph by its paragraph id and segment id.
|
|
458
506
|
* @param {string} paragraphId The paragraph id.
|
|
459
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
507
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
460
508
|
* @returns {FDocumentParagraph | null} The paragraph facade instance, or `null` if the paragraph is not found.
|
|
461
509
|
* @example
|
|
462
510
|
* ```ts
|
|
@@ -473,7 +521,7 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
473
521
|
/**
|
|
474
522
|
* Find a paragraph by its text content and segment id.
|
|
475
523
|
* @param {string} text The text content to search for.
|
|
476
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
524
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
477
525
|
* @returns {FDocumentParagraph | null} The paragraph facade instance, or `null` if the paragraph is not found.
|
|
478
526
|
* @example
|
|
479
527
|
* ```ts
|
|
@@ -509,8 +557,8 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
509
557
|
/**
|
|
510
558
|
* Insert a plain-text paragraph before the paragraph at the given paragraph index.
|
|
511
559
|
* @param {number} index The zero-based paragraph insertion index.
|
|
512
|
-
* @param {string} text The paragraph text. Defaults to an empty paragraph.
|
|
513
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
560
|
+
* @param {string} [text] The paragraph text. Defaults to an empty paragraph.
|
|
561
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
514
562
|
* @returns {FDocumentParagraph} The inserted paragraph facade instance.
|
|
515
563
|
* @example
|
|
516
564
|
* ```ts
|
|
@@ -526,8 +574,8 @@ export declare class FDocument extends FBaseInitialable {
|
|
|
526
574
|
insertParagraph(index: number, text?: string, segmentId?: string): FDocumentParagraph;
|
|
527
575
|
/**
|
|
528
576
|
* Append a plain-text paragraph at the end of the body.
|
|
529
|
-
* @param {string} text The paragraph text. Defaults to an empty paragraph.
|
|
530
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
577
|
+
* @param {string} [text] The paragraph text. Defaults to an empty paragraph.
|
|
578
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
531
579
|
* @returns {FDocumentParagraph} The appended paragraph wrapper.
|
|
532
580
|
* @example
|
|
533
581
|
* ```ts
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IDocumentData } from '@univerjs/core';
|
|
16
|
+
import type { ICreateUnitOptions, IDocumentData } from '@univerjs/core';
|
|
17
17
|
import { FUniver } from '@univerjs/core/facade';
|
|
18
18
|
import { FDocument } from './f-document';
|
|
19
19
|
/**
|
|
@@ -23,14 +23,15 @@ export interface IFUniverDocsMixin {
|
|
|
23
23
|
/**
|
|
24
24
|
* Create a new document and get the API handler of that document.
|
|
25
25
|
* @param {Partial<IDocumentData>} data The snapshot of the document.
|
|
26
|
+
* @param {ICreateUnitOptions} [options] The options of creating the document.
|
|
26
27
|
* @returns {FDocument} The document API instance.
|
|
27
28
|
* @example
|
|
28
29
|
* ```typescript
|
|
29
|
-
* const fDocument = univerAPI.
|
|
30
|
+
* const fDocument = univerAPI.createDocument({ id: 'document-01', title: 'Document1' });
|
|
30
31
|
* console.log(fDocument);
|
|
31
32
|
* ```
|
|
32
33
|
*/
|
|
33
|
-
createDocument(data: Partial<IDocumentData
|
|
34
|
+
createDocument(data: Partial<IDocumentData>, options?: ICreateUnitOptions): FDocument;
|
|
34
35
|
/**
|
|
35
36
|
* Get the currently focused Univer document.
|
|
36
37
|
* @returns {FDocument | null} The currently focused Univer document API instance, or null if there is no focused Univer document.
|
|
@@ -54,7 +55,7 @@ export interface IFUniverDocsMixin {
|
|
|
54
55
|
getDocument(id: string): FDocument | null;
|
|
55
56
|
}
|
|
56
57
|
export declare class FUniverDocsMixin extends FUniver implements IFUniverDocsMixin {
|
|
57
|
-
createDocument(data: Partial<IDocumentData
|
|
58
|
+
createDocument(data: Partial<IDocumentData>, options?: ICreateUnitOptions): FDocument;
|
|
58
59
|
getActiveDocument(): FDocument | null;
|
|
59
60
|
getDocument(id: string): FDocument | null;
|
|
60
61
|
}
|
|
@@ -18,6 +18,7 @@ import './f-enum';
|
|
|
18
18
|
export { FDocument, type IDocumentCustomBlockLayout, type IDocumentCustomBlockLayoutItem, } from './f-document';
|
|
19
19
|
export { FDocumentParagraph, isParagraphFacade } from './f-document-paragraph';
|
|
20
20
|
export type { IFDocumentFindTextOptions, IFDocumentParagraphInfo } from './f-document-paragraph';
|
|
21
|
+
export { FDocumentObjectPermission, FDocumentPermission } from './f-document-permission';
|
|
21
22
|
export { DocsSectionUnsupportedDocumentFlavorError, FDocumentSection } from './f-document-section';
|
|
22
23
|
export type { FDocumentSectionPageSetup, IFDocumentSectionColumnOptions, IFDocumentSectionDescription } from './f-document-section';
|
|
23
24
|
export { FDocumentTextRange } from './f-document-text-range';
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { DocumentDataModel, IDocumentBody, Injector, IParagraphStyle, UpdateDocsAttributeType } from '@univerjs/core';
|
|
17
|
+
import { ICommandService } from '@univerjs/core';
|
|
17
18
|
export interface IBuildPlainTextInsertBodyOptions {
|
|
18
19
|
paragraphStyle?: IParagraphStyle;
|
|
19
20
|
removeLeadingParagraphBreak?: boolean;
|
|
@@ -33,6 +34,6 @@ export declare function getRemovedLeadingParagraphBreakLength(dataStream: string
|
|
|
33
34
|
export declare function getNormalizedPlainTextCursorOffset(dataStream: string, cursorOffset: number, removeLeadingParagraphBreak?: boolean): number;
|
|
34
35
|
export declare function getParagraphStyleAtOffset(body: IDocumentBody, offset: number): IParagraphStyle | undefined;
|
|
35
36
|
export declare function buildPlainTextInsertBody(dataStream: string, options?: IBuildPlainTextInsertBodyOptions): IDocumentBody;
|
|
36
|
-
export declare function replaceBodyRange(range: IFDocumentTextRange, insertBody: IDocumentBody, docDataModel: DocumentDataModel,
|
|
37
|
+
export declare function replaceBodyRange(range: IFDocumentTextRange, insertBody: IDocumentBody, docDataModel: DocumentDataModel, commandService: ICommandService): boolean;
|
|
37
38
|
export declare function retainBodyRange(range: IFDocumentTextRange, updateBody: IDocumentBody, coverType: UpdateDocsAttributeType, docDataModel: DocumentDataModel, injector: Injector): boolean;
|
|
38
39
|
export declare function stripBlockTokens(text: string): string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -21,18 +21,25 @@ export { SetDocumentDefaultParagraphStyleCommand } from './commands/commands/set
|
|
|
21
21
|
export type { IDocumentDefaultParagraphStylePatch, ISetDocumentDefaultParagraphStyleCommandParams, } from './commands/commands/set-document-default-paragraph-style.command';
|
|
22
22
|
export { SetDocumentNameCommand } from './commands/commands/set-document-name.command';
|
|
23
23
|
export type { ISetDocumentNameCommandParams } from './commands/commands/set-document-name.command';
|
|
24
|
+
export { SetDocumentPermissionCommand } from './commands/commands/set-document-permission.command';
|
|
25
|
+
export type { ISetDocumentPermissionCommandParams } from './commands/commands/set-document-permission.command';
|
|
26
|
+
export { SetDocumentPermissionsCommand } from './commands/commands/set-document-permissions.command';
|
|
24
27
|
export { SetSectionHeaderFooterLinkCommand } from './commands/commands/set-section-header-footer-link.command';
|
|
25
28
|
export type { ISetSectionHeaderFooterLinkCommandParams } from './commands/commands/set-section-header-footer-link.command';
|
|
26
29
|
export { UpdateDocumentParagraphStyleCommand } from './commands/commands/update-document-paragraph-style.command';
|
|
27
30
|
export { DeleteDocumentSectionBreakCommand, InsertDocumentColumnBreakCommand, InsertDocumentSectionBreakCommand, UpdateDocumentSectionCommand } from './commands/commands/update-document-section.command';
|
|
28
31
|
export type { IDeleteDocumentSectionBreakCommandParams, IDocumentSectionConfig, IDocumentSectionUpdate, IInsertDocumentColumnBreakCommandParams, IInsertDocumentSectionBreakCommandParams, IUpdateDocumentSectionCommandParams } from './commands/commands/update-document-section.command';
|
|
29
|
-
export { RichTextEditingMutation } from './commands/mutations/core-editing.mutation';
|
|
32
|
+
export { DocHistoryAction, RichTextEditingMutation, transformDocumentTextRanges } from './commands/mutations/core-editing.mutation';
|
|
30
33
|
export type { IRichTextEditingMutationParams } from './commands/mutations/core-editing.mutation';
|
|
34
|
+
export { SetDocumentPermissionRuleMutation } from './commands/mutations/set-document-permission-rule.mutation';
|
|
35
|
+
export { SetDocumentPermissionRulesMutation } from './commands/mutations/set-document-permission-rules.mutation';
|
|
31
36
|
export { SetTextSelectionsOperation } from './commands/operations/text-selection.operation';
|
|
32
37
|
export type { ISetTextSelectionsOperationParams } from './commands/operations/text-selection.operation';
|
|
33
38
|
export type { IUniverDocsConfig } from './config/config';
|
|
34
39
|
export { createDocsCustomBlockDrawing, createDocsCustomBlockInsertMutation, createDocsCustomBlockRemoveMutation, createEmbedDocsCustomBlockData, createInsertCustomBlockActions, createRemoveCustomBlockActions, EMBED_DOCS_CUSTOM_BLOCK_DEFAULT_COMPONENT_KEY, isEmbedDocsCustomBlockData, isSheetLikeDocsCustomBlockChildType, resolveDocsCustomBlockSize, shouldUseInlineTextSelectionForDocsCustomBlockDrawing, } from './embed-host-anchor';
|
|
35
40
|
export type { EmbedDocsCustomBlockInteractionMode, IDocsCustomBlockMutationParams, IEmbedDocsCustomBlockData, } from './embed-host-anchor';
|
|
41
|
+
export { DocsLayoutWorkerCapabilityError, DocsLayoutWorkerClientService, startDocsLayoutWorker, UniverDocsLayoutWorkerPlugin } from './layout-worker';
|
|
42
|
+
export type { IDocsLayoutWorkerCapabilities, IDocsLayoutWorkerFontProbe, IDocsLayoutWorkerRuntime, IUniverDocsLayoutWorkerConfig } from './layout-worker';
|
|
36
43
|
export { UniverDocsPlugin } from './plugin';
|
|
37
44
|
export { DocBlockMoveValidatorService } from './services/doc-block-move-validator.service';
|
|
38
45
|
export type { DocBlockMoveTransformer, DocBlockMoveValidator, IDocBlockMoveResult, IDocBlockMoveTransformContext, IDocBlockMoveValidationContext, } from './services/doc-block-move-validator.service';
|
|
@@ -40,6 +47,8 @@ export { DocContentInsertService } from './services/doc-content-insert.service';
|
|
|
40
47
|
export type { IDocContentInsertRange } from './services/doc-content-insert.service';
|
|
41
48
|
export { DocInterceptorService } from './services/doc-interceptor/doc-interceptor.service';
|
|
42
49
|
export { DOC_INTERCEPTOR_POINT } from './services/doc-interceptor/interceptor-const';
|
|
50
|
+
export { DocLayoutExecutorService, DocLayoutExecutorState, DocLayoutExecutorType, DocLayoutSessionStatus, } from './services/doc-layout-executor.service';
|
|
51
|
+
export type { IDocLayoutCancelRequest, IDocLayoutCreateSessionRequest, IDocLayoutCustomRangePresentation, IDocLayoutCustomRangePresentationContext, IDocLayoutCustomRangePresentationEntry, IDocLayoutCustomRangePresentationPatch, IDocLayoutDisposeMountRequest, IDocLayoutDisposeSessionRequest, IDocLayoutExecutor, IDocLayoutExecutorStatus, IDocLayoutMountIdentity, IDocLayoutMutationProjection, IDocLayoutPageRequest, IDocLayoutPageResult, IDocLayoutPerformanceMetrics, IDocLayoutRecordPatch, IDocLayoutStartOptions, IDocLayoutStartRequest, IDocLayoutStartResult, IDocLayoutStepRequest, IDocLayoutStepResult, } from './services/doc-layout-executor.service';
|
|
43
52
|
export { DOC_SELECTION_OPTION_PRESERVE_CARET, DocSelectionManagerService, } from './services/doc-selection-manager.service';
|
|
44
53
|
export { DocSkeletonManagerService } from './services/doc-skeleton-manager.service';
|
|
45
54
|
export { DocStateChangeManagerService, IDocStateChangeInterceptorService, } from './services/doc-state-change-manager.service';
|
|
@@ -47,6 +56,9 @@ export type { IDocStateChangeInfo, IDocStateChangeParams } from './services/doc-
|
|
|
47
56
|
export { DocStateEmitService } from './services/doc-state-emit.service';
|
|
48
57
|
export { DocTextResolverService } from './services/doc-text-resolver.service';
|
|
49
58
|
export type { IDocTextReplacement, IDocTextResolver, IResolvedDocText, IResolvedDocTextCharacter, } from './services/doc-text-resolver.service';
|
|
59
|
+
export { canEditDocumentTargets, createDocumentPermissionPoint, DOCUMENT_UNIT_PERMISSION_ACTIONS, getDocumentEntityPermissionObjectId, getDocumentParagraphPermissionObjectId, getDocumentPermissionValue, getDocumentSectionPermissionObjectId, setDocumentPermissionValue, } from './services/permission/document-permission';
|
|
60
|
+
export type { DocumentUnitPermissionAction } from './services/permission/document-permission';
|
|
61
|
+
export { getDocumentDrawingSegmentId, getDocumentEditTargetObjectIds, getDocumentEntityParentPermissionObjectIds, getDocumentParagraphParentPermissionObjectIds, } from './services/permission/document-permission-resolver';
|
|
50
62
|
export { addCustomRangeBySelectionFactory, addCustomRangeFactory, deleteCustomRangeFactory, } from './utils/custom-range-factory';
|
|
51
63
|
export { generateParagraphs } from './utils/paragraphs';
|
|
52
64
|
export { replaceSelectionFactory } from './utils/replace-selection-factory';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DOCS_LAYOUT_WORKER_PLUGIN_CONFIG_KEY = "docs-layout-worker.config";
|
|
17
|
+
export declare const configSymbol: unique symbol;
|
|
18
|
+
export declare const DEFAULT_DOCS_LAYOUT_WORKER_REQUEST_TIMEOUT_MS = 15000;
|
|
19
|
+
export interface IDocsLayoutFontFace {
|
|
20
|
+
family: string;
|
|
21
|
+
/** Font bytes or a CSS FontFace source, such as url("https://example.test/font.woff2"). */
|
|
22
|
+
source: string | ArrayBuffer;
|
|
23
|
+
descriptors?: FontFaceDescriptors;
|
|
24
|
+
}
|
|
25
|
+
export interface IUniverDocsLayoutWorkerConfig {
|
|
26
|
+
workerFactory?: () => Worker;
|
|
27
|
+
/** Licensed web fonts to load in both the rendering context and the layout Worker before layout. */
|
|
28
|
+
fontFaces?: IDocsLayoutFontFace[];
|
|
29
|
+
/** Maximum time allowed for one Worker RPC request before recovery starts. */
|
|
30
|
+
requestTimeoutMs?: number;
|
|
31
|
+
}
|
|
32
|
+
export declare const defaultPluginDocsLayoutWorkerConfig: IUniverDocsLayoutWorkerConfig;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/** Collect once from the snapshot, then only from mutation payloads (including JSON1 font replacements). */
|
|
17
|
+
export declare function collectDocumentFontFamilies(value: unknown, families: Set<string>): void;
|
|
18
|
+
export declare function measureDocumentFontFamilies(families: Set<string>): Record<string, number>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IDocsLayoutFontFace } from './config/config';
|
|
17
|
+
import { Disposable } from '@univerjs/core';
|
|
18
|
+
/** Owns the same explicitly supplied font faces in the rendering and layout realms. */
|
|
19
|
+
export declare class DocsLayoutFontLoader extends Disposable {
|
|
20
|
+
private _loading;
|
|
21
|
+
private _fontSet;
|
|
22
|
+
private _faces;
|
|
23
|
+
load(fonts: readonly IDocsLayoutFontFace[]): Promise<void>;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
private _load;
|
|
26
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IDocLayoutCancelRequest, IDocLayoutCreateSessionRequest, IDocLayoutDisposeMountRequest, IDocLayoutDisposeSessionRequest, IDocLayoutExecutor, IDocLayoutPageRequest, IDocLayoutPageResult, IDocLayoutPerformanceMetrics, IDocLayoutStartRequest, IDocLayoutStartResult, IDocLayoutStepRequest, IDocLayoutStepResult } from '../services/doc-layout-executor.service';
|
|
17
|
+
import type { IDocsLayoutFontFace, IUniverDocsLayoutWorkerConfig } from './config/config';
|
|
18
|
+
import type { IDocsLayoutWorkerCapabilities } from './protocol';
|
|
19
|
+
import { Disposable, IConfigService, Injector, Plugin } from '@univerjs/core';
|
|
20
|
+
import { DocLayoutExecutorService, DocLayoutExecutorType } from '../services/doc-layout-executor.service';
|
|
21
|
+
import { startDocsLayoutWorker } from './worker';
|
|
22
|
+
export declare class DocsLayoutWorkerCapabilityError extends Error {
|
|
23
|
+
constructor(message: string);
|
|
24
|
+
}
|
|
25
|
+
export declare class DocsLayoutWorkerClientService extends Disposable implements IDocLayoutExecutor {
|
|
26
|
+
private readonly _workerFactory;
|
|
27
|
+
private readonly _requestTimeoutMs;
|
|
28
|
+
private readonly _fontFaces;
|
|
29
|
+
readonly type = DocLayoutExecutorType.WORKER;
|
|
30
|
+
private _worker;
|
|
31
|
+
private _channelService;
|
|
32
|
+
private _runtime;
|
|
33
|
+
private _initialization;
|
|
34
|
+
private _initialized;
|
|
35
|
+
private readonly _performanceTracker;
|
|
36
|
+
private readonly _fontFamilies;
|
|
37
|
+
private readonly _fontLoader;
|
|
38
|
+
constructor(_workerFactory: () => Worker, _requestTimeoutMs?: number, _fontFaces?: IDocsLayoutFontFace[]);
|
|
39
|
+
initialize(): Promise<void>;
|
|
40
|
+
get renderingFontsReady(): Promise<void> | undefined;
|
|
41
|
+
getCapabilities(): Promise<IDocsLayoutWorkerCapabilities>;
|
|
42
|
+
recover(): Promise<void>;
|
|
43
|
+
createSession(request: IDocLayoutCreateSessionRequest): Promise<void>;
|
|
44
|
+
startLayout(request: IDocLayoutStartRequest): Promise<IDocLayoutStartResult>;
|
|
45
|
+
stepLayout(request: IDocLayoutStepRequest): Promise<IDocLayoutStepResult>;
|
|
46
|
+
publishBacklog(request: Omit<IDocLayoutStepRequest, 'budgetMs'>): Promise<IDocLayoutStepResult>;
|
|
47
|
+
getLayoutPage(request: IDocLayoutPageRequest): Promise<IDocLayoutPageResult>;
|
|
48
|
+
cancelLayout(request: IDocLayoutCancelRequest): Promise<void>;
|
|
49
|
+
getPerformanceMetrics(unitId: string): Promise<Omit<IDocLayoutPerformanceMetrics, 'hydrationMs'>>;
|
|
50
|
+
resetPerformanceMetrics(unitId: string): Promise<void>;
|
|
51
|
+
disposeLayoutMount(request: IDocLayoutDisposeMountRequest): Promise<void>;
|
|
52
|
+
disposeSession(request: IDocLayoutDisposeSessionRequest): Promise<void>;
|
|
53
|
+
dispose(): void;
|
|
54
|
+
private _replaceRuntime;
|
|
55
|
+
private _disposeRuntime;
|
|
56
|
+
private _getRuntime;
|
|
57
|
+
private _withTimeout;
|
|
58
|
+
private _verifyCapabilities;
|
|
59
|
+
}
|
|
60
|
+
export declare class UniverDocsLayoutWorkerPlugin extends Plugin {
|
|
61
|
+
private readonly _config;
|
|
62
|
+
readonly _injector: Injector;
|
|
63
|
+
private readonly _layoutExecutorService;
|
|
64
|
+
private readonly _configService;
|
|
65
|
+
static pluginName: string;
|
|
66
|
+
static packageName: string;
|
|
67
|
+
static version: string;
|
|
68
|
+
constructor(_config: Partial<IUniverDocsLayoutWorkerConfig> | undefined, _injector: Injector, _layoutExecutorService: DocLayoutExecutorService, _configService: IConfigService);
|
|
69
|
+
onStarting(): void;
|
|
70
|
+
}
|
|
71
|
+
export type { IUniverDocsLayoutWorkerConfig } from './config/config';
|
|
72
|
+
export type { IDocsLayoutWorkerCapabilities, IDocsLayoutWorkerFontProbe, IDocsLayoutWorkerRuntime } from './protocol';
|
|
73
|
+
export { startDocsLayoutWorker };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IDocLayoutPerformanceMetrics } from '../services/doc-layout-executor.service';
|
|
17
|
+
type WorkerTransferMetrics = Omit<IDocLayoutPerformanceMetrics, 'hydrationMs'>;
|
|
18
|
+
export declare class DocsLayoutWorkerPerformanceTracker {
|
|
19
|
+
private readonly _metrics;
|
|
20
|
+
recordRequest(message: unknown, durationMs: number): void;
|
|
21
|
+
recordResponse(message: unknown, durationMs: number): void;
|
|
22
|
+
getMetrics(unitId: string): WorkerTransferMetrics;
|
|
23
|
+
reset(unitId: string): void;
|
|
24
|
+
resetAll(): void;
|
|
25
|
+
private _append;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { DocLayoutExecutorType, IDocLayoutExecutor } from '../services/doc-layout-executor.service';
|
|
17
|
+
import type { IDocsLayoutFontFace } from './config/config';
|
|
18
|
+
export declare const DOCS_LAYOUT_WORKER_CHANNEL = "univer.docs-layout-worker";
|
|
19
|
+
export declare const DOCS_LAYOUT_WORKER_PROTOCOL_VERSION = 5;
|
|
20
|
+
export interface IDocsLayoutWorkerFontProbe {
|
|
21
|
+
content: string;
|
|
22
|
+
font: string;
|
|
23
|
+
width: number;
|
|
24
|
+
actualBoundingBoxAscent: number;
|
|
25
|
+
actualBoundingBoxDescent: number;
|
|
26
|
+
}
|
|
27
|
+
export interface IDocsLayoutWorkerCapabilities {
|
|
28
|
+
protocolVersion: typeof DOCS_LAYOUT_WORKER_PROTOCOL_VERSION;
|
|
29
|
+
executor: DocLayoutExecutorType.WORKER;
|
|
30
|
+
offscreenCanvas: boolean;
|
|
31
|
+
structuredClone: boolean;
|
|
32
|
+
fontProbe: IDocsLayoutWorkerFontProbe;
|
|
33
|
+
}
|
|
34
|
+
export interface IDocsLayoutWorkerRuntime extends IDocLayoutExecutor {
|
|
35
|
+
initialize(fontFaces?: IDocsLayoutFontFace[]): Promise<void>;
|
|
36
|
+
getCapabilities(): Promise<IDocsLayoutWorkerCapabilities>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IDocLayoutCancelRequest, IDocLayoutCreateSessionRequest, IDocLayoutDisposeMountRequest, IDocLayoutDisposeSessionRequest, IDocLayoutPageRequest, IDocLayoutPageResult, IDocLayoutPerformanceMetrics, IDocLayoutStartRequest, IDocLayoutStartResult, IDocLayoutStepRequest, IDocLayoutStepResult } from '../services/doc-layout-executor.service';
|
|
17
|
+
import type { IDocsLayoutFontFace } from './config/config';
|
|
18
|
+
import type { IDocsLayoutWorkerCapabilities, IDocsLayoutWorkerRuntime } from './protocol';
|
|
19
|
+
import { ChannelService } from '@univerjs/rpc';
|
|
20
|
+
import { DocLayoutExecutorType } from '../services/doc-layout-executor.service';
|
|
21
|
+
import { DocsLayoutWorkerPerformanceTracker } from './performance-tracker';
|
|
22
|
+
export declare class DocsLayoutWorkerRuntime implements IDocsLayoutWorkerRuntime {
|
|
23
|
+
private readonly _performanceTracker;
|
|
24
|
+
private readonly _sessions;
|
|
25
|
+
private readonly _fontLoader;
|
|
26
|
+
readonly type = DocLayoutExecutorType.WORKER;
|
|
27
|
+
constructor(_performanceTracker?: DocsLayoutWorkerPerformanceTracker);
|
|
28
|
+
initialize(fontFaces?: IDocsLayoutFontFace[]): Promise<void>;
|
|
29
|
+
getCapabilities(): Promise<IDocsLayoutWorkerCapabilities>;
|
|
30
|
+
recover(): Promise<void>;
|
|
31
|
+
createSession(request: IDocLayoutCreateSessionRequest): Promise<void>;
|
|
32
|
+
startLayout(request: IDocLayoutStartRequest): Promise<IDocLayoutStartResult>;
|
|
33
|
+
private _applyMutations;
|
|
34
|
+
private _applyCustomRangePresentations;
|
|
35
|
+
private _updateCustomRangePresentations;
|
|
36
|
+
stepLayout(request: IDocLayoutStepRequest): Promise<IDocLayoutStepResult>;
|
|
37
|
+
publishBacklog(request: Omit<IDocLayoutStepRequest, 'budgetMs'>): Promise<IDocLayoutStepResult>;
|
|
38
|
+
getLayoutPage(request: IDocLayoutPageRequest): Promise<IDocLayoutPageResult>;
|
|
39
|
+
cancelLayout(request: IDocLayoutCancelRequest): Promise<void>;
|
|
40
|
+
getPerformanceMetrics(unitId: string): Promise<Omit<IDocLayoutPerformanceMetrics, 'hydrationMs'>>;
|
|
41
|
+
resetPerformanceMetrics(unitId: string): Promise<void>;
|
|
42
|
+
disposeLayoutMount(request: IDocLayoutDisposeMountRequest): Promise<void>;
|
|
43
|
+
disposeSession(request: IDocLayoutDisposeSessionRequest): Promise<void>;
|
|
44
|
+
dispose(): void;
|
|
45
|
+
private _getSession;
|
|
46
|
+
private _getLayoutMount;
|
|
47
|
+
private _runLayoutStep;
|
|
48
|
+
private _runWithCustomBlockViewports;
|
|
49
|
+
private _disposeSession;
|
|
50
|
+
}
|
|
51
|
+
export declare function startDocsLayoutWorker(): ChannelService;
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare class UniverDocsPlugin extends Plugin {
|
|
|
24
24
|
static version: string;
|
|
25
25
|
constructor(_config: Partial<IUniverDocsConfig> | undefined, _injector: Injector, _configService: IConfigService);
|
|
26
26
|
onStarting(): void;
|
|
27
|
+
private _initializeWordResources;
|
|
27
28
|
private _initializeCommands;
|
|
28
29
|
private _initializeDependencies;
|
|
29
30
|
onReady(): void;
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { ICustomDecoration, ICustomDecorationForInterceptor, ICustomRange, ICustomRangeForInterceptor } from '@univerjs/core';
|
|
16
|
+
import type { ICustomDecoration, ICustomDecorationForInterceptor, ICustomRange, ICustomRangeForInterceptor, IDocumentBody } from '@univerjs/core';
|
|
17
17
|
export declare const DOC_INTERCEPTOR_POINT: {
|
|
18
18
|
CUSTOM_RANGE: import("@univerjs/core").IInterceptor<ICustomRangeForInterceptor, {
|
|
19
19
|
index: number;
|
|
20
20
|
unitId: string;
|
|
21
|
+
body: IDocumentBody | undefined;
|
|
21
22
|
customRanges: ICustomRange[];
|
|
22
23
|
}>;
|
|
23
24
|
CUSTOM_DECORATION: import("@univerjs/core").IInterceptor<ICustomDecorationForInterceptor, {
|