@office-open/core 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,611 @@
1
- import{T as e,a as t,b as n,o as r,p as i}from"../xml-components-Csq7gWPd.mjs";var a=class extends e{constructor(){super(`c:scaling`),this.root.push(n(`c:orientation`,i({val:`minMax`})))}},o=class extends e{constructor(e,t){super(`c:catAx`),this.root.push(n(`c:axId`,i({val:e}))),this.root.push(new a),this.root.push(n(`c:delete`,i({val:0}))),this.root.push(n(`c:axPos`,i({val:`b`}))),this.root.push(n(`c:auto`,i({val:1}))),this.root.push(n(`c:lblOffset`,i({val:100}))),this.root.push(n(`c:noMultiLvlLbl`,i({val:0}))),this.root.push(n(`c:crossAx`,i({val:t}))),this.root.push(n(`c:crosses`,i({val:`autoZero`})))}},s=class extends e{constructor(e,r){super(`c:valAx`),this.root.push(n(`c:axId`,i({val:e}))),this.root.push(new a),this.root.push(n(`c:delete`,i({val:0}))),this.root.push(n(`c:axPos`,i({val:`l`}))),this.root.push(n(`c:numFmt`,i({formatCode:`General`,sourceLinked:1}))),this.root.push(n(`c:crossAx`,i({val:r}))),this.root.push(n(`c:crosses`,i({val:`autoZero`}))),this.root.push(new t({name:`c:spPr`}))}};const c=e=>new u(typeof e==`string`?[e]:e),l=e=>new p(e);var u=class extends e{constructor(e){super(`c:strRef`),this.root.push(new r(`c:f`)),this.root.push(new d(e))}},d=class extends e{constructor(e){super(`c:strCache`),this.root.push(n(`c:ptCount`,i({val:e.length})));for(let t=0;t<e.length;t++)this.root.push(new f(t,e[t]))}},f=class extends e{constructor(e,t){super(`c:pt`),this.root.push(i({idx:e})),this.root.push(new _(`c:v`,t))}},p=class extends e{constructor(e){super(`c:numRef`),this.root.push(new r(`c:f`)),this.root.push(new m(e))}},m=class extends e{constructor(e){super(`c:numCache`),this.root.push(n(`c:ptCount`,i({val:e.length}))),this.root.push(new g(`General`));for(let t=0;t<e.length;t++)this.root.push(new h(t,e[t]))}},h=class extends e{constructor(e,t){super(`c:pt`),this.root.push(i({idx:e})),this.root.push(new _(`c:v`,String(t)))}},g=class extends e{constructor(e){super(`c:formatCode`),this.root.push(e)}},_=class extends e{constructor(e,t){super(e),this.root.push(t)}},v=class extends e{constructor(e){super(`c:areaChart`),this.root.push(n(`c:grouping`,i({val:`standard`})));for(let t=0;t<e.series.length;t++)this.root.push(new y(t,e.series[t],e.categories));this.root.push(n(`c:axId`,i({val:10}))),this.root.push(n(`c:axId`,i({val:20})))}},y=class extends e{constructor(e,t,a){super(`c:ser`),this.root.push(n(`c:idx`,i({val:e}))),this.root.push(n(`c:order`,i({val:e}))),this.root.push(new ee(t.name)),this.root.push(new b(a)),this.root.push(new x(t.values)),this.root.push(new r(`c:spPr`))}},ee=class extends e{constructor(e){super(`c:tx`),this.root.push(c(e))}},b=class extends e{constructor(e){super(`c:cat`),this.root.push(c(e))}},x=class extends e{constructor(e){super(`c:val`),this.root.push(l(e))}},S=class extends e{constructor(e){super(`c:barChart`),this.root.push(n(`c:barDir`,i({val:e.barDirection}))),this.root.push(n(`c:grouping`,i({val:`clustered`})));for(let t=0;t<e.series.length;t++)this.root.push(new C(t,e.series[t],e.categories));this.root.push(n(`c:axId`,i({val:10}))),this.root.push(n(`c:axId`,i({val:20})))}},C=class extends e{constructor(e,t,a){super(`c:ser`),this.root.push(n(`c:idx`,i({val:e}))),this.root.push(n(`c:order`,i({val:e}))),this.root.push(new w(t.name)),this.root.push(new T(a)),this.root.push(new E(t.values)),this.root.push(new r(`c:spPr`))}},w=class extends e{constructor(e){super(`c:tx`),this.root.push(c(e))}},T=class extends e{constructor(e){super(`c:cat`),this.root.push(c(e))}},E=class extends e{constructor(e){super(`c:val`),this.root.push(l(e))}},D=class extends e{constructor(e){super(`c:lineChart`),this.root.push(n(`c:grouping`,i({val:`standard`})));for(let t=0;t<e.series.length;t++)this.root.push(new O(t,e.series[t],e.categories));this.root.push(n(`c:axId`,i({val:10}))),this.root.push(n(`c:axId`,i({val:20})))}},O=class extends e{constructor(e,t,a){super(`c:ser`),this.root.push(n(`c:idx`,i({val:e}))),this.root.push(n(`c:order`,i({val:e}))),this.root.push(new k(t.name)),this.root.push(new A(a)),this.root.push(new j(t.values)),this.root.push(new r(`c:spPr`))}},k=class extends e{constructor(e){super(`c:tx`),this.root.push(c(e))}},A=class extends e{constructor(e){super(`c:cat`),this.root.push(c(e))}},j=class extends e{constructor(e){super(`c:val`),this.root.push(l(e))}},M=class extends e{constructor(e){super(`c:pieChart`),this.root.push(n(`c:varyColors`,i({val:!0})));for(let t=0;t<e.series.length;t++)this.root.push(new N(t,e.series[t],e.categories))}},N=class extends e{constructor(e,t,a){super(`c:ser`),this.root.push(n(`c:idx`,i({val:e}))),this.root.push(n(`c:order`,i({val:e}))),this.root.push(new P(t.name)),this.root.push(new te(a)),this.root.push(new F(t.values)),this.root.push(new r(`c:spPr`))}},P=class extends e{constructor(e){super(`c:tx`),this.root.push(c(e))}},te=class extends e{constructor(e){super(`c:cat`),this.root.push(c(e))}},F=class extends e{constructor(e){super(`c:val`),this.root.push(l(e))}},I=class extends e{constructor(e){super(`c:scatterChart`),this.root.push(n(`c:scatterStyle`,i({val:`line`})));for(let t=0;t<e.series.length;t++)this.root.push(new L(t,e.series[t],e.categories));this.root.push(n(`c:axId`,i({val:10}))),this.root.push(n(`c:axId`,i({val:20})))}},L=class extends e{constructor(e,t,a){super(`c:ser`),this.root.push(n(`c:idx`,i({val:e}))),this.root.push(n(`c:order`,i({val:e}))),this.root.push(new R(t.name)),this.root.push(new z(a)),this.root.push(new B(t.values)),this.root.push(new r(`c:spPr`)),this.root.push(new r(`c:size`))}},R=class extends e{constructor(e){super(`c:tx`),this.root.push(c(e))}},z=class extends e{constructor(e){super(`c:cat`),this.root.push(c(e))}},B=class extends e{constructor(e){super(`c:val`),this.root.push(l(e))}};const V=e=>{switch(e.type){case`column`:case`bar`:return new S({barDirection:e.type===`column`?`col`:`bar`,categories:e.categories,series:e.series});case`line`:return new D({categories:e.categories,series:e.series});case`pie`:return new M({categories:e.categories,series:e.series});case`area`:return new v({categories:e.categories,series:e.series});case`scatter`:return new I({categories:e.categories,series:e.series});default:throw Error(`Unsupported chart type: ${e.type}`)}};var H=class extends e{constructor(e){super(`c:title`),this.root.push(new U(e)),this.root.push(new W)}},U=class extends e{constructor(t){super(`c:tx`);let n=new class extends e{constructor(){super(`c:rich`)}};n.root.push(new class extends e{constructor(){super(`a:bodyPr`)}}),n.root.push(new class extends e{constructor(){super(`a:lstStyle`)}});let r=new class extends e{constructor(){super(`a:p`)}},i=new class extends e{constructor(){super(`a:r`)}};i.root.push(new class extends e{constructor(){super(`a:t`),this.root.push(t)}}),r.root.push(i),n.root.push(r),this.root.push(n)}},W=class extends e{constructor(){super(`c:overlay`),this.root.push(i({val:0}))}},G=class extends e{constructor(e){super(`c:chartSpace`),this.root.push(i({"xmlns:a":`http://schemas.openxmlformats.org/drawingml/2006/main`,"xmlns:c":`http://schemas.openxmlformats.org/drawingml/2006/chart`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`})),this.root.push(n(`c:date1904`,i({val:0}))),this.root.push(n(`c:lang`,i({val:`en-US`}))),this.root.push(n(`c:roundedCorners`,i({val:0})));let r=new K;e.title&&r.root.push(new H(e.title)),r.root.push(n(`c:autoTitleDeleted`,i({val:0})));let a=new q;a.root.push(new t({name:`c:layout`})),a.root.push(V({categories:e.categories,series:e.series,type:e.type})),e.type!==`pie`&&(e.type===`scatter`?(a.root.push(new s(10,20)),a.root.push(new s(20,10))):(a.root.push(new o(10,20)),a.root.push(new s(20,10)))),r.root.push(a),e.showLegend!==!1&&r.root.push(J()),this.root.push(r),this.root.push(X()),this.root.push(Z()),e.style!==void 0&&this.root.push(new re(e.style))}},K=class extends e{constructor(){super(`c:chart`)}},q=class extends e{constructor(){super(`c:plotArea`)}};function J(){let r=new class extends e{constructor(){super(`c:legend`)}};return r.root.push(n(`c:legendPos`,i({val:`b`}))),r.root.push(new t({name:`c:layout`})),r.root.push(n(`c:overlay`,i({val:0}))),r.root.push(Y()),r.root.push(Q()),r}function Y(){let n=new class extends e{constructor(){super(`c:spPr`)}};return n.root.push(new class extends e{constructor(){super(`a:noFill`)}}),n.root.push(new class extends e{constructor(){super(`a:ln`),this.root.push(new class extends e{constructor(){super(`a:noFill`)}})}}),n.root.push(new t({name:`a:effectLst`})),n}function X(){let n=new class extends e{constructor(){super(`c:spPr`)}};return n.root.push(new class extends e{constructor(){super(`a:noFill`)}}),n.root.push(new class extends e{constructor(){super(`a:ln`),this.root.push(new class extends e{constructor(){super(`a:noFill`)}})}}),n.root.push(new t({name:`a:effectLst`})),n}function Z(){let n=new class extends e{constructor(){super(`c:txPr`)}};return n.root.push(new t({name:`a:bodyPr`})),n.root.push(new t({name:`a:lstStyle`})),n.root.push($()),n}function Q(){let n=new class extends e{constructor(){super(`c:txPr`)}};return n.root.push(ne()),n.root.push(new t({name:`a:lstStyle`})),n.root.push($()),n}function ne(){return new t({name:`a:bodyPr`,attributes:{rot:{key:`rot`,value:`0`},spcFirstLastPara:{key:`spcFirstLastPara`,value:`1`},vertOverflow:{key:`vertOverflow`,value:`ellipsis`},vert:{key:`vert`,value:`horz`},wrap:{key:`wrap`,value:`square`},anchor:{key:`anchor`,value:`ctr`},anchorCtr:{key:`anchorCtr`,value:`1`}}})}function $(){let n=new class extends e{constructor(){super(`a:p`)}},r=new class extends e{constructor(){super(`a:pPr`)}};return r.root.push(new t({name:`a:defRPr`})),n.root.push(r),n.root.push(new t({name:`a:endParaRPr`,attributes:{lang:{key:`lang`,value:`en-US`}}})),n}var re=class extends e{constructor(e){super(`c:style`),this.root.push(i({val:String(e)}))}},ie=class{map;constructor(){this.map=new Map}addChart(e,t){this.map.set(e,t)}get Array(){return[...this.map.values()]}};export{v as AreaChart,S as BarChart,o as CatAx,ie as ChartCollection,G as ChartSpace,H as ChartTitle,D as LineChart,M as PieChart,I as ScatterChart,s as ValAx,V as createChartType,l as createNumRef,c as createStrRef};
1
+ import { T as XmlComponent, a as BuilderElement, b as wrapEl, o as EmptyElement, p as chartAttr } from "../xml-components-CJKrtCSG.mjs";
2
+ //#region src/chart/axes.ts
3
+ /**
4
+ * c:scaling — axis scaling configuration (minOccurs=1 in EG_AxShared).
5
+ */
6
+ var Scaling = class extends XmlComponent {
7
+ constructor() {
8
+ super("c:scaling");
9
+ this.root.push(wrapEl("c:orientation", chartAttr({ val: "minMax" })));
10
+ }
11
+ };
12
+ /**
13
+ * c:catAx — category axis.
14
+ */
15
+ var CatAx = class extends XmlComponent {
16
+ constructor(axId, crossAx) {
17
+ super("c:catAx");
18
+ this.root.push(wrapEl("c:axId", chartAttr({ val: axId })));
19
+ this.root.push(new Scaling());
20
+ this.root.push(wrapEl("c:delete", chartAttr({ val: 0 })));
21
+ this.root.push(wrapEl("c:axPos", chartAttr({ val: "b" })));
22
+ this.root.push(wrapEl("c:auto", chartAttr({ val: 1 })));
23
+ this.root.push(wrapEl("c:lblOffset", chartAttr({ val: 100 })));
24
+ this.root.push(wrapEl("c:noMultiLvlLbl", chartAttr({ val: 0 })));
25
+ this.root.push(wrapEl("c:crossAx", chartAttr({ val: crossAx })));
26
+ this.root.push(wrapEl("c:crosses", chartAttr({ val: "autoZero" })));
27
+ }
28
+ };
29
+ /**
30
+ * c:valAx — value axis.
31
+ */
32
+ var ValAx = class extends XmlComponent {
33
+ constructor(axId, crossAx) {
34
+ super("c:valAx");
35
+ this.root.push(wrapEl("c:axId", chartAttr({ val: axId })));
36
+ this.root.push(new Scaling());
37
+ this.root.push(wrapEl("c:delete", chartAttr({ val: 0 })));
38
+ this.root.push(wrapEl("c:axPos", chartAttr({ val: "l" })));
39
+ this.root.push(wrapEl("c:numFmt", chartAttr({
40
+ formatCode: "General",
41
+ sourceLinked: 1
42
+ })));
43
+ this.root.push(wrapEl("c:crossAx", chartAttr({ val: crossAx })));
44
+ this.root.push(wrapEl("c:crosses", chartAttr({ val: "autoZero" })));
45
+ this.root.push(new BuilderElement({ name: "c:spPr" }));
46
+ }
47
+ };
48
+ //#endregion
49
+ //#region src/chart/series/series-data.ts
50
+ const createStrRef = (values) => {
51
+ return new StrRef(typeof values === "string" ? [values] : values);
52
+ };
53
+ const createNumRef = (values) => new NumRef(values);
54
+ var StrRef = class extends XmlComponent {
55
+ constructor(values) {
56
+ super("c:strRef");
57
+ this.root.push(new EmptyElement("c:f"));
58
+ this.root.push(new StrCache(values));
59
+ }
60
+ };
61
+ var StrCache = class extends XmlComponent {
62
+ constructor(values) {
63
+ super("c:strCache");
64
+ this.root.push(wrapEl("c:ptCount", chartAttr({ val: values.length })));
65
+ for (let i = 0; i < values.length; i++) this.root.push(new StrPt(i, values[i]));
66
+ }
67
+ };
68
+ var StrPt = class extends XmlComponent {
69
+ constructor(index, value) {
70
+ super("c:pt");
71
+ this.root.push(chartAttr({ idx: index }));
72
+ this.root.push(new StringValue("c:v", value));
73
+ }
74
+ };
75
+ var NumRef = class extends XmlComponent {
76
+ constructor(values) {
77
+ super("c:numRef");
78
+ this.root.push(new EmptyElement("c:f"));
79
+ this.root.push(new NumCache(values));
80
+ }
81
+ };
82
+ var NumCache = class extends XmlComponent {
83
+ constructor(values) {
84
+ super("c:numCache");
85
+ this.root.push(wrapEl("c:ptCount", chartAttr({ val: values.length })));
86
+ this.root.push(new FormatCode("General"));
87
+ for (let i = 0; i < values.length; i++) this.root.push(new NumPt(i, values[i]));
88
+ }
89
+ };
90
+ var NumPt = class extends XmlComponent {
91
+ constructor(index, value) {
92
+ super("c:pt");
93
+ this.root.push(chartAttr({ idx: index }));
94
+ this.root.push(new StringValue("c:v", String(value)));
95
+ }
96
+ };
97
+ var FormatCode = class extends XmlComponent {
98
+ constructor(code) {
99
+ super("c:formatCode");
100
+ this.root.push(code);
101
+ }
102
+ };
103
+ var StringValue = class extends XmlComponent {
104
+ constructor(name, val) {
105
+ super(name);
106
+ this.root.push(val);
107
+ }
108
+ };
109
+ //#endregion
110
+ //#region src/chart/chart-types/area-chart.ts
111
+ var AreaChart = class extends XmlComponent {
112
+ constructor(options) {
113
+ super("c:areaChart");
114
+ this.root.push(wrapEl("c:grouping", chartAttr({ val: "standard" })));
115
+ for (let i = 0; i < options.series.length; i++) this.root.push(new AreaSeries(i, options.series[i], options.categories));
116
+ this.root.push(wrapEl("c:axId", chartAttr({ val: 10 })));
117
+ this.root.push(wrapEl("c:axId", chartAttr({ val: 20 })));
118
+ }
119
+ };
120
+ var AreaSeries = class extends XmlComponent {
121
+ constructor(index, series, categories) {
122
+ super("c:ser");
123
+ this.root.push(wrapEl("c:idx", chartAttr({ val: index })));
124
+ this.root.push(wrapEl("c:order", chartAttr({ val: index })));
125
+ this.root.push(new SeriesTx$4(series.name));
126
+ this.root.push(new SeriesCat$4(categories));
127
+ this.root.push(new SeriesVal$4(series.values));
128
+ this.root.push(new EmptyElement("c:spPr"));
129
+ }
130
+ };
131
+ var SeriesTx$4 = class extends XmlComponent {
132
+ constructor(name) {
133
+ super("c:tx");
134
+ this.root.push(createStrRef(name));
135
+ }
136
+ };
137
+ var SeriesCat$4 = class extends XmlComponent {
138
+ constructor(categories) {
139
+ super("c:cat");
140
+ this.root.push(createStrRef(categories));
141
+ }
142
+ };
143
+ var SeriesVal$4 = class extends XmlComponent {
144
+ constructor(values) {
145
+ super("c:val");
146
+ this.root.push(createNumRef(values));
147
+ }
148
+ };
149
+ //#endregion
150
+ //#region src/chart/chart-types/bar-chart.ts
151
+ var BarChart = class extends XmlComponent {
152
+ constructor(options) {
153
+ super("c:barChart");
154
+ this.root.push(wrapEl("c:barDir", chartAttr({ val: options.barDirection })));
155
+ this.root.push(wrapEl("c:grouping", chartAttr({ val: "clustered" })));
156
+ for (let i = 0; i < options.series.length; i++) this.root.push(new BarSeries(i, options.series[i], options.categories));
157
+ this.root.push(wrapEl("c:axId", chartAttr({ val: 10 })));
158
+ this.root.push(wrapEl("c:axId", chartAttr({ val: 20 })));
159
+ }
160
+ };
161
+ var BarSeries = class extends XmlComponent {
162
+ constructor(index, series, categories) {
163
+ super("c:ser");
164
+ this.root.push(wrapEl("c:idx", chartAttr({ val: index })));
165
+ this.root.push(wrapEl("c:order", chartAttr({ val: index })));
166
+ this.root.push(new SeriesTx$3(series.name));
167
+ this.root.push(new SeriesCat$3(categories));
168
+ this.root.push(new SeriesVal$3(series.values));
169
+ this.root.push(new EmptyElement("c:spPr"));
170
+ }
171
+ };
172
+ var SeriesTx$3 = class extends XmlComponent {
173
+ constructor(name) {
174
+ super("c:tx");
175
+ this.root.push(createStrRef(name));
176
+ }
177
+ };
178
+ var SeriesCat$3 = class extends XmlComponent {
179
+ constructor(categories) {
180
+ super("c:cat");
181
+ this.root.push(createStrRef(categories));
182
+ }
183
+ };
184
+ var SeriesVal$3 = class extends XmlComponent {
185
+ constructor(values) {
186
+ super("c:val");
187
+ this.root.push(createNumRef(values));
188
+ }
189
+ };
190
+ //#endregion
191
+ //#region src/chart/chart-types/line-chart.ts
192
+ var LineChart = class extends XmlComponent {
193
+ constructor(options) {
194
+ super("c:lineChart");
195
+ this.root.push(wrapEl("c:grouping", chartAttr({ val: "standard" })));
196
+ for (let i = 0; i < options.series.length; i++) this.root.push(new LineSeries(i, options.series[i], options.categories));
197
+ this.root.push(wrapEl("c:axId", chartAttr({ val: 10 })));
198
+ this.root.push(wrapEl("c:axId", chartAttr({ val: 20 })));
199
+ }
200
+ };
201
+ var LineSeries = class extends XmlComponent {
202
+ constructor(index, series, categories) {
203
+ super("c:ser");
204
+ this.root.push(wrapEl("c:idx", chartAttr({ val: index })));
205
+ this.root.push(wrapEl("c:order", chartAttr({ val: index })));
206
+ this.root.push(new SeriesTx$2(series.name));
207
+ this.root.push(new SeriesCat$2(categories));
208
+ this.root.push(new SeriesVal$2(series.values));
209
+ this.root.push(new EmptyElement("c:spPr"));
210
+ }
211
+ };
212
+ var SeriesTx$2 = class extends XmlComponent {
213
+ constructor(name) {
214
+ super("c:tx");
215
+ this.root.push(createStrRef(name));
216
+ }
217
+ };
218
+ var SeriesCat$2 = class extends XmlComponent {
219
+ constructor(categories) {
220
+ super("c:cat");
221
+ this.root.push(createStrRef(categories));
222
+ }
223
+ };
224
+ var SeriesVal$2 = class extends XmlComponent {
225
+ constructor(values) {
226
+ super("c:val");
227
+ this.root.push(createNumRef(values));
228
+ }
229
+ };
230
+ //#endregion
231
+ //#region src/chart/chart-types/pie-chart.ts
232
+ var PieChart = class extends XmlComponent {
233
+ constructor(options) {
234
+ super("c:pieChart");
235
+ this.root.push(wrapEl("c:varyColors", chartAttr({ val: true })));
236
+ for (let i = 0; i < options.series.length; i++) this.root.push(new PieSeries(i, options.series[i], options.categories));
237
+ }
238
+ };
239
+ var PieSeries = class extends XmlComponent {
240
+ constructor(index, series, categories) {
241
+ super("c:ser");
242
+ this.root.push(wrapEl("c:idx", chartAttr({ val: index })));
243
+ this.root.push(wrapEl("c:order", chartAttr({ val: index })));
244
+ this.root.push(new SeriesTx$1(series.name));
245
+ this.root.push(new SeriesCat$1(categories));
246
+ this.root.push(new SeriesVal$1(series.values));
247
+ this.root.push(new EmptyElement("c:spPr"));
248
+ }
249
+ };
250
+ var SeriesTx$1 = class extends XmlComponent {
251
+ constructor(name) {
252
+ super("c:tx");
253
+ this.root.push(createStrRef(name));
254
+ }
255
+ };
256
+ var SeriesCat$1 = class extends XmlComponent {
257
+ constructor(categories) {
258
+ super("c:cat");
259
+ this.root.push(createStrRef(categories));
260
+ }
261
+ };
262
+ var SeriesVal$1 = class extends XmlComponent {
263
+ constructor(values) {
264
+ super("c:val");
265
+ this.root.push(createNumRef(values));
266
+ }
267
+ };
268
+ //#endregion
269
+ //#region src/chart/chart-types/scatter-chart.ts
270
+ var ScatterChart = class extends XmlComponent {
271
+ constructor(options) {
272
+ super("c:scatterChart");
273
+ this.root.push(wrapEl("c:scatterStyle", chartAttr({ val: "line" })));
274
+ for (let i = 0; i < options.series.length; i++) this.root.push(new ScatterSeries(i, options.series[i], options.categories));
275
+ this.root.push(wrapEl("c:axId", chartAttr({ val: 10 })));
276
+ this.root.push(wrapEl("c:axId", chartAttr({ val: 20 })));
277
+ }
278
+ };
279
+ var ScatterSeries = class extends XmlComponent {
280
+ constructor(index, series, categories) {
281
+ super("c:ser");
282
+ this.root.push(wrapEl("c:idx", chartAttr({ val: index })));
283
+ this.root.push(wrapEl("c:order", chartAttr({ val: index })));
284
+ this.root.push(new SeriesTx(series.name));
285
+ this.root.push(new SeriesCat(categories));
286
+ this.root.push(new SeriesVal(series.values));
287
+ this.root.push(new EmptyElement("c:spPr"));
288
+ this.root.push(new EmptyElement("c:size"));
289
+ }
290
+ };
291
+ var SeriesTx = class extends XmlComponent {
292
+ constructor(name) {
293
+ super("c:tx");
294
+ this.root.push(createStrRef(name));
295
+ }
296
+ };
297
+ var SeriesCat = class extends XmlComponent {
298
+ constructor(categories) {
299
+ super("c:cat");
300
+ this.root.push(createStrRef(categories));
301
+ }
302
+ };
303
+ var SeriesVal = class extends XmlComponent {
304
+ constructor(values) {
305
+ super("c:val");
306
+ this.root.push(createNumRef(values));
307
+ }
308
+ };
309
+ //#endregion
310
+ //#region src/chart/create-chart-type.ts
311
+ const createChartType = (options) => {
312
+ switch (options.type) {
313
+ case "column":
314
+ case "bar": return new BarChart({
315
+ barDirection: options.type === "column" ? "col" : "bar",
316
+ categories: options.categories,
317
+ series: options.series
318
+ });
319
+ case "line": return new LineChart({
320
+ categories: options.categories,
321
+ series: options.series
322
+ });
323
+ case "pie": return new PieChart({
324
+ categories: options.categories,
325
+ series: options.series
326
+ });
327
+ case "area": return new AreaChart({
328
+ categories: options.categories,
329
+ series: options.series
330
+ });
331
+ case "scatter": return new ScatterChart({
332
+ categories: options.categories,
333
+ series: options.series
334
+ });
335
+ default: throw new Error(`Unsupported chart type: ${options.type}`);
336
+ }
337
+ };
338
+ //#endregion
339
+ //#region src/chart/title.ts
340
+ var ChartTitle = class extends XmlComponent {
341
+ constructor(title) {
342
+ super("c:title");
343
+ this.root.push(new TitleTx(title));
344
+ this.root.push(new TitleOverlay());
345
+ }
346
+ };
347
+ var TitleTx = class extends XmlComponent {
348
+ constructor(title) {
349
+ super("c:tx");
350
+ const rich = new class extends XmlComponent {
351
+ constructor() {
352
+ super("c:rich");
353
+ }
354
+ }();
355
+ rich["root"].push(new class extends XmlComponent {
356
+ constructor() {
357
+ super("a:bodyPr");
358
+ }
359
+ }());
360
+ rich["root"].push(new class extends XmlComponent {
361
+ constructor() {
362
+ super("a:lstStyle");
363
+ }
364
+ }());
365
+ const p = new class extends XmlComponent {
366
+ constructor() {
367
+ super("a:p");
368
+ }
369
+ }();
370
+ const r = new class extends XmlComponent {
371
+ constructor() {
372
+ super("a:r");
373
+ }
374
+ }();
375
+ r["root"].push(new class extends XmlComponent {
376
+ constructor() {
377
+ super("a:t");
378
+ this.root.push(title);
379
+ }
380
+ }());
381
+ p["root"].push(r);
382
+ rich["root"].push(p);
383
+ this.root.push(rich);
384
+ }
385
+ };
386
+ var TitleOverlay = class extends XmlComponent {
387
+ constructor() {
388
+ super("c:overlay");
389
+ this.root.push(chartAttr({ val: 0 }));
390
+ }
391
+ };
392
+ //#endregion
393
+ //#region src/chart/chart-space.ts
394
+ /**
395
+ * ChartSpace — root element for chart XML parts (c:chartSpace).
396
+ *
397
+ * Full XSD-compliant implementation with all optional elements.
398
+ *
399
+ * @module
400
+ */
401
+ /**
402
+ * c:chartSpace — root element for chart XML parts.
403
+ */
404
+ var ChartSpace = class extends XmlComponent {
405
+ constructor(options) {
406
+ super("c:chartSpace");
407
+ this.root.push(chartAttr({
408
+ "xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
409
+ "xmlns:c": "http://schemas.openxmlformats.org/drawingml/2006/chart",
410
+ "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
411
+ }));
412
+ this.root.push(wrapEl("c:date1904", chartAttr({ val: 0 })));
413
+ this.root.push(wrapEl("c:lang", chartAttr({ val: "en-US" })));
414
+ this.root.push(wrapEl("c:roundedCorners", chartAttr({ val: 0 })));
415
+ const chart = new ChartContainer();
416
+ if (options.title) chart["root"].push(new ChartTitle(options.title));
417
+ chart["root"].push(wrapEl("c:autoTitleDeleted", chartAttr({ val: 0 })));
418
+ const plotArea = new PlotArea();
419
+ plotArea["root"].push(new BuilderElement({ name: "c:layout" }));
420
+ plotArea["root"].push(createChartType({
421
+ categories: options.categories,
422
+ series: options.series,
423
+ type: options.type
424
+ }));
425
+ if (options.type !== "pie") if (options.type === "scatter") {
426
+ plotArea["root"].push(new ValAx(10, 20));
427
+ plotArea["root"].push(new ValAx(20, 10));
428
+ } else {
429
+ plotArea["root"].push(new CatAx(10, 20));
430
+ plotArea["root"].push(new ValAx(20, 10));
431
+ }
432
+ chart["root"].push(plotArea);
433
+ if (options.showLegend !== false) chart["root"].push(createLegend());
434
+ this.root.push(chart);
435
+ this.root.push(createChartSpPr());
436
+ this.root.push(createChartTxPr());
437
+ if (options.style !== void 0) this.root.push(new ChartStyle(options.style));
438
+ }
439
+ };
440
+ var ChartContainer = class extends XmlComponent {
441
+ constructor() {
442
+ super("c:chart");
443
+ }
444
+ };
445
+ var PlotArea = class extends XmlComponent {
446
+ constructor() {
447
+ super("c:plotArea");
448
+ }
449
+ };
450
+ function createLegend() {
451
+ const legend = new class extends XmlComponent {
452
+ constructor() {
453
+ super("c:legend");
454
+ }
455
+ }();
456
+ legend["root"].push(wrapEl("c:legendPos", chartAttr({ val: "b" })));
457
+ legend["root"].push(new BuilderElement({ name: "c:layout" }));
458
+ legend["root"].push(wrapEl("c:overlay", chartAttr({ val: 0 })));
459
+ legend["root"].push(createNoFillSpPr());
460
+ legend["root"].push(createTxPr());
461
+ return legend;
462
+ }
463
+ function createNoFillSpPr() {
464
+ const spPr = new class extends XmlComponent {
465
+ constructor() {
466
+ super("c:spPr");
467
+ }
468
+ }();
469
+ spPr["root"].push(new class extends XmlComponent {
470
+ constructor() {
471
+ super("a:noFill");
472
+ }
473
+ }());
474
+ spPr["root"].push(new class extends XmlComponent {
475
+ constructor() {
476
+ super("a:ln");
477
+ this.root.push(new class extends XmlComponent {
478
+ constructor() {
479
+ super("a:noFill");
480
+ }
481
+ }());
482
+ }
483
+ }());
484
+ spPr["root"].push(new BuilderElement({ name: "a:effectLst" }));
485
+ return spPr;
486
+ }
487
+ function createChartSpPr() {
488
+ const spPr = new class extends XmlComponent {
489
+ constructor() {
490
+ super("c:spPr");
491
+ }
492
+ }();
493
+ spPr["root"].push(new class extends XmlComponent {
494
+ constructor() {
495
+ super("a:noFill");
496
+ }
497
+ }());
498
+ spPr["root"].push(new class extends XmlComponent {
499
+ constructor() {
500
+ super("a:ln");
501
+ this.root.push(new class extends XmlComponent {
502
+ constructor() {
503
+ super("a:noFill");
504
+ }
505
+ }());
506
+ }
507
+ }());
508
+ spPr["root"].push(new BuilderElement({ name: "a:effectLst" }));
509
+ return spPr;
510
+ }
511
+ function createChartTxPr() {
512
+ const txPr = new class extends XmlComponent {
513
+ constructor() {
514
+ super("c:txPr");
515
+ }
516
+ }();
517
+ txPr["root"].push(new BuilderElement({ name: "a:bodyPr" }));
518
+ txPr["root"].push(new BuilderElement({ name: "a:lstStyle" }));
519
+ txPr["root"].push(createTextParagraph());
520
+ return txPr;
521
+ }
522
+ function createTxPr() {
523
+ const txPr = new class extends XmlComponent {
524
+ constructor() {
525
+ super("c:txPr");
526
+ }
527
+ }();
528
+ txPr["root"].push(createBodyPr());
529
+ txPr["root"].push(new BuilderElement({ name: "a:lstStyle" }));
530
+ txPr["root"].push(createTextParagraph());
531
+ return txPr;
532
+ }
533
+ function createBodyPr() {
534
+ return new BuilderElement({
535
+ name: "a:bodyPr",
536
+ attributes: {
537
+ rot: {
538
+ key: "rot",
539
+ value: "0"
540
+ },
541
+ spcFirstLastPara: {
542
+ key: "spcFirstLastPara",
543
+ value: "1"
544
+ },
545
+ vertOverflow: {
546
+ key: "vertOverflow",
547
+ value: "ellipsis"
548
+ },
549
+ vert: {
550
+ key: "vert",
551
+ value: "horz"
552
+ },
553
+ wrap: {
554
+ key: "wrap",
555
+ value: "square"
556
+ },
557
+ anchor: {
558
+ key: "anchor",
559
+ value: "ctr"
560
+ },
561
+ anchorCtr: {
562
+ key: "anchorCtr",
563
+ value: "1"
564
+ }
565
+ }
566
+ });
567
+ }
568
+ function createTextParagraph() {
569
+ const p = new class extends XmlComponent {
570
+ constructor() {
571
+ super("a:p");
572
+ }
573
+ }();
574
+ const pPr = new class extends XmlComponent {
575
+ constructor() {
576
+ super("a:pPr");
577
+ }
578
+ }();
579
+ pPr["root"].push(new BuilderElement({ name: "a:defRPr" }));
580
+ p["root"].push(pPr);
581
+ p["root"].push(new BuilderElement({
582
+ name: "a:endParaRPr",
583
+ attributes: { lang: {
584
+ key: "lang",
585
+ value: "en-US"
586
+ } }
587
+ }));
588
+ return p;
589
+ }
590
+ var ChartStyle = class extends XmlComponent {
591
+ constructor(val) {
592
+ super("c:style");
593
+ this.root.push(chartAttr({ val: String(val) }));
594
+ }
595
+ };
596
+ //#endregion
597
+ //#region src/chart/chart-collection.ts
598
+ var ChartCollection = class {
599
+ map;
600
+ constructor() {
601
+ this.map = /* @__PURE__ */ new Map();
602
+ }
603
+ addChart(key, chartData) {
604
+ this.map.set(key, chartData);
605
+ }
606
+ get Array() {
607
+ return [...this.map.values()];
608
+ }
609
+ };
610
+ //#endregion
611
+ export { AreaChart, BarChart, CatAx, ChartCollection, ChartSpace, ChartTitle, LineChart, PieChart, ScatterChart, ValAx, createChartType, createNumRef, createStrRef };