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.
- package/CHANGELOG.md +24 -0
- package/dist/src/assets/locales/en.json +1 -1
- package/dist/src/assets/locales/fr.json +2 -2
- package/dist/src/components/Alert/OrigamAlert.vue +739 -165
- package/dist/src/components/App/OrigamApp.vue +95 -19
- package/dist/src/components/App/OrigamAppBar.vue +751 -158
- package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
- package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
- package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
- package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
- package/dist/src/components/Badge/OrigamBadge.vue +548 -135
- package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
- package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
- package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
- package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
- package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
- package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
- package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
- package/dist/src/components/Btn/OrigamBtn.vue +928 -249
- package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
- package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
- package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
- package/dist/src/components/Card/OrigamCard.vue +938 -194
- package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
- package/dist/src/components/Card/OrigamCardText.vue +536 -84
- package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
- package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
- package/dist/src/components/Chart/OrigamChart.vue +942 -452
- package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
- package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
- package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
- package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
- package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
- package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
- package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
- package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
- package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
- package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
- package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
- package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
- package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
- package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
- package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
- package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
- package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
- package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
- package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
- package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
- package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
- package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
- package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
- package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
- package/dist/src/components/Chip/OrigamChip.vue +867 -202
- package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
- package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
- package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
- package/dist/src/components/Code/OrigamCode.vue +844 -206
- package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
- package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
- package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
- package/dist/src/components/Counter/OrigamCounter.vue +588 -96
- package/dist/src/components/DataList/OrigamDataList.vue +619 -113
- package/dist/src/components/DataList/OrigamDataText.vue +295 -65
- package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
- package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
- package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
- package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
- package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
- package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
- package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
- package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
- package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
- package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
- package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
- package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
- package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
- package/dist/src/components/Divider/OrigamDivider.vue +210 -50
- package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
- package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
- package/dist/src/components/Field/OrigamField.vue +1118 -306
- package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
- package/dist/src/components/Form/OrigamForm.vue +197 -74
- package/dist/src/components/Grid/OrigamGrid.vue +707 -147
- package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
- package/dist/src/components/Grids/OrigamCol.vue +593 -110
- package/dist/src/components/Grids/OrigamContainer.vue +461 -80
- package/dist/src/components/Grids/OrigamRow.vue +573 -112
- package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
- package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
- package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
- package/dist/src/components/Icon/OrigamIcon.vue +561 -98
- package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
- package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
- package/dist/src/components/Img/OrigamImg.vue +869 -228
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
- package/dist/src/components/Input/OrigamInput.vue +747 -180
- package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
- package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
- package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
- package/dist/src/components/Label/OrigamLabel.vue +584 -95
- package/dist/src/components/Layout/OrigamLayout.vue +563 -94
- package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
- package/dist/src/components/List/OrigamList.vue +755 -170
- package/dist/src/components/List/OrigamListChildren.vue +59 -19
- package/dist/src/components/List/OrigamListGroup.vue +631 -134
- package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
- package/dist/src/components/List/OrigamListItem.vue +890 -224
- package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
- package/dist/src/components/List/OrigamListSubheader.vue +542 -93
- package/dist/src/components/Loader/OrigamLoader.vue +110 -25
- package/dist/src/components/Main/OrigamMain.vue +565 -96
- package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
- package/dist/src/components/Media/OrigamMediaController.vue +465 -182
- package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
- package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
- package/dist/src/components/Messages/OrigamMessages.vue +606 -97
- package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
- package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
- package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
- package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
- package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
- package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
- package/dist/src/components/Picker/OrigamPicker.vue +655 -108
- package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
- package/dist/src/components/Progress/OrigamProgress.vue +436 -70
- package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
- package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
- package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
- package/dist/src/components/Radio/OrigamRadio.vue +772 -132
- package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
- package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
- package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
- package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
- package/dist/src/components/Select/OrigamSelect.vue +1639 -567
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
- package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
- package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
- package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
- package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
- package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
- package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
- package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
- package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
- package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
- package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
- package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
- package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
- package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
- package/dist/src/components/Table/OrigamTable.vue +585 -124
- package/dist/src/components/Tabs/OrigamTab.vue +239 -73
- package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
- package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
- package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
- package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
- package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
- package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
- package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
- package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
- package/dist/src/components/Title/OrigamTitle.vue +505 -82
- package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
- package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
- package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
- package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
- package/dist/src/components/Transition/OrigamFade.vue +47 -9
- package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
- package/dist/src/components/Transition/OrigamSnack.vue +52 -10
- package/dist/src/components/Transition/OrigamTransition.vue +40 -12
- package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
- package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
- package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
- package/dist/src/components/Video/OrigamVideo.vue +1178 -331
- package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
- package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
- package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
- package/dist/src/components/Window/OrigamWindow.vue +745 -175
- package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
- package/dist/src/composables/Commons/display.composable.cjs +2 -0
- package/dist/src/composables/Commons/display.composable.js +1 -1
- package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
- package/package.json +6 -6
|
@@ -171,44 +171,167 @@ import { MDI_ICONS } from "../../enums/Commons/mdi.enum";
|
|
|
171
171
|
import { formatMediaTime } from "../../utils/Media/format-time.util";
|
|
172
172
|
import OrigamMediaScrubber from "./OrigamMediaScrubber.vue";
|
|
173
173
|
import OrigamMediaVolumeControl from "./OrigamMediaVolumeControl.vue";
|
|
174
|
+
/*********************************************************
|
|
175
|
+
* Global
|
|
176
|
+
*
|
|
177
|
+
* @description
|
|
178
|
+
* Universal media controls shell consumed by `<OrigamVideo>` AND
|
|
179
|
+
* `<OrigamAudio>`. The transport row uses native DS components
|
|
180
|
+
* (`<origam-btn>` for every icon-only button, `<origam-menu>` for
|
|
181
|
+
* the cog drill-down). Audio-specific features (playlist nav,
|
|
182
|
+
* tri-state loop, shuffle) are opt-in via `show*` props — video
|
|
183
|
+
* keeps a zero-regression default surface.
|
|
184
|
+
*
|
|
185
|
+
* Defaults are inlined here (not pulled from a constant object)
|
|
186
|
+
* because the Vue SFC compiler analyses `withDefaults` statically
|
|
187
|
+
* and only resolves literals — cf. CLAUDE.md rule.
|
|
188
|
+
********************************************************/
|
|
174
189
|
const { t } = useLocale();
|
|
175
190
|
const props = defineProps({
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
191
|
+
state: {
|
|
192
|
+
type: Object,
|
|
193
|
+
required: true
|
|
194
|
+
},
|
|
195
|
+
methods: {
|
|
196
|
+
type: Object,
|
|
197
|
+
required: true
|
|
198
|
+
},
|
|
199
|
+
inset: {
|
|
200
|
+
type: Boolean,
|
|
201
|
+
required: false,
|
|
202
|
+
default: false
|
|
203
|
+
},
|
|
204
|
+
visible: {
|
|
205
|
+
type: Boolean,
|
|
206
|
+
required: false,
|
|
207
|
+
default: true
|
|
208
|
+
},
|
|
209
|
+
playbackRates: {
|
|
210
|
+
type: Array,
|
|
211
|
+
required: false,
|
|
212
|
+
default: () => [
|
|
213
|
+
.5,
|
|
214
|
+
.75,
|
|
215
|
+
1,
|
|
216
|
+
1.25,
|
|
217
|
+
1.5,
|
|
218
|
+
2
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
allowRemotePlayback: {
|
|
222
|
+
type: Boolean,
|
|
223
|
+
required: false,
|
|
224
|
+
default: false
|
|
225
|
+
},
|
|
226
|
+
downloadable: {
|
|
227
|
+
type: Boolean,
|
|
228
|
+
required: false,
|
|
229
|
+
default: false
|
|
230
|
+
},
|
|
231
|
+
downloadUrl: {
|
|
232
|
+
type: [String, null],
|
|
233
|
+
required: false,
|
|
234
|
+
default: null
|
|
235
|
+
},
|
|
236
|
+
downloadFilename: {
|
|
237
|
+
type: String,
|
|
238
|
+
required: false,
|
|
239
|
+
default: undefined
|
|
240
|
+
},
|
|
241
|
+
qualityOptions: {
|
|
242
|
+
type: Array,
|
|
243
|
+
required: false,
|
|
244
|
+
default: () => []
|
|
245
|
+
},
|
|
246
|
+
currentQuality: {
|
|
247
|
+
type: [String, null],
|
|
248
|
+
required: false,
|
|
249
|
+
default: null
|
|
250
|
+
},
|
|
251
|
+
showPrevious: {
|
|
252
|
+
type: Boolean,
|
|
253
|
+
required: false,
|
|
254
|
+
default: false
|
|
255
|
+
},
|
|
256
|
+
showNext: {
|
|
257
|
+
type: Boolean,
|
|
258
|
+
required: false,
|
|
259
|
+
default: false
|
|
260
|
+
},
|
|
261
|
+
showLoop: {
|
|
262
|
+
type: Boolean,
|
|
263
|
+
required: false,
|
|
264
|
+
default: false
|
|
265
|
+
},
|
|
266
|
+
showShuffle: {
|
|
267
|
+
type: Boolean,
|
|
268
|
+
required: false,
|
|
269
|
+
default: false
|
|
270
|
+
},
|
|
271
|
+
loopMode: {
|
|
272
|
+
type: null,
|
|
273
|
+
required: false,
|
|
274
|
+
default: "none"
|
|
275
|
+
},
|
|
276
|
+
shuffle: {
|
|
277
|
+
type: Boolean,
|
|
278
|
+
required: false,
|
|
279
|
+
default: false
|
|
280
|
+
},
|
|
281
|
+
id: {
|
|
282
|
+
type: String,
|
|
283
|
+
required: false
|
|
284
|
+
},
|
|
285
|
+
class: {
|
|
286
|
+
type: [
|
|
287
|
+
String,
|
|
288
|
+
Array,
|
|
289
|
+
Object
|
|
290
|
+
],
|
|
291
|
+
required: false
|
|
292
|
+
},
|
|
293
|
+
style: {
|
|
294
|
+
type: [
|
|
295
|
+
String,
|
|
296
|
+
Array,
|
|
297
|
+
Object,
|
|
298
|
+
Boolean,
|
|
299
|
+
null
|
|
300
|
+
],
|
|
301
|
+
required: false,
|
|
302
|
+
skipCheck: true
|
|
303
|
+
}
|
|
196
304
|
});
|
|
197
|
-
const emit = defineEmits([
|
|
305
|
+
const emit = defineEmits([
|
|
306
|
+
"quality-change",
|
|
307
|
+
"download",
|
|
308
|
+
"previous",
|
|
309
|
+
"next",
|
|
310
|
+
"update:loopMode",
|
|
311
|
+
"update:shuffle"
|
|
312
|
+
]);
|
|
198
313
|
defineSlots();
|
|
199
314
|
const slots = useSlots();
|
|
315
|
+
/*********************************************************
|
|
316
|
+
* Icon refs — single source of truth for every transport glyph.
|
|
317
|
+
********************************************************/
|
|
200
318
|
const ICONS = {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
319
|
+
PLAY: MDI_ICONS.PLAY,
|
|
320
|
+
PAUSE: MDI_ICONS.PAUSE,
|
|
321
|
+
PREVIOUS: MDI_ICONS.SKIP_PREVIOUS,
|
|
322
|
+
NEXT: MDI_ICONS.SKIP_NEXT,
|
|
323
|
+
LOOP: MDI_ICONS.REPEAT,
|
|
324
|
+
LOOP_ONE: MDI_ICONS.REPEAT_ONCE,
|
|
325
|
+
SHUFFLE: MDI_ICONS.SHUFFLE,
|
|
326
|
+
COG: MDI_ICONS.COG,
|
|
327
|
+
CAST: MDI_ICONS.CAST,
|
|
328
|
+
DOWNLOAD: MDI_ICONS.DOWNLOAD
|
|
211
329
|
};
|
|
330
|
+
/*********************************************************
|
|
331
|
+
* i18n labels — pre-translated for the ARIA contract. Template
|
|
332
|
+
* stays free of `t(...)` calls (CLAUDE.md "no logic in templates"
|
|
333
|
+
* rule).
|
|
334
|
+
********************************************************/
|
|
212
335
|
const playLabel = computed(() => t("origam.media.play"));
|
|
213
336
|
const pauseLabel = computed(() => t("origam.media.pause"));
|
|
214
337
|
const muteLabel = computed(() => t("origam.media.mute"));
|
|
@@ -229,217 +352,377 @@ const speedLabel = computed(() => t("origam.media.playback_speed"));
|
|
|
229
352
|
const normalSpeedLabel = computed(() => t("origam.media.normal_speed"));
|
|
230
353
|
const qualityLabel = computed(() => t("origam.media.quality"));
|
|
231
354
|
const transportLabel = computed(() => t("origam.media.transport"));
|
|
355
|
+
/*********************************************************
|
|
356
|
+
* Reactive shorthands — surfaced as locals so the template stays
|
|
357
|
+
* free of `props.state.X.value` accesses.
|
|
358
|
+
********************************************************/
|
|
232
359
|
const state = computed(() => props.state);
|
|
233
360
|
const methods = computed(() => props.methods);
|
|
361
|
+
/*********************************************************
|
|
362
|
+
* Play / pause — uses the composable's `play()` / `pause()`
|
|
363
|
+
* methods directly. The parent can observe `state.playing` to
|
|
364
|
+
* paint additional UX (YouTube-style center pulse, …); the side
|
|
365
|
+
* effect is intentionally left to the parent.
|
|
366
|
+
********************************************************/
|
|
234
367
|
function onTogglePlay() {
|
|
235
|
-
|
|
236
|
-
|
|
368
|
+
if (state.value.playing.value) methods.value.pause();
|
|
369
|
+
else methods.value.play();
|
|
237
370
|
}
|
|
371
|
+
/*********************************************************
|
|
372
|
+
* Mute / volume — the volume composable owns the icon swap and
|
|
373
|
+
* the muted-collapse rule (slider sits at 0 when muted=true).
|
|
374
|
+
********************************************************/
|
|
238
375
|
function onToggleMute() {
|
|
239
|
-
|
|
376
|
+
methods.value.toggleMute();
|
|
240
377
|
}
|
|
241
378
|
function onVolumeChangeFromScrubber(value) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
379
|
+
if (value > 0 && state.value.muted.value) methods.value.toggleMute();
|
|
380
|
+
else if (value === 0 && !state.value.muted.value) methods.value.toggleMute();
|
|
381
|
+
methods.value.setVolume(value);
|
|
245
382
|
}
|
|
383
|
+
/*********************************************************
|
|
384
|
+
* Scrubber — both `update:modelValue` (live drag) and `change`
|
|
385
|
+
* (commit) call `seek` so the media tracks the thumb in real
|
|
386
|
+
* time. The native element ignores redundant seeks to the same
|
|
387
|
+
* position so no throttling is needed.
|
|
388
|
+
********************************************************/
|
|
246
389
|
const scrubberMax = computed(() => {
|
|
247
|
-
|
|
390
|
+
return Number.isFinite(state.value.duration.value) ? state.value.duration.value : 0;
|
|
248
391
|
});
|
|
249
392
|
function onScrubberSeek(value) {
|
|
250
|
-
|
|
393
|
+
methods.value.seek(value);
|
|
251
394
|
}
|
|
252
395
|
function onScrubberCommit(value) {
|
|
253
|
-
|
|
396
|
+
methods.value.seek(value);
|
|
254
397
|
}
|
|
255
398
|
function formatScrubberTime(seconds) {
|
|
256
|
-
|
|
399
|
+
return formatMediaTime(seconds);
|
|
257
400
|
}
|
|
401
|
+
/*********************************************************
|
|
402
|
+
* Time display — formatted via the shared util.
|
|
403
|
+
********************************************************/
|
|
258
404
|
const formattedCurrentTime = computed(() => formatMediaTime(state.value.currentTime.value));
|
|
259
405
|
const formattedDuration = computed(() => formatMediaTime(state.value.duration.value));
|
|
406
|
+
/*********************************************************
|
|
407
|
+
* Cast / Remote Playback — visibility gate combines the parent's
|
|
408
|
+
* allow flag with the runtime `remoteAvailable` ref.
|
|
409
|
+
********************************************************/
|
|
260
410
|
const showCastButton = computed(() => {
|
|
261
|
-
|
|
411
|
+
return Boolean(props.allowRemotePlayback) && state.value.remoteAvailable.value;
|
|
262
412
|
});
|
|
263
413
|
const isCasting = computed(() => state.value.remoteState.value === "connected");
|
|
264
414
|
async function onCastClick() {
|
|
265
|
-
|
|
415
|
+
await methods.value.requestRemotePlayback();
|
|
266
416
|
}
|
|
417
|
+
/*********************************************************
|
|
418
|
+
* Previous / next — pure emits. Parents (`<OrigamAudio>` for
|
|
419
|
+
* playlist navigation, `<OrigamVideo>` for chapter / skip) own
|
|
420
|
+
* the action.
|
|
421
|
+
********************************************************/
|
|
267
422
|
function emitPrevious() {
|
|
268
|
-
|
|
423
|
+
emit("previous");
|
|
269
424
|
}
|
|
270
425
|
function emitNext() {
|
|
271
|
-
|
|
426
|
+
emit("next");
|
|
272
427
|
}
|
|
428
|
+
/*********************************************************
|
|
429
|
+
* Tri-state loop — cycles `none → all → one → none …`. The
|
|
430
|
+
* controller owns the cycle but mirrors the value via
|
|
431
|
+
* `update:loopMode` so consumers can use `v-model:loopMode`.
|
|
432
|
+
*
|
|
433
|
+
* #429 — `loopMode` used to be seeded via `ref(props.loopMode ??
|
|
434
|
+
* 'none')`, an EAGER read in the body of `setup()`. Vue runs
|
|
435
|
+
* `setup()` BEFORE the `beforeCreate` hook where the ADR-005
|
|
436
|
+
* theme-props resolver patches `instance.props` (root CLAUDE.md), so
|
|
437
|
+
* a theme default for `loopMode` was captured too late and lost —
|
|
438
|
+
* the trailing `watch()` never fired for the value it needed (a
|
|
439
|
+
* watcher only reacts to a LATER change, never the initial one).
|
|
440
|
+
* `useVModel` seeds its internal ref LAZILY (on first read, at
|
|
441
|
+
* render — after `beforeCreate`), which is exactly the fix already
|
|
442
|
+
* validated elsewhere in the DS for this same ADR-005 trap.
|
|
443
|
+
********************************************************/
|
|
273
444
|
const loopModeModel = useVModel(props, "loopMode", () => "none");
|
|
274
445
|
const resolvedLoopMode = computed(() => loopModeModel.value);
|
|
275
446
|
function cycleLoopMode() {
|
|
276
|
-
|
|
277
|
-
|
|
447
|
+
const next = loopModeModel.value === "none" ? "all" : loopModeModel.value === "all" ? "one" : "none";
|
|
448
|
+
loopModeModel.value = next;
|
|
278
449
|
}
|
|
279
450
|
const loopIcon = computed(() => {
|
|
280
|
-
|
|
451
|
+
return resolvedLoopMode.value === "one" ? ICONS.LOOP_ONE : ICONS.LOOP;
|
|
281
452
|
});
|
|
282
453
|
const isLoopActive = computed(() => resolvedLoopMode.value !== "none");
|
|
283
454
|
const loopAriaLabel = computed(() => {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
455
|
+
if (resolvedLoopMode.value === "one") return loopOneLabel.value;
|
|
456
|
+
if (resolvedLoopMode.value === "all") return loopAllLabel.value;
|
|
457
|
+
return loopOffLabel.value;
|
|
287
458
|
});
|
|
459
|
+
/*********************************************************
|
|
460
|
+
* Shuffle toggle — v-modelled with the parent.
|
|
461
|
+
*
|
|
462
|
+
* #429 — same eager-read/ADR-005 trap as `loopMode` above, same fix.
|
|
463
|
+
********************************************************/
|
|
288
464
|
const shuffleModel = useVModel(props, "shuffle", () => false);
|
|
289
465
|
function toggleShuffle() {
|
|
290
|
-
|
|
466
|
+
shuffleModel.value = !shuffleModel.value;
|
|
291
467
|
}
|
|
468
|
+
/*********************************************************
|
|
469
|
+
* Config menu — `<origam-menu>` with a typed items array. Each
|
|
470
|
+
* row exposes `:title`, optional `:appendText` (for the current
|
|
471
|
+
* value display), optional `:prependIcon`, and `:children` to
|
|
472
|
+
* drill into sub-menus (speed / quality submenus).
|
|
473
|
+
*
|
|
474
|
+
* The download row carries a `data` payload with the URL +
|
|
475
|
+
* filename so the consumer can wire a native `<a download>` via
|
|
476
|
+
* the menu's link contract OR receive the click and route it
|
|
477
|
+
* through their own fetch+blob pipeline.
|
|
478
|
+
********************************************************/
|
|
292
479
|
const configMenuOpen = ref(false);
|
|
293
480
|
const hasQualityOptions = computed(() => props.qualityOptions.length >= 2);
|
|
294
481
|
const hasPlaybackRates = computed(() => (props.playbackRates?.length ?? 0) > 1);
|
|
295
482
|
const canDownload = computed(() => Boolean(props.downloadable) && Boolean(props.downloadUrl));
|
|
296
483
|
const hasConfigContent = computed(() => {
|
|
297
|
-
|
|
484
|
+
return Boolean(slots.configExtra) || hasPlaybackRates.value || hasQualityOptions.value || canDownload.value;
|
|
298
485
|
});
|
|
299
486
|
const formattedPlaybackRate = computed(() => {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
487
|
+
const r = state.value.playbackRate.value;
|
|
488
|
+
if (Math.abs(r - 1) < .01) return normalSpeedLabel.value;
|
|
489
|
+
return `${r}×`;
|
|
303
490
|
});
|
|
304
491
|
const formattedQuality = computed(() => {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
492
|
+
if (!props.currentQuality) return "";
|
|
493
|
+
const match = props.qualityOptions.find((q) => q.quality === props.currentQuality);
|
|
494
|
+
return match?.label ?? props.currentQuality;
|
|
308
495
|
});
|
|
496
|
+
/*********************************************************
|
|
497
|
+
* configMenuItems
|
|
498
|
+
*
|
|
499
|
+
* Each leaf item carries its OWN `onClick`, dispatched through the
|
|
500
|
+
* underlying `<OrigamListItem>`; parent rows that open a submenu
|
|
501
|
+
* purposely have NO click (the menu toggles the submenu on
|
|
502
|
+
* hover/click via its own activator binding).
|
|
503
|
+
*
|
|
504
|
+
* `<OrigamMenu>` also emits `select` for a picked leaf row, so this
|
|
505
|
+
* component deliberately does NOT listen for it: both channels fire
|
|
506
|
+
* on the same click, and routing both into `onConfigSelect` emitted
|
|
507
|
+
* `download` twice per click (and called `setPlaybackRate` /
|
|
508
|
+
* `quality-change` twice). The per-item handler is the one kept
|
|
509
|
+
* because `handleDownloadClick` needs the real `MouseEvent` to
|
|
510
|
+
* `preventDefault()` the cross-origin anchor navigation — the
|
|
511
|
+
* `select` payload is the item object, not the event.
|
|
512
|
+
********************************************************/
|
|
309
513
|
const configMenuItems = computed(() => {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
514
|
+
const items = [];
|
|
515
|
+
if (hasPlaybackRates.value) {
|
|
516
|
+
items.push({
|
|
517
|
+
title: speedLabel.value,
|
|
518
|
+
appendText: formattedPlaybackRate.value,
|
|
519
|
+
key: "speed-root",
|
|
520
|
+
children: props.playbackRates.map((rate) => ({
|
|
521
|
+
title: rate === 1 ? normalSpeedLabel.value : `${rate}×`,
|
|
522
|
+
key: `speed-${rate}`,
|
|
523
|
+
value: rate,
|
|
524
|
+
link: true,
|
|
525
|
+
onClick: () => onConfigSelect({
|
|
526
|
+
title: rate === 1 ? normalSpeedLabel.value : `${rate}×`,
|
|
527
|
+
key: `speed-${rate}`,
|
|
528
|
+
value: rate
|
|
529
|
+
})
|
|
530
|
+
}))
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
if (hasQualityOptions.value) {
|
|
534
|
+
items.push({
|
|
535
|
+
title: qualityLabel.value,
|
|
536
|
+
appendText: formattedQuality.value,
|
|
537
|
+
key: "quality-root",
|
|
538
|
+
children: props.qualityOptions.map((q) => ({
|
|
539
|
+
title: q.label,
|
|
540
|
+
key: `quality-${q.quality}`,
|
|
541
|
+
value: q.quality,
|
|
542
|
+
link: true,
|
|
543
|
+
onClick: () => onConfigSelect({
|
|
544
|
+
title: q.label,
|
|
545
|
+
key: `quality-${q.quality}`,
|
|
546
|
+
value: q.quality
|
|
547
|
+
})
|
|
548
|
+
}))
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
if (canDownload.value) {
|
|
552
|
+
/*
|
|
553
|
+
* Hybrid download strategy:
|
|
554
|
+
*
|
|
555
|
+
* - Same-origin / `data:` / `blob:` URLs → native
|
|
556
|
+
* `<a href download>` does the job. Cheap, one frame,
|
|
557
|
+
* no network round-trip, browser owns the user gesture.
|
|
558
|
+
*
|
|
559
|
+
* - Cross-origin URLs → the HTML spec IGNORES the
|
|
560
|
+
* `download` attribute (anti-phishing safeguard). The
|
|
561
|
+
* anchor would just NAVIGATE to the media URL, which
|
|
562
|
+
* the browser then opens inline (the user's exact
|
|
563
|
+
* report: "le contenu est remplacé par l'audio natif").
|
|
564
|
+
* We `preventDefault()` and route through `fetch` →
|
|
565
|
+
* blob → `URL.createObjectURL` → blob URL anchor click.
|
|
566
|
+
* The blob URL IS same-origin so the `download`
|
|
567
|
+
* attribute on the second anchor IS honoured.
|
|
568
|
+
*
|
|
569
|
+
* - Cross-origin without CORS (server rejects the fetch)
|
|
570
|
+
* → `window.open(url, '_blank')` so the user at least
|
|
571
|
+
* gets the file in a new tab rather than the current
|
|
572
|
+
* page being replaced by an inline media viewer.
|
|
573
|
+
*
|
|
574
|
+
* The user gesture is preserved across the async fetch:
|
|
575
|
+
* the click handler kicks off `fetch` from inside the
|
|
576
|
+
* synchronous gesture, and modern browsers extend the user
|
|
577
|
+
* activation flag through the subsequent `a.click()` on
|
|
578
|
+
* the blob URL. This is the same approach `<OrigamVideo>`
|
|
579
|
+
* shipped before its CORS-enabled CDN made it unnecessary.
|
|
580
|
+
*/
|
|
581
|
+
items.push({
|
|
582
|
+
title: downloadLabel.value,
|
|
583
|
+
prependIcon: ICONS.DOWNLOAD,
|
|
584
|
+
key: "download",
|
|
585
|
+
href: props.downloadUrl ?? undefined,
|
|
586
|
+
download: props.downloadFilename || "",
|
|
587
|
+
rel: "noopener",
|
|
588
|
+
onClick: handleDownloadClick
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
return items;
|
|
359
592
|
});
|
|
360
593
|
function onConfigSelect(item) {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
594
|
+
if (!item) return;
|
|
595
|
+
if (item.key.startsWith("speed-") && typeof item.value === "number") {
|
|
596
|
+
methods.value.setPlaybackRate(item.value);
|
|
597
|
+
configMenuOpen.value = false;
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
if (item.key.startsWith("quality-") && typeof item.value === "string") {
|
|
601
|
+
emit("quality-change", item.value);
|
|
602
|
+
configMenuOpen.value = false;
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
372
605
|
}
|
|
606
|
+
/*********************************************************
|
|
607
|
+
* Download teardown (#706)
|
|
608
|
+
*
|
|
609
|
+
* The cross-origin download path below leaves TWO pieces of async
|
|
610
|
+
* work behind that nothing used to cancel:
|
|
611
|
+
* - the `fetch` promise chain, whose `.catch()` dereferences
|
|
612
|
+
* `window`;
|
|
613
|
+
* - a 30s `setTimeout` that revokes the blob URL.
|
|
614
|
+
*
|
|
615
|
+
* Both outlive the component. Under Vitest that is not merely a
|
|
616
|
+
* leak: the continuation lands AFTER the jsdom environment is torn
|
|
617
|
+
* down, `window` no longer exists, and the resulting unhandled
|
|
618
|
+
* rejection fails the whole run with zero red tests. Measured three
|
|
619
|
+
* times in CI (#701 / #704 / #715), twice on a PR containing only a
|
|
620
|
+
* CSV file.
|
|
621
|
+
*
|
|
622
|
+
* `AbortController` is the platform mechanism for this: aborting on
|
|
623
|
+
* unmount rejects the in-flight fetch, and `signal.aborted` is the
|
|
624
|
+
* guard that keeps the rejection handler from touching `window`
|
|
625
|
+
* once the component is gone.
|
|
626
|
+
*
|
|
627
|
+
* @description
|
|
628
|
+
* `pendingRevokes` maps a blob URL whose deferred revoke has not
|
|
629
|
+
* fired yet to the timer handle that will revoke it, so unmount can
|
|
630
|
+
* cancel the timer and revoke immediately instead of leaving a 30s
|
|
631
|
+
* `window.setTimeout` pointing at a dead component.
|
|
632
|
+
********************************************************/
|
|
373
633
|
const downloadAbort = new AbortController();
|
|
374
|
-
const pendingRevokes =
|
|
634
|
+
const pendingRevokes = new Map();
|
|
375
635
|
onBeforeUnmount(() => {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
636
|
+
downloadAbort.abort();
|
|
637
|
+
for (const [blobUrl, handle] of pendingRevokes) {
|
|
638
|
+
window.clearTimeout(handle);
|
|
639
|
+
URL.revokeObjectURL(blobUrl);
|
|
640
|
+
}
|
|
641
|
+
pendingRevokes.clear();
|
|
382
642
|
});
|
|
643
|
+
/*********************************************************
|
|
644
|
+
* handleDownloadClick
|
|
645
|
+
*
|
|
646
|
+
* Wired on the cog-menu Download row. Detects same-origin vs
|
|
647
|
+
* cross-origin URLs and routes accordingly (see big comment block
|
|
648
|
+
* on the item factory above). Always closes the menu and emits
|
|
649
|
+
* `download` so consumers observe the intent immediately.
|
|
650
|
+
********************************************************/
|
|
383
651
|
function handleDownloadClick(event) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
652
|
+
emit("download");
|
|
653
|
+
configMenuOpen.value = false;
|
|
654
|
+
const url = props.downloadUrl;
|
|
655
|
+
if (!url) {
|
|
656
|
+
event.preventDefault();
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
660
|
+
const isSameOriginOrLocal = (raw) => {
|
|
661
|
+
if (raw.startsWith("data:") || raw.startsWith("blob:")) return true;
|
|
662
|
+
try {
|
|
663
|
+
const u = new URL(raw, window.location.href);
|
|
664
|
+
return u.origin === window.location.origin;
|
|
665
|
+
} catch {
|
|
666
|
+
return true;
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
// Same-origin / data: / blob: → the native anchor click is
|
|
670
|
+
// already correct (download attribute is honoured). Let the
|
|
671
|
+
// browser's default action proceed — we don't preventDefault.
|
|
672
|
+
if (isSameOriginOrLocal(url)) return;
|
|
673
|
+
// Cross-origin: cancel the native navigation; route through
|
|
674
|
+
// `fetch` → blob → blob URL anchor.
|
|
675
|
+
event.preventDefault();
|
|
676
|
+
const filename = props.downloadFilename || url.split("?")[0].split("/").pop() || "download";
|
|
677
|
+
const triggerAnchor = (href) => {
|
|
678
|
+
const a = document.createElement("a");
|
|
679
|
+
a.href = href;
|
|
680
|
+
a.download = filename;
|
|
681
|
+
a.rel = "noopener";
|
|
682
|
+
a.style.display = "none";
|
|
683
|
+
document.body.appendChild(a);
|
|
684
|
+
a.click();
|
|
685
|
+
document.body.removeChild(a);
|
|
686
|
+
};
|
|
687
|
+
fetch(url, {
|
|
688
|
+
mode: "cors",
|
|
689
|
+
credentials: "omit",
|
|
690
|
+
signal: downloadAbort.signal
|
|
691
|
+
}).then((response) => {
|
|
692
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
693
|
+
return response.blob();
|
|
694
|
+
}).then((blob) => {
|
|
695
|
+
if (downloadAbort.signal.aborted) return;
|
|
696
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
697
|
+
triggerAnchor(blobUrl);
|
|
698
|
+
// Defer revoke so the browser has time to start streaming.
|
|
699
|
+
// 30s is generous; multi-GB files might need more but
|
|
700
|
+
// holding the blob in memory beyond that is wasteful.
|
|
701
|
+
const handle = window.setTimeout(() => {
|
|
702
|
+
pendingRevokes.delete(blobUrl);
|
|
703
|
+
URL.revokeObjectURL(blobUrl);
|
|
704
|
+
}, 3e4);
|
|
705
|
+
pendingRevokes.set(blobUrl, handle);
|
|
706
|
+
}).catch(() => {
|
|
707
|
+
if (downloadAbort.signal.aborted) return;
|
|
708
|
+
// CORS-denied or offline. Last-resort: open the URL in
|
|
709
|
+
// a new tab so the user is NOT stuck on a page replaced
|
|
710
|
+
// by an inline media viewer.
|
|
711
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
712
|
+
});
|
|
430
713
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
]);
|
|
714
|
+
/*********************************************************
|
|
715
|
+
* Class & Style
|
|
716
|
+
********************************************************/
|
|
717
|
+
const rootClasses = computed(() => [{
|
|
718
|
+
"origam-media-controller--inset": props.inset,
|
|
719
|
+
"origam-media-controller--visible": props.visible
|
|
720
|
+
}, props.class]);
|
|
438
721
|
const style = computed(() => props.style);
|
|
439
722
|
defineExpose({
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
723
|
+
configMenuOpen,
|
|
724
|
+
resolvedLoopMode,
|
|
725
|
+
internalShuffle: shuffleModel
|
|
443
726
|
});
|
|
444
727
|
</script>
|
|
445
728
|
|