@superdoc-dev/cli 0.4.0-next.12 → 0.4.0-next.14

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 +71 -47
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -41140,7 +41140,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
41140
41140
  emptyOptions2 = {};
41141
41141
  });
41142
41142
 
41143
- // ../../packages/superdoc/dist/chunks/SuperConverter-C9MZOwsC.es.js
41143
+ // ../../packages/superdoc/dist/chunks/SuperConverter-CrD9C1_e.es.js
41144
41144
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
41145
41145
  const fieldValue = extension$1.config[field];
41146
41146
  if (typeof fieldValue === "function")
@@ -58889,6 +58889,8 @@ function getInlineRunProperties(runPropertiesFromMarks, runPropertiesFromStyles,
58889
58889
  Object.keys(existingRunProperties).forEach((key) => {
58890
58890
  if (RUN_PROPERTIES_DERIVED_FROM_MARKS.has(key) && !preservedDerivedKeys.has(key))
58891
58891
  return;
58892
+ if (key === "styleId" && TRANSIENT_HYPERLINK_STYLE_IDS.has(existingRunProperties[key]) && (runPropertiesFromMarks.styleId == null || runPropertiesFromMarks.styleId === ""))
58893
+ return;
58892
58894
  if (key in inlineRunProperties)
58893
58895
  return;
58894
58896
  if (existingRunProperties[key] === undefined)
@@ -61217,7 +61219,7 @@ function handleHtmlPaste(html2, editor, source) {
61217
61219
  cleanedHtml = htmlHandler(html2, editor);
61218
61220
  if (cleanedHtml?.dataset)
61219
61221
  cleanedHtml.dataset.superdocImport = "true";
61220
- let doc$2 = DOMParser$1.fromSchema(editor.schema).parse(cleanedHtml, { preserveWhitespace: true });
61222
+ let doc$2 = DOMParser$1.fromSchema(editor.schema).parse(cleanedHtml);
61221
61223
  doc$2 = mergeAdjacentTableFragments(doc$2);
61222
61224
  doc$2 = wrapTextsInRuns(doc$2);
61223
61225
  const { dispatch, state } = editor.view;
@@ -85438,7 +85440,7 @@ var isRegExp = (value) => {
85438
85440
  start: safeStart,
85439
85441
  end: safeEnd
85440
85442
  };
85441
- }, RUN_PROPERTIES_DERIVED_FROM_MARKS, RUN_PROPERTY_PRESERVE_META_KEY = "sdPreserveRunPropertiesKeys", calculateInlineRunPropertiesPlugin = (editor) => new Plugin({ appendTransaction(transactions, _oldState, newState) {
85443
+ }, RUN_PROPERTIES_DERIVED_FROM_MARKS, TRANSIENT_HYPERLINK_STYLE_IDS, RUN_PROPERTY_PRESERVE_META_KEY = "sdPreserveRunPropertiesKeys", calculateInlineRunPropertiesPlugin = (editor) => new Plugin({ appendTransaction(transactions, _oldState, newState) {
85442
85444
  const tr = newState.tr;
85443
85445
  if (!transactions.some((t) => t.docChanged))
85444
85446
  return null;
@@ -91371,7 +91373,7 @@ var isRegExp = (value) => {
91371
91373
  state.kern = kernNode.attributes["w:val"];
91372
91374
  }
91373
91375
  }, SuperConverter;
91374
- var init_SuperConverter_C9MZOwsC_es = __esm(() => {
91376
+ var init_SuperConverter_CrD9C1_e_es = __esm(() => {
91375
91377
  init_rolldown_runtime_B2q5OVn9_es();
91376
91378
  init_jszip_ChlR43oI_es();
91377
91379
  init_xml_js_40FWvL78_es();
@@ -119700,6 +119702,7 @@ var init_SuperConverter_C9MZOwsC_es = __esm(() => {
119700
119702
  "vertAlign",
119701
119703
  "position"
119702
119704
  ]);
119705
+ TRANSIENT_HYPERLINK_STYLE_IDS = new Set(["Hyperlink", "FollowedHyperlink"]);
119703
119706
  init_dist();
119704
119707
  DEFAULT_ALLOWED_PROTOCOLS = [
119705
119708
  "http",
@@ -154597,7 +154600,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
154597
154600
  init_remark_gfm_z_sDF4ss_es();
154598
154601
  });
154599
154602
 
154600
- // ../../packages/superdoc/dist/chunks/src-GN-UTjOb.es.js
154603
+ // ../../packages/superdoc/dist/chunks/src-BK2GcXbz.es.js
154601
154604
  function deleteProps(obj, propOrProps) {
154602
154605
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
154603
154606
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -217357,9 +217360,25 @@ var Node$13 = class Node$14 {
217357
217360
  if (Object.keys(normalizedSnapshotAttrs).length === 0)
217358
217361
  return false;
217359
217362
  return (0, import_lodash$1.isMatch)(normalizedMarkAttrs, normalizedSnapshotAttrs);
217363
+ }, markAttrsMatchOnOverlap = (mark2, snapshot2) => {
217364
+ if (!mark2 || !snapshot2 || mark2.type.name !== snapshot2.type)
217365
+ return false;
217366
+ if (!ATTRIBUTE_ONLY_MARKS.includes(snapshot2.type))
217367
+ return false;
217368
+ const normalizedMarkAttrs = normalizeAttrs(mark2.attrs || {});
217369
+ const normalizedSnapshotAttrs = normalizeAttrs(snapshot2.attrs || {});
217370
+ const markKeys$1 = Object.keys(normalizedMarkAttrs);
217371
+ const snapshotKeys = Object.keys(normalizedSnapshotAttrs);
217372
+ if (markKeys$1.length === 0 || snapshotKeys.length === 0)
217373
+ return false;
217374
+ const overlapKeys = markKeys$1.filter((key$1) => Object.prototype.hasOwnProperty.call(normalizedSnapshotAttrs, key$1));
217375
+ if (overlapKeys.length === 0)
217376
+ return false;
217377
+ return overlapKeys.every((key$1) => (0, import_lodash$1.isEqual)(normalizedMarkAttrs[key$1], normalizedSnapshotAttrs[key$1]));
217360
217378
  }, findMarkInRangeBySnapshot = ({ doc: doc$12, from: from$1, to, snapshot: snapshot2 }) => {
217361
217379
  let exactMatch = null;
217362
217380
  let subsetMatch = null;
217381
+ let overlapMatch = null;
217363
217382
  let typeOnlyMatch = null;
217364
217383
  const normalizedSnapshotAttrs = normalizeAttrs(snapshot2?.attrs || {});
217365
217384
  const shouldFallbackToTypeOnly = !(Object.keys(normalizedSnapshotAttrs).length > 0);
@@ -217378,13 +217397,18 @@ var Node$13 = class Node$14 {
217378
217397
  if (subset)
217379
217398
  subsetMatch = subset;
217380
217399
  }
217400
+ if (!overlapMatch) {
217401
+ const overlap = node3.marks.find((mark2) => markAttrsMatchOnOverlap(mark2, snapshot2));
217402
+ if (overlap)
217403
+ overlapMatch = overlap;
217404
+ }
217381
217405
  if (!typeOnlyMatch) {
217382
217406
  const fallback = node3.marks.find((mark2) => markMatchesSnapshot(mark2, snapshot2, false));
217383
217407
  if (fallback)
217384
217408
  typeOnlyMatch = fallback;
217385
217409
  }
217386
217410
  });
217387
- const liveMark = exactMatch || subsetMatch || (shouldFallbackToTypeOnly ? typeOnlyMatch : null);
217411
+ const liveMark = exactMatch || subsetMatch || overlapMatch || (shouldFallbackToTypeOnly ? typeOnlyMatch : null);
217388
217412
  if (!liveMark)
217389
217413
  console.debug("[track-changes] could not find live mark for snapshot", snapshot2);
217390
217414
  return liveMark;
@@ -228467,6 +228491,27 @@ var Node$13 = class Node$14 {
228467
228491
  if (borders.left)
228468
228492
  parts.push(`l:[${hashBorderSpec(borders.left)}]`);
228469
228493
  return parts.join(";");
228494
+ }, hashRunVisualMarks = (run2) => {
228495
+ const bold = "bold" in run2 ? run2.bold : false;
228496
+ const italic = "italic" in run2 ? run2.italic : false;
228497
+ const underline = "underline" in run2 ? run2.underline : undefined;
228498
+ const strike = "strike" in run2 ? run2.strike : false;
228499
+ const color2 = "color" in run2 ? run2.color : undefined;
228500
+ const fontSize = "fontSize" in run2 ? run2.fontSize : undefined;
228501
+ const fontFamily = "fontFamily" in run2 ? run2.fontFamily : undefined;
228502
+ const highlight = "highlight" in run2 ? run2.highlight : undefined;
228503
+ const link2 = "link" in run2 ? run2.link : undefined;
228504
+ return [
228505
+ bold ? "b" : "",
228506
+ italic ? "i" : "",
228507
+ underline ? `u:${JSON.stringify(underline)}` : "",
228508
+ strike ? "s" : "",
228509
+ color2 ?? "",
228510
+ fontSize !== undefined ? `fs:${fontSize}` : "",
228511
+ fontFamily ? `ff:${fontFamily}` : "",
228512
+ highlight ? `hl:${highlight}` : "",
228513
+ link2 ? `ln:${JSON.stringify(link2)}` : ""
228514
+ ].join("");
228470
228515
  }, MAX_CACHE_SIZE = 1e4, BYTES_PER_ENTRY_ESTIMATE = 5000, hashParagraphFrame = (frame) => {
228471
228516
  const parts = [];
228472
228517
  if (frame.wrap !== undefined)
@@ -228517,20 +228562,7 @@ var Node$13 = class Node$14 {
228517
228562
  continue;
228518
228563
  for (const run2 of paragraphBlock.runs) {
228519
228564
  const text5 = "text" in run2 && typeof run2.text === "string" ? run2.text : "";
228520
- const bold = "bold" in run2 ? run2.bold : false;
228521
- const italic = "italic" in run2 ? run2.italic : false;
228522
- const color2 = "color" in run2 ? run2.color : undefined;
228523
- const fontSize = "fontSize" in run2 ? run2.fontSize : undefined;
228524
- const fontFamily = "fontFamily" in run2 ? run2.fontFamily : undefined;
228525
- const highlight = "highlight" in run2 ? run2.highlight : undefined;
228526
- const marks = [
228527
- bold ? "b" : "",
228528
- italic ? "i" : "",
228529
- color2 ?? "",
228530
- fontSize !== undefined ? `fs:${fontSize}` : "",
228531
- fontFamily ? `ff:${fontFamily}` : "",
228532
- highlight ? `hl:${highlight}` : ""
228533
- ].join("");
228565
+ const marks = hashRunVisualMarks(run2);
228534
228566
  const commentHash = hasComments$1(run2) ? run2.comments.map((c) => `${c.commentId ?? ""}:${c.internal ? "1" : "0"}`).join("|") : "";
228535
228567
  let trackedKey = "";
228536
228568
  if (hasTrackedChange(run2)) {
@@ -228619,20 +228651,7 @@ var Node$13 = class Node$14 {
228619
228651
  if (run2.kind === "fieldAnnotation")
228620
228652
  return `fa:${fieldAnnotationKey(run2)}`;
228621
228653
  const text5 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" ? "" : run2.text ?? "";
228622
- const bold = "bold" in run2 ? run2.bold : false;
228623
- const italic = "italic" in run2 ? run2.italic : false;
228624
- const color2 = "color" in run2 ? run2.color : undefined;
228625
- const fontSize = "fontSize" in run2 ? run2.fontSize : undefined;
228626
- const fontFamily = "fontFamily" in run2 ? run2.fontFamily : undefined;
228627
- const highlight = "highlight" in run2 ? run2.highlight : undefined;
228628
- const marks = [
228629
- bold ? "b" : "",
228630
- italic ? "i" : "",
228631
- color2 ?? "",
228632
- fontSize !== undefined ? `fs:${fontSize}` : "",
228633
- fontFamily ? `ff:${fontFamily}` : "",
228634
- highlight ? `hl:${highlight}` : ""
228635
- ].join("");
228654
+ const marks = hashRunVisualMarks(run2);
228636
228655
  let trackedKey = "";
228637
228656
  if (hasTrackedChange(run2)) {
228638
228657
  const tc = run2.trackedChange;
@@ -229360,7 +229379,7 @@ var Node$13 = class Node$14 {
229360
229379
  for (let i4 = 0;i4 < a2.runs.length; i4 += 1) {
229361
229380
  const runA = a2.runs[i4];
229362
229381
  const runB = b$1.runs[i4];
229363
- if (("src" in runA || runA.kind === "lineBreak" || runA.kind === "break" || runA.kind === "fieldAnnotation" ? "" : runA.text) !== ("src" in runB || runB.kind === "lineBreak" || runB.kind === "break" || runB.kind === "fieldAnnotation" ? "" : runB.text) || fieldAnnotationKey(runA) !== fieldAnnotationKey(runB) || ("bold" in runA ? runA.bold : false) !== ("bold" in runB ? runB.bold : false) || ("italic" in runA ? runA.italic : false) !== ("italic" in runB ? runB.italic : false) || ("color" in runA ? runA.color : undefined) !== ("color" in runB ? runB.color : undefined) || ("fontSize" in runA ? runA.fontSize : undefined) !== ("fontSize" in runB ? runB.fontSize : undefined) || ("fontFamily" in runA ? runA.fontFamily : undefined) !== ("fontFamily" in runB ? runB.fontFamily : undefined) || ("highlight" in runA ? runA.highlight : undefined) !== ("highlight" in runB ? runB.highlight : undefined) || getTrackedChangeKey(runA) !== getTrackedChangeKey(runB) || getCommentKey(runA) !== getCommentKey(runB))
229382
+ if (("src" in runA || runA.kind === "lineBreak" || runA.kind === "break" || runA.kind === "fieldAnnotation" ? "" : runA.text) !== ("src" in runB || runB.kind === "lineBreak" || runB.kind === "break" || runB.kind === "fieldAnnotation" ? "" : runB.text) || fieldAnnotationKey(runA) !== fieldAnnotationKey(runB) || hashRunVisualMarks(runA) !== hashRunVisualMarks(runB) || getTrackedChangeKey(runA) !== getTrackedChangeKey(runB) || getCommentKey(runA) !== getCommentKey(runB))
229364
229383
  return false;
229365
229384
  }
229366
229385
  return true;
@@ -234205,9 +234224,9 @@ var Node$13 = class Node$14 {
234205
234224
  return;
234206
234225
  console.log(...args$1);
234207
234226
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
234208
- var init_src_GN_UTjOb_es = __esm(() => {
234227
+ var init_src_BK2GcXbz_es = __esm(() => {
234209
234228
  init_rolldown_runtime_B2q5OVn9_es();
234210
- init_SuperConverter_C9MZOwsC_es();
234229
+ init_SuperConverter_CrD9C1_e_es();
234211
234230
  init_jszip_ChlR43oI_es();
234212
234231
  init_uuid_qzgm05fK_es();
234213
234232
  init_constants_Qqwopz80_es();
@@ -250769,9 +250788,6 @@ function print() { __p += __j.call(arguments, '') }
250769
250788
  map$12.appendMap(deletionStep.getMap());
250770
250789
  return;
250771
250790
  }
250772
- trackedMark.attrs.before.forEach((oldMark) => {
250773
- tr.step(new AddMarkStep(mappedFrom, mappedTo, state.schema.marks[oldMark.type].create(oldMark.attrs)));
250774
- });
250775
250791
  trackedMark.attrs.after.forEach((newMark) => {
250776
250792
  const liveMark = findMarkInRangeBySnapshot({
250777
250793
  doc: tr.doc,
@@ -250783,6 +250799,9 @@ function print() { __p += __j.call(arguments, '') }
250783
250799
  return;
250784
250800
  tr.step(new RemoveMarkStep(mappedFrom, mappedTo, liveMark));
250785
250801
  });
250802
+ trackedMark.attrs.before.forEach((oldMark) => {
250803
+ tr.step(new AddMarkStep(mappedFrom, mappedTo, state.schema.marks[oldMark.type].create(oldMark.attrs)));
250804
+ });
250786
250805
  tr.step(new RemoveMarkStep(mappedFrom, mappedTo, trackedMark));
250787
250806
  });
250788
250807
  return dispatchTrackedChangeResolution({
@@ -267524,8 +267543,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
267524
267543
 
267525
267544
  // ../../packages/superdoc/dist/super-editor.es.js
267526
267545
  var init_super_editor_es = __esm(() => {
267527
- init_src_GN_UTjOb_es();
267528
- init_SuperConverter_C9MZOwsC_es();
267546
+ init_src_BK2GcXbz_es();
267547
+ init_SuperConverter_CrD9C1_e_es();
267529
267548
  init_jszip_ChlR43oI_es();
267530
267549
  init_xml_js_40FWvL78_es();
267531
267550
  init_constants_Qqwopz80_es();
@@ -320803,6 +320822,12 @@ function resolveCollaborationProfile(input2, sessionId) {
320803
320822
  bootstrapSettlingMs: input2.bootstrapSettlingMs
320804
320823
  };
320805
320824
  }
320825
+ function buildShorthandCollaborationInput(params4) {
320826
+ return parseCollaborationInput({
320827
+ providerType: DEFAULT_SHORTHAND_COLLABORATION_PROVIDER_TYPE,
320828
+ ...params4
320829
+ });
320830
+ }
320806
320831
  function resolveCollaborationToken(profile) {
320807
320832
  if (!profile.tokenEnv)
320808
320833
  return;
@@ -320890,7 +320915,7 @@ function createCollaborationRuntime(profile) {
320890
320915
  }
320891
320916
  };
320892
320917
  }
320893
- var DEFAULT_SYNC_TIMEOUT_MS = 1e4, SYNC_POLL_INTERVAL_MS = 25, ENV_VAR_NAME_PATTERN;
320918
+ var DEFAULT_SHORTHAND_COLLABORATION_PROVIDER_TYPE = "y-websocket", DEFAULT_SYNC_TIMEOUT_MS = 1e4, SYNC_POLL_INTERVAL_MS = 25, ENV_VAR_NAME_PATTERN;
320894
320919
  var init_collaboration = __esm(() => {
320895
320920
  init_hocuspocus_provider_esm();
320896
320921
  init_y_websocket();
@@ -326104,12 +326129,11 @@ async function runOpen(tokens, context) {
326104
326129
  payload.bootstrapSettlingMs = bootstrapSettlingMs;
326105
326130
  collaborationInput = parseCollaborationInput(payload);
326106
326131
  } else if (collabUrl) {
326107
- collaborationInput = parseCollaborationInput({
326108
- providerType: "hocuspocus",
326132
+ collaborationInput = buildShorthandCollaborationInput({
326109
326133
  url: collabUrl,
326110
326134
  documentId: collabDocumentId,
326111
- ...onMissing != null ? { onMissing } : {},
326112
- ...bootstrapSettlingMs != null ? { bootstrapSettlingMs } : {}
326135
+ onMissing,
326136
+ bootstrapSettlingMs
326113
326137
  });
326114
326138
  } else if (collabDocumentId) {
326115
326139
  throw new CliError("MISSING_REQUIRED", "open: --collab-document-id requires --collab-url.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.4.0-next.12",
3
+ "version": "0.4.0-next.14",
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.21.0",
25
23
  "@superdoc/document-api": "0.0.1",
26
- "@superdoc/super-editor": "0.0.1"
24
+ "@superdoc/pm-adapter": "0.0.0",
25
+ "@superdoc/super-editor": "0.0.1",
26
+ "superdoc": "1.21.0"
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.4.0-next.12",
34
- "@superdoc-dev/cli-darwin-x64": "0.4.0-next.12",
35
- "@superdoc-dev/cli-linux-x64": "0.4.0-next.12",
36
- "@superdoc-dev/cli-windows-x64": "0.4.0-next.12",
37
- "@superdoc-dev/cli-linux-arm64": "0.4.0-next.12"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.4.0-next.14",
34
+ "@superdoc-dev/cli-darwin-x64": "0.4.0-next.14",
35
+ "@superdoc-dev/cli-linux-arm64": "0.4.0-next.14",
36
+ "@superdoc-dev/cli-linux-x64": "0.4.0-next.14",
37
+ "@superdoc-dev/cli-windows-x64": "0.4.0-next.14"
38
38
  },
39
39
  "scripts": {
40
40
  "predev": "node scripts/ensure-superdoc-build.js",