@deepseek-ai/libreoffice-kit 0.0.2-rc8 → 0.0.3
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/NOTICE +0 -240
- package/README.md +53 -43
- package/README.zh.md +58 -35
- package/lib/cli.js +725 -132
- package/lib/index.js +757 -133
- package/lib/types/engine.d.ts +5 -5
- package/lib/types/font-loader.d.ts +18 -16
- package/lib/types/fonts.d.ts +38 -21
- package/lib/types/image-operations.d.ts +1 -1
- package/lib/types/index.d.ts +13 -7
- package/lib/types/native-image-renderer.d.ts +19 -0
- package/lib/types/native.d.ts +1 -1
- package/lib/types/options.d.ts +3 -1
- package/lib/types/wasm.d.ts +4 -1
- package/lib/types/worker.d.ts +2 -0
- package/lib/worker.js +420 -942
- package/package.json +13 -55
- package/assets/font-subset.json +0 -70
- package/assets/font-subset.wasm +0 -0
- package/lib/browser/assets.json +0 -10
- package/lib/browser/index.js +0 -491
- package/lib/browser/types/connection.d.ts +0 -20
- package/lib/browser/types/engine-rendering.d.ts +0 -3
- package/lib/browser/types/engine-types.d.ts +0 -17
- package/lib/browser/types/font-channel.d.ts +0 -21
- package/lib/browser/types/index.d.ts +0 -14
- package/lib/browser/types/office-engine.d.ts +0 -48
- package/lib/browser/types/office-types.d.ts +0 -107
- package/lib/browser/types/office.d.ts +0 -4
- package/lib/browser/types/preparation.d.ts +0 -13
- package/lib/browser/types/protocol.d.ts +0 -110
- package/lib/browser/types/rendering.d.ts +0 -4
- package/lib/browser/types/types.d.ts +0 -113
- package/lib/browser/types/worker.d.ts +0 -2
- package/lib/browser/worker.js +0 -3615
- package/lib/browser-assets.js +0 -119
- package/lib/document.js +0 -178
- package/lib/engine-rendering.js +0 -120
- package/lib/font-config.js +0 -46
- package/lib/font-source.js +0 -395
- package/lib/font-worker.js +0 -1481
- package/lib/rendering.js +0 -99
- package/lib/sheet-geometry.js +0 -111
- package/lib/types/browser-assets.d.ts +0 -15
- package/lib/types/default-fonts.d.ts +0 -3
- package/lib/types/font-config.d.ts +0 -24
- package/lib/types/font-preferences-data.d.ts +0 -16
- package/lib/types/font-preferences.d.ts +0 -29
- package/lib/types/font-request.d.ts +0 -12
- package/lib/types/font-source-types.d.ts +0 -95
- package/lib/types/font-source.d.ts +0 -10
- package/lib/types/font-subsets.d.ts +0 -39
- package/lib/types/font-worker.d.ts +0 -2
- package/lib/types/harfbuzz-subset.d.ts +0 -11
- package/lib/types/unicode-scripts.d.ts +0 -18
- package/licenses/font-subset/harfbuzz-COPYING +0 -42
- package/licenses/font-subset/harfbuzzjs-LICENSE +0 -19
- package/licenses/javascript/fflate-LICENSE +0 -21
- package/licenses/javascript/saxes-LICENSE +0 -64
- package/licenses/javascript/xmlchars-LICENSE +0 -18
- package/sources/browser/packages/browser/package.json +0 -22
- package/sources/browser/packages/browser/src/connection.ts +0 -171
- package/sources/browser/packages/browser/src/engine-rendering.ts +0 -2
- package/sources/browser/packages/browser/src/engine-types.ts +0 -14
- package/sources/browser/packages/browser/src/font-channel.ts +0 -160
- package/sources/browser/packages/browser/src/index.ts +0 -40
- package/sources/browser/packages/browser/src/office-engine.ts +0 -323
- package/sources/browser/packages/browser/src/office-types.ts +0 -77
- package/sources/browser/packages/browser/src/office.ts +0 -62
- package/sources/browser/packages/browser/src/preparation.ts +0 -41
- package/sources/browser/packages/browser/src/protocol.ts +0 -41
- package/sources/browser/packages/browser/src/rendering.ts +0 -3
- package/sources/browser/packages/browser/src/types.ts +0 -115
- package/sources/browser/packages/browser/src/worker.ts +0 -181
- package/sources/browser/packages/browser/tsconfig.json +0 -5
- package/sources/browser/packages/browser/tsdown.config.ts +0 -7
- package/sources/browser/scripts/build-browser.mjs +0 -82
- package/sources/font-subset/engine/font-subset/README.md +0 -23
- package/sources/font-subset/engine/font-subset/README.zh.md +0 -23
- package/sources/font-subset/engine/font-subset/source.json +0 -16
- package/sources/font-subset/harfbuzzjs/config-override-subset.h +0 -7
- package/sources/font-subset/harfbuzzjs/harfbuzz-subset.symbols +0 -34
- package/sources/font-subset/scripts/build-font-subset.mjs +0 -64
- package/sources/font-subset/scripts/pack-utils.mjs +0 -69
- package/sources/font-subset/scripts/platform-matrix.mjs +0 -100
- package/sources/font-subset/scripts/verify-artifacts.mjs +0 -260
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** Emscripten operations used by the single owning engine Worker. */
|
|
2
|
-
export interface EmscriptenModule {
|
|
3
|
-
readonly FS: {
|
|
4
|
-
mkdirTree(path: string): void;
|
|
5
|
-
writeFile(path: string, data: Uint8Array): void;
|
|
6
|
-
readFile(path: string): Uint8Array<ArrayBuffer>;
|
|
7
|
-
unlink(path: string): void;
|
|
8
|
-
};
|
|
9
|
-
readonly ENV: Record<string, string>;
|
|
10
|
-
readonly HEAPU32: Uint32Array;
|
|
11
|
-
readonly PThread: {
|
|
12
|
-
terminateAllThreads(): void;
|
|
13
|
-
};
|
|
14
|
-
ccall(name: string, returnType: string | null, argTypes: string[], args: unknown[]): number;
|
|
15
|
-
UTF8ToString(pointer: number): string;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=engine-types.d.ts.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { FontState } from './protocol.ts';
|
|
2
|
-
import type { FontIdentity } from './protocol.ts';
|
|
3
|
-
import type { BrowserFontRequest, BrowserFontResult } from './types.ts';
|
|
4
|
-
/** Views shared by the owner and engine; only the engine uses Atomics.wait. */
|
|
5
|
-
export declare function fontViews(channel: SharedArrayBuffer): {
|
|
6
|
-
control: Int32Array;
|
|
7
|
-
bytes: Uint8Array;
|
|
8
|
-
};
|
|
9
|
-
/** Only uninstalled content crosses the channel; each family retains its own alias. */
|
|
10
|
-
export declare function fontFrames(result: BrowserFontResult, known?: readonly FontIdentity[]): Generator<{
|
|
11
|
-
state: FontState;
|
|
12
|
-
bytes: Uint8Array;
|
|
13
|
-
}>;
|
|
14
|
-
/** One MEMFS font face registered under a document-local family alias. */
|
|
15
|
-
export interface EngineFontFace {
|
|
16
|
-
readonly path: string;
|
|
17
|
-
readonly family: string;
|
|
18
|
-
}
|
|
19
|
-
/** The synchronous reader installs immutable font assets before returning their MEMFS paths and aliases. */
|
|
20
|
-
export declare function createFontReader(channel: SharedArrayBuffer, timeoutMs: number, maxLoadedFontBytes: number, declaredFamilies: ReadonlyMap<string, string>, request: (request: BrowserFontRequest, known: readonly FontIdentity[]) => void, next: () => void, install: (path: string, bytes: Uint8Array) => void, missing: (families: readonly string[]) => void, documentCodePoints?: readonly number[]): (request: BrowserFontRequest) => EngineFontFace[];
|
|
21
|
-
//# sourceMappingURL=font-channel.d.ts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { BrowserDocument, BrowserDocumentOptions } from './types.ts';
|
|
2
|
-
export { BrowserRenderError } from './types.ts';
|
|
3
|
-
export { openOfficeDocument } from './office.ts';
|
|
4
|
-
export { prepareOfficeBrowser } from './preparation.ts';
|
|
5
|
-
export type * from './office-types.ts';
|
|
6
|
-
export type { BrowserDocument, BrowserDocumentOptions, BrowserEngineAssets, BrowserFontIdentity, BrowserFontRequest, BrowserFontResult, BrowserPage, BrowserRenderErrorCode, BrowserResolvedFont, BrowserTile, BrowserTileRequest, PreparedBrowserEngine } from './types.ts';
|
|
7
|
-
/**
|
|
8
|
-
* Open a read-only document; each call owns an independent Worker.
|
|
9
|
-
* @param options - Source bytes, version-matched resources and Host fonts.
|
|
10
|
-
* @param signal - Document lifetime; abort awaits engine teardown.
|
|
11
|
-
* @returns Immutable geometry, serialized tile rendering and disposal.
|
|
12
|
-
*/
|
|
13
|
-
export declare function openDocument(options: BrowserDocumentOptions, signal?: AbortSignal): Promise<BrowserDocument>;
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { BrowserTile } from './types.ts';
|
|
2
|
-
import type { EmscriptenModule } from './engine-types.ts';
|
|
3
|
-
import type { OfficeOperation } from './protocol.ts';
|
|
4
|
-
import type { OfficeDocumentEvent, OfficeDocumentFormat, OfficeDocumentState, OfficeDocumentTileRequest, OfficeDocumentLayoutResult } from './office-types.ts';
|
|
5
|
-
/** One read-only document, driven exclusively by its Worker's messages and timer. */
|
|
6
|
-
export declare class OfficeEngine {
|
|
7
|
-
private readonly module;
|
|
8
|
-
private readonly document;
|
|
9
|
-
private readonly emit;
|
|
10
|
-
private readonly failure;
|
|
11
|
-
state: OfficeDocumentState;
|
|
12
|
-
private timer;
|
|
13
|
-
private readonly callbacks;
|
|
14
|
-
private geometryDirty;
|
|
15
|
-
private stopped;
|
|
16
|
-
private layoutWidth;
|
|
17
|
-
private viewport;
|
|
18
|
-
private captureView;
|
|
19
|
-
private readingView;
|
|
20
|
-
private commandResult;
|
|
21
|
-
constructor(module: EmscriptenModule, document: number, format: OfficeDocumentFormat, emit: (event: OfficeDocumentEvent) => void, failure: (error: unknown) => void);
|
|
22
|
-
private call;
|
|
23
|
-
private text;
|
|
24
|
-
private invoke;
|
|
25
|
-
private requireOpen;
|
|
26
|
-
/** Collect callbacks without reentering LibreOffice inside its callback. */
|
|
27
|
-
callback(type: number, payload: string): void;
|
|
28
|
-
/** Enforce the native read-only view before accepting any input. */
|
|
29
|
-
start(): Promise<void>;
|
|
30
|
-
private schedule;
|
|
31
|
-
/** Stop event processing before destroying the document. */
|
|
32
|
-
stop(): void;
|
|
33
|
-
/** Return the part whose cached coordinates changed, or -1 when part identities changed. */
|
|
34
|
-
private refreshGeometry;
|
|
35
|
-
private pump;
|
|
36
|
-
private flush;
|
|
37
|
-
/** The Worker permits only these typed reading operations, including at runtime. */
|
|
38
|
-
operation(operation: OfficeOperation): Promise<{
|
|
39
|
-
text?: string;
|
|
40
|
-
layout?: OfficeDocumentLayoutResult;
|
|
41
|
-
}>;
|
|
42
|
-
private configure;
|
|
43
|
-
/** Internal whitelist commands only; no arbitrary command crosses the public API. */
|
|
44
|
-
private command;
|
|
45
|
-
/** Direct tiles preserve the active view, navigation state and selection. */
|
|
46
|
-
render(request: OfficeDocumentTileRequest): BrowserTile;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=office-engine.d.ts.map
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/** Retained Office reading sessions; this API never exposes document mutation. */
|
|
2
|
-
import type { BrowserDocumentOptions, BrowserPage, BrowserRenderErrorCode, BrowserTile } from './types.ts';
|
|
3
|
-
/** Office containers supported by the reading engine. */
|
|
4
|
-
export type OfficeDocumentFormat = 'doc' | 'docx' | 'xls' | 'xlsx' | 'ppt' | 'pptx';
|
|
5
|
-
/** Source bytes, engine resources and Host fonts; all sessions are read-only. */
|
|
6
|
-
export type OfficeDocumentOptions = Omit<BrowserDocumentOptions, 'extension'> & {
|
|
7
|
-
readonly extension: OfficeDocumentFormat;
|
|
8
|
-
};
|
|
9
|
-
/** Document coordinates in CSS pixels at 96 DPI, independent of zoom. */
|
|
10
|
-
export interface OfficeDocumentRectangle extends BrowserPage {
|
|
11
|
-
readonly x: number;
|
|
12
|
-
readonly y: number;
|
|
13
|
-
}
|
|
14
|
-
/** One Writer document, Calc worksheet or Impress slide. */
|
|
15
|
-
export interface OfficeDocumentPart extends BrowserPage {
|
|
16
|
-
readonly name: string;
|
|
17
|
-
}
|
|
18
|
-
/** Writer layout; other document types always remain paginated. */
|
|
19
|
-
export type OfficeDocumentLayout = 'paginated' | 'continuous';
|
|
20
|
-
/** A point in the previous layout, normally the upper visible line of body text. */
|
|
21
|
-
export interface OfficeDocumentAnchor {
|
|
22
|
-
readonly x: number;
|
|
23
|
-
readonly y: number;
|
|
24
|
-
}
|
|
25
|
-
/** Continuous width is the available content width in document CSS pixels. */
|
|
26
|
-
export type OfficeDocumentLayoutRequest = {
|
|
27
|
-
readonly mode: 'paginated';
|
|
28
|
-
readonly anchor?: OfficeDocumentAnchor;
|
|
29
|
-
} | {
|
|
30
|
-
readonly mode: 'continuous';
|
|
31
|
-
readonly width: number;
|
|
32
|
-
readonly anchor?: OfficeDocumentAnchor;
|
|
33
|
-
};
|
|
34
|
-
/** An optional body-text rectangle in the new layout for restoring reading position. */
|
|
35
|
-
export interface OfficeDocumentLayoutResult {
|
|
36
|
-
readonly changed: boolean;
|
|
37
|
-
readonly anchor?: OfficeDocumentRectangle;
|
|
38
|
-
}
|
|
39
|
-
/** Geometry and selection; cursor is a navigation/cell rectangle, never an editing caret. */
|
|
40
|
-
export interface OfficeDocumentState {
|
|
41
|
-
readonly documentType: 'text' | 'spreadsheet' | 'presentation';
|
|
42
|
-
readonly renderGeneration: number;
|
|
43
|
-
readonly layoutGeneration: number;
|
|
44
|
-
readonly layout: OfficeDocumentLayout;
|
|
45
|
-
readonly part: number;
|
|
46
|
-
readonly parts: readonly OfficeDocumentPart[];
|
|
47
|
-
/** Writer page rectangles in paginated mode; one continuous rectangle otherwise. */
|
|
48
|
-
readonly pages: readonly OfficeDocumentRectangle[];
|
|
49
|
-
readonly cursor: OfficeDocumentRectangle | null;
|
|
50
|
-
readonly selection: readonly OfficeDocumentRectangle[];
|
|
51
|
-
readonly graphicSelection: OfficeDocumentRectangle | null;
|
|
52
|
-
readonly cellAddress: string;
|
|
53
|
-
readonly cellFormula: string;
|
|
54
|
-
}
|
|
55
|
-
/** Primary-button selection; modifiers use LOK Shift (0x1000) / Control (0x2000). */
|
|
56
|
-
export interface OfficeDocumentPointer {
|
|
57
|
-
readonly action: 'down' | 'up' | 'move';
|
|
58
|
-
readonly x: number;
|
|
59
|
-
readonly y: number;
|
|
60
|
-
readonly buttons: number;
|
|
61
|
-
readonly modifiers: number;
|
|
62
|
-
readonly clicks: number;
|
|
63
|
-
}
|
|
64
|
-
/** Only navigation keys are accepted; no arbitrary character or key injection. */
|
|
65
|
-
export interface OfficeDocumentNavigation {
|
|
66
|
-
readonly key: 'left' | 'right' | 'up' | 'down' | 'home' | 'end' | 'pageUp' | 'pageDown';
|
|
67
|
-
readonly extend?: boolean;
|
|
68
|
-
readonly word?: boolean;
|
|
69
|
-
}
|
|
70
|
-
/** One region of the current part. Pixel density does not change document layout. */
|
|
71
|
-
export interface OfficeDocumentTileRequest extends OfficeDocumentRectangle {
|
|
72
|
-
readonly part: number;
|
|
73
|
-
readonly scale: number;
|
|
74
|
-
}
|
|
75
|
-
/** A null rectangle invalidates an entire part; negative part means every part. */
|
|
76
|
-
export type OfficeDocumentEvent = {
|
|
77
|
-
readonly type: 'state';
|
|
78
|
-
readonly state: OfficeDocumentState;
|
|
79
|
-
} | {
|
|
80
|
-
readonly type: 'invalidate';
|
|
81
|
-
readonly part: number;
|
|
82
|
-
readonly rectangle: OfficeDocumentRectangle | null;
|
|
83
|
-
readonly generation: number;
|
|
84
|
-
} | {
|
|
85
|
-
readonly type: 'error';
|
|
86
|
-
readonly code: BrowserRenderErrorCode;
|
|
87
|
-
readonly message: string;
|
|
88
|
-
};
|
|
89
|
-
/** Retain this session while hidden; dispose only when the document is closed. */
|
|
90
|
-
export interface OfficeDocument {
|
|
91
|
-
readonly state: OfficeDocumentState;
|
|
92
|
-
subscribe(listener: (event: OfficeDocumentEvent) => void): () => void;
|
|
93
|
-
pointer(event: OfficeDocumentPointer): Promise<void>;
|
|
94
|
-
navigate(event: OfficeDocumentNavigation): Promise<void>;
|
|
95
|
-
selectAll(): Promise<void>;
|
|
96
|
-
copy(): Promise<string>;
|
|
97
|
-
/** Select a bounded A1 cell or range on the current worksheet. */
|
|
98
|
-
goToCell(address: string): Promise<void>;
|
|
99
|
-
setPart(part: number): Promise<void>;
|
|
100
|
-
setViewport(rectangle: OfficeDocumentRectangle, scale: number): Promise<void>;
|
|
101
|
-
/** Coalesces pending widths; superseded callers observe the newest applied layout. */
|
|
102
|
-
setLayout(request: OfficeDocumentLayoutRequest): Promise<OfficeDocumentLayoutResult>;
|
|
103
|
-
/** Only the current part can be painted; queued requests for a former part reject with stale-part without changing selection. */
|
|
104
|
-
renderTile(request: OfficeDocumentTileRequest, signal?: AbortSignal): Promise<BrowserTile>;
|
|
105
|
-
dispose(): Promise<void>;
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=office-types.d.ts.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { OfficeDocument, OfficeDocumentOptions } from './office-types.ts';
|
|
2
|
-
/** Open one read-only Office model; source bytes remain owned by the caller. */
|
|
3
|
-
export declare function openOfficeDocument(options: OfficeDocumentOptions, signal?: AbortSignal): Promise<OfficeDocument>;
|
|
4
|
-
//# sourceMappingURL=office.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { BrowserEngineAssets, PreparedBrowserEngine } from './types.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Compile the version-matched LibreOffice WASM module for later document Workers.
|
|
4
|
-
* @param assets - Browser resources whose WASM URL identifies the compiled module.
|
|
5
|
-
* @param signal - Cancels the resource request; compilation may finish before cancellation is observed.
|
|
6
|
-
* @returns an opaque, structured-cloneable engine handle that allocates no WASM memory.
|
|
7
|
-
*/
|
|
8
|
-
export declare function prepareOfficeBrowser(assets: BrowserEngineAssets, signal?: AbortSignal): Promise<PreparedBrowserEngine>;
|
|
9
|
-
/** Return the compiled module after validating the Worker-bound asset identity. */
|
|
10
|
-
export declare function preparedBrowserModule(prepared: PreparedBrowserEngine, assets: BrowserEngineAssets): WebAssembly.Module;
|
|
11
|
-
/** Instantiate precompiled code through Emscripten's synchronous override. */
|
|
12
|
-
export declare function instantiatePreparedModule(module: WebAssembly.Module, imports: WebAssembly.Imports, receive: (instance: WebAssembly.Instance, module: WebAssembly.Module) => void): WebAssembly.Exports;
|
|
13
|
-
//# sourceMappingURL=preparation.d.ts.map
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/** Private messages exchanged by the document owner and its single engine Worker. */
|
|
2
|
-
import type { BrowserDocumentOptions, BrowserFontIdentity, BrowserFontRequest, BrowserPage, BrowserRenderErrorCode, BrowserTile, BrowserTileRequest } from './types.ts';
|
|
3
|
-
import type { OfficeDocumentEvent, OfficeDocumentNavigation, OfficeDocumentOptions, OfficeDocumentState, OfficeDocumentPointer, OfficeDocumentLayoutRequest, OfficeDocumentLayoutResult, OfficeDocumentTileRequest, OfficeDocumentRectangle } from './office-types.ts';
|
|
4
|
-
export declare const FONT_CHUNK_BYTES: number;
|
|
5
|
-
export declare const FONT_HEADER_BYTES = 8;
|
|
6
|
-
export declare const enum FontState {
|
|
7
|
-
Waiting = 0,
|
|
8
|
-
Header = 1,
|
|
9
|
-
Bytes = 2,
|
|
10
|
-
Done = 3,
|
|
11
|
-
Error = 4,
|
|
12
|
-
Cancelled = 5
|
|
13
|
-
}
|
|
14
|
-
export type WorkerOptions = Omit<BrowserDocumentOptions | OfficeDocumentOptions, 'resolveFonts' | 'onMissingFonts'>;
|
|
15
|
-
export type OfficeOperation = {
|
|
16
|
-
readonly type: 'pointer';
|
|
17
|
-
readonly event: OfficeDocumentPointer;
|
|
18
|
-
} | {
|
|
19
|
-
readonly type: 'navigate';
|
|
20
|
-
readonly event: OfficeDocumentNavigation;
|
|
21
|
-
} | {
|
|
22
|
-
readonly type: 'select-all';
|
|
23
|
-
} | {
|
|
24
|
-
readonly type: 'cell';
|
|
25
|
-
readonly address: string;
|
|
26
|
-
} | {
|
|
27
|
-
readonly type: 'copy';
|
|
28
|
-
} | {
|
|
29
|
-
readonly type: 'part';
|
|
30
|
-
readonly part: number;
|
|
31
|
-
} | {
|
|
32
|
-
readonly type: 'viewport';
|
|
33
|
-
readonly rectangle: OfficeDocumentRectangle;
|
|
34
|
-
readonly scale: number;
|
|
35
|
-
} | {
|
|
36
|
-
readonly type: 'layout';
|
|
37
|
-
readonly request: OfficeDocumentLayoutRequest;
|
|
38
|
-
};
|
|
39
|
-
export type OwnerMessage = {
|
|
40
|
-
readonly type: 'open';
|
|
41
|
-
readonly id: number;
|
|
42
|
-
readonly options: WorkerOptions;
|
|
43
|
-
readonly channel: SharedArrayBuffer;
|
|
44
|
-
readonly office?: boolean;
|
|
45
|
-
} | {
|
|
46
|
-
readonly type: 'tile';
|
|
47
|
-
readonly id: number;
|
|
48
|
-
readonly request: BrowserTileRequest;
|
|
49
|
-
} | {
|
|
50
|
-
readonly type: 'office-tile';
|
|
51
|
-
readonly id: number;
|
|
52
|
-
readonly request: OfficeDocumentTileRequest;
|
|
53
|
-
} | {
|
|
54
|
-
readonly type: 'office-operation';
|
|
55
|
-
readonly id: number;
|
|
56
|
-
readonly operation: OfficeOperation;
|
|
57
|
-
} | {
|
|
58
|
-
readonly type: 'dispose';
|
|
59
|
-
readonly id: number;
|
|
60
|
-
};
|
|
61
|
-
type WithoutId<T> = T extends unknown ? Omit<T, 'id'> : never;
|
|
62
|
-
export type OwnerRequest = WithoutId<OwnerMessage>;
|
|
63
|
-
export type WorkerMessage = {
|
|
64
|
-
readonly type: 'opened';
|
|
65
|
-
readonly id: number;
|
|
66
|
-
readonly pages: readonly BrowserPage[];
|
|
67
|
-
readonly office?: OfficeDocumentState;
|
|
68
|
-
} | {
|
|
69
|
-
readonly type: 'tile';
|
|
70
|
-
readonly id: number;
|
|
71
|
-
readonly tile: BrowserTile;
|
|
72
|
-
} | {
|
|
73
|
-
readonly type: 'office-result';
|
|
74
|
-
readonly id: number;
|
|
75
|
-
readonly text?: string;
|
|
76
|
-
readonly layout?: OfficeDocumentLayoutResult;
|
|
77
|
-
} | {
|
|
78
|
-
readonly type: 'office-event';
|
|
79
|
-
readonly event: OfficeDocumentEvent;
|
|
80
|
-
} | {
|
|
81
|
-
readonly type: 'disposed';
|
|
82
|
-
readonly id: number;
|
|
83
|
-
} | {
|
|
84
|
-
readonly type: 'error';
|
|
85
|
-
readonly id: number;
|
|
86
|
-
readonly code: BrowserRenderErrorCode;
|
|
87
|
-
readonly message: string;
|
|
88
|
-
readonly fatal: boolean;
|
|
89
|
-
} | {
|
|
90
|
-
readonly type: 'font';
|
|
91
|
-
readonly request: BrowserFontRequest;
|
|
92
|
-
readonly known: readonly FontIdentity[];
|
|
93
|
-
} | {
|
|
94
|
-
readonly type: 'font-next';
|
|
95
|
-
} | {
|
|
96
|
-
readonly type: 'missing-fonts';
|
|
97
|
-
readonly families: readonly string[];
|
|
98
|
-
};
|
|
99
|
-
/** Immutable bytes already installed in this document's MEMFS. */
|
|
100
|
-
export type FontIdentity = BrowserFontIdentity;
|
|
101
|
-
export interface FontHeader {
|
|
102
|
-
readonly fonts: readonly (FontIdentity & {
|
|
103
|
-
readonly family: string;
|
|
104
|
-
readonly alias: string;
|
|
105
|
-
readonly reference?: true;
|
|
106
|
-
})[];
|
|
107
|
-
readonly missingFamily?: string;
|
|
108
|
-
}
|
|
109
|
-
export {};
|
|
110
|
-
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/** Geometry and RGBA conversion shared by every WASM consumer. */
|
|
2
|
-
export { writerPages, tileDimensions, rgbaPixels, TWIPS_PER_CSS_PIXEL } from '@deepseek-ai/libreoffice-kit/internal/rendering';
|
|
3
|
-
export type { EnginePage } from '@deepseek-ai/libreoffice-kit/internal/rendering';
|
|
4
|
-
//# sourceMappingURL=rendering.d.ts.map
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/** Browser-facing document rendering and host font interfaces. */
|
|
2
|
-
/** Independently served, version-matched engine resources. */
|
|
3
|
-
export interface BrowserEngineAssets {
|
|
4
|
-
readonly workerUrl: string;
|
|
5
|
-
readonly loaderUrl: string;
|
|
6
|
-
readonly wasmUrl: string;
|
|
7
|
-
readonly dataUrl: string;
|
|
8
|
-
readonly metadataUrl: string;
|
|
9
|
-
readonly programDirectory: string;
|
|
10
|
-
}
|
|
11
|
-
declare const preparedBrowserEngine: unique symbol;
|
|
12
|
-
/** Compiled engine code bound to one WASM resource identity. */
|
|
13
|
-
export interface PreparedBrowserEngine {
|
|
14
|
-
readonly [preparedBrowserEngine]: true;
|
|
15
|
-
}
|
|
16
|
-
/** VCL attributes passed unchanged to the Host's font matcher. */
|
|
17
|
-
export interface BrowserFontRequest {
|
|
18
|
-
readonly mode?: 'full';
|
|
19
|
-
readonly family: string;
|
|
20
|
-
readonly style: string;
|
|
21
|
-
readonly weight: number;
|
|
22
|
-
readonly italic: number;
|
|
23
|
-
readonly width: number;
|
|
24
|
-
readonly pitch: number;
|
|
25
|
-
readonly language: string;
|
|
26
|
-
readonly codePoints: readonly number[];
|
|
27
|
-
}
|
|
28
|
-
/** Immutable font content already installed in one document Worker. */
|
|
29
|
-
export interface BrowserFontIdentity {
|
|
30
|
-
readonly id: string;
|
|
31
|
-
readonly bytes: number;
|
|
32
|
-
readonly format?: 'ttf' | 'otf' | 'ttc';
|
|
33
|
-
}
|
|
34
|
-
/** One new font body or a metadata-only reference to content already installed in the Worker. */
|
|
35
|
-
export type BrowserResolvedFont = {
|
|
36
|
-
readonly id: string;
|
|
37
|
-
readonly family: string;
|
|
38
|
-
readonly alias: string;
|
|
39
|
-
readonly format?: 'ttf' | 'otf' | 'ttc';
|
|
40
|
-
} & ({
|
|
41
|
-
readonly data: Uint8Array;
|
|
42
|
-
readonly bytes?: never;
|
|
43
|
-
} | {
|
|
44
|
-
readonly data?: never;
|
|
45
|
-
readonly bytes: number;
|
|
46
|
-
});
|
|
47
|
-
/** Immutable per-face font subsets; equal ids and aliases must identify equal bytes. */
|
|
48
|
-
export interface BrowserFontResult {
|
|
49
|
-
readonly fonts: readonly BrowserResolvedFont[];
|
|
50
|
-
readonly missingFamily?: string;
|
|
51
|
-
/** Missing scalars reported by the Host, independently of a substituted family. */
|
|
52
|
-
readonly unresolvedCodePoints?: readonly number[];
|
|
53
|
-
}
|
|
54
|
-
/** All sizes are CSS pixels at 96 pixels per inch. */
|
|
55
|
-
export interface BrowserPage {
|
|
56
|
-
readonly width: number;
|
|
57
|
-
readonly height: number;
|
|
58
|
-
}
|
|
59
|
-
/** Page-relative rectangle, rasterized at the requested pixel scale. */
|
|
60
|
-
export interface BrowserTileRequest {
|
|
61
|
-
readonly pageIndex: number;
|
|
62
|
-
readonly x: number;
|
|
63
|
-
readonly y: number;
|
|
64
|
-
readonly width: number;
|
|
65
|
-
readonly height: number;
|
|
66
|
-
readonly scale: number;
|
|
67
|
-
}
|
|
68
|
-
/** Owned, non-premultiplied RGBA pixels accepted by ImageData. */
|
|
69
|
-
export interface BrowserTile {
|
|
70
|
-
readonly width: number;
|
|
71
|
-
readonly height: number;
|
|
72
|
-
readonly rgba: Uint8ClampedArray;
|
|
73
|
-
}
|
|
74
|
-
/** Caller-owned source bytes are copied before Worker transfer. */
|
|
75
|
-
export interface BrowserDocumentOptions {
|
|
76
|
-
readonly data: Uint8Array;
|
|
77
|
-
readonly extension: 'pdf';
|
|
78
|
-
readonly assets: BrowserEngineAssets;
|
|
79
|
-
/** Optional compiled WASM code created by prepareOfficeBrowser for these assets. */
|
|
80
|
-
readonly preparedEngine?: PreparedBrowserEngine;
|
|
81
|
-
/** Maximum time for each load, render, font request, or teardown operation. */
|
|
82
|
-
readonly timeoutMs: number;
|
|
83
|
-
/** Maximum ZIP entries inspected before LibreOffice loads OOXML. */
|
|
84
|
-
readonly maxArchiveEntries: number;
|
|
85
|
-
/** Maximum total declared uncompressed OOXML bytes. */
|
|
86
|
-
readonly maxUncompressedBytes: number;
|
|
87
|
-
/** Total distinct font bytes retained in this document's MEMFS. */
|
|
88
|
-
readonly maxLoadedFontBytes: number;
|
|
89
|
-
/** The same ordered substitution groups used by the Host font matcher. */
|
|
90
|
-
readonly fontFallbacks: readonly (readonly string[])[];
|
|
91
|
-
/** Match fonts without blocking the browser's main thread. */
|
|
92
|
-
readonly resolveFonts: (request: BrowserFontRequest, known: readonly BrowserFontIdentity[], signal: AbortSignal) => Promise<BrowserFontResult>;
|
|
93
|
-
/** Called with unavailable declared OOXML families; binary DOC/PPT have no font diagnostics. */
|
|
94
|
-
readonly onMissingFonts?: (families: readonly string[]) => void;
|
|
95
|
-
}
|
|
96
|
-
/** One Worker-owned, read-only Office document. */
|
|
97
|
-
export interface BrowserDocument {
|
|
98
|
-
/** Visible pages; Writer omits zero-area automatic section parity placeholders. */
|
|
99
|
-
readonly pages: readonly BrowserPage[];
|
|
100
|
-
/** Render a page region; cancellation discards that region without closing the document. */
|
|
101
|
-
renderTile(request: BrowserTileRequest, signal?: AbortSignal): Promise<BrowserTile>;
|
|
102
|
-
/** Await document, office and pthread disposal; repeated calls share completion. */
|
|
103
|
-
dispose(): Promise<void>;
|
|
104
|
-
}
|
|
105
|
-
/** Stable failures callers may map to their own localized product copy. */
|
|
106
|
-
export type BrowserRenderErrorCode = 'unavailable' | 'invalid-document' | 'timeout' | 'font-limit' | 'font-unavailable' | 'disposed' | 'render-failed' | 'stale-part';
|
|
107
|
-
/** A rendering failure with a stable machine-readable category. */
|
|
108
|
-
export declare class BrowserRenderError extends Error {
|
|
109
|
-
readonly code: BrowserRenderErrorCode;
|
|
110
|
-
constructor(code: BrowserRenderErrorCode, message: string);
|
|
111
|
-
}
|
|
112
|
-
export {};
|
|
113
|
-
//# sourceMappingURL=types.d.ts.map
|