pptx-react-viewer 1.1.48 → 1.1.49

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.mjs.br CHANGED
Binary file
package/dist/index.mjs.gz CHANGED
Binary file
@@ -784,6 +784,14 @@ interface IPptxHandlerRuntime {
784
784
  * @returns Array of layout options belonging to the same slide master.
785
785
  */
786
786
  getAvailableLayoutsForSlide(slideIndex: number, slides: l[]): Promise<o[]>;
787
+ /**
788
+ * Resolve the editable template (master + layout) elements a slide
789
+ * inherits, each carrying a `master-` / `layout-` prefixed id. Excludes
790
+ * placeholders; returns only decorative shapes/pictures/graphic frames.
791
+ *
792
+ * @param slideId - The slide's archive path (`PptxSlide.id`).
793
+ */
794
+ getTemplateElementsForSlide(slideId: string): Promise<P[]>;
787
795
  /**
788
796
  * Scan the loaded PPTX archive for all theme parts.
789
797
  */
@@ -1191,6 +1199,37 @@ declare class PptxHandlerCore {
1191
1199
  * ```
1192
1200
  */
1193
1201
  getAvailableLayoutsForSlide(slideIndex: number, slides: l[]): Promise<o[]>;
1202
+ /**
1203
+ * Resolve the editable template (master + layout) elements a slide
1204
+ * inherits, each carrying a `master-` / `layout-` prefixed id.
1205
+ *
1206
+ * This is the foundation for an "edit template/master" feature. The
1207
+ * returned elements are the decorative master/layout shapes the loader
1208
+ * already merges behind slide-authored content (master shapes behind,
1209
+ * layout shapes on top); placeholders are excluded. The same elements are
1210
+ * shared by every slide inheriting the layout/master, so editing one and
1211
+ * saving updates the shared part.
1212
+ *
1213
+ * To persist an edit, keep the mutated template element inside the
1214
+ * `slide.elements` array passed to {@link save}; the save writer reads
1215
+ * template elements from there and writes their shape XML back into the
1216
+ * owning layout/master `p:spTree`.
1217
+ *
1218
+ * @param slideId - The slide's archive path (the `PptxSlide.id`).
1219
+ * @returns Master + layout elements with prefixed ids (may be empty).
1220
+ *
1221
+ * @example
1222
+ * ```ts
1223
+ * const templateEls = await handler.getTemplateElementsForSlide(slide.id);
1224
+ * const logo = templateEls.find((e) => e.id.startsWith("master-"));
1225
+ * if (logo) {
1226
+ * logo.x += 10;
1227
+ * slide.elements = [...slide.elements, logo];
1228
+ * await handler.save(data.slides);
1229
+ * }
1230
+ * ```
1231
+ */
1232
+ getTemplateElementsForSlide(slideId: string): Promise<P[]>;
1194
1233
  /**
1195
1234
  * Apply a different layout to an existing slide.
1196
1235
  *
@@ -784,6 +784,14 @@ interface IPptxHandlerRuntime {
784
784
  * @returns Array of layout options belonging to the same slide master.
785
785
  */
786
786
  getAvailableLayoutsForSlide(slideIndex: number, slides: l[]): Promise<o[]>;
787
+ /**
788
+ * Resolve the editable template (master + layout) elements a slide
789
+ * inherits, each carrying a `master-` / `layout-` prefixed id. Excludes
790
+ * placeholders; returns only decorative shapes/pictures/graphic frames.
791
+ *
792
+ * @param slideId - The slide's archive path (`PptxSlide.id`).
793
+ */
794
+ getTemplateElementsForSlide(slideId: string): Promise<P[]>;
787
795
  /**
788
796
  * Scan the loaded PPTX archive for all theme parts.
789
797
  */
@@ -1191,6 +1199,37 @@ declare class PptxHandlerCore {
1191
1199
  * ```
1192
1200
  */
1193
1201
  getAvailableLayoutsForSlide(slideIndex: number, slides: l[]): Promise<o[]>;
1202
+ /**
1203
+ * Resolve the editable template (master + layout) elements a slide
1204
+ * inherits, each carrying a `master-` / `layout-` prefixed id.
1205
+ *
1206
+ * This is the foundation for an "edit template/master" feature. The
1207
+ * returned elements are the decorative master/layout shapes the loader
1208
+ * already merges behind slide-authored content (master shapes behind,
1209
+ * layout shapes on top); placeholders are excluded. The same elements are
1210
+ * shared by every slide inheriting the layout/master, so editing one and
1211
+ * saving updates the shared part.
1212
+ *
1213
+ * To persist an edit, keep the mutated template element inside the
1214
+ * `slide.elements` array passed to {@link save}; the save writer reads
1215
+ * template elements from there and writes their shape XML back into the
1216
+ * owning layout/master `p:spTree`.
1217
+ *
1218
+ * @param slideId - The slide's archive path (the `PptxSlide.id`).
1219
+ * @returns Master + layout elements with prefixed ids (may be empty).
1220
+ *
1221
+ * @example
1222
+ * ```ts
1223
+ * const templateEls = await handler.getTemplateElementsForSlide(slide.id);
1224
+ * const logo = templateEls.find((e) => e.id.startsWith("master-"));
1225
+ * if (logo) {
1226
+ * logo.x += 10;
1227
+ * slide.elements = [...slide.elements, logo];
1228
+ * await handler.save(data.slides);
1229
+ * }
1230
+ * ```
1231
+ */
1232
+ getTemplateElementsForSlide(slideId: string): Promise<P[]>;
1194
1233
  /**
1195
1234
  * Apply a different layout to an existing slide.
1196
1235
  *