@stll/folio-core 0.47.7 → 0.48.0
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/controller/fontReadiness.js +3 -3
- package/dist/controller/hyphenationReadiness.d.ts +19 -0
- package/dist/controller/hyphenationReadiness.js +47 -0
- package/dist/controller/layoutPipeline.d.ts +3 -0
- package/dist/controller/layoutPipeline.js +59 -17
- package/dist/display-list/build/buildDisplayList.js +39 -12
- package/dist/display-list/build/pageFurniture.d.ts +7 -1
- package/dist/display-list/build/pageFurniture.js +21 -8
- package/dist/display-list/build/paragraphPrimitives.js +5 -4
- package/dist/display-list/build/tablePrimitives.js +10 -6
- package/dist/docx/attributeRemainder.js +10 -2
- package/dist/docx/blockContentParser.d.ts +2 -0
- package/dist/docx/blockContentParser.js +77 -62
- package/dist/docx/commentParser.d.ts +2 -1
- package/dist/docx/commentParser.js +57 -45
- package/dist/docx/containerChildren.d.ts +21 -8
- package/dist/docx/containerChildren.js +39 -9
- package/dist/docx/documentParser.d.ts +5 -1
- package/dist/docx/documentParser.js +8 -5
- package/dist/docx/documentSectionFacts.d.ts +22 -0
- package/dist/docx/documentSectionFacts.js +43 -0
- package/dist/docx/fieldParser.d.ts +8 -1
- package/dist/docx/fieldParser.js +47 -3
- package/dist/docx/fontTableParser.js +34 -27
- package/dist/docx/footnoteParser.d.ts +3 -2
- package/dist/docx/footnoteParser.js +15 -12
- package/dist/docx/groupDrawingParser.d.ts +2 -1
- package/dist/docx/groupDrawingParser.js +3 -6
- package/dist/docx/headerFooterParser.d.ts +7 -2
- package/dist/docx/headerFooterParser.js +15 -5
- package/dist/docx/hyperlinkParser.d.ts +48 -36
- package/dist/docx/hyperlinkParser.js +97 -82
- package/dist/docx/numberingParser.js +108 -84
- package/dist/docx/paragraphParser.d.ts +5 -1
- package/dist/docx/paragraphParser.js +381 -362
- package/dist/docx/paragraphProperties.js +123 -109
- package/dist/docx/paragraphPropertySource.d.ts +6 -1
- package/dist/docx/paragraphPropertySource.js +9 -1
- package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
- package/dist/docx/paragraphTextBoxEnrichment.js +17 -6
- package/dist/docx/parser.d.ts +7 -1
- package/dist/docx/parser.js +33 -16
- package/dist/docx/previewBudget.d.ts +55 -33
- package/dist/docx/previewBudget.js +59 -65
- package/dist/docx/rezip.js +41 -58
- package/dist/docx/runParser.d.ts +4 -1
- package/dist/docx/runParser.js +172 -184
- package/dist/docx/sdtProperties.js +87 -84
- package/dist/docx/sectionParser.js +169 -160
- package/dist/docx/serializer/paragraphSerializer.js +42 -38
- package/dist/docx/serializer/settingsSerializer.js +19 -1
- package/dist/docx/settingsParser.js +8 -0
- package/dist/docx/streamingXmlParser.d.ts +6 -2
- package/dist/docx/streamingXmlParser.js +12 -7
- package/dist/docx/styleParser.js +34 -8
- package/dist/docx/tableParser.d.ts +21 -12
- package/dist/docx/tableParser.js +518 -441
- package/dist/docx/textBoxParser.d.ts +8 -3
- package/dist/docx/textBoxParser.js +3 -3
- package/dist/docx/verbatimCapture.d.ts +10 -8
- package/dist/docx/verbatimCapture.js +45 -2
- package/dist/docx/vmlImageParser.d.ts +15 -13
- package/dist/docx/vmlImageParser.js +75 -60
- package/dist/docx/vmlPreview.d.ts +3 -3
- package/dist/docx/vmlPreview.js +3 -4
- package/dist/docx/xmlNamespaceContext.d.ts +9 -0
- package/dist/docx/xmlNamespaceContext.js +54 -0
- package/dist/docx/xmlParser.d.ts +6 -3
- package/dist/docx/xmlParser.js +11 -41
- package/dist/docx/xmlResourceLimits.d.ts +2 -1
- package/dist/docx/xmlResourceLimits.js +4 -1
- package/dist/fonts/headlessMeasure.js +0 -0
- package/dist/headless-layout.d.ts +11 -2
- package/dist/headless-layout.js +153 -107
- package/dist/internal/paragraphFormattingSerialization.js +3 -3
- package/dist/layout-bridge/convert/endnoteLayout.d.ts +65 -0
- package/dist/layout-bridge/convert/endnoteLayout.js +227 -0
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +19 -3
- package/dist/layout-bridge/convert/footnoteLayout.js +40 -31
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -7
- package/dist/layout-bridge/convert/headerFooterLayout.js +5 -20
- package/dist/layout-bridge/convert/paragraphMarkFormatting.d.ts +10 -0
- package/dist/layout-bridge/convert/paragraphMarkFormatting.js +59 -0
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +29 -1
- package/dist/layout-bridge/convert/toFlowBlocks.js +258 -35
- package/dist/layout-bridge/engine/hitTest.js +5 -3
- package/dist/layout-bridge/engine/selectionRects.js +5 -3
- package/dist/layout-engine/anchorLayoutInCellCompatibility.d.ts +10 -0
- package/dist/layout-engine/anchorLayoutInCellCompatibility.js +22 -0
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +70 -11
- package/dist/layout-engine/justificationCompatibility.d.ts +1 -1
- package/dist/layout-engine/justificationCompatibility.js +9 -5
- package/dist/layout-engine/keep-together.d.ts +11 -5
- package/dist/layout-engine/keep-together.js +39 -16
- package/dist/layout-engine/layoutInstrumentation.d.ts +8 -2
- package/dist/layout-engine/layoutInstrumentation.js +8 -1
- package/dist/layout-engine/measure/advanceComposition.js +4 -7
- package/dist/layout-engine/measure/hyphenationDictionaries.d.ts +74 -0
- package/dist/layout-engine/measure/hyphenationDictionaries.js +138 -0
- package/dist/layout-engine/measure/hyphenationPreload.d.ts +11 -0
- package/dist/layout-engine/measure/hyphenationPreload.js +24 -0
- package/dist/layout-engine/measure/lineBreakProvider.d.ts +12 -2
- package/dist/layout-engine/measure/lineBreakProvider.js +30 -30
- package/dist/layout-engine/measure/lineBreaks.d.ts +6 -1
- package/dist/layout-engine/measure/lineBreaks.js +10 -3
- package/dist/layout-engine/measure/listMarkerWidth.d.ts +9 -6
- package/dist/layout-engine/measure/listMarkerWidth.js +20 -22
- package/dist/layout-engine/measure/measureBlocks.js +42 -8
- package/dist/layout-engine/measure/measureContainer.js +5 -5
- package/dist/layout-engine/measure/measureHelpers.d.ts +15 -3
- package/dist/layout-engine/measure/measureHelpers.js +21 -5
- package/dist/layout-engine/measure/measureParagraph.js +109 -30
- package/dist/layout-engine/measure/measureTypes.d.ts +5 -0
- package/dist/layout-engine/measure/tabCalculator.d.ts +2 -0
- package/dist/layout-engine/measure/tabCalculator.js +2 -1
- package/dist/layout-engine/measure/tableCellFloating.d.ts +2 -0
- package/dist/layout-engine/measure/tableCellFloating.js +51 -19
- package/dist/layout-engine/measure/tableCellGrid.d.ts +28 -3
- package/dist/layout-engine/measure/tableCellGrid.js +45 -5
- package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
- package/dist/layout-engine/noteAreaFlow.d.ts +19 -0
- package/dist/layout-engine/noteAreaFlow.js +83 -0
- package/dist/layout-engine/paginator.d.ts +10 -1
- package/dist/layout-engine/paginator.js +13 -1
- package/dist/layout-engine/tableRowBreak.js +3 -1
- package/dist/layout-engine/types.d.ts +89 -3
- package/dist/layout-engine/types.js +96 -1
- package/dist/layout-painter/index.d.ts +3 -0
- package/dist/layout-painter/renderPage.js +32 -83
- package/dist/layout-painter/renderParagraph.d.ts +6 -1
- package/dist/layout-painter/renderParagraph.js +34 -22
- package/dist/layout-painter/renderTable.js +26 -13
- package/dist/prosemirror/attrs/index.d.ts +9 -9
- package/dist/prosemirror/attrs/index.js +43 -11
- package/dist/prosemirror/conversion/fromProseDoc.js +8 -1
- package/dist/prosemirror/conversion/markInterner.d.ts +21 -0
- package/dist/prosemirror/conversion/markInterner.js +90 -0
- package/dist/prosemirror/conversion/toProseDoc.js +77 -41
- package/dist/prosemirror/extensions/core/DocExtension.js +2 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +1 -0
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +6 -2
- package/dist/prosemirror/extensions/marks/markUtils.js +39 -51
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +2 -1
- package/dist/prosemirror/listMarker.d.ts +1 -0
- package/dist/prosemirror/listMarker.js +2 -0
- package/dist/prosemirror/listRenderingAttrs.d.ts +1 -0
- package/dist/prosemirror/listRenderingAttrs.js +3 -0
- package/dist/prosemirror/schema/nodes.d.ts +13 -1
- package/dist/prosemirror/textBoxHostParagraph.d.ts +13 -0
- package/dist/prosemirror/textBoxHostParagraph.js +21 -0
- package/dist/prosemirror/validation.js +91 -80
- package/dist/utils/createDocument.js +10 -1
- package/dist/utils/scriptSegments.d.ts +33 -4
- package/dist/utils/scriptSegments.js +39 -6
- package/dist/utils/textFormattingMerge.d.ts +17 -3
- package/dist/utils/textFormattingMerge.js +18 -12
- package/dist/utils/trailingText.d.ts +22 -0
- package/dist/utils/trailingText.js +32 -0
- package/package.json +2 -2
|
@@ -52,9 +52,32 @@ function hasCjk(text) {
|
|
|
52
52
|
function isComplexScriptCodePoint(cp) {
|
|
53
53
|
return cp >= 1424 && cp <= 1535 || cp >= 1536 && cp <= 1791 || cp >= 1792 && cp <= 1871 || cp >= 1872 && cp <= 1919 || cp >= 1920 && cp <= 1983 || cp >= 1984 && cp <= 2047 || cp >= 2048 && cp <= 2111 || cp >= 2112 && cp <= 2143 || cp >= 2144 && cp <= 2159 || cp >= 2160 && cp <= 2207 || cp >= 2208 && cp <= 2303 || cp >= 2304 && cp <= 3455 || cp >= 3456 && cp <= 3583 || cp >= 3584 && cp <= 3711 || cp >= 3712 && cp <= 3839 || cp >= 3840 && cp <= 4095 || cp >= 4096 && cp <= 4255 || cp >= 6016 && cp <= 6143 || cp >= 64285 && cp <= 64335 || cp >= 64336 && cp <= 65023 || cp >= 65136 && cp <= 65279 || cp >= 68864 && cp <= 68927 || cp >= 69312 && cp <= 69375 || cp >= 69424 && cp <= 69487 || cp >= 69488 && cp <= 69551 || cp >= 125184 && cp <= 125279 || cp >= 126464 && cp <= 126719;
|
|
54
54
|
}
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
/**
|
|
56
|
+
* True when `w:rFonts/@w:hint="eastAsia"` moves a code point from the
|
|
57
|
+
* `w:hAnsi` slot to the `w:eastAsia` slot (ECMA-376 §17.3.2.26): the ranges
|
|
58
|
+
* the font-slot table resolves to the East Asian font whenever the hint is
|
|
59
|
+
* `eastAsia`. Basic Latin never moves, and neither do the accented letters of
|
|
60
|
+
* Latin-1 Supplement and the Latin Extended blocks, whose move the table also
|
|
61
|
+
* conditions on the run's East Asian language.
|
|
62
|
+
*/
|
|
63
|
+
function isEastAsiaHintCodePoint(cp) {
|
|
64
|
+
return cp === 161 || cp === 164 || cp === 167 || cp === 168 || cp === 170 || cp === 173 || cp === 175 || cp >= 176 && cp <= 180 || cp >= 182 && cp <= 186 || cp >= 188 && cp <= 191 || cp === 215 || cp === 247 || cp >= 688 && cp <= 879 || cp >= 880 && cp <= 1023 || cp >= 1024 && cp <= 1279 || cp >= 8192 && cp <= 10175 || cp >= 57344 && cp <= 63743 || cp >= 64256 && cp <= 64284;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Whether a run's `w:hint="eastAsia"` takes effect. A run under `w:cs` or
|
|
68
|
+
* `w:rtl` formats every character with the complex-script slot, which the
|
|
69
|
+
* hint does not override.
|
|
70
|
+
*/
|
|
71
|
+
function eastAsiaHintApplies(run) {
|
|
72
|
+
return run.eastAsiaHint === true && run.forceComplexScript !== true && run.rtl !== true;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Which font slot a single code point selects. CJK wins where ranges meet.
|
|
76
|
+
* `eastAsiaHint` is the run's effective `w:hint="eastAsia"`
|
|
77
|
+
* (see {@link eastAsiaHintApplies}).
|
|
78
|
+
*/
|
|
79
|
+
function scriptClassOf(cp, eastAsiaHint = false) {
|
|
80
|
+
if (isCjkCodePoint(cp) || eastAsiaHint && isEastAsiaHintCodePoint(cp)) return SCRIPT_CLASS.eastAsia;
|
|
58
81
|
if (isComplexScriptCodePoint(cp)) return SCRIPT_CLASS.complex;
|
|
59
82
|
return SCRIPT_CLASS.western;
|
|
60
83
|
}
|
|
@@ -83,16 +106,26 @@ function hasComplexScript(text) {
|
|
|
83
106
|
return false;
|
|
84
107
|
}
|
|
85
108
|
/**
|
|
109
|
+
* True when some code point of the text selects the `w:eastAsia` slot: a CJK
|
|
110
|
+
* code point, or under an effective `w:hint="eastAsia"` one the hint moves.
|
|
111
|
+
*/
|
|
112
|
+
function hasEastAsiaSlotText(text, eastAsiaHint = false) {
|
|
113
|
+
if (!eastAsiaHint) return hasCjk(text);
|
|
114
|
+
for (const ch of text) if (scriptClassOf(ch.codePointAt(0), true) === SCRIPT_CLASS.eastAsia) return true;
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
86
118
|
* Split text into maximal runs of one script class (CJK vs. non-CJK). Iterates
|
|
87
119
|
* by code point so astral ideographs (surrogate pairs) are never split between
|
|
88
120
|
* fonts. Empty input yields no segments; single-class input yields one.
|
|
121
|
+
* `eastAsiaHint` is the run's effective `w:hint="eastAsia"`.
|
|
89
122
|
*/
|
|
90
|
-
function segmentByScript(text) {
|
|
123
|
+
function segmentByScript(text, eastAsiaHint = false) {
|
|
91
124
|
const segments = [];
|
|
92
125
|
let current = "";
|
|
93
126
|
let currentScript = SCRIPT_CLASS.western;
|
|
94
127
|
for (const ch of text) {
|
|
95
|
-
const script = scriptClassOf(ch.codePointAt(0));
|
|
128
|
+
const script = scriptClassOf(ch.codePointAt(0), eastAsiaHint);
|
|
96
129
|
if (current.length === 0) {
|
|
97
130
|
current = ch;
|
|
98
131
|
currentScript = script;
|
|
@@ -116,4 +149,4 @@ function segmentByScript(text) {
|
|
|
116
149
|
return segments;
|
|
117
150
|
}
|
|
118
151
|
//#endregion
|
|
119
|
-
export { SCRIPT_CLASS, hasCjk, hasComplexScript, hasRightToLeft, isCjkCodePoint, isComplexScriptCodePoint, isRightToLeftCodePoint, scriptClassOf, segmentByScript };
|
|
152
|
+
export { SCRIPT_CLASS, eastAsiaHintApplies, hasCjk, hasComplexScript, hasEastAsiaSlotText, hasRightToLeft, isCjkCodePoint, isComplexScriptCodePoint, isEastAsiaHintCodePoint, isRightToLeftCodePoint, scriptClassOf, segmentByScript };
|
|
@@ -2,10 +2,24 @@ import { document_d_exports } from "../types/document.js";
|
|
|
2
2
|
//#region src/utils/textFormattingMerge.d.ts
|
|
3
3
|
declare const STYLE_TOGGLE_KEYS: readonly ["bold", "boldCs", "italic", "italicCs", "allCaps", "emboss", "imprint", "outline", "shadow", "smallCaps", "strike", "hidden"];
|
|
4
4
|
/**
|
|
5
|
-
* Merge
|
|
5
|
+
* Merge one style's own run-formatting declarations onto its already-resolved
|
|
6
|
+
* `w:basedOn` ancestor.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* ECMA-376 §17.7.3 resolves a toggle property (bold, italic, allCaps, ...) for a
|
|
9
|
+
* single style tier by walking the `basedOn` chain from the style itself towards
|
|
10
|
+
* its root: read the value the style declares; if it declares none, move to the
|
|
11
|
+
* parent and repeat. The first value found — whether an explicit "on" or an
|
|
12
|
+
* explicit "off" — is that tier's value, and it is *not* combined with whatever
|
|
13
|
+
* a weaker ancestor further up the chain happened to say. A style's own
|
|
14
|
+
* `<w:b w:val="0"/>` therefore turns bold off outright, even when its base style
|
|
15
|
+
* is bold; it does not defer to the base.
|
|
16
|
+
*
|
|
17
|
+
* That is exactly last-defined-wins, i.e. `mergeTextFormatting`'s existing
|
|
18
|
+
* behaviour for every other property. The toggle behaviour §17.7.3 is actually
|
|
19
|
+
* known for — combining a table style's, a paragraph style's and a character
|
|
20
|
+
* style's resolved values by Boolean XOR — combines the *outputs* of separate
|
|
21
|
+
* `basedOn` walks like this one; it is not part of resolving a single walk, so
|
|
22
|
+
* it has no place in this function.
|
|
9
23
|
*/
|
|
10
24
|
declare function mergeStyleTextFormatting(target: document_d_exports.TextFormatting | undefined, source: document_d_exports.TextFormatting | undefined): document_d_exports.TextFormatting | undefined;
|
|
11
25
|
declare function mergeTextFormatting(target: document_d_exports.TextFormatting | undefined, source: document_d_exports.TextFormatting | undefined): document_d_exports.TextFormatting | undefined;
|
|
@@ -15,21 +15,27 @@ const STYLE_TOGGLE_KEYS = [
|
|
|
15
15
|
"hidden"
|
|
16
16
|
];
|
|
17
17
|
/**
|
|
18
|
-
* Merge
|
|
18
|
+
* Merge one style's own run-formatting declarations onto its already-resolved
|
|
19
|
+
* `w:basedOn` ancestor.
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* ECMA-376 §17.7.3 resolves a toggle property (bold, italic, allCaps, ...) for a
|
|
22
|
+
* single style tier by walking the `basedOn` chain from the style itself towards
|
|
23
|
+
* its root: read the value the style declares; if it declares none, move to the
|
|
24
|
+
* parent and repeat. The first value found — whether an explicit "on" or an
|
|
25
|
+
* explicit "off" — is that tier's value, and it is *not* combined with whatever
|
|
26
|
+
* a weaker ancestor further up the chain happened to say. A style's own
|
|
27
|
+
* `<w:b w:val="0"/>` therefore turns bold off outright, even when its base style
|
|
28
|
+
* is bold; it does not defer to the base.
|
|
29
|
+
*
|
|
30
|
+
* That is exactly last-defined-wins, i.e. `mergeTextFormatting`'s existing
|
|
31
|
+
* behaviour for every other property. The toggle behaviour §17.7.3 is actually
|
|
32
|
+
* known for — combining a table style's, a paragraph style's and a character
|
|
33
|
+
* style's resolved values by Boolean XOR — combines the *outputs* of separate
|
|
34
|
+
* `basedOn` walks like this one; it is not part of resolving a single walk, so
|
|
35
|
+
* it has no place in this function.
|
|
22
36
|
*/
|
|
23
37
|
function mergeStyleTextFormatting(target, source) {
|
|
24
|
-
|
|
25
|
-
if (!result || !source) return result;
|
|
26
|
-
for (const key of STYLE_TOGGLE_KEYS) {
|
|
27
|
-
if (source[key] !== false) continue;
|
|
28
|
-
const inherited = target?.[key];
|
|
29
|
-
if (inherited === void 0) Reflect.deleteProperty(result, key);
|
|
30
|
-
else result[key] = inherited;
|
|
31
|
-
}
|
|
32
|
-
return result;
|
|
38
|
+
return mergeTextFormatting(target, source);
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
35
41
|
* A merge answers "what does this text look like once the style, the paragraph
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/utils/trailingText.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Linear scans over the end of a text run. Layout calls these on every
|
|
4
|
+
* measure and paint pass, and run text can be arbitrarily long, so they
|
|
5
|
+
* must not backtrack the way an end-anchored regular expression does.
|
|
6
|
+
*/
|
|
7
|
+
/** Index where the trailing run of U+0020 spaces begins; `text.length` when there is none. */
|
|
8
|
+
declare function trailingSpaceStart(text: string): number;
|
|
9
|
+
type TrailingToken = {
|
|
10
|
+
/** Last run of non-whitespace characters. */
|
|
11
|
+
token: string;
|
|
12
|
+
/** Whitespace after the token, up to the end of the text. */
|
|
13
|
+
separator: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Split off the last whitespace-delimited token and the whitespace that
|
|
17
|
+
* follows it, or return undefined when the text has no non-whitespace
|
|
18
|
+
* character.
|
|
19
|
+
*/
|
|
20
|
+
declare function splitTrailingToken(text: string): TrailingToken | undefined;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { TrailingToken, splitTrailingToken, trailingSpaceStart };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/utils/trailingText.ts
|
|
2
|
+
/**
|
|
3
|
+
* Linear scans over the end of a text run. Layout calls these on every
|
|
4
|
+
* measure and paint pass, and run text can be arbitrarily long, so they
|
|
5
|
+
* must not backtrack the way an end-anchored regular expression does.
|
|
6
|
+
*/
|
|
7
|
+
const WHITESPACE = /\s/u;
|
|
8
|
+
const isWhitespaceUnit = (text, index) => WHITESPACE.test(text.charAt(index));
|
|
9
|
+
/** Index where the trailing run of U+0020 spaces begins; `text.length` when there is none. */
|
|
10
|
+
function trailingSpaceStart(text) {
|
|
11
|
+
let start = text.length;
|
|
12
|
+
while (start > 0 && text.charCodeAt(start - 1) === 32) start--;
|
|
13
|
+
return start;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Split off the last whitespace-delimited token and the whitespace that
|
|
17
|
+
* follows it, or return undefined when the text has no non-whitespace
|
|
18
|
+
* character.
|
|
19
|
+
*/
|
|
20
|
+
function splitTrailingToken(text) {
|
|
21
|
+
let tokenEnd = text.length;
|
|
22
|
+
while (tokenEnd > 0 && isWhitespaceUnit(text, tokenEnd - 1)) tokenEnd--;
|
|
23
|
+
if (tokenEnd === 0) return;
|
|
24
|
+
let tokenStart = tokenEnd;
|
|
25
|
+
while (tokenStart > 0 && !isWhitespaceUnit(text, tokenStart - 1)) tokenStart--;
|
|
26
|
+
return {
|
|
27
|
+
token: text.slice(tokenStart, tokenEnd),
|
|
28
|
+
separator: text.slice(tokenEnd)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { splitTrailingToken, trailingSpaceStart };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "Headless, framework-neutral core of folio: the OOXML (.docx) parser, document model, ProseMirror integration, and page-layout engine. No React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"document-model",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"perf": "bun scripts/profile-editor.ts"
|
|
129
129
|
},
|
|
130
130
|
"dependencies": {
|
|
131
|
-
"@stll/docx-core": "^0.
|
|
131
|
+
"@stll/docx-core": "^0.26.0",
|
|
132
132
|
"@stll/docx-utils": "^0.1.0",
|
|
133
133
|
"@stll/template-conditions": ">=0.4.0 <1.0.0",
|
|
134
134
|
"better-result": "3.0.1",
|