oasis-editor 0.0.205 → 0.0.207

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.
@@ -1,2 +1,2 @@
1
- export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "insertFootnote", "insertText", "insertEquation", "updateEquation", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "paste", "pasteAsPlainText", "pasteMergeFormatting", "formatPainter", "formatPainterContinuous", "cancelFormatPainter", "bold", "italic", "underline", "strike", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "toggleTrackChanges", "acceptRevisions", "rejectRevisions", "nextRevision", "previousRevision", "nextComment", "previousComment", "newComment", "replyComment", "editComment", "resolveComment", "reopenComment", "deleteComment", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "splitBlock", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "documentStyles", "print", "copy", "cut", "newDocument", "exportDocx", "exportPdf", "importDocument", "insertHtml", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "imageCropShape", "imageCropFill", "imageCropFit", "imageCropReset", "imageBorder", "outdent", "indent", "togglePageBreakBefore", "toggleKeepWithNext", "setSpacingAfter", "setSpacingBefore", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "setLineHeight", "setListFormat", "setListStartAt", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "setPageMargins", "applyDocumentTheme", "setDocumentColorScheme", "setDocumentFontScheme", "setDocumentParagraphSpacing", "setDocumentEffects", "setDocumentPageColor", "setDocumentWatermark", "setDocumentPageBorder", "setDocumentDesignDefault", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableApplyBorderPreset", "toggleTableDrawBorders", "toggleTableGridlines", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellWidth", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape", "openSymbolDialog", "openEquationDialog"];
1
+ export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "insertFootnote", "insertText", "insertEquation", "updateEquation", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "paste", "pasteAsPlainText", "pasteMergeFormatting", "formatPainter", "formatPainterContinuous", "cancelFormatPainter", "bold", "italic", "underline", "strike", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "toggleTrackChanges", "acceptRevisions", "rejectRevisions", "nextRevision", "previousRevision", "nextComment", "previousComment", "newComment", "replyComment", "editComment", "toggleCommentsPanel", "resolveComment", "reopenComment", "deleteComment", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "splitBlock", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "documentStyles", "print", "copy", "cut", "newDocument", "exportDocx", "exportPdf", "importDocument", "insertHtml", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "imageCropShape", "imageCropFill", "imageCropFit", "imageCropReset", "imageBorder", "outdent", "indent", "togglePageBreakBefore", "toggleKeepWithNext", "setSpacingAfter", "setSpacingBefore", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "setLineHeight", "setListFormat", "setListStartAt", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "setPageMargins", "applyDocumentTheme", "setDocumentColorScheme", "setDocumentFontScheme", "setDocumentParagraphSpacing", "setDocumentEffects", "setDocumentPageColor", "setDocumentWatermark", "setDocumentPageBorder", "setDocumentDesignDefault", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableApplyBorderPreset", "toggleTableDrawBorders", "toggleTableGridlines", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellWidth", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape", "openSymbolDialog", "openEquationDialog"];
2
2
  export type OasisBuiltinCommand = (typeof OASIS_BUILTIN_COMMANDS)[number];
@@ -4,6 +4,7 @@ export interface CommentContent {
4
4
  author: string;
5
5
  text: string;
6
6
  date: number;
7
+ authorId?: string;
7
8
  }
8
9
  export interface CommentRange {
9
10
  start: EditorCommentAnchor;
@@ -0,0 +1,17 @@
1
+ import { EditorComment, EditorComments } from '../model.js';
2
+ /** Policy data is owned by core; UI is a consumer, not a dependency. */
3
+ export interface OasisReviewAccess {
4
+ identity?: {
5
+ id: string;
6
+ displayName: string;
7
+ };
8
+ canModerate?: boolean;
9
+ }
10
+ /**
11
+ * Standalone / not configured: legacy local editing remains permissive.
12
+ * Configured: only the trusted, stable host actor ID owns a comment.
13
+ * Imported DOCX author names are presentation data, never proof of identity.
14
+ */
15
+ export declare function canEditReviewComment(access: OasisReviewAccess | undefined, comment: EditorComment | undefined): boolean;
16
+ /** Deleting a thread also deletes its descendants, so verify every author. */
17
+ export declare function canDeleteReviewThread(access: OasisReviewAccess | undefined, registry: EditorComments | undefined, id: string): boolean;
@@ -71,6 +71,7 @@ export interface OasisCommandPayloads {
71
71
  newComment: undefined;
72
72
  replyComment: undefined;
73
73
  editComment: undefined;
74
+ toggleCommentsPanel: undefined;
74
75
  resolveComment: undefined;
75
76
  reopenComment: undefined;
76
77
  deleteComment: undefined;
@@ -0,0 +1,15 @@
1
+ import { EditorReviewActivity, EditorReviewActivityKind, EditorState } from '../model.js';
2
+ /** Only successful comment operations append a record; no UI-side logging. */
3
+ export declare function appendReviewActivity(state: EditorState, activity: EditorReviewActivity): EditorState;
4
+ /** Resolves thread identity safely for arbitrarily nested or cyclic replies. */
5
+ export declare function getReviewThreadId(state: EditorState, commentId: string): string | null;
6
+ /** Append in the same undoable transaction as the changed comment. */
7
+ export declare function appendReviewChange(before: EditorState, after: EditorState, detail: {
8
+ id: string;
9
+ kind: EditorReviewActivityKind;
10
+ commentId: string;
11
+ actorName: string;
12
+ actorId?: string;
13
+ timestamp: number;
14
+ parentId?: string;
15
+ }): EditorState;
@@ -16,11 +16,19 @@ export declare function navigateComment(state: EditorState, direction: "next" |
16
16
  * overlapping comment. Replies without anchors are managed by parent id.
17
17
  */
18
18
  export declare function getSelectedReviewComment(state: EditorState): EditorComment | null;
19
- /** Keep all comment metadata/anchors intact for DOCX round-trip. */
19
+ /**
20
+ * Jump to an anchored comment in the active section/zone. A reply navigates
21
+ * to its closest anchored ancestor, without changing document text.
22
+ */
23
+ export declare function focusReviewCommentById(state: EditorState, id: string): EditorState;
24
+ export declare function setReviewCommentResolvedById(state: EditorState, id: string, resolved: boolean): EditorState;
25
+ /** The selected-comment actions share the same immutable ID based mutations. */
20
26
  export declare function setSelectedCommentResolved(state: EditorState, resolved: boolean): EditorState;
21
27
  /**
22
- * Deleting a parent thread deletes all its descendants, preventing dangling
23
- * parentId pointers in commentsExtended.xml.
28
+ * Remove a discussion and all descendants; never leave orphaned parent ids.
29
+ * This pure model operation intentionally has no knowledge of authenticated
30
+ * users: the editor command host must check permissions before invoking it.
24
31
  */
32
+ export declare function deleteReviewCommentById(state: EditorState, id: string): EditorState;
25
33
  export declare function deleteSelectedComment(state: EditorState): EditorState;
26
34
  export {};
@@ -1,5 +1,5 @@
1
1
  import { EditorBlockNode, EditorFootnote, EditorParagraphNode, EditorTableCellNode, EditorTableNode, EditorTableRowNode, EditorTextRun, EditorTextStyle, EditorTextBoxData, EditorImageRunData } from '../model.js';
2
- export type EditorNodeKind = "document" | "paragraph" | "run" | "table" | "table-row" | "table-cell" | "footnote" | "bookmark" | "comment" | "sdt";
2
+ export type EditorNodeKind = "document" | "paragraph" | "run" | "table" | "table-row" | "table-cell" | "footnote" | "bookmark" | "comment" | "review-activity" | "sdt";
3
3
  /**
4
4
  * Single authority for editor node IDs. Stateless and globally unique, so two
5
5
  * editors mounted on the same page never share a sequence. The `kind` prefix is
@@ -17,6 +17,7 @@ export type { EditorFootnote } from './types/documentFootnotes.js';
17
17
  export type { EditorEndnote } from './types/documentEndnotes.js';
18
18
  export type { EditorBookmark, EditorBookmarkAnchor, EditorBookmarks, } from './types/documentBookmarks.js';
19
19
  export type { EditorComment, EditorCommentAnchor, EditorComments, } from './types/documentComments.js';
20
+ export type { EditorReviewActivity, EditorReviewActivityKind, } from './types/documentReviewActivity.js';
20
21
  export type { EditorOpcPartKind, EditorOpcPartEncoding, EditorOpcRelationship, EditorOpcContentTypes, EditorOpcPart, EditorDocxDiagnostic, EditorDocxSourcePackage, } from './types/docxSourcePackage.js';
21
22
  export type { EditorPageMargins, EditorPageSettings, EditorColumnsSettings, EditorSection, EditorSectionBreakType, EditorSectionPropertiesSnapshot, EditorPageNumbering, EditorSectionVerticalAlign, EditorFontInfo, EditorFootnoteSettings, EditorFootnotes, EditorEndnoteSettings, EditorEndnotes, EditorDocumentDesign, EditorThemeData, EditorWatermark, EditorPageBorder, EditorDocument, } from './types/document.js';
22
23
  export type { EditorPosition, EditorSelection, EditorEditingZone, } from './types/selection.js';
@@ -4,6 +4,7 @@ import { EditorFootnote } from './documentFootnotes.js';
4
4
  import { EditorEndnote } from './documentEndnotes.js';
5
5
  import { EditorBookmarks } from './documentBookmarks.js';
6
6
  import { EditorComments } from './documentComments.js';
7
+ import { EditorReviewActivity } from './documentReviewActivity.js';
7
8
  import { EditorNamedStyle } from './styles.js';
8
9
  import { EditorDocxSourcePackage } from './docxSourcePackage.js';
9
10
  export interface EditorPageMargins {
@@ -238,6 +239,11 @@ export interface EditorDocument {
238
239
  * body shown in a hover/click popup.
239
240
  */
240
241
  comments?: EditorComments;
242
+ /**
243
+ * Local review activity for the editor document. Not a DOCX comment part,
244
+ * authenticated server audit, or immutable event log. Part of undo/redo.
245
+ */
246
+ reviewActivity?: EditorReviewActivity[];
241
247
  /**
242
248
  * `word/fontTable.xml` entries: the fonts the document declares, with
243
249
  * substitution metadata. Preserved on import and re-emitted on export.
@@ -30,6 +30,11 @@ export interface EditorComment {
30
30
  docxIdHint?: number;
31
31
  /** `w:comment/@w:author`. */
32
32
  author: string;
33
+ /**
34
+ * Application-local stable author identity. DOCX stores only display names;
35
+ * this field is not silently reconstructed from a DOCX author on import.
36
+ */
37
+ authorId?: string;
33
38
  /** `w:comment/@w:initials`. */
34
39
  initials?: string;
35
40
  /** `w:comment/@w:date` as an epoch millisecond timestamp. */
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Local review timeline entries, created on successful comment mutations.
3
+ * These are transaction-scoped editor data and are intentionally not emitted
4
+ * as WordprocessingML. The host can persist/export them separately if needed.
5
+ */
6
+ export type EditorReviewActivityKind = "comment-created" | "comment-replied" | "comment-edited" | "comment-resolved" | "comment-reopened" | "comment-deleted";
7
+ export interface EditorReviewActivity {
8
+ id: string;
9
+ kind: EditorReviewActivityKind;
10
+ commentId: string;
11
+ /** Immediate parent when a reply is created. */
12
+ parentId?: string;
13
+ /** Stable root discussion id, even if subsequently removed. */
14
+ threadId: string;
15
+ actorName: string;
16
+ actorId?: string;
17
+ /** Snapshot label survives deletion without copying the comment body. */
18
+ targetAuthor: string;
19
+ timestamp: number;
20
+ /** Number of comments deleted with the selected subtree. */
21
+ affectedCount?: number;
22
+ }