@office-kit/pptx 0.17.0 → 0.18.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/CHANGELOG.md +45 -0
- package/dist/{api-DTHZaBPq.js → api-0CdoUwvg.js} +704 -56
- package/dist/api-0CdoUwvg.js.map +1 -0
- package/dist/{index-Bfvx6-CU.d.ts → index-bswJVsv2.d.ts} +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +1 -1
- package/package.json +1 -1
- package/dist/api-DTHZaBPq.js.map +0 -1
|
@@ -1682,6 +1682,310 @@ const oneOf = (value, allowed, field) => {
|
|
|
1682
1682
|
return value;
|
|
1683
1683
|
};
|
|
1684
1684
|
//#endregion
|
|
1685
|
+
//#region src/internal/enum-values.ts
|
|
1686
|
+
const SHAPE_PRESETS = [
|
|
1687
|
+
"line",
|
|
1688
|
+
"lineInv",
|
|
1689
|
+
"triangle",
|
|
1690
|
+
"rtTriangle",
|
|
1691
|
+
"rect",
|
|
1692
|
+
"diamond",
|
|
1693
|
+
"parallelogram",
|
|
1694
|
+
"trapezoid",
|
|
1695
|
+
"nonIsoscelesTrapezoid",
|
|
1696
|
+
"pentagon",
|
|
1697
|
+
"hexagon",
|
|
1698
|
+
"heptagon",
|
|
1699
|
+
"octagon",
|
|
1700
|
+
"decagon",
|
|
1701
|
+
"dodecagon",
|
|
1702
|
+
"star4",
|
|
1703
|
+
"star5",
|
|
1704
|
+
"star6",
|
|
1705
|
+
"star7",
|
|
1706
|
+
"star8",
|
|
1707
|
+
"star10",
|
|
1708
|
+
"star12",
|
|
1709
|
+
"star16",
|
|
1710
|
+
"star24",
|
|
1711
|
+
"star32",
|
|
1712
|
+
"roundRect",
|
|
1713
|
+
"round1Rect",
|
|
1714
|
+
"round2SameRect",
|
|
1715
|
+
"round2DiagRect",
|
|
1716
|
+
"snipRoundRect",
|
|
1717
|
+
"snip1Rect",
|
|
1718
|
+
"snip2SameRect",
|
|
1719
|
+
"snip2DiagRect",
|
|
1720
|
+
"plaque",
|
|
1721
|
+
"ellipse",
|
|
1722
|
+
"teardrop",
|
|
1723
|
+
"homePlate",
|
|
1724
|
+
"chevron",
|
|
1725
|
+
"pieWedge",
|
|
1726
|
+
"pie",
|
|
1727
|
+
"blockArc",
|
|
1728
|
+
"donut",
|
|
1729
|
+
"noSmoking",
|
|
1730
|
+
"rightArrow",
|
|
1731
|
+
"leftArrow",
|
|
1732
|
+
"upArrow",
|
|
1733
|
+
"downArrow",
|
|
1734
|
+
"stripedRightArrow",
|
|
1735
|
+
"notchedRightArrow",
|
|
1736
|
+
"bentUpArrow",
|
|
1737
|
+
"leftRightArrow",
|
|
1738
|
+
"upDownArrow",
|
|
1739
|
+
"leftUpArrow",
|
|
1740
|
+
"leftRightUpArrow",
|
|
1741
|
+
"quadArrow",
|
|
1742
|
+
"leftArrowCallout",
|
|
1743
|
+
"rightArrowCallout",
|
|
1744
|
+
"upArrowCallout",
|
|
1745
|
+
"downArrowCallout",
|
|
1746
|
+
"leftRightArrowCallout",
|
|
1747
|
+
"upDownArrowCallout",
|
|
1748
|
+
"quadArrowCallout",
|
|
1749
|
+
"bentArrow",
|
|
1750
|
+
"uturnArrow",
|
|
1751
|
+
"circularArrow",
|
|
1752
|
+
"leftCircularArrow",
|
|
1753
|
+
"leftRightCircularArrow",
|
|
1754
|
+
"curvedRightArrow",
|
|
1755
|
+
"curvedLeftArrow",
|
|
1756
|
+
"curvedUpArrow",
|
|
1757
|
+
"curvedDownArrow",
|
|
1758
|
+
"swooshArrow",
|
|
1759
|
+
"cube",
|
|
1760
|
+
"can",
|
|
1761
|
+
"lightningBolt",
|
|
1762
|
+
"heart",
|
|
1763
|
+
"sun",
|
|
1764
|
+
"moon",
|
|
1765
|
+
"smileyFace",
|
|
1766
|
+
"irregularSeal1",
|
|
1767
|
+
"irregularSeal2",
|
|
1768
|
+
"foldedCorner",
|
|
1769
|
+
"bevel",
|
|
1770
|
+
"frame",
|
|
1771
|
+
"halfFrame",
|
|
1772
|
+
"corner",
|
|
1773
|
+
"diagStripe",
|
|
1774
|
+
"chord",
|
|
1775
|
+
"arc",
|
|
1776
|
+
"leftBracket",
|
|
1777
|
+
"rightBracket",
|
|
1778
|
+
"leftBrace",
|
|
1779
|
+
"rightBrace",
|
|
1780
|
+
"bracketPair",
|
|
1781
|
+
"bracePair",
|
|
1782
|
+
"straightConnector1",
|
|
1783
|
+
"bentConnector2",
|
|
1784
|
+
"bentConnector3",
|
|
1785
|
+
"bentConnector4",
|
|
1786
|
+
"bentConnector5",
|
|
1787
|
+
"curvedConnector2",
|
|
1788
|
+
"curvedConnector3",
|
|
1789
|
+
"curvedConnector4",
|
|
1790
|
+
"curvedConnector5",
|
|
1791
|
+
"callout1",
|
|
1792
|
+
"callout2",
|
|
1793
|
+
"callout3",
|
|
1794
|
+
"accentCallout1",
|
|
1795
|
+
"accentCallout2",
|
|
1796
|
+
"accentCallout3",
|
|
1797
|
+
"borderCallout1",
|
|
1798
|
+
"borderCallout2",
|
|
1799
|
+
"borderCallout3",
|
|
1800
|
+
"accentBorderCallout1",
|
|
1801
|
+
"accentBorderCallout2",
|
|
1802
|
+
"accentBorderCallout3",
|
|
1803
|
+
"wedgeRectCallout",
|
|
1804
|
+
"wedgeRoundRectCallout",
|
|
1805
|
+
"wedgeEllipseCallout",
|
|
1806
|
+
"cloudCallout",
|
|
1807
|
+
"cloud",
|
|
1808
|
+
"ribbon",
|
|
1809
|
+
"ribbon2",
|
|
1810
|
+
"ellipseRibbon",
|
|
1811
|
+
"ellipseRibbon2",
|
|
1812
|
+
"leftRightRibbon",
|
|
1813
|
+
"verticalScroll",
|
|
1814
|
+
"horizontalScroll",
|
|
1815
|
+
"wave",
|
|
1816
|
+
"doubleWave",
|
|
1817
|
+
"plus",
|
|
1818
|
+
"flowChartProcess",
|
|
1819
|
+
"flowChartDecision",
|
|
1820
|
+
"flowChartInputOutput",
|
|
1821
|
+
"flowChartPredefinedProcess",
|
|
1822
|
+
"flowChartInternalStorage",
|
|
1823
|
+
"flowChartDocument",
|
|
1824
|
+
"flowChartMultidocument",
|
|
1825
|
+
"flowChartTerminator",
|
|
1826
|
+
"flowChartPreparation",
|
|
1827
|
+
"flowChartManualInput",
|
|
1828
|
+
"flowChartManualOperation",
|
|
1829
|
+
"flowChartConnector",
|
|
1830
|
+
"flowChartPunchedCard",
|
|
1831
|
+
"flowChartPunchedTape",
|
|
1832
|
+
"flowChartSummingJunction",
|
|
1833
|
+
"flowChartOr",
|
|
1834
|
+
"flowChartCollate",
|
|
1835
|
+
"flowChartSort",
|
|
1836
|
+
"flowChartExtract",
|
|
1837
|
+
"flowChartMerge",
|
|
1838
|
+
"flowChartOfflineStorage",
|
|
1839
|
+
"flowChartOnlineStorage",
|
|
1840
|
+
"flowChartMagneticTape",
|
|
1841
|
+
"flowChartMagneticDisk",
|
|
1842
|
+
"flowChartMagneticDrum",
|
|
1843
|
+
"flowChartDisplay",
|
|
1844
|
+
"flowChartDelay",
|
|
1845
|
+
"flowChartAlternateProcess",
|
|
1846
|
+
"flowChartOffpageConnector",
|
|
1847
|
+
"actionButtonBlank",
|
|
1848
|
+
"actionButtonHome",
|
|
1849
|
+
"actionButtonHelp",
|
|
1850
|
+
"actionButtonInformation",
|
|
1851
|
+
"actionButtonForwardNext",
|
|
1852
|
+
"actionButtonBackPrevious",
|
|
1853
|
+
"actionButtonEnd",
|
|
1854
|
+
"actionButtonBeginning",
|
|
1855
|
+
"actionButtonReturn",
|
|
1856
|
+
"actionButtonDocument",
|
|
1857
|
+
"actionButtonSound",
|
|
1858
|
+
"actionButtonMovie",
|
|
1859
|
+
"gear6",
|
|
1860
|
+
"gear9",
|
|
1861
|
+
"funnel",
|
|
1862
|
+
"mathPlus",
|
|
1863
|
+
"mathMinus",
|
|
1864
|
+
"mathMultiply",
|
|
1865
|
+
"mathDivide",
|
|
1866
|
+
"mathEqual",
|
|
1867
|
+
"mathNotEqual",
|
|
1868
|
+
"cornerTabs",
|
|
1869
|
+
"squareTabs",
|
|
1870
|
+
"plaqueTabs",
|
|
1871
|
+
"chartX",
|
|
1872
|
+
"chartStar",
|
|
1873
|
+
"chartPlus"
|
|
1874
|
+
];
|
|
1875
|
+
const LINE_DASHES = [
|
|
1876
|
+
"solid",
|
|
1877
|
+
"dot",
|
|
1878
|
+
"dash",
|
|
1879
|
+
"lgDash",
|
|
1880
|
+
"dashDot",
|
|
1881
|
+
"lgDashDot",
|
|
1882
|
+
"lgDashDotDot",
|
|
1883
|
+
"sysDash",
|
|
1884
|
+
"sysDot",
|
|
1885
|
+
"sysDashDot",
|
|
1886
|
+
"sysDashDotDot"
|
|
1887
|
+
];
|
|
1888
|
+
const TEXT_DIRECTIONS = [
|
|
1889
|
+
"horz",
|
|
1890
|
+
"vert",
|
|
1891
|
+
"vert270",
|
|
1892
|
+
"wordArtVert",
|
|
1893
|
+
"eaVert",
|
|
1894
|
+
"mongolianVert",
|
|
1895
|
+
"wordArtVertRtl"
|
|
1896
|
+
];
|
|
1897
|
+
const AUTO_NUMBER_SCHEMES = [
|
|
1898
|
+
"alphaLcParenBoth",
|
|
1899
|
+
"alphaUcParenBoth",
|
|
1900
|
+
"alphaLcParenR",
|
|
1901
|
+
"alphaUcParenR",
|
|
1902
|
+
"alphaLcPeriod",
|
|
1903
|
+
"alphaUcPeriod",
|
|
1904
|
+
"arabicParenBoth",
|
|
1905
|
+
"arabicParenR",
|
|
1906
|
+
"arabicPeriod",
|
|
1907
|
+
"arabicPlain",
|
|
1908
|
+
"romanLcParenBoth",
|
|
1909
|
+
"romanUcParenBoth",
|
|
1910
|
+
"romanLcParenR",
|
|
1911
|
+
"romanUcParenR",
|
|
1912
|
+
"romanLcPeriod",
|
|
1913
|
+
"romanUcPeriod",
|
|
1914
|
+
"circleNumDbPlain",
|
|
1915
|
+
"circleNumWdBlackPlain",
|
|
1916
|
+
"circleNumWdWhitePlain",
|
|
1917
|
+
"arabicDbPeriod",
|
|
1918
|
+
"arabicDbPlain",
|
|
1919
|
+
"ea1ChsPeriod",
|
|
1920
|
+
"ea1ChsPlain",
|
|
1921
|
+
"ea1ChtPeriod",
|
|
1922
|
+
"ea1ChtPlain",
|
|
1923
|
+
"ea1JpnChsDbPeriod",
|
|
1924
|
+
"ea1JpnKorPlain",
|
|
1925
|
+
"ea1JpnKorPeriod",
|
|
1926
|
+
"arabic1Minus",
|
|
1927
|
+
"arabic2Minus",
|
|
1928
|
+
"hebrew2Minus",
|
|
1929
|
+
"thaiAlphaPeriod",
|
|
1930
|
+
"thaiAlphaParenR",
|
|
1931
|
+
"thaiAlphaParenBoth",
|
|
1932
|
+
"thaiNumPeriod",
|
|
1933
|
+
"thaiNumParenR",
|
|
1934
|
+
"thaiNumParenBoth",
|
|
1935
|
+
"hindiAlphaPeriod",
|
|
1936
|
+
"hindiNumPeriod",
|
|
1937
|
+
"hindiNumParenR",
|
|
1938
|
+
"hindiAlpha1Period"
|
|
1939
|
+
];
|
|
1940
|
+
const UNDERLINES = [
|
|
1941
|
+
"none",
|
|
1942
|
+
"words",
|
|
1943
|
+
"sng",
|
|
1944
|
+
"dbl",
|
|
1945
|
+
"heavy",
|
|
1946
|
+
"dotted",
|
|
1947
|
+
"dottedHeavy",
|
|
1948
|
+
"dash",
|
|
1949
|
+
"dashHeavy",
|
|
1950
|
+
"dashLong",
|
|
1951
|
+
"dashLongHeavy",
|
|
1952
|
+
"dotDash",
|
|
1953
|
+
"dotDashHeavy",
|
|
1954
|
+
"dotDotDash",
|
|
1955
|
+
"dotDotDashHeavy",
|
|
1956
|
+
"wavy",
|
|
1957
|
+
"wavyHeavy",
|
|
1958
|
+
"wavyDbl"
|
|
1959
|
+
];
|
|
1960
|
+
const STRIKES = [
|
|
1961
|
+
"noStrike",
|
|
1962
|
+
"sngStrike",
|
|
1963
|
+
"dblStrike"
|
|
1964
|
+
];
|
|
1965
|
+
const SLIDE_SIZE_TYPES = [
|
|
1966
|
+
"screen4x3",
|
|
1967
|
+
"letter",
|
|
1968
|
+
"A4",
|
|
1969
|
+
"35mm",
|
|
1970
|
+
"overhead",
|
|
1971
|
+
"banner",
|
|
1972
|
+
"custom",
|
|
1973
|
+
"ledger",
|
|
1974
|
+
"A3",
|
|
1975
|
+
"B4ISO",
|
|
1976
|
+
"B5ISO",
|
|
1977
|
+
"B4JIS",
|
|
1978
|
+
"B5JIS",
|
|
1979
|
+
"hagakiCard",
|
|
1980
|
+
"screen16x9",
|
|
1981
|
+
"screen16x10"
|
|
1982
|
+
];
|
|
1983
|
+
const TEXT_ANCHORS = {
|
|
1984
|
+
top: "t",
|
|
1985
|
+
center: "ctr",
|
|
1986
|
+
bottom: "b"
|
|
1987
|
+
};
|
|
1988
|
+
//#endregion
|
|
1685
1989
|
//#region src/internal/drawingml/color.ts
|
|
1686
1990
|
const NAME_SRGB_CLR$4 = qname("a", "srgbClr", NS.dml);
|
|
1687
1991
|
const NAME_SCHEME_CLR$2 = qname("a", "schemeClr", NS.dml);
|
|
@@ -1838,8 +2142,21 @@ const setHighlight = (rPr, value) => {
|
|
|
1838
2142
|
if (parsed === null) throw new Error(`unrecognized highlight color: ${value}`);
|
|
1839
2143
|
insertChildByRank(rPr, elem(NAME_HIGHLIGHT, { children: [parsed.kind === "srgb" ? elem(NAME_SRGB_CLR$3, { attrs: [attr(ATTR_VAL$8, parsed.hex)] }) : elem(NAME_SCHEME_CLR$1, { attrs: [attr(ATTR_VAL$8, parsed.token)] })] }), rprChildRank);
|
|
1840
2144
|
};
|
|
2145
|
+
const validateFormatEnums = (format, caller) => {
|
|
2146
|
+
if (format.underline != null && typeof format.underline !== "boolean") oneOf(format.underline, UNDERLINES, `${caller}: underline`);
|
|
2147
|
+
if (format.strike != null && typeof format.strike !== "boolean") oneOf(format.strike, STRIKES, `${caller}: strike`);
|
|
2148
|
+
if (format.cap != null) oneOf(format.cap, [
|
|
2149
|
+
"none",
|
|
2150
|
+
"small",
|
|
2151
|
+
"all"
|
|
2152
|
+
], `${caller}: cap`);
|
|
2153
|
+
};
|
|
1841
2154
|
/** Mutates `rPr` in place per `format`. */
|
|
1842
|
-
const applyRunFormat = (rPr, format) => {
|
|
2155
|
+
const applyRunFormat = (rPr, format, caller = "setShapeRunFormat") => {
|
|
2156
|
+
validateFormatEnums(format, caller);
|
|
2157
|
+
applyValidatedRunFormat(rPr, format);
|
|
2158
|
+
};
|
|
2159
|
+
const applyValidatedRunFormat = (rPr, format) => {
|
|
1843
2160
|
let attrs = rPr.attrs;
|
|
1844
2161
|
if (format.size !== void 0) {
|
|
1845
2162
|
const sz = fontSizeHundredthPt(format.size * 100, "setShapeRunFormat: size");
|
|
@@ -1877,7 +2194,11 @@ const applyRunFormat = (rPr, format) => {
|
|
|
1877
2194
|
* supplied format. Existing run-property attributes not addressed by
|
|
1878
2195
|
* `format` are preserved.
|
|
1879
2196
|
*/
|
|
1880
|
-
const applyFormatToAllRuns = (txBody, format) => {
|
|
2197
|
+
const applyFormatToAllRuns = (txBody, format, caller = "setShapeTextFormat") => {
|
|
2198
|
+
validateFormatEnums(format, caller);
|
|
2199
|
+
applyValidatedFormatToAllRuns(txBody, format);
|
|
2200
|
+
};
|
|
2201
|
+
const applyValidatedFormatToAllRuns = (txBody, format) => {
|
|
1881
2202
|
for (const p of txBody.children) {
|
|
1882
2203
|
if (p.kind !== "element" || p.name.namespaceURI !== NS.dml || p.name.localName !== "p") continue;
|
|
1883
2204
|
for (const r of p.children) {
|
|
@@ -1887,7 +2208,7 @@ const applyFormatToAllRuns = (txBody, format) => {
|
|
|
1887
2208
|
rPr = elem(NAME_RPR$6);
|
|
1888
2209
|
r.children.unshift(rPr);
|
|
1889
2210
|
}
|
|
1890
|
-
|
|
2211
|
+
applyValidatedRunFormat(rPr, format);
|
|
1891
2212
|
}
|
|
1892
2213
|
}
|
|
1893
2214
|
};
|
|
@@ -2026,7 +2347,12 @@ const replaceTextInTree = (root, from, to) => {
|
|
|
2026
2347
|
});
|
|
2027
2348
|
return count;
|
|
2028
2349
|
};
|
|
2029
|
-
const normalizeBulletStyle = (s) => {
|
|
2350
|
+
const normalizeBulletStyle = (s, caller) => {
|
|
2351
|
+
if (typeof s === "string") oneOf(s, [
|
|
2352
|
+
"bullet",
|
|
2353
|
+
"number",
|
|
2354
|
+
"none"
|
|
2355
|
+
], `${caller}: bullets`);
|
|
2030
2356
|
if (s === "bullet") return {
|
|
2031
2357
|
kind: "char",
|
|
2032
2358
|
char: "•"
|
|
@@ -2042,11 +2368,10 @@ const normalizeBulletStyle = (s) => {
|
|
|
2042
2368
|
};
|
|
2043
2369
|
return {
|
|
2044
2370
|
kind: "autoNum",
|
|
2045
|
-
type: s.autoNum
|
|
2371
|
+
type: oneOf(s.autoNum, AUTO_NUMBER_SCHEMES, `${caller}: bullets.autoNum`)
|
|
2046
2372
|
};
|
|
2047
2373
|
};
|
|
2048
|
-
const buildBulletElement = (
|
|
2049
|
-
const n = normalizeBulletStyle(style);
|
|
2374
|
+
const buildBulletElement = (n) => {
|
|
2050
2375
|
switch (n.kind) {
|
|
2051
2376
|
case "char": return elem(NAME_BU_CHAR, { attrs: [attr(ATTR_CHAR, n.char)] });
|
|
2052
2377
|
case "autoNum": return elem(NAME_BU_AUTO_NUM, { attrs: [attr(ATTR_START_AT, "1"), attr(ATTR_BU_TYPE, n.type)] });
|
|
@@ -2055,7 +2380,21 @@ const buildBulletElement = (style) => {
|
|
|
2055
2380
|
};
|
|
2056
2381
|
const NAME_PPR_FOR_BULLET = qname("a", "pPr", NS.dml);
|
|
2057
2382
|
const NAME_P_FOR_BULLET = qname("a", "p", NS.dml);
|
|
2058
|
-
const alignToken = (a) => {
|
|
2383
|
+
const alignToken = (a, caller) => {
|
|
2384
|
+
oneOf(a, [
|
|
2385
|
+
"left",
|
|
2386
|
+
"center",
|
|
2387
|
+
"right",
|
|
2388
|
+
"justify",
|
|
2389
|
+
"distribute",
|
|
2390
|
+
"l",
|
|
2391
|
+
"ctr",
|
|
2392
|
+
"r",
|
|
2393
|
+
"just",
|
|
2394
|
+
"dist",
|
|
2395
|
+
"justLow",
|
|
2396
|
+
"thaiDist"
|
|
2397
|
+
], `${caller}: align`);
|
|
2059
2398
|
switch (a) {
|
|
2060
2399
|
case "left":
|
|
2061
2400
|
case "l": return "l";
|
|
@@ -2075,8 +2414,10 @@ const ATTR_ALGN$1 = qname("", "algn", "");
|
|
|
2075
2414
|
* Sets `<a:pPr algn="...">` on every paragraph in `txBody`. Existing
|
|
2076
2415
|
* pPr attributes other than `algn` are preserved.
|
|
2077
2416
|
*/
|
|
2078
|
-
const applyAlignmentToAllParagraphs = (txBody, align) => {
|
|
2079
|
-
|
|
2417
|
+
const applyAlignmentToAllParagraphs = (txBody, align, caller = "setShapeAlignment") => {
|
|
2418
|
+
applyAlignmentTokenToAllParagraphs(txBody, alignToken(align, caller));
|
|
2419
|
+
};
|
|
2420
|
+
const applyAlignmentTokenToAllParagraphs = (txBody, token) => {
|
|
2080
2421
|
for (const p of txBody.children) {
|
|
2081
2422
|
if (p.kind !== "element" || p.name.namespaceURI !== NAME_P_FOR_BULLET.namespaceURI || p.name.localName !== "p") continue;
|
|
2082
2423
|
let pPr = firstChildElement(p, NAME_PPR_FOR_BULLET);
|
|
@@ -2118,32 +2459,39 @@ const BULLET_INDENT_BY_LEVEL = [
|
|
|
2118
2459
|
const bulletIndentForLevel = (lvl) => BULLET_INDENT_BY_LEVEL[Math.min(lvl, BULLET_INDENT_BY_LEVEL.length - 1)];
|
|
2119
2460
|
const ATTR_MAR_L$1 = qname("", "marL", "");
|
|
2120
2461
|
const ATTR_INDENT$1 = qname("", "indent", "");
|
|
2462
|
+
const updateBulletIndentForLevel = (pPr, previousLevel, level) => {
|
|
2463
|
+
const previous = bulletIndentForLevel(previousLevel);
|
|
2464
|
+
const marL = pPr.attrs.find((a) => a.name.namespaceURI === "" && a.name.localName === "marL");
|
|
2465
|
+
const indent = pPr.attrs.find((a) => a.name.namespaceURI === "" && a.name.localName === "indent");
|
|
2466
|
+
if (marL?.value !== String(previous.marL) || indent?.value !== String(previous.indent)) return;
|
|
2467
|
+
const next = bulletIndentForLevel(level);
|
|
2468
|
+
pPr.attrs = pPr.attrs.map((a) => a === marL ? attr(a.name, String(next.marL)) : a === indent ? attr(a.name, String(next.indent)) : a);
|
|
2469
|
+
};
|
|
2121
2470
|
const hasAttr = (el, local) => el.attrs.some((a) => a.name.namespaceURI === "" && a.name.localName === local);
|
|
2122
|
-
const
|
|
2471
|
+
const applyNormalizedBullet = (paragraph, style) => {
|
|
2123
2472
|
let pPr = firstChildElement(paragraph, NAME_PPR_FOR_BULLET);
|
|
2124
2473
|
if (pPr === null) {
|
|
2125
2474
|
pPr = elem(NAME_PPR_FOR_BULLET);
|
|
2126
2475
|
paragraph.children.unshift(pPr);
|
|
2127
2476
|
}
|
|
2128
2477
|
pPr.children = pPr.children.filter((c) => !(c.kind === "element" && c.name.namespaceURI === NS.dml && (c.name.localName === "buChar" || c.name.localName === "buAutoNum" || c.name.localName === "buNone" || c.name.localName === "buFont")));
|
|
2129
|
-
if (style !== "none") {
|
|
2478
|
+
if (style.kind !== "none") {
|
|
2130
2479
|
const lvl = Number.parseInt(pPr.attrs.find((a) => a.name.localName === "lvl")?.value ?? "0", 10);
|
|
2131
2480
|
const { marL, indent } = bulletIndentForLevel(Number.isFinite(lvl) ? lvl : 0);
|
|
2132
2481
|
if (!hasAttr(pPr, "marL")) pPr.attrs.push(attr(ATTR_MAR_L$1, String(marL)));
|
|
2133
2482
|
if (!hasAttr(pPr, "indent")) pPr.attrs.push(attr(ATTR_INDENT$1, String(indent)));
|
|
2134
2483
|
}
|
|
2135
|
-
if (
|
|
2484
|
+
if (style.kind === "autoNum") pPr.children.push(elem(NAME_BU_FONT, { attrs: [attr(ATTR_TYPEFACE$2, "+mj-lt")] }));
|
|
2136
2485
|
pPr.children.push(buildBulletElement(style));
|
|
2137
2486
|
};
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
* before inserting the new one. Creates `<a:pPr>` if absent.
|
|
2142
|
-
*/
|
|
2487
|
+
const applyBulletToParagraph = (paragraph, style) => {
|
|
2488
|
+
applyNormalizedBullet(paragraph, normalizeBulletStyle(style, "setParagraphBullet"));
|
|
2489
|
+
};
|
|
2143
2490
|
const applyBulletToAllParagraphs = (txBody, style) => {
|
|
2491
|
+
const normalized = normalizeBulletStyle(style, "setShapeBullets");
|
|
2144
2492
|
for (const p of txBody.children) {
|
|
2145
2493
|
if (p.kind !== "element" || p.name.namespaceURI !== NAME_P_FOR_BULLET.namespaceURI || p.name.localName !== "p") continue;
|
|
2146
|
-
|
|
2494
|
+
applyNormalizedBullet(p, normalized);
|
|
2147
2495
|
}
|
|
2148
2496
|
};
|
|
2149
2497
|
/**
|
|
@@ -2159,7 +2507,8 @@ const applyBulletToAllParagraphs = (txBody, style) => {
|
|
|
2159
2507
|
*
|
|
2160
2508
|
* The `bodyPr` and `lstStyle` children (if any) are preserved untouched.
|
|
2161
2509
|
*/
|
|
2162
|
-
const setTextBody = (txBody, value) => {
|
|
2510
|
+
const setTextBody = (txBody, value, bullets) => {
|
|
2511
|
+
const normalized = bullets === void 0 ? void 0 : normalizeBulletStyle(bullets, "setShapeText");
|
|
2163
2512
|
const rPrTemplate = findFirstRunProperties(txBody);
|
|
2164
2513
|
const pPrTemplate = findFirstParagraphProperties(txBody);
|
|
2165
2514
|
removeAllParagraphs(txBody);
|
|
@@ -2168,6 +2517,7 @@ const setTextBody = (txBody, value) => {
|
|
|
2168
2517
|
const t = elem(NAME_T$5, { children: line.length > 0 ? [text(line)] : [] });
|
|
2169
2518
|
const r = elem(NAME_R$4, { children: rPrTemplate !== null ? [cloneElement(rPrTemplate), t] : [t] });
|
|
2170
2519
|
const p = elem(NAME_P$5, { children: pPrTemplate !== null ? [cloneElement(pPrTemplate), r] : [r] });
|
|
2520
|
+
if (normalized !== void 0) applyNormalizedBullet(p, normalized);
|
|
2171
2521
|
txBody.children.push(p);
|
|
2172
2522
|
}
|
|
2173
2523
|
};
|
|
@@ -2176,21 +2526,21 @@ const setTextBody = (txBody, value) => {
|
|
|
2176
2526
|
* here, so a caller that builds before it touches the tree leaves the
|
|
2177
2527
|
* existing text intact when a value is rejected.
|
|
2178
2528
|
*/
|
|
2179
|
-
const buildTextBodyParagraphs = (paragraphs) => {
|
|
2529
|
+
const buildTextBodyParagraphs = (paragraphs, caller = "setShapeParagraphs") => {
|
|
2180
2530
|
if (paragraphs.length === 0) throw new Error("setTextBodyParagraphs: at least one paragraph is required");
|
|
2181
2531
|
const built = [];
|
|
2182
2532
|
for (const para of paragraphs) {
|
|
2183
2533
|
const children = [];
|
|
2184
|
-
if (para.align !== void 0) children.push(elem(NAME_PPR$1, { attrs: [attr(ATTR_ALGN$1, alignToken(para.align))] }));
|
|
2534
|
+
if (para.align !== void 0) children.push(elem(NAME_PPR$1, { attrs: [attr(ATTR_ALGN$1, alignToken(para.align, caller))] }));
|
|
2185
2535
|
for (const run of para.runs) {
|
|
2186
2536
|
const rPr = elem(NAME_RPR$5);
|
|
2187
|
-
if (run.format !== void 0) applyRunFormat(rPr, run.format);
|
|
2537
|
+
if (run.format !== void 0) applyRunFormat(rPr, run.format, caller);
|
|
2188
2538
|
const t = elem(NAME_T$5, { children: run.text.length > 0 ? [text(run.text)] : [] });
|
|
2189
2539
|
children.push(elem(NAME_R$4, { children: [rPr, t] }));
|
|
2190
2540
|
}
|
|
2191
2541
|
if (para.endFormat !== void 0) {
|
|
2192
2542
|
const endParaRPr = elem(NAME_END_PARA_RPR);
|
|
2193
|
-
applyRunFormat(endParaRPr, para.endFormat);
|
|
2543
|
+
applyRunFormat(endParaRPr, para.endFormat, caller);
|
|
2194
2544
|
children.push(endParaRPr);
|
|
2195
2545
|
}
|
|
2196
2546
|
built.push(elem(NAME_P$5, { children }));
|
|
@@ -2350,6 +2700,12 @@ const setPatternFill = (host, options) => {
|
|
|
2350
2700
|
};
|
|
2351
2701
|
/** Sets `<a:gradFill>` on `host`, replacing any previous fill choice. */
|
|
2352
2702
|
const setGradientFill = (host, options) => {
|
|
2703
|
+
if (options.path !== void 0) oneOf(options.path, [
|
|
2704
|
+
"linear",
|
|
2705
|
+
"circle",
|
|
2706
|
+
"rect",
|
|
2707
|
+
"shape"
|
|
2708
|
+
], "setShapeGradientFill: path");
|
|
2353
2709
|
if (options.stops.length < 2) throw new Error("gradient fill requires at least two stops");
|
|
2354
2710
|
removeAnyFill(host);
|
|
2355
2711
|
const stops = options.stops.map((s) => {
|
|
@@ -2534,6 +2890,7 @@ const ATTR_VAL$6 = qname("", "val", "");
|
|
|
2534
2890
|
* `<a:ln>` if absent. Replacing the dash choice on subsequent calls.
|
|
2535
2891
|
*/
|
|
2536
2892
|
const setStrokeDash = (spPr, dash) => {
|
|
2893
|
+
oneOf(dash, LINE_DASHES, "setShapeStrokeDash: dash");
|
|
2537
2894
|
const ln = ensureLn(spPr);
|
|
2538
2895
|
ln.children = ln.children.filter((c) => !(c.kind === "element" && c.name.namespaceURI === NS.dml && c.name.localName === "prstDash"));
|
|
2539
2896
|
insertLnChild(ln, elem(NAME_PRST_DASH, { attrs: [attr(ATTR_VAL$6, dash)] }));
|
|
@@ -2551,8 +2908,30 @@ const ATTR_LEN = qname("", "len", "");
|
|
|
2551
2908
|
* behavior).
|
|
2552
2909
|
*/
|
|
2553
2910
|
const setStrokeArrow = (spPr, end, options) => {
|
|
2911
|
+
oneOf(end, ["head", "tail"], "setShapeStrokeArrow: end");
|
|
2912
|
+
oneOf(options.type, [
|
|
2913
|
+
"none",
|
|
2914
|
+
"triangle",
|
|
2915
|
+
"stealth",
|
|
2916
|
+
"diamond",
|
|
2917
|
+
"oval",
|
|
2918
|
+
"arrow"
|
|
2919
|
+
], "setShapeStrokeArrow: type");
|
|
2920
|
+
if (options.width !== void 0) oneOf(options.width, [
|
|
2921
|
+
"sm",
|
|
2922
|
+
"med",
|
|
2923
|
+
"lg"
|
|
2924
|
+
], "setShapeStrokeArrow: width");
|
|
2925
|
+
if (options.length !== void 0) oneOf(options.length, [
|
|
2926
|
+
"sm",
|
|
2927
|
+
"med",
|
|
2928
|
+
"lg"
|
|
2929
|
+
], "setShapeStrokeArrow: length");
|
|
2554
2930
|
const ln = ensureLn(spPr);
|
|
2555
|
-
const localName =
|
|
2931
|
+
const localName = {
|
|
2932
|
+
head: "headEnd",
|
|
2933
|
+
tail: "tailEnd"
|
|
2934
|
+
}[end];
|
|
2556
2935
|
ln.children = ln.children.filter((c) => !(c.kind === "element" && c.name.namespaceURI === NS.dml && c.name.localName === localName));
|
|
2557
2936
|
const attrs = [attr(ATTR_TYPE$5, options.type)];
|
|
2558
2937
|
if (options.width !== void 0) attrs.push(attr(ATTR_W$3, options.width));
|
|
@@ -2561,6 +2940,11 @@ const setStrokeArrow = (spPr, end, options) => {
|
|
|
2561
2940
|
};
|
|
2562
2941
|
/** Sets `<a:ln cap="…"/>`. Pass `null` to clear the attribute. */
|
|
2563
2942
|
const setStrokeCap = (spPr, cap) => {
|
|
2943
|
+
if (cap !== null) oneOf(cap, [
|
|
2944
|
+
"rnd",
|
|
2945
|
+
"sq",
|
|
2946
|
+
"flat"
|
|
2947
|
+
], "setShapeStrokeCap: cap");
|
|
2564
2948
|
const ln = ensureLn(spPr);
|
|
2565
2949
|
ln.attrs = ln.attrs.filter((a) => !(a.name.namespaceURI === "" && a.name.localName === "cap"));
|
|
2566
2950
|
if (cap !== null) ln.attrs.push(attr(qname("", "cap", ""), cap));
|
|
@@ -2572,12 +2956,24 @@ const JOIN_LOCALS = new Set([
|
|
|
2572
2956
|
]);
|
|
2573
2957
|
/** Replaces the join child of `<a:ln>`. Pass `null` to remove it. */
|
|
2574
2958
|
const setStrokeJoin = (spPr, join) => {
|
|
2959
|
+
if (join !== null) oneOf(join, [
|
|
2960
|
+
"round",
|
|
2961
|
+
"bevel",
|
|
2962
|
+
"miter"
|
|
2963
|
+
], "setShapeStrokeJoin: join");
|
|
2575
2964
|
const ln = ensureLn(spPr);
|
|
2576
2965
|
removeChildrenIn(ln, JOIN_LOCALS);
|
|
2577
2966
|
if (join !== null) insertLnChild(ln, elem(qname("a", join, NS.dml)));
|
|
2578
2967
|
};
|
|
2579
2968
|
/** Sets `<a:ln cmpd="…"/>`. Pass `null` to clear the attribute. */
|
|
2580
2969
|
const setStrokeCompound = (spPr, cmpd) => {
|
|
2970
|
+
if (cmpd !== null) oneOf(cmpd, [
|
|
2971
|
+
"sng",
|
|
2972
|
+
"dbl",
|
|
2973
|
+
"thickThin",
|
|
2974
|
+
"thinThick",
|
|
2975
|
+
"tri"
|
|
2976
|
+
], "setShapeStrokeCompound: cmpd");
|
|
2581
2977
|
const ln = ensureLn(spPr);
|
|
2582
2978
|
ln.attrs = ln.attrs.filter((a) => !(a.name.namespaceURI === "" && a.name.localName === "cmpd"));
|
|
2583
2979
|
if (cmpd !== null) ln.attrs.push(attr(qname("", "cmpd", ""), cmpd));
|
|
@@ -3487,6 +3883,12 @@ const buildTextBody = (text$1, anchor) => {
|
|
|
3487
3883
|
] });
|
|
3488
3884
|
};
|
|
3489
3885
|
const buildShape = (opts) => {
|
|
3886
|
+
oneOf(opts.preset, SHAPE_PRESETS, "addSlideShape: preset");
|
|
3887
|
+
if (opts.textAnchor !== void 0) oneOf(opts.textAnchor, [
|
|
3888
|
+
"t",
|
|
3889
|
+
"ctr",
|
|
3890
|
+
"b"
|
|
3891
|
+
], "addSlideShape: textAnchor");
|
|
3490
3892
|
const name = opts.name ?? `${opts.preset} ${opts.id}`;
|
|
3491
3893
|
const anchor = opts.textAnchor ?? "ctr";
|
|
3492
3894
|
const children = [elem(NAME_NV_SP_PR$1, { children: [
|
|
@@ -4125,12 +4527,20 @@ const buildEffectElement = (opts) => {
|
|
|
4125
4527
|
attrs.push(attr(ATTR_DIR, opts.direction));
|
|
4126
4528
|
}
|
|
4127
4529
|
}
|
|
4128
|
-
if (opts.orientation !== void 0 && opts.effect === "split")
|
|
4530
|
+
if (opts.orientation !== void 0 && opts.effect === "split") {
|
|
4531
|
+
oneOf(opts.orientation, ["horz", "vert"], "setSlideTransition: orientation");
|
|
4532
|
+
attrs.push(attr(ATTR_ORIENT, opts.orientation));
|
|
4533
|
+
}
|
|
4129
4534
|
if (opts.thruBlack && THRU_BLK_EFFECTS.has(opts.effect)) attrs.push(attr(ATTR_THRU_BLK, "1"));
|
|
4130
4535
|
return elem(name, { attrs });
|
|
4131
4536
|
};
|
|
4132
4537
|
/** Returns a complete `<p:transition>` element. */
|
|
4133
4538
|
const buildTransition = (opts) => {
|
|
4539
|
+
if (opts.speed !== void 0) oneOf(opts.speed, [
|
|
4540
|
+
"slow",
|
|
4541
|
+
"med",
|
|
4542
|
+
"fast"
|
|
4543
|
+
], "setSlideTransition: speed");
|
|
4134
4544
|
const attrs = [];
|
|
4135
4545
|
if (opts.speed !== void 0) attrs.push(attr(ATTR_SPD, opts.speed));
|
|
4136
4546
|
if (opts.advanceOnClick === false) attrs.push(attr(ATTR_ADV_CLICK, "0"));
|
|
@@ -4267,10 +4677,15 @@ const buildOpacityAnim = (spid, durationMs, fadeIn) => {
|
|
|
4267
4677
|
};
|
|
4268
4678
|
/**
|
|
4269
4679
|
* Builds the complete `<p:timing>` element for a single click-effect on
|
|
4270
|
-
* the given shape id.
|
|
4680
|
+
* the given shape id.
|
|
4271
4681
|
*/
|
|
4272
4682
|
const buildSingleEffectTiming = (spid, opts) => {
|
|
4273
|
-
const preset = PRESETS[opts.effect
|
|
4683
|
+
const preset = PRESETS[oneOf(opts.effect, [
|
|
4684
|
+
"fadeIn",
|
|
4685
|
+
"fadeOut",
|
|
4686
|
+
"appear",
|
|
4687
|
+
"disappear"
|
|
4688
|
+
], "setShapeAnimation: effect")];
|
|
4274
4689
|
const duration = opts.durationMs === void 0 ? 500 : unsignedIntMs(opts.durationMs, "setShapeAnimation: durationMs");
|
|
4275
4690
|
const isFade = opts.effect === "fadeIn" || opts.effect === "fadeOut";
|
|
4276
4691
|
const isEntrance = preset.presetClass === "entr";
|
|
@@ -5381,6 +5796,218 @@ const setShapeClickAction = (shape, action) => {
|
|
|
5381
5796
|
commitAndRefresh(shape);
|
|
5382
5797
|
};
|
|
5383
5798
|
//#endregion
|
|
5799
|
+
//#region src/internal/chartml/enum-validation.ts
|
|
5800
|
+
const LABEL_POSITIONS = [
|
|
5801
|
+
"ctr",
|
|
5802
|
+
"inEnd",
|
|
5803
|
+
"outEnd",
|
|
5804
|
+
"inBase",
|
|
5805
|
+
"t",
|
|
5806
|
+
"b",
|
|
5807
|
+
"l",
|
|
5808
|
+
"r",
|
|
5809
|
+
"bestFit"
|
|
5810
|
+
];
|
|
5811
|
+
const DISPLAY_UNITS = [
|
|
5812
|
+
"hundreds",
|
|
5813
|
+
"thousands",
|
|
5814
|
+
"tenThousands",
|
|
5815
|
+
"hundredThousands",
|
|
5816
|
+
"millions",
|
|
5817
|
+
"tenMillions",
|
|
5818
|
+
"hundredMillions",
|
|
5819
|
+
"billions",
|
|
5820
|
+
"trillions"
|
|
5821
|
+
];
|
|
5822
|
+
const LABEL_ALIGNMENTS = [
|
|
5823
|
+
"ctr",
|
|
5824
|
+
"l",
|
|
5825
|
+
"r"
|
|
5826
|
+
];
|
|
5827
|
+
const DISPLAY_BLANKS = [
|
|
5828
|
+
"gap",
|
|
5829
|
+
"zero",
|
|
5830
|
+
"span"
|
|
5831
|
+
];
|
|
5832
|
+
const SCATTER_STYLES = [
|
|
5833
|
+
"none",
|
|
5834
|
+
"line",
|
|
5835
|
+
"lineMarker",
|
|
5836
|
+
"marker",
|
|
5837
|
+
"smooth",
|
|
5838
|
+
"smoothMarker"
|
|
5839
|
+
];
|
|
5840
|
+
const RADAR_STYLES = [
|
|
5841
|
+
"standard",
|
|
5842
|
+
"marker",
|
|
5843
|
+
"filled"
|
|
5844
|
+
];
|
|
5845
|
+
const BAR_3D_SHAPES = [
|
|
5846
|
+
"box",
|
|
5847
|
+
"cone",
|
|
5848
|
+
"coneToMax",
|
|
5849
|
+
"cylinder",
|
|
5850
|
+
"pyramid",
|
|
5851
|
+
"pyramidToMax"
|
|
5852
|
+
];
|
|
5853
|
+
const OF_PIE_TYPES = ["pie", "bar"];
|
|
5854
|
+
const SPLIT_TYPES = [
|
|
5855
|
+
"auto",
|
|
5856
|
+
"cust",
|
|
5857
|
+
"percent",
|
|
5858
|
+
"pos",
|
|
5859
|
+
"val"
|
|
5860
|
+
];
|
|
5861
|
+
const LAYOUT_TARGETS = ["inner", "outer"];
|
|
5862
|
+
const AXIS_CROSSES = [
|
|
5863
|
+
"autoZero",
|
|
5864
|
+
"min",
|
|
5865
|
+
"max"
|
|
5866
|
+
];
|
|
5867
|
+
const LEGEND_POSITIONS = [
|
|
5868
|
+
"r",
|
|
5869
|
+
"t",
|
|
5870
|
+
"b",
|
|
5871
|
+
"l",
|
|
5872
|
+
"tr"
|
|
5873
|
+
];
|
|
5874
|
+
const MARKER_SYMBOLS = [
|
|
5875
|
+
"none",
|
|
5876
|
+
"auto",
|
|
5877
|
+
"circle",
|
|
5878
|
+
"square",
|
|
5879
|
+
"diamond",
|
|
5880
|
+
"triangle",
|
|
5881
|
+
"star",
|
|
5882
|
+
"x",
|
|
5883
|
+
"plus",
|
|
5884
|
+
"dash",
|
|
5885
|
+
"dot",
|
|
5886
|
+
"picture"
|
|
5887
|
+
];
|
|
5888
|
+
const TRENDLINE_TYPES = [
|
|
5889
|
+
"linear",
|
|
5890
|
+
"exp",
|
|
5891
|
+
"log",
|
|
5892
|
+
"poly",
|
|
5893
|
+
"power",
|
|
5894
|
+
"movingAvg"
|
|
5895
|
+
];
|
|
5896
|
+
const ERROR_BAR_TYPES = [
|
|
5897
|
+
"both",
|
|
5898
|
+
"plus",
|
|
5899
|
+
"minus"
|
|
5900
|
+
];
|
|
5901
|
+
const ERROR_VALUE_TYPES = [
|
|
5902
|
+
"fixedVal",
|
|
5903
|
+
"percentage",
|
|
5904
|
+
"stdDev",
|
|
5905
|
+
"stdErr",
|
|
5906
|
+
"cust"
|
|
5907
|
+
];
|
|
5908
|
+
const GROUPINGS = [
|
|
5909
|
+
"clustered",
|
|
5910
|
+
"stacked",
|
|
5911
|
+
"percentStacked",
|
|
5912
|
+
"standard"
|
|
5913
|
+
];
|
|
5914
|
+
const TICK_MARKS = [
|
|
5915
|
+
"in",
|
|
5916
|
+
"out",
|
|
5917
|
+
"cross",
|
|
5918
|
+
"none"
|
|
5919
|
+
];
|
|
5920
|
+
const TICK_LABEL_POSITIONS = [
|
|
5921
|
+
"none",
|
|
5922
|
+
"low",
|
|
5923
|
+
"high",
|
|
5924
|
+
"nextTo"
|
|
5925
|
+
];
|
|
5926
|
+
const ORIENTATIONS = ["minMax", "maxMin"];
|
|
5927
|
+
const CROSS_BETWEEN = ["between", "midCat"];
|
|
5928
|
+
const TIME_UNITS$1 = [
|
|
5929
|
+
"days",
|
|
5930
|
+
"months",
|
|
5931
|
+
"years"
|
|
5932
|
+
];
|
|
5933
|
+
const validateLabels = (labels, field) => {
|
|
5934
|
+
if (labels?.position !== void 0) oneOf(labels.position, LABEL_POSITIONS, `${field}.position`);
|
|
5935
|
+
};
|
|
5936
|
+
const validateScaling = (scaling, field) => {
|
|
5937
|
+
if (scaling?.displayUnits !== void 0) oneOf(scaling.displayUnits, DISPLAY_UNITS, `${field}.displayUnits`);
|
|
5938
|
+
};
|
|
5939
|
+
/** Validate before chart XML or its embedded workbook is changed. */
|
|
5940
|
+
const validateChartSpecEnums = (spec, caller) => {
|
|
5941
|
+
oneOf(spec.kind, [
|
|
5942
|
+
"bar",
|
|
5943
|
+
"column",
|
|
5944
|
+
"line",
|
|
5945
|
+
"pie",
|
|
5946
|
+
"doughnut",
|
|
5947
|
+
"area",
|
|
5948
|
+
"scatter",
|
|
5949
|
+
"radar",
|
|
5950
|
+
"bubble",
|
|
5951
|
+
"stock",
|
|
5952
|
+
"surface"
|
|
5953
|
+
], `${caller}: kind`);
|
|
5954
|
+
if (spec.grouping !== void 0) oneOf(spec.grouping, GROUPINGS, `${caller}: grouping`);
|
|
5955
|
+
if (spec.valueAxisMajorTickMark !== void 0) oneOf(spec.valueAxisMajorTickMark, TICK_MARKS, `${caller}: valueAxisMajorTickMark`);
|
|
5956
|
+
if (spec.valueAxisMinorTickMark !== void 0) oneOf(spec.valueAxisMinorTickMark, TICK_MARKS, `${caller}: valueAxisMinorTickMark`);
|
|
5957
|
+
if (spec.categoryAxisMajorTickMark !== void 0) oneOf(spec.categoryAxisMajorTickMark, TICK_MARKS, `${caller}: categoryAxisMajorTickMark`);
|
|
5958
|
+
if (spec.categoryAxisMinorTickMark !== void 0) oneOf(spec.categoryAxisMinorTickMark, TICK_MARKS, `${caller}: categoryAxisMinorTickMark`);
|
|
5959
|
+
if (spec.valueAxisTickLabelPos !== void 0) oneOf(spec.valueAxisTickLabelPos, TICK_LABEL_POSITIONS, `${caller}: valueAxisTickLabelPos`);
|
|
5960
|
+
if (spec.categoryAxisTickLabelPos !== void 0) oneOf(spec.categoryAxisTickLabelPos, TICK_LABEL_POSITIONS, `${caller}: categoryAxisTickLabelPos`);
|
|
5961
|
+
if (spec.categoryAxisLabelAlign !== void 0) oneOf(spec.categoryAxisLabelAlign, LABEL_ALIGNMENTS, `${caller}: categoryAxisLabelAlign`);
|
|
5962
|
+
if (spec.categoryAxisOrientation !== void 0) oneOf(spec.categoryAxisOrientation, ORIENTATIONS, `${caller}: categoryAxisOrientation`);
|
|
5963
|
+
if (spec.valueAxisOrientation !== void 0) oneOf(spec.valueAxisOrientation, ORIENTATIONS, `${caller}: valueAxisOrientation`);
|
|
5964
|
+
if (spec.valueAxisCrossBetween !== void 0) oneOf(spec.valueAxisCrossBetween, CROSS_BETWEEN, `${caller}: valueAxisCrossBetween`);
|
|
5965
|
+
if (spec.dispBlanksAs !== void 0) oneOf(spec.dispBlanksAs, DISPLAY_BLANKS, `${caller}: dispBlanksAs`);
|
|
5966
|
+
if (spec.scatterStyle !== void 0) oneOf(spec.scatterStyle, SCATTER_STYLES, `${caller}: scatterStyle`);
|
|
5967
|
+
if (spec.radarStyle !== void 0) oneOf(spec.radarStyle, RADAR_STYLES, `${caller}: radarStyle`);
|
|
5968
|
+
if (spec.bubbleSizeRepresents !== void 0) oneOf(spec.bubbleSizeRepresents, ["area", "width"], `${caller}: bubbleSizeRepresents`);
|
|
5969
|
+
if (spec.bar3DShape !== void 0) oneOf(spec.bar3DShape, BAR_3D_SHAPES, `${caller}: bar3DShape`);
|
|
5970
|
+
if (spec.secondaryValueAxis?.majorTickMark !== void 0) oneOf(spec.secondaryValueAxis.majorTickMark, TICK_MARKS, `${caller}: secondaryValueAxis.majorTickMark`);
|
|
5971
|
+
if (spec.secondaryValueAxis?.minorTickMark !== void 0) oneOf(spec.secondaryValueAxis.minorTickMark, TICK_MARKS, `${caller}: secondaryValueAxis.minorTickMark`);
|
|
5972
|
+
if (spec.secondaryValueAxis?.tickLabelPos !== void 0) oneOf(spec.secondaryValueAxis.tickLabelPos, TICK_LABEL_POSITIONS, `${caller}: secondaryValueAxis.tickLabelPos`);
|
|
5973
|
+
if (spec.secondaryValueAxis?.crossBetween !== void 0) oneOf(spec.secondaryValueAxis.crossBetween, CROSS_BETWEEN, `${caller}: secondaryValueAxis.crossBetween`);
|
|
5974
|
+
if (spec.seriesAxis?.orientation !== void 0) oneOf(spec.seriesAxis.orientation, ORIENTATIONS, `${caller}: seriesAxis.orientation`);
|
|
5975
|
+
if (spec.seriesAxis?.tickLabelPos !== void 0) oneOf(spec.seriesAxis.tickLabelPos, TICK_LABEL_POSITIONS, `${caller}: seriesAxis.tickLabelPos`);
|
|
5976
|
+
if (spec.categoryAxisDate?.baseTimeUnit !== void 0) oneOf(spec.categoryAxisDate.baseTimeUnit, TIME_UNITS$1, `${caller}: categoryAxisDate.baseTimeUnit`);
|
|
5977
|
+
if (spec.categoryAxisDate?.majorTimeUnit !== void 0) oneOf(spec.categoryAxisDate.majorTimeUnit, TIME_UNITS$1, `${caller}: categoryAxisDate.majorTimeUnit`);
|
|
5978
|
+
if (spec.categoryAxisDate?.minorTimeUnit !== void 0) oneOf(spec.categoryAxisDate.minorTimeUnit, TIME_UNITS$1, `${caller}: categoryAxisDate.minorTimeUnit`);
|
|
5979
|
+
if (spec.ofPie?.type !== void 0) oneOf(spec.ofPie.type, OF_PIE_TYPES, `${caller}: ofPie.type`);
|
|
5980
|
+
if (spec.ofPie?.splitType !== void 0) oneOf(spec.ofPie.splitType, SPLIT_TYPES, `${caller}: ofPie.splitType`);
|
|
5981
|
+
if (spec.plotAreaLayout?.target !== void 0) oneOf(spec.plotAreaLayout.target, LAYOUT_TARGETS, `${caller}: plotAreaLayout.target`);
|
|
5982
|
+
if (spec.legend?.layout?.target !== void 0) oneOf(spec.legend.layout.target, LAYOUT_TARGETS, `${caller}: legend.layout.target`);
|
|
5983
|
+
if (spec.valueAxisCrosses !== void 0 && typeof spec.valueAxisCrosses !== "object") oneOf(spec.valueAxisCrosses, AXIS_CROSSES, `${caller}: valueAxisCrosses`);
|
|
5984
|
+
if (spec.legend?.position != null) oneOf(spec.legend.position, LEGEND_POSITIONS, `${caller}: legend.position`);
|
|
5985
|
+
validateLabels(spec.dataLabels, `${caller}: dataLabels`);
|
|
5986
|
+
validateScaling(spec.valueAxis, `${caller}: valueAxis`);
|
|
5987
|
+
validateScaling(spec.categoryAxisScaling, `${caller}: categoryAxisScaling`);
|
|
5988
|
+
validateScaling(spec.secondaryValueAxis?.scaling, `${caller}: secondaryValueAxis.scaling`);
|
|
5989
|
+
for (const [index, series] of spec.series.entries()) {
|
|
5990
|
+
const field = `${caller}: series[${index}]`;
|
|
5991
|
+
if (series.chartKind !== void 0) oneOf(series.chartKind, [
|
|
5992
|
+
"bar",
|
|
5993
|
+
"column",
|
|
5994
|
+
"line",
|
|
5995
|
+
"area"
|
|
5996
|
+
], `${field}.chartKind`);
|
|
5997
|
+
if (series.lineDash !== void 0) oneOf(series.lineDash, LINE_DASHES, `${field}.lineDash`);
|
|
5998
|
+
if (series.markerSymbol !== void 0) oneOf(series.markerSymbol, MARKER_SYMBOLS, `${field}.markerSymbol`);
|
|
5999
|
+
if (series.trendline !== void 0) oneOf(series.trendline.type, TRENDLINE_TYPES, `${field}.trendline.type`);
|
|
6000
|
+
validateLabels(series.dataLabels, `${field}.dataLabels`);
|
|
6001
|
+
for (const [point, labels] of (series.pointDataLabels ?? []).entries()) validateLabels(labels, `${field}.pointDataLabels[${point}]`);
|
|
6002
|
+
for (const direction of ["errorBars", "xErrorBars"]) {
|
|
6003
|
+
const bars = series[direction];
|
|
6004
|
+
if (bars === void 0) continue;
|
|
6005
|
+
oneOf(bars.barType, ERROR_BAR_TYPES, `${field}.${direction}.barType`);
|
|
6006
|
+
oneOf(bars.amount.type, ERROR_VALUE_TYPES, `${field}.${direction}.amount.type`);
|
|
6007
|
+
}
|
|
6008
|
+
}
|
|
6009
|
+
};
|
|
6010
|
+
//#endregion
|
|
5384
6011
|
//#region src/internal/chartml/embedded-xlsx.ts
|
|
5385
6012
|
const TEXT_ENCODER = new TextEncoder();
|
|
5386
6013
|
const encode = (s) => TEXT_ENCODER.encode(s);
|
|
@@ -9267,6 +9894,7 @@ const withChartDefaultTextColor = (spec, color) => {
|
|
|
9267
9894
|
};
|
|
9268
9895
|
};
|
|
9269
9896
|
const addSlideChart = (slide, opts) => {
|
|
9897
|
+
validateChartSpecEnums(opts.spec, "addSlideChart");
|
|
9270
9898
|
validateChartSpecColors(opts.spec);
|
|
9271
9899
|
validateChartSpecAxes(opts.spec);
|
|
9272
9900
|
const spec = withChartDefaultTextColor(opts.spec, resolveDeckBodyTextColor(slide));
|
|
@@ -9348,6 +9976,7 @@ const resolveChartPartName = (slide, shape) => {
|
|
|
9348
9976
|
* fresh data."
|
|
9349
9977
|
*/
|
|
9350
9978
|
const setChartSpec = (chart, spec) => {
|
|
9979
|
+
validateChartSpecEnums(spec, "setChartSpec");
|
|
9351
9980
|
validateChartSpecColors(spec);
|
|
9352
9981
|
validateChartSpecAxes(spec);
|
|
9353
9982
|
const slide = chart.shape[SHAPE_SLIDE];
|
|
@@ -10855,6 +11484,7 @@ const ensureCellTxBody = (cell) => {
|
|
|
10855
11484
|
txBody = elem(NAME_A_TX_BODY_TBL);
|
|
10856
11485
|
txBody.children.push(elem(qname("a", "bodyPr", NS.dml)));
|
|
10857
11486
|
txBody.children.push(elem(qname("a", "lstStyle", NS.dml)));
|
|
11487
|
+
txBody.children.push(elem(qname("a", "p", NS.dml)));
|
|
10858
11488
|
tc.children.unshift(txBody);
|
|
10859
11489
|
}
|
|
10860
11490
|
return txBody;
|
|
@@ -10882,7 +11512,7 @@ const setTableCellText = (cell, text) => {
|
|
|
10882
11512
|
* `getTableCellParagraphs`.
|
|
10883
11513
|
*/
|
|
10884
11514
|
const setTableCellParagraphs = (cell, paragraphs) => {
|
|
10885
|
-
const built = buildTextBodyParagraphs(paragraphs);
|
|
11515
|
+
const built = buildTextBodyParagraphs(paragraphs, "setTableCellParagraphs");
|
|
10886
11516
|
replaceTextBodyParagraphs(ensureCellTxBody(cell), built);
|
|
10887
11517
|
commitTableCell(cell);
|
|
10888
11518
|
};
|
|
@@ -11086,6 +11716,9 @@ const writeBorderLn = (tcPr, local, border) => {
|
|
|
11086
11716
|
* cardinal four — a strikethrough cell can have only a diagonal.
|
|
11087
11717
|
*/
|
|
11088
11718
|
const setTableCellBorders = (cell, sides) => {
|
|
11719
|
+
if (sides !== null) {
|
|
11720
|
+
for (const [side, border] of Object.entries(sides)) if (border?.dash != null) oneOf(border.dash, LINE_DASHES, `setTableCellBorders: ${side}.dash`);
|
|
11721
|
+
}
|
|
11089
11722
|
const tcPr = ensureCellTcPr(cell);
|
|
11090
11723
|
if (sides === null) for (const local of Object.values(BORDER_SIDE_LOCALS)) writeBorderLn(tcPr, local, null);
|
|
11091
11724
|
else for (const [key, local] of Object.entries(BORDER_SIDE_LOCALS)) {
|
|
@@ -11118,6 +11751,7 @@ const getTableCellTextDirection = (cell) => {
|
|
|
11118
11751
|
* default horizontal direction. Creates `<a:tcPr>` if absent.
|
|
11119
11752
|
*/
|
|
11120
11753
|
const setTableCellTextDirection = (cell, direction) => {
|
|
11754
|
+
if (direction !== null) oneOf(direction, TEXT_DIRECTIONS, "setTableCellTextDirection: direction");
|
|
11121
11755
|
const tcPr = ensureCellTcPr(cell);
|
|
11122
11756
|
tcPr.attrs = tcPr.attrs.filter((a) => !(a.name.namespaceURI === "" && a.name.localName === "vert"));
|
|
11123
11757
|
if (direction !== null && direction !== "horz") tcPr.attrs.push(attr(qname("", "vert", ""), direction));
|
|
@@ -11143,10 +11777,15 @@ const getTableCellAnchor = (cell) => {
|
|
|
11143
11777
|
* default (`ctr`). Creates `<a:tcPr>` if absent.
|
|
11144
11778
|
*/
|
|
11145
11779
|
const setTableCellAnchor = (cell, anchor) => {
|
|
11780
|
+
if (anchor !== null) oneOf(anchor, [
|
|
11781
|
+
"top",
|
|
11782
|
+
"center",
|
|
11783
|
+
"bottom"
|
|
11784
|
+
], "setTableCellAnchor: anchor");
|
|
11146
11785
|
const tcPr = ensureCellTcPr(cell);
|
|
11147
11786
|
tcPr.attrs = tcPr.attrs.filter((a) => !(a.name.namespaceURI === "" && a.name.localName === "anchor"));
|
|
11148
11787
|
if (anchor !== null) {
|
|
11149
|
-
const mapped = anchor
|
|
11788
|
+
const mapped = TEXT_ANCHORS[anchor];
|
|
11150
11789
|
tcPr.attrs.push(attr(qname("", "anchor", ""), mapped));
|
|
11151
11790
|
}
|
|
11152
11791
|
commitTableCell(cell);
|
|
@@ -11294,12 +11933,14 @@ const getTableCellFill = (cell) => {
|
|
|
11294
11933
|
};
|
|
11295
11934
|
/** Applies a TextFormat to every run in the cell's text. */
|
|
11296
11935
|
const setTableCellTextFormat = (cell, format) => {
|
|
11297
|
-
|
|
11936
|
+
validateFormatEnums(format, "setTableCellTextFormat");
|
|
11937
|
+
applyValidatedFormatToAllRuns(ensureCellTxBody(cell), format);
|
|
11298
11938
|
commitTableCell(cell);
|
|
11299
11939
|
};
|
|
11300
11940
|
/** Sets horizontal alignment on every paragraph in the cell. */
|
|
11301
11941
|
const setTableCellAlignment = (cell, align) => {
|
|
11302
|
-
|
|
11942
|
+
const token = alignToken(align, "setTableCellAlignment");
|
|
11943
|
+
applyAlignmentTokenToAllParagraphs(ensureCellTxBody(cell), token);
|
|
11303
11944
|
commitTableCell(cell);
|
|
11304
11945
|
};
|
|
11305
11946
|
/** Zero-based (row, col) of the cell. */
|
|
@@ -12014,8 +12655,9 @@ const getSlideTransition = (slide) => {
|
|
|
12014
12655
|
};
|
|
12015
12656
|
/** Sets the slide's transition effect. */
|
|
12016
12657
|
const setSlideTransition = (slide, options) => {
|
|
12658
|
+
const transition = buildTransition(options);
|
|
12017
12659
|
removeTransition(slide);
|
|
12018
|
-
insertAfterClrMapOvr(slide,
|
|
12660
|
+
insertAfterClrMapOvr(slide, transition);
|
|
12019
12661
|
commitSlideData(slide);
|
|
12020
12662
|
refreshSlideData(slide);
|
|
12021
12663
|
};
|
|
@@ -12588,6 +13230,7 @@ const NAME_SLD_ID_LST_FN = qname("p", "sldIdLst", NS.pml);
|
|
|
12588
13230
|
* §19.2.1.26; we insert at the correct position when bootstrapping.
|
|
12589
13231
|
*/
|
|
12590
13232
|
const setSlideSize = (pres, opts) => {
|
|
13233
|
+
if (opts.type !== void 0) oneOf(opts.type, SLIDE_SIZE_TYPES, "setSlideSize: type");
|
|
12591
13234
|
const presPart = pres[INTERNAL_PACKAGE].getPart(PRES_PART_NAME);
|
|
12592
13235
|
if (!presPart) throw new Error("presentation.xml is missing");
|
|
12593
13236
|
const doc = parseXml(decode$1(presPart.data));
|
|
@@ -13740,35 +14383,23 @@ const ensurePPr = (paragraph) => {
|
|
|
13740
14383
|
paragraph.children.unshift(fresh);
|
|
13741
14384
|
return fresh;
|
|
13742
14385
|
};
|
|
13743
|
-
const alignTokenForFn = (a) => {
|
|
13744
|
-
switch (a) {
|
|
13745
|
-
case "left":
|
|
13746
|
-
case "l": return "l";
|
|
13747
|
-
case "center":
|
|
13748
|
-
case "ctr": return "ctr";
|
|
13749
|
-
case "right":
|
|
13750
|
-
case "r": return "r";
|
|
13751
|
-
case "justify":
|
|
13752
|
-
case "just": return "just";
|
|
13753
|
-
case "distribute":
|
|
13754
|
-
case "dist": return "dist";
|
|
13755
|
-
default: return a;
|
|
13756
|
-
}
|
|
13757
|
-
};
|
|
13758
14386
|
/**
|
|
13759
14387
|
* Sets the horizontal alignment of a single paragraph. Same token set
|
|
13760
14388
|
* as `setShapeAlignment`. Other paragraphs are untouched.
|
|
13761
14389
|
*/
|
|
13762
14390
|
const setParagraphAlignment = (shape, paragraphIndex, align) => {
|
|
14391
|
+
const token = alignToken(align, "setParagraphAlignment");
|
|
13763
14392
|
const pPr = ensurePPr(requireParagraph(shape, paragraphIndex));
|
|
13764
14393
|
pPr.attrs = pPr.attrs.filter((a) => a.name.localName !== "algn");
|
|
13765
|
-
pPr.attrs.push(attr(ATTR_ALGN_FN,
|
|
14394
|
+
pPr.attrs.push(attr(ATTR_ALGN_FN, token));
|
|
13766
14395
|
commitAndRefresh(shape);
|
|
13767
14396
|
};
|
|
13768
14397
|
/**
|
|
13769
14398
|
* Sets the paragraph's nesting level (`<a:pPr lvl="N"/>`). Levels are
|
|
13770
14399
|
* 0-indexed; PowerPoint accepts 0 through 8. Pass `0` to clear an
|
|
13771
14400
|
* existing level — `<a:pPr lvl="0"/>` is the same as omitting the attr.
|
|
14401
|
+
* Indents matching the previous level's default bullet pair follow the level;
|
|
14402
|
+
* other indent values are preserved.
|
|
13772
14403
|
*
|
|
13773
14404
|
* Used in tandem with bullets to author nested lists:
|
|
13774
14405
|
*
|
|
@@ -13779,8 +14410,10 @@ const setParagraphAlignment = (shape, paragraphIndex, align) => {
|
|
|
13779
14410
|
const setParagraphLevel = (shape, paragraphIndex, level) => {
|
|
13780
14411
|
if (!Number.isInteger(level) || level < 0 || level > 8) throw new RangeError(`paragraph level must be an integer in [0, 8], got ${level}`);
|
|
13781
14412
|
const pPr = ensurePPr(requireParagraph(shape, paragraphIndex));
|
|
14413
|
+
const previousLevel = Number.parseInt(getAttrValue(pPr, ATTR_LVL) ?? "0", 10);
|
|
13782
14414
|
pPr.attrs = pPr.attrs.filter((a) => a.name.localName !== "lvl");
|
|
13783
14415
|
if (level > 0) pPr.attrs.push(attr(ATTR_LVL, String(level)));
|
|
14416
|
+
updateBulletIndentForLevel(pPr, Number.isFinite(previousLevel) ? previousLevel : 0, level);
|
|
13784
14417
|
commitAndRefresh(shape);
|
|
13785
14418
|
};
|
|
13786
14419
|
/**
|
|
@@ -16459,8 +17092,7 @@ const setShapeText = (shape, value, options = {}) => {
|
|
|
16459
17092
|
if (shape[SHAPE_SNAPSHOT].kind !== "shape") throw new Error(`setShapeText only works on text-bearing shapes; ${shape[SHAPE_SNAPSHOT].kind} is not one`);
|
|
16460
17093
|
const txBody = firstChildElement(shape[SHAPE_ELEMENT], NAME_TX_BODY);
|
|
16461
17094
|
if (txBody === null) throw new Error(`shape "${shape[SHAPE_SNAPSHOT].name}" has no <p:txBody>`);
|
|
16462
|
-
setTextBody(txBody, value);
|
|
16463
|
-
if (options.bullets !== void 0) applyBulletToAllParagraphs(txBody, options.bullets);
|
|
17095
|
+
setTextBody(txBody, value, options.bullets);
|
|
16464
17096
|
commitAndRefresh(shape);
|
|
16465
17097
|
};
|
|
16466
17098
|
/**
|
|
@@ -16503,6 +17135,7 @@ const requireBodyPr = (shape) => {
|
|
|
16503
17135
|
* Throws for non-text-bearing shape kinds.
|
|
16504
17136
|
*/
|
|
16505
17137
|
const setShapeTextWrap = (shape, wrap) => {
|
|
17138
|
+
oneOf(wrap, ["none", "square"], "setShapeTextWrap: wrap");
|
|
16506
17139
|
const bodyPr = requireBodyPr(shape);
|
|
16507
17140
|
const ATTR_WRAP = qname("", "wrap", "");
|
|
16508
17141
|
bodyPr.attrs = bodyPr.attrs.filter((a) => !(a.name.namespaceURI === "" && a.name.localName === "wrap"));
|
|
@@ -16530,9 +17163,18 @@ const getShapeTextWrap = (shape) => {
|
|
|
16530
17163
|
* non-text-bearing shape kinds.
|
|
16531
17164
|
*/
|
|
16532
17165
|
const setShapeTextAutoFit = (shape, mode) => {
|
|
17166
|
+
oneOf(mode, [
|
|
17167
|
+
"none",
|
|
17168
|
+
"normal",
|
|
17169
|
+
"shape"
|
|
17170
|
+
], "setShapeTextAutoFit: mode");
|
|
16533
17171
|
const bodyPr = requireBodyPr(shape);
|
|
16534
17172
|
bodyPr.children = bodyPr.children.filter((c) => !(c.kind === "element" && c.name.namespaceURI === NS.dml && AUTO_FIT_LOCALS.has(c.name.localName)));
|
|
16535
|
-
const local =
|
|
17173
|
+
const local = {
|
|
17174
|
+
none: "noAutofit",
|
|
17175
|
+
normal: "normAutofit",
|
|
17176
|
+
shape: "spAutoFit"
|
|
17177
|
+
}[mode];
|
|
16536
17178
|
bodyPr.children.push(elem(qname("a", local, NS.dml)));
|
|
16537
17179
|
commitAndRefresh(shape);
|
|
16538
17180
|
};
|
|
@@ -16725,6 +17367,7 @@ const getShapeTextDirection = (shape) => {
|
|
|
16725
17367
|
* horizontal direction. Throws for non-text-bearing shape kinds.
|
|
16726
17368
|
*/
|
|
16727
17369
|
const setShapeTextDirection = (shape, direction) => {
|
|
17370
|
+
if (direction !== null) oneOf(direction, TEXT_DIRECTIONS, "setShapeTextDirection: direction");
|
|
16728
17371
|
const bodyPr = requireBodyPr(shape);
|
|
16729
17372
|
bodyPr.attrs = bodyPr.attrs.filter((a) => !(a.name.namespaceURI === "" && a.name.localName === "vert"));
|
|
16730
17373
|
if (direction !== null && direction !== "horz") bodyPr.attrs.push(attr(qname("", "vert", ""), direction));
|
|
@@ -16841,13 +17484,18 @@ const getShapeBodyPrEffective = (pres, shape) => {
|
|
|
16841
17484
|
return result;
|
|
16842
17485
|
};
|
|
16843
17486
|
const setShapeTextAnchor = (shape, anchor) => {
|
|
17487
|
+
oneOf(anchor, [
|
|
17488
|
+
"top",
|
|
17489
|
+
"center",
|
|
17490
|
+
"bottom"
|
|
17491
|
+
], "setShapeTextAnchor: anchor");
|
|
16844
17492
|
const txBody = requireTxBody(shape);
|
|
16845
17493
|
let bodyPr = firstChildElement(txBody, NAME_A_BODY_PR);
|
|
16846
17494
|
if (bodyPr === null) {
|
|
16847
17495
|
bodyPr = elem(NAME_A_BODY_PR);
|
|
16848
17496
|
txBody.children.unshift(bodyPr);
|
|
16849
17497
|
}
|
|
16850
|
-
const token = anchor
|
|
17498
|
+
const token = TEXT_ANCHORS[anchor];
|
|
16851
17499
|
const ATTR_ANCHOR = qname("", "anchor", "");
|
|
16852
17500
|
bodyPr.attrs = bodyPr.attrs.filter((a) => !(a.name.namespaceURI === "" && a.name.localName === "anchor"));
|
|
16853
17501
|
bodyPr.attrs.push(attr(ATTR_ANCHOR, token));
|
|
@@ -16911,7 +17559,7 @@ const setShapeAlignment = (shape, align) => {
|
|
|
16911
17559
|
* updates compose.
|
|
16912
17560
|
*/
|
|
16913
17561
|
const setShapeTextFormat = (shape, format) => {
|
|
16914
|
-
applyFormatToAllRuns(requireTxBody(shape), format);
|
|
17562
|
+
applyFormatToAllRuns(requireTxBody(shape), format, "setShapeTextFormat");
|
|
16915
17563
|
commitAndRefresh(shape);
|
|
16916
17564
|
};
|
|
16917
17565
|
/**
|
|
@@ -18824,8 +19472,8 @@ const getShapeMedia = (shape) => {
|
|
|
18824
19472
|
const findShapesWithMedia = (slide) => slide[SLIDE_SHAPES].filter((shape) => getShapeMedia(shape) !== null);
|
|
18825
19473
|
//#endregion
|
|
18826
19474
|
//#region src/api/index.ts
|
|
18827
|
-
const VERSION = "0.
|
|
19475
|
+
const VERSION = "0.18.0";
|
|
18828
19476
|
//#endregion
|
|
18829
19477
|
export { replaceTokensInPresentation as $, getTableCellAnchor as $a, appendSlideNotes as $i, getShapePreset as $n, getSlideLayoutType as $o, getShapeParagraphCount as $r, findCommentsByAuthor as $s, getShapeStroke as $t, getOutlineText as A, removeSlideNotes as Aa, getShapeImageBiLevelThreshold as Ai, setSlideLayout as An, setTableCellTextFormat as Ao, setShapePatternFill as Ar, getSlideColorMapOverride as As, setShapeText as At, getSlideLayoutCount as B, getPackageSize as Ba, getShapeImagePartName as Bi, getShapeAltTitle as Bn, getPresentationCreated as Bo, getShapeRunFormat as Br, getSlideMasterBackgroundPatternFill as Bs, findShapesByEffect as Bt, setSlideSections as C, getSlidesWithHyperlinks as Ca, emu as Cc, findFlippedShapes as Ci, getShapeSlide as Cn, setTableCellAnchor as Co, setShapeAdjustValues as Cr, getEffectiveColorMap as Cs, getShapeTextColumns as Ct, findSlidesByNotes as D, getSlidesWithTables as Da, findSlidesByLayoutPartName as Di, getSlideShapes as Dn, setTableCellParagraphs as Do, setShapeImageFill as Dr, getSlideBackgroundGradientFill as Ds, setShapeAlignment as Dt, findSlideByTitle as E, getSlidesWithOverlap as Ea, pt as Ec, findSlidesByLayoutName as Ei, getSlideLayout as En, setTableCellMargins as Eo, setShapeGradientFill as Er, getSlideBackground as Es, getShapeTextWrap as Et, getShapeAt as F, setSlideTransition as Fa, getShapeImageDuotone as Fi, getGroupChildren as Fn, getThumbnail as Fo, setShapeStrokeArrow as Fr, getSlideLayoutBackgroundShapes as Fs, setShapeTextDirection as Ft, getSlideXmlString as G, setMediaPartBytes as Ga, setShapeImageContrast as Gi, getShapeDescription as Gn, touchModified as Go, getParagraphBulletImageBytes as Gr, setShapeClickAction as Gs, setShapeShadow as Gt, getSlidePartName as H, getSlideMediaPartNames as Ha, hasShapeText as Hi, getShapeBoundsResolved as Hn, incrementRevision as Ho, resolveDrawingColorOpacity as Hr, setSlideBackground as Hs, getShapeEffects as Ht, getSlideAt as I, _internalPackageOf as Ia, getShapeImageFillBytes as Ii, getGroupTransform as In, removeThumbnail as Io, setShapeStrokeCap as Ir, getSlideLayoutShapes as Is, setShapeTextFormat as It, isSlideHidden as J, clearTableCellFill as Ja, SLIDE_SIZE_16_10 as Ji, getShapeKind as Jn, findSlideLayoutByPartName as Jo, getParagraphIndent as Jr, clearAllSlideComments as Js, getShapeFill as Jt, getSlides as K, slidesUsingMediaPart as Ka, setShapeImageCrop as Ki, getShapeFlip as Kn, findLayoutsWithPlaceholderType as Ko, getParagraphBulletStyle as Kr, setShapeImage as Ks, getShapeGradientFill as Kt, getSlideCount as L, compactPackage as La, getShapeImageFormat as Li, getMaxShapeId as Ln, setThumbnail as Lo, setShapeStrokeCompound as Lr, getSlideMasterBackground as Ls, setShapeTextMargins as Lt, getPresentationText as M, setSlideNotes as Ma, getShapeImageBytes as Mi, centerShapeOnSlide as Mn, setTableRowHeight as Mo, setShapeRotation as Mr, getSlideLayoutBackgroundGradientFill as Ms, setShapeTextAutoFit as Mt, getPresentationTextLength as N, clearSlideTransition as Na, getShapeImageContrast as Ni, findShapesAtPoint as Nn, setTableStyleFlags as No, setShapeSize as Nr, getSlideLayoutBackgroundImageBytes as Ns, setShapeTextBodyRotationDeg as Nt, findSlidesByText as O, getVisibleSlides as Oa, findSlidesByLayoutType as Oi, getSlidesWithEmptyPlaceholders as On, setTableCellText as Oo, setShapeNoFill as Or, getSlideBackgroundImageBytes as Os, setShapeBullets as Ot, getPresentationTextLengthsBySlide as P, getSlideTransition as Pa, getShapeImageCrop as Pi, findShapesInRect as Pn, setTableStyleId as Po, setShapeStroke as Pr, getSlideLayoutBackgroundPatternFill as Ps, setShapeTextColumns as Pt, replaceTextInSlideNotes as Q, getTableCellAlignment as Qa, setSlideSize as Qi, getShapePosition as Qn, getSlideLayoutPlaceholders as Qo, getShapeHyperlinkTooltip as Qr, findCommentsBefore as Qs, getShapeFillOpacity as Qt, getSlideIndex as R, getMediaParts as Ra, getShapeImageLinkUrl as Ri, getMaxShapeIdInPresentation as Rn, getCoreProperties as Ro, setShapeStrokeDash as Rr, getSlideMasterBackgroundGradientFill as Rs, setShapeTextWrap as Rt, getSlideSections as S, getSlidesWithComments as Sa, cm as Sc, setShapeAnimation as Si, getShapeIndex as Sn, setTableCellAlignment as So, getShapeStrokeDash as Sr, setChartSpec as Ss, getShapeTextBodyRotationDeg as St, findSlideByText as T, getSlidesWithNotes as Ta, mm as Tc, findShapesOutsideCanvas as Ti, getShapesBounds as Tn, setTableCellFill as To, setShapeFlip as Tr, clearSlideBackground as Ts, getShapeTextMargins as Tt, getSlideText as U, listPackageParts as Ua, isShapeImageGrayscale as Ui, getShapeCenter as Un, setCoreProperties as Uo, getParagraphAlignment as Ur, setSlideBackgroundImage as Us, getShapeEffectsEffective as Ut, getSlideOutline as V, getPresentationSummary as Va, hasShapeImage as Vi, getShapeBounds as Vn, getPresentationModified as Vo, resolveDrawingColor as Vr, getSlideMasterShapes as Vs, getShapeEffect as Vt, getSlideTextLength as W, readPackagePart as Wa, setShapeImageBrightness as Wi, getShapeCustomGeometry as Wn, setExtendedProperties as Wo, getParagraphBullet as Wr, getShapeClickAction as Ws, setShapeGlow as Wt, replaceTextInPresentation as X, getSlideTables as Xa, SLIDE_SIZE_4_3 as Xi, getShapePlaceholderIdx as Xn, getSlideLayoutName as Xo, getParagraphLineSpacing as Xr, findCommentAuthorByName as Xs, getShapeFillColorResolved as Xt, replaceTextInNotes as Y, getPresentationTableCountsBySlide as Ya, SLIDE_SIZE_16_9 as Yi, getShapeName as Yn, findSlideLayoutByType as Yo, getParagraphLevel as Yr, clearSlideComments as Ys, getShapeFillColor as Yt, replaceTextInSlide as Z, getTableCell as Za, getSlideSize as Zi, getShapePlaceholderType as Zn, getSlideLayoutPartName as Zo, getParagraphSpacing as Zr, findCommentsAfter as Zs, getShapeFillEffective as Zt, moveSlide as _, getPresentationNotesLengthsBySlide as _a, setPresentationFonts as _c, setSlidePlaceholders as _i, findShapesByText as _n, isChartShape as _o, shapesOverlap as _r, getShapeChartKind as _s, appendShapeText as _t, groupShapes as a, findSlidesWithChartTrendlines as aa, getCommentPosition as ac, getShapeRunText as ai, getShapeStrokeJoin as an, getTableCellSpan as ao, getSlideMasterPartNames as ar, getShapeHyperlink as as, addSlideShape as at, sortSlides as b, getSlideNotesLength as ba, loadPresentation as bc, findShapesWithAnimation as bi, findSlidePlaceholderByIdx as bn, removeTableColumn as bo, getShapePatternFill as br, getShapeChartSpec as bs, getShapeTextAutoFit as bt, addContentSlide as c, getAllHyperlinks as ca, getCommentsSortedByDate as cc, setParagraphBullet as ci, findEmptyPlaceholders as cn, getTableCells as co, isShapeHidden as cr, setShapeRunFormat as cs, bringShapeForward as ct, addSlideAt as d, getAllTables as da, getPresentationCommenters as dc, setParagraphSpacing as di, findShapeByText as dn, getTableRowHeights as do, pointInShape as dr, findChartsBySeriesName as ds, copyShape as dt, clearAllHyperlinks as ea, findCommentsByText as ec, getShapeParagraphElements as ei, getShapeStrokeCap as en, getTableCellBorders as eo, getShapeRotation as er, getSlideLayoutUsageCounts as es, searchSlides as et, addTitleSlide as f, getDistinctHyperlinkUrls as fa, getSlideCommentAuthors as fc, setShapeRunHyperlink as fi, findShapeInPresentation as fn, getTableSize as fo, renameShape as fr, findChartsWithDataLabels as fs, getShapeZIndex as ft, mergePresentations as g, getPresentationNotesLength as ga, getPresentationTheme as gc, setSlideBody as gi, findShapesByPreset as gn, insertTableRow as go, setShapeHidden as gr, getShapeChartCategories as gs, setShapeZIndex as gt, importSlide as h, getPresentationHyperlinkCountsBySlide as ha, getPresentationFonts as hc, getSlideTitle as hi, findShapesByName as hn, insertTableColumn as ho, setShapeDescription as hr, getPresentationChartKindCounts as hs, sendShapeToBack as ht, getShapeMedia as i, findSlidesWithChartKind as ia, getCommentDate as ic, getShapeRunHyperlinkTooltip as ii, getShapeStrokeEffective as in, getTableCellPosition as io, getSlideMasterPartName as ir, getParagraphPropertiesEffective as is, addSlideLine as it, getPresentationShapeCountsBySlide as j, replaceHyperlink as ja, getShapeImageBrightness as ji, translateShapes as jn, setTableColumnWidth as jo, setShapePosition as jr, getSlideLayoutBackground as js, setShapeTextAnchor as jt, getAllShapes as k, hasSlideNotes as ka, getPresentationImageCountsBySlide as ki, replaceTokensInSlide as kn, setTableCellTextDirection as ko, setShapeNoStroke as kr, getSlideBackgroundPatternFill as ks, setShapeParagraphs as kt, addSectionHeaderSlide as l, getAllImages as la, getPresentationCommentCountsByAuthor as lc, setParagraphLevel as li, findShapeById as ln, getTableColumnWidths as lo, isShapePlaceholder as lr, addSlideChart as ls, bringShapeToFront as lt, duplicateSlideAt as m, getHiddenSlides as ma, removeSlideComment as mc, getSlideBody as mi, findShapesByKind as mn, getTableStyleId as mo, setShapeBounds as mr, getPresentationChartCountsBySlide as ms, sendShapeBackward as mt, addSlideMedia as n, clearSlideHyperlinks as na, getCommentAuthor as nc, getShapeRunCount as ni, getShapeStrokeColorResolved as nn, getTableCellMargins as no, getShapeText as nr, getSlideLayouts as ns, slideHasAnimations as nt, ungroupShapes as o, getAllCharts as oa, getCommentSlide as oc, isParagraphBulletPicture as oi, getShapeStrokeOpacity as on, getTableCellText as oo, getSlideMasterUsageCounts as or, getShapeRunFormatEffective as os, addSlideTable as ot, duplicateSlide as p, getEmptySlides as pa, getSlideComments as pc, setShapeRunText as pi, findShapesByHyperlink as pn, getTableStyleFlags as po, setShapeAltTitle as pr, findChartsWithTrendlines as ps, removeShape as pt, getSlidesByLayout as q, validatePresentation as qa, setShapeImageOpacity as qi, getShapeId as qn, findSlideLayout as qo, getParagraphEndFormat as qr, addSlideComment as qs, getShapeGradientFillEffective as qt, findShapesWithMedia as r, findSlidesByHyperlink as ra, getCommentAuthors as rc, getShapeRunHyperlink as ri, getShapeStrokeCompound as rn, getTableCellParagraphs as ro, getSlideMasterCount as rr, getUnusedSlideLayouts as rs, addSlideImage as rt, addBlankSlide as s, getAllComments as sa, getCommentText as sc, setParagraphAlignment as si, getShapeStrokeWidth as sn, getTableCellTextDirection as so, getUnusedSlideMasters as sr, setShapeHyperlink as ss, addSlideTextBox as st, VERSION as t, clearAllSlideNotes as ta, findSlidesWithCommentsByAuthor as tc, getShapeRunClickAction as ti, getShapeStrokeColor as tn, getTableCellFill as to, getShapeSize as tr, getSlideLayoutUsageCountsByType as ts, setSlideHidden as tt, addSlide as u, getAllNotes as ua, getPresentationCommentCountsBySlide as uc, setParagraphLineSpacing as ui, findShapeByName as un, getTableDimensions as uo, isShapeTextBox as ur, findChartByKind as us, clearSlideShapes as ut, removeSlide as v, getPresentationNotesText as va, setPresentationTheme as vc, setSlideTitle as vi, findShapesWithHyperlinks as vn, isTableShape as vo, clearShapeFill as vr, getShapeChartSeriesNames as vs, getShapeBodyPrEffective as vt, findSlideByPartName as w, getSlidesWithImages as wa, inches as wc, findOverlappingShapePairs as wi, getShapeXmlString as wn, setTableCellBorders as wo, setShapeFill as wr, resolveDeckBodyTextColor as ws, getShapeTextDirection as wt, swapSlides as x, getSlidesWithCharts as xa, savePresentation as xc, getShapeAnimation as xi, findSlidePlaceholders as xn, removeTableRow as xo, getShapeStrokeArrow as xr, getSlideCharts as xs, getShapeTextAutoFitParams as xt, reverseSlides as y, getSlideNotes as ya, createPresentation as yc, clearSlideAnimations as yi, findSlidePlaceholder as yn, mergeTableCells as yo, clearShapeStroke as yr, getShapeChartSeriesValues as ys, getShapeTextAnchor as yt, getSlideInfo as z, getOrphanMediaPartNames as za, getShapeImageOpacity as zi, getShapeAdjustValues as zn, getExtendedProperties as zo, setShapeStrokeJoin as zr, getSlideMasterBackgroundImageBytes as zs, clearShapeEffects as zt };
|
|
18830
19478
|
|
|
18831
|
-
//# sourceMappingURL=api-
|
|
19479
|
+
//# sourceMappingURL=api-0CdoUwvg.js.map
|