oasis-editor 0.0.91 → 0.0.93

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.
@@ -14,6 +14,21 @@ export interface FloatingExclusionRect {
14
14
  y: number;
15
15
  }>;
16
16
  }
17
+ /**
18
+ * Automatic-hyphenation configuration resolved from `EditorDocument.settings`
19
+ * (`w:autoHyphenation` and friends). Threaded to the composer so words can break
20
+ * at line ends with a rendered trailing hyphen.
21
+ */
22
+ export interface HyphenationLayoutOptions {
23
+ /** `w:autoHyphenation`: master switch. */
24
+ enabled: boolean;
25
+ /** `w:hyphenationZone`: min trailing gap (points) before hyphenating. */
26
+ zone?: number;
27
+ /** `w:consecutiveHyphenLimit`: max consecutive hyphenated lines (0/undefined = unlimited). */
28
+ consecutiveLimit?: number;
29
+ /** `w:doNotHyphenateCaps`: skip all-caps words. */
30
+ doNotHyphenateCaps?: boolean;
31
+ }
17
32
  export interface TextMeasureOptions {
18
33
  paragraph: EditorParagraphNode;
19
34
  fragments: EditorLayoutFragment[];
@@ -21,6 +36,7 @@ export interface TextMeasureOptions {
21
36
  contentWidth?: number;
22
37
  defaultTabStop?: number;
23
38
  exclusions?: FloatingExclusionRect[];
39
+ hyphenation?: HyphenationLayoutOptions;
24
40
  }
25
41
  export interface ITextMeasurer {
26
42
  composeMeasuredParagraphLines(options: TextMeasureOptions): EditorLayoutLine[];
@@ -88,6 +88,14 @@ export interface EditorDocument {
88
88
  defaultTabStop?: number;
89
89
  /** `w:allowSpaceOfSameStyleInTable`: contextual spacing applies in table cells. */
90
90
  allowSpaceOfSameStyleInTable?: boolean;
91
+ /** `w:autoHyphenation`: automatically hyphenate words at line ends. */
92
+ autoHyphenation?: boolean;
93
+ /** `w:consecutiveHyphenLimit`: max consecutive lines ending with a hyphen (0 = unlimited). */
94
+ consecutiveHyphenLimit?: number;
95
+ /** `w:hyphenationZone`: min trailing gap (points) before a word is hyphenated. */
96
+ hyphenationZone?: number;
97
+ /** `w:doNotHyphenateCaps`: do not hyphenate all-caps words. */
98
+ doNotHyphenateCaps?: boolean;
91
99
  };
92
100
  /**
93
101
  * Out-of-band asset registry. Image runs reference entries here using
@@ -37,6 +37,15 @@ export interface EditorLayoutLine {
37
37
  slots: EditorCaretSlot[];
38
38
  fragments: EditorLayoutFragment[];
39
39
  availableWidth?: number;
40
+ /**
41
+ * Set when the line ends mid-word due to automatic hyphenation. Renderers draw
42
+ * a trailing hyphen glyph after the last fragment; it is not part of the text
43
+ * model (no caret slot/offset), so caret and selection logic ignore it.
44
+ */
45
+ trailingHyphen?: boolean;
46
+ /** Advance (px) reserved/drawn for the trailing hyphen; the single source of
47
+ * truth shared by alignment and the canvas/PDF renderers. */
48
+ trailingHyphenWidth?: number;
40
49
  }
41
50
  export interface EditorLayoutParagraph {
42
51
  paragraphId: string;
@@ -4,5 +4,11 @@ import { DocContext, PartDefinition } from './docxTypes.js';
4
4
  export declare function buildContentTypesXml(hasNumbering: boolean, imageExtensions: Iterable<string>, hasSettings: boolean, parts: PartDefinition[], hasFootnotes: boolean, hasEndnotes: boolean, hasStyles: boolean, hasComments: boolean): string;
5
5
  export declare function buildRootRelationshipsXml(): string;
6
6
  export declare function buildDocumentRelationshipsXml(hasNumbering: boolean, hasSettings: boolean, images: DocContext["images"], hyperlinks: DocContext["hyperlinks"], parts: PartDefinition[], hasFootnotes: boolean, hasEndnotes: boolean, hasStyles: boolean, hasComments: boolean): string;
7
- export declare function buildSettingsXml(hasEvenAndOddHeaders: boolean, defaultTabStop?: number, footnoteSettings?: EditorFootnoteSettings, endnoteSettings?: EditorFootnoteSettings, allowSpaceOfSameStyleInTable?: boolean): string;
7
+ export interface HyphenationSettingsXml {
8
+ autoHyphenation?: boolean;
9
+ consecutiveHyphenLimit?: number;
10
+ hyphenationZone?: number;
11
+ doNotHyphenateCaps?: boolean;
12
+ }
13
+ export declare function buildSettingsXml(hasEvenAndOddHeaders: boolean, defaultTabStop?: number, footnoteSettings?: EditorFootnoteSettings, endnoteSettings?: EditorFootnoteSettings, allowSpaceOfSameStyleInTable?: boolean, hyphenation?: HyphenationSettingsXml): string;
8
14
  export declare function buildPartRelationshipsXml(images: DocContext["images"], hyperlinks: DocContext["hyperlinks"]): string;
@@ -4,6 +4,10 @@ export interface DocxSettings {
4
4
  adjustLineHeightInTable: boolean;
5
5
  allowSpaceOfSameStyleInTable?: boolean;
6
6
  defaultTabStop?: number;
7
+ autoHyphenation?: boolean;
8
+ consecutiveHyphenLimit?: number;
9
+ hyphenationZone?: number;
10
+ doNotHyphenateCaps?: boolean;
7
11
  footnoteSettings?: EditorFootnoteSettings;
8
12
  endnoteSettings?: EditorEndnoteSettings;
9
13
  }