@office-open/core 0.7.0 → 0.8.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 +20 -11
- package/dist/chart/index.d.mts +2 -2
- package/dist/chart/index.mjs +2 -2
- package/dist/{chart-ChqlyVeb.mjs → chart-BtEtdK2K.mjs} +175 -6
- package/dist/drawingml/index.d.mts +2 -2
- package/dist/drawingml/index.mjs +2 -2
- package/dist/{drawingml-DQlhouyh.mjs → drawingml-anlfMLLZ.mjs} +2977 -2
- package/dist/{index-C4Wm3RBo.d.mts → index-Bh6s66Up.d.mts} +163 -2
- package/dist/{index-BWboZ6Uq.d.mts → index-C-DvIxek.d.mts} +1636 -2
- package/dist/index-Cj2Yf5mk.d.mts +52 -0
- package/dist/{index-Borh69Zs.d.mts → index-CoTp4wVf.d.mts} +1 -17
- package/dist/{index-f_Izh2dj.d.mts → index-D0N5Bw2M.d.mts} +44 -6
- package/dist/index.d.mts +42 -12
- package/dist/index.mjs +1320 -19
- package/dist/smartart/index.d.mts +2 -2
- package/dist/smartart/index.mjs +1 -1
- package/dist/{smartart-Cx1qa6k_.mjs → smartart-BAhTD2yA.mjs} +63 -8
- package/dist/theme/index.d.mts +2 -0
- package/dist/theme/index.mjs +2 -0
- package/dist/theme-DmJXjgQs.mjs +80 -0
- package/dist/{xml-components-xJkfJ6ff.mjs → xml-components-DEU24Y1T.mjs} +1 -32
- package/package.json +12 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Point, c as
|
|
2
|
-
export { COLOR_CATEGORIES, Connection, DEFAULT_DRAWING_XML, DataModel, LAYOUT_CATEGORIES, Point, STYLE_CATEGORIES, SmartArtCollection, SmartArtData, TransPoint, TreeNode, createDataModel, getColorXml, getLayoutXml, getStyleXml };
|
|
1
|
+
import { a as Point, c as DataModel, d as getColorXml, f as getLayoutXml, g as STYLE_CATEGORIES, h as LAYOUT_CATEGORIES, i as SmartArtData, l as Connection, m as COLOR_CATEGORIES, n as createDataModel, o as PointPropertySetOptions, p as getStyleXml, r as SmartArtCollection, s as TransPoint, t as TreeNode, u as DEFAULT_DRAWING_XML } from "../index-D0N5Bw2M.mjs";
|
|
2
|
+
export { COLOR_CATEGORIES, Connection, DEFAULT_DRAWING_XML, DataModel, LAYOUT_CATEGORIES, Point, PointPropertySetOptions, STYLE_CATEGORIES, SmartArtCollection, SmartArtData, TransPoint, TreeNode, createDataModel, getColorXml, getLayoutXml, getStyleXml };
|
package/dist/smartart/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as TransPoint, l as getLayoutXml, n as SmartArtCollection, o as Connection, p as STYLE_CATEGORIES, r as Point, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "../smartart-
|
|
1
|
+
import { a as DataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as TransPoint, l as getLayoutXml, n as SmartArtCollection, o as Connection, p as STYLE_CATEGORIES, r as Point, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "../smartart-BAhTD2yA.mjs";
|
|
2
2
|
export { COLOR_CATEGORIES, Connection, DEFAULT_DRAWING_XML, DataModel, LAYOUT_CATEGORIES, Point, STYLE_CATEGORIES, SmartArtCollection, TransPoint, createDataModel, getColorXml, getLayoutXml, getStyleXml };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as chartAttr, y as XmlComponent } from "./xml-components-
|
|
1
|
+
import { l as chartAttr, y as XmlComponent } from "./xml-components-DEU24Y1T.mjs";
|
|
2
2
|
//#region src/smartart/categories.ts
|
|
3
3
|
/** Layout ID → OOXML category type */
|
|
4
4
|
const LAYOUT_CATEGORIES = {
|
|
@@ -101,23 +101,32 @@ const COLOR_CATEGORIES = {
|
|
|
101
101
|
* based on the uniqueId / loTypeId in the data model.
|
|
102
102
|
*/
|
|
103
103
|
function getLayoutXml(layoutId) {
|
|
104
|
-
if (layoutId === "default") return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><dgm:layoutDef xmlns:dgm=\"http://schemas.openxmlformats.org/drawingml/2006/diagram\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" uniqueId=\"urn:microsoft.com/office/officeart/2005/8/layout/default\"><dgm:title val=\"\"/><dgm:desc val=\"\"/><dgm:catLst><dgm:cat type=\"list\" pri=\"400\"/></dgm:catLst><dgm:sampData><dgm:dataModel><dgm:ptLst><dgm:pt modelId=\"0\" type=\"doc\"/><dgm:pt modelId=\"1\"><dgm:prSet phldr=\"1\"/></dgm:pt><dgm:pt modelId=\"2\"><dgm:prSet phldr=\"1\"/></dgm:pt><dgm:pt modelId=\"3\"><dgm:prSet phldr=\"1\"/></dgm:pt><dgm:pt modelId=\"4\"><dgm:prSet phldr=\"1\"/></dgm:pt><dgm:pt modelId=\"5\"><dgm:prSet phldr=\"1\"/></dgm:pt></dgm:ptLst><dgm:cxnLst><dgm:cxn modelId=\"6\" srcId=\"0\" destId=\"1\" srcOrd=\"0\" destOrd=\"0\"/><dgm:cxn modelId=\"7\" srcId=\"0\" destId=\"2\" srcOrd=\"1\" destOrd=\"0\"/><dgm:cxn modelId=\"8\" srcId=\"0\" destId=\"3\" srcOrd=\"2\" destOrd=\"0\"/><dgm:cxn modelId=\"9\" srcId=\"0\" destId=\"4\" srcOrd=\"3\" destOrd=\"0\"/><dgm:cxn modelId=\"10\" srcId=\"0\" destId=\"5\" srcOrd=\"4\" destOrd=\"0\"/></dgm:cxnLst><dgm:bg/><dgm:whole/></dgm:dataModel></dgm:sampData><dgm:styleData><dgm:dataModel><dgm:ptLst><dgm:pt modelId=\"0\" type=\"doc\"/><dgm:pt modelId=\"1\"/><dgm:pt modelId=\"2\"/></dgm:ptLst><dgm:cxnLst><dgm:cxn modelId=\"3\" srcId=\"0\" destId=\"1\" srcOrd=\"0\" destOrd=\"0\"/><dgm:cxn modelId=\"4\" srcId=\"0\" destId=\"2\" srcOrd=\"1\" destOrd=\"0\"/></dgm:cxnLst><dgm:bg/><dgm:whole/></dgm:dataModel></dgm:styleData><dgm:clrData><dgm:dataModel><dgm:ptLst><dgm:pt modelId=\"0\" type=\"doc\"/><dgm:pt modelId=\"1\"/><dgm:pt modelId=\"2\"/><dgm:pt modelId=\"3\"/><dgm:pt modelId=\"4\"/><dgm:pt modelId=\"5\"/><dgm:pt modelId=\"6\"/></dgm:ptLst><dgm:cxnLst><dgm:cxn modelId=\"7\" srcId=\"0\" destId=\"1\" srcOrd=\"0\" destOrd=\"0\"/><dgm:cxn modelId=\"8\" srcId=\"0\" destId=\"2\" srcOrd=\"1\" destOrd=\"0\"/><dgm:cxn modelId=\"9\" srcId=\"0\" destId=\"3\" srcOrd=\"2\" destOrd=\"0\"/><dgm:cxn modelId=\"10\" srcId=\"0\" destId=\"4\" srcOrd=\"3\" destOrd=\"0\"/><dgm:cxn modelId=\"11\" srcId=\"0\" destId=\"5\" srcOrd=\"4\" destOrd=\"0\"/><dgm:cxn modelId=\"12\" srcId=\"0\" destId=\"6\" srcOrd=\"5\" destOrd=\"0\"/></dgm:cxnLst><dgm:bg/><dgm:whole/></dgm:dataModel></dgm:clrData><dgm:layoutNode name=\"diagram\"><dgm:varLst><dgm:dir/><dgm:resizeHandles val=\"exact\"/></dgm:varLst><dgm:choose name=\"Name0\"><dgm:if name=\"Name1\" func=\"var\" arg=\"dir\" op=\"equ\" val=\"norm\"><dgm:alg type=\"snake\"><dgm:param type=\"grDir\" val=\"tL\"/><dgm:param type=\"flowDir\" val=\"row\"/><dgm:param type=\"contDir\" val=\"sameDir\"/><dgm:param type=\"off\" val=\"ctr\"/></dgm:alg></dgm:if><dgm:else name=\"Name2\"><dgm:alg type=\"snake\"><dgm:param type=\"grDir\" val=\"tR\"/><dgm:param type=\"flowDir\" val=\"row\"/><dgm:param type=\"contDir\" val=\"sameDir\"/><dgm:param type=\"off\" val=\"ctr\"/></dgm:alg></dgm:else></dgm:choose><dgm:shape xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:blip=\"\"><dgm:adjLst/></dgm:shape><dgm:presOf/><dgm:constrLst><dgm:constr type=\"w\" for=\"ch\" forName=\"node\" refType=\"w\"/><dgm:constr type=\"h\" for=\"ch\" forName=\"node\" refType=\"w\" refFor=\"ch\" refForName=\"node\" fact=\"0.6\"/><dgm:constr type=\"w\" for=\"ch\" forName=\"sibTrans\" refType=\"w\" refFor=\"ch\" refForName=\"node\" fact=\"0.1\"/><dgm:constr type=\"sp\" refType=\"w\" refFor=\"ch\" refForName=\"sibTrans\"/><dgm:constr type=\"primFontSz\" for=\"ch\" forName=\"node\" op=\"equ\" val=\"65\"/></dgm:constrLst><dgm:ruleLst/><dgm:forEach name=\"Name3\" axis=\"ch\" ptType=\"node\"><dgm:layoutNode name=\"node\"><dgm:varLst><dgm:bulletEnabled val=\"1\"/></dgm:varLst><dgm:alg type=\"tx\"/><dgm:shape type=\"rect\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:blip=\"\"><dgm:adjLst/></dgm:shape><dgm:presOf axis=\"desOrSelf\" ptType=\"node\"/><dgm:constrLst><dgm:constr type=\"lMarg\" refType=\"primFontSz\" fact=\"0.3\"/><dgm:constr type=\"rMarg\" refType=\"primFontSz\" fact=\"0.3\"/><dgm:constr type=\"tMarg\" refType=\"primFontSz\" fact=\"0.3\"/><dgm:constr type=\"bMarg\" refType=\"primFontSz\" fact=\"0.3\"/></dgm:constrLst><dgm:ruleLst><dgm:rule type=\"primFontSz\" val=\"5\" fact=\"NaN\" max=\"NaN\"/></dgm:ruleLst></dgm:layoutNode><dgm:forEach name=\"Name4\" axis=\"followSib\" ptType=\"sibTrans\" cnt=\"1\"><dgm:layoutNode name=\"sibTrans\"><dgm:alg type=\"sp\"/><dgm:shape xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:blip=\"\"><dgm:adjLst/></dgm:shape><dgm:presOf/><dgm:constrLst/><dgm:ruleLst/></dgm:layoutNode></dgm:forEach></dgm:layoutNode></dgm:layoutDef>";
|
|
104
|
+
if (layoutId === "default") return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><dgm:layoutDef xmlns:dgm=\"http://schemas.openxmlformats.org/drawingml/2006/diagram\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" uniqueId=\"urn:microsoft.com/office/officeart/2005/8/layout/default\"><dgm:title val=\"\"/><dgm:desc val=\"\"/><dgm:catLst><dgm:cat type=\"list\" pri=\"400\"/></dgm:catLst><dgm:sampData><dgm:dataModel><dgm:ptLst><dgm:pt modelId=\"0\" type=\"doc\"/><dgm:pt modelId=\"1\"><dgm:prSet phldr=\"1\"/></dgm:pt><dgm:pt modelId=\"2\"><dgm:prSet phldr=\"1\"/></dgm:pt><dgm:pt modelId=\"3\"><dgm:prSet phldr=\"1\"/></dgm:pt><dgm:pt modelId=\"4\"><dgm:prSet phldr=\"1\"/></dgm:pt><dgm:pt modelId=\"5\"><dgm:prSet phldr=\"1\"/></dgm:pt></dgm:ptLst><dgm:cxnLst><dgm:cxn modelId=\"6\" srcId=\"0\" destId=\"1\" srcOrd=\"0\" destOrd=\"0\"/><dgm:cxn modelId=\"7\" srcId=\"0\" destId=\"2\" srcOrd=\"1\" destOrd=\"0\"/><dgm:cxn modelId=\"8\" srcId=\"0\" destId=\"3\" srcOrd=\"2\" destOrd=\"0\"/><dgm:cxn modelId=\"9\" srcId=\"0\" destId=\"4\" srcOrd=\"3\" destOrd=\"0\"/><dgm:cxn modelId=\"10\" srcId=\"0\" destId=\"5\" srcOrd=\"4\" destOrd=\"0\"/></dgm:cxnLst><dgm:bg/><dgm:whole/></dgm:dataModel></dgm:sampData><dgm:styleData><dgm:dataModel><dgm:ptLst><dgm:pt modelId=\"0\" type=\"doc\"/><dgm:pt modelId=\"1\"/><dgm:pt modelId=\"2\"/></dgm:ptLst><dgm:cxnLst><dgm:cxn modelId=\"3\" srcId=\"0\" destId=\"1\" srcOrd=\"0\" destOrd=\"0\"/><dgm:cxn modelId=\"4\" srcId=\"0\" destId=\"2\" srcOrd=\"1\" destOrd=\"0\"/></dgm:cxnLst><dgm:bg/><dgm:whole/></dgm:dataModel></dgm:styleData><dgm:clrData><dgm:dataModel><dgm:ptLst><dgm:pt modelId=\"0\" type=\"doc\"/><dgm:pt modelId=\"1\"/><dgm:pt modelId=\"2\"/><dgm:pt modelId=\"3\"/><dgm:pt modelId=\"4\"/><dgm:pt modelId=\"5\"/><dgm:pt modelId=\"6\"/></dgm:ptLst><dgm:cxnLst><dgm:cxn modelId=\"7\" srcId=\"0\" destId=\"1\" srcOrd=\"0\" destOrd=\"0\"/><dgm:cxn modelId=\"8\" srcId=\"0\" destId=\"2\" srcOrd=\"1\" destOrd=\"0\"/><dgm:cxn modelId=\"9\" srcId=\"0\" destId=\"3\" srcOrd=\"2\" destOrd=\"0\"/><dgm:cxn modelId=\"10\" srcId=\"0\" destId=\"4\" srcOrd=\"3\" destOrd=\"0\"/><dgm:cxn modelId=\"11\" srcId=\"0\" destId=\"5\" srcOrd=\"4\" destOrd=\"0\"/><dgm:cxn modelId=\"12\" srcId=\"0\" destId=\"6\" srcOrd=\"5\" destOrd=\"0\"/></dgm:cxnLst><dgm:bg/><dgm:whole/></dgm:dataModel></dgm:clrData><dgm:layoutNode name=\"diagram\" chOrder=\"b\"><dgm:varLst><dgm:dir/><dgm:resizeHandles val=\"exact\"/></dgm:varLst><dgm:choose name=\"Name0\"><dgm:if name=\"Name1\" func=\"var\" arg=\"dir\" op=\"equ\" val=\"norm\"><dgm:alg type=\"snake\"><dgm:param type=\"grDir\" val=\"tL\"/><dgm:param type=\"flowDir\" val=\"row\"/><dgm:param type=\"contDir\" val=\"sameDir\"/><dgm:param type=\"off\" val=\"ctr\"/></dgm:alg></dgm:if><dgm:else name=\"Name2\"><dgm:alg type=\"snake\"><dgm:param type=\"grDir\" val=\"tR\"/><dgm:param type=\"flowDir\" val=\"row\"/><dgm:param type=\"contDir\" val=\"sameDir\"/><dgm:param type=\"off\" val=\"ctr\"/></dgm:alg></dgm:else></dgm:choose><dgm:shape blipPhldr=\"false\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:blip=\"\"><dgm:adjLst/></dgm:shape><dgm:presOf/><dgm:constrLst><dgm:constr type=\"w\" for=\"ch\" forName=\"node\" refType=\"w\" refPtType=\"all\"/><dgm:constr type=\"h\" for=\"ch\" forName=\"node\" refType=\"w\" refFor=\"ch\" refForName=\"node\" fact=\"0.6\"/><dgm:constr type=\"w\" for=\"ch\" forName=\"sibTrans\" refType=\"w\" refFor=\"ch\" refForName=\"node\" fact=\"0.1\"/><dgm:constr type=\"sp\" refType=\"w\" refFor=\"ch\" refForName=\"sibTrans\"/><dgm:constr type=\"primFontSz\" for=\"ch\" forName=\"node\" op=\"equ\" val=\"65\"/></dgm:constrLst><dgm:ruleLst/><dgm:forEach name=\"Name3\" axis=\"ch\" ptType=\"node\" st=\"1\"><dgm:layoutNode name=\"node\"><dgm:varLst><dgm:bulletEnabled val=\"1\"/></dgm:varLst><dgm:alg type=\"tx\"/><dgm:shape type=\"rect\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:blip=\"\"><dgm:adjLst/></dgm:shape><dgm:presOf axis=\"desOrSelf\" ptType=\"node\"/><dgm:constrLst><dgm:constr type=\"lMarg\" refType=\"primFontSz\" fact=\"0.3\"/><dgm:constr type=\"rMarg\" refType=\"primFontSz\" fact=\"0.3\"/><dgm:constr type=\"tMarg\" refType=\"primFontSz\" fact=\"0.3\"/><dgm:constr type=\"bMarg\" refType=\"primFontSz\" fact=\"0.3\"/></dgm:constrLst><dgm:ruleLst><dgm:rule type=\"primFontSz\" val=\"5\" fact=\"NaN\" max=\"NaN\"/></dgm:ruleLst></dgm:layoutNode><dgm:forEach name=\"Name4\" axis=\"followSib\" ptType=\"sibTrans\" cnt=\"1\"><dgm:layoutNode name=\"sibTrans\"><dgm:alg type=\"sp\"/><dgm:shape xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:blip=\"\"><dgm:adjLst/></dgm:shape><dgm:presOf/><dgm:constrLst/><dgm:ruleLst/></dgm:layoutNode></dgm:forEach></dgm:layoutNode></dgm:layoutDef>";
|
|
105
105
|
const cat = LAYOUT_CATEGORIES[layoutId] ?? "list";
|
|
106
106
|
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><dgm:layoutDef xmlns:dgm=\"http://schemas.openxmlformats.org/drawingml/2006/diagram\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" uniqueId=\"urn:microsoft.com/office/officeart/2005/8/layout/" + layoutId + "\"><dgm:title val=\"\"/><dgm:desc val=\"\"/><dgm:catLst><dgm:cat type=\"" + cat + "\" pri=\"400\"/></dgm:catLst><dgm:sampData><dgm:dataModel><dgm:ptLst><dgm:pt modelId=\"0\" type=\"doc\"/><dgm:pt modelId=\"1\"><dgm:prSet phldr=\"1\"/></dgm:pt><dgm:pt modelId=\"2\"><dgm:prSet phldr=\"1\"/></dgm:pt></dgm:ptLst><dgm:cxnLst><dgm:cxn modelId=\"3\" srcId=\"0\" destId=\"1\" srcOrd=\"0\" destOrd=\"0\"/><dgm:cxn modelId=\"4\" srcId=\"0\" destId=\"2\" srcOrd=\"1\" destOrd=\"0\"/></dgm:cxnLst><dgm:bg/><dgm:whole/></dgm:dataModel></dgm:sampData></dgm:layoutDef>";
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
* Returns style
|
|
109
|
+
* Returns style XML with basic style definitions (fillClrLst, linClrLst, etc.)
|
|
110
|
+
* that allow PowerPoint to correctly render SmartArt colors and effects.
|
|
110
111
|
*/
|
|
111
112
|
function getStyleXml(styleId) {
|
|
112
113
|
const cat = STYLE_CATEGORIES[styleId] ?? "simple";
|
|
113
|
-
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><dgm:styleDef xmlns:dgm=\"http://schemas.openxmlformats.org/drawingml/2006/diagram\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" uniqueId=\"urn:microsoft.com/office/officeart/2005/8/quickstyle/" + styleId + "\"><dgm:title val=\"\"/><dgm:desc val=\"\"/><dgm:catLst><dgm:cat type=\"" + cat + "\" pri=\"10100\"/></dgm:catLst><dgm:scene3d><a:camera prst=\"orthographicFront\"/><a:lightRig rig=\"threePt\" dir=\"t\"/></dgm:scene3d></dgm:styleDef>";
|
|
114
|
+
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><dgm:styleDef xmlns:dgm=\"http://schemas.openxmlformats.org/drawingml/2006/diagram\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" uniqueId=\"urn:microsoft.com/office/officeart/2005/8/quickstyle/" + styleId + "\"><dgm:title val=\"\"/><dgm:desc val=\"\"/><dgm:catLst><dgm:cat type=\"" + cat + "\" pri=\"10100\"/></dgm:catLst><dgm:scene3d><a:camera prst=\"orthographicFront\"/><a:lightRig rig=\"threePt\" dir=\"t\"/></dgm:scene3d><dgm:fillClrLst><a:solidFill><a:schemeClr val=\"accent1\"/></a:solidFill><a:solidFill><a:schemeClr val=\"accent2\"/></a:solidFill><a:solidFill><a:schemeClr val=\"accent3\"/></a:solidFill><a:solidFill><a:schemeClr val=\"accent4\"/></a:solidFill><a:solidFill><a:schemeClr val=\"accent5\"/></a:solidFill><a:solidFill><a:schemeClr val=\"accent6\"/></a:solidFill></dgm:fillClrLst><dgm:linClrLst><a:solidFill><a:schemeClr val=\"tx1\"/></a:solidFill></dgm:linClrLst><dgm:effectClrLst><a:solidFill><a:schemeClr val=\"tx1\"/></a:solidFill></dgm:effectClrLst><dgm:fontClrLst><a:solidFill><a:schemeClr val=\"tx1\"/></a:solidFill><a:solidFill><a:schemeClr val=\"tx1\"/></a:solidFill><a:solidFill><a:schemeClr val=\"tx1\"/></a:solidFill></dgm:fontClrLst></dgm:styleDef>";
|
|
114
115
|
}
|
|
115
116
|
/**
|
|
116
|
-
* Returns color
|
|
117
|
+
* Returns color XML with basic color definitions (fillLst, linLst, etc.)
|
|
118
|
+
* that allow PowerPoint to correctly render SmartArt with the specified color scheme.
|
|
117
119
|
*/
|
|
118
120
|
function getColorXml(colorId) {
|
|
119
121
|
const cat = COLOR_CATEGORIES[colorId] ?? "accent1";
|
|
120
|
-
|
|
122
|
+
const accentMatch = colorId.match(/^(accent\d)/);
|
|
123
|
+
const accentVal = accentMatch ? accentMatch[1] : "accent1";
|
|
124
|
+
let colorContent;
|
|
125
|
+
if (colorId.startsWith("accent")) colorContent = `<dgm:fillLst><a:solidFill><a:schemeClr val="${accentVal}"/></a:solidFill></dgm:fillLst><dgm:linLst><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></dgm:linLst><dgm:effectLst><a:solidFill><a:schemeClr val="tx1"/></a:solidFill></dgm:effectLst><dgm:txFillLst><a:solidFill><a:schemeClr val="tx1"/></a:solidFill></dgm:txFillLst><dgm:txLinLst><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></dgm:txLinLst><dgm:txEffectLst><a:solidFill><a:schemeClr val="tx1"/></a:solidFill></dgm:txEffectLst>`;
|
|
126
|
+
else if (colorId.startsWith("colorful")) colorContent = "<dgm:fillLst><a:solidFill><a:schemeClr val=\"accent1\"/></a:solidFill><a:solidFill><a:schemeClr val=\"accent2\"/></a:solidFill><a:solidFill><a:schemeClr val=\"accent3\"/></a:solidFill><a:solidFill><a:schemeClr val=\"accent4\"/></a:solidFill><a:solidFill><a:schemeClr val=\"accent5\"/></a:solidFill></dgm:fillLst><dgm:linLst><a:solidFill><a:schemeClr val=\"lt1\"/></a:solidFill></dgm:linLst><dgm:effectLst><a:solidFill><a:schemeClr val=\"lt1\"/></a:solidFill></dgm:effectLst><dgm:txFillLst><a:solidFill><a:schemeClr val=\"tx1\"/></a:solidFill></dgm:txFillLst><dgm:txLinLst/><dgm:txEffectLst/>";
|
|
127
|
+
else if (colorId.startsWith("dark")) colorContent = "<dgm:fillLst><a:solidFill><a:schemeClr val=\"dk1\"/></a:solidFill><a:solidFill><a:schemeClr val=\"dk2\"/></a:solidFill></dgm:fillLst><dgm:linLst><a:solidFill><a:schemeClr val=\"lt1\"/></a:solidFill></dgm:linLst><dgm:effectLst><a:solidFill><a:schemeClr val=\"lt1\"/></a:solidFill></dgm:effectLst><dgm:txFillLst><a:solidFill><a:schemeClr val=\"lt1\"/></a:solidFill></dgm:txFillLst><dgm:txLinLst/><dgm:txEffectLst/>";
|
|
128
|
+
else colorContent = "<dgm:fillLst><a:solidFill><a:schemeClr val=\"accent1\"/></a:solidFill></dgm:fillLst><dgm:linLst><a:solidFill><a:schemeClr val=\"tx1\"/></a:solidFill></dgm:linLst><dgm:effectLst><a:solidFill><a:schemeClr val=\"tx1\"/></a:solidFill></dgm:effectLst><dgm:txFillLst><a:solidFill><a:schemeClr val=\"tx1\"/></a:solidFill></dgm:txFillLst><dgm:txLinLst/><dgm:txEffectLst/>";
|
|
129
|
+
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><dgm:colorsDef xmlns:dgm=\"http://schemas.openxmlformats.org/drawingml/2006/diagram\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" uniqueId=\"urn:microsoft.com/office/officeart/2005/8/colors/" + colorId + "\"><dgm:title val=\"\"/><dgm:desc val=\"\"/><dgm:catLst><dgm:cat type=\"" + cat + "\" pri=\"11200\"/></dgm:catLst>" + colorContent + "</dgm:colorsDef>";
|
|
121
130
|
}
|
|
122
131
|
/** Minimal drawing cache for SmartArt (Office apps auto-regenerate this on open) */
|
|
123
132
|
const DEFAULT_DRAWING_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><dsp:drawing xmlns:dgm=\"http://schemas.openxmlformats.org/drawingml/2006/diagram\" xmlns:dsp=\"http://schemas.microsoft.com/office/drawing/2008/diagram\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"><dsp:spTree><dsp:nvGrpSpPr><dsp:cNvPr id=\"0\" name=\"\"/><dsp:cNvGrpSpPr/></dsp:nvGrpSpPr><dsp:grpSpPr/></dsp:spTree></dsp:drawing>";
|
|
@@ -127,7 +136,7 @@ const DEFAULT_DRAWING_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone
|
|
|
127
136
|
* dgm:cxn — SmartArt data model connection (edge).
|
|
128
137
|
*/
|
|
129
138
|
var Connection = class extends XmlComponent {
|
|
130
|
-
constructor(modelId, srcId, destId, type, srcOrd = 0, destOrd = 0, parTransId, sibTransId) {
|
|
139
|
+
constructor(modelId, srcId, destId, type, srcOrd = 0, destOrd = 0, parTransId, sibTransId, presId) {
|
|
131
140
|
super("dgm:cxn");
|
|
132
141
|
const attrs = {
|
|
133
142
|
modelId,
|
|
@@ -139,6 +148,7 @@ var Connection = class extends XmlComponent {
|
|
|
139
148
|
if (type) attrs.type = type;
|
|
140
149
|
if (parTransId) attrs.parTransId = parTransId;
|
|
141
150
|
if (sibTransId) attrs.sibTransId = sibTransId;
|
|
151
|
+
if (presId) attrs.presId = presId;
|
|
142
152
|
this.root.push(chartAttr(attrs));
|
|
143
153
|
}
|
|
144
154
|
};
|
|
@@ -183,16 +193,61 @@ var EmptyElement$2 = class extends XmlComponent {
|
|
|
183
193
|
* dgm:pt — SmartArt data model point (node).
|
|
184
194
|
*/
|
|
185
195
|
var Point = class extends XmlComponent {
|
|
186
|
-
constructor(modelId, text, type = "node") {
|
|
196
|
+
constructor(modelId, text, type = "node", propertySet) {
|
|
187
197
|
super("dgm:pt");
|
|
188
198
|
this.root.push(chartAttr({
|
|
189
199
|
modelId,
|
|
190
200
|
type
|
|
191
201
|
}));
|
|
202
|
+
if (propertySet) this.root.push(new PropertySet(propertySet));
|
|
192
203
|
this.root.push(new PointText(text));
|
|
193
204
|
}
|
|
194
205
|
};
|
|
195
206
|
/**
|
|
207
|
+
* dgm:prSet — Property set for a SmartArt data model point.
|
|
208
|
+
*/
|
|
209
|
+
var PropertySet = class extends XmlComponent {
|
|
210
|
+
constructor(opts) {
|
|
211
|
+
super("dgm:prSet");
|
|
212
|
+
const attr = {};
|
|
213
|
+
if (opts.presentationAssociationId !== void 0) attr.presAssocID = opts.presentationAssociationId;
|
|
214
|
+
if (opts.presentationName !== void 0) attr.presName = opts.presentationName;
|
|
215
|
+
if (opts.presentationStyleLabel !== void 0) attr.presStyleLbl = opts.presentationStyleLabel;
|
|
216
|
+
if (opts.presentationStyleIndex !== void 0) attr.presStyleIdx = opts.presentationStyleIndex;
|
|
217
|
+
if (opts.presentationStyleCount !== void 0) attr.presStyleCnt = opts.presentationStyleCount;
|
|
218
|
+
if (opts.placeholderText !== void 0) attr.phldrT = opts.placeholderText;
|
|
219
|
+
if (opts.placeholder !== void 0) attr.phldr = opts.placeholder ? "1" : "0";
|
|
220
|
+
if (opts.customAngle !== void 0) attr.custAng = opts.customAngle;
|
|
221
|
+
if (opts.customFlipVertical !== void 0) attr.custFlipVert = opts.customFlipVertical ? "1" : "0";
|
|
222
|
+
if (opts.customFlipHorizontal !== void 0) attr.custFlipHor = opts.customFlipHorizontal ? "1" : "0";
|
|
223
|
+
if (opts.customSizeX !== void 0) attr.custSzX = opts.customSizeX;
|
|
224
|
+
if (opts.customSizeY !== void 0) attr.custSzY = opts.customSizeY;
|
|
225
|
+
if (opts.customScaleX !== void 0) attr.custScaleX = opts.customScaleX;
|
|
226
|
+
if (opts.customScaleY !== void 0) attr.custScaleY = opts.customScaleY;
|
|
227
|
+
if (opts.customText !== void 0) attr.custT = opts.customText ? "1" : "0";
|
|
228
|
+
if (opts.customLinearFactorX !== void 0) attr.custLinFactX = opts.customLinearFactorX;
|
|
229
|
+
if (opts.customLinearFactorY !== void 0) attr.custLinFactY = opts.customLinearFactorY;
|
|
230
|
+
if (opts.customLinearFactorNeighborX !== void 0) attr.custLinFactNeighborX = opts.customLinearFactorNeighborX;
|
|
231
|
+
if (opts.customLinearFactorNeighborY !== void 0) attr.custLinFactNeighborY = opts.customLinearFactorNeighborY;
|
|
232
|
+
if (opts.customRadialScaleRadius !== void 0) attr.custRadScaleRad = opts.customRadialScaleRadius;
|
|
233
|
+
if (opts.customRadialScaleIncrement !== void 0) attr.custRadScaleInc = opts.customRadialScaleIncrement;
|
|
234
|
+
if (opts.coherent3DOffset !== void 0) attr.coherent3DOff = opts.coherent3DOffset ? "1" : "0";
|
|
235
|
+
if (opts.hideGeometry !== void 0) attr.hideGeom = opts.hideGeometry ? "1" : "0";
|
|
236
|
+
if (opts.hideLastTransition !== void 0) attr.hideLastTrans = opts.hideLastTransition ? "1" : "0";
|
|
237
|
+
if (opts.lockTextEntry !== void 0) attr.lkTxEntry = opts.lockTextEntry ? "1" : "0";
|
|
238
|
+
if (opts.moveWith !== void 0) attr.moveWith = opts.moveWith;
|
|
239
|
+
if (opts.useDefault !== void 0) attr.useDef = opts.useDefault ? "1" : "0";
|
|
240
|
+
if (opts.zOrderOffset !== void 0) attr.zOrderOff = opts.zOrderOffset;
|
|
241
|
+
if (opts.layoutTypeId !== void 0) attr.loTypeId = opts.layoutTypeId;
|
|
242
|
+
if (opts.layoutCategoryId !== void 0) attr.loCatId = opts.layoutCategoryId;
|
|
243
|
+
if (opts.quickStyleTypeId !== void 0) attr.qsTypeId = opts.quickStyleTypeId;
|
|
244
|
+
if (opts.quickStyleCategoryId !== void 0) attr.qsCatId = opts.quickStyleCategoryId;
|
|
245
|
+
if (opts.colorStyleTypeId !== void 0) attr.csTypeId = opts.colorStyleTypeId;
|
|
246
|
+
if (opts.colorStyleCategoryId !== void 0) attr.csCatId = opts.colorStyleCategoryId;
|
|
247
|
+
if (Object.keys(attr).length > 0) this.root.push({ _attr: attr });
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
196
251
|
* Transition point (parTrans or sibTrans) — no text body, references a connection.
|
|
197
252
|
*/
|
|
198
253
|
var TransPoint = class extends XmlComponent {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as FontSchemeOptions, i as ColorSchemeOptions, n as buildThemeXml, o as ThemeOptions, r as DefaultTheme, t as DEFAULT_COLORS } from "../index-Cj2Yf5mk.mjs";
|
|
2
|
+
export { type ColorSchemeOptions, DEFAULT_COLORS, DefaultTheme, type FontSchemeOptions, type ThemeOptions, buildThemeXml };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { b as BaseXmlComponent } from "./xml-components-DEU24Y1T.mjs";
|
|
2
|
+
//#region src/theme/default-colors.ts
|
|
3
|
+
/** Office 2016+ default theme colors (hex without #). */
|
|
4
|
+
const DEFAULT_COLORS = {
|
|
5
|
+
dark1: "000000",
|
|
6
|
+
light1: "FFFFFF",
|
|
7
|
+
dark2: "44546A",
|
|
8
|
+
light2: "E7E6E6",
|
|
9
|
+
accent1: "4472C4",
|
|
10
|
+
accent2: "ED7D31",
|
|
11
|
+
accent3: "A5A5A5",
|
|
12
|
+
accent4: "FFC000",
|
|
13
|
+
accent5: "5B9BD5",
|
|
14
|
+
accent6: "70AD47",
|
|
15
|
+
hyperlink: "0563C1",
|
|
16
|
+
followedHyperlink: "954F72"
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/theme/build-theme-xml.ts
|
|
20
|
+
/**
|
|
21
|
+
* Build theme XML string — pure function, no side effects.
|
|
22
|
+
*
|
|
23
|
+
* fmtScheme uses the complete Office version (gradFill, outerShdw, bgFillStyleLst)
|
|
24
|
+
* matching what Excel generates.
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
function buildThemeXml(options) {
|
|
29
|
+
const name = options?.name ?? "Office Theme";
|
|
30
|
+
const c = {
|
|
31
|
+
...DEFAULT_COLORS,
|
|
32
|
+
...options?.colors
|
|
33
|
+
};
|
|
34
|
+
const f = options?.fonts;
|
|
35
|
+
const majorFont = f?.majorFont ?? "Calibri Light";
|
|
36
|
+
const minorFont = f?.minorFont ?? "Calibri";
|
|
37
|
+
const majorFontAsian = f?.majorFontAsian ?? "";
|
|
38
|
+
const minorFontAsian = f?.minorFontAsian ?? "";
|
|
39
|
+
return `<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="${name}"><a:themeElements><a:clrScheme name="${name}"><a:dk1>${options?.colors?.dark1 !== void 0 ? `<a:srgbClr val="${c.dark1}"/>` : `<a:sysClr val="windowText" lastClr="000000"/>`}</a:dk1><a:lt1>${options?.colors?.light1 !== void 0 ? `<a:srgbClr val="${c.light1}"/>` : `<a:sysClr val="window" lastClr="FFFFFF"/>`}</a:lt1><a:dk2><a:srgbClr val="${c.dark2}"/></a:dk2><a:lt2><a:srgbClr val="${c.light2}"/></a:lt2><a:accent1><a:srgbClr val="${c.accent1}"/></a:accent1><a:accent2><a:srgbClr val="${c.accent2}"/></a:accent2><a:accent3><a:srgbClr val="${c.accent3}"/></a:accent3><a:accent4><a:srgbClr val="${c.accent4}"/></a:accent4><a:accent5><a:srgbClr val="${c.accent5}"/></a:accent5><a:accent6><a:srgbClr val="${c.accent6}"/></a:accent6><a:hlink><a:srgbClr val="${c.hyperlink}"/></a:hlink><a:folHlink><a:srgbClr val="${c.followedHyperlink}"/></a:folHlink></a:clrScheme><a:fontScheme name="${name}"><a:majorFont><a:latin typeface="${majorFont}" panose="020F0302020204030204"/><a:ea typeface="${majorFontAsian}"/><a:cs typeface=""/></a:majorFont><a:minorFont><a:latin typeface="${minorFont}" panose="020F0502020204030204"/><a:ea typeface="${minorFontAsian}"/><a:cs typeface=""/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="110000"/><a:satMod val="105000"/><a:tint val="67000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="103000"/><a:tint val="73000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="109000"/><a:tint val="81000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="102000"/><a:satMod val="103000"/><a:tint val="94000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="100000"/><a:satMod val="110000"/><a:shade val="100000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="99000"/><a:satMod val="120000"/><a:shade val="78000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="12700" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="19050" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="63000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/><a:satMod val="170000"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="102000"/><a:satMod val="150000"/><a:tint val="93000"/><a:shade val="98000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="103000"/><a:satMod val="130000"/><a:tint val="98000"/><a:shade val="90000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:satMod val="120000"/><a:shade val="63000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/></a:theme>`;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/theme/default-theme.ts
|
|
43
|
+
/**
|
|
44
|
+
* DefaultTheme — cached theme XML component.
|
|
45
|
+
*
|
|
46
|
+
* - No-arg constructor returns module-level pre-computed constant (zero allocation).
|
|
47
|
+
* - With options, builds XML string and caches by key.
|
|
48
|
+
*
|
|
49
|
+
* @module
|
|
50
|
+
*/
|
|
51
|
+
const DEFAULT_XML = buildThemeXml();
|
|
52
|
+
const customCache = /* @__PURE__ */ new Map();
|
|
53
|
+
function themeKey(o) {
|
|
54
|
+
const c = o.colors;
|
|
55
|
+
const f = o.fonts;
|
|
56
|
+
return `n${o.name ?? ""}c${c?.dark1 ?? ""}${c?.light1 ?? ""}${c?.dark2 ?? ""}${c?.light2 ?? ""}${c?.accent1 ?? ""}${c?.accent2 ?? ""}${c?.accent3 ?? ""}${c?.accent4 ?? ""}${c?.accent5 ?? ""}${c?.accent6 ?? ""}${c?.hyperlink ?? ""}${c?.followedHyperlink ?? ""}f${f?.majorFont ?? ""}${f?.minorFont ?? ""}${f?.majorFontAsian ?? ""}${f?.minorFontAsian ?? ""}`;
|
|
57
|
+
}
|
|
58
|
+
var DefaultTheme = class extends BaseXmlComponent {
|
|
59
|
+
xml;
|
|
60
|
+
constructor(options) {
|
|
61
|
+
super("a:theme");
|
|
62
|
+
if (!options) {
|
|
63
|
+
this.xml = DEFAULT_XML;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const key = themeKey(options);
|
|
67
|
+
const cached = customCache.get(key);
|
|
68
|
+
if (cached) this.xml = cached;
|
|
69
|
+
else {
|
|
70
|
+
const built = buildThemeXml(options);
|
|
71
|
+
customCache.set(key, built);
|
|
72
|
+
this.xml = built;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
toXml(_context) {
|
|
76
|
+
return this.xml;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { buildThemeXml as n, DEFAULT_COLORS as r, DefaultTheme as t };
|
|
@@ -11,10 +11,6 @@ var BaseXmlComponent = class {
|
|
|
11
11
|
this.rootKey = rootKey;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* @deprecated Use `toXml()` instead.
|
|
15
|
-
*/
|
|
16
|
-
prepForXml(_context) {}
|
|
17
|
-
/**
|
|
18
14
|
* Direct XML serialization. Override in subclasses for zero-allocation output.
|
|
19
15
|
*/
|
|
20
16
|
toXml(_context) {
|
|
@@ -57,19 +53,6 @@ var XmlComponent = class extends BaseXmlComponent {
|
|
|
57
53
|
this.root = [];
|
|
58
54
|
}
|
|
59
55
|
/**
|
|
60
|
-
* @deprecated Use `toXml()` instead.
|
|
61
|
-
*/
|
|
62
|
-
prepForXml(context) {
|
|
63
|
-
context.stack.push(this);
|
|
64
|
-
const children = [];
|
|
65
|
-
for (const comp of this.root) if (comp instanceof BaseXmlComponent) {
|
|
66
|
-
const prepared = comp.prepForXml(context);
|
|
67
|
-
if (prepared !== void 0) children.push(prepared);
|
|
68
|
-
} else children.push(comp);
|
|
69
|
-
context.stack.pop();
|
|
70
|
-
return { [this.rootKey]: children.length ? children.length === 1 && children[0] && typeof children[0] === "object" && "_attr" in children[0] ? children[0] : children : EMPTY_OBJECT };
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
56
|
* Direct XML serialization — traverses `root` and calls `toXml()` on
|
|
74
57
|
* each child, concatenating the results into a single string.
|
|
75
58
|
*/
|
|
@@ -113,7 +96,7 @@ var XmlComponent = class extends BaseXmlComponent {
|
|
|
113
96
|
return body.length === 0 ? `<${this.rootKey}${attrStr}/>` : `<${this.rootKey}${attrStr}>${body}</${this.rootKey}>`;
|
|
114
97
|
}
|
|
115
98
|
/**
|
|
116
|
-
* @
|
|
99
|
+
* @internal
|
|
117
100
|
*/
|
|
118
101
|
addChildElement(child) {
|
|
119
102
|
this.root.push(child);
|
|
@@ -130,14 +113,6 @@ var IgnoreIfEmptyXmlComponent = class extends XmlComponent {
|
|
|
130
113
|
this.includeIfEmpty = includeIfEmpty;
|
|
131
114
|
}
|
|
132
115
|
/**
|
|
133
|
-
* @deprecated Use `toXml()` instead.
|
|
134
|
-
*/
|
|
135
|
-
prepForXml(context) {
|
|
136
|
-
if (this.includeIfEmpty) return super.prepForXml(context);
|
|
137
|
-
const result = super.prepForXml(context);
|
|
138
|
-
return result && result[this.rootKey] === EMPTY_OBJECT ? void 0 : result;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
116
|
* Suppress empty elements — super.toXml() produces a self-closing tag
|
|
142
117
|
* (`<tag/>`) when there are no child elements; IgnoreIfEmpty returns ""
|
|
143
118
|
* in that case. Child components that already override toXml() (e.g.
|
|
@@ -323,12 +298,6 @@ var ImportedRootElementAttributes = class extends XmlComponent {
|
|
|
323
298
|
this._attr = _attr;
|
|
324
299
|
if (_attr) this.root.push({ _attr });
|
|
325
300
|
}
|
|
326
|
-
/**
|
|
327
|
-
* @deprecated Use `toXml()` instead.
|
|
328
|
-
*/
|
|
329
|
-
prepForXml(_context) {
|
|
330
|
-
return { _attr: this._attr };
|
|
331
|
-
}
|
|
332
301
|
toXml(_context) {
|
|
333
302
|
return "";
|
|
334
303
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@office-open/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shared OOXML infrastructure
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Shared OOXML infrastructure — XML components, validators, converters, charts, and SmartArt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"core",
|
|
7
7
|
"office-open",
|
|
@@ -49,13 +49,22 @@
|
|
|
49
49
|
"./drawingml": {
|
|
50
50
|
"types": "./dist/drawingml/index.d.mts",
|
|
51
51
|
"import": "./dist/drawingml/index.mjs"
|
|
52
|
+
},
|
|
53
|
+
"./patch": {
|
|
54
|
+
"types": "./dist/patch/index.d.mts",
|
|
55
|
+
"import": "./dist/patch/index.mjs"
|
|
56
|
+
},
|
|
57
|
+
"./theme": {
|
|
58
|
+
"types": "./dist/theme/index.d.mts",
|
|
59
|
+
"import": "./dist/theme/index.mjs"
|
|
52
60
|
}
|
|
53
61
|
},
|
|
54
62
|
"dependencies": {
|
|
55
63
|
"fflate": "0.8.3",
|
|
56
64
|
"hash.js": "1.1.7",
|
|
57
65
|
"nanoid": "5.1.11",
|
|
58
|
-
"
|
|
66
|
+
"undio": "0.2.0",
|
|
67
|
+
"@office-open/xml": "0.8.0"
|
|
59
68
|
},
|
|
60
69
|
"scripts": {
|
|
61
70
|
"dev": "basis build --stub",
|