@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContentControlBoundError, ContentControlLockedError, ContentControlTypeError } from "../../content-controls/errors.js";
|
|
2
2
|
import "../../content-controls/index.js";
|
|
3
|
-
import { Plugin } from "prosemirror-state";
|
|
3
|
+
import { EditorState, Plugin, PluginKey } from "prosemirror-state";
|
|
4
4
|
import { EditorView } from "prosemirror-view";
|
|
5
5
|
//#region src/prosemirror/plugins/contentControlWidgets.d.ts
|
|
6
6
|
export type ContentControlWidgetAnchor = {
|
|
@@ -49,10 +49,10 @@ type HandleContentControlWidgetClickOptions = {
|
|
|
49
49
|
};
|
|
50
50
|
export declare const contentControlWidgetsPluginKey: Readonly<{
|
|
51
51
|
key: string;
|
|
52
|
-
createKey: () =>
|
|
52
|
+
createKey: () => PluginKey<unknown>;
|
|
53
53
|
owns: (plugin: Plugin<unknown>) => boolean;
|
|
54
|
-
get: (state:
|
|
55
|
-
getState: (state:
|
|
54
|
+
get: (state: EditorState) => Plugin<unknown> | undefined;
|
|
55
|
+
getState: (state: EditorState) => unknown;
|
|
56
56
|
}>;
|
|
57
57
|
/**
|
|
58
58
|
* CustomEvent name dispatched on the editor view DOM whenever the plugin
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { document_d_exports } from "../../types/document.js";
|
|
2
2
|
import { BuiltInStyleIndex } from "../../docx/builtInStyles.js";
|
|
3
3
|
import { StyleResolver } from "../styles/styleResolver.js";
|
|
4
|
-
import { EditorState } from "prosemirror-state";
|
|
4
|
+
import { EditorState, Plugin, PluginKey } from "prosemirror-state";
|
|
5
5
|
//#region src/prosemirror/plugins/documentStyleState.d.ts
|
|
6
6
|
export declare const documentStylesKey: Readonly<{
|
|
7
7
|
key: string;
|
|
8
|
-
createKey: () =>
|
|
9
|
-
owns: (plugin:
|
|
10
|
-
get: (state: EditorState) =>
|
|
8
|
+
createKey: () => PluginKey<StyleResolver | null>;
|
|
9
|
+
owns: (plugin: Plugin<StyleResolver | null>) => boolean;
|
|
10
|
+
get: (state: EditorState) => Plugin<StyleResolver | null> | undefined;
|
|
11
11
|
getState: (state: EditorState) => StyleResolver | null | undefined;
|
|
12
12
|
}>;
|
|
13
13
|
/** Read the document's StyleResolver, or null when the plugin isn't installed. */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Node } from "prosemirror-model";
|
|
2
|
+
import { TaggedErrorClass } from "better-result";
|
|
2
3
|
//#region src/prosemirror/plugins/revisionIds.d.ts
|
|
3
|
-
declare const
|
|
4
|
-
export declare class RevisionIdAllocationError extends
|
|
4
|
+
declare const RevisionIdAllocationErrorBase: TaggedErrorClass<"RevisionIdAllocationError">;
|
|
5
|
+
export declare class RevisionIdAllocationError extends RevisionIdAllocationErrorBase<{
|
|
5
6
|
message: string;
|
|
6
7
|
first: number;
|
|
7
8
|
next: number;
|
|
@@ -22,7 +22,8 @@ import { MAX_REVISION_ID } from "@stll/docx-core/model";
|
|
|
22
22
|
*/
|
|
23
23
|
let counter = 1;
|
|
24
24
|
const occupiedIds = /* @__PURE__ */ new Set();
|
|
25
|
-
|
|
25
|
+
const RevisionIdAllocationErrorBase = TaggedError("RevisionIdAllocationError");
|
|
26
|
+
var RevisionIdAllocationError = class extends RevisionIdAllocationErrorBase {};
|
|
26
27
|
/** Batches use contiguous ids; on rollover prefer the largest unused interval. */
|
|
27
28
|
const largestFreeIntervalStart = (reservedIds) => {
|
|
28
29
|
let first = 1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { document_d_exports } from "../../types/document.js";
|
|
2
2
|
import { ListState } from "../listState.js";
|
|
3
|
-
import { EditorState, Plugin } from "prosemirror-state";
|
|
3
|
+
import { EditorState, Plugin, PluginKey } from "prosemirror-state";
|
|
4
4
|
//#region src/prosemirror/plugins/selectionTracker.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Selection context for toolbar state
|
|
@@ -32,7 +32,7 @@ export type SelectionContext = {
|
|
|
32
32
|
*/
|
|
33
33
|
export declare const selectionTrackerKey: Readonly<{
|
|
34
34
|
key: string;
|
|
35
|
-
createKey: () =>
|
|
35
|
+
createKey: () => PluginKey<SelectionContext>;
|
|
36
36
|
owns: (plugin: Plugin<SelectionContext>) => boolean;
|
|
37
37
|
get: (state: EditorState) => Plugin<SelectionContext> | undefined;
|
|
38
38
|
getState: (state: EditorState) => SelectionContext | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Slice } from "prosemirror-model";
|
|
2
|
-
import { EditorState, Plugin, Transaction } from "prosemirror-state";
|
|
2
|
+
import { EditorState, Plugin, PluginKey, Transaction } from "prosemirror-state";
|
|
3
3
|
import { EditorView } from "prosemirror-view";
|
|
4
4
|
//#region src/prosemirror/plugins/suggestionMode.d.ts
|
|
5
5
|
export declare const suggestionModeKey: Readonly<{
|
|
6
6
|
key: string;
|
|
7
|
-
createKey: () =>
|
|
7
|
+
createKey: () => PluginKey<SuggestionModeState>;
|
|
8
8
|
owns: (plugin: Plugin<SuggestionModeState>) => boolean;
|
|
9
9
|
get: (state: EditorState) => Plugin<SuggestionModeState> | undefined;
|
|
10
10
|
getState: (state: EditorState) => SuggestionModeState | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DocScanState } from "./createDocScanPlugin.js";
|
|
2
2
|
import { Node } from "prosemirror-model";
|
|
3
|
-
import { EditorState } from "prosemirror-state";
|
|
3
|
+
import { EditorState, Plugin, PluginKey } from "prosemirror-state";
|
|
4
4
|
import { DirectiveKind } from "@stll/template-conditions";
|
|
5
5
|
//#region src/prosemirror/plugins/templateDirectives.d.ts
|
|
6
6
|
export type DirectiveRange = {
|
|
@@ -52,15 +52,15 @@ export declare const computeBlockDepths: (ranges: readonly DirectiveRange[]) =>
|
|
|
52
52
|
export declare const scanDirectives: (doc: Node) => DirectiveRange[];
|
|
53
53
|
export declare const templateDirectivesKey: Readonly<{
|
|
54
54
|
key: string;
|
|
55
|
-
createKey: () =>
|
|
56
|
-
owns: (plugin:
|
|
57
|
-
get: (state: EditorState) =>
|
|
55
|
+
createKey: () => PluginKey<DocScanState<undefined, DirectiveRange>>;
|
|
56
|
+
owns: (plugin: Plugin<DocScanState<undefined, DirectiveRange>>) => boolean;
|
|
57
|
+
get: (state: EditorState) => Plugin<DocScanState<undefined, DirectiveRange>> | undefined;
|
|
58
58
|
getState: (state: EditorState) => DocScanState<undefined, DirectiveRange> | undefined;
|
|
59
59
|
}>;
|
|
60
60
|
export type TemplateDirectivesPluginOptions = {
|
|
61
61
|
onRangesChange?: (ranges: readonly DirectiveRange[]) => void;
|
|
62
62
|
};
|
|
63
|
-
export declare const createTemplateDirectivesPlugin: ({ onRangesChange }?: TemplateDirectivesPluginOptions) =>
|
|
63
|
+
export declare const createTemplateDirectivesPlugin: ({ onRangesChange }?: TemplateDirectivesPluginOptions) => Plugin<DocScanState<undefined, DirectiveRange>>;
|
|
64
64
|
export declare const getTemplateDirectives: (state: EditorState) => readonly DirectiveRange[];
|
|
65
65
|
//#endregion
|
|
66
66
|
export type { DirectiveKind };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from "prosemirror-state";
|
|
1
|
+
import { EditorState, Plugin, PluginKey } from "prosemirror-state";
|
|
2
2
|
import { DecorationSet, EditorView } from "prosemirror-view";
|
|
3
3
|
//#region src/prosemirror/plugins/templatePreviewValues.d.ts
|
|
4
4
|
/** One formatted span of a rich preview value. The flags layer over the
|
|
@@ -89,10 +89,10 @@ type TemplatePreviewState = {
|
|
|
89
89
|
};
|
|
90
90
|
export declare const templatePreviewValuesKey: Readonly<{
|
|
91
91
|
key: string;
|
|
92
|
-
createKey: () =>
|
|
92
|
+
createKey: () => PluginKey<TemplatePreviewState>;
|
|
93
93
|
owns: (plugin: Plugin<TemplatePreviewState>) => boolean;
|
|
94
|
-
get: (state:
|
|
95
|
-
getState: (state:
|
|
94
|
+
get: (state: EditorState) => Plugin<TemplatePreviewState> | undefined;
|
|
95
|
+
getState: (state: EditorState) => TemplatePreviewState | undefined;
|
|
96
96
|
}>;
|
|
97
97
|
export declare function createTemplatePreviewValuesPlugin(): Plugin<TemplatePreviewState>;
|
|
98
98
|
/** Push (or clear, with `null`) the live fill preview into the editor. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorState, Plugin, Transaction } from "prosemirror-state";
|
|
1
|
+
import { EditorState, Plugin, PluginKey, Transaction } from "prosemirror-state";
|
|
2
2
|
//#region src/prosemirror/plugins/templateSlashMenu.d.ts
|
|
3
3
|
export type TemplateSlashMenuState = {
|
|
4
4
|
active: false;
|
|
@@ -36,7 +36,7 @@ export type TemplateSlashMenuPluginOptions = {
|
|
|
36
36
|
};
|
|
37
37
|
export declare const templateSlashMenuKey: Readonly<{
|
|
38
38
|
key: string;
|
|
39
|
-
createKey: () =>
|
|
39
|
+
createKey: () => PluginKey<TemplateSlashMenuState>;
|
|
40
40
|
owns: (plugin: Plugin<TemplateSlashMenuState>) => boolean;
|
|
41
41
|
get: (state: EditorState) => Plugin<TemplateSlashMenuState> | undefined;
|
|
42
42
|
getState: (state: EditorState) => TemplateSlashMenuState | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Mark, Node } from "prosemirror-model";
|
|
1
|
+
import { Attrs, Mark, Node } from "prosemirror-model";
|
|
2
2
|
//#region src/prosemirror/preservedXmlReview.d.ts
|
|
3
3
|
/** A retained opaque deleted result becomes ordinary text when its last deletion resolves. */
|
|
4
|
-
export declare const resolvedPreservedXmlAttrs: (node: Node, marks: readonly Mark[]) =>
|
|
4
|
+
export declare const resolvedPreservedXmlAttrs: (node: Node, marks: readonly Mark[]) => Attrs;
|
|
5
5
|
//#endregion
|
|
@@ -52,8 +52,8 @@ export declare const resolveParagraphInheritedRunFormatting: (options: ResolvePa
|
|
|
52
52
|
italic?: boolean | undefined;
|
|
53
53
|
italicCs?: boolean | undefined;
|
|
54
54
|
underline?: {
|
|
55
|
-
style:
|
|
56
|
-
color?:
|
|
55
|
+
style: document_d_exports.UnderlineStyle;
|
|
56
|
+
color?: document_d_exports.ColorValue;
|
|
57
57
|
} | undefined;
|
|
58
58
|
strike?: boolean | undefined;
|
|
59
59
|
doubleStrike?: boolean | undefined;
|
|
@@ -62,9 +62,9 @@ export declare const resolveParagraphInheritedRunFormatting: (options: ResolvePa
|
|
|
62
62
|
allCaps?: boolean | undefined;
|
|
63
63
|
hidden?: boolean | undefined;
|
|
64
64
|
noProof?: boolean | undefined;
|
|
65
|
-
color?:
|
|
65
|
+
color?: document_d_exports.ColorValue | undefined;
|
|
66
66
|
highlight?: "black" | "blue" | "cyan" | "darkBlue" | "darkCyan" | "darkGray" | "darkGreen" | "darkMagenta" | "darkRed" | "darkYellow" | "green" | "lightGray" | "magenta" | "none" | "red" | "white" | "yellow" | undefined;
|
|
67
|
-
shading?:
|
|
67
|
+
shading?: document_d_exports.ShadingProperties | undefined;
|
|
68
68
|
fontSize?: number | undefined;
|
|
69
69
|
fontSizeCs?: number | undefined;
|
|
70
70
|
fontFamily?: {
|
|
@@ -87,8 +87,8 @@ export declare const resolveParagraphInheritedRunFormatting: (options: ResolvePa
|
|
|
87
87
|
position?: number | undefined;
|
|
88
88
|
scale?: number | undefined;
|
|
89
89
|
kerning?: number | undefined;
|
|
90
|
-
effect?:
|
|
91
|
-
emphasisMark?:
|
|
90
|
+
effect?: document_d_exports.TextEffect | undefined;
|
|
91
|
+
emphasisMark?: document_d_exports.EmphasisMark | undefined;
|
|
92
92
|
emboss?: boolean | undefined;
|
|
93
93
|
imprint?: boolean | undefined;
|
|
94
94
|
outline?: boolean | undefined;
|
|
@@ -96,7 +96,7 @@ export declare const resolveParagraphInheritedRunFormatting: (options: ResolvePa
|
|
|
96
96
|
rtl?: boolean | undefined;
|
|
97
97
|
cs?: boolean | undefined;
|
|
98
98
|
styleId?: string | undefined;
|
|
99
|
-
preserved?:
|
|
99
|
+
preserved?: document_d_exports.PreservedMarkup | undefined;
|
|
100
100
|
} | undefined;
|
|
101
101
|
inheritedToggleCascade: {
|
|
102
102
|
formatting: document_d_exports.TextFormatting | undefined;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, InlineWrapperAttrs, InlineWrapperKind, InlineWrapperLayer, LanguageAttrs, RunFormattingOverrideAttrs, RunIdentityMarkAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, TrackedRevisionAncestor, UnderlineAttrs } from "./marks.js";
|
|
2
2
|
import { BlockCustomXmlAttrs, BlockSdtAttrs, BookmarkBoundaryAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, PageBreakRunAttrs, ParagraphAttrs, ParagraphPropertyChangeAttrs, PreservedBlockAttrs, PreservedXmlAttrs, PreservedXmlLevel, SdtAttrs, ShapeAttrs, SymbolAttrs, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "./nodes.js";
|
|
3
3
|
import { ExtensionManager } from "../extensions/ExtensionManager.js";
|
|
4
|
+
import { Schema } from "prosemirror-model";
|
|
4
5
|
//#region src/prosemirror/schema/index.d.ts
|
|
5
6
|
export declare const singletonManager: ExtensionManager;
|
|
6
|
-
export declare const schema:
|
|
7
|
+
export declare const schema: Schema;
|
|
7
8
|
/**
|
|
8
9
|
* Export types for convenience
|
|
9
10
|
*/
|
|
@@ -2,13 +2,6 @@ import { ExtensionManager } from "../extensions/ExtensionManager.js";
|
|
|
2
2
|
import { createStarterKit } from "../extensions/StarterKit.js";
|
|
3
3
|
//#region src/prosemirror/schema/index.ts
|
|
4
4
|
/**
|
|
5
|
-
* ProseMirror Schema for DOCX Editor
|
|
6
|
-
*
|
|
7
|
-
* Singleton ExtensionManager that builds the schema and initializes runtime.
|
|
8
|
-
* Legacy code imports `schema` and commands from here; new code should use
|
|
9
|
-
* ExtensionManager directly.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
5
|
* Singleton ExtensionManager — builds schema + initializes runtime (plugins, commands, keymaps)
|
|
13
6
|
*/
|
|
14
7
|
const mgr = new ExtensionManager(createStarterKit());
|
|
@@ -140,5 +140,5 @@ export declare class StyleResolver {
|
|
|
140
140
|
*/
|
|
141
141
|
export declare function createStyleResolver(styleDefinitions: document_d_exports.StyleDefinitions | undefined): StyleResolver;
|
|
142
142
|
/** The same ordered paragraph tiers, without unrelated run or paragraph fields. */
|
|
143
|
-
export declare const resolveStyleParagraphNumbering: (resolver: StyleResolver, styleId: string | undefined | null) =>
|
|
143
|
+
export declare const resolveStyleParagraphNumbering: (resolver: StyleResolver, styleId: string | undefined | null) => document_d_exports.ParagraphNumberingOverride | undefined;
|
|
144
144
|
//#endregion
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Mark } from "prosemirror-model";
|
|
1
2
|
import { EditorState, Plugin, Transaction } from "prosemirror-state";
|
|
2
3
|
import { EditorView } from "prosemirror-view";
|
|
3
4
|
//#region src/prosemirror/textInput.d.ts
|
|
@@ -17,7 +18,7 @@ type FormattingMarksBesideLockedControlOptions = {
|
|
|
17
18
|
from: number;
|
|
18
19
|
to: number;
|
|
19
20
|
};
|
|
20
|
-
export declare const formattingMarksBesideLockedControl: ({ state, from, to }: FormattingMarksBesideLockedControlOptions) =>
|
|
21
|
+
export declare const formattingMarksBesideLockedControl: ({ state, from, to }: FormattingMarksBesideLockedControlOptions) => Mark[] | undefined;
|
|
21
22
|
export declare const dispatchEditorTextInput: <TView extends TextInputDispatchTarget<TView>>(view: TView, input: string | TextInput) => void;
|
|
22
23
|
export declare const getEditorInputTargetRange: (view: EditorView, event: InputEvent) => {
|
|
23
24
|
from: number;
|
|
@@ -31,6 +32,6 @@ export declare const handleEditorBeforeInput: (view: EditorView, event: InputEve
|
|
|
31
32
|
*/
|
|
32
33
|
export declare const afterNativeCompositionFlush: (callback: () => void) => void;
|
|
33
34
|
/** Route committed text through the model before the browser mutates mark spans. */
|
|
34
|
-
export declare const createTextInputPlugin: () => Plugin
|
|
35
|
+
export declare const createTextInputPlugin: () => Plugin;
|
|
35
36
|
//#endregion
|
|
36
37
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Node } from "prosemirror-model";
|
|
2
|
-
import { Result } from "better-result";
|
|
2
|
+
import { Result, TaggedErrorClass } from "better-result";
|
|
3
3
|
import * as Y from "yjs";
|
|
4
4
|
//#region src/prosemirror/yjsDocumentMetadata.d.ts
|
|
5
|
+
declare const FolioYjsAttrSchemaVersionErrorBase: TaggedErrorClass<"FolioYjsAttrSchemaVersionError">;
|
|
5
6
|
/**
|
|
6
7
|
* Carry a snapshot written under `version` forward to the next version,
|
|
7
8
|
* rewriting the fragment in place and answering how many paragraphs changed.
|
|
@@ -15,15 +16,15 @@ export type FolioYjsAttrSchemaVersion = (typeof FOLIO_YJS_ATTR_SCHEMA_VERSIONS)[
|
|
|
15
16
|
* The attr-schema version this build writes. Derived against the migration map
|
|
16
17
|
* so the constant and the map cannot disagree.
|
|
17
18
|
*/
|
|
18
|
-
export declare const FOLIO_YJS_ATTR_SCHEMA_VERSION
|
|
19
|
-
declare const
|
|
20
|
-
export declare class FolioYjsNoteReferenceSchemaError extends
|
|
19
|
+
export declare const FOLIO_YJS_ATTR_SCHEMA_VERSION: 14;
|
|
20
|
+
declare const FolioYjsNoteReferenceSchemaErrorBase: TaggedErrorClass<"FolioYjsNoteReferenceSchemaError">;
|
|
21
|
+
export declare class FolioYjsNoteReferenceSchemaError extends FolioYjsNoteReferenceSchemaErrorBase<{
|
|
21
22
|
message: string;
|
|
22
23
|
schemaVersion: FolioYjsAttrSchemaVersion;
|
|
23
24
|
requiredSchemaVersion: FolioYjsAttrSchemaVersion;
|
|
24
25
|
}> {}
|
|
25
|
-
declare const
|
|
26
|
-
export declare class FolioYjsNumberingSourceSchemaError extends
|
|
26
|
+
declare const FolioYjsNumberingSourceSchemaErrorBase: TaggedErrorClass<"FolioYjsNumberingSourceSchemaError">;
|
|
27
|
+
export declare class FolioYjsNumberingSourceSchemaError extends FolioYjsNumberingSourceSchemaErrorBase<{
|
|
27
28
|
message: string;
|
|
28
29
|
schemaVersion: FolioYjsAttrSchemaVersion;
|
|
29
30
|
requiredSchemaVersion: FolioYjsAttrSchemaVersion;
|
|
@@ -49,9 +50,8 @@ export declare const attrSchemaMigrationSteps: (fromVersion: FolioYjsAttrSchemaV
|
|
|
49
50
|
* Returns how many elements the steps rewrote.
|
|
50
51
|
*/
|
|
51
52
|
export declare const applyAttrSchemaMigrations: (ydoc: Y.Doc, fragment: Y.XmlFragment, fromVersion: FolioYjsAttrSchemaVersion) => number;
|
|
52
|
-
declare const FolioYjsAttrSchemaVersionError_base: import("better-result").TaggedErrorClass<"FolioYjsAttrSchemaVersionError">;
|
|
53
53
|
/** Raised when a snapshot's attr-schema marker is ahead of the running code. */
|
|
54
|
-
export declare class FolioYjsAttrSchemaVersionError extends
|
|
54
|
+
export declare class FolioYjsAttrSchemaVersionError extends FolioYjsAttrSchemaVersionErrorBase<{
|
|
55
55
|
message: string;
|
|
56
56
|
/** The marker exactly as stored, so the host can log what it refused. */
|
|
57
57
|
marker: unknown;
|
|
@@ -4,6 +4,7 @@ import { mintSectionProperties, parseSectionBreakType } from "./sectionCarrier.j
|
|
|
4
4
|
import { Result, TaggedError, panic } from "better-result";
|
|
5
5
|
import { DRAWING_RAW_XML_MODES, outlineLevelFromStatedValue, paragraphNumberingFromSlots } from "@stll/docx-core/model";
|
|
6
6
|
//#region src/prosemirror/yjsDocumentMetadata.ts
|
|
7
|
+
const FolioYjsAttrSchemaVersionErrorBase = TaggedError("FolioYjsAttrSchemaVersionError");
|
|
7
8
|
/**
|
|
8
9
|
* Folio's own keys inside a collaboration document: one map, two independent
|
|
9
10
|
* bindings.
|
|
@@ -512,8 +513,10 @@ const ATTR_SCHEMA_MIGRATIONS = {
|
|
|
512
513
|
*/
|
|
513
514
|
const FOLIO_YJS_ATTR_SCHEMA_VERSION = 14;
|
|
514
515
|
const STATED_NUMBERING_SOURCE_SCHEMA_VERSION = 13;
|
|
515
|
-
|
|
516
|
-
var
|
|
516
|
+
const FolioYjsNoteReferenceSchemaErrorBase = TaggedError("FolioYjsNoteReferenceSchemaError");
|
|
517
|
+
var FolioYjsNoteReferenceSchemaError = class extends FolioYjsNoteReferenceSchemaErrorBase {};
|
|
518
|
+
const FolioYjsNumberingSourceSchemaErrorBase = TaggedError("FolioYjsNumberingSourceSchemaError");
|
|
519
|
+
var FolioYjsNumberingSourceSchemaError = class extends FolioYjsNumberingSourceSchemaErrorBase {};
|
|
517
520
|
/** Older snapshots can hold a resolved style reference where a stated override belongs. */
|
|
518
521
|
const requireStatedNumberingSources = (fragment, schemaVersion) => {
|
|
519
522
|
if (schemaVersion >= STATED_NUMBERING_SOURCE_SCHEMA_VERSION) return;
|
|
@@ -601,7 +604,7 @@ const applyAttrSchemaMigrations = (ydoc, fragment, fromVersion) => {
|
|
|
601
604
|
return rewritten;
|
|
602
605
|
};
|
|
603
606
|
/** Raised when a snapshot's attr-schema marker is ahead of the running code. */
|
|
604
|
-
var FolioYjsAttrSchemaVersionError = class extends
|
|
607
|
+
var FolioYjsAttrSchemaVersionError = class extends FolioYjsAttrSchemaVersionErrorBase {};
|
|
605
608
|
const isReadableVersion = (marker) => typeof marker === "number" && Number.isInteger(marker) && marker >= 0 && marker <= 14;
|
|
606
609
|
/**
|
|
607
610
|
* The attr-schema version a collaboration document was written under.
|
package/dist/redline.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { FolioAIEditAppliedOperation, FolioAIEditSkippedOperation } from "./ai-edits/types.js";
|
|
2
2
|
import { FolioDocumentStoryHandle, FolioResolvedReviewedView } from "./ai-edits/headless.js";
|
|
3
3
|
import { FolioDocumentPrivacyOptions, FolioDocumentPrivacyReport } from "./docx/metadataPrivacy.js";
|
|
4
|
+
import { TaggedErrorClass } from "better-result";
|
|
4
5
|
//#region src/redline.d.ts
|
|
6
|
+
declare const GenerateRedlineDocxResourceImportErrorBase: TaggedErrorClass<"GenerateRedlineDocxResourceImportError">;
|
|
7
|
+
declare const InvalidGenerateRedlineDocxOptionsErrorBase: TaggedErrorClass<"InvalidGenerateRedlineDocxOptionsError">;
|
|
5
8
|
/** Options for {@link generateRedlineDocx}. */
|
|
6
9
|
export type GenerateRedlineDocxOptions = {
|
|
7
10
|
/** Author recorded on the generated tracked changes. (default: `"folio compare"`) */
|
|
@@ -13,16 +16,14 @@ export type GenerateRedlineDocxOptions = {
|
|
|
13
16
|
/** Optional output-only package-metadata privacy transforms. */
|
|
14
17
|
privacy?: FolioDocumentPrivacyOptions;
|
|
15
18
|
};
|
|
16
|
-
declare const InvalidGenerateRedlineDocxOptionsError_base: import("better-result").TaggedErrorClass<"InvalidGenerateRedlineDocxOptionsError">;
|
|
17
19
|
/** Raised when a resolved input view is not `"original"` or `"final"`. */
|
|
18
|
-
export declare class InvalidGenerateRedlineDocxOptionsError extends
|
|
20
|
+
export declare class InvalidGenerateRedlineDocxOptionsError extends InvalidGenerateRedlineDocxOptionsErrorBase<{
|
|
19
21
|
message: string;
|
|
20
22
|
option: "baseView" | "revisedView";
|
|
21
23
|
receivedValue: unknown;
|
|
22
24
|
}> {}
|
|
23
|
-
declare const GenerateRedlineDocxResourceImportError_base: import("better-result").TaggedErrorClass<"GenerateRedlineDocxResourceImportError">;
|
|
24
25
|
/** Raised before body operations when revised resources cannot be imported atomically. */
|
|
25
|
-
export declare class GenerateRedlineDocxResourceImportError extends
|
|
26
|
+
export declare class GenerateRedlineDocxResourceImportError extends GenerateRedlineDocxResourceImportErrorBase<{
|
|
26
27
|
message: string;
|
|
27
28
|
detail: string;
|
|
28
29
|
}> {}
|
package/dist/redline.js
CHANGED
|
@@ -24,10 +24,12 @@ import { TaggedError, panic } from "better-result";
|
|
|
24
24
|
*
|
|
25
25
|
* @packageDocumentation
|
|
26
26
|
*/
|
|
27
|
+
const GenerateRedlineDocxResourceImportErrorBase = TaggedError("GenerateRedlineDocxResourceImportError");
|
|
28
|
+
const InvalidGenerateRedlineDocxOptionsErrorBase = TaggedError("InvalidGenerateRedlineDocxOptionsError");
|
|
27
29
|
/** Raised when a resolved input view is not `"original"` or `"final"`. */
|
|
28
|
-
var InvalidGenerateRedlineDocxOptionsError = class extends
|
|
30
|
+
var InvalidGenerateRedlineDocxOptionsError = class extends InvalidGenerateRedlineDocxOptionsErrorBase {};
|
|
29
31
|
/** Raised before body operations when revised resources cannot be imported atomically. */
|
|
30
|
-
var GenerateRedlineDocxResourceImportError = class extends
|
|
32
|
+
var GenerateRedlineDocxResourceImportError = class extends GenerateRedlineDocxResourceImportErrorBase {};
|
|
31
33
|
const nextBaseBlockIdByIndex = (events) => {
|
|
32
34
|
const nextIds = Array.from({ length: events.length });
|
|
33
35
|
let nextId = null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { TaggedErrorClass } from "better-result";
|
|
1
2
|
//#region src/redlineOperationLimit.d.ts
|
|
2
3
|
export declare const MAX_GENERATED_REDLINE_OPERATIONS = 10000;
|
|
3
|
-
declare const
|
|
4
|
-
export declare class GenerateRedlineDocxOperationLimitError extends
|
|
4
|
+
declare const GenerateRedlineDocxOperationLimitErrorBase: TaggedErrorClass<"GenerateRedlineDocxOperationLimitError">;
|
|
5
|
+
export declare class GenerateRedlineDocxOperationLimitError extends GenerateRedlineDocxOperationLimitErrorBase<{
|
|
5
6
|
message: string;
|
|
6
7
|
}> {}
|
|
7
8
|
//#endregion
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TaggedError } from "better-result";
|
|
2
2
|
//#region src/redlineOperationLimit.ts
|
|
3
3
|
const MAX_GENERATED_REDLINE_OPERATIONS = 1e4;
|
|
4
|
-
|
|
4
|
+
const GenerateRedlineDocxOperationLimitErrorBase = TaggedError("GenerateRedlineDocxOperationLimitError");
|
|
5
|
+
var GenerateRedlineDocxOperationLimitError = class extends GenerateRedlineDocxOperationLimitErrorBase {};
|
|
5
6
|
//#endregion
|
|
6
7
|
export { GenerateRedlineDocxOperationLimitError, MAX_GENERATED_REDLINE_OPERATIONS };
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* cannot come to answer differently.
|
|
15
15
|
*/
|
|
16
16
|
/** The painted anchors inside a container, whichever comment they belong to. */
|
|
17
|
-
export declare const COMMENT_ANCHOR_SELECTOR
|
|
17
|
+
export declare const COMMENT_ANCHOR_SELECTOR: "[data-comment-id]";
|
|
18
18
|
/** What a painter, a reader and their test fakes all offer. */
|
|
19
19
|
type CommentAnchor = {
|
|
20
20
|
dataset: Record<string, string | undefined>;
|
package/dist/shaping/shaper.d.ts
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
|
+
import { TaggedErrorClass } from "better-result";
|
|
1
2
|
//#region src/shaping/shaper.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* The boundary to the text shaper.
|
|
4
|
-
*
|
|
5
|
-
* Shaping is the one part of text layout that cannot be derived from code
|
|
6
|
-
* points: Arabic letters take their form from their neighbours, lam-alef
|
|
7
|
-
* ligates, Devanagari reorders and forms conjuncts, Hebrew points hang off the
|
|
8
|
-
* letter they belong to. One implementation answers that question, in Rust, and
|
|
9
|
-
* every caller reaches it through this module: a measurement in CSS pixels and
|
|
10
|
-
* a PDF text matrix scale the same glyph ids and the same advances, so the two
|
|
11
|
-
* cannot describe different text.
|
|
12
|
-
*
|
|
13
|
-
* The artifact is loaded on demand. It carries the OpenType layout engine and
|
|
14
|
-
* the Unicode data that engine needs, and a document in Latin, Cyrillic or
|
|
15
|
-
* Greek needs none of it: `getShaper` is called only once a run in a shaping
|
|
16
|
-
* script is about to be measured or painted, and never before.
|
|
17
|
-
*
|
|
18
|
-
* The same artifact resolves the bidirectional algorithm, because splitting a
|
|
19
|
-
* line into runs that each read one way is what shaping needs first.
|
|
20
|
-
*/
|
|
21
3
|
/** Which way a run advances. Resolved by the producer, never guessed here. */
|
|
22
4
|
export declare const SHAPING_DIRECTION: {
|
|
23
5
|
readonly leftToRight: "ltr";
|
|
@@ -93,8 +75,8 @@ export type Shaper = {
|
|
|
93
75
|
readonly shapeRun: (request: ShapeRunRequest) => ShapedRun;
|
|
94
76
|
readonly resolveBidi: (request: ResolveBidiRequest) => BidiLine;
|
|
95
77
|
};
|
|
96
|
-
declare const
|
|
97
|
-
export declare class ShaperError extends
|
|
78
|
+
declare const ShaperErrorBase: TaggedErrorClass<"ShaperError">;
|
|
79
|
+
export declare class ShaperError extends ShaperErrorBase<{
|
|
98
80
|
message: string;
|
|
99
81
|
cause?: unknown;
|
|
100
82
|
}> {}
|
package/dist/shaping/shaper.js
CHANGED
|
@@ -32,7 +32,8 @@ const BIDI_DIRECTION = {
|
|
|
32
32
|
/** Rules P2 and P3: the first strong character outside an isolate decides. */
|
|
33
33
|
auto: "auto"
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
const ShaperErrorBase = TaggedError("ShaperError");
|
|
36
|
+
var ShaperError = class extends ShaperErrorBase {};
|
|
36
37
|
/**
|
|
37
38
|
* The flat buffer the WebAssembly entry returns:
|
|
38
39
|
* `[unitsPerEm, glyphCount, (glyphId, cluster, xAdvance, yAdvance, xOffset,
|
|
@@ -137,7 +137,7 @@ export declare function createClipboardHandlers(options: {
|
|
|
137
137
|
handlePaste: (event: ClipboardEvent) => void;
|
|
138
138
|
handleKeyDown: (event: KeyboardEvent) => Promise<void>;
|
|
139
139
|
};
|
|
140
|
-
declare const
|
|
140
|
+
declare const _default_1: {
|
|
141
141
|
copyRuns: typeof copyRuns;
|
|
142
142
|
copyParagraphs: typeof copyParagraphs;
|
|
143
143
|
readFromClipboard: typeof readFromClipboard;
|
|
@@ -149,4 +149,4 @@ declare const _default: {
|
|
|
149
149
|
createClipboardHandlers: typeof createClipboardHandlers;
|
|
150
150
|
};
|
|
151
151
|
//#endregion
|
|
152
|
-
export {
|
|
152
|
+
export { _default_1 as default };
|
package/dist/utils/clipboard.js
CHANGED
|
@@ -666,7 +666,7 @@ function createClipboardHandlers(options) {
|
|
|
666
666
|
handleKeyDown
|
|
667
667
|
};
|
|
668
668
|
}
|
|
669
|
-
|
|
669
|
+
const _default_1 = {
|
|
670
670
|
copyRuns,
|
|
671
671
|
copyParagraphs,
|
|
672
672
|
readFromClipboard,
|
|
@@ -678,4 +678,4 @@ var clipboard_default = {
|
|
|
678
678
|
createClipboardHandlers
|
|
679
679
|
};
|
|
680
680
|
//#endregion
|
|
681
|
-
export { CLIPBOARD_TYPES, INTERNAL_CLIPBOARD_TYPE, cleanWordHtml, copyParagraphs, copyRuns, createClipboardHandlers,
|
|
681
|
+
export { CLIPBOARD_TYPES, INTERNAL_CLIPBOARD_TYPE, cleanWordHtml, copyParagraphs, copyRuns, createClipboardHandlers, _default_1 as default, getClipboardImageFiles, getStandaloneClipboardImageFiles, handlePasteEvent, htmlToRuns, isEditorHtml, isWordHtml, paragraphsToClipboardContent, parseClipboardHtml, readFromClipboard, runsToClipboardContent, sanitizeInboundClipboardHtml, writeToClipboard };
|
|
@@ -56,7 +56,7 @@ export type UnderlineDecorationCss = {
|
|
|
56
56
|
* It is also what an underline CSS cannot spell parses back as; see
|
|
57
57
|
* `underlineStyleFromCssDecoration`.
|
|
58
58
|
*/
|
|
59
|
-
export declare const PLAIN_UNDERLINE
|
|
59
|
+
export declare const PLAIN_UNDERLINE: "single";
|
|
60
60
|
/**
|
|
61
61
|
* Every `ST_Underline` member's CSS line. The one table: the ProseMirror mark's
|
|
62
62
|
* `toDOM`, the DOM painter and `textToStyle` all render a run from this, so a
|
|
@@ -5,6 +5,13 @@ import { Node } from "prosemirror-model";
|
|
|
5
5
|
* Information about a heading found in the document.
|
|
6
6
|
*/
|
|
7
7
|
export type HeadingInfo = {
|
|
8
|
+
/**
|
|
9
|
+
* Outline identity within this editing session: the paragraph's `paraId`,
|
|
10
|
+
* which the editor allocates for every body paragraph and which survives
|
|
11
|
+
* edits elsewhere in the document. A paragraph without one, or whose
|
|
12
|
+
* `paraId` an earlier heading already took, is identified by position.
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
8
15
|
/** The text content of the heading */
|
|
9
16
|
text: string;
|
|
10
17
|
/** Outline level (0 = Heading 1, 1 = Heading 2, etc.) */
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { resolveHeadingLevel } from "../docx/builtInStyles.js";
|
|
2
2
|
import { readOutlineLevelAttr } from "../prosemirror/outlineLevelAttr.js";
|
|
3
3
|
//#region src/utils/headingCollector.ts
|
|
4
|
+
/** Not hex, so it cannot collide with a `paraId` Word or the editor writes. */
|
|
5
|
+
const POSITIONAL_HEADING_ID_PREFIX = "pos-";
|
|
4
6
|
const RUN_IN_TITLE_MARKS = /* @__PURE__ */ new Set([
|
|
5
7
|
"bold",
|
|
6
8
|
"italic",
|
|
@@ -56,6 +58,7 @@ const headingText = (paragraph) => {
|
|
|
56
58
|
*/
|
|
57
59
|
function collectHeadings(doc, styles) {
|
|
58
60
|
const headings = [];
|
|
61
|
+
const takenIds = /* @__PURE__ */ new Set();
|
|
59
62
|
doc.descendants((node, pos) => {
|
|
60
63
|
if (node.type.name !== "paragraph") return;
|
|
61
64
|
const level = resolveHeadingLevel({
|
|
@@ -64,7 +67,12 @@ function collectHeadings(doc, styles) {
|
|
|
64
67
|
}, styles);
|
|
65
68
|
if (level === void 0) return;
|
|
66
69
|
const text = headingText(node);
|
|
67
|
-
if (text.trim())
|
|
70
|
+
if (!text.trim()) return;
|
|
71
|
+
const paraId = node.attrs["paraId"];
|
|
72
|
+
const id = typeof paraId === "string" && paraId !== "" && !takenIds.has(paraId) ? paraId : `${POSITIONAL_HEADING_ID_PREFIX}${String(pos)}`;
|
|
73
|
+
takenIds.add(id);
|
|
74
|
+
headings.push({
|
|
75
|
+
id,
|
|
68
76
|
text: text.trim(),
|
|
69
77
|
level,
|
|
70
78
|
pmPos: pos
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HeadingInfo } from "./headingCollector.js";
|
|
2
|
+
import { Layout } from "../layout-engine/types.js";
|
|
3
|
+
//#region src/utils/outlineHeadings.d.ts
|
|
4
|
+
type ResolveOutlineHeadingsOptions = {
|
|
5
|
+
/** Headings collected from the document `layout` was computed from. */
|
|
6
|
+
collected: readonly HeadingInfo[];
|
|
7
|
+
layout: Layout | null;
|
|
8
|
+
previous: HeadingInfo[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The outline's headings with page numbers from `layout`.
|
|
12
|
+
*
|
|
13
|
+
* A heading the layout does not place keeps the page number it last had under
|
|
14
|
+
* the same id, so the outline never shows a transient blank while a layout is
|
|
15
|
+
* pending. An unchanged entry is returned as its previous object and an
|
|
16
|
+
* unchanged list as the previous array, so consumers can skip work by identity.
|
|
17
|
+
*/
|
|
18
|
+
export declare const resolveOutlineHeadings: ({ collected, layout, previous }: ResolveOutlineHeadingsOptions) => HeadingInfo[];
|
|
19
|
+
//#endregion
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { findPageIndexContainingPmPos } from "../layout-engine/pmPageIndex.js";
|
|
2
|
+
//#region src/utils/outlineHeadings.ts
|
|
3
|
+
const sameHeading = (a, b) => Object.values({
|
|
4
|
+
id: a.id === b.id,
|
|
5
|
+
text: a.text === b.text,
|
|
6
|
+
level: a.level === b.level,
|
|
7
|
+
pmPos: a.pmPos === b.pmPos,
|
|
8
|
+
pageNumber: (a.pageNumber ?? null) === (b.pageNumber ?? null)
|
|
9
|
+
}).every(Boolean);
|
|
10
|
+
const layoutPageNumber = (layout, pmPos) => {
|
|
11
|
+
const pageIndex = findPageIndexContainingPmPos(layout, pmPos);
|
|
12
|
+
return pageIndex === null ? null : layout.pages[pageIndex]?.number ?? null;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The outline's headings with page numbers from `layout`.
|
|
16
|
+
*
|
|
17
|
+
* A heading the layout does not place keeps the page number it last had under
|
|
18
|
+
* the same id, so the outline never shows a transient blank while a layout is
|
|
19
|
+
* pending. An unchanged entry is returned as its previous object and an
|
|
20
|
+
* unchanged list as the previous array, so consumers can skip work by identity.
|
|
21
|
+
*/
|
|
22
|
+
const resolveOutlineHeadings = ({ collected, layout, previous }) => {
|
|
23
|
+
const previousById = new Map(previous.map((heading) => [heading.id, heading]));
|
|
24
|
+
let changed = collected.length !== previous.length;
|
|
25
|
+
const next = [];
|
|
26
|
+
for (const [index, heading] of collected.entries()) {
|
|
27
|
+
const before = previousById.get(heading.id);
|
|
28
|
+
const pageNumber = (layout && layoutPageNumber(layout, heading.pmPos)) ?? before?.pageNumber ?? null;
|
|
29
|
+
const resolved = {
|
|
30
|
+
id: heading.id,
|
|
31
|
+
text: heading.text,
|
|
32
|
+
level: heading.level,
|
|
33
|
+
pmPos: heading.pmPos,
|
|
34
|
+
pageNumber
|
|
35
|
+
};
|
|
36
|
+
const kept = before && sameHeading(before, resolved) ? before : resolved;
|
|
37
|
+
if (kept !== previous[index]) changed = true;
|
|
38
|
+
next.push(kept);
|
|
39
|
+
}
|
|
40
|
+
return changed ? next : previous;
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { resolveOutlineHeadings };
|