origam 2.38.0 → 2.38.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.
Files changed (228) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/src/assets/locales/en.json +1 -1
  3. package/dist/src/assets/locales/fr.json +2 -2
  4. package/dist/src/components/Alert/OrigamAlert.vue +739 -165
  5. package/dist/src/components/App/OrigamApp.vue +95 -19
  6. package/dist/src/components/App/OrigamAppBar.vue +751 -158
  7. package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
  8. package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
  9. package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
  10. package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
  11. package/dist/src/components/Badge/OrigamBadge.vue +548 -135
  12. package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
  13. package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
  14. package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
  15. package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
  16. package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
  17. package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
  18. package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
  19. package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
  20. package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
  21. package/dist/src/components/Btn/OrigamBtn.vue +928 -249
  22. package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
  23. package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
  24. package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
  25. package/dist/src/components/Card/OrigamCard.vue +938 -194
  26. package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
  27. package/dist/src/components/Card/OrigamCardText.vue +536 -84
  28. package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
  29. package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
  30. package/dist/src/components/Chart/OrigamChart.vue +942 -452
  31. package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
  32. package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
  33. package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
  34. package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
  35. package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
  36. package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
  37. package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
  38. package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
  39. package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
  40. package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
  41. package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
  42. package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
  43. package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
  44. package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
  45. package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
  46. package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
  47. package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
  48. package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
  49. package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
  50. package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
  51. package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
  52. package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
  53. package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
  54. package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
  55. package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
  56. package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
  57. package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
  58. package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
  59. package/dist/src/components/Chip/OrigamChip.vue +867 -202
  60. package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
  61. package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
  62. package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
  63. package/dist/src/components/Code/OrigamCode.vue +844 -206
  64. package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
  65. package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
  66. package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
  67. package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
  68. package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
  69. package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
  70. package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
  71. package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
  72. package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
  73. package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
  74. package/dist/src/components/Counter/OrigamCounter.vue +588 -96
  75. package/dist/src/components/DataList/OrigamDataList.vue +619 -113
  76. package/dist/src/components/DataList/OrigamDataText.vue +295 -65
  77. package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
  78. package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
  79. package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
  80. package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
  81. package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
  82. package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
  83. package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
  84. package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
  85. package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
  86. package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
  87. package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
  88. package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
  89. package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
  90. package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
  91. package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
  92. package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
  93. package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
  94. package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
  95. package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
  96. package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
  97. package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
  98. package/dist/src/components/Divider/OrigamDivider.vue +210 -50
  99. package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
  100. package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
  101. package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
  102. package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
  103. package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
  104. package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
  105. package/dist/src/components/Field/OrigamField.vue +1118 -306
  106. package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
  107. package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
  108. package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
  109. package/dist/src/components/Form/OrigamForm.vue +197 -74
  110. package/dist/src/components/Grid/OrigamGrid.vue +707 -147
  111. package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
  112. package/dist/src/components/Grids/OrigamCol.vue +593 -110
  113. package/dist/src/components/Grids/OrigamContainer.vue +461 -80
  114. package/dist/src/components/Grids/OrigamRow.vue +573 -112
  115. package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
  116. package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
  117. package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
  118. package/dist/src/components/Icon/OrigamIcon.vue +561 -98
  119. package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
  120. package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
  121. package/dist/src/components/Img/OrigamImg.vue +869 -228
  122. package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
  123. package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
  124. package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
  125. package/dist/src/components/Input/OrigamInput.vue +747 -180
  126. package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
  127. package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
  128. package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
  129. package/dist/src/components/Label/OrigamLabel.vue +584 -95
  130. package/dist/src/components/Layout/OrigamLayout.vue +563 -94
  131. package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
  132. package/dist/src/components/List/OrigamList.vue +755 -170
  133. package/dist/src/components/List/OrigamListChildren.vue +59 -19
  134. package/dist/src/components/List/OrigamListGroup.vue +631 -134
  135. package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
  136. package/dist/src/components/List/OrigamListItem.vue +890 -224
  137. package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
  138. package/dist/src/components/List/OrigamListSubheader.vue +542 -93
  139. package/dist/src/components/Loader/OrigamLoader.vue +110 -25
  140. package/dist/src/components/Main/OrigamMain.vue +565 -96
  141. package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
  142. package/dist/src/components/Media/OrigamMediaController.vue +465 -182
  143. package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
  144. package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
  145. package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
  146. package/dist/src/components/Messages/OrigamMessages.vue +606 -97
  147. package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
  148. package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
  149. package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
  150. package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
  151. package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
  152. package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
  153. package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
  154. package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
  155. package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
  156. package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
  157. package/dist/src/components/Picker/OrigamPicker.vue +655 -108
  158. package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
  159. package/dist/src/components/Progress/OrigamProgress.vue +436 -70
  160. package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
  161. package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
  162. package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
  163. package/dist/src/components/Radio/OrigamRadio.vue +772 -132
  164. package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
  165. package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
  166. package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
  167. package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
  168. package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
  169. package/dist/src/components/Select/OrigamSelect.vue +1639 -567
  170. package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
  171. package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
  172. package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
  173. package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
  174. package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
  175. package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
  176. package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
  177. package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
  178. package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
  179. package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
  180. package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
  181. package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
  182. package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
  183. package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
  184. package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
  185. package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
  186. package/dist/src/components/Table/OrigamTable.vue +585 -124
  187. package/dist/src/components/Tabs/OrigamTab.vue +239 -73
  188. package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
  189. package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
  190. package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
  191. package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
  192. package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
  193. package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
  194. package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
  195. package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
  196. package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
  197. package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
  198. package/dist/src/components/Title/OrigamTitle.vue +505 -82
  199. package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
  200. package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
  201. package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
  202. package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
  203. package/dist/src/components/Transition/OrigamFade.vue +47 -9
  204. package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
  205. package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
  206. package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
  207. package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
  208. package/dist/src/components/Transition/OrigamSnack.vue +52 -10
  209. package/dist/src/components/Transition/OrigamTransition.vue +40 -12
  210. package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
  211. package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
  212. package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
  213. package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
  214. package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
  215. package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
  216. package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
  217. package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
  218. package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
  219. package/dist/src/components/Video/OrigamVideo.vue +1178 -331
  220. package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
  221. package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
  222. package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
  223. package/dist/src/components/Window/OrigamWindow.vue +745 -175
  224. package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
  225. package/dist/src/composables/Commons/display.composable.cjs +2 -0
  226. package/dist/src/composables/Commons/display.composable.js +1 -1
  227. package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
  228. package/package.json +8 -8
@@ -165,10 +165,7 @@
165
165
 
166
166
  <script lang="ts" setup>
167
167
  import { CHART_ASPECT_RATIO, CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
168
- import {
169
- computed,
170
- ref
171
- } from "vue";
168
+ import { computed, ref } from "vue";
172
169
  import OrigamChartLegend from "./OrigamChartLegend.vue";
173
170
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
174
171
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
@@ -183,70 +180,416 @@ import { useMargin } from "../../composables/Commons/margin.composable";
183
180
  import { usePadding } from "../../composables/Commons/padding.composable";
184
181
  import { useRounded } from "../../composables/Commons/rounded.composable";
185
182
  import { intentBgExpr, isIntent } from "../../utils/Commons/color.util";
186
- defineOptions({
187
- name: "OrigamChartSunburst"
188
- });
183
+ /*********************************************************
184
+ * Global
185
+ *
186
+ * @description
187
+ * Sunburst chart family. Renders a hierarchical multi-level
188
+ * donut where each ring represents one depth level of the tree.
189
+ *
190
+ * - Root nodes form the innermost ring, proportional to value.
191
+ * - Child nodes subdivide their parent's angular span.
192
+ * - `innerRadius` controls the centre hole size (0 = full pie).
193
+ * - Children inherit parent colour via `color-mix` lightening.
194
+ *
195
+ * `withDefaults` literals only, per CLAUDE.md.
196
+ ********************************************************/
197
+ defineOptions({ name: "OrigamChartSunburst" });
189
198
  const props = defineProps({
190
- innerRadius: { type: Number, required: false, default: 0.15 },
191
- ringPadding: { type: Number, required: false, default: 1 },
192
- showLabel: { type: Boolean, required: false, default: true },
193
- yAxisFormat: { type: Function, required: false, default: void 0 },
194
- series: { type: Array, required: true },
195
- title: { type: String, required: false, default: void 0 },
196
- subtitle: { type: String, required: false, default: void 0 },
197
- showLegend: { type: Boolean, required: false, default: true },
198
- legendPosition: { type: null, required: false, default: "bottom" },
199
- showTooltip: { type: Boolean, required: false, default: true },
200
- animated: { type: Boolean, required: false, default: true },
201
- animationDuration: { type: Number, required: false, default: 600 },
202
- colorScheme: { type: Array, required: false, default: () => [] },
203
- aspectRatio: { type: String, required: false, default: void 0 },
204
- id: { type: String, required: false },
205
- class: { type: [String, Array, Object], required: false },
206
- style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
207
- height: { type: [Number, String], required: false },
208
- maxHeight: { type: [Number, String], required: false },
209
- maxWidth: { type: [Number, String], required: false },
210
- minHeight: { type: [Number, String], required: false },
211
- minWidth: { type: [Number, String], required: false },
212
- width: { type: [Number, String], required: false },
213
- margin: { type: [Boolean, Number, String], required: false },
214
- marginTop: { type: [Boolean, Number, String], required: false },
215
- marginLeft: { type: [Boolean, Number, String], required: false },
216
- marginBottom: { type: [Boolean, Number, String], required: false },
217
- marginRight: { type: [Boolean, Number, String], required: false },
218
- marginBlock: { type: [Boolean, Number, String], required: false },
219
- marginInline: { type: [Boolean, Number, String], required: false },
220
- marginInlineStart: { type: [Boolean, Number, String], required: false },
221
- marginInlineEnd: { type: [Boolean, Number, String], required: false },
222
- marginBlockStart: { type: [Boolean, Number, String], required: false },
223
- marginBlockEnd: { type: [Boolean, Number, String], required: false },
224
- padding: { type: [Boolean, Number, String], required: false },
225
- paddingTop: { type: [Boolean, Number, String], required: false },
226
- paddingLeft: { type: [Boolean, Number, String], required: false },
227
- paddingBottom: { type: [Boolean, Number, String], required: false },
228
- paddingRight: { type: [Boolean, Number, String], required: false },
229
- paddingBlock: { type: [Boolean, Number, String], required: false },
230
- paddingInline: { type: [Boolean, Number, String], required: false },
231
- paddingInlineStart: { type: [Boolean, Number, String], required: false },
232
- paddingInlineEnd: { type: [Boolean, Number, String], required: false },
233
- paddingBlockStart: { type: [Boolean, Number, String], required: false },
234
- paddingBlockEnd: { type: [Boolean, Number, String], required: false },
235
- rounded: { type: [Boolean, Number, String, null], required: false, skipCheck: true },
236
- roundedTopRight: { type: [Boolean, Number, String], required: false },
237
- roundedTopLeft: { type: [Boolean, Number, String], required: false },
238
- roundedBottomLeft: { type: [Boolean, Number, String], required: false },
239
- roundedBottomRight: { type: [Boolean, Number, String], required: false },
240
- roundedStartStart: { type: [Boolean, Number, String], required: false },
241
- roundedStartEnd: { type: [Boolean, Number, String], required: false },
242
- roundedEndStart: { type: [Boolean, Number, String], required: false },
243
- roundedEndEnd: { type: [Boolean, Number, String], required: false },
244
- elevation: { type: [Number, String], required: false },
245
- bgColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
246
- fontSize: { type: null, required: false },
247
- fontWeight: { type: null, required: false }
199
+ innerRadius: {
200
+ type: Number,
201
+ required: false,
202
+ default: .15
203
+ },
204
+ ringPadding: {
205
+ type: Number,
206
+ required: false,
207
+ default: 1
208
+ },
209
+ showLabel: {
210
+ type: Boolean,
211
+ required: false,
212
+ default: true
213
+ },
214
+ yAxisFormat: {
215
+ type: Function,
216
+ required: false,
217
+ default: undefined
218
+ },
219
+ series: {
220
+ type: Array,
221
+ required: true
222
+ },
223
+ title: {
224
+ type: String,
225
+ required: false,
226
+ default: undefined
227
+ },
228
+ subtitle: {
229
+ type: String,
230
+ required: false,
231
+ default: undefined
232
+ },
233
+ showLegend: {
234
+ type: Boolean,
235
+ required: false,
236
+ default: true
237
+ },
238
+ legendPosition: {
239
+ type: null,
240
+ required: false,
241
+ default: "bottom"
242
+ },
243
+ showTooltip: {
244
+ type: Boolean,
245
+ required: false,
246
+ default: true
247
+ },
248
+ animated: {
249
+ type: Boolean,
250
+ required: false,
251
+ default: true
252
+ },
253
+ animationDuration: {
254
+ type: Number,
255
+ required: false,
256
+ default: 600
257
+ },
258
+ colorScheme: {
259
+ type: Array,
260
+ required: false,
261
+ default: () => []
262
+ },
263
+ aspectRatio: {
264
+ type: String,
265
+ required: false,
266
+ default: undefined
267
+ },
268
+ id: {
269
+ type: String,
270
+ required: false
271
+ },
272
+ class: {
273
+ type: [
274
+ String,
275
+ Array,
276
+ Object
277
+ ],
278
+ required: false
279
+ },
280
+ style: {
281
+ type: [
282
+ String,
283
+ Array,
284
+ Object,
285
+ Boolean,
286
+ null
287
+ ],
288
+ required: false,
289
+ skipCheck: true
290
+ },
291
+ height: {
292
+ type: [Number, String],
293
+ required: false
294
+ },
295
+ maxHeight: {
296
+ type: [Number, String],
297
+ required: false
298
+ },
299
+ maxWidth: {
300
+ type: [Number, String],
301
+ required: false
302
+ },
303
+ minHeight: {
304
+ type: [Number, String],
305
+ required: false
306
+ },
307
+ minWidth: {
308
+ type: [Number, String],
309
+ required: false
310
+ },
311
+ width: {
312
+ type: [Number, String],
313
+ required: false
314
+ },
315
+ margin: {
316
+ type: [
317
+ Boolean,
318
+ Number,
319
+ String
320
+ ],
321
+ required: false
322
+ },
323
+ marginTop: {
324
+ type: [
325
+ Boolean,
326
+ Number,
327
+ String
328
+ ],
329
+ required: false
330
+ },
331
+ marginLeft: {
332
+ type: [
333
+ Boolean,
334
+ Number,
335
+ String
336
+ ],
337
+ required: false
338
+ },
339
+ marginBottom: {
340
+ type: [
341
+ Boolean,
342
+ Number,
343
+ String
344
+ ],
345
+ required: false
346
+ },
347
+ marginRight: {
348
+ type: [
349
+ Boolean,
350
+ Number,
351
+ String
352
+ ],
353
+ required: false
354
+ },
355
+ marginBlock: {
356
+ type: [
357
+ Boolean,
358
+ Number,
359
+ String
360
+ ],
361
+ required: false
362
+ },
363
+ marginInline: {
364
+ type: [
365
+ Boolean,
366
+ Number,
367
+ String
368
+ ],
369
+ required: false
370
+ },
371
+ marginInlineStart: {
372
+ type: [
373
+ Boolean,
374
+ Number,
375
+ String
376
+ ],
377
+ required: false
378
+ },
379
+ marginInlineEnd: {
380
+ type: [
381
+ Boolean,
382
+ Number,
383
+ String
384
+ ],
385
+ required: false
386
+ },
387
+ marginBlockStart: {
388
+ type: [
389
+ Boolean,
390
+ Number,
391
+ String
392
+ ],
393
+ required: false
394
+ },
395
+ marginBlockEnd: {
396
+ type: [
397
+ Boolean,
398
+ Number,
399
+ String
400
+ ],
401
+ required: false
402
+ },
403
+ padding: {
404
+ type: [
405
+ Boolean,
406
+ Number,
407
+ String
408
+ ],
409
+ required: false
410
+ },
411
+ paddingTop: {
412
+ type: [
413
+ Boolean,
414
+ Number,
415
+ String
416
+ ],
417
+ required: false
418
+ },
419
+ paddingLeft: {
420
+ type: [
421
+ Boolean,
422
+ Number,
423
+ String
424
+ ],
425
+ required: false
426
+ },
427
+ paddingBottom: {
428
+ type: [
429
+ Boolean,
430
+ Number,
431
+ String
432
+ ],
433
+ required: false
434
+ },
435
+ paddingRight: {
436
+ type: [
437
+ Boolean,
438
+ Number,
439
+ String
440
+ ],
441
+ required: false
442
+ },
443
+ paddingBlock: {
444
+ type: [
445
+ Boolean,
446
+ Number,
447
+ String
448
+ ],
449
+ required: false
450
+ },
451
+ paddingInline: {
452
+ type: [
453
+ Boolean,
454
+ Number,
455
+ String
456
+ ],
457
+ required: false
458
+ },
459
+ paddingInlineStart: {
460
+ type: [
461
+ Boolean,
462
+ Number,
463
+ String
464
+ ],
465
+ required: false
466
+ },
467
+ paddingInlineEnd: {
468
+ type: [
469
+ Boolean,
470
+ Number,
471
+ String
472
+ ],
473
+ required: false
474
+ },
475
+ paddingBlockStart: {
476
+ type: [
477
+ Boolean,
478
+ Number,
479
+ String
480
+ ],
481
+ required: false
482
+ },
483
+ paddingBlockEnd: {
484
+ type: [
485
+ Boolean,
486
+ Number,
487
+ String
488
+ ],
489
+ required: false
490
+ },
491
+ rounded: {
492
+ type: [
493
+ Boolean,
494
+ Number,
495
+ String,
496
+ null
497
+ ],
498
+ required: false,
499
+ skipCheck: true
500
+ },
501
+ roundedTopRight: {
502
+ type: [
503
+ Boolean,
504
+ Number,
505
+ String
506
+ ],
507
+ required: false
508
+ },
509
+ roundedTopLeft: {
510
+ type: [
511
+ Boolean,
512
+ Number,
513
+ String
514
+ ],
515
+ required: false
516
+ },
517
+ roundedBottomLeft: {
518
+ type: [
519
+ Boolean,
520
+ Number,
521
+ String
522
+ ],
523
+ required: false
524
+ },
525
+ roundedBottomRight: {
526
+ type: [
527
+ Boolean,
528
+ Number,
529
+ String
530
+ ],
531
+ required: false
532
+ },
533
+ roundedStartStart: {
534
+ type: [
535
+ Boolean,
536
+ Number,
537
+ String
538
+ ],
539
+ required: false
540
+ },
541
+ roundedStartEnd: {
542
+ type: [
543
+ Boolean,
544
+ Number,
545
+ String
546
+ ],
547
+ required: false
548
+ },
549
+ roundedEndStart: {
550
+ type: [
551
+ Boolean,
552
+ Number,
553
+ String
554
+ ],
555
+ required: false
556
+ },
557
+ roundedEndEnd: {
558
+ type: [
559
+ Boolean,
560
+ Number,
561
+ String
562
+ ],
563
+ required: false
564
+ },
565
+ elevation: {
566
+ type: [Number, String],
567
+ required: false
568
+ },
569
+ bgColor: {
570
+ type: [
571
+ String,
572
+ Object,
573
+ Boolean,
574
+ null
575
+ ],
576
+ required: false,
577
+ skipCheck: true
578
+ },
579
+ fontSize: {
580
+ type: null,
581
+ required: false
582
+ },
583
+ fontWeight: {
584
+ type: null,
585
+ required: false
586
+ }
248
587
  });
249
- const emit = defineEmits(["point-click", "legend-click", "series-toggle"]);
588
+ const emit = defineEmits([
589
+ "point-click",
590
+ "legend-click",
591
+ "series-toggle"
592
+ ]);
250
593
  defineSlots();
251
594
  const { t } = useLocale();
252
595
  const { dimensionStyles } = useDimension(props);
@@ -257,390 +600,458 @@ const { paddingClasses, paddingStyles } = usePadding(props);
257
600
  const { roundedClasses, roundedStyles } = useRounded(props);
258
601
  const { headerTypographyStyles } = useChartHeaderTypography(props);
259
602
  const chartAnimationStyle = useChartAnimationStyle(props);
603
+ /*********************************************************
604
+ * Static SVG box — square coordinate space; CSS scales it.
605
+ ********************************************************/
260
606
  const { resizeRef: svgRef, width: svgWidth } = useChartSize(CHART_SIZE_FALLBACK.sunburst, { aspectRatio: CHART_ASPECT_RATIO.radial });
261
607
  const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
262
608
  const center = computed(() => svgWidth.value / 2);
263
609
  const MAX_DEPTH_CAP = 4;
264
- const LABEL_ANGLE_INLINE = 0.1;
265
- const LABEL_ANGLE_ROTATED = 0.05;
266
- const CHAR_WIDTH_FACTOR = 0.6;
610
+ /**
611
+ * Angular-span thresholds for label rendering strategy:
612
+ * - ≥ LABEL_ANGLE_INLINE (~5.7°): render label horizontally inside the arc.
613
+ * - ≥ LABEL_ANGLE_ROTATED (~2.9°): render label rotated along the arc midpoint.
614
+ * - < LABEL_ANGLE_ROTATED : render label outside via leader line.
615
+ */
616
+ const LABEL_ANGLE_INLINE = .1;
617
+ const LABEL_ANGLE_ROTATED = .05;
618
+ /** Estimated character width factor (fraction of font-size) for truncation. */
619
+ const CHAR_WIDTH_FACTOR = .6;
620
+ /** Font size in SVG units (matches CSS 0.625rem at 16px base). */
267
621
  const LABEL_FONT_SIZE = 10;
622
+ /** Extra radial clearance beyond outerR for leader elbow. */
268
623
  const LEADER_ELBOW_OFFSET = 18;
624
+ /** Horizontal extension past the elbow for the label anchor. */
269
625
  const LEADER_HORIZ_OFFSET = 28;
626
+ /*********************************************************
627
+ * Default colour palette — mirrors the DS intent cycle
628
+ ********************************************************/
270
629
  const DEFAULT_PALETTE = [
271
- "primary",
272
- "success",
273
- "warning",
274
- "danger",
275
- "info",
276
- "secondary",
277
- "ghost",
278
- "neutral"
630
+ "primary",
631
+ "success",
632
+ "warning",
633
+ "danger",
634
+ "info",
635
+ "secondary",
636
+ "ghost",
637
+ "neutral"
279
638
  ];
280
639
  const resolveColor = (raw) => {
281
- if (!raw) return "currentColor";
282
- if (/^(#|rgb|hsl|var|currentColor|transparent|linear-gradient|radial-gradient|conic-gradient)/i.test(raw)) {
283
- return raw;
284
- }
285
- if (isIntent(raw)) {
286
- return intentBgExpr(raw, "default");
287
- }
288
- return "currentColor";
640
+ if (!raw) return "currentColor";
641
+ if (/^(#|rgb|hsl|var|currentColor|transparent|linear-gradient|radial-gradient|conic-gradient)/i.test(raw)) {
642
+ return raw;
643
+ }
644
+ if (isIntent(raw)) {
645
+ return intentBgExpr(raw, "default");
646
+ }
647
+ return "currentColor";
289
648
  };
290
649
  const rootColorFor = (rootIndex) => {
291
- const scheme = props.colorScheme?.length ? props.colorScheme : DEFAULT_PALETTE;
292
- return resolveColor(scheme[rootIndex % scheme.length]);
650
+ const scheme = props.colorScheme?.length ? props.colorScheme : DEFAULT_PALETTE;
651
+ return resolveColor(scheme[rootIndex % scheme.length]);
293
652
  };
653
+ /*********************************************************
654
+ * Child colour — lighten toward white per depth level.
655
+ * Uses color-mix when CSS custom properties are involved;
656
+ * falls back to a simple inlined color-mix expression.
657
+ ********************************************************/
294
658
  const childColor = (parentColor, depth) => {
295
- const cappedDepth = Math.min(depth, MAX_DEPTH_CAP);
296
- const pct = cappedDepth * 15;
297
- return `color-mix(in srgb, ${parentColor} calc(100% - ${pct}%), white)`;
659
+ const cappedDepth = Math.min(depth, MAX_DEPTH_CAP);
660
+ const pct = cappedDepth * 15;
661
+ return `color-mix(in srgb, ${parentColor} calc(100% - ${pct}%), white)`;
298
662
  };
663
+ /*********************************************************
664
+ * Tree value resolution — fill in missing internal values
665
+ ********************************************************/
299
666
  const resolveValue = (datum) => {
300
- if (!datum.children?.length) {
301
- return datum.value ?? 0;
302
- }
303
- const childSum = datum.children.reduce((acc, c) => acc + resolveValue(c), 0);
304
- return datum.value ?? childSum;
667
+ if (!datum.children?.length) {
668
+ return datum.value ?? 0;
669
+ }
670
+ const childSum = datum.children.reduce((acc, c) => acc + resolveValue(c), 0);
671
+ return datum.value ?? childSum;
305
672
  };
673
+ /*********************************************************
674
+ * Arc path generator (standard SVG arc notation)
675
+ ********************************************************/
306
676
  const arcPath = (innerR, outerR, startAngle, endAngle) => {
307
- const sweep = endAngle - startAngle;
308
- if (sweep <= 0) return "";
309
- const fullCircle = sweep >= 2 * Math.PI - 1e-6;
310
- const cos0 = Math.cos(startAngle);
311
- const sin0 = Math.sin(startAngle);
312
- const cos1 = Math.cos(endAngle);
313
- const sin1 = Math.sin(endAngle);
314
- const largeArc = sweep > Math.PI ? 1 : 0;
315
- if (fullCircle) {
316
- const midAngle = startAngle + Math.PI;
317
- const cosM = Math.cos(midAngle);
318
- const sinM = Math.sin(midAngle);
319
- const ox02 = outerR * cosM;
320
- const oy02 = outerR * sinM;
321
- const ox12 = outerR * cos0;
322
- const oy12 = outerR * sin0;
323
- const ix02 = innerR * cosM;
324
- const iy02 = innerR * sinM;
325
- const ix12 = innerR * cos0;
326
- const iy12 = innerR * sin0;
327
- if (innerR < 1e-3) {
328
- return [
329
- `M ${ox02},${oy02}`,
330
- `A ${outerR},${outerR} 0 1,1 ${ox12},${oy12}`,
331
- `A ${outerR},${outerR} 0 1,1 ${ox02},${oy02}`,
332
- "Z"
333
- ].join(" ");
334
- }
335
- return [
336
- `M ${ox02},${oy02}`,
337
- `A ${outerR},${outerR} 0 1,1 ${ox12},${oy12}`,
338
- `A ${outerR},${outerR} 0 1,1 ${ox02},${oy02}`,
339
- `L ${ix02},${iy02}`,
340
- `A ${innerR},${innerR} 0 1,0 ${ix12},${iy12}`,
341
- `A ${innerR},${innerR} 0 1,0 ${ix02},${iy02}`,
342
- "Z"
343
- ].join(" ");
344
- }
345
- const ox0 = outerR * cos0;
346
- const oy0 = outerR * sin0;
347
- const ox1 = outerR * cos1;
348
- const oy1 = outerR * sin1;
349
- const ix0 = innerR * cos0;
350
- const iy0 = innerR * sin0;
351
- const ix1 = innerR * cos1;
352
- const iy1 = innerR * sin1;
353
- if (innerR < 1e-3) {
354
- return [
355
- `M 0,0`,
356
- `L ${ox0},${oy0}`,
357
- `A ${outerR},${outerR} 0 ${largeArc},1 ${ox1},${oy1}`,
358
- "Z"
359
- ].join(" ");
360
- }
361
- return [
362
- `M ${ox0},${oy0}`,
363
- `A ${outerR},${outerR} 0 ${largeArc},1 ${ox1},${oy1}`,
364
- `L ${ix1},${iy1}`,
365
- `A ${innerR},${innerR} 0 ${largeArc},0 ${ix0},${iy0}`,
366
- "Z"
367
- ].join(" ");
677
+ const sweep = endAngle - startAngle;
678
+ if (sweep <= 0) return "";
679
+ const fullCircle = sweep >= 2 * Math.PI - 1e-6;
680
+ const cos0 = Math.cos(startAngle);
681
+ const sin0 = Math.sin(startAngle);
682
+ const cos1 = Math.cos(endAngle);
683
+ const sin1 = Math.sin(endAngle);
684
+ const largeArc = sweep > Math.PI ? 1 : 0;
685
+ if (fullCircle) {
686
+ const midAngle = startAngle + Math.PI;
687
+ const cosM = Math.cos(midAngle);
688
+ const sinM = Math.sin(midAngle);
689
+ const ox0 = outerR * cosM;
690
+ const oy0 = outerR * sinM;
691
+ const ox1 = outerR * cos0;
692
+ const oy1 = outerR * sin0;
693
+ const ix0 = innerR * cosM;
694
+ const iy0 = innerR * sinM;
695
+ const ix1 = innerR * cos0;
696
+ const iy1 = innerR * sin0;
697
+ if (innerR < .001) {
698
+ return [
699
+ `M ${ox0},${oy0}`,
700
+ `A ${outerR},${outerR} 0 1,1 ${ox1},${oy1}`,
701
+ `A ${outerR},${outerR} 0 1,1 ${ox0},${oy0}`,
702
+ "Z"
703
+ ].join(" ");
704
+ }
705
+ return [
706
+ `M ${ox0},${oy0}`,
707
+ `A ${outerR},${outerR} 0 1,1 ${ox1},${oy1}`,
708
+ `A ${outerR},${outerR} 0 1,1 ${ox0},${oy0}`,
709
+ `L ${ix0},${iy0}`,
710
+ `A ${innerR},${innerR} 0 1,0 ${ix1},${iy1}`,
711
+ `A ${innerR},${innerR} 0 1,0 ${ix0},${iy0}`,
712
+ "Z"
713
+ ].join(" ");
714
+ }
715
+ const ox0 = outerR * cos0;
716
+ const oy0 = outerR * sin0;
717
+ const ox1 = outerR * cos1;
718
+ const oy1 = outerR * sin1;
719
+ const ix0 = innerR * cos0;
720
+ const iy0 = innerR * sin0;
721
+ const ix1 = innerR * cos1;
722
+ const iy1 = innerR * sin1;
723
+ if (innerR < .001) {
724
+ return [
725
+ `M 0,0`,
726
+ `L ${ox0},${oy0}`,
727
+ `A ${outerR},${outerR} 0 ${largeArc},1 ${ox1},${oy1}`,
728
+ "Z"
729
+ ].join(" ");
730
+ }
731
+ /*
732
+ * Donut wedge: start at outer-START, sweep clockwise to
733
+ * outer-END (sweep=1), radial line in to inner-END, then
734
+ * sweep counter-clockwise back to inner-START (sweep=0).
735
+ *
736
+ * Prior agent inverted both directions (started at inner
737
+ * end, swept the WRONG way around the circle) which made
738
+ * each wedge draw across the entire ring — visible as
739
+ * petals / bulges in the rendered chart.
740
+ */
741
+ return [
742
+ `M ${ox0},${oy0}`,
743
+ `A ${outerR},${outerR} 0 ${largeArc},1 ${ox1},${oy1}`,
744
+ `L ${ix1},${iy1}`,
745
+ `A ${innerR},${innerR} 0 ${largeArc},0 ${ix0},${iy0}`,
746
+ "Z"
747
+ ].join(" ");
368
748
  };
749
+ /*********************************************************
750
+ * Max-depth calculation — must precede allNodes
751
+ ********************************************************/
369
752
  const computeMaxDepth = (data) => {
370
- const walkDepth = (nodes, current) => {
371
- let max = current;
372
- for (const node of nodes) {
373
- if (node.children?.length) {
374
- max = Math.max(max, walkDepth(node.children, current + 1));
375
- }
376
- }
377
- return max;
378
- };
379
- return walkDepth(data, 1);
753
+ const walkDepth = (nodes, current) => {
754
+ let max = current;
755
+ for (const node of nodes) {
756
+ if (node.children?.length) {
757
+ max = Math.max(max, walkDepth(node.children, current + 1));
758
+ }
759
+ }
760
+ return max;
761
+ };
762
+ return walkDepth(data, 1);
380
763
  };
381
- const hiddenRoots = ref(/* @__PURE__ */ new Set());
764
+ /*********************************************************
765
+ * Legend — hidden-root set keyed by root node name
766
+ ********************************************************/
767
+ const hiddenRoots = ref(new Set());
768
+ /*********************************************************
769
+ * Geometry engine — flatten tree into node descriptors
770
+ ********************************************************/
382
771
  const allNodes = computed(() => {
383
- const series = props.series?.[0];
384
- if (!series || !series.data?.length) return [];
385
- const rawData = series.data;
386
- if (!rawData.length) return [];
387
- const maxDepth = Math.min(computeMaxDepth(rawData), MAX_DEPTH_CAP);
388
- if (maxDepth === 0) return [];
389
- const totalR = center.value - 4;
390
- const holeR = totalR * props.innerRadius;
391
- const ringWidth = (totalR - holeR) / maxDepth;
392
- const totalValue = rawData.reduce((acc, d) => acc + resolveValue(d), 0);
393
- if (totalValue <= 0) return [];
394
- const TWO_PI = 2 * Math.PI;
395
- const result = [];
396
- const walkTree = (datum, depth, parentStartAngle, parentEndAngle, rootIdx, parentColor, ancestorPath) => {
397
- if (depth > MAX_DEPTH_CAP) return;
398
- const val = resolveValue(datum);
399
- if (val <= 0) return;
400
- const nodePath = ancestorPath ? `${ancestorPath} > ${datum.name}` : datum.name;
401
- const isHidden = hiddenRoots.value.has(depth === 0 ? datum.name : nodePath.split(" > ")[0]);
402
- const innerR = holeR + depth * (ringWidth + props.ringPadding);
403
- const outerR = innerR + ringWidth;
404
- const nodeColor = datum.color ? resolveColor(datum.color) : depth === 0 ? parentColor : childColor(parentColor, depth);
405
- const d = arcPath(innerR, outerR, parentStartAngle, parentEndAngle);
406
- const arcSpan = parentEndAngle - parentStartAngle;
407
- const labelMode = arcSpan >= LABEL_ANGLE_INLINE ? "inline" : arcSpan >= LABEL_ANGLE_ROTATED ? "rotated" : "leader";
408
- result.push({
409
- id: nodePath,
410
- name: datum.name,
411
- value: val,
412
- depth,
413
- rootIndex: rootIdx,
414
- startAngle: parentStartAngle,
415
- endAngle: parentEndAngle,
416
- innerR,
417
- outerR,
418
- d,
419
- color: nodeColor,
420
- visible: !isHidden,
421
- path: nodePath,
422
- labelMode
423
- });
424
- if (datum.children?.length && depth + 1 <= MAX_DEPTH_CAP) {
425
- const parentSpan = parentEndAngle - parentStartAngle;
426
- let childAngle = parentStartAngle;
427
- for (const child of datum.children) {
428
- const childVal = resolveValue(child);
429
- if (childVal <= 0) continue;
430
- const childSpan = childVal / val * parentSpan;
431
- const childEnd = childAngle + childSpan;
432
- walkTree(child, depth + 1, childAngle, childEnd, rootIdx, nodeColor, nodePath);
433
- childAngle = childEnd;
434
- }
435
- }
436
- };
437
- let currentAngle = 0;
438
- rawData.forEach((datum, rootIdx) => {
439
- const rootVal = resolveValue(datum);
440
- if (rootVal <= 0) return;
441
- const rootColor = datum.color ? resolveColor(datum.color) : rootColorFor(rootIdx);
442
- const span = rootVal / totalValue * TWO_PI;
443
- walkTree(datum, 0, currentAngle, currentAngle + span, rootIdx, rootColor, "");
444
- currentAngle += span;
445
- });
446
- return result;
772
+ const series = props.series?.[0];
773
+ if (!series || !series.data?.length) return [];
774
+ const rawData = series.data;
775
+ if (!rawData.length) return [];
776
+ const maxDepth = Math.min(computeMaxDepth(rawData), MAX_DEPTH_CAP);
777
+ if (maxDepth === 0) return [];
778
+ const totalR = center.value - 4;
779
+ const holeR = totalR * props.innerRadius;
780
+ const ringWidth = (totalR - holeR) / maxDepth;
781
+ const totalValue = rawData.reduce((acc, d) => acc + resolveValue(d), 0);
782
+ if (totalValue <= 0) return [];
783
+ const TWO_PI = 2 * Math.PI;
784
+ const result = [];
785
+ const walkTree = (datum, depth, parentStartAngle, parentEndAngle, rootIdx, parentColor, ancestorPath) => {
786
+ if (depth > MAX_DEPTH_CAP) return;
787
+ const val = resolveValue(datum);
788
+ if (val <= 0) return;
789
+ const nodePath = ancestorPath ? `${ancestorPath} > ${datum.name}` : datum.name;
790
+ const isHidden = hiddenRoots.value.has(depth === 0 ? datum.name : nodePath.split(" > ")[0]);
791
+ const innerR = holeR + depth * (ringWidth + props.ringPadding);
792
+ const outerR = innerR + ringWidth;
793
+ const nodeColor = datum.color ? resolveColor(datum.color) : depth === 0 ? parentColor : childColor(parentColor, depth);
794
+ const d = arcPath(innerR, outerR, parentStartAngle, parentEndAngle);
795
+ const arcSpan = parentEndAngle - parentStartAngle;
796
+ const labelMode = arcSpan >= LABEL_ANGLE_INLINE ? "inline" : arcSpan >= LABEL_ANGLE_ROTATED ? "rotated" : "leader";
797
+ result.push({
798
+ id: nodePath,
799
+ name: datum.name,
800
+ value: val,
801
+ depth,
802
+ rootIndex: rootIdx,
803
+ startAngle: parentStartAngle,
804
+ endAngle: parentEndAngle,
805
+ innerR,
806
+ outerR,
807
+ d,
808
+ color: nodeColor,
809
+ visible: !isHidden,
810
+ path: nodePath,
811
+ labelMode
812
+ });
813
+ if (datum.children?.length && depth + 1 <= MAX_DEPTH_CAP) {
814
+ const parentSpan = parentEndAngle - parentStartAngle;
815
+ let childAngle = parentStartAngle;
816
+ for (const child of datum.children) {
817
+ const childVal = resolveValue(child);
818
+ if (childVal <= 0) continue;
819
+ const childSpan = childVal / val * parentSpan;
820
+ const childEnd = childAngle + childSpan;
821
+ walkTree(child, depth + 1, childAngle, childEnd, rootIdx, nodeColor, nodePath);
822
+ childAngle = childEnd;
823
+ }
824
+ }
825
+ };
826
+ let currentAngle = 0;
827
+ rawData.forEach((datum, rootIdx) => {
828
+ const rootVal = resolveValue(datum);
829
+ if (rootVal <= 0) return;
830
+ const rootColor = datum.color ? resolveColor(datum.color) : rootColorFor(rootIdx);
831
+ const span = rootVal / totalValue * TWO_PI;
832
+ walkTree(datum, 0, currentAngle, currentAngle + span, rootIdx, rootColor, "");
833
+ currentAngle += span;
834
+ });
835
+ return result;
447
836
  });
448
- const visibleNodes = computed(
449
- () => allNodes.value.filter((n) => n.visible)
450
- );
837
+ const visibleNodes = computed(() => allNodes.value.filter((n) => n.visible));
451
838
  const inlineOrRotatedLabelNodes = computed(() => {
452
- if (!props.showLabel) return [];
453
- return visibleNodes.value.filter((n) => n.labelMode === "inline" || n.labelMode === "rotated");
839
+ if (!props.showLabel) return [];
840
+ return visibleNodes.value.filter((n) => n.labelMode === "inline" || n.labelMode === "rotated");
454
841
  });
455
842
  const leaderLabelNodes = computed(() => {
456
- if (!props.showLabel) return [];
457
- return visibleNodes.value.filter((n) => n.labelMode === "leader");
843
+ if (!props.showLabel) return [];
844
+ return visibleNodes.value.filter((n) => n.labelMode === "leader");
458
845
  });
846
+ /*********************************************************
847
+ * Text truncation helpers
848
+ ********************************************************/
459
849
  const chordBudget = (node) => {
460
- const midR = (node.innerR + node.outerR) / 2;
461
- const span = node.endAngle - node.startAngle;
462
- return midR * 2 * Math.sin(span / 2);
850
+ const midR = (node.innerR + node.outerR) / 2;
851
+ const span = node.endAngle - node.startAngle;
852
+ return midR * 2 * Math.sin(span / 2);
463
853
  };
464
854
  const truncatedLabel = (node) => {
465
- const budget = chordBudget(node);
466
- const maxChars = Math.floor(budget / (LABEL_FONT_SIZE * CHAR_WIDTH_FACTOR));
467
- if (maxChars <= 0) return "";
468
- if (node.name.length <= maxChars) return node.name;
469
- if (maxChars <= 1) return "\u2026";
470
- return node.name.slice(0, maxChars - 1) + "\u2026";
855
+ const budget = chordBudget(node);
856
+ const maxChars = Math.floor(budget / (LABEL_FONT_SIZE * CHAR_WIDTH_FACTOR));
857
+ if (maxChars <= 0) return "";
858
+ if (node.name.length <= maxChars) return node.name;
859
+ if (maxChars <= 1) return "…";
860
+ return node.name.slice(0, maxChars - 1) + "…";
471
861
  };
472
862
  const truncatedLabelLeader = (node) => {
473
- const maxChars = 14;
474
- if (node.name.length <= maxChars) return node.name;
475
- return node.name.slice(0, maxChars - 1) + "\u2026";
863
+ const maxChars = 14;
864
+ if (node.name.length <= maxChars) return node.name;
865
+ return node.name.slice(0, maxChars - 1) + "…";
476
866
  };
867
+ /*********************************************************
868
+ * Label geometry — inline / rotated (centred in arc)
869
+ *
870
+ * inline — rotate so text reads tangentially (same direction as arc)
871
+ * but flip 180° on the left half so it never reads upside-down.
872
+ * rotated — same tangential rotation; the only visual difference is the
873
+ * narrower budget tracked by truncatedLabel().
874
+ ********************************************************/
477
875
  const labelTransform = (node) => {
478
- const midAngle = (node.startAngle + node.endAngle) / 2;
479
- const midR = (node.innerR + node.outerR) / 2;
480
- const x = midR * Math.cos(midAngle);
481
- const y = midR * Math.sin(midAngle);
482
- const degrees = midAngle * 180 / Math.PI;
483
- const rotation = degrees > 90 && degrees < 270 ? degrees + 180 : degrees;
484
- return `translate(${x},${y}) rotate(${rotation})`;
876
+ const midAngle = (node.startAngle + node.endAngle) / 2;
877
+ const midR = (node.innerR + node.outerR) / 2;
878
+ const x = midR * Math.cos(midAngle);
879
+ const y = midR * Math.sin(midAngle);
880
+ const degrees = midAngle * 180 / Math.PI;
881
+ const rotation = degrees > 90 && degrees < 270 ? degrees + 180 : degrees;
882
+ return `translate(${x},${y}) rotate(${rotation})`;
485
883
  };
884
+ /*********************************************************
885
+ * Leader-line geometry — outside-chart labels
886
+ *
887
+ * Strategy: elbow at outerR + LEADER_ELBOW_OFFSET along the midpoint
888
+ * radial, then horizontal to LEADER_HORIZ_OFFSET. Label sits at the
889
+ * end of the horizontal leg.
890
+ ********************************************************/
486
891
  const leaderElbow = (node) => {
487
- const midAngle = (node.startAngle + node.endAngle) / 2;
488
- const elbowR = node.outerR + LEADER_ELBOW_OFFSET;
489
- return {
490
- x: elbowR * Math.cos(midAngle),
491
- y: elbowR * Math.sin(midAngle)
492
- };
892
+ const midAngle = (node.startAngle + node.endAngle) / 2;
893
+ const elbowR = node.outerR + LEADER_ELBOW_OFFSET;
894
+ return {
895
+ x: elbowR * Math.cos(midAngle),
896
+ y: elbowR * Math.sin(midAngle)
897
+ };
493
898
  };
494
899
  const leaderEnd = (node) => {
495
- const elbow = leaderElbow(node);
496
- const sign = elbow.x >= 0 ? 1 : -1;
497
- return {
498
- x: elbow.x + sign * LEADER_HORIZ_OFFSET,
499
- y: elbow.y
500
- };
900
+ const elbow = leaderElbow(node);
901
+ const sign = elbow.x >= 0 ? 1 : -1;
902
+ return {
903
+ x: elbow.x + sign * LEADER_HORIZ_OFFSET,
904
+ y: elbow.y
905
+ };
501
906
  };
502
907
  const leaderStartPoint = (node) => {
503
- const midAngle = (node.startAngle + node.endAngle) / 2;
504
- return {
505
- x: node.outerR * Math.cos(midAngle),
506
- y: node.outerR * Math.sin(midAngle)
507
- };
908
+ const midAngle = (node.startAngle + node.endAngle) / 2;
909
+ return {
910
+ x: node.outerR * Math.cos(midAngle),
911
+ y: node.outerR * Math.sin(midAngle)
912
+ };
508
913
  };
509
914
  const leaderLinePoints = (node) => {
510
- const start = leaderStartPoint(node);
511
- const elbow = leaderElbow(node);
512
- const end = leaderEnd(node);
513
- return `${start.x},${start.y} ${elbow.x},${elbow.y} ${end.x},${end.y}`;
915
+ const start = leaderStartPoint(node);
916
+ const elbow = leaderElbow(node);
917
+ const end = leaderEnd(node);
918
+ return `${start.x},${start.y} ${elbow.x},${elbow.y} ${end.x},${end.y}`;
514
919
  };
515
920
  const leaderTextAnchor = (node) => {
516
- const elbow = leaderElbow(node);
517
- return elbow.x >= 0 ? "start" : "end";
921
+ const elbow = leaderElbow(node);
922
+ return elbow.x >= 0 ? "start" : "end";
518
923
  };
519
924
  const leaderTextTransform = (node) => {
520
- const end = leaderEnd(node);
521
- const sign = end.x >= 0 ? 1 : -1;
522
- return `translate(${end.x + sign * 3},${end.y})`;
925
+ const end = leaderEnd(node);
926
+ const sign = end.x >= 0 ? 1 : -1;
927
+ return `translate(${end.x + sign * 3},${end.y})`;
523
928
  };
929
+ /*********************************************************
930
+ * Legend items — root-level nodes only
931
+ ********************************************************/
524
932
  const legendItems = computed(() => {
525
- const series = props.series?.[0];
526
- if (!series) return [];
527
- const roots = allNodes.value.filter((n) => n.depth === 0);
528
- return roots.map((node) => ({
529
- series: {
530
- ...series,
531
- name: node.name,
532
- data: [node.value],
533
- visible: node.visible
534
- },
535
- index: node.rootIndex,
536
- color: node.color,
537
- visible: node.visible
538
- }));
933
+ const series = props.series?.[0];
934
+ if (!series) return [];
935
+ const roots = allNodes.value.filter((n) => n.depth === 0);
936
+ return roots.map((node) => ({
937
+ series: {
938
+ ...series,
939
+ name: node.name,
940
+ data: [node.value],
941
+ visible: node.visible
942
+ },
943
+ index: node.rootIndex,
944
+ color: node.color,
945
+ visible: node.visible
946
+ }));
947
+ });
948
+ /*********************************************************
949
+ * Hover / tooltip
950
+ ********************************************************/
951
+ const mousePos = ref({
952
+ x: 0,
953
+ y: 0
539
954
  });
540
- const mousePos = ref({ x: 0, y: 0 });
541
955
  const hoveredId = ref(null);
542
956
  const hoveredNode = computed(() => {
543
- if (!hoveredId.value) return null;
544
- return visibleNodes.value.find((n) => n.id === hoveredId.value) ?? null;
957
+ if (!hoveredId.value) return null;
958
+ return visibleNodes.value.find((n) => n.id === hoveredId.value) ?? null;
545
959
  });
546
960
  const hoveredPoint = computed(() => {
547
- const n = hoveredNode.value;
548
- if (!n || !props.series?.[0]) return null;
549
- return {
550
- seriesIndex: 0,
551
- seriesName: props.series[0].name,
552
- dataIndex: n.rootIndex,
553
- x: n.name,
554
- y: n.value,
555
- color: n.color
556
- };
961
+ const n = hoveredNode.value;
962
+ if (!n || !props.series?.[0]) return null;
963
+ return {
964
+ seriesIndex: 0,
965
+ seriesName: props.series[0].name,
966
+ dataIndex: n.rootIndex,
967
+ x: n.name,
968
+ y: n.value,
969
+ color: n.color
970
+ };
557
971
  });
558
972
  const hoveredSeries = computed(() => {
559
- if (!hoveredNode.value || !props.series?.[0]) return null;
560
- return props.series[0];
973
+ if (!hoveredNode.value || !props.series?.[0]) return null;
974
+ return props.series[0];
561
975
  });
562
- const hoveredCategory = computed(
563
- () => hoveredNode.value?.name ?? ""
564
- );
976
+ const hoveredCategory = computed(() => hoveredNode.value?.name ?? "");
565
977
  const showEmpty = computed(() => {
566
- if (!props.series?.length) return true;
567
- const first = props.series[0];
568
- if (!first?.data?.length) return true;
569
- return visibleNodes.value.length === 0;
978
+ if (!props.series?.length) return true;
979
+ const first = props.series[0];
980
+ if (!first?.data?.length) return true;
981
+ return visibleNodes.value.length === 0;
570
982
  });
983
+ /*********************************************************
984
+ * Root classes / styles
985
+ ********************************************************/
571
986
  const rootClasses = computed(() => [
572
- {
573
- [`origam-chart-sunburst--legend-${props.legendPosition}`]: true,
574
- "origam-chart-sunburst--no-animation": !props.animated
575
- },
576
- backgroundColorClasses.value,
577
- elevationClasses.value,
578
- marginClasses.value,
579
- paddingClasses.value,
580
- roundedClasses.value,
581
- props.class
987
+ {
988
+ [`origam-chart-sunburst--legend-${props.legendPosition}`]: true,
989
+ "origam-chart-sunburst--no-animation": !props.animated
990
+ },
991
+ backgroundColorClasses.value,
992
+ elevationClasses.value,
993
+ marginClasses.value,
994
+ paddingClasses.value,
995
+ roundedClasses.value,
996
+ props.class
582
997
  ]);
583
998
  const rootStyles = computed(() => {
584
- const out = {};
585
- if (props.aspectRatio) {
586
- out.aspectRatio = props.aspectRatio;
587
- }
588
- Object.assign(out, chartAnimationStyle.value);
589
- return [out, props.style];
999
+ const out = {};
1000
+ if (props.aspectRatio) {
1001
+ out.aspectRatio = props.aspectRatio;
1002
+ }
1003
+ Object.assign(out, chartAnimationStyle.value);
1004
+ return [out, props.style];
590
1005
  });
591
- const bodyClasses = computed(() => ({
592
- "origam-chart-sunburst__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right")
593
- }));
594
- const svgClasses = computed(() => ({
595
- "origam-chart__svg--animated": props.animated
596
- }));
1006
+ const bodyClasses = computed(() => ({ "origam-chart-sunburst__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right") }));
1007
+ const svgClasses = computed(() => ({ "origam-chart__svg--animated": props.animated }));
597
1008
  const hasTitleBlock = computed(() => Boolean(props.title || props.subtitle));
1009
+ /*********************************************************
1010
+ * ARIA
1011
+ ********************************************************/
598
1012
  const defaultAriaLabel = computed(() => t("origam.chart.sunburst.aria_label"));
599
1013
  const ariaLabel = computed(() => props.title ?? defaultAriaLabel.value);
600
1014
  const svgAriaLabel = computed(() => props.title ?? defaultAriaLabel.value);
601
1015
  const svgTitle = computed(() => props.title ?? defaultAriaLabel.value);
602
- const svgDesc = computed(
603
- () => t(
604
- "origam.chart.sunburst.desc",
605
- visibleNodes.value.filter((nd) => nd.depth === 0).length,
606
- { chart: defaultAriaLabel.value }
607
- )
608
- );
1016
+ const svgDesc = computed(() => t("origam.chart.sunburst.desc", visibleNodes.value.filter((nd) => nd.depth === 0).length, { chart: defaultAriaLabel.value }));
609
1017
  const nodeAriaLabel = (node) => {
610
- const formatted = props.yAxisFormat ? props.yAxisFormat(node.value) : String(node.value);
611
- return `${node.path}: ${formatted}`;
1018
+ const formatted = props.yAxisFormat ? props.yAxisFormat(node.value) : String(node.value);
1019
+ return `${node.path}: ${formatted}`;
612
1020
  };
1021
+ /*********************************************************
1022
+ * Interaction
1023
+ ********************************************************/
613
1024
  const onNodeEnter = (node) => {
614
- hoveredId.value = node.id;
1025
+ hoveredId.value = node.id;
615
1026
  };
616
1027
  const onNodeLeave = () => {
617
- hoveredId.value = null;
1028
+ hoveredId.value = null;
618
1029
  };
619
1030
  const onSvgMouseMove = (event) => {
620
- const target = svgRef.value;
621
- if (!target) return;
622
- const rect = target.getBoundingClientRect();
623
- mousePos.value = {
624
- x: event.clientX - rect.left,
625
- y: event.clientY - rect.top
626
- };
1031
+ const target = svgRef.value;
1032
+ if (!target) return;
1033
+ const rect = target.getBoundingClientRect();
1034
+ mousePos.value = {
1035
+ x: event.clientX - rect.left,
1036
+ y: event.clientY - rect.top
1037
+ };
627
1038
  };
628
1039
  const onSvgMouseLeave = () => {
629
- onNodeLeave();
1040
+ onNodeLeave();
630
1041
  };
631
1042
  const onNodeActivate = (node, event) => {
632
- hoveredId.value = node.id;
633
- if (hoveredPoint.value) {
634
- emit("point-click", hoveredPoint.value, event);
635
- }
1043
+ hoveredId.value = node.id;
1044
+ if (hoveredPoint.value) {
1045
+ emit("point-click", hoveredPoint.value, event);
1046
+ }
636
1047
  };
637
1048
  const onLegendClick = (series, index) => {
638
- emit("legend-click", series, index);
1049
+ emit("legend-click", series, index);
639
1050
  };
640
1051
  const onSeriesToggle = (series, nextVisible) => {
641
- if (nextVisible) hiddenRoots.value.delete(series.name);
642
- else hiddenRoots.value.add(series.name);
643
- emit("series-toggle", series, nextVisible);
1052
+ if (nextVisible) hiddenRoots.value.delete(series.name);
1053
+ else hiddenRoots.value.add(series.name);
1054
+ emit("series-toggle", series, nextVisible);
644
1055
  };
645
1056
  </script>
646
1057