@superdoc-dev/cli 0.13.0-next.12 → 0.13.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 +85 -32
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -18876,6 +18876,9 @@ function executeAnchoredMetadataList(adapter, query2) {
18876
18876
  if (query2?.within !== undefined) {
18877
18877
  validateWithin(query2.within, "metadata.list");
18878
18878
  }
18879
+ if (query2?.resolvedOnly !== undefined && typeof query2.resolvedOnly !== "boolean") {
18880
+ throw new DocumentApiValidationError("INVALID_INPUT", `metadata.list 'resolvedOnly' must be a boolean when provided.`);
18881
+ }
18879
18882
  return adapter.list(query2);
18880
18883
  }
18881
18884
  function executeAnchoredMetadataGet(adapter, input) {
@@ -67790,7 +67793,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
67790
67793
  emptyOptions2 = {};
67791
67794
  });
67792
67795
 
67793
- // ../../packages/superdoc/dist/chunks/SuperConverter-qtmGhHOJ.es.js
67796
+ // ../../packages/superdoc/dist/chunks/SuperConverter-1HMbTEKL.es.js
67794
67797
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
67795
67798
  const fieldValue = extension$1.config[field];
67796
67799
  if (typeof fieldValue === "function")
@@ -74348,6 +74351,8 @@ function executeAnchoredMetadataList2(adapter, query2) {
74348
74351
  throw new DocumentApiValidationError2("INVALID_INPUT", `metadata.list 'namespace' must be a string when provided.`);
74349
74352
  if (query2?.within !== undefined)
74350
74353
  validateWithin2(query2.within, "metadata.list");
74354
+ if (query2?.resolvedOnly !== undefined && typeof query2.resolvedOnly !== "boolean")
74355
+ throw new DocumentApiValidationError2("INVALID_INPUT", `metadata.list 'resolvedOnly' must be a boolean when provided.`);
74351
74356
  return adapter.list(query2);
74352
74357
  }
74353
74358
  function executeAnchoredMetadataGet2(adapter, input) {
@@ -122653,7 +122658,7 @@ var isRegExp = (value) => {
122653
122658
  state.kern = kernNode.attributes["w:val"];
122654
122659
  }
122655
122660
  }, SuperConverter;
122656
- var init_SuperConverter_qtmGhHOJ_es = __esm(() => {
122661
+ var init_SuperConverter_1HMbTEKL_es = __esm(() => {
122657
122662
  init_rolldown_runtime_Bg48TavK_es();
122658
122663
  init_jszip_C49i9kUs_es();
122659
122664
  init_xml_js_CqGKpaft_es();
@@ -160967,7 +160972,7 @@ var init_SuperConverter_qtmGhHOJ_es = __esm(() => {
160967
160972
  };
160968
160973
  });
160969
160974
 
160970
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BAtdJwuZ.es.js
160975
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-Bd3oZr3v.es.js
160971
160976
  function parseSizeUnit(val = "0") {
160972
160977
  const length3 = val.toString() || "0";
160973
160978
  const value = Number.parseFloat(length3);
@@ -171199,8 +171204,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
171199
171204
  }
171200
171205
  };
171201
171206
  };
171202
- var init_create_headless_toolbar_BAtdJwuZ_es = __esm(() => {
171203
- init_SuperConverter_qtmGhHOJ_es();
171207
+ var init_create_headless_toolbar_Bd3oZr3v_es = __esm(() => {
171208
+ init_SuperConverter_1HMbTEKL_es();
171204
171209
  init_uuid_qzgm05fK_es();
171205
171210
  init_constants_DrU4EASo_es();
171206
171211
  init_dist_B8HfvhaK_es();
@@ -220410,7 +220415,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
220410
220415
  init_remark_gfm_BhnWr3yf_es();
220411
220416
  });
220412
220417
 
220413
- // ../../packages/superdoc/dist/chunks/src-UhA9uMm0.es.js
220418
+ // ../../packages/superdoc/dist/chunks/src-DC9lS58S.es.js
220414
220419
  function deleteProps(obj, propOrProps) {
220415
220420
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
220416
220421
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -222336,27 +222341,52 @@ function normalizeYjsFragmentEventsForSchema(events, fallbackFragment) {
222336
222341
  function stripSchemaAtomChildren(parent) {
222337
222342
  if (!isTraversableYjsXml(parent))
222338
222343
  return false;
222339
- if (parent instanceof YXmlElement && SCHEMA_ATOM_NODE_NAMES.has(parent.nodeName)) {
222340
- if (parent.length === 0)
222341
- return false;
222342
- parent.delete(0, parent.length);
222343
- return true;
222344
- }
222344
+ if (parent instanceof YXmlElement && SCHEMA_ATOM_NODE_NAMES.has(parent.nodeName))
222345
+ return normalizeSchemaAtomElement(parent);
222345
222346
  let changed = false;
222346
222347
  for (const child of parent.toArray()) {
222347
222348
  if (!(child instanceof YXmlElement))
222348
222349
  continue;
222349
222350
  if (SCHEMA_ATOM_NODE_NAMES.has(child.nodeName)) {
222350
- if (child.length > 0) {
222351
- child.delete(0, child.length);
222352
- changed = true;
222353
- }
222351
+ changed = normalizeSchemaAtomElement(child) || changed;
222354
222352
  continue;
222355
222353
  }
222356
222354
  changed = stripSchemaAtomChildren(child) || changed;
222357
222355
  }
222358
222356
  return changed;
222359
222357
  }
222358
+ function normalizeSchemaAtomElement(element3) {
222359
+ let changed = false;
222360
+ if (isEmptyResolvedText(element3.getAttribute("resolvedText"))) {
222361
+ const visibleText = extractVisibleXmlText(element3);
222362
+ if (visibleText.length > 0) {
222363
+ element3.setAttribute("resolvedText", visibleText);
222364
+ changed = true;
222365
+ }
222366
+ }
222367
+ if (element3.length > 0) {
222368
+ element3.delete(0, element3.length);
222369
+ changed = true;
222370
+ }
222371
+ return changed;
222372
+ }
222373
+ function isEmptyResolvedText(value) {
222374
+ return typeof value !== "string" || value.length === 0;
222375
+ }
222376
+ function extractVisibleXmlText(parent) {
222377
+ let text5 = "";
222378
+ for (const child of parent.toArray())
222379
+ if (child instanceof YXmlText)
222380
+ text5 += extractVisibleTextFromXmlText(child);
222381
+ else if (child instanceof YXmlElement)
222382
+ text5 += extractVisibleXmlText(child);
222383
+ return text5;
222384
+ }
222385
+ function extractVisibleTextFromXmlText(textNode) {
222386
+ return textNode.toDelta().reduce((visibleText, op) => {
222387
+ return typeof op.insert === "string" ? visibleText + op.insert : visibleText;
222388
+ }, "");
222389
+ }
222360
222390
  function findNormalizableEventTarget(target) {
222361
222391
  let current = target;
222362
222392
  while (current) {
@@ -253139,6 +253169,15 @@ function parseMetadataPart(convertedXml, partName) {
253139
253169
  function listMetadataParts(convertedXml) {
253140
253170
  return listCustomXmlParts(convertedXml).map((part) => parseMetadataPart(convertedXml, part.partName)).filter((part) => part !== null);
253141
253171
  }
253172
+ function buildFilteredMetadataXml(editor, convertedXml, options) {
253173
+ const filtered = {};
253174
+ const finalDoc = options?.finalDoc === true;
253175
+ for (const part of listMetadataParts(convertedXml)) {
253176
+ const resolvedEntries = finalDoc ? [] : part.entries.filter((entry) => hasAnchor(editor, entry.id));
253177
+ filtered[part.partName] = buildEnvelopeXml(part.namespace, resolvedEntries);
253178
+ }
253179
+ return filtered;
253180
+ }
253142
253181
  function findPartByNamespace(convertedXml, namespace) {
253143
253182
  return listMetadataParts(convertedXml).find((part) => part.namespace === namespace) ?? null;
253144
253183
  }
@@ -253193,7 +253232,7 @@ function findAnchorsById(editor, id2) {
253193
253232
  return findAllSdtNodes(editor.state.doc).filter((sdt) => sdt.kind === "inline" && sdt.node.attrs?.tag === id2);
253194
253233
  }
253195
253234
  function hasAnchor(editor, id2) {
253196
- return findAllSdtNodes(editor.state.doc).some((sdt) => sdt.node.attrs?.tag === id2);
253235
+ return findAnchorsById(editor, id2).length > 0;
253197
253236
  }
253198
253237
  function wrapRangeInAnchor(editor, target, id2) {
253199
253238
  const { absFrom, absTo } = resolveSelectionTarget(editor, target);
@@ -253328,11 +253367,12 @@ function removeEntry(editor, id2, dryRun) {
253328
253367
  markConverterDirty(editor);
253329
253368
  return true;
253330
253369
  }
253331
- function toSummary(entry) {
253370
+ function toSummary(entry, editor) {
253332
253371
  return {
253333
253372
  id: entry.id,
253334
253373
  namespace: entry.namespace,
253335
- partName: entry.partName
253374
+ partName: entry.partName,
253375
+ anchorStatus: hasAnchor(editor, entry.id) ? "resolved" : "orphan"
253336
253376
  };
253337
253377
  }
253338
253378
  function listEntries(editor, query2) {
@@ -253341,11 +253381,13 @@ function listEntries(editor, query2) {
253341
253381
  entries2 = entries2.filter((entry) => entry.namespace === query2.namespace);
253342
253382
  if (query2?.within !== undefined)
253343
253383
  entries2 = entries2.filter((entry) => anchorOverlaps(editor, entry.id, query2.within));
253384
+ if (query2?.resolvedOnly)
253385
+ entries2 = entries2.filter((entry) => hasAnchor(editor, entry.id));
253344
253386
  return entries2;
253345
253387
  }
253346
253388
  function metadataListWrapper(editor, query2) {
253347
253389
  const { total, items } = paginate(listEntries(editor, query2).map((entry) => {
253348
- const summary = toSummary(entry);
253390
+ const summary = toSummary(entry, editor);
253349
253391
  return buildDiscoveryItem(summary.id, buildResolvedHandle(`metadata:${summary.id}`, "ephemeral", "ext:anchoredMetadata"), summary);
253350
253392
  }), query2?.offset, query2?.limit);
253351
253393
  return buildDiscoveryResult({
@@ -253360,7 +253402,13 @@ function metadataListWrapper(editor, query2) {
253360
253402
  });
253361
253403
  }
253362
253404
  function metadataGetWrapper(editor, input2) {
253363
- return findEntry(getConvertedXml2(editor), input2.id);
253405
+ const entry = findEntry(getConvertedXml2(editor), input2.id);
253406
+ if (!entry)
253407
+ return null;
253408
+ return {
253409
+ ...entry,
253410
+ anchorStatus: hasAnchor(editor, entry.id) ? "resolved" : "orphan"
253411
+ };
253364
253412
  }
253365
253413
  function metadataResolveWrapper(editor, input2) {
253366
253414
  if (!hasPayloadEntry(getConvertedXml2(editor), input2.id))
@@ -313220,13 +313268,13 @@ menclose::after {
313220
313268
  return;
313221
313269
  console.log(...args$1);
313222
313270
  }, 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, TRACKED_MARK_NAMES;
313223
- var init_src_UhA9uMm0_es = __esm(() => {
313271
+ var init_src_DC9lS58S_es = __esm(() => {
313224
313272
  init_rolldown_runtime_Bg48TavK_es();
313225
- init_SuperConverter_qtmGhHOJ_es();
313273
+ init_SuperConverter_1HMbTEKL_es();
313226
313274
  init_jszip_C49i9kUs_es();
313227
313275
  init_xml_js_CqGKpaft_es();
313228
313276
  init_uuid_qzgm05fK_es();
313229
- init_create_headless_toolbar_BAtdJwuZ_es();
313277
+ init_create_headless_toolbar_Bd3oZr3v_es();
313230
313278
  init_constants_DrU4EASo_es();
313231
313279
  init_dist_B8HfvhaK_es();
313232
313280
  init_unified_Dsuw2be5_es();
@@ -338997,6 +339045,11 @@ function print() { __p += __j.call(arguments, '') }
338997
339045
  if (partData?.elements?.[0])
338998
339046
  updatedDocs[path2] = String(this.converter.schemaToXml(partData.elements[0]));
338999
339047
  }
339048
+ if (isFinalDoc) {
339049
+ const filteredMetadataParts = buildFilteredMetadataXml(this, this.converter.convertedXml, { finalDoc: true });
339050
+ for (const [path2, xml2] of Object.entries(filteredMetadataParts))
339051
+ updatedDocs[path2] = xml2;
339052
+ }
339000
339053
  for (const path2 of Object.keys(this.converter.convertedXml)) {
339001
339054
  if (!path2.startsWith("customXml/"))
339002
339055
  continue;
@@ -351253,11 +351306,11 @@ function print() { __p += __j.call(arguments, '') }
351253
351306
  ]);
351254
351307
  });
351255
351308
 
351256
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BlXIZRF5.es.js
351309
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BObTHhKp.es.js
351257
351310
  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;
351258
- var init_create_super_doc_ui_BlXIZRF5_es = __esm(() => {
351259
- init_SuperConverter_qtmGhHOJ_es();
351260
- init_create_headless_toolbar_BAtdJwuZ_es();
351311
+ var init_create_super_doc_ui_BObTHhKp_es = __esm(() => {
351312
+ init_SuperConverter_1HMbTEKL_es();
351313
+ init_create_headless_toolbar_Bd3oZr3v_es();
351261
351314
  MOD_ALIASES = new Set([
351262
351315
  "Mod",
351263
351316
  "Meta",
@@ -351299,16 +351352,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
351299
351352
 
351300
351353
  // ../../packages/superdoc/dist/super-editor.es.js
351301
351354
  var init_super_editor_es = __esm(() => {
351302
- init_src_UhA9uMm0_es();
351303
- init_SuperConverter_qtmGhHOJ_es();
351355
+ init_src_DC9lS58S_es();
351356
+ init_SuperConverter_1HMbTEKL_es();
351304
351357
  init_jszip_C49i9kUs_es();
351305
351358
  init_xml_js_CqGKpaft_es();
351306
- init_create_headless_toolbar_BAtdJwuZ_es();
351359
+ init_create_headless_toolbar_Bd3oZr3v_es();
351307
351360
  init_constants_DrU4EASo_es();
351308
351361
  init_dist_B8HfvhaK_es();
351309
351362
  init_unified_Dsuw2be5_es();
351310
351363
  init_DocxZipper_CZMPWpOp_es();
351311
- init_create_super_doc_ui_BlXIZRF5_es();
351364
+ init_create_super_doc_ui_BObTHhKp_es();
351312
351365
  init_ui_C5PAS9hY_es();
351313
351366
  init_eventemitter3_BnGqBE_Q_es();
351314
351367
  init_errors_CNaD6vcg_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.13.0-next.12",
3
+ "version": "0.13.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
+ "superdoc": "1.35.0",
29
29
  "@superdoc/super-editor": "0.0.1",
30
- "superdoc": "1.35.0"
30
+ "@superdoc/pm-adapter": "0.0.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.13.0-next.12",
38
- "@superdoc-dev/cli-darwin-x64": "0.13.0-next.12",
39
- "@superdoc-dev/cli-linux-x64": "0.13.0-next.12",
40
- "@superdoc-dev/cli-linux-arm64": "0.13.0-next.12",
41
- "@superdoc-dev/cli-windows-x64": "0.13.0-next.12"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.13.0-next.14",
38
+ "@superdoc-dev/cli-darwin-x64": "0.13.0-next.14",
39
+ "@superdoc-dev/cli-linux-x64": "0.13.0-next.14",
40
+ "@superdoc-dev/cli-linux-arm64": "0.13.0-next.14",
41
+ "@superdoc-dev/cli-windows-x64": "0.13.0-next.14"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",