superdoc 2.6.1-next.3 → 2.7.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/chunks/{create-super-doc-ui-DCjm-_Xo.es.js → create-super-doc-ui-BTNVc3UD.es.js} +7 -3
  2. package/dist/chunks/{create-super-doc-ui-CwCvqMOa.cjs → create-super-doc-ui-C44xPZxz.cjs} +7 -3
  3. package/dist/collaboration-upgrade-engine.cjs +1 -1
  4. package/dist/collaboration-upgrade-engine.es.js +1 -1
  5. package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
  6. package/dist/document-api/src/contract/operation-definitions.d.ts +9 -0
  7. package/dist/document-api/src/contract/operation-registry.d.ts +7 -1
  8. package/dist/document-api/src/contract/sd-fragment-schema.d.ts +4 -0
  9. package/dist/document-api/src/html-to-fragment/html-to-fragment.d.ts +8 -0
  10. package/dist/document-api/src/index.d.ts +13 -5
  11. package/dist/document-api/src/insert/insert.d.ts +1 -2
  12. package/dist/document-api/src/receipt-bridge.d.ts +24 -3
  13. package/dist/document-api/src/replace/replace.d.ts +14 -2
  14. package/dist/document-api/src/types/clipboard.d.ts +69 -6
  15. package/dist/document-api/src/types/fragment.d.ts +1 -1
  16. package/dist/document-api/src/types/index.d.ts +1 -0
  17. package/dist/document-api/src/types/mutation-plan.types.d.ts +3 -0
  18. package/dist/document-api/src/types/receipt.d.ts +4 -0
  19. package/dist/document-api/src/types/sd-contract.d.ts +57 -3
  20. package/dist/document-api/src/types/sd-nodes.d.ts +9 -1
  21. package/dist/document-api/src/write/write.d.ts +1 -1
  22. package/dist/public/ui-react.cjs +1 -1
  23. package/dist/public/ui-react.es.js +1 -1
  24. package/dist/public/ui.cjs +1 -1
  25. package/dist/public/ui.es.js +1 -1
  26. package/dist/superdoc/src/helpers/v2-review-mutation-impact.d.ts +2 -3
  27. package/dist/superdoc.cjs +2 -2
  28. package/dist/superdoc.es.js +2 -2
  29. package/dist-cdn/superdoc.min.js +3 -3
  30. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  import { BlockNodeAddress } from './base.js';
2
2
  import { SelectionTarget, TextAddress } from './address.js';
3
- import { ReceiptEffects, TextMutationRange } from './receipt.js';
3
+ import { ReceiptEffects, ReceiptSuccess, TextMutationRange } from './receipt.js';
4
4
  export type SDErrorCode = 'INVALID_PAYLOAD' | 'INVALID_TARGET' | 'TARGET_NOT_FOUND' | 'ADDRESS_STALE' | 'PRECONDITION_FAILED' | 'REVISION_MISMATCH' | 'INVALID_CONTEXT' | 'INVALID_NESTING' | 'INVALID_PLACEMENT' | 'DUPLICATE_ID' | 'CAPABILITY_UNSUPPORTED' | 'RAW_MODE_REQUIRED' | 'PRESERVE_ONLY_VIOLATION' | 'NO_OP' | 'UNSUPPORTED_ENVIRONMENT' | 'INTERNAL_ERROR';
5
5
  export interface SDError {
6
6
  code: SDErrorCode;
@@ -24,6 +24,16 @@ export interface SDMutationReceipt {
24
24
  before: string;
25
25
  after: string;
26
26
  };
27
+ id?: ReceiptSuccess['id'];
28
+ inserted?: ReceiptSuccess['inserted'];
29
+ updated?: ReceiptSuccess['updated'];
30
+ removed?: ReceiptSuccess['removed'];
31
+ invalidatedRefs?: ReceiptSuccess['invalidatedRefs'];
32
+ remappedRefs?: ReceiptSuccess['remappedRefs'];
33
+ affectedStories?: ReceiptSuccess['affectedStories'];
34
+ textRangeShifts?: ReceiptSuccess['textRangeShifts'];
35
+ txId?: ReceiptSuccess['txId'];
36
+ warnings?: ReceiptSuccess['warnings'];
27
37
  resolution?: {
28
38
  target: MutationResolutionTarget;
29
39
  /** Engine-resolved absolute document range for the effective target. */
@@ -40,15 +50,59 @@ export interface SDMutationReceipt {
40
50
  * read it here instead. See {@link ReceiptEffects}.
41
51
  */
42
52
  effects?: ReceiptEffects;
53
+ conversion?: SDMutationConversionReport;
54
+ }
55
+ export declare const SD_CONVERSION_FORMATS: readonly ["html", "markdown"];
56
+ export type SDConversionFormat = (typeof SD_CONVERSION_FORMATS)[number];
57
+ export declare const SD_CONVERSION_DIAGNOSTIC_CODES: readonly ["conversion-normalized-construct", "conversion-unsupported-construct", "conversion-dropped-style", "conversion-unsafe-content", "conversion-unsafe-url", "conversion-source-limit-exceeded", "conversion-depth-limit-exceeded", "conversion-malformed-input", "conversion-empty-result"];
58
+ export type SDConversionDiagnosticCode = (typeof SD_CONVERSION_DIAGNOSTIC_CODES)[number];
59
+ /** Stable feature identifiers used to classify conversion diagnostics. */
60
+ export declare const SD_CONVERSION_CONSTRUCTS: readonly ["document", "source", "text", "paragraph", "emptyParagraph", "softBreak", "lineBreak", "heading", "bold", "italic", "underline", "strike", "hyperlink", "list", "table", "tableHeader", "colSpan", "rowSpan", "horizontalRule", "inlineCode", "codeBlock", "blockquote", "taskList", "image", "footnote", "rawHtml", "unknownWrapper", "script", "style", "eventHandler"];
61
+ export type SDConversionConstruct = (typeof SD_CONVERSION_CONSTRUCTS)[number];
62
+ export declare const SD_CONVERSION_DISPOSITIONS: readonly ["preserved", "normalized", "downgraded", "dropped", "rejected"];
63
+ export type SDConversionDisposition = (typeof SD_CONVERSION_DISPOSITIONS)[number];
64
+ /** UTF-16 offsets are start-inclusive and end-exclusive. */
65
+ export interface SDConversionSourceRange {
66
+ startOffset: number;
67
+ endOffset: number;
68
+ startLine?: number;
69
+ startColumn?: number;
70
+ endLine?: number;
71
+ endColumn?: number;
72
+ }
73
+ export interface SDConversionSource {
74
+ format: SDConversionFormat;
75
+ range?: SDConversionSourceRange;
43
76
  }
44
77
  export interface SDDiagnostic {
45
78
  code: string;
46
79
  severity: 'error' | 'warning' | 'info';
47
80
  message: string;
48
81
  path?: Array<string | number>;
82
+ construct?: SDConversionConstruct;
83
+ disposition?: SDConversionDisposition;
84
+ lossy?: boolean;
85
+ source?: SDConversionSource;
86
+ }
87
+ /** Diagnostic shape guaranteed by the canonical HTML/Markdown converters. */
88
+ export interface SDConversionDiagnostic extends SDDiagnostic {
89
+ code: SDConversionDiagnosticCode;
90
+ construct: SDConversionConstruct;
91
+ disposition: SDConversionDisposition;
92
+ lossy: boolean;
93
+ source: SDConversionSource;
49
94
  }
50
- export interface SDMarkdownToFragmentResult {
95
+ export interface SDMutationConversionReport {
96
+ format: SDConversionFormat;
97
+ lossy: boolean;
98
+ diagnostics: SDConversionDiagnostic[];
99
+ }
100
+ export interface SDContentToFragmentResult<TDiagnostic extends SDDiagnostic = SDDiagnostic> {
51
101
  fragment: import('./fragment.js').SDFragment;
52
102
  lossy: boolean;
53
- diagnostics: SDDiagnostic[];
103
+ diagnostics: TDiagnostic[];
104
+ }
105
+ export type SDHtmlToFragmentResult = SDContentToFragmentResult<SDConversionDiagnostic>;
106
+ /** Existing Markdown adapters may continue returning base diagnostics. */
107
+ export interface SDMarkdownToFragmentResult extends SDContentToFragmentResult<SDDiagnostic> {
54
108
  }
@@ -74,6 +74,8 @@ export interface SDTableCell {
74
74
  props?: SDCellProps;
75
75
  colSpan?: number;
76
76
  rowSpan?: number;
77
+ /** Marks a semantic table header cell. */
78
+ header?: boolean;
77
79
  content: SDContentNode[];
78
80
  }
79
81
  export interface SDTable extends SDNodeBase {
@@ -164,6 +166,12 @@ export interface SDBreak extends SDNodeBase {
164
166
  type: 'page' | 'column';
165
167
  };
166
168
  }
169
+ /** A semantic horizontal rule; the destination chooses its durable representation. */
170
+ export interface SDHorizontalRule {
171
+ id?: string;
172
+ kind: 'horizontalRule';
173
+ horizontalRule: Record<string, never>;
174
+ }
167
175
  export interface SDSectionBreak extends SDNodeBase {
168
176
  kind: 'sectionBreak';
169
177
  sectionBreak: {
@@ -371,5 +379,5 @@ export interface SDExtInlineNode extends SDNodeBase {
371
379
  kind: `ext.${string}`;
372
380
  [key: string]: unknown;
373
381
  }
374
- export type SDContentNode = SDParagraph | SDHeading | SDList | SDTable | SDToc | SDDocumentIndex | SDBibliography | SDTableOfAuthorities | SDBreak | SDSectionBreak | SDSectPr | SDImage | SDDrawing | SDSdt | SDCustomXml | SDAltChunk | SDMath | SDField | SDExtContentNode;
382
+ export type SDContentNode = SDParagraph | SDHeading | SDList | SDTable | SDToc | SDDocumentIndex | SDBibliography | SDTableOfAuthorities | SDBreak | SDHorizontalRule | SDSectionBreak | SDSectPr | SDImage | SDDrawing | SDSdt | SDCustomXml | SDAltChunk | SDMath | SDField | SDExtContentNode;
375
383
  export type SDInlineNode = SDRun | SDHyperlink | SDCrossRef | SDIndexEntry | SDSequenceField | SDCitation | SDAuthorityEntry | SDTocEntry | SDImage | SDDrawing | SDSdt | SDCustomXml | SDMath | SDField | SDTab | SDLineBreak | SDFootnoteRef | SDEndnoteRef | SDExtInlineNode;
@@ -66,7 +66,7 @@ export interface WriteAdapter {
66
66
  write(request: InsertWriteRequest, options?: MutationOptions): TextMutationReceipt;
67
67
  /** Structured insert for SDFragment or markdown/html content. Returns SDMutationReceipt. */
68
68
  insertStructured(input: InsertInput, options?: MutationOptions): SDMutationReceipt;
69
- /** Structured replace for SDFragment content. Returns SDMutationReceipt. */
69
+ /** Structured replace for SDFragment or markdown/html content. Returns SDMutationReceipt. */
70
70
  replaceStructured(input: ReplaceInput, options?: MutationOptions): SDMutationReceipt;
71
71
  }
72
72
  export declare function normalizeMutationOptions(options?: MutationOptions): MutationOptions;
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CwCvqMOa.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C44xPZxz.cjs");
3
3
  let react = require("react");
4
4
  //#region src/public/ui/react.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-DCjm-_Xo.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BTNVc3UD.es.js";
2
2
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
3
3
  //#region src/public/ui/react.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CwCvqMOa.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C44xPZxz.cjs");
3
3
  exports.BUILT_IN_COMMAND_IDS = require_create_super_doc_ui.BUILT_IN_COMMAND_IDS;
4
4
  exports.createSuperDocUI = require_create_super_doc_ui.createSuperDocUI;
5
5
  exports.shallowEqual = require_create_super_doc_ui.shallowEqual;
@@ -1,2 +1,2 @@
1
- import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-DCjm-_Xo.es.js";
1
+ import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-BTNVc3UD.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
@@ -2,9 +2,8 @@
2
2
  * Classify the tracked-change identities carried by a v2 mutation event.
3
3
  *
4
4
  * Receipt entities are the durable invalidation contract between the document
5
- * kernel and derived review UI. Consumers apply removals/remaps locally; the
6
- * next committed window supplies surviving or restored rows. History follows
7
- * the same bounded path and never enumerates invisible review identities.
5
+ * kernel and derived review UI. Direct receipts carry entity refs; mutation
6
+ * plans carry the same identities through `trackedChanges` and per-step ids.
8
7
  */
9
8
  export function getV2TrackedChangeMutationImpact(event: any): {
10
9
  allResolved?: any;
package/dist/superdoc.cjs CHANGED
@@ -4,7 +4,7 @@ const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
4
4
  const require_eventemitter3 = require("./chunks/eventemitter3-D38u8ta_.cjs");
5
5
  const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
6
6
  const require_jszip = require("./chunks/jszip-RC64TPzL.cjs");
7
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-CwCvqMOa.cjs");
7
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-C44xPZxz.cjs");
8
8
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-SDR04tiH.cjs");
9
9
  const require_constants = require("./chunks/constants-DpXuDx_g.cjs");
10
10
  let vue = require("vue");
@@ -43606,7 +43606,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
43606
43606
  this.config.colors = shuffleArray(this.config.colors);
43607
43607
  this.userColorMap = /* @__PURE__ */ new Map();
43608
43608
  this.colorIndex = 0;
43609
- this.version = "2.6.1-next.3";
43609
+ this.version = "2.7.0-next.2";
43610
43610
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43611
43611
  this.superdocId = config.superdocId || require_uuid.v4();
43612
43612
  this.colors = this.config.colors ?? [];
@@ -3,7 +3,7 @@ import { t as blank_default } from "./chunks/blank-docx-DzQccOlW.es.js";
3
3
  import { t as import_eventemitter3 } from "./chunks/eventemitter3-CMOjDs74.es.js";
4
4
  import { t as v4 } from "./chunks/uuid-H0Xcmmhy.es.js";
5
5
  import { a as init_dist$1, i as global, n as init_dist$2, o as Buffer, r as process$1, s as init_dist, t as require_jszip_min } from "./chunks/jszip-VxCFV9YS.es.js";
6
- import { a as DOM_CLASS_NAMES, i as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-DCjm-_Xo.es.js";
6
+ import { a as DOM_CLASS_NAMES, i as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-BTNVc3UD.es.js";
7
7
  import { t as _plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-BOaGB7Aw.es.js";
8
8
  import { t as PDF_TO_CSS_UNITS } from "./chunks/constants-B6VBlmKp.es.js";
9
9
  import * as Vue from "vue";
@@ -43539,7 +43539,7 @@ var SuperDoc = class extends import_eventemitter3.default {
43539
43539
  this.config.colors = shuffleArray(this.config.colors);
43540
43540
  this.userColorMap = /* @__PURE__ */ new Map();
43541
43541
  this.colorIndex = 0;
43542
- this.version = "2.6.1-next.3";
43542
+ this.version = "2.7.0-next.2";
43543
43543
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43544
43544
  this.superdocId = config.superdocId || v4();
43545
43545
  this.colors = this.config.colors ?? [];