oasis-editor 0.0.30 → 0.0.32
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-Bvkbr1KZ.js → OasisEditorApp-D6NxTc6l.js} +603 -307
- package/dist/app/services/indexedDbPersistence.d.ts +20 -0
- package/dist/assets/{importDocxWorker-DVvaVtgj.js → importDocxWorker-xRrspiYv.js} +1 -1
- package/dist/core/editorState.d.ts +7 -1
- package/dist/core/endnotes.d.ts +0 -2
- package/dist/core/footnotes.d.ts +0 -2
- package/dist/core/model/index.d.ts +1 -0
- package/dist/core/model/listNumbering.d.ts +5 -0
- package/dist/core/model/types/primitives.d.ts +10 -0
- package/dist/export/docx/docxTypes.d.ts +10 -3
- package/dist/export/pdf/draw/drawBlockList.d.ts +1 -1
- package/dist/export/pdf/draw/drawParagraph.d.ts +1 -1
- package/dist/export/pdf/draw/drawTable.d.ts +1 -1
- package/dist/export/pdf/draw/lists.d.ts +2 -2
- package/dist/i18n/I18nContext.d.ts +9 -0
- package/dist/i18n/index.d.ts +7 -3
- package/dist/import/docx/numbering.d.ts +19 -28
- package/dist/{index-BVAzjJsg.js → index-CDi9hs5T.js} +1264 -1540
- package/dist/index.d.ts +1 -1
- package/dist/oasis-editor.js +54 -54
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/OasisEditorAppProps.d.ts +6 -0
- package/dist/ui/app/useEditorContextMenuClipboard.d.ts +2 -0
- package/dist/ui/app/useEditorRuntimeBootstrap.d.ts +1 -0
- package/dist/ui/app/useEditorRuntimePlugins.d.ts +2 -0
- package/dist/ui/canvas/listNumbering.d.ts +2 -1
- package/dist/ui/components/Menubar/Menubar.d.ts +1 -1
- package/dist/ui/components/Menubar/menuRegistry.d.ts +0 -1
- package/dist/ui/components/Toolbar/presets/defaultToolbar.d.ts +2 -1
- package/dist/ui/components/Toolbar/ribbon/ribbonModel.d.ts +4 -3
- package/dist/ui/components/Toolbar/state/createToolbarApi.d.ts +2 -1
- package/dist/ui/textMeasurement/indentation.d.ts +2 -0
- package/package.json +1 -1
- package/dist/app/services/PersistenceService.d.ts +0 -11
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { EditorAsset, EditorBlockNode, EditorDocument, EditorFootnote, EditorPageSettings, EditorParagraphNode, EditorSection, EditorState, EditorTableCellNode, EditorTableNode, EditorTableRowNode, EditorTextRun, EditorTextStyle, EditorTextBoxData, EditorImageRunData, EditorNamedStyle } from './model.js';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export type EditorNodeKind = "document" | "paragraph" | "run" | "table" | "table-row" | "table-cell" | "footnote" | "bookmark" | "comment";
|
|
4
|
+
/**
|
|
5
|
+
* Single authority for editor node IDs. Stateless and globally unique, so two
|
|
6
|
+
* editors mounted on the same page never share a sequence. The `kind` prefix is
|
|
7
|
+
* kept purely for debuggability; no code parses it for ordering or numbering.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createEditorNodeId(kind: EditorNodeKind): string;
|
|
4
10
|
export declare function createEditorBookmarkId(): string;
|
|
5
11
|
export declare function createEditorCommentId(): string;
|
|
6
12
|
export declare function createEditorRun(text?: string): EditorTextRun;
|
package/dist/core/endnotes.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { EditorBlockNode, EditorDocument, EditorEndnote, EditorEndnotes, EditorParagraphNode, EditorTextRun } from './model.js';
|
|
2
2
|
|
|
3
|
-
export declare function resetEndnoteIds(): void;
|
|
4
|
-
export declare function createEndnoteId(): string;
|
|
5
3
|
/**
|
|
6
4
|
* Iterate every paragraph in document order (endnote bodies excluded), yielding
|
|
7
5
|
* each endnote reference run with its owning paragraph. Order matches reading
|
package/dist/core/footnotes.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { EditorBlockNode, EditorDocument, EditorFootnote, EditorFootnoteNumberFormat, EditorFootnotes, EditorParagraphNode, EditorTextRun } from './model.js';
|
|
2
2
|
|
|
3
|
-
export declare function resetFootnoteIds(): void;
|
|
4
|
-
export declare function createFootnoteId(): string;
|
|
5
3
|
/**
|
|
6
4
|
* Iterate every paragraph in document order (sections + footnotes excluded),
|
|
7
5
|
* yielding each footnote reference run along with the owning paragraph. Order
|
|
@@ -29,4 +29,5 @@ export { getDocumentSections, getDocumentSectionsCanonical, } from './documentSe
|
|
|
29
29
|
export { DocumentIndexBuilder, getDocumentParagraphIndex, getDocumentParagraphs, getDocumentParagraphsCanonical, getParagraphById, findParagraphLocation, findParagraphTableLocation, WeakMapDocumentIndexCache, } from './documentIndex.js';
|
|
30
30
|
export type { EditorParagraphLocation, TableLocation, DocumentParagraphIndexEntry, DocumentIndexCache, } from './documentIndex.js';
|
|
31
31
|
export { getBlockParagraphs, collectSectionParagraphs, } from './paragraphWalker.js';
|
|
32
|
+
export { buildListLabels, resolveListLabel } from './listNumbering.js';
|
|
32
33
|
export { getActiveSectionIndex, getActiveZone, getEditableBlocksForZone, tryGetEditableBlocksForZone, getActiveSectionBlocks, getParagraphs, } from './editingZones.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EditorDocument } from './types/document.js';
|
|
2
|
+
import { EditorParagraphNode } from './types/nodes.js';
|
|
3
|
+
|
|
4
|
+
export declare function buildListLabels(document: EditorDocument): Map<string, string>;
|
|
5
|
+
export declare function resolveListLabel(paragraph: EditorParagraphNode, labels: Map<string, string>): string;
|
|
@@ -26,8 +26,18 @@ export interface EditorTabStop {
|
|
|
26
26
|
export interface EditorParagraphListStyle {
|
|
27
27
|
kind: "bullet" | "ordered";
|
|
28
28
|
level?: number;
|
|
29
|
+
/** Imported OOXML `w:numId`; paragraphs sharing it use the same counters. */
|
|
30
|
+
instanceId?: string;
|
|
29
31
|
format?: "decimal" | "lowerLetter" | "upperLetter" | "lowerRoman" | "upperRoman" | "bullet";
|
|
30
32
|
startAt?: number;
|
|
33
|
+
/** Effective `w:lvlText` pattern, for example `%1.%2.`. */
|
|
34
|
+
levelText?: string;
|
|
35
|
+
/** Effective formats for referenced levels in a multilevel label. */
|
|
36
|
+
levelFormats?: Array<"decimal" | "lowerLetter" | "upperLetter" | "lowerRoman" | "upperRoman" | "bullet">;
|
|
37
|
+
/** `w:lvlJc`: alignment of the label inside its hanging-indent area. */
|
|
38
|
+
alignment?: "left" | "center" | "right";
|
|
39
|
+
/** `w:isLgl`: render referenced ordered levels with decimal digits. */
|
|
40
|
+
legal?: boolean;
|
|
31
41
|
/**
|
|
32
42
|
* Separator between the list label and the paragraph text (`w:lvl/w:suff`).
|
|
33
43
|
* OOXML default is "tab"; Word renders the label, then advances to the next
|
|
@@ -2,16 +2,23 @@ import { EditorBlockNode, EditorImageCrop, EditorImageFillMode, EditorImageFloat
|
|
|
2
2
|
import { BookmarkEventsByParagraph } from './bookmarksXml.js';
|
|
3
3
|
import { CommentEventsByParagraph } from './commentsXml.js';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface NumberingLevelDefinition {
|
|
6
6
|
kind: EditorParagraphListStyle["kind"];
|
|
7
7
|
level: number;
|
|
8
|
-
abstractNumId: number;
|
|
9
|
-
numId: number;
|
|
10
8
|
format?: NonNullable<EditorParagraphListStyle["format"]>;
|
|
11
9
|
startAt?: number;
|
|
10
|
+
levelText?: string;
|
|
11
|
+
suffix?: EditorParagraphListStyle["suffix"];
|
|
12
|
+
alignment?: EditorParagraphListStyle["alignment"];
|
|
13
|
+
legal?: boolean;
|
|
12
14
|
bulletGlyph?: string;
|
|
13
15
|
bulletFont?: string;
|
|
14
16
|
}
|
|
17
|
+
export interface NumberingDefinition {
|
|
18
|
+
abstractNumId: number;
|
|
19
|
+
numId: number;
|
|
20
|
+
levels: NumberingLevelDefinition[];
|
|
21
|
+
}
|
|
15
22
|
export interface DocContext {
|
|
16
23
|
numberingInfo: Map<string, {
|
|
17
24
|
numId: number;
|
|
@@ -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,
|
|
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>;
|
|
@@ -9,4 +9,4 @@ import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
|
9
9
|
* dotted edges use {@link borderDashArray} to match the canvas renderer.
|
|
10
10
|
*/
|
|
11
11
|
export declare function drawParagraphDecorations(writer: OasisPdfWriter, pageIndex: number, paragraphStyle: EditorParagraphStyle, lines: EditorLayoutLine[], originX: number, contentTop: number, contentWidth: number): void;
|
|
12
|
-
export declare function drawParagraph(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, lines: EditorLayoutLine[], document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string,
|
|
12
|
+
export declare function drawParagraph(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, lines: EditorLayoutLine[], document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>): Promise<void>;
|
|
@@ -2,4 +2,4 @@ import { EditorDocument, EditorLayoutBlock } from '../../../core/model.js';
|
|
|
2
2
|
import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
|
|
3
3
|
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
4
4
|
|
|
5
|
-
export declare function drawTableBlock(writer: OasisPdfWriter, pageIndex: number, block: EditorLayoutBlock, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string,
|
|
5
|
+
export declare function drawTableBlock(writer: OasisPdfWriter, pageIndex: number, block: EditorLayoutBlock, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>): Promise<void>;
|
|
@@ -2,5 +2,5 @@ import { EditorDocument, EditorLayoutLine, EditorParagraphNode } from '../../../
|
|
|
2
2
|
import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
|
|
3
3
|
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
4
4
|
|
|
5
|
-
export declare function getListOrdinals(document: EditorDocument): Map<string,
|
|
6
|
-
export declare function drawListPrefix(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, line: EditorLayoutLine, document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string,
|
|
5
|
+
export declare function getListOrdinals(document: EditorDocument): Map<string, string>;
|
|
6
|
+
export declare function drawListPrefix(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, line: EditorLayoutLine, document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { TranslateFn } from './index.js';
|
|
3
|
+
|
|
4
|
+
/** Access the translator from the nearest `I18nProvider`. */
|
|
5
|
+
export declare function useI18n(): TranslateFn;
|
|
6
|
+
export declare function I18nProvider(props: {
|
|
7
|
+
translator: TranslateFn;
|
|
8
|
+
children: JSX.Element;
|
|
9
|
+
}): JSX.Element;
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import { en } from './locales/en.js';
|
|
|
2
2
|
|
|
3
3
|
export type Locale = "en" | "pt-BR";
|
|
4
4
|
export type TranslationKey = keyof typeof en;
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export type TranslateFn = (key: TranslationKey, params?: unknown[]) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Build a translator bound to a locale accessor. The accessor is read on every
|
|
8
|
+
* call, so when it reads a Solid signal the translation tracks locale changes
|
|
9
|
+
* reactively. No module-level mutable locale is involved.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createTranslator(getLocale: () => Locale): TranslateFn;
|
|
@@ -1,41 +1,32 @@
|
|
|
1
1
|
import { Element as XmlElement } from '@xmldom/xmldom';
|
|
2
2
|
import { EditorParagraphListStyle } from '../../core/model.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
type ListFormat = NonNullable<EditorParagraphListStyle["format"]>;
|
|
5
|
+
interface NumberingLevel {
|
|
6
|
+
kind?: EditorParagraphListStyle["kind"];
|
|
7
|
+
format?: ListFormat;
|
|
8
|
+
suffix?: EditorParagraphListStyle["suffix"];
|
|
9
|
+
startAt?: number;
|
|
10
|
+
levelText?: string;
|
|
11
|
+
alignment?: EditorParagraphListStyle["alignment"];
|
|
12
|
+
legal?: boolean;
|
|
13
|
+
bulletGlyph?: string;
|
|
14
|
+
bulletFont?: string;
|
|
15
|
+
indent?: {
|
|
9
16
|
left?: number;
|
|
10
17
|
hanging?: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/** Starting number from `w:start`, keyed by "abstractNumId:ilvl". OOXML default is 1. */
|
|
17
|
-
abstractStarts: Map<string, number>;
|
|
18
|
-
/** Literal bullet glyph from `w:lvlText`, keyed by "abstractNumId:ilvl". */
|
|
19
|
-
abstractBulletGlyphs: Map<string, string>;
|
|
20
|
-
/** Font name from `w:lvl/w:rPr/w:rFonts`, keyed by "abstractNumId:ilvl". */
|
|
21
|
-
abstractBulletFonts: Map<string, string>;
|
|
22
|
-
/** `w:startOverride` values from `w:num/w:lvlOverride`, keyed by "numId:ilvl". */
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface NumberingMaps {
|
|
21
|
+
abstractLevels: Map<string, NumberingLevel>;
|
|
22
|
+
numOverrideLevels: Map<string, NumberingLevel>;
|
|
23
23
|
numStartOverrides: Map<string, number>;
|
|
24
|
-
/** numId → abstractNumId */
|
|
25
24
|
numToAbstractId: Map<string, string>;
|
|
26
|
-
/**
|
|
27
|
-
* Tracks which "numId:ilvl" pairs have been seen during paragraph parsing.
|
|
28
|
-
* The first paragraph for each pair carries the level's `startAt` value;
|
|
29
|
-
* subsequent paragraphs in the same list instance do not, so the counter
|
|
30
|
-
* continues from the previous ordinal instead of resetting.
|
|
31
|
-
*/
|
|
32
25
|
seenInstances: Set<string>;
|
|
33
26
|
}
|
|
34
27
|
export declare function parseNumbering(numberingXml: string | null): NumberingMaps;
|
|
35
28
|
export declare function parseParagraphList(paragraphProperties: XmlElement | null, numberingMaps: NumberingMaps): {
|
|
36
29
|
list: EditorParagraphListStyle;
|
|
37
|
-
indent?:
|
|
38
|
-
left?: number;
|
|
39
|
-
hanging?: number;
|
|
40
|
-
};
|
|
30
|
+
indent?: NumberingLevel["indent"];
|
|
41
31
|
} | undefined;
|
|
32
|
+
export {};
|