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
@@ -242,12 +242,7 @@
242
242
  </template>
243
243
 
244
244
  <script lang="ts" setup>
245
- import {
246
- computed,
247
- nextTick,
248
- ref,
249
- watch
250
- } from "vue";
245
+ import { computed, nextTick, ref, watch } from "vue";
251
246
  import { OrigamIcon } from "../Icon";
252
247
  import { OrigamList, OrigamListItem } from "../List";
253
248
  import { OrigamMediaController } from "../Media";
@@ -269,439 +264,1371 @@ import { shouldSuppressAutoplay } from "../../composables/Media/use-media-player
269
264
  import { UNSEEDED } from "../../consts/Commons/vmodel.const";
270
265
  import { MDI_ICONS } from "../../enums/Commons/mdi.enum";
271
266
  import { formatMediaTime } from "../../utils/Media/format-time.util";
267
+ /*********************************************************
268
+ * Global
269
+ *
270
+ * @description
271
+ * Stemtracks studio strip: cover (left/right) + body column with
272
+ * a metadata header, a waveform mini scrubber, and a transport
273
+ * `<nav>` row. The body is a CSS grid composed entirely from atomic
274
+ * media components — `<OrigamMediaController>` is intentionally NOT
275
+ * used here so the audio shell can ship its own transport layout.
276
+ *
277
+ * Defaults are inlined here (not pulled from a constant object)
278
+ * because the Vue SFC compiler analyses `withDefaults` statically
279
+ * and only resolves literal values — cf. CLAUDE.md rule.
280
+ ********************************************************/
272
281
  const { t } = useLocale();
273
282
  const props = defineProps({
274
- variant: { type: null, required: false, default: "expanded" },
275
- coverPosition: { type: null, required: false, default: "left" },
276
- src: { type: [String, Object, Array], required: true },
277
- tracks: { type: Array, required: false, default: () => [] },
278
- title: { type: String, required: false, default: void 0 },
279
- artist: { type: String, required: false, default: void 0 },
280
- album: { type: String, required: false, default: void 0 },
281
- cover: { type: [String, Object], required: false, default: void 0 },
282
- waveform: { type: [Boolean, String], required: false, default: false },
283
- waveformColor: { type: String, required: false, default: "currentColor" },
284
- autoplay: { type: Boolean, required: false, default: false },
285
- muted: { type: Boolean, required: false, default: false },
286
- loop: { type: Boolean, required: false, default: false },
287
- loopMode: { type: null, required: false, default: "none" },
288
- shuffle: { type: Boolean, required: false, default: false },
289
- playlist: { type: Array, required: false, default: void 0 },
290
- currentTrackIndex: { type: Number, required: false, default: 0 },
291
- preload: { type: String, required: false, default: "metadata" },
292
- crossorigin: { type: String, required: false, default: void 0 },
293
- controls: { type: null, required: false, default: "custom" },
294
- playbackRates: { type: Array, required: false, default: () => [0.5, 0.75, 1, 1.25, 1.5, 2] },
295
- playbackRate: { type: Number, required: false, default: 1 },
296
- allowRemotePlayback: { type: Boolean, required: false, default: false },
297
- downloadable: { type: Boolean, required: false, default: false },
298
- downloadFilename: { type: String, required: false, default: void 0 },
299
- id: { type: String, required: false },
300
- class: { type: [String, Array, Object], required: false },
301
- style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
302
- tag: { type: String, required: false, default: "article" },
303
- rounded: { type: [Boolean, Number, String, null], required: false, skipCheck: true },
304
- roundedTopRight: { type: [Boolean, Number, String], required: false },
305
- roundedTopLeft: { type: [Boolean, Number, String], required: false },
306
- roundedBottomLeft: { type: [Boolean, Number, String], required: false },
307
- roundedBottomRight: { type: [Boolean, Number, String], required: false },
308
- roundedStartStart: { type: [Boolean, Number, String], required: false },
309
- roundedStartEnd: { type: [Boolean, Number, String], required: false },
310
- roundedEndStart: { type: [Boolean, Number, String], required: false },
311
- roundedEndEnd: { type: [Boolean, Number, String], required: false },
312
- border: { type: [Boolean, Number, String, Array], required: false, skipCheck: true },
313
- borderTop: { type: [Boolean, Number, String], required: false },
314
- borderLeft: { type: [Boolean, Number, String], required: false },
315
- borderBottom: { type: [Boolean, Number, String], required: false },
316
- borderRight: { type: [Boolean, Number, String], required: false },
317
- borderBlock: { type: [Boolean, Number, String], required: false },
318
- borderInline: { type: [Boolean, Number, String], required: false },
319
- borderInlineStart: { type: [Boolean, Number, String], required: false },
320
- borderInlineEnd: { type: [Boolean, Number, String], required: false },
321
- borderBlockStart: { type: [Boolean, Number, String], required: false },
322
- borderBlockEnd: { type: [Boolean, Number, String], required: false },
323
- borderColor: { type: String, required: false },
324
- borderStyle: { type: String, required: false },
325
- borderTopColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
326
- borderRightColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
327
- borderBottomColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
328
- borderLeftColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
329
- borderInlineStartColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
330
- borderInlineEndColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
331
- borderBlockStartColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
332
- borderBlockEndColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
333
- height: { type: [Number, String], required: false },
334
- maxHeight: { type: [Number, String], required: false },
335
- maxWidth: { type: [Number, String], required: false },
336
- minHeight: { type: [Number, String], required: false },
337
- minWidth: { type: [Number, String], required: false },
338
- width: { type: [Number, String], required: false },
339
- margin: { type: [Boolean, Number, String], required: false },
340
- marginTop: { type: [Boolean, Number, String], required: false },
341
- marginLeft: { type: [Boolean, Number, String], required: false },
342
- marginBottom: { type: [Boolean, Number, String], required: false },
343
- marginRight: { type: [Boolean, Number, String], required: false },
344
- marginBlock: { type: [Boolean, Number, String], required: false },
345
- marginInline: { type: [Boolean, Number, String], required: false },
346
- marginInlineStart: { type: [Boolean, Number, String], required: false },
347
- marginInlineEnd: { type: [Boolean, Number, String], required: false },
348
- marginBlockStart: { type: [Boolean, Number, String], required: false },
349
- marginBlockEnd: { type: [Boolean, Number, String], required: false },
350
- padding: { type: [Boolean, Number, String], required: false },
351
- paddingTop: { type: [Boolean, Number, String], required: false },
352
- paddingLeft: { type: [Boolean, Number, String], required: false },
353
- paddingBottom: { type: [Boolean, Number, String], required: false },
354
- paddingRight: { type: [Boolean, Number, String], required: false },
355
- paddingBlock: { type: [Boolean, Number, String], required: false },
356
- paddingInline: { type: [Boolean, Number, String], required: false },
357
- paddingInlineStart: { type: [Boolean, Number, String], required: false },
358
- paddingInlineEnd: { type: [Boolean, Number, String], required: false },
359
- paddingBlockStart: { type: [Boolean, Number, String], required: false },
360
- paddingBlockEnd: { type: [Boolean, Number, String], required: false },
361
- elevation: { type: [Number, String], required: false },
362
- position: { type: null, required: false, default: "relative" },
363
- top: { type: [Number, String], required: false, default: void 0 },
364
- bottom: { type: [Number, String], required: false, default: void 0 },
365
- left: { type: [Number, String], required: false, default: void 0 },
366
- right: { type: [Number, String], required: false, default: void 0 },
367
- color: { type: [String, Object, Boolean, null], required: false, skipCheck: true, default: void 0 },
368
- bgColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true, default: void 0 },
369
- fontSize: { type: null, required: false },
370
- fontWeight: { type: null, required: false },
371
- lineHeight: { type: null, required: false }
283
+ variant: {
284
+ type: null,
285
+ required: false,
286
+ default: "expanded"
287
+ },
288
+ coverPosition: {
289
+ type: null,
290
+ required: false,
291
+ default: "left"
292
+ },
293
+ src: {
294
+ type: [
295
+ String,
296
+ Object,
297
+ Array
298
+ ],
299
+ required: true
300
+ },
301
+ tracks: {
302
+ type: Array,
303
+ required: false,
304
+ default: () => []
305
+ },
306
+ title: {
307
+ type: String,
308
+ required: false,
309
+ default: undefined
310
+ },
311
+ artist: {
312
+ type: String,
313
+ required: false,
314
+ default: undefined
315
+ },
316
+ album: {
317
+ type: String,
318
+ required: false,
319
+ default: undefined
320
+ },
321
+ cover: {
322
+ type: [String, Object],
323
+ required: false,
324
+ default: undefined
325
+ },
326
+ waveform: {
327
+ type: [Boolean, String],
328
+ required: false,
329
+ default: false
330
+ },
331
+ waveformColor: {
332
+ type: String,
333
+ required: false,
334
+ default: "currentColor"
335
+ },
336
+ autoplay: {
337
+ type: Boolean,
338
+ required: false,
339
+ default: false
340
+ },
341
+ muted: {
342
+ type: Boolean,
343
+ required: false,
344
+ default: false
345
+ },
346
+ loop: {
347
+ type: Boolean,
348
+ required: false,
349
+ default: false
350
+ },
351
+ loopMode: {
352
+ type: null,
353
+ required: false,
354
+ default: "none"
355
+ },
356
+ shuffle: {
357
+ type: Boolean,
358
+ required: false,
359
+ default: false
360
+ },
361
+ playlist: {
362
+ type: Array,
363
+ required: false,
364
+ default: undefined
365
+ },
366
+ currentTrackIndex: {
367
+ type: Number,
368
+ required: false,
369
+ default: 0
370
+ },
371
+ preload: {
372
+ type: String,
373
+ required: false,
374
+ default: "metadata"
375
+ },
376
+ crossorigin: {
377
+ type: String,
378
+ required: false,
379
+ default: undefined
380
+ },
381
+ controls: {
382
+ type: null,
383
+ required: false,
384
+ default: "custom"
385
+ },
386
+ playbackRates: {
387
+ type: Array,
388
+ required: false,
389
+ default: () => [
390
+ .5,
391
+ .75,
392
+ 1,
393
+ 1.25,
394
+ 1.5,
395
+ 2
396
+ ]
397
+ },
398
+ playbackRate: {
399
+ type: Number,
400
+ required: false,
401
+ default: 1
402
+ },
403
+ allowRemotePlayback: {
404
+ type: Boolean,
405
+ required: false,
406
+ default: false
407
+ },
408
+ downloadable: {
409
+ type: Boolean,
410
+ required: false,
411
+ default: false
412
+ },
413
+ downloadFilename: {
414
+ type: String,
415
+ required: false,
416
+ default: undefined
417
+ },
418
+ id: {
419
+ type: String,
420
+ required: false
421
+ },
422
+ class: {
423
+ type: [
424
+ String,
425
+ Array,
426
+ Object
427
+ ],
428
+ required: false
429
+ },
430
+ style: {
431
+ type: [
432
+ String,
433
+ Array,
434
+ Object,
435
+ Boolean,
436
+ null
437
+ ],
438
+ required: false,
439
+ skipCheck: true
440
+ },
441
+ tag: {
442
+ type: String,
443
+ required: false,
444
+ default: "article"
445
+ },
446
+ rounded: {
447
+ type: [
448
+ Boolean,
449
+ Number,
450
+ String,
451
+ null
452
+ ],
453
+ required: false,
454
+ skipCheck: true
455
+ },
456
+ roundedTopRight: {
457
+ type: [
458
+ Boolean,
459
+ Number,
460
+ String
461
+ ],
462
+ required: false
463
+ },
464
+ roundedTopLeft: {
465
+ type: [
466
+ Boolean,
467
+ Number,
468
+ String
469
+ ],
470
+ required: false
471
+ },
472
+ roundedBottomLeft: {
473
+ type: [
474
+ Boolean,
475
+ Number,
476
+ String
477
+ ],
478
+ required: false
479
+ },
480
+ roundedBottomRight: {
481
+ type: [
482
+ Boolean,
483
+ Number,
484
+ String
485
+ ],
486
+ required: false
487
+ },
488
+ roundedStartStart: {
489
+ type: [
490
+ Boolean,
491
+ Number,
492
+ String
493
+ ],
494
+ required: false
495
+ },
496
+ roundedStartEnd: {
497
+ type: [
498
+ Boolean,
499
+ Number,
500
+ String
501
+ ],
502
+ required: false
503
+ },
504
+ roundedEndStart: {
505
+ type: [
506
+ Boolean,
507
+ Number,
508
+ String
509
+ ],
510
+ required: false
511
+ },
512
+ roundedEndEnd: {
513
+ type: [
514
+ Boolean,
515
+ Number,
516
+ String
517
+ ],
518
+ required: false
519
+ },
520
+ border: {
521
+ type: [
522
+ Boolean,
523
+ Number,
524
+ String,
525
+ Array
526
+ ],
527
+ required: false,
528
+ skipCheck: true
529
+ },
530
+ borderTop: {
531
+ type: [
532
+ Boolean,
533
+ Number,
534
+ String
535
+ ],
536
+ required: false
537
+ },
538
+ borderLeft: {
539
+ type: [
540
+ Boolean,
541
+ Number,
542
+ String
543
+ ],
544
+ required: false
545
+ },
546
+ borderBottom: {
547
+ type: [
548
+ Boolean,
549
+ Number,
550
+ String
551
+ ],
552
+ required: false
553
+ },
554
+ borderRight: {
555
+ type: [
556
+ Boolean,
557
+ Number,
558
+ String
559
+ ],
560
+ required: false
561
+ },
562
+ borderBlock: {
563
+ type: [
564
+ Boolean,
565
+ Number,
566
+ String
567
+ ],
568
+ required: false
569
+ },
570
+ borderInline: {
571
+ type: [
572
+ Boolean,
573
+ Number,
574
+ String
575
+ ],
576
+ required: false
577
+ },
578
+ borderInlineStart: {
579
+ type: [
580
+ Boolean,
581
+ Number,
582
+ String
583
+ ],
584
+ required: false
585
+ },
586
+ borderInlineEnd: {
587
+ type: [
588
+ Boolean,
589
+ Number,
590
+ String
591
+ ],
592
+ required: false
593
+ },
594
+ borderBlockStart: {
595
+ type: [
596
+ Boolean,
597
+ Number,
598
+ String
599
+ ],
600
+ required: false
601
+ },
602
+ borderBlockEnd: {
603
+ type: [
604
+ Boolean,
605
+ Number,
606
+ String
607
+ ],
608
+ required: false
609
+ },
610
+ borderColor: {
611
+ type: String,
612
+ required: false
613
+ },
614
+ borderStyle: {
615
+ type: String,
616
+ required: false
617
+ },
618
+ borderTopColor: {
619
+ type: [
620
+ String,
621
+ Object,
622
+ Boolean,
623
+ null
624
+ ],
625
+ required: false,
626
+ skipCheck: true
627
+ },
628
+ borderRightColor: {
629
+ type: [
630
+ String,
631
+ Object,
632
+ Boolean,
633
+ null
634
+ ],
635
+ required: false,
636
+ skipCheck: true
637
+ },
638
+ borderBottomColor: {
639
+ type: [
640
+ String,
641
+ Object,
642
+ Boolean,
643
+ null
644
+ ],
645
+ required: false,
646
+ skipCheck: true
647
+ },
648
+ borderLeftColor: {
649
+ type: [
650
+ String,
651
+ Object,
652
+ Boolean,
653
+ null
654
+ ],
655
+ required: false,
656
+ skipCheck: true
657
+ },
658
+ borderInlineStartColor: {
659
+ type: [
660
+ String,
661
+ Object,
662
+ Boolean,
663
+ null
664
+ ],
665
+ required: false,
666
+ skipCheck: true
667
+ },
668
+ borderInlineEndColor: {
669
+ type: [
670
+ String,
671
+ Object,
672
+ Boolean,
673
+ null
674
+ ],
675
+ required: false,
676
+ skipCheck: true
677
+ },
678
+ borderBlockStartColor: {
679
+ type: [
680
+ String,
681
+ Object,
682
+ Boolean,
683
+ null
684
+ ],
685
+ required: false,
686
+ skipCheck: true
687
+ },
688
+ borderBlockEndColor: {
689
+ type: [
690
+ String,
691
+ Object,
692
+ Boolean,
693
+ null
694
+ ],
695
+ required: false,
696
+ skipCheck: true
697
+ },
698
+ height: {
699
+ type: [Number, String],
700
+ required: false
701
+ },
702
+ maxHeight: {
703
+ type: [Number, String],
704
+ required: false
705
+ },
706
+ maxWidth: {
707
+ type: [Number, String],
708
+ required: false
709
+ },
710
+ minHeight: {
711
+ type: [Number, String],
712
+ required: false
713
+ },
714
+ minWidth: {
715
+ type: [Number, String],
716
+ required: false
717
+ },
718
+ width: {
719
+ type: [Number, String],
720
+ required: false
721
+ },
722
+ margin: {
723
+ type: [
724
+ Boolean,
725
+ Number,
726
+ String
727
+ ],
728
+ required: false
729
+ },
730
+ marginTop: {
731
+ type: [
732
+ Boolean,
733
+ Number,
734
+ String
735
+ ],
736
+ required: false
737
+ },
738
+ marginLeft: {
739
+ type: [
740
+ Boolean,
741
+ Number,
742
+ String
743
+ ],
744
+ required: false
745
+ },
746
+ marginBottom: {
747
+ type: [
748
+ Boolean,
749
+ Number,
750
+ String
751
+ ],
752
+ required: false
753
+ },
754
+ marginRight: {
755
+ type: [
756
+ Boolean,
757
+ Number,
758
+ String
759
+ ],
760
+ required: false
761
+ },
762
+ marginBlock: {
763
+ type: [
764
+ Boolean,
765
+ Number,
766
+ String
767
+ ],
768
+ required: false
769
+ },
770
+ marginInline: {
771
+ type: [
772
+ Boolean,
773
+ Number,
774
+ String
775
+ ],
776
+ required: false
777
+ },
778
+ marginInlineStart: {
779
+ type: [
780
+ Boolean,
781
+ Number,
782
+ String
783
+ ],
784
+ required: false
785
+ },
786
+ marginInlineEnd: {
787
+ type: [
788
+ Boolean,
789
+ Number,
790
+ String
791
+ ],
792
+ required: false
793
+ },
794
+ marginBlockStart: {
795
+ type: [
796
+ Boolean,
797
+ Number,
798
+ String
799
+ ],
800
+ required: false
801
+ },
802
+ marginBlockEnd: {
803
+ type: [
804
+ Boolean,
805
+ Number,
806
+ String
807
+ ],
808
+ required: false
809
+ },
810
+ padding: {
811
+ type: [
812
+ Boolean,
813
+ Number,
814
+ String
815
+ ],
816
+ required: false
817
+ },
818
+ paddingTop: {
819
+ type: [
820
+ Boolean,
821
+ Number,
822
+ String
823
+ ],
824
+ required: false
825
+ },
826
+ paddingLeft: {
827
+ type: [
828
+ Boolean,
829
+ Number,
830
+ String
831
+ ],
832
+ required: false
833
+ },
834
+ paddingBottom: {
835
+ type: [
836
+ Boolean,
837
+ Number,
838
+ String
839
+ ],
840
+ required: false
841
+ },
842
+ paddingRight: {
843
+ type: [
844
+ Boolean,
845
+ Number,
846
+ String
847
+ ],
848
+ required: false
849
+ },
850
+ paddingBlock: {
851
+ type: [
852
+ Boolean,
853
+ Number,
854
+ String
855
+ ],
856
+ required: false
857
+ },
858
+ paddingInline: {
859
+ type: [
860
+ Boolean,
861
+ Number,
862
+ String
863
+ ],
864
+ required: false
865
+ },
866
+ paddingInlineStart: {
867
+ type: [
868
+ Boolean,
869
+ Number,
870
+ String
871
+ ],
872
+ required: false
873
+ },
874
+ paddingInlineEnd: {
875
+ type: [
876
+ Boolean,
877
+ Number,
878
+ String
879
+ ],
880
+ required: false
881
+ },
882
+ paddingBlockStart: {
883
+ type: [
884
+ Boolean,
885
+ Number,
886
+ String
887
+ ],
888
+ required: false
889
+ },
890
+ paddingBlockEnd: {
891
+ type: [
892
+ Boolean,
893
+ Number,
894
+ String
895
+ ],
896
+ required: false
897
+ },
898
+ elevation: {
899
+ type: [Number, String],
900
+ required: false
901
+ },
902
+ position: {
903
+ type: null,
904
+ required: false,
905
+ default: "relative"
906
+ },
907
+ top: {
908
+ type: [Number, String],
909
+ required: false,
910
+ default: undefined
911
+ },
912
+ bottom: {
913
+ type: [Number, String],
914
+ required: false,
915
+ default: undefined
916
+ },
917
+ left: {
918
+ type: [Number, String],
919
+ required: false,
920
+ default: undefined
921
+ },
922
+ right: {
923
+ type: [Number, String],
924
+ required: false,
925
+ default: undefined
926
+ },
927
+ color: {
928
+ type: [
929
+ String,
930
+ Object,
931
+ Boolean,
932
+ null
933
+ ],
934
+ required: false,
935
+ skipCheck: true,
936
+ default: undefined
937
+ },
938
+ bgColor: {
939
+ type: [
940
+ String,
941
+ Object,
942
+ Boolean,
943
+ null
944
+ ],
945
+ required: false,
946
+ skipCheck: true,
947
+ default: undefined
948
+ },
949
+ fontSize: {
950
+ type: null,
951
+ required: false
952
+ },
953
+ fontWeight: {
954
+ type: null,
955
+ required: false
956
+ },
957
+ lineHeight: {
958
+ type: null,
959
+ required: false
960
+ }
372
961
  });
373
- const emit = defineEmits(["play", "pause", "ended", "timeupdate", "volumechange", "loadedmetadata", "error", "update:playbackRate", "download", "waveform", "previous", "next", "update:currentTrackIndex", "update:loopMode", "update:shuffle", "track-change"]);
962
+ const emit = defineEmits([
963
+ "play",
964
+ "pause",
965
+ "ended",
966
+ "timeupdate",
967
+ "volumechange",
968
+ "loadedmetadata",
969
+ "error",
970
+ "update:playbackRate",
971
+ "download",
972
+ "waveform",
973
+ "previous",
974
+ "next",
975
+ "update:currentTrackIndex",
976
+ "update:loopMode",
977
+ "update:shuffle",
978
+ "track-change"
979
+ ]);
374
980
  defineSlots();
981
+ /*********************************************************
982
+ * Icon refs — single source of truth for the transport + status
983
+ * glyphs. Inlined as a const object so the template only sees
984
+ * literal references (CLAUDE.md "no logic in templates" rule).
985
+ ********************************************************/
375
986
  const ICONS = {
376
- LOADING: MDI_ICONS.LOADING,
377
- ALERT: MDI_ICONS.ALERT_CIRCLE
987
+ LOADING: MDI_ICONS.LOADING,
988
+ ALERT: MDI_ICONS.ALERT_CIRCLE
378
989
  };
990
+ /*********************************************************
991
+ * i18n labels — only the ones used by OrigamAudio's own
992
+ * overlays / scrubber aria-label. Every transport label
993
+ * (play, pause, mute, volume, prev, next, loop, shuffle,
994
+ * cast, settings, speed, quality, download, normal-speed,
995
+ * transport) lives inside `<origam-media-controller>` and
996
+ * resolves there directly.
997
+ ********************************************************/
379
998
  const waveformAriaLabel = computed(() => t("origam.media.seek"));
380
999
  const loadingLabel = computed(() => t("origam.loading"));
1000
+ /*********************************************************
1001
+ * trackTitle — #436 (C8)
1002
+ *
1003
+ * @description
1004
+ * A playlist entry without a `title` used to fall back to the
1005
+ * template literal `Track ${ index + 1 }` — an English string
1006
+ * rendered verbatim under every locale, and a computation inside
1007
+ * the template. It now resolves `origam.audio.track_number`
1008
+ * (`"Track {0}"` / `"Piste {0}"`), interpolated positionally by
1009
+ * the builtin locale adapter.
1010
+ ********************************************************/
381
1011
  function trackTitle(track, index) {
382
- return track.title ?? t("origam.audio.track_number", index + 1);
1012
+ return track.title ?? t("origam.audio.track_number", index + 1);
383
1013
  }
1014
+ /*********************************************************
1015
+ * Resolved autoplay / muted — autoplay is suppressed when the user
1016
+ * prefers reduced motion (a11y), and the browser requires muted=true
1017
+ * for unattended playback in most cases.
1018
+ ********************************************************/
384
1019
  const resolvedAutoplay = computed(() => {
385
- if (!props.autoplay) return false;
386
- if (shouldSuppressAutoplay()) return false;
387
- return true;
1020
+ if (!props.autoplay) return false;
1021
+ if (shouldSuppressAutoplay()) return false;
1022
+ return true;
388
1023
  });
389
1024
  const resolvedMuted = computed(() => {
390
- if (props.muted) return true;
391
- if (resolvedAutoplay.value) return true;
392
- return false;
1025
+ if (props.muted) return true;
1026
+ if (resolvedAutoplay.value) return true;
1027
+ return false;
393
1028
  });
1029
+ /*********************************************************
1030
+ * Controls strategy — drives both the native `controls` attribute
1031
+ * on the `<audio>` AND the conditional render of the custom
1032
+ * Stemtracks body.
1033
+ ********************************************************/
394
1034
  const isCustomControls = computed(() => props.controls === "custom");
395
1035
  const isNativeControls = computed(() => props.controls === "native");
1036
+ /*********************************************************
1037
+ * Variant normalisation — accept the legacy `'normal' | 'minimal'`
1038
+ * aliases as well as the canonical `'expanded' | 'compact'` values
1039
+ * so the brief swap is non-breaking for v0.x consumers.
1040
+ ********************************************************/
396
1041
  const isCompactVariant = computed(() => {
397
- return props.variant === "compact" || props.variant === "minimal";
1042
+ return props.variant === "compact" || props.variant === "minimal";
398
1043
  });
399
1044
  const isExpandedVariant = computed(() => !isCompactVariant.value);
1045
+ /*********************************************************
1046
+ * Playlist state machine
1047
+ *
1048
+ * @description
1049
+ * When `playlist` is set, the active track drives the
1050
+ * `<audio>` source AND the metadata strip. The component owns
1051
+ * an internal `currentTrackIndex` ref that v-models against the
1052
+ * parent so consumers can either read it or control it externally.
1053
+ *
1054
+ * Shuffle mode picks a new track uniformly at random from the
1055
+ * full playlist at EACH navigation event (prev / next / auto-
1056
+ * advance on `ended`). Same track twice in a row is allowed —
1057
+ * it's true randomness, not a pre-computed permutation. To avoid
1058
+ * "stuck on the same track" feeling on small playlists, we
1059
+ * retry once when the picked index matches the current track and
1060
+ * the playlist has more than one entry.
1061
+ ********************************************************/
400
1062
  const hasPlaylist = computed(() => Array.isArray(props.playlist) && props.playlist.length > 0);
1063
+ /*********************************************************
1064
+ * `internalTrackIndex` — #661, same ADR-005 trap as `loopMode` /
1065
+ * `shuffle` (#648) just above: seeding `ref(props.currentTrackIndex
1066
+ * ?? 0)` reads `props.currentTrackIndex` eagerly in the body of
1067
+ * `setup()`, before the theme resolver has a chance to write a
1068
+ * theme default for `origam-audio`'s `currentTrackIndex` prop (it
1069
+ * patches `instance.props` in `beforeCreate`, which Vue runs AFTER
1070
+ * `setup()`). Seed `UNSEEDED` and resolve the legacy-aware default
1071
+ * LAZILY via `resolvedTrackIndex` instead.
1072
+ ********************************************************/
401
1073
  const internalTrackIndex = ref(UNSEEDED);
402
1074
  watch(() => props.currentTrackIndex, (next) => {
403
- if (typeof next === "number" && next !== internalTrackIndex.value) {
404
- internalTrackIndex.value = next;
405
- }
1075
+ if (typeof next === "number" && next !== internalTrackIndex.value) {
1076
+ internalTrackIndex.value = next;
1077
+ }
406
1078
  });
407
- const resolvedTrackIndex = computed(
408
- () => internalTrackIndex.value === UNSEEDED ? props.currentTrackIndex ?? 0 : internalTrackIndex.value
409
- );
1079
+ const resolvedTrackIndex = computed(() => internalTrackIndex.value === UNSEEDED ? props.currentTrackIndex ?? 0 : internalTrackIndex.value);
410
1080
  const safeTrackIndex = computed(() => {
411
- if (!hasPlaylist.value) return 0;
412
- const total = props.playlist.length;
413
- if (total === 0) return 0;
414
- const i = resolvedTrackIndex.value;
415
- return (i % total + total) % total;
1081
+ if (!hasPlaylist.value) return 0;
1082
+ const total = props.playlist.length;
1083
+ if (total === 0) return 0;
1084
+ const i = resolvedTrackIndex.value;
1085
+ return (i % total + total) % total;
416
1086
  });
417
1087
  const activeTrack = computed(() => {
418
- if (!hasPlaylist.value) return void 0;
419
- return props.playlist[safeTrackIndex.value];
1088
+ if (!hasPlaylist.value) return undefined;
1089
+ return props.playlist[safeTrackIndex.value];
420
1090
  });
1091
+ /*********************************************************
1092
+ * `pendingResumeOnLoad` carries the "user was playing when we
1093
+ * swapped the track" intent across the async reload cycle:
1094
+ *
1095
+ * 1. Vue updates `<audio :src>` synchronously after
1096
+ * `setActiveTrack`.
1097
+ * 2. The browser resets the audio element to a fresh state,
1098
+ * pausing playback and re-emitting `loadstart` /
1099
+ * `loadedmetadata` / `canplay` as the new track buffers.
1100
+ * 3. Once `state.ready` flips back to true (= `canplay`), the
1101
+ * watch below kicks off `methods.play()` so the user
1102
+ * perceives an uninterrupted hand-off between tracks.
1103
+ *
1104
+ * Without this flag, clicking the next btn while playing would
1105
+ * silently land on the new track in a paused state — the exact
1106
+ * user-reported bug ("passé au next stop la lecture et
1107
+ * impossible de la relancer").
1108
+ ********************************************************/
421
1109
  const pendingResumeOnLoad = ref(false);
422
1110
  function setActiveTrack(nextIndex) {
423
- if (!hasPlaylist.value) return;
424
- const total = props.playlist.length;
425
- if (total === 0) return;
426
- const wrapped = (nextIndex % total + total) % total;
427
- if (wrapped === safeTrackIndex.value) return;
428
- if (state.playing.value) pendingResumeOnLoad.value = true;
429
- internalTrackIndex.value = wrapped;
430
- emit("update:currentTrackIndex", wrapped);
431
- const track = props.playlist[wrapped];
432
- if (track) emit("track-change", track, wrapped);
1111
+ if (!hasPlaylist.value) return;
1112
+ const total = props.playlist.length;
1113
+ if (total === 0) return;
1114
+ const wrapped = (nextIndex % total + total) % total;
1115
+ if (wrapped === safeTrackIndex.value) return;
1116
+ // Snapshot the playback intent BEFORE we mutate the index —
1117
+ // the src swap is reactive and pauses playback before we get
1118
+ // another chance to read `state.playing`.
1119
+ if (state.playing.value) pendingResumeOnLoad.value = true;
1120
+ internalTrackIndex.value = wrapped;
1121
+ emit("update:currentTrackIndex", wrapped);
1122
+ const track = props.playlist[wrapped];
1123
+ if (track) emit("track-change", track, wrapped);
433
1124
  }
1125
+ /*********************************************************
1126
+ * Random pick — uniformly samples a playlist index from the
1127
+ * (total - 1) non-current tracks. Guarantees the next track
1128
+ * is always different from the current one, so shuffle always
1129
+ * advances. The math `(cur + 1 + r) % total` with `r` uniform
1130
+ * in `[0, total - 1)` enumerates every non-current index
1131
+ * exactly once with equal probability.
1132
+ ********************************************************/
434
1133
  function pickRandomIndex() {
435
- const total = props.playlist?.length ?? 0;
436
- if (total <= 1) return 0;
437
- const cur = safeTrackIndex.value;
438
- const offset = 1 + Math.floor(Math.random() * (total - 1));
439
- return (cur + offset) % total;
1134
+ const total = props.playlist?.length ?? 0;
1135
+ if (total <= 1) return 0;
1136
+ const cur = safeTrackIndex.value;
1137
+ const offset = 1 + Math.floor(Math.random() * (total - 1));
1138
+ return (cur + offset) % total;
440
1139
  }
441
1140
  function navigateRelative(delta) {
442
- if (!hasPlaylist.value) return;
443
- const total = props.playlist.length;
444
- if (total === 0) return;
445
- if (resolvedShuffle.value) {
446
- setActiveTrack(pickRandomIndex());
447
- return;
448
- }
449
- let target = safeTrackIndex.value + delta;
450
- if (target < 0 || target >= total) {
451
- if (resolvedLoopMode.value === "all" || resolvedLoopMode.value === "one") {
452
- target = (target % total + total) % total;
453
- } else {
454
- return;
455
- }
456
- }
457
- setActiveTrack(target);
1141
+ if (!hasPlaylist.value) return;
1142
+ const total = props.playlist.length;
1143
+ if (total === 0) return;
1144
+ if (resolvedShuffle.value) {
1145
+ setActiveTrack(pickRandomIndex());
1146
+ return;
1147
+ }
1148
+ let target = safeTrackIndex.value + delta;
1149
+ if (target < 0 || target >= total) {
1150
+ if (resolvedLoopMode.value === "all" || resolvedLoopMode.value === "one") {
1151
+ target = (target % total + total) % total;
1152
+ } else {
1153
+ return;
1154
+ }
1155
+ }
1156
+ setActiveTrack(target);
458
1157
  }
1158
+ /*********************************************************
1159
+ * Loop mode (tri-state) + shuffle — v-modelled with the parent.
1160
+ * `loopMode` cycle: 'none' → 'all' → 'one' → 'none'.
1161
+ *
1162
+ * Legacy `loop: true` maps to `loopMode='one'` at read-time when
1163
+ * the consumer hasn't explicitly set `loopMode`.
1164
+ *
1165
+ * #648 — `internalLoopMode` used to be seeded via
1166
+ * `ref(initialLoopMode)`, itself derived from `props.loopMode` /
1167
+ * `props.loop` read EAGERLY in the body of `setup()`. Vue runs
1168
+ * `setup()` BEFORE the `beforeCreate` hook where the ADR-005
1169
+ * theme-props resolver patches `instance.props` (root CLAUDE.md), so
1170
+ * a theme default for `loopMode` on `origam-audio` was captured too
1171
+ * late and silently lost — same defect as #429 on
1172
+ * `OrigamMediaController`. Fixed the same way: the ref starts
1173
+ * `UNSEEDED` and the legacy-aware seed is computed LAZILY, on first
1174
+ * read through `resolvedLoopMode` (a `computed`, evaluated at render
1175
+ * — comfortably after `beforeCreate`), not at `setup()` time.
1176
+ ********************************************************/
459
1177
  const internalLoopMode = ref(UNSEEDED);
1178
+ // `withDefaults` resolves `loopMode` to `'none'` by default, so we
1179
+ // only fall through to the legacy `loop` flag when `loopMode` was
1180
+ // left at its default — never overriding an explicit non-'none' value.
460
1181
  const seedLoopMode = () => props.loopMode && props.loopMode !== "none" ? props.loopMode : props.loop ? "one" : "none";
461
1182
  watch(() => props.loopMode, (next) => {
462
- if (next && next !== internalLoopMode.value) internalLoopMode.value = next;
1183
+ if (next && next !== internalLoopMode.value) internalLoopMode.value = next;
463
1184
  });
1185
+ // Legacy `loop: boolean` flag — mirror runtime changes into the
1186
+ // tri-state mode so toggling `:loop="true"` from a parent checks
1187
+ // the loop button. Only fires when `loopMode` was not explicitly
1188
+ // set by the consumer (otherwise loopMode wins).
464
1189
  watch(() => props.loop, (next) => {
465
- if (props.loopMode && props.loopMode !== "none") return;
466
- internalLoopMode.value = next ? "one" : "none";
467
- emit("update:loopMode", internalLoopMode.value);
1190
+ if (props.loopMode && props.loopMode !== "none") return;
1191
+ internalLoopMode.value = next ? "one" : "none";
1192
+ emit("update:loopMode", internalLoopMode.value);
468
1193
  });
1194
+ /*********************************************************
1195
+ * onLoopModeChange — #436
1196
+ *
1197
+ * @description
1198
+ * Exact twin of `onShuffleChange` below, and the defect 40c099b8
1199
+ * fixed for shuffle but not for loop: `v-model:loop-mode` on
1200
+ * `<origam-media-controller>` SWALLOWED the child's `update:loopMode`
1201
+ * into the internal ref, so a consumer's own `v-model:loopMode` /
1202
+ * `@update:loopMode` on `<OrigamAudio>` never fired for a real user
1203
+ * click on the loop button — only when the parent flipped the legacy
1204
+ * `loop` prop. The story's "Events - update:loopMode" Variant logged
1205
+ * nothing at all.
1206
+ ********************************************************/
469
1207
  const onLoopModeChange = (next) => {
470
- internalLoopMode.value = next;
471
- emit("update:loopMode", next);
1208
+ internalLoopMode.value = next;
1209
+ emit("update:loopMode", next);
472
1210
  };
473
1211
  const resolvedLoopMode = computed(() => internalLoopMode.value === UNSEEDED ? seedLoopMode() : internalLoopMode.value);
1212
+ /*********************************************************
1213
+ * #648 — same eager-read/ADR-005 trap as `loopMode` above, same fix:
1214
+ * `internalShuffle` starts `UNSEEDED`, the `props.shuffle ?? false`
1215
+ * seed is read lazily through `resolvedShuffle` at render time.
1216
+ ********************************************************/
474
1217
  const internalShuffle = ref(UNSEEDED);
475
1218
  watch(() => props.shuffle, (next) => {
476
- if (typeof next === "boolean" && next !== internalShuffle.value) {
477
- internalShuffle.value = next;
478
- }
1219
+ if (typeof next === "boolean" && next !== internalShuffle.value) {
1220
+ internalShuffle.value = next;
1221
+ }
479
1222
  });
480
1223
  const resolvedShuffle = computed(() => internalShuffle.value === UNSEEDED ? props.shuffle ?? false : internalShuffle.value);
1224
+ /*********************************************************
1225
+ * onShuffleChange
1226
+ *
1227
+ * @description
1228
+ * The shuffle toggle lives in `<origam-media-controller>` — its
1229
+ * `update:shuffle` is relayed here (rather than v-modelled) so the
1230
+ * consumer's own `v-model:shuffle` / `update:shuffle` listener on
1231
+ * `<OrigamAudio>` actually fires when the user clicks the button.
1232
+ ********************************************************/
481
1233
  const onShuffleChange = (next) => {
482
- internalShuffle.value = next;
483
- emit("update:shuffle", next);
1234
+ internalShuffle.value = next;
1235
+ emit("update:shuffle", next);
484
1236
  };
1237
+ /*********************************************************
1238
+ * Source resolution — when a playlist is active the `<audio>`
1239
+ * source comes from the active track; otherwise we fall back to
1240
+ * the root `src` prop.
1241
+ ********************************************************/
485
1242
  const effectiveSrc = computed(() => {
486
- if (hasPlaylist.value && activeTrack.value) return activeTrack.value.src;
487
- return props.src;
1243
+ if (hasPlaylist.value && activeTrack.value) return activeTrack.value.src;
1244
+ return props.src;
488
1245
  });
489
1246
  const singleSrc = computed(() => {
490
- const s = effectiveSrc.value;
491
- return typeof s === "string" ? s : void 0;
1247
+ const s = effectiveSrc.value;
1248
+ return typeof s === "string" ? s : undefined;
492
1249
  });
493
1250
  const resolvedSources = computed(() => {
494
- const s = effectiveSrc.value;
495
- if (typeof s === "string" || s == null) return [];
496
- if (Array.isArray(s)) return s;
497
- return [s];
1251
+ const s = effectiveSrc.value;
1252
+ if (typeof s === "string" || s == null) return [];
1253
+ if (Array.isArray(s)) return s;
1254
+ return [s];
498
1255
  });
499
1256
  const resolvedTracks = computed(() => props.tracks ?? []);
1257
+ /*********************************************************
1258
+ * Composable
1259
+ *
1260
+ * @description
1261
+ * #661 — `autoplay` / `muted` used to be read as plain values
1262
+ * (`props.autoplay`, `resolvedMuted.value`), snapshotted ONCE when
1263
+ * this object literal is built during `setup()` — before the
1264
+ * ADR-005 theme resolver has a chance to write a theme default onto
1265
+ * `props.autoplay` (it patches `instance.props` in `beforeCreate`,
1266
+ * which Vue runs AFTER `setup()`). A themed default for either prop
1267
+ * was therefore silently ignored by `useAudioPlayer`'s internal
1268
+ * state (the native `<audio autoplay>`/`<audio muted>` attributes
1269
+ * above were already fine — they're template bindings, evaluated at
1270
+ * render time). Passing getters defers the read to
1271
+ * `useMediaPlayer`'s `bind()` (`onMounted`, i.e. after
1272
+ * `beforeCreate`) — see `IUseMediaPlayerOptions.autoplay` /
1273
+ * `.muted` for the lazy-read contract.
1274
+ *
1275
+ * `loop` / `preload` are deliberately NOT forwarded: `useMediaPlayer`
1276
+ * never reads `options.loop` or `options.preload` (grepped — zero
1277
+ * occurrences beyond the destructured parameter), so passing them
1278
+ * was dead code that happened to also trip the eager-read guard for
1279
+ * no functional benefit. The real `loop` / `preload` DOM attributes
1280
+ * are already driven reactively by `audioLoopAttr` / the bare
1281
+ * `preload` prop binding in the template above.
1282
+ ********************************************************/
500
1283
  const { audioRef, state, methods } = useAudioPlayer({
501
- autoplay: () => props.autoplay,
502
- muted: () => resolvedMuted.value
1284
+ autoplay: () => props.autoplay,
1285
+ muted: () => resolvedMuted.value
503
1286
  });
1287
+ /*********************************************************
1288
+ * controlsSlotBindings — #378
1289
+ *
1290
+ * @description
1291
+ * `IAudioSlots.controls` was declared and documented ("Override the
1292
+ * entire controls, replaces the default `<OrigamMediaController>`")
1293
+ * but never rendered in the template: a consumer following the doc
1294
+ * got total silence. Bindings mirror `IAudioScopedSlotBindings`
1295
+ * exactly — unwrapped snapshots of the internal `state` refs plus
1296
+ * the imperative `methods` object already driving the default
1297
+ * `<OrigamMediaController>`, so a custom transport has the same
1298
+ * capability as the built-in one.
1299
+ ********************************************************/
504
1300
  const controlsSlotBindings = computed(() => ({
505
- playing: state.playing.value,
506
- paused: state.paused.value,
507
- currentTime: state.currentTime.value,
508
- duration: state.duration.value,
509
- buffered: state.buffered.value,
510
- volume: state.volume.value,
511
- muted: state.muted.value,
512
- playbackRate: state.playbackRate.value,
513
- loading: state.loading.value,
514
- error: state.error.value,
515
- methods
1301
+ playing: state.playing.value,
1302
+ paused: state.paused.value,
1303
+ currentTime: state.currentTime.value,
1304
+ duration: state.duration.value,
1305
+ buffered: state.buffered.value,
1306
+ volume: state.volume.value,
1307
+ muted: state.muted.value,
1308
+ playbackRate: state.playbackRate.value,
1309
+ loading: state.loading.value,
1310
+ error: state.error.value,
1311
+ methods
516
1312
  }));
1313
+ /*********************************************************
1314
+ * Resume playback once the new track is ready — paired with
1315
+ * `pendingResumeOnLoad` from `setActiveTrack`.
1316
+ *
1317
+ * We listen to the native `loadeddata` event on the <audio>
1318
+ * element directly because the composable's `state.ready` flag
1319
+ * doesn't flip back to `false` on `loadstart` (track swap), so
1320
+ * it would never re-fire the false → true transition needed to
1321
+ * drive a watcher. Subscribing to the DOM event gives us a
1322
+ * deterministic "new track is buffered, you can play()" signal
1323
+ * exactly once per track change.
1324
+ ********************************************************/
517
1325
  watch(audioRef, (el, _prev, onCleanup) => {
518
- if (!el) return;
519
- const onLoadedData = () => {
520
- if (!pendingResumeOnLoad.value) return;
521
- pendingResumeOnLoad.value = false;
522
- methods.play();
523
- };
524
- el.addEventListener("loadeddata", onLoadedData);
525
- onCleanup(() => el.removeEventListener("loadeddata", onLoadedData));
1326
+ if (!el) return;
1327
+ const onLoadedData = () => {
1328
+ if (!pendingResumeOnLoad.value) return;
1329
+ pendingResumeOnLoad.value = false;
1330
+ methods.play();
1331
+ };
1332
+ el.addEventListener("loadeddata", onLoadedData);
1333
+ onCleanup(() => el.removeEventListener("loadeddata", onLoadedData));
526
1334
  }, { immediate: true });
1335
+ /*********************************************************
1336
+ * Reactive autoplay — the native `autoplay` attribute only acts at load
1337
+ * time, so flipping the prop after the element mounted (e.g. ticking the
1338
+ * control) would do nothing. React to `resolvedAutoplay` going truthy and
1339
+ * actually start playback. It plays muted (`resolvedMuted`, browser policy)
1340
+ * and stays suppressed under `prefers-reduced-motion` (a11y) since
1341
+ * `resolvedAutoplay` already accounts for it.
1342
+ ********************************************************/
527
1343
  watch(resolvedAutoplay, (on) => {
528
- if (on) void methods.play();
1344
+ if (on) void methods.play();
529
1345
  });
1346
+ /*********************************************************
1347
+ * Native event handlers — forward to the parent emit pipeline.
1348
+ ********************************************************/
530
1349
  function onTimeUpdate(event) {
531
- emit("timeupdate", event);
1350
+ emit("timeupdate", event);
532
1351
  }
533
1352
  function onVolumeChange(event) {
534
- emit("volumechange", event);
1353
+ emit("volumechange", event);
535
1354
  }
536
1355
  function onLoadedMetadata(event) {
537
- emit("loadedmetadata", event);
1356
+ emit("loadedmetadata", event);
538
1357
  }
539
1358
  function onErrorEvent(event) {
540
- emit("error", state.error.value ?? event);
1359
+ emit("error", state.error.value ?? event);
541
1360
  }
1361
+ /*********************************************************
1362
+ * Metadata strip — hides itself when title/artist/album are
1363
+ * absent. Cover figure renders separately so the cover can still
1364
+ * stand on its own if the consumer only passes an image.
1365
+ ********************************************************/
542
1366
  const resolvedTitle = computed(() => activeTrack.value?.title ?? props.title);
543
1367
  const resolvedArtist = computed(() => activeTrack.value?.artist ?? props.artist);
544
1368
  const resolvedAlbum = computed(() => activeTrack.value?.album ?? props.album);
545
1369
  const resolvedCover = computed(() => {
546
- if (activeTrack.value?.cover) return activeTrack.value.cover;
547
- if (!props.cover) return void 0;
548
- if (typeof props.cover === "string") return props.cover;
549
- return props.cover.src;
1370
+ if (activeTrack.value?.cover) return activeTrack.value.cover;
1371
+ if (!props.cover) return undefined;
1372
+ if (typeof props.cover === "string") return props.cover;
1373
+ return props.cover.src;
550
1374
  });
551
1375
  const coverAlt = computed(() => {
552
- const t2 = resolvedTitle.value;
553
- const a = resolvedArtist.value;
554
- if (t2 && a) return `${t2} \u2014 ${a}`;
555
- if (t2) return t2;
556
- return "";
1376
+ const t = resolvedTitle.value;
1377
+ const a = resolvedArtist.value;
1378
+ if (t && a) return `${t} — ${a}`;
1379
+ if (t) return t;
1380
+ return "";
557
1381
  });
558
1382
  const hasCover = computed(() => Boolean(resolvedCover.value));
1383
+ /*********************************************************
1384
+ * Cover size — `<origam-img>` needs explicit `width` / `height`
1385
+ * attribute values to clamp its inner `<img>` (CSS scoped on
1386
+ * the parent doesn't pierce the wrapper). Resolved at the parent
1387
+ * level from the variant — 96px for `expanded`, 48px for `compact`.
1388
+ ********************************************************/
559
1389
  const coverSizePx = computed(() => isCompactVariant.value ? 48 : 96);
560
1390
  const hasMetadata = computed(() => {
561
- return Boolean(resolvedTitle.value || resolvedArtist.value || resolvedAlbum.value);
1391
+ return Boolean(resolvedTitle.value || resolvedArtist.value || resolvedAlbum.value);
562
1392
  });
563
1393
  const hasMetaLine = computed(() => {
564
- return Boolean(resolvedArtist.value || resolvedAlbum.value || hasDurationLabel.value);
1394
+ return Boolean(resolvedArtist.value || resolvedAlbum.value || hasDurationLabel.value);
565
1395
  });
566
1396
  const hasDurationLabel = computed(() => {
567
- return Number.isFinite(state.duration.value) && state.duration.value > 0;
1397
+ return Number.isFinite(state.duration.value) && state.duration.value > 0;
568
1398
  });
569
1399
  const formattedDuration = computed(() => formatMediaTime(state.duration.value));
1400
+ /*********************************************************
1401
+ * Waveform — decoded on the fly via `useWaveform`. The waveform
1402
+ * mini scrubber lives between the metadata header and the
1403
+ * transport row in the EXPANDED variant; the COMPACT variant
1404
+ * hides it to keep the dock height tight.
1405
+ ********************************************************/
570
1406
  const waveformEnabled = computed(() => {
571
- if (isCompactVariant.value) return false;
572
- if (props.waveform === true) return true;
573
- if (props.waveform === "auto") {
574
- if (typeof window === "undefined") return false;
575
- const win = window;
576
- return Boolean(win.OfflineAudioContext);
577
- }
578
- return false;
1407
+ if (isCompactVariant.value) return false;
1408
+ if (props.waveform === true) return true;
1409
+ if (props.waveform === "auto") {
1410
+ if (typeof window === "undefined") return false;
1411
+ const win = window;
1412
+ return Boolean(win.OfflineAudioContext);
1413
+ }
1414
+ return false;
579
1415
  });
580
1416
  const showWaveform = computed(() => waveformEnabled.value || isExpandedVariant.value);
581
1417
  const waveformSrc = computed(() => {
582
- if (!waveformEnabled.value) return void 0;
583
- if (typeof props.src === "string") return props.src;
584
- if (Array.isArray(props.src)) return props.src[0]?.src;
585
- return props.src?.src;
1418
+ if (!waveformEnabled.value) return undefined;
1419
+ if (typeof props.src === "string") return props.src;
1420
+ if (Array.isArray(props.src)) return props.src[0]?.src;
1421
+ return props.src?.src;
586
1422
  });
1423
+ /*********************************************************
1424
+ * #661 — `crossOrigin` used to snapshot `props.crossorigin` once at
1425
+ * `setup()` time (same ADR-005 trap as `autoplay`/`muted` above). A
1426
+ * getter defers the read to `useWaveform`'s `compute()`, which
1427
+ * re-runs on every source change (`watch(srcRef, …)`), so a themed
1428
+ * default written by the resolver after `setup()` is honoured on
1429
+ * the next computation.
1430
+ ********************************************************/
587
1431
  const { peaks } = useWaveform(waveformSrc, {
588
- bins: 200,
589
- crossOrigin: () => props.crossorigin === "use-credentials" || props.crossorigin === "anonymous" ? props.crossorigin : void 0
1432
+ bins: 200,
1433
+ crossOrigin: () => props.crossorigin === "use-credentials" || props.crossorigin === "anonymous" ? props.crossorigin : undefined
590
1434
  });
591
1435
  watch(peaks, (next) => {
592
- if (next.length > 0) emit("waveform", next);
1436
+ if (next.length > 0) emit("waveform", next);
593
1437
  });
1438
+ /*********************************************************
1439
+ * Displayed peaks — the audio variant of `<OrigamSliderField>`
1440
+ * only paints its waveform SVG when the `peaks` array is non-empty.
1441
+ * Real peaks come from `useWaveform` which depends on a successful
1442
+ * `OfflineAudioContext.decodeAudioData()`. The decode fails silently
1443
+ * on CORS-blocked or HLS sources — the visual identity of the
1444
+ * scrubber would collapse back to a hairline (Stemtracks loses its
1445
+ * signature). We seed a deterministic synthetic waveform (sum of
1446
+ * three sine waves, ~120 bars, values 0.15-1.0) so the audio
1447
+ * scrubber ALWAYS reads as "audio" at a glance, then overwrites
1448
+ * with real peaks as soon as `useWaveform` resolves.
1449
+ ********************************************************/
594
1450
  const SYNTHETIC_PEAKS_COUNT = 120;
595
1451
  const syntheticPeaks = (() => {
596
- const out = [];
597
- for (let i = 0; i < SYNTHETIC_PEAKS_COUNT; i++) {
598
- const t2 = i / SYNTHETIC_PEAKS_COUNT;
599
- const w = Math.sin(t2 * Math.PI * 7) * 0.5 + Math.sin(t2 * Math.PI * 13 + 1.2) * 0.3 + Math.sin(t2 * Math.PI * 29 + 0.4) * 0.2;
600
- out.push(0.55 + w * 0.42);
601
- }
602
- return out.map((v) => Math.max(0.12, Math.min(1, Math.abs(v))));
1452
+ const out = [];
1453
+ for (let i = 0; i < SYNTHETIC_PEAKS_COUNT; i++) {
1454
+ const t = i / SYNTHETIC_PEAKS_COUNT;
1455
+ const w = Math.sin(t * Math.PI * 7) * .5 + Math.sin(t * Math.PI * 13 + 1.2) * .3 + Math.sin(t * Math.PI * 29 + .4) * .2;
1456
+ out.push(.55 + w * .42);
1457
+ }
1458
+ return out.map((v) => Math.max(.12, Math.min(1, Math.abs(v))));
603
1459
  })();
604
1460
  const displayedPeaks = computed(() => {
605
- if (peaks.value && peaks.value.length > 0) return peaks.value;
606
- return syntheticPeaks;
1461
+ if (peaks.value && peaks.value.length > 0) return peaks.value;
1462
+ return syntheticPeaks;
607
1463
  });
1464
+ /*********************************************************
1465
+ * Scrubber math — both the waveform mini scrubber AND the inline
1466
+ * timer scrubber share the same `max` (clamped to a finite
1467
+ * duration) and seek handler.
1468
+ ********************************************************/
608
1469
  const scrubberMax = computed(() => {
609
- return Number.isFinite(state.duration.value) ? state.duration.value : 0;
1470
+ return Number.isFinite(state.duration.value) ? state.duration.value : 0;
610
1471
  });
611
1472
  function onWaveformSeek(value) {
612
- if (Array.isArray(value)) return;
613
- methods.seek(value);
1473
+ if (Array.isArray(value)) return;
1474
+ methods.seek(value);
614
1475
  }
615
1476
  function formatTimeTooltip(seconds) {
616
- return formatMediaTime(seconds);
1477
+ return formatMediaTime(seconds);
617
1478
  }
1479
+ /*********************************************************
1480
+ * Transport handlers — previous / next bubbled from
1481
+ * `<origam-media-controller>` are handled here (we own the
1482
+ * playlist + skip-time policy). Play / pause / mute / volume
1483
+ * are routed by MediaController directly through `methods.*`.
1484
+ ********************************************************/
618
1485
  function onPrevious() {
619
- emit("previous");
620
- if (hasPlaylist.value) {
621
- navigateRelative(-1);
622
- } else {
623
- methods.skipBackward(10);
624
- }
1486
+ emit("previous");
1487
+ if (hasPlaylist.value) {
1488
+ navigateRelative(-1);
1489
+ } else {
1490
+ methods.skipBackward(10);
1491
+ }
625
1492
  }
626
1493
  function onNext() {
627
- emit("next");
628
- if (hasPlaylist.value) {
629
- navigateRelative(1);
630
- } else {
631
- methods.skipForward(10);
632
- }
1494
+ emit("next");
1495
+ if (hasPlaylist.value) {
1496
+ navigateRelative(1);
1497
+ } else {
1498
+ methods.skipForward(10);
1499
+ }
633
1500
  }
1501
+ /*********************************************************
1502
+ * Native `<audio>` loop attribute — mapped from the resolved
1503
+ * loop mode. `'one'` sets the native `loop` flag so the same
1504
+ * track restarts on `ended` without our intervention. `'all'`
1505
+ * keeps `loop=false` and triggers a programmatic `next` on
1506
+ * `ended` to advance through the playlist; on the last track
1507
+ * we wrap to the first. `'none'` lets playback stop after the
1508
+ * last track.
1509
+ ********************************************************/
634
1510
  const audioLoopAttr = computed(() => resolvedLoopMode.value === "one");
635
1511
  function onNativeEnded() {
636
- emit("ended");
637
- if (resolvedLoopMode.value === "one") return;
638
- if (!hasPlaylist.value) return;
639
- const total = props.playlist.length;
640
- if (total === 0) return;
641
- if (resolvedShuffle.value) {
642
- setActiveTrack(pickRandomIndex());
643
- void nextTick(() => {
644
- void methods.play();
645
- });
646
- return;
647
- }
648
- const cur = safeTrackIndex.value;
649
- const target = cur + 1;
650
- if (target < total) {
651
- setActiveTrack(target);
652
- void nextTick(() => {
653
- void methods.play();
654
- });
655
- } else if (resolvedLoopMode.value === "all") {
656
- setActiveTrack(0);
657
- void nextTick(() => {
658
- void methods.play();
659
- });
660
- }
1512
+ emit("ended");
1513
+ if (resolvedLoopMode.value === "one") return;
1514
+ if (!hasPlaylist.value) return;
1515
+ const total = props.playlist.length;
1516
+ if (total === 0) return;
1517
+ if (resolvedShuffle.value) {
1518
+ setActiveTrack(pickRandomIndex());
1519
+ void nextTick(() => {
1520
+ void methods.play();
1521
+ });
1522
+ return;
1523
+ }
1524
+ const cur = safeTrackIndex.value;
1525
+ const target = cur + 1;
1526
+ if (target < total) {
1527
+ setActiveTrack(target);
1528
+ void nextTick(() => {
1529
+ void methods.play();
1530
+ });
1531
+ } else if (resolvedLoopMode.value === "all") {
1532
+ setActiveTrack(0);
1533
+ void nextTick(() => {
1534
+ void methods.play();
1535
+ });
1536
+ }
661
1537
  }
1538
+ /*********************************************************
1539
+ * Download URL resolution — single-source playback means we
1540
+ * always know the active URL; multi-source arrays fall back to
1541
+ * the first entry. Forwarded to `<origam-media-controller>` via
1542
+ * its `:download-url` prop. The Controller emits `download` when
1543
+ * the listener clicks the row; we re-emit with the URL payload
1544
+ * for v0.x consumers.
1545
+ ********************************************************/
662
1546
  const downloadUrl = computed(() => {
663
- const src = effectiveSrc.value;
664
- if (typeof src === "string") return src || null;
665
- if (Array.isArray(src)) {
666
- const first = src[0];
667
- return first?.src ?? null;
668
- }
669
- return src?.src ?? null;
1547
+ const src = effectiveSrc.value;
1548
+ if (typeof src === "string") return src || null;
1549
+ if (Array.isArray(src)) {
1550
+ const first = src[0];
1551
+ return first?.src ?? null;
1552
+ }
1553
+ return src?.src ?? null;
670
1554
  });
671
1555
  function onDownloadClick() {
672
- const url = downloadUrl.value;
673
- if (!url) return;
674
- emit("download", url);
1556
+ const url = downloadUrl.value;
1557
+ if (!url) return;
1558
+ emit("download", url);
675
1559
  }
1560
+ /*********************************************************
1561
+ * Apply initial playback rate (prop) once metadata is ready.
1562
+ ********************************************************/
676
1563
  watch(() => props.playbackRate, (rate) => {
677
- if (typeof rate === "number" && Number.isFinite(rate) && rate > 0) {
678
- methods.setPlaybackRate(rate);
679
- }
1564
+ if (typeof rate === "number" && Number.isFinite(rate) && rate > 0) {
1565
+ methods.setPlaybackRate(rate);
1566
+ }
680
1567
  }, { immediate: true });
1568
+ /*********************************************************
1569
+ * Forward playback-rate updates from `<origam-media-controller>`'s
1570
+ * config menu through our public emit pipeline so v-model'ing
1571
+ * `:playback-rate` on `<origam-audio>` keeps working.
1572
+ ********************************************************/
681
1573
  watch(() => state.playbackRate.value, (rate) => {
682
- emit("update:playbackRate", rate);
1574
+ emit("update:playbackRate", rate);
683
1575
  });
1576
+ /*********************************************************
1577
+ * Error formatting for the default error overlay.
1578
+ *
1579
+ * @description
1580
+ * #436 (C8) — the generic label was the hardcoded English literal
1581
+ * `'Playback error'`, shown verbatim under every locale. It now
1582
+ * resolves `origam.media.playback_error`, shared with the other
1583
+ * media surfaces. A `MediaError` carries only a numeric `code`, so
1584
+ * this branch is the one a real decoding failure reaches; a
1585
+ * JS `Error` raised by the composable keeps its own `message`.
1586
+ ********************************************************/
684
1587
  const genericErrorMessage = computed(() => t("origam.media.playback_error"));
685
1588
  const errorMessage = computed(() => {
686
- const err = state.error.value;
687
- if (!err) return genericErrorMessage.value;
688
- if ("message" in err && err.message) return err.message;
689
- return genericErrorMessage.value;
1589
+ const err = state.error.value;
1590
+ if (!err) return genericErrorMessage.value;
1591
+ if ("message" in err && err.message) return err.message;
1592
+ return genericErrorMessage.value;
690
1593
  });
1594
+ /*********************************************************
1595
+ * Wrapper chrome — every canonical DS transverse composable.
1596
+ * The SCSS host carries the dark studio backdrop by default;
1597
+ * `bgColor` overrides it when the consumer provides an intent
1598
+ * or hex.
1599
+ ********************************************************/
1600
+ /*********************************************************
1601
+ * `useColorEffect` resolves color + bgColor TOGETHER so that
1602
+ * passing `bgColor="primary"` automatically pairs with the
1603
+ * intent's WCAG-validated foreground token (no invisible
1604
+ * text on dark intent surfaces). The composable falls back
1605
+ * to inline `:style` declarations for raw hex/rgb values
1606
+ * and keeps the resting tokens whenever both props are
1607
+ * supplied so the consumer's intent is always respected.
1608
+ ********************************************************/
691
1609
  const { colorClasses, colorStyles } = useColorEffect(props);
692
- useUnsupportedProp(
693
- "OrigamAudio",
694
- "waveformColor",
695
- "the waveform paints from `currentColor`; this prop reaches no declaration.",
696
- () => props.waveformColor !== void 0
697
- );
1610
+ /*********************************************************
1611
+ * Props declarees sans effet (#550, critere C1)
1612
+ *
1613
+ * @description
1614
+ * ⛔ Exposees dans la story, parfois documentees, et pourtant lues
1615
+ * nulle part. Elles ne sont ni retirees — ca casserait la story et le
1616
+ * type d'un consommateur pour une prop qui ne faisait deja rien — ni
1617
+ * cablees a un comportement invente. Elles avertissent une fois, en
1618
+ * dev, avec la raison exacte. Meme traitement que la famille Chart.
1619
+ ********************************************************/
1620
+ useUnsupportedProp("OrigamAudio", "waveformColor", "the waveform paints from `currentColor`; this prop reaches no declaration.", () => props.waveformColor !== undefined);
698
1621
  const hasColorProp = computed(() => !!props.color);
699
1622
  const hasBgColorProp = computed(() => !!props.bgColor);
700
1623
  const scrubberColorStyle = computed(() => {
701
- if (hasColorProp.value || hasBgColorProp.value) {
702
- return { "--origam-media-controller__scrubber---color": "currentColor" };
703
- }
704
- return { "--origam-media-controller__scrubber---color": "var(--origam-color__text---secondary, color-mix(in srgb, currentColor 55%, transparent))" };
1624
+ // When the consumer sets `color` (or `bgColor`, which auto-pairs
1625
+ // its fg via `useColorEffect`), the scrubber adopts the resulting
1626
+ // `currentColor`. With NO color prop, the scrubber stays neutral
1627
+ // grey so it doesn't compete with the play-button accent.
1628
+ if (hasColorProp.value || hasBgColorProp.value) {
1629
+ return { "--origam-media-controller__scrubber---color": "currentColor" };
1630
+ }
1631
+ return { "--origam-media-controller__scrubber---color": "var(--origam-color__text---secondary, color-mix(in srgb, currentColor 55%, transparent))" };
705
1632
  });
706
1633
  const { roundedClasses, roundedStyles } = useRounded(props);
707
1634
  const { borderClasses, borderStyles } = useBorder(props);
@@ -710,53 +1637,68 @@ const { marginClasses, marginStyles } = useMargin(props);
710
1637
  const { elevationClasses, elevationStyles } = useElevation(props);
711
1638
  const { positionClasses, positionStyles } = usePosition(props);
712
1639
  const { dimensionStyles } = useDimension(props);
1640
+ /*********************************************************
1641
+ * Typography — per-surface tokens. One useTypography call per
1642
+ * CSS-variable namespace read by the SCSS:
1643
+ * audio__title → font-size, font-weight, line-height (all read)
1644
+ * audio__meta → font-size only
1645
+ * audio__loading / audio--error → font-size only (état overlays)
1646
+ * useColorEffect drives color; typographyStyles only sets font vars.
1647
+ ********************************************************/
713
1648
  const { typographyStyles: typographyTitleStyles } = useTypography(props, "audio__title");
714
1649
  const { typographyStyles: typographyMetaStyles } = useTypography(props, "audio__meta");
715
1650
  const { typographyStyles: typographyLoadingStyles } = useTypography(props, "audio__loading");
716
1651
  const { typographyStyles: typographyErrorStyles } = useTypography(props, "audio--error");
1652
+ /*********************************************************
1653
+ * Class & Style — Strategy A: classes win for tokenised values,
1654
+ * inline styles win for raw CSS, both bind in parallel.
1655
+ ********************************************************/
717
1656
  const variantClassName = computed(() => `origam-audio--${isCompactVariant.value ? "compact" : "expanded"}`);
718
1657
  const rootClasses = computed(() => [
719
- variantClassName.value,
720
- `origam-audio--cover-${props.coverPosition}`,
721
- {
722
- "origam-audio--playing": state.playing.value,
723
- "origam-audio--paused": state.paused.value,
724
- "origam-audio--loading": state.loading.value,
725
- "origam-audio--error": state.error.value !== null,
726
- "origam-audio--controls-native": isNativeControls.value,
727
- "origam-audio--controls-custom": isCustomControls.value,
728
- "origam-audio--has-cover": hasCover.value,
729
- "origam-audio--has-waveform": showWaveform.value
730
- },
731
- positionClasses.value,
732
- ...colorClasses.value,
733
- {
734
- "origam-audio--has-color": hasColorProp.value,
735
- "origam-audio--has-bg-color": hasBgColorProp.value
736
- },
737
- ...roundedClasses.value,
738
- ...borderClasses.value,
739
- ...paddingClasses.value,
740
- ...marginClasses.value,
741
- ...elevationClasses.value,
742
- props.class
1658
+ variantClassName.value,
1659
+ `origam-audio--cover-${props.coverPosition}`,
1660
+ {
1661
+ "origam-audio--playing": state.playing.value,
1662
+ "origam-audio--paused": state.paused.value,
1663
+ "origam-audio--loading": state.loading.value,
1664
+ "origam-audio--error": state.error.value !== null,
1665
+ "origam-audio--controls-native": isNativeControls.value,
1666
+ "origam-audio--controls-custom": isCustomControls.value,
1667
+ "origam-audio--has-cover": hasCover.value,
1668
+ "origam-audio--has-waveform": showWaveform.value
1669
+ },
1670
+ positionClasses.value,
1671
+ ...colorClasses.value,
1672
+ {
1673
+ "origam-audio--has-color": hasColorProp.value,
1674
+ "origam-audio--has-bg-color": hasBgColorProp.value
1675
+ },
1676
+ ...roundedClasses.value,
1677
+ ...borderClasses.value,
1678
+ ...paddingClasses.value,
1679
+ ...marginClasses.value,
1680
+ ...elevationClasses.value,
1681
+ props.class
743
1682
  ]);
744
1683
  const rootStyles = computed(() => [
745
- positionStyles.value,
746
- colorStyles.value,
747
- scrubberColorStyle.value,
748
- roundedStyles.value,
749
- borderStyles.value,
750
- paddingStyles.value,
751
- marginStyles.value,
752
- elevationStyles.value,
753
- dimensionStyles.value,
754
- props.style
1684
+ positionStyles.value,
1685
+ colorStyles.value,
1686
+ scrubberColorStyle.value,
1687
+ roundedStyles.value,
1688
+ borderStyles.value,
1689
+ paddingStyles.value,
1690
+ marginStyles.value,
1691
+ elevationStyles.value,
1692
+ dimensionStyles.value,
1693
+ props.style
755
1694
  ]);
1695
+ /*********************************************************
1696
+ * Expose
1697
+ ********************************************************/
756
1698
  defineExpose({
757
- audioRef,
758
- state,
759
- methods
1699
+ audioRef,
1700
+ state,
1701
+ methods
760
1702
  });
761
1703
  </script>
762
1704