@stll/folio-core 0.3.1 → 0.5.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/ai-edits/apply.d.ts +3 -9
- package/dist/ai-edits/apply.js +94 -14
- package/dist/ai-edits/blockRange.d.ts +33 -0
- package/dist/ai-edits/blockRange.js +58 -0
- package/dist/ai-edits/headless.d.ts +35 -5
- package/dist/ai-edits/headless.js +92 -22
- package/dist/ai-edits/index.d.ts +5 -3
- package/dist/ai-edits/index.js +3 -2
- package/dist/ai-edits/snapshot.d.ts +14 -2
- package/dist/ai-edits/snapshot.js +12 -1
- package/dist/ai-edits/types.d.ts +42 -3
- package/dist/compat/eigenpal.d.ts +3 -2
- package/dist/compat/eigenpal.js +6 -5
- package/dist/controller/layoutPipeline.d.ts +1 -0
- package/dist/controller/layoutPipeline.js +35 -115
- package/dist/controller/layoutScheduler.d.ts +2 -1
- package/dist/controller/layoutScheduler.js +6 -0
- package/dist/document-operations.d.ts +122 -0
- package/dist/document-operations.js +575 -0
- package/dist/docx/blockContentParser.js +17 -7
- package/dist/docx/encryption/agileDecryption.d.ts +6 -0
- package/dist/docx/encryption/agileDecryption.js +209 -0
- package/dist/docx/encryption/compoundFile.d.ts +20 -0
- package/dist/docx/encryption/compoundFile.js +251 -0
- package/dist/docx/encryption/containerFormat.d.ts +15 -0
- package/dist/docx/encryption/containerFormat.js +40 -0
- package/dist/docx/encryption/cryptoBytes.d.ts +11 -0
- package/dist/docx/encryption/cryptoBytes.js +55 -0
- package/dist/docx/encryption/encryptionInfo.d.ts +32 -0
- package/dist/docx/encryption/encryptionInfo.js +128 -0
- package/dist/docx/encryption/errors.d.ts +18 -0
- package/dist/docx/encryption/errors.js +13 -0
- package/dist/docx/encryption/index.d.ts +4 -0
- package/dist/docx/encryption/index.js +4 -0
- package/dist/docx/encryption/openEncryptedDocx.d.ts +28 -0
- package/dist/docx/encryption/openEncryptedDocx.js +65 -0
- package/dist/docx/footnoteParser.d.ts +1 -17
- package/dist/docx/footnoteParser.js +1 -27
- package/dist/docx/groupDrawingParser.d.ts +8 -0
- package/dist/docx/groupDrawingParser.js +131 -0
- package/dist/docx/index.d.ts +3 -1
- package/dist/docx/index.js +3 -1
- package/dist/docx/numberingParser.d.ts +3 -1
- package/dist/docx/numberingParser.js +8 -2
- package/dist/docx/paragraphParser.js +9 -3
- package/dist/docx/parser.d.ts +4 -5
- package/dist/docx/parser.js +8 -2
- package/dist/docx/runParser.js +8 -1
- package/dist/docx/selectiveXmlPatch.js +4 -10
- package/dist/docx/serializer/numberingSerializer.js +3 -1
- package/dist/docx/settingsParser.d.ts +6 -3
- package/dist/docx/settingsParser.js +2 -0
- package/dist/docx/unzip.d.ts +7 -5
- package/dist/docx/unzip.js +8 -2
- package/dist/docx/xmlParser.js +11 -4
- package/dist/index.d.ts +3 -2
- package/dist/index.js +6 -5
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +37 -1
- package/dist/layout-bridge/convert/footnoteLayout.js +138 -14
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +6 -8
- package/dist/layout-bridge/convert/headerFooterLayout.js +21 -13
- package/dist/layout-bridge/convert/toFlowBlocks.js +58 -19
- package/dist/layout-engine/index.d.ts +6 -5
- package/dist/layout-engine/index.js +116 -27
- package/dist/layout-engine/keep-together.d.ts +13 -8
- package/dist/layout-engine/keep-together.js +40 -25
- package/dist/layout-engine/layoutInstrumentation.d.ts +11 -1
- package/dist/layout-engine/layoutInstrumentation.js +10 -1
- package/dist/layout-engine/measure/measureBlocks.js +43 -19
- package/dist/layout-engine/measure/measureParagraph.js +91 -14
- package/dist/layout-engine/paginator.d.ts +2 -1
- package/dist/layout-engine/paginator.js +9 -3
- package/dist/layout-engine/textBoxGroup.d.ts +7 -0
- package/dist/layout-engine/textBoxGroup.js +8 -0
- package/dist/layout-engine/types.d.ts +33 -9
- package/dist/layout-engine/types.js +20 -2
- package/dist/layout-painter/renderPage.d.ts +15 -1
- package/dist/layout-painter/renderPage.js +29 -12
- package/dist/layout-painter/renderParagraph.js +44 -9
- package/dist/layout-painter/renderTable.js +27 -7
- package/dist/managers/DocumentLoaderManager.d.ts +3 -1
- package/dist/managers/DocumentLoaderManager.js +13 -5
- package/dist/managers/TableSelectionManager.js +1 -1
- package/dist/model.js +1 -1
- package/dist/paged-layout/pageText.d.ts +14 -0
- package/dist/paged-layout/pageText.js +21 -0
- package/dist/prosemirror/attrs/index.js +3 -0
- package/dist/prosemirror/commands/comments.js +75 -5
- package/dist/prosemirror/commands/hyperlink.js +4 -2
- package/dist/prosemirror/commands/image.js +2 -1
- package/dist/prosemirror/commands/index.js +1 -1
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +68 -0
- package/dist/prosemirror/commands/propertyChangeScope.js +242 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +21 -5
- package/dist/prosemirror/conversion/toProseDoc.js +43 -15
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +3 -0
- package/dist/prosemirror/extensions/features/ListExtension.js +6 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +12 -11
- package/dist/prosemirror/findReplaceSelection.js +2 -1
- package/dist/prosemirror/index.js +1 -1
- package/dist/prosemirror/insertOperations.js +1 -1
- package/dist/prosemirror/schema/nodes.d.ts +14 -7
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +1 -0
- package/dist/prosemirror/utils/tabCalculator.js +4 -2
- package/dist/redline.d.ts +20 -0
- package/dist/redline.js +127 -0
- package/dist/server.d.ts +7 -3
- package/dist/server.js +6 -2
- package/dist/symbols.d.ts +35 -0
- package/dist/symbols.js +512 -0
- package/dist/utils/clipboard.js +3 -3
- package/dist/utils/fontLoader.js +3 -0
- package/dist/utils/fontResolver.js +65 -1
- package/dist/utils/zoom.d.ts +21 -0
- package/dist/utils/zoom.js +21 -0
- package/dist/version-comparison.d.ts +92 -0
- package/dist/version-comparison.js +436 -0
- package/package.json +7 -3
- package/dist/paged-layout/headerFooterMargins.d.ts +0 -73
- package/dist/paged-layout/headerFooterMargins.js +0 -120
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
//#region src/paged-layout/headerFooterMargins.ts
|
|
2
|
-
/**
|
|
3
|
-
* Floor on the body content area, in pixels. Header/footer overflow can
|
|
4
|
-
* never shrink the content band below this, so a degenerate document
|
|
5
|
-
* (a header taller than the page) still renders some body text.
|
|
6
|
-
*/
|
|
7
|
-
const MIN_CONTENT_HEIGHT_PX = 24;
|
|
8
|
-
function headerHeight(content) {
|
|
9
|
-
if (!content) return 0;
|
|
10
|
-
return content.marginPushBottom ?? content.visualBottom ?? content.height;
|
|
11
|
-
}
|
|
12
|
-
function footerHeight(content) {
|
|
13
|
-
if (!content) return 0;
|
|
14
|
-
const bottom = content.marginPushBottom ?? content.visualBottom ?? content.height;
|
|
15
|
-
const top = content.marginPushTop ?? content.visualTop ?? 0;
|
|
16
|
-
return Math.max(bottom - top, content.height);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Build a function that, applied to any `PageMargins`, extends `top`/`bottom`
|
|
20
|
-
* to clear the same header/footer content the body's effective margins do.
|
|
21
|
-
* Returns the identity function when no extension is needed.
|
|
22
|
-
*
|
|
23
|
-
* Header/footer distances are taken from the *given* margins (the source
|
|
24
|
-
* paragraph's section margins), not the body's, so each section's authored
|
|
25
|
-
* `w:header`/`w:footer` distances are honored.
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* Build an extender that pushes body margins clear of HF content.
|
|
29
|
-
*
|
|
30
|
-
* `mode === "default"` ignores `firstPageHeaderContent` /
|
|
31
|
-
* `firstPageFooterContent`. The first-page H/F only renders on page 1 of
|
|
32
|
-
* a `<w:titlePg/>`-enabled section, so margins for pages 2+ within the
|
|
33
|
-
* same section must NOT be extended for first-page overflow — extending
|
|
34
|
-
* them would push body content down on every page even though only page
|
|
35
|
-
* 1 actually carries the overflowing header. This produced visible
|
|
36
|
-
* regressions on NVCA-style first-page-header docs, where pages 2+
|
|
37
|
-
* inherited page 1's title-page header reservation.
|
|
38
|
-
*
|
|
39
|
-
* `mode === "firstPage"` uses the larger of the default and first-page
|
|
40
|
-
* H/F heights — applied only to the first-page margins of a titlePg
|
|
41
|
-
* section.
|
|
42
|
-
*/
|
|
43
|
-
function buildExtender({ headerContent, footerContent, firstPageHeaderContent, firstPageFooterContent, pageSize, warn, mode }) {
|
|
44
|
-
const headerContentHeight = mode === "firstPage" ? Math.max(headerHeight(headerContent), headerHeight(firstPageHeaderContent)) : headerHeight(headerContent);
|
|
45
|
-
const footerContentHeight = mode === "firstPage" ? Math.max(footerHeight(footerContent), footerHeight(firstPageFooterContent)) : footerHeight(footerContent);
|
|
46
|
-
return (margins) => {
|
|
47
|
-
const headerDistance = margins.header ?? 48;
|
|
48
|
-
const footerDistance = margins.footer ?? 48;
|
|
49
|
-
const availableHeaderSpace = margins.top - headerDistance;
|
|
50
|
-
const availableFooterSpace = margins.bottom - footerDistance;
|
|
51
|
-
const maxMargins = pageSize ? Math.max(0, pageSize.h - MIN_CONTENT_HEIGHT_PX) : void 0;
|
|
52
|
-
const fitsContent = headerContentHeight <= availableHeaderSpace && footerContentHeight <= availableFooterSpace;
|
|
53
|
-
const fitsPage = maxMargins === void 0 || margins.top + margins.bottom <= maxMargins;
|
|
54
|
-
if (fitsContent && fitsPage) return margins;
|
|
55
|
-
const out = { ...margins };
|
|
56
|
-
if (headerContentHeight > availableHeaderSpace) out.top = Math.max(margins.top, headerDistance + headerContentHeight);
|
|
57
|
-
if (footerContentHeight > availableFooterSpace) out.bottom = Math.max(margins.bottom, footerDistance + footerContentHeight);
|
|
58
|
-
if (pageSize && maxMargins !== void 0 && out.top + out.bottom > maxMargins) {
|
|
59
|
-
if (warn) warn(`header/footer content exceeds page height; clamping margins to preserve a content area. pageHeight=${Math.round(pageSize.h)} top=${Math.round(out.top)} bottom=${Math.round(out.bottom)}`);
|
|
60
|
-
out.bottom = Math.max(0, Math.min(out.bottom, maxMargins - out.top));
|
|
61
|
-
if (out.top + out.bottom > maxMargins) out.top = Math.max(0, maxMargins - out.bottom);
|
|
62
|
-
}
|
|
63
|
-
return out;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function computeHeaderFooterMarginExtender(input) {
|
|
67
|
-
return buildExtender({
|
|
68
|
-
...input,
|
|
69
|
-
mode: "default"
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Like `computeHeaderFooterMarginExtender` but also accounts for the
|
|
74
|
-
* first-page header/footer content. Apply this only to the margins used
|
|
75
|
-
* for page 1 of a `<w:titlePg/>`-enabled section.
|
|
76
|
-
*/
|
|
77
|
-
function computeFirstPageHeaderFooterMarginExtender(input) {
|
|
78
|
-
return buildExtender({
|
|
79
|
-
...input,
|
|
80
|
-
mode: "firstPage"
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
function computeEffectiveHeaderFooterMargins({ margins, headerContent, footerContent, firstPageHeaderContent, firstPageFooterContent, pageSize, warn }) {
|
|
84
|
-
return computeHeaderFooterMarginExtender({
|
|
85
|
-
headerContent,
|
|
86
|
-
footerContent,
|
|
87
|
-
firstPageHeaderContent,
|
|
88
|
-
firstPageFooterContent,
|
|
89
|
-
pageSize,
|
|
90
|
-
warn
|
|
91
|
-
})(margins);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Extend every section break's margins to clear the same header/footer
|
|
95
|
-
* overflow the body margins do (eigenpal #400), so an overflowing footer
|
|
96
|
-
* never re-overlaps body text on a later section.
|
|
97
|
-
*
|
|
98
|
-
* The walk mirrors `collectSectionConfigs`: a break that omits its own
|
|
99
|
-
* `pageSize` or `margins` inherits the previous section's. Each break's
|
|
100
|
-
* authored-or-inherited margins are extended against the section's *own*
|
|
101
|
-
* resolved page height, so a taller page never keeps a smaller page's
|
|
102
|
-
* clamped reservation (and vice versa). Materializes `margins` on every
|
|
103
|
-
* non-inheriting break in place.
|
|
104
|
-
*/
|
|
105
|
-
function extendSectionBreakMargins(sectionBreaks, { content, bodyPageSize, bodyMargins, warn }) {
|
|
106
|
-
let pageSize = bodyPageSize;
|
|
107
|
-
let margins = bodyMargins;
|
|
108
|
-
for (const sb of sectionBreaks) {
|
|
109
|
-
if (!sb.pageSize && !sb.margins) continue;
|
|
110
|
-
pageSize = sb.pageSize ?? pageSize;
|
|
111
|
-
margins = computeHeaderFooterMarginExtender({
|
|
112
|
-
...content,
|
|
113
|
-
pageSize,
|
|
114
|
-
warn
|
|
115
|
-
})(sb.margins ?? margins);
|
|
116
|
-
sb.margins = margins;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
//#endregion
|
|
120
|
-
export { computeEffectiveHeaderFooterMargins, computeFirstPageHeaderFooterMarginExtender, computeHeaderFooterMarginExtender, extendSectionBreakMargins };
|