@leavepulse/ui 0.81.0 → 0.82.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-Ci6IIHW0.css +8 -0
- package/dist/chunks/{ContextMenuItems-DLK4q-mm.js → ContextMenuItems-kRVTuSZd.js} +1 -1
- package/dist/chunks/{DropzoneLinkField-CcJu8De3.js → DropzoneLinkField-CvMUu8HQ.js} +1 -1
- package/dist/chunks/{FieldLeading-CldGLINn.js → FieldLeading-CNN_5Dp1.js} +1 -1
- package/dist/chunks/{FieldWrapper-Cj8ZgoKp.js → FieldWrapper-BBJPEVHr.js} +1 -1
- package/dist/chunks/{IconCloseButton-CV4iHRpy.js → IconCloseButton-C59_etp2.js} +1 -1
- package/dist/chunks/{LayoutCanvas-BQbq7Ekw.js → LayoutCanvas-BIY74SUe.js} +1 -1
- package/dist/chunks/{LayoutNode-BMedRk3g.js → LayoutNode-CTlKlhb-.js} +1 -1
- package/dist/chunks/{LpActionBar-C7g52Cyo.js → LpActionBar-Cowb-28D.js} +1 -1
- package/dist/chunks/{LpAddressInput-1uakhQk5.js → LpAddressInput-nTJlUQ6K.js} +7 -7
- package/dist/chunks/{LpAlert-DWFeR82L.js → LpAlert-DhZdjekN.js} +1 -1
- package/dist/chunks/{LpAppShell-BBINfN1v.js → LpAppShell-CK9hTgQ1.js} +4 -4
- package/dist/chunks/{LpAutocomplete-DY3LvpB9.js → LpAutocomplete--PaZkQoU.js} +4 -4
- package/dist/chunks/{LpAvatar-CEZmMcGh.js → LpAvatar-DVCld_L2.js} +1 -1
- package/dist/chunks/{LpBadge-C_VqLHtg.js → LpBadge-DXvpxk6z.js} +1 -1
- package/dist/chunks/{LpBottomNav-4I89sPDZ.js → LpBottomNav-COQiBNUN.js} +1 -1
- package/dist/chunks/{LpBreadcrumbs-1BBzrfxG.js → LpBreadcrumbs-Dt1O5G4O.js} +1 -1
- package/dist/chunks/{LpCalendar-D2dcXjUK.js → LpCalendar-C8Xlukd2.js} +1 -1
- package/dist/chunks/{LpCheckbox-CN-MEnbX.js → LpCheckbox-Dpybd3oV.js} +2 -2
- package/dist/chunks/{LpCodeBlock-Cj7zk4QE.js → LpCodeBlock-C1Hu5RyT.js} +2 -2
- package/dist/chunks/{LpCodeDisplay-COzosm77.js → LpCodeDisplay-BVruT3-A.js} +4 -4
- package/dist/chunks/{LpColorPicker-BezW6DX1.js → LpColorPicker-BK-NRaGK.js} +3 -3
- package/dist/chunks/{LpConfirmDialog-D9GkDMYr.js → LpConfirmDialog-2CQFKtqU.js} +2 -2
- package/dist/chunks/{LpConfirmHost-BH7kf0dm.js → LpConfirmHost-CTkSytVl.js} +1 -1
- package/dist/chunks/{LpContextMenu-bn5bc9t7.js → LpContextMenu-DcHPdW-t.js} +2 -2
- package/dist/chunks/{LpContextSwitcher-CGr6ZAuq.js → LpContextSwitcher-C_nnDbeI.js} +2 -2
- package/dist/chunks/{LpCopyButton-BSr6YaFR.js → LpCopyButton-De7_elaO.js} +1 -1
- package/dist/chunks/{LpDataList-Cv7ZUlyy.js → LpDataList-BjZPfQjO.js} +2 -2
- package/dist/chunks/{LpDatePicker-CR7vsb5M.js → LpDatePicker-wOrHd0fg.js} +5 -5
- package/dist/chunks/{LpDateRangePicker-B9fRO3G6.js → LpDateRangePicker-CVMvvo5t.js} +3 -3
- package/dist/chunks/{LpDisclosure-CE4mneaE.js → LpDisclosure-CtQ63LeO.js} +1 -1
- package/dist/chunks/{LpDrawer-DU_5MqBz.js → LpDrawer-TZBPzyOM.js} +1 -1
- package/dist/chunks/{LpDropdownMenu-_u6GPWhp.js → LpDropdownMenu-DL9LgkS8.js} +2 -2
- package/dist/chunks/{LpEditable-DYoMayjt.js → LpEditable-DuPE2tkl.js} +2 -2
- package/dist/chunks/{LpEmptyState-DpdHeSfz.js → LpEmptyState-W1U_tKg-.js} +1 -1
- package/dist/chunks/{LpFieldNotice-DONFCWV7.js → LpFieldNotice-BLKlYLwu.js} +1 -1
- package/dist/chunks/{LpFileTree-f5ktGqsN.js → LpFileTree-CEiRIpj1.js} +4 -4
- package/dist/chunks/{LpFileTreeNode-nbp-JwV9.js → LpFileTreeNode-C0292AU2.js} +4 -4
- package/dist/chunks/{LpFormField-Bz50_LZW.js → LpFormField-Bhgi0idH.js} +1 -1
- package/dist/chunks/{LpHintLayer-B6bA5Cb_.js → LpHintLayer-D8ZKsvsT.js} +1 -1
- package/dist/chunks/{LpHints-DyJ5hVcr.js → LpHints-DbIV-wk4.js} +3 -3
- package/dist/chunks/{LpIcon-BCQLuHSP.js → LpIcon-CytpcLmS.js} +1 -1
- package/dist/chunks/{LpInfraNode-BS1RXYAs.js → LpInfraNode-8cGoY87Q.js} +2 -2
- package/dist/chunks/{LpInput-BjbXdjcW.js → LpInput-P2C12X7s.js} +3 -3
- package/dist/chunks/{LpInspector-BIyJyM6r.js → LpInspector-DjfMa4tD.js} +4 -4
- package/dist/chunks/{LpLightbox-CSAJuUaJ.js → LpLightbox-BEQtCz0m.js} +2 -2
- package/dist/chunks/{LpLogInspector-OJEz1vod.js → LpLogInspector-CyxK1d-V.js} +2 -2
- package/dist/chunks/{LpLogViewer-CRLwQpk0.js → LpLogViewer-CZrc_HG7.js} +6 -6
- package/dist/chunks/{LpMapPicker-DW2EnrCJ.js → LpMapPicker-CbTfFcEu.js} +1 -1
- package/dist/chunks/{LpMediaGallery-BNEYctDP.js → LpMediaGallery-C_SwNR4y.js} +3 -3
- package/dist/chunks/{LpModal-DdTqdf4x.js → LpModal-B6Yt0G7E.js} +1 -1
- package/dist/chunks/{LpModalNav-BL7Dp0om.js → LpModalNav-CMYWEiUs.js} +3 -3
- package/dist/chunks/{LpNotificationBell-d0F6MWxD.js → LpNotificationBell-BJKPx0X1.js} +4 -4
- package/dist/chunks/{LpNotificationFeed-BIe5lapb.js → LpNotificationFeed-orWISVez.js} +4 -4
- package/dist/chunks/{LpNumberField-D5Dx-hzD.js → LpNumberField-C5MeLsoE.js} +3 -3
- package/dist/chunks/{LpOtpInput-BVl74Lfl.js → LpOtpInput-6SCQ64uK.js} +1 -1
- package/dist/chunks/{LpPagination-D0wb-Uru.js → LpPagination-CkwbdFa9.js} +1 -1
- package/dist/chunks/{LpPaletteTheme-DdilCBXA.js → LpPaletteTheme-RWgbWFOz.js} +2 -2
- package/dist/chunks/{LpPasswordInput-DUtqWMkA.js → LpPasswordInput-DJBRo5lt.js} +2 -2
- package/dist/chunks/{LpPhoneInput-CalRjkqc.js → LpPhoneInput-DcmcJwos.js} +3 -3
- package/dist/chunks/{LpPie-BVAEmVBT.js → LpPie-DmMlhgo2.js} +2 -2
- package/dist/chunks/{LpPipeline-Dk7_sRP1.js → LpPipeline-BXcp2shV.js} +2 -2
- package/dist/chunks/{LpQuota-DKx0IZYA.js → LpQuota-CtEiqRg4.js} +1 -1
- package/dist/chunks/{LpRadioGroup-E3SP6j9h.js → LpRadioGroup-Ubkk_eSq.js} +2 -2
- package/dist/chunks/{LpRangeCalendar-BFJFaen4.js → LpRangeCalendar-DCswVYbU.js} +1 -1
- package/dist/chunks/{LpRangeSlider-b6ipywRB.js → LpRangeSlider-DM1qy5Tp.js} +1 -1
- package/dist/chunks/{LpRepeater-BLrw62Bh.js → LpRepeater-BMo2Eabn.js} +2 -2
- package/dist/chunks/{LpSecretField-BV8BNjKc.js → LpSecretField-SSRGVqRc.js} +5 -5
- package/dist/chunks/{LpSection-CghNNxIv.js → LpSection-C3bTxD7t.js} +1 -1
- package/dist/chunks/{LpSegmented-DjvrHL_G.js → LpSegmented-C1DF6m6A.js} +2 -2
- package/dist/chunks/{LpSelect-DYPimzAZ.js → LpSelect-DvDr1VPn.js} +4 -4
- package/dist/chunks/{LpSidebar-D3S8rYFf.js → LpSidebar-Bql881r6.js} +4 -4
- package/dist/chunks/{LpSidebarNav-Dlse8vxT.js → LpSidebarNav-CKx2KJvr.js} +3 -3
- package/dist/chunks/{LpSidebarRow-Cqd_6tGG.js → LpSidebarRow-BMOL9kOG.js} +3 -3
- package/dist/chunks/{LpSlider-B9XIC75O.js → LpSlider-DsSMe4b5.js} +1 -1
- package/dist/chunks/{LpStat-kyLRmX-m.js → LpStat-CQYYDMS6.js} +2 -2
- package/dist/chunks/{LpStatus-szB2dWzM.js → LpStatus-g5nSJfU3.js} +1 -1
- package/dist/chunks/{LpStepMark-DP3CDSm9.js → LpStepMark-seVNOuNJ.js} +1 -1
- package/dist/chunks/{LpStepper-BS3iaJIz.js → LpStepper-D6qEXihZ.js} +1 -1
- package/dist/chunks/{LpSwitch-DRFy8RNr.js → LpSwitch-DM5CVm31.js} +1 -1
- package/dist/chunks/{LpTabFace-C9-OperL.js → LpTabFace-ZWwelqRU.js} +2 -2
- package/dist/chunks/{LpTableFilter-CEIwLupk.js → LpTableFilter-CWU9Dmk-.js} +2 -2
- package/dist/chunks/{LpTagsInput-ClDeF_aU.js → LpTagsInput-C2qVF2ax.js} +5 -5
- package/dist/chunks/{LpTextarea-DEY6pUBy.js → LpTextarea-C3EoV_xv.js} +1 -1
- package/dist/chunks/{LpThemeStudio-WY72Z1Db.js → LpThemeStudio-BIBahaIs.js} +5 -5
- package/dist/chunks/{LpThemeSwitcher-9uCH9c-K.js → LpThemeSwitcher-D4MqFLGS.js} +3 -3
- package/dist/chunks/{LpTimeField-BmgxCzQO.js → LpTimeField-DPOkbvyP.js} +2 -2
- package/dist/chunks/{LpToaster-DLKO-efn.js → LpToaster-Dj1VKxFv.js} +2 -2
- package/dist/chunks/{LpTopologyCanvas-B-PhPa7k.js → LpTopologyCanvas-Bspzwm7x.js} +4 -4
- package/dist/chunks/{LpTour-ODlBcat2.js → LpTour-CwpVdVN-.js} +1 -1
- package/dist/chunks/{LpTruncate--nhT0iUo.js → LpTruncate-JSaIW25q.js} +1 -1
- package/dist/chunks/{LpWindow-DJxE8Zl-.js → LpWindow-RVcP436Z.js} +2 -2
- package/dist/chunks/{LpWorkspaceSwitcher-Bpf41Bw5.js → LpWorkspaceSwitcher-D0WOz1Fg.js} +3 -3
- package/dist/chunks/{MenuTitle-CMjvLsvC.js → MenuTitle-D8Umab23.js} +1 -1
- package/dist/chunks/{OptionContent-DY8NaG8s.js → OptionContent-DCnX_KRK.js} +1 -1
- package/dist/chunks/{PickerField-CgfkaBgg.js → PickerField-ChjY27bm.js} +1 -1
- package/dist/chunks/{RevealToggle-CPMXxaKv.js → RevealToggle-MaL7PEjr.js} +1 -1
- package/dist/chunks/{TourCard-D4b3lMHi.js → TourCard-oXZSpHKb.js} +1 -1
- package/dist/chunks/{icons-C1vppR4f.js → icons-BOdqDUii.js} +1 -1
- 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.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.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/LpVideoTrim.vue.d.ts +68 -0
- package/dist/components/LpVideoTrim.vue.js +955 -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/TourCard.vue.js +1 -1
- package/dist/components/chartWindow.js +4 -8
- package/dist/components/menuWhen.js +1 -1
- package/dist/components/videoFrames.d.ts +37 -0
- package/dist/components/videoFrames.js +134 -0
- package/dist/components/videoTrim.d.ts +75 -0
- package/dist/components/videoTrim.js +127 -0
- package/dist/composables/span.d.ts +10 -0
- package/dist/composables/span.js +15 -0
- package/dist/icons-all.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +95 -88
- package/package.json +1 -1
- package/src/component-names.ts +1 -0
- package/src/components/LpVideoTrim.vue +924 -0
- package/src/components/chartWindow.ts +4 -8
- package/src/components/videoFrames.ts +171 -0
- package/src/components/videoTrim.ts +198 -0
- package/src/composables/span.ts +21 -0
- package/src/index.ts +3 -0
- package/src/kit-icons.ts +1 -1
|
@@ -0,0 +1,955 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, watch, shallowRef, nextTick, onMounted, onBeforeUnmount, openBlock, createElementBlock, mergeProps, unref, createElementVNode, normalizeStyle, Fragment, renderList, normalizeClass, createCommentVNode, createVNode, toDisplayString, withCtx, createTextVNode, withDirectives, vShow, withKeys, withModifiers, createBlock } from "vue";
|
|
2
|
+
import { startPointerDrag } from "../composables/pointerDrag.js";
|
|
3
|
+
import { 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 { _ as _sfc_main$2 } from "../chunks/LpButton-DSHioIfD.js";
|
|
9
|
+
import { _ as _sfc_main$1 } from "../chunks/LpIcon-CytpcLmS.js";
|
|
10
|
+
import { _ as _sfc_main$3 } from "../chunks/LpInput-P2C12X7s.js";
|
|
11
|
+
import { formatClipTime } from "./videoBackdrop.js";
|
|
12
|
+
import { stillSpan, FrameSampler } from "./videoFrames.js";
|
|
13
|
+
import { normalizeRange, ticks, tickStep, containRect, mediaErrorCause, revealTime, zoomView, shiftView, adjustRegion, dragEnd, setEnd, parseClipTime, regionBetween } from "./videoTrim.js";
|
|
14
|
+
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper-1tPrXgE0.js";
|
|
15
|
+
import '../assets/LpVideoTrim-Ci6IIHW0.css';const _hoisted_1 = ["data-disabled"];
|
|
16
|
+
const _hoisted_2 = ["src", "poster", "muted"];
|
|
17
|
+
const _hoisted_3 = ["src"];
|
|
18
|
+
const _hoisted_4 = ["aria-label"];
|
|
19
|
+
const _hoisted_5 = ["data-lp-corner", "onPointerdown"];
|
|
20
|
+
const _hoisted_6 = {
|
|
21
|
+
key: 1,
|
|
22
|
+
role: "alert",
|
|
23
|
+
class: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4 text-center text-sm text-white/80"
|
|
24
|
+
};
|
|
25
|
+
const _hoisted_7 = { class: "flex flex-wrap items-center gap-1" };
|
|
26
|
+
const _hoisted_8 = {
|
|
27
|
+
class: "px-1.5 font-mono text-xs text-muted tabular-nums",
|
|
28
|
+
"data-lp-clock": ""
|
|
29
|
+
};
|
|
30
|
+
const _hoisted_9 = { class: "text-ink" };
|
|
31
|
+
const _hoisted_10 = {
|
|
32
|
+
class: "relative h-4 overflow-hidden text-[10px] text-muted tabular-nums",
|
|
33
|
+
"aria-hidden": "true"
|
|
34
|
+
};
|
|
35
|
+
const _hoisted_11 = ["aria-label"];
|
|
36
|
+
const _hoisted_12 = { class: "absolute inset-0 overflow-hidden rounded-control" };
|
|
37
|
+
const _hoisted_13 = ["data-lp-still"];
|
|
38
|
+
const _hoisted_14 = ["tabindex", "aria-label", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-disabled", "data-lp-handle", "onPointerdown"];
|
|
39
|
+
const _hoisted_15 = ["tabindex", "aria-label", "aria-valuemax", "aria-valuenow", "aria-valuetext"];
|
|
40
|
+
const _hoisted_16 = ["aria-label"];
|
|
41
|
+
const _hoisted_17 = { class: "flex flex-wrap items-end gap-x-3 gap-y-2 text-xs" };
|
|
42
|
+
const _hoisted_18 = { class: "text-muted" };
|
|
43
|
+
const _hoisted_19 = { class: "flex flex-col gap-1 pb-1.5" };
|
|
44
|
+
const _hoisted_20 = { class: "text-muted" };
|
|
45
|
+
const _hoisted_21 = {
|
|
46
|
+
class: "font-mono text-sm text-ink tabular-nums",
|
|
47
|
+
"data-lp-length": ""
|
|
48
|
+
};
|
|
49
|
+
const _hoisted_22 = {
|
|
50
|
+
key: 0,
|
|
51
|
+
class: "pb-2 text-muted",
|
|
52
|
+
"data-lp-left": ""
|
|
53
|
+
};
|
|
54
|
+
const _hoisted_23 = {
|
|
55
|
+
key: 1,
|
|
56
|
+
class: "pb-2 text-muted"
|
|
57
|
+
};
|
|
58
|
+
const __default__ = { inheritAttrs: false };
|
|
59
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
60
|
+
...__default__,
|
|
61
|
+
__name: "LpVideoTrim",
|
|
62
|
+
props: {
|
|
63
|
+
src: {},
|
|
64
|
+
poster: { default: void 0 },
|
|
65
|
+
range: { default: void 0 },
|
|
66
|
+
maxClip: { default: void 0 },
|
|
67
|
+
minClip: { default: 0.1 },
|
|
68
|
+
regionSelect: { type: Boolean },
|
|
69
|
+
region: { default: null },
|
|
70
|
+
frameRate: { default: 30 },
|
|
71
|
+
disabled: { type: Boolean },
|
|
72
|
+
labels: { default: () => ({}) }
|
|
73
|
+
},
|
|
74
|
+
emits: ["update:range", "change", "update:region", "error"],
|
|
75
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
76
|
+
const props = __props;
|
|
77
|
+
const emit = __emit;
|
|
78
|
+
const text = useLabels(
|
|
79
|
+
"videoTrim",
|
|
80
|
+
{
|
|
81
|
+
play: "Play",
|
|
82
|
+
pause: "Pause",
|
|
83
|
+
stepBack: "Previous frame",
|
|
84
|
+
stepForward: "Next frame",
|
|
85
|
+
mute: "Mute",
|
|
86
|
+
unmute: "Unmute",
|
|
87
|
+
zoomIn: "Zoom in",
|
|
88
|
+
zoomOut: "Zoom out",
|
|
89
|
+
zoomFit: "Show whole video",
|
|
90
|
+
start: "Start",
|
|
91
|
+
end: "End",
|
|
92
|
+
position: "Position",
|
|
93
|
+
length: "Length",
|
|
94
|
+
/** `{left}` and `{max}` are replaced by times. */
|
|
95
|
+
left: "{left} left of {max}",
|
|
96
|
+
overview: "Visible part of the timeline",
|
|
97
|
+
timeline: "Timeline — Space plays, arrows step, I and O set start and end",
|
|
98
|
+
region: "Marked area — arrows move it, Shift+arrows resize, Delete removes",
|
|
99
|
+
regionHint: "Drag on the picture to mark an area",
|
|
100
|
+
regionClear: "Remove area",
|
|
101
|
+
failed: "This video couldn't be loaded.",
|
|
102
|
+
unsupported: "This browser can't play this video's format.",
|
|
103
|
+
invalidTime: "Type a time like 1:05.5"
|
|
104
|
+
},
|
|
105
|
+
() => props.labels
|
|
106
|
+
);
|
|
107
|
+
const { class: rootClass, attrs: rest } = useMergedAttrs("flex flex-col gap-3 select-none");
|
|
108
|
+
const reduced = usePrefersReducedMotion();
|
|
109
|
+
const videoEl = ref(null);
|
|
110
|
+
const samplerEl = ref(null);
|
|
111
|
+
const stageEl = ref(null);
|
|
112
|
+
const trackEl = ref(null);
|
|
113
|
+
const duration = ref(0);
|
|
114
|
+
const failure = ref(null);
|
|
115
|
+
const time = ref(0);
|
|
116
|
+
const playing = ref(false);
|
|
117
|
+
const muted = ref(false);
|
|
118
|
+
const videoSize = ref({ width: 0, height: 0 });
|
|
119
|
+
const stageSize = ref({ width: 0, height: 0 });
|
|
120
|
+
const trackWidth = ref(0);
|
|
121
|
+
const ready = computed(() => duration.value > 0 && !failure.value);
|
|
122
|
+
const off = computed(() => props.disabled || !ready.value);
|
|
123
|
+
const limits = computed(() => ({
|
|
124
|
+
duration: duration.value,
|
|
125
|
+
minClip: Math.max(0, props.minClip ?? 0),
|
|
126
|
+
maxClip: props.maxClip && props.maxClip > 0 ? props.maxClip : Infinity
|
|
127
|
+
}));
|
|
128
|
+
const local = ref([0, 0]);
|
|
129
|
+
const dragging = ref(null);
|
|
130
|
+
const same = (a, b) => !!a && a[0] === b[0] && a[1] === b[1];
|
|
131
|
+
watch(
|
|
132
|
+
[() => props.range, limits],
|
|
133
|
+
() => {
|
|
134
|
+
if (dragging.value !== null || !duration.value) return;
|
|
135
|
+
const next = normalizeRange(props.range, limits.value);
|
|
136
|
+
local.value = next;
|
|
137
|
+
if (!same(props.range, next)) emit("update:range", next);
|
|
138
|
+
},
|
|
139
|
+
{ deep: true }
|
|
140
|
+
);
|
|
141
|
+
function put(next, commit) {
|
|
142
|
+
const changed = !same(local.value, next);
|
|
143
|
+
local.value = next;
|
|
144
|
+
if (changed) emit("update:range", next);
|
|
145
|
+
if (commit) emit("change", next);
|
|
146
|
+
}
|
|
147
|
+
const clipLength = computed(() => local.value[1] - local.value[0]);
|
|
148
|
+
let seekTarget = null;
|
|
149
|
+
let seekBusy = false;
|
|
150
|
+
function seek(t) {
|
|
151
|
+
const video = videoEl.value;
|
|
152
|
+
const target = Math.min(Math.max(0, t), duration.value || t);
|
|
153
|
+
time.value = target;
|
|
154
|
+
if (!video) return;
|
|
155
|
+
if (seekBusy) {
|
|
156
|
+
seekTarget = target;
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
seekBusy = true;
|
|
160
|
+
video.currentTime = target;
|
|
161
|
+
}
|
|
162
|
+
function onSeeked() {
|
|
163
|
+
seekBusy = false;
|
|
164
|
+
if (seekTarget !== null) {
|
|
165
|
+
const next = seekTarget;
|
|
166
|
+
seekTarget = null;
|
|
167
|
+
seek(next);
|
|
168
|
+
} else if (videoEl.value && !playing.value) time.value = videoEl.value.currentTime;
|
|
169
|
+
}
|
|
170
|
+
let probingDuration = false;
|
|
171
|
+
function onMetadata() {
|
|
172
|
+
const video = videoEl.value;
|
|
173
|
+
if (!video) return;
|
|
174
|
+
videoSize.value = { width: video.videoWidth, height: video.videoHeight };
|
|
175
|
+
if (Number.isFinite(video.duration)) {
|
|
176
|
+
duration.value = video.duration;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
probingDuration = true;
|
|
180
|
+
video.currentTime = 1e101;
|
|
181
|
+
}
|
|
182
|
+
function onDurationChange() {
|
|
183
|
+
const video = videoEl.value;
|
|
184
|
+
if (!video || !Number.isFinite(video.duration) || !video.duration) return;
|
|
185
|
+
duration.value = video.duration;
|
|
186
|
+
if (probingDuration) {
|
|
187
|
+
probingDuration = false;
|
|
188
|
+
video.currentTime = 0;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
async function onError() {
|
|
192
|
+
const video = videoEl.value;
|
|
193
|
+
if (!video?.error) return;
|
|
194
|
+
const src = props.src;
|
|
195
|
+
let cause = mediaErrorCause(video.error);
|
|
196
|
+
if (cause === "unsupported") cause = await probeSource(src);
|
|
197
|
+
if (src !== props.src) return;
|
|
198
|
+
failure.value = cause;
|
|
199
|
+
emit("error", { cause, message: cause === "unsupported" ? text.value.unsupported : text.value.failed });
|
|
200
|
+
}
|
|
201
|
+
async function probeSource(src) {
|
|
202
|
+
try {
|
|
203
|
+
const res = await fetch(src, { headers: { Range: "bytes=0-0" }, credentials: "same-origin" });
|
|
204
|
+
void res.body?.cancel();
|
|
205
|
+
const type = res.headers.get("content-type") ?? "";
|
|
206
|
+
return res.ok && !/^text\/|json|xml/.test(type) ? "unsupported" : "load";
|
|
207
|
+
} catch {
|
|
208
|
+
return "unsupported";
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
let stopAtEnd = false;
|
|
212
|
+
let frame = 0;
|
|
213
|
+
function tick() {
|
|
214
|
+
frame = 0;
|
|
215
|
+
const video = videoEl.value;
|
|
216
|
+
if (!video || !playing.value) return;
|
|
217
|
+
time.value = video.currentTime;
|
|
218
|
+
if (stopAtEnd && video.currentTime >= local.value[1]) {
|
|
219
|
+
video.pause();
|
|
220
|
+
seek(local.value[1]);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (zoomed.value) view.value = revealTime(view.value, time.value, duration.value, 0.05);
|
|
224
|
+
frame = requestAnimationFrame(tick);
|
|
225
|
+
}
|
|
226
|
+
function onPlay() {
|
|
227
|
+
playing.value = true;
|
|
228
|
+
if (!frame) frame = requestAnimationFrame(tick);
|
|
229
|
+
}
|
|
230
|
+
function onPause() {
|
|
231
|
+
playing.value = false;
|
|
232
|
+
if (frame) cancelAnimationFrame(frame);
|
|
233
|
+
frame = 0;
|
|
234
|
+
if (videoEl.value && !seekBusy) time.value = videoEl.value.currentTime;
|
|
235
|
+
}
|
|
236
|
+
function togglePlay() {
|
|
237
|
+
const video = videoEl.value;
|
|
238
|
+
if (!video || off.value) return;
|
|
239
|
+
if (!video.paused) {
|
|
240
|
+
video.pause();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const [a, b] = local.value;
|
|
244
|
+
let from = time.value;
|
|
245
|
+
if (from >= b - 1e-3 && from <= b + 1e-3) from = a;
|
|
246
|
+
stopAtEnd = from >= a - 1e-3 && from < b;
|
|
247
|
+
if (from !== time.value) seek(from);
|
|
248
|
+
void video.play().catch(() => {
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function pause() {
|
|
252
|
+
videoEl.value?.pause();
|
|
253
|
+
}
|
|
254
|
+
function step(seconds) {
|
|
255
|
+
if (off.value) return;
|
|
256
|
+
pause();
|
|
257
|
+
seek(time.value + seconds);
|
|
258
|
+
if (zoomed.value) view.value = revealTime(view.value, time.value, duration.value);
|
|
259
|
+
}
|
|
260
|
+
function toggleMute() {
|
|
261
|
+
muted.value = !muted.value;
|
|
262
|
+
if (videoEl.value) videoEl.value.muted = muted.value;
|
|
263
|
+
}
|
|
264
|
+
const frameStep = computed(() => 1 / Math.max(1, props.frameRate));
|
|
265
|
+
const MIN_SPAN = 2;
|
|
266
|
+
const view = ref({ start: 0, end: 0 });
|
|
267
|
+
const span = computed(() => Math.max(1e-6, view.value.end - view.value.start));
|
|
268
|
+
const zoomed = computed(() => duration.value > 0 && span.value < duration.value - 1e-6);
|
|
269
|
+
const canZoomIn = computed(() => span.value > Math.min(MIN_SPAN, duration.value) + 1e-6);
|
|
270
|
+
watch(duration, (d) => {
|
|
271
|
+
view.value = { start: 0, end: d };
|
|
272
|
+
});
|
|
273
|
+
const xOf = (t) => (t - view.value.start) / span.value * trackWidth.value;
|
|
274
|
+
const pct = (t) => `${(t - view.value.start) / span.value * 100}%`;
|
|
275
|
+
function timeAt(clientX) {
|
|
276
|
+
const box = trackEl.value?.getBoundingClientRect();
|
|
277
|
+
if (!box || !box.width) return 0;
|
|
278
|
+
return view.value.start + (clientX - box.left) / box.width * span.value;
|
|
279
|
+
}
|
|
280
|
+
function zoomBy(factor, anchor = time.value) {
|
|
281
|
+
if (!duration.value) return;
|
|
282
|
+
view.value = zoomView(view.value, anchor, factor, duration.value, MIN_SPAN);
|
|
283
|
+
}
|
|
284
|
+
function fit() {
|
|
285
|
+
view.value = { start: 0, end: duration.value };
|
|
286
|
+
}
|
|
287
|
+
function onWheel(event) {
|
|
288
|
+
if (!ready.value) return;
|
|
289
|
+
const dx = event.shiftKey ? event.deltaY : event.deltaX;
|
|
290
|
+
if (Math.abs(dx) > Math.abs(event.deltaY) || event.shiftKey) {
|
|
291
|
+
if (!zoomed.value) return;
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
view.value = shiftView(view.value, dx / Math.max(1, trackWidth.value) * span.value, duration.value);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
event.preventDefault();
|
|
297
|
+
const unit = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? 400 : 1;
|
|
298
|
+
zoomBy(Math.exp(-event.deltaY * unit / (event.ctrlKey ? 100 : 300)), timeAt(event.clientX));
|
|
299
|
+
}
|
|
300
|
+
const marks = computed(() => ready.value ? ticks(view.value, tickStep(span.value, trackWidth.value)) : []);
|
|
301
|
+
const markDigits = computed(() => tickStep(span.value, trackWidth.value) < 1);
|
|
302
|
+
const pointers = /* @__PURE__ */ new Map();
|
|
303
|
+
let pinch = null;
|
|
304
|
+
let edgeFrame = 0;
|
|
305
|
+
let lastX = 0;
|
|
306
|
+
let scrubbing = false;
|
|
307
|
+
function onHandleDown(end, event) {
|
|
308
|
+
if (off.value || event.button !== 0) return;
|
|
309
|
+
event.stopPropagation();
|
|
310
|
+
event.currentTarget.focus({ preventScroll: true });
|
|
311
|
+
pause();
|
|
312
|
+
dragging.value = end;
|
|
313
|
+
lastX = event.clientX;
|
|
314
|
+
startPointerDrag(event, {
|
|
315
|
+
cursor: "ew-resize",
|
|
316
|
+
move: (e) => {
|
|
317
|
+
lastX = e.clientX;
|
|
318
|
+
moveHandle();
|
|
319
|
+
edgeScroll();
|
|
320
|
+
},
|
|
321
|
+
end: () => {
|
|
322
|
+
dragging.value = null;
|
|
323
|
+
if (edgeFrame) cancelAnimationFrame(edgeFrame);
|
|
324
|
+
edgeFrame = 0;
|
|
325
|
+
emit("change", local.value);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function moveHandle() {
|
|
330
|
+
const end = dragging.value;
|
|
331
|
+
if (end === null) return;
|
|
332
|
+
const next = dragEnd(local.value, end, timeAt(lastX), limits.value);
|
|
333
|
+
put(next, false);
|
|
334
|
+
seek(next[end]);
|
|
335
|
+
}
|
|
336
|
+
function edgeScroll() {
|
|
337
|
+
if (edgeFrame || !zoomed.value) return;
|
|
338
|
+
const box = trackEl.value?.getBoundingClientRect();
|
|
339
|
+
if (!box) return;
|
|
340
|
+
const over = lastX < box.left ? lastX - box.left : lastX > box.right ? lastX - box.right : 0;
|
|
341
|
+
if (!over || dragging.value === null && !scrubbing) return;
|
|
342
|
+
edgeFrame = requestAnimationFrame(() => {
|
|
343
|
+
edgeFrame = 0;
|
|
344
|
+
view.value = shiftView(view.value, Math.max(-60, Math.min(60, over)) / 6 / Math.max(1, box.width) * span.value, duration.value);
|
|
345
|
+
if (dragging.value !== null) moveHandle();
|
|
346
|
+
else seek(timeAt(lastX));
|
|
347
|
+
edgeScroll();
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
function onTrackDown(event) {
|
|
351
|
+
if (off.value || event.pointerType === "mouse" && event.button !== 0) return;
|
|
352
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
353
|
+
pointers.set(event.pointerId, event.clientX);
|
|
354
|
+
if (pointers.size === 2) {
|
|
355
|
+
scrubbing = false;
|
|
356
|
+
const [a, b] = [...pointers.values()];
|
|
357
|
+
pinch = { distance: Math.max(8, Math.abs(a - b)), anchor: timeAt((a + b) / 2) };
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (pointers.size > 2) return;
|
|
361
|
+
event.preventDefault();
|
|
362
|
+
trackEl.value?.querySelector("[data-lp-playhead]")?.focus({ preventScroll: true });
|
|
363
|
+
pause();
|
|
364
|
+
scrubbing = true;
|
|
365
|
+
lastX = event.clientX;
|
|
366
|
+
seek(timeAt(event.clientX));
|
|
367
|
+
}
|
|
368
|
+
function onTrackMove(event) {
|
|
369
|
+
if (!pointers.has(event.pointerId)) return;
|
|
370
|
+
pointers.set(event.pointerId, event.clientX);
|
|
371
|
+
if (pinch && pointers.size === 2) {
|
|
372
|
+
const [a, b] = [...pointers.values()];
|
|
373
|
+
const distance = Math.max(8, Math.abs(a - b));
|
|
374
|
+
zoomBy(distance / pinch.distance, pinch.anchor);
|
|
375
|
+
pinch.distance = distance;
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
if (!scrubbing) return;
|
|
379
|
+
lastX = event.clientX;
|
|
380
|
+
seek(timeAt(event.clientX));
|
|
381
|
+
edgeScroll();
|
|
382
|
+
}
|
|
383
|
+
function onTrackUp(event) {
|
|
384
|
+
pointers.delete(event.pointerId);
|
|
385
|
+
if (pointers.size < 2) pinch = null;
|
|
386
|
+
if (!pointers.size) scrubbing = false;
|
|
387
|
+
}
|
|
388
|
+
function onOverviewDown(event) {
|
|
389
|
+
if (off.value || event.button !== 0) return;
|
|
390
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
391
|
+
const centreAt = (clientX) => {
|
|
392
|
+
const centre = (clientX - box.left) / Math.max(1, box.width) * duration.value;
|
|
393
|
+
view.value = shiftView(view.value, centre - (view.value.start + view.value.end) / 2, duration.value);
|
|
394
|
+
};
|
|
395
|
+
centreAt(event.clientX);
|
|
396
|
+
startPointerDrag(event, { move: (e) => centreAt(e.clientX), end: () => {
|
|
397
|
+
} });
|
|
398
|
+
}
|
|
399
|
+
const STILL_HEIGHT = 56;
|
|
400
|
+
const stillWidth = computed(() => {
|
|
401
|
+
const { width, height } = videoSize.value;
|
|
402
|
+
return Math.round(Math.min(160, Math.max(40, width && height ? STILL_HEIGHT * width / height : STILL_HEIGHT * (16 / 9))));
|
|
403
|
+
});
|
|
404
|
+
const stillSeconds = computed(() => stillSpan(span.value / Math.max(1, trackWidth.value), stillWidth.value));
|
|
405
|
+
const stills = computed(() => {
|
|
406
|
+
if (!ready.value || !trackWidth.value) return [];
|
|
407
|
+
const step2 = stillSeconds.value;
|
|
408
|
+
const first = Math.floor(view.value.start / step2);
|
|
409
|
+
const last = Math.min(Math.ceil(view.value.end / step2), Math.ceil(duration.value / step2));
|
|
410
|
+
const out = [];
|
|
411
|
+
for (let k = first; k < last && out.length < 200; k++) {
|
|
412
|
+
out.push({ key: `${step2}:${k}`, time: Math.min(duration.value, k * step2 + step2 / 2), left: pct(k * step2), width: `${step2 / span.value * 100}%` });
|
|
413
|
+
}
|
|
414
|
+
return out;
|
|
415
|
+
});
|
|
416
|
+
const frames = shallowRef(/* @__PURE__ */ new Map());
|
|
417
|
+
let sampler = null;
|
|
418
|
+
let stillTimer;
|
|
419
|
+
watch(stills, (list) => {
|
|
420
|
+
clearTimeout(stillTimer);
|
|
421
|
+
stillTimer = setTimeout(() => {
|
|
422
|
+
if (!sampler) return;
|
|
423
|
+
const centre = (view.value.start + view.value.end) / 2;
|
|
424
|
+
sampler.want([...list].sort((a, b) => Math.abs(a.time - centre) - Math.abs(b.time - centre)));
|
|
425
|
+
}, 120);
|
|
426
|
+
});
|
|
427
|
+
function mountFrame(key, el) {
|
|
428
|
+
if (!isHTMLElement(el)) return;
|
|
429
|
+
const canvas = frames.value.get(key) ?? sampler?.cached(key);
|
|
430
|
+
if (canvas && canvas.parentElement !== el) el.replaceChildren(canvas);
|
|
431
|
+
}
|
|
432
|
+
const picture = computed(() => containRect(stageSize.value.width, stageSize.value.height, videoSize.value.width, videoSize.value.height));
|
|
433
|
+
const draft = ref(null);
|
|
434
|
+
const shownRegion = computed(() => draft.value ?? props.region ?? null);
|
|
435
|
+
function fractionAt(event) {
|
|
436
|
+
const box = stageEl.value?.getBoundingClientRect();
|
|
437
|
+
const p = picture.value;
|
|
438
|
+
if (!box || !p.width || !p.height) return { x: 0, y: 0 };
|
|
439
|
+
return { x: (event.clientX - box.left - p.x) / p.width, y: (event.clientY - box.top - p.y) / p.height };
|
|
440
|
+
}
|
|
441
|
+
function onRegionDown(handle, event) {
|
|
442
|
+
if (props.disabled || !props.regionSelect || event.pointerType === "mouse" && event.button !== 0) return;
|
|
443
|
+
event.stopPropagation();
|
|
444
|
+
pause();
|
|
445
|
+
const start = fractionAt(event);
|
|
446
|
+
const from = props.region ?? null;
|
|
447
|
+
startPointerDrag(event, {
|
|
448
|
+
move: (e) => {
|
|
449
|
+
const at = fractionAt(e);
|
|
450
|
+
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);
|
|
451
|
+
},
|
|
452
|
+
end: (completed) => {
|
|
453
|
+
const next = draft.value;
|
|
454
|
+
draft.value = null;
|
|
455
|
+
if (!completed || !next || handle === "draw" && (next.w < 0.01 || next.h < 0.01)) return;
|
|
456
|
+
emit("update:region", next);
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
function onRegionKey(event) {
|
|
461
|
+
const r = props.region;
|
|
462
|
+
if (!r || props.disabled) return;
|
|
463
|
+
if (event.key === "Delete" || event.key === "Backspace") {
|
|
464
|
+
event.preventDefault();
|
|
465
|
+
emit("update:region", null);
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const d = event.altKey ? 2e-3 : 0.01;
|
|
469
|
+
const moves = { ArrowLeft: [-d, 0], ArrowRight: [d, 0], ArrowUp: [0, -d], ArrowDown: [0, d] };
|
|
470
|
+
const move = moves[event.key];
|
|
471
|
+
if (!move) return;
|
|
472
|
+
event.preventDefault();
|
|
473
|
+
event.stopPropagation();
|
|
474
|
+
emit("update:region", adjustRegion(r, event.shiftKey ? "se" : "move", move[0], move[1]));
|
|
475
|
+
}
|
|
476
|
+
function onKeydown(event) {
|
|
477
|
+
const target = event.target;
|
|
478
|
+
if (event.defaultPrevented || event.ctrlKey || event.metaKey || target.closest("input, textarea, select, [contenteditable='true']")) return;
|
|
479
|
+
const handle = target.dataset.lpHandle;
|
|
480
|
+
const end = handle === "0" ? 0 : handle === "1" ? 1 : null;
|
|
481
|
+
const big = event.shiftKey ? 1 : frameStep.value;
|
|
482
|
+
const delta = { ArrowLeft: -big, ArrowRight: big, ArrowDown: -big, ArrowUp: big, PageDown: -10, PageUp: 10 };
|
|
483
|
+
if (event.key === " " && target.tagName !== "BUTTON") {
|
|
484
|
+
event.preventDefault();
|
|
485
|
+
togglePlay();
|
|
486
|
+
} else if (event.key in delta || event.key === "Home" || event.key === "End") {
|
|
487
|
+
if (off.value) return;
|
|
488
|
+
event.preventDefault();
|
|
489
|
+
if (end !== null) {
|
|
490
|
+
const from = local.value[end];
|
|
491
|
+
const to = event.key === "Home" ? 0 : event.key === "End" ? duration.value : from + delta[event.key];
|
|
492
|
+
const next = dragEnd(local.value, end, to, limits.value);
|
|
493
|
+
put(next, true);
|
|
494
|
+
pause();
|
|
495
|
+
seek(next[end]);
|
|
496
|
+
} else if (event.key === "Home" || event.key === "End") {
|
|
497
|
+
pause();
|
|
498
|
+
seek(event.key === "Home" ? 0 : duration.value);
|
|
499
|
+
} else step(delta[event.key]);
|
|
500
|
+
if (zoomed.value) view.value = revealTime(view.value, time.value, duration.value);
|
|
501
|
+
} else if ((event.key === "i" || event.key === "I" || event.key === "o" || event.key === "O") && !event.altKey) {
|
|
502
|
+
if (off.value) return;
|
|
503
|
+
event.preventDefault();
|
|
504
|
+
put(setEnd(local.value, event.key.toLowerCase() === "i" ? 0 : 1, time.value, limits.value), true);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
const drafts = ref([null, null]);
|
|
508
|
+
const invalid = ref([false, false]);
|
|
509
|
+
const fieldText = (end) => drafts.value[end] ?? formatClipTime(local.value[end], true);
|
|
510
|
+
function onFieldInput(end, value) {
|
|
511
|
+
drafts.value[end] = value;
|
|
512
|
+
invalid.value[end] = false;
|
|
513
|
+
}
|
|
514
|
+
function commitField(end) {
|
|
515
|
+
const typed = drafts.value[end];
|
|
516
|
+
if (typed === null) return;
|
|
517
|
+
const t = parseClipTime(typed);
|
|
518
|
+
if (t === null) {
|
|
519
|
+
invalid.value[end] = true;
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
drafts.value[end] = null;
|
|
523
|
+
put(setEnd(local.value, end, t, limits.value), true);
|
|
524
|
+
seek(local.value[end]);
|
|
525
|
+
if (zoomed.value) view.value = revealTime(view.value, local.value[end], duration.value);
|
|
526
|
+
}
|
|
527
|
+
function revertField(end) {
|
|
528
|
+
drafts.value[end] = null;
|
|
529
|
+
invalid.value[end] = false;
|
|
530
|
+
}
|
|
531
|
+
useResizeObserver(trackEl, (_, el) => trackWidth.value = el.clientWidth, { immediate: true });
|
|
532
|
+
useResizeObserver(stageEl, (_, el) => stageSize.value = { width: el.clientWidth, height: el.clientHeight }, { immediate: true });
|
|
533
|
+
function startSampler() {
|
|
534
|
+
sampler?.dispose();
|
|
535
|
+
sampler = samplerEl.value ? new FrameSampler(samplerEl.value, () => ({ width: stillWidth.value, height: STILL_HEIGHT }), (key, canvas) => {
|
|
536
|
+
const next = new Map(frames.value);
|
|
537
|
+
next.set(key, canvas);
|
|
538
|
+
if (next.size > 240) next.delete(next.keys().next().value);
|
|
539
|
+
frames.value = next;
|
|
540
|
+
}) : null;
|
|
541
|
+
}
|
|
542
|
+
watch(
|
|
543
|
+
() => props.src,
|
|
544
|
+
() => {
|
|
545
|
+
duration.value = 0;
|
|
546
|
+
failure.value = null;
|
|
547
|
+
time.value = 0;
|
|
548
|
+
frames.value = /* @__PURE__ */ new Map();
|
|
549
|
+
seekBusy = false;
|
|
550
|
+
seekTarget = null;
|
|
551
|
+
void nextTick(startSampler);
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
onMounted(startSampler);
|
|
555
|
+
onBeforeUnmount(() => {
|
|
556
|
+
sampler?.dispose();
|
|
557
|
+
clearTimeout(stillTimer);
|
|
558
|
+
if (frame) cancelAnimationFrame(frame);
|
|
559
|
+
if (edgeFrame) cancelAnimationFrame(edgeFrame);
|
|
560
|
+
for (const el of [videoEl.value, samplerEl.value]) {
|
|
561
|
+
if (!el) continue;
|
|
562
|
+
el.pause();
|
|
563
|
+
el.removeAttribute("src");
|
|
564
|
+
el.load();
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
__expose({
|
|
568
|
+
play: () => videoEl.value?.paused ? togglePlay() : void 0,
|
|
569
|
+
pause,
|
|
570
|
+
seek,
|
|
571
|
+
/** The playhead, in seconds. */
|
|
572
|
+
currentTime: () => time.value
|
|
573
|
+
});
|
|
574
|
+
const handleText = (t) => formatClipTime(t, true);
|
|
575
|
+
const leftText = computed(
|
|
576
|
+
() => Number.isFinite(limits.value.maxClip) ? text.value.left.replace("{left}", formatClipTime(Math.max(0, limits.value.maxClip - clipLength.value), true)).replace("{max}", formatClipTime(limits.value.maxClip, true)) : ""
|
|
577
|
+
);
|
|
578
|
+
return (_ctx, _cache) => {
|
|
579
|
+
return openBlock(), createElementBlock("div", mergeProps({ class: unref(rootClass) }, unref(rest), {
|
|
580
|
+
"data-disabled": __props.disabled || void 0,
|
|
581
|
+
onKeydown
|
|
582
|
+
}), [
|
|
583
|
+
createElementVNode("div", {
|
|
584
|
+
ref_key: "stageEl",
|
|
585
|
+
ref: stageEl,
|
|
586
|
+
class: "relative aspect-video w-full overflow-hidden rounded-card bg-black"
|
|
587
|
+
}, [
|
|
588
|
+
createElementVNode("video", {
|
|
589
|
+
ref_key: "videoEl",
|
|
590
|
+
ref: videoEl,
|
|
591
|
+
class: "absolute inset-0 size-full object-contain",
|
|
592
|
+
src: __props.src,
|
|
593
|
+
poster: __props.poster,
|
|
594
|
+
preload: "metadata",
|
|
595
|
+
playsinline: "",
|
|
596
|
+
muted: muted.value,
|
|
597
|
+
onLoadedmetadata: onMetadata,
|
|
598
|
+
onDurationchange: onDurationChange,
|
|
599
|
+
onSeeked,
|
|
600
|
+
onPlay,
|
|
601
|
+
onPause,
|
|
602
|
+
onError,
|
|
603
|
+
onClick: _cache[0] || (_cache[0] = ($event) => !__props.regionSelect && togglePlay())
|
|
604
|
+
}, null, 40, _hoisted_2),
|
|
605
|
+
createElementVNode("video", {
|
|
606
|
+
ref_key: "samplerEl",
|
|
607
|
+
ref: samplerEl,
|
|
608
|
+
class: "pointer-events-none absolute size-px opacity-0",
|
|
609
|
+
src: __props.src,
|
|
610
|
+
preload: "metadata",
|
|
611
|
+
muted: "",
|
|
612
|
+
playsinline: "",
|
|
613
|
+
"aria-hidden": "true",
|
|
614
|
+
tabindex: "-1"
|
|
615
|
+
}, null, 8, _hoisted_3),
|
|
616
|
+
__props.regionSelect && ready.value ? (openBlock(), createElementBlock("div", {
|
|
617
|
+
key: 0,
|
|
618
|
+
class: "absolute cursor-crosshair touch-none",
|
|
619
|
+
style: normalizeStyle({ left: `${picture.value.x}px`, top: `${picture.value.y}px`, width: `${picture.value.width}px`, height: `${picture.value.height}px` }),
|
|
620
|
+
"data-lp-region-layer": "",
|
|
621
|
+
onPointerdown: _cache[2] || (_cache[2] = ($event) => onRegionDown("draw", $event))
|
|
622
|
+
}, [
|
|
623
|
+
shownRegion.value ? (openBlock(), createElementBlock("div", {
|
|
624
|
+
key: 0,
|
|
625
|
+
class: "absolute cursor-move rounded-inner border-2 border-dashed border-white bg-brand/25 shadow-[0_0_0_9999px_rgb(0_0_0/0.35)] outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
626
|
+
style: normalizeStyle({ left: `${shownRegion.value.x * 100}%`, top: `${shownRegion.value.y * 100}%`, width: `${shownRegion.value.w * 100}%`, height: `${shownRegion.value.h * 100}%` }),
|
|
627
|
+
tabindex: "0",
|
|
628
|
+
role: "group",
|
|
629
|
+
"aria-label": unref(text).region,
|
|
630
|
+
"data-lp-region": "",
|
|
631
|
+
onPointerdown: _cache[1] || (_cache[1] = ($event) => onRegionDown("move", $event)),
|
|
632
|
+
onKeydown: onRegionKey
|
|
633
|
+
}, [
|
|
634
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(["nw", "ne", "sw", "se"], (corner) => {
|
|
635
|
+
return createElementVNode("span", {
|
|
636
|
+
key: corner,
|
|
637
|
+
class: normalizeClass(["absolute grid size-6 place-items-center pointer-coarse:size-11", [
|
|
638
|
+
corner[0] === "n" ? "top-0 -translate-y-1/2" : "bottom-0 translate-y-1/2",
|
|
639
|
+
corner[1] === "w" ? "left-0 -translate-x-1/2" : "right-0 translate-x-1/2",
|
|
640
|
+
corner === "nw" || corner === "se" ? "cursor-nwse-resize" : "cursor-nesw-resize"
|
|
641
|
+
]]),
|
|
642
|
+
"data-lp-corner": corner,
|
|
643
|
+
onPointerdown: ($event) => onRegionDown(corner, $event)
|
|
644
|
+
}, [..._cache[8] || (_cache[8] = [
|
|
645
|
+
createElementVNode("span", { class: "size-3 rounded-pill border-2 border-white bg-brand shadow" }, null, -1)
|
|
646
|
+
])], 42, _hoisted_5);
|
|
647
|
+
}), 64))
|
|
648
|
+
], 44, _hoisted_4)) : createCommentVNode("", true)
|
|
649
|
+
], 36)) : createCommentVNode("", true),
|
|
650
|
+
failure.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
651
|
+
createVNode(_sfc_main$1, {
|
|
652
|
+
name: "lucide:video-off",
|
|
653
|
+
size: 32
|
|
654
|
+
}),
|
|
655
|
+
createElementVNode("p", null, toDisplayString(failure.value === "unsupported" ? unref(text).unsupported : unref(text).failed), 1)
|
|
656
|
+
])) : createCommentVNode("", true)
|
|
657
|
+
], 512),
|
|
658
|
+
createElementVNode("div", _hoisted_7, [
|
|
659
|
+
createVNode(_sfc_main$2, {
|
|
660
|
+
size: "sm",
|
|
661
|
+
variant: "ghost",
|
|
662
|
+
square: "",
|
|
663
|
+
disabled: off.value,
|
|
664
|
+
"aria-label": playing.value ? unref(text).pause : unref(text).play,
|
|
665
|
+
title: playing.value ? unref(text).pause : unref(text).play,
|
|
666
|
+
onClick: togglePlay
|
|
667
|
+
}, {
|
|
668
|
+
default: withCtx(() => [
|
|
669
|
+
createVNode(_sfc_main$1, {
|
|
670
|
+
name: playing.value ? "lucide:pause" : "lucide:play",
|
|
671
|
+
size: 16
|
|
672
|
+
}, null, 8, ["name"])
|
|
673
|
+
]),
|
|
674
|
+
_: 1
|
|
675
|
+
}, 8, ["disabled", "aria-label", "title"]),
|
|
676
|
+
createVNode(_sfc_main$2, {
|
|
677
|
+
size: "sm",
|
|
678
|
+
variant: "ghost",
|
|
679
|
+
square: "",
|
|
680
|
+
disabled: off.value,
|
|
681
|
+
"aria-label": unref(text).stepBack,
|
|
682
|
+
title: unref(text).stepBack,
|
|
683
|
+
onClick: _cache[3] || (_cache[3] = ($event) => step(-frameStep.value))
|
|
684
|
+
}, {
|
|
685
|
+
default: withCtx(() => [
|
|
686
|
+
createVNode(_sfc_main$1, {
|
|
687
|
+
name: "lucide:step-back",
|
|
688
|
+
size: 16
|
|
689
|
+
})
|
|
690
|
+
]),
|
|
691
|
+
_: 1
|
|
692
|
+
}, 8, ["disabled", "aria-label", "title"]),
|
|
693
|
+
createVNode(_sfc_main$2, {
|
|
694
|
+
size: "sm",
|
|
695
|
+
variant: "ghost",
|
|
696
|
+
square: "",
|
|
697
|
+
disabled: off.value,
|
|
698
|
+
"aria-label": unref(text).stepForward,
|
|
699
|
+
title: unref(text).stepForward,
|
|
700
|
+
onClick: _cache[4] || (_cache[4] = ($event) => step(frameStep.value))
|
|
701
|
+
}, {
|
|
702
|
+
default: withCtx(() => [
|
|
703
|
+
createVNode(_sfc_main$1, {
|
|
704
|
+
name: "lucide:step-forward",
|
|
705
|
+
size: 16
|
|
706
|
+
})
|
|
707
|
+
]),
|
|
708
|
+
_: 1
|
|
709
|
+
}, 8, ["disabled", "aria-label", "title"]),
|
|
710
|
+
createElementVNode("span", _hoisted_8, [
|
|
711
|
+
createElementVNode("span", _hoisted_9, toDisplayString(unref(formatClipTime)(time.value, true)), 1),
|
|
712
|
+
createTextVNode(" / " + toDisplayString(unref(formatClipTime)(duration.value, true)), 1)
|
|
713
|
+
]),
|
|
714
|
+
createVNode(_sfc_main$2, {
|
|
715
|
+
size: "sm",
|
|
716
|
+
variant: "ghost",
|
|
717
|
+
square: "",
|
|
718
|
+
disabled: !ready.value,
|
|
719
|
+
"aria-label": muted.value ? unref(text).unmute : unref(text).mute,
|
|
720
|
+
title: muted.value ? unref(text).unmute : unref(text).mute,
|
|
721
|
+
"aria-pressed": muted.value,
|
|
722
|
+
onClick: toggleMute
|
|
723
|
+
}, {
|
|
724
|
+
default: withCtx(() => [
|
|
725
|
+
createVNode(_sfc_main$1, {
|
|
726
|
+
name: muted.value ? "lucide:volume-x" : "lucide:volume-2",
|
|
727
|
+
size: 16
|
|
728
|
+
}, null, 8, ["name"])
|
|
729
|
+
]),
|
|
730
|
+
_: 1
|
|
731
|
+
}, 8, ["disabled", "aria-label", "title", "aria-pressed"]),
|
|
732
|
+
_cache[9] || (_cache[9] = createElementVNode("span", { class: "flex-1" }, null, -1)),
|
|
733
|
+
createVNode(_sfc_main$2, {
|
|
734
|
+
size: "sm",
|
|
735
|
+
variant: "ghost",
|
|
736
|
+
square: "",
|
|
737
|
+
disabled: off.value || !zoomed.value,
|
|
738
|
+
"aria-label": unref(text).zoomOut,
|
|
739
|
+
title: unref(text).zoomOut,
|
|
740
|
+
onClick: _cache[5] || (_cache[5] = ($event) => zoomBy(0.5))
|
|
741
|
+
}, {
|
|
742
|
+
default: withCtx(() => [
|
|
743
|
+
createVNode(_sfc_main$1, {
|
|
744
|
+
name: "lucide:zoom-out",
|
|
745
|
+
size: 16
|
|
746
|
+
})
|
|
747
|
+
]),
|
|
748
|
+
_: 1
|
|
749
|
+
}, 8, ["disabled", "aria-label", "title"]),
|
|
750
|
+
createVNode(_sfc_main$2, {
|
|
751
|
+
size: "sm",
|
|
752
|
+
variant: "ghost",
|
|
753
|
+
square: "",
|
|
754
|
+
disabled: off.value || !canZoomIn.value,
|
|
755
|
+
"aria-label": unref(text).zoomIn,
|
|
756
|
+
title: unref(text).zoomIn,
|
|
757
|
+
onClick: _cache[6] || (_cache[6] = ($event) => zoomBy(2))
|
|
758
|
+
}, {
|
|
759
|
+
default: withCtx(() => [
|
|
760
|
+
createVNode(_sfc_main$1, {
|
|
761
|
+
name: "lucide:zoom-in",
|
|
762
|
+
size: 16
|
|
763
|
+
})
|
|
764
|
+
]),
|
|
765
|
+
_: 1
|
|
766
|
+
}, 8, ["disabled", "aria-label", "title"]),
|
|
767
|
+
createVNode(_sfc_main$2, {
|
|
768
|
+
size: "sm",
|
|
769
|
+
variant: "ghost",
|
|
770
|
+
square: "",
|
|
771
|
+
disabled: off.value || !zoomed.value,
|
|
772
|
+
"aria-label": unref(text).zoomFit,
|
|
773
|
+
title: unref(text).zoomFit,
|
|
774
|
+
onClick: fit
|
|
775
|
+
}, {
|
|
776
|
+
default: withCtx(() => [
|
|
777
|
+
createVNode(_sfc_main$1, {
|
|
778
|
+
name: "lucide:maximize-2",
|
|
779
|
+
size: 16
|
|
780
|
+
})
|
|
781
|
+
]),
|
|
782
|
+
_: 1
|
|
783
|
+
}, 8, ["disabled", "aria-label", "title"])
|
|
784
|
+
]),
|
|
785
|
+
createElementVNode("div", {
|
|
786
|
+
class: "relative",
|
|
787
|
+
onWheel
|
|
788
|
+
}, [
|
|
789
|
+
createElementVNode("div", _hoisted_10, [
|
|
790
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(marks.value, (m) => {
|
|
791
|
+
return openBlock(), createElementBlock("span", {
|
|
792
|
+
key: m,
|
|
793
|
+
class: normalizeClass(["absolute top-0 whitespace-nowrap", xOf(m) < 16 ? "" : xOf(m) > trackWidth.value - 16 ? "-translate-x-full" : "-translate-x-1/2"]),
|
|
794
|
+
style: normalizeStyle({ left: pct(m) })
|
|
795
|
+
}, toDisplayString(unref(formatClipTime)(m, markDigits.value)), 7);
|
|
796
|
+
}), 128))
|
|
797
|
+
]),
|
|
798
|
+
createElementVNode("div", {
|
|
799
|
+
ref_key: "trackEl",
|
|
800
|
+
ref: trackEl,
|
|
801
|
+
class: normalizeClass(["relative h-14 touch-none rounded-control bg-surface-soft", off.value ? "opacity-60" : "cursor-text"]),
|
|
802
|
+
"aria-label": unref(text).timeline,
|
|
803
|
+
role: "group",
|
|
804
|
+
onPointerdown: onTrackDown,
|
|
805
|
+
onPointermove: onTrackMove,
|
|
806
|
+
onPointerup: onTrackUp,
|
|
807
|
+
onPointercancel: onTrackUp
|
|
808
|
+
}, [
|
|
809
|
+
createElementVNode("div", _hoisted_12, [
|
|
810
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(stills.value, (s) => {
|
|
811
|
+
return openBlock(), createElementBlock("div", {
|
|
812
|
+
key: s.key,
|
|
813
|
+
ref_for: true,
|
|
814
|
+
ref: (el) => mountFrame(s.key, el),
|
|
815
|
+
class: normalizeClass(["lp-trim-still absolute inset-y-0 overflow-hidden border-r border-black/20 [&>canvas]:size-full [&>canvas]:object-cover", { "lp-trim-still-in": !unref(reduced) }]),
|
|
816
|
+
style: normalizeStyle({ left: s.left, width: s.width }),
|
|
817
|
+
"data-lp-still": frames.value.has(s.key) ? "ready" : "pending"
|
|
818
|
+
}, null, 14, _hoisted_13);
|
|
819
|
+
}), 128)),
|
|
820
|
+
createElementVNode("div", {
|
|
821
|
+
class: "absolute inset-y-0 left-0 bg-black/55",
|
|
822
|
+
style: normalizeStyle({ width: `${Math.max(0, xOf(local.value[0]))}px` })
|
|
823
|
+
}, null, 4),
|
|
824
|
+
createElementVNode("div", {
|
|
825
|
+
class: "absolute inset-y-0 right-0 bg-black/55",
|
|
826
|
+
style: normalizeStyle({ left: `${Math.min(trackWidth.value, Math.max(0, xOf(local.value[1])))}px` })
|
|
827
|
+
}, null, 4)
|
|
828
|
+
]),
|
|
829
|
+
ready.value ? (openBlock(), createElementBlock("div", {
|
|
830
|
+
key: 0,
|
|
831
|
+
class: "pointer-events-none absolute inset-y-0 border-y-2 border-brand",
|
|
832
|
+
style: normalizeStyle({ left: pct(local.value[0]), width: `${clipLength.value / span.value * 100}%` }),
|
|
833
|
+
"data-lp-range": ""
|
|
834
|
+
}, null, 4)) : createCommentVNode("", true),
|
|
835
|
+
(openBlock(), createElementBlock(Fragment, null, renderList([0, 1], (end) => {
|
|
836
|
+
return withDirectives(createElementVNode("div", {
|
|
837
|
+
key: end,
|
|
838
|
+
class: normalizeClass(["group/handle absolute inset-y-0 z-10 flex w-6 touch-none items-stretch outline-none pointer-coarse:w-11", [end === 0 ? "justify-start" : "-translate-x-full justify-end", off.value ? "" : "cursor-ew-resize"]]),
|
|
839
|
+
style: normalizeStyle({ left: pct(local.value[end]) }),
|
|
840
|
+
role: "slider",
|
|
841
|
+
tabindex: off.value ? -1 : 0,
|
|
842
|
+
"aria-label": end === 0 ? unref(text).start : unref(text).end,
|
|
843
|
+
"aria-valuemin": 0,
|
|
844
|
+
"aria-valuemax": Math.round(duration.value * 1e3) / 1e3,
|
|
845
|
+
"aria-valuenow": local.value[end],
|
|
846
|
+
"aria-valuetext": handleText(local.value[end]),
|
|
847
|
+
"aria-disabled": off.value || void 0,
|
|
848
|
+
"data-lp-handle": end,
|
|
849
|
+
onPointerdown: ($event) => onHandleDown(end, $event)
|
|
850
|
+
}, [
|
|
851
|
+
createElementVNode("span", {
|
|
852
|
+
class: normalizeClass(["flex w-3 items-center justify-center bg-brand transition-[width] duration-(--duration-fast) group-focus-visible/handle:ring-2 group-focus-visible/handle:ring-ring motion-reduce:transition-none", end === 0 ? "rounded-l-control" : "rounded-r-control"])
|
|
853
|
+
}, [..._cache[10] || (_cache[10] = [
|
|
854
|
+
createElementVNode("span", { class: "h-5 w-0.5 rounded-pill bg-white/85" }, null, -1)
|
|
855
|
+
])], 2)
|
|
856
|
+
], 46, _hoisted_14), [
|
|
857
|
+
[vShow, ready.value]
|
|
858
|
+
]);
|
|
859
|
+
}), 64)),
|
|
860
|
+
withDirectives(createElementVNode("div", {
|
|
861
|
+
class: "absolute -top-4 bottom-0 z-20 w-0 outline-none",
|
|
862
|
+
style: normalizeStyle({ left: pct(time.value) }),
|
|
863
|
+
role: "slider",
|
|
864
|
+
tabindex: off.value ? -1 : 0,
|
|
865
|
+
"aria-label": unref(text).position,
|
|
866
|
+
"aria-valuemin": 0,
|
|
867
|
+
"aria-valuemax": Math.round(duration.value * 1e3) / 1e3,
|
|
868
|
+
"aria-valuenow": Math.round(time.value * 1e3) / 1e3,
|
|
869
|
+
"aria-valuetext": handleText(time.value),
|
|
870
|
+
"data-lp-playhead": ""
|
|
871
|
+
}, [..._cache[11] || (_cache[11] = [
|
|
872
|
+
createElementVNode("span", { class: "pointer-events-none absolute inset-y-0 -left-px w-0.5 bg-white shadow-[0_0_0_1px_rgb(0_0_0/0.45)]" }, null, -1),
|
|
873
|
+
createElementVNode("span", { class: "pointer-events-none absolute -top-0.5 -left-1.5 size-3 rounded-pill border-2 border-white bg-ink shadow [[data-lp-playhead]:focus-visible_&]:ring-2 [[data-lp-playhead]:focus-visible_&]:ring-ring" }, null, -1)
|
|
874
|
+
])], 12, _hoisted_15), [
|
|
875
|
+
[vShow, ready.value && time.value >= view.value.start && time.value <= view.value.end]
|
|
876
|
+
])
|
|
877
|
+
], 42, _hoisted_11),
|
|
878
|
+
zoomed.value ? (openBlock(), createElementBlock("div", {
|
|
879
|
+
key: 0,
|
|
880
|
+
class: "relative mt-1.5 h-2 cursor-pointer touch-none rounded-pill bg-surface-soft",
|
|
881
|
+
"aria-label": unref(text).overview,
|
|
882
|
+
role: "presentation",
|
|
883
|
+
"data-lp-overview": "",
|
|
884
|
+
onPointerdown: onOverviewDown
|
|
885
|
+
}, [
|
|
886
|
+
createElementVNode("span", {
|
|
887
|
+
class: "absolute inset-y-0 rounded-pill bg-brand/45",
|
|
888
|
+
style: normalizeStyle({ left: `${local.value[0] / duration.value * 100}%`, width: `${clipLength.value / duration.value * 100}%` })
|
|
889
|
+
}, null, 4),
|
|
890
|
+
createElementVNode("span", {
|
|
891
|
+
class: "absolute -inset-y-0.5 rounded-pill border-2 border-ink/70",
|
|
892
|
+
style: normalizeStyle({ left: `${view.value.start / duration.value * 100}%`, width: `${span.value / duration.value * 100}%` })
|
|
893
|
+
}, null, 4)
|
|
894
|
+
], 40, _hoisted_16)) : createCommentVNode("", true)
|
|
895
|
+
], 32),
|
|
896
|
+
createElementVNode("div", _hoisted_17, [
|
|
897
|
+
(openBlock(), createElementBlock(Fragment, null, renderList([0, 1], (end) => {
|
|
898
|
+
return createElementVNode("label", {
|
|
899
|
+
key: end,
|
|
900
|
+
class: "flex flex-col gap-1"
|
|
901
|
+
}, [
|
|
902
|
+
createElementVNode("span", _hoisted_18, toDisplayString(end === 0 ? unref(text).start : unref(text).end), 1),
|
|
903
|
+
createVNode(_sfc_main$3, {
|
|
904
|
+
size: "sm",
|
|
905
|
+
class: "w-28 font-mono tabular-nums",
|
|
906
|
+
"model-value": fieldText(end),
|
|
907
|
+
disabled: off.value,
|
|
908
|
+
invalid: invalid.value[end],
|
|
909
|
+
title: invalid.value[end] ? unref(text).invalidTime : void 0,
|
|
910
|
+
inputmode: "decimal",
|
|
911
|
+
spellcheck: "false",
|
|
912
|
+
autocomplete: "off",
|
|
913
|
+
"data-lp-time": end,
|
|
914
|
+
"onUpdate:modelValue": ($event) => onFieldInput(end, $event),
|
|
915
|
+
onBlur: ($event) => commitField(end),
|
|
916
|
+
onKeydown: [
|
|
917
|
+
withKeys(withModifiers(($event) => commitField(end), ["prevent"]), ["enter"]),
|
|
918
|
+
withKeys(($event) => revertField(end), ["esc"])
|
|
919
|
+
]
|
|
920
|
+
}, null, 8, ["model-value", "disabled", "invalid", "title", "data-lp-time", "onUpdate:modelValue", "onBlur", "onKeydown"])
|
|
921
|
+
]);
|
|
922
|
+
}), 64)),
|
|
923
|
+
createElementVNode("div", _hoisted_19, [
|
|
924
|
+
createElementVNode("span", _hoisted_20, toDisplayString(unref(text).length), 1),
|
|
925
|
+
createElementVNode("span", _hoisted_21, toDisplayString(unref(formatClipTime)(clipLength.value, true)), 1)
|
|
926
|
+
]),
|
|
927
|
+
leftText.value ? (openBlock(), createElementBlock("span", _hoisted_22, toDisplayString(leftText.value), 1)) : createCommentVNode("", true),
|
|
928
|
+
_cache[12] || (_cache[12] = createElementVNode("span", { class: "flex-1" }, null, -1)),
|
|
929
|
+
__props.regionSelect ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
930
|
+
__props.region ? (openBlock(), createBlock(_sfc_main$2, {
|
|
931
|
+
key: 0,
|
|
932
|
+
size: "sm",
|
|
933
|
+
variant: "outline",
|
|
934
|
+
disabled: __props.disabled,
|
|
935
|
+
onClick: _cache[7] || (_cache[7] = ($event) => emit("update:region", null))
|
|
936
|
+
}, {
|
|
937
|
+
default: withCtx(() => [
|
|
938
|
+
createVNode(_sfc_main$1, {
|
|
939
|
+
name: "lucide:x",
|
|
940
|
+
size: 14
|
|
941
|
+
}),
|
|
942
|
+
createTextVNode(toDisplayString(unref(text).regionClear), 1)
|
|
943
|
+
]),
|
|
944
|
+
_: 1
|
|
945
|
+
}, 8, ["disabled"])) : (openBlock(), createElementBlock("span", _hoisted_23, toDisplayString(unref(text).regionHint), 1))
|
|
946
|
+
], 64)) : createCommentVNode("", true)
|
|
947
|
+
])
|
|
948
|
+
], 16, _hoisted_1);
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
const LpVideoTrim = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-04a3a07a"]]);
|
|
953
|
+
export {
|
|
954
|
+
LpVideoTrim as default
|
|
955
|
+
};
|