oasis-editor 0.0.106 → 0.0.108
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/dist/{OasisEditorApp-CwVZxG1m.js → OasisEditorApp-DkiTrFZ6.js} +1945 -489
- package/dist/app/controllers/tableResize/tableResizeGeometry.d.ts +3 -2
- package/dist/app/controllers/tableResize/tableResizeHitTest.d.ts +3 -2
- package/dist/app/controllers/useEditorLayout.d.ts +2 -0
- package/dist/app/controllers/useEditorNavigation.d.ts +4 -1
- package/dist/app/controllers/useEditorTableResize.d.ts +5 -1
- package/dist/export/pdf/OasisPdfWriter.d.ts +23 -2
- package/dist/export/pdf/draw/drawBlockList.d.ts +1 -1
- package/dist/export/pdf/writer/PdfDocumentSerializer.d.ts +2 -2
- package/dist/export/pdf/writer/pdfTypes.d.ts +55 -3
- package/dist/{index-DdcPkCmB.js → index-DzBLUs91.js} +13707 -14175
- package/dist/layoutProjection/index.d.ts +1 -0
- package/dist/layoutProjection/layoutMetricsEpoch.d.ts +2 -0
- package/dist/oasis-editor.js +55 -55
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/OasisEditorEditor.d.ts +3 -2
- package/dist/ui/app/EditorDragLayers.d.ts +5 -1
- package/dist/ui/app/EditorWorkspace.d.ts +2 -1
- package/dist/ui/app/buildEditorViewProps.d.ts +2 -0
- package/dist/ui/app/createEditorDocumentRuntime.d.ts +2 -0
- package/dist/ui/app/createEditorInteractionRuntime.d.ts +2 -0
- package/dist/ui/app/useCanvasSurfaceHitResolver.d.ts +4 -3
- package/dist/ui/app/useEditorInteractionWiring.d.ts +2 -0
- package/dist/ui/canvas/canvasLayoutSnapshotProvider.d.ts +14 -0
- package/dist/ui/canvas/canvasSnapshotTypes.d.ts +2 -3
- package/dist/ui/canvas/canvasTextMeasurer.d.ts +3 -0
- package/dist/ui/components/DropCaret.d.ts +5 -1
- package/dist/ui/components/Outline/OutlinePanel.d.ts +5 -1
- package/dist/ui/editorUiTypes.d.ts +2 -1
- package/dist/ui/shells/DocumentShell.d.ts +3 -2
- package/package.json +2 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { EditorState, EditorTableNode } from '../../../core/model.js';
|
|
1
|
+
import { EditorLayoutDocument, EditorState, EditorTableNode } from '../../../core/model.js';
|
|
2
|
+
import { CanvasLayoutSnapshotProvider } from '../../../ui/canvas/canvasLayoutSnapshotProvider.js';
|
|
2
3
|
import { TableGeometry } from './tableResizeTypes.js';
|
|
3
4
|
|
|
4
5
|
export declare function getTableById(state: EditorState, tableId: string): EditorTableNode | null;
|
|
5
|
-
export declare function buildTableGeometries(surface: HTMLElement, state: EditorState): TableGeometry[];
|
|
6
|
+
export declare function buildTableGeometries(surface: HTMLElement, state: EditorState, documentLayout: EditorLayoutDocument, canvasSnapshotProvider: CanvasLayoutSnapshotProvider, zoomFactor?: number): TableGeometry[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { EditorState } from '../../../core/model.js';
|
|
1
|
+
import { EditorLayoutDocument, EditorState } from '../../../core/model.js';
|
|
2
|
+
import { CanvasLayoutSnapshotProvider } from '../../../ui/canvas/canvasLayoutSnapshotProvider.js';
|
|
2
3
|
import { ResizeHoverInfo } from './tableResizeTypes.js';
|
|
3
4
|
|
|
4
|
-
export declare function findTableResizeHoverInfo(event: MouseEvent, surface: HTMLElement, state: EditorState): ResizeHoverInfo | null;
|
|
5
|
+
export declare function findTableResizeHoverInfo(event: MouseEvent, surface: HTMLElement, state: EditorState, documentLayout: EditorLayoutDocument, canvasSnapshotProvider: CanvasLayoutSnapshotProvider, zoomFactor?: number): ResizeHoverInfo | null;
|
|
@@ -19,6 +19,8 @@ export interface LayoutInvalidation {
|
|
|
19
19
|
export declare function useEditorLayout(props: UseEditorLayoutProps): {
|
|
20
20
|
measuredBlockHeights: import('solid-js').Accessor<Record<string, number>>;
|
|
21
21
|
measuredParagraphLayouts: import('solid-js').Accessor<Record<string, EditorLayoutParagraph>>;
|
|
22
|
+
documentLayout: import('solid-js').Accessor<import('../../core/model.js').EditorLayoutDocument>;
|
|
23
|
+
canvasSnapshotProvider: import('../../ui/canvas/canvasLayoutSnapshotProvider.js').CanvasLayoutSnapshotProvider;
|
|
22
24
|
inputBox: import('solid-js').Accessor<InputBox>;
|
|
23
25
|
selectionBoxes: import('solid-js').Accessor<SelectionBox[]>;
|
|
24
26
|
commentHighlights: import('solid-js').Accessor<CommentHighlightBox[]>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { EditorState } from '../../core/model.js';
|
|
1
|
+
import { EditorLayoutDocument, EditorState } from '../../core/model.js';
|
|
2
2
|
import { CaretBox } from '../../ui/editorUiTypes.js';
|
|
3
|
+
import { CanvasLayoutSnapshotProvider } from '../../ui/canvas/canvasLayoutSnapshotProvider.js';
|
|
3
4
|
|
|
4
5
|
export interface UseEditorNavigationProps {
|
|
5
6
|
state: () => EditorState;
|
|
@@ -12,6 +13,8 @@ export interface UseEditorNavigationProps {
|
|
|
12
13
|
clearPreferredColumn: () => void;
|
|
13
14
|
resetTransactionGrouping: () => void;
|
|
14
15
|
focusInput: () => void;
|
|
16
|
+
documentLayout: () => EditorLayoutDocument;
|
|
17
|
+
canvasSnapshotProvider: CanvasLayoutSnapshotProvider;
|
|
15
18
|
/**
|
|
16
19
|
* Current visual zoom factor. `desiredX` and the snapshot slots both live in
|
|
17
20
|
* "screen-anchored local" space, so the comparison stays correct once the
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
import { EditorLayoutDocument, EditorState } from '../../core/model.js';
|
|
3
|
+
import { CanvasLayoutSnapshotProvider } from '../../ui/canvas/canvasLayoutSnapshotProvider.js';
|
|
2
4
|
import { TableResizeOps } from './tableResize/tableResizeTypes.js';
|
|
3
5
|
|
|
4
6
|
export { type TableResizeOps } from './tableResize/tableResizeTypes.js';
|
|
@@ -7,6 +9,8 @@ export declare function createEditorTableResize(deps: {
|
|
|
7
9
|
applyTransactionalState: (producer: (current: EditorState) => EditorState) => void;
|
|
8
10
|
surfaceRef: () => HTMLElement | undefined;
|
|
9
11
|
viewportRef: () => HTMLElement | undefined;
|
|
12
|
+
documentLayout: Accessor<EditorLayoutDocument>;
|
|
13
|
+
canvasSnapshotProvider: CanvasLayoutSnapshotProvider;
|
|
10
14
|
/** Visual zoom factor `z`; resize pointer deltas are divided by it. */
|
|
11
15
|
zoomFactor?: () => number;
|
|
12
16
|
}): TableResizeOps;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { OasisPdfAxialGradient, OasisPdfFontResource, OasisPdfImageOptions, OasisPdfImageResource, OasisPdfLineOptions, OasisPdfPageSize, OasisPdfPathOptions, OasisPdfRectOptions, OasisPdfTextOptions } from './writer/pdfTypes.js';
|
|
1
|
+
import { OasisPdfAxialGradient, OasisPdfLinkAnnotation, OasisPdfNamedDestination, OasisPdfOutlineItem, OasisPdfDocumentInfo, OasisPdfFontResource, OasisPdfImageOptions, OasisPdfImageResource, OasisPdfLineOptions, OasisPdfPageSize, OasisPdfPathOptions, OasisPdfRectOptions, OasisPdfTextOptions } from './writer/pdfTypes.js';
|
|
2
2
|
|
|
3
|
-
export type { OasisPdfPageSize, OasisPdfPage, OasisPdfRectOptions, OasisPdfLineOptions, OasisPdfPathSegment, OasisPdfPathOptions, OasisPdfTextOptions, OasisPdfImageResource, OasisPdfImageOptions, OasisPdfFontResource, OasisPdfBase14FontResource, OasisPdfUnicodeFontResource, } from './writer/pdfTypes.js';
|
|
3
|
+
export type { OasisPdfPageSize, OasisPdfPage, OasisPdfRectOptions, OasisPdfLineOptions, OasisPdfPathSegment, OasisPdfPathOptions, OasisPdfTextOptions, OasisPdfImageResource, OasisPdfImageOptions, OasisPdfFontResource, OasisPdfBase14FontResource, OasisPdfUnicodeFontResource, OasisPdfLinkAnnotation, OasisPdfAnnotation, OasisPdfNamedDestination, OasisPdfOutlineItem, OasisPdfDocumentInfo, } from './writer/pdfTypes.js';
|
|
4
4
|
export declare class OasisPdfWriter {
|
|
5
5
|
private readonly pages;
|
|
6
6
|
private readonly streams;
|
|
7
7
|
private readonly fonts;
|
|
8
8
|
private readonly images;
|
|
9
9
|
private readonly shadings;
|
|
10
|
+
private readonly namedDestinations;
|
|
11
|
+
private readonly outlineItems;
|
|
12
|
+
private documentInfo;
|
|
10
13
|
constructor(fontResources?: OasisPdfFontResource[]);
|
|
11
14
|
registerFontResource(resource: OasisPdfFontResource): void;
|
|
12
15
|
addPage(size: OasisPdfPageSize): number;
|
|
@@ -29,6 +32,24 @@ export declare class OasisPdfWriter {
|
|
|
29
32
|
resourceName?: string;
|
|
30
33
|
}): string;
|
|
31
34
|
drawImage(pageIndex: number, options: OasisPdfImageOptions): void;
|
|
35
|
+
/**
|
|
36
|
+
* Attaches a clickable external link annotation to a page. The rect is in the
|
|
37
|
+
* writer's top-left point space; the serializer flips it to PDF space.
|
|
38
|
+
*/
|
|
39
|
+
addLinkAnnotation(pageIndex: number, annotation: OasisPdfLinkAnnotation): void;
|
|
40
|
+
/**
|
|
41
|
+
* Registers a named destination (jump target). Position is in the writer's
|
|
42
|
+
* top-left point space. The first registration of a given name wins; later
|
|
43
|
+
* duplicates are ignored so destinations stay unique in the names tree.
|
|
44
|
+
*/
|
|
45
|
+
addNamedDestination(destination: OasisPdfNamedDestination): void;
|
|
46
|
+
/**
|
|
47
|
+
* Appends an outline (bookmarks-panel) entry. Call in document order; the
|
|
48
|
+
* serializer nests entries by `level`.
|
|
49
|
+
*/
|
|
50
|
+
addOutlineItem(item: OasisPdfOutlineItem): void;
|
|
51
|
+
/** Sets the document information dictionary (`/Info`). */
|
|
52
|
+
setDocumentInfo(info: OasisPdfDocumentInfo): void;
|
|
32
53
|
toArrayBuffer(): ArrayBuffer;
|
|
33
54
|
toBlob(): Blob;
|
|
34
55
|
private toUint8Array;
|
|
@@ -2,4 +2,4 @@ import { EditorDocument, EditorLayoutBlock, EditorPageSettings } from '../../../
|
|
|
2
2
|
import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
|
|
3
3
|
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
4
4
|
|
|
5
|
-
export declare function drawBlockList(writer: OasisPdfWriter, pageIndex: number, blocks: EditorLayoutBlock[] | undefined, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>, pageSettings?: EditorPageSettings): Promise<void>;
|
|
5
|
+
export declare function drawBlockList(writer: OasisPdfWriter, pageIndex: number, blocks: EditorLayoutBlock[] | undefined, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>, pageSettings?: EditorPageSettings, onParagraphDrawn?: (paragraphId: string, topPx: number) => void): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OasisPdfPage } from './pdfTypes.js';
|
|
1
|
+
import { OasisPdfDocumentInfo, OasisPdfNamedDestination, OasisPdfOutlineItem, OasisPdfPage } from './pdfTypes.js';
|
|
2
2
|
import { PdfFontTable } from './PdfFontTable.js';
|
|
3
3
|
import { PdfImageTable } from './PdfImageTable.js';
|
|
4
4
|
import { PdfShadingTable } from './PdfShadingTable.js';
|
|
5
5
|
|
|
6
|
-
export declare function serializePdfDocument(pages: OasisPdfPage[], fonts: PdfFontTable, images: PdfImageTable, shadings: PdfShadingTable): Uint8Array;
|
|
6
|
+
export declare function serializePdfDocument(pages: OasisPdfPage[], fonts: PdfFontTable, images: PdfImageTable, shadings: PdfShadingTable, namedDestinations?: OasisPdfNamedDestination[], outlineItems?: OasisPdfOutlineItem[], documentInfo?: OasisPdfDocumentInfo): Uint8Array;
|
|
@@ -13,6 +13,54 @@ export interface OasisPdfPage {
|
|
|
13
13
|
commands: string[];
|
|
14
14
|
imageResourceNames: Set<string>;
|
|
15
15
|
shadingResourceNames: Set<string>;
|
|
16
|
+
annotations: OasisPdfAnnotation[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A clickable link annotation. The rect is given in the writer's top-left point
|
|
20
|
+
* space (same convention as drawing); the serializer flips y to PDF bottom-left
|
|
21
|
+
* space and emits the `[x1 y1 x2 y2]` `/Rect`. Exactly one of `uri` (external)
|
|
22
|
+
* or `destName` (internal named destination) is set.
|
|
23
|
+
*/
|
|
24
|
+
export interface OasisPdfLinkAnnotation {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
/** External target (`/URI` action). */
|
|
30
|
+
uri?: string;
|
|
31
|
+
/** Internal target: a named destination resolved via the `/Dests` name tree. */
|
|
32
|
+
destName?: string;
|
|
33
|
+
}
|
|
34
|
+
export type OasisPdfAnnotation = OasisPdfLinkAnnotation;
|
|
35
|
+
/**
|
|
36
|
+
* A named destination (a jump target for internal links / the outline). Position
|
|
37
|
+
* is in the writer's top-left point space; the serializer flips y and binds it to
|
|
38
|
+
* the page object as a `/XYZ` destination.
|
|
39
|
+
*/
|
|
40
|
+
export interface OasisPdfNamedDestination {
|
|
41
|
+
name: string;
|
|
42
|
+
pageIndex: number;
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* One entry in the document outline (bookmarks panel). Items are supplied in
|
|
48
|
+
* document order; the serializer folds them into a nested tree by `level` (1 =
|
|
49
|
+
* top level). `destName` references a registered named destination.
|
|
50
|
+
*/
|
|
51
|
+
export interface OasisPdfOutlineItem {
|
|
52
|
+
title: string;
|
|
53
|
+
level: number;
|
|
54
|
+
destName: string;
|
|
55
|
+
}
|
|
56
|
+
/** Document information dictionary (`/Info`). All fields optional. */
|
|
57
|
+
export interface OasisPdfDocumentInfo {
|
|
58
|
+
title?: string;
|
|
59
|
+
author?: string;
|
|
60
|
+
subject?: string;
|
|
61
|
+
keywords?: string;
|
|
62
|
+
producer?: string;
|
|
63
|
+
creationDate?: Date;
|
|
16
64
|
}
|
|
17
65
|
/** One color stop of an axial gradient. `offset` is 0–1; `color` is a hex string. */
|
|
18
66
|
export interface OasisPdfGradientStop {
|
|
@@ -131,10 +179,14 @@ export interface OasisPdfUnicodeFontResource {
|
|
|
131
179
|
fontData: Uint8Array;
|
|
132
180
|
postscriptName?: string;
|
|
133
181
|
}
|
|
134
|
-
/**
|
|
182
|
+
/**
|
|
183
|
+
* A serialized indirect PDF object: its 1-based id and dictionary/stream body.
|
|
184
|
+
* The body is a string for text objects, or raw bytes when it embeds a binary
|
|
185
|
+
* (e.g. FlateDecode-compressed) stream that must not pass through UTF-8 encoding.
|
|
186
|
+
*/
|
|
135
187
|
export interface PdfObject {
|
|
136
188
|
id: number;
|
|
137
|
-
body: string;
|
|
189
|
+
body: string | Uint8Array;
|
|
138
190
|
}
|
|
139
191
|
/** Signature of the object-appending closure used during serialization. */
|
|
140
|
-
export type AddPdfObject = (body: string) => number;
|
|
192
|
+
export type AddPdfObject = (body: string | Uint8Array) => number;
|