@superdoc-dev/cli 0.17.0-next.41 → 0.17.0-next.42

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 +109 -32
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -68164,7 +68164,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
68164
68164
  emptyOptions2 = {};
68165
68165
  });
68166
68166
 
68167
- // ../../packages/superdoc/dist/chunks/SuperConverter--x_mSI6o.es.js
68167
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DRKaQwZS.es.js
68168
68168
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68169
68169
  const fieldValue = extension$1.config[field];
68170
68170
  if (typeof fieldValue === "function")
@@ -90006,6 +90006,7 @@ function getFormattingStateAtPos(state, pos, editor, options = {}) {
90006
90006
  const context = getParagraphRunContext($pos, editor);
90007
90007
  const currentRunProperties = context?.runProperties || null;
90008
90008
  const cursorMarks = $pos.marks();
90009
+ const directMarkRunProperties = decodeRPrFromMarks(cursorMarks);
90009
90010
  const hasStoredMarks = storedMarks !== null;
90010
90011
  const hasExplicitEmptyStoredMarks = hasStoredMarks && storedMarks.length === 0;
90011
90012
  const resolvedMarks = [];
@@ -90033,7 +90034,9 @@ function getFormattingStateAtPos(state, pos, editor, options = {}) {
90033
90034
  inlineMarks: [],
90034
90035
  resolvedRunProperties: {},
90035
90036
  inlineRunProperties: {},
90036
- styleRunProperties: {}
90037
+ styleRunProperties: {},
90038
+ directMarkRunProperties: {},
90039
+ mixedRunProperties: null
90037
90040
  };
90038
90041
  const resolvedFromSelection = getInheritedRunProperties($pos, editor, preferParagraphRunProperties || !hasStoredMarks && context?.isEmpty ? context?.paragraphAttrs?.paragraphProperties?.runProperties || null : inlineRunProperties);
90039
90042
  const resolvedRunProperties = resolvedFromSelection?.resolvedRunProperties ?? inlineRunProperties;
@@ -90047,7 +90050,9 @@ function getFormattingStateAtPos(state, pos, editor, options = {}) {
90047
90050
  inlineMarks,
90048
90051
  resolvedRunProperties,
90049
90052
  inlineRunProperties,
90050
- styleRunProperties
90053
+ styleRunProperties,
90054
+ directMarkRunProperties,
90055
+ mixedRunProperties: null
90051
90056
  };
90052
90057
  }
90053
90058
  function getFormattingStateForRange(state, from4, to, editor) {
@@ -90067,9 +90072,14 @@ function getFormattingStateForRange(state, from4, to, editor) {
90067
90072
  return aggregateFormattingSegments(state, editor, segments);
90068
90073
  }
90069
90074
  function aggregateFormattingSegments(state, editor, segments) {
90070
- const resolvedRunProperties = intersectRunProperties(segments.map((segment) => segment.resolvedRunProperties));
90071
- const inlineRunProperties = intersectRunProperties(segments.map((segment) => segment.inlineRunProperties));
90072
- const styleRunProperties = intersectRunProperties(segments.map((segment) => segment.styleRunProperties));
90075
+ const resolvedRunPropertiesList = segments.map((segment) => segment.resolvedRunProperties);
90076
+ const inlineRunPropertiesList = segments.map((segment) => segment.inlineRunProperties);
90077
+ const styleRunPropertiesList = segments.map((segment) => segment.styleRunProperties);
90078
+ const directMarkRunPropertiesList = segments.map((segment) => segment.directMarkRunProperties);
90079
+ const resolvedRunProperties = intersectRunProperties(resolvedRunPropertiesList);
90080
+ const inlineRunProperties = intersectRunProperties(inlineRunPropertiesList);
90081
+ const styleRunProperties = intersectRunProperties(styleRunPropertiesList);
90082
+ const directMarkRunProperties = intersectRunProperties(directMarkRunPropertiesList);
90073
90083
  const resolvedMarks = createMarksFromRunProperties(state, resolvedRunProperties, editor);
90074
90084
  const inlineMarks = createMarksFromRunProperties(state, inlineRunProperties, editor);
90075
90085
  return {
@@ -90077,7 +90087,9 @@ function aggregateFormattingSegments(state, editor, segments) {
90077
90087
  inlineMarks,
90078
90088
  resolvedRunProperties,
90079
90089
  inlineRunProperties,
90080
- styleRunProperties
90090
+ styleRunProperties,
90091
+ directMarkRunProperties,
90092
+ mixedRunProperties: getMixedRunProperties(resolvedRunPropertiesList, directMarkRunPropertiesList)
90081
90093
  };
90082
90094
  }
90083
90095
  function mergeResolvedMarksWithInlineFallback(resolvedMarks, inlineMarks) {
@@ -90102,6 +90114,41 @@ function intersectRunProperties(runPropertiesList) {
90102
90114
  });
90103
90115
  return Object.keys(intersection).length ? intersection : null;
90104
90116
  }
90117
+ function getMixedRunProperties(runPropertiesList, directRunPropertiesList = []) {
90118
+ const filtered = runPropertiesList.filter((props) => props && typeof props === "object");
90119
+ if (filtered.length <= 1)
90120
+ return null;
90121
+ const keys$1 = new Set(filtered.flatMap((props) => Object.keys(props)));
90122
+ const mixed = {};
90123
+ keys$1.forEach((key) => {
90124
+ if (key === "fontFamily" && hasUniformDirectFontFamily(directRunPropertiesList))
90125
+ return;
90126
+ const values = filtered.map((props) => Object.prototype.hasOwnProperty.call(props, key) ? props[key] : undefined);
90127
+ const first = JSON.stringify(values[0]);
90128
+ if (values.some((value) => JSON.stringify(value) !== first))
90129
+ mixed[key] = true;
90130
+ });
90131
+ return Object.keys(mixed).length ? mixed : null;
90132
+ }
90133
+ function hasUniformDirectFontFamily(runPropertiesList) {
90134
+ if (runPropertiesList.length <= 1)
90135
+ return false;
90136
+ let firstValue;
90137
+ let hasFirstValue = false;
90138
+ for (const props of runPropertiesList) {
90139
+ if (!props || typeof props !== "object" || !Object.prototype.hasOwnProperty.call(props, "fontFamily"))
90140
+ return false;
90141
+ const value = props.fontFamily;
90142
+ if (!hasFirstValue) {
90143
+ firstValue = value;
90144
+ hasFirstValue = true;
90145
+ continue;
90146
+ }
90147
+ if (JSON.stringify(value) !== JSON.stringify(firstValue))
90148
+ return false;
90149
+ }
90150
+ return hasFirstValue;
90151
+ }
90105
90152
  function getInheritedRunProperties($pos, editor, inlineRunProperties) {
90106
90153
  if (!editor)
90107
90154
  return {
@@ -136401,7 +136448,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
136401
136448
  state.kern = kernNode.attributes["w:val"];
136402
136449
  }
136403
136450
  }, SuperConverter;
136404
- var init_SuperConverter_x_mSI6o_es = __esm(() => {
136451
+ var init_SuperConverter_DRKaQwZS_es = __esm(() => {
136405
136452
  init_rolldown_runtime_Bg48TavK_es();
136406
136453
  init_jszip_C49i9kUs_es();
136407
136454
  init_xml_js_CqGKpaft_es();
@@ -165327,7 +165374,7 @@ var init_SuperConverter_x_mSI6o_es = __esm(() => {
165327
165374
  };
165328
165375
  });
165329
165376
 
165330
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-D1KbRv5B.es.js
165377
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-ChACxHAH.es.js
165331
165378
  function parseSizeUnit(val = "0") {
165332
165379
  const length3 = val.toString() || "0";
165333
165380
  const value = Number.parseFloat(length3);
@@ -175292,6 +175339,14 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
175292
175339
  if (!rawActiveMark || !hasFormattingAttrs(rawActiveMark))
175293
175340
  return false;
175294
175341
  return isNegatedMark(rawActiveMark.name, rawActiveMark.attrs);
175342
+ }, getPrimaryFontFamily = (value) => {
175343
+ if (typeof value === "string")
175344
+ return value.split(",")[0].trim();
175345
+ if (!value || typeof value !== "object")
175346
+ return null;
175347
+ const fontFamily = value;
175348
+ const primary = fontFamily.ascii ?? fontFamily.hAnsi ?? fontFamily.eastAsia ?? fontFamily.cs;
175349
+ return typeof primary === "string" ? primary.split(",")[0].trim() : null;
175295
175350
  }, isFormatCommandsStorage = (value) => {
175296
175351
  return typeof value === "object" && value !== null && "storedStyle" in value;
175297
175352
  }, hasStoredCopyFormat = (context) => {
@@ -175384,15 +175439,20 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
175384
175439
  disabled: true,
175385
175440
  value: null
175386
175441
  };
175387
- const normalizedValues = getFormattingAttr(formatting, "fontFamily", "fontFamily").map((value$1) => normalizeFontFamilyValue(value$1));
175442
+ const values = getFormattingAttr(formatting, "fontFamily", "fontFamily");
175443
+ const selectionFormattingState = stateEditor?.state?.selection?.empty === false ? getSelectionFormattingState(stateEditor.state, stateEditor) : null;
175444
+ const normalizedValues = values.map((value$1) => normalizeFontFamilyValue(value$1));
175388
175445
  const uniqueValues = [...new Set(normalizedValues)];
175389
- const canUseLinkedStyle = !(uniqueValues.length > 0) && isFormattingActivatedFromLinkedStyle(context, "font-family");
175446
+ const hasDirectValue = uniqueValues.length > 0;
175447
+ const hasMixedFontFamily = Boolean(selectionFormattingState?.mixedRunProperties?.fontFamily);
175448
+ const directSelectionValue = normalizeFontFamilyValue(getPrimaryFontFamily(selectionFormattingState?.directMarkRunProperties?.fontFamily));
175449
+ const canUseLinkedStyle = !hasDirectValue && !hasMixedFontFamily && isFormattingActivatedFromLinkedStyle(context, "font-family");
175390
175450
  const paragraphProps = canUseLinkedStyle ? getCurrentResolvedParagraphProperties(context) : null;
175391
175451
  const documentEditor = context?.presentationEditor?.editor ?? context?.editor ?? null;
175392
175452
  const linkedStyleValue = normalizeFontFamilyValue((canUseLinkedStyle ? documentEditor?.converter?.linkedStyles?.find((style) => style.id === paragraphProps?.styleId) : null)?.definition?.styles?.["font-family"]) ?? null;
175393
- const value = uniqueValues.length === 1 ? uniqueValues[0] : linkedStyleValue;
175453
+ const value = hasMixedFontFamily ? null : directSelectionValue || (uniqueValues.length === 1 ? uniqueValues[0] : linkedStyleValue);
175394
175454
  return {
175395
- active: uniqueValues.length > 0 || linkedStyleValue != null,
175455
+ active: hasMixedFontFamily || uniqueValues.length > 0 || directSelectionValue != null || linkedStyleValue != null,
175396
175456
  disabled: false,
175397
175457
  value
175398
175458
  };
@@ -176117,9 +176177,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
176117
176177
  }
176118
176178
  };
176119
176179
  };
176120
- var init_create_headless_toolbar_D1KbRv5B_es = __esm(() => {
176180
+ var init_create_headless_toolbar_ChACxHAH_es = __esm(() => {
176121
176181
  init_rolldown_runtime_Bg48TavK_es();
176122
- init_SuperConverter_x_mSI6o_es();
176182
+ init_SuperConverter_DRKaQwZS_es();
176123
176183
  init_jszip_C49i9kUs_es();
176124
176184
  init_uuid_B2wVPhPi_es();
176125
176185
  init_constants_D9qj59G2_es();
@@ -226212,7 +226272,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
226212
226272
  init_remark_gfm_BUJjZJLy_es();
226213
226273
  });
226214
226274
 
226215
- // ../../packages/superdoc/dist/chunks/src-Fy-l94Cn.es.js
226275
+ // ../../packages/superdoc/dist/chunks/src-ly1ZYfUZ.es.js
226216
226276
  function deleteProps(obj, propOrProps) {
226217
226277
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
226218
226278
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -303010,7 +303070,12 @@ var Node$13 = class Node$14 {
303010
303070
  suppressActiveHighlight: true,
303011
303071
  attributes: { ariaLabel: "Font family" },
303012
303072
  options: fontOptions,
303013
- onActivate: ({ fontFamily }) => {
303073
+ onActivate: ({ fontFamily } = {}, isMultiple = false) => {
303074
+ if (isMultiple) {
303075
+ fontButton.label.value = "";
303076
+ fontButton.selectedValue.value = "";
303077
+ return;
303078
+ }
303014
303079
  if (!fontFamily)
303015
303080
  return;
303016
303081
  fontFamily = fontFamily.split(",")[0];
@@ -326428,13 +326493,13 @@ menclose::after {
326428
326493
  return;
326429
326494
  console.log(...args$1);
326430
326495
  }, 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;
326431
- var init_src_Fy_l94Cn_es = __esm(() => {
326496
+ var init_src_ly1ZYfUZ_es = __esm(() => {
326432
326497
  init_rolldown_runtime_Bg48TavK_es();
326433
- init_SuperConverter_x_mSI6o_es();
326498
+ init_SuperConverter_DRKaQwZS_es();
326434
326499
  init_jszip_C49i9kUs_es();
326435
326500
  init_xml_js_CqGKpaft_es();
326436
326501
  init_uuid_B2wVPhPi_es();
326437
- init_create_headless_toolbar_D1KbRv5B_es();
326502
+ init_create_headless_toolbar_ChACxHAH_es();
326438
326503
  init_constants_D9qj59G2_es();
326439
326504
  init_unified_BDuVPlMu_es();
326440
326505
  init_remark_gfm_BUJjZJLy_es();
@@ -333196,10 +333261,18 @@ ${err.toString()}`);
333196
333261
  addCommands() {
333197
333262
  return {
333198
333263
  setFontFamily: (fontFamily) => ({ chain }) => {
333199
- return chain().setMark("textStyle", { fontFamily }).run();
333264
+ return chain().setMark("textStyle", {
333265
+ fontFamily,
333266
+ eastAsiaFontFamily: null,
333267
+ csFontFamily: null
333268
+ }).run();
333200
333269
  },
333201
333270
  unsetFontFamily: () => ({ chain }) => {
333202
- return chain().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run();
333271
+ return chain().setMark("textStyle", {
333272
+ fontFamily: null,
333273
+ eastAsiaFontFamily: null,
333274
+ csFontFamily: null
333275
+ }).removeEmptyTextStyle().run();
333203
333276
  }
333204
333277
  };
333205
333278
  }
@@ -356364,7 +356437,7 @@ function print() { __p += __j.call(arguments, '') }
356364
356437
  return null;
356365
356438
  return getParagraphFontFamilyFromProperties(calculateResolvedParagraphProperties(this.activeEditor, paragraphParent.node, state.doc.resolve(paragraphParent.pos)), this.activeEditor?.converter?.convertedXml ?? {}) || null;
356366
356439
  }
356367
- #isFontSizeMixedState(commandState) {
356440
+ #isMixedState(commandState) {
356368
356441
  return Boolean(commandState?.active) && commandState?.value == null;
356369
356442
  }
356370
356443
  #applyHeadlessState(item) {
@@ -356408,6 +356481,10 @@ function print() { __p += __j.call(arguments, '') }
356408
356481
  item.activate({ fontFamily: commandState.value });
356409
356482
  return;
356410
356483
  }
356484
+ if (this.#isMixedState(commandState)) {
356485
+ item.activate({}, true);
356486
+ return;
356487
+ }
356411
356488
  const fallbackFontFamily = this.#getFontFamilyFallbackValue();
356412
356489
  if (fallbackFontFamily) {
356413
356490
  item.activate({ fontFamily: fallbackFontFamily });
@@ -356420,7 +356497,7 @@ function print() { __p += __j.call(arguments, '') }
356420
356497
  item.activate({ fontSize: commandState.value });
356421
356498
  return;
356422
356499
  }
356423
- if (this.#isFontSizeMixedState(commandState)) {
356500
+ if (this.#isMixedState(commandState)) {
356424
356501
  item.activate({}, true);
356425
356502
  return;
356426
356503
  }
@@ -369677,11 +369754,11 @@ function print() { __p += __j.call(arguments, '') }
369677
369754
  ]);
369678
369755
  });
369679
369756
 
369680
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-Du-2OQ-7.es.js
369757
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CjKDFHjb.es.js
369681
369758
  var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, 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, FONT_SIZE_OPTIONS;
369682
- var init_create_super_doc_ui_Du_2OQ_7_es = __esm(() => {
369683
- init_SuperConverter_x_mSI6o_es();
369684
- init_create_headless_toolbar_D1KbRv5B_es();
369759
+ var init_create_super_doc_ui_CjKDFHjb_es = __esm(() => {
369760
+ init_SuperConverter_DRKaQwZS_es();
369761
+ init_create_headless_toolbar_ChACxHAH_es();
369685
369762
  DEFAULT_TEXT_ALIGN_OPTIONS = [
369686
369763
  {
369687
369764
  label: "Left",
@@ -369972,15 +370049,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
369972
370049
 
369973
370050
  // ../../packages/superdoc/dist/super-editor.es.js
369974
370051
  var init_super_editor_es = __esm(() => {
369975
- init_src_Fy_l94Cn_es();
369976
- init_SuperConverter_x_mSI6o_es();
370052
+ init_src_ly1ZYfUZ_es();
370053
+ init_SuperConverter_DRKaQwZS_es();
369977
370054
  init_jszip_C49i9kUs_es();
369978
370055
  init_xml_js_CqGKpaft_es();
369979
- init_create_headless_toolbar_D1KbRv5B_es();
370056
+ init_create_headless_toolbar_ChACxHAH_es();
369980
370057
  init_constants_D9qj59G2_es();
369981
370058
  init_unified_BDuVPlMu_es();
369982
370059
  init_DocxZipper_BzS208BW_es();
369983
- init_create_super_doc_ui_Du_2OQ_7_es();
370060
+ init_create_super_doc_ui_CjKDFHjb_es();
369984
370061
  init_ui_CGB3qmy3_es();
369985
370062
  init_eventemitter3_UwU_CLPU_es();
369986
370063
  init_errors_C_DoKMoN_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.17.0-next.41",
3
+ "version": "0.17.0-next.42",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -26,20 +26,20 @@
26
26
  "lib0": "^0.2.114",
27
27
  "typescript": "^5.9.2",
28
28
  "y-protocols": "^1.0.6",
29
- "@superdoc/super-editor": "0.0.1",
30
29
  "@superdoc/document-api": "0.1.0-alpha.0",
31
- "superdoc": "1.43.1"
30
+ "superdoc": "1.43.1",
31
+ "@superdoc/super-editor": "0.0.1"
32
32
  },
33
33
  "module": "src/index.ts",
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@superdoc-dev/cli-darwin-x64": "0.17.0-next.41",
39
- "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.41",
40
- "@superdoc-dev/cli-linux-x64": "0.17.0-next.41",
41
- "@superdoc-dev/cli-linux-arm64": "0.17.0-next.41",
42
- "@superdoc-dev/cli-windows-x64": "0.17.0-next.41"
38
+ "@superdoc-dev/cli-darwin-x64": "0.17.0-next.42",
39
+ "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.42",
40
+ "@superdoc-dev/cli-linux-x64": "0.17.0-next.42",
41
+ "@superdoc-dev/cli-linux-arm64": "0.17.0-next.42",
42
+ "@superdoc-dev/cli-windows-x64": "0.17.0-next.42"
43
43
  },
44
44
  "scripts": {
45
45
  "predev": "node scripts/ensure-superdoc-build.js",