@stll/folio-core 0.66.0 → 0.66.2
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/ai-edits/apply.d.ts +13 -1
- package/dist/ai-edits/apply.js +533 -136
- package/dist/ai-edits/batch-claims.d.ts +26 -0
- package/dist/ai-edits/batch-claims.js +30 -5
- package/dist/ai-edits/headless.d.ts +6 -0
- package/dist/ai-edits/headless.js +25 -3
- package/dist/ai-edits/newListNumbering.d.ts +4 -1
- package/dist/ai-edits/newListNumbering.js +4 -2
- package/dist/ai-edits/types.d.ts +1 -1
- package/dist/document-operations.d.ts +13 -1
- package/dist/document-operations.js +11 -4
- package/dist/docx/listNumberingInstances.d.ts +6 -4
- package/dist/docx/listNumberingInstances.js +12 -11
- package/dist/docx/numberingIds.d.ts +10 -0
- package/dist/docx/numberingIds.js +5 -1
- package/dist/docx/paragraphParser.js +16 -3
- package/dist/docx/paragraphProperties.js +2 -1
- package/dist/docx/serializer/paragraphSerializer.js +86 -66
- package/dist/fonts/bundledFonts.d.ts +54 -0
- package/dist/fonts/bundledFonts.js +45 -0
- package/dist/fonts/fontsourceFaces.d.ts +9 -14
- package/dist/fonts/fontsourceFaces.js +10 -22
- package/dist/i18n/messages/ar.gen.js +1 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
- package/dist/i18n/messages/catalogs.gen.js +17 -0
- package/dist/i18n/messages/cs.gen.js +1 -0
- package/dist/i18n/messages/de.gen.js +1 -0
- package/dist/i18n/messages/en.gen.js +1 -0
- package/dist/i18n/messages/es.gen.js +1 -0
- package/dist/i18n/messages/et.gen.js +1 -0
- package/dist/i18n/messages/fr.gen.js +1 -0
- package/dist/i18n/messages/he.gen.js +1 -0
- package/dist/i18n/messages/hi.gen.js +1 -0
- package/dist/i18n/messages/hu.gen.js +1 -0
- package/dist/i18n/messages/lt.gen.js +1 -0
- package/dist/i18n/messages/lv.gen.js +1 -0
- package/dist/i18n/messages/messages.gen.d.ts +1 -0
- package/dist/i18n/messages/pl.gen.js +1 -0
- package/dist/i18n/messages/pt-BR.gen.js +1 -0
- package/dist/i18n/messages/sk.gen.js +1 -0
- package/dist/i18n/messages/tr.gen.js +1 -0
- package/dist/i18n/messages/zh-CN.gen.js +1 -0
- package/dist/internal/wholeStoryRevisionResolution.d.ts +1 -1
- package/dist/internal/wholeStoryRevisionResolution.js +24 -9
- package/dist/layout-bridge/convert/runMarkFormatting.js +1 -0
- package/dist/markdown/renderRuns.js +68 -12
- package/dist/prosemirror/commands/comments.js +2 -0
- package/dist/prosemirror/commands/resolveParagraphProperties.js +15 -2
- package/dist/prosemirror/conversion/fromProseDoc.js +55 -18
- package/dist/prosemirror/conversion/hyphenTextCarriers.d.ts +23 -1
- package/dist/prosemirror/conversion/hyphenTextCarriers.js +46 -1
- package/dist/prosemirror/conversion/toProseDoc.js +15 -9
- package/dist/prosemirror/extensions/StarterKit.js +1 -1
- package/dist/prosemirror/extensions/features/pasteCleanup.js +6 -0
- package/dist/prosemirror/extensions/features/pastedHtmlLists.js +2 -1
- package/dist/prosemirror/extensions/markRegistry.d.ts +3 -1
- package/dist/prosemirror/extensions/markRegistry.js +3 -0
- package/dist/prosemirror/extensions/marks/HyphenElementExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/marks/HyphenElementExtension.js +54 -0
- package/dist/prosemirror/fieldRepresentation.js +2 -1
- package/dist/prosemirror/hyphenElementAttrs.d.ts +10 -0
- package/dist/prosemirror/hyphenElementAttrs.js +32 -0
- package/dist/prosemirror/keptRangeBoundaries.d.ts +2 -0
- package/dist/prosemirror/keptRangeBoundaries.js +1 -1
- package/dist/prosemirror/listNumbering.js +3 -2
- package/dist/prosemirror/paragraphIndentation.js +2 -1
- package/dist/prosemirror/paragraphPropertyCarry.d.ts +1 -14
- package/dist/prosemirror/paragraphPropertyCarry.js +4 -28
- package/dist/prosemirror/plugins/suggestionMode.js +19 -6
- package/dist/prosemirror/replacedAnnotations.d.ts +1 -0
- package/dist/prosemirror/replacedAnnotations.js +1 -0
- package/dist/prosemirror/sectionCarrier.d.ts +8 -0
- package/dist/prosemirror/sectionCarrier.js +29 -1
- package/dist/prosemirror/styles/paragraphStyleCascade.d.ts +10 -0
- package/dist/prosemirror/styles/paragraphStyleCascade.js +12 -2
- package/dist/prosemirror/tableRunIn.d.ts +24 -9
- package/dist/prosemirror/tableRunIn.js +107 -21
- package/dist/prosemirror/textInput.js +3 -1
- package/dist/prosemirror/validation.js +6 -0
- package/dist/utils/createDocument.js +11 -8
- package/dist/utils/fontLoader.d.ts +1 -1
- package/dist/utils/fontLoader.js +3 -11
- package/dist/utils/formatToStyle.js +2 -2
- package/dist/utils/units.d.ts +5 -0
- package/dist/utils/units.js +6 -1
- package/package.json +6 -4
package/dist/utils/fontLoader.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { FONTSOURCE_PACKAGES } from "../fonts/bundledFonts.js";
|
|
1
2
|
// src/utils/fontLoader.ts
|
|
2
3
|
/**
|
|
3
4
|
* Font Loader
|
|
4
5
|
*
|
|
5
6
|
* Manages font availability for the DOCX editor. Fonts are bundled via
|
|
6
|
-
*
|
|
7
|
+
* `@stll/folio-fonts` (WOFF2, no external requests). This module
|
|
7
8
|
* tracks which fonts are loaded and provides callbacks for re-rendering
|
|
8
9
|
* when fonts become available.
|
|
9
10
|
*/
|
|
@@ -34,16 +35,7 @@ const FONT_MAPPING = {
|
|
|
34
35
|
"Lucida Console": "monospace"
|
|
35
36
|
};
|
|
36
37
|
/** Bundled font families (available without network requests). */
|
|
37
|
-
const BUNDLED_FONTS =
|
|
38
|
-
"Carlito",
|
|
39
|
-
"Caladea",
|
|
40
|
-
"Arimo",
|
|
41
|
-
"Tinos",
|
|
42
|
-
"Cousine",
|
|
43
|
-
"Lato",
|
|
44
|
-
"Source Sans 3",
|
|
45
|
-
"Noto Sans Arabic"
|
|
46
|
-
]);
|
|
38
|
+
const BUNDLED_FONTS = new Set(Object.keys(FONTSOURCE_PACKAGES));
|
|
47
39
|
/**
|
|
48
40
|
* Mark a font as loaded. For bundled fonts this is immediate;
|
|
49
41
|
* for others it checks CSS Font Loading API.
|
|
@@ -6,7 +6,7 @@ import { resolveColor, resolveHighlightToCss, resolveShadingColor } from "./colo
|
|
|
6
6
|
import { resolveFontFamily, resolveThemeFont } from "./fontResolver.js";
|
|
7
7
|
import { getHorizontalScaleFactor, normalizeHorizontalScalePercent } from "./horizontalScale.js";
|
|
8
8
|
import { textFlowCss } from "./textDirectionFlow.js";
|
|
9
|
-
import { AUTO_PARAGRAPH_SPACING_PX, eighthsToPixels, formatPx, halfPointsToPixels, halfPointsToPoints, twipsToPixels } from "./units.js";
|
|
9
|
+
import { AUTO_PARAGRAPH_SPACING_PX, eighthsToPixels, formatPx, halfPointsToPixels, halfPointsToPoints, hangingFirstLineIndent, twipsToPixels } from "./units.js";
|
|
10
10
|
import { statesNoBorder } from "@stll/docx-core/model";
|
|
11
11
|
// src/utils/formatToStyle.ts
|
|
12
12
|
/**
|
|
@@ -119,7 +119,7 @@ function paragraphToStyle(formatting, theme) {
|
|
|
119
119
|
if (formatting.indentLeft !== void 0) style.marginLeft = formatPx(twipsToPixels(formatting.indentLeft));
|
|
120
120
|
if (formatting.indentRight !== void 0) style.marginRight = formatPx(twipsToPixels(formatting.indentRight));
|
|
121
121
|
if (formatting.indentFirstLine !== void 0) {
|
|
122
|
-
const textIndent = formatting.hangingIndent ?
|
|
122
|
+
const textIndent = formatting.hangingIndent ? hangingFirstLineIndent(formatting.indentFirstLine) : formatting.indentFirstLine;
|
|
123
123
|
style.textIndent = formatPx(twipsToPixels(textIndent));
|
|
124
124
|
}
|
|
125
125
|
if (formatting.borders) {
|
package/dist/utils/units.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ export declare const PIXELS_PER_INCH: 96;
|
|
|
22
22
|
* twips conversion. See eigenpal/docx-editor#823.
|
|
23
23
|
*/
|
|
24
24
|
export declare const AUTO_PARAGRAPH_SPACING_PX: number;
|
|
25
|
+
/**
|
|
26
|
+
* The `indentFirstLine` a hanging indent of `magnitude` twips stores: negated,
|
|
27
|
+
* but never as `-0`, which compares unequal to the `0` a model holds elsewhere.
|
|
28
|
+
*/
|
|
29
|
+
export declare const hangingFirstLineIndent: (magnitude: number) => number;
|
|
25
30
|
/**
|
|
26
31
|
* Convert twips to pixels (at 96 DPI)
|
|
27
32
|
*
|
package/dist/utils/units.js
CHANGED
|
@@ -34,6 +34,11 @@ const PIXELS_PER_INCH = STANDARD_DPI;
|
|
|
34
34
|
*/
|
|
35
35
|
const AUTO_PARAGRAPH_SPACING_PX = pointsToPixels(14);
|
|
36
36
|
/**
|
|
37
|
+
* The `indentFirstLine` a hanging indent of `magnitude` twips stores: negated,
|
|
38
|
+
* but never as `-0`, which compares unequal to the `0` a model holds elsewhere.
|
|
39
|
+
*/
|
|
40
|
+
const hangingFirstLineIndent = (magnitude) => magnitude === 0 ? 0 : -Math.abs(magnitude);
|
|
41
|
+
/**
|
|
37
42
|
* Convert twips to pixels (at 96 DPI)
|
|
38
43
|
*
|
|
39
44
|
* 1 inch = 1440 twips = 96 pixels
|
|
@@ -146,4 +151,4 @@ function clamp(value, min, max) {
|
|
|
146
151
|
function formatPx(px) {
|
|
147
152
|
return `${roundPixels(px)}px`;
|
|
148
153
|
}
|
|
149
|
-
export { AUTO_PARAGRAPH_SPACING_PX, PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToStrokePixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels };
|
|
154
|
+
export { AUTO_PARAGRAPH_SPACING_PX, PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToStrokePixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, hangingFirstLineIndent, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-core",
|
|
3
|
-
"version": "0.66.
|
|
3
|
+
"version": "0.66.2",
|
|
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",
|
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
"skills",
|
|
30
30
|
"README.md",
|
|
31
31
|
"LICENSE",
|
|
32
|
-
"NOTICE.md"
|
|
32
|
+
"NOTICE.md",
|
|
33
|
+
"licenses",
|
|
34
|
+
"THIRD_PARTY_NOTICES.md"
|
|
33
35
|
],
|
|
34
36
|
"type": "module",
|
|
35
37
|
"sideEffects": false,
|
|
@@ -171,7 +173,7 @@
|
|
|
171
173
|
"perf": "bun scripts/profile-editor.ts"
|
|
172
174
|
},
|
|
173
175
|
"dependencies": {
|
|
174
|
-
"@stll/docx-core": "^0.
|
|
176
|
+
"@stll/docx-core": "^0.42.0",
|
|
175
177
|
"@stll/docx-utils": "^0.2.0",
|
|
176
178
|
"@stll/template-conditions": "^0.6.2",
|
|
177
179
|
"@stll/utf8-boundaries": "0.2.0",
|
|
@@ -196,7 +198,7 @@
|
|
|
196
198
|
"prosemirror-state": "^1.4.4",
|
|
197
199
|
"prosemirror-tables": "^1.8.5",
|
|
198
200
|
"prosemirror-transform": "^1.12.4",
|
|
199
|
-
"prosemirror-view": "^1.42.
|
|
201
|
+
"prosemirror-view": "^1.42.8",
|
|
200
202
|
"y-prosemirror": "^1.3.7",
|
|
201
203
|
"y-protocols": "^1.0.6",
|
|
202
204
|
"yjs": "^13.6.33"
|