@superdoc-dev/cli 0.2.0-next.98 → 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 +59 -32
  2. package/package.json +7 -7
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-6i-hCnOE.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_6i_hCnOE_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_6i_hCnOE_es = __esm(() => {
94979
94979
  static getStoredSuperdocVersion(docx) {
94980
94980
  return SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
94981
94981
  }
94982
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.17.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-CpAHRXG4.es.js
121918
- var exports_src_CpAHRXG4_es = {};
121919
- __export(exports_src_CpAHRXG4_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.17.0";
122153
+ return "1.18.2";
122150
122154
  } catch {
122151
122155
  return "unknown";
122152
122156
  }
@@ -161564,7 +161568,7 @@ function computeAnchorMap(bookmarks, layout, blocks2) {
161564
161568
  });
161565
161569
  return anchorMap;
161566
161570
  }
161567
- 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 }) {
161568
161572
  if (!anchor)
161569
161573
  return false;
161570
161574
  if (!layout)
@@ -161576,9 +161580,11 @@ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks
161576
161580
  if (pmPos == null)
161577
161581
  return false;
161578
161582
  let pageIndex = (selectionToRects(layout, blocks2, measures, pmPos, pmPos + 1, pageGeometryHelper) ?? [])[0]?.pageIndex ?? null;
161583
+ let fragmentY = null;
161579
161584
  if (pageIndex == null) {
161580
161585
  let nextFragmentPage = null;
161581
161586
  let nextFragmentStart = null;
161587
+ let nextFragmentY = null;
161582
161588
  for (const page of layout.pages) {
161583
161589
  for (const fragment of page.fragments) {
161584
161590
  if (fragment.kind !== "para")
@@ -161589,25 +161595,46 @@ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks
161589
161595
  continue;
161590
161596
  if (pmPos >= fragStart && pmPos < fragEnd) {
161591
161597
  pageIndex = page.number - 1;
161598
+ fragmentY = fragment.y;
161592
161599
  break;
161593
161600
  }
161594
161601
  if (fragStart > pmPos && (nextFragmentStart === null || fragStart < nextFragmentStart)) {
161595
161602
  nextFragmentPage = page.number - 1;
161596
161603
  nextFragmentStart = fragStart;
161604
+ nextFragmentY = fragment.y;
161597
161605
  }
161598
161606
  }
161599
161607
  if (pageIndex != null)
161600
161608
  break;
161601
161609
  }
161602
- if (pageIndex == null && nextFragmentPage != null)
161610
+ if (pageIndex == null && nextFragmentPage != null) {
161603
161611
  pageIndex = nextFragmentPage;
161612
+ fragmentY = nextFragmentY;
161613
+ }
161604
161614
  }
161605
161615
  if (pageIndex == null)
161606
161616
  return false;
161607
161617
  scrollPageIntoView(pageIndex);
161608
161618
  await waitForPageMount(pageIndex, timeoutMs);
161609
161619
  const pageEl = getPageElementByIndex(painterHost, pageIndex);
161610
- 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)
161611
161638
  pageEl.scrollIntoView({
161612
161639
  behavior: "instant",
161613
161640
  block: "start"
@@ -180189,7 +180216,7 @@ var Node$13 = class Node$14 {
180189
180216
  domAvailabilityCache = false;
180190
180217
  return false;
180191
180218
  }
180192
- }, summaryVersion = "1.17.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
180219
+ }, summaryVersion = "1.18.2", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
180193
180220
  const container = document.createElement("div");
180194
180221
  container.innerHTML = html3;
180195
180222
  const result = [];
@@ -180757,8 +180784,6 @@ var Node$13 = class Node$14 {
180757
180784
  existingFileNames.add(uniqueFileName);
180758
180785
  const mediaPath = buildMediaPath(uniqueFileName);
180759
180786
  mediaStore[mediaPath] = src;
180760
- if (editor.options.ydoc)
180761
- editor.options.ydoc.getMap("media").set(mediaPath, src);
180762
180787
  const rId = addImageRelationship({
180763
180788
  editor,
180764
180789
  path: mediaPath.startsWith("word/") ? mediaPath.slice(5) : mediaPath
@@ -199186,16 +199211,16 @@ var Node$13 = class Node$14 {
199186
199211
  trackedChanges: context.trackedChanges ?? []
199187
199212
  });
199188
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;
199189
- var init_src_CpAHRXG4_es = __esm(() => {
199214
+ var init_src_B5RzIebm_es = __esm(() => {
199190
199215
  init_rolldown_runtime_B2q5OVn9_es();
199191
- init_SuperConverter_6i_hCnOE_es();
199216
+ init_SuperConverter_B7Dckk9A_es();
199192
199217
  init_jszip_ChlR43oI_es();
199193
199218
  init_uuid_qzgm05fK_es();
199194
199219
  init_constants_CMPtQbp7_es();
199195
199220
  init_unified_BRHLwnjP_es();
199196
199221
  init_remark_gfm_z_sDF4ss_es();
199197
199222
  init_remark_stringify_D8vxv_XI_es();
199198
- init_DocxZipper_Dt7MDO2A_es();
199223
+ init_DocxZipper_Db__JB22_es();
199199
199224
  init_vue_q66HzpoR_es();
199200
199225
  init__plugin_vue_export_helper_HmhZBO0u_es();
199201
199226
  init_eventemitter3_DGBTyUUP_es();
@@ -209549,7 +209574,7 @@ function print() { __p += __j.call(arguments, '') }
209549
209574
  return migrations.length > 0;
209550
209575
  }
209551
209576
  processCollaborationMigrations() {
209552
- console.debug("[checkVersionMigrations] Current editor version", "1.17.0");
209577
+ console.debug("[checkVersionMigrations] Current editor version", "1.18.2");
209553
209578
  if (!this.options.ydoc)
209554
209579
  return;
209555
209580
  let docVersion = this.options.ydoc.getMap("meta").get("version");
@@ -215580,7 +215605,7 @@ function print() { __p += __j.call(arguments, '') }
215580
215605
  const commentAnnotations = textRun.comments;
215581
215606
  const hasAnyComment = !!commentAnnotations?.length;
215582
215607
  const commentHighlight = getCommentHighlight(textRun, this.activeCommentId);
215583
- if (commentHighlight.color && !textRun.highlight && hasAnyComment) {
215608
+ if (commentHighlight.color && hasAnyComment) {
215584
215609
  elem.style.backgroundColor = commentHighlight.color;
215585
215610
  if (commentHighlight.hasNestedComments && commentHighlight.baseColor) {
215586
215611
  const borderColor = `${commentHighlight.baseColor}99`;
@@ -220446,6 +220471,8 @@ function print() { __p += __j.call(arguments, '') }
220446
220471
  bookmarks: this.#layoutState.bookmarks,
220447
220472
  pageGeometryHelper: this.#pageGeometryHelper ?? undefined,
220448
220473
  painterHost: this.#painterHost,
220474
+ scrollContainer: this.#scrollContainer ?? this.#visibleHost,
220475
+ zoom: this.zoom,
220449
220476
  scrollPageIntoView: (pageIndex) => this.#scrollPageIntoView(pageIndex),
220450
220477
  waitForPageMount: (pageIndex, timeoutMs) => this.#waitForPageMount(pageIndex, { timeout: timeoutMs }),
220451
220478
  getActiveEditor: () => this.getActiveEditor(),
@@ -230937,8 +230964,8 @@ function print() { __p += __j.call(arguments, '') }
230937
230964
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
230938
230965
  };
230939
230966
  stubFalse_default = stubFalse;
230940
- freeExports$2 = typeof exports_src_CpAHRXG4_es == "object" && exports_src_CpAHRXG4_es && !exports_src_CpAHRXG4_es.nodeType && exports_src_CpAHRXG4_es;
230941
- freeModule$2 = freeExports$2 && typeof module_src_CpAHRXG4_es == "object" && module_src_CpAHRXG4_es && !module_src_CpAHRXG4_es.nodeType && module_src_CpAHRXG4_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;
230942
230969
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
230943
230970
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
230944
230971
  typedArrayTags = {};
@@ -230946,8 +230973,8 @@ function print() { __p += __j.call(arguments, '') }
230946
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;
230947
230974
  _baseIsTypedArray_default = baseIsTypedArray;
230948
230975
  _baseUnary_default = baseUnary;
230949
- freeExports$1 = typeof exports_src_CpAHRXG4_es == "object" && exports_src_CpAHRXG4_es && !exports_src_CpAHRXG4_es.nodeType && exports_src_CpAHRXG4_es;
230950
- freeModule$1 = freeExports$1 && typeof module_src_CpAHRXG4_es == "object" && module_src_CpAHRXG4_es && !module_src_CpAHRXG4_es.nodeType && module_src_CpAHRXG4_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;
230951
230978
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
230952
230979
  _nodeUtil_default = function() {
230953
230980
  try {
@@ -231052,8 +231079,8 @@ function print() { __p += __j.call(arguments, '') }
231052
231079
  Stack.prototype.has = _stackHas_default;
231053
231080
  Stack.prototype.set = _stackSet_default;
231054
231081
  _Stack_default = Stack;
231055
- freeExports = typeof exports_src_CpAHRXG4_es == "object" && exports_src_CpAHRXG4_es && !exports_src_CpAHRXG4_es.nodeType && exports_src_CpAHRXG4_es;
231056
- freeModule = freeExports && typeof module_src_CpAHRXG4_es == "object" && module_src_CpAHRXG4_es && !module_src_CpAHRXG4_es.nodeType && module_src_CpAHRXG4_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;
231057
231084
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
231058
231085
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
231059
231086
  _cloneBuffer_default = cloneBuffer;
@@ -239133,13 +239160,13 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
239133
239160
 
239134
239161
  // ../../packages/superdoc/dist/super-editor.es.js
239135
239162
  var init_super_editor_es = __esm(() => {
239136
- init_src_CpAHRXG4_es();
239137
- init_SuperConverter_6i_hCnOE_es();
239163
+ init_src_B5RzIebm_es();
239164
+ init_SuperConverter_B7Dckk9A_es();
239138
239165
  init_jszip_ChlR43oI_es();
239139
239166
  init_xml_js_DLE8mr0n_es();
239140
239167
  init_constants_CMPtQbp7_es();
239141
239168
  init_unified_BRHLwnjP_es();
239142
- init_DocxZipper_Dt7MDO2A_es();
239169
+ init_DocxZipper_Db__JB22_es();
239143
239170
  init_vue_q66HzpoR_es();
239144
239171
  init_eventemitter3_DGBTyUUP_es();
239145
239172
  init_zipper_DqXT7uTa_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.98",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -23,18 +23,18 @@
23
23
  "@superdoc/document-api": "0.0.1",
24
24
  "@superdoc/super-editor": "0.0.1",
25
25
  "@superdoc/pm-adapter": "0.0.0",
26
- "superdoc": "1.17.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.98",
34
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.98",
35
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.98",
36
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.98",
37
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.98"
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",