@superdoc-dev/cli 0.3.0-next.14 → 0.3.0-next.15

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 +59 -23
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -39075,7 +39075,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
39075
39075
  emptyOptions2 = {};
39076
39076
  });
39077
39077
 
39078
- // ../../packages/superdoc/dist/chunks/SuperConverter-B6j-v0cn.es.js
39078
+ // ../../packages/superdoc/dist/chunks/SuperConverter-ClF1lbF9.es.js
39079
39079
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
39080
39080
  const fieldValue = extension$1.config[field];
39081
39081
  if (typeof fieldValue === "function")
@@ -47061,14 +47061,27 @@ function getFontFamilyValue$1(attributes, docx) {
47061
47061
  return SuperConverter.toCssFontFamily(resolved, docx);
47062
47062
  }
47063
47063
  function getHighLightValue$1(attributes) {
47064
- const fill = attributes["w:fill"];
47065
- if (fill && fill !== "auto")
47064
+ const fill = normalizeHighlightHex(attributes?.["w:fill"]);
47065
+ if (fill)
47066
47066
  return `#${fill}`;
47067
- if (attributes?.["w:val"] === "none")
47067
+ const value = attributes?.["w:val"];
47068
+ if (value === "none")
47068
47069
  return "transparent";
47069
- if (isValidHexColor(attributes?.["w:val"]))
47070
- return `#${attributes["w:val"]}`;
47071
- return getHexColorFromDocxSystem(attributes?.["w:val"]) || null;
47070
+ const normalizedValue = normalizeHighlightHex(value);
47071
+ if (normalizedValue)
47072
+ return `#${normalizedValue}`;
47073
+ return getHexColorFromDocxSystem(value) || null;
47074
+ }
47075
+ function normalizeHighlightHex(rawValue) {
47076
+ if (typeof rawValue !== "string")
47077
+ return null;
47078
+ const trimmedValue = rawValue.trim();
47079
+ if (!trimmedValue || trimmedValue.toLowerCase() === "auto")
47080
+ return null;
47081
+ const normalizedValue = normalizeHexColor(trimmedValue);
47082
+ if (!normalizedValue || !isValidHexColor(normalizedValue))
47083
+ return null;
47084
+ return normalizedValue;
47072
47085
  }
47073
47086
  function normalizeToggleValue(value) {
47074
47087
  if (value == null)
@@ -55505,7 +55518,7 @@ function getFormattingStateAtPos(state, pos, editor, options = {}) {
55505
55518
  const resolvedRunProperties = resolvedFromSelection?.resolvedRunProperties ?? inlineRunProperties;
55506
55519
  const styleRunProperties = resolvedFromSelection?.styleRunProperties ?? null;
55507
55520
  const resolvedMarksFromProperties = createMarksFromRunProperties(state, resolvedRunProperties, editor);
55508
- resolvedMarks.push(...resolvedMarksFromProperties.length ? resolvedMarksFromProperties : inlineMarks);
55521
+ resolvedMarks.push(...mergeResolvedMarksWithInlineFallback(resolvedMarksFromProperties, inlineMarks));
55509
55522
  if (storedMarks && includeCursorMarksWithStoredMarks)
55510
55523
  resolvedMarks.push(...cursorMarks);
55511
55524
  return {
@@ -55536,14 +55549,25 @@ function aggregateFormattingSegments(state, editor, segments) {
55536
55549
  const resolvedRunProperties = intersectRunProperties(segments.map((segment) => segment.resolvedRunProperties));
55537
55550
  const inlineRunProperties = intersectRunProperties(segments.map((segment) => segment.inlineRunProperties));
55538
55551
  const styleRunProperties = intersectRunProperties(segments.map((segment) => segment.styleRunProperties));
55552
+ const resolvedMarks = createMarksFromRunProperties(state, resolvedRunProperties, editor);
55553
+ const inlineMarks = createMarksFromRunProperties(state, inlineRunProperties, editor);
55539
55554
  return {
55540
- resolvedMarks: createMarksFromRunProperties(state, resolvedRunProperties, editor),
55541
- inlineMarks: createMarksFromRunProperties(state, inlineRunProperties, editor),
55555
+ resolvedMarks: mergeResolvedMarksWithInlineFallback(resolvedMarks, inlineMarks),
55556
+ inlineMarks,
55542
55557
  resolvedRunProperties,
55543
55558
  inlineRunProperties,
55544
55559
  styleRunProperties
55545
55560
  };
55546
55561
  }
55562
+ function mergeResolvedMarksWithInlineFallback(resolvedMarks, inlineMarks) {
55563
+ if (!resolvedMarks.length)
55564
+ return inlineMarks;
55565
+ if (!inlineMarks.length)
55566
+ return resolvedMarks;
55567
+ const resolvedMarkNames = new Set(resolvedMarks.map((mark) => mark.type.name));
55568
+ const missingInlineMarks = inlineMarks.filter((mark) => !resolvedMarkNames.has(mark.type.name));
55569
+ return [...resolvedMarks, ...missingInlineMarks];
55570
+ }
55547
55571
  function intersectRunProperties(runPropertiesList) {
55548
55572
  const filtered = runPropertiesList.filter((props) => props && typeof props === "object");
55549
55573
  if (filtered.length === 0)
@@ -82435,7 +82459,7 @@ var isRegExp = (value) => {
82435
82459
  state.kern = kernNode.attributes["w:val"];
82436
82460
  }
82437
82461
  }, SuperConverter;
82438
- var init_SuperConverter_B6j_v0cn_es = __esm(() => {
82462
+ var init_SuperConverter_ClF1lbF9_es = __esm(() => {
82439
82463
  init_rolldown_runtime_B2q5OVn9_es();
82440
82464
  init_jszip_ChlR43oI_es();
82441
82465
  init_xml_js_BtmJ6bNs_es();
@@ -144232,7 +144256,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
144232
144256
  init_remark_gfm_z_sDF4ss_es();
144233
144257
  });
144234
144258
 
144235
- // ../../packages/superdoc/dist/chunks/src-C7UQVkf5.es.js
144259
+ // ../../packages/superdoc/dist/chunks/src-bFMQreny.es.js
144236
144260
  function deleteProps(obj, propOrProps) {
144237
144261
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
144238
144262
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -224649,9 +224673,9 @@ var Node$13 = class Node$14 {
224649
224673
  return false;
224650
224674
  return Boolean(checker(attrs));
224651
224675
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
224652
- var init_src_C7UQVkf5_es = __esm(() => {
224676
+ var init_src_bFMQreny_es = __esm(() => {
224653
224677
  init_rolldown_runtime_B2q5OVn9_es();
224654
- init_SuperConverter_B6j_v0cn_es();
224678
+ init_SuperConverter_ClF1lbF9_es();
224655
224679
  init_jszip_ChlR43oI_es();
224656
224680
  init_uuid_qzgm05fK_es();
224657
224681
  init_constants_ep1_Gwqi_es();
@@ -257737,8 +257761,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
257737
257761
 
257738
257762
  // ../../packages/superdoc/dist/super-editor.es.js
257739
257763
  var init_super_editor_es = __esm(() => {
257740
- init_src_C7UQVkf5_es();
257741
- init_SuperConverter_B6j_v0cn_es();
257764
+ init_src_bFMQreny_es();
257765
+ init_SuperConverter_ClF1lbF9_es();
257742
257766
  init_jszip_ChlR43oI_es();
257743
257767
  init_xml_js_BtmJ6bNs_es();
257744
257768
  init_constants_ep1_Gwqi_es();
@@ -323304,20 +323328,32 @@ function getFontFamilyValue3(attributes, docx) {
323304
323328
  return SuperConverter3.toCssFontFamily(resolved, docx);
323305
323329
  }
323306
323330
  function getHighLightValue3(attributes) {
323307
- const fill = attributes["w:fill"];
323308
- if (fill && fill !== "auto")
323331
+ const fill = normalizeHighlightHex2(attributes?.["w:fill"]);
323332
+ if (fill)
323309
323333
  return `#${fill}`;
323310
- if (attributes?.["w:val"] === "none")
323334
+ const value = attributes?.["w:val"];
323335
+ if (value === "none")
323311
323336
  return "transparent";
323312
- if (isValidHexColor3(attributes?.["w:val"]))
323313
- return `#${attributes["w:val"]}`;
323314
- return getHexColorFromDocxSystem2(attributes?.["w:val"]) || null;
323337
+ const normalizedValue = normalizeHighlightHex2(value);
323338
+ if (normalizedValue)
323339
+ return `#${normalizedValue}`;
323340
+ return getHexColorFromDocxSystem2(value) || null;
323341
+ }
323342
+ function normalizeHighlightHex2(rawValue) {
323343
+ if (typeof rawValue !== "string")
323344
+ return null;
323345
+ const trimmedValue = rawValue.trim();
323346
+ if (!trimmedValue || trimmedValue.toLowerCase() === "auto")
323347
+ return null;
323348
+ const normalizedValue = normalizeHexColor3(trimmedValue);
323349
+ if (!normalizedValue || !isValidHexColor3(normalizedValue))
323350
+ return null;
323351
+ return normalizedValue;
323315
323352
  }
323316
323353
  var getToCssFontFamily2 = () => {
323317
323354
  return SuperConverter3.toCssFontFamily;
323318
323355
  };
323319
323356
  var init_styles3 = __esm(() => {
323320
- init_helpers();
323321
323357
  init_helpers();
323322
323358
  init_SuperConverter();
323323
323359
  init_ooxml();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.3.0-next.14",
3
+ "version": "0.3.0-next.15",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -20,21 +20,21 @@
20
20
  "@types/bun": "^1.3.8",
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
- "@superdoc/document-api": "0.0.1",
24
23
  "@superdoc/pm-adapter": "0.0.0",
25
24
  "@superdoc/super-editor": "0.0.1",
26
- "superdoc": "1.19.0"
25
+ "superdoc": "1.19.0",
26
+ "@superdoc/document-api": "0.0.1"
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.3.0-next.14",
34
- "@superdoc-dev/cli-linux-x64": "0.3.0-next.14",
35
- "@superdoc-dev/cli-darwin-x64": "0.3.0-next.14",
36
- "@superdoc-dev/cli-linux-arm64": "0.3.0-next.14",
37
- "@superdoc-dev/cli-windows-x64": "0.3.0-next.14"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.15",
34
+ "@superdoc-dev/cli-darwin-x64": "0.3.0-next.15",
35
+ "@superdoc-dev/cli-linux-x64": "0.3.0-next.15",
36
+ "@superdoc-dev/cli-linux-arm64": "0.3.0-next.15",
37
+ "@superdoc-dev/cli-windows-x64": "0.3.0-next.15"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",