@superdoc-dev/cli 0.2.0-next.99 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +121 -146
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -33280,7 +33280,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
33280
33280
  emptyOptions2 = {};
33281
33281
  });
33282
33282
 
33283
- // ../../packages/superdoc/dist/chunks/SuperConverter-DSgQEo7o.es.js
33283
+ // ../../packages/superdoc/dist/chunks/SuperConverter-B7Dckk9A.es.js
33284
33284
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
33285
33285
  const fieldValue = extension$1.config[field];
33286
33286
  if (typeof fieldValue === "function")
@@ -65108,7 +65108,7 @@ var isRegExp = (value) => {
65108
65108
  state.kern = kernNode.attributes["w:val"];
65109
65109
  }
65110
65110
  }, SuperConverter;
65111
- var init_SuperConverter_DSgQEo7o_es = __esm(() => {
65111
+ var init_SuperConverter_B7Dckk9A_es = __esm(() => {
65112
65112
  init_rolldown_runtime_B2q5OVn9_es();
65113
65113
  init_jszip_ChlR43oI_es();
65114
65114
  init_xml_js_DLE8mr0n_es();
@@ -94979,7 +94979,7 @@ var init_SuperConverter_DSgQEo7o_es = __esm(() => {
94979
94979
  static getStoredSuperdocVersion(docx) {
94980
94980
  return SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
94981
94981
  }
94982
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.18.0") {
94982
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.18.2") {
94983
94983
  return SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
94984
94984
  }
94985
94985
  static generateWordTimestamp() {
@@ -96229,7 +96229,7 @@ var init_remark_stringify_D8vxv_XI_es = __esm(() => {
96229
96229
  eol = /\r?\n|\r/g;
96230
96230
  });
96231
96231
 
96232
- // ../../packages/superdoc/dist/chunks/DocxZipper-Dt7MDO2A.es.js
96232
+ // ../../packages/superdoc/dist/chunks/DocxZipper-Db_-JB22.es.js
96233
96233
  function getLens2(b64) {
96234
96234
  var len$1 = b64.length;
96235
96235
  if (len$1 % 4 > 0)
@@ -96340,7 +96340,11 @@ function ensureXmlString(content2) {
96340
96340
  if (!u8)
96341
96341
  throw new Error("Unsupported content type for XML");
96342
96342
  const enc = sniffEncoding(u8);
96343
- return stripBOM(new TextDecoder(enc).decode(u8));
96343
+ let xml = new TextDecoder(enc).decode(u8);
96344
+ xml = stripBOM(xml);
96345
+ if (enc !== "utf-8")
96346
+ xml = xml.replace(/(<\?xml\b[^?]*?)\bencoding\s*=\s*["'][^"']*["']/i, '$1encoding="UTF-8"');
96347
+ return xml;
96344
96348
  }
96345
96349
  var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", buffer2, base64Js2, lookup2, revLookup2, Arr2, code4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i2, len2, ieee7542, Buffer3, isXmlLike = (name) => /\.xml$|\.rels$/i.test(name), import_lib3, import_jszip_min, IMAGE_EXTS, MIME_TYPE_FOR_EXT, DocxZipper = class {
96346
96350
  constructor(params = {}) {
@@ -96589,8 +96593,8 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
96589
96593
  const unzippedOriginalDocx = await this.unzip(originalDocxFile);
96590
96594
  const filePromises = [];
96591
96595
  unzippedOriginalDocx.forEach((relativePath, zipEntry) => {
96592
- const promise = zipEntry.async("string").then((content2) => {
96593
- unzippedOriginalDocx.file(zipEntry.name, content2);
96596
+ const promise = zipEntry.async("uint8array").then((u8) => {
96597
+ unzippedOriginalDocx.file(zipEntry.name, isXmlLike(zipEntry.name) ? ensureXmlString(u8) : u8);
96594
96598
  });
96595
96599
  filePromises.push(promise);
96596
96600
  });
@@ -96624,7 +96628,7 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
96624
96628
  return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
96625
96629
  }
96626
96630
  }, DocxZipper_default;
96627
- var init_DocxZipper_Dt7MDO2A_es = __esm(() => {
96631
+ var init_DocxZipper_Db__JB22_es = __esm(() => {
96628
96632
  init_rolldown_runtime_B2q5OVn9_es();
96629
96633
  init_jszip_ChlR43oI_es();
96630
96634
  init_xml_js_DLE8mr0n_es();
@@ -121914,9 +121918,9 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
121914
121918
  init_remark_gfm_z_sDF4ss_es();
121915
121919
  });
121916
121920
 
121917
- // ../../packages/superdoc/dist/chunks/src-CPyKzDwB.es.js
121918
- var exports_src_CPyKzDwB_es = {};
121919
- __export(exports_src_CPyKzDwB_es, {
121921
+ // ../../packages/superdoc/dist/chunks/src-B5RzIebm.es.js
121922
+ var exports_src_B5RzIebm_es = {};
121923
+ __export(exports_src_B5RzIebm_es, {
121920
121924
  zt: () => defineMark,
121921
121925
  z: () => cM,
121922
121926
  yt: () => removeAwarenessStates,
@@ -122146,7 +122150,7 @@ function hasV8CaptureStackTrace(error) {
122146
122150
  }
122147
122151
  function getSuperdocVersion() {
122148
122152
  try {
122149
- return "1.18.0";
122153
+ return "1.18.2";
122150
122154
  } catch {
122151
122155
  return "unknown";
122152
122156
  }
@@ -145010,32 +145014,21 @@ function imagesSetHyperlinkWrapper(editor, input2, options) {
145010
145014
  return buildNoOpResult("Set hyperlink produced no change.");
145011
145015
  return buildSuccessResult(findImageById(editor, input2.imageId));
145012
145016
  }
145013
- function findContainingParagraph(editor, imagePos) {
145014
- const $pos = editor.state.doc.resolve(imagePos);
145015
- for (let depth = $pos.depth;depth >= 1; depth -= 1) {
145016
- const node3 = $pos.node(depth);
145017
- if (node3.type.name !== "paragraph")
145018
- continue;
145019
- return {
145020
- depth,
145021
- pos: $pos.before(depth),
145022
- node: node3
145023
- };
145024
- }
145025
- throw new DocumentApiAdapterError("INVALID_TARGET", "Caption operations require the image to be inside a paragraph.");
145026
- }
145027
145017
  function findCaptionParagraph(editor, imagePos) {
145028
- const paragraph2 = findContainingParagraph(editor, imagePos);
145029
- const afterParagraphPos = paragraph2.pos + paragraph2.node.nodeSize;
145030
- if (afterParagraphPos >= editor.state.doc.content.size)
145018
+ const $pos = editor.state.doc.resolve(imagePos);
145019
+ const parentDepth = $pos.depth - 1;
145020
+ if (parentDepth < 0)
145031
145021
  return null;
145032
- const nextNode = editor.state.doc.nodeAt(afterParagraphPos);
145022
+ const afterParentPos = $pos.before(parentDepth + 1) + $pos.node(parentDepth + 1).nodeSize;
145023
+ if (afterParentPos >= editor.state.doc.content.size)
145024
+ return null;
145025
+ const nextNode = editor.state.doc.nodeAt(afterParentPos);
145033
145026
  if (!nextNode || nextNode.type.name !== "paragraph")
145034
145027
  return null;
145035
- if ((nextNode.attrs?.paragraphProperties?.styleId ?? nextNode.attrs?.styleId) !== "Caption")
145028
+ if (nextNode.attrs?.paragraphProperties?.styleId !== "Caption")
145036
145029
  return null;
145037
145030
  return {
145038
- pos: afterParagraphPos,
145031
+ pos: afterParentPos,
145039
145032
  node: nextNode
145040
145033
  };
145041
145034
  }
@@ -145062,11 +145055,12 @@ function imagesInsertCaptionWrapper(editor, input2, options) {
145062
145055
  if (options?.dryRun)
145063
145056
  return buildSuccessResult(image2);
145064
145057
  if (executeDomainCommand(editor, () => {
145065
- const paragraph2 = findContainingParagraph(editor, findImageById(editor, input2.imageId).pos);
145066
- const afterParagraphPos = paragraph2.pos + paragraph2.node.nodeSize;
145058
+ const $pos = editor.state.doc.resolve(image2.pos);
145059
+ const parentDepth = $pos.depth - 1;
145060
+ const afterParentPos = $pos.before(parentDepth + 1) + $pos.node(parentDepth + 1).nodeSize;
145067
145061
  const tr = editor.state.tr;
145068
145062
  const captionPara = editor.state.schema.nodes.paragraph.create({ paragraphProperties: { styleId: "Caption" } }, editor.state.schema.text(input2.text));
145069
- tr.insert(afterParagraphPos, captionPara);
145063
+ tr.insert(afterParentPos, captionPara);
145070
145064
  if (!tr.docChanged)
145071
145065
  return false;
145072
145066
  editor.dispatch(tr);
@@ -161574,7 +161568,7 @@ function computeAnchorMap(bookmarks, layout, blocks2) {
161574
161568
  });
161575
161569
  return anchorMap;
161576
161570
  }
161577
- async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks, pageGeometryHelper, painterHost, scrollPageIntoView, waitForPageMount, getActiveEditor, timeoutMs }) {
161571
+ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks, pageGeometryHelper, painterHost, scrollContainer, zoom, scrollPageIntoView, waitForPageMount, getActiveEditor, timeoutMs }) {
161578
161572
  if (!anchor)
161579
161573
  return false;
161580
161574
  if (!layout)
@@ -161586,9 +161580,11 @@ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks
161586
161580
  if (pmPos == null)
161587
161581
  return false;
161588
161582
  let pageIndex = (selectionToRects(layout, blocks2, measures, pmPos, pmPos + 1, pageGeometryHelper) ?? [])[0]?.pageIndex ?? null;
161583
+ let fragmentY = null;
161589
161584
  if (pageIndex == null) {
161590
161585
  let nextFragmentPage = null;
161591
161586
  let nextFragmentStart = null;
161587
+ let nextFragmentY = null;
161592
161588
  for (const page of layout.pages) {
161593
161589
  for (const fragment of page.fragments) {
161594
161590
  if (fragment.kind !== "para")
@@ -161599,25 +161595,46 @@ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks
161599
161595
  continue;
161600
161596
  if (pmPos >= fragStart && pmPos < fragEnd) {
161601
161597
  pageIndex = page.number - 1;
161598
+ fragmentY = fragment.y;
161602
161599
  break;
161603
161600
  }
161604
161601
  if (fragStart > pmPos && (nextFragmentStart === null || fragStart < nextFragmentStart)) {
161605
161602
  nextFragmentPage = page.number - 1;
161606
161603
  nextFragmentStart = fragStart;
161604
+ nextFragmentY = fragment.y;
161607
161605
  }
161608
161606
  }
161609
161607
  if (pageIndex != null)
161610
161608
  break;
161611
161609
  }
161612
- if (pageIndex == null && nextFragmentPage != null)
161610
+ if (pageIndex == null && nextFragmentPage != null) {
161613
161611
  pageIndex = nextFragmentPage;
161612
+ fragmentY = nextFragmentY;
161613
+ }
161614
161614
  }
161615
161615
  if (pageIndex == null)
161616
161616
  return false;
161617
161617
  scrollPageIntoView(pageIndex);
161618
161618
  await waitForPageMount(pageIndex, timeoutMs);
161619
161619
  const pageEl = getPageElementByIndex(painterHost, pageIndex);
161620
- if (pageEl)
161620
+ if (pageEl && fragmentY != null) {
161621
+ const scaledY = fragmentY * zoom;
161622
+ if (scrollContainer instanceof Element) {
161623
+ const pageRect = pageEl.getBoundingClientRect();
161624
+ const containerRect = scrollContainer.getBoundingClientRect();
161625
+ const targetY = pageRect.top - containerRect.top + scrollContainer.scrollTop + scaledY;
161626
+ scrollContainer.scrollTo({
161627
+ top: targetY,
161628
+ behavior: "instant"
161629
+ });
161630
+ } else {
161631
+ const targetY = pageEl.getBoundingClientRect().top + scrollContainer.scrollY + scaledY;
161632
+ scrollContainer.scrollTo({
161633
+ top: targetY,
161634
+ behavior: "instant"
161635
+ });
161636
+ }
161637
+ } else if (pageEl)
161621
161638
  pageEl.scrollIntoView({
161622
161639
  behavior: "instant",
161623
161640
  block: "start"
@@ -180199,7 +180216,7 @@ var Node$13 = class Node$14 {
180199
180216
  domAvailabilityCache = false;
180200
180217
  return false;
180201
180218
  }
180202
- }, summaryVersion = "1.18.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
180219
+ }, summaryVersion = "1.18.2", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
180203
180220
  const container = document.createElement("div");
180204
180221
  container.innerHTML = html3;
180205
180222
  const result = [];
@@ -180767,8 +180784,6 @@ var Node$13 = class Node$14 {
180767
180784
  existingFileNames.add(uniqueFileName);
180768
180785
  const mediaPath = buildMediaPath(uniqueFileName);
180769
180786
  mediaStore[mediaPath] = src;
180770
- if (editor.options.ydoc)
180771
- editor.options.ydoc.getMap("media").set(mediaPath, src);
180772
180787
  const rId = addImageRelationship({
180773
180788
  editor,
180774
180789
  path: mediaPath.startsWith("word/") ? mediaPath.slice(5) : mediaPath
@@ -199196,16 +199211,16 @@ var Node$13 = class Node$14 {
199196
199211
  trackedChanges: context.trackedChanges ?? []
199197
199212
  });
199198
199213
  }, _hoisted_1$6, _hoisted_2$2, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, _hoisted_2$1, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_HEIGHT_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, POPOVER_VERTICAL_OFFSET_PX = 15, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
199199
- var init_src_CPyKzDwB_es = __esm(() => {
199214
+ var init_src_B5RzIebm_es = __esm(() => {
199200
199215
  init_rolldown_runtime_B2q5OVn9_es();
199201
- init_SuperConverter_DSgQEo7o_es();
199216
+ init_SuperConverter_B7Dckk9A_es();
199202
199217
  init_jszip_ChlR43oI_es();
199203
199218
  init_uuid_qzgm05fK_es();
199204
199219
  init_constants_CMPtQbp7_es();
199205
199220
  init_unified_BRHLwnjP_es();
199206
199221
  init_remark_gfm_z_sDF4ss_es();
199207
199222
  init_remark_stringify_D8vxv_XI_es();
199208
- init_DocxZipper_Dt7MDO2A_es();
199223
+ init_DocxZipper_Db__JB22_es();
199209
199224
  init_vue_q66HzpoR_es();
199210
199225
  init__plugin_vue_export_helper_HmhZBO0u_es();
199211
199226
  init_eventemitter3_DGBTyUUP_es();
@@ -209559,7 +209574,7 @@ function print() { __p += __j.call(arguments, '') }
209559
209574
  return migrations.length > 0;
209560
209575
  }
209561
209576
  processCollaborationMigrations() {
209562
- console.debug("[checkVersionMigrations] Current editor version", "1.18.0");
209577
+ console.debug("[checkVersionMigrations] Current editor version", "1.18.2");
209563
209578
  if (!this.options.ydoc)
209564
209579
  return;
209565
209580
  let docVersion = this.options.ydoc.getMap("meta").get("version");
@@ -215590,7 +215605,7 @@ function print() { __p += __j.call(arguments, '') }
215590
215605
  const commentAnnotations = textRun.comments;
215591
215606
  const hasAnyComment = !!commentAnnotations?.length;
215592
215607
  const commentHighlight = getCommentHighlight(textRun, this.activeCommentId);
215593
- if (commentHighlight.color && !textRun.highlight && hasAnyComment) {
215608
+ if (commentHighlight.color && hasAnyComment) {
215594
215609
  elem.style.backgroundColor = commentHighlight.color;
215595
215610
  if (commentHighlight.hasNestedComments && commentHighlight.baseColor) {
215596
215611
  const borderColor = `${commentHighlight.baseColor}99`;
@@ -220456,6 +220471,8 @@ function print() { __p += __j.call(arguments, '') }
220456
220471
  bookmarks: this.#layoutState.bookmarks,
220457
220472
  pageGeometryHelper: this.#pageGeometryHelper ?? undefined,
220458
220473
  painterHost: this.#painterHost,
220474
+ scrollContainer: this.#scrollContainer ?? this.#visibleHost,
220475
+ zoom: this.zoom,
220459
220476
  scrollPageIntoView: (pageIndex) => this.#scrollPageIntoView(pageIndex),
220460
220477
  waitForPageMount: (pageIndex, timeoutMs) => this.#waitForPageMount(pageIndex, { timeout: timeoutMs }),
220461
220478
  getActiveEditor: () => this.getActiveEditor(),
@@ -230947,8 +230964,8 @@ function print() { __p += __j.call(arguments, '') }
230947
230964
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
230948
230965
  };
230949
230966
  stubFalse_default = stubFalse;
230950
- freeExports$2 = typeof exports_src_CPyKzDwB_es == "object" && exports_src_CPyKzDwB_es && !exports_src_CPyKzDwB_es.nodeType && exports_src_CPyKzDwB_es;
230951
- freeModule$2 = freeExports$2 && typeof module_src_CPyKzDwB_es == "object" && module_src_CPyKzDwB_es && !module_src_CPyKzDwB_es.nodeType && module_src_CPyKzDwB_es;
230967
+ freeExports$2 = typeof exports_src_B5RzIebm_es == "object" && exports_src_B5RzIebm_es && !exports_src_B5RzIebm_es.nodeType && exports_src_B5RzIebm_es;
230968
+ freeModule$2 = freeExports$2 && typeof module_src_B5RzIebm_es == "object" && module_src_B5RzIebm_es && !module_src_B5RzIebm_es.nodeType && module_src_B5RzIebm_es;
230952
230969
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
230953
230970
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
230954
230971
  typedArrayTags = {};
@@ -230956,8 +230973,8 @@ function print() { __p += __j.call(arguments, '') }
230956
230973
  typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
230957
230974
  _baseIsTypedArray_default = baseIsTypedArray;
230958
230975
  _baseUnary_default = baseUnary;
230959
- freeExports$1 = typeof exports_src_CPyKzDwB_es == "object" && exports_src_CPyKzDwB_es && !exports_src_CPyKzDwB_es.nodeType && exports_src_CPyKzDwB_es;
230960
- freeModule$1 = freeExports$1 && typeof module_src_CPyKzDwB_es == "object" && module_src_CPyKzDwB_es && !module_src_CPyKzDwB_es.nodeType && module_src_CPyKzDwB_es;
230976
+ freeExports$1 = typeof exports_src_B5RzIebm_es == "object" && exports_src_B5RzIebm_es && !exports_src_B5RzIebm_es.nodeType && exports_src_B5RzIebm_es;
230977
+ freeModule$1 = freeExports$1 && typeof module_src_B5RzIebm_es == "object" && module_src_B5RzIebm_es && !module_src_B5RzIebm_es.nodeType && module_src_B5RzIebm_es;
230961
230978
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
230962
230979
  _nodeUtil_default = function() {
230963
230980
  try {
@@ -231062,8 +231079,8 @@ function print() { __p += __j.call(arguments, '') }
231062
231079
  Stack.prototype.has = _stackHas_default;
231063
231080
  Stack.prototype.set = _stackSet_default;
231064
231081
  _Stack_default = Stack;
231065
- freeExports = typeof exports_src_CPyKzDwB_es == "object" && exports_src_CPyKzDwB_es && !exports_src_CPyKzDwB_es.nodeType && exports_src_CPyKzDwB_es;
231066
- freeModule = freeExports && typeof module_src_CPyKzDwB_es == "object" && module_src_CPyKzDwB_es && !module_src_CPyKzDwB_es.nodeType && module_src_CPyKzDwB_es;
231082
+ freeExports = typeof exports_src_B5RzIebm_es == "object" && exports_src_B5RzIebm_es && !exports_src_B5RzIebm_es.nodeType && exports_src_B5RzIebm_es;
231083
+ freeModule = freeExports && typeof module_src_B5RzIebm_es == "object" && module_src_B5RzIebm_es && !module_src_B5RzIebm_es.nodeType && module_src_B5RzIebm_es;
231067
231084
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
231068
231085
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
231069
231086
  _cloneBuffer_default = cloneBuffer;
@@ -239143,13 +239160,13 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
239143
239160
 
239144
239161
  // ../../packages/superdoc/dist/super-editor.es.js
239145
239162
  var init_super_editor_es = __esm(() => {
239146
- init_src_CPyKzDwB_es();
239147
- init_SuperConverter_DSgQEo7o_es();
239163
+ init_src_B5RzIebm_es();
239164
+ init_SuperConverter_B7Dckk9A_es();
239148
239165
  init_jszip_ChlR43oI_es();
239149
239166
  init_xml_js_DLE8mr0n_es();
239150
239167
  init_constants_CMPtQbp7_es();
239151
239168
  init_unified_BRHLwnjP_es();
239152
- init_DocxZipper_Dt7MDO2A_es();
239169
+ init_DocxZipper_Db__JB22_es();
239153
239170
  init_vue_q66HzpoR_es();
239154
239171
  init_eventemitter3_DGBTyUUP_es();
239155
239172
  init_zipper_DqXT7uTa_es();
@@ -317240,32 +317257,22 @@ function imagesSetHyperlinkWrapper2(editor, input2, options) {
317240
317257
  return buildNoOpResult2("Set hyperlink produced no change.");
317241
317258
  return buildSuccessResult2(findImageById2(editor, input2.imageId));
317242
317259
  }
317243
- function findContainingParagraph2(editor, imagePos) {
317244
- const $pos = editor.state.doc.resolve(imagePos);
317245
- for (let depth = $pos.depth;depth >= 1; depth -= 1) {
317246
- const node4 = $pos.node(depth);
317247
- if (node4.type.name !== "paragraph")
317248
- continue;
317249
- return {
317250
- depth,
317251
- pos: $pos.before(depth),
317252
- node: node4
317253
- };
317254
- }
317255
- throw new DocumentApiAdapterError3("INVALID_TARGET", "Caption operations require the image to be inside a paragraph.");
317256
- }
317257
317260
  function findCaptionParagraph2(editor, imagePos) {
317258
- const paragraph3 = findContainingParagraph2(editor, imagePos);
317259
- const afterParagraphPos = paragraph3.pos + paragraph3.node.nodeSize;
317260
- if (afterParagraphPos >= editor.state.doc.content.size)
317261
+ const $pos = editor.state.doc.resolve(imagePos);
317262
+ const parentDepth = $pos.depth - 1;
317263
+ if (parentDepth < 0)
317264
+ return null;
317265
+ const parentPos = $pos.before(parentDepth + 1);
317266
+ const parentNode2 = $pos.node(parentDepth + 1);
317267
+ const afterParentPos = parentPos + parentNode2.nodeSize;
317268
+ if (afterParentPos >= editor.state.doc.content.size)
317261
317269
  return null;
317262
- const nextNode = editor.state.doc.nodeAt(afterParagraphPos);
317270
+ const nextNode = editor.state.doc.nodeAt(afterParentPos);
317263
317271
  if (!nextNode || nextNode.type.name !== "paragraph")
317264
317272
  return null;
317265
- const styleId = nextNode.attrs?.paragraphProperties?.styleId ?? nextNode.attrs?.styleId;
317266
- if (styleId !== "Caption")
317273
+ if (nextNode.attrs?.paragraphProperties?.styleId !== "Caption")
317267
317274
  return null;
317268
- return { pos: afterParagraphPos, node: nextNode };
317275
+ return { pos: afterParentPos, node: nextNode };
317269
317276
  }
317270
317277
  function requireSoleImageInParagraph2(editor, imagePos) {
317271
317278
  const $pos = editor.state.doc.resolve(imagePos);
@@ -317294,12 +317301,14 @@ function imagesInsertCaptionWrapper2(editor, input2, options) {
317294
317301
  if (options?.dryRun)
317295
317302
  return buildSuccessResult2(image3);
317296
317303
  const receipt2 = executeDomainCommand2(editor, () => {
317297
- const currentImage = findImageById2(editor, input2.imageId);
317298
- const paragraph3 = findContainingParagraph2(editor, currentImage.pos);
317299
- const afterParagraphPos = paragraph3.pos + paragraph3.node.nodeSize;
317304
+ const $pos = editor.state.doc.resolve(image3.pos);
317305
+ const parentDepth = $pos.depth - 1;
317306
+ const parentPos = $pos.before(parentDepth + 1);
317307
+ const parentNode2 = $pos.node(parentDepth + 1);
317308
+ const afterParentPos = parentPos + parentNode2.nodeSize;
317300
317309
  const tr = editor.state.tr;
317301
317310
  const captionPara = editor.state.schema.nodes.paragraph.create({ paragraphProperties: { styleId: "Caption" } }, editor.state.schema.text(input2.text));
317302
- tr.insert(afterParagraphPos, captionPara);
317311
+ tr.insert(afterParentPos, captionPara);
317303
317312
  if (!tr.docChanged)
317304
317313
  return false;
317305
317314
  editor.dispatch(tr);
@@ -382147,61 +382156,16 @@ var init_wrapper_dispatch = __esm(() => {
382147
382156
  COMMAND_SPEC_BY_KEY = new Map(CLI_COMMAND_SPECS.map((spec) => [spec.key, spec]));
382148
382157
  });
382149
382158
 
382150
- // src/commands/skill-targets.ts
382151
- import { existsSync, realpathSync } from "node:fs";
382152
- import { homedir as homedir2 } from "node:os";
382153
- import { join as join7 } from "node:path";
382154
- function realPathOrSelf(path3) {
382155
- try {
382156
- return realpathSync(path3);
382157
- } catch {
382158
- return path3;
382159
- }
382160
- }
382161
- function resolveTargetRoots(cwd2) {
382162
- const roots = [{ baseDir: cwd2, displayPrefix: "" }];
382163
- const homeDir = process.env.HOME || process.env.USERPROFILE || homedir2();
382164
- if (homeDir && homeDir !== cwd2) {
382165
- roots.push({ baseDir: homeDir, displayPrefix: "~/" });
382166
- }
382167
- return roots;
382168
- }
382169
- function resolveSkillTargets(cwd2) {
382170
- const targets = [];
382171
- const seen = new Set;
382172
- for (const root5 of resolveTargetRoots(cwd2)) {
382173
- for (const agentDirName of AGENT_DIRS) {
382174
- const agentDir = join7(root5.baseDir, agentDirName);
382175
- if (!existsSync(agentDir))
382176
- continue;
382177
- const dedupeKey = realPathOrSelf(agentDir);
382178
- if (seen.has(dedupeKey))
382179
- continue;
382180
- seen.add(dedupeKey);
382181
- const displaySkillDir = `${root5.displayPrefix}${agentDirName}/skills/superdoc/`;
382182
- targets.push({
382183
- skillDir: join7(agentDir, "skills", "superdoc"),
382184
- displaySkillDir
382185
- });
382186
- }
382187
- }
382188
- return targets;
382189
- }
382190
- var AGENT_DIRS;
382191
- var init_skill_targets = __esm(() => {
382192
- AGENT_DIRS = [".claude", ".agents"];
382193
- });
382194
-
382195
382159
  // src/commands/install.ts
382196
- import { existsSync as existsSync2, cpSync, mkdirSync } from "node:fs";
382197
- import { join as join8, dirname as dirname2 } from "node:path";
382160
+ import { existsSync, cpSync, mkdirSync } from "node:fs";
382161
+ import { join as join7, dirname as dirname2 } from "node:path";
382198
382162
  import { fileURLToPath as fileURLToPath2 } from "node:url";
382199
382163
  function resolveSkillSource() {
382200
- const fromDist = join8(__dirname2, "..", "skill");
382201
- if (existsSync2(fromDist))
382164
+ const fromDist = join7(__dirname2, "..", "skill");
382165
+ if (existsSync(fromDist))
382202
382166
  return fromDist;
382203
- const fromSrc = join8(__dirname2, "..", "..", "skill");
382204
- if (existsSync2(fromSrc))
382167
+ const fromSrc = join7(__dirname2, "..", "..", "skill");
382168
+ if (existsSync(fromSrc))
382205
382169
  return fromSrc;
382206
382170
  throw new Error("Could not locate bundled skill directory. Is the package installed correctly?");
382207
382171
  }
@@ -382213,31 +382177,38 @@ async function runInstall(tokens, io) {
382213
382177
  }
382214
382178
  const cwd2 = process.cwd();
382215
382179
  const skillSource = resolveSkillSource();
382216
- const targets = resolveSkillTargets(cwd2);
382217
382180
  let installed = 0;
382218
- for (const target2 of targets) {
382219
- mkdirSync(target2.skillDir, { recursive: true });
382220
- cpSync(skillSource, target2.skillDir, { recursive: true });
382221
- io.stdout(`Installed skill to ${target2.displaySkillDir}
382181
+ for (const target2 of AGENT_TARGETS) {
382182
+ const agentDir = join7(cwd2, target2.dir);
382183
+ if (!existsSync(agentDir))
382184
+ continue;
382185
+ const dest = join7(agentDir, "skills", "superdoc");
382186
+ mkdirSync(dest, { recursive: true });
382187
+ cpSync(skillSource, dest, { recursive: true });
382188
+ io.stdout(`Installed skill to ${target2.dir}/skills/superdoc/
382222
382189
  `);
382223
382190
  installed += 1;
382224
382191
  }
382225
382192
  if (installed === 0) {
382226
- io.stderr(`No agent directories found in current or home directory. Create .claude/ (Claude Code) or .agents/ (Codex) first, then re-run.
382193
+ io.stderr(`No agent directories found. Create .claude/ (Claude Code) or .agents/ (Codex) first, then re-run.
382227
382194
  `);
382228
382195
  return 1;
382229
382196
  }
382230
382197
  return 0;
382231
382198
  }
382232
- var __filename2, __dirname2;
382199
+ var __filename2, __dirname2, AGENT_TARGETS;
382233
382200
  var init_install = __esm(() => {
382234
- init_skill_targets();
382235
382201
  __filename2 = fileURLToPath2(import.meta.url);
382236
382202
  __dirname2 = dirname2(__filename2);
382203
+ AGENT_TARGETS = [
382204
+ { name: "Claude Code", dir: ".claude" },
382205
+ { name: "Codex", dir: ".agents" }
382206
+ ];
382237
382207
  });
382238
382208
 
382239
382209
  // src/commands/uninstall.ts
382240
- import { existsSync as existsSync3, rmSync } from "node:fs";
382210
+ import { existsSync as existsSync2, rmSync } from "node:fs";
382211
+ import { join as join8 } from "node:path";
382241
382212
  async function runUninstall(tokens, io) {
382242
382213
  if (!tokens.includes("--skills")) {
382243
382214
  io.stderr(`Usage: superdoc uninstall --skills
@@ -382245,13 +382216,13 @@ async function runUninstall(tokens, io) {
382245
382216
  return 1;
382246
382217
  }
382247
382218
  const cwd2 = process.cwd();
382248
- const targets = resolveSkillTargets(cwd2);
382249
382219
  let removed = 0;
382250
- for (const target2 of targets) {
382251
- if (!existsSync3(target2.skillDir))
382220
+ for (const target2 of SKILL_PATHS) {
382221
+ const fullPath = join8(cwd2, target2.path);
382222
+ if (!existsSync2(fullPath))
382252
382223
  continue;
382253
- rmSync(target2.skillDir, { recursive: true });
382254
- io.stdout(`Removed ${target2.displaySkillDir}
382224
+ rmSync(fullPath, { recursive: true });
382225
+ io.stdout(`Removed ${target2.path}/
382255
382226
  `);
382256
382227
  removed += 1;
382257
382228
  }
@@ -382261,8 +382232,12 @@ async function runUninstall(tokens, io) {
382261
382232
  }
382262
382233
  return 0;
382263
382234
  }
382235
+ var SKILL_PATHS;
382264
382236
  var init_uninstall = __esm(() => {
382265
- init_skill_targets();
382237
+ SKILL_PATHS = [
382238
+ { name: "Claude Code", path: ".claude/skills/superdoc" },
382239
+ { name: "Codex", path: ".agents/skills/superdoc" }
382240
+ ];
382266
382241
  });
382267
382242
 
382268
382243
  // src/host/session-pool.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.99",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -20,21 +20,21 @@
20
20
  "@types/bun": "^1.3.8",
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
- "@superdoc/pm-adapter": "0.0.0",
24
- "superdoc": "1.18.0",
23
+ "@superdoc/document-api": "0.0.1",
25
24
  "@superdoc/super-editor": "0.0.1",
26
- "@superdoc/document-api": "0.0.1"
25
+ "@superdoc/pm-adapter": "0.0.0",
26
+ "superdoc": "1.18.2"
27
27
  },
28
28
  "module": "src/index.ts",
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.99",
34
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.99",
35
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.99",
36
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.99",
37
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.99"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0",
36
+ "@superdoc-dev/cli-linux-arm64": "0.2.0",
37
+ "@superdoc-dev/cli-windows-x64": "0.2.0"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",