@superdoc-dev/cli 0.11.1 → 0.12.0-next.10

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 +70 -34
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -2368,7 +2368,7 @@ More content with **bold** and *italic*.`
2368
2368
  },
2369
2369
  "format.paragraph.setAlignment": {
2370
2370
  memberPath: "format.paragraph.setAlignment",
2371
- description: "Set paragraph alignment (justification) on a paragraph-like block.",
2371
+ description: "Set visual paragraph alignment on a paragraph-like block. For RTL paragraphs, left/right are translated to Word-compatible stored justification values.",
2372
2372
  expectedResult: "Returns a ParagraphMutationResult; reports NO_OP if the alignment already matches.",
2373
2373
  requiresDocumentContext: true,
2374
2374
  metadata: mutationOperation({
@@ -10405,10 +10405,13 @@ var init_schemas = __esm(() => {
10405
10405
  failure: paragraphMutationFailureSchemaFor("format.paragraph.resetDirectFormatting")
10406
10406
  },
10407
10407
  "format.paragraph.setAlignment": {
10408
- input: objectSchema({ target: paragraphTargetSchema, alignment: { enum: [...PARAGRAPH_ALIGNMENTS] } }, [
10409
- "target",
10410
- "alignment"
10411
- ]),
10408
+ input: objectSchema({
10409
+ target: paragraphTargetSchema,
10410
+ alignment: {
10411
+ enum: [...PARAGRAPH_ALIGNMENTS],
10412
+ description: "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side."
10413
+ }
10414
+ }, ["target", "alignment"]),
10412
10415
  output: paragraphMutationResultSchemaFor("format.paragraph.setAlignment"),
10413
10416
  success: paragraphMutationSuccessSchema,
10414
10417
  failure: paragraphMutationFailureSchemaFor("format.paragraph.setAlignment")
@@ -66775,7 +66778,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
66775
66778
  emptyOptions2 = {};
66776
66779
  });
66777
66780
 
66778
- // ../../packages/superdoc/dist/chunks/SuperConverter-SvCYq2KK.es.js
66781
+ // ../../packages/superdoc/dist/chunks/SuperConverter-UqLu6KQU.es.js
66779
66782
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
66780
66783
  const fieldValue = extension$1.config[field];
66781
66784
  if (typeof fieldValue === "function")
@@ -120751,7 +120754,7 @@ var isRegExp = (value) => {
120751
120754
  state.kern = kernNode.attributes["w:val"];
120752
120755
  }
120753
120756
  }, SuperConverter;
120754
- var init_SuperConverter_SvCYq2KK_es = __esm(() => {
120757
+ var init_SuperConverter_UqLu6KQU_es = __esm(() => {
120755
120758
  init_rolldown_runtime_Bg48TavK_es();
120756
120759
  init_jszip_C49i9kUs_es();
120757
120760
  init_xml_js_CqGKpaft_es();
@@ -124570,7 +124573,7 @@ var init_SuperConverter_SvCYq2KK_es = __esm(() => {
124570
124573
  },
124571
124574
  "format.paragraph.setAlignment": {
124572
124575
  memberPath: "format.paragraph.setAlignment",
124573
- description: "Set paragraph alignment (justification) on a paragraph-like block.",
124576
+ description: "Set visual paragraph alignment on a paragraph-like block. For RTL paragraphs, left/right are translated to Word-compatible stored justification values.",
124574
124577
  expectedResult: "Returns a ParagraphMutationResult; reports NO_OP if the alignment already matches.",
124575
124578
  requiresDocumentContext: true,
124576
124579
  metadata: mutationOperation2({
@@ -132500,7 +132503,10 @@ var init_SuperConverter_SvCYq2KK_es = __esm(() => {
132500
132503
  }
132501
132504
  }, ["target", "styleId"]), paragraphMutationResultSchemaFor2("styles.paragraph.setStyle"), paragraphMutationFailureSchemaFor2("styles.paragraph.setStyle"), objectSchema2({ target: paragraphTargetSchema2 }, ["target"]), paragraphMutationResultSchemaFor2("styles.paragraph.clearStyle"), paragraphMutationFailureSchemaFor2("styles.paragraph.clearStyle"), objectSchema2({ target: paragraphTargetSchema2 }, ["target"]), paragraphMutationResultSchemaFor2("format.paragraph.resetDirectFormatting"), paragraphMutationFailureSchemaFor2("format.paragraph.resetDirectFormatting"), objectSchema2({
132502
132505
  target: paragraphTargetSchema2,
132503
- alignment: { enum: [...PARAGRAPH_ALIGNMENTS2] }
132506
+ alignment: {
132507
+ enum: [...PARAGRAPH_ALIGNMENTS2],
132508
+ description: "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side."
132509
+ }
132504
132510
  }, ["target", "alignment"]), paragraphMutationResultSchemaFor2("format.paragraph.setAlignment"), paragraphMutationFailureSchemaFor2("format.paragraph.setAlignment"), objectSchema2({ target: paragraphTargetSchema2 }, ["target"]), paragraphMutationResultSchemaFor2("format.paragraph.clearAlignment"), paragraphMutationFailureSchemaFor2("format.paragraph.clearAlignment"), { ...objectSchema2({
132505
132511
  target: paragraphTargetSchema2,
132506
132512
  left: {
@@ -158928,7 +158934,7 @@ var init_SuperConverter_SvCYq2KK_es = __esm(() => {
158928
158934
  };
158929
158935
  });
158930
158936
 
158931
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CAjlOJ3Q.es.js
158937
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-QcQvy-nD.es.js
158932
158938
  function parseSizeUnit(val = "0") {
158933
158939
  const length3 = val.toString() || "0";
158934
158940
  const value = Number.parseFloat(length3);
@@ -162211,6 +162217,7 @@ function getWordChanges(oldText, newText) {
162211
162217
  i4++;
162212
162218
  continue;
162213
162219
  }
162220
+ const groupStart = i4;
162214
162221
  let deleteStart = -1;
162215
162222
  let deleteEnd = -1;
162216
162223
  let insertText2 = "";
@@ -162239,7 +162246,7 @@ function getWordChanges(oldText, newText) {
162239
162246
  oldTo: deleteEnd
162240
162247
  });
162241
162248
  else if (insertText2.length > 0) {
162242
- const prevStep = i4 > 0 ? steps[i4 - 1] : null;
162249
+ const prevStep = groupStart > 0 ? steps[groupStart - 1] : null;
162243
162250
  let insertAt = 0;
162244
162251
  if (prevStep && prevStep.type === "equal") {
162245
162252
  const prevToken = oldTokens[prevStep.oldIdx];
@@ -167834,6 +167841,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
167834
167841
  const documentId = activeEditor?.options?.documentId;
167835
167842
  if (!documentId)
167836
167843
  return null;
167844
+ if (typeof superdoc.getPresentationEditorForDocument === "function")
167845
+ return superdoc.getPresentationEditorForDocument(documentId);
167837
167846
  return (superdoc.superdocStore?.documents ?? []).find((doc2) => doc2.getEditor?.()?.options?.documentId === documentId)?.getPresentationEditor?.() ?? null;
167838
167847
  }, resolveToolbarSources = (superdoc) => {
167839
167848
  const presentationEditor = resolvePresentationEditor(superdoc);
@@ -168580,17 +168589,21 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
168580
168589
  active: false,
168581
168590
  disabled: isCommandDisabled(context) || !inTable
168582
168591
  };
168592
+ }, lookupCommentByCommentId = (superdoc, commentId) => {
168593
+ if (typeof superdoc?.getComment === "function")
168594
+ return superdoc.getComment(commentId) ?? null;
168595
+ const store = superdoc?.commentsStore;
168596
+ if (typeof store?.getComment === "function")
168597
+ return store.getComment(commentId) ?? null;
168598
+ return null;
168583
168599
  }, enrichTrackedChanges = (trackedChanges = [], superdoc) => {
168584
168600
  if (!trackedChanges.length)
168585
168601
  return trackedChanges;
168586
- const store = superdoc?.commentsStore;
168587
- if (!store?.getComment)
168588
- return trackedChanges;
168589
168602
  return trackedChanges.map((change) => {
168590
168603
  const commentId = change.id;
168591
168604
  if (!commentId)
168592
168605
  return change;
168593
- const storeComment = store.getComment(commentId);
168606
+ const storeComment = lookupCommentByCommentId(superdoc, commentId);
168594
168607
  if (!storeComment)
168595
168608
  return change;
168596
168609
  const comment = typeof storeComment.getValues === "function" ? storeComment.getValues() : storeComment;
@@ -168938,8 +168951,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
168938
168951
  }
168939
168952
  };
168940
168953
  };
168941
- var init_create_headless_toolbar_CAjlOJ3Q_es = __esm(() => {
168942
- init_SuperConverter_SvCYq2KK_es();
168954
+ var init_create_headless_toolbar_QcQvy_nD_es = __esm(() => {
168955
+ init_SuperConverter_UqLu6KQU_es();
168943
168956
  init_uuid_qzgm05fK_es();
168944
168957
  init_constants_DrU4EASo_es();
168945
168958
  init_dist_B8HfvhaK_es();
@@ -218144,7 +218157,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
218144
218157
  init_remark_gfm_BhnWr3yf_es();
218145
218158
  });
218146
218159
 
218147
- // ../../packages/superdoc/dist/chunks/src-C5nJLlXh.es.js
218160
+ // ../../packages/superdoc/dist/chunks/src-DXlYP0an.es.js
218148
218161
  function deleteProps(obj, propOrProps) {
218149
218162
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
218150
218163
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -249784,6 +249797,8 @@ function metadataGetWrapper(editor, input2) {
249784
249797
  return findEntry(getConvertedXml2(editor), input2.id);
249785
249798
  }
249786
249799
  function metadataResolveWrapper(editor, input2) {
249800
+ if (!hasPayloadEntry(getConvertedXml2(editor), input2.id))
249801
+ return null;
249787
249802
  const target = resolveAnchorTarget(editor, input2.id);
249788
249803
  return target ? {
249789
249804
  id: input2.id,
@@ -306531,13 +306546,13 @@ menclose::after {
306531
306546
  return;
306532
306547
  console.log(...args$1);
306533
306548
  }, 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;
306534
- var init_src_C5nJLlXh_es = __esm(() => {
306549
+ var init_src_DXlYP0an_es = __esm(() => {
306535
306550
  init_rolldown_runtime_Bg48TavK_es();
306536
- init_SuperConverter_SvCYq2KK_es();
306551
+ init_SuperConverter_UqLu6KQU_es();
306537
306552
  init_jszip_C49i9kUs_es();
306538
306553
  init_xml_js_CqGKpaft_es();
306539
306554
  init_uuid_qzgm05fK_es();
306540
- init_create_headless_toolbar_CAjlOJ3Q_es();
306555
+ init_create_headless_toolbar_QcQvy_nD_es();
306541
306556
  init_constants_DrU4EASo_es();
306542
306557
  init_dist_B8HfvhaK_es();
306543
306558
  init_unified_Dsuw2be5_es();
@@ -328420,6 +328435,12 @@ function print() { __p += __j.call(arguments, '') }
328420
328435
  customButtons: [],
328421
328436
  showFormattingMarksButton: false
328422
328437
  };
328438
+ toolbarItems = [];
328439
+ overflowItems = [];
328440
+ isDev = false;
328441
+ role = "editor";
328442
+ superdoc;
328443
+ toolbarContainer = null;
328423
328444
  constructor(config2) {
328424
328445
  super();
328425
328446
  this.config = {
@@ -344253,11 +344274,11 @@ function print() { __p += __j.call(arguments, '') }
344253
344274
  ];
344254
344275
  });
344255
344276
 
344256
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-Bgxw65Gk.es.js
344277
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BuJIur0F.es.js
344257
344278
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
344258
- var init_create_super_doc_ui_Bgxw65Gk_es = __esm(() => {
344259
- init_SuperConverter_SvCYq2KK_es();
344260
- init_create_headless_toolbar_CAjlOJ3Q_es();
344279
+ var init_create_super_doc_ui_BuJIur0F_es = __esm(() => {
344280
+ init_SuperConverter_UqLu6KQU_es();
344281
+ init_create_headless_toolbar_QcQvy_nD_es();
344261
344282
  MOD_ALIASES = new Set([
344262
344283
  "Mod",
344263
344284
  "Meta",
@@ -344299,16 +344320,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
344299
344320
 
344300
344321
  // ../../packages/superdoc/dist/super-editor.es.js
344301
344322
  var init_super_editor_es = __esm(() => {
344302
- init_src_C5nJLlXh_es();
344303
- init_SuperConverter_SvCYq2KK_es();
344323
+ init_src_DXlYP0an_es();
344324
+ init_SuperConverter_UqLu6KQU_es();
344304
344325
  init_jszip_C49i9kUs_es();
344305
344326
  init_xml_js_CqGKpaft_es();
344306
- init_create_headless_toolbar_CAjlOJ3Q_es();
344327
+ init_create_headless_toolbar_QcQvy_nD_es();
344307
344328
  init_constants_DrU4EASo_es();
344308
344329
  init_dist_B8HfvhaK_es();
344309
344330
  init_unified_Dsuw2be5_es();
344310
344331
  init_DocxZipper_CZMPWpOp_es();
344311
- init_create_super_doc_ui_Bgxw65Gk_es();
344332
+ init_create_super_doc_ui_BuJIur0F_es();
344312
344333
  init_ui_C5PAS9hY_es();
344313
344334
  init_eventemitter3_BnGqBE_Q_es();
344314
344335
  init_errors_CNaD6vcg_es();
@@ -405129,13 +405150,16 @@ var init_invoke2 = __esm(async () => {
405129
405150
  var exports_server = {};
405130
405151
  __export(exports_server, {
405131
405152
  runHostStdio: () => runHostStdio,
405153
+ parseHostCommandTokens: () => parseHostCommandTokens,
405132
405154
  HostServer: () => HostServer
405133
405155
  });
405134
405156
  import { createInterface } from "node:readline";
405135
405157
  function parseHostCommandTokens(tokens) {
405136
405158
  let stdio = false;
405137
405159
  let help = false;
405138
- for (const token2 of tokens) {
405160
+ let requestTimeoutMs;
405161
+ for (let i4 = 0;i4 < tokens.length; i4++) {
405162
+ const token2 = tokens[i4];
405139
405163
  if (token2 === "--stdio") {
405140
405164
  stdio = true;
405141
405165
  continue;
@@ -405144,9 +405168,21 @@ function parseHostCommandTokens(tokens) {
405144
405168
  help = true;
405145
405169
  continue;
405146
405170
  }
405171
+ if (token2 === REQUEST_TIMEOUT_FLAG || token2.startsWith(`${REQUEST_TIMEOUT_FLAG}=`)) {
405172
+ const value2 = token2 === REQUEST_TIMEOUT_FLAG ? tokens[++i4] : token2.slice(REQUEST_TIMEOUT_FLAG.length + 1);
405173
+ if (value2 == null || value2 === "") {
405174
+ throw new CliError("INVALID_ARGUMENT", `host: ${REQUEST_TIMEOUT_FLAG} requires a positive finite number of milliseconds.`);
405175
+ }
405176
+ const parsed = Number(value2);
405177
+ if (!Number.isFinite(parsed) || parsed <= 0) {
405178
+ throw new CliError("INVALID_ARGUMENT", `host: ${REQUEST_TIMEOUT_FLAG} requires a positive finite number of milliseconds (got ${JSON.stringify(value2)}).`);
405179
+ }
405180
+ requestTimeoutMs = parsed;
405181
+ continue;
405182
+ }
405147
405183
  throw new CliError("INVALID_ARGUMENT", `host: unknown option ${token2}`);
405148
405184
  }
405149
- return { stdio, help };
405185
+ return { stdio, help, requestTimeoutMs };
405150
405186
  }
405151
405187
  async function settleWithTimeout(promise, timeoutMs) {
405152
405188
  const settled = promise.then((value2) => ({ kind: "success", value: value2 }), (error4) => ({ kind: "error", error: error4 }));
@@ -405332,7 +405368,7 @@ async function runHostStdio(tokens, io) {
405332
405368
  if (!parsed.stdio) {
405333
405369
  throw new CliError("INVALID_ARGUMENT", "host: only --stdio is supported in v1.");
405334
405370
  }
405335
- const server = new HostServer({ io });
405371
+ const server = new HostServer({ io, requestTimeoutMs: parsed.requestTimeoutMs });
405336
405372
  const rl = createInterface({
405337
405373
  input: process.stdin,
405338
405374
  crlfDelay: Number.POSITIVE_INFINITY
@@ -405351,8 +405387,8 @@ async function runHostStdio(tokens, io) {
405351
405387
  return 0;
405352
405388
  }
405353
405389
  var HOST_HELP = `Usage:
405354
- superdoc host --stdio
405355
- `, DEFAULT_REQUEST_TIMEOUT_MS = 30000;
405390
+ superdoc host --stdio [--request-timeout-ms <ms>]
405391
+ `, DEFAULT_REQUEST_TIMEOUT_MS = 30000, REQUEST_TIMEOUT_FLAG = "--request-timeout-ms";
405356
405392
  var init_server = __esm(async () => {
405357
405393
  init_errors();
405358
405394
  init_guards();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.11.1",
3
+ "version": "0.12.0-next.10",
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": "1.34.0",
28
29
  "@superdoc/pm-adapter": "0.0.0",
29
- "@superdoc/super-editor": "0.0.1",
30
- "superdoc": "1.34.0"
30
+ "@superdoc/super-editor": "0.0.1"
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.11.1",
38
- "@superdoc-dev/cli-darwin-x64": "0.11.1",
39
- "@superdoc-dev/cli-linux-x64": "0.11.1",
40
- "@superdoc-dev/cli-linux-arm64": "0.11.1",
41
- "@superdoc-dev/cli-windows-x64": "0.11.1"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.12.0-next.10",
38
+ "@superdoc-dev/cli-darwin-x64": "0.12.0-next.10",
39
+ "@superdoc-dev/cli-linux-arm64": "0.12.0-next.10",
40
+ "@superdoc-dev/cli-linux-x64": "0.12.0-next.10",
41
+ "@superdoc-dev/cli-windows-x64": "0.12.0-next.10"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",