pptx-viewer-mcp 2.5.6 → 2.5.8
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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +138 -17
- package/dist/index.mjs +138 -17
- package/dist/mcp/index.js +148 -17
- package/dist/mcp/index.mjs +148 -17
- package/dist/schemas/index.d.ts +4 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +8 -0
- package/dist/schemas/index.mjs +8 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ A release listed with no entries carried no Conventional Commit in this package'
|
|
|
7
7
|
scope: scripts/release-plan.mjs re-releases a package whenever any of its files
|
|
8
8
|
change, not only on conventional ones.
|
|
9
9
|
|
|
10
|
+
## [2.5.7](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-mcp@2.5.7) - 2026-09-30
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **tools:** Preserve rich text edits and populate layout placeholders (by @ChristopherVR) ([8a0cbdc](https://github.com/ChristopherVR/pptx-viewer/commit/8a0cbdc577ce86bfd92b8c90fc3bab7a6a50e9a7))
|
|
15
|
+
|
|
16
|
+
## [2.5.6](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-mcp@2.5.6) - 2026-09-25
|
|
17
|
+
|
|
18
|
+
### Chores
|
|
19
|
+
|
|
20
|
+
- **npm:** Surface every package in an npm search for pptx-viewer (by @ChristopherVR) ([ac67fda](https://github.com/ChristopherVR/pptx-viewer/commit/ac67fdafcfaf664412f59eee9a0627182340782f))
|
|
21
|
+
|
|
10
22
|
## [2.5.5](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-mcp@2.5.5) - 2026-09-19
|
|
11
23
|
|
|
12
24
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Doc } from "yjs";
|
|
2
|
-
import { ChartAxisEdit, OleNestedDeckSlideDetail, OlePayloadEditorKind, OleSheetGrid, ParsedTableStyleBorders, ParsedTableStyleFill, ParsedTableStyleText, PptxAppProperties, PptxChartErrBars, PptxChartMarkerSymbol, PptxChartUserShape, PptxCoreProperties, PptxCustomProperty, PptxData, PptxData as PptxData$1, PptxData as PptxData$2, PptxElement, PptxElement as PptxElement$1, PptxHandler, PptxJsonAssetStats, PptxPresentationProperties, PptxSlide, PptxSlide as PptxSlide$1, PptxTableCell3D, PptxThemeColorRef, PptxThemeColorScheme, PptxThemeFontScheme, PresentationDiff, ShapeStyle, TableStylePartName } from "pptx-viewer-core";
|
|
2
|
+
import { ChartAxisEdit, OleNestedDeckSlideDetail, OlePayloadEditorKind, OleSheetGrid, ParsedTableStyleBorders, ParsedTableStyleFill, ParsedTableStyleText, PptxAppProperties, PptxChartErrBars, PptxChartMarkerSymbol, PptxChartUserShape, PptxCoreProperties, PptxCustomProperty, PptxData, PptxData as PptxData$1, PptxData as PptxData$2, PptxElement, PptxElement as PptxElement$1, PptxHandler, PptxJsonAssetStats, PptxPresentationProperties, PptxSlide, PptxSlide as PptxSlide$1, PptxTableCell3D, PptxThemeColorRef, PptxThemeColorScheme, PptxThemeFontScheme, PresentationDiff, ShapeStyle, TableStylePartName, TextSegment } from "pptx-viewer-core";
|
|
3
3
|
//#region src/types.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Platform-agnostic context passed to every tool function.
|
|
@@ -255,6 +255,7 @@ interface UpdateElementParams {
|
|
|
255
255
|
height?: number;
|
|
256
256
|
rotation?: number;
|
|
257
257
|
text?: string;
|
|
258
|
+
textSegments?: TextSegment[];
|
|
258
259
|
fontSize?: number;
|
|
259
260
|
fontFamily?: string;
|
|
260
261
|
fontColor?: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/execution.ts","../src/tools/slide-tools.ts","../src/tools/helpers.ts","../src/tools/element-tools.ts","../src/tools/table-tools.ts","../src/tools/table-style-tools.ts","../src/tools/style-tools.ts","../src/tools/content-tools.ts","../src/tools/conversion-tools.ts","../src/tools/theme-tools.ts","../src/tools/chart-tools.ts","../src/tools/chart-formatting-tools.ts","../src/tools/chart-user-shape-tools.ts","../src/tools/smartart-tools.ts","../src/tools/merge-tools.ts","../src/tools/template-tools.ts","../src/tools/metadata-tools.ts","../src/tools/section-tools.ts","../src/tools/export-tools.ts","../src/tools/json-tools.ts","../src/tools/hyperlink-tools.ts","../src/tools/geometry-tools.ts","../src/tools/lock-tools.ts","../src/tools/validation-tools.ts","../src/tools/presentation-tools.ts","../src/tools/layout-tools.ts","../src/tools/ole-tools.ts"],"mappings":";;;;;;;UAOiB;;EAEhB,UAAU;;EAEV,gBAAgB,iBAAiB,QAAQ;;EAEzC,gBAAgB,iBAAiB,QAAQ;;;;;;;;;;;UAYzB;;EAEhB;;EAEA;;;;;;UAOgB,WAAW;;EAE3B,UAAU;;EAEV,QAAQ;;EAER;;;;;;EAMA,cAAc;;;;;;UAWE;;EAEhB,QAAQ;IAAqB,MAAM;;;EAEnC,SAAS;IACR,QAAQ,MAAM,KAAM,OAAO,YAAY,kBAAkB;IACzD,UAAU,MAAM,MAAO,QAAQ;;;EAGhC,YAAY;;;;;;;UAQI;EAChB,SAAS,eAAe,QAAQ;EAChC,UAAU,cAAc,MAAM,aAAa;;;;;;UAO3B;EAChB,eACC,kBACA,OAAO,YACP;IAAW;IAAoB;;EAEhC,SAAS,mBAAmB;;;;;UAMZ;;EAEhB,YAAY;;EAEZ,gBAAgB;;EAEhB,SAAS;;EAET;;;;;;;;;wBC7FqB,iBACrB,kBACA,SAAS,mBACP;EAAU,UAAU;EAAU,UAAU;;;;;wBA0BrB,iBACrB,kBACA,UAAU,YACV,UAAU,YACV,SAAS,kBACT,wBAAwB,wBACtB;EAAU;EAAsB;;;;;;wBAsDb,uBAAuB,GAC5C,kBACA,SAAS,kBACT,SAAS,KAAK,gBAAgB,WAAW,KAAK,QAAQ,WAAW,MAC/D,QAAQ;EAAM;EAAuB;;;;UC/FvB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;;wBAGK,SACf,KAAK,aACL;EAAU;IACR,WAAW;UAuBG;EAChB;EACA;;UAGgB;EAChB;EACA;;wBAGe,SAAS,KAAK,aAAa,QAAQ,iBAAiB,WAAW;UA2B9D;EAChB;;UAGgB;EAChB;EACA;;wBAGe,aACf,KAAK,aACL,QAAQ,qBACN,WAAW;UA4BG;EAChB;;wBAGe,cACf,KAAK,aACL,QAAQ,sBACN;EAAa;;UA2BC;EAChB;EACA;;wBAGe,eACf,KAAK,aACL,QAAQ,uBACN;EAAa;EAAuB;;UA4BtB;EAChB;EACA;EACA;EACA;EACA;EACA;;wBAGe,sBACf,KAAK,aACL,QAAQ,8BACN;EAAa;;UA8BC;EAChB;EACA;EACA;EACA;EACA;EACA;;wBAGe,mBACf,KAAK,aACL,QAAQ,2BACN;EAAa;EAAoB;;UAmCnB;EAChB;EACA;;wBAGe,cACf,KAAK,aACL,QAAQ,sBACN;EAAa;EAAqB;;;;wBChSrB;wBAIA;;wBAKA,gBAAgB,IAAI,gBAAc;;wBAwGlC,iBAAiB,OAAO;;wBA0BxB,mBAAmB,oBAAoB;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/execution.ts","../src/tools/slide-tools.ts","../src/tools/helpers.ts","../src/tools/element-tools.ts","../src/tools/table-tools.ts","../src/tools/table-style-tools.ts","../src/tools/style-tools.ts","../src/tools/content-tools.ts","../src/tools/conversion-tools.ts","../src/tools/theme-tools.ts","../src/tools/chart-tools.ts","../src/tools/chart-formatting-tools.ts","../src/tools/chart-user-shape-tools.ts","../src/tools/smartart-tools.ts","../src/tools/merge-tools.ts","../src/tools/template-tools.ts","../src/tools/metadata-tools.ts","../src/tools/section-tools.ts","../src/tools/export-tools.ts","../src/tools/json-tools.ts","../src/tools/hyperlink-tools.ts","../src/tools/geometry-tools.ts","../src/tools/lock-tools.ts","../src/tools/validation-tools.ts","../src/tools/presentation-tools.ts","../src/tools/layout-tools.ts","../src/tools/ole-tools.ts"],"mappings":";;;;;;;UAOiB;;EAEhB,UAAU;;EAEV,gBAAgB,iBAAiB,QAAQ;;EAEzC,gBAAgB,iBAAiB,QAAQ;;;;;;;;;;;UAYzB;;EAEhB;;EAEA;;;;;;UAOgB,WAAW;;EAE3B,UAAU;;EAEV,QAAQ;;EAER;;;;;;EAMA,cAAc;;;;;;UAWE;;EAEhB,QAAQ;IAAqB,MAAM;;;EAEnC,SAAS;IACR,QAAQ,MAAM,KAAM,OAAO,YAAY,kBAAkB;IACzD,UAAU,MAAM,MAAO,QAAQ;;;EAGhC,YAAY;;;;;;;UAQI;EAChB,SAAS,eAAe,QAAQ;EAChC,UAAU,cAAc,MAAM,aAAa;;;;;;UAO3B;EAChB,eACC,kBACA,OAAO,YACP;IAAW;IAAoB;;EAEhC,SAAS,mBAAmB;;;;;UAMZ;;EAEhB,YAAY;;EAEZ,gBAAgB;;EAEhB,SAAS;;EAET;;;;;;;;;wBC7FqB,iBACrB,kBACA,SAAS,mBACP;EAAU,UAAU;EAAU,UAAU;;;;;wBA0BrB,iBACrB,kBACA,UAAU,YACV,UAAU,YACV,SAAS,kBACT,wBAAwB,wBACtB;EAAU;EAAsB;;;;;;wBAsDb,uBAAuB,GAC5C,kBACA,SAAS,kBACT,SAAS,KAAK,gBAAgB,WAAW,KAAK,QAAQ,WAAW,MAC/D,QAAQ;EAAM;EAAuB;;;;UC/FvB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;;wBAGK,SACf,KAAK,aACL;EAAU;IACR,WAAW;UAuBG;EAChB;EACA;;UAGgB;EAChB;EACA;;wBAGe,SAAS,KAAK,aAAa,QAAQ,iBAAiB,WAAW;UA2B9D;EAChB;;UAGgB;EAChB;EACA;;wBAGe,aACf,KAAK,aACL,QAAQ,qBACN,WAAW;UA4BG;EAChB;;wBAGe,cACf,KAAK,aACL,QAAQ,sBACN;EAAa;;UA2BC;EAChB;EACA;;wBAGe,eACf,KAAK,aACL,QAAQ,uBACN;EAAa;EAAuB;;UA4BtB;EAChB;EACA;EACA;EACA;EACA;EACA;;wBAGe,sBACf,KAAK,aACL,QAAQ,8BACN;EAAa;;UA8BC;EAChB;EACA;EACA;EACA;EACA;EACA;;wBAGe,mBACf,KAAK,aACL,QAAQ,2BACN;EAAa;EAAoB;;UAmCnB;EAChB;EACA;;wBAGe,cACf,KAAK,aACL,QAAQ,sBACN;EAAa;EAAqB;;;;wBChSrB;wBAIA;;wBAKA,gBAAgB,IAAI,gBAAc;;wBAwGlC,iBAAiB,OAAO;;wBA0BxB,mBAAmB,oBAAoB;;;UClHtC;EAChB;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;UAGgB;EAChB;EACA;;wBAGe,WACf,KAAK,aACL,QAAQ,mBACN,WAAW;UAmKG;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;;;;;;;EAOA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;EAEA;;wBAGe,cACf,KAAK,aACL,QAAQ,sBACN;EAAa;;UA2HC;EAChB;EACA;;EAEA;;wBAGe,cACf,KAAK,aACL,QAAQ,sBACN;EAAa;EAAmB;;UA4BlB;EAChB;EACA;;wBAGe,eACf,KAAK,aACL,QAAQ,uBACN;EAAa;;UA0BC;EAChB;EACA;EAEA;EACA;EAEA;EACA;;wBAGe,gBACf,KAAK,aACL,QAAQ,wBACN;EAAa;;UA6GC;EAChB;EACA;EACA;EACA;EACA;;UAGgB;EAChB;;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;EAEA,QAAQ;;EAER;;EAEA,aAAa;;;;;;;;;;wBAWQ,cACrB,KAAK,aACL,QAAQ,sBACN,QAAQ,WAAW;UAmCL;EAChB;;EAEA;;UAGgB;EAChB;EACA;EACA;EACA;EACA;;;wBAIqB,gBACrB,KAAK,aACL,QAAQ,wBACN,QAAQ,WAAW;UAkBL;EAChB;EACA;EACA;EACA;;;wBAIqB,wBACrB,KAAK,aACL,QAAQ,gCACN,QAAQ,WAAW;UAcL;EAChB;EACA;EACA;;EAEA;EACA;;;;;;;;;wBAUqB,qBACrB,KAAK,aACL,QAAQ,6BACN,QAAQ,WAAW;UAmBL;EAChB;EACA;;EAEA;;;;;;;;wBASqB,kBACrB,KAAK,aACL,QAAQ,yBACN,QAAQ,WAAW;UAaL;EAChB;EACA;;EAEA;;EAEA;;;;;;;wBAQqB,gBACrB,KAAK,aACL,QAAQ,uBACN,QAAQ,WAAW"}
|
package/dist/index.js
CHANGED
|
@@ -628,6 +628,95 @@ function runAccessibilityCheck(ctx) {
|
|
|
628
628
|
};
|
|
629
629
|
}
|
|
630
630
|
|
|
631
|
+
// src/tools/text-editing.ts
|
|
632
|
+
function editRange(segments, start, end, replacement) {
|
|
633
|
+
let offset = 0;
|
|
634
|
+
let inserted = false;
|
|
635
|
+
for (const segment of segments) {
|
|
636
|
+
const text = segment.text;
|
|
637
|
+
const next = offset + text.length;
|
|
638
|
+
if (!segment.bulletInfo?.ownedByParagraph && next > start && offset < end) {
|
|
639
|
+
const from = Math.max(0, start - offset);
|
|
640
|
+
const to = Math.min(text.length, end - offset);
|
|
641
|
+
segment.text = text.slice(0, from) + (inserted ? "" : replacement) + text.slice(to);
|
|
642
|
+
inserted = true;
|
|
643
|
+
} else if (!inserted && start === end && offset <= start && next >= start && !segment.bulletInfo?.ownedByParagraph) {
|
|
644
|
+
const at = start - offset;
|
|
645
|
+
segment.text = text.slice(0, at) + replacement + text.slice(at);
|
|
646
|
+
inserted = true;
|
|
647
|
+
}
|
|
648
|
+
offset = next;
|
|
649
|
+
}
|
|
650
|
+
if (!inserted && replacement) {
|
|
651
|
+
segments.push({ text: replacement, style: {} });
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
function changedRange(before, text) {
|
|
655
|
+
let start = 0;
|
|
656
|
+
while (start < before.length && start < text.length && before[start] === text[start]) {
|
|
657
|
+
start++;
|
|
658
|
+
}
|
|
659
|
+
let suffix = 0;
|
|
660
|
+
while (suffix < before.length - start && suffix < text.length - start && before[before.length - suffix - 1] === text[text.length - suffix - 1]) {
|
|
661
|
+
suffix++;
|
|
662
|
+
}
|
|
663
|
+
return {
|
|
664
|
+
start,
|
|
665
|
+
end: before.length - suffix,
|
|
666
|
+
replacement: text.slice(start, text.length - suffix)
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
function setElementText(element, text) {
|
|
670
|
+
const segments = element.textSegments;
|
|
671
|
+
if (segments?.length) {
|
|
672
|
+
const before = segments.map((segment) => segment.text).join("");
|
|
673
|
+
const oldLines = before.split("\n");
|
|
674
|
+
const newLines = text.split("\n");
|
|
675
|
+
if (oldLines.length === newLines.length) {
|
|
676
|
+
let offset = before.length;
|
|
677
|
+
for (let index = oldLines.length - 1; index >= 0; index--) {
|
|
678
|
+
const line = oldLines[index];
|
|
679
|
+
offset -= line.length;
|
|
680
|
+
const edit = changedRange(line, newLines[index]);
|
|
681
|
+
editRange(segments, offset + edit.start, offset + edit.end, edit.replacement);
|
|
682
|
+
offset--;
|
|
683
|
+
}
|
|
684
|
+
} else {
|
|
685
|
+
const edit = changedRange(before, text);
|
|
686
|
+
editRange(segments, edit.start, edit.end, edit.replacement);
|
|
687
|
+
}
|
|
688
|
+
element.text = segments.map((segment) => segment.text).join("");
|
|
689
|
+
} else {
|
|
690
|
+
element.text = text;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
function replaceElementText(element, regex, replacement) {
|
|
694
|
+
const before = element.text ?? element.textSegments?.map((segment) => segment.text).join("") ?? "";
|
|
695
|
+
const matches = Array.from(before.matchAll(regex));
|
|
696
|
+
if (before.replace(regex, replacement) === before) {
|
|
697
|
+
return 0;
|
|
698
|
+
}
|
|
699
|
+
if (!element.textSegments?.length) {
|
|
700
|
+
element.text = before.replace(regex, replacement);
|
|
701
|
+
return matches.length;
|
|
702
|
+
}
|
|
703
|
+
for (const match of matches.reverse()) {
|
|
704
|
+
const start = match.index;
|
|
705
|
+
const end = start + match[0].length;
|
|
706
|
+
const single = new RegExp(regex.source, `${regex.flags.replace("g", "")}y`);
|
|
707
|
+
single.lastIndex = start;
|
|
708
|
+
const after = before.replace(single, replacement);
|
|
709
|
+
editRange(
|
|
710
|
+
element.textSegments,
|
|
711
|
+
start,
|
|
712
|
+
end,
|
|
713
|
+
after.slice(start, after.length - (before.length - end))
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
element.text = element.textSegments.map((segment) => segment.text).join("");
|
|
717
|
+
return matches.length;
|
|
718
|
+
}
|
|
719
|
+
|
|
631
720
|
// src/tools/element-tools.ts
|
|
632
721
|
function addElement(ctx, params) {
|
|
633
722
|
const err = validateSlideIndex(params.slideIndex, ctx.pptxData.slides.length);
|
|
@@ -816,13 +905,11 @@ function updateElement(ctx, params) {
|
|
|
816
905
|
}
|
|
817
906
|
if (pptxViewerCore.hasTextProperties(el)) {
|
|
818
907
|
const textEl = el;
|
|
819
|
-
if (params.
|
|
820
|
-
textEl.
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
textEl.textSegments = [{ text: params.text, style: {} }];
|
|
825
|
-
}
|
|
908
|
+
if (params.textSegments !== void 0) {
|
|
909
|
+
textEl.textSegments = structuredClone(params.textSegments);
|
|
910
|
+
textEl.text = textEl.textSegments.map((segment) => segment.text).join("");
|
|
911
|
+
} else if (params.text !== void 0) {
|
|
912
|
+
setElementText(textEl, params.text);
|
|
826
913
|
}
|
|
827
914
|
if (!textEl.textStyle) {
|
|
828
915
|
textEl.textStyle = {};
|
|
@@ -1620,16 +1707,7 @@ function replaceText(ctx, params) {
|
|
|
1620
1707
|
if (after !== before) {
|
|
1621
1708
|
const matchCount = Array.from(before.matchAll(regex)).length;
|
|
1622
1709
|
count += matchCount;
|
|
1623
|
-
textEl
|
|
1624
|
-
if (textEl.textSegments && textEl.textSegments.length > 0) {
|
|
1625
|
-
const firstSeg = textEl.textSegments[0];
|
|
1626
|
-
const updatedFirst = firstSeg.text.replace(regex, params.replacement);
|
|
1627
|
-
if (updatedFirst !== firstSeg.text) {
|
|
1628
|
-
firstSeg.text = updatedFirst;
|
|
1629
|
-
} else {
|
|
1630
|
-
textEl.textSegments = [{ text: after, style: firstSeg.style }];
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1710
|
+
replaceElementText(textEl, regex, params.replacement);
|
|
1633
1711
|
}
|
|
1634
1712
|
}
|
|
1635
1713
|
}
|
|
@@ -2955,6 +3033,49 @@ function applyLayout(ctx, params) {
|
|
|
2955
3033
|
if (layout.path) {
|
|
2956
3034
|
slide.layoutPath = layout.path;
|
|
2957
3035
|
}
|
|
3036
|
+
const master = ctx.pptxData.slideMasters?.find(
|
|
3037
|
+
(candidate) => candidate.layouts?.some((definition2) => definition2.path === layout.path)
|
|
3038
|
+
);
|
|
3039
|
+
const definition = master?.layouts?.find((candidate) => candidate.path === layout.path);
|
|
3040
|
+
for (const frame of definition?.placeholders ?? []) {
|
|
3041
|
+
if (["dt", "ftr", "sldnum", "hdr"].includes(frame.type)) {
|
|
3042
|
+
continue;
|
|
3043
|
+
}
|
|
3044
|
+
const ph = {
|
|
3045
|
+
"@_type": frame.type === "ctrtitle" ? "ctrTitle" : frame.type,
|
|
3046
|
+
...frame.idx !== void 0 ? { "@_idx": frame.idx } : {}
|
|
3047
|
+
};
|
|
3048
|
+
if (slide.elements.some((element) => {
|
|
3049
|
+
const nv = element.rawXml?.["p:nvSpPr"];
|
|
3050
|
+
const nvPr = nv?.["p:nvPr"];
|
|
3051
|
+
const existing = nvPr?.["p:ph"];
|
|
3052
|
+
return element.placeholderType === frame.type && String(existing?.["@_idx"] ?? "0") === String(frame.idx ?? "0");
|
|
3053
|
+
})) {
|
|
3054
|
+
continue;
|
|
3055
|
+
}
|
|
3056
|
+
const inherited = master?.placeholders?.find(
|
|
3057
|
+
(candidate) => candidate.type === frame.type && (candidate.idx ?? "0") === (frame.idx ?? "0")
|
|
3058
|
+
) ?? master?.placeholders?.find((candidate) => candidate.type === frame.type);
|
|
3059
|
+
slide.elements.push({
|
|
3060
|
+
id: generateElementId(),
|
|
3061
|
+
type: "text",
|
|
3062
|
+
placeholderType: frame.type,
|
|
3063
|
+
x: frame.x ?? inherited?.x ?? 0,
|
|
3064
|
+
y: frame.y ?? inherited?.y ?? 0,
|
|
3065
|
+
width: frame.width ?? inherited?.width ?? ctx.pptxData.width,
|
|
3066
|
+
height: frame.height ?? inherited?.height ?? ctx.pptxData.height,
|
|
3067
|
+
text: "",
|
|
3068
|
+
textSegments: [{ text: "", style: {} }],
|
|
3069
|
+
rawXml: {
|
|
3070
|
+
"p:nvSpPr": {
|
|
3071
|
+
"p:cNvPr": { "@_name": frame.type },
|
|
3072
|
+
"p:cNvSpPr": {},
|
|
3073
|
+
"p:nvPr": { "p:ph": ph }
|
|
3074
|
+
},
|
|
3075
|
+
"p:spPr": {}
|
|
3076
|
+
}
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
2958
3079
|
return {
|
|
2959
3080
|
pptxData: ctx.pptxData,
|
|
2960
3081
|
dirty: true,
|
package/dist/index.mjs
CHANGED
|
@@ -627,6 +627,95 @@ function runAccessibilityCheck(ctx) {
|
|
|
627
627
|
};
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
+
// src/tools/text-editing.ts
|
|
631
|
+
function editRange(segments, start, end, replacement) {
|
|
632
|
+
let offset = 0;
|
|
633
|
+
let inserted = false;
|
|
634
|
+
for (const segment of segments) {
|
|
635
|
+
const text = segment.text;
|
|
636
|
+
const next = offset + text.length;
|
|
637
|
+
if (!segment.bulletInfo?.ownedByParagraph && next > start && offset < end) {
|
|
638
|
+
const from = Math.max(0, start - offset);
|
|
639
|
+
const to = Math.min(text.length, end - offset);
|
|
640
|
+
segment.text = text.slice(0, from) + (inserted ? "" : replacement) + text.slice(to);
|
|
641
|
+
inserted = true;
|
|
642
|
+
} else if (!inserted && start === end && offset <= start && next >= start && !segment.bulletInfo?.ownedByParagraph) {
|
|
643
|
+
const at = start - offset;
|
|
644
|
+
segment.text = text.slice(0, at) + replacement + text.slice(at);
|
|
645
|
+
inserted = true;
|
|
646
|
+
}
|
|
647
|
+
offset = next;
|
|
648
|
+
}
|
|
649
|
+
if (!inserted && replacement) {
|
|
650
|
+
segments.push({ text: replacement, style: {} });
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
function changedRange(before, text) {
|
|
654
|
+
let start = 0;
|
|
655
|
+
while (start < before.length && start < text.length && before[start] === text[start]) {
|
|
656
|
+
start++;
|
|
657
|
+
}
|
|
658
|
+
let suffix = 0;
|
|
659
|
+
while (suffix < before.length - start && suffix < text.length - start && before[before.length - suffix - 1] === text[text.length - suffix - 1]) {
|
|
660
|
+
suffix++;
|
|
661
|
+
}
|
|
662
|
+
return {
|
|
663
|
+
start,
|
|
664
|
+
end: before.length - suffix,
|
|
665
|
+
replacement: text.slice(start, text.length - suffix)
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
function setElementText(element, text) {
|
|
669
|
+
const segments = element.textSegments;
|
|
670
|
+
if (segments?.length) {
|
|
671
|
+
const before = segments.map((segment) => segment.text).join("");
|
|
672
|
+
const oldLines = before.split("\n");
|
|
673
|
+
const newLines = text.split("\n");
|
|
674
|
+
if (oldLines.length === newLines.length) {
|
|
675
|
+
let offset = before.length;
|
|
676
|
+
for (let index = oldLines.length - 1; index >= 0; index--) {
|
|
677
|
+
const line = oldLines[index];
|
|
678
|
+
offset -= line.length;
|
|
679
|
+
const edit = changedRange(line, newLines[index]);
|
|
680
|
+
editRange(segments, offset + edit.start, offset + edit.end, edit.replacement);
|
|
681
|
+
offset--;
|
|
682
|
+
}
|
|
683
|
+
} else {
|
|
684
|
+
const edit = changedRange(before, text);
|
|
685
|
+
editRange(segments, edit.start, edit.end, edit.replacement);
|
|
686
|
+
}
|
|
687
|
+
element.text = segments.map((segment) => segment.text).join("");
|
|
688
|
+
} else {
|
|
689
|
+
element.text = text;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
function replaceElementText(element, regex, replacement) {
|
|
693
|
+
const before = element.text ?? element.textSegments?.map((segment) => segment.text).join("") ?? "";
|
|
694
|
+
const matches = Array.from(before.matchAll(regex));
|
|
695
|
+
if (before.replace(regex, replacement) === before) {
|
|
696
|
+
return 0;
|
|
697
|
+
}
|
|
698
|
+
if (!element.textSegments?.length) {
|
|
699
|
+
element.text = before.replace(regex, replacement);
|
|
700
|
+
return matches.length;
|
|
701
|
+
}
|
|
702
|
+
for (const match of matches.reverse()) {
|
|
703
|
+
const start = match.index;
|
|
704
|
+
const end = start + match[0].length;
|
|
705
|
+
const single = new RegExp(regex.source, `${regex.flags.replace("g", "")}y`);
|
|
706
|
+
single.lastIndex = start;
|
|
707
|
+
const after = before.replace(single, replacement);
|
|
708
|
+
editRange(
|
|
709
|
+
element.textSegments,
|
|
710
|
+
start,
|
|
711
|
+
end,
|
|
712
|
+
after.slice(start, after.length - (before.length - end))
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
element.text = element.textSegments.map((segment) => segment.text).join("");
|
|
716
|
+
return matches.length;
|
|
717
|
+
}
|
|
718
|
+
|
|
630
719
|
// src/tools/element-tools.ts
|
|
631
720
|
function addElement(ctx, params) {
|
|
632
721
|
const err = validateSlideIndex(params.slideIndex, ctx.pptxData.slides.length);
|
|
@@ -815,13 +904,11 @@ function updateElement(ctx, params) {
|
|
|
815
904
|
}
|
|
816
905
|
if (hasTextProperties(el)) {
|
|
817
906
|
const textEl = el;
|
|
818
|
-
if (params.
|
|
819
|
-
textEl.
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
textEl.textSegments = [{ text: params.text, style: {} }];
|
|
824
|
-
}
|
|
907
|
+
if (params.textSegments !== void 0) {
|
|
908
|
+
textEl.textSegments = structuredClone(params.textSegments);
|
|
909
|
+
textEl.text = textEl.textSegments.map((segment) => segment.text).join("");
|
|
910
|
+
} else if (params.text !== void 0) {
|
|
911
|
+
setElementText(textEl, params.text);
|
|
825
912
|
}
|
|
826
913
|
if (!textEl.textStyle) {
|
|
827
914
|
textEl.textStyle = {};
|
|
@@ -1619,16 +1706,7 @@ function replaceText(ctx, params) {
|
|
|
1619
1706
|
if (after !== before) {
|
|
1620
1707
|
const matchCount = Array.from(before.matchAll(regex)).length;
|
|
1621
1708
|
count += matchCount;
|
|
1622
|
-
textEl
|
|
1623
|
-
if (textEl.textSegments && textEl.textSegments.length > 0) {
|
|
1624
|
-
const firstSeg = textEl.textSegments[0];
|
|
1625
|
-
const updatedFirst = firstSeg.text.replace(regex, params.replacement);
|
|
1626
|
-
if (updatedFirst !== firstSeg.text) {
|
|
1627
|
-
firstSeg.text = updatedFirst;
|
|
1628
|
-
} else {
|
|
1629
|
-
textEl.textSegments = [{ text: after, style: firstSeg.style }];
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1709
|
+
replaceElementText(textEl, regex, params.replacement);
|
|
1632
1710
|
}
|
|
1633
1711
|
}
|
|
1634
1712
|
}
|
|
@@ -2954,6 +3032,49 @@ function applyLayout(ctx, params) {
|
|
|
2954
3032
|
if (layout.path) {
|
|
2955
3033
|
slide.layoutPath = layout.path;
|
|
2956
3034
|
}
|
|
3035
|
+
const master = ctx.pptxData.slideMasters?.find(
|
|
3036
|
+
(candidate) => candidate.layouts?.some((definition2) => definition2.path === layout.path)
|
|
3037
|
+
);
|
|
3038
|
+
const definition = master?.layouts?.find((candidate) => candidate.path === layout.path);
|
|
3039
|
+
for (const frame of definition?.placeholders ?? []) {
|
|
3040
|
+
if (["dt", "ftr", "sldnum", "hdr"].includes(frame.type)) {
|
|
3041
|
+
continue;
|
|
3042
|
+
}
|
|
3043
|
+
const ph = {
|
|
3044
|
+
"@_type": frame.type === "ctrtitle" ? "ctrTitle" : frame.type,
|
|
3045
|
+
...frame.idx !== void 0 ? { "@_idx": frame.idx } : {}
|
|
3046
|
+
};
|
|
3047
|
+
if (slide.elements.some((element) => {
|
|
3048
|
+
const nv = element.rawXml?.["p:nvSpPr"];
|
|
3049
|
+
const nvPr = nv?.["p:nvPr"];
|
|
3050
|
+
const existing = nvPr?.["p:ph"];
|
|
3051
|
+
return element.placeholderType === frame.type && String(existing?.["@_idx"] ?? "0") === String(frame.idx ?? "0");
|
|
3052
|
+
})) {
|
|
3053
|
+
continue;
|
|
3054
|
+
}
|
|
3055
|
+
const inherited = master?.placeholders?.find(
|
|
3056
|
+
(candidate) => candidate.type === frame.type && (candidate.idx ?? "0") === (frame.idx ?? "0")
|
|
3057
|
+
) ?? master?.placeholders?.find((candidate) => candidate.type === frame.type);
|
|
3058
|
+
slide.elements.push({
|
|
3059
|
+
id: generateElementId(),
|
|
3060
|
+
type: "text",
|
|
3061
|
+
placeholderType: frame.type,
|
|
3062
|
+
x: frame.x ?? inherited?.x ?? 0,
|
|
3063
|
+
y: frame.y ?? inherited?.y ?? 0,
|
|
3064
|
+
width: frame.width ?? inherited?.width ?? ctx.pptxData.width,
|
|
3065
|
+
height: frame.height ?? inherited?.height ?? ctx.pptxData.height,
|
|
3066
|
+
text: "",
|
|
3067
|
+
textSegments: [{ text: "", style: {} }],
|
|
3068
|
+
rawXml: {
|
|
3069
|
+
"p:nvSpPr": {
|
|
3070
|
+
"p:cNvPr": { "@_name": frame.type },
|
|
3071
|
+
"p:cNvSpPr": {},
|
|
3072
|
+
"p:nvPr": { "p:ph": ph }
|
|
3073
|
+
},
|
|
3074
|
+
"p:spPr": {}
|
|
3075
|
+
}
|
|
3076
|
+
});
|
|
3077
|
+
}
|
|
2957
3078
|
return {
|
|
2958
3079
|
pptxData: ctx.pptxData,
|
|
2959
3080
|
dirty: true,
|
package/dist/mcp/index.js
CHANGED
|
@@ -135,6 +135,14 @@ var UpdateElementSchema = zod.z.object({
|
|
|
135
135
|
height: zod.z.number().optional(),
|
|
136
136
|
rotation: zod.z.number().optional(),
|
|
137
137
|
text: zod.z.string().optional(),
|
|
138
|
+
textSegments: zod.z.array(
|
|
139
|
+
zod.z.object({
|
|
140
|
+
text: zod.z.string(),
|
|
141
|
+
style: zod.z.record(zod.z.string(), zod.z.any())
|
|
142
|
+
}).passthrough()
|
|
143
|
+
).optional().describe(
|
|
144
|
+
"Rich text segments, including paragraph and bullet metadata. Takes precedence over text."
|
|
145
|
+
),
|
|
138
146
|
fontSize: zod.z.number().optional(),
|
|
139
147
|
fontFamily: zod.z.string().optional(),
|
|
140
148
|
fontColor: zod.z.string().optional(),
|
|
@@ -1359,6 +1367,97 @@ function removeChartUserShapeT(ctx, params) {
|
|
|
1359
1367
|
pptxViewerCore.removeChartUserShape(chart, params.index);
|
|
1360
1368
|
return { pptxData: ctx.pptxData, dirty: true, result: { elementId: params.elementId } };
|
|
1361
1369
|
}
|
|
1370
|
+
|
|
1371
|
+
// src/tools/text-editing.ts
|
|
1372
|
+
function editRange(segments, start, end, replacement) {
|
|
1373
|
+
let offset = 0;
|
|
1374
|
+
let inserted = false;
|
|
1375
|
+
for (const segment of segments) {
|
|
1376
|
+
const text = segment.text;
|
|
1377
|
+
const next = offset + text.length;
|
|
1378
|
+
if (!segment.bulletInfo?.ownedByParagraph && next > start && offset < end) {
|
|
1379
|
+
const from = Math.max(0, start - offset);
|
|
1380
|
+
const to = Math.min(text.length, end - offset);
|
|
1381
|
+
segment.text = text.slice(0, from) + (inserted ? "" : replacement) + text.slice(to);
|
|
1382
|
+
inserted = true;
|
|
1383
|
+
} else if (!inserted && start === end && offset <= start && next >= start && !segment.bulletInfo?.ownedByParagraph) {
|
|
1384
|
+
const at = start - offset;
|
|
1385
|
+
segment.text = text.slice(0, at) + replacement + text.slice(at);
|
|
1386
|
+
inserted = true;
|
|
1387
|
+
}
|
|
1388
|
+
offset = next;
|
|
1389
|
+
}
|
|
1390
|
+
if (!inserted && replacement) {
|
|
1391
|
+
segments.push({ text: replacement, style: {} });
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
function changedRange(before, text) {
|
|
1395
|
+
let start = 0;
|
|
1396
|
+
while (start < before.length && start < text.length && before[start] === text[start]) {
|
|
1397
|
+
start++;
|
|
1398
|
+
}
|
|
1399
|
+
let suffix = 0;
|
|
1400
|
+
while (suffix < before.length - start && suffix < text.length - start && before[before.length - suffix - 1] === text[text.length - suffix - 1]) {
|
|
1401
|
+
suffix++;
|
|
1402
|
+
}
|
|
1403
|
+
return {
|
|
1404
|
+
start,
|
|
1405
|
+
end: before.length - suffix,
|
|
1406
|
+
replacement: text.slice(start, text.length - suffix)
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
function setElementText(element, text) {
|
|
1410
|
+
const segments = element.textSegments;
|
|
1411
|
+
if (segments?.length) {
|
|
1412
|
+
const before = segments.map((segment) => segment.text).join("");
|
|
1413
|
+
const oldLines = before.split("\n");
|
|
1414
|
+
const newLines = text.split("\n");
|
|
1415
|
+
if (oldLines.length === newLines.length) {
|
|
1416
|
+
let offset = before.length;
|
|
1417
|
+
for (let index = oldLines.length - 1; index >= 0; index--) {
|
|
1418
|
+
const line = oldLines[index];
|
|
1419
|
+
offset -= line.length;
|
|
1420
|
+
const edit = changedRange(line, newLines[index]);
|
|
1421
|
+
editRange(segments, offset + edit.start, offset + edit.end, edit.replacement);
|
|
1422
|
+
offset--;
|
|
1423
|
+
}
|
|
1424
|
+
} else {
|
|
1425
|
+
const edit = changedRange(before, text);
|
|
1426
|
+
editRange(segments, edit.start, edit.end, edit.replacement);
|
|
1427
|
+
}
|
|
1428
|
+
element.text = segments.map((segment) => segment.text).join("");
|
|
1429
|
+
} else {
|
|
1430
|
+
element.text = text;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
function replaceElementText(element, regex, replacement) {
|
|
1434
|
+
const before = element.text ?? element.textSegments?.map((segment) => segment.text).join("") ?? "";
|
|
1435
|
+
const matches = Array.from(before.matchAll(regex));
|
|
1436
|
+
if (before.replace(regex, replacement) === before) {
|
|
1437
|
+
return 0;
|
|
1438
|
+
}
|
|
1439
|
+
if (!element.textSegments?.length) {
|
|
1440
|
+
element.text = before.replace(regex, replacement);
|
|
1441
|
+
return matches.length;
|
|
1442
|
+
}
|
|
1443
|
+
for (const match of matches.reverse()) {
|
|
1444
|
+
const start = match.index;
|
|
1445
|
+
const end = start + match[0].length;
|
|
1446
|
+
const single = new RegExp(regex.source, `${regex.flags.replace("g", "")}y`);
|
|
1447
|
+
single.lastIndex = start;
|
|
1448
|
+
const after = before.replace(single, replacement);
|
|
1449
|
+
editRange(
|
|
1450
|
+
element.textSegments,
|
|
1451
|
+
start,
|
|
1452
|
+
end,
|
|
1453
|
+
after.slice(start, after.length - (before.length - end))
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1456
|
+
element.text = element.textSegments.map((segment) => segment.text).join("");
|
|
1457
|
+
return matches.length;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
// src/tools/content-tools.ts
|
|
1362
1461
|
var MAX_REGEX_LEN = 200;
|
|
1363
1462
|
function hasNestedUnboundedQuantifier(pattern) {
|
|
1364
1463
|
return /\([^)]*[+*]\)[+*]/u.test(pattern);
|
|
@@ -1501,16 +1600,7 @@ function replaceText(ctx, params) {
|
|
|
1501
1600
|
if (after !== before) {
|
|
1502
1601
|
const matchCount = Array.from(before.matchAll(regex)).length;
|
|
1503
1602
|
count += matchCount;
|
|
1504
|
-
textEl
|
|
1505
|
-
if (textEl.textSegments && textEl.textSegments.length > 0) {
|
|
1506
|
-
const firstSeg = textEl.textSegments[0];
|
|
1507
|
-
const updatedFirst = firstSeg.text.replace(regex, params.replacement);
|
|
1508
|
-
if (updatedFirst !== firstSeg.text) {
|
|
1509
|
-
firstSeg.text = updatedFirst;
|
|
1510
|
-
} else {
|
|
1511
|
-
textEl.textSegments = [{ text: after, style: firstSeg.style }];
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1603
|
+
replaceElementText(textEl, regex, params.replacement);
|
|
1514
1604
|
}
|
|
1515
1605
|
}
|
|
1516
1606
|
}
|
|
@@ -2106,13 +2196,11 @@ function updateElement(ctx, params) {
|
|
|
2106
2196
|
}
|
|
2107
2197
|
if (pptxViewerCore.hasTextProperties(el)) {
|
|
2108
2198
|
const textEl = el;
|
|
2109
|
-
if (params.
|
|
2110
|
-
textEl.
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
textEl.textSegments = [{ text: params.text, style: {} }];
|
|
2115
|
-
}
|
|
2199
|
+
if (params.textSegments !== void 0) {
|
|
2200
|
+
textEl.textSegments = structuredClone(params.textSegments);
|
|
2201
|
+
textEl.text = textEl.textSegments.map((segment) => segment.text).join("");
|
|
2202
|
+
} else if (params.text !== void 0) {
|
|
2203
|
+
setElementText(textEl, params.text);
|
|
2116
2204
|
}
|
|
2117
2205
|
if (!textEl.textStyle) {
|
|
2118
2206
|
textEl.textStyle = {};
|
|
@@ -2765,6 +2853,49 @@ function applyLayout(ctx, params) {
|
|
|
2765
2853
|
if (layout.path) {
|
|
2766
2854
|
slide.layoutPath = layout.path;
|
|
2767
2855
|
}
|
|
2856
|
+
const master = ctx.pptxData.slideMasters?.find(
|
|
2857
|
+
(candidate) => candidate.layouts?.some((definition2) => definition2.path === layout.path)
|
|
2858
|
+
);
|
|
2859
|
+
const definition = master?.layouts?.find((candidate) => candidate.path === layout.path);
|
|
2860
|
+
for (const frame of definition?.placeholders ?? []) {
|
|
2861
|
+
if (["dt", "ftr", "sldnum", "hdr"].includes(frame.type)) {
|
|
2862
|
+
continue;
|
|
2863
|
+
}
|
|
2864
|
+
const ph = {
|
|
2865
|
+
"@_type": frame.type === "ctrtitle" ? "ctrTitle" : frame.type,
|
|
2866
|
+
...frame.idx !== void 0 ? { "@_idx": frame.idx } : {}
|
|
2867
|
+
};
|
|
2868
|
+
if (slide.elements.some((element) => {
|
|
2869
|
+
const nv = element.rawXml?.["p:nvSpPr"];
|
|
2870
|
+
const nvPr = nv?.["p:nvPr"];
|
|
2871
|
+
const existing = nvPr?.["p:ph"];
|
|
2872
|
+
return element.placeholderType === frame.type && String(existing?.["@_idx"] ?? "0") === String(frame.idx ?? "0");
|
|
2873
|
+
})) {
|
|
2874
|
+
continue;
|
|
2875
|
+
}
|
|
2876
|
+
const inherited = master?.placeholders?.find(
|
|
2877
|
+
(candidate) => candidate.type === frame.type && (candidate.idx ?? "0") === (frame.idx ?? "0")
|
|
2878
|
+
) ?? master?.placeholders?.find((candidate) => candidate.type === frame.type);
|
|
2879
|
+
slide.elements.push({
|
|
2880
|
+
id: generateElementId(),
|
|
2881
|
+
type: "text",
|
|
2882
|
+
placeholderType: frame.type,
|
|
2883
|
+
x: frame.x ?? inherited?.x ?? 0,
|
|
2884
|
+
y: frame.y ?? inherited?.y ?? 0,
|
|
2885
|
+
width: frame.width ?? inherited?.width ?? ctx.pptxData.width,
|
|
2886
|
+
height: frame.height ?? inherited?.height ?? ctx.pptxData.height,
|
|
2887
|
+
text: "",
|
|
2888
|
+
textSegments: [{ text: "", style: {} }],
|
|
2889
|
+
rawXml: {
|
|
2890
|
+
"p:nvSpPr": {
|
|
2891
|
+
"p:cNvPr": { "@_name": frame.type },
|
|
2892
|
+
"p:cNvSpPr": {},
|
|
2893
|
+
"p:nvPr": { "p:ph": ph }
|
|
2894
|
+
},
|
|
2895
|
+
"p:spPr": {}
|
|
2896
|
+
}
|
|
2897
|
+
});
|
|
2898
|
+
}
|
|
2768
2899
|
return {
|
|
2769
2900
|
pptxData: ctx.pptxData,
|
|
2770
2901
|
dirty: true,
|
package/dist/mcp/index.mjs
CHANGED
|
@@ -133,6 +133,14 @@ var UpdateElementSchema = z.object({
|
|
|
133
133
|
height: z.number().optional(),
|
|
134
134
|
rotation: z.number().optional(),
|
|
135
135
|
text: z.string().optional(),
|
|
136
|
+
textSegments: z.array(
|
|
137
|
+
z.object({
|
|
138
|
+
text: z.string(),
|
|
139
|
+
style: z.record(z.string(), z.any())
|
|
140
|
+
}).passthrough()
|
|
141
|
+
).optional().describe(
|
|
142
|
+
"Rich text segments, including paragraph and bullet metadata. Takes precedence over text."
|
|
143
|
+
),
|
|
136
144
|
fontSize: z.number().optional(),
|
|
137
145
|
fontFamily: z.string().optional(),
|
|
138
146
|
fontColor: z.string().optional(),
|
|
@@ -1357,6 +1365,97 @@ function removeChartUserShapeT(ctx, params) {
|
|
|
1357
1365
|
removeChartUserShape(chart, params.index);
|
|
1358
1366
|
return { pptxData: ctx.pptxData, dirty: true, result: { elementId: params.elementId } };
|
|
1359
1367
|
}
|
|
1368
|
+
|
|
1369
|
+
// src/tools/text-editing.ts
|
|
1370
|
+
function editRange(segments, start, end, replacement) {
|
|
1371
|
+
let offset = 0;
|
|
1372
|
+
let inserted = false;
|
|
1373
|
+
for (const segment of segments) {
|
|
1374
|
+
const text = segment.text;
|
|
1375
|
+
const next = offset + text.length;
|
|
1376
|
+
if (!segment.bulletInfo?.ownedByParagraph && next > start && offset < end) {
|
|
1377
|
+
const from = Math.max(0, start - offset);
|
|
1378
|
+
const to = Math.min(text.length, end - offset);
|
|
1379
|
+
segment.text = text.slice(0, from) + (inserted ? "" : replacement) + text.slice(to);
|
|
1380
|
+
inserted = true;
|
|
1381
|
+
} else if (!inserted && start === end && offset <= start && next >= start && !segment.bulletInfo?.ownedByParagraph) {
|
|
1382
|
+
const at = start - offset;
|
|
1383
|
+
segment.text = text.slice(0, at) + replacement + text.slice(at);
|
|
1384
|
+
inserted = true;
|
|
1385
|
+
}
|
|
1386
|
+
offset = next;
|
|
1387
|
+
}
|
|
1388
|
+
if (!inserted && replacement) {
|
|
1389
|
+
segments.push({ text: replacement, style: {} });
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
function changedRange(before, text) {
|
|
1393
|
+
let start = 0;
|
|
1394
|
+
while (start < before.length && start < text.length && before[start] === text[start]) {
|
|
1395
|
+
start++;
|
|
1396
|
+
}
|
|
1397
|
+
let suffix = 0;
|
|
1398
|
+
while (suffix < before.length - start && suffix < text.length - start && before[before.length - suffix - 1] === text[text.length - suffix - 1]) {
|
|
1399
|
+
suffix++;
|
|
1400
|
+
}
|
|
1401
|
+
return {
|
|
1402
|
+
start,
|
|
1403
|
+
end: before.length - suffix,
|
|
1404
|
+
replacement: text.slice(start, text.length - suffix)
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
function setElementText(element, text) {
|
|
1408
|
+
const segments = element.textSegments;
|
|
1409
|
+
if (segments?.length) {
|
|
1410
|
+
const before = segments.map((segment) => segment.text).join("");
|
|
1411
|
+
const oldLines = before.split("\n");
|
|
1412
|
+
const newLines = text.split("\n");
|
|
1413
|
+
if (oldLines.length === newLines.length) {
|
|
1414
|
+
let offset = before.length;
|
|
1415
|
+
for (let index = oldLines.length - 1; index >= 0; index--) {
|
|
1416
|
+
const line = oldLines[index];
|
|
1417
|
+
offset -= line.length;
|
|
1418
|
+
const edit = changedRange(line, newLines[index]);
|
|
1419
|
+
editRange(segments, offset + edit.start, offset + edit.end, edit.replacement);
|
|
1420
|
+
offset--;
|
|
1421
|
+
}
|
|
1422
|
+
} else {
|
|
1423
|
+
const edit = changedRange(before, text);
|
|
1424
|
+
editRange(segments, edit.start, edit.end, edit.replacement);
|
|
1425
|
+
}
|
|
1426
|
+
element.text = segments.map((segment) => segment.text).join("");
|
|
1427
|
+
} else {
|
|
1428
|
+
element.text = text;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
function replaceElementText(element, regex, replacement) {
|
|
1432
|
+
const before = element.text ?? element.textSegments?.map((segment) => segment.text).join("") ?? "";
|
|
1433
|
+
const matches = Array.from(before.matchAll(regex));
|
|
1434
|
+
if (before.replace(regex, replacement) === before) {
|
|
1435
|
+
return 0;
|
|
1436
|
+
}
|
|
1437
|
+
if (!element.textSegments?.length) {
|
|
1438
|
+
element.text = before.replace(regex, replacement);
|
|
1439
|
+
return matches.length;
|
|
1440
|
+
}
|
|
1441
|
+
for (const match of matches.reverse()) {
|
|
1442
|
+
const start = match.index;
|
|
1443
|
+
const end = start + match[0].length;
|
|
1444
|
+
const single = new RegExp(regex.source, `${regex.flags.replace("g", "")}y`);
|
|
1445
|
+
single.lastIndex = start;
|
|
1446
|
+
const after = before.replace(single, replacement);
|
|
1447
|
+
editRange(
|
|
1448
|
+
element.textSegments,
|
|
1449
|
+
start,
|
|
1450
|
+
end,
|
|
1451
|
+
after.slice(start, after.length - (before.length - end))
|
|
1452
|
+
);
|
|
1453
|
+
}
|
|
1454
|
+
element.text = element.textSegments.map((segment) => segment.text).join("");
|
|
1455
|
+
return matches.length;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
// src/tools/content-tools.ts
|
|
1360
1459
|
var MAX_REGEX_LEN = 200;
|
|
1361
1460
|
function hasNestedUnboundedQuantifier(pattern) {
|
|
1362
1461
|
return /\([^)]*[+*]\)[+*]/u.test(pattern);
|
|
@@ -1499,16 +1598,7 @@ function replaceText(ctx, params) {
|
|
|
1499
1598
|
if (after !== before) {
|
|
1500
1599
|
const matchCount = Array.from(before.matchAll(regex)).length;
|
|
1501
1600
|
count += matchCount;
|
|
1502
|
-
textEl
|
|
1503
|
-
if (textEl.textSegments && textEl.textSegments.length > 0) {
|
|
1504
|
-
const firstSeg = textEl.textSegments[0];
|
|
1505
|
-
const updatedFirst = firstSeg.text.replace(regex, params.replacement);
|
|
1506
|
-
if (updatedFirst !== firstSeg.text) {
|
|
1507
|
-
firstSeg.text = updatedFirst;
|
|
1508
|
-
} else {
|
|
1509
|
-
textEl.textSegments = [{ text: after, style: firstSeg.style }];
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1601
|
+
replaceElementText(textEl, regex, params.replacement);
|
|
1512
1602
|
}
|
|
1513
1603
|
}
|
|
1514
1604
|
}
|
|
@@ -2104,13 +2194,11 @@ function updateElement(ctx, params) {
|
|
|
2104
2194
|
}
|
|
2105
2195
|
if (hasTextProperties(el)) {
|
|
2106
2196
|
const textEl = el;
|
|
2107
|
-
if (params.
|
|
2108
|
-
textEl.
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
textEl.textSegments = [{ text: params.text, style: {} }];
|
|
2113
|
-
}
|
|
2197
|
+
if (params.textSegments !== void 0) {
|
|
2198
|
+
textEl.textSegments = structuredClone(params.textSegments);
|
|
2199
|
+
textEl.text = textEl.textSegments.map((segment) => segment.text).join("");
|
|
2200
|
+
} else if (params.text !== void 0) {
|
|
2201
|
+
setElementText(textEl, params.text);
|
|
2114
2202
|
}
|
|
2115
2203
|
if (!textEl.textStyle) {
|
|
2116
2204
|
textEl.textStyle = {};
|
|
@@ -2763,6 +2851,49 @@ function applyLayout(ctx, params) {
|
|
|
2763
2851
|
if (layout.path) {
|
|
2764
2852
|
slide.layoutPath = layout.path;
|
|
2765
2853
|
}
|
|
2854
|
+
const master = ctx.pptxData.slideMasters?.find(
|
|
2855
|
+
(candidate) => candidate.layouts?.some((definition2) => definition2.path === layout.path)
|
|
2856
|
+
);
|
|
2857
|
+
const definition = master?.layouts?.find((candidate) => candidate.path === layout.path);
|
|
2858
|
+
for (const frame of definition?.placeholders ?? []) {
|
|
2859
|
+
if (["dt", "ftr", "sldnum", "hdr"].includes(frame.type)) {
|
|
2860
|
+
continue;
|
|
2861
|
+
}
|
|
2862
|
+
const ph = {
|
|
2863
|
+
"@_type": frame.type === "ctrtitle" ? "ctrTitle" : frame.type,
|
|
2864
|
+
...frame.idx !== void 0 ? { "@_idx": frame.idx } : {}
|
|
2865
|
+
};
|
|
2866
|
+
if (slide.elements.some((element) => {
|
|
2867
|
+
const nv = element.rawXml?.["p:nvSpPr"];
|
|
2868
|
+
const nvPr = nv?.["p:nvPr"];
|
|
2869
|
+
const existing = nvPr?.["p:ph"];
|
|
2870
|
+
return element.placeholderType === frame.type && String(existing?.["@_idx"] ?? "0") === String(frame.idx ?? "0");
|
|
2871
|
+
})) {
|
|
2872
|
+
continue;
|
|
2873
|
+
}
|
|
2874
|
+
const inherited = master?.placeholders?.find(
|
|
2875
|
+
(candidate) => candidate.type === frame.type && (candidate.idx ?? "0") === (frame.idx ?? "0")
|
|
2876
|
+
) ?? master?.placeholders?.find((candidate) => candidate.type === frame.type);
|
|
2877
|
+
slide.elements.push({
|
|
2878
|
+
id: generateElementId(),
|
|
2879
|
+
type: "text",
|
|
2880
|
+
placeholderType: frame.type,
|
|
2881
|
+
x: frame.x ?? inherited?.x ?? 0,
|
|
2882
|
+
y: frame.y ?? inherited?.y ?? 0,
|
|
2883
|
+
width: frame.width ?? inherited?.width ?? ctx.pptxData.width,
|
|
2884
|
+
height: frame.height ?? inherited?.height ?? ctx.pptxData.height,
|
|
2885
|
+
text: "",
|
|
2886
|
+
textSegments: [{ text: "", style: {} }],
|
|
2887
|
+
rawXml: {
|
|
2888
|
+
"p:nvSpPr": {
|
|
2889
|
+
"p:cNvPr": { "@_name": frame.type },
|
|
2890
|
+
"p:cNvSpPr": {},
|
|
2891
|
+
"p:nvPr": { "p:ph": ph }
|
|
2892
|
+
},
|
|
2893
|
+
"p:spPr": {}
|
|
2894
|
+
}
|
|
2895
|
+
});
|
|
2896
|
+
}
|
|
2766
2897
|
return {
|
|
2767
2898
|
pptxData: ctx.pptxData,
|
|
2768
2899
|
dirty: true,
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -114,6 +114,10 @@ export declare const UpdateElementSchema: z.ZodObject<{
|
|
|
114
114
|
height: z.ZodOptional<z.ZodNumber>;
|
|
115
115
|
rotation: z.ZodOptional<z.ZodNumber>;
|
|
116
116
|
text: z.ZodOptional<z.ZodString>;
|
|
117
|
+
textSegments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
118
|
+
text: z.ZodString;
|
|
119
|
+
style: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
120
|
+
}, z.core.$loose>>>;
|
|
117
121
|
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
118
122
|
fontFamily: z.ZodOptional<z.ZodString>;
|
|
119
123
|
fontColor: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/schemas/slide-schemas.ts","../../src/schemas/element-schemas.ts","../../src/schemas/table-style-schemas.ts","../../src/schemas/theme-schemas.ts","../../src/schemas/chart-formatting-schemas.ts","../../src/schemas/chart-schemas.ts","../../src/schemas/chart-user-shape-schemas.ts","../../src/schemas/smartart-schemas.ts","../../src/schemas/template-schemas.ts","../../src/schemas/metadata-schemas.ts","../../src/schemas/section-schemas.ts","../../src/schemas/export-schemas.ts","../../src/schemas/json-schemas.ts","../../src/schemas/hyperlink-schemas.ts","../../src/schemas/geometry-schemas.ts","../../src/schemas/lock-schemas.ts","../../src/schemas/validation-schemas.ts","../../src/schemas/presentation-schemas.ts","../../src/schemas/layout-schemas.ts","../../src/schemas/ole-schemas.ts"],"mappings":";;qBAEa,gBAAc,EAAA;;;GAGzB,EAAA,KAAA;qBAEW,gBAAc,EAAA;;;;GAIzB,EAAA,KAAA;qBAEW,oBAAkB,EAAA;;;GAG7B,EAAA,KAAA;qBAEW,qBAAmB,EAAA;;;GAG9B,EAAA,KAAA;qBAEW,sBAAoB,EAAA;;;;GAI/B,EAAA,KAAA;qBAEW,6BAA2B,EAAA;;;;;;;;GAQtC,EAAA,KAAA;qBAEW,0BAAwB,EAAA;;;;;;;;GAQnC,EAAA,KAAA;qBAEW,qBAAmB,EAAA;;;;GAI9B,EAAA,KAAA;qBAEW,yBAAuB,EAAA;;;;;;;;;;;GAclC,EAAA,KAAA;qBAEW,0BAAwB,EAAA;;GAEnC,EAAA,KAAA;;;qBCrCW,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8B3B,EAAA,KAAA;qBAEW,qBAAmB,EAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/schemas/slide-schemas.ts","../../src/schemas/element-schemas.ts","../../src/schemas/table-style-schemas.ts","../../src/schemas/theme-schemas.ts","../../src/schemas/chart-formatting-schemas.ts","../../src/schemas/chart-schemas.ts","../../src/schemas/chart-user-shape-schemas.ts","../../src/schemas/smartart-schemas.ts","../../src/schemas/template-schemas.ts","../../src/schemas/metadata-schemas.ts","../../src/schemas/section-schemas.ts","../../src/schemas/export-schemas.ts","../../src/schemas/json-schemas.ts","../../src/schemas/hyperlink-schemas.ts","../../src/schemas/geometry-schemas.ts","../../src/schemas/lock-schemas.ts","../../src/schemas/validation-schemas.ts","../../src/schemas/presentation-schemas.ts","../../src/schemas/layout-schemas.ts","../../src/schemas/ole-schemas.ts"],"mappings":";;qBAEa,gBAAc,EAAA;;;GAGzB,EAAA,KAAA;qBAEW,gBAAc,EAAA;;;;GAIzB,EAAA,KAAA;qBAEW,oBAAkB,EAAA;;;GAG7B,EAAA,KAAA;qBAEW,qBAAmB,EAAA;;;GAG9B,EAAA,KAAA;qBAEW,sBAAoB,EAAA;;;;GAI/B,EAAA,KAAA;qBAEW,6BAA2B,EAAA;;;;;;;;GAQtC,EAAA,KAAA;qBAEW,0BAAwB,EAAA;;;;;;;;GAQnC,EAAA,KAAA;qBAEW,qBAAmB,EAAA;;;;GAI9B,EAAA,KAAA;qBAEW,yBAAuB,EAAA;;;;;;;;;;;GAclC,EAAA,KAAA;qBAEW,0BAAwB,EAAA;;GAEnC,EAAA,KAAA;;;qBCrCW,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8B3B,EAAA,KAAA;qBAEW,qBAAmB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuD9B,EAAA,KAAA;qBAEW,qBAAmB,EAAA;;;;;GAK9B,EAAA,KAAA;qBAEW,sBAAoB,EAAA;;;;GAI/B,EAAA,KAAA;qBAEW,uBAAqB,EAAA;;;;;;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rC,EAAA,KAAA;qBAEW,sBAAoB,EAAA;;;;;;GAW/B,EAAA,KAAA;qBAEW,wBAAsB,EAAA;;;;;GAKjC,EAAA,KAAA"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -130,6 +130,14 @@ var UpdateElementSchema = zod.z.object({
|
|
|
130
130
|
height: zod.z.number().optional(),
|
|
131
131
|
rotation: zod.z.number().optional(),
|
|
132
132
|
text: zod.z.string().optional(),
|
|
133
|
+
textSegments: zod.z.array(
|
|
134
|
+
zod.z.object({
|
|
135
|
+
text: zod.z.string(),
|
|
136
|
+
style: zod.z.record(zod.z.string(), zod.z.any())
|
|
137
|
+
}).passthrough()
|
|
138
|
+
).optional().describe(
|
|
139
|
+
"Rich text segments, including paragraph and bullet metadata. Takes precedence over text."
|
|
140
|
+
),
|
|
133
141
|
fontSize: zod.z.number().optional(),
|
|
134
142
|
fontFamily: zod.z.string().optional(),
|
|
135
143
|
fontColor: zod.z.string().optional(),
|
package/dist/schemas/index.mjs
CHANGED
|
@@ -128,6 +128,14 @@ var UpdateElementSchema = z.object({
|
|
|
128
128
|
height: z.number().optional(),
|
|
129
129
|
rotation: z.number().optional(),
|
|
130
130
|
text: z.string().optional(),
|
|
131
|
+
textSegments: z.array(
|
|
132
|
+
z.object({
|
|
133
|
+
text: z.string(),
|
|
134
|
+
style: z.record(z.string(), z.any())
|
|
135
|
+
}).passthrough()
|
|
136
|
+
).optional().describe(
|
|
137
|
+
"Rich text segments, including paragraph and bullet metadata. Takes precedence over text."
|
|
138
|
+
),
|
|
131
139
|
fontSize: z.number().optional(),
|
|
132
140
|
fontFamily: z.string().optional(),
|
|
133
141
|
fontColor: z.string().optional(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pptx-viewer-mcp",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.8",
|
|
4
4
|
"description": "pptx-viewer MCP server and tools: manipulate, convert, and collaborate on PowerPoint .pptx files from AI agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
74
74
|
"fast-xml-parser": "^5.11.1",
|
|
75
75
|
"jszip": "^3.10.2",
|
|
76
|
-
"pptx-viewer-core": "^4.
|
|
76
|
+
"pptx-viewer-core": "^4.9.3",
|
|
77
77
|
"zod": ">=4.4.3 <4.5.3"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|