@harbour-enterprises/superdoc 1.17.0-next.10 → 1.17.0-next.12

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 (24) hide show
  1. package/dist/chunks/{SuperConverter-CqDsHOKA.es.js → SuperConverter-B8jWQriR.es.js} +1 -1
  2. package/dist/chunks/{SuperConverter-BQs6tZ2x.cjs → SuperConverter-BSNvGA-_.cjs} +1 -1
  3. package/dist/chunks/{src-C4SehkH8.es.js → src-BI6hYDgO.es.js} +150 -9
  4. package/dist/chunks/{src-_k0ahqT1.cjs → src-D6cAnOaK.cjs} +156 -8
  5. package/dist/style.css +25 -21
  6. package/dist/super-editor/converter.cjs +1 -1
  7. package/dist/super-editor/converter.es.js +1 -1
  8. package/dist/super-editor/src/document-api-adapters/assemble-adapters.d.ts.map +1 -1
  9. package/dist/super-editor/src/document-api-adapters/capabilities-adapter.d.ts.map +1 -1
  10. package/dist/super-editor/src/document-api-adapters/errors.d.ts +1 -1
  11. package/dist/super-editor/src/document-api-adapters/errors.d.ts.map +1 -1
  12. package/dist/super-editor/src/document-api-adapters/helpers/node-address-resolver.d.ts +12 -0
  13. package/dist/super-editor/src/document-api-adapters/helpers/node-address-resolver.d.ts.map +1 -1
  14. package/dist/super-editor/src/document-api-adapters/index.d.ts.map +1 -1
  15. package/dist/super-editor/src/document-api-adapters/plan-engine/blocks-wrappers.d.ts +4 -0
  16. package/dist/super-editor/src/document-api-adapters/plan-engine/blocks-wrappers.d.ts.map +1 -0
  17. package/dist/super-editor/src/document-api-adapters/plan-engine/executor.d.ts.map +1 -1
  18. package/dist/super-editor.cjs +2 -2
  19. package/dist/super-editor.es.js +2 -2
  20. package/dist/superdoc.cjs +92 -63
  21. package/dist/superdoc.es.js +92 -63
  22. package/dist/superdoc.umd.js +273 -102
  23. package/dist/superdoc.umd.js.map +1 -1
  24. package/package.json +1 -1
@@ -33839,7 +33839,7 @@ var SuperConverter = class SuperConverter {
33839
33839
  static getStoredSuperdocVersion(docx) {
33840
33840
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33841
33841
  }
33842
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.17.0-next.10") {
33842
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.17.0-next.12") {
33843
33843
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33844
33844
  }
33845
33845
  static generateWordTimestamp() {
@@ -33853,7 +33853,7 @@ var SuperConverter = class SuperConverter {
33853
33853
  static getStoredSuperdocVersion(docx) {
33854
33854
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33855
33855
  }
33856
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.17.0-next.10") {
33856
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.17.0-next.12") {
33857
33857
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33858
33858
  }
33859
33859
  static generateWordTimestamp() {
@@ -1,5 +1,5 @@
1
1
  import { a as __toCommonJS, n as __esmMin, r as __export, t as __commonJSMin } from "./rolldown-runtime-B2q5OVn9.es.js";
2
- import { $ as TextSelection$1, A as findMark, At as Mark$1, B as defaultBlockAt$1, C as docxNumberingHelpers, Ct as TrackDeleteMarkName, D as posToDOMRect, Dt as DOMParser$1, E as isInTable, Et as carbonCopy, F as isMarkActive, Ft as getExtensionConfigField, G as createDocument, H as getNodeType, I as getMarkRange, J as NodeSelection, K as AllSelection, L as isTextSelection, M as isActive, Mt as Slice, N as isNodeActive, Nt as minMax, O as findChildren$1, Ot as DOMSerializer, P as getSchemaTypeNameByName, Pt as callOrGet, Q as SelectionRange, R as findParentNode, S as getResolvedParagraphProperties, St as getUnderlineCssString, T as CommandService, Tt as TrackInsertMarkName, U as cleanSchemaItem, V as getMarkType, W as getSchemaTypeByName, X as PluginKey, Y as Plugin, Z as Selection, _ as ListHelpers, _t as encodeMarksFromRPr, a as _getReferencedTableStyles, at as Transform, b as isList, bt as resolveRunProperties, c as processContent, ct as dropPoint, d as createCellBorders, dt as replaceStep$1, et as AddMarkStep, f as InputRule, ft as generateDocxRandomId, g as unflattenListsInHtml, gt as encodeCSSFromRPr, h as inputRulesPlugin, ht as encodeCSSFromPPr, it as ReplaceStep, j as getMarksFromSelection, jt as Schema$1, k as getActiveFormatting, kt as Fragment$1, l as createDocFromMarkdown, lt as joinPoint, m as htmlHandler, mt as decodeRPrFromMarks, n as kebabCase$1, nt as RemoveMarkStep, o as helpers_exports, ot as canJoin, p as handleClipboardPaste, pt as generateRandomSigned32BitIntStrId, q as EditorState, r as insertNewRelationship, rt as ReplaceAroundStep$1, s as updateDOMAttributes, st as canSplit, t as SuperConverter, tt as Mapping, u as createDocFromHTML, ut as liftTarget, v as changeListLevel, vt as resolveDocxFontFamily, w as generateOrderedListIndex, wt as TrackFormatMarkName, x as calculateResolvedParagraphProperties, xt as resolveTableCellProperties, y as updateNumberingProperties, yt as resolveParagraphProperties, z as findParentNodeClosestToPos } from "./SuperConverter-CqDsHOKA.es.js";
2
+ import { $ as TextSelection$1, A as findMark, At as Mark$1, B as defaultBlockAt$1, C as docxNumberingHelpers, Ct as TrackDeleteMarkName, D as posToDOMRect, Dt as DOMParser$1, E as isInTable, Et as carbonCopy, F as isMarkActive, Ft as getExtensionConfigField, G as createDocument, H as getNodeType, I as getMarkRange, J as NodeSelection, K as AllSelection, L as isTextSelection, M as isActive, Mt as Slice, N as isNodeActive, Nt as minMax, O as findChildren$1, Ot as DOMSerializer, P as getSchemaTypeNameByName, Pt as callOrGet, Q as SelectionRange, R as findParentNode, S as getResolvedParagraphProperties, St as getUnderlineCssString, T as CommandService, Tt as TrackInsertMarkName, U as cleanSchemaItem, V as getMarkType, W as getSchemaTypeByName, X as PluginKey, Y as Plugin, Z as Selection, _ as ListHelpers, _t as encodeMarksFromRPr, a as _getReferencedTableStyles, at as Transform, b as isList, bt as resolveRunProperties, c as processContent, ct as dropPoint, d as createCellBorders, dt as replaceStep$1, et as AddMarkStep, f as InputRule, ft as generateDocxRandomId, g as unflattenListsInHtml, gt as encodeCSSFromRPr, h as inputRulesPlugin, ht as encodeCSSFromPPr, it as ReplaceStep, j as getMarksFromSelection, jt as Schema$1, k as getActiveFormatting, kt as Fragment$1, l as createDocFromMarkdown, lt as joinPoint, m as htmlHandler, mt as decodeRPrFromMarks, n as kebabCase$1, nt as RemoveMarkStep, o as helpers_exports, ot as canJoin, p as handleClipboardPaste, pt as generateRandomSigned32BitIntStrId, q as EditorState, r as insertNewRelationship, rt as ReplaceAroundStep$1, s as updateDOMAttributes, st as canSplit, t as SuperConverter, tt as Mapping, u as createDocFromHTML, ut as liftTarget, v as changeListLevel, vt as resolveDocxFontFamily, w as generateOrderedListIndex, wt as TrackFormatMarkName, x as calculateResolvedParagraphProperties, xt as resolveTableCellProperties, y as updateNumberingProperties, yt as resolveParagraphProperties, z as findParentNodeClosestToPos } from "./SuperConverter-B8jWQriR.es.js";
3
3
  import { a as init_dist$2, i as global, n as init_dist, o as Buffer$3, r as process$1, s as init_dist$1 } from "./jszip-ChlR43oI.es.js";
4
4
  import { t as v4_default } from "./uuid-2IzDu5nl.es.js";
5
5
  import { A as resolveOpcTargetPath, E as pixelsToTwips, F as twipsToLines, I as twipsToPixels, P as twipsToInches, _ as halfPointToPoints, c as convertSizeToCSS, k as ptToTwips, p as getArrayBufferFromUrl, t as COMMENT_FILE_BASENAMES, v as inchesToPixels, x as linesToTwips, y as inchesToTwips } from "./constants-DBKi0Amm.es.js";
@@ -260,7 +260,7 @@ var v_click_outside_default = {
260
260
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
261
261
  function getSuperdocVersion() {
262
262
  try {
263
- return "1.17.0-next.10";
263
+ return "1.17.0-next.12";
264
264
  } catch {
265
265
  return "unknown";
266
266
  }
@@ -20715,7 +20715,7 @@ const canUseDOM = () => {
20715
20715
  return false;
20716
20716
  }
20717
20717
  };
20718
- var summaryVersion = "1.17.0-next.10";
20718
+ var summaryVersion = "1.17.0-next.12";
20719
20719
  var nodeKeys = [
20720
20720
  "group",
20721
20721
  "content",
@@ -21093,6 +21093,13 @@ const BLOCK_NODE_TYPES = [
21093
21093
  "image",
21094
21094
  "sdt"
21095
21095
  ];
21096
+ const DELETABLE_BLOCK_NODE_TYPES = [
21097
+ "paragraph",
21098
+ "heading",
21099
+ "listItem",
21100
+ "table",
21101
+ "sdt"
21102
+ ];
21096
21103
  const INLINE_NODE_TYPES = [
21097
21104
  "run",
21098
21105
  "bookmark",
@@ -21281,6 +21288,27 @@ const OPERATION_DEFINITIONS = {
21281
21288
  referenceDocPath: "delete.mdx",
21282
21289
  referenceGroup: "core"
21283
21290
  },
21291
+ "blocks.delete": {
21292
+ memberPath: "blocks.delete",
21293
+ description: "Delete an entire block node (paragraph, heading, list item, table, image, or sdt) deterministically.",
21294
+ requiresDocumentContext: true,
21295
+ metadata: mutationOperation({
21296
+ idempotency: "conditional",
21297
+ supportsDryRun: true,
21298
+ supportsTrackedMode: false,
21299
+ possibleFailureCodes: NONE_FAILURES,
21300
+ throws: [
21301
+ "TARGET_NOT_FOUND",
21302
+ "AMBIGUOUS_TARGET",
21303
+ "CAPABILITY_UNAVAILABLE",
21304
+ "INVALID_TARGET",
21305
+ "INVALID_INPUT",
21306
+ "INTERNAL_ERROR"
21307
+ ]
21308
+ }),
21309
+ referenceDocPath: "blocks/delete.mdx",
21310
+ referenceGroup: "blocks"
21311
+ },
21284
21312
  "format.apply": {
21285
21313
  memberPath: "format.apply",
21286
21314
  description: "Apply explicit inline style changes (bold, italic, underline, strike) to the target range using boolean patch semantics.",
@@ -21855,6 +21883,7 @@ function ref$1(name) {
21855
21883
  }
21856
21884
  var nodeTypeValues = NODE_TYPES;
21857
21885
  var blockNodeTypeValues = BLOCK_NODE_TYPES;
21886
+ var deletableBlockNodeTypeValues = DELETABLE_BLOCK_NODE_TYPES;
21858
21887
  var inlineNodeTypeValues = INLINE_NODE_TYPES;
21859
21888
  objectSchema({
21860
21889
  start: { type: "integer" },
@@ -21891,6 +21920,14 @@ objectSchema({
21891
21920
  "kind",
21892
21921
  "nodeType",
21893
21922
  "nodeId"
21923
+ ]), objectSchema({
21924
+ kind: { const: "block" },
21925
+ nodeType: { enum: [...deletableBlockNodeTypeValues] },
21926
+ nodeId: { type: "string" }
21927
+ }, [
21928
+ "kind",
21929
+ "nodeType",
21930
+ "nodeId"
21894
21931
  ]), objectSchema({
21895
21932
  kind: { const: "block" },
21896
21933
  nodeType: { const: "paragraph" },
@@ -22042,6 +22079,7 @@ ref$1("TargetKind");
22042
22079
  var textAddressSchema = ref$1("TextAddress");
22043
22080
  var textTargetSchema = ref$1("TextTarget");
22044
22081
  var blockNodeAddressSchema = ref$1("BlockNodeAddress");
22082
+ var deletableBlockNodeAddressSchema = ref$1("DeletableBlockNodeAddress");
22045
22083
  var paragraphAddressSchema = ref$1("ParagraphAddress");
22046
22084
  var headingAddressSchema = ref$1("HeadingAddress");
22047
22085
  var listItemAddressSchema = ref$1("ListItemAddress");
@@ -22412,6 +22450,7 @@ discoveryResultSchema(discoveryItemSchema({
22412
22450
  }, ["address", "type"]));
22413
22451
  var capabilityReasonsSchema = arraySchema({ enum: [
22414
22452
  "COMMAND_UNAVAILABLE",
22453
+ "HELPER_UNAVAILABLE",
22415
22454
  "OPERATION_UNAVAILABLE",
22416
22455
  "TRACKED_MODE_UNAVAILABLE",
22417
22456
  "DRY_RUN_UNAVAILABLE",
@@ -22501,7 +22540,13 @@ objectSchema({
22501
22540
  }, ["target", "value"]), textMutationResultSchemaFor("format.color"), textMutationFailureSchemaFor("format.color"), objectSchema({
22502
22541
  target: textAddressSchema,
22503
22542
  alignment: { oneOf: [{ enum: [...ALIGNMENTS] }, { type: "null" }] }
22504
- }, ["target", "alignment"]), textMutationResultSchemaFor("format.align"), textMutationFailureSchemaFor("format.align"), objectSchema({
22543
+ }, ["target", "alignment"]), textMutationResultSchemaFor("format.align"), textMutationFailureSchemaFor("format.align"), objectSchema({ target: deletableBlockNodeAddressSchema }, ["target"]), objectSchema({
22544
+ success: { const: true },
22545
+ deleted: deletableBlockNodeAddressSchema
22546
+ }, ["success", "deleted"]), objectSchema({
22547
+ success: { const: true },
22548
+ deleted: deletableBlockNodeAddressSchema
22549
+ }, ["success", "deleted"]), preApplyFailureResultSchemaFor("blocks.delete"), objectSchema({
22505
22550
  at: { oneOf: [
22506
22551
  objectSchema({ kind: { const: "documentStart" } }, ["kind"]),
22507
22552
  objectSchema({ kind: { const: "documentEnd" } }, ["kind"]),
@@ -22679,6 +22724,11 @@ var GROUP_METADATA = {
22679
22724
  description: "Primary read and write operations.",
22680
22725
  pagePath: "core/index.mdx"
22681
22726
  },
22727
+ blocks: {
22728
+ title: "Blocks",
22729
+ description: "Block-level structural operations.",
22730
+ pagePath: "blocks/index.mdx"
22731
+ },
22682
22732
  capabilities: {
22683
22733
  title: "Capabilities",
22684
22734
  description: "Runtime support discovery for capability-aware branching.",
@@ -22727,6 +22777,7 @@ Object.keys(GROUP_METADATA).map((key$1) => ({
22727
22777
  }));
22728
22778
  const CAPABILITY_REASON_CODES = [
22729
22779
  "COMMAND_UNAVAILABLE",
22780
+ "HELPER_UNAVAILABLE",
22730
22781
  "OPERATION_UNAVAILABLE",
22731
22782
  "TRACKED_MODE_UNAVAILABLE",
22732
22783
  "DRY_RUN_UNAVAILABLE",
@@ -23024,6 +23075,27 @@ function executeCreateHeading(adapter, input, options) {
23024
23075
  validateCreateLocation(normalized.at, "create.heading");
23025
23076
  return adapter.heading(normalized, normalizeMutationOptions(options));
23026
23077
  }
23078
+ var SUPPORTED_DELETE_NODE_TYPES = new Set(DELETABLE_BLOCK_NODE_TYPES);
23079
+ var REJECTED_DELETE_NODE_TYPES = new Set(["tableRow", "tableCell"]);
23080
+ function validateBlocksDeleteInput(input) {
23081
+ if (!input || typeof input !== "object") throw new DocumentApiValidationError("INVALID_INPUT", "blocks.delete requires an input object.", { fields: ["input"] });
23082
+ if (!input.target) throw new DocumentApiValidationError("INVALID_INPUT", "blocks.delete requires a target.", { fields: ["target"] });
23083
+ if (input.target.kind !== "block") throw new DocumentApiValidationError("INVALID_INPUT", "blocks.delete target must have kind \"block\".", { fields: ["target.kind"] });
23084
+ if (!input.target.nodeId || typeof input.target.nodeId !== "string") throw new DocumentApiValidationError("INVALID_INPUT", "blocks.delete target requires a nodeId string.", { fields: ["target.nodeId"] });
23085
+ const { nodeType } = input.target;
23086
+ if (REJECTED_DELETE_NODE_TYPES.has(nodeType)) throw new DocumentApiValidationError("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets. Table row/column operations are out of scope.`, {
23087
+ fields: ["target.nodeType"],
23088
+ nodeType
23089
+ });
23090
+ if (!SUPPORTED_DELETE_NODE_TYPES.has(nodeType)) throw new DocumentApiValidationError("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets.`, {
23091
+ fields: ["target.nodeType"],
23092
+ nodeType
23093
+ });
23094
+ }
23095
+ function executeBlocksDelete(adapter, input, options) {
23096
+ validateBlocksDeleteInput(input);
23097
+ return adapter.delete(input, normalizeMutationOptions(options));
23098
+ }
23027
23099
  function executeTrackChangesList(adapter, input) {
23028
23100
  return adapter.list(input);
23029
23101
  }
@@ -23067,6 +23139,7 @@ function buildDispatchTable(api) {
23067
23139
  insert: (input, options) => api.insert(input, options),
23068
23140
  replace: (input, options) => api.replace(input, options),
23069
23141
  delete: (input, options) => api.delete(input, options),
23142
+ "blocks.delete": (input, options) => api.blocks.delete(input, options),
23070
23143
  "format.apply": (input, options) => api.format.apply(input, options),
23071
23144
  "format.fontSize": (input, options) => api.format.fontSize(input, options),
23072
23145
  "format.fontFamily": (input, options) => api.format.fontFamily(input, options),
@@ -23192,6 +23265,9 @@ function createDocumentApi(adapters) {
23192
23265
  return executeTrackChangesDecide(adapters.trackChanges, input, options);
23193
23266
  }
23194
23267
  },
23268
+ blocks: { delete(input, options) {
23269
+ return executeBlocksDelete(adapters.blocks, input, options);
23270
+ } },
23195
23271
  create: {
23196
23272
  paragraph(input, options) {
23197
23273
  return executeCreateParagraph(adapters.create, input, options);
@@ -23276,6 +23352,7 @@ var REQUIRED_COMMANDS = {
23276
23352
  "lists.outdent": ["setTextSelection", "decreaseListIndent"],
23277
23353
  "lists.restart": ["setTextSelection", "restartNumbering"],
23278
23354
  "lists.exit": ["exitListItemAt"],
23355
+ "blocks.delete": ["deleteBlockNodeById"],
23279
23356
  "comments.create": [
23280
23357
  "addComment",
23281
23358
  "setTextSelection",
@@ -23304,6 +23381,12 @@ function hasAllCommands(editor, operationId) {
23304
23381
  if (!required || required.length === 0) return true;
23305
23382
  return required.every((command$1) => hasCommand(editor, command$1));
23306
23383
  }
23384
+ var REQUIRED_HELPERS = { "blocks.delete": (editor) => typeof editor.helpers?.blockNode?.getBlockNodeById === "function" };
23385
+ function hasRequiredHelpers(editor, operationId) {
23386
+ const check = REQUIRED_HELPERS[operationId];
23387
+ if (!check) return true;
23388
+ return check(editor);
23389
+ }
23307
23390
  function hasMarkCapability(editor, markName) {
23308
23391
  return Boolean(editor.schema?.marks?.[markName]);
23309
23392
  }
@@ -23349,7 +23432,7 @@ function pushReason(reasons, reason) {
23349
23432
  function isOperationAvailable(editor, operationId) {
23350
23433
  if (operationId === "format.apply") return MARK_KEYS.some((key$1) => hasMarkCapability(editor, STYLE_MARK_SCHEMA_NAMES[key$1] ?? key$1));
23351
23434
  if (INLINE_FORMAT_OPERATIONS.has(operationId)) return hasAllCommands(editor, operationId) && hasMarkCapability(editor, "textStyle");
23352
- return hasAllCommands(editor, operationId);
23435
+ return hasAllCommands(editor, operationId) && hasRequiredHelpers(editor, operationId);
23353
23436
  }
23354
23437
  function isCommandBackedAvailability(operationId) {
23355
23438
  return !isMarkBackedOperation(operationId) && !INLINE_FORMAT_OPERATIONS.has(operationId);
@@ -23363,7 +23446,10 @@ function buildOperationCapabilities(editor) {
23363
23446
  const dryRun = metadata.supportsDryRun && available;
23364
23447
  const reasons = [];
23365
23448
  if (!available) {
23366
- if (isCommandBackedAvailability(operationId)) pushReason(reasons, "COMMAND_UNAVAILABLE");
23449
+ if (isCommandBackedAvailability(operationId)) {
23450
+ if (!hasAllCommands(editor, operationId)) pushReason(reasons, "COMMAND_UNAVAILABLE");
23451
+ if (!hasRequiredHelpers(editor, operationId)) pushReason(reasons, "HELPER_UNAVAILABLE");
23452
+ }
23367
23453
  pushReason(reasons, "OPERATION_UNAVAILABLE");
23368
23454
  }
23369
23455
  if (metadata.supportsTrackedMode && !tracked) pushReason(reasons, "TRACKED_MODE_UNAVAILABLE");
@@ -23853,13 +23939,21 @@ function buildBlockIndex(editor) {
23853
23939
  });
23854
23940
  return {
23855
23941
  candidates,
23856
- byId
23942
+ byId,
23943
+ ambiguous
23857
23944
  };
23858
23945
  }
23859
23946
  function findBlockById(index, address) {
23860
23947
  if (address.kind !== "block") return void 0;
23861
23948
  return index.byId.get(`${address.nodeType}:${address.nodeId}`);
23862
23949
  }
23950
+ function findBlockByIdStrict(index, address) {
23951
+ const key$1 = `${address.nodeType}:${address.nodeId}`;
23952
+ if (index.ambiguous.has(key$1)) throw new DocumentApiAdapterError("AMBIGUOUS_TARGET", `Multiple blocks share key "${key$1}".`, { target: address });
23953
+ const candidate = index.byId.get(key$1);
23954
+ if (!candidate) throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `Block "${key$1}" was not found.`, { target: address });
23955
+ return candidate;
23956
+ }
23863
23957
  function isTextBlockCandidate(candidate) {
23864
23958
  const node = candidate.node;
23865
23959
  return Boolean(node?.inlineContent || node?.isTextblock);
@@ -25325,7 +25419,8 @@ function buildAssertIndex(doc$2) {
25325
25419
  });
25326
25420
  return {
25327
25421
  candidates,
25328
- byId
25422
+ byId,
25423
+ ambiguous
25329
25424
  };
25330
25425
  }
25331
25426
  function resolveAssertScope(index, select, within$1) {
@@ -26595,6 +26690,51 @@ function createCommentsWrapper(editor) {
26595
26690
  list: (query) => listCommentsHandler(editor, query)
26596
26691
  };
26597
26692
  }
26693
+ var SUPPORTED_NODE_TYPES = new Set(DELETABLE_BLOCK_NODE_TYPES);
26694
+ var REJECTED_NODE_TYPES = new Set(["tableRow", "tableCell"]);
26695
+ function validateTargetNodeType(nodeType) {
26696
+ if (REJECTED_NODE_TYPES.has(nodeType)) throw new DocumentApiAdapterError("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets. Table row/column operations are out of scope.`, { nodeType });
26697
+ if (!SUPPORTED_NODE_TYPES.has(nodeType)) throw new DocumentApiAdapterError("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets.`, { nodeType });
26698
+ }
26699
+ function resolveSdBlockId(candidate) {
26700
+ const sdBlockId = candidate.node.attrs?.sdBlockId;
26701
+ if (typeof sdBlockId === "string" && sdBlockId.length > 0) return sdBlockId;
26702
+ throw new DocumentApiAdapterError("INTERNAL_ERROR", "Resolved block candidate is missing sdBlockId attribute. This indicates a schema/extension invariant violation.", { attrs: candidate.node.attrs });
26703
+ }
26704
+ function validateCommandLayerUniqueness(editor, sdBlockId) {
26705
+ const getBlockNodeById = editor.helpers?.blockNode?.getBlockNodeById;
26706
+ if (typeof getBlockNodeById !== "function") throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "blocks.delete requires the blockNode helper to be registered.", { reason: "missing_helper" });
26707
+ const matches = getBlockNodeById(sdBlockId);
26708
+ if (!matches || Array.isArray(matches) && matches.length === 0) throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `Block with sdBlockId "${sdBlockId}" was not found at the command layer.`, { sdBlockId });
26709
+ if (Array.isArray(matches) && matches.length > 1) throw new DocumentApiAdapterError("AMBIGUOUS_TARGET", `Multiple blocks share sdBlockId "${sdBlockId}" at the command layer.`, {
26710
+ sdBlockId,
26711
+ count: matches.length
26712
+ });
26713
+ }
26714
+ function blocksDeleteWrapper(editor, input, options) {
26715
+ rejectTrackedMode("blocks.delete", options);
26716
+ const candidate = findBlockByIdStrict(getBlockIndex(editor), input.target);
26717
+ validateTargetNodeType(candidate.nodeType);
26718
+ const sdBlockId = resolveSdBlockId(candidate);
26719
+ const deleteBlockNodeById = requireEditorCommand(editor.commands?.deleteBlockNodeById, "blocks.delete");
26720
+ validateCommandLayerUniqueness(editor, sdBlockId);
26721
+ if (options?.dryRun) return {
26722
+ success: true,
26723
+ deleted: input.target
26724
+ };
26725
+ if (executeDomainCommand(editor, () => {
26726
+ const didApply = deleteBlockNodeById(sdBlockId);
26727
+ if (didApply) clearIndexCache(editor);
26728
+ return didApply;
26729
+ }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed") throw new DocumentApiAdapterError("INTERNAL_ERROR", "blocks.delete command returned false despite passing all pre-apply checks. This is an internal invariant violation.", {
26730
+ sdBlockId,
26731
+ target: input.target
26732
+ });
26733
+ return {
26734
+ success: true,
26735
+ deleted: input.target
26736
+ };
26737
+ }
26598
26738
  var DERIVED_ID_LENGTH = 24;
26599
26739
  function getRawTrackedMarks(editor) {
26600
26740
  try {
@@ -28826,6 +28966,7 @@ function getDocumentApiAdapters(editor) {
28826
28966
  acceptAll: (input, options) => trackChangesAcceptAllWrapper(editor, input, options),
28827
28967
  rejectAll: (input, options) => trackChangesRejectAllWrapper(editor, input, options)
28828
28968
  },
28969
+ blocks: { delete: (input, options) => blocksDeleteWrapper(editor, input, options) },
28829
28970
  create: {
28830
28971
  paragraph: (input, options) => createParagraphWrapper(editor, input, options),
28831
28972
  heading: (input, options) => createHeadingWrapper(editor, input, options)
@@ -30216,7 +30357,7 @@ var Editor = class Editor extends EventEmitter$1 {
30216
30357
  return migrations.length > 0;
30217
30358
  }
30218
30359
  processCollaborationMigrations() {
30219
- console.debug("[checkVersionMigrations] Current editor version", "1.17.0-next.10");
30360
+ console.debug("[checkVersionMigrations] Current editor version", "1.17.0-next.12");
30220
30361
  if (!this.options.ydoc) return;
30221
30362
  let docVersion = this.options.ydoc.getMap("meta").get("version");
30222
30363
  if (!docVersion) docVersion = "initial";