@leavepulse/ui 0.69.0 → 0.70.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/README.md +37 -0
- package/dist/assets/LoaderMark-DxBV2iDJ.css +43 -0
- package/dist/assets/LpActivityLine-B3EwNQEB.css +33 -0
- package/dist/assets/{LpCommandPalette-DxyjhYn_.css → LpCommandPalette-u-zOxKWa.css} +21 -31
- package/dist/assets/LpDock-Cbh0wQUv.css +17 -0
- package/dist/assets/{LpDropzone-Qb8k7cg4.css → LpDropzone-Bb1vBTeU.css} +12 -17
- package/dist/assets/{LpImageEditor-CElPDzpF.css → LpImageEditor-XM5bAziW.css} +6 -6
- package/dist/assets/LpLogViewer-BDNW6P52.css +38 -0
- package/dist/assets/{LpPalettePreview-CJmAKgYW.css → LpPalettePreview-B9VKDrvA.css} +2 -7
- package/dist/assets/LpShinyText-D69cBYDR.css +61 -0
- package/dist/assets/LpStatus-430OGTZY.css +17 -0
- package/dist/assets/LpStepMark-Drvx33Vg.css +10 -0
- package/dist/assets/{LpTable-BPERfJIk.css → LpTable-DHxEQ_-3.css} +19 -19
- package/dist/assets/LpTabs-BJ-nrJuI.css +18 -0
- package/dist/assets/LpTextReveal-DjI1MsDS.css +35 -0
- package/dist/assets/LpTypewriter-CXAm9Nca.css +27 -0
- package/dist/chunks/AttentionDot-DCBf4aWg.js +25 -0
- package/dist/chunks/{ContextMenuItems-B7XFHksm.js → ContextMenuItems-B5uE8Znw.js} +1 -1
- package/dist/chunks/{DropzoneLinkField-CjkrpDqO.js → DropzoneLinkField-Bw8Flkhk.js} +2 -2
- package/dist/chunks/FieldWrapper-BiennROB.js +43 -0
- package/dist/chunks/{LayoutCanvas-DF9CovaK.js → LayoutCanvas-BsJIzhdd.js} +1 -1
- package/dist/chunks/{LayoutNode-D9bIFzk0.js → LayoutNode-DJVhkSGk.js} +6 -8
- package/dist/chunks/LegendSwatch-BhRjrtzv.js +18 -0
- package/dist/chunks/LoaderMark-C1dubiKn.js +85 -0
- package/dist/chunks/{LpActionBar-MPKMu3pz.js → LpActionBar-CzOFar5t.js} +14 -20
- package/dist/chunks/LpActivityLine-CJvzrNpj.js +95 -0
- package/dist/chunks/{LpAddressInput-DG0BTqdH.js → LpAddressInput-CNnLTDZg.js} +7 -7
- package/dist/chunks/LpAlert-C5igj802.js +119 -0
- package/dist/chunks/{LpAppShell-DPh1756q.js → LpAppShell-CEUAB8kK.js} +15 -16
- package/dist/chunks/{LpAutocomplete-Dgn6hw3p.js → LpAutocomplete-D92niDHE.js} +15 -32
- package/dist/chunks/{LpAvatar-Bs0Fb1lC.js → LpAvatar-CLPl-qOF.js} +18 -6
- package/dist/chunks/LpBadge-HOEPBYmi.js +126 -0
- package/dist/chunks/LpBreadcrumbs-DYoPc3P4.js +144 -0
- package/dist/chunks/{LpButton-DNR-YAq5.js → LpButton-CVxBfGjd.js} +12 -4
- package/dist/chunks/{LpCalendar-BLya39Fh.js → LpCalendar-pVL91-Pl.js} +1 -1
- package/dist/chunks/{LpCard-Bf71NXZq.js → LpCard-CqKLnEhl.js} +18 -8
- package/dist/chunks/{LpCheckbox-Da5oZPHo.js → LpCheckbox-DHc2bHDe.js} +9 -6
- package/dist/chunks/{LpCodeBlock-lLbmslfs.js → LpCodeBlock-BGsQhxw8.js} +24 -32
- package/dist/chunks/LpCodeDisplay-CIKKT2iW.js +189 -0
- package/dist/chunks/LpCollapse-CWS9M_lm.js +115 -0
- package/dist/chunks/{LpColorPicker-DtEfBAcK.js → LpColorPicker-DFugXNUi.js} +10 -5
- package/dist/chunks/{LpConfirmDialog-D7s4jakB.js → LpConfirmDialog-CfGCux8m.js} +3 -3
- package/dist/chunks/{LpConfirmHost-DrYI5y1K.js → LpConfirmHost-exB7JmcO.js} +1 -1
- package/dist/chunks/{LpContextMenu-CRnjoqSt.js → LpContextMenu-COwOwRgI.js} +13 -5
- package/dist/chunks/LpCopyButton-DzHjnFs0.js +133 -0
- package/dist/chunks/LpCountdown-Dtq1ihlJ.js +231 -0
- package/dist/chunks/LpDataList-B-5nHfNw.js +120 -0
- package/dist/chunks/LpDatePicker-BUe1VUC0.js +168 -0
- package/dist/chunks/LpDateRangePicker-C_k65vGR.js +126 -0
- package/dist/chunks/{LpDisclosure-6AplYBub.js → LpDisclosure-DOarzlAG.js} +22 -11
- package/dist/chunks/{LpDrawer-Q4SOxM4s.js → LpDrawer-DGNKRsGq.js} +9 -4
- package/dist/chunks/{LpDropdownMenu-DWTt0ooM.js → LpDropdownMenu-CRgrhdAH.js} +10 -5
- package/dist/chunks/LpEditable-DTqLt2lT.js +236 -0
- package/dist/chunks/{LpEmptyState-om1UnFjV.js → LpEmptyState-KTKipws2.js} +1 -1
- package/dist/chunks/{LpFieldNotice-CHuDeLjc.js → LpFieldNotice-CurbNuXI.js} +1 -1
- package/dist/chunks/{LpFileTree-CW24YsVX.js → LpFileTree-DMISXVHC.js} +5 -3
- package/dist/chunks/{LpFileTreeNode-BXhTHaKW.js → LpFileTreeNode-CPXB_Yy3.js} +42 -55
- package/dist/chunks/{LpFormField-DPb47HEm.js → LpFormField-BWwgm1E4.js} +23 -9
- package/dist/chunks/LpFrame-BVQCQLDI.js +155 -0
- package/dist/chunks/LpGauge-Bk8TwJj0.js +204 -0
- package/dist/chunks/LpGlowBorder-B8V-QzIl.js +40 -0
- package/dist/chunks/{LpHintExample-C1eKYdeL.js → LpHintExample-9Py0wc-L.js} +11 -34
- package/dist/chunks/{LpHintLayer-7UOdWQG3.js → LpHintLayer-p4hqzdyA.js} +27 -14
- package/dist/chunks/{LpHints-BUtBp9-w.js → LpHints-CCrhRfy9.js} +3 -3
- package/dist/chunks/LpHoverCard-spGxyw7T.js +130 -0
- package/dist/chunks/{LpIcon-6tSrZ3Zy.js → LpIcon-HJP5xMz4.js} +1 -1
- package/dist/chunks/LpIdenticon-BzdC_qz9.js +63 -0
- package/dist/chunks/{LpInfraNode-Ds_8SZgN.js → LpInfraNode-CUC3t4na.js} +39 -25
- package/dist/chunks/{LpInput-CUyr6PIE.js → LpInput-CDuwODJG.js} +44 -18
- package/dist/chunks/{LpLightbox-B9J8rzsj.js → LpLightbox-XJ0LpTcZ.js} +69 -69
- package/dist/chunks/LpLoader-DjJEX8hL.js +92 -0
- package/dist/chunks/{LpLogViewer-4QFc-sVN.js → LpLogViewer-elZHbj85.js} +225 -129
- package/dist/chunks/LpMagnetic-CtXKLa2Y.js +62 -0
- package/dist/chunks/{LpMapPicker-BTbkFeSG.js → LpMapPicker-BtIl7NOM.js} +34 -31
- package/dist/chunks/LpMasonry--k0571qG.js +185 -0
- package/dist/chunks/{LpMediaGallery-CuPcscx3.js → LpMediaGallery-D5swlmZ_.js} +3 -3
- package/dist/chunks/{LpModal-hk1noDcr.js → LpModal-eBMt2Fqn.js} +8 -3
- package/dist/chunks/{LpModalNav-DQd2keZm.js → LpModalNav-D4Z0wVHR.js} +4 -4
- package/dist/chunks/{LpNotificationBell-X84PJIxD.js → LpNotificationBell-DPZmP5dM.js} +32 -48
- package/dist/chunks/LpNumberField-B9k-h2HE.js +140 -0
- package/dist/chunks/{LpNumberFlow-z4WPZcZu.js → LpNumberFlow-Cfyh033Q.js} +8 -28
- package/dist/chunks/{LpOtpInput-PbeNJ5In.js → LpOtpInput-CeBPsM7D.js} +2 -1
- package/dist/chunks/{LpPagination-Bx-VG4Ag.js → LpPagination-VNCX6pFC.js} +37 -6
- package/dist/chunks/{LpPalettePreview-CFav_7co.js → LpPalettePreview-BNB8T_MY.js} +1 -1
- package/dist/chunks/{LpPasswordInput-CbnXitAS.js → LpPasswordInput-DTV18FIh.js} +20 -20
- package/dist/chunks/{LpPhoneInput-DP69HONS.js → LpPhoneInput-C60tx1tC.js} +12 -7
- package/dist/chunks/{LpPie-yLF9-aDR.js → LpPie-CFuV7pZv.js} +158 -47
- package/dist/chunks/LpPipeline-D81yh_NX.js +329 -0
- package/dist/chunks/{LpPopover-DVnkHaOu.js → LpPopover-BEIcqb9p.js} +8 -3
- package/dist/chunks/{LpProgress-CA86wxXu.js → LpProgress-CE-m5OpD.js} +23 -63
- package/dist/chunks/LpQuota-2Sw_gqcJ.js +162 -0
- package/dist/chunks/{LpRadioGroup-8S5hf8lE.js → LpRadioGroup-CGBr5nIp.js} +1 -1
- package/dist/chunks/{LpRangeCalendar-ByQi-WUz.js → LpRangeCalendar-c5qj7YcC.js} +1 -1
- package/dist/chunks/{LpRangeSlider-C1yF9-nP.js → LpRangeSlider-Dv6lNvHY.js} +6 -2
- package/dist/chunks/LpRelativeTime-CKzVqAo9.js +73 -0
- package/dist/chunks/LpRepeater-D0VjmD6y.js +140 -0
- package/dist/chunks/LpRevealOnScroll-DcQjexLy.js +76 -0
- package/dist/chunks/LpScramble-TDO5Kdou.js +85 -0
- package/dist/chunks/LpSecretField-DMfdJ1cQ.js +307 -0
- package/dist/chunks/{LpSection-BmRXe6ZP.js → LpSection-BW4xJ-Li.js} +1 -1
- package/dist/chunks/{LpSegmented-CW3bFHM4.js → LpSegmented-BO99Sr4m.js} +11 -14
- package/dist/chunks/{LpSelect-BCyDYoih.js → LpSelect-B4f_yRi5.js} +93 -108
- package/dist/chunks/LpShaderBackdrop-Bote0iuy.js +332 -0
- package/dist/chunks/LpShinyText-DX2ajtWq.js +48 -0
- package/dist/chunks/{LpSidebar-DfIiS-lB.js → LpSidebar-D-M0Y_7U.js} +5 -3
- package/dist/chunks/{LpSidebarNav-C5FDNI0t.js → LpSidebarNav-DF-TYxOV.js} +3 -3
- package/dist/chunks/{LpSlider-Cuzmrd7p.js → LpSlider-DuoRpOrH.js} +6 -2
- package/dist/chunks/{LpSparkline-DXT4KrSi.js → LpSparkline-CExIRDb3.js} +32 -27
- package/dist/chunks/LpSpotlight-4F3NeUMY.js +41 -0
- package/dist/chunks/{LpStat-iBMF5QNk.js → LpStat-B2ix1Q7t.js} +38 -35
- package/dist/chunks/LpStatus-C7kx5PKE.js +86 -0
- package/dist/chunks/LpStepMark-DK-5BKAt.js +101 -0
- package/dist/chunks/LpStepper-DRFfdJaq.js +76 -0
- package/dist/chunks/{LpSwap-D82jiecV.js → LpSwap-DzE6M3Mg.js} +1 -1
- package/dist/chunks/LpSwitch-DrzKrZZV.js +112 -0
- package/dist/chunks/{LpTableFilter-CuIbgdW0.js → LpTableFilter-DyvHGbOk.js} +3 -2
- package/dist/chunks/{LpTableOfContents-C_4VBktT.js → LpTableOfContents-rYvo8z5T.js} +34 -21
- package/dist/chunks/{LpTagsInput-DiXrpYeE.js → LpTagsInput-DgpBFRV2.js} +68 -71
- package/dist/chunks/LpTextReveal-CtAnOUkp.js +140 -0
- package/dist/chunks/{LpTextarea-xoQd5Lnp.js → LpTextarea-DiWjeVoJ.js} +12 -11
- package/dist/chunks/{LpThemeProvider-CQ2jC9TA.js → LpThemeProvider-DcbfOxsU.js} +1 -1
- package/dist/chunks/LpThemeStudio-DguwHdGt.js +416 -0
- package/dist/chunks/LpThemeStudioSection-BwhqYDLf.js +20 -0
- package/dist/chunks/LpThemeSwitcher-D5uz0MhK.js +278 -0
- package/dist/chunks/{LpTimeField-MFgAsNc5.js → LpTimeField-BFQVf_PW.js} +13 -5
- package/dist/chunks/{LpToaster-C4zE9zB7.js → LpToaster-Wv9ksj4q.js} +49 -82
- package/dist/chunks/{LpTooltip-suFCM34F.js → LpTooltip-Cz8SQwRt.js} +8 -3
- package/dist/chunks/{LpTopologyCanvas-6ozNrQKh.js → LpTopologyCanvas-ZhKthfgz.js} +1 -1
- package/dist/chunks/{LpTour-BUp3Jt2e.js → LpTour-NfRJNEIP.js} +24 -18
- package/dist/chunks/LpTruncate-D_5Pfv5B.js +112 -0
- package/dist/chunks/LpTypewriter-BCL_a6wE.js +159 -0
- package/dist/chunks/{LpUptimeBar-B6kHw4Cj.js → LpUptimeBar-DWegV2p6.js} +9 -8
- package/dist/chunks/{LpVideoBackdrop-qWRYBOTQ.js → LpVideoBackdrop-DS1wGv-X.js} +7 -8
- package/dist/chunks/{MenuTitle-obgek0B7.js → MenuTitle-BjQZX8tQ.js} +1 -1
- package/dist/chunks/OptionContent-CmYUUeWj.js +40 -0
- package/dist/chunks/PickerField-CHRS1h7K.js +116 -0
- package/dist/chunks/RevealToggle-C-KzaQGJ.js +65 -0
- package/dist/chunks/StepConnector-37OgEOXA.js +41 -0
- package/dist/chunks/TourCard-BXuVHsfn.js +123 -0
- package/dist/chunks/backdrop-Dkf2vM81.js +59 -0
- package/dist/chunks/{icons-DVhZ_plB.js → icons-4IywzkHk.js} +1 -1
- package/dist/chunks/{useTheme-2qHG8NEU.js → useTheme-BOV_-AiY.js} +9 -65
- package/dist/component-names.d.ts +1 -1
- package/dist/components/AttentionDot.vue.d.ts +9 -0
- package/dist/components/AttentionDot.vue.js +4 -0
- package/dist/components/ContextMenuItems.vue.js +1 -1
- package/dist/components/DropzoneLinkField.vue.js +1 -1
- package/dist/components/FieldWrapper.vue.d.ts +25 -0
- package/dist/components/FieldWrapper.vue.js +4 -0
- package/dist/components/LayoutCanvas.vue.js +1 -1
- package/dist/components/LayoutNode.vue.d.ts +4 -4
- package/dist/components/LayoutNode.vue.js +1 -1
- package/dist/components/LegendSwatch.vue.d.ts +6 -0
- package/dist/components/LegendSwatch.vue.js +4 -0
- package/dist/components/LoaderMark.vue.d.ts +12 -0
- package/dist/components/LoaderMark.vue.js +4 -0
- package/dist/components/LpActionBar.vue.js +1 -1
- package/dist/components/LpActivityLine.vue.d.ts +58 -0
- package/dist/components/LpActivityLine.vue.js +4 -0
- package/dist/components/LpAddressInput.vue.js +1 -1
- package/dist/components/LpAlert.vue.d.ts +2 -2
- package/dist/components/LpAlert.vue.js +1 -1
- package/dist/components/LpAppShell.vue.d.ts +8 -7
- package/dist/components/LpAppShell.vue.js +1 -1
- package/dist/components/LpAutocomplete.vue.js +1 -1
- package/dist/components/LpAvatar.vue.d.ts +16 -0
- package/dist/components/LpAvatar.vue.js +1 -1
- package/dist/components/LpBadge.vue.d.ts +19 -5
- package/dist/components/LpBadge.vue.js +1 -1
- package/dist/components/LpBreadcrumbs.vue.js +1 -1
- package/dist/components/LpButton.vue.d.ts +2 -2
- package/dist/components/LpButton.vue.js +1 -1
- package/dist/components/LpCalendar.vue.js +1 -1
- package/dist/components/LpCard.vue.d.ts +24 -0
- package/dist/components/LpCard.vue.js +1 -1
- package/dist/components/LpChart.vue.js +107 -138
- package/dist/components/LpCheckbox.vue.d.ts +2 -2
- package/dist/components/LpCheckbox.vue.js +1 -1
- package/dist/components/LpCodeBlock.vue.js +1 -1
- package/dist/components/LpCodeDisplay.vue.d.ts +89 -0
- package/dist/components/LpCodeDisplay.vue.js +4 -0
- package/dist/components/LpCollapse.vue.d.ts +58 -0
- package/dist/components/LpCollapse.vue.js +4 -0
- package/dist/components/LpColorPicker.vue.d.ts +2 -2
- package/dist/components/LpColorPicker.vue.js +1 -1
- package/dist/components/LpCommandPalette.vue.js +34 -23
- 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/LpCopyButton.vue.d.ts +82 -0
- package/dist/components/LpCopyButton.vue.js +4 -0
- package/dist/components/LpCountdown.vue.d.ts +100 -0
- package/dist/components/LpCountdown.vue.js +4 -0
- package/dist/components/LpDataList.vue.d.ts +66 -0
- package/dist/components/LpDataList.vue.js +4 -0
- package/dist/components/LpDatePicker.vue.d.ts +1 -1
- package/dist/components/LpDatePicker.vue.js +1 -1
- package/dist/components/LpDateRangePicker.vue.d.ts +1 -1
- package/dist/components/LpDateRangePicker.vue.js +1 -1
- package/dist/components/LpDisclosure.vue.js +1 -1
- package/dist/components/LpDock.vue.d.ts +74 -0
- package/dist/components/LpDock.vue.js +204 -0
- package/dist/components/LpDrawer.vue.js +1 -1
- package/dist/components/LpDropdownMenu.vue.js +1 -1
- package/dist/components/LpDropzone.vue.d.ts +8 -1
- package/dist/components/LpDropzone.vue.js +36 -15
- package/dist/components/LpEditable.vue.d.ts +85 -0
- package/dist/components/LpEditable.vue.js +4 -0
- 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/LpFrame.vue.d.ts +22 -0
- package/dist/components/LpFrame.vue.js +4 -0
- package/dist/components/LpGauge.vue.d.ts +116 -0
- package/dist/components/LpGauge.vue.js +4 -0
- package/dist/components/LpGlowBorder.vue.d.ts +47 -0
- package/dist/components/LpGlowBorder.vue.js +4 -0
- package/dist/components/LpHintExample.vue.d.ts +2 -2
- package/dist/components/LpHintExample.vue.js +1 -1
- package/dist/components/LpHintLayer.vue.js +1 -1
- package/dist/components/LpHints.vue.js +1 -1
- package/dist/components/LpHoverCard.vue.d.ts +60 -0
- package/dist/components/LpHoverCard.vue.js +4 -0
- package/dist/components/LpIcon.vue.js +1 -1
- package/dist/components/LpIdenticon.vue.d.ts +37 -0
- package/dist/components/LpIdenticon.vue.js +4 -0
- package/dist/components/LpImageEditor.vue.js +13 -19
- package/dist/components/LpInfraNode.vue.js +1 -1
- package/dist/components/LpInput.vue.d.ts +10 -0
- package/dist/components/LpInput.vue.js +1 -1
- package/dist/components/LpLightbox.vue.js +1 -1
- package/dist/components/LpLoader.vue.d.ts +106 -0
- package/dist/components/LpLoader.vue.js +4 -0
- package/dist/components/LpLogViewer.vue.js +1 -1
- package/dist/components/LpMagnetic.vue.d.ts +28 -0
- package/dist/components/LpMagnetic.vue.js +4 -0
- package/dist/components/LpMapPicker.vue.js +1 -1
- package/dist/components/LpMasonry.vue.d.ts +42 -0
- package/dist/components/LpMasonry.vue.js +4 -0
- 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.d.ts +15 -6
- package/dist/components/LpNotificationBell.vue.js +1 -1
- package/dist/components/LpNumberField.vue.d.ts +57 -0
- package/dist/components/LpNumberField.vue.js +1 -1
- package/dist/components/LpNumberFlow.vue.js +1 -1
- package/dist/components/LpOtpInput.vue.d.ts +12 -4
- 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/LpPalettePreview.vue.js +1 -1
- package/dist/components/LpPaletteStats.vue.js +1 -1
- package/dist/components/LpPasswordInput.vue.d.ts +12 -1
- package/dist/components/LpPasswordInput.vue.js +1 -1
- package/dist/components/LpPhoneInput.vue.js +1 -1
- package/dist/components/LpPie.vue.d.ts +3 -1
- package/dist/components/LpPie.vue.js +1 -1
- package/dist/components/LpPipeline.vue.d.ts +91 -0
- package/dist/components/LpPipeline.vue.js +4 -0
- package/dist/components/LpPopover.vue.d.ts +2 -2
- package/dist/components/LpPopover.vue.js +1 -1
- package/dist/components/LpProgress.vue.d.ts +11 -4
- package/dist/components/LpProgress.vue.js +1 -1
- package/dist/components/LpQuota.vue.d.ts +68 -0
- package/dist/components/LpQuota.vue.js +4 -0
- 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/LpRelativeTime.vue.d.ts +41 -0
- package/dist/components/LpRelativeTime.vue.js +4 -0
- package/dist/components/LpRepeater.vue.d.ts +48 -0
- package/dist/components/LpRepeater.vue.js +4 -0
- package/dist/components/LpRevealOnScroll.vue.d.ts +67 -0
- package/dist/components/LpRevealOnScroll.vue.js +4 -0
- package/dist/components/LpRollingText.vue.d.ts +1 -1
- package/dist/components/LpScramble.vue.d.ts +55 -0
- package/dist/components/LpScramble.vue.js +4 -0
- package/dist/components/LpScrollArea.vue.d.ts +1 -1
- package/dist/components/LpSecretField.vue.d.ts +108 -0
- package/dist/components/LpSecretField.vue.js +4 -0
- package/dist/components/LpSection.vue.js +1 -1
- package/dist/components/LpSegmented.vue.js +1 -1
- package/dist/components/LpSelect.vue.d.ts +2 -0
- package/dist/components/LpSelect.vue.js +1 -1
- package/dist/components/LpShaderBackdrop.vue.d.ts +39 -0
- package/dist/components/LpShaderBackdrop.vue.js +4 -0
- package/dist/components/LpShinyText.vue.d.ts +39 -0
- package/dist/components/LpShinyText.vue.js +4 -0
- 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/LpSlider.vue.js +1 -1
- package/dist/components/LpSparkline.vue.d.ts +4 -3
- package/dist/components/LpSparkline.vue.js +1 -1
- package/dist/components/LpSpotlight.vue.d.ts +37 -0
- package/dist/components/LpSpotlight.vue.js +4 -0
- package/dist/components/LpStat.vue.js +1 -1
- package/dist/components/LpStatus.vue.d.ts +65 -0
- package/dist/components/LpStatus.vue.js +4 -0
- package/dist/components/LpStepMark.vue.d.ts +31 -0
- package/dist/components/LpStepMark.vue.js +4 -0
- package/dist/components/LpStepper.vue.js +1 -1
- package/dist/components/LpSwap.vue.js +1 -1
- package/dist/components/LpSwitch.vue.d.ts +2 -2
- package/dist/components/LpSwitch.vue.js +1 -1
- package/dist/components/LpTable.vue.js +104 -120
- package/dist/components/LpTableFilter.vue.js +1 -1
- package/dist/components/LpTableOfContents.vue.d.ts +6 -1
- package/dist/components/LpTableOfContents.vue.js +1 -1
- package/dist/components/LpTabs.vue.d.ts +5 -5
- package/dist/components/LpTabs.vue.js +25 -33
- package/dist/components/LpTagsInput.vue.js +1 -1
- package/dist/components/LpTextReveal.vue.d.ts +58 -0
- package/dist/components/LpTextReveal.vue.js +4 -0
- package/dist/components/LpTextarea.vue.js +1 -1
- package/dist/components/LpThemeProvider.vue.js +1 -1
- package/dist/components/LpThemeStudio.vue.d.ts +54 -0
- package/dist/components/LpThemeStudio.vue.js +4 -0
- package/dist/components/LpThemeStudioSection.vue.d.ts +16 -0
- package/dist/components/LpThemeStudioSection.vue.js +4 -0
- package/dist/components/LpThemeSwitcher.vue.d.ts +32 -1
- package/dist/components/LpThemeSwitcher.vue.js +1 -1
- package/dist/components/LpTimeField.vue.d.ts +2 -0
- package/dist/components/LpTimeField.vue.js +1 -1
- package/dist/components/LpToaster.vue.js +1 -1
- package/dist/components/LpTooltip.vue.d.ts +2 -2
- package/dist/components/LpTooltip.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.d.ts +34 -0
- package/dist/components/LpTruncate.vue.js +4 -0
- package/dist/components/LpTypewriter.vue.d.ts +61 -0
- package/dist/components/LpTypewriter.vue.js +4 -0
- package/dist/components/LpUptimeBar.vue.js +1 -1
- package/dist/components/LpVideoBackdrop.vue.js +1 -1
- package/dist/components/MenuTitle.vue.js +1 -1
- package/dist/components/OptionContent.vue.d.ts +7 -0
- package/dist/components/OptionContent.vue.js +4 -0
- package/dist/components/PickerField.vue.d.ts +43 -0
- package/dist/components/PickerField.vue.js +4 -0
- package/dist/components/RevealToggle.vue.d.ts +21 -0
- package/dist/components/RevealToggle.vue.js +4 -0
- package/dist/components/StepConnector.vue.d.ts +19 -0
- package/dist/components/StepConnector.vue.js +4 -0
- package/dist/components/TourCard.vue.js +1 -1
- package/dist/components/badge.d.ts +1 -0
- package/dist/components/badge.js +4 -0
- package/dist/components/chart.d.ts +5 -1
- package/dist/components/chart.js +2 -21
- package/dist/components/dateRange.d.ts +11 -0
- package/dist/components/dateRange.js +12 -0
- package/dist/components/dock.d.ts +19 -0
- package/dist/components/dock.js +16 -0
- package/dist/components/dropdown.d.ts +10 -1
- package/dist/components/dropdown.js +7 -2
- package/dist/components/fieldText.d.ts +38 -0
- package/dist/components/fieldText.js +53 -0
- package/dist/components/fileTree.d.ts +7 -3
- package/dist/components/fileTree.js +12 -18
- package/dist/components/format.d.ts +41 -0
- package/dist/components/format.js +67 -0
- package/dist/components/identicon.d.ts +38 -0
- package/dist/components/identicon.js +85 -0
- package/dist/components/masonry.d.ts +32 -0
- package/dist/components/masonry.js +40 -0
- package/dist/components/menuWhen.js +1 -1
- package/dist/components/meter.d.ts +64 -0
- package/dist/components/meter.js +53 -0
- package/dist/components/otp.d.ts +1 -1
- package/dist/components/otp.js +7 -2
- package/dist/components/pipeline.d.ts +55 -0
- package/dist/components/pipeline.js +51 -0
- package/dist/components/quota.d.ts +57 -0
- package/dist/components/quota.js +40 -0
- package/dist/components/relativeTime.d.ts +24 -0
- package/dist/components/relativeTime.js +56 -0
- package/dist/components/reveal.d.ts +18 -0
- package/dist/components/reveal.js +32 -0
- package/dist/components/scramble.d.ts +68 -0
- package/dist/components/scramble.js +58 -0
- package/dist/components/shaderBackdrop.d.ts +20 -0
- package/dist/components/shaderBackdrop.js +156 -0
- package/dist/components/slider.d.ts +5 -0
- package/dist/components/slider.js +24 -0
- package/dist/components/slotText.d.ts +2 -0
- package/dist/components/slotText.js +9 -0
- package/dist/components/status.d.ts +14 -0
- package/dist/components/status.js +22 -0
- package/dist/components/tableFacets.d.ts +8 -0
- package/dist/components/tableFacets.js +19 -0
- package/dist/components/textSplit.d.ts +17 -0
- package/dist/components/textSplit.js +24 -0
- package/dist/components/timeSpan.d.ts +78 -0
- package/dist/components/timeSpan.js +85 -0
- package/dist/components/tone.d.ts +43 -0
- package/dist/components/tone.js +82 -0
- package/dist/components/tour.js +3 -2
- package/dist/components/typewriter.d.ts +36 -0
- package/dist/components/typewriter.js +53 -0
- package/dist/components/videoBackdrop.js +5 -6
- package/dist/composables/easing.d.ts +22 -1
- package/dist/composables/easing.js +42 -1
- package/dist/composables/pseudoLocale.d.ts +15 -0
- package/dist/composables/pseudoLocale.js +96 -0
- package/dist/composables/scroll.js +5 -3
- package/dist/composables/useClipboard.d.ts +4 -1
- package/dist/composables/useClipboard.js +12 -2
- package/dist/composables/useField.d.ts +8 -0
- package/dist/composables/useField.js +5 -0
- package/dist/composables/useForm.js +19 -5
- package/dist/composables/useInView.d.ts +11 -0
- package/dist/composables/useInView.js +39 -0
- package/dist/composables/useLoadingGate.d.ts +8 -0
- package/dist/composables/useLoadingGate.js +38 -0
- package/dist/composables/useLpConfig.d.ts +10 -0
- package/dist/composables/useLpConfig.js +11 -1
- package/dist/composables/useMediaQuery.js +3 -1
- package/dist/composables/useNow.d.ts +16 -0
- package/dist/composables/useNow.js +39 -0
- package/dist/composables/usePersisted.js +14 -7
- package/dist/composables/usePillTransition.d.ts +5 -2
- package/dist/composables/usePillTransition.js +4 -3
- package/dist/composables/usePointerFrame.d.ts +18 -0
- package/dist/composables/usePointerFrame.js +31 -0
- package/dist/composables/useReducedMotion.d.ts +2 -0
- package/dist/composables/useReducedMotion.js +7 -0
- package/dist/composables/useRepeater.d.ts +17 -0
- package/dist/composables/useRepeater.js +31 -0
- package/dist/composables/useResizeObserver.d.ts +8 -0
- package/dist/composables/useResizeObserver.js +33 -0
- package/dist/composables/useRevealedValue.d.ts +31 -0
- package/dist/composables/useRevealedValue.js +26 -0
- package/dist/composables/useScramble.d.ts +42 -0
- package/dist/composables/useScramble.js +76 -0
- package/dist/composables/useShift.js +2 -10
- package/dist/composables/useSpotlight.d.ts +18 -0
- package/dist/composables/useSpotlight.js +53 -0
- package/dist/composables/useTilt.js +26 -18
- package/dist/composables/useTween.d.ts +43 -0
- package/dist/composables/useTween.js +69 -0
- package/dist/composables/useView.d.ts +18 -0
- package/dist/composables/useView.js +61 -0
- package/dist/icons-all.js +1 -1
- package/dist/index.d.ts +98 -1
- package/dist/index.js +262 -104
- package/dist/theme/define.d.ts +12 -0
- package/dist/theme/studio.d.ts +90 -0
- package/package.json +5 -2
- package/src/component-names.ts +33 -0
- package/src/components/AttentionDot.vue +27 -0
- package/src/components/FieldWrapper.vue +38 -0
- package/src/components/LayoutNode.vue +5 -9
- package/src/components/LegendSwatch.vue +15 -0
- package/src/components/LoaderMark.vue +90 -0
- package/src/components/LpActionBar.vue +12 -20
- package/src/components/LpActivityLine.vue +186 -0
- package/src/components/LpAlert.vue +54 -24
- package/src/components/LpAppShell.vue +7 -11
- package/src/components/LpAutocomplete.vue +16 -14
- package/src/components/LpAvatar.vue +17 -2
- package/src/components/LpBadge.vue +77 -13
- package/src/components/LpBreadcrumbs.vue +101 -35
- package/src/components/LpButton.vue +15 -3
- package/src/components/LpCard.vue +30 -7
- package/src/components/LpChart.vue +143 -154
- package/src/components/LpCheckbox.vue +10 -4
- package/src/components/LpCodeBlock.vue +11 -19
- package/src/components/LpCodeDisplay.vue +228 -0
- package/src/components/LpCollapse.vue +162 -0
- package/src/components/LpColorPicker.vue +10 -1
- package/src/components/LpCommandPalette.vue +38 -24
- package/src/components/LpContextMenu.vue +10 -1
- package/src/components/LpCopyButton.vue +185 -0
- package/src/components/LpCountdown.vue +308 -0
- package/src/components/LpDataList.vue +154 -0
- package/src/components/LpDatePicker.vue +53 -104
- package/src/components/LpDateRangePicker.vue +49 -95
- package/src/components/LpDisclosure.vue +58 -36
- package/src/components/LpDock.vue +274 -0
- package/src/components/LpDrawer.vue +10 -1
- package/src/components/LpDropdownMenu.vue +10 -1
- package/src/components/LpDropzone.vue +34 -13
- package/src/components/LpEditable.vue +293 -0
- package/src/components/LpFileTree.vue +5 -1
- package/src/components/LpFileTreeNode.vue +25 -50
- package/src/components/LpFormField.vue +22 -3
- package/src/components/LpFrame.vue +200 -0
- package/src/components/LpGauge.vue +287 -0
- package/src/components/LpGlowBorder.vue +60 -0
- package/src/components/LpHintExample.vue +9 -32
- package/src/components/LpHintLayer.vue +13 -3
- package/src/components/LpHoverCard.vue +175 -0
- package/src/components/LpIdenticon.vue +69 -0
- package/src/components/LpImageEditor.vue +15 -18
- package/src/components/LpInfraNode.vue +27 -16
- package/src/components/LpInput.vue +30 -16
- package/src/components/LpLightbox.vue +44 -23
- package/src/components/LpLoader.vue +145 -0
- package/src/components/LpLogViewer.vue +311 -82
- package/src/components/LpMagnetic.vue +97 -0
- package/src/components/LpMapPicker.vue +26 -28
- package/src/components/LpMasonry.vue +247 -0
- package/src/components/LpModal.vue +10 -1
- package/src/components/LpNotificationBell.vue +33 -49
- package/src/components/LpNumberField.vue +79 -14
- package/src/components/LpNumberFlow.vue +10 -35
- package/src/components/LpOtpInput.vue +7 -2
- package/src/components/LpPagination.vue +38 -4
- package/src/components/LpPalettePreview.vue +2 -7
- package/src/components/LpPasswordInput.vue +16 -14
- package/src/components/LpPhoneInput.vue +12 -3
- package/src/components/LpPie.vue +197 -36
- package/src/components/LpPipeline.vue +366 -0
- package/src/components/LpPopover.vue +10 -1
- package/src/components/LpProgress.vue +22 -84
- package/src/components/LpQuota.vue +197 -0
- package/src/components/LpRangeSlider.vue +5 -1
- package/src/components/LpRelativeTime.vue +90 -0
- package/src/components/LpRepeater.vue +80 -0
- package/src/components/LpRevealOnScroll.vue +125 -0
- package/src/components/LpScramble.vue +107 -0
- package/src/components/LpSecretField.vue +313 -0
- package/src/components/LpSegmented.vue +3 -10
- package/src/components/LpSelect.vue +78 -64
- package/src/components/LpShaderBackdrop.vue +434 -0
- package/src/components/LpShinyText.vue +139 -0
- package/src/components/LpSidebar.vue +2 -0
- package/src/components/LpSlider.vue +5 -1
- package/src/components/LpSparkline.vue +55 -37
- package/src/components/LpSpotlight.vue +51 -0
- package/src/components/LpStat.vue +6 -2
- package/src/components/LpStatus.vue +127 -0
- package/src/components/LpStepMark.vue +138 -0
- package/src/components/LpStepper.vue +37 -43
- package/src/components/LpSwap.vue +2 -2
- package/src/components/LpSwitch.vue +15 -22
- package/src/components/LpTable.vue +47 -63
- package/src/components/LpTableFilter.vue +1 -0
- package/src/components/LpTableOfContents.vue +53 -29
- package/src/components/LpTabs.vue +10 -21
- package/src/components/LpTagsInput.vue +53 -37
- package/src/components/LpTextReveal.vue +236 -0
- package/src/components/LpTextarea.vue +11 -11
- package/src/components/LpThemeStudio.vue +216 -0
- package/src/components/LpThemeStudioSection.vue +16 -0
- package/src/components/LpThemeSwitcher.vue +156 -47
- package/src/components/LpTimeField.vue +9 -1
- package/src/components/LpToaster.vue +63 -83
- package/src/components/LpTooltip.vue +10 -1
- package/src/components/LpTour.vue +24 -13
- package/src/components/LpTruncate.vue +135 -0
- package/src/components/LpTypewriter.vue +236 -0
- package/src/components/LpUptimeBar.vue +6 -5
- package/src/components/LpVideoBackdrop.vue +15 -13
- package/src/components/OptionContent.vue +17 -0
- package/src/components/PickerField.vue +58 -0
- package/src/components/RevealToggle.vue +51 -0
- package/src/components/StepConnector.vue +54 -0
- package/src/components/TourCard.vue +29 -16
- package/src/components/badge.ts +8 -0
- package/src/components/chart.ts +8 -23
- package/src/components/dateRange.ts +25 -0
- package/src/components/dock.ts +31 -0
- package/src/components/dropdown.ts +15 -3
- package/src/components/fieldText.ts +95 -0
- package/src/components/fileTree.ts +19 -21
- package/src/components/format.ts +136 -0
- package/src/components/identicon.ts +160 -0
- package/src/components/masonry.ts +73 -0
- package/src/components/meter.ts +122 -0
- package/src/components/otp.ts +14 -3
- package/src/components/pipeline.ts +101 -0
- package/src/components/quota.ts +111 -0
- package/src/components/relativeTime.ts +118 -0
- package/src/components/reveal.ts +56 -0
- package/src/components/scramble.ts +138 -0
- package/src/components/shaderBackdrop.ts +208 -0
- package/src/components/slider.ts +30 -0
- package/src/components/slotText.ts +13 -0
- package/src/components/status.ts +46 -0
- package/src/components/tableFacets.ts +25 -0
- package/src/components/textSplit.ts +55 -0
- package/src/components/timeSpan.ts +183 -0
- package/src/components/tone.ts +144 -0
- package/src/components/tour.ts +3 -2
- package/src/components/typewriter.ts +104 -0
- package/src/components/videoBackdrop.ts +7 -6
- package/src/composables/easing.ts +66 -1
- package/src/composables/pseudoLocale.ts +105 -0
- package/src/composables/scroll.ts +6 -3
- package/src/composables/useClipboard.ts +25 -3
- package/src/composables/useField.ts +12 -0
- package/src/composables/useForm.ts +27 -6
- package/src/composables/useInView.ts +61 -0
- package/src/composables/useLoadingGate.ts +63 -0
- package/src/composables/useLpConfig.ts +20 -1
- package/src/composables/useMediaQuery.ts +6 -2
- package/src/composables/useNow.ts +84 -0
- package/src/composables/usePersisted.ts +19 -8
- package/src/composables/usePillTransition.ts +21 -13
- package/src/composables/usePointerFrame.ts +72 -0
- package/src/composables/useReducedMotion.ts +22 -0
- package/src/composables/useRepeater.ts +44 -0
- package/src/composables/useResizeObserver.ts +59 -0
- package/src/composables/useRevealedValue.ts +84 -0
- package/src/composables/useScramble.ts +152 -0
- package/src/composables/useShift.ts +10 -16
- package/src/composables/useSpotlight.ts +82 -0
- package/src/composables/useTilt.ts +40 -23
- package/src/composables/useTween.ts +149 -0
- package/src/composables/useView.ts +93 -0
- package/src/index.css +1 -0
- package/src/index.ts +143 -1
- package/src/kit-icons.ts +1 -1
- package/src/theme/define.ts +65 -0
- package/src/theme/studio.ts +202 -0
- package/src/tokens/effects.css +151 -0
- package/src/tokens/tokens.css +131 -39
- package/src/tokens/utilities.css +81 -0
- package/dist/assets/LpTabs-Bk7v4bZz.css +0 -18
- package/dist/chunks/LpAlert-BdvxvcWE.js +0 -85
- package/dist/chunks/LpBadge-Fe0D1bYx.js +0 -62
- package/dist/chunks/LpBreadcrumbs-rzOKkLiI.js +0 -98
- package/dist/chunks/LpDatePicker-BMfM454Y.js +0 -243
- package/dist/chunks/LpDateRangePicker-CNb9X3eL.js +0 -195
- package/dist/chunks/LpNumberField-DO1ufKvE.js +0 -107
- package/dist/chunks/LpStepper-C2slwObu.js +0 -90
- package/dist/chunks/LpSwitch-CZy9_IoA.js +0 -132
- package/dist/chunks/LpThemeSwitcher-CDoziW0z.js +0 -166
- package/dist/chunks/TourCard-BKI7X9-r.js +0 -105
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter, type Ref } from "vue";
|
|
2
|
+
export interface UseNowOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Ms from `now` until the next tick. Defaults to the next wall-clock
|
|
5
|
+
* second, which is when an elapsed "1m 12s" changes.
|
|
6
|
+
*/
|
|
7
|
+
nextIn?: (now: number) => number;
|
|
8
|
+
/**
|
|
9
|
+
* Re-read the clock and reschedule whenever this changes. For a `nextIn`
|
|
10
|
+
* that depends on more than the time: a relative date that was "last month"
|
|
11
|
+
* sleeps an hour, and if it is replaced by a date a few seconds old, the
|
|
12
|
+
* wait it scheduled for the old one would leave "now" on screen for an hour.
|
|
13
|
+
*/
|
|
14
|
+
restartOn?: MaybeRefOrGetter<unknown>;
|
|
15
|
+
}
|
|
16
|
+
export declare function useNow(active?: MaybeRefOrGetter<boolean>, options?: UseNowOptions): Ref<number>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ref, watch, toValue, onScopeDispose } from "vue";
|
|
2
|
+
function useNow(active = true, options = {}) {
|
|
3
|
+
const now = ref(Date.now());
|
|
4
|
+
let timer;
|
|
5
|
+
const hasDocument = typeof document !== "undefined";
|
|
6
|
+
const stop = () => {
|
|
7
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
8
|
+
timer = void 0;
|
|
9
|
+
};
|
|
10
|
+
const delay = (at) => {
|
|
11
|
+
const next = options.nextIn ? options.nextIn(at) : 1e3 - at % 1e3;
|
|
12
|
+
return Math.max(16, Number.isFinite(next) ? next : 1e3);
|
|
13
|
+
};
|
|
14
|
+
const tick = () => {
|
|
15
|
+
stop();
|
|
16
|
+
now.value = Date.now();
|
|
17
|
+
if (!toValue(active) || hasDocument && document.hidden) return;
|
|
18
|
+
timer = setTimeout(tick, delay(now.value) + 4);
|
|
19
|
+
};
|
|
20
|
+
const onVisibility = () => {
|
|
21
|
+
if (document.hidden) stop();
|
|
22
|
+
else tick();
|
|
23
|
+
};
|
|
24
|
+
watch(() => !!toValue(active), (on) => on ? tick() : stop(), { immediate: true });
|
|
25
|
+
if (options.restartOn !== void 0) {
|
|
26
|
+
watch(() => toValue(options.restartOn), () => {
|
|
27
|
+
if (toValue(active)) tick();
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (hasDocument) document.addEventListener("visibilitychange", onVisibility);
|
|
31
|
+
onScopeDispose(() => {
|
|
32
|
+
stop();
|
|
33
|
+
if (hasDocument) document.removeEventListener("visibilitychange", onVisibility);
|
|
34
|
+
});
|
|
35
|
+
return now;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
useNow
|
|
39
|
+
};
|
|
@@ -28,19 +28,26 @@ function useKitStorage() {
|
|
|
28
28
|
}
|
|
29
29
|
function usePersisted(key, initial, options = {}) {
|
|
30
30
|
const storage = useKitStorage();
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const pristine = initial === void 0 ? void 0 : JSON.stringify(initial);
|
|
32
|
+
const fresh = () => pristine === void 0 ? initial : JSON.parse(pristine);
|
|
33
|
+
const value = ref(fresh());
|
|
34
|
+
function stored(name) {
|
|
34
35
|
const raw = storage.get(name);
|
|
35
|
-
if (raw == null) return;
|
|
36
|
+
if (raw == null) return { ok: false };
|
|
36
37
|
try {
|
|
37
38
|
const parsed = JSON.parse(raw);
|
|
38
|
-
|
|
39
|
-
value.value = parsed;
|
|
39
|
+
return options.validate && !options.validate(parsed) ? { ok: false } : { ok: true, value: parsed };
|
|
40
40
|
} catch {
|
|
41
|
+
return { ok: false };
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
function read(name, previous) {
|
|
45
|
+
if (!name) return;
|
|
46
|
+
const found = stored(name);
|
|
47
|
+
if (found.ok) value.value = found.value;
|
|
48
|
+
else if (previous) value.value = fresh();
|
|
49
|
+
}
|
|
50
|
+
watch(() => toValue(key), (name, previous) => read(name, previous), { immediate: true });
|
|
44
51
|
watch(
|
|
45
52
|
value,
|
|
46
53
|
(next) => {
|
|
@@ -5,16 +5,19 @@ export type PillTransition = {
|
|
|
5
5
|
type: "spring";
|
|
6
6
|
stiffness: number;
|
|
7
7
|
damping: number;
|
|
8
|
+
mass?: number;
|
|
8
9
|
};
|
|
9
|
-
export type PillFeel = "pill" | "float";
|
|
10
|
+
export type PillFeel = "pill" | "float" | "layout";
|
|
10
11
|
export declare function usePillTransition(feel?: PillFeel): ComputedRef<PillTransition>;
|
|
12
|
+
/** The feels a pointer follower uses; "layout" is a motion-v layout move only. */
|
|
13
|
+
export type StepFeel = Exclude<PillFeel, "layout">;
|
|
11
14
|
export interface SpringState {
|
|
12
15
|
/** Current position; seed it with the start value. */
|
|
13
16
|
value: number;
|
|
14
17
|
/** Current velocity; seed with 0. */
|
|
15
18
|
velocity: number;
|
|
16
19
|
}
|
|
17
|
-
export declare function springStep(state: SpringState, target: number, feel?:
|
|
20
|
+
export declare function springStep(state: SpringState, target: number, feel?: StepFeel,
|
|
18
21
|
/** Frame time in seconds; clamped so a backgrounded tab can't explode it. */
|
|
19
22
|
dt?: number): SpringState;
|
|
20
23
|
/** True once a spring is close enough to its target to stop animating. */
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { useReducedMotion } from "motion-v";
|
|
2
1
|
import { computed } from "vue";
|
|
2
|
+
import { usePrefersReducedMotion } from "./useReducedMotion.js";
|
|
3
3
|
const SPRING = {
|
|
4
4
|
pill: { type: "spring", stiffness: 520, damping: 40 },
|
|
5
|
-
float: { type: "spring", stiffness: 210, damping: 26 }
|
|
5
|
+
float: { type: "spring", stiffness: 210, damping: 26 },
|
|
6
|
+
layout: { type: "spring", stiffness: 520, damping: 42, mass: 0.9 }
|
|
6
7
|
};
|
|
7
8
|
function usePillTransition(feel = "pill") {
|
|
8
|
-
const reduceMotion =
|
|
9
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
9
10
|
return computed(
|
|
10
11
|
() => reduceMotion.value ? { duration: 0 } : SPRING[feel]
|
|
11
12
|
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter } from "vue";
|
|
2
|
+
export interface PointerFrameOptions {
|
|
3
|
+
/** Paint with the latest pointer position, in client coordinates. */
|
|
4
|
+
paint: (x: number, y: number) => void;
|
|
5
|
+
/** Drop moves while true; the caller decides what "off" looks like. */
|
|
6
|
+
disabled?: MaybeRefOrGetter<boolean | undefined>;
|
|
7
|
+
/** Follow touch and pen too, not only a mouse. */
|
|
8
|
+
anyPointer?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface PointerFrame {
|
|
11
|
+
/** Feed a pointer event. False when it was dropped (touch, reduced motion, disabled). */
|
|
12
|
+
move: (event: PointerEvent) => boolean;
|
|
13
|
+
/** Paint at a given position on the next frame, as if the pointer were there (a pointer that left the window). */
|
|
14
|
+
moveTo: (x: number, y: number) => void;
|
|
15
|
+
/** Drop a frame that has been asked for but not painted yet. */
|
|
16
|
+
cancel: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function usePointerFrame(options: PointerFrameOptions): PointerFrame;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { onScopeDispose, toValue } from "vue";
|
|
2
|
+
import { prefersReducedMotion } from "./easing.js";
|
|
3
|
+
function usePointerFrame(options) {
|
|
4
|
+
let frame = 0;
|
|
5
|
+
let lastX = 0;
|
|
6
|
+
let lastY = 0;
|
|
7
|
+
const run = () => {
|
|
8
|
+
frame = 0;
|
|
9
|
+
options.paint(lastX, lastY);
|
|
10
|
+
};
|
|
11
|
+
const moveTo = (x, y) => {
|
|
12
|
+
lastX = x;
|
|
13
|
+
lastY = y;
|
|
14
|
+
if (!frame) frame = requestAnimationFrame(run);
|
|
15
|
+
};
|
|
16
|
+
const move = (event) => {
|
|
17
|
+
if (!options.anyPointer && event.pointerType !== "mouse") return false;
|
|
18
|
+
if (toValue(options.disabled) || prefersReducedMotion()) return false;
|
|
19
|
+
moveTo(event.clientX, event.clientY);
|
|
20
|
+
return true;
|
|
21
|
+
};
|
|
22
|
+
const cancel = () => {
|
|
23
|
+
if (frame) cancelAnimationFrame(frame);
|
|
24
|
+
frame = 0;
|
|
25
|
+
};
|
|
26
|
+
onScopeDispose(cancel);
|
|
27
|
+
return { move, moveTo, cancel };
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
usePointerFrame
|
|
31
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type RepeaterItemKey<T> = keyof T | ((item: T) => string | number);
|
|
2
|
+
/** Keys live beside the model: unsaved rows need identity without adding fields to a DTO. */
|
|
3
|
+
export declare function useRepeater<T extends object>(options: {
|
|
4
|
+
value: () => T[];
|
|
5
|
+
set: (items: T[]) => void;
|
|
6
|
+
createItem: () => T;
|
|
7
|
+
itemKey: () => RepeaterItemKey<T> | undefined;
|
|
8
|
+
disabled: () => boolean;
|
|
9
|
+
}): {
|
|
10
|
+
rows: import("vue").ComputedRef<{
|
|
11
|
+
item: T;
|
|
12
|
+
key: string;
|
|
13
|
+
}[]>;
|
|
14
|
+
add: () => void;
|
|
15
|
+
remove: (index: number) => void;
|
|
16
|
+
update: (index: number, item: T) => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { computed, toRaw } from "vue";
|
|
2
|
+
function useRepeater(options) {
|
|
3
|
+
const keys = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
let sequence = 0;
|
|
5
|
+
function keyFor(item) {
|
|
6
|
+
const key = options.itemKey();
|
|
7
|
+
const explicit = typeof key === "function" ? key(item) : key === void 0 ? void 0 : item[key];
|
|
8
|
+
if (explicit !== void 0 && explicit !== null) return `item:${typeof explicit}:${String(explicit)}`;
|
|
9
|
+
const raw = toRaw(item);
|
|
10
|
+
if (!keys.has(raw)) keys.set(raw, `local:${sequence++}`);
|
|
11
|
+
return keys.get(raw);
|
|
12
|
+
}
|
|
13
|
+
const rows = computed(() => options.value().map((item) => ({ item, key: keyFor(item) })));
|
|
14
|
+
function add() {
|
|
15
|
+
if (!options.disabled()) options.set([...options.value(), options.createItem()]);
|
|
16
|
+
}
|
|
17
|
+
function remove(index) {
|
|
18
|
+
if (options.disabled() || index < 0 || index >= options.value().length) return;
|
|
19
|
+
options.set(options.value().filter((_, i) => i !== index));
|
|
20
|
+
}
|
|
21
|
+
function update(index, item) {
|
|
22
|
+
const previous = options.value()[index];
|
|
23
|
+
if (options.disabled() || previous === void 0) return;
|
|
24
|
+
keys.set(toRaw(item), keyFor(previous));
|
|
25
|
+
options.set(options.value().map((value, i) => i === index ? item : value));
|
|
26
|
+
}
|
|
27
|
+
return { rows, add, remove, update };
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
useRepeater
|
|
31
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter } from "vue";
|
|
2
|
+
export interface UseResizeObserverOptions extends ResizeObserverOptions {
|
|
3
|
+
/** Call back once as soon as an element is attached (with no entry), not only on the first report. */
|
|
4
|
+
immediate?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function useResizeObserver(target: MaybeRefOrGetter<Element | null | undefined>, callback: (entry: ResizeObserverEntry | undefined, el: Element) => void, options?: UseResizeObserverOptions): {
|
|
7
|
+
stop: () => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { watch, toValue, onScopeDispose } from "vue";
|
|
2
|
+
function useResizeObserver(target, callback, options = {}) {
|
|
3
|
+
const { immediate = false, ...observe } = options;
|
|
4
|
+
let observer;
|
|
5
|
+
const disconnect = () => {
|
|
6
|
+
observer?.disconnect();
|
|
7
|
+
observer = void 0;
|
|
8
|
+
};
|
|
9
|
+
const stopWatch = watch(
|
|
10
|
+
() => toValue(target),
|
|
11
|
+
(el) => {
|
|
12
|
+
disconnect();
|
|
13
|
+
if (!el) return;
|
|
14
|
+
if (immediate) callback(void 0, el);
|
|
15
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
16
|
+
observer = new ResizeObserver((entries) => {
|
|
17
|
+
const entry = entries[entries.length - 1];
|
|
18
|
+
if (entry) callback(entry, el);
|
|
19
|
+
});
|
|
20
|
+
observer.observe(el, observe);
|
|
21
|
+
},
|
|
22
|
+
{ immediate: true, flush: "post" }
|
|
23
|
+
);
|
|
24
|
+
const stop = () => {
|
|
25
|
+
stopWatch();
|
|
26
|
+
disconnect();
|
|
27
|
+
};
|
|
28
|
+
onScopeDispose(stop);
|
|
29
|
+
return { stop };
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
useResizeObserver
|
|
33
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter, type Ref } from "vue";
|
|
2
|
+
export interface UseRevealedValueOptions {
|
|
3
|
+
/** Where the number starts while held: 0 for a bar, the floor for a gauge. */
|
|
4
|
+
from?: MaybeRefOrGetter<number>;
|
|
5
|
+
/** False shows the value at once, with nothing held. */
|
|
6
|
+
animateOnMount?: MaybeRefOrGetter<boolean>;
|
|
7
|
+
/**
|
|
8
|
+
* Also tween `shown` toward the target over this many ms (eased out), for a
|
|
9
|
+
* component that draws from one interpolated number. Omitted, `shown` is the
|
|
10
|
+
* target itself, for a component that animates in CSS or through LpNumberFlow.
|
|
11
|
+
*/
|
|
12
|
+
duration?: MaybeRefOrGetter<number>;
|
|
13
|
+
/**
|
|
14
|
+
* Whether a change that arrives before the reveal waits too (default) or
|
|
15
|
+
* goes through at once. A meter waits, so its first sweep is still seen;
|
|
16
|
+
* LpNumberFlow lets it through, because a figure that changes while the user
|
|
17
|
+
* is on the page is news whether or not it is in view.
|
|
18
|
+
*/
|
|
19
|
+
holdChanges?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface UseRevealedValue {
|
|
22
|
+
/** Attach to the element whose appearance releases the value. */
|
|
23
|
+
el: Ref<Element | null>;
|
|
24
|
+
/** False until that element has been seen. */
|
|
25
|
+
revealed: Ref<boolean>;
|
|
26
|
+
/** The value released so far: `from` while held, then the source. */
|
|
27
|
+
target: Readonly<Ref<number>>;
|
|
28
|
+
/** What to draw: `target`, tweened when a `duration` is given. */
|
|
29
|
+
shown: Readonly<Ref<number>>;
|
|
30
|
+
}
|
|
31
|
+
export declare function useRevealedValue(value: () => number, options?: UseRevealedValueOptions): UseRevealedValue;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ref, toValue, watch, computed } from "vue";
|
|
2
|
+
import { easeOut } from "./easing.js";
|
|
3
|
+
import { useReveal } from "./useReveal.js";
|
|
4
|
+
import { useTween, lerp } from "./useTween.js";
|
|
5
|
+
function useRevealedValue(value, options = {}) {
|
|
6
|
+
const animate = () => toValue(options.animateOnMount) ?? true;
|
|
7
|
+
const { el, revealed } = useReveal({ immediate: () => !animate() });
|
|
8
|
+
const canRelease = () => !animate() || typeof window !== "undefined";
|
|
9
|
+
const target = ref(animate() ? toValue(options.from) ?? 0 : value());
|
|
10
|
+
watch(
|
|
11
|
+
revealed,
|
|
12
|
+
(seen) => {
|
|
13
|
+
if (seen && canRelease()) target.value = value();
|
|
14
|
+
},
|
|
15
|
+
{ immediate: true }
|
|
16
|
+
);
|
|
17
|
+
watch(value, (v) => {
|
|
18
|
+
if (revealed.value || options.holdChanges === false) target.value = v;
|
|
19
|
+
});
|
|
20
|
+
const duration = options.duration;
|
|
21
|
+
const shown = duration === void 0 ? computed(() => target.value) : useTween(() => target.value, lerp, { duration: () => toValue(duration), ease: easeOut });
|
|
22
|
+
return { el, revealed, target, shown };
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
useRevealedValue
|
|
26
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ComputedRef, type MaybeRefOrGetter, type ShallowRef } from "vue";
|
|
2
|
+
import { type Random, type ScrambleFrameCell } from "../components/scramble";
|
|
3
|
+
export interface UseScrambleOptions {
|
|
4
|
+
/** Travel time in ms. */
|
|
5
|
+
duration?: MaybeRefOrGetter<number | undefined>;
|
|
6
|
+
/** See ScrambleOptions.order. */
|
|
7
|
+
order?: MaybeRefOrGetter<"sequential" | "together" | undefined>;
|
|
8
|
+
/** Glyph pool. */
|
|
9
|
+
glyphs?: MaybeRefOrGetter<string | undefined>;
|
|
10
|
+
/** Characters that never churn. Whitespace by default. */
|
|
11
|
+
keep?: (char: string) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* How often a churning position draws a new glyph, in ms. Every frame is too
|
|
14
|
+
* fast to read as anything but noise; ~50 ms looks like a display cycling.
|
|
15
|
+
*/
|
|
16
|
+
tick?: number;
|
|
17
|
+
/** Scramble when the source changes. Off: a change lands at once and only `play()` scrambles. */
|
|
18
|
+
onChange?: MaybeRefOrGetter<boolean | undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* What shows before the first `play()`: the value (`settled`) or a static
|
|
21
|
+
* mask of glyphs (`masked`), for a value that should decrypt on first sight
|
|
22
|
+
* rather than flash its plain text first.
|
|
23
|
+
*/
|
|
24
|
+
start?: "settled" | "masked";
|
|
25
|
+
/** Inject for reproducible frames (tests, screenshots). */
|
|
26
|
+
random?: Random;
|
|
27
|
+
/** Called when a run lands. */
|
|
28
|
+
onDone?: () => void;
|
|
29
|
+
}
|
|
30
|
+
export interface UseScramble {
|
|
31
|
+
/** The positions as they are drawn now. */
|
|
32
|
+
cells: Readonly<ShallowRef<ScrambleFrameCell[]>>;
|
|
33
|
+
/** The same as one string. */
|
|
34
|
+
text: ComputedRef<string>;
|
|
35
|
+
/** A run is in progress. */
|
|
36
|
+
running: Readonly<ShallowRef<boolean>>;
|
|
37
|
+
/** Scramble from what is shown now into the source value (into itself when unchanged). */
|
|
38
|
+
play: () => void;
|
|
39
|
+
/** Land at once on the source value. */
|
|
40
|
+
settle: () => void;
|
|
41
|
+
}
|
|
42
|
+
export declare function useScramble(source: MaybeRefOrGetter<string>, options?: UseScrambleOptions): UseScramble;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { toValue, shallowRef, computed, watch, onScopeDispose } from "vue";
|
|
2
|
+
import { scrambleFrame, planScramble, settledCells, SCRAMBLE_GLYPHS } from "../components/scramble.js";
|
|
3
|
+
import { prefersReducedMotion } from "./easing.js";
|
|
4
|
+
function useScramble(source, options = {}) {
|
|
5
|
+
const random = options.random ?? Math.random;
|
|
6
|
+
const tick = options.tick ?? 50;
|
|
7
|
+
const glyphs = () => toValue(options.glyphs) || SCRAMBLE_GLYPHS;
|
|
8
|
+
const initial = toValue(source);
|
|
9
|
+
const cells = shallowRef(
|
|
10
|
+
options.start === "masked" ? scrambleFrame(planScramble(initial, initial, { duration: 1, keep: options.keep }, random), 0, random, glyphs()) : settledCells(initial)
|
|
11
|
+
);
|
|
12
|
+
const running = shallowRef(false);
|
|
13
|
+
const text = computed(() => cells.value.map((cell) => cell.char).join(""));
|
|
14
|
+
let frame = 0;
|
|
15
|
+
let plan = [];
|
|
16
|
+
let started = 0;
|
|
17
|
+
let lastRoll = 0;
|
|
18
|
+
const stopFrame = () => {
|
|
19
|
+
if (frame && typeof cancelAnimationFrame !== "undefined") cancelAnimationFrame(frame);
|
|
20
|
+
frame = 0;
|
|
21
|
+
};
|
|
22
|
+
function settle() {
|
|
23
|
+
stopFrame();
|
|
24
|
+
cells.value = settledCells(toValue(source));
|
|
25
|
+
if (running.value) {
|
|
26
|
+
running.value = false;
|
|
27
|
+
options.onDone?.();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function step(now) {
|
|
31
|
+
const elapsed = now - started;
|
|
32
|
+
const duration = Math.max(1, toValue(options.duration) ?? 900);
|
|
33
|
+
if (elapsed >= duration) return settle();
|
|
34
|
+
if (now - lastRoll >= tick) {
|
|
35
|
+
lastRoll = now;
|
|
36
|
+
cells.value = scrambleFrame(plan, elapsed, random, glyphs());
|
|
37
|
+
} else {
|
|
38
|
+
const shown = cells.value;
|
|
39
|
+
let changed = false;
|
|
40
|
+
const next = shown.map((cell, i) => {
|
|
41
|
+
const p = plan[i];
|
|
42
|
+
if (!cell.settled && p && (p.fixed || elapsed >= p.settleAt)) {
|
|
43
|
+
changed = true;
|
|
44
|
+
return { char: p.final, sizer: p.final, settled: true };
|
|
45
|
+
}
|
|
46
|
+
return cell;
|
|
47
|
+
});
|
|
48
|
+
if (changed) cells.value = next;
|
|
49
|
+
}
|
|
50
|
+
frame = requestAnimationFrame(step);
|
|
51
|
+
}
|
|
52
|
+
function play() {
|
|
53
|
+
const to = toValue(source);
|
|
54
|
+
const duration = toValue(options.duration) ?? 900;
|
|
55
|
+
if (prefersReducedMotion() || duration <= 0 || typeof requestAnimationFrame === "undefined") return settle();
|
|
56
|
+
stopFrame();
|
|
57
|
+
const from = cells.value.map((cell) => cell.sizer).join("");
|
|
58
|
+
plan = planScramble(from, to, { duration, order: toValue(options.order), keep: options.keep }, random);
|
|
59
|
+
started = performance.now();
|
|
60
|
+
lastRoll = -Infinity;
|
|
61
|
+
running.value = true;
|
|
62
|
+
frame = requestAnimationFrame(step);
|
|
63
|
+
}
|
|
64
|
+
watch(
|
|
65
|
+
() => toValue(source),
|
|
66
|
+
() => {
|
|
67
|
+
if (toValue(options.onChange) === false) settle();
|
|
68
|
+
else play();
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
onScopeDispose(stopFrame);
|
|
72
|
+
return { cells, text, running, play, settle };
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
useScramble
|
|
76
|
+
};
|
|
@@ -50,18 +50,10 @@ function useShift(options = {}) {
|
|
|
50
50
|
const fromHeight = lastHeight;
|
|
51
51
|
const fromWidth = lastWidth;
|
|
52
52
|
const tops = readScroll();
|
|
53
|
-
if (wantsHeight())
|
|
54
|
-
|
|
55
|
-
node.style.maxHeight = "none";
|
|
56
|
-
}
|
|
57
|
-
if (wantsWidth()) {
|
|
58
|
-
node.style.width = "";
|
|
59
|
-
node.style.maxWidth = "none";
|
|
60
|
-
}
|
|
53
|
+
if (wantsHeight()) node.style.height = "";
|
|
54
|
+
if (wantsWidth()) node.style.width = "";
|
|
61
55
|
const toHeight = wantsHeight() ? node.offsetHeight : 0;
|
|
62
56
|
const toWidth = wantsWidth() ? node.offsetWidth : 0;
|
|
63
|
-
if (wantsHeight()) node.style.maxHeight = "";
|
|
64
|
-
if (wantsWidth()) node.style.maxWidth = "";
|
|
65
57
|
restoreScroll(tops);
|
|
66
58
|
lastHeight = toHeight;
|
|
67
59
|
lastWidth = toWidth;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter, type Ref } from "vue";
|
|
2
|
+
export interface UseSpotlightOptions {
|
|
3
|
+
/** Switch the effect off without unbinding — the listeners stay, nothing is drawn. */
|
|
4
|
+
disabled?: MaybeRefOrGetter<boolean | undefined>;
|
|
5
|
+
}
|
|
6
|
+
export interface UseSpotlight {
|
|
7
|
+
/** Attach to the element carrying `.lp-spotlight`. */
|
|
8
|
+
el: Ref<HTMLElement | null>;
|
|
9
|
+
}
|
|
10
|
+
/** Pointer position relative to a rect, in px, as the CSS custom properties want it. */
|
|
11
|
+
export declare function spotlightPoint(rect: {
|
|
12
|
+
left: number;
|
|
13
|
+
top: number;
|
|
14
|
+
}, clientX: number, clientY: number): {
|
|
15
|
+
x: string;
|
|
16
|
+
y: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function useSpotlight(options?: UseSpotlightOptions): UseSpotlight;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ref, watch, toValue, onBeforeUnmount } from "vue";
|
|
2
|
+
import { usePointerFrame } from "./usePointerFrame.js";
|
|
3
|
+
function spotlightPoint(rect, clientX, clientY) {
|
|
4
|
+
return { x: `${Math.round(clientX - rect.left)}px`, y: `${Math.round(clientY - rect.top)}px` };
|
|
5
|
+
}
|
|
6
|
+
function useSpotlight(options = {}) {
|
|
7
|
+
const el = ref(null);
|
|
8
|
+
const pointer = usePointerFrame({
|
|
9
|
+
disabled: options.disabled,
|
|
10
|
+
paint: (clientX, clientY) => {
|
|
11
|
+
const node = el.value;
|
|
12
|
+
if (!node) return;
|
|
13
|
+
const { x, y } = spotlightPoint(node.getBoundingClientRect(), clientX, clientY);
|
|
14
|
+
node.style.setProperty("--lp-spot-x", x);
|
|
15
|
+
node.style.setProperty("--lp-spot-y", y);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
function onMove(event) {
|
|
19
|
+
if (pointer.move(event)) el.value?.setAttribute("data-lp-spot", "");
|
|
20
|
+
}
|
|
21
|
+
function onLeave() {
|
|
22
|
+
el.value?.removeAttribute("data-lp-spot");
|
|
23
|
+
}
|
|
24
|
+
function detach(node) {
|
|
25
|
+
node.removeEventListener("pointermove", onMove);
|
|
26
|
+
node.removeEventListener("pointerleave", onLeave);
|
|
27
|
+
node.removeAttribute("data-lp-spot");
|
|
28
|
+
}
|
|
29
|
+
watch(
|
|
30
|
+
el,
|
|
31
|
+
(node, previous) => {
|
|
32
|
+
if (previous) detach(previous);
|
|
33
|
+
if (!node) return;
|
|
34
|
+
node.addEventListener("pointermove", onMove, { passive: true });
|
|
35
|
+
node.addEventListener("pointerleave", onLeave, { passive: true });
|
|
36
|
+
},
|
|
37
|
+
{ flush: "post" }
|
|
38
|
+
);
|
|
39
|
+
watch(
|
|
40
|
+
() => toValue(options.disabled),
|
|
41
|
+
(disabled) => {
|
|
42
|
+
if (disabled) onLeave();
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
onBeforeUnmount(() => {
|
|
46
|
+
if (el.value) detach(el.value);
|
|
47
|
+
});
|
|
48
|
+
return { el };
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
spotlightPoint,
|
|
52
|
+
useSpotlight
|
|
53
|
+
};
|
|
@@ -1,38 +1,48 @@
|
|
|
1
|
-
import { useReducedMotion } from "motion-v";
|
|
2
1
|
import { computed, toValue, ref } from "vue";
|
|
2
|
+
import { usePointerFrame } from "./usePointerFrame.js";
|
|
3
|
+
import { usePrefersReducedMotion } from "./useReducedMotion.js";
|
|
4
|
+
import { spotlightPoint } from "./useSpotlight.js";
|
|
5
|
+
const TILT_VARS = ["--lp-tilt-x", "--lp-tilt-y", "--lp-spot-x", "--lp-spot-y"];
|
|
3
6
|
function useTilt(source = {}) {
|
|
4
7
|
const options = computed(() => toValue(source));
|
|
5
|
-
const reduceMotion =
|
|
8
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
6
9
|
const active = ref(false);
|
|
7
|
-
|
|
8
|
-
const
|
|
10
|
+
let target = null;
|
|
11
|
+
const pointer = usePointerFrame({
|
|
12
|
+
anyPointer: true,
|
|
13
|
+
paint: (x, y) => {
|
|
14
|
+
if (!target || !active.value) return;
|
|
15
|
+
const r = target.getBoundingClientRect();
|
|
16
|
+
target.style.setProperty("--lp-tilt-x", ((x - r.left) / r.width * 2 - 1).toFixed(3));
|
|
17
|
+
target.style.setProperty("--lp-tilt-y", ((y - r.top) / r.height * 2 - 1).toFixed(3));
|
|
18
|
+
const spot = spotlightPoint(r, x, y);
|
|
19
|
+
target.style.setProperty("--lp-spot-x", spot.x);
|
|
20
|
+
target.style.setProperty("--lp-spot-y", spot.y);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
9
23
|
function onPointerMove(e) {
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
if (!el) return;
|
|
13
|
-
const r = el.getBoundingClientRect();
|
|
14
|
-
nx.value = (e.clientX - r.left) / r.width * 2 - 1;
|
|
15
|
-
ny.value = (e.clientY - r.top) / r.height * 2 - 1;
|
|
24
|
+
if (e.currentTarget instanceof HTMLElement) target = e.currentTarget;
|
|
25
|
+
pointer.move(e);
|
|
16
26
|
}
|
|
17
27
|
function onPointerEnter() {
|
|
18
28
|
active.value = true;
|
|
19
29
|
}
|
|
20
30
|
function onPointerLeave() {
|
|
21
31
|
active.value = false;
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
pointer.cancel();
|
|
33
|
+
for (const name of TILT_VARS) target?.style.removeProperty(name);
|
|
24
34
|
}
|
|
25
35
|
const style = computed(() => {
|
|
26
36
|
if (reduceMotion.value) {
|
|
27
37
|
return { transition: "transform 0.2s ease" };
|
|
28
38
|
}
|
|
29
39
|
const { max = 10, lift = 8, scale = 1.03 } = options.value;
|
|
30
|
-
const rx = active.value ? -
|
|
31
|
-
const ry = active.value ?
|
|
40
|
+
const rx = active.value ? `calc(var(--lp-tilt-y, 0) * ${-max}deg)` : "0deg";
|
|
41
|
+
const ry = active.value ? `calc(var(--lp-tilt-x, 0) * ${max}deg)` : "0deg";
|
|
32
42
|
const z = active.value ? lift : 0;
|
|
33
43
|
const s = active.value ? scale : 1;
|
|
34
44
|
return {
|
|
35
|
-
transform: `translate3d(0, ${-z}px, 0) rotateX(${rx}
|
|
45
|
+
transform: `translate3d(0, ${-z}px, 0) rotateX(${rx}) rotateY(${ry}) scale(${s})`,
|
|
36
46
|
transformStyle: "preserve-3d",
|
|
37
47
|
transition: active.value ? "transform 0.12s ease-out" : "transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)"
|
|
38
48
|
};
|
|
@@ -41,11 +51,9 @@ function useTilt(source = {}) {
|
|
|
41
51
|
if (!options.value.glare || reduceMotion.value || !active.value) {
|
|
42
52
|
return { opacity: 0 };
|
|
43
53
|
}
|
|
44
|
-
const px = (nx.value + 1) * 50;
|
|
45
|
-
const py = (ny.value + 1) * 50;
|
|
46
54
|
return {
|
|
47
55
|
opacity: 1,
|
|
48
|
-
background:
|
|
56
|
+
background: "radial-gradient(circle at var(--lp-spot-x, 50%) var(--lp-spot-y, 50%), rgba(255,255,255,0.35), transparent 55%)",
|
|
49
57
|
transition: "opacity 0.2s ease"
|
|
50
58
|
};
|
|
51
59
|
});
|