pptx-viewer-mcp 2.1.1 → 2.1.2
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 +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -39
- package/dist/index.mjs +21 -40
- package/dist/mcp/index.js +20 -39
- package/dist/mcp/index.mjs +21 -40
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ All notable changes to this project are documented here.
|
|
|
4
4
|
This file is generated from [Conventional Commits](https://www.conventionalcommits.org)
|
|
5
5
|
by [git-cliff](https://git-cliff.org); do not edit it by hand.
|
|
6
6
|
|
|
7
|
+
## [2.1.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-mcp@2.1.1) - 2026-08-10
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
- **deps:** Update yjs requirement from ^13.6.31 to ^13.6.32 ([#152](https://github.com/ChristopherVR/pptx-viewer/issues/152)) (by @dependabot[bot]) ([456fdb8](https://github.com/ChristopherVR/pptx-viewer/commit/456fdb8493487ab3e346714755239a90698f6b4d))
|
|
12
|
+
- **deps:** Update @modelcontextprotocol/sdk requirement ([#153](https://github.com/ChristopherVR/pptx-viewer/issues/153)) (by @dependabot[bot]) ([974413f](https://github.com/ChristopherVR/pptx-viewer/commit/974413f162851d16dc1816ce6d94d3d80a5ff817))
|
|
13
|
+
|
|
7
14
|
## [2.1.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-mcp@2.1.0) - 2026-08-07
|
|
8
15
|
|
|
9
16
|
### Features
|
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/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/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"],"mappings":";;;;;;;UAOiB;;EAEhB,UAAU;;EAEV,gBAAgB,iBAAiB,QAAQ;;EAEzC,gBAAgB,iBAAiB,QAAQ;;;;;;UAOzB,WAAW;;EAE3B,UAAU;;EAEV,QAAQ;;EAER;;;;;;UAWgB;;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;;;;;;;;;iBCvEqB,iBACrB,kBACA,SAAS,mBACP;EAAU,UAAU;EAAU,UAAU;;;;;iBA0BrB,iBACrB,kBACA,UAAU,YACV,UAAU,YACV,SAAS,mBACP;EAAU;EAAsB;;;;;;iBAgDb,uBAAuB,GAC5C,kBACA,SAAS,kBACT,SAAS,KAAK,gBAAgB,WAAW,KAAK,QAAQ,WAAW,MAC/D,QAAQ;EAAM;EAAuB;;;;UCxFvB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;;iBAGK,SACf,KAAK,aACL;EAAU;IACR,WAAW;UAuBG;EAChB;EACA;;UAGgB;EAChB;EACA;;iBAGe,SAAS,KAAK,aAAa,QAAQ,iBAAiB,WAAW;UA2B9D;EAChB;;UAGgB;EAChB;EACA;;iBAGe,aACf,KAAK,aACL,QAAQ,qBACN,WAAW;UA4BG;EAChB;;iBAGe,cACf,KAAK,aACL,QAAQ,sBACN;EAAa;;UA2BC;EAChB;EACA;;iBAGe,eACf,KAAK,aACL,QAAQ,uBACN;EAAa;EAAuB;;UA4BtB;EAChB;EACA;EACA;EACA;EACA;EACA;;iBAGe,sBACf,KAAK,aACL,QAAQ,8BACN;EAAa;;UA8BC;EAChB;EACA;EACA;EACA;EACA;EACA;;iBAGe,mBACf,KAAK,aACL,QAAQ,2BACN;EAAa;EAAoB;;UAmCnB;EAChB;EACA;;iBAGe,cACf,KAAK,aACL,QAAQ,sBACN;EAAa;EAAqB;;;;iBChSrB;iBAIA;;iBAKA,gBAAgB,IAAI,gBAAc;;iBAwGlC,iBAAiB,OAAO;;iBA0BxB,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/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/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"],"mappings":";;;;;;;UAOiB;;EAEhB,UAAU;;EAEV,gBAAgB,iBAAiB,QAAQ;;EAEzC,gBAAgB,iBAAiB,QAAQ;;;;;;UAOzB,WAAW;;EAE3B,UAAU;;EAEV,QAAQ;;EAER;;;;;;UAWgB;;EAEhB,QAAQ;I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ChSrB;iBAIA;;iBAKA,gBAAgB,IAAI,gBAAc;;iBAwGlC,iBAAiB,OAAO;;iBA0BxB,mBAAmB,oBAAoB;;;UCvHtC;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;;iBAGe,WACf,KAAK,aACL,QAAQ,mBACN,WAAW;UAmKG;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe,cACf,KAAK,aACL,QAAQ,sBACN;EAAa;;UA8GC;EAChB;EACA;;EAEA;;iBAGe,cACf,KAAK,aACL,QAAQ,sBACN;EAAa;EAAmB;;UA4BlB;EAChB;EACA;;iBAGe,eACf,KAAK,aACL,QAAQ,uBACN;EAAa;;UA0BC;EAChB;EACA;EAEA;EACA;EAEA;EACA;;iBAGe,gBACf,KAAK,aACL,QAAQ,wBACN;EAAa;;UA6GC;EAChB;EACA;EACA;EACA;EACA;;UAGgB;EAChB;;iBAGe,aACf,KAAK,aACL,QAAQ,qBACN,WAAW;UA6CG;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe,oBACf,KAAK,aACL,QAAQ,4BACN;EAAa;;UAsDC;EAChB;EACA;;UAGgB;EAChB;;iBAGe,cACf,KAAK,aACL,QAAQ,sBACN,WAAW;UAmCG;EAChB;EACA;;UAGgB;EAChB;;iBAGe,gBACf,KAAK,aACL,QAAQ,wBACN,WAAW;UA6CG;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe,oBACf,KAAK,aACL,QAAQ,4BACN;EAAa;;;;UClyBC;EAChB;EACA;EACA,OAAO;IAAQ;IAAa;IAAa;;;iBAG1B,iBACf,KAAK,aACL,QAAQ,yBACN;EAAa;;UA6CC;EAChB;EACA;EACA;EACA;EACA;EACA;;iBAGe,qBACf,KAAK,aACL,QAAQ,6BACN;EAAa;EAAkB;;;;UCjEjB;EAChB;EACA;EAEA;EACA,WAAW;EACX,oBAAoB;IAAQ;IAAe;IAAkB;;EAC7D;EACA;EACA;EAEA;EACA;EACA,aAAa;EACb;EAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe,mBACf,KAAK,aACL,QAAQ,2BACN;EAAa;;UA6HC;EAChB;EACA;EACA;EACA;;UAGgB;EAChB;EACA;EACA;EACA;EACA;EACA,QAAQ;;iBAGO,sBAAsB,KAAK,cAAc,WAAW;;;UCnJnD;EAChB;EACA;EACA;EACA;;UAGgB;EAChB;EACA;EACA;EACA;EACA;;UAGgB;EAChB;EACA;EACA,SAAS;;iBAGM,SAAS,KAAK,aAAa,QAAQ,iBAAiB,WAAW;UA2G9D;EAChB;EACA;EACA;EACA;EACA;;UAGgB;EAChB;EACA;EACA;;iBAGe,YACf,KAAK,aACL,QAAQ,oBACN,WAAW;UAiGG;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;;UAGgB;EAChB;EACA;EACA;EACA;EACA;EACA;;UAGgB;EAChB;EACA,WAAW;EACX;EACA;;iBAGe,eACf,KAAK,aACL,QAAQ,uBACN,WAAW;;;UCpTG;EAChB;EACA;EACA;EACA;IAAe;IAAgB;;EAC/B;EACA;EACA;;;;;;EAMA;;;;;;;;;;;;;;EAcA,kBAAkB,mBAAmB;;UAGrB;EAChB;EACA;EACA;EACA;;iBAGqB,kBACrB,KAAK,aACL,QAAQ,0BACN,QAAQ,WAAW;;;UCjCL;EAChB;EACA,cAAc;EACd,aAAa;EACb;;iBAGe,aAAa,KAAK,cAAc,WAAW;UAgB1C;EAChB;;UAGgB;EAChB;EACA,aAAa;;iBAGE,iBACf,KAAK,aACL,QAAQ,yBACN,WAAW;UA8BG;EAChB;EACA;EACA;EACA;EACA;EACA;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;EAA0B,eAAe;;;;iBCvC9C,0BAA0B,KAAK,cAAc;EAC5D,YAAY;EACZ;EACA;EACA;;UAgBgB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe,6BACf,KAAK,aACL,QAAQ,qCACN;EAAa,YAAY;;;;UClCX;EAChB;EACA;EACA;;UAGgB;EAChB,SAAS;EACT;;iBAGe,WAAW,KAAK,cAAc,WAAW;UAmCxC;EAChB;EACA;EACA;;UAGgB;EAChB;EACA;;iBAGe,YACf,KAAK,aACL,QAAQ,oBACN,WAAW"}
|
package/dist/index.js
CHANGED
|
@@ -786,8 +786,10 @@ function cloneElement(ctx, params) {
|
|
|
786
786
|
if (terr) {
|
|
787
787
|
throw new Error(terr);
|
|
788
788
|
}
|
|
789
|
-
const clone =
|
|
790
|
-
|
|
789
|
+
const clone = pptxViewerCore.cloneElement(original);
|
|
790
|
+
const intoTemplate = pptxViewerCore.isTemplateElementId(original.id);
|
|
791
|
+
clone.id = pptxViewerCore.makeStoreAwareId(intoTemplate, original.id);
|
|
792
|
+
pptxViewerCore.reassignDescendantIds(clone, () => pptxViewerCore.makeStoreAwareId(intoTemplate, original.id));
|
|
791
793
|
clone.x += offsetX;
|
|
792
794
|
clone.y += offsetY;
|
|
793
795
|
ctx.pptxData.slides[targetIdx].elements.push(clone);
|
|
@@ -856,38 +858,18 @@ function groupElements(ctx, params) {
|
|
|
856
858
|
}
|
|
857
859
|
const slide = ctx.pptxData.slides[params.slideIndex];
|
|
858
860
|
const idSet = new Set(params.elementIds);
|
|
859
|
-
const
|
|
860
|
-
if (
|
|
861
|
-
const
|
|
862
|
-
const missing = params.elementIds.filter((id) => !childIds.has(id));
|
|
861
|
+
const found = new Set(slide.elements.filter((e) => idSet.has(e.id)).map((e) => e.id));
|
|
862
|
+
if (found.size !== idSet.size) {
|
|
863
|
+
const missing = params.elementIds.filter((id) => !found.has(id));
|
|
863
864
|
throw new Error(`Elements not found: ${missing.join(", ")}`);
|
|
864
865
|
}
|
|
865
|
-
const minX = Math.min(...children.map((e) => e.x));
|
|
866
|
-
const minY = Math.min(...children.map((e) => e.y));
|
|
867
|
-
const maxX = Math.max(...children.map((e) => e.x + e.width));
|
|
868
|
-
const maxY = Math.max(...children.map((e) => e.y + e.height));
|
|
869
|
-
const localChildren = children.map((e) => {
|
|
870
|
-
const c = structuredClone(e);
|
|
871
|
-
c.x -= minX;
|
|
872
|
-
c.y -= minY;
|
|
873
|
-
return c;
|
|
874
|
-
});
|
|
875
|
-
slide.elements = slide.elements.filter((e) => !idSet.has(e.id));
|
|
876
866
|
const groupId = generateElementId();
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
type: "group",
|
|
880
|
-
x: minX,
|
|
881
|
-
y: minY,
|
|
882
|
-
width: maxX - minX,
|
|
883
|
-
height: maxY - minY,
|
|
884
|
-
children: localChildren
|
|
885
|
-
};
|
|
886
|
-
slide.elements.push(group);
|
|
867
|
+
const grouped = pptxViewerCore.groupElements(slide.elements, params.elementIds, groupId);
|
|
868
|
+
slide.elements = grouped.elements;
|
|
887
869
|
return {
|
|
888
870
|
pptxData: ctx.pptxData,
|
|
889
871
|
dirty: true,
|
|
890
|
-
result: { groupId }
|
|
872
|
+
result: { groupId: grouped.groupId ?? groupId }
|
|
891
873
|
};
|
|
892
874
|
}
|
|
893
875
|
function ungroupElements(ctx, params) {
|
|
@@ -896,26 +878,25 @@ function ungroupElements(ctx, params) {
|
|
|
896
878
|
throw new Error(err);
|
|
897
879
|
}
|
|
898
880
|
const slide = ctx.pptxData.slides[params.slideIndex];
|
|
899
|
-
const
|
|
900
|
-
if (
|
|
881
|
+
const group = slide.elements.find((e) => e.id === params.groupElementId);
|
|
882
|
+
if (!group) {
|
|
901
883
|
throw new Error(`Group element '${params.groupElementId}' not found.`);
|
|
902
884
|
}
|
|
903
|
-
const group = slide.elements[groupIdx];
|
|
904
885
|
if (group.type !== "group") {
|
|
905
886
|
throw new Error(`Element '${params.groupElementId}' is not a group.`);
|
|
906
887
|
}
|
|
907
|
-
const
|
|
908
|
-
const
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
888
|
+
const intoTemplate = pptxViewerCore.isTemplateElementId(group.id);
|
|
889
|
+
const childIds = group.children.map(
|
|
890
|
+
(child) => pptxViewerCore.isTemplateElementId(child.id) === intoTemplate ? child.id : pptxViewerCore.makeStoreAwareId(intoTemplate, group.id)
|
|
891
|
+
);
|
|
892
|
+
const promoted = pptxViewerCore.ungroupElements(slide.elements, params.groupElementId, childIds, {
|
|
893
|
+
intoTemplate
|
|
913
894
|
});
|
|
914
|
-
slide.elements
|
|
895
|
+
slide.elements = promoted.elements;
|
|
915
896
|
return {
|
|
916
897
|
pptxData: ctx.pptxData,
|
|
917
898
|
dirty: true,
|
|
918
|
-
result: { restoredIds:
|
|
899
|
+
result: { restoredIds: promoted.childIds }
|
|
919
900
|
};
|
|
920
901
|
}
|
|
921
902
|
function batchUpdateElements(ctx, params) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PptxHandler, hasTextProperties, PptxMarkdownConverter, ThemePresets, getThemePreset, setChartType, setChartTitle, setChartGrouping, setChartLegend, setChartDataLabels, setChartAxis, setChartCategories, addChartSeries, removeChartSeries, updateChartSeriesValues, ChartBuilder, decomposeSmartArt, demoteSmartArtNode, promoteSmartArtNode, reorderSmartArtNode, updateSmartArtNodeText, removeSmartArtNode, addSmartArtNode, mergePresentation, diffPresentations, findPlaceholders, applyTemplate, getSectionForSlide, moveSlidesToSection, reorderSections, removeSection, addSection, SvgExporter, buildPptxJsonDocument, deserializePptxFromJson, applyImportedPptxData, replaceWithCustomGeometry, replaceShapeGeometry, setElementLocked, validatePptx, repairPptx, findLayoutByName, findLayoutByType } from 'pptx-viewer-core';
|
|
1
|
+
import { PptxHandler, hasTextProperties, cloneElement as cloneElement$1, isTemplateElementId, makeStoreAwareId, reassignDescendantIds, groupElements as groupElements$1, ungroupElements as ungroupElements$1, PptxMarkdownConverter, ThemePresets, getThemePreset, setChartType, setChartTitle, setChartGrouping, setChartLegend, setChartDataLabels, setChartAxis, setChartCategories, addChartSeries, removeChartSeries, updateChartSeriesValues, ChartBuilder, decomposeSmartArt, demoteSmartArtNode, promoteSmartArtNode, reorderSmartArtNode, updateSmartArtNodeText, removeSmartArtNode, addSmartArtNode, mergePresentation, diffPresentations, findPlaceholders, applyTemplate, getSectionForSlide, moveSlidesToSection, reorderSections, removeSection, addSection, SvgExporter, buildPptxJsonDocument, deserializePptxFromJson, applyImportedPptxData, replaceWithCustomGeometry, replaceShapeGeometry, setElementLocked, validatePptx, repairPptx, findLayoutByName, findLayoutByType } from 'pptx-viewer-core';
|
|
2
2
|
export { PptxHandler } from 'pptx-viewer-core';
|
|
3
3
|
|
|
4
4
|
// src/execution.ts
|
|
@@ -785,8 +785,10 @@ function cloneElement(ctx, params) {
|
|
|
785
785
|
if (terr) {
|
|
786
786
|
throw new Error(terr);
|
|
787
787
|
}
|
|
788
|
-
const clone =
|
|
789
|
-
|
|
788
|
+
const clone = cloneElement$1(original);
|
|
789
|
+
const intoTemplate = isTemplateElementId(original.id);
|
|
790
|
+
clone.id = makeStoreAwareId(intoTemplate, original.id);
|
|
791
|
+
reassignDescendantIds(clone, () => makeStoreAwareId(intoTemplate, original.id));
|
|
790
792
|
clone.x += offsetX;
|
|
791
793
|
clone.y += offsetY;
|
|
792
794
|
ctx.pptxData.slides[targetIdx].elements.push(clone);
|
|
@@ -855,38 +857,18 @@ function groupElements(ctx, params) {
|
|
|
855
857
|
}
|
|
856
858
|
const slide = ctx.pptxData.slides[params.slideIndex];
|
|
857
859
|
const idSet = new Set(params.elementIds);
|
|
858
|
-
const
|
|
859
|
-
if (
|
|
860
|
-
const
|
|
861
|
-
const missing = params.elementIds.filter((id) => !childIds.has(id));
|
|
860
|
+
const found = new Set(slide.elements.filter((e) => idSet.has(e.id)).map((e) => e.id));
|
|
861
|
+
if (found.size !== idSet.size) {
|
|
862
|
+
const missing = params.elementIds.filter((id) => !found.has(id));
|
|
862
863
|
throw new Error(`Elements not found: ${missing.join(", ")}`);
|
|
863
864
|
}
|
|
864
|
-
const minX = Math.min(...children.map((e) => e.x));
|
|
865
|
-
const minY = Math.min(...children.map((e) => e.y));
|
|
866
|
-
const maxX = Math.max(...children.map((e) => e.x + e.width));
|
|
867
|
-
const maxY = Math.max(...children.map((e) => e.y + e.height));
|
|
868
|
-
const localChildren = children.map((e) => {
|
|
869
|
-
const c = structuredClone(e);
|
|
870
|
-
c.x -= minX;
|
|
871
|
-
c.y -= minY;
|
|
872
|
-
return c;
|
|
873
|
-
});
|
|
874
|
-
slide.elements = slide.elements.filter((e) => !idSet.has(e.id));
|
|
875
865
|
const groupId = generateElementId();
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
type: "group",
|
|
879
|
-
x: minX,
|
|
880
|
-
y: minY,
|
|
881
|
-
width: maxX - minX,
|
|
882
|
-
height: maxY - minY,
|
|
883
|
-
children: localChildren
|
|
884
|
-
};
|
|
885
|
-
slide.elements.push(group);
|
|
866
|
+
const grouped = groupElements$1(slide.elements, params.elementIds, groupId);
|
|
867
|
+
slide.elements = grouped.elements;
|
|
886
868
|
return {
|
|
887
869
|
pptxData: ctx.pptxData,
|
|
888
870
|
dirty: true,
|
|
889
|
-
result: { groupId }
|
|
871
|
+
result: { groupId: grouped.groupId ?? groupId }
|
|
890
872
|
};
|
|
891
873
|
}
|
|
892
874
|
function ungroupElements(ctx, params) {
|
|
@@ -895,26 +877,25 @@ function ungroupElements(ctx, params) {
|
|
|
895
877
|
throw new Error(err);
|
|
896
878
|
}
|
|
897
879
|
const slide = ctx.pptxData.slides[params.slideIndex];
|
|
898
|
-
const
|
|
899
|
-
if (
|
|
880
|
+
const group = slide.elements.find((e) => e.id === params.groupElementId);
|
|
881
|
+
if (!group) {
|
|
900
882
|
throw new Error(`Group element '${params.groupElementId}' not found.`);
|
|
901
883
|
}
|
|
902
|
-
const group = slide.elements[groupIdx];
|
|
903
884
|
if (group.type !== "group") {
|
|
904
885
|
throw new Error(`Element '${params.groupElementId}' is not a group.`);
|
|
905
886
|
}
|
|
906
|
-
const
|
|
907
|
-
const
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
887
|
+
const intoTemplate = isTemplateElementId(group.id);
|
|
888
|
+
const childIds = group.children.map(
|
|
889
|
+
(child) => isTemplateElementId(child.id) === intoTemplate ? child.id : makeStoreAwareId(intoTemplate, group.id)
|
|
890
|
+
);
|
|
891
|
+
const promoted = ungroupElements$1(slide.elements, params.groupElementId, childIds, {
|
|
892
|
+
intoTemplate
|
|
912
893
|
});
|
|
913
|
-
slide.elements
|
|
894
|
+
slide.elements = promoted.elements;
|
|
914
895
|
return {
|
|
915
896
|
pptxData: ctx.pptxData,
|
|
916
897
|
dirty: true,
|
|
917
|
-
result: { restoredIds:
|
|
898
|
+
result: { restoredIds: promoted.childIds }
|
|
918
899
|
};
|
|
919
900
|
}
|
|
920
901
|
function batchUpdateElements(ctx, params) {
|
package/dist/mcp/index.js
CHANGED
|
@@ -1485,8 +1485,10 @@ function cloneElement(ctx, params) {
|
|
|
1485
1485
|
if (terr) {
|
|
1486
1486
|
throw new Error(terr);
|
|
1487
1487
|
}
|
|
1488
|
-
const clone =
|
|
1489
|
-
|
|
1488
|
+
const clone = pptxViewerCore.cloneElement(original);
|
|
1489
|
+
const intoTemplate = pptxViewerCore.isTemplateElementId(original.id);
|
|
1490
|
+
clone.id = pptxViewerCore.makeStoreAwareId(intoTemplate, original.id);
|
|
1491
|
+
pptxViewerCore.reassignDescendantIds(clone, () => pptxViewerCore.makeStoreAwareId(intoTemplate, original.id));
|
|
1490
1492
|
clone.x += offsetX;
|
|
1491
1493
|
clone.y += offsetY;
|
|
1492
1494
|
ctx.pptxData.slides[targetIdx].elements.push(clone);
|
|
@@ -1555,38 +1557,18 @@ function groupElements(ctx, params) {
|
|
|
1555
1557
|
}
|
|
1556
1558
|
const slide = ctx.pptxData.slides[params.slideIndex];
|
|
1557
1559
|
const idSet = new Set(params.elementIds);
|
|
1558
|
-
const
|
|
1559
|
-
if (
|
|
1560
|
-
const
|
|
1561
|
-
const missing = params.elementIds.filter((id) => !childIds.has(id));
|
|
1560
|
+
const found = new Set(slide.elements.filter((e) => idSet.has(e.id)).map((e) => e.id));
|
|
1561
|
+
if (found.size !== idSet.size) {
|
|
1562
|
+
const missing = params.elementIds.filter((id) => !found.has(id));
|
|
1562
1563
|
throw new Error(`Elements not found: ${missing.join(", ")}`);
|
|
1563
1564
|
}
|
|
1564
|
-
const minX = Math.min(...children.map((e) => e.x));
|
|
1565
|
-
const minY = Math.min(...children.map((e) => e.y));
|
|
1566
|
-
const maxX = Math.max(...children.map((e) => e.x + e.width));
|
|
1567
|
-
const maxY = Math.max(...children.map((e) => e.y + e.height));
|
|
1568
|
-
const localChildren = children.map((e) => {
|
|
1569
|
-
const c = structuredClone(e);
|
|
1570
|
-
c.x -= minX;
|
|
1571
|
-
c.y -= minY;
|
|
1572
|
-
return c;
|
|
1573
|
-
});
|
|
1574
|
-
slide.elements = slide.elements.filter((e) => !idSet.has(e.id));
|
|
1575
1565
|
const groupId = generateElementId();
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
type: "group",
|
|
1579
|
-
x: minX,
|
|
1580
|
-
y: minY,
|
|
1581
|
-
width: maxX - minX,
|
|
1582
|
-
height: maxY - minY,
|
|
1583
|
-
children: localChildren
|
|
1584
|
-
};
|
|
1585
|
-
slide.elements.push(group);
|
|
1566
|
+
const grouped = pptxViewerCore.groupElements(slide.elements, params.elementIds, groupId);
|
|
1567
|
+
slide.elements = grouped.elements;
|
|
1586
1568
|
return {
|
|
1587
1569
|
pptxData: ctx.pptxData,
|
|
1588
1570
|
dirty: true,
|
|
1589
|
-
result: { groupId }
|
|
1571
|
+
result: { groupId: grouped.groupId ?? groupId }
|
|
1590
1572
|
};
|
|
1591
1573
|
}
|
|
1592
1574
|
function ungroupElements(ctx, params) {
|
|
@@ -1595,26 +1577,25 @@ function ungroupElements(ctx, params) {
|
|
|
1595
1577
|
throw new Error(err);
|
|
1596
1578
|
}
|
|
1597
1579
|
const slide = ctx.pptxData.slides[params.slideIndex];
|
|
1598
|
-
const
|
|
1599
|
-
if (
|
|
1580
|
+
const group = slide.elements.find((e) => e.id === params.groupElementId);
|
|
1581
|
+
if (!group) {
|
|
1600
1582
|
throw new Error(`Group element '${params.groupElementId}' not found.`);
|
|
1601
1583
|
}
|
|
1602
|
-
const group = slide.elements[groupIdx];
|
|
1603
1584
|
if (group.type !== "group") {
|
|
1604
1585
|
throw new Error(`Element '${params.groupElementId}' is not a group.`);
|
|
1605
1586
|
}
|
|
1606
|
-
const
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1587
|
+
const intoTemplate = pptxViewerCore.isTemplateElementId(group.id);
|
|
1588
|
+
const childIds = group.children.map(
|
|
1589
|
+
(child) => pptxViewerCore.isTemplateElementId(child.id) === intoTemplate ? child.id : pptxViewerCore.makeStoreAwareId(intoTemplate, group.id)
|
|
1590
|
+
);
|
|
1591
|
+
const promoted = pptxViewerCore.ungroupElements(slide.elements, params.groupElementId, childIds, {
|
|
1592
|
+
intoTemplate
|
|
1612
1593
|
});
|
|
1613
|
-
slide.elements
|
|
1594
|
+
slide.elements = promoted.elements;
|
|
1614
1595
|
return {
|
|
1615
1596
|
pptxData: ctx.pptxData,
|
|
1616
1597
|
dirty: true,
|
|
1617
|
-
result: { restoredIds:
|
|
1598
|
+
result: { restoredIds: promoted.childIds }
|
|
1618
1599
|
};
|
|
1619
1600
|
}
|
|
1620
1601
|
function batchUpdateElements(ctx, params) {
|
package/dist/mcp/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
3
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { validatePptx, repairPptx, PptxHandler, hasTextProperties, PptxMarkdownConverter, ThemePresets, getThemePreset, setChartType, setChartTitle, setChartGrouping, setChartLegend, setChartDataLabels, setChartAxis, setChartCategories, addChartSeries, removeChartSeries, updateChartSeriesValues, ChartBuilder, decomposeSmartArt, demoteSmartArtNode, promoteSmartArtNode, reorderSmartArtNode, updateSmartArtNodeText, removeSmartArtNode, addSmartArtNode, findPlaceholders, applyTemplate, getSectionForSlide, moveSlidesToSection, reorderSections, removeSection, addSection, SvgExporter, buildPptxJsonDocument, deserializePptxFromJson, applyImportedPptxData, replaceWithCustomGeometry, replaceShapeGeometry, setElementLocked, findLayoutByName, findLayoutByType } from 'pptx-viewer-core';
|
|
5
|
+
import { validatePptx, repairPptx, PptxHandler, hasTextProperties, cloneElement as cloneElement$1, isTemplateElementId, makeStoreAwareId, reassignDescendantIds, groupElements as groupElements$1, ungroupElements as ungroupElements$1, PptxMarkdownConverter, ThemePresets, getThemePreset, setChartType, setChartTitle, setChartGrouping, setChartLegend, setChartDataLabels, setChartAxis, setChartCategories, addChartSeries, removeChartSeries, updateChartSeriesValues, ChartBuilder, decomposeSmartArt, demoteSmartArtNode, promoteSmartArtNode, reorderSmartArtNode, updateSmartArtNodeText, removeSmartArtNode, addSmartArtNode, findPlaceholders, applyTemplate, getSectionForSlide, moveSlidesToSection, reorderSections, removeSection, addSection, SvgExporter, buildPptxJsonDocument, deserializePptxFromJson, applyImportedPptxData, replaceWithCustomGeometry, replaceShapeGeometry, setElementLocked, findLayoutByName, findLayoutByType } from 'pptx-viewer-core';
|
|
6
6
|
import { writeFile, readFile } from 'fs/promises';
|
|
7
7
|
import { resolve, isAbsolute, sep } from 'path';
|
|
8
8
|
|
|
@@ -1483,8 +1483,10 @@ function cloneElement(ctx, params) {
|
|
|
1483
1483
|
if (terr) {
|
|
1484
1484
|
throw new Error(terr);
|
|
1485
1485
|
}
|
|
1486
|
-
const clone =
|
|
1487
|
-
|
|
1486
|
+
const clone = cloneElement$1(original);
|
|
1487
|
+
const intoTemplate = isTemplateElementId(original.id);
|
|
1488
|
+
clone.id = makeStoreAwareId(intoTemplate, original.id);
|
|
1489
|
+
reassignDescendantIds(clone, () => makeStoreAwareId(intoTemplate, original.id));
|
|
1488
1490
|
clone.x += offsetX;
|
|
1489
1491
|
clone.y += offsetY;
|
|
1490
1492
|
ctx.pptxData.slides[targetIdx].elements.push(clone);
|
|
@@ -1553,38 +1555,18 @@ function groupElements(ctx, params) {
|
|
|
1553
1555
|
}
|
|
1554
1556
|
const slide = ctx.pptxData.slides[params.slideIndex];
|
|
1555
1557
|
const idSet = new Set(params.elementIds);
|
|
1556
|
-
const
|
|
1557
|
-
if (
|
|
1558
|
-
const
|
|
1559
|
-
const missing = params.elementIds.filter((id) => !childIds.has(id));
|
|
1558
|
+
const found = new Set(slide.elements.filter((e) => idSet.has(e.id)).map((e) => e.id));
|
|
1559
|
+
if (found.size !== idSet.size) {
|
|
1560
|
+
const missing = params.elementIds.filter((id) => !found.has(id));
|
|
1560
1561
|
throw new Error(`Elements not found: ${missing.join(", ")}`);
|
|
1561
1562
|
}
|
|
1562
|
-
const minX = Math.min(...children.map((e) => e.x));
|
|
1563
|
-
const minY = Math.min(...children.map((e) => e.y));
|
|
1564
|
-
const maxX = Math.max(...children.map((e) => e.x + e.width));
|
|
1565
|
-
const maxY = Math.max(...children.map((e) => e.y + e.height));
|
|
1566
|
-
const localChildren = children.map((e) => {
|
|
1567
|
-
const c = structuredClone(e);
|
|
1568
|
-
c.x -= minX;
|
|
1569
|
-
c.y -= minY;
|
|
1570
|
-
return c;
|
|
1571
|
-
});
|
|
1572
|
-
slide.elements = slide.elements.filter((e) => !idSet.has(e.id));
|
|
1573
1563
|
const groupId = generateElementId();
|
|
1574
|
-
const
|
|
1575
|
-
|
|
1576
|
-
type: "group",
|
|
1577
|
-
x: minX,
|
|
1578
|
-
y: minY,
|
|
1579
|
-
width: maxX - minX,
|
|
1580
|
-
height: maxY - minY,
|
|
1581
|
-
children: localChildren
|
|
1582
|
-
};
|
|
1583
|
-
slide.elements.push(group);
|
|
1564
|
+
const grouped = groupElements$1(slide.elements, params.elementIds, groupId);
|
|
1565
|
+
slide.elements = grouped.elements;
|
|
1584
1566
|
return {
|
|
1585
1567
|
pptxData: ctx.pptxData,
|
|
1586
1568
|
dirty: true,
|
|
1587
|
-
result: { groupId }
|
|
1569
|
+
result: { groupId: grouped.groupId ?? groupId }
|
|
1588
1570
|
};
|
|
1589
1571
|
}
|
|
1590
1572
|
function ungroupElements(ctx, params) {
|
|
@@ -1593,26 +1575,25 @@ function ungroupElements(ctx, params) {
|
|
|
1593
1575
|
throw new Error(err);
|
|
1594
1576
|
}
|
|
1595
1577
|
const slide = ctx.pptxData.slides[params.slideIndex];
|
|
1596
|
-
const
|
|
1597
|
-
if (
|
|
1578
|
+
const group = slide.elements.find((e) => e.id === params.groupElementId);
|
|
1579
|
+
if (!group) {
|
|
1598
1580
|
throw new Error(`Group element '${params.groupElementId}' not found.`);
|
|
1599
1581
|
}
|
|
1600
|
-
const group = slide.elements[groupIdx];
|
|
1601
1582
|
if (group.type !== "group") {
|
|
1602
1583
|
throw new Error(`Element '${params.groupElementId}' is not a group.`);
|
|
1603
1584
|
}
|
|
1604
|
-
const
|
|
1605
|
-
const
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1585
|
+
const intoTemplate = isTemplateElementId(group.id);
|
|
1586
|
+
const childIds = group.children.map(
|
|
1587
|
+
(child) => isTemplateElementId(child.id) === intoTemplate ? child.id : makeStoreAwareId(intoTemplate, group.id)
|
|
1588
|
+
);
|
|
1589
|
+
const promoted = ungroupElements$1(slide.elements, params.groupElementId, childIds, {
|
|
1590
|
+
intoTemplate
|
|
1610
1591
|
});
|
|
1611
|
-
slide.elements
|
|
1592
|
+
slide.elements = promoted.elements;
|
|
1612
1593
|
return {
|
|
1613
1594
|
pptxData: ctx.pptxData,
|
|
1614
1595
|
dirty: true,
|
|
1615
|
-
result: { restoredIds:
|
|
1596
|
+
result: { restoredIds: promoted.childIds }
|
|
1616
1597
|
};
|
|
1617
1598
|
}
|
|
1618
1599
|
function batchUpdateElements(ctx, params) {
|