ooxml-core 1.19.1 → 1.20.0
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/README.md +12 -1
- package/dist/{PptxHandler-2V4PQL6O.mjs → PptxHandler-FYD7IYXT.mjs} +2 -2
- package/dist/PptxHandler-SITN3K3F.mjs +4 -0
- package/dist/{PptxHandler-6TNIQ7S5.cjs → PptxHandler-TEKISCJO.cjs} +3 -3
- package/dist/{PresentationBuilder-HQ6C7L4V.mjs → PresentationBuilder-EYI6Z2JP.mjs} +2 -2
- package/dist/{PresentationBuilder-G7MPEGXJ.mjs → PresentationBuilder-IMB4DVRN.mjs} +2 -2
- package/dist/{PresentationBuilder-RM52LCVN.cjs → PresentationBuilder-NCKASKXU.cjs} +5 -5
- package/dist/automation/index.cjs +424 -90
- package/dist/automation/index.mjs +423 -91
- package/dist/automation/xlsx-read.d.ts +56 -0
- package/dist/automation/xlsx-read.d.ts.map +1 -0
- package/dist/automation/xlsx.d.ts +105 -4
- package/dist/automation/xlsx.d.ts.map +1 -1
- package/dist/{chunk-M6GDBVQ7.mjs → chunk-GQYQQ3GA.mjs} +1 -1
- package/dist/{chunk-SLNQNVQM.mjs → chunk-LEV2SVMK.mjs} +1 -1
- package/dist/{chunk-JUABSM7C.mjs → chunk-LVM3IZJ2.mjs} +1 -1
- package/dist/{chunk-TJPUAUWL.mjs → chunk-MN27HKHM.mjs} +8 -194
- package/dist/{chunk-4FTUAD2B.mjs → chunk-MNXKRXFB.mjs} +715 -200
- package/dist/{chunk-R5FIHHGB.cjs → chunk-NXKATFM5.cjs} +1598 -1204
- package/dist/{chunk-ZJ2OKIJN.mjs → chunk-WXY5EDGT.mjs} +592 -198
- package/dist/docx/embedded.cjs +4 -1
- package/dist/docx/embedded.mjs +4 -1
- package/dist/docx/index.cjs +4 -1
- package/dist/docx/index.mjs +4 -1
- package/dist/docx/load/index.cjs +4 -1
- package/dist/docx/load/index.mjs +4 -1
- package/dist/docx/write-table.d.ts.map +1 -1
- package/dist/index.cjs +25 -0
- package/dist/index.mjs +25 -0
- package/dist/pptx/automation/index.cjs +887 -453
- package/dist/pptx/automation/index.d.ts +2 -2
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-Bqm-jFG-.d.ts → index-CgFX0T7b.d.ts} +7573 -7508
- package/dist/pptx/chunks/index-CgFX0T7b.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-B9x557hr.d.ts → index-qwVYoFn6.d.ts} +2 -2
- package/dist/pptx/chunks/{index-B9x557hr.d.ts.map → index-qwVYoFn6.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +654 -221
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/index.cjs +991 -619
- package/dist/pptx/index.d.ts +3 -3
- package/dist/pptx/index.mjs +5 -5
- package/dist/visio/index.cjs +61 -7
- package/dist/visio/index.mjs +61 -7
- package/dist/visio/ui/contract.d.ts +2 -1
- package/dist/visio/ui/contract.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +62 -7
- package/dist/visio/ui/index.mjs +62 -7
- package/dist/xlsx/edit/dimensions.d.ts.map +1 -1
- package/dist/xlsx/edit/history-rows.d.ts +7 -0
- package/dist/xlsx/edit/history-rows.d.ts.map +1 -0
- package/dist/xlsx/edit/history.d.ts +11 -1
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/outline.d.ts.map +1 -1
- package/dist/xlsx/edit/row-autofit.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +235 -54
- package/dist/xlsx/index.mjs +235 -54
- package/dist/xlsx/layout/merge-sweep.d.ts +36 -0
- package/dist/xlsx/layout/merge-sweep.d.ts.map +1 -0
- package/dist/xlsx/layout/metrics.d.ts +5 -0
- package/dist/xlsx/layout/metrics.d.ts.map +1 -1
- package/dist/xlsx/layout/row-autofit.d.ts +6 -0
- package/dist/xlsx/layout/row-autofit.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +61 -7
- package/dist/xlsx/load/index.mjs +61 -7
- package/dist/xlsx/numfmt/format.d.ts +8 -0
- package/dist/xlsx/numfmt/format.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-data-source.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +281 -55
- package/dist/xlsx/ui/index.d.ts +1 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +281 -56
- package/dist/xlsx/ui/selection-format.d.ts +13 -0
- package/dist/xlsx/ui/selection-format.d.ts.map +1 -0
- package/dist/xml/index.cjs +25 -0
- package/dist/xml/index.mjs +25 -0
- package/dist/xml/lite.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/PptxHandler-HSPKEP5E.mjs +0 -4
- package/dist/pptx/chunks/index-Bqm-jFG-.d.ts.map +0 -1
- /package/dist/{chunk-NYTR4UZ5.cjs → chunk-3IENHIFD.cjs} +0 -0
- /package/dist/{chunk-XTSHZGSM.mjs → chunk-CC5UNZOO.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NS, SMART_ART_DEFINITION_PARTS, VML_SHAPE_TAGS, isAlternateContentChoiceXmlSupported, parseVmlElement, unwrapAlternateContent, xmlChild, xmlAttr, parseDrawingMediaReference, cropShapeForPresetGeometry, isHeaderFooterPlaceholder, xmlPath, inheritedPlaceholderFieldType, parseParagraphLevel, xmlHasChild, parseParagraphExtraAttributes, parseParagraphMargins, parseAlignmentAttr, parseParagraphRtl, parseTabStops, resolveParagraphAlignment, xmlText, parseBodyPrBooleanAttrs, selectAlternateContentBranch, parseBulletSizePercent, extractColorChoiceXml, themeColorRefFromColorChoice, formatAutoNumberMarker, cloneXmlObject, parseParagraphSpacingPx, parseOoxmlPercent, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, orderedPathCommandEntries, ooxmlArcToSvg, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, remapElementShapeIds, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, openPptxZip, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, orderedXmlKey, safeResolveZipPath, parseXml, elements, parseDataUrlToBytes, base64Decode, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER, ensureXmlChild, inkElementToStrokes, buildInkMlContent, ensureXmlChildOrCreate, isXmlNode, applyChartLayouts, stripXmlOrderSuffix, serializeTabStop, colorsEqual, generateFontGuid, applyBubbleChartOptions, applyChartUpDownBars, applyDataLabelsRangeToDLbls, applyChartAxisScaling, applyChartAxisLabelFormatting, upsertChartAxisChild, applyChartDateAxisUnits, applyChartAxisDisplayUnitsToXml, writeChartShapeProps, resolveTxPrDefRPr, buildDefRPrTextProperties, buildChartGradFillXml, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, applyChartManualLayout, chartTrendlineType, buildTrendlineLabel, serializeColorChoice, replaceOleEmbedding, findKey, collectAllText, buildNodeGuidMap, buildPresentationGuidMap, regenerateSmartArtDrawingShapes, buildFabricatedDrawingXml, buildFabricatedDiagramDataXml, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, applyDiagramRelationshipIds, applyDrawingMediaReference, XML_PROLOG, DGM_XMLNS, xmlEscape, writeBodyPrBooleanAttrs, applyTextBodySp3d, customGeometryPathsToXml, ensureArrayValue, lookupPresetShape, writeShapeEffects, SHAPE_STYLE_ORDER, roundCoordinate, scaleVectorToIntegers, P14_GUIDE_URI, P15_GUIDE_URI, buildGuideListExtension, resetSpPrFormattingForStyleMatrix, restorePathListCommandOrder, fillIsPurelyStyleMatrix, serializeColorChoiceWithRef, createLineStyleGate, applyDrawingLineDash, getSignaturePathsToStrip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, mergeSmartArtPointXml, mergeSmartArtConnectionXml, applySmartArtLayoutDefinition, obfuscateFont, containsConvertibleStrictNamespaceAttribute, convertXmlToStrict, applySeriesPictureOptionsToXml, findChartExtByUri, findChildByLocalName, regenerateClonedUniqueId, buildChartUniqueIdExtLst, createOfficeGuid, isContentPoint, newSmartArtGuid, parseChartUserShapesDrawing, DEFAULT_ROW_HEIGHT_EMU, createDefaultXmlCell, xmlChildren, applyChartGradientToSpPr, setAutoTitleDeleted, insertAt, replaceFirstText, shouldRebuildFromParagraphs, buildPointFromParagraphs, shouldRebuildFromRuns, buildPointFromRuns, buildPointText, tableCellTextBodyMatches, ensureXmlChildren, TC_PR_BORDERS_ORDER, writeChartColorChoice, openNestedZip, stripParentDirSegments, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, preservesSpreadsheetXmlWhitespace, buildEffectDagTreeFromXml, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, fetchUrlToBytes, parseChartWideTextStyle, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, first, children, ooxmlGradientAngleToCssDegrees, isAlternateContentChoiceSupported, detectStrictConformance, normalizeStrictXml, relayoutSmartArt, themeColorRefToSolidFillWithOpacity, FONT_ADVANCE_TABLES, DEFAULT_FONT_ADVANCE_TABLE, measureTextWidth, applyDrawingColorTransforms, applyThemeToData, detectFileFormat, parseOle2, EncryptedFileError, decryptPptx, encryptPptx, encodeXmlAttributeValue, encodeXmlTextValue, svgToCustomGeometryPaths, IncorrectPasswordError, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, supportsChartGradientFill, DEFAULT_CHART_GRADIENT_ANGLE,
|
|
1
|
+
import { NS, SMART_ART_DEFINITION_PARTS, VML_SHAPE_TAGS, isAlternateContentChoiceXmlSupported, parseVmlElement, unwrapAlternateContent, xmlChild, xmlAttr, parseDrawingMediaReference, cropShapeForPresetGeometry, isHeaderFooterPlaceholder, xmlPath, inheritedPlaceholderFieldType, parseParagraphLevel, xmlHasChild, parseParagraphExtraAttributes, parseParagraphMargins, parseAlignmentAttr, parseParagraphRtl, parseTabStops, resolveParagraphAlignment, xmlText, parseBodyPrBooleanAttrs, selectAlternateContentBranch, parseBulletSizePercent, extractColorChoiceXml, themeColorRefFromColorChoice, formatAutoNumberMarker, cloneXmlObject, parseParagraphSpacingPx, parseOoxmlPercent, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, orderedPathCommandEntries, ooxmlArcToSvg, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, remapElementShapeIds, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, openPptxZip, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, orderedXmlKey, safeResolveZipPath, parseXml, elements, parseDataUrlToBytes, base64Decode, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER, ensureXmlChild, inkElementToStrokes, buildInkMlContent, ensureXmlChildOrCreate, isXmlNode, applyChartLayouts, stripXmlOrderSuffix, serializeTabStop, colorsEqual, generateFontGuid, applyBubbleChartOptions, applyChartUpDownBars, applyDataLabelsRangeToDLbls, applyChartAxisScaling, applyChartAxisLabelFormatting, upsertChartAxisChild, applyChartDateAxisUnits, applyChartAxisDisplayUnitsToXml, writeChartShapeProps, resolveTxPrDefRPr, buildDefRPrTextProperties, buildChartGradFillXml, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, applyChartManualLayout, chartTrendlineType, buildTrendlineLabel, serializeColorChoice, replaceOleEmbedding, findKey, collectAllText, buildNodeGuidMap, buildPresentationGuidMap, regenerateSmartArtDrawingShapes, buildFabricatedDrawingXml, buildFabricatedDiagramDataXml, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, applyDiagramRelationshipIds, applyDrawingMediaReference, XML_PROLOG, DGM_XMLNS, xmlEscape, writeBodyPrBooleanAttrs, applyTextBodySp3d, customGeometryPathsToXml, ensureArrayValue, lookupPresetShape, writeShapeEffects, SHAPE_STYLE_ORDER, roundCoordinate, scaleVectorToIntegers, P14_GUIDE_URI, P15_GUIDE_URI, buildGuideListExtension, resetSpPrFormattingForStyleMatrix, restorePathListCommandOrder, fillIsPurelyStyleMatrix, serializeColorChoiceWithRef, createLineStyleGate, applyDrawingLineDash, getSignaturePathsToStrip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, mergeSmartArtPointXml, mergeSmartArtConnectionXml, applySmartArtLayoutDefinition, obfuscateFont, containsConvertibleStrictNamespaceAttribute, convertXmlToStrict, applySeriesPictureOptionsToXml, findChartExtByUri, findChildByLocalName, regenerateClonedUniqueId, buildChartUniqueIdExtLst, createOfficeGuid, isContentPoint, newSmartArtGuid, parseChartUserShapesDrawing, DEFAULT_ROW_HEIGHT_EMU, createDefaultXmlCell, xmlChildren, applyChartGradientToSpPr, setAutoTitleDeleted, insertAt, replaceFirstText, shouldRebuildFromParagraphs, buildPointFromParagraphs, shouldRebuildFromRuns, buildPointFromRuns, buildPointText, tableCellTextBodyMatches, ensureXmlChildren, TC_PR_BORDERS_ORDER, writeChartColorChoice, openNestedZip, stripParentDirSegments, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, preservesSpreadsheetXmlWhitespace, buildEffectDagTreeFromXml, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, fetchUrlToBytes, parseChartWideTextStyle, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, first, children, ooxmlGradientAngleToCssDegrees, isAlternateContentChoiceSupported, detectStrictConformance, normalizeStrictXml, relayoutSmartArt, themeColorRefToSolidFillWithOpacity, FONT_ADVANCE_TABLES, DEFAULT_FONT_ADVANCE_TABLE, measureTextWidth, applyDrawingColorTransforms, applyThemeToData, detectFileFormat, parseOle2, EncryptedFileError, decryptPptx, encryptPptx, encodeXmlAttributeValue, encodeXmlTextValue, svgToCustomGeometryPaths, IncorrectPasswordError, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, supportsChartGradientFill, DEFAULT_CHART_GRADIENT_ANGLE, decodeXmlEntities, preservesXmlWhitespace, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, stripXmlOrderMarkers, normalizeStShapeType, applyCustomShows, applySections, reorderObjectKeysByLocalName, PRESENTATION_CHILD_ORDER, applyKinsokuToXml, normalizeNamespaceUri, backgroundStyleRefIsCurrent, backgroundRefNode, captureStyleBaseline, STYLE_MATRIX_FILL_KEYS, STYLE_MATRIX_LINE_KEYS, STYLE_MATRIX_EFFECT_KEYS, detectOleObjectType, inferOleExtensionFromTarget, backgroundStylePreset, isDarkColorMap, backgroundStyleColorMap, reResolveElementsForColorMapChange, deriveSlideTitles, parseP14DirectChild, parseP14FromExtLst, P14_TRANSITION_TYPES, parseSlideDrawingGuides, slideBackgroundStyleRefFromNode, cloneSlide, parseDrawingFraction, scrgbLinearToSrgb8, parseDrawingHueDegrees, hslToRgb, themeColorRefToXml, effectChild, mergeEffectNode, mergeAttributeEffectNode, findThemeEffectScheme, wrapFormatSchemeXml, effectIsPurelyStyleMatrix, prismFamilyFlags, prismFamilyTypeOfNode, prismFamilyTypeForFlags, P14_DIR_IS_ORIENTATION_TYPE, estimateMediaDurationMs, parseVmlElements, parseDrawingLineDash, parseLineSpacingMultiplier, parseLineSpacingExactPt, loadThemeVariants, parsePresentationDrawingGuides, parsePresentationSmartTags, resolveLayoutDisplayName, DEFAULT_MAX_UNCOMPRESSED_BYTES, guardZip, ZipBombError, MAX_ZIP_ENTRY_COUNT, detectDigitalSignatures, unwrapOleEmbedding, mimeTypeForOleFile, oleBytesToDataUrl, themeColorRefFromSchemeClr, extractGuidFromPartName, deobfuscateFont, detectFontFormat, parseKinsoku, parseLineStyle, parseChartUpDownBars, parseDataTable, parseChart3DSurfaces, parseChartAxes, parseBubbleChartOptions, parseChartLayouts, parseCxChartSeries, parseChartDataPointPictureBlipRel, parseSeriesDataPoints, parseMarker, parseSeriesDataLabels, parseChartDataPointPicture, parseImplicitBlipPictureFill, parseEmbeddedXlsx, relAttr, buildXml, chartTrendlineKind, parseChartManualLayout, parseDiagramRelationshipIds, parseSmartArtTextParagraphs, firstParagraphRuns, smartArtParagraphsText, parseSmartArtLayoutDefinition, parseSmartArtPresLayoutVars, readChartManualLayoutValues, parseSmartArtConnection, projectSmartArtNodeText, resolveSmartArtNodeStyleRoles, resolveSmartArtNodeCoherent3DOff, parseSmartArtDefinitionMetadata, parseSmartArtColorStyleLabels, buildSmartArtColorLists, buildSmartArtColorRoleMap, parseSmartArtQuickStyleLabels, resolveSmartArtEffectIntensity, parseSmartArtStyleLabelRefs, extractStyleReferenceColorXml, withThemePlaceholderColor, blendColorOntoWhite, CHART_ERROR_VALUE_TYPES, CHART_ERROR_BAR_TYPES, CHART_ERROR_BAR_DIRECTIONS } from './chunk-CC5UNZOO.mjs';
|
|
2
2
|
import { hasShapeProperties, hasTextProperties } from './chunk-GXHKNSZX.mjs';
|
|
3
3
|
import { EMU_PER_PX, EMU_PER_PIXEL, SYSTEM_COLOR_MAP, PRESET_COLOR_MAP, OOXML_PERCENT_UNITS, EMU_PER_POINT } from './chunk-CA7KCNL3.mjs';
|
|
4
4
|
import JSZip from 'jszip';
|
|
@@ -4329,6 +4329,153 @@ function materializeInheritedShapeTransform(shape, element) {
|
|
|
4329
4329
|
return transform2;
|
|
4330
4330
|
}
|
|
4331
4331
|
|
|
4332
|
+
// pptx/core/utils/placeholder-xml.ts
|
|
4333
|
+
function findNonVisualProps(rawXml) {
|
|
4334
|
+
for (const container of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
|
|
4335
|
+
const parent = rawXml[container];
|
|
4336
|
+
const nvPr = parent?.["p:nvPr"];
|
|
4337
|
+
if (nvPr) {
|
|
4338
|
+
return nvPr;
|
|
4339
|
+
}
|
|
4340
|
+
}
|
|
4341
|
+
return void 0;
|
|
4342
|
+
}
|
|
4343
|
+
function retargetPlaceholder(rawXml, target) {
|
|
4344
|
+
const nvPr = findNonVisualProps(rawXml);
|
|
4345
|
+
if (!nvPr) {
|
|
4346
|
+
return;
|
|
4347
|
+
}
|
|
4348
|
+
const ph = nvPr["p:ph"] ?? {};
|
|
4349
|
+
nvPr["p:ph"] = ph;
|
|
4350
|
+
if (target.type) {
|
|
4351
|
+
ph["@_type"] = target.type;
|
|
4352
|
+
} else {
|
|
4353
|
+
delete ph["@_type"];
|
|
4354
|
+
}
|
|
4355
|
+
if (target.idx !== void 0) {
|
|
4356
|
+
ph["@_idx"] = target.idx;
|
|
4357
|
+
} else {
|
|
4358
|
+
delete ph["@_idx"];
|
|
4359
|
+
}
|
|
4360
|
+
}
|
|
4361
|
+
function setRawXmlTransform(rawXml, xEmu, yEmu, cxEmu, cyEmu) {
|
|
4362
|
+
const spPr = rawXml["p:spPr"];
|
|
4363
|
+
if (!spPr) {
|
|
4364
|
+
return;
|
|
4365
|
+
}
|
|
4366
|
+
const xfrm = spPr["a:xfrm"] ?? {};
|
|
4367
|
+
spPr["a:xfrm"] = xfrm;
|
|
4368
|
+
const off = xfrm["a:off"] ?? {};
|
|
4369
|
+
xfrm["a:off"] = off;
|
|
4370
|
+
off["@_x"] = String(xEmu);
|
|
4371
|
+
off["@_y"] = String(yEmu);
|
|
4372
|
+
const ext = xfrm["a:ext"] ?? {};
|
|
4373
|
+
xfrm["a:ext"] = ext;
|
|
4374
|
+
ext["@_cx"] = String(cxEmu);
|
|
4375
|
+
ext["@_cy"] = String(cyEmu);
|
|
4376
|
+
}
|
|
4377
|
+
function createEmptyPlaceholderElement(target, xEmu, yEmu, cxEmu, cyEmu, uniqueId) {
|
|
4378
|
+
if (cxEmu <= 0 || cyEmu <= 0) {
|
|
4379
|
+
return null;
|
|
4380
|
+
}
|
|
4381
|
+
const phNode = {};
|
|
4382
|
+
if (target.type) {
|
|
4383
|
+
phNode["@_type"] = target.type;
|
|
4384
|
+
}
|
|
4385
|
+
if (target.idx !== void 0) {
|
|
4386
|
+
phNode["@_idx"] = target.idx;
|
|
4387
|
+
}
|
|
4388
|
+
const rawXml = {
|
|
4389
|
+
"p:nvSpPr": {
|
|
4390
|
+
"p:cNvPr": {
|
|
4391
|
+
"@_id": uniqueId,
|
|
4392
|
+
"@_name": `Placeholder ${target.type || "content"}`
|
|
4393
|
+
},
|
|
4394
|
+
"p:cNvSpPr": {
|
|
4395
|
+
"a:spLocks": { "@_noGrp": "1" }
|
|
4396
|
+
},
|
|
4397
|
+
"p:nvPr": {
|
|
4398
|
+
"p:ph": phNode
|
|
4399
|
+
}
|
|
4400
|
+
},
|
|
4401
|
+
"p:spPr": {
|
|
4402
|
+
"a:xfrm": {
|
|
4403
|
+
"a:off": { "@_x": String(xEmu), "@_y": String(yEmu) },
|
|
4404
|
+
"a:ext": { "@_cx": String(cxEmu), "@_cy": String(cyEmu) }
|
|
4405
|
+
}
|
|
4406
|
+
},
|
|
4407
|
+
"p:txBody": {
|
|
4408
|
+
"a:bodyPr": {},
|
|
4409
|
+
"a:lstStyle": {},
|
|
4410
|
+
"a:p": { "a:endParaRPr": { "@_lang": "en-US" } }
|
|
4411
|
+
}
|
|
4412
|
+
};
|
|
4413
|
+
return {
|
|
4414
|
+
type: "text",
|
|
4415
|
+
id: `ph-${target.type || "content"}-${target.idx ?? "0"}-${uniqueId}`,
|
|
4416
|
+
x: Math.round(xEmu / EMU_PER_PX),
|
|
4417
|
+
y: Math.round(yEmu / EMU_PER_PX),
|
|
4418
|
+
width: Math.round(cxEmu / EMU_PER_PX),
|
|
4419
|
+
height: Math.round(cyEmu / EMU_PER_PX),
|
|
4420
|
+
text: "",
|
|
4421
|
+
rawXml
|
|
4422
|
+
};
|
|
4423
|
+
}
|
|
4424
|
+
|
|
4425
|
+
// pptx/core/core/runtime/save-geometry-validation.ts
|
|
4426
|
+
var FRAME_FIELDS = ["x", "y", "width", "height"];
|
|
4427
|
+
var OPTIONAL_FIELDS = [
|
|
4428
|
+
"xEmu",
|
|
4429
|
+
"yEmu",
|
|
4430
|
+
"widthEmu",
|
|
4431
|
+
"heightEmu",
|
|
4432
|
+
"rotation",
|
|
4433
|
+
"skewX",
|
|
4434
|
+
"skewY",
|
|
4435
|
+
"chOffXEmu",
|
|
4436
|
+
"chOffYEmu",
|
|
4437
|
+
"chExtWidthEmu",
|
|
4438
|
+
"chExtHeightEmu"
|
|
4439
|
+
];
|
|
4440
|
+
function omitsInheritedFrame(element) {
|
|
4441
|
+
if (!["text", "shape", "picture", "media"].includes(element.type) || !element.rawXml)
|
|
4442
|
+
return false;
|
|
4443
|
+
if (!xmlHasChild(findNonVisualProps(element.rawXml), "p:ph")) return false;
|
|
4444
|
+
if (xmlHasChild(xmlChild(element.rawXml, "p:spPr"), "a:xfrm") || xmlHasChild(element.rawXml, "p:xfrm"))
|
|
4445
|
+
return false;
|
|
4446
|
+
const baseline = element.inheritedTransform;
|
|
4447
|
+
if (!baseline) return FRAME_FIELDS.every((key2) => element[key2] === void 0);
|
|
4448
|
+
return FRAME_FIELDS.every(
|
|
4449
|
+
(key2) => Number.isFinite(baseline[key2]) && (element[key2] === void 0 || element[key2] === baseline[key2])
|
|
4450
|
+
) && ["rotation", "skewX", "skewY", "flipHorizontal", "flipVertical"].every(
|
|
4451
|
+
(key2) => (element[key2] ?? 0) === (baseline[key2] ?? 0)
|
|
4452
|
+
);
|
|
4453
|
+
}
|
|
4454
|
+
function validateElementGeometry(element, context, emuPerPx = 9525) {
|
|
4455
|
+
const inherited = omitsInheritedFrame(element);
|
|
4456
|
+
const record2 = element;
|
|
4457
|
+
const fields = [...inherited ? [] : FRAME_FIELDS, ...OPTIONAL_FIELDS];
|
|
4458
|
+
for (const field of fields) {
|
|
4459
|
+
const value = record2[field];
|
|
4460
|
+
if (OPTIONAL_FIELDS.includes(field) && value === void 0) continue;
|
|
4461
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isFinite(value * emuPerPx)) {
|
|
4462
|
+
throw new Error(
|
|
4463
|
+
`${context}: element '${element.id}' (${element.name ?? "unnamed"}, type=${element.type}) has invalid ${field}=${String(value)}; expected a finite number`
|
|
4464
|
+
);
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4467
|
+
if (element.type === "group") {
|
|
4468
|
+
for (const child16 of element.children) validateElementGeometry(child16, context, emuPerPx);
|
|
4469
|
+
}
|
|
4470
|
+
}
|
|
4471
|
+
function validateSlideGeometry(slides) {
|
|
4472
|
+
for (const slide of slides) {
|
|
4473
|
+
for (const element of slide.elements) {
|
|
4474
|
+
validateElementGeometry(element, `Slide ${slide.slideNumber} (${slide.id})`);
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
4478
|
+
|
|
4332
4479
|
// pptx/core/core/builders/PptxElementTransformUpdater.ts
|
|
4333
4480
|
var PptxElementTransformUpdater = class {
|
|
4334
4481
|
applyTransform(shape, element, emuPerPx, enclosingGroupChildSpace) {
|
|
@@ -4337,6 +4484,7 @@ var PptxElementTransformUpdater = class {
|
|
|
4337
4484
|
if (!transform2) {
|
|
4338
4485
|
return;
|
|
4339
4486
|
}
|
|
4487
|
+
validateElementGeometry(element, "Transform writer", emuPerPx);
|
|
4340
4488
|
if (!transform2["a:off"]) {
|
|
4341
4489
|
transform2["a:off"] = {};
|
|
4342
4490
|
}
|
|
@@ -35491,6 +35639,75 @@ var PptxSaveConstantsFactory = class {
|
|
|
35491
35639
|
var defaultPptxSaveConstantsFactory = new PptxSaveConstantsFactory();
|
|
35492
35640
|
var createPptxSaveConstants = (conformance = "transitional") => defaultPptxSaveConstantsFactory.create(conformance);
|
|
35493
35641
|
|
|
35642
|
+
// pptx/core/utils/placeholder-remap.ts
|
|
35643
|
+
var TITLE_ROLE = /* @__PURE__ */ new Set(["title", "ctrtitle"]);
|
|
35644
|
+
var CONTENT_ROLE = /* @__PURE__ */ new Set([
|
|
35645
|
+
"body",
|
|
35646
|
+
"obj",
|
|
35647
|
+
"subtitle",
|
|
35648
|
+
"pic",
|
|
35649
|
+
"chart",
|
|
35650
|
+
"tbl",
|
|
35651
|
+
"media",
|
|
35652
|
+
"clipart",
|
|
35653
|
+
"dgm"
|
|
35654
|
+
]);
|
|
35655
|
+
function placeholderContentRole(type) {
|
|
35656
|
+
const declared = (type ?? "").trim().toLowerCase() || "body";
|
|
35657
|
+
if (TITLE_ROLE.has(declared)) {
|
|
35658
|
+
return "title";
|
|
35659
|
+
}
|
|
35660
|
+
if (CONTENT_ROLE.has(declared)) {
|
|
35661
|
+
return "content";
|
|
35662
|
+
}
|
|
35663
|
+
return declared;
|
|
35664
|
+
}
|
|
35665
|
+
function preferredPlaceholderTypes(element) {
|
|
35666
|
+
switch (element.type) {
|
|
35667
|
+
case "image":
|
|
35668
|
+
case "picture":
|
|
35669
|
+
return ["pic", "obj", "body"];
|
|
35670
|
+
case "chart":
|
|
35671
|
+
return ["chart", "obj", "body"];
|
|
35672
|
+
case "table":
|
|
35673
|
+
return ["tbl", "obj", "body"];
|
|
35674
|
+
case "media":
|
|
35675
|
+
case "model3d":
|
|
35676
|
+
return ["media", "pic", "obj", "body"];
|
|
35677
|
+
case "smartArt":
|
|
35678
|
+
return ["dgm", "obj", "body"];
|
|
35679
|
+
case "text":
|
|
35680
|
+
return ["body", "subtitle", "obj"];
|
|
35681
|
+
default:
|
|
35682
|
+
return ["obj", "body"];
|
|
35683
|
+
}
|
|
35684
|
+
}
|
|
35685
|
+
function scorePlaceholderMatch(element, source, target) {
|
|
35686
|
+
if (placeholderContentRole(source.type) !== placeholderContentRole(target.type)) {
|
|
35687
|
+
return -1;
|
|
35688
|
+
}
|
|
35689
|
+
const sourceType = normalizeType(source.type);
|
|
35690
|
+
const targetType = normalizeType(target.type);
|
|
35691
|
+
let score = 1;
|
|
35692
|
+
if (source.idx !== void 0 && source.idx === target.idx) {
|
|
35693
|
+
score += 100;
|
|
35694
|
+
}
|
|
35695
|
+
if (sourceType === targetType) {
|
|
35696
|
+
score += 50;
|
|
35697
|
+
}
|
|
35698
|
+
const preferred = preferredPlaceholderTypes(element).indexOf(targetType);
|
|
35699
|
+
if (preferred >= 0) {
|
|
35700
|
+
score += 30 - preferred * 5;
|
|
35701
|
+
}
|
|
35702
|
+
if (targetType === "obj") {
|
|
35703
|
+
score += 10;
|
|
35704
|
+
}
|
|
35705
|
+
return score;
|
|
35706
|
+
}
|
|
35707
|
+
function normalizeType(type) {
|
|
35708
|
+
return (type ?? "").trim().toLowerCase() || "body";
|
|
35709
|
+
}
|
|
35710
|
+
|
|
35494
35711
|
// pptx/core/core/runtime/master-save-helpers.ts
|
|
35495
35712
|
function applyHeaderFooterFlagsToNode(root, flags) {
|
|
35496
35713
|
if (!flags || Object.keys(flags).length === 0) {
|
|
@@ -53572,168 +53789,6 @@ function buildChartUserShapesDrawingXml(shapes) {
|
|
|
53572
53789
|
return { "c:userShapes": root };
|
|
53573
53790
|
}
|
|
53574
53791
|
|
|
53575
|
-
// pptx/core/utils/placeholder-remap.ts
|
|
53576
|
-
var TITLE_ROLE = /* @__PURE__ */ new Set(["title", "ctrtitle"]);
|
|
53577
|
-
var CONTENT_ROLE = /* @__PURE__ */ new Set([
|
|
53578
|
-
"body",
|
|
53579
|
-
"obj",
|
|
53580
|
-
"subtitle",
|
|
53581
|
-
"pic",
|
|
53582
|
-
"chart",
|
|
53583
|
-
"tbl",
|
|
53584
|
-
"media",
|
|
53585
|
-
"clipart",
|
|
53586
|
-
"dgm"
|
|
53587
|
-
]);
|
|
53588
|
-
function placeholderContentRole(type) {
|
|
53589
|
-
const declared = (type ?? "").trim().toLowerCase() || "body";
|
|
53590
|
-
if (TITLE_ROLE.has(declared)) {
|
|
53591
|
-
return "title";
|
|
53592
|
-
}
|
|
53593
|
-
if (CONTENT_ROLE.has(declared)) {
|
|
53594
|
-
return "content";
|
|
53595
|
-
}
|
|
53596
|
-
return declared;
|
|
53597
|
-
}
|
|
53598
|
-
function preferredPlaceholderTypes(element) {
|
|
53599
|
-
switch (element.type) {
|
|
53600
|
-
case "image":
|
|
53601
|
-
case "picture":
|
|
53602
|
-
return ["pic", "obj", "body"];
|
|
53603
|
-
case "chart":
|
|
53604
|
-
return ["chart", "obj", "body"];
|
|
53605
|
-
case "table":
|
|
53606
|
-
return ["tbl", "obj", "body"];
|
|
53607
|
-
case "media":
|
|
53608
|
-
case "model3d":
|
|
53609
|
-
return ["media", "pic", "obj", "body"];
|
|
53610
|
-
case "smartArt":
|
|
53611
|
-
return ["dgm", "obj", "body"];
|
|
53612
|
-
case "text":
|
|
53613
|
-
return ["body", "subtitle", "obj"];
|
|
53614
|
-
default:
|
|
53615
|
-
return ["obj", "body"];
|
|
53616
|
-
}
|
|
53617
|
-
}
|
|
53618
|
-
function scorePlaceholderMatch(element, source, target) {
|
|
53619
|
-
if (placeholderContentRole(source.type) !== placeholderContentRole(target.type)) {
|
|
53620
|
-
return -1;
|
|
53621
|
-
}
|
|
53622
|
-
const sourceType = normalizeType(source.type);
|
|
53623
|
-
const targetType = normalizeType(target.type);
|
|
53624
|
-
let score = 1;
|
|
53625
|
-
if (source.idx !== void 0 && source.idx === target.idx) {
|
|
53626
|
-
score += 100;
|
|
53627
|
-
}
|
|
53628
|
-
if (sourceType === targetType) {
|
|
53629
|
-
score += 50;
|
|
53630
|
-
}
|
|
53631
|
-
const preferred = preferredPlaceholderTypes(element).indexOf(targetType);
|
|
53632
|
-
if (preferred >= 0) {
|
|
53633
|
-
score += 30 - preferred * 5;
|
|
53634
|
-
}
|
|
53635
|
-
if (targetType === "obj") {
|
|
53636
|
-
score += 10;
|
|
53637
|
-
}
|
|
53638
|
-
return score;
|
|
53639
|
-
}
|
|
53640
|
-
function normalizeType(type) {
|
|
53641
|
-
return (type ?? "").trim().toLowerCase() || "body";
|
|
53642
|
-
}
|
|
53643
|
-
|
|
53644
|
-
// pptx/core/utils/placeholder-xml.ts
|
|
53645
|
-
function findNonVisualProps(rawXml) {
|
|
53646
|
-
for (const container of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
|
|
53647
|
-
const parent = rawXml[container];
|
|
53648
|
-
const nvPr = parent?.["p:nvPr"];
|
|
53649
|
-
if (nvPr) {
|
|
53650
|
-
return nvPr;
|
|
53651
|
-
}
|
|
53652
|
-
}
|
|
53653
|
-
return void 0;
|
|
53654
|
-
}
|
|
53655
|
-
function retargetPlaceholder(rawXml, target) {
|
|
53656
|
-
const nvPr = findNonVisualProps(rawXml);
|
|
53657
|
-
if (!nvPr) {
|
|
53658
|
-
return;
|
|
53659
|
-
}
|
|
53660
|
-
const ph = nvPr["p:ph"] ?? {};
|
|
53661
|
-
nvPr["p:ph"] = ph;
|
|
53662
|
-
if (target.type) {
|
|
53663
|
-
ph["@_type"] = target.type;
|
|
53664
|
-
} else {
|
|
53665
|
-
delete ph["@_type"];
|
|
53666
|
-
}
|
|
53667
|
-
if (target.idx !== void 0) {
|
|
53668
|
-
ph["@_idx"] = target.idx;
|
|
53669
|
-
} else {
|
|
53670
|
-
delete ph["@_idx"];
|
|
53671
|
-
}
|
|
53672
|
-
}
|
|
53673
|
-
function setRawXmlTransform(rawXml, xEmu, yEmu, cxEmu, cyEmu) {
|
|
53674
|
-
const spPr = rawXml["p:spPr"];
|
|
53675
|
-
if (!spPr) {
|
|
53676
|
-
return;
|
|
53677
|
-
}
|
|
53678
|
-
const xfrm = spPr["a:xfrm"] ?? {};
|
|
53679
|
-
spPr["a:xfrm"] = xfrm;
|
|
53680
|
-
const off = xfrm["a:off"] ?? {};
|
|
53681
|
-
xfrm["a:off"] = off;
|
|
53682
|
-
off["@_x"] = String(xEmu);
|
|
53683
|
-
off["@_y"] = String(yEmu);
|
|
53684
|
-
const ext = xfrm["a:ext"] ?? {};
|
|
53685
|
-
xfrm["a:ext"] = ext;
|
|
53686
|
-
ext["@_cx"] = String(cxEmu);
|
|
53687
|
-
ext["@_cy"] = String(cyEmu);
|
|
53688
|
-
}
|
|
53689
|
-
function createEmptyPlaceholderElement(target, xEmu, yEmu, cxEmu, cyEmu, uniqueId) {
|
|
53690
|
-
if (cxEmu <= 0 || cyEmu <= 0) {
|
|
53691
|
-
return null;
|
|
53692
|
-
}
|
|
53693
|
-
const phNode = {};
|
|
53694
|
-
if (target.type) {
|
|
53695
|
-
phNode["@_type"] = target.type;
|
|
53696
|
-
}
|
|
53697
|
-
if (target.idx !== void 0) {
|
|
53698
|
-
phNode["@_idx"] = target.idx;
|
|
53699
|
-
}
|
|
53700
|
-
const rawXml = {
|
|
53701
|
-
"p:nvSpPr": {
|
|
53702
|
-
"p:cNvPr": {
|
|
53703
|
-
"@_id": uniqueId,
|
|
53704
|
-
"@_name": `Placeholder ${target.type || "content"}`
|
|
53705
|
-
},
|
|
53706
|
-
"p:cNvSpPr": {
|
|
53707
|
-
"a:spLocks": { "@_noGrp": "1" }
|
|
53708
|
-
},
|
|
53709
|
-
"p:nvPr": {
|
|
53710
|
-
"p:ph": phNode
|
|
53711
|
-
}
|
|
53712
|
-
},
|
|
53713
|
-
"p:spPr": {
|
|
53714
|
-
"a:xfrm": {
|
|
53715
|
-
"a:off": { "@_x": String(xEmu), "@_y": String(yEmu) },
|
|
53716
|
-
"a:ext": { "@_cx": String(cxEmu), "@_cy": String(cyEmu) }
|
|
53717
|
-
}
|
|
53718
|
-
},
|
|
53719
|
-
"p:txBody": {
|
|
53720
|
-
"a:bodyPr": {},
|
|
53721
|
-
"a:lstStyle": {},
|
|
53722
|
-
"a:p": { "a:endParaRPr": { "@_lang": "en-US" } }
|
|
53723
|
-
}
|
|
53724
|
-
};
|
|
53725
|
-
return {
|
|
53726
|
-
type: "text",
|
|
53727
|
-
id: `ph-${target.type || "content"}-${target.idx ?? "0"}-${uniqueId}`,
|
|
53728
|
-
x: Math.round(xEmu / EMU_PER_PX),
|
|
53729
|
-
y: Math.round(yEmu / EMU_PER_PX),
|
|
53730
|
-
width: Math.round(cxEmu / EMU_PER_PX),
|
|
53731
|
-
height: Math.round(cyEmu / EMU_PER_PX),
|
|
53732
|
-
text: "",
|
|
53733
|
-
rawXml
|
|
53734
|
-
};
|
|
53735
|
-
}
|
|
53736
|
-
|
|
53737
53792
|
// pptx/core/utils/text-fill-blip.ts
|
|
53738
53793
|
function resolveTextFillBlip(blipFill, lookupTarget, resolveArchivePath, allowExternal) {
|
|
53739
53794
|
const blip = blipFill["a:blip"];
|
|
@@ -73024,6 +73079,19 @@ var PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
73024
73079
|
return this.isStrictOoxml ? "strict" : "transitional";
|
|
73025
73080
|
}
|
|
73026
73081
|
async save(slides, options) {
|
|
73082
|
+
validateSlideGeometry(slides);
|
|
73083
|
+
const templates = [
|
|
73084
|
+
...options?.slideMasters ?? [],
|
|
73085
|
+
...options?.slideLayouts ?? [],
|
|
73086
|
+
...options?.slideMasters?.flatMap((master) => master.layouts ?? []) ?? [],
|
|
73087
|
+
...options?.notesMaster ? [options.notesMaster] : [],
|
|
73088
|
+
...options?.handoutMaster ? [options.handoutMaster] : []
|
|
73089
|
+
];
|
|
73090
|
+
for (const template of templates) {
|
|
73091
|
+
for (const element of template.elements ?? []) {
|
|
73092
|
+
validateElementGeometry(element, `Template (${template.path})`);
|
|
73093
|
+
}
|
|
73094
|
+
}
|
|
73027
73095
|
if (options?.outputFormat === "ppt") {
|
|
73028
73096
|
return this.saveAsLegacyPpt(
|
|
73029
73097
|
slides,
|
|
@@ -73953,8 +74021,7 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
|
|
|
73953
74021
|
return this.scanPlaceholderBuckets(spTree, (info) => info?.type === type);
|
|
73954
74022
|
}
|
|
73955
74023
|
/** The layout and master counterparts of a placeholder, unmerged. */
|
|
73956
|
-
findPlaceholderContexts(slidePath, expected) {
|
|
73957
|
-
const layoutPath = this.resolveLayoutPathForSlide(slidePath);
|
|
74024
|
+
findPlaceholderContexts(slidePath, expected, layoutPath = this.resolveLayoutPathForSlide(slidePath)) {
|
|
73958
74025
|
if (!layoutPath) {
|
|
73959
74026
|
return {};
|
|
73960
74027
|
}
|
|
@@ -73966,10 +74033,11 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
|
|
|
73966
74033
|
const master = this.findPlaceholderInShapeTree(masterSpTree, expected) ?? this.findSingletonPlaceholderInShapeTree(masterSpTree, expected);
|
|
73967
74034
|
return { layout, master };
|
|
73968
74035
|
}
|
|
73969
|
-
findPlaceholderContext(slidePath, expected) {
|
|
74036
|
+
findPlaceholderContext(slidePath, expected, layoutPath) {
|
|
73970
74037
|
const { layout: layoutContext, master: masterContext } = this.findPlaceholderContexts(
|
|
73971
74038
|
slidePath,
|
|
73972
|
-
expected
|
|
74039
|
+
expected,
|
|
74040
|
+
layoutPath
|
|
73973
74041
|
);
|
|
73974
74042
|
if (!layoutContext) {
|
|
73975
74043
|
return masterContext;
|
|
@@ -73995,8 +74063,8 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
|
|
|
73995
74063
|
* a master `p:sp`), so the layout keeps winning exactly as it does when
|
|
73996
74064
|
* both are shapes.
|
|
73997
74065
|
*/
|
|
73998
|
-
findPlaceholderNode(slidePath, expected) {
|
|
73999
|
-
const { layout, master } = this.findPlaceholderContexts(slidePath, expected);
|
|
74066
|
+
findPlaceholderNode(slidePath, expected, layoutPath) {
|
|
74067
|
+
const { layout, master } = this.findPlaceholderContexts(slidePath, expected, layoutPath);
|
|
74000
74068
|
const firstNode2 = (context) => context?.shape ?? context?.picture ?? context?.graphicFrame;
|
|
74001
74069
|
const layoutNode = firstNode2(layout);
|
|
74002
74070
|
const masterNode = firstNode2(master);
|
|
@@ -74037,8 +74105,7 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
|
|
|
74037
74105
|
* reference. Checks the layout cache first, then the master cache, and
|
|
74038
74106
|
* merges them so that layout values take priority over master values.
|
|
74039
74107
|
*/
|
|
74040
|
-
lookupPlaceholderDefaults(slidePath, phInfo) {
|
|
74041
|
-
const layoutPath = this.resolveLayoutPathForSlide(slidePath);
|
|
74108
|
+
lookupPlaceholderDefaults(slidePath, phInfo, layoutPath = this.resolveLayoutPathForSlide(slidePath)) {
|
|
74042
74109
|
if (!layoutPath) {
|
|
74043
74110
|
return void 0;
|
|
74044
74111
|
}
|
|
@@ -76124,14 +76191,14 @@ var PptxHandlerRuntime66 = class extends PptxHandlerRuntime65 {
|
|
|
76124
76191
|
|
|
76125
76192
|
// pptx/core/core/runtime/PptxHandlerRuntimeShapeParsing.ts
|
|
76126
76193
|
var PptxHandlerRuntime67 = class _PptxHandlerRuntime extends PptxHandlerRuntime66 {
|
|
76127
|
-
parseShape(shape, id, slidePath) {
|
|
76194
|
+
parseShape(shape, id, slidePath, layoutPath) {
|
|
76128
76195
|
try {
|
|
76129
76196
|
const spPr = shape["p:spPr"];
|
|
76130
76197
|
const slideRelationshipMap = slidePath ? this.slideRelsMap.get(slidePath) : void 0;
|
|
76131
76198
|
const placeholderInfo = this.extractPlaceholderInfo(
|
|
76132
76199
|
shape?.["p:nvSpPr"]?.["p:nvPr"]
|
|
76133
76200
|
);
|
|
76134
|
-
const inheritedPlaceholder = slidePath && placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
|
|
76201
|
+
const inheritedPlaceholder = (slidePath || layoutPath) && placeholderInfo ? this.findPlaceholderContext(slidePath ?? "", placeholderInfo, layoutPath) : void 0;
|
|
76135
76202
|
const inheritedSpPr = inheritedPlaceholder?.shape?.["p:spPr"] || inheritedPlaceholder?.picture?.["p:spPr"];
|
|
76136
76203
|
const effectiveSpPr = spPr ? {
|
|
76137
76204
|
...spPr,
|
|
@@ -76257,7 +76324,7 @@ var PptxHandlerRuntime67 = class _PptxHandlerRuntime extends PptxHandlerRuntime6
|
|
|
76257
76324
|
);
|
|
76258
76325
|
const linkedTxbxId = bodyPropResult.linkedTxbxId;
|
|
76259
76326
|
const linkedTxbxSeq = bodyPropResult.linkedTxbxSeq;
|
|
76260
|
-
const phDefaults = slidePath && placeholderInfo ? this.lookupPlaceholderDefaults(slidePath, placeholderInfo) : void 0;
|
|
76327
|
+
const phDefaults = (slidePath || layoutPath) && placeholderInfo ? this.lookupPlaceholderDefaults(slidePath ?? "", placeholderInfo, layoutPath) : void 0;
|
|
76261
76328
|
if (phDefaults) {
|
|
76262
76329
|
this.applyPlaceholderBodyDefaults(textStyle, phDefaults);
|
|
76263
76330
|
}
|
|
@@ -85226,8 +85293,175 @@ var PptxHandlerRuntime102 = class extends PptxHandlerRuntime101 {
|
|
|
85226
85293
|
}
|
|
85227
85294
|
};
|
|
85228
85295
|
|
|
85229
|
-
// pptx/core/core/runtime/
|
|
85296
|
+
// pptx/core/core/runtime/sdk-placeholder.ts
|
|
85297
|
+
var TEXT_PLACEHOLDER_TYPES = /* @__PURE__ */ new Set([
|
|
85298
|
+
"title",
|
|
85299
|
+
"ctrtitle",
|
|
85300
|
+
"subtitle",
|
|
85301
|
+
"body",
|
|
85302
|
+
"obj",
|
|
85303
|
+
"dt",
|
|
85304
|
+
"ftr",
|
|
85305
|
+
"hdr",
|
|
85306
|
+
"sldnum"
|
|
85307
|
+
]);
|
|
85308
|
+
function selectTextPlaceholder(input, type, options, slots) {
|
|
85309
|
+
if (!TEXT_PLACEHOLDER_TYPES.has(type.toLowerCase())) {
|
|
85310
|
+
throw new Error(`Unsupported text placeholder type: ${type}`);
|
|
85311
|
+
}
|
|
85312
|
+
if (options.idx !== void 0 && (!Number.isInteger(options.idx) || options.idx < 0 || options.idx > 4294967295)) {
|
|
85313
|
+
throw new Error("Placeholder idx must be an unsigned 32-bit integer");
|
|
85314
|
+
}
|
|
85315
|
+
const source = {
|
|
85316
|
+
type: type.toLowerCase(),
|
|
85317
|
+
...options.idx !== void 0 ? { idx: String(options.idx) } : {}
|
|
85318
|
+
};
|
|
85319
|
+
let best;
|
|
85320
|
+
let bestScore = 0;
|
|
85321
|
+
for (const slot of slots) {
|
|
85322
|
+
if (!TEXT_PLACEHOLDER_TYPES.has(slot.phInfo.type ?? "obj")) continue;
|
|
85323
|
+
if (source.idx !== void 0 && source.idx !== (slot.phInfo.idx ?? "0")) continue;
|
|
85324
|
+
const score = scorePlaceholderMatch(input, source, slot.phInfo);
|
|
85325
|
+
if (score > bestScore) {
|
|
85326
|
+
best = slot;
|
|
85327
|
+
bestScore = score;
|
|
85328
|
+
}
|
|
85329
|
+
}
|
|
85330
|
+
return best ? { type: canonicalPlaceholderType(best.phInfo.type ?? "obj"), idx: best.phInfo.idx } : { type: canonicalPlaceholderType(source.type), idx: source.idx };
|
|
85331
|
+
}
|
|
85332
|
+
function withoutFallbackLanguage(properties) {
|
|
85333
|
+
const { "@_lang": language, ...rest } = properties;
|
|
85334
|
+
if (language !== "en-US") return properties;
|
|
85335
|
+
const keys = Object.keys(rest);
|
|
85336
|
+
return keys.length === 0 || keys.length === 1 && rest["@_dirty"] === "0" ? void 0 : rest;
|
|
85337
|
+
}
|
|
85338
|
+
function stripFallbackLanguage(node, key2) {
|
|
85339
|
+
const properties = node[key2];
|
|
85340
|
+
if (!properties || typeof properties !== "object") return node;
|
|
85341
|
+
const next = withoutFallbackLanguage(properties);
|
|
85342
|
+
if (next === properties) return node;
|
|
85343
|
+
const result = {};
|
|
85344
|
+
for (const [name, value] of Object.entries(node)) {
|
|
85345
|
+
if (name !== key2) result[name] = value;
|
|
85346
|
+
else if (next) result[name] = next;
|
|
85347
|
+
}
|
|
85348
|
+
return result;
|
|
85349
|
+
}
|
|
85350
|
+
function withoutFallbackLanguages(paragraphs) {
|
|
85351
|
+
return paragraphs.map((paragraph) => {
|
|
85352
|
+
const next = { ...stripFallbackLanguage(paragraph, "a:endParaRPr") };
|
|
85353
|
+
for (const child16 of ["a:r", "a:br", "a:fld"]) {
|
|
85354
|
+
const nodes = next[child16];
|
|
85355
|
+
if (nodes === void 0) continue;
|
|
85356
|
+
next[child16] = Array.isArray(nodes) ? nodes.map((node) => stripFallbackLanguage(node, "a:rPr")) : stripFallbackLanguage(nodes, "a:rPr");
|
|
85357
|
+
}
|
|
85358
|
+
return next;
|
|
85359
|
+
});
|
|
85360
|
+
}
|
|
85361
|
+
function placeholderShape2(identity, paragraphs) {
|
|
85362
|
+
paragraphs = withoutFallbackLanguages(paragraphs);
|
|
85363
|
+
return {
|
|
85364
|
+
"p:nvSpPr": {
|
|
85365
|
+
"p:cNvPr": { "@_id": "2", "@_name": `Placeholder ${identity.type}` },
|
|
85366
|
+
"p:cNvSpPr": { "a:spLocks": { "@_noGrp": "1" } },
|
|
85367
|
+
"p:nvPr": {
|
|
85368
|
+
"p:ph": {
|
|
85369
|
+
"@_type": identity.type,
|
|
85370
|
+
...identity.idx !== void 0 ? { "@_idx": identity.idx } : {}
|
|
85371
|
+
}
|
|
85372
|
+
}
|
|
85373
|
+
},
|
|
85374
|
+
"p:spPr": {},
|
|
85375
|
+
"p:txBody": { "a:bodyPr": {}, "a:lstStyle": {}, "a:p": paragraphs }
|
|
85376
|
+
};
|
|
85377
|
+
}
|
|
85378
|
+
function applyPlaceholderFrame(shape, inherited, options, emuPerPx, materializeFrame = false) {
|
|
85379
|
+
for (const key2 of ["x", "y", "width", "height"]) {
|
|
85380
|
+
if (options[key2] !== void 0 && !Number.isFinite(options[key2])) {
|
|
85381
|
+
throw new Error(`Invalid placeholder frame for ${key2}: expected a finite number`);
|
|
85382
|
+
}
|
|
85383
|
+
}
|
|
85384
|
+
const off = xmlPath(inherited, "p:spPr", "a:xfrm", "a:off");
|
|
85385
|
+
const ext = xmlPath(inherited, "p:spPr", "a:xfrm", "a:ext");
|
|
85386
|
+
const frame = {
|
|
85387
|
+
x: options.x ?? (off?.["@_x"] !== void 0 ? Number(off["@_x"]) / emuPerPx : void 0),
|
|
85388
|
+
y: options.y ?? (off?.["@_y"] !== void 0 ? Number(off["@_y"]) / emuPerPx : void 0),
|
|
85389
|
+
width: options.width ?? (ext?.["@_cx"] !== void 0 ? Number(ext["@_cx"]) / emuPerPx : void 0),
|
|
85390
|
+
height: options.height ?? (ext?.["@_cy"] !== void 0 ? Number(ext["@_cy"]) / emuPerPx : void 0)
|
|
85391
|
+
};
|
|
85392
|
+
for (const [key2, value] of Object.entries(frame)) {
|
|
85393
|
+
if (!Number.isFinite(value)) {
|
|
85394
|
+
throw new Error(
|
|
85395
|
+
`No matching placeholder frame for ${key2}; supply a complete explicit frame or choose a layout containing this slot`
|
|
85396
|
+
);
|
|
85397
|
+
}
|
|
85398
|
+
}
|
|
85399
|
+
if (materializeFrame || ["x", "y", "width", "height"].some((key2) => options[key2] !== void 0)) {
|
|
85400
|
+
setRawXmlTransform(
|
|
85401
|
+
shape,
|
|
85402
|
+
...["x", "y", "width", "height"].map(
|
|
85403
|
+
(key2) => Math.round(frame[key2] * emuPerPx)
|
|
85404
|
+
)
|
|
85405
|
+
);
|
|
85406
|
+
}
|
|
85407
|
+
}
|
|
85408
|
+
|
|
85409
|
+
// pptx/core/core/runtime/PptxHandlerRuntimeSdkPlaceholders.ts
|
|
85230
85410
|
var PptxHandlerRuntime103 = class _PptxHandlerRuntime extends PptxHandlerRuntime102 {
|
|
85411
|
+
createPlaceholderElement(layoutPath, input, type, options) {
|
|
85412
|
+
if (input.type !== "text") throw new Error("Placeholder input must be text");
|
|
85413
|
+
const layout = this.layoutXmlMap.get(layoutPath);
|
|
85414
|
+
if (!layout) throw new Error(`Unknown layout: ${layoutPath}`);
|
|
85415
|
+
const identity = selectTextPlaceholder(
|
|
85416
|
+
input,
|
|
85417
|
+
type,
|
|
85418
|
+
options,
|
|
85419
|
+
this.extractLayoutPlaceholders(layout, layoutPath)
|
|
85420
|
+
);
|
|
85421
|
+
const shape = placeholderShape2(
|
|
85422
|
+
identity,
|
|
85423
|
+
this.createParagraphsFromTextContent(input.text, void 0, input.textSegments)
|
|
85424
|
+
);
|
|
85425
|
+
const inherited = this.findPlaceholderNode(
|
|
85426
|
+
"",
|
|
85427
|
+
{ type: identity.type.toLowerCase(), idx: identity.idx },
|
|
85428
|
+
layoutPath
|
|
85429
|
+
);
|
|
85430
|
+
const fallback = this.sdkMasterFrame(layoutPath, identity.type, identity.idx, inherited);
|
|
85431
|
+
applyPlaceholderFrame(
|
|
85432
|
+
shape,
|
|
85433
|
+
fallback ?? inherited,
|
|
85434
|
+
options,
|
|
85435
|
+
_PptxHandlerRuntime.EMU_PER_PX,
|
|
85436
|
+
fallback !== void 0
|
|
85437
|
+
);
|
|
85438
|
+
const element = this.parseShape(shape, input.id, void 0, layoutPath);
|
|
85439
|
+
if (!element) throw new Error("Unable to resolve placeholder content");
|
|
85440
|
+
if ((element.type === "text" || element.type === "shape") && !element.textStyle && element.textSegments?.[0]?.style) {
|
|
85441
|
+
element.textStyle = { ...element.textSegments[0].style };
|
|
85442
|
+
}
|
|
85443
|
+
return element;
|
|
85444
|
+
}
|
|
85445
|
+
sdkMasterFrame(layoutPath, type, idx, inherited) {
|
|
85446
|
+
if (!inherited) return void 0;
|
|
85447
|
+
if (xmlPath(inherited, "p:spPr", "a:xfrm", "a:off") && xmlPath(inherited, "p:spPr", "a:xfrm", "a:ext"))
|
|
85448
|
+
return void 0;
|
|
85449
|
+
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
85450
|
+
const tree = masterPath ? xmlPath(this.masterXmlMap.get(masterPath), "p:sldMaster", "p:cSld", "p:spTree") : void 0;
|
|
85451
|
+
const role = placeholderContentRole(type.toLowerCase());
|
|
85452
|
+
const candidates = this.ensureArray(tree?.["p:sp"]).filter((shape) => {
|
|
85453
|
+
const info = this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"));
|
|
85454
|
+
return info && placeholderContentRole(info.type) === role;
|
|
85455
|
+
});
|
|
85456
|
+
const master = candidates.find(
|
|
85457
|
+
(shape) => this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"))?.idx === idx
|
|
85458
|
+
) ?? candidates[0];
|
|
85459
|
+
return master ? this.mergeXmlObjects(master, inherited) : void 0;
|
|
85460
|
+
}
|
|
85461
|
+
};
|
|
85462
|
+
|
|
85463
|
+
// pptx/core/core/runtime/PptxHandlerRuntimeImplementation.ts
|
|
85464
|
+
var PptxHandlerRuntime104 = class _PptxHandlerRuntime extends PptxHandlerRuntime103 {
|
|
85231
85465
|
constructor(dependencyFactory = new PptxRuntimeDependencyFactory()) {
|
|
85232
85466
|
super();
|
|
85233
85467
|
this.dependencyFactory = dependencyFactory;
|
|
@@ -85365,11 +85599,11 @@ var PptxHandlerRuntime103 = class _PptxHandlerRuntime extends PptxHandlerRuntime
|
|
|
85365
85599
|
};
|
|
85366
85600
|
|
|
85367
85601
|
// pptx/core/core/PptxHandlerRuntime.ts
|
|
85368
|
-
var
|
|
85602
|
+
var PptxHandlerRuntime105 = class extends PptxHandlerRuntime104 {
|
|
85369
85603
|
};
|
|
85370
85604
|
|
|
85371
85605
|
// pptx/core/core/PptxHandlerRuntimeFactory.ts
|
|
85372
|
-
var createDefaultPptxHandlerRuntime = () => new
|
|
85606
|
+
var createDefaultPptxHandlerRuntime = () => new PptxHandlerRuntime105();
|
|
85373
85607
|
|
|
85374
85608
|
// pptx/core/ppt/current-user.ts
|
|
85375
85609
|
var EncryptedPptError = class extends Error {
|
|
@@ -88175,6 +88409,13 @@ var PptxHandlerCore = class {
|
|
|
88175
88409
|
getLayoutOptions() {
|
|
88176
88410
|
return this.runtime.getLayoutOptions();
|
|
88177
88411
|
}
|
|
88412
|
+
/** Resolve a text placeholder in this loaded deck, preserving layout inheritance. */
|
|
88413
|
+
createPlaceholderElement(layoutPath, input, type, options = {}) {
|
|
88414
|
+
if (!this.runtime.createPlaceholderElement) {
|
|
88415
|
+
throw new Error("This runtime does not support creating layout placeholders");
|
|
88416
|
+
}
|
|
88417
|
+
return this.runtime.createPlaceholderElement(layoutPath, input, type, options);
|
|
88418
|
+
}
|
|
88178
88419
|
/**
|
|
88179
88420
|
* Build the artwork thumbnails backing the New Slide / Layout galleries.
|
|
88180
88421
|
*
|
|
@@ -89488,13 +89729,14 @@ function createFreeformElement(pathData, options) {
|
|
|
89488
89729
|
|
|
89489
89730
|
// pptx/core/builders/sdk/SlideBuilder.ts
|
|
89490
89731
|
var SlideBuilder = class {
|
|
89491
|
-
slide;
|
|
89492
89732
|
/**
|
|
89493
89733
|
* @param slideNumber - 1-based slide number.
|
|
89494
89734
|
* @param layoutPath - Optional layout archive path.
|
|
89495
89735
|
* @param layoutName - Optional layout display name.
|
|
89736
|
+
* @param handler - Loaded deck context for placeholder geometry and text styles.
|
|
89496
89737
|
*/
|
|
89497
|
-
constructor(slideNumber, layoutPath, layoutName) {
|
|
89738
|
+
constructor(slideNumber, layoutPath, layoutName, handler) {
|
|
89739
|
+
this.handler = handler;
|
|
89498
89740
|
this.slide = {
|
|
89499
89741
|
id: `slide${slideNumber}`,
|
|
89500
89742
|
rId: `rId${slideNumber + 1}`,
|
|
@@ -89504,11 +89746,52 @@ var SlideBuilder = class {
|
|
|
89504
89746
|
layoutName: layoutName ?? "Title Slide"
|
|
89505
89747
|
};
|
|
89506
89748
|
}
|
|
89749
|
+
handler;
|
|
89750
|
+
slide;
|
|
89507
89751
|
/** Add a text box to the slide. */
|
|
89508
89752
|
addText(text, options) {
|
|
89509
89753
|
this.slide.elements.push(createTextElement(text, options));
|
|
89510
89754
|
return this;
|
|
89511
89755
|
}
|
|
89756
|
+
/**
|
|
89757
|
+
* Fill a layout placeholder, inheriting its frame and text styles.
|
|
89758
|
+
*
|
|
89759
|
+
* Unlike addText, this writes a real p:ph binding, not a free text box.
|
|
89760
|
+
* Use idx to select repeated slots (for example, Two Content's 1 and 2).
|
|
89761
|
+
* Explicit frame fields override the layout; all other fields inherit.
|
|
89762
|
+
* A standalone builder requires the fourth constructor argument (a loaded
|
|
89763
|
+
* handler), even with an explicit frame, so text styles resolve consistently.
|
|
89764
|
+
* Missing slots without a complete frame throw instead of creating a text box.
|
|
89765
|
+
* Master frames requiring compatible-role fallback are materialized locally
|
|
89766
|
+
* for new content only, keeping existing-deck loading unchanged.
|
|
89767
|
+
*
|
|
89768
|
+
* @example
|
|
89769
|
+
* ```ts
|
|
89770
|
+
* createSlide('Title Slide')
|
|
89771
|
+
* .addPlaceholder('ctrTitle', 'Quarterly review')
|
|
89772
|
+
* .addPlaceholder('subTitle', 'October 2026');
|
|
89773
|
+
* createSlide('Two Content').addPlaceholder('body', 'Right column', { idx: 2 });
|
|
89774
|
+
* ```
|
|
89775
|
+
*/
|
|
89776
|
+
addPlaceholder(type, text, options = {}) {
|
|
89777
|
+
const input = createTextElement(text);
|
|
89778
|
+
const context = `Slide ${this.slide.slideNumber} (${this.slide.id}), placeholder ${type} idx=${options.idx ?? "auto"}, layout ${this.slide.layoutName} (${this.slide.layoutPath})`;
|
|
89779
|
+
try {
|
|
89780
|
+
if (!this.handler) {
|
|
89781
|
+
throw new Error(
|
|
89782
|
+
"addPlaceholder requires a loaded handler as the fourth SlideBuilder constructor argument"
|
|
89783
|
+
);
|
|
89784
|
+
}
|
|
89785
|
+
this.slide.elements.push(
|
|
89786
|
+
this.handler.createPlaceholderElement(this.slide.layoutPath, input, type, options)
|
|
89787
|
+
);
|
|
89788
|
+
} catch (error) {
|
|
89789
|
+
throw new Error(`${context}: ${error instanceof Error ? error.message : String(error)}`, {
|
|
89790
|
+
cause: error
|
|
89791
|
+
});
|
|
89792
|
+
}
|
|
89793
|
+
return this;
|
|
89794
|
+
}
|
|
89512
89795
|
/** Add a shape to the slide. */
|
|
89513
89796
|
addShape(shapeType, options) {
|
|
89514
89797
|
this.slide.elements.push(createShapeElement(shapeType, options));
|
|
@@ -89747,6 +90030,125 @@ var SlideBuilder = class {
|
|
|
89747
90030
|
}
|
|
89748
90031
|
};
|
|
89749
90032
|
|
|
90033
|
+
// pptx/core/builders/sdk/layout-operations.ts
|
|
90034
|
+
var EMU_PER_PIXEL4 = 9525;
|
|
90035
|
+
function pxToEmu(px) {
|
|
90036
|
+
return Math.round(px * EMU_PER_PIXEL4);
|
|
90037
|
+
}
|
|
90038
|
+
function placeholderSpXml(ph, shapeId) {
|
|
90039
|
+
const name = ph.name ?? `${ph.type.charAt(0).toUpperCase() + ph.type.slice(1)} Placeholder ${shapeId - 1}`;
|
|
90040
|
+
const x = pxToEmu(ph.x);
|
|
90041
|
+
const y = pxToEmu(ph.y);
|
|
90042
|
+
const cx = pxToEmu(ph.width);
|
|
90043
|
+
const cy = pxToEmu(ph.height);
|
|
90044
|
+
const idxAttr = ph.idx !== void 0 ? ` idx="${Math.max(0, Math.round(ph.idx))}"` : "";
|
|
90045
|
+
return ` <p:sp>
|
|
90046
|
+
<p:nvSpPr>
|
|
90047
|
+
<p:cNvPr id="${shapeId}" name="${escAttr(name)}"/>
|
|
90048
|
+
<p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
|
|
90049
|
+
<p:nvPr><p:ph type="${escAttr(ph.type)}"${idxAttr}/></p:nvPr>
|
|
90050
|
+
</p:nvSpPr>
|
|
90051
|
+
<p:spPr>
|
|
90052
|
+
<a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>
|
|
90053
|
+
</p:spPr>
|
|
90054
|
+
<p:txBody>
|
|
90055
|
+
<a:bodyPr/>
|
|
90056
|
+
<a:lstStyle/>
|
|
90057
|
+
<a:p><a:endParaRPr lang="en-US"/></a:p>
|
|
90058
|
+
</p:txBody>
|
|
90059
|
+
</p:sp>`;
|
|
90060
|
+
}
|
|
90061
|
+
function normalizeSrgbHex(color2) {
|
|
90062
|
+
if (!color2) {
|
|
90063
|
+
return void 0;
|
|
90064
|
+
}
|
|
90065
|
+
const raw = color2.trim().replace(/^#/, "").toUpperCase();
|
|
90066
|
+
if (/^[0-9A-F]{6}$/.test(raw)) {
|
|
90067
|
+
return raw;
|
|
90068
|
+
}
|
|
90069
|
+
if (/^[0-9A-F]{3}$/.test(raw)) {
|
|
90070
|
+
return raw.replace(/./g, (ch) => ch + ch);
|
|
90071
|
+
}
|
|
90072
|
+
return void 0;
|
|
90073
|
+
}
|
|
90074
|
+
function generateLayoutXml(definition) {
|
|
90075
|
+
const layoutType = definition.type ?? "obj";
|
|
90076
|
+
const placeholders = definition.placeholders ?? [];
|
|
90077
|
+
const phShapes = placeholders.map((ph, i) => placeholderSpXml(ph, i + 2)).join("\n");
|
|
90078
|
+
let bgXml = "";
|
|
90079
|
+
const hex3 = normalizeSrgbHex(definition.backgroundColor);
|
|
90080
|
+
if (hex3) {
|
|
90081
|
+
bgXml = ` <p:bg><p:bgPr><a:solidFill><a:srgbClr val="${hex3}"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>
|
|
90082
|
+
`;
|
|
90083
|
+
}
|
|
90084
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
90085
|
+
<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
90086
|
+
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
90087
|
+
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
90088
|
+
type="${escAttr(layoutType)}" preserve="1">
|
|
90089
|
+
<p:cSld name="${escAttr(definition.name)}">
|
|
90090
|
+
${bgXml} <p:spTree>
|
|
90091
|
+
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
90092
|
+
<p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
|
|
90093
|
+
${phShapes}
|
|
90094
|
+
</p:spTree>
|
|
90095
|
+
</p:cSld>
|
|
90096
|
+
<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
90097
|
+
</p:sldLayout>`;
|
|
90098
|
+
}
|
|
90099
|
+
|
|
90100
|
+
// pptx/core/builders/sdk/standard-layout-placeholders.ts
|
|
90101
|
+
function standardLayoutPlaceholders(type, width, height) {
|
|
90102
|
+
if (type === "blank") return [];
|
|
90103
|
+
const box = (type2, idx, x, y, w, h) => ({
|
|
90104
|
+
type: type2,
|
|
90105
|
+
idx,
|
|
90106
|
+
x: x * width,
|
|
90107
|
+
y: y * height,
|
|
90108
|
+
width: w * width,
|
|
90109
|
+
height: h * height
|
|
90110
|
+
});
|
|
90111
|
+
const title = box("title", 0, 0.05, 0.04, 0.9, 0.15);
|
|
90112
|
+
const content2 = box("obj", 1, 0.05, 0.23, 0.9, 0.64);
|
|
90113
|
+
let slots;
|
|
90114
|
+
switch (type) {
|
|
90115
|
+
case "title":
|
|
90116
|
+
slots = [
|
|
90117
|
+
box("ctrTitle", 0, 0.08, 0.24, 0.84, 0.22),
|
|
90118
|
+
box("subTitle", 1, 0.12, 0.49, 0.76, 0.2)
|
|
90119
|
+
];
|
|
90120
|
+
break;
|
|
90121
|
+
case "secHead":
|
|
90122
|
+
slots = [box("title", 0, 0.05, 0.37, 0.9, 0.2), box("body", 1, 0.05, 0.6, 0.9, 0.23)];
|
|
90123
|
+
break;
|
|
90124
|
+
case "twoObj":
|
|
90125
|
+
case "twoTxTwoObj":
|
|
90126
|
+
slots = [title, box("obj", 1, 0.05, 0.27, 0.43, 0.6), box("obj", 2, 0.52, 0.27, 0.43, 0.6)];
|
|
90127
|
+
if (type === "twoTxTwoObj")
|
|
90128
|
+
slots.push(box("body", 3, 0.05, 0.2, 0.43, 0.07), box("body", 4, 0.52, 0.2, 0.43, 0.07));
|
|
90129
|
+
break;
|
|
90130
|
+
case "titleOnly":
|
|
90131
|
+
slots = [title];
|
|
90132
|
+
break;
|
|
90133
|
+
case "objTx":
|
|
90134
|
+
case "picTx":
|
|
90135
|
+
slots = [
|
|
90136
|
+
title,
|
|
90137
|
+
box(type === "picTx" ? "pic" : "obj", 1, 0.36, 0.23, 0.59, 0.64),
|
|
90138
|
+
box("body", 2, 0.05, 0.23, 0.27, 0.64)
|
|
90139
|
+
];
|
|
90140
|
+
break;
|
|
90141
|
+
default:
|
|
90142
|
+
slots = [title, content2];
|
|
90143
|
+
}
|
|
90144
|
+
return [
|
|
90145
|
+
...slots,
|
|
90146
|
+
box("dt", 10, 0.05, 0.92, 0.25, 0.04),
|
|
90147
|
+
box("ftr", 11, 0.33, 0.92, 0.34, 0.04),
|
|
90148
|
+
box("sldNum", 12, 0.75, 0.92, 0.2, 0.04)
|
|
90149
|
+
];
|
|
90150
|
+
}
|
|
90151
|
+
|
|
89750
90152
|
// pptx/core/builders/sdk/PresentationBuilder.ts
|
|
89751
90153
|
var DEFAULT_WIDTH = 12192e3;
|
|
89752
90154
|
var DEFAULT_HEIGHT = 6858e3;
|
|
@@ -89766,7 +90168,7 @@ var DEFAULT_COLORS2 = {
|
|
|
89766
90168
|
};
|
|
89767
90169
|
var DEFAULT_MAJOR_FONT = "Calibri Light";
|
|
89768
90170
|
var DEFAULT_MINOR_FONT = "Calibri";
|
|
89769
|
-
function
|
|
90171
|
+
function normalizeSrgbHex2(color2) {
|
|
89770
90172
|
if (!color2) {
|
|
89771
90173
|
return void 0;
|
|
89772
90174
|
}
|
|
@@ -89782,7 +90184,7 @@ function normalizeSrgbHex(color2) {
|
|
|
89782
90184
|
function resolveThemeColors(overrides) {
|
|
89783
90185
|
const resolved = {};
|
|
89784
90186
|
for (const [key2, fallback] of Object.entries(DEFAULT_COLORS2)) {
|
|
89785
|
-
resolved[key2] =
|
|
90187
|
+
resolved[key2] = normalizeSrgbHex2(overrides?.[key2]) ?? normalizeSrgbHex2(fallback) ?? "000000";
|
|
89786
90188
|
}
|
|
89787
90189
|
return resolved;
|
|
89788
90190
|
}
|
|
@@ -89939,21 +90341,6 @@ ${layoutRels}
|
|
|
89939
90341
|
<Relationship Id="rId${layoutCount + 1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>
|
|
89940
90342
|
</Relationships>`;
|
|
89941
90343
|
}
|
|
89942
|
-
function slideLayoutXml2(name, layoutType) {
|
|
89943
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
89944
|
-
<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
89945
|
-
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
89946
|
-
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
89947
|
-
type="${escAttr(layoutType)}" preserve="1">
|
|
89948
|
-
<p:cSld name="${escAttr(name)}">
|
|
89949
|
-
<p:spTree>
|
|
89950
|
-
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
89951
|
-
<p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
|
|
89952
|
-
</p:spTree>
|
|
89953
|
-
</p:cSld>
|
|
89954
|
-
<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
89955
|
-
</p:sldLayout>`;
|
|
89956
|
-
}
|
|
89957
90344
|
function slideLayoutRelsXml() {
|
|
89958
90345
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
89959
90346
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
@@ -90102,7 +90489,14 @@ async function buildBlankPresentationArchive(options) {
|
|
|
90102
90489
|
zip.file("ppt/slideMasters/_rels/slideMaster1.xml.rels", slideMasterRelsXml(layoutCount));
|
|
90103
90490
|
for (let i = 0; i < layoutCount; i++) {
|
|
90104
90491
|
const layout = STANDARD_LAYOUTS[i];
|
|
90105
|
-
zip.file(
|
|
90492
|
+
zip.file(
|
|
90493
|
+
`ppt/slideLayouts/slideLayout${i + 1}.xml`,
|
|
90494
|
+
generateLayoutXml({
|
|
90495
|
+
name: layout.name,
|
|
90496
|
+
type: layout.type,
|
|
90497
|
+
placeholders: standardLayoutPlaceholders(layout.type, width / 9525, height / 9525)
|
|
90498
|
+
})
|
|
90499
|
+
);
|
|
90106
90500
|
zip.file(`ppt/slideLayouts/_rels/slideLayout${i + 1}.xml.rels`, slideLayoutRelsXml());
|
|
90107
90501
|
}
|
|
90108
90502
|
for (let i = 0; i < initialSlideCount; i++) {
|
|
@@ -90139,7 +90533,7 @@ var PresentationBuilder = class {
|
|
|
90139
90533
|
const layoutIdx = STANDARD_LAYOUTS.findIndex((l) => l.name === layoutName) + 1 || 7;
|
|
90140
90534
|
const layoutPath = `ppt/slideLayouts/slideLayout${layoutIdx}.xml`;
|
|
90141
90535
|
const resolvedName = layoutName ?? STANDARD_LAYOUTS[layoutIdx - 1]?.name ?? "Blank";
|
|
90142
|
-
return new SlideBuilder(slideNum, layoutPath, resolvedName);
|
|
90536
|
+
return new SlideBuilder(slideNum, layoutPath, resolvedName, handler);
|
|
90143
90537
|
};
|
|
90144
90538
|
return { handler, data, createSlide };
|
|
90145
90539
|
}
|