@superdoc-dev/mcp 0.3.0-next.94 → 0.3.0-next.96
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.
- package/dist/index.js +217 -87
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -51891,7 +51891,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
51891
51891
|
emptyOptions2 = {};
|
|
51892
51892
|
});
|
|
51893
51893
|
|
|
51894
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
51894
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-1Voea3gd.es.js
|
|
51895
51895
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
51896
51896
|
const fieldValue = extension$1.config[field];
|
|
51897
51897
|
if (typeof fieldValue === "function")
|
|
@@ -61147,7 +61147,7 @@ function encodeMarksFromRPr(runProperties, docx) {
|
|
|
61147
61147
|
return [];
|
|
61148
61148
|
const marks = [];
|
|
61149
61149
|
const textStyleAttrs = {};
|
|
61150
|
-
let
|
|
61150
|
+
let highlightAttrs = null;
|
|
61151
61151
|
let hasHighlightTag = false;
|
|
61152
61152
|
Object.keys(runProperties).forEach((key) => {
|
|
61153
61153
|
const value = runProperties[key];
|
|
@@ -61224,7 +61224,9 @@ function encodeMarksFromRPr(runProperties, docx) {
|
|
|
61224
61224
|
const color2 = getHighLightValue$1(value);
|
|
61225
61225
|
if (color2) {
|
|
61226
61226
|
hasHighlightTag = true;
|
|
61227
|
-
|
|
61227
|
+
highlightAttrs = { color: color2 };
|
|
61228
|
+
if (color2.toLowerCase() === "transparent" && String(value?.["w:val"]).toLowerCase() === "none")
|
|
61229
|
+
highlightAttrs.ooxmlHighlightClear = true;
|
|
61228
61230
|
}
|
|
61229
61231
|
break;
|
|
61230
61232
|
case "shading": {
|
|
@@ -61233,11 +61235,11 @@ function encodeMarksFromRPr(runProperties, docx) {
|
|
|
61233
61235
|
const fill = value["fill"];
|
|
61234
61236
|
const shdVal = value["val"];
|
|
61235
61237
|
if (fill && String(fill).toLowerCase() !== "auto")
|
|
61236
|
-
|
|
61238
|
+
highlightAttrs = { color: `#${String(fill).replace("#", "")}` };
|
|
61237
61239
|
else if (typeof shdVal === "string") {
|
|
61238
61240
|
const normalized = shdVal.toLowerCase();
|
|
61239
61241
|
if (normalized === "clear" || normalized === "nil" || normalized === "none")
|
|
61240
|
-
|
|
61242
|
+
highlightAttrs = { color: "transparent" };
|
|
61241
61243
|
}
|
|
61242
61244
|
break;
|
|
61243
61245
|
}
|
|
@@ -61259,10 +61261,10 @@ function encodeMarksFromRPr(runProperties, docx) {
|
|
|
61259
61261
|
type: "textStyle",
|
|
61260
61262
|
attrs: textStyleAttrs
|
|
61261
61263
|
});
|
|
61262
|
-
if (
|
|
61264
|
+
if (highlightAttrs)
|
|
61263
61265
|
marks.push({
|
|
61264
61266
|
type: "highlight",
|
|
61265
|
-
attrs:
|
|
61267
|
+
attrs: highlightAttrs
|
|
61266
61268
|
});
|
|
61267
61269
|
return marks;
|
|
61268
61270
|
}
|
|
@@ -61545,10 +61547,6 @@ function decodeRPrFromMarks(marks) {
|
|
|
61545
61547
|
case "italic":
|
|
61546
61548
|
case "bold":
|
|
61547
61549
|
runProperties[type] = mark.attrs.value !== "0" && mark.attrs.value !== false;
|
|
61548
|
-
if (type === "bold")
|
|
61549
|
-
runProperties.boldCs = runProperties.bold;
|
|
61550
|
-
else if (type === "italic")
|
|
61551
|
-
runProperties.italicCs = runProperties.italic;
|
|
61552
61550
|
break;
|
|
61553
61551
|
case "underline": {
|
|
61554
61552
|
const { underlineType, underlineColor, underlineThemeColor, underlineThemeTint, underlineThemeShade } = mark.attrs;
|
|
@@ -61568,11 +61566,13 @@ function decodeRPrFromMarks(marks) {
|
|
|
61568
61566
|
break;
|
|
61569
61567
|
}
|
|
61570
61568
|
case "highlight":
|
|
61571
|
-
if (mark.attrs.color)
|
|
61572
|
-
|
|
61569
|
+
if (!mark.attrs.color)
|
|
61570
|
+
break;
|
|
61571
|
+
if (mark.attrs.color.toLowerCase() === "transparent") {
|
|
61572
|
+
if (mark.attrs.ooxmlHighlightClear)
|
|
61573
61573
|
runProperties.highlight = { "w:val": "none" };
|
|
61574
|
-
|
|
61575
|
-
|
|
61574
|
+
} else
|
|
61575
|
+
runProperties.highlight = { "w:val": mark.attrs.color };
|
|
61576
61576
|
break;
|
|
61577
61577
|
case "link":
|
|
61578
61578
|
runProperties.styleId = "Hyperlink";
|
|
@@ -70443,13 +70443,13 @@ function extractTableInfo($pos, depth) {
|
|
|
70443
70443
|
return fallbackInfo;
|
|
70444
70444
|
}
|
|
70445
70445
|
}
|
|
70446
|
-
function segmentRunByInlineProps(runNode, paragraphNode, tableInfo, $pos, editor, preservedDerivedKeys, preferExistingKeys) {
|
|
70446
|
+
function segmentRunByInlineProps(runNode, paragraphNode, tableInfo, $pos, editor, removedKeys, preservedDerivedKeys, preferExistingKeys) {
|
|
70447
70447
|
const segments = [];
|
|
70448
70448
|
let lastKey = null;
|
|
70449
70449
|
let boundaryCounter = 0;
|
|
70450
70450
|
runNode.forEach((child) => {
|
|
70451
70451
|
if (child.isText) {
|
|
70452
|
-
const { inlineProps: inlineProps$1, inlineKey: inlineKey$2 } = computeInlineRunProps(child.marks, runNode.attrs?.runProperties, paragraphNode, tableInfo, $pos, editor, preservedDerivedKeys, preferExistingKeys);
|
|
70452
|
+
const { inlineProps: inlineProps$1, inlineKey: inlineKey$2 } = computeInlineRunProps(child.marks, runNode.attrs?.runProperties, paragraphNode, tableInfo, $pos, editor, removedKeys, preservedDerivedKeys, preferExistingKeys);
|
|
70453
70453
|
const last = segments[segments.length - 1];
|
|
70454
70454
|
if (last && inlineKey$2 === lastKey)
|
|
70455
70455
|
last.content.push(child);
|
|
@@ -70477,20 +70477,20 @@ function segmentRunByInlineProps(runNode, paragraphNode, tableInfo, $pos, editor
|
|
|
70477
70477
|
firstInlineProps: segments[0]?.inlineProps ?? null
|
|
70478
70478
|
};
|
|
70479
70479
|
}
|
|
70480
|
-
function computeInlineRunProps(marks, existingRunProperties, paragraphNode, tableInfo, $pos, editor, preservedDerivedKeys, preferExistingKeys) {
|
|
70480
|
+
function computeInlineRunProps(marks, existingRunProperties, paragraphNode, tableInfo, $pos, editor, removedKeys, preservedDerivedKeys, preferExistingKeys) {
|
|
70481
70481
|
const runPropertiesFromMarks = decodeRPrFromMarks(marks);
|
|
70482
70482
|
const paragraphProperties = getResolvedParagraphProperties(paragraphNode) || calculateResolvedParagraphProperties(editor, paragraphNode, $pos);
|
|
70483
70483
|
const inlineRunProperties = getInlineRunProperties(runPropertiesFromMarks, resolveRunProperties({
|
|
70484
70484
|
translatedNumbering: editor.converter?.translatedNumbering ?? {},
|
|
70485
70485
|
translatedLinkedStyles: editor.converter?.translatedLinkedStyles ?? {}
|
|
70486
|
-
}, existingRunProperties?.styleId != null ? { styleId: existingRunProperties?.styleId } : {}, paragraphProperties, tableInfo, false, Boolean(paragraphNode.attrs.paragraphProperties?.numberingProperties)), existingRunProperties, editor, preservedDerivedKeys, preferExistingKeys);
|
|
70486
|
+
}, existingRunProperties?.styleId != null ? { styleId: existingRunProperties?.styleId } : {}, paragraphProperties, tableInfo, false, Boolean(paragraphNode.attrs.paragraphProperties?.numberingProperties)), existingRunProperties, editor, removedKeys, preservedDerivedKeys, preferExistingKeys);
|
|
70487
70487
|
const inlineProps = Object.keys(inlineRunProperties).length ? inlineRunProperties : null;
|
|
70488
70488
|
return {
|
|
70489
70489
|
inlineProps,
|
|
70490
70490
|
inlineKey: stableStringifyInlineProps(inlineProps)
|
|
70491
70491
|
};
|
|
70492
70492
|
}
|
|
70493
|
-
function getInlineRunProperties(runPropertiesFromMarks, runPropertiesFromStyles, existingRunProperties, editor, preservedDerivedKeys = /* @__PURE__ */ new Set, preferExistingKeys = /* @__PURE__ */ new Set) {
|
|
70493
|
+
function getInlineRunProperties(runPropertiesFromMarks, runPropertiesFromStyles, existingRunProperties, editor, removedKeys = /* @__PURE__ */ new Set, preservedDerivedKeys = /* @__PURE__ */ new Set, preferExistingKeys = /* @__PURE__ */ new Set) {
|
|
70494
70494
|
const inlineRunProperties = {};
|
|
70495
70495
|
for (const key in runPropertiesFromMarks) {
|
|
70496
70496
|
if (preservedDerivedKeys.has(key)) {
|
|
@@ -70525,6 +70525,9 @@ function getInlineRunProperties(runPropertiesFromMarks, runPropertiesFromStyles,
|
|
|
70525
70525
|
Object.keys(existingRunProperties).forEach((key) => {
|
|
70526
70526
|
if (RUN_PROPERTIES_DERIVED_FROM_MARKS.has(key) && !preservedDerivedKeys.has(key))
|
|
70527
70527
|
return;
|
|
70528
|
+
const baseKey = COMPANION_INLINE_KEYS[key];
|
|
70529
|
+
if (baseKey && removedKeys.has(baseKey))
|
|
70530
|
+
return;
|
|
70528
70531
|
if (key === "styleId" && TRANSIENT_HYPERLINK_STYLE_IDS.has(existingRunProperties[key]) && (runPropertiesFromMarks.styleId == null || runPropertiesFromMarks.styleId === ""))
|
|
70529
70532
|
return;
|
|
70530
70533
|
if (key in inlineRunProperties)
|
|
@@ -82567,11 +82570,13 @@ function translateDocumentNode(params) {
|
|
|
82567
82570
|
const mergedIgnorable = mergeMcIgnorable(DEFAULT_DOCX_DEFS["mc:Ignorable"], originalAttrs["mc:Ignorable"]);
|
|
82568
82571
|
if (mergedIgnorable)
|
|
82569
82572
|
attributes["mc:Ignorable"] = mergedIgnorable;
|
|
82570
|
-
|
|
82573
|
+
const node2 = {
|
|
82571
82574
|
name: "w:document",
|
|
82572
82575
|
elements: [translatedBodyNode],
|
|
82573
82576
|
attributes
|
|
82574
|
-
}
|
|
82577
|
+
};
|
|
82578
|
+
normalizePgMarTwipsInTree(node2);
|
|
82579
|
+
return [node2, params];
|
|
82575
82580
|
}
|
|
82576
82581
|
function wrapTextInRun(nodeOrNodes, marks) {
|
|
82577
82582
|
let elements = [];
|
|
@@ -82690,6 +82695,8 @@ function translateMark(mark) {
|
|
|
82690
82695
|
break;
|
|
82691
82696
|
case "highlight": {
|
|
82692
82697
|
const highlightValue = attrs.color ?? attrs.highlight ?? null;
|
|
82698
|
+
if (String(highlightValue).trim().toLowerCase() === "transparent" && !attrs.ooxmlHighlightClear)
|
|
82699
|
+
return {};
|
|
82693
82700
|
return translator$2.decode({ node: { attrs: { highlight: highlightValue } } }) || {};
|
|
82694
82701
|
}
|
|
82695
82702
|
case "strike":
|
|
@@ -91405,6 +91412,21 @@ var isRegExp = (value) => {
|
|
|
91405
91412
|
if (!Array.isArray(node2.elements))
|
|
91406
91413
|
return false;
|
|
91407
91414
|
return node2.elements.some((child) => hasXmlNodeNamed(child, targetName));
|
|
91415
|
+
}, COMPLEX_SCRIPT_CODEPOINT_RANGES, textHasComplexScript = (text$2) => {
|
|
91416
|
+
for (const char of text$2) {
|
|
91417
|
+
const codePoint = char.codePointAt(0);
|
|
91418
|
+
if (COMPLEX_SCRIPT_CODEPOINT_RANGES.some(([start, end]) => codePoint >= start && codePoint <= end))
|
|
91419
|
+
return true;
|
|
91420
|
+
}
|
|
91421
|
+
return false;
|
|
91422
|
+
}, hasComplexScriptText = (node2) => {
|
|
91423
|
+
if (!node2 || typeof node2 !== "object")
|
|
91424
|
+
return false;
|
|
91425
|
+
if (typeof node2.text === "string" && textHasComplexScript(node2.text))
|
|
91426
|
+
return true;
|
|
91427
|
+
if (!Array.isArray(node2.content))
|
|
91428
|
+
return false;
|
|
91429
|
+
return node2.content.some((child) => hasComplexScriptText(child));
|
|
91408
91430
|
}, getRunPropertiesNode = (runNode) => {
|
|
91409
91431
|
if (!runNode)
|
|
91410
91432
|
return null;
|
|
@@ -91615,6 +91637,12 @@ var isRegExp = (value) => {
|
|
|
91615
91637
|
const shouldExport = (key) => (key in (runProperties || {})) && (!(Array.isArray(styleKeys) && styleKeys.includes(key)) || Array.isArray(overrideKeys) && overrideKeys.includes(key));
|
|
91616
91638
|
const exportKeys = candidateKeys.filter(shouldExport);
|
|
91617
91639
|
const runPropertiesToExport = exportKeys.length > 0 ? Object.fromEntries(exportKeys.map((k) => [k, runProperties[k]])) : {};
|
|
91640
|
+
if (hasComplexScriptText(runNodeForExport)) {
|
|
91641
|
+
if ("bold" in runPropertiesToExport && !("boldCs" in runPropertiesToExport))
|
|
91642
|
+
runPropertiesToExport.boldCs = runPropertiesToExport.bold;
|
|
91643
|
+
if ("italic" in runPropertiesToExport && !("italicCs" in runPropertiesToExport))
|
|
91644
|
+
runPropertiesToExport.italicCs = runPropertiesToExport.italic;
|
|
91645
|
+
}
|
|
91618
91646
|
const exportParams = {
|
|
91619
91647
|
...params,
|
|
91620
91648
|
node: runNodeForExport,
|
|
@@ -99333,7 +99361,7 @@ var isRegExp = (value) => {
|
|
|
99333
99361
|
const { paragraphNode, paragraphPos, tableInfo } = getRunContext($pos);
|
|
99334
99362
|
if (!paragraphNode || paragraphPos === undefined)
|
|
99335
99363
|
return;
|
|
99336
|
-
const { segments, firstInlineProps } = segmentRunByInlineProps(runNode, paragraphNode, tableInfo, $pos, editor, preservedDerivedKeys, preferExistingKeys);
|
|
99364
|
+
const { segments, firstInlineProps } = segmentRunByInlineProps(runNode, paragraphNode, tableInfo, $pos, editor, removedKeys, preservedDerivedKeys, preferExistingKeys);
|
|
99337
99365
|
let runProperties = firstInlineProps ?? null;
|
|
99338
99366
|
const existingInlineKeys = runNode.attrs?.runPropertiesInlineKeys || [];
|
|
99339
99367
|
const hadInlineKeysMetadata = Array.isArray(runNode.attrs?.runPropertiesInlineKeys);
|
|
@@ -99398,6 +99426,9 @@ var isRegExp = (value) => {
|
|
|
99398
99426
|
lostKeys.forEach((k) => {
|
|
99399
99427
|
if (removedKeys.has(k))
|
|
99400
99428
|
return;
|
|
99429
|
+
const baseKey = COMPANION_INLINE_KEYS[k];
|
|
99430
|
+
if (baseKey && removedKeys.has(baseKey))
|
|
99431
|
+
return;
|
|
99401
99432
|
if (runNode.attrs?.runProperties?.[k] !== undefined)
|
|
99402
99433
|
runProperties[k] = runNode.attrs.runProperties[k];
|
|
99403
99434
|
});
|
|
@@ -104690,6 +104721,24 @@ var isRegExp = (value) => {
|
|
|
104690
104721
|
pgMar.attributes[attrKey] = value;
|
|
104691
104722
|
});
|
|
104692
104723
|
return sectPr;
|
|
104724
|
+
}, normalizePgMarTwipsInTree = (node2) => {
|
|
104725
|
+
if (!node2 || typeof node2 !== "object")
|
|
104726
|
+
return;
|
|
104727
|
+
if (node2.name === "w:pgMar" && node2.attributes && typeof node2.attributes === "object")
|
|
104728
|
+
for (const key of Object.keys(node2.attributes)) {
|
|
104729
|
+
const value = node2.attributes[key];
|
|
104730
|
+
if (value == null)
|
|
104731
|
+
continue;
|
|
104732
|
+
const serialized = String(value).trim();
|
|
104733
|
+
if (!serialized)
|
|
104734
|
+
continue;
|
|
104735
|
+
const num = Number(serialized);
|
|
104736
|
+
if (Number.isFinite(num) && !/^-?\d+$/.test(serialized))
|
|
104737
|
+
node2.attributes[key] = String(Math.round(num));
|
|
104738
|
+
}
|
|
104739
|
+
if (Array.isArray(node2.elements))
|
|
104740
|
+
for (const child of node2.elements)
|
|
104741
|
+
normalizePgMarTwipsInTree(child);
|
|
104693
104742
|
}, generateDefaultHeaderFooter = (type, id) => {
|
|
104694
104743
|
return {
|
|
104695
104744
|
type: "element",
|
|
@@ -105502,7 +105551,7 @@ var isRegExp = (value) => {
|
|
|
105502
105551
|
state.kern = kernNode.attributes["w:val"];
|
|
105503
105552
|
}
|
|
105504
105553
|
}, SuperConverter;
|
|
105505
|
-
var
|
|
105554
|
+
var init_SuperConverter_1Voea3gd_es = __esm(() => {
|
|
105506
105555
|
init_rolldown_runtime_Bg48TavK_es();
|
|
105507
105556
|
init_jszip_C49i9kUs_es();
|
|
105508
105557
|
init_xml_js_CqGKpaft_es();
|
|
@@ -121651,6 +121700,14 @@ var init_SuperConverter_B_EF8ijE_es = __esm(() => {
|
|
|
121651
121700
|
"w:footnoteReference": "FootnoteReference",
|
|
121652
121701
|
"w:endnoteReference": "EndnoteReference"
|
|
121653
121702
|
};
|
|
121703
|
+
COMPLEX_SCRIPT_CODEPOINT_RANGES = [
|
|
121704
|
+
[1424, 2303],
|
|
121705
|
+
[2304, 4255],
|
|
121706
|
+
[6016, 6319],
|
|
121707
|
+
[7376, 7423],
|
|
121708
|
+
[43008, 43263],
|
|
121709
|
+
[43616, 43647]
|
|
121710
|
+
];
|
|
121654
121711
|
config$30 = {
|
|
121655
121712
|
xmlName: XML_NODE_NAME$31,
|
|
121656
121713
|
sdNodeOrKeyName: SD_KEY_NAME,
|
|
@@ -134777,9 +134834,7 @@ var init_SuperConverter_B_EF8ijE_es = __esm(() => {
|
|
|
134777
134834
|
RUN_PROPERTIES_DERIVED_FROM_MARKS = new Set([
|
|
134778
134835
|
"strike",
|
|
134779
134836
|
"italic",
|
|
134780
|
-
"italicCs",
|
|
134781
134837
|
"bold",
|
|
134782
|
-
"boldCs",
|
|
134783
134838
|
"underline",
|
|
134784
134839
|
"highlight",
|
|
134785
134840
|
"textTransform",
|
|
@@ -143376,7 +143431,7 @@ var init_SuperConverter_B_EF8ijE_es = __esm(() => {
|
|
|
143376
143431
|
};
|
|
143377
143432
|
});
|
|
143378
143433
|
|
|
143379
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
143434
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-cNPAdMd2.es.js
|
|
143380
143435
|
function parseSizeUnit(val = "0") {
|
|
143381
143436
|
const length = val.toString() || "0";
|
|
143382
143437
|
const value = Number.parseFloat(length);
|
|
@@ -146098,8 +146153,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
146098
146153
|
}
|
|
146099
146154
|
};
|
|
146100
146155
|
};
|
|
146101
|
-
var
|
|
146102
|
-
|
|
146156
|
+
var init_create_headless_toolbar_cNPAdMd2_es = __esm(() => {
|
|
146157
|
+
init_SuperConverter_1Voea3gd_es();
|
|
146103
146158
|
init_constants_DrU4EASo_es();
|
|
146104
146159
|
init_dist_B8HfvhaK_es();
|
|
146105
146160
|
CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
|
|
@@ -200318,7 +200373,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
200318
200373
|
init_remark_gfm_BhnWr3yf_es();
|
|
200319
200374
|
});
|
|
200320
200375
|
|
|
200321
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
200376
|
+
// ../../packages/superdoc/dist/chunks/src-BaUVXQjX.es.js
|
|
200322
200377
|
function deleteProps(obj, propOrProps) {
|
|
200323
200378
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
200324
200379
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -272786,6 +272841,16 @@ var Node$13 = class Node$14 {
|
|
|
272786
272841
|
targetTr.setSelection(Selection.near(targetTr.doc.resolve(boundedFrom), -1));
|
|
272787
272842
|
}, require_lodash, import_lodash$1, normalizeAttrs = (attrs = {}) => {
|
|
272788
272843
|
return Object.fromEntries(Object.entries(attrs).filter(([, value]) => value !== null && value !== undefined));
|
|
272844
|
+
}, stripUnsetInternalSnapshotAttrs = (attrs = {}) => {
|
|
272845
|
+
const nextAttrs = { ...attrs };
|
|
272846
|
+
if (nextAttrs.ooxmlHighlightClear === null || nextAttrs.ooxmlHighlightClear === undefined)
|
|
272847
|
+
delete nextAttrs.ooxmlHighlightClear;
|
|
272848
|
+
return nextAttrs;
|
|
272849
|
+
}, createMarkSnapshot = (type, attrs = {}) => {
|
|
272850
|
+
return {
|
|
272851
|
+
type,
|
|
272852
|
+
attrs: stripUnsetInternalSnapshotAttrs(attrs)
|
|
272853
|
+
};
|
|
272789
272854
|
}, IDENTITY_ATTR_VALUES, ATTRIBUTE_ONLY_MARKS, normalizeSnapshotAttrs = (attrs = {}) => {
|
|
272790
272855
|
const base4 = normalizeAttrs(attrs);
|
|
272791
272856
|
return Object.fromEntries(Object.entries(base4).filter(([key2, value]) => IDENTITY_ATTR_VALUES[key2] !== value));
|
|
@@ -272826,14 +272891,14 @@ var Node$13 = class Node$14 {
|
|
|
272826
272891
|
if (existing) {
|
|
272827
272892
|
const merged = {
|
|
272828
272893
|
...existing,
|
|
272829
|
-
attrs: {
|
|
272894
|
+
attrs: stripUnsetInternalSnapshotAttrs({
|
|
272830
272895
|
...existing.attrs,
|
|
272831
272896
|
...incoming.attrs
|
|
272832
|
-
}
|
|
272897
|
+
})
|
|
272833
272898
|
};
|
|
272834
272899
|
return snapshots.map((mark2) => mark2 === existing ? merged : mark2);
|
|
272835
272900
|
}
|
|
272836
|
-
return [...snapshots, incoming];
|
|
272901
|
+
return [...snapshots, createMarkSnapshot(incoming.type, incoming.attrs)];
|
|
272837
272902
|
}, markMatchesSnapshot = (mark2, snapshot2, exact = true) => {
|
|
272838
272903
|
return marksMatch(mark2, snapshot2, exact);
|
|
272839
272904
|
}, markAttrsIncludeSnapshotAttrs = (mark2, snapshot2) => {
|
|
@@ -272943,19 +273008,13 @@ var Node$13 = class Node$14 {
|
|
|
272943
273008
|
before = [...beforeSnapshots];
|
|
272944
273009
|
after = upsertMarkSnapshotByType(afterSnapshots, {
|
|
272945
273010
|
type: step2.mark.type.name,
|
|
272946
|
-
attrs:
|
|
273011
|
+
attrs: step2.mark.attrs
|
|
272947
273012
|
});
|
|
272948
273013
|
}
|
|
272949
273014
|
} else {
|
|
272950
273015
|
const existingMarkOfSameType = liveMarks.find((mark2) => mark2.type.name === step2.mark.type.name && !["trackDelete", "trackFormat"].includes(mark2.type.name));
|
|
272951
|
-
before = existingMarkOfSameType ? [
|
|
272952
|
-
|
|
272953
|
-
attrs: { ...existingMarkOfSameType.attrs }
|
|
272954
|
-
}] : [];
|
|
272955
|
-
after = [{
|
|
272956
|
-
type: step2.mark.type.name,
|
|
272957
|
-
attrs: { ...step2.mark.attrs }
|
|
272958
|
-
}];
|
|
273016
|
+
before = existingMarkOfSameType ? [createMarkSnapshot(existingMarkOfSameType.type.name, existingMarkOfSameType.attrs)] : [];
|
|
273017
|
+
after = [createMarkSnapshot(step2.mark.type.name, step2.mark.attrs)];
|
|
272959
273018
|
}
|
|
272960
273019
|
if (isTrackFormatNoOp(before, after)) {
|
|
272961
273020
|
if (formatChangeMark)
|
|
@@ -273017,17 +273076,14 @@ var Node$13 = class Node$14 {
|
|
|
273017
273076
|
after = [...formatChangeMark.attrs.after];
|
|
273018
273077
|
before = upsertMarkSnapshotByType(formatChangeMark.attrs.before, {
|
|
273019
273078
|
type: step2.mark.type.name,
|
|
273020
|
-
attrs:
|
|
273079
|
+
attrs: step2.mark.attrs
|
|
273021
273080
|
});
|
|
273022
273081
|
}
|
|
273023
273082
|
else {
|
|
273024
273083
|
after = [];
|
|
273025
273084
|
let existingMark = node2.marks.find((mark2) => mark2.type === step2.mark.type);
|
|
273026
273085
|
if (existingMark)
|
|
273027
|
-
before = [
|
|
273028
|
-
type: step2.mark.type.name,
|
|
273029
|
-
attrs: { ...existingMark.attrs }
|
|
273030
|
-
}];
|
|
273086
|
+
before = [createMarkSnapshot(step2.mark.type.name, existingMark.attrs)];
|
|
273031
273087
|
else
|
|
273032
273088
|
before = [];
|
|
273033
273089
|
}
|
|
@@ -294132,12 +294188,12 @@ menclose::after {
|
|
|
294132
294188
|
return;
|
|
294133
294189
|
console.log(...args$1);
|
|
294134
294190
|
}, 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;
|
|
294135
|
-
var
|
|
294191
|
+
var init_src_BaUVXQjX_es = __esm(() => {
|
|
294136
294192
|
init_rolldown_runtime_Bg48TavK_es();
|
|
294137
|
-
|
|
294193
|
+
init_SuperConverter_1Voea3gd_es();
|
|
294138
294194
|
init_jszip_C49i9kUs_es();
|
|
294139
294195
|
init_uuid_qzgm05fK_es();
|
|
294140
|
-
|
|
294196
|
+
init_create_headless_toolbar_cNPAdMd2_es();
|
|
294141
294197
|
init_constants_DrU4EASo_es();
|
|
294142
294198
|
init_dist_B8HfvhaK_es();
|
|
294143
294199
|
init_unified_Dsuw2be5_es();
|
|
@@ -305272,18 +305328,25 @@ ${err.toString()}`);
|
|
|
305272
305328
|
return { htmlAttributes: {} };
|
|
305273
305329
|
},
|
|
305274
305330
|
addAttributes() {
|
|
305275
|
-
return {
|
|
305276
|
-
|
|
305277
|
-
|
|
305278
|
-
|
|
305279
|
-
|
|
305280
|
-
|
|
305281
|
-
|
|
305282
|
-
|
|
305283
|
-
|
|
305284
|
-
|
|
305331
|
+
return {
|
|
305332
|
+
color: {
|
|
305333
|
+
default: null,
|
|
305334
|
+
parseDOM: (element3) => cssColorToHex(element3.getAttribute("data-color") || element3.style.backgroundColor),
|
|
305335
|
+
renderDOM: (attributes) => {
|
|
305336
|
+
if (!attributes.color)
|
|
305337
|
+
return {};
|
|
305338
|
+
return {
|
|
305339
|
+
"data-color": attributes.color,
|
|
305340
|
+
style: `background-color: ${attributes.color}; color: inherit`
|
|
305341
|
+
};
|
|
305342
|
+
}
|
|
305343
|
+
},
|
|
305344
|
+
ooxmlHighlightClear: {
|
|
305345
|
+
default: null,
|
|
305346
|
+
parseDOM: () => null,
|
|
305347
|
+
renderDOM: () => ({})
|
|
305285
305348
|
}
|
|
305286
|
-
}
|
|
305349
|
+
};
|
|
305287
305350
|
},
|
|
305288
305351
|
parseDOM() {
|
|
305289
305352
|
return [{ tag: "mark" }, {
|
|
@@ -327796,11 +327859,23 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327796
327859
|
if (pageIndex != null) {
|
|
327797
327860
|
const pageEl = getPageElementByIndex(this.#viewportHost, pageIndex);
|
|
327798
327861
|
if (pageEl) {
|
|
327799
|
-
|
|
327862
|
+
const elToScroll = this.#findElementAtPosition(pageEl, clampedPos) ?? pageEl;
|
|
327863
|
+
elToScroll.scrollIntoView({
|
|
327800
327864
|
block,
|
|
327801
327865
|
inline: "nearest",
|
|
327802
327866
|
behavior
|
|
327803
327867
|
});
|
|
327868
|
+
this.#shouldScrollSelectionIntoView = false;
|
|
327869
|
+
const win = this.#visibleHost.ownerDocument?.defaultView;
|
|
327870
|
+
if (win)
|
|
327871
|
+
win.requestAnimationFrame(() => {
|
|
327872
|
+
elToScroll.scrollIntoView({
|
|
327873
|
+
block,
|
|
327874
|
+
inline: "nearest",
|
|
327875
|
+
behavior
|
|
327876
|
+
});
|
|
327877
|
+
this.#shouldScrollSelectionIntoView = false;
|
|
327878
|
+
});
|
|
327804
327879
|
return true;
|
|
327805
327880
|
}
|
|
327806
327881
|
}
|
|
@@ -332180,11 +332255,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
332180
332255
|
];
|
|
332181
332256
|
});
|
|
332182
332257
|
|
|
332183
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
332258
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-C8mCHw5x.es.js
|
|
332184
332259
|
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;
|
|
332185
|
-
var
|
|
332186
|
-
|
|
332187
|
-
|
|
332260
|
+
var init_create_super_doc_ui_C8mCHw5x_es = __esm(() => {
|
|
332261
|
+
init_SuperConverter_1Voea3gd_es();
|
|
332262
|
+
init_create_headless_toolbar_cNPAdMd2_es();
|
|
332188
332263
|
MOD_ALIASES = new Set([
|
|
332189
332264
|
"Mod",
|
|
332190
332265
|
"Meta",
|
|
@@ -332226,16 +332301,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
|
|
|
332226
332301
|
|
|
332227
332302
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
332228
332303
|
var init_super_editor_es = __esm(() => {
|
|
332229
|
-
|
|
332230
|
-
|
|
332304
|
+
init_src_BaUVXQjX_es();
|
|
332305
|
+
init_SuperConverter_1Voea3gd_es();
|
|
332231
332306
|
init_jszip_C49i9kUs_es();
|
|
332232
332307
|
init_xml_js_CqGKpaft_es();
|
|
332233
|
-
|
|
332308
|
+
init_create_headless_toolbar_cNPAdMd2_es();
|
|
332234
332309
|
init_constants_DrU4EASo_es();
|
|
332235
332310
|
init_dist_B8HfvhaK_es();
|
|
332236
332311
|
init_unified_Dsuw2be5_es();
|
|
332237
332312
|
init_DocxZipper_TPSo9G36_es();
|
|
332238
|
-
|
|
332313
|
+
init_create_super_doc_ui_C8mCHw5x_es();
|
|
332239
332314
|
init_ui_CGB3qmy3_es();
|
|
332240
332315
|
init_eventemitter3_UwU_CLPU_es();
|
|
332241
332316
|
init_errors_C_DoKMoN_es();
|
|
@@ -394846,6 +394921,22 @@ var XML_NODE_NAME12 = "w:r", SD_KEY_NAME2 = "run", REFERENCE_RUN_STYLE_BY_XML_NA
|
|
|
394846
394921
|
if (!Array.isArray(node4.elements))
|
|
394847
394922
|
return false;
|
|
394848
394923
|
return node4.elements.some((child) => hasXmlNodeNamed2(child, targetName));
|
|
394924
|
+
}, COMPLEX_SCRIPT_CODEPOINT_RANGES2, textHasComplexScript2 = (text7) => {
|
|
394925
|
+
for (const char of text7) {
|
|
394926
|
+
const codePoint = char.codePointAt(0);
|
|
394927
|
+
if (COMPLEX_SCRIPT_CODEPOINT_RANGES2.some(([start2, end]) => codePoint >= start2 && codePoint <= end)) {
|
|
394928
|
+
return true;
|
|
394929
|
+
}
|
|
394930
|
+
}
|
|
394931
|
+
return false;
|
|
394932
|
+
}, hasComplexScriptText2 = (node4) => {
|
|
394933
|
+
if (!node4 || typeof node4 !== "object")
|
|
394934
|
+
return false;
|
|
394935
|
+
if (typeof node4.text === "string" && textHasComplexScript2(node4.text))
|
|
394936
|
+
return true;
|
|
394937
|
+
if (!Array.isArray(node4.content))
|
|
394938
|
+
return false;
|
|
394939
|
+
return node4.content.some((child) => hasComplexScriptText2(child));
|
|
394849
394940
|
}, getRunPropertiesNode2 = (runNode) => {
|
|
394850
394941
|
if (!runNode)
|
|
394851
394942
|
return null;
|
|
@@ -395036,6 +395127,14 @@ var XML_NODE_NAME12 = "w:r", SD_KEY_NAME2 = "run", REFERENCE_RUN_STYLE_BY_XML_NA
|
|
|
395036
395127
|
const shouldExport = (key2) => (key2 in (runProperties || {})) && (!(Array.isArray(styleKeys) && styleKeys.includes(key2)) || Array.isArray(overrideKeys) && overrideKeys.includes(key2));
|
|
395037
395128
|
const exportKeys = candidateKeys.filter(shouldExport);
|
|
395038
395129
|
const runPropertiesToExport = exportKeys.length > 0 ? Object.fromEntries(exportKeys.map((k2) => [k2, runProperties[k2]])) : {};
|
|
395130
|
+
if (hasComplexScriptText2(runNodeForExport)) {
|
|
395131
|
+
if ("bold" in runPropertiesToExport && !("boldCs" in runPropertiesToExport)) {
|
|
395132
|
+
runPropertiesToExport.boldCs = runPropertiesToExport.bold;
|
|
395133
|
+
}
|
|
395134
|
+
if ("italic" in runPropertiesToExport && !("italicCs" in runPropertiesToExport)) {
|
|
395135
|
+
runPropertiesToExport.italicCs = runPropertiesToExport.italic;
|
|
395136
|
+
}
|
|
395137
|
+
}
|
|
395039
395138
|
const exportParams = {
|
|
395040
395139
|
...params3,
|
|
395041
395140
|
node: runNodeForExport,
|
|
@@ -395153,6 +395252,14 @@ var init_r_translator = __esm(() => {
|
|
|
395153
395252
|
"w:footnoteReference": "FootnoteReference",
|
|
395154
395253
|
"w:endnoteReference": "EndnoteReference"
|
|
395155
395254
|
};
|
|
395255
|
+
COMPLEX_SCRIPT_CODEPOINT_RANGES2 = [
|
|
395256
|
+
[1424, 2303],
|
|
395257
|
+
[2304, 4255],
|
|
395258
|
+
[6016, 6319],
|
|
395259
|
+
[7376, 7423],
|
|
395260
|
+
[43008, 43263],
|
|
395261
|
+
[43616, 43647]
|
|
395262
|
+
];
|
|
395156
395263
|
config13 = {
|
|
395157
395264
|
xmlName: XML_NODE_NAME12,
|
|
395158
395265
|
sdNodeOrKeyName: SD_KEY_NAME2,
|
|
@@ -424711,6 +424818,7 @@ function translateDocumentNode2(params3) {
|
|
|
424711
424818
|
elements: [translatedBodyNode],
|
|
424712
424819
|
attributes
|
|
424713
424820
|
};
|
|
424821
|
+
normalizePgMarTwipsInTree2(node4);
|
|
424714
424822
|
return [node4, params3];
|
|
424715
424823
|
}
|
|
424716
424824
|
function wrapTextInRun2(nodeOrNodes, marks) {
|
|
@@ -424833,6 +424941,9 @@ function translateMark2(mark2) {
|
|
|
424833
424941
|
break;
|
|
424834
424942
|
case "highlight": {
|
|
424835
424943
|
const highlightValue = attrs.color ?? attrs.highlight ?? null;
|
|
424944
|
+
if (String(highlightValue).trim().toLowerCase() === "transparent" && !attrs.ooxmlHighlightClear) {
|
|
424945
|
+
return {};
|
|
424946
|
+
}
|
|
424836
424947
|
const translated = translator64.decode({ node: { attrs: { highlight: highlightValue } } });
|
|
424837
424948
|
return translated || {};
|
|
424838
424949
|
}
|
|
@@ -424984,6 +425095,27 @@ var DEFAULT_SECTION_PROPS_TWIPS2, ensureSectionLayoutDefaults2 = (sectPr, conver
|
|
|
424984
425095
|
pgMar.attributes[attrKey] = value;
|
|
424985
425096
|
});
|
|
424986
425097
|
return sectPr;
|
|
425098
|
+
}, normalizePgMarTwipsInTree2 = (node4) => {
|
|
425099
|
+
if (!node4 || typeof node4 !== "object")
|
|
425100
|
+
return;
|
|
425101
|
+
if (node4.name === "w:pgMar" && node4.attributes && typeof node4.attributes === "object") {
|
|
425102
|
+
for (const key2 of Object.keys(node4.attributes)) {
|
|
425103
|
+
const value = node4.attributes[key2];
|
|
425104
|
+
if (value == null)
|
|
425105
|
+
continue;
|
|
425106
|
+
const serialized = String(value).trim();
|
|
425107
|
+
if (!serialized)
|
|
425108
|
+
continue;
|
|
425109
|
+
const num = Number(serialized);
|
|
425110
|
+
if (Number.isFinite(num) && !/^-?\d+$/.test(serialized)) {
|
|
425111
|
+
node4.attributes[key2] = String(Math.round(num));
|
|
425112
|
+
}
|
|
425113
|
+
}
|
|
425114
|
+
}
|
|
425115
|
+
if (Array.isArray(node4.elements)) {
|
|
425116
|
+
for (const child of node4.elements)
|
|
425117
|
+
normalizePgMarTwipsInTree2(child);
|
|
425118
|
+
}
|
|
424987
425119
|
}, generateDefaultHeaderFooter2 = (type, id2) => {
|
|
424988
425120
|
return {
|
|
424989
425121
|
type: "element",
|
|
@@ -428290,7 +428422,7 @@ function encodeMarksFromRPr2(runProperties, docx) {
|
|
|
428290
428422
|
}
|
|
428291
428423
|
const marks = [];
|
|
428292
428424
|
const textStyleAttrs = {};
|
|
428293
|
-
let
|
|
428425
|
+
let highlightAttrs = null;
|
|
428294
428426
|
let hasHighlightTag = false;
|
|
428295
428427
|
Object.keys(runProperties).forEach((key2) => {
|
|
428296
428428
|
const value = runProperties[key2];
|
|
@@ -428372,7 +428504,10 @@ function encodeMarksFromRPr2(runProperties, docx) {
|
|
|
428372
428504
|
const color3 = getHighLightValue3(value);
|
|
428373
428505
|
if (color3) {
|
|
428374
428506
|
hasHighlightTag = true;
|
|
428375
|
-
|
|
428507
|
+
highlightAttrs = { color: color3 };
|
|
428508
|
+
if (color3.toLowerCase() === "transparent" && String(value?.["w:val"]).toLowerCase() === "none") {
|
|
428509
|
+
highlightAttrs.ooxmlHighlightClear = true;
|
|
428510
|
+
}
|
|
428376
428511
|
}
|
|
428377
428512
|
break;
|
|
428378
428513
|
case "shading": {
|
|
@@ -428382,11 +428517,11 @@ function encodeMarksFromRPr2(runProperties, docx) {
|
|
|
428382
428517
|
const fill = value["fill"];
|
|
428383
428518
|
const shdVal = value["val"];
|
|
428384
428519
|
if (fill && String(fill).toLowerCase() !== "auto") {
|
|
428385
|
-
|
|
428520
|
+
highlightAttrs = { color: `#${String(fill).replace("#", "")}` };
|
|
428386
428521
|
} else if (typeof shdVal === "string") {
|
|
428387
428522
|
const normalized = shdVal.toLowerCase();
|
|
428388
428523
|
if (normalized === "clear" || normalized === "nil" || normalized === "none") {
|
|
428389
|
-
|
|
428524
|
+
highlightAttrs = { color: "transparent" };
|
|
428390
428525
|
}
|
|
428391
428526
|
}
|
|
428392
428527
|
break;
|
|
@@ -428411,8 +428546,8 @@ function encodeMarksFromRPr2(runProperties, docx) {
|
|
|
428411
428546
|
if (Object.keys(textStyleAttrs).length) {
|
|
428412
428547
|
marks.push({ type: "textStyle", attrs: textStyleAttrs });
|
|
428413
428548
|
}
|
|
428414
|
-
if (
|
|
428415
|
-
marks.push({ type: "highlight", attrs:
|
|
428549
|
+
if (highlightAttrs) {
|
|
428550
|
+
marks.push({ type: "highlight", attrs: highlightAttrs });
|
|
428416
428551
|
}
|
|
428417
428552
|
return marks;
|
|
428418
428553
|
}
|
|
@@ -428428,11 +428563,6 @@ function decodeRPrFromMarks2(marks) {
|
|
|
428428
428563
|
case "italic":
|
|
428429
428564
|
case "bold":
|
|
428430
428565
|
runProperties[type] = mark2.attrs.value !== "0" && mark2.attrs.value !== false;
|
|
428431
|
-
if (type === "bold") {
|
|
428432
|
-
runProperties.boldCs = runProperties.bold;
|
|
428433
|
-
} else if (type === "italic") {
|
|
428434
|
-
runProperties.italicCs = runProperties.italic;
|
|
428435
|
-
}
|
|
428436
428566
|
break;
|
|
428437
428567
|
case "underline": {
|
|
428438
428568
|
const { underlineType, underlineColor, underlineThemeColor, underlineThemeTint, underlineThemeShade } = mark2.attrs;
|
|
@@ -428458,12 +428588,14 @@ function decodeRPrFromMarks2(marks) {
|
|
|
428458
428588
|
break;
|
|
428459
428589
|
}
|
|
428460
428590
|
case "highlight":
|
|
428461
|
-
if (mark2.attrs.color)
|
|
428462
|
-
|
|
428591
|
+
if (!mark2.attrs.color)
|
|
428592
|
+
break;
|
|
428593
|
+
if (mark2.attrs.color.toLowerCase() === "transparent") {
|
|
428594
|
+
if (mark2.attrs.ooxmlHighlightClear) {
|
|
428463
428595
|
runProperties.highlight = { "w:val": "none" };
|
|
428464
|
-
} else {
|
|
428465
|
-
runProperties.highlight = { "w:val": mark2.attrs.color };
|
|
428466
428596
|
}
|
|
428597
|
+
} else {
|
|
428598
|
+
runProperties.highlight = { "w:val": mark2.attrs.color };
|
|
428467
428599
|
}
|
|
428468
428600
|
break;
|
|
428469
428601
|
case "link":
|
|
@@ -428666,9 +428798,7 @@ var init_calculateInlineRunPropertiesPlugin = __esm(() => {
|
|
|
428666
428798
|
RUN_PROPERTIES_DERIVED_FROM_MARKS2 = new Set([
|
|
428667
428799
|
"strike",
|
|
428668
428800
|
"italic",
|
|
428669
|
-
"italicCs",
|
|
428670
428801
|
"bold",
|
|
428671
|
-
"boldCs",
|
|
428672
428802
|
"underline",
|
|
428673
428803
|
"highlight",
|
|
428674
428804
|
"textTransform",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/mcp",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.96",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@types/node": "22.19.2",
|
|
21
21
|
"typescript": "^5.9.2",
|
|
22
22
|
"@superdoc/super-editor": "0.0.1",
|
|
23
|
-
"
|
|
24
|
-
"superdoc": "
|
|
23
|
+
"superdoc": "1.32.0",
|
|
24
|
+
"@superdoc/document-api": "0.0.1"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|