@leavepulse/ui 0.81.0 → 0.83.0
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/dist/assets/LpVideoTrim-BcGs3Sh0.css +8 -0
- package/dist/assets/VideoFlash-VuPkC7QV.css +23 -0
- package/dist/chunks/{ContextMenuItems-DLK4q-mm.js → ContextMenuItems-h-apPY2d.js} +1 -1
- package/dist/chunks/{DropzoneLinkField-CcJu8De3.js → DropzoneLinkField-_Op8b_ee.js} +1 -1
- package/dist/chunks/{FieldLeading-CldGLINn.js → FieldLeading-mOMcwNqi.js} +1 -1
- package/dist/chunks/{FieldWrapper-Cj8ZgoKp.js → FieldWrapper-DtT-AIcn.js} +1 -1
- package/dist/chunks/{IconCloseButton-CV4iHRpy.js → IconCloseButton-YmisskyZ.js} +1 -1
- package/dist/chunks/{LayoutCanvas-BQbq7Ekw.js → LayoutCanvas-BrISZEBr.js} +1 -1
- package/dist/chunks/{LayoutNode-BMedRk3g.js → LayoutNode-CwMQ8ACa.js} +1 -1
- package/dist/chunks/{LpActionBar-C7g52Cyo.js → LpActionBar-CVVC6YbC.js} +1 -1
- package/dist/chunks/{LpAddressInput-1uakhQk5.js → LpAddressInput-tiuJ-bru.js} +7 -7
- package/dist/chunks/{LpAlert-DWFeR82L.js → LpAlert-8-x4H_Nk.js} +1 -1
- package/dist/chunks/{LpAppShell-BBINfN1v.js → LpAppShell-BW2YMq-A.js} +4 -4
- package/dist/chunks/{LpAutocomplete-DY3LvpB9.js → LpAutocomplete-BZODIops.js} +4 -4
- package/dist/chunks/{LpAvatar-CEZmMcGh.js → LpAvatar-BZq4nH53.js} +1 -1
- package/dist/chunks/{LpBadge-C_VqLHtg.js → LpBadge-Cz0pSSUu.js} +1 -1
- package/dist/chunks/{LpBottomNav-4I89sPDZ.js → LpBottomNav-DVdR5Mry.js} +1 -1
- package/dist/chunks/{LpBreadcrumbs-1BBzrfxG.js → LpBreadcrumbs-B2jphAel.js} +1 -1
- package/dist/chunks/{LpCalendar-D2dcXjUK.js → LpCalendar-C0_N5LVT.js} +1 -1
- package/dist/chunks/{LpCheckbox-CN-MEnbX.js → LpCheckbox-CwqLNdw4.js} +2 -2
- package/dist/chunks/{LpCodeBlock-Cj7zk4QE.js → LpCodeBlock-Dcss6bnl.js} +2 -2
- package/dist/chunks/{LpCodeDisplay-COzosm77.js → LpCodeDisplay-CLms1zDY.js} +4 -4
- package/dist/chunks/{LpColorPicker-BezW6DX1.js → LpColorPicker-CbIY450X.js} +3 -3
- package/dist/chunks/{LpConfirmDialog-D9GkDMYr.js → LpConfirmDialog-RmP4z6va.js} +2 -2
- package/dist/chunks/{LpConfirmHost-BH7kf0dm.js → LpConfirmHost-DheBgRMB.js} +1 -1
- package/dist/chunks/{LpContextMenu-bn5bc9t7.js → LpContextMenu-DIYhlap8.js} +2 -2
- package/dist/chunks/{LpContextSwitcher-CGr6ZAuq.js → LpContextSwitcher-fDA6ERl-.js} +2 -2
- package/dist/chunks/{LpCopyButton-BSr6YaFR.js → LpCopyButton-DSqKFGEb.js} +1 -1
- package/dist/chunks/{LpDataList-Cv7ZUlyy.js → LpDataList-f9UjSx9m.js} +2 -2
- package/dist/chunks/{LpDatePicker-CR7vsb5M.js → LpDatePicker-3kDQLVbg.js} +5 -5
- package/dist/chunks/{LpDateRangePicker-B9fRO3G6.js → LpDateRangePicker-DUPiTt0_.js} +3 -3
- package/dist/chunks/{LpDisclosure-CE4mneaE.js → LpDisclosure-C5WZjhbQ.js} +1 -1
- package/dist/chunks/{LpDrawer-DU_5MqBz.js → LpDrawer-CkYvIGIa.js} +1 -1
- package/dist/chunks/{LpDropdownMenu-_u6GPWhp.js → LpDropdownMenu-zSsK2Xra.js} +6 -3
- package/dist/chunks/{LpEditable-DYoMayjt.js → LpEditable-CP7Y_lKg.js} +2 -2
- package/dist/chunks/{LpEmptyState-DpdHeSfz.js → LpEmptyState-dsc5x-ya.js} +1 -1
- package/dist/chunks/{LpFieldNotice-DONFCWV7.js → LpFieldNotice-TOTbWvgv.js} +1 -1
- package/dist/chunks/{LpFileTree-f5ktGqsN.js → LpFileTree-BPjnOTln.js} +4 -4
- package/dist/chunks/{LpFileTreeNode-nbp-JwV9.js → LpFileTreeNode-_-MiWmie.js} +4 -4
- package/dist/chunks/{LpFormField-Bz50_LZW.js → LpFormField-BJwD1iEF.js} +1 -1
- package/dist/chunks/{LpHintLayer-B6bA5Cb_.js → LpHintLayer-CmfGnxYu.js} +1 -1
- package/dist/chunks/{LpHints-DyJ5hVcr.js → LpHints-C2Xvc1Fd.js} +3 -3
- package/dist/chunks/{LpIcon-BCQLuHSP.js → LpIcon-CoOLz1oJ.js} +1 -1
- package/dist/chunks/{LpInfraNode-BS1RXYAs.js → LpInfraNode-CW3qsM-U.js} +2 -2
- package/dist/chunks/{LpInput-BjbXdjcW.js → LpInput-BVWhkPuN.js} +3 -3
- package/dist/chunks/{LpInspector-BIyJyM6r.js → LpInspector-REmoX_es.js} +4 -4
- package/dist/chunks/{LpLightbox-CSAJuUaJ.js → LpLightbox-C3FFTYP5.js} +65 -20
- package/dist/chunks/{LpLogInspector-OJEz1vod.js → LpLogInspector-Cs8Z_fM0.js} +2 -2
- package/dist/chunks/{LpLogViewer-CRLwQpk0.js → LpLogViewer-DQRGe-ZK.js} +6 -6
- package/dist/chunks/{LpMapPicker-DW2EnrCJ.js → LpMapPicker-CQnQPgKm.js} +1 -1
- package/dist/chunks/{LpMediaGallery-BNEYctDP.js → LpMediaGallery-DkKqTy9P.js} +20 -8
- package/dist/chunks/{LpModal-DdTqdf4x.js → LpModal-DwejR7VP.js} +1 -1
- package/dist/chunks/{LpModalNav-BL7Dp0om.js → LpModalNav-D1-dSe6f.js} +3 -3
- package/dist/chunks/{LpNotificationBell-d0F6MWxD.js → LpNotificationBell-EKLkN0sp.js} +4 -4
- package/dist/chunks/{LpNotificationFeed-BIe5lapb.js → LpNotificationFeed-Dc-yQ4NH.js} +4 -4
- package/dist/chunks/{LpNumberField-D5Dx-hzD.js → LpNumberField-DvUjEMp-.js} +3 -3
- package/dist/chunks/{LpOtpInput-BVl74Lfl.js → LpOtpInput-xvDO14f4.js} +1 -1
- package/dist/chunks/{LpPagination-D0wb-Uru.js → LpPagination-BFZY8dFn.js} +1 -1
- package/dist/chunks/{LpPaletteTheme-DdilCBXA.js → LpPaletteTheme-EBJv0Bwz.js} +2 -2
- package/dist/chunks/{LpPasswordInput-DUtqWMkA.js → LpPasswordInput-DRJR3fF1.js} +2 -2
- package/dist/chunks/{LpPhoneInput-CalRjkqc.js → LpPhoneInput-BGOOtUoW.js} +3 -3
- package/dist/chunks/{LpPie-BVAEmVBT.js → LpPie-Deyn8h5J.js} +2 -2
- package/dist/chunks/{LpPipeline-Dk7_sRP1.js → LpPipeline-9ChjeNh5.js} +2 -2
- package/dist/chunks/{LpQuota-DKx0IZYA.js → LpQuota-CNh5eF_p.js} +1 -1
- package/dist/chunks/{LpRadioGroup-E3SP6j9h.js → LpRadioGroup-Br2Nl9Gr.js} +2 -2
- package/dist/chunks/{LpRangeCalendar-BFJFaen4.js → LpRangeCalendar-D66Y3U_w.js} +1 -1
- package/dist/chunks/{LpRangeSlider-b6ipywRB.js → LpRangeSlider-eX-fIlOw.js} +1 -1
- package/dist/chunks/{LpRepeater-BLrw62Bh.js → LpRepeater-0XvnlVd_.js} +2 -2
- package/dist/chunks/{LpSecretField-BV8BNjKc.js → LpSecretField-1RCooChq.js} +5 -5
- package/dist/chunks/{LpSection-CghNNxIv.js → LpSection-B9gbJJcP.js} +1 -1
- package/dist/chunks/{LpSegmented-DjvrHL_G.js → LpSegmented-hIjGzGTo.js} +2 -2
- package/dist/chunks/{LpSelect-DYPimzAZ.js → LpSelect-DugubwTc.js} +4 -4
- package/dist/chunks/{LpSidebar-D3S8rYFf.js → LpSidebar-DevSoN8W.js} +4 -4
- package/dist/chunks/{LpSidebarNav-Dlse8vxT.js → LpSidebarNav-DwQQ3KXe.js} +3 -3
- package/dist/chunks/{LpSidebarRow-Cqd_6tGG.js → LpSidebarRow-CAGgtJCS.js} +3 -3
- package/dist/chunks/{LpSlider-B9XIC75O.js → LpSlider-1fHpVxpB.js} +1 -1
- package/dist/chunks/{LpStat-kyLRmX-m.js → LpStat-Cm9-FaWQ.js} +2 -2
- package/dist/chunks/{LpStatus-szB2dWzM.js → LpStatus-CE8FSAT1.js} +1 -1
- package/dist/chunks/{LpStepMark-DP3CDSm9.js → LpStepMark-BWSlV69R.js} +1 -1
- package/dist/chunks/{LpStepper-BS3iaJIz.js → LpStepper-1D0ZA7Nx.js} +1 -1
- package/dist/chunks/{LpSwitch-DRFy8RNr.js → LpSwitch-D_kvE0oQ.js} +1 -1
- package/dist/chunks/{LpTabFace-C9-OperL.js → LpTabFace-CpbFKi-N.js} +2 -2
- package/dist/chunks/{LpTableFilter-CEIwLupk.js → LpTableFilter-BYHyCu38.js} +2 -2
- package/dist/chunks/{LpTagsInput-ClDeF_aU.js → LpTagsInput-Cqm38t5N.js} +5 -5
- package/dist/chunks/{LpTextarea-DEY6pUBy.js → LpTextarea-DaSKBkiV.js} +1 -1
- package/dist/chunks/{LpThemeStudio-WY72Z1Db.js → LpThemeStudio-BNdfi-Ds.js} +5 -5
- package/dist/chunks/{LpThemeSwitcher-9uCH9c-K.js → LpThemeSwitcher-CbC1nqBP.js} +3 -3
- package/dist/chunks/{LpTimeField-BmgxCzQO.js → LpTimeField-CCfPCWPT.js} +2 -2
- package/dist/chunks/{LpToaster-DLKO-efn.js → LpToaster-BhlI7h-h.js} +2 -2
- package/dist/chunks/{LpTopologyCanvas-B-PhPa7k.js → LpTopologyCanvas-DlKbu7E5.js} +4 -4
- package/dist/chunks/{LpTour-ODlBcat2.js → LpTour-CSLerA1B.js} +1 -1
- package/dist/chunks/{LpTruncate--nhT0iUo.js → LpTruncate-Ct26BSYB.js} +1 -1
- package/dist/chunks/{LpVideoBackdrop-Ct4St4ZL.js → LpVideoBackdrop-57i8RY8g.js} +1 -2
- package/dist/chunks/LpVideoPlayer-DcWd9DDW.js +813 -0
- package/dist/chunks/{LpWindow-DJxE8Zl-.js → LpWindow-YnF_knSj.js} +2 -2
- package/dist/chunks/{LpWorkspaceSwitcher-Bpf41Bw5.js → LpWorkspaceSwitcher-B-5UU6o4.js} +3 -3
- package/dist/chunks/{MenuTitle-CMjvLsvC.js → MenuTitle-BnZbFSwq.js} +1 -1
- package/dist/chunks/{OptionContent-DY8NaG8s.js → OptionContent-D5e_eklA.js} +1 -1
- package/dist/chunks/{PickerField-CgfkaBgg.js → PickerField-KpHiowNI.js} +1 -1
- package/dist/chunks/{RevealToggle-CPMXxaKv.js → RevealToggle-CE1hAIJB.js} +1 -1
- package/dist/chunks/SteadyText-CwH-kduj.js +25 -0
- package/dist/chunks/{TourCard-D4b3lMHi.js → TourCard-t2csiTDS.js} +1 -1
- package/dist/chunks/VideoThumb-Csf9bUz3.js +67 -0
- package/dist/chunks/VideoVolume-B4_DNmNi.js +68 -0
- package/dist/chunks/icons-CdSlCrle.js +59 -0
- package/dist/component-names.d.ts +1 -1
- package/dist/components/ContextMenuItems.vue.js +1 -1
- package/dist/components/DropzoneLinkField.vue.js +1 -1
- package/dist/components/FieldLeading.vue.js +1 -1
- package/dist/components/FieldWrapper.vue.js +1 -1
- package/dist/components/IconCloseButton.vue.js +1 -1
- package/dist/components/LayoutCanvas.vue.js +1 -1
- package/dist/components/LayoutNode.vue.js +1 -1
- package/dist/components/LpActionBar.vue.js +1 -1
- package/dist/components/LpAddressInput.vue.js +1 -1
- package/dist/components/LpAlert.vue.js +1 -1
- package/dist/components/LpAppShell.vue.js +1 -1
- package/dist/components/LpAutocomplete.vue.js +1 -1
- package/dist/components/LpAvatar.vue.js +1 -1
- package/dist/components/LpBadge.vue.js +1 -1
- package/dist/components/LpBottomNav.vue.js +1 -1
- package/dist/components/LpBreadcrumbs.vue.js +1 -1
- package/dist/components/LpCalendar.vue.js +1 -1
- package/dist/components/LpChart.vue.js +2 -2
- package/dist/components/LpCheckbox.vue.js +1 -1
- package/dist/components/LpCodeBlock.vue.js +1 -1
- package/dist/components/LpCodeDisplay.vue.js +1 -1
- package/dist/components/LpColorPicker.vue.js +1 -1
- package/dist/components/LpCommandPalette.vue.js +2 -2
- package/dist/components/LpConfirmDialog.vue.js +1 -1
- package/dist/components/LpConfirmHost.vue.js +1 -1
- package/dist/components/LpContextMenu.vue.js +1 -1
- package/dist/components/LpContextSwitcher.vue.js +1 -1
- package/dist/components/LpCopyButton.vue.js +1 -1
- package/dist/components/LpDataList.vue.js +1 -1
- package/dist/components/LpDatePicker.vue.js +1 -1
- package/dist/components/LpDateRangePicker.vue.js +1 -1
- package/dist/components/LpDisclosure.vue.js +1 -1
- package/dist/components/LpDock.vue.js +1 -1
- package/dist/components/LpDrawer.vue.js +1 -1
- package/dist/components/LpDropdownMenu.vue.d.ts +5 -1
- package/dist/components/LpDropdownMenu.vue.js +1 -1
- package/dist/components/LpDropzone.vue.js +2 -2
- package/dist/components/LpEditable.vue.js +1 -1
- package/dist/components/LpEmptyState.vue.js +1 -1
- package/dist/components/LpFieldNotice.vue.js +1 -1
- package/dist/components/LpFileTree.vue.js +1 -1
- package/dist/components/LpFileTreeNode.vue.js +1 -1
- package/dist/components/LpFormField.vue.js +1 -1
- package/dist/components/LpHintLayer.vue.js +1 -1
- package/dist/components/LpHints.vue.js +1 -1
- package/dist/components/LpIcon.vue.js +1 -1
- package/dist/components/LpImageEditor.vue.js +1 -1
- package/dist/components/LpInfraNode.vue.js +1 -1
- package/dist/components/LpInput.vue.js +1 -1
- package/dist/components/LpInspector.vue.js +1 -1
- package/dist/components/LpLightbox.vue.js +1 -1
- package/dist/components/LpLogInspector.vue.js +1 -1
- package/dist/components/LpLogViewer.vue.js +1 -1
- package/dist/components/LpMapPicker.vue.js +1 -1
- package/dist/components/LpMediaGallery.vue.d.ts +1 -1
- package/dist/components/LpMediaGallery.vue.js +1 -1
- package/dist/components/LpModal.vue.js +1 -1
- package/dist/components/LpModalNav.vue.js +1 -1
- package/dist/components/LpNotificationBell.vue.js +1 -1
- package/dist/components/LpNotificationFeed.vue.js +1 -1
- package/dist/components/LpNumberField.vue.js +1 -1
- package/dist/components/LpOtpInput.vue.js +1 -1
- package/dist/components/LpPagination.vue.js +1 -1
- package/dist/components/LpPaletteFacts.vue.js +1 -1
- package/dist/components/LpPaletteHeader.vue.js +2 -2
- package/dist/components/LpPaletteTheme.vue.js +1 -1
- package/dist/components/LpPasswordInput.vue.js +1 -1
- package/dist/components/LpPhoneInput.vue.js +1 -1
- package/dist/components/LpPie.vue.js +1 -1
- package/dist/components/LpPipeline.vue.js +1 -1
- package/dist/components/LpQuota.vue.js +1 -1
- package/dist/components/LpRadioGroup.vue.js +1 -1
- package/dist/components/LpRangeCalendar.vue.js +1 -1
- package/dist/components/LpRangeSlider.vue.js +1 -1
- package/dist/components/LpRepeater.vue.js +1 -1
- package/dist/components/LpSecretField.vue.js +1 -1
- package/dist/components/LpSection.vue.js +1 -1
- package/dist/components/LpSegmented.vue.js +1 -1
- package/dist/components/LpSelect.vue.js +1 -1
- package/dist/components/LpShortcutsDialog.vue.js +1 -1
- package/dist/components/LpSidebar.vue.js +1 -1
- package/dist/components/LpSidebarNav.vue.js +1 -1
- package/dist/components/LpSidebarRow.vue.js +1 -1
- package/dist/components/LpSlider.vue.js +1 -1
- package/dist/components/LpStat.vue.js +1 -1
- package/dist/components/LpStatus.vue.js +1 -1
- package/dist/components/LpStepMark.vue.js +1 -1
- package/dist/components/LpStepper.vue.js +1 -1
- package/dist/components/LpSwitch.vue.js +1 -1
- package/dist/components/LpTabFace.vue.js +1 -1
- package/dist/components/LpTable.vue.js +9 -9
- package/dist/components/LpTableFilter.vue.js +1 -1
- package/dist/components/LpTabs.vue.js +2 -2
- package/dist/components/LpTagsInput.vue.js +1 -1
- package/dist/components/LpTextarea.vue.js +1 -1
- package/dist/components/LpThemeStudio.vue.js +1 -1
- package/dist/components/LpThemeSwitcher.vue.js +1 -1
- package/dist/components/LpTimeField.vue.js +1 -1
- package/dist/components/LpToaster.vue.js +1 -1
- package/dist/components/LpTopologyCanvas.vue.js +1 -1
- package/dist/components/LpTour.vue.js +1 -1
- package/dist/components/LpTruncate.vue.js +1 -1
- package/dist/components/LpVideoBackdrop.vue.js +1 -1
- package/dist/components/LpVideoPlayer.vue.d.ts +111 -0
- package/dist/components/LpVideoPlayer.vue.js +4 -0
- package/dist/components/LpVideoTrim.vue.d.ts +82 -0
- package/dist/components/LpVideoTrim.vue.js +1106 -0
- package/dist/components/LpWindow.vue.js +1 -1
- package/dist/components/LpWorkspaceSwitcher.vue.js +1 -1
- package/dist/components/MenuTitle.vue.js +1 -1
- package/dist/components/OptionContent.vue.js +1 -1
- package/dist/components/PickerField.vue.js +1 -1
- package/dist/components/RevealToggle.vue.js +1 -1
- package/dist/components/SteadyText.vue.d.ts +7 -0
- package/dist/components/SteadyText.vue.js +4 -0
- package/dist/components/TourCard.vue.js +1 -1
- package/dist/components/VideoFlash.vue.d.ts +10 -0
- package/dist/components/VideoFlash.vue.js +33 -0
- package/dist/components/VideoThumb.vue.d.ts +12 -0
- package/dist/components/VideoThumb.vue.js +4 -0
- package/dist/components/VideoVolume.vue.d.ts +15 -0
- package/dist/components/VideoVolume.vue.js +4 -0
- package/dist/components/chartWindow.js +4 -8
- package/dist/components/lightbox.d.ts +13 -0
- package/dist/components/lightbox.js +11 -1
- package/dist/components/menuWhen.js +1 -1
- package/dist/components/videoBackdrop.d.ts +15 -2
- package/dist/components/videoBackdrop.js +8 -2
- package/dist/components/videoFrames.d.ts +37 -0
- package/dist/components/videoFrames.js +134 -0
- package/dist/components/videoMotion.d.ts +28 -0
- package/dist/components/videoMotion.js +26 -0
- package/dist/components/videoTrim.d.ts +68 -0
- package/dist/components/videoTrim.js +121 -0
- package/dist/composables/span.d.ts +10 -0
- package/dist/composables/span.js +15 -0
- package/dist/composables/useVideoMedia.d.ts +74 -0
- package/dist/composables/useVideoMedia.js +291 -0
- package/dist/icons-all.js +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +186 -174
- package/package.json +1 -1
- package/src/component-names.ts +2 -0
- package/src/components/LpDropdownMenu.vue +4 -0
- package/src/components/LpLightbox.vue +61 -8
- package/src/components/LpMediaGallery.vue +19 -2
- package/src/components/LpVideoBackdrop.vue +1 -7
- package/src/components/LpVideoPlayer.vue +774 -0
- package/src/components/LpVideoTrim.vue +1066 -0
- package/src/components/SteadyText.vue +21 -0
- package/src/components/VideoFlash.vue +52 -0
- package/src/components/VideoThumb.vue +66 -0
- package/src/components/VideoVolume.vue +63 -0
- package/src/components/chartWindow.ts +4 -8
- package/src/components/lightbox.ts +23 -0
- package/src/components/videoBackdrop.ts +20 -3
- package/src/components/videoFrames.ts +171 -0
- package/src/components/videoMotion.ts +38 -0
- package/src/components/videoTrim.ts +186 -0
- package/src/composables/span.ts +21 -0
- package/src/composables/useVideoMedia.ts +411 -0
- package/src/index.ts +7 -1
- package/src/kit-icons.ts +1 -1
- package/dist/chunks/icons-C1vppR4f.js +0 -59
|
@@ -0,0 +1,1106 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, watch, shallowRef, nextTick, onMounted, onBeforeUnmount, openBlock, createElementBlock, mergeProps, unref, createVNode, withCtx, createElementVNode, toHandlers, Transition, normalizeProps, guardReactiveProps, normalizeStyle, Fragment, renderList, normalizeClass, createCommentVNode, toDisplayString, renderSlot, createBlock, createTextVNode, TransitionGroup, withKeys, withModifiers } from "vue";
|
|
2
|
+
import { startPointerDrag } from "../composables/pointerDrag.js";
|
|
3
|
+
import { nodeWindow, isHTMLElement } from "../composables/realm.js";
|
|
4
|
+
import { useLabels } from "../composables/useLpConfig.js";
|
|
5
|
+
import { useMergedAttrs } from "../composables/useMergedClass.js";
|
|
6
|
+
import { useResizeObserver } from "../composables/useResizeObserver.js";
|
|
7
|
+
import { usePrefersReducedMotion } from "../composables/useReducedMotion.js";
|
|
8
|
+
import { useVideoMedia } from "../composables/useVideoMedia.js";
|
|
9
|
+
import { _ as _sfc_main$3 } from "../chunks/LpButton-DSHioIfD.js";
|
|
10
|
+
import { _ as _sfc_main$2 } from "../chunks/LpIcon-CoOLz1oJ.js";
|
|
11
|
+
import { _ as _sfc_main$1 } from "../chunks/LpContextMenu-DIYhlap8.js";
|
|
12
|
+
import { _ as _sfc_main$6 } from "../chunks/LpInput-BVWhkPuN.js";
|
|
13
|
+
import { _ as _sfc_main$4 } from "../chunks/SteadyText-CwH-kduj.js";
|
|
14
|
+
import VideoFlash from "./VideoFlash.vue.js";
|
|
15
|
+
import { _ as _sfc_main$5 } from "../chunks/VideoVolume-B4_DNmNi.js";
|
|
16
|
+
import { FADE, FADE_SCALE, OVERLAY_BUTTON, ICON_SWAP } from "./videoMotion.js";
|
|
17
|
+
import { useClipboard } from "../composables/useClipboard.js";
|
|
18
|
+
import { useToast } from "../composables/useToast.js";
|
|
19
|
+
import { formatClipTime, widestClipTime } from "./videoBackdrop.js";
|
|
20
|
+
import { stillSpan, FrameSampler } from "./videoFrames.js";
|
|
21
|
+
import { normalizeRange, ticks, tickStep, containRect, setEnd, revealTime, zoomView, shiftView, adjustRegion, dragEnd, parseClipTime, regionBetween } from "./videoTrim.js";
|
|
22
|
+
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper-1tPrXgE0.js";
|
|
23
|
+
import '../assets/LpVideoTrim-BcGs3Sh0.css';const _hoisted_1 = ["data-disabled"];
|
|
24
|
+
const _hoisted_2 = ["src", "poster"];
|
|
25
|
+
const _hoisted_3 = ["src"];
|
|
26
|
+
const _hoisted_4 = ["data-live", "aria-label"];
|
|
27
|
+
const _hoisted_5 = ["data-lp-corner", "onPointerdown"];
|
|
28
|
+
const _hoisted_6 = {
|
|
29
|
+
key: 0,
|
|
30
|
+
class: "pointer-events-none absolute bottom-3 left-1/2 -translate-x-1/2 rounded-pill bg-black/55 px-3 py-1 text-xs whitespace-nowrap text-white/85"
|
|
31
|
+
};
|
|
32
|
+
const _hoisted_7 = {
|
|
33
|
+
key: 0,
|
|
34
|
+
class: "absolute top-2 right-2 flex gap-0.5 rounded-control bg-black/45"
|
|
35
|
+
};
|
|
36
|
+
const _hoisted_8 = {
|
|
37
|
+
key: 0,
|
|
38
|
+
role: "alert",
|
|
39
|
+
class: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4 text-center text-sm text-white/80"
|
|
40
|
+
};
|
|
41
|
+
const _hoisted_9 = { class: "flex items-center gap-0.5" };
|
|
42
|
+
const _hoisted_10 = {
|
|
43
|
+
class: "min-w-0 truncate px-1.5 font-mono text-xs text-muted",
|
|
44
|
+
"data-lp-clock": ""
|
|
45
|
+
};
|
|
46
|
+
const _hoisted_11 = ["data-live"];
|
|
47
|
+
const _hoisted_12 = ["aria-label"];
|
|
48
|
+
const _hoisted_13 = { class: "absolute inset-0 overflow-hidden rounded-control" };
|
|
49
|
+
const _hoisted_14 = ["data-lp-still"];
|
|
50
|
+
const _hoisted_15 = ["tabindex", "aria-label", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-disabled", "aria-hidden", "data-lp-handle", "data-active", "onPointerdown"];
|
|
51
|
+
const _hoisted_16 = ["tabindex", "aria-label", "aria-valuemax", "aria-valuenow", "aria-valuetext", "data-glide"];
|
|
52
|
+
const _hoisted_17 = ["aria-label"];
|
|
53
|
+
const _hoisted_18 = { class: "flex flex-wrap items-end gap-x-3 gap-y-2" };
|
|
54
|
+
const _hoisted_19 = { class: "flex flex-col gap-0.5 pb-0.5 text-xs" };
|
|
55
|
+
const _hoisted_20 = { class: "text-muted" };
|
|
56
|
+
const _hoisted_21 = {
|
|
57
|
+
class: "font-mono text-sm text-ink",
|
|
58
|
+
"data-lp-length": ""
|
|
59
|
+
};
|
|
60
|
+
const _hoisted_22 = {
|
|
61
|
+
key: 0,
|
|
62
|
+
class: "pb-1 font-mono text-xs text-muted",
|
|
63
|
+
"data-lp-left": ""
|
|
64
|
+
};
|
|
65
|
+
const __default__ = { inheritAttrs: false };
|
|
66
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
67
|
+
...__default__,
|
|
68
|
+
__name: "LpVideoTrim",
|
|
69
|
+
props: {
|
|
70
|
+
src: {},
|
|
71
|
+
poster: { default: void 0 },
|
|
72
|
+
range: { default: void 0 },
|
|
73
|
+
maxClip: { default: void 0 },
|
|
74
|
+
minClip: { default: 0.1 },
|
|
75
|
+
regionSelect: { type: Boolean },
|
|
76
|
+
region: { default: null },
|
|
77
|
+
frameRate: { default: 30 },
|
|
78
|
+
menuItems: {},
|
|
79
|
+
disabled: { type: Boolean },
|
|
80
|
+
labels: { default: () => ({}) }
|
|
81
|
+
},
|
|
82
|
+
emits: ["update:range", "change", "update:region", "error"],
|
|
83
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
84
|
+
const props = __props;
|
|
85
|
+
const emit = __emit;
|
|
86
|
+
const text = useLabels(
|
|
87
|
+
"videoTrim",
|
|
88
|
+
{
|
|
89
|
+
play: "Play",
|
|
90
|
+
pause: "Pause",
|
|
91
|
+
stepBack: "Previous frame",
|
|
92
|
+
stepForward: "Next frame",
|
|
93
|
+
mute: "Mute",
|
|
94
|
+
unmute: "Unmute",
|
|
95
|
+
zoomIn: "Zoom in",
|
|
96
|
+
zoomOut: "Zoom out",
|
|
97
|
+
zoomFit: "Show whole video",
|
|
98
|
+
start: "Start",
|
|
99
|
+
end: "End",
|
|
100
|
+
position: "Position",
|
|
101
|
+
length: "Length",
|
|
102
|
+
/** `{left}` and `{max}` are replaced by times. */
|
|
103
|
+
left: "{left} left of {max}",
|
|
104
|
+
overview: "Visible part of the timeline",
|
|
105
|
+
timeline: "Timeline — Space plays, arrows step, I and O set start and end",
|
|
106
|
+
region: "Marked area — arrows move it, Shift+arrows resize, Delete removes",
|
|
107
|
+
regionHint: "Drag on the picture to mark an area",
|
|
108
|
+
regionClear: "Remove area",
|
|
109
|
+
failed: "This video couldn't be loaded.",
|
|
110
|
+
unsupported: "This browser can't play this video's format.",
|
|
111
|
+
invalidTime: "Type a time like 1:05.5",
|
|
112
|
+
/** `{time}` is replaced by the time the menu was opened at. */
|
|
113
|
+
menuAt: "At {time}",
|
|
114
|
+
setStart: "Start here",
|
|
115
|
+
setEnd: "End here",
|
|
116
|
+
goStart: "Go to the clip's start",
|
|
117
|
+
goEnd: "Go to the clip's end",
|
|
118
|
+
zoomHere: "Zoom in here",
|
|
119
|
+
volume: "Volume",
|
|
120
|
+
copyTime: "Copy time",
|
|
121
|
+
copyFrame: "Copy frame",
|
|
122
|
+
copiedTime: "Time copied",
|
|
123
|
+
copiedFrame: "Frame copied",
|
|
124
|
+
copyFailed: "Couldn't copy"
|
|
125
|
+
},
|
|
126
|
+
() => props.labels
|
|
127
|
+
);
|
|
128
|
+
const { class: rootClass, attrs: rest } = useMergedAttrs("flex w-full min-w-0 flex-col gap-3 select-none");
|
|
129
|
+
const reduced = usePrefersReducedMotion();
|
|
130
|
+
const videoEl = ref(null);
|
|
131
|
+
const samplerEl = ref(null);
|
|
132
|
+
const stageEl = ref(null);
|
|
133
|
+
const trackEl = ref(null);
|
|
134
|
+
const media = useVideoMedia(videoEl, {
|
|
135
|
+
src: () => props.src,
|
|
136
|
+
onFrame: followPlayback,
|
|
137
|
+
onError: (cause) => emit("error", { cause, message: cause === "unsupported" ? text.value.unsupported : text.value.failed })
|
|
138
|
+
});
|
|
139
|
+
const { duration, failure, time, playing, wantsPlay, muted, size: videoSize, seek } = media;
|
|
140
|
+
const pause = () => media.pause({ instant: true });
|
|
141
|
+
const stageSize = ref({ width: 0, height: 0 });
|
|
142
|
+
const trackWidth = ref(0);
|
|
143
|
+
const ready = computed(() => duration.value > 0 && !failure.value);
|
|
144
|
+
const off = computed(() => props.disabled || !ready.value);
|
|
145
|
+
const limits = computed(() => ({
|
|
146
|
+
duration: duration.value,
|
|
147
|
+
minClip: Math.max(0, props.minClip ?? 0),
|
|
148
|
+
maxClip: props.maxClip && props.maxClip > 0 ? props.maxClip : Infinity
|
|
149
|
+
}));
|
|
150
|
+
const local = ref([0, 0]);
|
|
151
|
+
const dragging = ref(null);
|
|
152
|
+
const same = (a, b) => !!a && a[0] === b[0] && a[1] === b[1];
|
|
153
|
+
watch(
|
|
154
|
+
[() => props.range, limits],
|
|
155
|
+
() => {
|
|
156
|
+
if (dragging.value !== null || !duration.value) return;
|
|
157
|
+
const next = normalizeRange(props.range, limits.value);
|
|
158
|
+
local.value = next;
|
|
159
|
+
if (!same(props.range, next)) emit("update:range", next);
|
|
160
|
+
},
|
|
161
|
+
{ deep: true }
|
|
162
|
+
);
|
|
163
|
+
function put(next, commit) {
|
|
164
|
+
const changed = !same(local.value, next);
|
|
165
|
+
local.value = next;
|
|
166
|
+
if (changed) emit("update:range", next);
|
|
167
|
+
if (commit) emit("change", next);
|
|
168
|
+
}
|
|
169
|
+
const clipLength = computed(() => local.value[1] - local.value[0]);
|
|
170
|
+
let stopAtEnd = false;
|
|
171
|
+
function followPlayback() {
|
|
172
|
+
if (stopAtEnd && time.value >= local.value[1]) {
|
|
173
|
+
pause();
|
|
174
|
+
seek(local.value[1]);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (zoomed.value) view.value = revealTime(view.value, time.value, duration.value, 0.05);
|
|
178
|
+
}
|
|
179
|
+
const flash = ref(null);
|
|
180
|
+
function togglePlay() {
|
|
181
|
+
if (!videoEl.value || off.value) return;
|
|
182
|
+
flash.value = { icon: wantsPlay.value ? "lucide:pause" : "lucide:play", n: (flash.value?.n ?? 0) + 1 };
|
|
183
|
+
if (wantsPlay.value) {
|
|
184
|
+
media.pause();
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const [a, b] = local.value;
|
|
188
|
+
let from = time.value;
|
|
189
|
+
if (from >= b - 1e-3 && from <= b + 1e-3) from = a;
|
|
190
|
+
stopAtEnd = from >= a - 1e-3 && from < b;
|
|
191
|
+
if (from !== time.value) seek(from);
|
|
192
|
+
media.play();
|
|
193
|
+
}
|
|
194
|
+
function step(seconds) {
|
|
195
|
+
if (off.value) return;
|
|
196
|
+
pause();
|
|
197
|
+
seek(time.value + seconds);
|
|
198
|
+
if (zoomed.value) view.value = revealTime(view.value, time.value, duration.value);
|
|
199
|
+
}
|
|
200
|
+
function toggleMute() {
|
|
201
|
+
media.setMuted(!muted.value);
|
|
202
|
+
}
|
|
203
|
+
const frameStep = computed(() => 1 / Math.max(1, props.frameRate));
|
|
204
|
+
const frameWindow = () => nodeWindow(trackEl.value ?? videoEl.value);
|
|
205
|
+
const TRACK_GLIDE = "[&_[data-glide]]:transition-[left,width] [&_[data-glide]]:duration-(--duration-medium) [&_[data-glide]]:ease-(--ease-emphasized) data-[live]:[&_[data-glide]]:transition-none motion-reduce:[&_[data-glide]]:transition-none";
|
|
206
|
+
const placed = ref(false);
|
|
207
|
+
watch(ready, (ok) => {
|
|
208
|
+
placed.value = false;
|
|
209
|
+
if (ok) frameWindow().requestAnimationFrame(() => frameWindow().requestAnimationFrame(() => placed.value = true));
|
|
210
|
+
});
|
|
211
|
+
const live = computed(() => !placed.value || dragging.value !== null || scrubbing.value || pinching.value || wheeling.value || playing.value);
|
|
212
|
+
const MIN_SPAN = 2;
|
|
213
|
+
const view = ref({ start: 0, end: 0 });
|
|
214
|
+
const span = computed(() => Math.max(1e-6, view.value.end - view.value.start));
|
|
215
|
+
const zoomed = computed(() => duration.value > 0 && span.value < duration.value - 1e-6);
|
|
216
|
+
const canZoomIn = computed(() => span.value > Math.min(MIN_SPAN, duration.value) + 1e-6);
|
|
217
|
+
watch(duration, (d) => {
|
|
218
|
+
view.value = { start: 0, end: d };
|
|
219
|
+
});
|
|
220
|
+
const xOf = (t) => (t - view.value.start) / span.value * trackWidth.value;
|
|
221
|
+
const pct = (t) => `${(t - view.value.start) / span.value * 100}%`;
|
|
222
|
+
function timeAt(clientX) {
|
|
223
|
+
const box = trackEl.value?.getBoundingClientRect();
|
|
224
|
+
if (!box || !box.width) return 0;
|
|
225
|
+
return view.value.start + (clientX - box.left) / box.width * span.value;
|
|
226
|
+
}
|
|
227
|
+
function zoomAnchor() {
|
|
228
|
+
const { start, end } = view.value;
|
|
229
|
+
return time.value >= start && time.value <= end ? time.value : (start + end) / 2;
|
|
230
|
+
}
|
|
231
|
+
function zoomBy(factor, anchor = zoomAnchor()) {
|
|
232
|
+
if (!duration.value) return;
|
|
233
|
+
view.value = zoomView(view.value, anchor, factor, duration.value, MIN_SPAN);
|
|
234
|
+
}
|
|
235
|
+
function fit() {
|
|
236
|
+
view.value = { start: 0, end: duration.value };
|
|
237
|
+
}
|
|
238
|
+
const wheeling = ref(false);
|
|
239
|
+
let wheelTimer;
|
|
240
|
+
function markWheel() {
|
|
241
|
+
wheeling.value = true;
|
|
242
|
+
clearTimeout(wheelTimer);
|
|
243
|
+
wheelTimer = setTimeout(() => wheeling.value = false, 160);
|
|
244
|
+
}
|
|
245
|
+
function onWheel(event) {
|
|
246
|
+
if (!ready.value) return;
|
|
247
|
+
const dx = event.shiftKey ? event.deltaY : event.deltaX;
|
|
248
|
+
if (Math.abs(dx) > Math.abs(event.deltaY) || event.shiftKey) {
|
|
249
|
+
if (!zoomed.value) return;
|
|
250
|
+
event.preventDefault();
|
|
251
|
+
markWheel();
|
|
252
|
+
view.value = shiftView(view.value, dx / Math.max(1, trackWidth.value) * span.value, duration.value);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
event.preventDefault();
|
|
256
|
+
const unit = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? 400 : 1;
|
|
257
|
+
const delta = event.deltaY * unit;
|
|
258
|
+
const notch = event.deltaMode !== 0 || !event.ctrlKey && Math.abs(delta) >= 50;
|
|
259
|
+
if (!notch) markWheel();
|
|
260
|
+
zoomBy(Math.exp(-delta / (event.ctrlKey ? 100 : 300)), timeAt(event.clientX));
|
|
261
|
+
}
|
|
262
|
+
const marks = computed(() => ready.value ? ticks(view.value, tickStep(span.value, trackWidth.value)) : []);
|
|
263
|
+
const markDigits = computed(() => tickStep(span.value, trackWidth.value) < 1);
|
|
264
|
+
const pointers = /* @__PURE__ */ new Map();
|
|
265
|
+
let pinch = null;
|
|
266
|
+
const pinching = ref(false);
|
|
267
|
+
let edgeFrame = 0;
|
|
268
|
+
let lastX = 0;
|
|
269
|
+
const scrubbing = ref(false);
|
|
270
|
+
function onHandleDown(end, event) {
|
|
271
|
+
if (off.value || event.button !== 0) return;
|
|
272
|
+
event.stopPropagation();
|
|
273
|
+
event.currentTarget.focus({ preventScroll: true });
|
|
274
|
+
pause();
|
|
275
|
+
dragging.value = end;
|
|
276
|
+
lastX = event.clientX;
|
|
277
|
+
startPointerDrag(event, {
|
|
278
|
+
cursor: "ew-resize",
|
|
279
|
+
move: (e) => {
|
|
280
|
+
lastX = e.clientX;
|
|
281
|
+
moveHandle();
|
|
282
|
+
edgeScroll();
|
|
283
|
+
},
|
|
284
|
+
end: () => {
|
|
285
|
+
dragging.value = null;
|
|
286
|
+
if (edgeFrame) frameWindow().cancelAnimationFrame(edgeFrame);
|
|
287
|
+
edgeFrame = 0;
|
|
288
|
+
emit("change", local.value);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function moveHandle() {
|
|
293
|
+
const end = dragging.value;
|
|
294
|
+
if (end === null) return;
|
|
295
|
+
const next = dragEnd(local.value, end, timeAt(lastX), limits.value);
|
|
296
|
+
put(next, false);
|
|
297
|
+
seek(next[end]);
|
|
298
|
+
}
|
|
299
|
+
function edgeScroll() {
|
|
300
|
+
if (edgeFrame || !zoomed.value) return;
|
|
301
|
+
const box = trackEl.value?.getBoundingClientRect();
|
|
302
|
+
if (!box) return;
|
|
303
|
+
const over = lastX < box.left ? lastX - box.left : lastX > box.right ? lastX - box.right : 0;
|
|
304
|
+
if (!over || dragging.value === null && !scrubbing.value) return;
|
|
305
|
+
edgeFrame = frameWindow().requestAnimationFrame(() => {
|
|
306
|
+
edgeFrame = 0;
|
|
307
|
+
view.value = shiftView(view.value, Math.max(-60, Math.min(60, over)) / 6 / Math.max(1, box.width) * span.value, duration.value);
|
|
308
|
+
if (dragging.value !== null) moveHandle();
|
|
309
|
+
else seek(timeAt(lastX));
|
|
310
|
+
edgeScroll();
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function onTrackDown(event) {
|
|
314
|
+
if (off.value || event.pointerType === "mouse" && event.button !== 0) return;
|
|
315
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
316
|
+
pointers.set(event.pointerId, event.clientX);
|
|
317
|
+
if (pointers.size === 2) {
|
|
318
|
+
scrubbing.value = false;
|
|
319
|
+
const [a, b] = [...pointers.values()];
|
|
320
|
+
pinch = { distance: Math.max(8, Math.abs(a - b)), anchor: timeAt((a + b) / 2) };
|
|
321
|
+
pinching.value = true;
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (pointers.size > 2) return;
|
|
325
|
+
event.preventDefault();
|
|
326
|
+
trackEl.value?.querySelector("[data-lp-playhead]")?.focus({ preventScroll: true });
|
|
327
|
+
pause();
|
|
328
|
+
scrubbing.value = true;
|
|
329
|
+
lastX = event.clientX;
|
|
330
|
+
seek(timeAt(event.clientX));
|
|
331
|
+
}
|
|
332
|
+
function onTrackMove(event) {
|
|
333
|
+
if (!pointers.has(event.pointerId)) return;
|
|
334
|
+
pointers.set(event.pointerId, event.clientX);
|
|
335
|
+
if (pinch && pointers.size === 2) {
|
|
336
|
+
const [a, b] = [...pointers.values()];
|
|
337
|
+
const distance = Math.max(8, Math.abs(a - b));
|
|
338
|
+
zoomBy(distance / pinch.distance, pinch.anchor);
|
|
339
|
+
pinch.distance = distance;
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
if (!scrubbing.value) return;
|
|
343
|
+
lastX = event.clientX;
|
|
344
|
+
seek(timeAt(event.clientX));
|
|
345
|
+
edgeScroll();
|
|
346
|
+
}
|
|
347
|
+
function onTrackUp(event) {
|
|
348
|
+
pointers.delete(event.pointerId);
|
|
349
|
+
if (pointers.size < 2) {
|
|
350
|
+
pinch = null;
|
|
351
|
+
pinching.value = false;
|
|
352
|
+
}
|
|
353
|
+
if (!pointers.size) scrubbing.value = false;
|
|
354
|
+
}
|
|
355
|
+
function onOverviewDown(event) {
|
|
356
|
+
if (off.value || event.button !== 0) return;
|
|
357
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
358
|
+
const centreAt = (clientX) => {
|
|
359
|
+
const centre = (clientX - box.left) / Math.max(1, box.width) * duration.value;
|
|
360
|
+
view.value = shiftView(view.value, centre - (view.value.start + view.value.end) / 2, duration.value);
|
|
361
|
+
};
|
|
362
|
+
centreAt(event.clientX);
|
|
363
|
+
startPointerDrag(event, { move: (e) => centreAt(e.clientX), end: () => {
|
|
364
|
+
} });
|
|
365
|
+
}
|
|
366
|
+
const STILL_HEIGHT = 56;
|
|
367
|
+
const stillWidth = computed(() => {
|
|
368
|
+
const { width, height } = videoSize.value;
|
|
369
|
+
return Math.round(Math.min(160, Math.max(40, width && height ? STILL_HEIGHT * width / height : STILL_HEIGHT * (16 / 9))));
|
|
370
|
+
});
|
|
371
|
+
const stillSeconds = computed(() => stillSpan(span.value / Math.max(1, trackWidth.value), stillWidth.value));
|
|
372
|
+
const stills = computed(() => {
|
|
373
|
+
if (!ready.value || !trackWidth.value) return [];
|
|
374
|
+
const step2 = stillSeconds.value;
|
|
375
|
+
const first = Math.floor(view.value.start / step2);
|
|
376
|
+
const last = Math.min(Math.ceil(view.value.end / step2), Math.ceil(duration.value / step2));
|
|
377
|
+
const out = [];
|
|
378
|
+
for (let k = first; k < last && out.length < 200; k++) {
|
|
379
|
+
out.push({ key: `${step2}:${k}`, time: Math.min(duration.value, k * step2 + step2 / 2), left: pct(k * step2), width: `${step2 / span.value * 100}%` });
|
|
380
|
+
}
|
|
381
|
+
return out;
|
|
382
|
+
});
|
|
383
|
+
const frames = shallowRef(/* @__PURE__ */ new Map());
|
|
384
|
+
let sampler = null;
|
|
385
|
+
let stillTimer;
|
|
386
|
+
watch(stills, (list) => {
|
|
387
|
+
clearTimeout(stillTimer);
|
|
388
|
+
stillTimer = setTimeout(() => {
|
|
389
|
+
if (!sampler) return;
|
|
390
|
+
const centre = (view.value.start + view.value.end) / 2;
|
|
391
|
+
sampler.want([...list].sort((a, b) => Math.abs(a.time - centre) - Math.abs(b.time - centre)));
|
|
392
|
+
}, 120);
|
|
393
|
+
});
|
|
394
|
+
function mountFrame(still, el) {
|
|
395
|
+
if (!isHTMLElement(el)) return;
|
|
396
|
+
const canvas = frames.value.get(still.key) ?? sampler?.cached(still.key);
|
|
397
|
+
if (canvas) {
|
|
398
|
+
if (canvas.parentElement === el) return;
|
|
399
|
+
const standIns = [...el.children];
|
|
400
|
+
el.append(canvas);
|
|
401
|
+
if (!standIns.length || reduced.value) standIns.forEach((c) => c.remove());
|
|
402
|
+
else canvas.addEventListener("animationend", () => standIns.forEach((c) => c.remove()), { once: true });
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if (el.children.length) return;
|
|
406
|
+
const near = nearestFrame(still.time);
|
|
407
|
+
if (!near) return;
|
|
408
|
+
const copy2 = el.ownerDocument.createElement("canvas");
|
|
409
|
+
copy2.width = near.width;
|
|
410
|
+
copy2.height = near.height;
|
|
411
|
+
copy2.getContext("2d")?.drawImage(near, 0, 0);
|
|
412
|
+
copy2.dataset.lpStandIn = "";
|
|
413
|
+
el.append(copy2);
|
|
414
|
+
}
|
|
415
|
+
const frameTimes = /* @__PURE__ */ new Map();
|
|
416
|
+
function nearestFrame(t) {
|
|
417
|
+
let best;
|
|
418
|
+
let gap = Infinity;
|
|
419
|
+
for (const [key, canvas] of frames.value) {
|
|
420
|
+
const d = Math.abs((frameTimes.get(key) ?? Infinity) - t);
|
|
421
|
+
if (d < gap) {
|
|
422
|
+
gap = d;
|
|
423
|
+
best = canvas;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return best;
|
|
427
|
+
}
|
|
428
|
+
const picture = computed(() => containRect(stageSize.value.width, stageSize.value.height, videoSize.value.width, videoSize.value.height));
|
|
429
|
+
const draft = ref(null);
|
|
430
|
+
const shownRegion = computed(() => draft.value ?? props.region ?? null);
|
|
431
|
+
function fractionAt(event) {
|
|
432
|
+
const box = stageEl.value?.getBoundingClientRect();
|
|
433
|
+
const p = picture.value;
|
|
434
|
+
if (!box || !p.width || !p.height) return { x: 0, y: 0 };
|
|
435
|
+
return { x: (event.clientX - box.left - p.x) / p.width, y: (event.clientY - box.top - p.y) / p.height };
|
|
436
|
+
}
|
|
437
|
+
function onRegionDown(handle, event) {
|
|
438
|
+
if (props.disabled || !props.regionSelect || event.pointerType === "mouse" && event.button !== 0) return;
|
|
439
|
+
event.stopPropagation();
|
|
440
|
+
pause();
|
|
441
|
+
const start = fractionAt(event);
|
|
442
|
+
const from = props.region ?? null;
|
|
443
|
+
startPointerDrag(event, {
|
|
444
|
+
move: (e) => {
|
|
445
|
+
const at = fractionAt(e);
|
|
446
|
+
draft.value = handle === "draw" || !from ? regionBetween(start.x, start.y, at.x, at.y) : adjustRegion(from, handle, at.x - start.x, at.y - start.y);
|
|
447
|
+
},
|
|
448
|
+
end: (completed) => {
|
|
449
|
+
const next = draft.value;
|
|
450
|
+
draft.value = null;
|
|
451
|
+
if (!completed || !next || handle === "draw" && (next.w < 0.01 || next.h < 0.01)) return;
|
|
452
|
+
emit("update:region", next);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
function onRegionKey(event) {
|
|
457
|
+
const r = props.region;
|
|
458
|
+
if (!r || props.disabled) return;
|
|
459
|
+
if (event.key === "Delete" || event.key === "Backspace") {
|
|
460
|
+
event.preventDefault();
|
|
461
|
+
emit("update:region", null);
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const d = event.altKey ? 2e-3 : 0.01;
|
|
465
|
+
const moves = { ArrowLeft: [-d, 0], ArrowRight: [d, 0], ArrowUp: [0, -d], ArrowDown: [0, d] };
|
|
466
|
+
const move = moves[event.key];
|
|
467
|
+
if (!move) return;
|
|
468
|
+
event.preventDefault();
|
|
469
|
+
event.stopPropagation();
|
|
470
|
+
emit("update:region", adjustRegion(r, event.shiftKey ? "se" : "move", move[0], move[1]));
|
|
471
|
+
}
|
|
472
|
+
function onKeydown(event) {
|
|
473
|
+
const target = event.target;
|
|
474
|
+
if (event.defaultPrevented || event.ctrlKey || event.metaKey || target.closest("input, textarea, select, [contenteditable='true']")) return;
|
|
475
|
+
const handle = target.dataset.lpHandle;
|
|
476
|
+
const end = handle === "0" ? 0 : handle === "1" ? 1 : null;
|
|
477
|
+
if (target.getAttribute("role") === "slider" && end === null && target.dataset.lpPlayhead === void 0) return;
|
|
478
|
+
if ((event.key === "m" || event.key === "M") && !event.altKey) {
|
|
479
|
+
if (!ready.value) return;
|
|
480
|
+
event.preventDefault();
|
|
481
|
+
toggleMute();
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const big = event.shiftKey ? 1 : frameStep.value;
|
|
485
|
+
const delta = { ArrowLeft: -big, ArrowRight: big, ArrowDown: -big, ArrowUp: big, PageDown: -10, PageUp: 10 };
|
|
486
|
+
if (event.key === " " && target.tagName !== "BUTTON") {
|
|
487
|
+
event.preventDefault();
|
|
488
|
+
togglePlay();
|
|
489
|
+
} else if (event.key in delta || event.key === "Home" || event.key === "End") {
|
|
490
|
+
if (off.value) return;
|
|
491
|
+
event.preventDefault();
|
|
492
|
+
if (end !== null) {
|
|
493
|
+
const from = local.value[end];
|
|
494
|
+
const to = event.key === "Home" ? 0 : event.key === "End" ? duration.value : from + delta[event.key];
|
|
495
|
+
const next = dragEnd(local.value, end, to, limits.value);
|
|
496
|
+
put(next, true);
|
|
497
|
+
pause();
|
|
498
|
+
seek(next[end]);
|
|
499
|
+
} else if (event.key === "Home" || event.key === "End") {
|
|
500
|
+
pause();
|
|
501
|
+
seek(event.key === "Home" ? 0 : duration.value);
|
|
502
|
+
} else step(delta[event.key]);
|
|
503
|
+
if (zoomed.value) view.value = revealTime(view.value, time.value, duration.value);
|
|
504
|
+
} else if ((event.key === "i" || event.key === "I" || event.key === "o" || event.key === "O") && !event.altKey) {
|
|
505
|
+
if (off.value) return;
|
|
506
|
+
event.preventDefault();
|
|
507
|
+
put(setEnd(local.value, event.key.toLowerCase() === "i" ? 0 : 1, time.value, limits.value), true);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
const drafts = ref([null, null]);
|
|
511
|
+
const invalid = ref([false, false]);
|
|
512
|
+
const fieldText = (end) => drafts.value[end] ?? formatClipTime(local.value[end], "fixed");
|
|
513
|
+
function onFieldInput(end, value) {
|
|
514
|
+
drafts.value[end] = value;
|
|
515
|
+
invalid.value[end] = false;
|
|
516
|
+
}
|
|
517
|
+
function commitField(end) {
|
|
518
|
+
const typed = drafts.value[end];
|
|
519
|
+
if (typed === null) return;
|
|
520
|
+
const t = parseClipTime(typed);
|
|
521
|
+
if (t === null) {
|
|
522
|
+
invalid.value[end] = true;
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
drafts.value[end] = null;
|
|
526
|
+
put(setEnd(local.value, end, t, limits.value), true);
|
|
527
|
+
seek(local.value[end]);
|
|
528
|
+
if (zoomed.value) view.value = revealTime(view.value, local.value[end], duration.value);
|
|
529
|
+
}
|
|
530
|
+
function revertField(end) {
|
|
531
|
+
drafts.value[end] = null;
|
|
532
|
+
invalid.value[end] = false;
|
|
533
|
+
}
|
|
534
|
+
useResizeObserver(trackEl, (_, el) => trackWidth.value = el.clientWidth, { immediate: true });
|
|
535
|
+
useResizeObserver(stageEl, (_, el) => stageSize.value = { width: el.clientWidth, height: el.clientHeight }, { immediate: true });
|
|
536
|
+
function startSampler() {
|
|
537
|
+
sampler?.dispose();
|
|
538
|
+
sampler = samplerEl.value ? new FrameSampler(samplerEl.value, () => ({ width: stillWidth.value, height: STILL_HEIGHT }), (key, canvas) => {
|
|
539
|
+
const still = stills.value.find((s) => s.key === key);
|
|
540
|
+
if (still) frameTimes.set(key, still.time);
|
|
541
|
+
const next = new Map(frames.value);
|
|
542
|
+
next.set(key, canvas);
|
|
543
|
+
if (next.size > 240) next.delete(next.keys().next().value);
|
|
544
|
+
frames.value = next;
|
|
545
|
+
}) : null;
|
|
546
|
+
}
|
|
547
|
+
watch(
|
|
548
|
+
() => props.src,
|
|
549
|
+
() => {
|
|
550
|
+
frames.value = /* @__PURE__ */ new Map();
|
|
551
|
+
void nextTick(startSampler);
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
onMounted(startSampler);
|
|
555
|
+
onBeforeUnmount(() => {
|
|
556
|
+
sampler?.dispose();
|
|
557
|
+
clearTimeout(stillTimer);
|
|
558
|
+
if (edgeFrame) frameWindow().cancelAnimationFrame(edgeFrame);
|
|
559
|
+
const stillsEl = samplerEl.value;
|
|
560
|
+
if (stillsEl) {
|
|
561
|
+
stillsEl.removeAttribute("src");
|
|
562
|
+
stillsEl.load();
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
__expose({
|
|
566
|
+
play: () => videoEl.value?.paused ? togglePlay() : void 0,
|
|
567
|
+
pause,
|
|
568
|
+
seek,
|
|
569
|
+
/** The playhead, in seconds. */
|
|
570
|
+
currentTime: () => time.value
|
|
571
|
+
});
|
|
572
|
+
const { copy } = useClipboard();
|
|
573
|
+
const { error: toastError } = useToast();
|
|
574
|
+
const videoMenu = computed(() => {
|
|
575
|
+
if (!ready.value || props.disabled) return [];
|
|
576
|
+
const items = [
|
|
577
|
+
{ label: wantsPlay.value ? text.value.pause : text.value.play, icon: wantsPlay.value ? "lucide:pause" : "lucide:play", shortcut: "Space", onSelect: togglePlay },
|
|
578
|
+
{ label: muted.value ? text.value.unmute : text.value.mute, icon: muted.value ? "lucide:volume-2" : "lucide:volume-x", shortcut: "M", onSelect: toggleMute },
|
|
579
|
+
{ label: text.value.stepBack, icon: "lucide:step-back", shortcut: "ArrowLeft", separatorBefore: true, onSelect: () => step(-frameStep.value) },
|
|
580
|
+
{ label: text.value.stepForward, icon: "lucide:step-forward", shortcut: "ArrowRight", onSelect: () => step(frameStep.value) },
|
|
581
|
+
{ label: text.value.copyTime, icon: "lucide:clock", separatorBefore: true, onSelect: () => void copy(formatClipTime(time.value, "fixed"), { toast: text.value.copiedTime, errorToast: text.value.copyFailed }) },
|
|
582
|
+
{ label: text.value.copyFrame, icon: "lucide:image", onSelect: copyFrame }
|
|
583
|
+
];
|
|
584
|
+
if (props.regionSelect && props.region) items.push({ label: text.value.regionClear, icon: "lucide:x", separatorBefore: true, onSelect: () => emit("update:region", null) });
|
|
585
|
+
return items;
|
|
586
|
+
});
|
|
587
|
+
const clockTitle = computed(() => text.value.menuAt.replace("{time}", formatClipTime(time.value, "fixed")));
|
|
588
|
+
async function copyFrame() {
|
|
589
|
+
const blob = await media.captureFrame();
|
|
590
|
+
if (blob) void copy(blob, { toast: text.value.copiedFrame, errorToast: text.value.copyFailed });
|
|
591
|
+
else toastError(text.value.copyFailed);
|
|
592
|
+
}
|
|
593
|
+
const menuAt = ref(0);
|
|
594
|
+
function onTimeContextMenu(event) {
|
|
595
|
+
const overview = event.target.closest?.("[data-lp-overview]");
|
|
596
|
+
if (overview) {
|
|
597
|
+
const box = overview.getBoundingClientRect();
|
|
598
|
+
menuAt.value = (event.clientX - box.left) / Math.max(1, box.width) * duration.value;
|
|
599
|
+
} else menuAt.value = timeAt(event.clientX);
|
|
600
|
+
menuAt.value = Math.min(duration.value, Math.max(0, menuAt.value));
|
|
601
|
+
}
|
|
602
|
+
const timeMenu = computed(() => {
|
|
603
|
+
if (!ready.value || props.disabled) return [];
|
|
604
|
+
const at = menuAt.value;
|
|
605
|
+
const items = [
|
|
606
|
+
{
|
|
607
|
+
label: text.value.setStart,
|
|
608
|
+
icon: "lucide:arrow-left-to-line",
|
|
609
|
+
shortcut: "I",
|
|
610
|
+
onSelect: () => {
|
|
611
|
+
put(setEnd(local.value, 0, at, limits.value), true);
|
|
612
|
+
seek(at);
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
label: text.value.setEnd,
|
|
617
|
+
icon: "lucide:arrow-right-to-line",
|
|
618
|
+
shortcut: "O",
|
|
619
|
+
onSelect: () => {
|
|
620
|
+
put(setEnd(local.value, 1, at, limits.value), true);
|
|
621
|
+
seek(at);
|
|
622
|
+
}
|
|
623
|
+
},
|
|
624
|
+
{ label: text.value.goStart, separatorBefore: true, onSelect: () => seek(local.value[0]) },
|
|
625
|
+
{ label: text.value.goEnd, onSelect: () => seek(local.value[1]) },
|
|
626
|
+
zoomed.value ? { label: text.value.zoomFit, icon: "lucide:maximize-2", separatorBefore: true, onSelect: fit } : { label: text.value.zoomHere, icon: "lucide:zoom-in", separatorBefore: true, disabled: !canZoomIn.value, onSelect: () => zoomBy(4, at) }
|
|
627
|
+
];
|
|
628
|
+
const extra = props.menuItems?.(at) ?? [];
|
|
629
|
+
return [...items, ...extra.map((item, i) => i === 0 ? { ...item, separatorBefore: true } : item)];
|
|
630
|
+
});
|
|
631
|
+
const menuTitle = computed(() => text.value.menuAt.replace("{time}", formatClipTime(menuAt.value, "fixed")));
|
|
632
|
+
const handleText = (t) => formatClipTime(t, "fixed");
|
|
633
|
+
const widest = computed(() => widestClipTime(duration.value));
|
|
634
|
+
const leftOf = (left, max) => text.value.left.replace("{left}", left).replace("{max}", max);
|
|
635
|
+
const leftText = computed(
|
|
636
|
+
() => Number.isFinite(limits.value.maxClip) ? leftOf(formatClipTime(Math.max(0, limits.value.maxClip - clipLength.value), "fixed"), formatClipTime(limits.value.maxClip, "fixed")) : ""
|
|
637
|
+
);
|
|
638
|
+
const widestLeft = computed(() => leftOf(widestClipTime(limits.value.maxClip), widestClipTime(limits.value.maxClip)));
|
|
639
|
+
return (_ctx, _cache) => {
|
|
640
|
+
return openBlock(), createElementBlock("div", mergeProps({ class: unref(rootClass) }, unref(rest), {
|
|
641
|
+
"data-disabled": __props.disabled || void 0,
|
|
642
|
+
onKeydown
|
|
643
|
+
}), [
|
|
644
|
+
createVNode(_sfc_main$1, {
|
|
645
|
+
items: videoMenu.value,
|
|
646
|
+
title: clockTitle.value,
|
|
647
|
+
always: ""
|
|
648
|
+
}, {
|
|
649
|
+
default: withCtx(() => [
|
|
650
|
+
createElementVNode("div", null, [
|
|
651
|
+
createElementVNode("div", {
|
|
652
|
+
ref_key: "stageEl",
|
|
653
|
+
ref: stageEl,
|
|
654
|
+
class: "relative aspect-video w-full overflow-hidden rounded-card bg-black"
|
|
655
|
+
}, [
|
|
656
|
+
createElementVNode("video", mergeProps({
|
|
657
|
+
ref_key: "videoEl",
|
|
658
|
+
ref: videoEl,
|
|
659
|
+
class: "absolute inset-0 size-full object-contain",
|
|
660
|
+
src: __props.src,
|
|
661
|
+
poster: __props.poster,
|
|
662
|
+
preload: "metadata",
|
|
663
|
+
playsinline: ""
|
|
664
|
+
}, toHandlers(unref(media).listeners, true), {
|
|
665
|
+
onClick: _cache[0] || (_cache[0] = ($event) => !__props.regionSelect && togglePlay())
|
|
666
|
+
}), null, 16, _hoisted_2),
|
|
667
|
+
createVNode(VideoFlash, { flash: flash.value }, null, 8, ["flash"]),
|
|
668
|
+
createElementVNode("video", {
|
|
669
|
+
ref_key: "samplerEl",
|
|
670
|
+
ref: samplerEl,
|
|
671
|
+
class: "pointer-events-none absolute size-px opacity-0",
|
|
672
|
+
src: __props.src,
|
|
673
|
+
preload: "metadata",
|
|
674
|
+
muted: "",
|
|
675
|
+
playsinline: "",
|
|
676
|
+
"aria-hidden": "true",
|
|
677
|
+
tabindex: "-1"
|
|
678
|
+
}, null, 8, _hoisted_3),
|
|
679
|
+
createVNode(Transition, normalizeProps(guardReactiveProps(unref(FADE))), {
|
|
680
|
+
default: withCtx(() => [
|
|
681
|
+
__props.regionSelect && ready.value ? (openBlock(), createElementBlock("div", {
|
|
682
|
+
key: 0,
|
|
683
|
+
class: "absolute cursor-crosshair touch-none",
|
|
684
|
+
style: normalizeStyle({ left: `${picture.value.x}px`, top: `${picture.value.y}px`, width: `${picture.value.width}px`, height: `${picture.value.height}px` }),
|
|
685
|
+
"data-lp-region-layer": "",
|
|
686
|
+
onPointerdown: _cache[2] || (_cache[2] = ($event) => onRegionDown("draw", $event))
|
|
687
|
+
}, [
|
|
688
|
+
createVNode(Transition, mergeProps(unref(FADE_SCALE), {
|
|
689
|
+
"enter-from-class": draft.value ? "opacity-0" : unref(FADE_SCALE).enterFromClass
|
|
690
|
+
}), {
|
|
691
|
+
default: withCtx(() => [
|
|
692
|
+
shownRegion.value ? (openBlock(), createElementBlock("div", {
|
|
693
|
+
key: 0,
|
|
694
|
+
class: "absolute cursor-move rounded-inner border-2 border-dashed border-white/90 bg-white/10 shadow-[0_0_0_9999px_rgb(0_0_0/0.35)] outline-none transition-[left,top,width,height] duration-(--duration-medium) ease-(--ease-emphasized) focus-visible:ring-2 focus-visible:ring-ring data-[live]:transition-none motion-reduce:transition-none",
|
|
695
|
+
"data-live": draft.value ? "" : void 0,
|
|
696
|
+
style: normalizeStyle({ left: `${shownRegion.value.x * 100}%`, top: `${shownRegion.value.y * 100}%`, width: `${shownRegion.value.w * 100}%`, height: `${shownRegion.value.h * 100}%` }),
|
|
697
|
+
tabindex: "0",
|
|
698
|
+
role: "group",
|
|
699
|
+
"aria-label": unref(text).region,
|
|
700
|
+
"data-lp-region": "",
|
|
701
|
+
onPointerdown: _cache[1] || (_cache[1] = ($event) => onRegionDown("move", $event)),
|
|
702
|
+
onKeydown: onRegionKey
|
|
703
|
+
}, [
|
|
704
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(["nw", "ne", "sw", "se"], (corner) => {
|
|
705
|
+
return createElementVNode("span", {
|
|
706
|
+
key: corner,
|
|
707
|
+
class: normalizeClass(["absolute grid size-6 place-items-center pointer-coarse:size-11", [
|
|
708
|
+
corner[0] === "n" ? "top-0 -translate-y-1/2" : "bottom-0 translate-y-1/2",
|
|
709
|
+
corner[1] === "w" ? "left-0 -translate-x-1/2" : "right-0 translate-x-1/2",
|
|
710
|
+
corner === "nw" || corner === "se" ? "cursor-nwse-resize" : "cursor-nesw-resize"
|
|
711
|
+
]]),
|
|
712
|
+
"data-lp-corner": corner,
|
|
713
|
+
onPointerdown: ($event) => onRegionDown(corner, $event)
|
|
714
|
+
}, [..._cache[8] || (_cache[8] = [
|
|
715
|
+
createElementVNode("span", { class: "size-3 rounded-full bg-white shadow-[0_0_0_1px_rgb(0_0_0/0.3),0_1px_3px_rgb(0_0_0/0.35)]" }, null, -1)
|
|
716
|
+
])], 42, _hoisted_5);
|
|
717
|
+
}), 64))
|
|
718
|
+
], 44, _hoisted_4)) : createCommentVNode("", true)
|
|
719
|
+
]),
|
|
720
|
+
_: 1
|
|
721
|
+
}, 16, ["enter-from-class"])
|
|
722
|
+
], 36)) : createCommentVNode("", true)
|
|
723
|
+
]),
|
|
724
|
+
_: 1
|
|
725
|
+
}, 16),
|
|
726
|
+
createVNode(Transition, normalizeProps(guardReactiveProps(unref(FADE))), {
|
|
727
|
+
default: withCtx(() => [
|
|
728
|
+
__props.regionSelect && ready.value && !shownRegion.value && !unref(playing) && !__props.disabled ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(unref(text).regionHint), 1)) : createCommentVNode("", true)
|
|
729
|
+
]),
|
|
730
|
+
_: 1
|
|
731
|
+
}, 16),
|
|
732
|
+
_ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
733
|
+
renderSlot(_ctx.$slots, "actions", { buttonClass: unref(OVERLAY_BUTTON) }, void 0, true)
|
|
734
|
+
])) : createCommentVNode("", true),
|
|
735
|
+
createVNode(Transition, normalizeProps(guardReactiveProps(unref(FADE))), {
|
|
736
|
+
default: withCtx(() => [
|
|
737
|
+
unref(failure) ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
738
|
+
createVNode(_sfc_main$2, {
|
|
739
|
+
name: "lucide:video-off",
|
|
740
|
+
size: 32
|
|
741
|
+
}),
|
|
742
|
+
createElementVNode("p", null, toDisplayString(unref(failure) === "unsupported" ? unref(text).unsupported : unref(text).failed), 1)
|
|
743
|
+
])) : createCommentVNode("", true)
|
|
744
|
+
]),
|
|
745
|
+
_: 1
|
|
746
|
+
}, 16)
|
|
747
|
+
], 512)
|
|
748
|
+
])
|
|
749
|
+
]),
|
|
750
|
+
_: 3
|
|
751
|
+
}, 8, ["items", "title"]),
|
|
752
|
+
createElementVNode("div", _hoisted_9, [
|
|
753
|
+
createVNode(_sfc_main$3, {
|
|
754
|
+
size: "sm",
|
|
755
|
+
variant: "ghost",
|
|
756
|
+
square: "",
|
|
757
|
+
disabled: off.value,
|
|
758
|
+
"aria-label": unref(wantsPlay) ? unref(text).pause : unref(text).play,
|
|
759
|
+
title: unref(wantsPlay) ? unref(text).pause : unref(text).play,
|
|
760
|
+
onClick: togglePlay
|
|
761
|
+
}, {
|
|
762
|
+
default: withCtx(() => [
|
|
763
|
+
createVNode(Transition, normalizeProps(guardReactiveProps(unref(ICON_SWAP))), {
|
|
764
|
+
default: withCtx(() => [
|
|
765
|
+
(openBlock(), createBlock(_sfc_main$2, {
|
|
766
|
+
key: unref(wantsPlay) ? "pause" : "play",
|
|
767
|
+
name: unref(wantsPlay) ? "lucide:pause" : "lucide:play",
|
|
768
|
+
size: 16
|
|
769
|
+
}, null, 8, ["name"]))
|
|
770
|
+
]),
|
|
771
|
+
_: 1
|
|
772
|
+
}, 16)
|
|
773
|
+
]),
|
|
774
|
+
_: 1
|
|
775
|
+
}, 8, ["disabled", "aria-label", "title"]),
|
|
776
|
+
createVNode(_sfc_main$3, {
|
|
777
|
+
size: "sm",
|
|
778
|
+
variant: "ghost",
|
|
779
|
+
square: "",
|
|
780
|
+
disabled: off.value,
|
|
781
|
+
"aria-label": unref(text).stepBack,
|
|
782
|
+
title: unref(text).stepBack,
|
|
783
|
+
onClick: _cache[3] || (_cache[3] = ($event) => step(-frameStep.value))
|
|
784
|
+
}, {
|
|
785
|
+
default: withCtx(() => [
|
|
786
|
+
createVNode(_sfc_main$2, {
|
|
787
|
+
name: "lucide:step-back",
|
|
788
|
+
size: 16
|
|
789
|
+
})
|
|
790
|
+
]),
|
|
791
|
+
_: 1
|
|
792
|
+
}, 8, ["disabled", "aria-label", "title"]),
|
|
793
|
+
createVNode(_sfc_main$3, {
|
|
794
|
+
size: "sm",
|
|
795
|
+
variant: "ghost",
|
|
796
|
+
square: "",
|
|
797
|
+
disabled: off.value,
|
|
798
|
+
"aria-label": unref(text).stepForward,
|
|
799
|
+
title: unref(text).stepForward,
|
|
800
|
+
onClick: _cache[4] || (_cache[4] = ($event) => step(frameStep.value))
|
|
801
|
+
}, {
|
|
802
|
+
default: withCtx(() => [
|
|
803
|
+
createVNode(_sfc_main$2, {
|
|
804
|
+
name: "lucide:step-forward",
|
|
805
|
+
size: 16
|
|
806
|
+
})
|
|
807
|
+
]),
|
|
808
|
+
_: 1
|
|
809
|
+
}, 8, ["disabled", "aria-label", "title"]),
|
|
810
|
+
createElementVNode("span", _hoisted_10, [
|
|
811
|
+
createVNode(_sfc_main$4, {
|
|
812
|
+
class: "text-ink",
|
|
813
|
+
text: unref(formatClipTime)(unref(time), "fixed"),
|
|
814
|
+
widest: widest.value
|
|
815
|
+
}, null, 8, ["text", "widest"]),
|
|
816
|
+
createTextVNode(" / " + toDisplayString(unref(formatClipTime)(unref(duration), "fixed")), 1)
|
|
817
|
+
]),
|
|
818
|
+
createVNode(_sfc_main$5, {
|
|
819
|
+
media: unref(media),
|
|
820
|
+
labels: unref(text),
|
|
821
|
+
disabled: !ready.value
|
|
822
|
+
}, null, 8, ["media", "labels", "disabled"]),
|
|
823
|
+
_cache[9] || (_cache[9] = createElementVNode("span", { class: "flex-1" }, null, -1)),
|
|
824
|
+
createVNode(Transition, normalizeProps(guardReactiveProps(unref(FADE_SCALE))), {
|
|
825
|
+
default: withCtx(() => [
|
|
826
|
+
zoomed.value ? (openBlock(), createBlock(_sfc_main$3, {
|
|
827
|
+
key: 0,
|
|
828
|
+
size: "sm",
|
|
829
|
+
variant: "ghost",
|
|
830
|
+
square: "",
|
|
831
|
+
disabled: off.value,
|
|
832
|
+
"aria-label": unref(text).zoomFit,
|
|
833
|
+
title: unref(text).zoomFit,
|
|
834
|
+
onClick: fit
|
|
835
|
+
}, {
|
|
836
|
+
default: withCtx(() => [
|
|
837
|
+
createVNode(_sfc_main$2, {
|
|
838
|
+
name: "lucide:maximize-2",
|
|
839
|
+
size: 16
|
|
840
|
+
})
|
|
841
|
+
]),
|
|
842
|
+
_: 1
|
|
843
|
+
}, 8, ["disabled", "aria-label", "title"])) : createCommentVNode("", true)
|
|
844
|
+
]),
|
|
845
|
+
_: 1
|
|
846
|
+
}, 16),
|
|
847
|
+
createVNode(_sfc_main$3, {
|
|
848
|
+
size: "sm",
|
|
849
|
+
variant: "ghost",
|
|
850
|
+
square: "",
|
|
851
|
+
disabled: off.value || !zoomed.value,
|
|
852
|
+
"aria-label": unref(text).zoomOut,
|
|
853
|
+
title: unref(text).zoomOut,
|
|
854
|
+
onClick: _cache[5] || (_cache[5] = ($event) => zoomBy(0.5))
|
|
855
|
+
}, {
|
|
856
|
+
default: withCtx(() => [
|
|
857
|
+
createVNode(_sfc_main$2, {
|
|
858
|
+
name: "lucide:zoom-out",
|
|
859
|
+
size: 16
|
|
860
|
+
})
|
|
861
|
+
]),
|
|
862
|
+
_: 1
|
|
863
|
+
}, 8, ["disabled", "aria-label", "title"]),
|
|
864
|
+
createVNode(_sfc_main$3, {
|
|
865
|
+
size: "sm",
|
|
866
|
+
variant: "ghost",
|
|
867
|
+
square: "",
|
|
868
|
+
disabled: off.value || !canZoomIn.value,
|
|
869
|
+
"aria-label": unref(text).zoomIn,
|
|
870
|
+
title: unref(text).zoomIn,
|
|
871
|
+
onClick: _cache[6] || (_cache[6] = ($event) => zoomBy(2))
|
|
872
|
+
}, {
|
|
873
|
+
default: withCtx(() => [
|
|
874
|
+
createVNode(_sfc_main$2, {
|
|
875
|
+
name: "lucide:zoom-in",
|
|
876
|
+
size: 16
|
|
877
|
+
})
|
|
878
|
+
]),
|
|
879
|
+
_: 1
|
|
880
|
+
}, 8, ["disabled", "aria-label", "title"])
|
|
881
|
+
]),
|
|
882
|
+
createVNode(_sfc_main$1, {
|
|
883
|
+
items: timeMenu.value,
|
|
884
|
+
title: menuTitle.value,
|
|
885
|
+
always: ""
|
|
886
|
+
}, {
|
|
887
|
+
default: withCtx(() => [
|
|
888
|
+
createElementVNode("div", {
|
|
889
|
+
class: normalizeClass(["relative", TRACK_GLIDE]),
|
|
890
|
+
"data-live": live.value || void 0,
|
|
891
|
+
onWheel,
|
|
892
|
+
onContextmenu: onTimeContextMenu
|
|
893
|
+
}, [
|
|
894
|
+
createVNode(TransitionGroup, mergeProps({
|
|
895
|
+
tag: "div",
|
|
896
|
+
class: "relative h-4 overflow-hidden text-[10px] text-muted tabular-nums",
|
|
897
|
+
"aria-hidden": "true"
|
|
898
|
+
}, unref(FADE)), {
|
|
899
|
+
default: withCtx(() => [
|
|
900
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(marks.value, (m) => {
|
|
901
|
+
return openBlock(), createElementBlock("span", {
|
|
902
|
+
key: m,
|
|
903
|
+
class: normalizeClass(["absolute top-0 whitespace-nowrap", xOf(m) < 16 ? "" : xOf(m) > trackWidth.value - 16 ? "-translate-x-full" : "-translate-x-1/2"]),
|
|
904
|
+
style: normalizeStyle({ left: pct(m) }),
|
|
905
|
+
"data-glide": ""
|
|
906
|
+
}, toDisplayString(unref(formatClipTime)(m, markDigits.value)), 7);
|
|
907
|
+
}), 128))
|
|
908
|
+
]),
|
|
909
|
+
_: 1
|
|
910
|
+
}, 16),
|
|
911
|
+
createElementVNode("div", {
|
|
912
|
+
ref_key: "trackEl",
|
|
913
|
+
ref: trackEl,
|
|
914
|
+
class: normalizeClass(["relative h-14 touch-none rounded-control bg-surface-soft transition-opacity duration-(--duration-fast) motion-reduce:transition-none", off.value ? "opacity-60" : "cursor-text"]),
|
|
915
|
+
"aria-label": unref(text).timeline,
|
|
916
|
+
role: "group",
|
|
917
|
+
onPointerdown: onTrackDown,
|
|
918
|
+
onPointermove: onTrackMove,
|
|
919
|
+
onPointerup: onTrackUp,
|
|
920
|
+
onPointercancel: onTrackUp
|
|
921
|
+
}, [
|
|
922
|
+
createElementVNode("div", _hoisted_13, [
|
|
923
|
+
createVNode(TransitionGroup, normalizeProps(guardReactiveProps(unref(FADE))), {
|
|
924
|
+
default: withCtx(() => [
|
|
925
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(stills.value, (s) => {
|
|
926
|
+
return openBlock(), createElementBlock("div", {
|
|
927
|
+
key: s.key,
|
|
928
|
+
ref_for: true,
|
|
929
|
+
ref: (el) => mountFrame(s, el),
|
|
930
|
+
class: normalizeClass(["absolute inset-y-0 overflow-hidden [&>canvas]:absolute [&>canvas]:inset-0 [&>canvas]:size-full [&>canvas]:object-cover", { "lp-trim-still-in": !unref(reduced) }]),
|
|
931
|
+
style: normalizeStyle({ left: s.left, width: s.width }),
|
|
932
|
+
"data-lp-still": frames.value.has(s.key) ? "ready" : "pending",
|
|
933
|
+
"data-glide": ""
|
|
934
|
+
}, null, 14, _hoisted_14);
|
|
935
|
+
}), 128))
|
|
936
|
+
]),
|
|
937
|
+
_: 1
|
|
938
|
+
}, 16),
|
|
939
|
+
createElementVNode("div", {
|
|
940
|
+
class: "absolute inset-y-0 left-0 bg-black/55",
|
|
941
|
+
style: normalizeStyle({ width: pct(local.value[0]) }),
|
|
942
|
+
"data-glide": ""
|
|
943
|
+
}, null, 4),
|
|
944
|
+
createElementVNode("div", {
|
|
945
|
+
class: "absolute inset-y-0 right-0 bg-black/55",
|
|
946
|
+
style: normalizeStyle({ left: pct(local.value[1]) }),
|
|
947
|
+
"data-glide": ""
|
|
948
|
+
}, null, 4)
|
|
949
|
+
]),
|
|
950
|
+
createElementVNode("div", {
|
|
951
|
+
class: normalizeClass(["pointer-events-none absolute inset-0 transition-opacity duration-(--duration-medium) ease-(--ease-emphasized) motion-reduce:transition-none", ready.value ? "" : "opacity-0"])
|
|
952
|
+
}, [
|
|
953
|
+
createElementVNode("div", {
|
|
954
|
+
class: "absolute inset-y-0 rounded-control border-y-2 border-white/85 shadow-[0_0_0_1px_rgb(0_0_0/0.25)]",
|
|
955
|
+
style: normalizeStyle({ left: pct(local.value[0]), width: `${clipLength.value / span.value * 100}%` }),
|
|
956
|
+
"data-lp-range": "",
|
|
957
|
+
"data-glide": ""
|
|
958
|
+
}, null, 4),
|
|
959
|
+
(openBlock(), createElementBlock(Fragment, null, renderList([0, 1], (end) => {
|
|
960
|
+
return createElementVNode("div", {
|
|
961
|
+
key: end,
|
|
962
|
+
class: normalizeClass(["group/handle absolute inset-y-0 z-10 flex w-6 -translate-x-1/2 touch-none justify-center outline-none pointer-coarse:w-11", [off.value ? "" : "cursor-ew-resize", ready.value ? "pointer-events-auto" : ""]]),
|
|
963
|
+
style: normalizeStyle({ left: pct(local.value[end]) }),
|
|
964
|
+
role: "slider",
|
|
965
|
+
tabindex: off.value ? -1 : 0,
|
|
966
|
+
"aria-label": end === 0 ? unref(text).start : unref(text).end,
|
|
967
|
+
"aria-valuemin": 0,
|
|
968
|
+
"aria-valuemax": Math.round(unref(duration) * 1e3) / 1e3,
|
|
969
|
+
"aria-valuenow": local.value[end],
|
|
970
|
+
"aria-valuetext": handleText(local.value[end]),
|
|
971
|
+
"aria-disabled": off.value || void 0,
|
|
972
|
+
"aria-hidden": ready.value ? void 0 : "true",
|
|
973
|
+
"data-lp-handle": end,
|
|
974
|
+
"data-active": dragging.value === end || void 0,
|
|
975
|
+
"data-glide": "",
|
|
976
|
+
onPointerdown: ($event) => onHandleDown(end, $event)
|
|
977
|
+
}, [..._cache[10] || (_cache[10] = [
|
|
978
|
+
createElementVNode("span", { class: "my-1 flex w-2 items-center justify-center rounded-inner bg-white/90 shadow-[0_0_0_1px_rgb(0_0_0/0.3),0_1px_3px_rgb(0_0_0/0.35)] transition-[background-color,scale] duration-(--duration-fast) ease-(--ease-emphasized) group-hover/handle:bg-white group-data-active/handle:scale-x-125 group-data-active/handle:bg-white group-focus-visible/handle:ring-2 group-focus-visible/handle:ring-ring motion-reduce:transition-none motion-reduce:group-data-active/handle:scale-x-100" }, [
|
|
979
|
+
createElementVNode("span", { class: "h-4 w-px rounded-pill bg-black/35" })
|
|
980
|
+
], -1)
|
|
981
|
+
])], 46, _hoisted_15);
|
|
982
|
+
}), 64))
|
|
983
|
+
], 2),
|
|
984
|
+
createElementVNode("div", {
|
|
985
|
+
class: "group/playhead absolute -top-4 bottom-0 z-20 w-0 outline-none",
|
|
986
|
+
style: normalizeStyle({ left: pct(unref(time)) }),
|
|
987
|
+
role: "slider",
|
|
988
|
+
tabindex: off.value ? -1 : 0,
|
|
989
|
+
"aria-label": unref(text).position,
|
|
990
|
+
"aria-valuemin": 0,
|
|
991
|
+
"aria-valuemax": Math.round(unref(duration) * 1e3) / 1e3,
|
|
992
|
+
"aria-valuenow": Math.round(unref(time) * 1e3) / 1e3,
|
|
993
|
+
"aria-valuetext": handleText(unref(time)),
|
|
994
|
+
"data-lp-playhead": "",
|
|
995
|
+
"data-glide": unref(playing) ? void 0 : ""
|
|
996
|
+
}, [
|
|
997
|
+
createElementVNode("span", {
|
|
998
|
+
class: normalizeClass(["pointer-events-none absolute inset-0 transition-opacity duration-(--duration-fast) motion-reduce:transition-none", ready.value && unref(time) >= view.value.start && unref(time) <= view.value.end ? "" : "opacity-0"])
|
|
999
|
+
}, [..._cache[11] || (_cache[11] = [
|
|
1000
|
+
createElementVNode("span", { class: "absolute inset-y-0 -left-px w-0.5 rounded-pill bg-white shadow-[0_0_0_1px_rgb(0_0_0/0.35)]" }, null, -1),
|
|
1001
|
+
createElementVNode("span", { class: "absolute -top-0.5 -left-1.5 size-3 rounded-full bg-white shadow-[0_0_0_1px_rgb(0_0_0/0.3),0_1px_3px_rgb(0_0_0/0.35)] group-focus-visible/playhead:ring-2 group-focus-visible/playhead:ring-ring" }, null, -1)
|
|
1002
|
+
])], 2)
|
|
1003
|
+
], 12, _hoisted_16)
|
|
1004
|
+
], 42, _hoisted_12),
|
|
1005
|
+
createVNode(Transition, normalizeProps(guardReactiveProps(unref(FADE))), {
|
|
1006
|
+
default: withCtx(() => [
|
|
1007
|
+
zoomed.value ? (openBlock(), createElementBlock("div", {
|
|
1008
|
+
key: 0,
|
|
1009
|
+
class: "relative mt-1.5 h-2.5 cursor-pointer touch-none rounded-pill bg-surface-soft",
|
|
1010
|
+
"aria-label": unref(text).overview,
|
|
1011
|
+
role: "presentation",
|
|
1012
|
+
"data-lp-overview": "",
|
|
1013
|
+
onPointerdown: onOverviewDown
|
|
1014
|
+
}, [
|
|
1015
|
+
createElementVNode("span", {
|
|
1016
|
+
class: "absolute inset-y-0.5 rounded-pill bg-line-strong",
|
|
1017
|
+
style: normalizeStyle({ left: `${local.value[0] / unref(duration) * 100}%`, width: `${clipLength.value / unref(duration) * 100}%` }),
|
|
1018
|
+
"data-glide": ""
|
|
1019
|
+
}, null, 4),
|
|
1020
|
+
createElementVNode("span", {
|
|
1021
|
+
class: "absolute inset-y-0 rounded-pill border border-ink/60",
|
|
1022
|
+
style: normalizeStyle({ left: `${view.value.start / unref(duration) * 100}%`, width: `${span.value / unref(duration) * 100}%` }),
|
|
1023
|
+
"data-glide": ""
|
|
1024
|
+
}, null, 4)
|
|
1025
|
+
], 40, _hoisted_17)) : createCommentVNode("", true)
|
|
1026
|
+
]),
|
|
1027
|
+
_: 1
|
|
1028
|
+
}, 16)
|
|
1029
|
+
], 40, _hoisted_11)
|
|
1030
|
+
]),
|
|
1031
|
+
_: 1
|
|
1032
|
+
}, 8, ["items", "title"]),
|
|
1033
|
+
createElementVNode("div", _hoisted_18, [
|
|
1034
|
+
(openBlock(), createElementBlock(Fragment, null, renderList([0, 1], (end) => {
|
|
1035
|
+
return createVNode(_sfc_main$6, {
|
|
1036
|
+
key: end,
|
|
1037
|
+
size: "sm",
|
|
1038
|
+
class: "w-28",
|
|
1039
|
+
label: end === 0 ? unref(text).start : unref(text).end,
|
|
1040
|
+
"model-value": fieldText(end),
|
|
1041
|
+
disabled: off.value,
|
|
1042
|
+
invalid: invalid.value[end],
|
|
1043
|
+
title: invalid.value[end] ? unref(text).invalidTime : void 0,
|
|
1044
|
+
inputmode: "decimal",
|
|
1045
|
+
spellcheck: "false",
|
|
1046
|
+
autocomplete: "off",
|
|
1047
|
+
"data-lp-time": end,
|
|
1048
|
+
"onUpdate:modelValue": ($event) => onFieldInput(end, $event),
|
|
1049
|
+
onBlur: ($event) => commitField(end),
|
|
1050
|
+
onKeydown: [
|
|
1051
|
+
withKeys(withModifiers(($event) => commitField(end), ["prevent"]), ["enter"]),
|
|
1052
|
+
withKeys(($event) => revertField(end), ["esc"])
|
|
1053
|
+
]
|
|
1054
|
+
}, null, 8, ["label", "model-value", "disabled", "invalid", "title", "data-lp-time", "onUpdate:modelValue", "onBlur", "onKeydown"]);
|
|
1055
|
+
}), 64)),
|
|
1056
|
+
createElementVNode("div", _hoisted_19, [
|
|
1057
|
+
createElementVNode("span", _hoisted_20, toDisplayString(unref(text).length), 1),
|
|
1058
|
+
createElementVNode("span", _hoisted_21, [
|
|
1059
|
+
createVNode(_sfc_main$4, {
|
|
1060
|
+
text: unref(formatClipTime)(clipLength.value, "fixed"),
|
|
1061
|
+
widest: widest.value
|
|
1062
|
+
}, null, 8, ["text", "widest"])
|
|
1063
|
+
])
|
|
1064
|
+
]),
|
|
1065
|
+
createVNode(Transition, normalizeProps(guardReactiveProps(unref(FADE))), {
|
|
1066
|
+
default: withCtx(() => [
|
|
1067
|
+
leftText.value ? (openBlock(), createElementBlock("span", _hoisted_22, [
|
|
1068
|
+
createVNode(_sfc_main$4, {
|
|
1069
|
+
text: leftText.value,
|
|
1070
|
+
widest: widestLeft.value
|
|
1071
|
+
}, null, 8, ["text", "widest"])
|
|
1072
|
+
])) : createCommentVNode("", true)
|
|
1073
|
+
]),
|
|
1074
|
+
_: 1
|
|
1075
|
+
}, 16),
|
|
1076
|
+
_cache[12] || (_cache[12] = createElementVNode("span", { class: "flex-1" }, null, -1)),
|
|
1077
|
+
createVNode(Transition, normalizeProps(guardReactiveProps(unref(FADE_SCALE))), {
|
|
1078
|
+
default: withCtx(() => [
|
|
1079
|
+
__props.regionSelect ? (openBlock(), createBlock(_sfc_main$3, {
|
|
1080
|
+
key: 0,
|
|
1081
|
+
size: "sm",
|
|
1082
|
+
variant: "outline",
|
|
1083
|
+
disabled: __props.disabled || !__props.region,
|
|
1084
|
+
onClick: _cache[7] || (_cache[7] = ($event) => emit("update:region", null))
|
|
1085
|
+
}, {
|
|
1086
|
+
default: withCtx(() => [
|
|
1087
|
+
createVNode(_sfc_main$2, {
|
|
1088
|
+
name: "lucide:x",
|
|
1089
|
+
size: 14
|
|
1090
|
+
}),
|
|
1091
|
+
createTextVNode(toDisplayString(unref(text).regionClear), 1)
|
|
1092
|
+
]),
|
|
1093
|
+
_: 1
|
|
1094
|
+
}, 8, ["disabled"])) : createCommentVNode("", true)
|
|
1095
|
+
]),
|
|
1096
|
+
_: 1
|
|
1097
|
+
}, 16)
|
|
1098
|
+
])
|
|
1099
|
+
], 16, _hoisted_1);
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
const LpVideoTrim = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-713835cc"]]);
|
|
1104
|
+
export {
|
|
1105
|
+
LpVideoTrim as default
|
|
1106
|
+
};
|