@superdoc-dev/cli 0.8.0-next.12 → 0.8.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 +87 -67
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -65535,7 +65535,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65535
65535
  emptyOptions2 = {};
65536
65536
  });
65537
65537
 
65538
- // ../../packages/superdoc/dist/chunks/SuperConverter-D54XfHFt.es.js
65538
+ // ../../packages/superdoc/dist/chunks/SuperConverter-aq0iFjuQ.es.js
65539
65539
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65540
65540
  const fieldValue = extension$1.config[field];
65541
65541
  if (typeof fieldValue === "function")
@@ -95925,6 +95925,19 @@ function shouldRequirePageBoundary(current, next) {
95925
95925
  function hasIntrinsicBoundarySignals(_) {
95926
95926
  return false;
95927
95927
  }
95928
+ function emitPendingSectionBreakForParagraph(args2) {
95929
+ const { sectionState, nextBlockId, blocks, recordBlockKind } = args2;
95930
+ if (!sectionState || sectionState.ranges.length === 0)
95931
+ return;
95932
+ const nextSection = sectionState.ranges[sectionState.currentSectionIndex + 1];
95933
+ if (!nextSection || sectionState.currentParagraphIndex !== nextSection.startParagraphIndex)
95934
+ return;
95935
+ const currentSection = sectionState.ranges[sectionState.currentSectionIndex];
95936
+ const sectionBreak = createSectionBreakBlock(nextSection, nextBlockId, shouldRequirePageBoundary(currentSection, nextSection) || hasIntrinsicBoundarySignals(nextSection) ? { requirePageBoundary: true } : undefined);
95937
+ blocks.push(sectionBreak);
95938
+ recordBlockKind?.(sectionBreak.kind);
95939
+ sectionState.currentSectionIndex++;
95940
+ }
95928
95941
  function shouldIgnoreSectionBreak(paragraph2, index2, total, hasBodySectPr) {
95929
95942
  const paragraphAttrs = paragraph2.attrs ?? {};
95930
95943
  const sectPr = paragraphAttrs?.paragraphProperties?.sectPr;
@@ -95968,7 +95981,7 @@ function findParagraphsWithSectPr(doc$2) {
95968
95981
  paragraphIndex++;
95969
95982
  return;
95970
95983
  }
95971
- if (node3.type === "index" || node3.type === "bibliography" || node3.type === "tableOfAuthorities")
95984
+ if (node3.type === "index" || node3.type === "bibliography" || node3.type === "tableOfAuthorities" || node3.type === "documentPartObject" || node3.type === "tableOfContents")
95972
95985
  getNodeChildren(node3).forEach(visitNode);
95973
95986
  };
95974
95987
  if (doc$2.content)
@@ -117730,7 +117743,7 @@ var isRegExp = (value) => {
117730
117743
  state.kern = kernNode.attributes["w:val"];
117731
117744
  }
117732
117745
  }, SuperConverter;
117733
- var init_SuperConverter_D54XfHFt_es = __esm(() => {
117746
+ var init_SuperConverter_aq0iFjuQ_es = __esm(() => {
117734
117747
  init_rolldown_runtime_Bg48TavK_es();
117735
117748
  init_jszip_C49i9kUs_es();
117736
117749
  init_xml_js_CqGKpaft_es();
@@ -155146,7 +155159,7 @@ var init_SuperConverter_D54XfHFt_es = __esm(() => {
155146
155159
  };
155147
155160
  });
155148
155161
 
155149
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DrE9IMiD.es.js
155162
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-bhnvM7MP.es.js
155150
155163
  function parseSizeUnit(val = "0") {
155151
155164
  const length3 = val.toString() || "0";
155152
155165
  const value = Number.parseFloat(length3);
@@ -157738,8 +157751,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
157738
157751
  }
157739
157752
  };
157740
157753
  };
157741
- var init_create_headless_toolbar_DrE9IMiD_es = __esm(() => {
157742
- init_SuperConverter_D54XfHFt_es();
157754
+ var init_create_headless_toolbar_bhnvM7MP_es = __esm(() => {
157755
+ init_SuperConverter_aq0iFjuQ_es();
157743
157756
  init_constants_CGhJRd87_es();
157744
157757
  init_dist_B8HfvhaK_es();
157745
157758
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -206426,7 +206439,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
206426
206439
  init_remark_gfm_BhnWr3yf_es();
206427
206440
  });
206428
206441
 
206429
- // ../../packages/superdoc/dist/chunks/src-BFNW1Ck5.es.js
206442
+ // ../../packages/superdoc/dist/chunks/src-BJiA8udr.es.js
206430
206443
  function deleteProps(obj, propOrProps) {
206431
206444
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
206432
206445
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -258736,7 +258749,7 @@ function applyTocMetadata(blocks2, metadata) {
258736
258749
  if (!block.attrs)
258737
258750
  block.attrs = {};
258738
258751
  block.attrs.isTocEntry = true;
258739
- if (!block.attrs.sdt)
258752
+ if (!block.attrs.sdt && metadata.gallery)
258740
258753
  block.attrs.sdt = {
258741
258754
  type: "docPartObject",
258742
258755
  gallery: metadata.gallery,
@@ -258754,6 +258767,12 @@ function processTocChildren(children, metadata, context, outputArrays) {
258754
258767
  const { blocks: blocks2, recordBlockKind } = outputArrays;
258755
258768
  children.forEach((child) => {
258756
258769
  if (child.type === "paragraph") {
258770
+ emitPendingSectionBreakForParagraph({
258771
+ sectionState: context.sectionState,
258772
+ nextBlockId: context.nextBlockId,
258773
+ blocks: blocks2,
258774
+ recordBlockKind
258775
+ });
258757
258776
  const paragraphBlocks = paragraphConverter({
258758
258777
  para: child,
258759
258778
  nextBlockId: context.nextBlockId,
@@ -258761,6 +258780,7 @@ function processTocChildren(children, metadata, context, outputArrays) {
258761
258780
  trackedChangesConfig: context.trackedChangesConfig,
258762
258781
  bookmarks: context.bookmarks,
258763
258782
  hyperlinkConfig: context.hyperlinkConfig,
258783
+ themeColors: context.themeColors,
258764
258784
  converters: context.converters,
258765
258785
  enableComments: context.enableComments,
258766
258786
  converterContext: context.converterContext
@@ -258775,6 +258795,8 @@ function processTocChildren(children, metadata, context, outputArrays) {
258775
258795
  blocks2.push(block);
258776
258796
  recordBlockKind?.(block.kind);
258777
258797
  });
258798
+ if (context.sectionState)
258799
+ context.sectionState.currentParagraphIndex++;
258778
258800
  } else if (child.type === "tableOfContents" && Array.isArray(child.content)) {
258779
258801
  const finalInstruction = getNodeInstruction(child) ?? tocInstruction;
258780
258802
  processTocChildren(child.content, {
@@ -258789,33 +258811,20 @@ function processTocChildren(children, metadata, context, outputArrays) {
258789
258811
  function handleTableOfContentsNode(node3, context) {
258790
258812
  if (!Array.isArray(node3.content))
258791
258813
  return;
258792
- const { blocks: blocks2, recordBlockKind, nextBlockId, positions, trackedChangesConfig, bookmarks, hyperlinkConfig, converters: converters$1, converterContext, themeColors, enableComments } = context;
258793
- const tocInstruction = getNodeInstruction(node3);
258794
- const paragraphToFlowBlocks$1 = converters$1.paragraphToFlowBlocks;
258795
- node3.content.forEach((child) => {
258796
- if (child.type === "paragraph")
258797
- paragraphToFlowBlocks$1({
258798
- para: child,
258799
- nextBlockId,
258800
- positions,
258801
- trackedChangesConfig,
258802
- bookmarks,
258803
- themeColors,
258804
- hyperlinkConfig,
258805
- converters: converters$1,
258806
- enableComments,
258807
- converterContext
258808
- }).forEach((block) => {
258809
- if (block.kind === "paragraph") {
258810
- if (!block.attrs)
258811
- block.attrs = {};
258812
- block.attrs.isTocEntry = true;
258813
- if (tocInstruction)
258814
- block.attrs.tocInstruction = tocInstruction;
258815
- }
258816
- blocks2.push(block);
258817
- recordBlockKind?.(block.kind);
258818
- });
258814
+ processTocChildren(node3.content, { tocInstruction: getNodeInstruction(node3) }, {
258815
+ nextBlockId: context.nextBlockId,
258816
+ positions: context.positions,
258817
+ bookmarks: context.bookmarks,
258818
+ trackedChangesConfig: context.trackedChangesConfig,
258819
+ hyperlinkConfig: context.hyperlinkConfig,
258820
+ enableComments: context.enableComments,
258821
+ themeColors: context.themeColors,
258822
+ converters: context.converters,
258823
+ converterContext: context.converterContext,
258824
+ sectionState: context.sectionState
258825
+ }, {
258826
+ blocks: context.blocks,
258827
+ recordBlockKind: context.recordBlockKind
258819
258828
  });
258820
258829
  }
258821
258830
  function handleIndexNode(node3, context) {
@@ -259071,7 +259080,7 @@ function handleDocumentSectionNode2(node3, context) {
259071
259080
  function handleDocumentPartObjectNode(node3, context) {
259072
259081
  if (!Array.isArray(node3.content))
259073
259082
  return;
259074
- const { blocks: blocks2, recordBlockKind, nextBlockId, positions, bookmarks, hyperlinkConfig, converters: converters$1, converterContext, enableComments, trackedChangesConfig, themeColors } = context;
259083
+ const { blocks: blocks2, recordBlockKind, nextBlockId, positions, bookmarks, hyperlinkConfig, sectionState, converters: converters$1, converterContext, enableComments, trackedChangesConfig, themeColors } = context;
259075
259084
  const docPartGallery = getDocPartGallery(node3);
259076
259085
  const docPartObjectId = getDocPartObjectId(node3);
259077
259086
  const tocInstruction = getNodeInstruction(node3);
@@ -259090,8 +259099,10 @@ function handleDocumentPartObjectNode(node3, context) {
259090
259099
  hyperlinkConfig,
259091
259100
  enableComments,
259092
259101
  trackedChangesConfig,
259102
+ themeColors,
259093
259103
  converters: converters$1,
259094
- converterContext
259104
+ converterContext,
259105
+ sectionState
259095
259106
  }, {
259096
259107
  blocks: blocks2,
259097
259108
  recordBlockKind
@@ -259099,6 +259110,12 @@ function handleDocumentPartObjectNode(node3, context) {
259099
259110
  else if (paragraphToFlowBlocks$1) {
259100
259111
  for (const child of node3.content)
259101
259112
  if (child.type === "paragraph") {
259113
+ emitPendingSectionBreakForParagraph({
259114
+ sectionState,
259115
+ nextBlockId,
259116
+ blocks: blocks2,
259117
+ recordBlockKind
259118
+ });
259102
259119
  const childBlocks = paragraphToFlowBlocks$1({
259103
259120
  para: child,
259104
259121
  nextBlockId,
@@ -259115,6 +259132,8 @@ function handleDocumentPartObjectNode(node3, context) {
259115
259132
  blocks2.push(block);
259116
259133
  recordBlockKind?.(block.kind);
259117
259134
  }
259135
+ if (sectionState)
259136
+ sectionState.currentParagraphIndex++;
259118
259137
  }
259119
259138
  }
259120
259139
  }
@@ -277498,14 +277517,14 @@ var Node$13 = class Node$14 {
277498
277517
  () => commands$1.joinForward(),
277499
277518
  () => commands$1.selectNodeForward()
277500
277519
  ]);
277501
- }, Keymap, handleBackwardReplaceInsertText = (view, event) => {
277520
+ }, Keymap, handleInsertTextBeforeInput = (view, event) => {
277502
277521
  const isInsertTextInput = event?.inputType === "insertText";
277503
277522
  const hasTextData = typeof event?.data === "string" && event.data.length > 0;
277504
- const hasNonEmptySelection = !view.state.selection.empty;
277505
- if (!isInsertTextInput || !hasTextData || !hasNonEmptySelection)
277523
+ const isComposing = event?.isComposing === true;
277524
+ if (!isInsertTextInput || !hasTextData || isComposing)
277506
277525
  return false;
277507
277526
  const selection = view.state.selection;
277508
- if (!((selection.anchor ?? selection.from) > (selection.head ?? selection.to)))
277527
+ if (selection.empty)
277509
277528
  return false;
277510
277529
  const tr = view.state.tr.insertText(event.data, selection.from, selection.to);
277511
277530
  tr.setMeta("inputType", "insertText");
@@ -293606,12 +293625,12 @@ menclose::after {
293606
293625
  return;
293607
293626
  console.log(...args$1);
293608
293627
  }, 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;
293609
- var init_src_BFNW1Ck5_es = __esm(() => {
293628
+ var init_src_BJiA8udr_es = __esm(() => {
293610
293629
  init_rolldown_runtime_Bg48TavK_es();
293611
- init_SuperConverter_D54XfHFt_es();
293630
+ init_SuperConverter_aq0iFjuQ_es();
293612
293631
  init_jszip_C49i9kUs_es();
293613
293632
  init_uuid_qzgm05fK_es();
293614
- init_create_headless_toolbar_DrE9IMiD_es();
293633
+ init_create_headless_toolbar_bhnvM7MP_es();
293615
293634
  init_constants_CGhJRd87_es();
293616
293635
  init_dist_B8HfvhaK_es();
293617
293636
  init_unified_Dsuw2be5_es();
@@ -315456,7 +315475,7 @@ function print() { __p += __j.call(arguments, '') }
315456
315475
  }
315457
315476
  if (shouldForceEndStaleComposition(view, event))
315458
315477
  __endComposition(view);
315459
- if (handleBackwardReplaceInsertText(view, event))
315478
+ if (handleInsertTextBeforeInput(view, event))
315460
315479
  return true;
315461
315480
  return false;
315462
315481
  },
@@ -317847,7 +317866,7 @@ function print() { __p += __j.call(arguments, '') }
317847
317866
  if (!editable && this.view.dom)
317848
317867
  this.view.dom.blur();
317849
317868
  }
317850
- if (emitUpdate)
317869
+ if (emitUpdate && this.state)
317851
317870
  this.emit("update", {
317852
317871
  editor: this,
317853
317872
  transaction: this.state.tr
@@ -325639,22 +325658,34 @@ function print() { __p += __j.call(arguments, '') }
325639
325658
  const normalized = this.#normalizeClientPoint(clientX, clientY);
325640
325659
  if (!normalized)
325641
325660
  return null;
325661
+ const noteContext = this.#buildActiveNoteLayoutContext();
325662
+ if (noteContext) {
325663
+ const rawHit$1 = this.#resolveNoteDomHit(noteContext, clientX, clientY) ?? clickToPositionGeometry(this.#layoutState.layout, noteContext.blocks, noteContext.measures, normalized, { geometryHelper: this.#pageGeometryHelper ?? undefined });
325664
+ if (!rawHit$1)
325665
+ return null;
325666
+ const doc$2 = this.getActiveEditor().state?.doc;
325667
+ if (!doc$2)
325668
+ return rawHit$1;
325669
+ return {
325670
+ ...rawHit$1,
325671
+ pos: Math.max(0, Math.min(rawHit$1.pos, doc$2.content.size))
325672
+ };
325673
+ }
325642
325674
  if ((this.#headerFooterSession?.session?.mode ?? "body") !== "body") {
325643
325675
  const context = this.#getHeaderFooterContext();
325644
325676
  if (!context)
325645
325677
  return null;
325646
- const headerPageHeight = context.layout.pageSize?.h ?? context.region.height ?? 1;
325678
+ const pageGap = this.#layoutState.layout?.pageGap ?? this.#getEffectivePageGap();
325647
325679
  const bodyPageHeight = this.#getBodyPageHeight();
325648
- if (Math.max(0, Math.floor(normalized.y / bodyPageHeight)) !== context.region.pageIndex)
325680
+ if ((normalized.pageIndex ?? Math.max(0, Math.floor(normalized.y / (bodyPageHeight + pageGap)))) !== context.region.pageIndex)
325649
325681
  return null;
325650
325682
  const localX = normalized.x - context.region.localX;
325651
- const localY = normalized.y - context.region.pageIndex * bodyPageHeight - context.region.localY;
325683
+ const localY = (normalized.pageLocalY ?? normalized.y - context.region.pageIndex * (bodyPageHeight + pageGap)) - context.region.localY;
325652
325684
  if (localX < 0 || localY < 0 || localX > context.region.width || localY > context.region.height)
325653
325685
  return null;
325654
- const headerPageIndex = Math.floor(localY / headerPageHeight);
325655
325686
  const headerPoint = {
325656
325687
  x: localX,
325657
- y: headerPageIndex * headerPageHeight + (localY - headerPageIndex * headerPageHeight)
325688
+ y: localY
325658
325689
  };
325659
325690
  const hit = clickToPositionGeometry(context.layout, context.blocks, context.measures, headerPoint) ?? null;
325660
325691
  if (!hit)
@@ -325667,19 +325698,6 @@ function print() { __p += __j.call(arguments, '') }
325667
325698
  pos: Math.max(0, Math.min(hit.pos, doc$2.content.size))
325668
325699
  };
325669
325700
  }
325670
- const noteContext = this.#buildActiveNoteLayoutContext();
325671
- if (noteContext) {
325672
- const rawHit$1 = this.#resolveNoteDomHit(noteContext, clientX, clientY) ?? clickToPositionGeometry(this.#layoutState.layout, noteContext.blocks, noteContext.measures, normalized, { geometryHelper: this.#pageGeometryHelper ?? undefined });
325673
- if (!rawHit$1)
325674
- return null;
325675
- const doc$2 = this.getActiveEditor().state?.doc;
325676
- if (!doc$2)
325677
- return rawHit$1;
325678
- return {
325679
- ...rawHit$1,
325680
- pos: Math.max(0, Math.min(rawHit$1.pos, doc$2.content.size))
325681
- };
325682
- }
325683
325701
  if (!this.#layoutState.layout)
325684
325702
  return null;
325685
325703
  const rawHit = resolvePointerPositionHit({
@@ -328307,6 +328325,8 @@ function print() { __p += __j.call(arguments, '') }
328307
328325
  return Selection.near(doc$12.resolve(clampedPos), bias);
328308
328326
  }
328309
328327
  #activateRenderedNoteSession(target, options) {
328328
+ if ((this.#headerFooterSession?.session?.mode ?? "body") !== "body")
328329
+ this.#headerFooterSession?.exitMode();
328310
328330
  const storySessionManager = this.#ensureStorySessionManager();
328311
328331
  if (target.storyType !== "footnote" && target.storyType !== "endnote")
328312
328332
  return false;
@@ -329639,11 +329659,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
329639
329659
 
329640
329660
  // ../../packages/superdoc/dist/super-editor.es.js
329641
329661
  var init_super_editor_es = __esm(() => {
329642
- init_src_BFNW1Ck5_es();
329643
- init_SuperConverter_D54XfHFt_es();
329662
+ init_src_BJiA8udr_es();
329663
+ init_SuperConverter_aq0iFjuQ_es();
329644
329664
  init_jszip_C49i9kUs_es();
329645
329665
  init_xml_js_CqGKpaft_es();
329646
- init_create_headless_toolbar_DrE9IMiD_es();
329666
+ init_create_headless_toolbar_bhnvM7MP_es();
329647
329667
  init_constants_CGhJRd87_es();
329648
329668
  init_dist_B8HfvhaK_es();
329649
329669
  init_unified_Dsuw2be5_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.8.0-next.12",
3
+ "version": "0.8.0-next.14",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,20 +25,20 @@
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",
28
29
  "@superdoc/super-editor": "0.0.1",
29
- "superdoc": "1.28.0",
30
- "@superdoc/pm-adapter": "0.0.0"
30
+ "superdoc": "1.28.0"
31
31
  },
32
32
  "module": "src/index.ts",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.12",
38
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.12",
39
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.12",
40
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.12",
41
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.12"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.14",
38
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.14",
39
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.14",
40
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.14",
41
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.14"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",