@superdoc-dev/cli 0.4.0-next.6 → 0.4.0-next.9

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 +198 -82
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -25713,9 +25713,9 @@ var init_jszip_ChlR43oI_es = __esm(() => {
25713
25713
  });
25714
25714
  });
25715
25715
 
25716
- // ../../packages/superdoc/dist/chunks/xml-js-DLE8mr0n.es.js
25716
+ // ../../packages/superdoc/dist/chunks/xml-js-40FWvL78.es.js
25717
25717
  var require_events, require_inherits_browser, require_stream_browser, require_dist, require_shams$1, require_shams, require_es_object_atoms, require_es_errors, require_eval, require_range, require_ref, require_syntax, require_type, require_uri, require_abs, require_floor, require_max, require_min, require_pow, require_round, require_isNaN, require_sign, require_gOPD, require_gopd, require_es_define_property, require_has_symbols, require_Reflect_getPrototypeOf, require_Object_getPrototypeOf, require_implementation, require_function_bind, require_functionCall, require_functionApply, require_reflectApply, require_actualApply, require_call_bind_apply_helpers, require_get, require_get_proto, require_hasown, require_get_intrinsic, require_call_bound, require_is_arguments, require_is_regex, require_safe_regex_test, require_generator_function, require_is_generator_function, require_is_callable, require_for_each, require_possible_typed_array_names, require_available_typed_arrays, require_define_data_property, require_has_property_descriptors, require_set_function_length, require_applyBind, require_call_bind, require_which_typed_array, require_is_typed_array, require_types, require_isBufferBrowser, require_util, require_buffer_list, require_destroy, require_errors_browser, require_state, require_browser, require__stream_writable, require__stream_duplex, require_safe_buffer, require_string_decoder, require_end_of_stream, require_async_iterator, require_from_browser, require__stream_readable, require__stream_transform, require__stream_passthrough, require_pipeline, require_stream_browserify, require_sax, require_array_helper, require_options_helper, require_xml2js, require_xml2json, require_js2xml, require_json2xml, require_lib;
25718
- var init_xml_js_DLE8mr0n_es = __esm(() => {
25718
+ var init_xml_js_40FWvL78_es = __esm(() => {
25719
25719
  init_rolldown_runtime_B2q5OVn9_es();
25720
25720
  init_jszip_ChlR43oI_es();
25721
25721
  require_events = /* @__PURE__ */ __commonJSMin((exports, module) => {
@@ -32263,9 +32263,13 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32263
32263
  clearBuffers(parser);
32264
32264
  parser.q = parser.c = "";
32265
32265
  parser.bufferCheckPosition = sax$1.MAX_BUFFER_LENGTH;
32266
+ parser.encoding = null;
32266
32267
  parser.opt = opt || {};
32267
32268
  parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags;
32268
32269
  parser.looseCase = parser.opt.lowercase ? "toLowerCase" : "toUpperCase";
32270
+ parser.opt.maxEntityCount = parser.opt.maxEntityCount || 512;
32271
+ parser.opt.maxEntityDepth = parser.opt.maxEntityDepth || 4;
32272
+ parser.entityCount = parser.entityDepth = 0;
32269
32273
  parser.tags = [];
32270
32274
  parser.closed = parser.closedRoot = parser.sawRoot = false;
32271
32275
  parser.tag = parser.error = null;
@@ -32368,6 +32372,24 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32368
32372
  function createStream(strict, opt) {
32369
32373
  return new SAXStream(strict, opt);
32370
32374
  }
32375
+ function determineBufferEncoding(data, isEnd) {
32376
+ if (data.length >= 2) {
32377
+ if (data[0] === 255 && data[1] === 254)
32378
+ return "utf-16le";
32379
+ if (data[0] === 254 && data[1] === 255)
32380
+ return "utf-16be";
32381
+ }
32382
+ if (data.length >= 3 && data[0] === 239 && data[1] === 187 && data[2] === 191)
32383
+ return "utf8";
32384
+ if (data.length >= 4) {
32385
+ if (data[0] === 60 && data[1] === 0 && data[2] === 63 && data[3] === 0)
32386
+ return "utf-16le";
32387
+ if (data[0] === 0 && data[1] === 60 && data[2] === 0 && data[3] === 63)
32388
+ return "utf-16be";
32389
+ return "utf8";
32390
+ }
32391
+ return isEnd ? "utf8" : null;
32392
+ }
32371
32393
  function SAXStream(strict, opt) {
32372
32394
  if (!(this instanceof SAXStream))
32373
32395
  return new SAXStream(strict, opt);
@@ -32384,6 +32406,7 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32384
32406
  me._parser.error = null;
32385
32407
  };
32386
32408
  this._decoder = null;
32409
+ this._decoderBuffer = null;
32387
32410
  streamWraps.forEach(function(ev) {
32388
32411
  Object.defineProperty(me, "on" + ev, {
32389
32412
  get: function() {
@@ -32403,11 +32426,31 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32403
32426
  });
32404
32427
  }
32405
32428
  SAXStream.prototype = Object.create(Stream$3.prototype, { constructor: { value: SAXStream } });
32429
+ SAXStream.prototype._decodeBuffer = function(data, isEnd) {
32430
+ if (this._decoderBuffer) {
32431
+ data = Buffer2.concat([this._decoderBuffer, data]);
32432
+ this._decoderBuffer = null;
32433
+ }
32434
+ if (!this._decoder) {
32435
+ var encoding = determineBufferEncoding(data, isEnd);
32436
+ if (!encoding) {
32437
+ this._decoderBuffer = data;
32438
+ return "";
32439
+ }
32440
+ this._parser.encoding = encoding;
32441
+ this._decoder = new TextDecoder(encoding);
32442
+ }
32443
+ return this._decoder.decode(data, { stream: !isEnd });
32444
+ };
32406
32445
  SAXStream.prototype.write = function(data) {
32407
- if (typeof Buffer2 === "function" && typeof Buffer2.isBuffer === "function" && Buffer2.isBuffer(data)) {
32408
- if (!this._decoder)
32409
- this._decoder = new TextDecoder("utf8");
32410
- data = this._decoder.decode(data, { stream: true });
32446
+ if (typeof Buffer2 === "function" && typeof Buffer2.isBuffer === "function" && Buffer2.isBuffer(data))
32447
+ data = this._decodeBuffer(data, false);
32448
+ else if (this._decoderBuffer) {
32449
+ var remaining = this._decodeBuffer(Buffer2.alloc(0), true);
32450
+ if (remaining) {
32451
+ this._parser.write(remaining);
32452
+ this.emit("data", remaining);
32453
+ }
32411
32454
  }
32412
32455
  this._parser.write(data.toString());
32413
32456
  this.emit("data", data);
@@ -32416,7 +32459,13 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32416
32459
  SAXStream.prototype.end = function(chunk) {
32417
32460
  if (chunk && chunk.length)
32418
32461
  this.write(chunk);
32419
- if (this._decoder) {
32462
+ if (this._decoderBuffer) {
32463
+ var finalChunk = this._decodeBuffer(Buffer2.alloc(0), true);
32464
+ if (finalChunk) {
32465
+ this._parser.write(finalChunk);
32466
+ this.emit("data", finalChunk);
32467
+ }
32468
+ } else if (this._decoder) {
32420
32469
  var remaining = this._decoder.decode();
32421
32470
  if (remaining) {
32422
32471
  this._parser.write(remaining);
@@ -32776,6 +32825,31 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32776
32825
  function emit(parser, event, data) {
32777
32826
  parser[event] && parser[event](data);
32778
32827
  }
32828
+ function getDeclaredEncoding(body) {
32829
+ var match = body && body.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);
32830
+ return match ? match[2] : null;
32831
+ }
32832
+ function normalizeEncodingName(encoding) {
32833
+ if (!encoding)
32834
+ return null;
32835
+ return encoding.toLowerCase().replace(/[^a-z0-9]/g, "");
32836
+ }
32837
+ function encodingsMatch(detectedEncoding, declaredEncoding) {
32838
+ const detected = normalizeEncodingName(detectedEncoding);
32839
+ const declared = normalizeEncodingName(declaredEncoding);
32840
+ if (!detected || !declared)
32841
+ return true;
32842
+ if (declared === "utf16")
32843
+ return detected === "utf16le" || detected === "utf16be";
32844
+ return detected === declared;
32845
+ }
32846
+ function validateXmlDeclarationEncoding(parser, data) {
32847
+ if (!parser.strict || !parser.encoding || !data || data.name !== "xml")
32848
+ return;
32849
+ var declaredEncoding = getDeclaredEncoding(data.body);
32850
+ if (declaredEncoding && !encodingsMatch(parser.encoding, declaredEncoding))
32851
+ strictFail(parser, "XML declaration encoding " + declaredEncoding + " does not match detected stream encoding " + parser.encoding.toUpperCase());
32852
+ }
32779
32853
  function emitNode(parser, nodeType, data) {
32780
32854
  if (parser.textNode)
32781
32855
  closeText(parser);
@@ -33314,10 +33388,12 @@ Actual: ` + parser.attribValue);
33314
33388
  continue;
33315
33389
  case S.PROC_INST_ENDING:
33316
33390
  if (c === ">") {
33317
- emitNode(parser, "onprocessinginstruction", {
33391
+ const procInstEndData = {
33318
33392
  name: parser.procInstName,
33319
33393
  body: parser.procInstBody
33320
- });
33394
+ };
33395
+ validateXmlDeclarationEncoding(parser, procInstEndData);
33396
+ emitNode(parser, "onprocessinginstruction", procInstEndData);
33321
33397
  parser.procInstName = parser.procInstBody = "";
33322
33398
  parser.state = S.TEXT;
33323
33399
  } else {
@@ -33514,9 +33590,14 @@ Actual: ` + parser.attribValue);
33514
33590
  if (c === ";") {
33515
33591
  var parsedEntity = parseEntity(parser);
33516
33592
  if (parser.opt.unparsedEntities && !Object.values(sax$1.XML_ENTITIES).includes(parsedEntity)) {
33593
+ if ((parser.entityCount += 1) > parser.opt.maxEntityCount)
33594
+ error(parser, "Parsed entity count exceeds max entity count");
33595
+ if ((parser.entityDepth += 1) > parser.opt.maxEntityDepth)
33596
+ error(parser, "Parsed entity depth exceeds max entity depth");
33517
33597
  parser.entity = "";
33518
33598
  parser.state = returnState;
33519
33599
  parser.write(parsedEntity);
33600
+ parser.entityDepth -= 1;
33520
33601
  } else {
33521
33602
  parser[buffer$2] += parsedEntity;
33522
33603
  parser.entity = "";
@@ -34459,7 +34540,7 @@ var init_uuid_qzgm05fK_es = __esm(() => {
34459
34540
  v5_default = v35("v5", 80, sha1);
34460
34541
  });
34461
34542
 
34462
- // ../../packages/superdoc/dist/chunks/constants-CMPtQbp7.es.js
34543
+ // ../../packages/superdoc/dist/chunks/constants-Qqwopz80.es.js
34463
34544
  function computeCrc32Hex(data) {
34464
34545
  let crc = 4294967295;
34465
34546
  for (let i2 = 0;i2 < data.length; i2++)
@@ -34851,8 +34932,8 @@ var import_lib, CRC32_TABLE, REMOTE_RESOURCE_PATTERN, DATA_URI_PATTERN, getArray
34851
34932
  return "webp";
34852
34933
  return null;
34853
34934
  }, COMMENT_FILE_BASENAMES, COMMENT_RELATIONSHIP_TYPES;
34854
- var init_constants_CMPtQbp7_es = __esm(() => {
34855
- init_xml_js_DLE8mr0n_es();
34935
+ var init_constants_Qqwopz80_es = __esm(() => {
34936
+ init_xml_js_40FWvL78_es();
34856
34937
  import_lib = require_lib();
34857
34938
  CRC32_TABLE = new Uint32Array(256);
34858
34939
  for (let i2 = 0;i2 < 256; i2++) {
@@ -41059,7 +41140,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
41059
41140
  emptyOptions2 = {};
41060
41141
  });
41061
41142
 
41062
- // ../../packages/superdoc/dist/chunks/SuperConverter-BMUaGImr.es.js
41143
+ // ../../packages/superdoc/dist/chunks/SuperConverter-Cqf2W6iO.es.js
41063
41144
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
41064
41145
  const fieldValue = extension$1.config[field];
41065
41146
  if (typeof fieldValue === "function")
@@ -91290,12 +91371,12 @@ var isRegExp = (value) => {
91290
91371
  state.kern = kernNode.attributes["w:val"];
91291
91372
  }
91292
91373
  }, SuperConverter;
91293
- var init_SuperConverter_BMUaGImr_es = __esm(() => {
91374
+ var init_SuperConverter_Cqf2W6iO_es = __esm(() => {
91294
91375
  init_rolldown_runtime_B2q5OVn9_es();
91295
91376
  init_jszip_ChlR43oI_es();
91296
- init_xml_js_DLE8mr0n_es();
91377
+ init_xml_js_40FWvL78_es();
91297
91378
  init_uuid_qzgm05fK_es();
91298
- init_constants_CMPtQbp7_es();
91379
+ init_constants_Qqwopz80_es();
91299
91380
  init_unified_BRHLwnjP_es();
91300
91381
  init_lib_HnbxUP96_es();
91301
91382
  init_lib_DAB30bX1_es();
@@ -128663,7 +128744,7 @@ var init_remark_stringify_D8vxv_XI_es = __esm(() => {
128663
128744
  eol = /\r?\n|\r/g;
128664
128745
  });
128665
128746
 
128666
- // ../../packages/superdoc/dist/chunks/DocxZipper-BBJ5zSyW.es.js
128747
+ // ../../packages/superdoc/dist/chunks/DocxZipper-gWkmvJfR.es.js
128667
128748
  function getLens2(b64) {
128668
128749
  var len$1 = b64.length;
128669
128750
  if (len$1 % 4 > 0)
@@ -129358,11 +129439,11 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
129358
129439
  return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
129359
129440
  }
129360
129441
  }, DocxZipper_default;
129361
- var init_DocxZipper_BBJ5zSyW_es = __esm(() => {
129442
+ var init_DocxZipper_gWkmvJfR_es = __esm(() => {
129362
129443
  init_rolldown_runtime_B2q5OVn9_es();
129363
129444
  init_jszip_ChlR43oI_es();
129364
- init_xml_js_DLE8mr0n_es();
129365
- init_constants_CMPtQbp7_es();
129445
+ init_xml_js_40FWvL78_es();
129446
+ init_constants_Qqwopz80_es();
129366
129447
  buffer2 = {};
129367
129448
  base64Js2 = {};
129368
129449
  base64Js2.byteLength = byteLength2;
@@ -154516,7 +154597,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
154516
154597
  init_remark_gfm_z_sDF4ss_es();
154517
154598
  });
154518
154599
 
154519
- // ../../packages/superdoc/dist/chunks/src-BGYOfW0n.es.js
154600
+ // ../../packages/superdoc/dist/chunks/src-ej63VOXd.es.js
154520
154601
  function deleteProps(obj, propOrProps) {
154521
154602
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
154522
154603
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -164927,6 +165008,7 @@ async function measureParagraphBlock(block, maxWidth) {
164927
165008
  let hasSeenTextRun = false;
164928
165009
  let tabStopCursor = 0;
164929
165010
  let pendingTabAlignment = null;
165011
+ let pendingLeader = null;
164930
165012
  let pendingRunSpacing = 0;
164931
165013
  let lastAppliedTabAlign = null;
164932
165014
  const warnedTabVals = /* @__PURE__ */ new Set;
@@ -164959,12 +165041,17 @@ async function measureParagraphBlock(block, maxWidth) {
164959
165041
  startX = Math.max(0, target - segmentWidth / 2);
164960
165042
  else
164961
165043
  startX = Math.max(0, target);
165044
+ if (pendingLeader) {
165045
+ const effectiveIndent = lines.length === 0 ? indentLeft + rawFirstLineOffset : indentLeft;
165046
+ pendingLeader.to = startX + effectiveIndent;
165047
+ }
164962
165048
  currentLine.width = roundValue(startX);
164963
165049
  lastAppliedTabAlign = {
164964
165050
  target,
164965
165051
  val
164966
165052
  };
164967
165053
  pendingTabAlignment = null;
165054
+ pendingLeader = null;
164968
165055
  return startX;
164969
165056
  };
164970
165057
  const alignSegmentAtTab = (segmentText, font, runContext, segmentStartChar) => {
@@ -165067,6 +165154,7 @@ async function measureParagraphBlock(block, maxWidth) {
165067
165154
  }
165068
165155
  tabStopCursor = 0;
165069
165156
  pendingTabAlignment = null;
165157
+ pendingLeader = null;
165070
165158
  lastAppliedTabAlign = null;
165071
165159
  pendingRunSpacing = 0;
165072
165160
  continue;
@@ -165111,12 +165199,14 @@ async function measureParagraphBlock(block, maxWidth) {
165111
165199
  };
165112
165200
  tabStopCursor = 0;
165113
165201
  pendingTabAlignment = null;
165202
+ pendingLeader = null;
165114
165203
  lastAppliedTabAlign = null;
165115
165204
  pendingRunSpacing = 0;
165116
165205
  continue;
165117
165206
  }
165118
165207
  if (isTabRun$1(run2)) {
165119
165208
  activeTabGroup = null;
165209
+ pendingLeader = null;
165120
165210
  if (!currentLine)
165121
165211
  currentLine = {
165122
165212
  fromRun: runIndex,
@@ -165142,18 +165232,19 @@ async function measureParagraphBlock(block, maxWidth) {
165142
165232
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, 12);
165143
165233
  currentLine.toRun = runIndex;
165144
165234
  currentLine.toChar = 1;
165235
+ let currentLeader = null;
165145
165236
  if (stop && stop.leader && stop.leader !== "none") {
165146
165237
  const leaderStyle = stop.leader;
165147
- const relativeTarget = clampedTarget - effectiveIndent;
165148
- const from$1 = Math.min(originX, relativeTarget);
165149
- const to = Math.max(originX, relativeTarget);
165238
+ const from$1 = Math.min(originX + effectiveIndent, clampedTarget);
165239
+ const to = Math.max(originX + effectiveIndent, clampedTarget);
165150
165240
  if (!currentLine.leaders)
165151
165241
  currentLine.leaders = [];
165152
- currentLine.leaders.push({
165242
+ currentLeader = {
165153
165243
  from: from$1,
165154
165244
  to,
165155
165245
  style: leaderStyle
165156
- });
165246
+ };
165247
+ currentLine.leaders.push(currentLeader);
165157
165248
  }
165158
165249
  if (stop) {
165159
165250
  validateTabStopVal(stop);
@@ -165170,6 +165261,8 @@ async function measureParagraphBlock(block, maxWidth) {
165170
165261
  const beforeDecimal = groupMeasure.beforeDecimalWidth ?? groupMeasure.totalWidth;
165171
165262
  groupStartX = Math.max(0, relativeTarget - beforeDecimal);
165172
165263
  }
165264
+ if (currentLeader)
165265
+ currentLeader.to = groupStartX + effectiveIndent;
165173
165266
  activeTabGroup = {
165174
165267
  measure: groupMeasure,
165175
165268
  startX: groupStartX,
@@ -165180,13 +165273,16 @@ async function measureParagraphBlock(block, maxWidth) {
165180
165273
  currentLine.width = roundValue(groupStartX);
165181
165274
  }
165182
165275
  pendingTabAlignment = null;
165276
+ pendingLeader = null;
165183
165277
  } else
165184
165278
  pendingTabAlignment = {
165185
165279
  target: clampedTarget - effectiveIndent,
165186
165280
  val: stop.val
165187
165281
  };
165188
- } else
165282
+ } else {
165189
165283
  pendingTabAlignment = null;
165284
+ pendingLeader = null;
165285
+ }
165190
165286
  pendingRunSpacing = 0;
165191
165287
  continue;
165192
165288
  }
@@ -165239,6 +165335,7 @@ async function measureParagraphBlock(block, maxWidth) {
165239
165335
  lines.push(completedLine);
165240
165336
  tabStopCursor = 0;
165241
165337
  pendingTabAlignment = null;
165338
+ pendingLeader = null;
165242
165339
  lastAppliedTabAlign = null;
165243
165340
  activeTabGroup = null;
165244
165341
  currentLine = {
@@ -165338,6 +165435,7 @@ async function measureParagraphBlock(block, maxWidth) {
165338
165435
  lines.push(completedLine);
165339
165436
  tabStopCursor = 0;
165340
165437
  pendingTabAlignment = null;
165438
+ pendingLeader = null;
165341
165439
  lastAppliedTabAlign = null;
165342
165440
  currentLine = {
165343
165441
  fromRun: runIndex,
@@ -165426,6 +165524,7 @@ async function measureParagraphBlock(block, maxWidth) {
165426
165524
  lines.push(completedLine);
165427
165525
  tabStopCursor = 0;
165428
165526
  pendingTabAlignment = null;
165527
+ pendingLeader = null;
165429
165528
  lastAppliedTabAlign = null;
165430
165529
  currentLine = {
165431
165530
  fromRun: runIndex,
@@ -165512,6 +165611,7 @@ async function measureParagraphBlock(block, maxWidth) {
165512
165611
  lines.push(completedLine);
165513
165612
  tabStopCursor = 0;
165514
165613
  pendingTabAlignment = null;
165614
+ pendingLeader = null;
165515
165615
  lastAppliedTabAlign = null;
165516
165616
  activeTabGroup = null;
165517
165617
  currentLine = {
@@ -165568,6 +165668,7 @@ async function measureParagraphBlock(block, maxWidth) {
165568
165668
  lines.push(completedLine);
165569
165669
  tabStopCursor = 0;
165570
165670
  pendingTabAlignment = null;
165671
+ pendingLeader = null;
165571
165672
  currentLine = null;
165572
165673
  }
165573
165674
  const lineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
@@ -165612,6 +165713,7 @@ async function measureParagraphBlock(block, maxWidth) {
165612
165713
  lines.push(completedLine);
165613
165714
  tabStopCursor = 0;
165614
165715
  pendingTabAlignment = null;
165716
+ pendingLeader = null;
165615
165717
  currentLine = null;
165616
165718
  }
165617
165719
  } else if (isLastChunk) {
@@ -165731,6 +165833,7 @@ async function measureParagraphBlock(block, maxWidth) {
165731
165833
  lines.push(completedLine);
165732
165834
  tabStopCursor = 0;
165733
165835
  pendingTabAlignment = null;
165836
+ pendingLeader = null;
165734
165837
  currentLine = {
165735
165838
  fromRun: runIndex,
165736
165839
  fromChar: wordStartChar,
@@ -165783,6 +165886,7 @@ async function measureParagraphBlock(block, maxWidth) {
165783
165886
  lines.push(completedLine);
165784
165887
  tabStopCursor = 0;
165785
165888
  pendingTabAlignment = null;
165889
+ pendingLeader = null;
165786
165890
  currentLine = null;
165787
165891
  charPosInRun = wordEndNoSpace + 1;
165788
165892
  continue;
@@ -165820,6 +165924,7 @@ async function measureParagraphBlock(block, maxWidth) {
165820
165924
  }
165821
165925
  if (!isLastSegment) {
165822
165926
  pendingTabAlignment = null;
165927
+ pendingLeader = null;
165823
165928
  if (!currentLine)
165824
165929
  currentLine = {
165825
165930
  fromRun: runIndex,
@@ -165853,20 +165958,23 @@ async function measureParagraphBlock(block, maxWidth) {
165853
165958
  target: clampedTarget - effectiveIndent,
165854
165959
  val: stop.val
165855
165960
  };
165856
- } else
165961
+ } else {
165857
165962
  pendingTabAlignment = null;
165963
+ pendingLeader = null;
165964
+ }
165858
165965
  if (stop && stop.leader && stop.leader !== "none" && stop.leader !== "middleDot") {
165859
165966
  const leaderStyle = stop.leader;
165860
- const relativeTarget = clampedTarget - effectiveIndent;
165861
- const from$1 = Math.min(originX, relativeTarget);
165862
- const to = Math.max(originX, relativeTarget);
165967
+ const from$1 = Math.min(originX + effectiveIndent, clampedTarget);
165968
+ const to = Math.max(originX + effectiveIndent, clampedTarget);
165863
165969
  if (!currentLine.leaders)
165864
165970
  currentLine.leaders = [];
165865
- currentLine.leaders.push({
165971
+ const leader = {
165866
165972
  from: from$1,
165867
165973
  to,
165868
165974
  style: leaderStyle
165869
- });
165975
+ };
165976
+ currentLine.leaders.push(leader);
165977
+ pendingLeader = leader;
165870
165978
  }
165871
165979
  }
165872
165980
  }
@@ -221596,7 +221704,25 @@ var Node$13 = class Node$14 {
221596
221704
  this.onMouseLeave = null;
221597
221705
  this.hoveredSdtId = null;
221598
221706
  }
221599
- }, cssToken = (varName, fallback) => ({
221707
+ }, isRtlParagraph = (attrs) => attrs?.direction === "rtl" || attrs?.rtl === true, resolveTextAlign = (alignment$1, isRtl) => {
221708
+ switch (alignment$1) {
221709
+ case "center":
221710
+ case "right":
221711
+ case "left":
221712
+ return alignment$1;
221713
+ case "justify":
221714
+ default:
221715
+ return isRtl ? "right" : "left";
221716
+ }
221717
+ }, applyRtlStyles = (element3, attrs) => {
221718
+ const rtl = isRtlParagraph(attrs);
221719
+ if (rtl) {
221720
+ element3.setAttribute("dir", "rtl");
221721
+ element3.style.direction = "rtl";
221722
+ }
221723
+ element3.style.textAlign = resolveTextAlign(attrs?.alignment, rtl);
221724
+ return rtl;
221725
+ }, shouldUseSegmentPositioning = (hasExplicitPositioning, hasSegments, isRtl) => hasExplicitPositioning && hasSegments && !isRtl, cssToken = (varName, fallback) => ({
221600
221726
  css: `var(${varName}, ${fallback})`,
221601
221727
  fallback
221602
221728
  }), LIST_MARKER_GAP = 8, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, COMMENT_HIGHLIGHT_EXTERNAL, COMMENT_HIGHLIGHT_EXTERNAL_ACTIVE, COMMENT_HIGHLIGHT_EXTERNAL_FADED, COMMENT_HIGHLIGHT_INTERNAL, COMMENT_HIGHLIGHT_INTERNAL_ACTIVE, COMMENT_HIGHLIGHT_INTERNAL_FADED, COMMENT_HIGHLIGHT_EXTERNAL_NESTED_BORDER, COMMENT_HIGHLIGHT_INTERNAL_NESTED_BORDER, LINK_DATASET_KEYS, MAX_HREF_LENGTH = 2048, SAFE_ANCHOR_PATTERN, MAX_DATA_URL_LENGTH, VALID_IMAGE_DATA_URL, MAX_RESIZE_MULTIPLIER = 3, FALLBACK_MAX_DIMENSION = 1000, MIN_IMAGE_DIMENSION = 20, AMBIGUOUS_LINK_PATTERNS, linkMetrics, TRACK_CHANGE_BASE_CLASS, TRACK_CHANGE_FOCUSED_CLASS = "track-change-focused", TRACK_CHANGE_MODIFIER_CLASS, LINK_TARGET_SET, normalizeAnchor$1 = (value) => {
@@ -222263,27 +222389,12 @@ var Node$13 = class Node$14 {
222263
222389
  console.warn(`[DomPainter] Failed to set data attribute "${key$1}":`, error);
222264
222390
  }
222265
222391
  });
222266
- }, resolveParagraphDirection = (attrs) => {
222267
- if (attrs?.direction)
222268
- return attrs.direction;
222269
- if (attrs?.rtl === true)
222270
- return "rtl";
222271
- if (attrs?.rtl === false)
222272
- return "ltr";
222273
- }, applyParagraphDirection = (element3, attrs) => {
222274
- const direction = resolveParagraphDirection(attrs);
222275
- if (!direction)
222276
- return;
222277
- element3.setAttribute("dir", direction);
222278
- element3.style.direction = direction;
222279
222392
  }, applyParagraphBlockStyles = (element3, attrs) => {
222280
222393
  if (!attrs)
222281
222394
  return;
222282
222395
  if (attrs.styleId)
222283
222396
  element3.setAttribute("styleid", attrs.styleId);
222284
- applyParagraphDirection(element3, attrs);
222285
- if (attrs.alignment)
222286
- element3.style.textAlign = attrs.alignment === "justify" ? "left" : attrs.alignment;
222397
+ applyRtlStyles(element3, attrs);
222287
222398
  if (attrs.dropCap)
222288
222399
  element3.classList.add("sd-editor-dropcap");
222289
222400
  const indent2 = attrs.indent;
@@ -226150,7 +226261,7 @@ var Node$13 = class Node$14 {
226150
226261
  return;
226151
226262
  const trimmed = value.trim();
226152
226263
  return trimmed ? trimmed : undefined;
226153
- }, AUTO_SPACING_DEFAULT_MULTIPLIER = 1.15, AUTO_SPACING_LINE_DEFAULT = 240, normalizeAlignment = (value) => {
226264
+ }, AUTO_SPACING_DEFAULT_MULTIPLIER = 1.15, AUTO_SPACING_LINE_DEFAULT = 240, normalizeAlignment = (value, isRtl = false) => {
226154
226265
  switch (value) {
226155
226266
  case "center":
226156
226267
  case "right":
@@ -226161,11 +226272,14 @@ var Node$13 = class Node$14 {
226161
226272
  case "distribute":
226162
226273
  case "numTab":
226163
226274
  case "thaiDistribute":
226275
+ case "lowKashida":
226276
+ case "mediumKashida":
226277
+ case "highKashida":
226164
226278
  return "justify";
226165
226279
  case "end":
226166
- return "right";
226280
+ return isRtl ? "left" : "right";
226167
226281
  case "start":
226168
- return "left";
226282
+ return isRtl ? "right" : "left";
226169
226283
  default:
226170
226284
  return;
226171
226285
  }
@@ -226425,10 +226539,11 @@ var Node$13 = class Node$14 {
226425
226539
  resolvedParagraphProperties = paragraphProperties;
226426
226540
  else
226427
226541
  resolvedParagraphProperties = resolveParagraphProperties(converterContext, paragraphProperties, converterContext.tableInfo);
226542
+ const isRtl = resolvedParagraphProperties.rightToLeft === true;
226428
226543
  const normalizedSpacing = normalizeParagraphSpacing(resolvedParagraphProperties.spacing, Boolean(resolvedParagraphProperties.numberingProperties));
226429
226544
  const normalizedIndent = normalizeIndentTwipsToPx(resolvedParagraphProperties.indent);
226430
226545
  const normalizedTabStops = normalizeOoxmlTabs(resolvedParagraphProperties.tabStops);
226431
- const normalizedAlignment = normalizeAlignment(resolvedParagraphProperties.justification);
226546
+ const normalizedAlignment = normalizeAlignment(resolvedParagraphProperties.justification, isRtl);
226432
226547
  const normalizedBorders = normalizeParagraphBorders(resolvedParagraphProperties.borders);
226433
226548
  const normalizedShading = normalizeParagraphShading(resolvedParagraphProperties.shading);
226434
226549
  const paragraphDecimalSeparator = DEFAULT_DECIMAL_SEPARATOR;
@@ -226457,8 +226572,10 @@ var Node$13 = class Node$14 {
226457
226572
  keepLines: resolvedParagraphProperties.keepLines,
226458
226573
  floatAlignment,
226459
226574
  pageBreakBefore: resolvedParagraphProperties.pageBreakBefore,
226460
- direction: normalizedDirection,
226461
- rtl: normalizedDirection === "rtl" ? true : normalizedDirection === "ltr" ? false : undefined
226575
+ ...normalizedDirection ? {
226576
+ direction: normalizedDirection,
226577
+ rtl: isRtl
226578
+ } : {}
226462
226579
  };
226463
226580
  if (normalizedNumberingProperties && normalizedListRendering) {
226464
226581
  const markerRunAttrs = computeRunAttrs(resolveRunProperties(converterContext, resolvedParagraphProperties.runProperties, resolvedParagraphProperties, converterContext.tableInfo, true, Boolean(paragraphProperties.numberingProperties)), converterContext);
@@ -228977,16 +229094,17 @@ var Node$13 = class Node$14 {
228977
229094
  const originX = cursorX;
228978
229095
  const { target, nextIndex, stop } = getNextTabStopPx(cursorX + effectiveIndent, tabStops, tabStopCursor);
228979
229096
  tabStopCursor = nextIndex;
228980
- const relativeTarget = (Number.isFinite(maxAbsWidth) ? Math.min(target, maxAbsWidth) : target) - effectiveIndent;
229097
+ const clampedTarget = Number.isFinite(maxAbsWidth) ? Math.min(target, maxAbsWidth) : target;
229098
+ const relativeTarget = clampedTarget - effectiveIndent;
228981
229099
  lineWidth = Math.max(lineWidth, relativeTarget);
229100
+ let currentLeader = null;
228982
229101
  if (stop?.leader && stop.leader !== "none") {
228983
- const from$1 = Math.min(originX, relativeTarget);
228984
- const to = Math.max(originX, relativeTarget);
228985
- leaders.push({
228986
- from: from$1,
228987
- to,
229102
+ currentLeader = {
229103
+ from: Math.min(originX + effectiveIndent, clampedTarget),
229104
+ to: Math.max(originX + effectiveIndent, clampedTarget),
228988
229105
  style: stop.leader
228989
- });
229106
+ };
229107
+ leaders.push(currentLeader);
228990
229108
  }
228991
229109
  const stopVal = stop?.val ?? "start";
228992
229110
  if (stopVal === "end" || stopVal === "center" || stopVal === "decimal") {
@@ -229001,6 +229119,8 @@ var Node$13 = class Node$14 {
229001
229119
  const beforeDecimal = groupMeasure.beforeDecimalWidth ?? groupMeasure.totalWidth;
229002
229120
  groupStartX = Math.max(0, relativeTarget - beforeDecimal);
229003
229121
  }
229122
+ if (currentLeader)
229123
+ currentLeader.to = groupStartX + effectiveIndent;
229004
229124
  pendingTabAlignStartX = groupStartX;
229005
229125
  } else
229006
229126
  cursorX = Math.max(cursorX, relativeTarget);
@@ -234085,16 +234205,16 @@ var Node$13 = class Node$14 {
234085
234205
  return;
234086
234206
  console.log(...args$1);
234087
234207
  }, 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;
234088
- var init_src_BGYOfW0n_es = __esm(() => {
234208
+ var init_src_ej63VOXd_es = __esm(() => {
234089
234209
  init_rolldown_runtime_B2q5OVn9_es();
234090
- init_SuperConverter_BMUaGImr_es();
234210
+ init_SuperConverter_Cqf2W6iO_es();
234091
234211
  init_jszip_ChlR43oI_es();
234092
234212
  init_uuid_qzgm05fK_es();
234093
- init_constants_CMPtQbp7_es();
234213
+ init_constants_Qqwopz80_es();
234094
234214
  init_unified_BRHLwnjP_es();
234095
234215
  init_remark_gfm_z_sDF4ss_es();
234096
234216
  init_remark_stringify_D8vxv_XI_es();
234097
- init_DocxZipper_BBJ5zSyW_es();
234217
+ init_DocxZipper_gWkmvJfR_es();
234098
234218
  init_vue_LcaAh_pz_es();
234099
234219
  init__plugin_vue_export_helper_DBsdbQXw_es();
234100
234220
  init_eventemitter3_C8I7im8Y_es();
@@ -254720,16 +254840,11 @@ function print() { __p += __j.call(arguments, '') }
254720
254840
  el.classList.add(CLASS_NAMES$1.line);
254721
254841
  applyStyles(el, lineStyles(line.lineHeight));
254722
254842
  el.dataset.layoutEpoch = String(this.layoutEpoch);
254723
- const paragraphAttrs = block.attrs ?? {};
254724
- const styleId = paragraphAttrs.styleId;
254843
+ const styleId = (block.attrs ?? {}).styleId;
254725
254844
  if (styleId)
254726
254845
  el.setAttribute("styleid", styleId);
254727
- applyParagraphDirection(el, paragraphAttrs);
254728
- const alignment$1 = paragraphAttrs.alignment;
254729
- if (alignment$1 === "center" || alignment$1 === "right")
254730
- el.style.textAlign = alignment$1;
254731
- else
254732
- el.style.textAlign = "left";
254846
+ const pAttrs = block.attrs;
254847
+ const isRtl = applyRtlStyles(el, pAttrs);
254733
254848
  if (lineRange.pmStart != null)
254734
254849
  el.dataset.pmStart = String(lineRange.pmStart);
254735
254850
  if (lineRange.pmEnd != null)
@@ -254927,7 +255042,7 @@ function print() { __p += __j.call(arguments, '') }
254927
255042
  });
254928
255043
  if (spacingPerSpace !== 0)
254929
255044
  el.style.wordSpacing = `${spacingPerSpace}px`;
254930
- if (hasExplicitPositioning && line.segments) {
255045
+ if (shouldUseSegmentPositioning(hasExplicitPositioning ?? false, Boolean(line.segments), isRtl)) {
254931
255046
  const paraIndent = block.attrs?.indent;
254932
255047
  const indentLeft = paraIndent?.left ?? 0;
254933
255048
  const firstLine = paraIndent?.firstLine ?? 0;
@@ -254940,8 +255055,9 @@ function print() { __p += __j.call(arguments, '') }
254940
255055
  const fallbackListTextStartPx = typeof wordLayout?.marker?.textStartX === "number" && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : undefined;
254941
255056
  const indentOffset = isListParagraph ? isFirstLineOfPara ? resolvedListTextStartPx ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
254942
255057
  let cumulativeX = 0;
255058
+ const segments = line.segments;
254943
255059
  const segmentsByRun = /* @__PURE__ */ new Map;
254944
- line.segments.forEach((segment) => {
255060
+ segments.forEach((segment) => {
254945
255061
  const list5 = segmentsByRun.get(segment.runIndex);
254946
255062
  if (list5)
254947
255063
  list5.push(segment);
@@ -267408,13 +267524,13 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
267408
267524
 
267409
267525
  // ../../packages/superdoc/dist/super-editor.es.js
267410
267526
  var init_super_editor_es = __esm(() => {
267411
- init_src_BGYOfW0n_es();
267412
- init_SuperConverter_BMUaGImr_es();
267527
+ init_src_ej63VOXd_es();
267528
+ init_SuperConverter_Cqf2W6iO_es();
267413
267529
  init_jszip_ChlR43oI_es();
267414
- init_xml_js_DLE8mr0n_es();
267415
- init_constants_CMPtQbp7_es();
267530
+ init_xml_js_40FWvL78_es();
267531
+ init_constants_Qqwopz80_es();
267416
267532
  init_unified_BRHLwnjP_es();
267417
- init_DocxZipper_BBJ5zSyW_es();
267533
+ init_DocxZipper_gWkmvJfR_es();
267418
267534
  init_vue_LcaAh_pz_es();
267419
267535
  init_eventemitter3_C8I7im8Y_es();
267420
267536
  init_zipper_DqXT7uTa_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.4.0-next.6",
3
+ "version": "0.4.0-next.9",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -21,20 +21,20 @@
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
23
  "@superdoc/document-api": "0.0.1",
24
- "superdoc": "1.21.0",
24
+ "@superdoc/pm-adapter": "0.0.0",
25
25
  "@superdoc/super-editor": "0.0.1",
26
- "@superdoc/pm-adapter": "0.0.0"
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.6",
34
- "@superdoc-dev/cli-darwin-x64": "0.4.0-next.6",
35
- "@superdoc-dev/cli-linux-x64": "0.4.0-next.6",
36
- "@superdoc-dev/cli-windows-x64": "0.4.0-next.6",
37
- "@superdoc-dev/cli-linux-arm64": "0.4.0-next.6"
33
+ "@superdoc-dev/cli-darwin-x64": "0.4.0-next.9",
34
+ "@superdoc-dev/cli-darwin-arm64": "0.4.0-next.9",
35
+ "@superdoc-dev/cli-linux-x64": "0.4.0-next.9",
36
+ "@superdoc-dev/cli-linux-arm64": "0.4.0-next.9",
37
+ "@superdoc-dev/cli-windows-x64": "0.4.0-next.9"
38
38
  },
39
39
  "scripts": {
40
40
  "predev": "node scripts/ensure-superdoc-build.js",