origam 2.38.1 → 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 +24 -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 +6 -6
@@ -490,12 +490,7 @@
490
490
  </template>
491
491
 
492
492
  <script lang="ts" setup>
493
- import {
494
- computed,
495
- nextTick,
496
- ref,
497
- watch
498
- } from "vue";
493
+ import { computed, nextTick, ref, watch } from "vue";
499
494
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
500
495
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
501
496
  import { useChartRoving } from "../../composables/Chart/chart-roving.composable";
@@ -509,175 +504,634 @@ import { useLocale } from "../../composables/Commons/locale.composable";
509
504
  import { useMargin } from "../../composables/Commons/margin.composable";
510
505
  import { usePadding } from "../../composables/Commons/padding.composable";
511
506
  import { useRounded } from "../../composables/Commons/rounded.composable";
512
- import {
513
- computeAnnotationGeometry,
514
- computePlotBandGeometry,
515
- computePlotLineGeometry
516
- } from "../../composables/Chart/chart.composable";
507
+ import { computeAnnotationGeometry, computePlotBandGeometry, computePlotLineGeometry } from "../../composables/Chart/chart.composable";
517
508
  import { CHART_RANGE_SELECTOR_DEFAULT_BUTTONS, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
518
- import {
519
- CHART_ZOOM_RESET_GAP,
520
- CHART_ZOOM_RESET_MIN_WIDTH,
521
- CHART_ZOOM_RESET_PADDING_X
522
- } from "../../consts/Chart/chart-cartesian.const";
509
+ import { CHART_ZOOM_RESET_GAP, CHART_ZOOM_RESET_MIN_WIDTH, CHART_ZOOM_RESET_PADDING_X } from "../../consts/Chart/chart-cartesian.const";
523
510
  import { OrigamBtn } from "../Btn";
524
511
  import OrigamChartAxis from "./OrigamChartAxis.vue";
525
512
  import OrigamChartLegend from "./OrigamChartLegend.vue";
526
513
  import OrigamChartRangeSelector from "./OrigamChartRangeSelector.vue";
527
514
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
528
- defineOptions({
529
- name: "OrigamChartCartesian"
530
- });
515
+ /*********************************************************
516
+ * Global
517
+ *
518
+ * @description
519
+ * Cartesian chart family — renders `line`, `area`, `bar`,
520
+ * `column`, `scatter`, `spline`, `stepped-line`. Owns
521
+ * the X+Y axes + grid + tick labels via `<OrigamChartAxis>`.
522
+ *
523
+ * Polar / radar / gauge live in their own family components so
524
+ * pie / donut don't inherit the cartesian chrome. The shell
525
+ * `<OrigamChart>` dispatches between families based on the
526
+ * `type` prop.
527
+ ********************************************************/
528
+ defineOptions({ name: "OrigamChartCartesian" });
529
+ /*********************************************************
530
+ * Props / Emits — defaults inlined per CLAUDE.md.
531
+ ********************************************************/
531
532
  const props = defineProps({
532
- type: { type: null, required: false, default: "line" },
533
- stacked: { type: Boolean, required: false, default: false },
534
- stacking: { type: null, required: false, default: "normal" },
535
- smoothing: { type: null, required: false, default: "none" },
536
- yMin: { type: Number, required: false, default: void 0 },
537
- yMax: { type: Number, required: false, default: void 0 },
538
- showGrid: { type: Boolean, required: false, default: true },
539
- showAxis: { type: Boolean, required: false, default: true },
540
- showTooltip: { type: Boolean, required: false, default: true },
541
- xAxisFormat: { type: Function, required: false, default: void 0 },
542
- yAxisFormat: { type: Function, required: false, default: void 0 },
543
- secondaryYAxis: { type: Object, required: false, default: void 0 },
544
- plotBands: { type: Array, required: false, default: () => [] },
545
- plotLines: { type: Array, required: false, default: () => [] },
546
- drilldown: { type: Object, required: false, default: void 0 },
547
- zoomable: { type: Boolean, required: false, default: false },
548
- zoomResetLabel: { type: String, required: false, default: "origam.chart.zoom.reset_aria_label" },
549
- rangeSelector: { type: Object, required: false, default: void 0 },
550
- annotations: { type: Array, required: false, default: () => [] },
551
- series: { type: Array, required: true },
552
- categories: { type: Array, required: false, default: () => [] },
553
- title: { type: String, required: false, default: void 0 },
554
- subtitle: { type: String, required: false, default: void 0 },
555
- showLegend: { type: Boolean, required: false, default: true },
556
- legendPosition: { type: null, required: false, default: "bottom" },
557
- animated: { type: Boolean, required: false, default: true },
558
- animationDuration: { type: Number, required: false, default: 600 },
559
- colorScheme: { type: Array, required: false, default: () => [] },
560
- aspectRatio: { type: String, required: false, default: void 0 },
561
- id: { type: String, required: false },
562
- class: { type: [String, Array, Object], required: false },
563
- style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
564
- height: { type: [Number, String], required: false, default: 300 },
565
- maxHeight: { type: [Number, String], required: false },
566
- maxWidth: { type: [Number, String], required: false },
567
- minHeight: { type: [Number, String], required: false },
568
- minWidth: { type: [Number, String], required: false },
569
- width: { type: [Number, String], required: false },
570
- margin: { type: [Boolean, Number, String], required: false },
571
- marginTop: { type: [Boolean, Number, String], required: false },
572
- marginLeft: { type: [Boolean, Number, String], required: false },
573
- marginBottom: { type: [Boolean, Number, String], required: false },
574
- marginRight: { type: [Boolean, Number, String], required: false },
575
- marginBlock: { type: [Boolean, Number, String], required: false },
576
- marginInline: { type: [Boolean, Number, String], required: false },
577
- marginInlineStart: { type: [Boolean, Number, String], required: false },
578
- marginInlineEnd: { type: [Boolean, Number, String], required: false },
579
- marginBlockStart: { type: [Boolean, Number, String], required: false },
580
- marginBlockEnd: { type: [Boolean, Number, String], required: false },
581
- padding: { type: [Boolean, Number, String], required: false },
582
- paddingTop: { type: [Boolean, Number, String], required: false },
583
- paddingLeft: { type: [Boolean, Number, String], required: false },
584
- paddingBottom: { type: [Boolean, Number, String], required: false },
585
- paddingRight: { type: [Boolean, Number, String], required: false },
586
- paddingBlock: { type: [Boolean, Number, String], required: false },
587
- paddingInline: { type: [Boolean, Number, String], required: false },
588
- paddingInlineStart: { type: [Boolean, Number, String], required: false },
589
- paddingInlineEnd: { type: [Boolean, Number, String], required: false },
590
- paddingBlockStart: { type: [Boolean, Number, String], required: false },
591
- paddingBlockEnd: { type: [Boolean, Number, String], required: false },
592
- rounded: { type: [Boolean, Number, String, null], required: false, skipCheck: true },
593
- roundedTopRight: { type: [Boolean, Number, String], required: false },
594
- roundedTopLeft: { type: [Boolean, Number, String], required: false },
595
- roundedBottomLeft: { type: [Boolean, Number, String], required: false },
596
- roundedBottomRight: { type: [Boolean, Number, String], required: false },
597
- roundedStartStart: { type: [Boolean, Number, String], required: false },
598
- roundedStartEnd: { type: [Boolean, Number, String], required: false },
599
- roundedEndStart: { type: [Boolean, Number, String], required: false },
600
- roundedEndEnd: { type: [Boolean, Number, String], required: false },
601
- elevation: { type: [Number, String], required: false },
602
- bgColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
603
- fontSize: { type: null, required: false },
604
- fontWeight: { type: null, required: false }
533
+ type: {
534
+ type: null,
535
+ required: false,
536
+ default: "line"
537
+ },
538
+ stacked: {
539
+ type: Boolean,
540
+ required: false,
541
+ default: false
542
+ },
543
+ stacking: {
544
+ type: null,
545
+ required: false,
546
+ default: "normal"
547
+ },
548
+ smoothing: {
549
+ type: null,
550
+ required: false,
551
+ default: "none"
552
+ },
553
+ yMin: {
554
+ type: Number,
555
+ required: false,
556
+ default: undefined
557
+ },
558
+ yMax: {
559
+ type: Number,
560
+ required: false,
561
+ default: undefined
562
+ },
563
+ showGrid: {
564
+ type: Boolean,
565
+ required: false,
566
+ default: true
567
+ },
568
+ showAxis: {
569
+ type: Boolean,
570
+ required: false,
571
+ default: true
572
+ },
573
+ showTooltip: {
574
+ type: Boolean,
575
+ required: false,
576
+ default: true
577
+ },
578
+ xAxisFormat: {
579
+ type: Function,
580
+ required: false,
581
+ default: undefined
582
+ },
583
+ yAxisFormat: {
584
+ type: Function,
585
+ required: false,
586
+ default: undefined
587
+ },
588
+ secondaryYAxis: {
589
+ type: Object,
590
+ required: false,
591
+ default: undefined
592
+ },
593
+ plotBands: {
594
+ type: Array,
595
+ required: false,
596
+ default: () => []
597
+ },
598
+ plotLines: {
599
+ type: Array,
600
+ required: false,
601
+ default: () => []
602
+ },
603
+ drilldown: {
604
+ type: Object,
605
+ required: false,
606
+ default: undefined
607
+ },
608
+ zoomable: {
609
+ type: Boolean,
610
+ required: false,
611
+ default: false
612
+ },
613
+ zoomResetLabel: {
614
+ type: String,
615
+ required: false,
616
+ default: "origam.chart.zoom.reset_aria_label"
617
+ },
618
+ rangeSelector: {
619
+ type: Object,
620
+ required: false,
621
+ default: undefined
622
+ },
623
+ annotations: {
624
+ type: Array,
625
+ required: false,
626
+ default: () => []
627
+ },
628
+ series: {
629
+ type: Array,
630
+ required: true
631
+ },
632
+ categories: {
633
+ type: Array,
634
+ required: false,
635
+ default: () => []
636
+ },
637
+ title: {
638
+ type: String,
639
+ required: false,
640
+ default: undefined
641
+ },
642
+ subtitle: {
643
+ type: String,
644
+ required: false,
645
+ default: undefined
646
+ },
647
+ showLegend: {
648
+ type: Boolean,
649
+ required: false,
650
+ default: true
651
+ },
652
+ legendPosition: {
653
+ type: null,
654
+ required: false,
655
+ default: "bottom"
656
+ },
657
+ animated: {
658
+ type: Boolean,
659
+ required: false,
660
+ default: true
661
+ },
662
+ animationDuration: {
663
+ type: Number,
664
+ required: false,
665
+ default: 600
666
+ },
667
+ colorScheme: {
668
+ type: Array,
669
+ required: false,
670
+ default: () => []
671
+ },
672
+ aspectRatio: {
673
+ type: String,
674
+ required: false,
675
+ default: undefined
676
+ },
677
+ id: {
678
+ type: String,
679
+ required: false
680
+ },
681
+ class: {
682
+ type: [
683
+ String,
684
+ Array,
685
+ Object
686
+ ],
687
+ required: false
688
+ },
689
+ style: {
690
+ type: [
691
+ String,
692
+ Array,
693
+ Object,
694
+ Boolean,
695
+ null
696
+ ],
697
+ required: false,
698
+ skipCheck: true
699
+ },
700
+ height: {
701
+ type: [Number, String],
702
+ required: false,
703
+ default: 300
704
+ },
705
+ maxHeight: {
706
+ type: [Number, String],
707
+ required: false
708
+ },
709
+ maxWidth: {
710
+ type: [Number, String],
711
+ required: false
712
+ },
713
+ minHeight: {
714
+ type: [Number, String],
715
+ required: false
716
+ },
717
+ minWidth: {
718
+ type: [Number, String],
719
+ required: false
720
+ },
721
+ width: {
722
+ type: [Number, String],
723
+ required: false
724
+ },
725
+ margin: {
726
+ type: [
727
+ Boolean,
728
+ Number,
729
+ String
730
+ ],
731
+ required: false
732
+ },
733
+ marginTop: {
734
+ type: [
735
+ Boolean,
736
+ Number,
737
+ String
738
+ ],
739
+ required: false
740
+ },
741
+ marginLeft: {
742
+ type: [
743
+ Boolean,
744
+ Number,
745
+ String
746
+ ],
747
+ required: false
748
+ },
749
+ marginBottom: {
750
+ type: [
751
+ Boolean,
752
+ Number,
753
+ String
754
+ ],
755
+ required: false
756
+ },
757
+ marginRight: {
758
+ type: [
759
+ Boolean,
760
+ Number,
761
+ String
762
+ ],
763
+ required: false
764
+ },
765
+ marginBlock: {
766
+ type: [
767
+ Boolean,
768
+ Number,
769
+ String
770
+ ],
771
+ required: false
772
+ },
773
+ marginInline: {
774
+ type: [
775
+ Boolean,
776
+ Number,
777
+ String
778
+ ],
779
+ required: false
780
+ },
781
+ marginInlineStart: {
782
+ type: [
783
+ Boolean,
784
+ Number,
785
+ String
786
+ ],
787
+ required: false
788
+ },
789
+ marginInlineEnd: {
790
+ type: [
791
+ Boolean,
792
+ Number,
793
+ String
794
+ ],
795
+ required: false
796
+ },
797
+ marginBlockStart: {
798
+ type: [
799
+ Boolean,
800
+ Number,
801
+ String
802
+ ],
803
+ required: false
804
+ },
805
+ marginBlockEnd: {
806
+ type: [
807
+ Boolean,
808
+ Number,
809
+ String
810
+ ],
811
+ required: false
812
+ },
813
+ padding: {
814
+ type: [
815
+ Boolean,
816
+ Number,
817
+ String
818
+ ],
819
+ required: false
820
+ },
821
+ paddingTop: {
822
+ type: [
823
+ Boolean,
824
+ Number,
825
+ String
826
+ ],
827
+ required: false
828
+ },
829
+ paddingLeft: {
830
+ type: [
831
+ Boolean,
832
+ Number,
833
+ String
834
+ ],
835
+ required: false
836
+ },
837
+ paddingBottom: {
838
+ type: [
839
+ Boolean,
840
+ Number,
841
+ String
842
+ ],
843
+ required: false
844
+ },
845
+ paddingRight: {
846
+ type: [
847
+ Boolean,
848
+ Number,
849
+ String
850
+ ],
851
+ required: false
852
+ },
853
+ paddingBlock: {
854
+ type: [
855
+ Boolean,
856
+ Number,
857
+ String
858
+ ],
859
+ required: false
860
+ },
861
+ paddingInline: {
862
+ type: [
863
+ Boolean,
864
+ Number,
865
+ String
866
+ ],
867
+ required: false
868
+ },
869
+ paddingInlineStart: {
870
+ type: [
871
+ Boolean,
872
+ Number,
873
+ String
874
+ ],
875
+ required: false
876
+ },
877
+ paddingInlineEnd: {
878
+ type: [
879
+ Boolean,
880
+ Number,
881
+ String
882
+ ],
883
+ required: false
884
+ },
885
+ paddingBlockStart: {
886
+ type: [
887
+ Boolean,
888
+ Number,
889
+ String
890
+ ],
891
+ required: false
892
+ },
893
+ paddingBlockEnd: {
894
+ type: [
895
+ Boolean,
896
+ Number,
897
+ String
898
+ ],
899
+ required: false
900
+ },
901
+ rounded: {
902
+ type: [
903
+ Boolean,
904
+ Number,
905
+ String,
906
+ null
907
+ ],
908
+ required: false,
909
+ skipCheck: true
910
+ },
911
+ roundedTopRight: {
912
+ type: [
913
+ Boolean,
914
+ Number,
915
+ String
916
+ ],
917
+ required: false
918
+ },
919
+ roundedTopLeft: {
920
+ type: [
921
+ Boolean,
922
+ Number,
923
+ String
924
+ ],
925
+ required: false
926
+ },
927
+ roundedBottomLeft: {
928
+ type: [
929
+ Boolean,
930
+ Number,
931
+ String
932
+ ],
933
+ required: false
934
+ },
935
+ roundedBottomRight: {
936
+ type: [
937
+ Boolean,
938
+ Number,
939
+ String
940
+ ],
941
+ required: false
942
+ },
943
+ roundedStartStart: {
944
+ type: [
945
+ Boolean,
946
+ Number,
947
+ String
948
+ ],
949
+ required: false
950
+ },
951
+ roundedStartEnd: {
952
+ type: [
953
+ Boolean,
954
+ Number,
955
+ String
956
+ ],
957
+ required: false
958
+ },
959
+ roundedEndStart: {
960
+ type: [
961
+ Boolean,
962
+ Number,
963
+ String
964
+ ],
965
+ required: false
966
+ },
967
+ roundedEndEnd: {
968
+ type: [
969
+ Boolean,
970
+ Number,
971
+ String
972
+ ],
973
+ required: false
974
+ },
975
+ elevation: {
976
+ type: [Number, String],
977
+ required: false
978
+ },
979
+ bgColor: {
980
+ type: [
981
+ String,
982
+ Object,
983
+ Boolean,
984
+ null
985
+ ],
986
+ required: false,
987
+ skipCheck: true
988
+ },
989
+ fontSize: {
990
+ type: null,
991
+ required: false
992
+ },
993
+ fontWeight: {
994
+ type: null,
995
+ required: false
996
+ }
605
997
  });
606
- const emit = defineEmits(["drill", "drill-up", "zoom", "reset-zoom", "point-click", "legend-click", "series-toggle"]);
998
+ const emit = defineEmits([
999
+ "drill",
1000
+ "drill-up",
1001
+ "zoom",
1002
+ "reset-zoom",
1003
+ "point-click",
1004
+ "legend-click",
1005
+ "series-toggle"
1006
+ ]);
607
1007
  defineSlots();
1008
+ /*********************************************************
1009
+ * Composables
1010
+ ********************************************************/
608
1011
  const { t } = useLocale();
1012
+ /*********************************************************
1013
+ * Drilldown state — a navigation stack where index 0 is the
1014
+ * root frame (props.series / props.categories). Each drill-in
1015
+ * pushes a new frame; "Back" pops it. The chart engine always
1016
+ * reads the top frame so reactivity flows automatically.
1017
+ *
1018
+ * Cycle detection: a point's drilldown id is looked up in the
1019
+ * dataset bank; if the id already appears in the current stack
1020
+ * we silently ignore the click to prevent infinite loops.
1021
+ * Maximum depth is naturally bounded by the number of distinct
1022
+ * dataset ids the consumer provides — infinite levels are
1023
+ * supported as long as there are no cycles.
1024
+ ********************************************************/
609
1025
  const drillStack = ref([]);
610
1026
  const activeSeries = computed(() => {
611
- if (!drillStack.value.length) return props.series;
612
- return drillStack.value[drillStack.value.length - 1].series;
1027
+ if (!drillStack.value.length) return props.series;
1028
+ return drillStack.value[drillStack.value.length - 1].series;
613
1029
  });
614
1030
  const activeCategories = computed(() => {
615
- if (!drillStack.value.length) return props.categories;
616
- return drillStack.value[drillStack.value.length - 1].categories;
1031
+ if (!drillStack.value.length) return props.categories;
1032
+ return drillStack.value[drillStack.value.length - 1].categories;
617
1033
  });
618
1034
  const hasDrilldown = computed(() => Boolean(props.drilldown?.datasets?.length));
619
1035
  const isDrilled = computed(() => drillStack.value.length > 0);
620
1036
  const breadcrumbItems = computed(() => {
621
- const root = { name: props.title ?? t("origam.chart.drilldown.root_label"), depth: -1 };
622
- return [root, ...drillStack.value.map((frame, i) => ({ name: frame.name, depth: i }))];
1037
+ const root = {
1038
+ name: props.title ?? t("origam.chart.drilldown.root_label"),
1039
+ depth: -1
1040
+ };
1041
+ return [root, ...drillStack.value.map((frame, i) => ({
1042
+ name: frame.name,
1043
+ depth: i
1044
+ }))];
623
1045
  });
624
1046
  const drilldownBackLabel = computed(() => props.drilldown?.backLabel ?? t("origam.chart.drilldown.back_label"));
625
1047
  const drilldownNavAriaLabel = computed(() => t(props.drilldown?.navAriaLabel ?? "origam.chart.drilldown.aria_label"));
626
1048
  const zoomResetAriaLabel = computed(() => t(props.zoomResetLabel));
1049
+ /*********************************************************
1050
+ * Largeur de la pilule « Reset zoom » — mesuree, pas devinee
1051
+ *
1052
+ * @description
1053
+ * La boite etait un `<rect width="64">` ECRIT EN DUR, dimensionne
1054
+ * pour l'anglais. Depuis que le texte visible suit la locale (#764),
1055
+ * toute langue plus verbeuse debordait. Mesure Chromium :
1056
+ *
1057
+ * en « Reset zoom » texte 56.75 → tenait
1058
+ * fr « Réinitialiser le zoom » texte 98.06 → +34.06 de debord
1059
+ *
1060
+ * @description
1061
+ * ⛔ SVG N'A PAS D'AUTO-LAYOUT : aucun mecanisme natif n'elargit un
1062
+ * `<rect>` au texte d'un `<text>` frere, contrairement au padding
1063
+ * d'une boite HTML. C'est le cas ou la plateforme ne fait PAS le
1064
+ * travail, donc on le lui demande explicitement — `getBBox()`, la
1065
+ * mesure typographique reelle du navigateur.
1066
+ *
1067
+ * @description
1068
+ * L'alternative — estimer depuis `label.length` — a ete ecartee sur
1069
+ * mesure, pas par principe : les deux chaines ci-dessus donnent
1070
+ * 5.68 et 4.67 unites par caractere. Un facteur unique se tromperait
1071
+ * deja de ~20 % sur ces deux-la, et davantage sur des glyphes larges
1072
+ * (`W` contre `i`), que le compte de caracteres ne distingue pas.
1073
+ *
1074
+ * @description
1075
+ * `getBBox` est absent en SSR et sous jsdom : la garde laisse alors
1076
+ * la pilule au plancher, qui est exactement le rendu d'avant.
1077
+ *
1078
+ * @description
1079
+ * Le `catch` couvre le second cas de repli : `getBBox()` LEVE sur un
1080
+ * noeud non rendu — onglet d'arriere-plan, `display: none`, sous-arbre
1081
+ * detache. Le plancher reste alors une largeur valide, donc l'echec de
1082
+ * mesure degrade le rendu sans jamais le casser.
1083
+ ********************************************************/
627
1084
  const zoomResetTextRef = ref(null);
628
1085
  const zoomResetTextWidth = ref(0);
629
1086
  const zoomResetWidth = computed(() => {
630
- if (!zoomResetTextWidth.value) return CHART_ZOOM_RESET_MIN_WIDTH;
631
- return Math.max(
632
- CHART_ZOOM_RESET_MIN_WIDTH,
633
- zoomResetTextWidth.value + CHART_ZOOM_RESET_PADDING_X * 2
634
- );
1087
+ if (!zoomResetTextWidth.value) return CHART_ZOOM_RESET_MIN_WIDTH;
1088
+ return Math.max(CHART_ZOOM_RESET_MIN_WIDTH, zoomResetTextWidth.value + CHART_ZOOM_RESET_PADDING_X * 2);
635
1089
  });
636
1090
  const measureZoomResetText = async () => {
637
- await nextTick();
638
- const el = zoomResetTextRef.value;
639
- if (!el || typeof el.getBBox !== "function") {
640
- zoomResetTextWidth.value = 0;
641
- return;
642
- }
643
- try {
644
- zoomResetTextWidth.value = el.getBBox().width;
645
- } catch {
646
- zoomResetTextWidth.value = 0;
647
- }
1091
+ await nextTick();
1092
+ const el = zoomResetTextRef.value;
1093
+ if (!el || typeof el.getBBox !== "function") {
1094
+ zoomResetTextWidth.value = 0;
1095
+ return;
1096
+ }
1097
+ try {
1098
+ zoomResetTextWidth.value = el.getBBox().width;
1099
+ } catch {
1100
+ zoomResetTextWidth.value = 0;
1101
+ }
648
1102
  };
649
1103
  const resolveDrilldownLink = (link) => {
650
- if (!props.drilldown) return null;
651
- const dataset = props.drilldown.datasets.find((d) => d.id === link.id);
652
- if (!dataset) return null;
653
- return {
654
- name: dataset.name,
655
- series: dataset.series,
656
- categories: dataset.categories ?? []
657
- };
1104
+ if (!props.drilldown) return null;
1105
+ const dataset = props.drilldown.datasets.find((d) => d.id === link.id);
1106
+ if (!dataset) return null;
1107
+ return {
1108
+ name: dataset.name,
1109
+ series: dataset.series,
1110
+ categories: dataset.categories ?? []
1111
+ };
658
1112
  };
659
1113
  const isDrilldownCycle = (id) => drillStack.value.some((frame) => frame.name === id);
660
1114
  const onDrillIn = (link, point) => {
661
- if (isDrilldownCycle(link.id)) return;
662
- const frame = resolveDrilldownLink(link);
663
- if (!frame) return;
664
- drillStack.value = [...drillStack.value, frame];
665
- hoveredPath.value = null;
666
- emit("drill", link, point);
1115
+ if (isDrilldownCycle(link.id)) return;
1116
+ const frame = resolveDrilldownLink(link);
1117
+ if (!frame) return;
1118
+ drillStack.value = [...drillStack.value, frame];
1119
+ hoveredPath.value = null;
1120
+ emit("drill", link, point);
667
1121
  };
668
1122
  const onDrillUp = () => {
669
- if (!drillStack.value.length) return;
670
- drillStack.value = drillStack.value.slice(0, -1);
671
- hoveredPath.value = null;
672
- emit("drill-up");
1123
+ if (!drillStack.value.length) return;
1124
+ drillStack.value = drillStack.value.slice(0, -1);
1125
+ hoveredPath.value = null;
1126
+ emit("drill-up");
673
1127
  };
674
1128
  const onBreadcrumbClick = (depth) => {
675
- if (depth === -1) {
676
- drillStack.value = [];
677
- } else {
678
- drillStack.value = drillStack.value.slice(0, depth + 1);
679
- }
680
- hoveredPath.value = null;
1129
+ if (depth === -1) {
1130
+ drillStack.value = [];
1131
+ } else {
1132
+ drillStack.value = drillStack.value.slice(0, depth + 1);
1133
+ }
1134
+ hoveredPath.value = null;
681
1135
  };
682
1136
  const { dimensionStyles } = useDimension(props);
683
1137
  const { backgroundColorClasses, backgroundColorStyles } = useBackgroundColor(props, "bgColor");
@@ -687,431 +1141,545 @@ const { paddingClasses, paddingStyles } = usePadding(props);
687
1141
  const { roundedClasses, roundedStyles } = useRounded(props);
688
1142
  const { headerTypographyStyles } = useChartHeaderTypography(props);
689
1143
  const chartAnimationStyle = useChartAnimationStyle(props);
690
- const { resizeRef: svgSizeRef, width: svgWidth, height: svgHeight } = useChartSize({ width: 600, height: 360 });
691
- const PADDING_DEFAULT = { top: 24, right: 24, bottom: 36, left: 48 };
692
- const PADDING_WITH_SECONDARY_AXIS = { top: 24, right: 56, bottom: 36, left: 48 };
1144
+ /*********************************************************
1145
+ * Static — viewBox geometry. SVG renders into a fixed coordinate
1146
+ * space; CSS scales the resulting box. Trend sparklines use a
1147
+ * shorter viewBox so they don't grow taller than their host
1148
+ * row when wrapped into a table cell.
1149
+ ********************************************************/
1150
+ const { resizeRef: svgSizeRef, width: svgWidth, height: svgHeight } = useChartSize({
1151
+ width: 600,
1152
+ height: 360
1153
+ });
1154
+ const PADDING_DEFAULT = {
1155
+ top: 24,
1156
+ right: 24,
1157
+ bottom: 36,
1158
+ left: 48
1159
+ };
1160
+ const PADDING_WITH_SECONDARY_AXIS = {
1161
+ top: 24,
1162
+ right: 56,
1163
+ bottom: 36,
1164
+ left: 48
1165
+ };
693
1166
  const svgRef = ref(null);
694
1167
  const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
695
1168
  const setSvgRef = (el) => {
696
- svgRef.value = el;
697
- svgSizeRef.value = el;
1169
+ svgRef.value = el;
1170
+ svgSizeRef.value = el;
698
1171
  };
699
- const mousePos = ref({ x: 0, y: 0 });
700
- const hasSecondaryAxis = computed(
701
- () => Boolean(props.secondaryYAxis) || activeSeries.value.some((s) => (s.yAxis ?? 0) === 1)
702
- );
703
- const chartPadding = computed(
704
- () => hasSecondaryAxis.value ? PADDING_WITH_SECONDARY_AXIS : PADDING_DEFAULT
705
- );
1172
+ const mousePos = ref({
1173
+ x: 0,
1174
+ y: 0
1175
+ });
1176
+ const hasSecondaryAxis = computed(() => Boolean(props.secondaryYAxis) || activeSeries.value.some((s) => (s.yAxis ?? 0) === 1));
1177
+ const chartPadding = computed(() => hasSecondaryAxis.value ? PADDING_WITH_SECONDARY_AXIS : PADDING_DEFAULT);
1178
+ /*********************************************************
1179
+ * Zoom / pan state — `useChartZoom` manages the visible
1180
+ * category window. The engine clips `activeCategories` to
1181
+ * `[zoomStart, zoomEnd]` before scale computation. When
1182
+ * `zoomable` is `false` the window covers the full range and
1183
+ * all methods are no-ops from the consumer's perspective.
1184
+ ********************************************************/
706
1185
  const zoom = useChartZoom({ dataLength: () => activeCategories.value.length });
707
- const {
708
- zoomStart,
709
- zoomEnd,
710
- isDragging,
711
- dragStartPx,
712
- dragEndPx,
713
- isZoomed,
714
- zoomTo,
715
- zoomReset: zoomResetState,
716
- zoomBy,
717
- pxToCategoryIndex,
718
- WHEEL_ZOOM_STEP
719
- } = zoom;
1186
+ const { zoomStart, zoomEnd, isDragging, dragStartPx, dragEndPx, isZoomed, zoomTo, zoomReset: zoomResetState, zoomBy, pxToCategoryIndex, WHEEL_ZOOM_STEP } = zoom;
1187
+ /*********************************************************
1188
+ * ⛔ Le `watch` vit ICI, et pas aupres de `measureZoomResetText`
1189
+ * qu'il appelle : `isZoomed` sort de la destructuration de
1190
+ * `useChartZoom` juste au-dessus, et il est `immediate`. Declare
1191
+ * plus haut, il lirait `isZoomed` avant son `const` — zone morte
1192
+ * temporelle, qui casse le montage du composant entier.
1193
+ ********************************************************/
720
1194
  watch(
721
- [zoomResetAriaLabel, isZoomed, () => props.zoomable],
722
- /*********************************************************
723
- * Promesse flottante, deliberement
724
- *
725
- * @description
726
- * La mesure se fait en `flush: 'post'` et rien n'attend la
727
- * promesse. Le `void` qui marquait cette intention est retire
728
- * (Sonar #771) : la valeur de retour reste ignoree a l'identique,
729
- * et le callback rend toujours `undefined`.
730
- ********************************************************/
731
- () => {
732
- measureZoomResetText();
733
- },
734
- { flush: "post", immediate: true }
1195
+ [
1196
+ zoomResetAriaLabel,
1197
+ isZoomed,
1198
+ () => props.zoomable
1199
+ ],
1200
+ /*********************************************************
1201
+ * Promesse flottante, deliberement
1202
+ *
1203
+ * @description
1204
+ * La mesure se fait en `flush: 'post'` et rien n'attend la
1205
+ * promesse. Le `void` qui marquait cette intention est retire
1206
+ * (Sonar #771) : la valeur de retour reste ignoree a l'identique,
1207
+ * et le callback rend toujours `undefined`.
1208
+ ********************************************************/
1209
+ () => {
1210
+ measureZoomResetText();
1211
+ },
1212
+ {
1213
+ flush: "post",
1214
+ immediate: true
1215
+ }
735
1216
  );
736
1217
  const visibleCategories = computed(() => {
737
- if (!props.zoomable) return activeCategories.value;
738
- const len = activeCategories.value.length;
739
- if (!len) return activeCategories.value;
740
- const s = zoomStart.value;
741
- const e = Math.min(zoomEnd.value, len - 1);
742
- return activeCategories.value.slice(s, e + 1);
1218
+ if (!props.zoomable) return activeCategories.value;
1219
+ const len = activeCategories.value.length;
1220
+ if (!len) return activeCategories.value;
1221
+ const s = zoomStart.value;
1222
+ const e = Math.min(zoomEnd.value, len - 1);
1223
+ return activeCategories.value.slice(s, e + 1);
743
1224
  });
1225
+ /*********************************************************
1226
+ * Range selector state — tracks which button is currently active.
1227
+ ********************************************************/
744
1228
  const rangeSelectorActiveIndex = ref(-1);
745
- const hasRangeSelector = computed(
746
- () => Boolean(props.rangeSelector?.enabled)
747
- );
1229
+ const hasRangeSelector = computed(() => Boolean(props.rangeSelector?.enabled));
748
1230
  const rangeSelectorButtons = computed(() => {
749
- const custom = props.rangeSelector?.buttons;
750
- if (custom && custom.length) return custom;
751
- return CHART_RANGE_SELECTOR_DEFAULT_BUTTONS;
1231
+ const custom = props.rangeSelector?.buttons;
1232
+ if (custom && custom.length) return custom;
1233
+ return CHART_RANGE_SELECTOR_DEFAULT_BUTTONS;
752
1234
  });
753
1235
  const onRangeSelectorSelect = (index, start, end) => {
754
- rangeSelectorActiveIndex.value = index;
755
- if (props.zoomable) {
756
- zoomTo(start, end);
757
- emit("zoom", { start, end });
758
- }
1236
+ rangeSelectorActiveIndex.value = index;
1237
+ if (props.zoomable) {
1238
+ zoomTo(start, end);
1239
+ emit("zoom", {
1240
+ start,
1241
+ end
1242
+ });
1243
+ }
759
1244
  };
760
- watch(
761
- () => activeCategories.value.length,
762
- () => {
763
- zoomResetState();
764
- rangeSelectorActiveIndex.value = -1;
765
- const sel = props.rangeSelector?.selected;
766
- if (sel !== void 0 && rangeSelectorButtons.value[sel]) {
767
- const btn = rangeSelectorButtons.value[sel];
768
- const len = activeCategories.value.length;
769
- let start;
770
- let end;
771
- if (btn.fraction !== void 0) {
772
- const windowSize = Math.round(len * Math.max(0, Math.min(1, btn.fraction)));
773
- start = Math.max(0, len - windowSize);
774
- end = len - 1;
775
- } else if (btn.count !== void 0) {
776
- start = Math.max(0, len - btn.count);
777
- end = len - 1;
778
- } else {
779
- start = 0;
780
- end = len - 1;
781
- }
782
- rangeSelectorActiveIndex.value = sel;
783
- if (props.zoomable) zoomTo(start, end);
784
- }
785
- },
786
- { immediate: true }
787
- );
1245
+ watch(() => activeCategories.value.length, () => {
1246
+ zoomResetState();
1247
+ rangeSelectorActiveIndex.value = -1;
1248
+ const sel = props.rangeSelector?.selected;
1249
+ if (sel !== undefined && rangeSelectorButtons.value[sel]) {
1250
+ const btn = rangeSelectorButtons.value[sel];
1251
+ const len = activeCategories.value.length;
1252
+ let start;
1253
+ let end;
1254
+ if (btn.fraction !== undefined) {
1255
+ const windowSize = Math.round(len * Math.max(0, Math.min(1, btn.fraction)));
1256
+ start = Math.max(0, len - windowSize);
1257
+ end = len - 1;
1258
+ } else if (btn.count !== undefined) {
1259
+ start = Math.max(0, len - btn.count);
1260
+ end = len - 1;
1261
+ } else {
1262
+ start = 0;
1263
+ end = len - 1;
1264
+ }
1265
+ rangeSelectorActiveIndex.value = sel;
1266
+ if (props.zoomable) zoomTo(start, end);
1267
+ }
1268
+ }, { immediate: true });
1269
+ /*********************************************************
1270
+ * Engine — `useChart` produces every descriptor needed to
1271
+ * paint. The thunks make the composable reactive against
1272
+ * `props` without owning the prop reference itself.
1273
+ * When drilled in, `activeSeries` / `activeCategories` point
1274
+ * to the sub-dataset instead of the root props.
1275
+ * The zoom window clips the visible category slice so the
1276
+ * X scale maps only the visible range to the full plot width.
1277
+ ********************************************************/
788
1278
  const chart = useChart({
789
- type: () => props.type,
790
- series: () => activeSeries.value,
791
- categories: () => visibleCategories.value,
792
- stacked: () => props.stacked,
793
- stacking: () => props.stacking,
794
- // donutHoleSize is a no-op for cartesian; fixed to 0.
795
- donutHoleSize: () => 0,
796
- colorScheme: () => props.colorScheme,
797
- smoothing: () => props.smoothing,
798
- yMin: () => props.yMin,
799
- yMax: () => props.yMax,
800
- width: () => svgWidth.value,
801
- height: () => svgHeight.value,
802
- padding: () => chartPadding.value,
803
- secondaryYAxis: () => props.secondaryYAxis
1279
+ type: () => props.type,
1280
+ series: () => activeSeries.value,
1281
+ categories: () => visibleCategories.value,
1282
+ stacked: () => props.stacked,
1283
+ stacking: () => props.stacking,
1284
+ // donutHoleSize is a no-op for cartesian; fixed to 0.
1285
+ donutHoleSize: () => 0,
1286
+ colorScheme: () => props.colorScheme,
1287
+ smoothing: () => props.smoothing,
1288
+ yMin: () => props.yMin,
1289
+ yMax: () => props.yMax,
1290
+ width: () => svgWidth.value,
1291
+ height: () => svgHeight.value,
1292
+ padding: () => chartPadding.value,
1293
+ secondaryYAxis: () => props.secondaryYAxis
804
1294
  });
805
1295
  const { viewBox, ticks, secondaryTicks, paths, legend, plot, scales, yRange, slotCount, effectiveStacking, percentValues } = chart;
1296
+ /*********************************************************
1297
+ * Plot bands + lines — background decoration layers.
1298
+ * Split by `layer` so the template renders below/above
1299
+ * data in the correct order without z-index tricks.
1300
+ ********************************************************/
806
1301
  const bandDescriptors = computed(() => {
807
- const { x0, x1, y0, y1 } = plot.value;
808
- return (props.plotBands ?? []).map((band) => ({
809
- band,
810
- geo: computePlotBandGeometry(
811
- band,
812
- scales.value,
813
- activeCategories.value,
814
- x0,
815
- x1,
816
- y0,
817
- y1
818
- )
819
- })).filter((d) => d.geo !== null);
1302
+ const { x0, x1, y0, y1 } = plot.value;
1303
+ return (props.plotBands ?? []).map((band) => ({
1304
+ band,
1305
+ geo: computePlotBandGeometry(band, scales.value, activeCategories.value, x0, x1, y0, y1)
1306
+ })).filter((d) => d.geo !== null);
820
1307
  });
821
1308
  const lineDescriptors = computed(() => {
822
- const { x0, x1, y0, y1 } = plot.value;
823
- return (props.plotLines ?? []).map((line) => ({
824
- line,
825
- geo: computePlotLineGeometry(
826
- line,
827
- scales.value,
828
- activeCategories.value,
829
- x0,
830
- x1,
831
- y0,
832
- y1
833
- )
834
- })).filter((d) => d.geo !== null);
1309
+ const { x0, x1, y0, y1 } = plot.value;
1310
+ return (props.plotLines ?? []).map((line) => ({
1311
+ line,
1312
+ geo: computePlotLineGeometry(line, scales.value, activeCategories.value, x0, x1, y0, y1)
1313
+ })).filter((d) => d.geo !== null);
835
1314
  });
836
- const belowBands = computed(
837
- () => bandDescriptors.value.filter((d) => (d.band.layer ?? "below") === "below")
838
- );
839
- const aboveBands = computed(
840
- () => bandDescriptors.value.filter((d) => d.band.layer === "above")
841
- );
842
- const belowLines = computed(
843
- () => lineDescriptors.value.filter((d) => (d.line.layer ?? "above") === "below")
844
- );
845
- const aboveLines = computed(
846
- () => lineDescriptors.value.filter((d) => (d.line.layer ?? "above") === "above")
847
- );
1315
+ const belowBands = computed(() => bandDescriptors.value.filter((d) => (d.band.layer ?? "below") === "below"));
1316
+ const aboveBands = computed(() => bandDescriptors.value.filter((d) => d.band.layer === "above"));
1317
+ const belowLines = computed(() => lineDescriptors.value.filter((d) => (d.line.layer ?? "above") === "below"));
1318
+ const aboveLines = computed(() => lineDescriptors.value.filter((d) => (d.line.layer ?? "above") === "above"));
1319
+ /*********************************************************
1320
+ * Annotations — projected above all series and decorations.
1321
+ * Each entry is `IChartAnnotationGeo | null`; nulls are
1322
+ * filtered out so the template never receives bad geometry.
1323
+ ********************************************************/
848
1324
  const annotationGeos = computed(() => {
849
- const annos = props.annotations ?? [];
850
- if (!annos.length) return [];
851
- return annos.map((a) => computeAnnotationGeometry(a, scales.value, visibleCategories.value, slotCount.value)).filter((g) => g !== null);
1325
+ const annos = props.annotations ?? [];
1326
+ if (!annos.length) return [];
1327
+ return annos.map((a) => computeAnnotationGeometry(a, scales.value, visibleCategories.value, slotCount.value)).filter((g) => g !== null);
852
1328
  });
1329
+ /*********************************************************
1330
+ * Hover / tooltip — pure data flow, no DOM measurements
1331
+ * beyond positioning the floating tooltip. Identical to the
1332
+ * shell pattern.
1333
+ ********************************************************/
853
1334
  const hoveredPath = ref(null);
854
1335
  const hoveredPoint = computed(() => {
855
- const p = hoveredPath.value;
856
- if (!p) return null;
857
- const series = p.series;
858
- const visibleIdx = p.dataIndex ?? 0;
859
- const absIdx = zoomStart.value + visibleIdx;
860
- const entry = series.data[absIdx] ?? series.data[visibleIdx];
861
- const x = typeof entry === "number" ? visibleCategories.value[visibleIdx] ?? activeCategories.value[absIdx] ?? absIdx : entry.x;
862
- const y = typeof entry === "number" ? entry : entry.y;
863
- return {
864
- seriesIndex: p.seriesIndex,
865
- seriesName: series.name,
866
- dataIndex: absIdx,
867
- x,
868
- y,
869
- color: p.color
870
- };
1336
+ const p = hoveredPath.value;
1337
+ if (!p) return null;
1338
+ const series = p.series;
1339
+ const visibleIdx = p.dataIndex ?? 0;
1340
+ const absIdx = zoomStart.value + visibleIdx;
1341
+ const entry = series.data[absIdx] ?? series.data[visibleIdx];
1342
+ const x = typeof entry === "number" ? visibleCategories.value[visibleIdx] ?? activeCategories.value[absIdx] ?? absIdx : entry.x;
1343
+ const y = typeof entry === "number" ? entry : entry.y;
1344
+ return {
1345
+ seriesIndex: p.seriesIndex,
1346
+ seriesName: series.name,
1347
+ dataIndex: absIdx,
1348
+ x,
1349
+ y,
1350
+ color: p.color
1351
+ };
871
1352
  });
872
- const hoveredSeries = computed(
873
- () => hoveredPath.value?.series ?? null
874
- );
1353
+ const hoveredSeries = computed(() => hoveredPath.value?.series ?? null);
875
1354
  const hoveredCategory = computed(() => {
876
- if (!hoveredPoint.value) return "";
877
- return activeCategories.value[hoveredPoint.value.dataIndex] ?? hoveredPoint.value.x;
1355
+ if (!hoveredPoint.value) return "";
1356
+ return activeCategories.value[hoveredPoint.value.dataIndex] ?? hoveredPoint.value.x;
878
1357
  });
1358
+ /*********************************************************
1359
+ * Empty state — fired when no series carries usable data.
1360
+ ********************************************************/
879
1361
  const showEmpty = computed(() => {
880
- if (!activeSeries.value?.length) return true;
881
- return activeSeries.value.every((s) => !s.data?.length || s.visible === false);
1362
+ if (!activeSeries.value?.length) return true;
1363
+ return activeSeries.value.every((s) => !s.data?.length || s.visible === false);
882
1364
  });
1365
+ /*********************************************************
1366
+ * Root classes / styles — `aspectRatio` wins over `height`.
1367
+ ********************************************************/
883
1368
  const rootClasses = computed(() => [
884
- {
885
- [`origam-chart-cartesian--${props.type}`]: true,
886
- [`origam-chart-cartesian--legend-${props.legendPosition}`]: true,
887
- "origam-chart-cartesian--no-animation": !props.animated
888
- },
889
- backgroundColorClasses.value,
890
- elevationClasses.value,
891
- marginClasses.value,
892
- paddingClasses.value,
893
- roundedClasses.value,
894
- props.class
1369
+ {
1370
+ [`origam-chart-cartesian--${props.type}`]: true,
1371
+ [`origam-chart-cartesian--legend-${props.legendPosition}`]: true,
1372
+ "origam-chart-cartesian--no-animation": !props.animated
1373
+ },
1374
+ backgroundColorClasses.value,
1375
+ elevationClasses.value,
1376
+ marginClasses.value,
1377
+ paddingClasses.value,
1378
+ roundedClasses.value,
1379
+ props.class
895
1380
  ]);
896
1381
  const rootStyles = computed(() => {
897
- const out = {};
898
- if (props.aspectRatio) {
899
- out.aspectRatio = props.aspectRatio;
900
- }
901
- Object.assign(out, chartAnimationStyle.value);
902
- return [out, props.style];
1382
+ const out = {};
1383
+ if (props.aspectRatio) {
1384
+ out.aspectRatio = props.aspectRatio;
1385
+ }
1386
+ Object.assign(out, chartAnimationStyle.value);
1387
+ return [out, props.style];
903
1388
  });
904
- const bodyClasses = computed(() => ({
905
- "origam-chart-cartesian__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right")
906
- }));
1389
+ const bodyClasses = computed(() => ({ "origam-chart-cartesian__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right") }));
907
1390
  const svgClasses = computed(() => ({
908
- "origam-chart__svg--animated": props.animated,
909
- "origam-chart__svg--zoomable": props.zoomable
1391
+ "origam-chart__svg--animated": props.animated,
1392
+ "origam-chart__svg--zoomable": props.zoomable
910
1393
  }));
911
1394
  const hasTitleBlock = computed(() => Boolean(props.title || props.subtitle));
1395
+ /*********************************************************
1396
+ * Format helpers — fall back to identity.
1397
+ ********************************************************/
912
1398
  const formatY = (value) => {
913
- if (props.yAxisFormat) return props.yAxisFormat(value);
914
- return String(value);
1399
+ if (props.yAxisFormat) return props.yAxisFormat(value);
1400
+ return String(value);
915
1401
  };
1402
+ /**
1403
+ * Y-axis formatter active for the currently hovered series.
1404
+ *
1405
+ * - Secondary axis: uses `secondaryYAxis.format` when present.
1406
+ * - Percent stacking: overrides with `rawValue (XX.X%)` so the
1407
+ * tooltip shows both the raw data value and the stack share.
1408
+ * - Default: falls back to `props.yAxisFormat` or identity.
1409
+ */
916
1410
  const activeYAxisFormat = computed(() => {
917
- const isPercent = effectiveStacking.value === "percent" && props.stacked;
918
- if (isPercent) {
919
- return (rawY) => {
920
- const seriesIdx = hoveredPath.value?.seriesIndex ?? -1;
921
- const dataIdx = hoveredPath.value?.dataIndex ?? 0;
922
- const pct = seriesIdx >= 0 ? percentValues.value.get(seriesIdx)?.[dataIdx] ?? 0 : 0;
923
- const base = props.yAxisFormat ? props.yAxisFormat(rawY) : String(rawY);
924
- return `${base} (${pct.toFixed(1)}%)`;
925
- };
926
- }
927
- const s = hoveredSeries.value;
928
- if (s && (s.yAxis ?? 0) === 1 && props.secondaryYAxis?.format) {
929
- return props.secondaryYAxis.format;
930
- }
931
- return props.yAxisFormat;
1411
+ const isPercent = effectiveStacking.value === "percent" && props.stacked;
1412
+ if (isPercent) {
1413
+ return (rawY) => {
1414
+ const seriesIdx = hoveredPath.value?.seriesIndex ?? -1;
1415
+ const dataIdx = hoveredPath.value?.dataIndex ?? 0;
1416
+ const pct = seriesIdx >= 0 ? percentValues.value.get(seriesIdx)?.[dataIdx] ?? 0 : 0;
1417
+ const base = props.yAxisFormat ? props.yAxisFormat(rawY) : String(rawY);
1418
+ return `${base} (${pct.toFixed(1)}%)`;
1419
+ };
1420
+ }
1421
+ const s = hoveredSeries.value;
1422
+ if (s && (s.yAxis ?? 0) === 1 && props.secondaryYAxis?.format) {
1423
+ return props.secondaryYAxis.format;
1424
+ }
1425
+ return props.yAxisFormat;
932
1426
  });
1427
+ /*********************************************************
1428
+ * Path classification — pie / donut helpers don't apply
1429
+ * here (the engine never emits a slice descriptor when
1430
+ * `type` is cartesian). We keep `effectiveTypeOf` for
1431
+ * mixed-type series (e.g. a `<column>` chart with a `line`
1432
+ * overlay series).
1433
+ ********************************************************/
933
1434
  const effectiveTypeOf = (path) => path.series.type ?? props.type;
1435
+ /*********************************************************
1436
+ * strokeStyleFor — `--origam-chart-path---length` n'est PAS un token
1437
+ *
1438
+ * @description
1439
+ * ⛔ Cette variable ne doit PAS etre declaree dans les feuilles de tokens
1440
+ * (#591). C'est une synthese locale : la longueur MESUREE de chaque
1441
+ * trace, ecrite en style inline par instance et relue par
1442
+ * `stroke-dasharray` / `stroke-dashoffset` dans le bloc `<style>` pour
1443
+ * l'animation de dessin.
1444
+ *
1445
+ * @description
1446
+ * Une declaration de feuille serait inerte (le style inline gagne) et
1447
+ * surtout mensongere : un theme qui la reglerait casserait l'animation
1448
+ * sur tous les traces a la fois. Le garde `token-var-channels` la compte
1449
+ * en « canal mort » a tort — son exclusion « synthese locale » ne regarde
1450
+ * que les LHS du `<style>`, pas celles ecrites depuis le `<script>`.
1451
+ * Laissee en baseline volontairement.
1452
+ ********************************************************/
934
1453
  const strokeStyleFor = (path) => {
935
- if (!props.animated) return {};
936
- const length = path.pathLength ?? 0;
937
- if (!length) return {};
938
- return { "--origam-chart-path---length": String(length) };
1454
+ if (!props.animated) return {};
1455
+ const length = path.pathLength ?? 0;
1456
+ if (!length) return {};
1457
+ return { "--origam-chart-path---length": String(length) };
939
1458
  };
1459
+ /*
1460
+ * Combined inline style for SVG `<path>` — pre-fix the fill /
1461
+ * stroke were emitted as SVG presentation attributes
1462
+ * (`fill="..."`, `stroke="..."`), which are treated as INITIAL
1463
+ * CSS values and lose against the scoped `.origam-chart__path
1464
+ * { fill: none; }` rule below. The area's translucent fill
1465
+ * therefore never rendered — the user-reported "area looks
1466
+ * identical to line" symptom. Inline styles have higher
1467
+ * precedence than CSS rules, so emitting them here makes the
1468
+ * fill / stroke survive the cascade.
1469
+ */
940
1470
  const pathStyleFor = (path) => {
941
- const base = strokeStyleFor(path);
942
- const isAreaFill = path.variant === "fill" && effectiveTypeOf(path) === "area";
943
- const isStroke = path.variant !== "fill";
944
- return {
945
- ...base,
946
- fill: isAreaFill ? path.color : "none",
947
- fillOpacity: isAreaFill ? "0.25" : "0",
948
- stroke: isStroke ? path.color : "none"
949
- };
1471
+ const base = strokeStyleFor(path);
1472
+ const isAreaFill = path.variant === "fill" && effectiveTypeOf(path) === "area";
1473
+ const isStroke = path.variant !== "fill";
1474
+ return {
1475
+ ...base,
1476
+ fill: isAreaFill ? path.color : "none",
1477
+ fillOpacity: isAreaFill ? "0.25" : "0",
1478
+ stroke: isStroke ? path.color : "none"
1479
+ };
950
1480
  };
1481
+ /*********************************************************
1482
+ * Interaction
1483
+ ********************************************************/
951
1484
  const hoverMatches = (path) => hoveredPath.value === path;
952
1485
  const onPointEnter = (path) => {
953
- hoveredPath.value = path;
954
- if (hoveredPoint.value) chart.onPointHover(hoveredPoint.value);
1486
+ hoveredPath.value = path;
1487
+ if (hoveredPoint.value) chart.onPointHover(hoveredPoint.value);
955
1488
  };
956
1489
  const onPointLeaveEvent = () => {
957
- hoveredPath.value = null;
958
- chart.onPointHover(null);
1490
+ hoveredPath.value = null;
1491
+ chart.onPointHover(null);
959
1492
  };
960
1493
  const onSvgMouseMove = (event) => {
961
- const target = svgRef.value;
962
- if (!target) return;
963
- const rect = target.getBoundingClientRect();
964
- mousePos.value = {
965
- x: event.clientX - rect.left,
966
- y: event.clientY - rect.top
967
- };
1494
+ const target = svgRef.value;
1495
+ if (!target) return;
1496
+ const rect = target.getBoundingClientRect();
1497
+ mousePos.value = {
1498
+ x: event.clientX - rect.left,
1499
+ y: event.clientY - rect.top
1500
+ };
968
1501
  };
969
1502
  const onSvgMouseLeave = () => {
970
- if (isDragging.value) {
971
- isDragging.value = false;
972
- dragStartPx.value = null;
973
- dragEndPx.value = null;
974
- }
975
- onPointLeaveEvent();
1503
+ if (isDragging.value) {
1504
+ isDragging.value = false;
1505
+ dragStartPx.value = null;
1506
+ dragEndPx.value = null;
1507
+ }
1508
+ onPointLeaveEvent();
976
1509
  };
1510
+ /*********************************************************
1511
+ * Zoom / pan interactions
1512
+ *
1513
+ * SVG viewBox follows the measured box (useChartSize). Mouse events
1514
+ * are in DOM pixels; we convert via `getBoundingClientRect()` +
1515
+ * the scale factor between DOM and SVG viewBox dimensions.
1516
+ ********************************************************/
977
1517
  const svgToCategoryIndex = (clientX) => {
978
- const svgEl = svgRef.value;
979
- if (!svgEl) return 0;
980
- const rect = svgEl.getBoundingClientRect();
981
- const domRatio = svgWidth.value / Math.max(1, rect.width);
982
- const svgX = (clientX - rect.left) * domRatio;
983
- return pxToCategoryIndex(svgX, plot.value.x0, plot.value.x1);
1518
+ const svgEl = svgRef.value;
1519
+ if (!svgEl) return 0;
1520
+ const rect = svgEl.getBoundingClientRect();
1521
+ const domRatio = svgWidth.value / Math.max(1, rect.width);
1522
+ const svgX = (clientX - rect.left) * domRatio;
1523
+ return pxToCategoryIndex(svgX, plot.value.x0, plot.value.x1);
984
1524
  };
985
1525
  const onSvgMouseDown = (event) => {
986
- if (!props.zoomable) return;
987
- if (event.button !== 0) return;
988
- if (event.ctrlKey || event.metaKey) {
989
- isDragging.value = false;
990
- dragStartPx.value = event.clientX;
991
- return;
992
- }
993
- isDragging.value = true;
994
- dragStartPx.value = event.clientX;
995
- dragEndPx.value = event.clientX;
996
- const handleMouseMove = (mv) => {
997
- if (!isDragging.value) return;
998
- dragEndPx.value = mv.clientX;
999
- };
1000
- const handleMouseUp = (mu) => {
1001
- window.removeEventListener("mousemove", handleMouseMove);
1002
- window.removeEventListener("mouseup", handleMouseUp);
1003
- if (!isDragging.value) return;
1004
- isDragging.value = false;
1005
- const startIdx = svgToCategoryIndex(dragStartPx.value ?? mu.clientX);
1006
- const endIdx = svgToCategoryIndex(mu.clientX);
1007
- dragStartPx.value = null;
1008
- dragEndPx.value = null;
1009
- const lo = Math.floor(Math.min(startIdx, endIdx));
1010
- const hi = Math.ceil(Math.max(startIdx, endIdx));
1011
- if (hi - lo < 1) return;
1012
- const len = activeCategories.value.length;
1013
- const absLo = zoomStart.value + lo;
1014
- const absHi = Math.min(len - 1, zoomStart.value + hi);
1015
- if (absHi - absLo < 1) return;
1016
- zoomTo(absLo, absHi);
1017
- rangeSelectorActiveIndex.value = -1;
1018
- emit("zoom", { start: absLo, end: absHi });
1019
- };
1020
- window.addEventListener("mousemove", handleMouseMove);
1021
- window.addEventListener("mouseup", handleMouseUp);
1022
- };
1023
- const onSvgMouseUp = (_event) => {
1526
+ if (!props.zoomable) return;
1527
+ if (event.button !== 0) return;
1528
+ if (event.ctrlKey || event.metaKey) {
1529
+ isDragging.value = false;
1530
+ dragStartPx.value = event.clientX;
1531
+ return;
1532
+ }
1533
+ isDragging.value = true;
1534
+ dragStartPx.value = event.clientX;
1535
+ dragEndPx.value = event.clientX;
1536
+ const handleMouseMove = (mv) => {
1537
+ if (!isDragging.value) return;
1538
+ dragEndPx.value = mv.clientX;
1539
+ };
1540
+ const handleMouseUp = (mu) => {
1541
+ window.removeEventListener("mousemove", handleMouseMove);
1542
+ window.removeEventListener("mouseup", handleMouseUp);
1543
+ if (!isDragging.value) return;
1544
+ isDragging.value = false;
1545
+ const startIdx = svgToCategoryIndex(dragStartPx.value ?? mu.clientX);
1546
+ const endIdx = svgToCategoryIndex(mu.clientX);
1547
+ dragStartPx.value = null;
1548
+ dragEndPx.value = null;
1549
+ const lo = Math.floor(Math.min(startIdx, endIdx));
1550
+ const hi = Math.ceil(Math.max(startIdx, endIdx));
1551
+ if (hi - lo < 1) return;
1552
+ const len = activeCategories.value.length;
1553
+ const absLo = zoomStart.value + lo;
1554
+ const absHi = Math.min(len - 1, zoomStart.value + hi);
1555
+ if (absHi - absLo < 1) return;
1556
+ zoomTo(absLo, absHi);
1557
+ rangeSelectorActiveIndex.value = -1;
1558
+ emit("zoom", {
1559
+ start: absLo,
1560
+ end: absHi
1561
+ });
1562
+ };
1563
+ window.addEventListener("mousemove", handleMouseMove);
1564
+ window.addEventListener("mouseup", handleMouseUp);
1024
1565
  };
1566
+ const onSvgMouseUp = (_event) => {};
1025
1567
  const onSvgWheel = (event) => {
1026
- if (!props.zoomable) return;
1027
- if (!event.shiftKey) return;
1028
- event.preventDefault();
1029
- const svgEl = svgRef.value;
1030
- if (!svgEl) return;
1031
- const rect = svgEl.getBoundingClientRect();
1032
- const domRatio = svgWidth.value / Math.max(1, rect.width);
1033
- const svgX = (event.clientX - rect.left) * domRatio;
1034
- const { x0, x1 } = plot.value;
1035
- const plotWidth = Math.max(1, x1 - x0);
1036
- const anchorFraction = Math.max(0, Math.min(1, (svgX - x0) / plotWidth));
1037
- const zoomIn = event.deltaY < 0;
1038
- const delta = zoomIn ? WHEEL_ZOOM_STEP : -WHEEL_ZOOM_STEP;
1039
- zoomBy(delta, anchorFraction);
1040
- rangeSelectorActiveIndex.value = -1;
1041
- emit("zoom", { start: zoomStart.value, end: zoomEnd.value });
1568
+ if (!props.zoomable) return;
1569
+ if (!event.shiftKey) return;
1570
+ event.preventDefault();
1571
+ const svgEl = svgRef.value;
1572
+ if (!svgEl) return;
1573
+ const rect = svgEl.getBoundingClientRect();
1574
+ const domRatio = svgWidth.value / Math.max(1, rect.width);
1575
+ const svgX = (event.clientX - rect.left) * domRatio;
1576
+ const { x0, x1 } = plot.value;
1577
+ const plotWidth = Math.max(1, x1 - x0);
1578
+ const anchorFraction = Math.max(0, Math.min(1, (svgX - x0) / plotWidth));
1579
+ const zoomIn = event.deltaY < 0;
1580
+ const delta = zoomIn ? WHEEL_ZOOM_STEP : -WHEEL_ZOOM_STEP;
1581
+ zoomBy(delta, anchorFraction);
1582
+ rangeSelectorActiveIndex.value = -1;
1583
+ emit("zoom", {
1584
+ start: zoomStart.value,
1585
+ end: zoomEnd.value
1586
+ });
1042
1587
  };
1043
1588
  const onZoomReset = () => {
1044
- zoomResetState();
1045
- rangeSelectorActiveIndex.value = -1;
1046
- emit("reset-zoom");
1589
+ zoomResetState();
1590
+ rangeSelectorActiveIndex.value = -1;
1591
+ emit("reset-zoom");
1047
1592
  };
1048
1593
  const dragSelectionRect = computed(() => {
1049
- if (!isDragging.value || dragStartPx.value === null || dragEndPx.value === null) return null;
1050
- const svgEl = svgRef.value;
1051
- if (!svgEl) return null;
1052
- const rect = svgEl.getBoundingClientRect();
1053
- const domRatio = svgWidth.value / Math.max(1, rect.width);
1054
- const startSvgX = (dragStartPx.value - rect.left) * domRatio;
1055
- const endSvgX = (dragEndPx.value - rect.left) * domRatio;
1056
- const { x0, x1, y0, y1 } = plot.value;
1057
- const left = Math.max(x0, Math.min(x1, Math.min(startSvgX, endSvgX)));
1058
- const right = Math.max(x0, Math.min(x1, Math.max(startSvgX, endSvgX)));
1059
- const width = right - left;
1060
- if (width < 1) return null;
1061
- return { x: left, y: y0, width, height: y1 - y0 };
1594
+ if (!isDragging.value || dragStartPx.value === null || dragEndPx.value === null) return null;
1595
+ const svgEl = svgRef.value;
1596
+ if (!svgEl) return null;
1597
+ const rect = svgEl.getBoundingClientRect();
1598
+ const domRatio = svgWidth.value / Math.max(1, rect.width);
1599
+ const startSvgX = (dragStartPx.value - rect.left) * domRatio;
1600
+ const endSvgX = (dragEndPx.value - rect.left) * domRatio;
1601
+ const { x0, x1, y0, y1 } = plot.value;
1602
+ const left = Math.max(x0, Math.min(x1, Math.min(startSvgX, endSvgX)));
1603
+ const right = Math.max(x0, Math.min(x1, Math.max(startSvgX, endSvgX)));
1604
+ const width = right - left;
1605
+ if (width < 1) return null;
1606
+ return {
1607
+ x: left,
1608
+ y: y0,
1609
+ width,
1610
+ height: y1 - y0
1611
+ };
1062
1612
  });
1063
1613
  const onPointActivate = (path, event) => {
1064
- if (!hoveredPoint.value || hoveredPath.value !== path) {
1065
- hoveredPath.value = path;
1066
- }
1067
- if (!hoveredPoint.value) return;
1068
- const currentPoint = hoveredPoint.value;
1069
- if (hasDrilldown.value) {
1070
- const dataIdx = path.dataIndex ?? 0;
1071
- const entry = path.series.data[dataIdx];
1072
- const drillLink = typeof entry !== "number" ? entry.drilldown : void 0;
1073
- if (drillLink) {
1074
- onDrillIn(drillLink, currentPoint);
1075
- return;
1076
- }
1077
- }
1078
- emit("point-click", currentPoint, event);
1614
+ if (!hoveredPoint.value || hoveredPath.value !== path) {
1615
+ hoveredPath.value = path;
1616
+ }
1617
+ if (!hoveredPoint.value) return;
1618
+ const currentPoint = hoveredPoint.value;
1619
+ if (hasDrilldown.value) {
1620
+ const dataIdx = path.dataIndex ?? 0;
1621
+ const entry = path.series.data[dataIdx];
1622
+ const drillLink = typeof entry !== "number" ? entry.drilldown : undefined;
1623
+ if (drillLink) {
1624
+ onDrillIn(drillLink, currentPoint);
1625
+ return;
1626
+ }
1627
+ }
1628
+ emit("point-click", currentPoint, event);
1079
1629
  };
1080
1630
  const onLegendClick = (series, index) => {
1081
- emit("legend-click", series, index);
1631
+ emit("legend-click", series, index);
1082
1632
  };
1083
1633
  const onSeriesToggle = (series, nextVisible) => {
1084
- series.visible = nextVisible;
1085
- emit("series-toggle", series, nextVisible);
1634
+ series.visible = nextVisible;
1635
+ emit("series-toggle", series, nextVisible);
1086
1636
  };
1637
+ /*********************************************************
1638
+ * ARIA
1639
+ *
1640
+ * @description
1641
+ * `svgDesc` compose DEUX comptes INDEPENDANTS — les series et les points.
1642
+ * Une seule cle pluralisee ne peut pas les accorder tous les deux : la
1643
+ * forme est choisie sur UN compte, et l'autre suit la mauvaise categorie.
1644
+ * Mesure en `fr` avec 1 serie et 5 points, la cle unique selectionnait
1645
+ * `desc_other` et rendait « avec 1 series et 5 points » ; avec 3 series et
1646
+ * 1 point elle rendait « avec 3 serie et 1 point ».
1647
+ * @description
1648
+ * Invisible en `en`, ou « series » est invariable — c'est pourquoi le
1649
+ * defaut a franchi la revue de #610. Chaque compte est donc resolu par son
1650
+ * PROPRE appel a `t()`, puis la chaine porteuse recoit les fragments deja
1651
+ * resolus en simple substitution : la couche i18n n'a rien a composer.
1652
+ * Meme patron que radar / streamgraph / sankey ; les composants a un seul
1653
+ * compte (variwide) gardent la forme simple `desc_one` / `desc_other`.
1654
+ ********************************************************/
1087
1655
  const ariaLabel = computed(() => props.title ?? t("origam.chart.aria_label"));
1088
1656
  const svgAriaLabel = computed(() => props.title ?? t("origam.chart.cartesian.aria_label", { type: props.type }));
1089
1657
  const svgTitle = computed(() => props.title ?? t("origam.chart.cartesian.aria_label", { type: props.type }));
1090
1658
  const svgDesc = computed(() => {
1091
- const seriesCount = activeSeries.value.length;
1092
- if (!seriesCount) return t("origam.chart.desc_no_data");
1093
- const range = yRange.value;
1094
- const points = slotCount.value;
1095
- return t("origam.chart.cartesian.desc", {
1096
- type: props.type,
1097
- series: t("origam.chart.cartesian.desc_series", seriesCount, { count: seriesCount }),
1098
- points: t("origam.chart.cartesian.desc_points", points, { count: points }),
1099
- min: range.min,
1100
- max: range.max
1101
- });
1659
+ const seriesCount = activeSeries.value.length;
1660
+ if (!seriesCount) return t("origam.chart.desc_no_data");
1661
+ const range = yRange.value;
1662
+ const points = slotCount.value;
1663
+ return t("origam.chart.cartesian.desc", {
1664
+ type: props.type,
1665
+ series: t("origam.chart.cartesian.desc_series", seriesCount, { count: seriesCount }),
1666
+ points: t("origam.chart.cartesian.desc_points", points, { count: points }),
1667
+ min: range.min,
1668
+ max: range.max
1669
+ });
1102
1670
  });
1103
1671
  const pointAriaLabel = (path) => {
1104
- const dataIdx = path.dataIndex ?? 0;
1105
- const absIdx = zoomStart.value + dataIdx;
1106
- const entry = path.series.data[absIdx] ?? path.series.data[dataIdx];
1107
- const y = typeof entry === "number" ? entry : entry.y;
1108
- const cat = visibleCategories.value[dataIdx] ?? activeCategories.value[absIdx] ?? absIdx;
1109
- const isPercent = effectiveStacking.value === "percent" && props.stacked;
1110
- if (isPercent) {
1111
- const pct = percentValues.value.get(path.seriesIndex)?.[dataIdx] ?? 0;
1112
- return `${path.series.name}, ${cat}: ${formatY(y)} (${pct.toFixed(1)}%)`;
1113
- }
1114
- return `${path.series.name}, ${cat}: ${formatY(y)}`;
1672
+ const dataIdx = path.dataIndex ?? 0;
1673
+ const absIdx = zoomStart.value + dataIdx;
1674
+ const entry = path.series.data[absIdx] ?? path.series.data[dataIdx];
1675
+ const y = typeof entry === "number" ? entry : entry.y;
1676
+ const cat = visibleCategories.value[dataIdx] ?? activeCategories.value[absIdx] ?? absIdx;
1677
+ const isPercent = effectiveStacking.value === "percent" && props.stacked;
1678
+ if (isPercent) {
1679
+ const pct = percentValues.value.get(path.seriesIndex)?.[dataIdx] ?? 0;
1680
+ return `${path.series.name}, ${cat}: ${formatY(y)} (${pct.toFixed(1)}%)`;
1681
+ }
1682
+ return `${path.series.name}, ${cat}: ${formatY(y)}`;
1115
1683
  };
1116
1684
  </script>
1117
1685