@stll/folio-core 0.63.0 → 0.64.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/headless.d.ts +5 -4
- package/dist/ai-edits/headless.js +10 -67
- package/dist/compare/content.d.ts +7 -7
- package/dist/compare/content.js +6 -3
- package/dist/compare/types.d.ts +15 -14
- package/dist/compare/types.js +14 -7
- package/dist/content-controls/errors.d.ts +7 -6
- package/dist/content-controls/errors.js +6 -3
- package/dist/controller/canonicalComments.d.ts +4 -3
- package/dist/controller/canonicalComments.js +2 -1
- package/dist/controller/canonicalInlineProjection.d.ts +3 -3
- package/dist/controller/canonicalInlineProjection.js +2 -1
- package/dist/controller/canonicalListRendering.d.ts +5 -3
- package/dist/controller/canonicalPublicOperations.js +2 -1
- package/dist/controller/canonicalSession.d.ts +5 -5
- package/dist/controller/canonicalSession.js +2 -1
- package/dist/controller/hiddenEditorManager.d.ts +3 -2
- package/dist/controller/hiddenEditorManager.js +2 -1
- package/dist/document-operations.d.ts +5 -4
- package/dist/document-operations.js +4 -2
- package/dist/docx/appVersionNormalization.d.ts +3 -2
- package/dist/docx/appVersionNormalization.js +2 -1
- package/dist/docx/attributeRemainder.d.ts +3 -2
- package/dist/docx/attributeRemainder.js +2 -1
- package/dist/docx/canonicalResourceSave.d.ts +3 -2
- package/dist/docx/canonicalResourceSave.js +2 -1
- package/dist/docx/canonicalSave.d.ts +6 -4
- package/dist/docx/canonicalSave.js +2 -1
- package/dist/docx/canonicalSessionInput.d.ts +4 -3
- package/dist/docx/canonicalSessionInput.js +2 -1
- package/dist/docx/encryption/errors.d.ts +3 -2
- package/dist/docx/encryption/errors.js +2 -1
- package/dist/docx/ensureParaIds.d.ts +3 -2
- package/dist/docx/ensureParaIds.js +2 -1
- package/dist/docx/headerFooterVerbatim.d.ts +2 -2
- package/dist/docx/imageParser.d.ts +1 -1
- package/dist/docx/index.d.ts +1 -0
- package/dist/docx/linkedSdtPreservation.d.ts +5 -3
- package/dist/docx/linkedSdtPreservation.js +2 -1
- package/dist/docx/metadataPrivacy.d.ts +5 -4
- package/dist/docx/metadataPrivacy.js +4 -2
- package/dist/docx/numericIdAllocator.js +2 -1
- package/dist/docx/paragraphPropertySource.d.ts +3 -2
- package/dist/docx/paragraphPropertySource.js +2 -1
- package/dist/docx/parser.d.ts +3 -2
- package/dist/docx/parser.js +2 -1
- package/dist/docx/reviewResolutionProvenance.d.ts +3 -2
- package/dist/docx/reviewResolutionProvenance.js +2 -1
- package/dist/docx/revisionIdNormalization.d.ts +3 -2
- package/dist/docx/revisionIdNormalization.js +2 -1
- package/dist/docx/rezip.d.ts +5 -4
- package/dist/docx/rezip.js +4 -2
- package/dist/docx/sectionReferenceHistory.d.ts +3 -2
- package/dist/docx/sectionReferenceHistory.js +2 -1
- package/dist/docx/serializer/paragraphSerializer.js +6 -3
- package/dist/docx/serializer/partNamespaces.d.ts +3 -2
- package/dist/docx/serializer/partNamespaces.js +2 -1
- package/dist/docx/server/applyDocxXmlPatchProposal.d.ts +5 -4
- package/dist/docx/server/applyDocxXmlPatchProposal.js +4 -2
- package/dist/docx/server/boundedArchive.d.ts +3 -2
- package/dist/docx/server/boundedArchive.js +2 -1
- package/dist/docx/server/build.d.ts +3 -2
- package/dist/docx/server/build.js +2 -1
- package/dist/docx/server/createBilingualDocument.d.ts +3 -2
- package/dist/docx/server/createBilingualDocument.js +4 -2
- package/dist/docx/server/evaluateDocxXmlPatchProposal.d.ts +5 -4
- package/dist/docx/server/evaluateDocxXmlPatchProposal.js +4 -2
- package/dist/docx/server/inspectDocxPackage.d.ts +3 -2
- package/dist/docx/server/inspectDocxPackage.js +2 -1
- package/dist/docx/server/materializeYjsDocx.d.ts +3 -2
- package/dist/docx/server/materializeYjsDocx.js +2 -1
- package/dist/docx/server/migrateYjsAttrSchema.d.ts +3 -3
- package/dist/docx/server/migrateYjsAttrSchema.js +2 -1
- package/dist/docx/tableParser.d.ts +4 -4
- package/dist/docx/verbatimCapture.d.ts +3 -2
- package/dist/docx/verbatimCapture.js +2 -1
- package/dist/docx/xmlResourceLimits.d.ts +3 -2
- package/dist/docx/xmlResourceLimits.js +5 -2
- package/dist/export-pdf.d.ts +3 -3
- package/dist/export-pdf.js +2 -1
- package/dist/fonts/headlessMeasure.d.ts +3 -3
- package/dist/fonts/headlessMeasure.js +2 -1
- package/dist/fonts/sfnt/parse.d.ts +3 -3
- package/dist/fonts/sfnt/parse.js +2 -1
- package/dist/fonts/sfnt/subset.d.ts +3 -3
- package/dist/fonts/sfnt/subset.js +2 -1
- package/dist/fonts/sfnt/tables.d.ts +3 -3
- package/dist/fonts/sfnt/tables.js +2 -1
- package/dist/fonts/sfnt/woff.d.ts +3 -3
- package/dist/fonts/sfnt/woff.js +2 -1
- package/dist/headless-layout.d.ts +3 -3
- package/dist/headless-layout.js +2 -1
- package/dist/layout-engine/measure/font-metrics.worker.js +2 -1
- package/dist/layout-engine/measure/hyphenationDictionaries.d.ts +3 -20
- package/dist/layout-engine/measure/hyphenationDictionaries.js +2 -1
- package/dist/layout-engine/section-breaks.d.ts +1 -1
- package/dist/layout-painter/renderPage.d.ts +6 -0
- package/dist/layout-painter/renderPage.js +83 -47
- package/dist/paged-layout/editorScrollRoot.d.ts +4 -0
- package/dist/paged-layout/editorScrollRoot.js +11 -3
- package/dist/paged-layout/scrollToPmPosition.js +41 -51
- package/dist/pdf/fonts.js +2 -1
- package/dist/pdf/images.d.ts +3 -3
- package/dist/pdf/images.js +2 -1
- package/dist/pdf/paint.d.ts +3 -3
- package/dist/pdf/paint.js +2 -1
- package/dist/pdf/writePdf.d.ts +3 -3
- package/dist/pdf/writePdf.js +2 -1
- package/dist/prosemirror/canonicalCommands.d.ts +9 -9
- package/dist/prosemirror/commands/tableMergeFoldDecisions.d.ts +15 -14
- package/dist/prosemirror/commentIdAllocator.d.ts +3 -2
- package/dist/prosemirror/commentIdAllocator.js +2 -1
- package/dist/prosemirror/conversion/fromProseDoc.js +4 -2
- package/dist/prosemirror/extensions/core/DocExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/core/TextExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +2 -2
- package/dist/prosemirror/extensions/features/BidiShortcutExtension.d.ts +0 -10
- package/dist/prosemirror/extensions/features/ContentControlWidgetsExtension.d.ts +0 -10
- package/dist/prosemirror/extensions/features/DropCursorExtension.d.ts +0 -6
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.d.ts +4 -4
- package/dist/prosemirror/extensions/features/GapCursorExtension.d.ts +0 -13
- package/dist/prosemirror/extensions/features/ImageDragExtension.d.ts +0 -9
- package/dist/prosemirror/extensions/features/ImagePasteExtension.d.ts +0 -6
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +0 -14
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +3 -2
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +77 -46
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +2 -2
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +0 -17
- package/dist/prosemirror/extensions/features/PasteStyleInlinerExtension.d.ts +0 -14
- package/dist/prosemirror/extensions/marks/AllCapsExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/BoldExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.d.ts +0 -8
- package/dist/prosemirror/extensions/marks/CharacterStyleExtension.d.ts +0 -14
- package/dist/prosemirror/extensions/marks/CommentExtension.d.ts +0 -6
- package/dist/prosemirror/extensions/marks/FontFamilyExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/FontSizeExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.d.ts +0 -5
- package/dist/prosemirror/extensions/marks/HiddenTextExtension.d.ts +0 -17
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.d.ts +0 -12
- package/dist/prosemirror/extensions/marks/ItalicExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/SmallCapsExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/StrikeExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/SubscriptExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/SuperscriptExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/TextColorExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/TextEffectsExtensions.d.ts +0 -6
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.d.ts +0 -7
- package/dist/prosemirror/extensions/marks/UnderlineExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +8 -7
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +0 -22
- package/dist/prosemirror/extensions/nodes/BlockMoveRangeBoundaryExtension.d.ts +0 -14
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +0 -17
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/FieldExtension.d.ts +0 -8
- package/dist/prosemirror/extensions/nodes/HardBreakExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/nodes/HorizontalRuleExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/nodes/ImageExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/nodes/MathExtension.d.ts +0 -7
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/PageBreakExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/nodes/PageBreakRunExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.d.ts +0 -25
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.d.ts +0 -9
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +0 -6
- package/dist/prosemirror/extensions/nodes/TabExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.d.ts +0 -7
- package/dist/prosemirror/hyperlinkRemoval.d.ts +3 -2
- package/dist/prosemirror/hyperlinkRemoval.js +2 -1
- package/dist/prosemirror/markupViewProjection.d.ts +3 -3
- package/dist/prosemirror/noteReferenceOccurrences.d.ts +6 -5
- package/dist/prosemirror/noteReferenceOccurrences.js +4 -2
- package/dist/prosemirror/numberingAttr.d.ts +5 -5
- package/dist/prosemirror/plugins/aiCitationDecorations.d.ts +4 -4
- package/dist/prosemirror/plugins/aiSuggestionDecorations.d.ts +4 -4
- package/dist/prosemirror/plugins/anonymizationDecorations.d.ts +2 -2
- package/dist/prosemirror/plugins/autocompleteSuggestion.d.ts +2 -2
- package/dist/prosemirror/plugins/contentControlWidgets.d.ts +4 -4
- package/dist/prosemirror/plugins/documentStyleState.d.ts +4 -4
- package/dist/prosemirror/plugins/revisionIds.d.ts +3 -2
- package/dist/prosemirror/plugins/revisionIds.js +2 -1
- package/dist/prosemirror/plugins/selectionTracker.d.ts +2 -2
- package/dist/prosemirror/plugins/suggestionMode.d.ts +2 -2
- package/dist/prosemirror/plugins/templateDirectives.d.ts +5 -5
- package/dist/prosemirror/plugins/templatePreviewValues.d.ts +4 -4
- package/dist/prosemirror/plugins/templateSlashMenu.d.ts +2 -2
- package/dist/prosemirror/preservedXmlReview.d.ts +2 -2
- package/dist/prosemirror/runStyleFormatting.d.ts +7 -7
- package/dist/prosemirror/schema/index.d.ts +2 -1
- package/dist/prosemirror/schema/index.js +0 -7
- package/dist/prosemirror/styles/styleResolver.d.ts +1 -1
- package/dist/prosemirror/textInput.d.ts +3 -2
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +8 -8
- package/dist/prosemirror/yjsDocumentMetadata.js +6 -3
- package/dist/redline.d.ts +5 -4
- package/dist/redline.js +4 -2
- package/dist/redlineOperationLimit.d.ts +3 -2
- package/dist/redlineOperationLimit.js +2 -1
- package/dist/render-dom/commentAnchorAttributes.d.ts +1 -1
- package/dist/shaping/shaper.d.ts +3 -21
- package/dist/shaping/shaper.js +2 -1
- package/dist/utils/clipboard.d.ts +2 -2
- package/dist/utils/clipboard.js +2 -2
- package/dist/utils/formatToStyle.d.ts +1 -1
- package/dist/utils/headingCollector.d.ts +7 -0
- package/dist/utils/headingCollector.js +9 -1
- package/dist/utils/outlineHeadings.d.ts +20 -0
- package/dist/utils/outlineHeadings.js +43 -0
- package/dist/utils/units.d.ts +1 -1
- package/dist/version-comparison.d.ts +3 -2
- package/dist/version-comparison.js +2 -1
- package/package.json +3 -3
package/dist/fonts/sfnt/woff.js
CHANGED
|
@@ -12,7 +12,8 @@ import { inflateSync } from "node:zlib";
|
|
|
12
12
|
* `glyf`/`loca` transform has to be reversed and Brotli decoded), so it is
|
|
13
13
|
* rejected here rather than half-supported.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
const WoffDecodeErrorBase = TaggedError("WoffDecodeError");
|
|
16
|
+
var WoffDecodeError = class extends WoffDecodeErrorBase {};
|
|
16
17
|
const fail = (message) => Result.err(new WoffDecodeError({ message }));
|
|
17
18
|
/** Byte offsets inside the WOFF header. */
|
|
18
19
|
const WOFF_HEADER = {
|
|
@@ -6,7 +6,7 @@ import { BlockLookup } from "./layout-painter/index.js";
|
|
|
6
6
|
import { PageFurnitureInputs } from "./display-list/build/furniture.js";
|
|
7
7
|
import { DocumentFeatures } from "./display-list/build/buildDisplayList.js";
|
|
8
8
|
import { Node } from "prosemirror-model";
|
|
9
|
-
import { Result } from "better-result";
|
|
9
|
+
import { Result, TaggedErrorClass } from "better-result";
|
|
10
10
|
//#region src/headless-layout.d.ts
|
|
11
11
|
/**
|
|
12
12
|
* Constructs the painter takes from render options rather than from `Layout`.
|
|
@@ -26,8 +26,8 @@ export type HeadlessLayoutGap = {
|
|
|
26
26
|
readonly story: never;
|
|
27
27
|
readonly detail: string;
|
|
28
28
|
};
|
|
29
|
-
declare const
|
|
30
|
-
export declare class HeadlessLayoutError extends
|
|
29
|
+
declare const HeadlessLayoutErrorBase: TaggedErrorClass<"HeadlessLayoutError">;
|
|
30
|
+
export declare class HeadlessLayoutError extends HeadlessLayoutErrorBase<{
|
|
31
31
|
message: string;
|
|
32
32
|
cause?: unknown;
|
|
33
33
|
}> {}
|
package/dist/headless-layout.js
CHANGED
|
@@ -64,7 +64,8 @@ const formatEndnoteTexts = (numbers, formatNumber) => {
|
|
|
64
64
|
for (const [id, displayNumber] of numbers) texts.set(id, formatNumber(displayNumber));
|
|
65
65
|
return texts;
|
|
66
66
|
};
|
|
67
|
-
|
|
67
|
+
const HeadlessLayoutErrorBase = TaggedError("HeadlessLayoutError");
|
|
68
|
+
var HeadlessLayoutError = class extends HeadlessLayoutErrorBase {};
|
|
68
69
|
/**
|
|
69
70
|
* Stories this entry still does not lay out, keyed by story so the map is total
|
|
70
71
|
* over the union. `satisfies Record<…>` is what makes it total in both
|
|
@@ -17,7 +17,8 @@ import { TaggedError } from "better-result";
|
|
|
17
17
|
* that touches `document`, `window`, or React. The protocol module is
|
|
18
18
|
* deliberately dependency-free.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
const WorkerInitErrorBase = TaggedError("WorkerInitError");
|
|
21
|
+
var WorkerInitError = class extends WorkerInitErrorBase {};
|
|
21
22
|
let ctx = null;
|
|
22
23
|
let initError = null;
|
|
23
24
|
const FONT_FINGERPRINT_EPSILON = .01;
|
|
@@ -1,28 +1,11 @@
|
|
|
1
|
+
import { TaggedErrorClass } from "better-result";
|
|
1
2
|
//#region src/layout-engine/measure/hyphenationDictionaries.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* On-demand hyphenation dictionaries for automatic hyphenation.
|
|
4
|
-
*
|
|
5
|
-
* Each `hyphen` pattern set is tens to hundreds of kilobytes of source whose
|
|
6
|
-
* evaluation builds a pattern trie, and most documents never enable
|
|
7
|
-
* `w:autoHyphenation`. A dictionary is therefore imported only once measurement
|
|
8
|
-
* asks to hyphenate a word in its language. Measurement is synchronous, so the
|
|
9
|
-
* first request starts the import and hyphenates nothing. A layout run wrapped
|
|
10
|
-
* in {@link collectRequestedHyphenationDictionaries} learns which dictionaries
|
|
11
|
-
* it lacked, so its own editor can re-run layout on load or report the failure
|
|
12
|
-
* (`controller/hyphenationReadiness`). Hosts that must lay out correctly on the
|
|
13
|
-
* first pass (headless layout, tests) await `preloadHyphenationDictionaries`
|
|
14
|
-
* (`./hyphenationPreload`) before measuring.
|
|
15
|
-
*
|
|
16
|
-
* This module sits on every editor's import graph, so it speaks in its own
|
|
17
|
-
* settled-state union rather than `Result`, keeping the `Result` API out of
|
|
18
|
-
* adapters' type checks; the preload boundary converts.
|
|
19
|
-
*/
|
|
20
3
|
export type HyphenateWord = (text: string) => string;
|
|
21
4
|
declare const HYPHENATION_DICTIONARY_IDS: readonly ["cs", "en-gb", "en-us", "sk"];
|
|
22
5
|
export type HyphenationDictionaryId = (typeof HYPHENATION_DICTIONARY_IDS)[number];
|
|
23
6
|
export type HyphenationDictionaryLoaders = Readonly<Record<HyphenationDictionaryId, () => Promise<HyphenateWord>>>;
|
|
24
|
-
declare const
|
|
25
|
-
export declare class HyphenationDictionaryError extends
|
|
7
|
+
declare const HyphenationDictionaryErrorBase: TaggedErrorClass<"HyphenationDictionaryError">;
|
|
8
|
+
export declare class HyphenationDictionaryError extends HyphenationDictionaryErrorBase<{
|
|
26
9
|
message: string;
|
|
27
10
|
dictionary: HyphenationDictionaryId;
|
|
28
11
|
cause: unknown;
|
|
@@ -32,7 +32,8 @@ const HYPHENATION_DICTIONARY_LOADERS = {
|
|
|
32
32
|
sk: async () => (await import("hyphen/sk")).default.hyphenateSync
|
|
33
33
|
};
|
|
34
34
|
let dictionaryLoaders = HYPHENATION_DICTIONARY_LOADERS;
|
|
35
|
-
|
|
35
|
+
const HyphenationDictionaryErrorBase = TaggedError("HyphenationDictionaryError");
|
|
36
|
+
var HyphenationDictionaryError = class extends HyphenationDictionaryErrorBase {};
|
|
36
37
|
const createInitialStates = () => ({
|
|
37
38
|
cs: { status: "unloaded" },
|
|
38
39
|
"en-gb": { status: "unloaded" },
|
|
@@ -55,7 +55,7 @@ export type BreakDecision = {
|
|
|
55
55
|
requiredParity?: "even" | "odd";
|
|
56
56
|
};
|
|
57
57
|
/** `w:sectPr` may omit `w:type`; §17.6.22's omitted value is `nextPage`. */
|
|
58
|
-
export declare const DEFAULT_SECTION_BREAK_TYPE
|
|
58
|
+
export declare const DEFAULT_SECTION_BREAK_TYPE: "nextPage";
|
|
59
59
|
/**
|
|
60
60
|
* The section start a boundary states, with the omitted value resolved.
|
|
61
61
|
*
|
|
@@ -301,6 +301,12 @@ export type PainterPaintedDetail = {
|
|
|
301
301
|
container: HTMLElement;
|
|
302
302
|
pageCount: number;
|
|
303
303
|
};
|
|
304
|
+
/**
|
|
305
|
+
* Paint `shell` and its buffer neighbours now, ahead of the observer, so a
|
|
306
|
+
* navigation can scroll straight onto painted content instead of passing blank
|
|
307
|
+
* shells. No-op for containers `renderPages` did not virtualize.
|
|
308
|
+
*/
|
|
309
|
+
export declare function renderPagesAround(container: HTMLElement, shell: HTMLElement): void;
|
|
304
310
|
/**
|
|
305
311
|
* Force every virtualized page shell in `container` to be fully rendered.
|
|
306
312
|
*
|
|
@@ -8,6 +8,7 @@ import { DEFAULT_FONT_FAMILY } from "../layout-engine/measure/measureHelpers.js"
|
|
|
8
8
|
import { measureParagraph } from "../layout-engine/measure/measureParagraph.js";
|
|
9
9
|
import { resolveTableInlineOffset } from "../layout-engine/measure/tableInlinePlacement.js";
|
|
10
10
|
import { NOTE_SEPARATOR_RULE_THICKNESS, NOTE_SEPARATOR_WIDTH_FRACTION, floatingTextBoxReservesBand, floatingTextBoxWrapsText, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, stripFlowBlockPmAnchors } from "../layout-engine/types.js";
|
|
11
|
+
import { getEditorScrollRoot } from "../paged-layout/editorScrollRoot.js";
|
|
11
12
|
import { cssBorderStyle } from "../utils/borderCss.js";
|
|
12
13
|
import { resolveFontFamily } from "../utils/fontResolver.js";
|
|
13
14
|
import { borderToStyle } from "../utils/formatToStyle.js";
|
|
@@ -1527,6 +1528,8 @@ function applyContainerStyles(container, pageGap) {
|
|
|
1527
1528
|
*/
|
|
1528
1529
|
const VIRTUALIZATION_BUFFER = 1;
|
|
1529
1530
|
const VIRTUALIZATION_ROOT_MARGIN_PX = 1e3;
|
|
1531
|
+
/** Painted pages stay painted within three viewport heights of the viewport. */
|
|
1532
|
+
const VIRTUALIZATION_RETAIN_MARGIN_PERCENT = 300;
|
|
1530
1533
|
const INITIAL_EAGER_RENDER_PAGES = 3;
|
|
1531
1534
|
/**
|
|
1532
1535
|
* Minimum page count before virtualization kicks in.
|
|
@@ -1555,7 +1558,7 @@ function renderPages(pages, container, options = {}) {
|
|
|
1555
1558
|
if (prevState && prevState.optionsHash === currentOptionsHash && useVirtualization) {
|
|
1556
1559
|
const prevShells = prevState.pageStates;
|
|
1557
1560
|
const prevDataMap = prevState.pageDataMap;
|
|
1558
|
-
const
|
|
1561
|
+
const observers = pc.__pageObservers;
|
|
1559
1562
|
const totalPagesChanged = prevState.totalPages !== totalPages;
|
|
1560
1563
|
const fieldContextChanged = prevState.fieldContextHash !== currentFieldContextHash;
|
|
1561
1564
|
const commonCount = Math.min(prevShells.length, pages.length);
|
|
@@ -1619,13 +1622,16 @@ function renderPages(pages, container, options = {}) {
|
|
|
1619
1622
|
index: i,
|
|
1620
1623
|
rendered: false
|
|
1621
1624
|
});
|
|
1622
|
-
|
|
1625
|
+
observers?.populate.observe(pageEl);
|
|
1626
|
+
observers?.retain.observe(pageEl);
|
|
1623
1627
|
}
|
|
1624
1628
|
}
|
|
1625
1629
|
if (pages.length < prevShells.length) {
|
|
1626
1630
|
for (let i = prevShells.length - 1; i >= pages.length; i--) {
|
|
1627
1631
|
const shell = prevShells[i].element;
|
|
1628
|
-
|
|
1632
|
+
observers?.populate.unobserve(shell);
|
|
1633
|
+
observers?.retain.unobserve(shell);
|
|
1634
|
+
prevState.retainedShells.delete(shell);
|
|
1629
1635
|
prevDataMap.delete(shell);
|
|
1630
1636
|
removeRenderedPage(shell);
|
|
1631
1637
|
}
|
|
@@ -1641,10 +1647,11 @@ function renderPages(pages, container, options = {}) {
|
|
|
1641
1647
|
emitPainterPainted(container);
|
|
1642
1648
|
return;
|
|
1643
1649
|
}
|
|
1644
|
-
const
|
|
1645
|
-
if (
|
|
1646
|
-
|
|
1647
|
-
|
|
1650
|
+
const prevObservers = pc.__pageObservers;
|
|
1651
|
+
if (prevObservers) {
|
|
1652
|
+
prevObservers.populate.disconnect();
|
|
1653
|
+
prevObservers.retain.disconnect();
|
|
1654
|
+
delete pc.__pageObservers;
|
|
1648
1655
|
}
|
|
1649
1656
|
const pageShellClass = options.pageClassName ?? PAGE_CLASS_NAMES.page;
|
|
1650
1657
|
const isPageShell = (el) => el.className.split(/\s+/u).includes(pageShellClass);
|
|
@@ -1683,52 +1690,42 @@ function renderPages(pages, container, options = {}) {
|
|
|
1683
1690
|
index: i,
|
|
1684
1691
|
rendered: false
|
|
1685
1692
|
});
|
|
1686
|
-
const
|
|
1693
|
+
const observerRoot = getEditorScrollRoot(container);
|
|
1694
|
+
const populate = new IntersectionObserver((entries) => {
|
|
1687
1695
|
const renderState = pc.__pageRenderState;
|
|
1688
1696
|
if (!renderState) return;
|
|
1689
|
-
const { currentOptions: liveOptions, totalPages: liveTotalPages, pageDataMap: liveDataMap } = renderState;
|
|
1690
1697
|
for (const entry of entries) {
|
|
1691
|
-
if (!(entry.target instanceof HTMLElement)) continue;
|
|
1692
|
-
const
|
|
1693
|
-
|
|
1694
|
-
if (!data) continue;
|
|
1695
|
-
if (entry.isIntersecting) {
|
|
1696
|
-
populatePageShell(shell, liveDataMap, liveTotalPages, liveOptions);
|
|
1697
|
-
for (let offset = -1; offset <= VIRTUALIZATION_BUFFER; offset++) {
|
|
1698
|
-
const neighborIdx = data.index + offset;
|
|
1699
|
-
if (neighborIdx >= 0 && neighborIdx < renderState.pageStates.length && neighborIdx !== data.index) populatePageShell(renderState.pageStates[neighborIdx].element, liveDataMap, liveTotalPages, liveOptions);
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
const viewportHeight = window.innerHeight;
|
|
1704
|
-
const nearThreshold = viewportHeight * 3;
|
|
1705
|
-
const nearIndices = /* @__PURE__ */ new Set();
|
|
1706
|
-
let depopulated = false;
|
|
1707
|
-
for (const [el, data] of liveDataMap) {
|
|
1708
|
-
if (!data.rendered) continue;
|
|
1709
|
-
const rect = el.getBoundingClientRect();
|
|
1710
|
-
if (rect.bottom > -nearThreshold && rect.top < viewportHeight + nearThreshold) nearIndices.add(data.index);
|
|
1711
|
-
}
|
|
1712
|
-
for (const [el, data] of liveDataMap) {
|
|
1713
|
-
if (!data.rendered) continue;
|
|
1714
|
-
let keepRendered = false;
|
|
1715
|
-
for (const nearIdx of nearIndices) if (Math.abs(data.index - nearIdx) <= 2) {
|
|
1716
|
-
keepRendered = true;
|
|
1717
|
-
break;
|
|
1718
|
-
}
|
|
1719
|
-
if (!keepRendered && nearIndices.size > 0) {
|
|
1720
|
-
depopulatePageShell(el, liveDataMap);
|
|
1721
|
-
depopulated = true;
|
|
1722
|
-
}
|
|
1698
|
+
if (!(entry.target instanceof HTMLElement) || !entry.isIntersecting) continue;
|
|
1699
|
+
const data = renderState.pageDataMap.get(entry.target);
|
|
1700
|
+
if (data) populatePageRange(renderState, data.index);
|
|
1723
1701
|
}
|
|
1724
|
-
if (depopulated) emitPainterPainted(container);
|
|
1725
1702
|
}, {
|
|
1726
|
-
root:
|
|
1703
|
+
root: observerRoot,
|
|
1727
1704
|
rootMargin: `${VIRTUALIZATION_ROOT_MARGIN_PX}px 0px ${VIRTUALIZATION_ROOT_MARGIN_PX}px 0px`
|
|
1728
1705
|
});
|
|
1729
|
-
|
|
1730
|
-
|
|
1706
|
+
const retain = new IntersectionObserver((entries) => {
|
|
1707
|
+
const renderState = pc.__pageRenderState;
|
|
1708
|
+
if (!renderState) return;
|
|
1709
|
+
for (const entry of entries) {
|
|
1710
|
+
if (!(entry.target instanceof HTMLElement)) continue;
|
|
1711
|
+
if (entry.isIntersecting) renderState.retainedShells.add(entry.target);
|
|
1712
|
+
else renderState.retainedShells.delete(entry.target);
|
|
1713
|
+
}
|
|
1714
|
+
sweepUnretainedPages(container, renderState);
|
|
1715
|
+
}, {
|
|
1716
|
+
root: observerRoot,
|
|
1717
|
+
rootMargin: `${VIRTUALIZATION_RETAIN_MARGIN_PERCENT}% 0px ${VIRTUALIZATION_RETAIN_MARGIN_PERCENT}% 0px`
|
|
1718
|
+
});
|
|
1719
|
+
for (const shell of pageShells) {
|
|
1720
|
+
populate.observe(shell);
|
|
1721
|
+
retain.observe(shell);
|
|
1722
|
+
}
|
|
1723
|
+
pc.__pageObservers = {
|
|
1724
|
+
populate,
|
|
1725
|
+
retain
|
|
1726
|
+
};
|
|
1731
1727
|
pc.__pageRenderState = {
|
|
1728
|
+
retainedShells: /* @__PURE__ */ new Set(),
|
|
1732
1729
|
pageStates: pageShells.map((el) => ({
|
|
1733
1730
|
element: el,
|
|
1734
1731
|
fingerprint: null,
|
|
@@ -1775,6 +1772,45 @@ function populatePageShell(shell, pageDataMap, totalPages, options) {
|
|
|
1775
1772
|
const container = shell.parentElement;
|
|
1776
1773
|
if (container instanceof HTMLElement) emitPainterPainted(container);
|
|
1777
1774
|
}
|
|
1775
|
+
/** Paint the page at `index` and its buffer neighbours. */
|
|
1776
|
+
function populatePageRange(state, index) {
|
|
1777
|
+
const first = Math.max(0, index - VIRTUALIZATION_BUFFER);
|
|
1778
|
+
const last = Math.min(state.pageStates.length - 1, index + VIRTUALIZATION_BUFFER);
|
|
1779
|
+
for (let i = first; i <= last; i++) populatePageShell(state.pageStates[i].element, state.pageDataMap, state.totalPages, state.currentOptions);
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* Depopulate painted pages more than one page beyond the buffer of every
|
|
1783
|
+
* retained shell. Reads the retention observer's last report, so it forces no
|
|
1784
|
+
* layout.
|
|
1785
|
+
*/
|
|
1786
|
+
function sweepUnretainedPages(container, state) {
|
|
1787
|
+
const retainedIndices = [];
|
|
1788
|
+
for (const shell of state.retainedShells) {
|
|
1789
|
+
const data = state.pageDataMap.get(shell);
|
|
1790
|
+
if (data) retainedIndices.push(data.index);
|
|
1791
|
+
}
|
|
1792
|
+
if (retainedIndices.length === 0) return;
|
|
1793
|
+
let depopulated = false;
|
|
1794
|
+
for (const [el, data] of state.pageDataMap) {
|
|
1795
|
+
if (!data.rendered) continue;
|
|
1796
|
+
if (!retainedIndices.some((retainedIndex) => Math.abs(data.index - retainedIndex) <= 2)) {
|
|
1797
|
+
depopulatePageShell(el, state.pageDataMap);
|
|
1798
|
+
depopulated = true;
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
if (depopulated) emitPainterPainted(container);
|
|
1802
|
+
}
|
|
1803
|
+
/**
|
|
1804
|
+
* Paint `shell` and its buffer neighbours now, ahead of the observer, so a
|
|
1805
|
+
* navigation can scroll straight onto painted content instead of passing blank
|
|
1806
|
+
* shells. No-op for containers `renderPages` did not virtualize.
|
|
1807
|
+
*/
|
|
1808
|
+
function renderPagesAround(container, shell) {
|
|
1809
|
+
const state = container.__pageRenderState;
|
|
1810
|
+
const data = state?.pageDataMap.get(shell);
|
|
1811
|
+
if (!state || !data) return;
|
|
1812
|
+
populatePageRange(state, data.index);
|
|
1813
|
+
}
|
|
1778
1814
|
/**
|
|
1779
1815
|
* Force every virtualized page shell in `container` to be fully rendered.
|
|
1780
1816
|
*
|
|
@@ -1918,7 +1954,7 @@ function findPageShellForPmPos(container, pmPos) {
|
|
|
1918
1954
|
if (fragment.pmEnd !== void 0 && fragment.pmEnd > pageEnd) pageEnd = fragment.pmEnd;
|
|
1919
1955
|
}
|
|
1920
1956
|
if (pageStart === Number.POSITIVE_INFINITY) continue;
|
|
1921
|
-
if (pageStart <= pmPos && pmPos
|
|
1957
|
+
if (pageStart <= pmPos && pmPos < pageEnd) return {
|
|
1922
1958
|
element: shell,
|
|
1923
1959
|
isExact: true
|
|
1924
1960
|
};
|
|
@@ -1947,4 +1983,4 @@ function depopulatePageShell(shell, pageDataMap) {
|
|
|
1947
1983
|
}
|
|
1948
1984
|
}
|
|
1949
1985
|
//#endregion
|
|
1950
|
-
export { PAGE_CLASS_NAMES, PAINTER_PAINTED_EVENT, applySectionHeaderFooterOptions, calculateFootnoteAreaRenderHeight, computePageFingerprint, emuToPixels, findPageShellForPmPos, floatingTableReservesBand, getDefaultPageFontFamily, isFloatingImageRun, renderAllPagesNow, renderFloatingImagesLayer, renderFootnoteArea, renderPage, renderPages, resolveAnchoredImagePosition, resolveHeaderFooterFloatLeft, resolveHeaderFooterIntrinsicFrameHorizontalPosition, selectSectionHeaderFooterRIds };
|
|
1986
|
+
export { PAGE_CLASS_NAMES, PAINTER_PAINTED_EVENT, applySectionHeaderFooterOptions, calculateFootnoteAreaRenderHeight, computePageFingerprint, emuToPixels, findPageShellForPmPos, floatingTableReservesBand, getDefaultPageFontFamily, isFloatingImageRun, renderAllPagesNow, renderFloatingImagesLayer, renderFootnoteArea, renderPage, renderPages, renderPagesAround, resolveAnchoredImagePosition, resolveHeaderFooterFloatLeft, resolveHeaderFooterIntrinsicFrameHorizontalPosition, selectSectionHeaderFooterRIds };
|
|
@@ -5,6 +5,10 @@ export declare const scrollEditorTo: (element: HTMLElement | null, options: Scro
|
|
|
5
5
|
export declare const scrollEditorBy: (element: HTMLElement | null, delta: number) => void;
|
|
6
6
|
type ScrollEditorElementOptions = {
|
|
7
7
|
block?: "start" | "center" | "end" | "nearest";
|
|
8
|
+
/**
|
|
9
|
+
* Omitted: smooth (instant under `prefers-reduced-motion`) within two
|
|
10
|
+
* viewport heights, instant beyond.
|
|
11
|
+
*/
|
|
8
12
|
behavior?: ScrollBehavior;
|
|
9
13
|
/** Space to leave between the target and the visible root edge. */
|
|
10
14
|
margin?: number;
|
|
@@ -24,8 +24,15 @@ const nearestScrollOffset = ({ targetStart, targetEnd, viewportStart, viewportEn
|
|
|
24
24
|
if (below && targetSize <= viewportSize || above && targetSize > viewportSize) return targetEnd - viewportEnd;
|
|
25
25
|
return 0;
|
|
26
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Farthest move, in viewport heights, that the default behavior animates. A
|
|
29
|
+
* longer smooth scroll passes page shells that virtualization paints one by
|
|
30
|
+
* one before discarding them, and shows blank shells until it arrives.
|
|
31
|
+
*/
|
|
32
|
+
const SMOOTH_SCROLL_MAX_VIEWPORTS = 2;
|
|
33
|
+
const navigationScrollBehavior = (distance, viewportHeight) => Math.abs(distance) > viewportHeight * SMOOTH_SCROLL_MAX_VIEWPORTS ? "instant" : prefersReducedMotionBehavior();
|
|
27
34
|
/** Scroll only the marked root, including when the target is inside a scaled viewport. */
|
|
28
|
-
const scrollEditorElementIntoView = (element, { block = "center", behavior
|
|
35
|
+
const scrollEditorElementIntoView = (element, { block = "center", behavior, margin = 0, rect } = {}) => {
|
|
29
36
|
const root = getEditorScrollRoot(element);
|
|
30
37
|
if (!root || !element) return;
|
|
31
38
|
const targetRect = rect ?? element.getBoundingClientRect();
|
|
@@ -62,10 +69,11 @@ const scrollEditorElementIntoView = (element, { block = "center", behavior = pre
|
|
|
62
69
|
viewportEnd: visibleLeft + root.clientWidth
|
|
63
70
|
});
|
|
64
71
|
if (top === root.scrollTop && left === root.scrollLeft) return;
|
|
72
|
+
const clampedTop = Math.max(0, top);
|
|
65
73
|
scrollEditorTo(root, {
|
|
66
|
-
top:
|
|
74
|
+
top: clampedTop,
|
|
67
75
|
left: Math.max(0, left),
|
|
68
|
-
behavior
|
|
76
|
+
behavior: behavior ?? navigationScrollBehavior(clampedTop - root.scrollTop, root.clientHeight)
|
|
69
77
|
});
|
|
70
78
|
};
|
|
71
79
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findBodyPmAnchor, findBodyPmAnchors } from "../layout-bridge/dom/findBodyPmSpans.js";
|
|
2
|
-
import { findPageShellForPmPos } from "../layout-painter/renderPage.js";
|
|
2
|
+
import { findPageShellForPmPos, renderPagesAround } from "../layout-painter/renderPage.js";
|
|
3
3
|
import { getEditorScrollRoot, scrollEditorElementIntoView } from "./editorScrollRoot.js";
|
|
4
4
|
import { isValidPmScrollPosition } from "./scrollNavigation.js";
|
|
5
5
|
//#region src/paged-layout/scrollToPmPosition.ts
|
|
@@ -8,61 +8,51 @@ const PAGES_CONTAINER_CLASS = "paged-editor__pages";
|
|
|
8
8
|
/** Scroll visible pages to a ProseMirror position. */
|
|
9
9
|
const scrollPagesToPmPosition = (pageContainer, pmPos) => {
|
|
10
10
|
if (!isValidPmScrollPosition(pmPos)) return;
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
scrollEditorElementIntoView(
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
let runMatch = null;
|
|
17
|
-
for (const el of findBodyPmAnchors(pageContainer)) {
|
|
18
|
-
const start = Number(el.dataset["pmStart"]);
|
|
19
|
-
if (Number.isNaN(start)) continue;
|
|
20
|
-
const endAttr = el.dataset["pmEnd"];
|
|
21
|
-
const end = endAttr === void 0 ? start : Number(endAttr);
|
|
22
|
-
if (start <= pmPos && pmPos <= end) {
|
|
23
|
-
runMatch = el;
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (runMatch) {
|
|
28
|
-
scrollEditorElementIntoView(runMatch);
|
|
11
|
+
const rendered = findBodyPmAnchor(pageContainer, pmPos) ?? findAnchorContaining(pageContainer, pmPos);
|
|
12
|
+
if (rendered) {
|
|
13
|
+
scrollEditorElementIntoView(rendered);
|
|
29
14
|
return;
|
|
30
15
|
}
|
|
31
16
|
const shellHit = findPageShellForPmPos(pageContainer, pmPos);
|
|
32
17
|
if (!shellHit) return;
|
|
33
18
|
const { element: shell } = shellHit;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
19
|
+
renderPagesAround(pageContainer, shell);
|
|
20
|
+
scrollEditorElementIntoView(findBodyPmAnchor(shell, pmPos) ?? findAnchorContaining(shell, pmPos) ?? findAnchorBefore(shell, pmPos) ?? shell);
|
|
21
|
+
};
|
|
22
|
+
const anchorRanges = (root) => {
|
|
23
|
+
const ranges = [];
|
|
24
|
+
for (const element of findBodyPmAnchors(root)) {
|
|
25
|
+
const start = Number(element.dataset["pmStart"]);
|
|
26
|
+
if (Number.isNaN(start)) continue;
|
|
27
|
+
const endAttr = element.dataset["pmEnd"];
|
|
28
|
+
ranges.push({
|
|
29
|
+
element,
|
|
30
|
+
start,
|
|
31
|
+
end: endAttr === void 0 ? start : Number(endAttr)
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return ranges;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* First painted run whose range holds `pmPos` (block positions rarely match a
|
|
38
|
+
* run start). Ranges are half-open, as page lookups are: a run ending where a
|
|
39
|
+
* block starts belongs before it, so the end of a painted page never stands in
|
|
40
|
+
* for the unpainted page that block opens. A run without an end holds only its
|
|
41
|
+
* start.
|
|
42
|
+
*/
|
|
43
|
+
const findAnchorContaining = (root, pmPos) => {
|
|
44
|
+
for (const { element, start, end } of anchorRanges(root)) if (start <= pmPos && (pmPos < end || pmPos === start)) return element;
|
|
45
|
+
return null;
|
|
46
|
+
};
|
|
47
|
+
/** The painted run starting closest before `pmPos`. */
|
|
48
|
+
const findAnchorBefore = (root, pmPos) => {
|
|
49
|
+
let best = null;
|
|
50
|
+
let bestStart = Number.NEGATIVE_INFINITY;
|
|
51
|
+
for (const { element, start } of anchorRanges(root)) if (start <= pmPos && start > bestStart) {
|
|
52
|
+
bestStart = start;
|
|
53
|
+
best = element;
|
|
54
|
+
}
|
|
55
|
+
return best;
|
|
66
56
|
};
|
|
67
57
|
/**
|
|
68
58
|
* Scroll the paged layout that mirrors `view` so `pmPos` is centered
|
package/dist/pdf/fonts.js
CHANGED
|
@@ -6,7 +6,8 @@ import { bytesToHex, decodeText, encodeUtf16BE, encodeUtf8 } from "../utils/text
|
|
|
6
6
|
import { pdfArray, pdfAsciiString, pdfDict, pdfFlateStream, pdfName, pdfNumber, pdfNumberArray } from "./objects.js";
|
|
7
7
|
import { Result, TaggedError, panic } from "better-result";
|
|
8
8
|
//#region src/pdf/fonts.ts
|
|
9
|
-
|
|
9
|
+
const PdfFontErrorBase = TaggedError("PdfFontError");
|
|
10
|
+
var PdfFontError = class extends PdfFontErrorBase {};
|
|
10
11
|
/** Text space is 1000 units to the em whatever the font's own head is. */
|
|
11
12
|
const TEXT_SPACE_UNITS_PER_EM = 1e3;
|
|
12
13
|
/** `fsType` bit 1: the vendor forbids embedding this face outright. */
|
package/dist/pdf/images.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DisplayImageSource } from "../display-list/types.js";
|
|
2
2
|
import { PdfValue } from "./objects.js";
|
|
3
|
-
import { Result } from "better-result";
|
|
3
|
+
import { Result, TaggedErrorClass } from "better-result";
|
|
4
4
|
//#region src/pdf/images.d.ts
|
|
5
|
-
declare const
|
|
6
|
-
export declare class PdfImageError extends
|
|
5
|
+
declare const PdfImageErrorBase: TaggedErrorClass<"PdfImageError">;
|
|
6
|
+
export declare class PdfImageError extends PdfImageErrorBase<{
|
|
7
7
|
message: string;
|
|
8
8
|
}> {}
|
|
9
9
|
/** A soft mask: one alpha sample per pixel, matching the image's dimensions. */
|
package/dist/pdf/images.js
CHANGED
|
@@ -18,7 +18,8 @@ import { inflateSync } from "node:zlib";
|
|
|
18
18
|
* refusing the page. Adam7 interlacing is not such a form — it is seven
|
|
19
19
|
* ordinary rasters of the same samples — so it is decoded rather than refused.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
const PdfImageErrorBase = TaggedError("PdfImageError");
|
|
22
|
+
var PdfImageError = class extends PdfImageErrorBase {};
|
|
22
23
|
const PNG_SIGNATURE = [
|
|
23
24
|
137,
|
|
24
25
|
80,
|
package/dist/pdf/paint.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DisplayPage } from "../display-list/types.js";
|
|
2
2
|
import { PreparedFont, ShapedRunRequest } from "./fonts.js";
|
|
3
3
|
import { ContentPart } from "./contentStream.js";
|
|
4
|
-
import { Result } from "better-result";
|
|
4
|
+
import { Result, TaggedErrorClass } from "better-result";
|
|
5
5
|
//#region src/pdf/paint.d.ts
|
|
6
|
-
declare const
|
|
7
|
-
export declare class PaintError extends
|
|
6
|
+
declare const PaintErrorBase: TaggedErrorClass<"PaintError">;
|
|
7
|
+
export declare class PaintError extends PaintErrorBase<{
|
|
8
8
|
message: string;
|
|
9
9
|
}> {}
|
|
10
10
|
export type PaintPageOptions = {
|
package/dist/pdf/paint.js
CHANGED
|
@@ -12,7 +12,8 @@ import { Result, TaggedError, panic } from "better-result";
|
|
|
12
12
|
* converts once, at the stream's first operator, which is why no primitive
|
|
13
13
|
* below does any arithmetic on the page height.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
const PaintErrorBase = TaggedError("PaintError");
|
|
16
|
+
var PaintError = class extends PaintErrorBase {};
|
|
16
17
|
/** Thousandths of an em, the unit of a `TJ` adjustment. */
|
|
17
18
|
const TEXT_SPACE_UNITS_PER_EM = 1e3;
|
|
18
19
|
const OPAQUE = 1;
|
package/dist/pdf/writePdf.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DisplayList } from "../display-list/types.js";
|
|
2
2
|
import { PdfFontSource, PdfSubstitution } from "./fonts.js";
|
|
3
|
-
import { Result } from "better-result";
|
|
3
|
+
import { Result, TaggedErrorClass } from "better-result";
|
|
4
4
|
//#region src/pdf/writePdf.d.ts
|
|
5
5
|
export type WritePdfOptions = {
|
|
6
6
|
readonly fonts: PdfFontSource;
|
|
@@ -38,8 +38,8 @@ export type WritePdfResult = {
|
|
|
38
38
|
/** Code points painted as `.notdef` because no supplied face covers them. */
|
|
39
39
|
readonly unencodable: readonly PdfUnencodable[];
|
|
40
40
|
};
|
|
41
|
-
declare const
|
|
42
|
-
export declare class WritePdfError extends
|
|
41
|
+
declare const WritePdfErrorBase: TaggedErrorClass<"WritePdfError">;
|
|
42
|
+
export declare class WritePdfError extends WritePdfErrorBase<{
|
|
43
43
|
message: string;
|
|
44
44
|
cause?: unknown;
|
|
45
45
|
}> {}
|
package/dist/pdf/writePdf.js
CHANGED
|
@@ -20,7 +20,8 @@ import { createHash } from "node:crypto";
|
|
|
20
20
|
* deflate level) exists to keep it true. Nothing here reads a clock or a
|
|
21
21
|
* random source.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
const WritePdfErrorBase = TaggedError("WritePdfError");
|
|
24
|
+
var WritePdfError = class extends WritePdfErrorBase {};
|
|
24
25
|
const DEFAULT_PRODUCER = "folio";
|
|
25
26
|
/** How many code points the strict-coverage refusal names before counting. */
|
|
26
27
|
const UNENCODABLE_SAMPLE = 5;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
2
|
import { Node } from "prosemirror-model";
|
|
3
3
|
import { Command, EditorState } from "prosemirror-state";
|
|
4
|
-
import { ParagraphPropsPatch, RunPropsPatch } from "@stll/docx-core/ops";
|
|
4
|
+
import { FormattingPatch, ParagraphPropsPatch, RunPropsPatch } from "@stll/docx-core/ops";
|
|
5
5
|
//#region src/prosemirror/canonicalCommands.d.ts
|
|
6
6
|
/** Command meaning before canonical positions are resolved by the session. */
|
|
7
7
|
export type CanonicalCommandIntent = {
|
|
@@ -78,14 +78,14 @@ export declare const canonicalRunFormatting: (state: EditorState, patch: RunProp
|
|
|
78
78
|
type: "formatRun";
|
|
79
79
|
from: number;
|
|
80
80
|
to: number;
|
|
81
|
-
patch:
|
|
81
|
+
patch: FormattingPatch<{
|
|
82
82
|
bold?: boolean | undefined;
|
|
83
83
|
boldCs?: boolean | undefined;
|
|
84
84
|
italic?: boolean | undefined;
|
|
85
85
|
italicCs?: boolean | undefined;
|
|
86
86
|
underline?: {
|
|
87
|
-
style:
|
|
88
|
-
color?:
|
|
87
|
+
style: document_d_exports.UnderlineStyle;
|
|
88
|
+
color?: document_d_exports.ColorValue;
|
|
89
89
|
} | undefined;
|
|
90
90
|
strike?: boolean | undefined;
|
|
91
91
|
doubleStrike?: boolean | undefined;
|
|
@@ -94,9 +94,9 @@ export declare const canonicalRunFormatting: (state: EditorState, patch: RunProp
|
|
|
94
94
|
allCaps?: boolean | undefined;
|
|
95
95
|
hidden?: boolean | undefined;
|
|
96
96
|
noProof?: boolean | undefined;
|
|
97
|
-
color?:
|
|
97
|
+
color?: document_d_exports.ColorValue | undefined;
|
|
98
98
|
highlight?: "black" | "blue" | "cyan" | "darkBlue" | "darkCyan" | "darkGray" | "darkGreen" | "darkMagenta" | "darkRed" | "darkYellow" | "green" | "lightGray" | "magenta" | "none" | "red" | "white" | "yellow" | undefined;
|
|
99
|
-
shading?:
|
|
99
|
+
shading?: document_d_exports.ShadingProperties | undefined;
|
|
100
100
|
fontSize?: number | undefined;
|
|
101
101
|
fontSizeCs?: number | undefined;
|
|
102
102
|
fontFamily?: {
|
|
@@ -119,8 +119,8 @@ export declare const canonicalRunFormatting: (state: EditorState, patch: RunProp
|
|
|
119
119
|
position?: number | undefined;
|
|
120
120
|
scale?: number | undefined;
|
|
121
121
|
kerning?: number | undefined;
|
|
122
|
-
effect?:
|
|
123
|
-
emphasisMark?:
|
|
122
|
+
effect?: document_d_exports.TextEffect | undefined;
|
|
123
|
+
emphasisMark?: document_d_exports.EmphasisMark | undefined;
|
|
124
124
|
emboss?: boolean | undefined;
|
|
125
125
|
imprint?: boolean | undefined;
|
|
126
126
|
outline?: boolean | undefined;
|
|
@@ -128,7 +128,7 @@ export declare const canonicalRunFormatting: (state: EditorState, patch: RunProp
|
|
|
128
128
|
rtl?: boolean | undefined;
|
|
129
129
|
cs?: boolean | undefined;
|
|
130
130
|
styleId?: string | undefined;
|
|
131
|
-
preserved?:
|
|
131
|
+
preserved?: document_d_exports.PreservedMarkup | undefined;
|
|
132
132
|
}>;
|
|
133
133
|
}[];
|
|
134
134
|
export declare const withCanonicalParagraphFormatting: (command: Command, patch: ParagraphPropsPatch | ((paragraph: Node) => ParagraphPropsPatch)) => Command;
|