jvs-ppt-ui 0.0.29 → 0.0.32

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,194 +1,357 @@
1
- import { ref, computed, type ComputedRef } from 'vue'
2
- import { generateMonoPalette } from '../../utils/palette'
3
-
4
- export const CHART_PRESET_PALETTES = [
5
- { id: 'mono', name: 'Chart colors - Mono', isDynamic: true },
6
- { id: 'diverging', name: 'Diverging', colors: ['#2563eb', '#60a5fa', '#93c5fd', '#e2e8f0', '#fed7aa', '#fb923c', '#ea580c', '#c2410c'] },
7
- { id: 'saturated', name: 'Saturated', colors: ['#3b82f6', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6', '#ec4899', '#06b6d4', '#84cc16'] },
8
- { id: 'colorblind', name: 'Colorblind friendly', colors: ['#000000', '#E69F00', '#56B4E9', '#009E73', '#F0E442', '#0072B2', '#D55E00', '#CC79A7'] },
9
- { id: 'ocean', name: '静谧海洋', colors: ['#2563eb', '#3b82f6', '#60a5fa', '#93c5fd', '#bfdbfe', '#1d4ed8', '#1e3a8a', '#dbeafe'] },
10
- { id: 'emerald', name: '清新绿意', colors: ['#10b981', '#059669', '#34d399', '#6ee7b7', '#a7f3d0', '#047857', '#065f46', '#022c22'] },
11
- { id: 'warm', name: '温暖朝阳', colors: ['#f59e0b', '#ef4444', '#ec4899', '#f97316', '#fca5a5', '#b91c1c', '#7f1d1d', '#fda4af'] },
12
- { id: 'slate', name: '高级灰调', colors: ['#1e293b', '#334155', '#475569', '#64748b', '#94a3b8', '#cbd5e1', '#e2e8f0', '#f1f5f9'] },
13
- { id: 'pink', name: '浪漫粉黛', colors: ['#fbcfe8', '#f9a8d4', '#f472b6', '#ec4899', '#db2777', '#be185d', '#9d174d', '#831843'] }
14
- ]
15
-
16
- export function useSidebarChart(
17
- selectedElement: ComputedRef<any>,
18
- addHistorySnapshot: () => void
19
- ) {
20
- const chartDataDialogVisible = ref(false)
21
- const tempChartDataText = ref('')
22
- const chartTypePopoverVisible = ref(false)
23
-
24
- const chartPrimaryColor = computed({
25
- get() {
26
- if (!selectedElement.value) return '#4f46e5'
27
- return selectedElement.value.style?.chartPrimaryColor || selectedElement.value.style?.chartColors?.[0] || '#4f46e5'
28
- },
29
- set(val: string) {
30
- if (!selectedElement.value || selectedElement.value.type !== 'chart') return
31
- if (!selectedElement.value.style) selectedElement.value.style = {}
32
- selectedElement.value.style.chartPrimaryColor = val
33
- const monoColors = generateMonoPalette(val, 8)
34
- selectedElement.value.style.chartColors = monoColors
35
- selectedElement.value.style.chartPalette = 'mono'
36
- addHistorySnapshot()
37
- }
38
- })
39
-
40
- const currentChartPaletteId = computed(() => {
41
- return selectedElement.value?.style?.chartPalette || 'mono'
42
- })
43
-
44
- const currentChartColors = computed(() => {
45
- if (selectedElement.value?.style?.chartColors && Array.isArray(selectedElement.value.style.chartColors) && selectedElement.value.style.chartColors.length > 0) {
46
- return selectedElement.value.style.chartColors
47
- }
48
- return generateMonoPalette(chartPrimaryColor.value, 8)
49
- })
50
-
51
- function getPaletteColors(palette: any): string[] {
52
- if (palette.id === 'mono') {
53
- return generateMonoPalette(chartPrimaryColor.value, 8)
54
- }
55
- return palette.colors || []
56
- }
57
-
58
- function selectChartPalette(palette: any) {
59
- if (!selectedElement.value || selectedElement.value.type !== 'chart') return
60
- if (!selectedElement.value.style) selectedElement.value.style = {}
61
- selectedElement.value.style.chartPalette = palette.id
62
- selectedElement.value.style.chartColors = getPaletteColors(palette)
63
- addHistorySnapshot()
64
- }
65
-
66
- const chartTextColor = computed({
67
- get() {
68
- return selectedElement.value?.style?.textColor || selectedElement.value?.style?.color || '#64748b'
69
- },
70
- set(val: string) {
71
- if (!selectedElement.value) return
72
- if (!selectedElement.value.style) selectedElement.value.style = {}
73
- selectedElement.value.style.textColor = val
74
- selectedElement.value.style.color = val
75
- addHistorySnapshot()
76
- }
77
- })
78
-
79
- const chartGridColor = computed({
80
- get() {
81
- return selectedElement.value?.style?.gridColor || '#e2e8f0'
82
- },
83
- set(val: string) {
84
- if (!selectedElement.value) return
85
- if (!selectedElement.value.style) selectedElement.value.style = {}
86
- selectedElement.value.style.gridColor = val
87
- addHistorySnapshot()
88
- }
89
- })
90
-
91
- function updateChartColor(index: number, newColor: string) {
92
- if (!selectedElement.value || selectedElement.value.type !== 'chart') return
93
- if (!selectedElement.value.style) selectedElement.value.style = { top: '0px', left: '0px' }
94
- if (!selectedElement.value.style.chartColors) {
95
- selectedElement.value.style.chartColors = [...(CHART_PRESET_PALETTES[1].colors || [])]
96
- }
97
- const newColors = [...selectedElement.value.style.chartColors]
98
- newColors[index] = newColor
99
- selectedElement.value.style.chartColors = newColors
100
- selectedElement.value.style.chartPalette = 'custom'
101
- addHistorySnapshot()
102
- }
103
-
104
- function changeChartType(type: 'bar' | 'horizontal-bar' | 'line' | 'area' | 'scatter' | 'pie' | 'donut' | 'radar') {
105
- if (selectedElement.value && selectedElement.value.type === 'chart') {
106
- selectedElement.value.chartType = type
107
- }
108
- chartTypePopoverVisible.value = false
109
- }
110
-
111
- function getChartDataText(el: any) {
112
- if (!el.data) {
113
- if (el.chartType === 'pie' || el.chartType === 'donut') {
114
- return '分类A,35\n分类B,25\n分类C,20\n分类D,20'
115
- }
116
- if (el.chartType === 'radar') {
117
- return '指标A,80,60\n指标B,70,80\n指标C,90,75\n指标D,60,80\n指标E,85,70'
118
- }
119
- return '一月,30,20\n二月,45,30\n三月,55,40\n四月,60,45\n五月,80,65'
120
- }
121
- const labels = el.data.labels || []
122
- const datasets = el.data.datasets || []
123
- if (datasets.length === 0) return ''
124
- return labels.map((l: string, i: number) => {
125
- const vals = datasets.map((d: any) => d.data[i] !== undefined ? d.data[i] : 0)
126
- return [l, ...vals].join(',')
127
- }).join('\n')
128
- }
129
-
130
- function updateChartDataText(el: any, text: string) {
131
- const lines = text.split('\n')
132
- const labels: string[] = []
133
- const datasetValuesList: number[][] = []
134
-
135
- for (const line of lines) {
136
- const parts = line.split(',')
137
- if (parts.length >= 2) {
138
- const label = parts[0].trim()
139
- const vals = parts.slice(1).map(p => parseFloat(p.trim())).filter(v => !isNaN(v))
140
- if (vals.length > 0) {
141
- labels.push(label)
142
- vals.forEach((v, idx) => {
143
- if (!datasetValuesList[idx]) datasetValuesList[idx] = []
144
- datasetValuesList[idx].push(v)
145
- })
146
- }
147
- }
148
- }
149
-
150
- if (labels.length > 0 && datasetValuesList.length > 0) {
151
- el.data = {
152
- labels,
153
- datasets: datasetValuesList.map((vals, idx) => {
154
- const oldDataset = el.data?.datasets?.[idx]
155
- return {
156
- label: oldDataset?.label || `系列${idx + 1}`,
157
- data: vals
158
- }
159
- })
160
- }
161
- }
162
- }
163
-
164
- function openChartDataDialog() {
165
- if (selectedElement.value) {
166
- tempChartDataText.value = getChartDataText(selectedElement.value)
167
- chartDataDialogVisible.value = true
168
- }
169
- }
170
-
171
- function saveChartData() {
172
- if (selectedElement.value) {
173
- updateChartDataText(selectedElement.value, tempChartDataText.value)
174
- chartDataDialogVisible.value = false
175
- }
176
- }
177
-
178
- return {
179
- chartDataDialogVisible,
180
- tempChartDataText,
181
- chartTypePopoverVisible,
182
- chartPrimaryColor,
183
- currentChartPaletteId,
184
- currentChartColors,
185
- chartPresetPalettes: CHART_PRESET_PALETTES,
186
- selectChartPalette,
187
- chartTextColor,
188
- chartGridColor,
189
- updateChartColor,
190
- changeChartType,
191
- openChartDataDialog,
192
- saveChartData
193
- }
194
- }
1
+ import { ref, computed, type ComputedRef } from 'vue'
2
+ import { generateMonoPalette } from '../../utils/palette'
3
+
4
+ export const CHART_PRESET_PALETTES = [
5
+ { id: 'mono', name: 'Chart colors - Mono', isDynamic: true },
6
+ { id: 'diverging', name: 'Diverging', colors: ['#2563eb', '#60a5fa', '#93c5fd', '#e2e8f0', '#fed7aa', '#fb923c', '#ea580c', '#c2410c'] },
7
+ { id: 'saturated', name: 'Saturated', colors: ['#3b82f6', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6', '#ec4899', '#06b6d4', '#84cc16'] },
8
+ { id: 'colorblind', name: 'Colorblind friendly', colors: ['#000000', '#E69F00', '#56B4E9', '#009E73', '#F0E442', '#0072B2', '#D55E00', '#CC79A7'] },
9
+ { id: 'ocean', name: '静谧海洋', colors: ['#2563eb', '#3b82f6', '#60a5fa', '#93c5fd', '#bfdbfe', '#1d4ed8', '#1e3a8a', '#dbeafe'] },
10
+ { id: 'emerald', name: '清新绿意', colors: ['#10b981', '#059669', '#34d399', '#6ee7b7', '#a7f3d0', '#047857', '#065f46', '#022c22'] },
11
+ { id: 'warm', name: '温暖朝阳', colors: ['#f59e0b', '#ef4444', '#ec4899', '#f97316', '#fca5a5', '#b91c1c', '#7f1d1d', '#fda4af'] },
12
+ { id: 'slate', name: '高级灰调', colors: ['#1e293b', '#334155', '#475569', '#64748b', '#94a3b8', '#cbd5e1', '#e2e8f0', '#f1f5f9'] },
13
+ { id: 'pink', name: '浪漫粉黛', colors: ['#fbcfe8', '#f9a8d4', '#f472b6', '#ec4899', '#db2777', '#be185d', '#9d174d', '#831843'] }
14
+ ]
15
+
16
+ export interface ChartDatasetItem {
17
+ label: string
18
+ data: number[]
19
+ }
20
+
21
+ export function useSidebarChart(
22
+ selectedElement: ComputedRef<any>,
23
+ addHistorySnapshot: () => void
24
+ ) {
25
+ const chartDataDialogVisible = ref(false)
26
+ const tempChartDataText = ref('')
27
+ const tempChartLabels = ref<string[]>([])
28
+ const tempChartDatasets = ref<ChartDatasetItem[]>([])
29
+ const chartEditMode = ref<'table' | 'csv'>('table')
30
+ const previewChartType = ref<string>('pie')
31
+ const chartTypePopoverVisible = ref(false)
32
+
33
+ const chartPrimaryColor = computed({
34
+ get() {
35
+ if (!selectedElement.value) return '#4f46e5'
36
+ return selectedElement.value.style?.chartPrimaryColor || selectedElement.value.style?.chartColors?.[0] || '#4f46e5'
37
+ },
38
+ set(val: string) {
39
+ if (!selectedElement.value || selectedElement.value.type !== 'chart') return
40
+ if (!selectedElement.value.style) selectedElement.value.style = {}
41
+ selectedElement.value.style.chartPrimaryColor = val
42
+ const monoColors = generateMonoPalette(val, 8)
43
+ selectedElement.value.style.chartColors = monoColors
44
+ selectedElement.value.style.chartPalette = 'mono'
45
+ addHistorySnapshot()
46
+ }
47
+ })
48
+
49
+ const currentChartPaletteId = computed(() => {
50
+ return selectedElement.value?.style?.chartPalette || 'mono'
51
+ })
52
+
53
+ const currentChartColors = computed(() => {
54
+ if (selectedElement.value?.style?.chartColors && Array.isArray(selectedElement.value.style.chartColors) && selectedElement.value.style.chartColors.length > 0) {
55
+ return selectedElement.value.style.chartColors
56
+ }
57
+ return generateMonoPalette(chartPrimaryColor.value, 8)
58
+ })
59
+
60
+ function getPaletteColors(palette: any): string[] {
61
+ if (palette.id === 'mono') {
62
+ return generateMonoPalette(chartPrimaryColor.value, 8)
63
+ }
64
+ return palette.colors || []
65
+ }
66
+
67
+ function selectChartPalette(palette: any) {
68
+ if (!selectedElement.value || selectedElement.value.type !== 'chart') return
69
+ if (!selectedElement.value.style) selectedElement.value.style = {}
70
+ selectedElement.value.style.chartPalette = palette.id
71
+ selectedElement.value.style.chartColors = getPaletteColors(palette)
72
+ addHistorySnapshot()
73
+ }
74
+
75
+ const chartTextColor = computed({
76
+ get() {
77
+ return selectedElement.value?.style?.textColor || selectedElement.value?.style?.color || '#64748b'
78
+ },
79
+ set(val: string) {
80
+ if (!selectedElement.value) return
81
+ if (!selectedElement.value.style) selectedElement.value.style = {}
82
+ selectedElement.value.style.textColor = val
83
+ selectedElement.value.style.color = val
84
+ addHistorySnapshot()
85
+ }
86
+ })
87
+
88
+ const chartGridColor = computed({
89
+ get() {
90
+ return selectedElement.value?.style?.gridColor || '#e2e8f0'
91
+ },
92
+ set(val: string) {
93
+ if (!selectedElement.value) return
94
+ if (!selectedElement.value.style) selectedElement.value.style = {}
95
+ selectedElement.value.style.gridColor = val
96
+ addHistorySnapshot()
97
+ }
98
+ })
99
+
100
+ function updateChartColor(index: number, newColor: string) {
101
+ if (!selectedElement.value || selectedElement.value.type !== 'chart') return
102
+ if (!selectedElement.value.style) selectedElement.value.style = { top: '0px', left: '0px' }
103
+ if (!selectedElement.value.style.chartColors) {
104
+ selectedElement.value.style.chartColors = [...(CHART_PRESET_PALETTES[1].colors || [])]
105
+ }
106
+ const newColors = [...selectedElement.value.style.chartColors]
107
+ newColors[index] = newColor
108
+ selectedElement.value.style.chartColors = newColors
109
+ selectedElement.value.style.chartPalette = 'custom'
110
+ addHistorySnapshot()
111
+ }
112
+
113
+ function changeChartType(type: string) {
114
+ if (selectedElement.value && selectedElement.value.type === 'chart') {
115
+ selectedElement.value.chartType = type
116
+ addHistorySnapshot()
117
+ }
118
+ chartTypePopoverVisible.value = false
119
+ }
120
+
121
+ function getDefaultStructuredData(el: any): { labels: string[]; datasets: ChartDatasetItem[] } {
122
+ const type = el?.chartType || 'bar'
123
+ if (['pie', 'donut', 'rose-pie', 'rose-donut', 'pieChart', 'doughnutChart'].includes(type)) {
124
+ return {
125
+ labels: ['分类A', '分类B', '分类C', '分类D'],
126
+ datasets: [{ label: '系列1', data: [35, 25, 20, 20] }]
127
+ }
128
+ }
129
+ if (type === 'radar') {
130
+ return {
131
+ labels: ['指标A', '指标B', '指标C', '指标D', '指标E'],
132
+ datasets: [
133
+ { label: '系列1', data: [80, 70, 90, 60, 85] },
134
+ { label: '系列2', data: [60, 80, 75, 80, 70] }
135
+ ]
136
+ }
137
+ }
138
+ return {
139
+ labels: ['一月', '二月', '三月', '四月', '五月'],
140
+ datasets: [
141
+ { label: '系列1', data: [30, 45, 55, 60, 80] },
142
+ { label: '系列2', data: [20, 30, 40, 45, 65] }
143
+ ]
144
+ }
145
+ }
146
+
147
+ function extractStructuredData(el: any): { labels: string[]; datasets: ChartDatasetItem[] } {
148
+ if (!el?.data) {
149
+ return getDefaultStructuredData(el)
150
+ }
151
+ const rawLabels = Array.isArray(el.data.labels) && el.data.labels.length > 0
152
+ ? [...el.data.labels]
153
+ : getDefaultStructuredData(el).labels
154
+
155
+ if (Array.isArray(el.data.datasets) && el.data.datasets.length > 0) {
156
+ const datasets = el.data.datasets.map((ds: any, idx: number) => ({
157
+ label: ds.label || `系列${idx + 1}`,
158
+ data: rawLabels.map((_, rIdx) => {
159
+ const v = Number(ds.data?.[rIdx])
160
+ return isNaN(v) ? 0 : v
161
+ })
162
+ }))
163
+ return { labels: rawLabels, datasets }
164
+ }
165
+
166
+ if (Array.isArray(el.data.series) && el.data.series.length > 0) {
167
+ const legends = el.data.legends || []
168
+ const datasets = el.data.series.map((s: any, idx: number) => {
169
+ const arr = Array.isArray(s) ? s : [s]
170
+ return {
171
+ label: legends[idx] || `系列${idx + 1}`,
172
+ data: rawLabels.map((_, rIdx) => {
173
+ const v = Number(arr[rIdx])
174
+ return isNaN(v) ? 0 : v
175
+ })
176
+ }
177
+ })
178
+ return { labels: rawLabels, datasets }
179
+ }
180
+
181
+ return getDefaultStructuredData(el)
182
+ }
183
+
184
+ function syncStructuredToText() {
185
+ const labels = tempChartLabels.value
186
+ const datasets = tempChartDatasets.value
187
+ if (!labels.length || !datasets.length) {
188
+ tempChartDataText.value = ''
189
+ return
190
+ }
191
+ tempChartDataText.value = labels
192
+ .map((l, rIdx) => {
193
+ const vals = datasets.map(ds => (ds.data[rIdx] !== undefined ? ds.data[rIdx] : 0))
194
+ return [l, ...vals].join(', ')
195
+ })
196
+ .join('\n')
197
+ }
198
+
199
+ function syncTextToStructured(text: string) {
200
+ const lines = text.split('\n').map(l => l.trim()).filter(Boolean)
201
+ const labels: string[] = []
202
+ const datasetValuesList: number[][] = []
203
+
204
+ for (const line of lines) {
205
+ const parts = line.split(/[,,\t]/)
206
+ if (parts.length >= 2) {
207
+ const label = parts[0].trim() || `分类${labels.length + 1}`
208
+ const vals = parts.slice(1).map(p => {
209
+ const parsed = parseFloat(p.trim())
210
+ return isNaN(parsed) ? 0 : parsed
211
+ })
212
+ if (vals.length > 0) {
213
+ labels.push(label)
214
+ vals.forEach((v, idx) => {
215
+ if (!datasetValuesList[idx]) datasetValuesList[idx] = []
216
+ datasetValuesList[idx].push(v)
217
+ })
218
+ }
219
+ }
220
+ }
221
+
222
+ if (labels.length > 0 && datasetValuesList.length > 0) {
223
+ tempChartLabels.value = labels
224
+ tempChartDatasets.value = datasetValuesList.map((vals, idx) => ({
225
+ label: tempChartDatasets.value[idx]?.label || `系列${idx + 1}`,
226
+ data: labels.map((_, rIdx) => vals[rIdx] ?? 0)
227
+ }))
228
+ }
229
+ }
230
+
231
+ function addChartRow() {
232
+ const nextIdx = tempChartLabels.value.length
233
+ const suffix = nextIdx < 26 ? String.fromCharCode(65 + nextIdx) : `${nextIdx + 1}`
234
+ tempChartLabels.value.push(`分类${suffix}`)
235
+ tempChartDatasets.value.forEach(ds => {
236
+ ds.data.push(20)
237
+ })
238
+ syncStructuredToText()
239
+ }
240
+
241
+ function removeChartRow(rowIndex: number) {
242
+ if (tempChartLabels.value.length <= 1) return
243
+ tempChartLabels.value.splice(rowIndex, 1)
244
+ tempChartDatasets.value.forEach(ds => {
245
+ ds.data.splice(rowIndex, 1)
246
+ })
247
+ syncStructuredToText()
248
+ }
249
+
250
+ function addChartSeries() {
251
+ const nextIdx = tempChartDatasets.value.length + 1
252
+ tempChartDatasets.value.push({
253
+ label: `系列${nextIdx}`,
254
+ data: tempChartLabels.value.map(() => 25)
255
+ })
256
+ syncStructuredToText()
257
+ }
258
+
259
+ function removeChartSeries(seriesIndex: number) {
260
+ if (tempChartDatasets.value.length <= 1) return
261
+ tempChartDatasets.value.splice(seriesIndex, 1)
262
+ syncStructuredToText()
263
+ }
264
+
265
+ function transposeChartData() {
266
+ const oldLabels = [...tempChartLabels.value]
267
+ const oldDatasets = tempChartDatasets.value.map(ds => ({
268
+ label: ds.label,
269
+ data: [...ds.data]
270
+ }))
271
+ if (!oldLabels.length || !oldDatasets.length) return
272
+
273
+ tempChartLabels.value = oldDatasets.map(ds => ds.label)
274
+ tempChartDatasets.value = oldLabels.map((lbl, rIdx) => ({
275
+ label: lbl,
276
+ data: oldDatasets.map(ds => ds.data[rIdx] ?? 0)
277
+ }))
278
+ syncStructuredToText()
279
+ }
280
+
281
+ function openChartDataDialog() {
282
+ if (selectedElement.value) {
283
+ const { labels, datasets } = extractStructuredData(selectedElement.value)
284
+ tempChartLabels.value = labels
285
+ tempChartDatasets.value = datasets
286
+ previewChartType.value = selectedElement.value.chartType || 'bar'
287
+ chartEditMode.value = 'table'
288
+ syncStructuredToText()
289
+ chartDataDialogVisible.value = true
290
+ }
291
+ }
292
+
293
+ function saveChartData() {
294
+ if (selectedElement.value) {
295
+ if (chartEditMode.value === 'csv') {
296
+ syncTextToStructured(tempChartDataText.value)
297
+ }
298
+ const cleanLabels: string[] = []
299
+ const cleanDatasets: ChartDatasetItem[] = tempChartDatasets.value.map((ds, idx) => ({
300
+ label: (ds.label || '').trim() || `系列${idx + 1}`,
301
+ data: []
302
+ }))
303
+
304
+ tempChartLabels.value.forEach((lbl, rIdx) => {
305
+ const trimmed = (lbl || '').trim()
306
+ const hasAnyValue = tempChartDatasets.value.some(ds => ds.data[rIdx] !== undefined && !isNaN(Number(ds.data[rIdx])))
307
+ if (trimmed || hasAnyValue) {
308
+ cleanLabels.push(trimmed || `分类${cleanLabels.length + 1}`)
309
+ tempChartDatasets.value.forEach((ds, sIdx) => {
310
+ const num = Number(ds.data[rIdx])
311
+ cleanDatasets[sIdx].data.push(isNaN(num) ? 0 : num)
312
+ })
313
+ }
314
+ })
315
+
316
+ if (cleanLabels.length > 0 && cleanDatasets.length > 0) {
317
+ selectedElement.value.data = {
318
+ labels: cleanLabels,
319
+ datasets: cleanDatasets
320
+ }
321
+ }
322
+ if (previewChartType.value && selectedElement.value.chartType !== previewChartType.value) {
323
+ selectedElement.value.chartType = previewChartType.value
324
+ }
325
+ addHistorySnapshot()
326
+ chartDataDialogVisible.value = false
327
+ }
328
+ }
329
+
330
+ return {
331
+ chartDataDialogVisible,
332
+ tempChartDataText,
333
+ tempChartLabels,
334
+ tempChartDatasets,
335
+ chartEditMode,
336
+ previewChartType,
337
+ chartTypePopoverVisible,
338
+ chartPrimaryColor,
339
+ currentChartPaletteId,
340
+ currentChartColors,
341
+ chartPresetPalettes: CHART_PRESET_PALETTES,
342
+ selectChartPalette,
343
+ chartTextColor,
344
+ chartGridColor,
345
+ updateChartColor,
346
+ changeChartType,
347
+ addChartRow,
348
+ removeChartRow,
349
+ addChartSeries,
350
+ removeChartSeries,
351
+ transposeChartData,
352
+ syncStructuredToText,
353
+ syncTextToStructured,
354
+ openChartDataDialog,
355
+ saveChartData
356
+ }
357
+ }
@@ -170,6 +170,8 @@ export function useSidebarDesign() {
170
170
 
171
171
  slide.masterId = parentMaster?.id || slide.masterId || 'master-default'
172
172
  slide.layoutId = masterLayout.id
173
+ if (masterLayout.background && (!slide.bgType || slide.bgType === 'color')) slide.background = masterLayout.background
174
+ if ((parentMaster as any)?.themeId && !slide.themeId) { slide.themeId = (parentMaster as any).themeId; slide.themeName = (parentMaster as any).themeName }
173
175
  slide.showMasterElements = true
174
176
  slide.elements = [...nonLayoutElements, ...newElements]
175
177
  addHistorySnapshot()