@superdoc-dev/cli 0.8.0-next.93 → 0.8.0-next.95

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 +101 -74
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -208524,7 +208524,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
208524
208524
  init_remark_gfm_BhnWr3yf_es();
208525
208525
  });
208526
208526
 
208527
- // ../../packages/superdoc/dist/chunks/src-BdpJXQ5F.es.js
208527
+ // ../../packages/superdoc/dist/chunks/src-DnSeNxAx.es.js
208528
208528
  function deleteProps(obj, propOrProps) {
208529
208529
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
208530
208530
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -265298,7 +265298,7 @@ function mergeAdjacentRuns(runs2) {
265298
265298
  let current = runs2[0];
265299
265299
  for (let i4 = 1;i4 < runs2.length; i4++) {
265300
265300
  const next2 = runs2[i4];
265301
- if (isTextRun$3(current) && isTextRun$3(next2) && !current.token && !next2.token && current.pmStart != null && current.pmEnd != null && next2.pmStart != null && next2.pmEnd != null && current.pmEnd === next2.pmStart && current.fontFamily === next2.fontFamily && current.fontSize === next2.fontSize && current.bold === next2.bold && current.italic === next2.italic && current.underline === next2.underline && current.strike === next2.strike && current.color === next2.color && current.highlight === next2.highlight && (current.letterSpacing ?? 0) === (next2.letterSpacing ?? 0) && trackedChangesCompatible(current, next2) && dataAttrsCompatible(current, next2) && commentsCompatible(current, next2)) {
265301
+ if (isTextRun$3(current) && isTextRun$3(next2) && !current.token && !next2.token && current.pmStart != null && current.pmEnd != null && next2.pmStart != null && next2.pmEnd != null && current.pmEnd === next2.pmStart && current.fontFamily === next2.fontFamily && current.fontSize === next2.fontSize && current.bold === next2.bold && current.italic === next2.italic && current.underline === next2.underline && current.strike === next2.strike && current.color === next2.color && current.highlight === next2.highlight && (current.letterSpacing ?? 0) === (next2.letterSpacing ?? 0) && trackedChangesCompatible(current, next2) && dataAttrsCompatible(current, next2) && commentsCompatible(current, next2) && bidiCompatible(current, next2)) {
265302
265302
  const currText = current.text ?? "";
265303
265303
  const nextText = next2.text ?? "";
265304
265304
  current = {
@@ -265761,7 +265761,9 @@ function toFlowBlocks(pmDoc, options) {
265761
265761
  };
265762
265762
  const bodySectionProps = doc$12.attrs?.bodySectPr ?? doc$12.attrs?.sectPr;
265763
265763
  const sectionRanges = options?.emitSectionBreaks ? analyzeSectionRanges(doc$12, bodySectionProps) : [];
265764
- converterContext.sectionDirection = converterContext.sectionDirection ?? resolveSectionDirectionFromSectPr(sectionRanges[0]?.sectPr ?? bodySectionProps);
265764
+ const firstSectPr = sectionRanges[0]?.sectPr ?? bodySectionProps;
265765
+ converterContext.sectionDirection = converterContext.sectionDirection ?? resolveSectionDirectionFromSectPr(firstSectPr);
265766
+ converterContext.sectionDirectionContext = resolveSectionDirection(firstSectPr);
265765
265767
  publishSectionMetadata(sectionRanges, options);
265766
265768
  if (sectionRanges.length > 0 && sectionRanges[0]) {
265767
265769
  const sectionBreak = createSectionBreakBlock(sectionRanges[0], nextBlockId, { isFirstSection: true });
@@ -290786,6 +290788,10 @@ menclose::after {
290786
290788
  if (runToken === "totalPageCount")
290787
290789
  return context.totalPages ? String(context.totalPages) : run2.text ?? "";
290788
290790
  return run2.text ?? "";
290791
+ }, RTL_DATE_LIKE_TOKEN_RE, RLM = "‏", normalizeRtlDateTokenForWordParity = (text5) => {
290792
+ if (!RTL_DATE_LIKE_TOKEN_RE.test(text5))
290793
+ return text5;
290794
+ return text5.replace(/[./-]/g, (separator) => `${RLM}${separator}${RLM}`);
290789
290795
  }, createDomPainter = (options) => {
290790
290796
  const painter = new DomPainter(options);
290791
290797
  return {
@@ -291277,7 +291283,8 @@ menclose::after {
291277
291283
  textRun.baselineShift != null ? textRun.baselineShift : "",
291278
291284
  textRun.token ?? "",
291279
291285
  textRun.trackedChange ? 1 : 0,
291280
- textRun.comments?.length ?? 0
291286
+ textRun.comments?.length ?? 0,
291287
+ textRun.bidi ? JSON.stringify(textRun.bidi) : ""
291281
291288
  ].join(",");
291282
291289
  }).join("|");
291283
291290
  const attrs = block.attrs;
@@ -291442,6 +291449,8 @@ menclose::after {
291442
291449
  hash$3 = hashString(hash$3, getRunBooleanProp(run2, "strike") ? "1" : "");
291443
291450
  hash$3 = hashString(hash$3, getRunStringProp(run2, "vertAlign"));
291444
291451
  hash$3 = hashNumber(hash$3, getRunNumberProp(run2, "baselineShift"));
291452
+ const bidi = run2.bidi;
291453
+ hash$3 = hashString(hash$3, bidi ? JSON.stringify(bidi) : "");
291445
291454
  }
291446
291455
  }
291447
291456
  }
@@ -291944,6 +291953,7 @@ menclose::after {
291944
291953
  const fontFamily = "fontFamily" in run2 ? run2.fontFamily : undefined;
291945
291954
  const highlight = "highlight" in run2 ? run2.highlight : undefined;
291946
291955
  const link2 = "link" in run2 ? run2.link : undefined;
291956
+ const bidi = "bidi" in run2 ? run2.bidi : undefined;
291947
291957
  return [
291948
291958
  bold2 ? "b" : "",
291949
291959
  italic ? "i" : "",
@@ -291953,7 +291963,8 @@ menclose::after {
291953
291963
  fontSize !== undefined ? `fs:${fontSize}` : "",
291954
291964
  fontFamily ? `ff:${fontFamily}` : "",
291955
291965
  highlight ? `hl:${highlight}` : "",
291956
- link2 ? `ln:${JSON.stringify(link2)}` : ""
291966
+ link2 ? `ln:${JSON.stringify(link2)}` : "",
291967
+ bidi ? `bd:${JSON.stringify(bidi)}` : ""
291957
291968
  ].join("");
291958
291969
  }, MAX_CACHE_SIZE$1 = 1e4, BYTES_PER_ENTRY_ESTIMATE = 5000, hashParagraphFrame = (frame) => {
291959
291970
  const parts = [];
@@ -294554,7 +294565,69 @@ menclose::after {
294554
294565
  this.#onRebuild();
294555
294566
  });
294556
294567
  }
294557
- }, Y_SORT_THRESHOLD_PX = 2, Y_SAME_LINE_THRESHOLD_PX = 3, HORIZONTAL_OVERLAP_THRESHOLD = 0.8, log2 = (...args$1) => {}, CLASS, TWIPS_PER_INCH2 = 1440, PX_PER_PT2, VALID_TRACKED_MODES, DEFAULT_HYPERLINK_CONFIG, ATOMIC_INLINE_TYPES, TOKEN_INLINE_TYPES, isValidTrackedMode = (value) => {
294568
+ }, Y_SORT_THRESHOLD_PX = 2, Y_SAME_LINE_THRESHOLD_PX = 3, HORIZONTAL_OVERLAP_THRESHOLD = 0.8, log2 = (...args$1) => {}, CLASS, DEFAULT_PAGE_DIRECTION = "ltr", DEFAULT_WRITING_MODE = "horizontal-tb", isToggleOn = (val) => {
294569
+ if (val === undefined || val === null)
294570
+ return true;
294571
+ if (val === "0" || val === 0 || val === false)
294572
+ return false;
294573
+ if (val === "false" || val === "off")
294574
+ return false;
294575
+ return true;
294576
+ }, writingModeFromTextDirection$1 = (val) => {
294577
+ if (typeof val !== "string")
294578
+ return;
294579
+ switch (val) {
294580
+ case "lrTb":
294581
+ case "lrTbV":
294582
+ case "tb":
294583
+ case "tbV":
294584
+ return "horizontal-tb";
294585
+ case "tbRl":
294586
+ case "tbRlV":
294587
+ case "rl":
294588
+ case "rlV":
294589
+ return "vertical-rl";
294590
+ case "btLr":
294591
+ case "lr":
294592
+ case "lrV":
294593
+ case "tbLrV":
294594
+ return "vertical-lr";
294595
+ default:
294596
+ return;
294597
+ }
294598
+ }, resolveSectionDirection = (sectPr) => {
294599
+ let pageDirection = DEFAULT_PAGE_DIRECTION;
294600
+ let writingMode = DEFAULT_WRITING_MODE;
294601
+ let rtlGutter = false;
294602
+ if (sectPr && typeof sectPr === "object") {
294603
+ const elements = sectPr.elements;
294604
+ if (Array.isArray(elements))
294605
+ for (const el of elements) {
294606
+ if (!el?.name)
294607
+ continue;
294608
+ const val = el.attributes?.["w:val"] ?? el.attributes?.val;
294609
+ if (el.name === "w:bidi" && isToggleOn(val)) {
294610
+ pageDirection = "rtl";
294611
+ continue;
294612
+ }
294613
+ if (el.name === "w:textDirection") {
294614
+ const mode = writingModeFromTextDirection$1(val);
294615
+ if (mode)
294616
+ writingMode = mode;
294617
+ continue;
294618
+ }
294619
+ if (el.name === "w:rtlGutter" && isToggleOn(val)) {
294620
+ rtlGutter = true;
294621
+ continue;
294622
+ }
294623
+ }
294624
+ }
294625
+ return {
294626
+ pageDirection,
294627
+ writingMode,
294628
+ rtlGutter
294629
+ };
294630
+ }, TWIPS_PER_INCH2 = 1440, PX_PER_PT2, VALID_TRACKED_MODES, DEFAULT_HYPERLINK_CONFIG, ATOMIC_INLINE_TYPES, TOKEN_INLINE_TYPES, isValidTrackedMode = (value) => {
294558
294631
  return typeof value === "string" && VALID_TRACKED_MODES.includes(value);
294559
294632
  }, isTextRun$4 = (run2) => {
294560
294633
  return "text" in run2 && run2.kind !== "tab";
@@ -295159,68 +295232,6 @@ menclose::after {
295159
295232
  mutated = true;
295160
295233
  }
295161
295234
  return mutated ? mirrored : indent2;
295162
- }, DEFAULT_PAGE_DIRECTION = "ltr", DEFAULT_WRITING_MODE = "horizontal-tb", isToggleOn = (val) => {
295163
- if (val === undefined || val === null)
295164
- return true;
295165
- if (val === "0" || val === 0 || val === false)
295166
- return false;
295167
- if (val === "false" || val === "off")
295168
- return false;
295169
- return true;
295170
- }, writingModeFromTextDirection$1 = (val) => {
295171
- if (typeof val !== "string")
295172
- return;
295173
- switch (val) {
295174
- case "lrTb":
295175
- case "lrTbV":
295176
- case "tb":
295177
- case "tbV":
295178
- return "horizontal-tb";
295179
- case "tbRl":
295180
- case "tbRlV":
295181
- case "rl":
295182
- case "rlV":
295183
- return "vertical-rl";
295184
- case "btLr":
295185
- case "lr":
295186
- case "lrV":
295187
- case "tbLrV":
295188
- return "vertical-lr";
295189
- default:
295190
- return;
295191
- }
295192
- }, resolveSectionDirection = (sectPr) => {
295193
- let pageDirection = DEFAULT_PAGE_DIRECTION;
295194
- let writingMode = DEFAULT_WRITING_MODE;
295195
- let rtlGutter = false;
295196
- if (sectPr && typeof sectPr === "object") {
295197
- const elements = sectPr.elements;
295198
- if (Array.isArray(elements))
295199
- for (const el of elements) {
295200
- if (!el?.name)
295201
- continue;
295202
- const val = el.attributes?.["w:val"] ?? el.attributes?.val;
295203
- if (el.name === "w:bidi" && isToggleOn(val)) {
295204
- pageDirection = "rtl";
295205
- continue;
295206
- }
295207
- if (el.name === "w:textDirection") {
295208
- const mode = writingModeFromTextDirection$1(val);
295209
- if (mode)
295210
- writingMode = mode;
295211
- continue;
295212
- }
295213
- if (el.name === "w:rtlGutter" && isToggleOn(val)) {
295214
- rtlGutter = true;
295215
- continue;
295216
- }
295217
- }
295218
- }
295219
- return {
295220
- pageDirection,
295221
- writingMode,
295222
- rtlGutter
295223
- };
295224
295235
  }, writingModeFromTextDirection = (val) => {
295225
295236
  switch (val) {
295226
295237
  case "lrTb":
@@ -295391,7 +295402,7 @@ menclose::after {
295391
295402
  resolvedParagraphProperties = paragraphProperties;
295392
295403
  else
295393
295404
  resolvedParagraphProperties = resolveParagraphProperties(converterContext, paragraphProperties, converterContext.tableInfo);
295394
- const sectionContext = resolveSectionDirection(undefined);
295405
+ const sectionContext = converterContext?.sectionDirectionContext ?? resolveSectionDirection(undefined);
295395
295406
  const directionContext = resolveParagraphDirection(resolvedParagraphProperties, sectionContext);
295396
295407
  const normalizedDirection = directionContext.inlineDirection;
295397
295408
  const isRtl = normalizedDirection === "rtl";
@@ -297081,6 +297092,14 @@ menclose::after {
297081
297092
  if (aKeys[i4] !== bKeys[i4])
297082
297093
  return false;
297083
297094
  return true;
297095
+ }, bidiCompatible = (a2, b$1) => {
297096
+ const aBidi = a2.bidi;
297097
+ const bBidi = b$1.bidi;
297098
+ if (!aBidi && !bBidi)
297099
+ return true;
297100
+ if (!aBidi || !bBidi)
297101
+ return false;
297102
+ return aBidi.rtl === bBidi.rtl && aBidi.embedding === bBidi.embedding && aBidi.override === bBidi.override;
297084
297103
  }, toTrackChangeAttrs = (value) => {
297085
297104
  if (!value || typeof value !== "object")
297086
297105
  return;
@@ -302114,7 +302133,7 @@ menclose::after {
302114
302133
  return;
302115
302134
  console.log(...args$1);
302116
302135
  }, 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;
302117
- var init_src_BdpJXQ5F_es = __esm(() => {
302136
+ var init_src_DnSeNxAx_es = __esm(() => {
302118
302137
  init_rolldown_runtime_Bg48TavK_es();
302119
302138
  init_SuperConverter_BInxZk0I_es();
302120
302139
  init_jszip_C49i9kUs_es();
@@ -331667,7 +331686,9 @@ function print() { __p += __j.call(arguments, '') }
331667
331686
  const isActiveLink = !!(linkData && !linkData.blocked && linkData.href);
331668
331687
  const elem = isActiveLink ? this.doc.createElement("a") : this.doc.createElement("span");
331669
331688
  const text5 = resolveRunText(run2, context);
331670
- this.setTextContentWithFormattingSpaceMarks(elem, text5);
331689
+ const textRun = run2;
331690
+ const effectiveText = textRun.bidi?.rtl === true && typeof text5 === "string" ? normalizeRtlDateTokenForWordParity(text5) : text5;
331691
+ this.setTextContentWithFormattingSpaceMarks(elem, effectiveText);
331671
331692
  if (linkData?.dataset)
331672
331693
  applyLinkDataset(elem, linkData.dataset);
331673
331694
  if (linkData?.blocked) {
@@ -331682,7 +331703,11 @@ function print() { __p += __j.call(arguments, '') }
331682
331703
  this.pendingTooltips.set(elem, linkData.tooltip);
331683
331704
  }
331684
331705
  applyRunStyles(elem, run2, isActiveLink);
331685
- const commentAnnotations = run2.comments;
331706
+ if (textRun.bidi?.rtl === true)
331707
+ elem.setAttribute("dir", "rtl");
331708
+ else if (typeof textRun.text === "string" && RTL_DATE_LIKE_TOKEN_RE.test(textRun.text))
331709
+ elem.setAttribute("dir", "ltr");
331710
+ const commentAnnotations = textRun.comments;
331686
331711
  if (!!commentAnnotations?.length) {
331687
331712
  elem.dataset.commentIds = commentAnnotations.map((c) => c.commentId).join(",");
331688
331713
  if (commentAnnotations.some((c) => c.internal))
@@ -332144,7 +332169,8 @@ function print() { __p += __j.call(arguments, '') }
332144
332169
  sdt: run2.sdt ?? null,
332145
332170
  link: run2.link ?? null,
332146
332171
  comments: run2.comments ?? null,
332147
- dataAttrs: stableDataAttrs(run2.dataAttrs) ?? null
332172
+ dataAttrs: stableDataAttrs(run2.dataAttrs) ?? null,
332173
+ bidi: run2.bidi ?? null
332148
332174
  });
332149
332175
  const isWhitespaceOnly = (text5) => {
332150
332176
  if (text5.length === 0)
@@ -332792,6 +332818,7 @@ function print() { __p += __j.call(arguments, '') }
332792
332818
  "path(",
332793
332819
  "rect("
332794
332820
  ];
332821
+ RTL_DATE_LIKE_TOKEN_RE = /^-?\d+(?:[./-]\d+)+$/;
332795
332822
  CLIP_PATH_PREFIXES = [
332796
332823
  "inset(",
332797
332824
  "polygon(",
@@ -340175,7 +340202,7 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
340175
340202
 
340176
340203
  // ../../packages/superdoc/dist/super-editor.es.js
340177
340204
  var init_super_editor_es = __esm(() => {
340178
- init_src_BdpJXQ5F_es();
340205
+ init_src_DnSeNxAx_es();
340179
340206
  init_SuperConverter_BInxZk0I_es();
340180
340207
  init_jszip_C49i9kUs_es();
340181
340208
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.8.0-next.93",
3
+ "version": "0.8.0-next.95",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,8 +25,8 @@
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
- "@superdoc/pm-adapter": "0.0.0",
29
28
  "@superdoc/super-editor": "0.0.1",
29
+ "@superdoc/pm-adapter": "0.0.0",
30
30
  "superdoc": "1.32.0"
31
31
  },
32
32
  "module": "src/index.ts",
@@ -34,11 +34,11 @@
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.93",
38
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.93",
39
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.93",
40
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.93",
41
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.93"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.95",
38
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.95",
39
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.95",
40
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.95",
41
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.95"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",