oasis-editor 0.0.91 → 0.0.92
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-Cwd5XBHr.js → OasisEditorApp-C_Ao4zIF.js} +36 -11
- package/dist/assets/{importDocxWorker-6DqfSWfq.js → importDocxWorker-DAbfLHtp.js} +1 -1
- package/dist/core/engine.d.ts +16 -0
- package/dist/core/model/types/document.d.ts +8 -0
- package/dist/core/model/types/layout.d.ts +9 -0
- package/dist/export/docx/docxPackageXml.d.ts +7 -1
- package/dist/import/docx/settings.d.ts +4 -0
- package/dist/{index-C2DlzueH.js → index-BQEtsRa0.js} +438 -49
- package/dist/layoutProjection/paragraphPagination.d.ts +2 -1
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/textMeasurement/hyphenation.d.ts +33 -0
- package/dist/ui/textMeasurement/types.d.ts +9 -2
- package/package.json +4 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knuth–Liang automatic hyphenation, language-aware (Portuguese + English).
|
|
3
|
+
*
|
|
4
|
+
* The composer consumes this to break long words at linguistically valid
|
|
5
|
+
* points. Auto-hyphens are a layout-time concern only — they are never written
|
|
6
|
+
* into the document model (Word recomputes them on open).
|
|
7
|
+
*/
|
|
8
|
+
export type HyphenationLanguage = "pt" | "en-us";
|
|
9
|
+
export interface ShouldHyphenateOptions {
|
|
10
|
+
/** `w:doNotHyphenateCaps`: skip words that are entirely uppercase. */
|
|
11
|
+
doNotHyphenateCaps?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Maps a run/paragraph BCP-47-ish language tag to a bundled pattern set.
|
|
15
|
+
* Anything that is not clearly English falls back to Portuguese (the editor's
|
|
16
|
+
* primary language).
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveHyphenationLanguage(tag: string | undefined): HyphenationLanguage;
|
|
19
|
+
/**
|
|
20
|
+
* Whether a token is a plain word that may be auto-hyphenated. Skips numbers,
|
|
21
|
+
* alphanumeric codes, words already carrying a hyphen, and (optionally) all-caps
|
|
22
|
+
* words.
|
|
23
|
+
*/
|
|
24
|
+
export declare function shouldHyphenateWord(word: string, options?: ShouldHyphenateOptions): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the allowed break offsets within `word` (indices at which the word may
|
|
27
|
+
* be split, with a hyphen drawn before the break). Memoized per language+word.
|
|
28
|
+
*
|
|
29
|
+
* Offsets are relative to the start of `word`; leading/trailing non-letters are
|
|
30
|
+
* ignored so trailing punctuation (e.g. "palavra,") does not block hyphenation
|
|
31
|
+
* of the alphabetic core.
|
|
32
|
+
*/
|
|
33
|
+
export declare function findHyphenationPoints(word: string, lang: HyphenationLanguage): readonly number[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EditorLayoutFragment, EditorNamedStyle, EditorParagraphNode } from '../../core/model.js';
|
|
2
|
-
import { FloatingExclusionRect } from '../../core/engine.js';
|
|
1
|
+
import { EditorLayoutFragment, EditorNamedStyle, EditorParagraphNode, EditorTextStyle } from '../../core/model.js';
|
|
2
|
+
import { FloatingExclusionRect, HyphenationLayoutOptions } from '../../core/engine.js';
|
|
3
3
|
|
|
4
4
|
export interface MeasuredChar {
|
|
5
5
|
char: string;
|
|
@@ -11,6 +11,12 @@ export interface MeasuredChar {
|
|
|
11
11
|
* objects (which are taken out of flow).
|
|
12
12
|
*/
|
|
13
13
|
objectHeight?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Effective text style of the run this char belongs to (shared reference).
|
|
16
|
+
* Used by automatic hyphenation to measure the hyphen glyph and resolve the
|
|
17
|
+
* hyphenation language; absent for inline-object placeholders.
|
|
18
|
+
*/
|
|
19
|
+
style?: EditorTextStyle;
|
|
14
20
|
}
|
|
15
21
|
export interface MeasuredToken {
|
|
16
22
|
kind: "text" | "whitespace" | "newline";
|
|
@@ -24,4 +30,5 @@ export interface TextMeasureOptions {
|
|
|
24
30
|
contentWidth?: number;
|
|
25
31
|
defaultTabStop?: number;
|
|
26
32
|
exclusions?: FloatingExclusionRect[];
|
|
33
|
+
hyphenation?: HyphenationLayoutOptions;
|
|
27
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oasis-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.92",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -87,6 +87,9 @@
|
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@xmldom/xmldom": "^0.9.10",
|
|
89
89
|
"brotli": "^1.3.3",
|
|
90
|
+
"hyphenation.en-us": "^0.2.1",
|
|
91
|
+
"hyphenation.pt": "^0.2.1",
|
|
92
|
+
"hypher": "^0.2.5",
|
|
90
93
|
"jszip": "^3.10.1",
|
|
91
94
|
"lucide": "^1.11.0",
|
|
92
95
|
"solid-js": "^1.9.12"
|