@leavepulse/ui 0.69.0 → 0.70.1
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 +49 -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/LpRepeater-C1Cw27hj.css +21 -0
- package/dist/assets/{LpRollingText-BGnE6q9j.css → LpRollingText-dyOXedGO.css} +7 -0
- 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-6kxEivBI.js} +11 -5
- 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-Chv_Xf8q.js} +7 -7
- package/dist/chunks/LpAlert-C5igj802.js +119 -0
- package/dist/chunks/{LpAppShell-DPh1756q.js → LpAppShell-BiWByLmt.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-BBq1Er9T.js +126 -0
- package/dist/chunks/LpBreadcrumbs-JKEi_yFF.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-CbJMs-IK.js +189 -0
- package/dist/chunks/LpCollapse-CWS9M_lm.js +115 -0
- package/dist/chunks/{LpColorPicker-DtEfBAcK.js → LpColorPicker-B7HSIFmn.js} +11 -6
- 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-Cj96ENDC.js} +16 -7
- package/dist/chunks/LpCopyButton-DzHjnFs0.js +133 -0
- package/dist/chunks/LpCountdown-BQnmB4gq.js +231 -0
- package/dist/chunks/LpDataList-CHNYQw7h.js +121 -0
- package/dist/chunks/LpDatePicker-ac1_6o5P.js +169 -0
- package/dist/chunks/LpDateRangePicker-B15gYrZJ.js +127 -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-R4aYVtVV.js} +14 -6
- package/dist/chunks/LpEditable-Ws3DNQHn.js +238 -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-DDNg34tJ.js} +5 -3
- package/dist/chunks/{LpFileTreeNode-BXhTHaKW.js → LpFileTreeNode-DmPuYNZ_.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-C14Z9503.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-HvwUA5Ec.js} +27 -14
- package/dist/chunks/{LpHints-BUtBp9-w.js → LpHints-DxbPKOzQ.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-D64hywJI.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-DKK4ySZl.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-rmI1DjKN.js} +3 -3
- package/dist/chunks/{LpModal-hk1noDcr.js → LpModal-eBMt2Fqn.js} +8 -3
- package/dist/chunks/{LpModalNav-DQd2keZm.js → LpModalNav-DiyFCHiZ.js} +4 -4
- package/dist/chunks/{LpNotificationBell-X84PJIxD.js → LpNotificationBell-D-WhE5m2.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-GL2KOFK8.js} +26 -22
- package/dist/chunks/{LpPhoneInput-DP69HONS.js → LpPhoneInput-C60tx1tC.js} +12 -7
- package/dist/chunks/{LpPie-yLF9-aDR.js → LpPie-BgXZ3xmm.js} +159 -48
- package/dist/chunks/LpPipeline-B31h41Mu.js +329 -0
- package/dist/chunks/{LpPopover-DVnkHaOu.js → LpPopover-DmZ3wUtP.js} +13 -7
- package/dist/chunks/{LpProgress-CA86wxXu.js → LpProgress-CE-m5OpD.js} +23 -63
- package/dist/chunks/LpQuota-DaL8TgNe.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-yin9uQP7.js +73 -0
- package/dist/chunks/LpRepeater-D0S7jjwr.js +180 -0
- package/dist/chunks/LpRevealOnScroll-DcQjexLy.js +76 -0
- package/dist/chunks/{LpRollingText-DB7upf-5.js → LpRollingText-DiL717LK.js} +4 -3
- package/dist/chunks/LpScramble-TDO5Kdou.js +85 -0
- package/dist/chunks/LpSecretField-CfWyHv9m.js +316 -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-C_8cJtj6.js} +91 -111
- package/dist/chunks/LpShaderBackdrop-Bote0iuy.js +332 -0
- package/dist/chunks/LpShinyText-DX2ajtWq.js +48 -0
- package/dist/chunks/{LpSidebar-DfIiS-lB.js → LpSidebar-CZRXtvem.js} +5 -3
- package/dist/chunks/{LpSidebarNav-C5FDNI0t.js → LpSidebarNav-DBg1U1oW.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-DFKlPJgy.js} +38 -35
- package/dist/chunks/LpStatus-BsGLrpor.js +86 -0
- package/dist/chunks/LpStepMark-TrzOioa9.js +101 -0
- package/dist/chunks/LpStepper-BbnS5jUr.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-DZg80W-B.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-DxVZMtzN.js +416 -0
- package/dist/chunks/LpThemeStudioSection-BwhqYDLf.js +20 -0
- package/dist/chunks/LpThemeSwitcher-CadVBTBn.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-C17A1XCb.js} +1 -1
- package/dist/chunks/{LpTour-BUp3Jt2e.js → LpTour-CY2bFXge.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-Tew1Ykx4.js} +10 -9
- 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-DoHv0WMH.js +125 -0
- package/dist/chunks/RevealToggle-C-KzaQGJ.js +65 -0
- package/dist/chunks/StepConnector-37OgEOXA.js +41 -0
- package/dist/chunks/TourCard-BJ8i7dk0.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 +131 -160
- 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 +3 -1
- package/dist/components/LpDatePicker.vue.js +1 -1
- package/dist/components/LpDateRangePicker.vue.d.ts +3 -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 +2 -2
- package/dist/components/LpPaletteHeader.vue.js +2 -2
- package/dist/components/LpPalettePreview.vue.js +1 -1
- package/dist/components/LpPaletteStats.vue.js +2 -2
- package/dist/components/LpPasswordInput.vue.d.ts +19 -2
- 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 +3 -1
- package/dist/components/LpRollingText.vue.js +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 +45 -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 +13 -0
- package/dist/composables/useField.js +26 -1
- package/dist/composables/useForm.js +32 -9
- 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 +64 -0
- package/dist/icons-all.js +1 -1
- package/dist/index.d.ts +98 -1
- package/dist/index.js +263 -105
- package/dist/theme/define.d.ts +12 -0
- package/dist/theme/studio.d.ts +90 -0
- package/package.json +8 -2
- package/src/component-names.ts +33 -0
- package/src/components/AttentionDot.vue +27 -0
- package/src/components/ContextMenuItems.vue +5 -2
- 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 +162 -171
- 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 +13 -3
- 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 +55 -104
- package/src/components/LpDateRangePicker.vue +51 -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 +11 -2
- package/src/components/LpDropzone.vue +34 -13
- package/src/components/LpEditable.vue +295 -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 +25 -18
- 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 +14 -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 +131 -0
- package/src/components/LpRevealOnScroll.vue +125 -0
- package/src/components/LpRollingText.vue +12 -1
- package/src/components/LpScramble.vue +107 -0
- package/src/components/LpSecretField.vue +320 -0
- package/src/components/LpSegmented.vue +3 -10
- package/src/components/LpSelect.vue +74 -65
- 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 +59 -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 +38 -1
- package/src/composables/useForm.ts +41 -11
- 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 +96 -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,39 @@
|
|
|
1
|
+
import { ref, watch, onBeforeUnmount } from "vue";
|
|
2
|
+
function useInView(options = {}) {
|
|
3
|
+
const el = ref(null);
|
|
4
|
+
const intersecting = ref(typeof IntersectionObserver === "undefined");
|
|
5
|
+
const pageVisible = ref(typeof document === "undefined" || document.visibilityState === "visible");
|
|
6
|
+
const inView = ref(false);
|
|
7
|
+
let observer = null;
|
|
8
|
+
const sync = () => inView.value = intersecting.value && pageVisible.value;
|
|
9
|
+
const onVisibility = () => {
|
|
10
|
+
pageVisible.value = document.visibilityState === "visible";
|
|
11
|
+
sync();
|
|
12
|
+
};
|
|
13
|
+
if (typeof document !== "undefined") document.addEventListener("visibilitychange", onVisibility);
|
|
14
|
+
watch(
|
|
15
|
+
el,
|
|
16
|
+
(node) => {
|
|
17
|
+
observer?.disconnect();
|
|
18
|
+
observer = null;
|
|
19
|
+
if (!node || typeof IntersectionObserver === "undefined") return sync();
|
|
20
|
+
observer = new IntersectionObserver(
|
|
21
|
+
(entries) => {
|
|
22
|
+
intersecting.value = entries.some((entry) => entry.isIntersecting);
|
|
23
|
+
sync();
|
|
24
|
+
},
|
|
25
|
+
{ rootMargin: options.rootMargin ?? "0px", threshold: options.threshold ?? 0 }
|
|
26
|
+
);
|
|
27
|
+
observer.observe(node);
|
|
28
|
+
},
|
|
29
|
+
{ immediate: true, flush: "post" }
|
|
30
|
+
);
|
|
31
|
+
onBeforeUnmount(() => {
|
|
32
|
+
observer?.disconnect();
|
|
33
|
+
if (typeof document !== "undefined") document.removeEventListener("visibilitychange", onVisibility);
|
|
34
|
+
});
|
|
35
|
+
return { el, inView };
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
useInView
|
|
39
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter, type Ref } from "vue";
|
|
2
|
+
export interface LoadingGateOptions {
|
|
3
|
+
/** Ms of loading before the indicator appears. */
|
|
4
|
+
delay?: MaybeRefOrGetter<number>;
|
|
5
|
+
/** Ms the indicator stays once shown, even if loading ends sooner. */
|
|
6
|
+
minVisible?: MaybeRefOrGetter<number>;
|
|
7
|
+
}
|
|
8
|
+
export declare function useLoadingGate(active: MaybeRefOrGetter<boolean>, options?: LoadingGateOptions): Ref<boolean>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ref, watch, toValue, onScopeDispose } from "vue";
|
|
2
|
+
function useLoadingGate(active, options = {}) {
|
|
3
|
+
const shown = ref(false);
|
|
4
|
+
let shownAt = 0;
|
|
5
|
+
let timer;
|
|
6
|
+
const clear = () => {
|
|
7
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
8
|
+
timer = void 0;
|
|
9
|
+
};
|
|
10
|
+
const show = () => {
|
|
11
|
+
clear();
|
|
12
|
+
shown.value = true;
|
|
13
|
+
shownAt = Date.now();
|
|
14
|
+
};
|
|
15
|
+
const settle = (on) => {
|
|
16
|
+
clear();
|
|
17
|
+
if (on) {
|
|
18
|
+
if (shown.value) return;
|
|
19
|
+
const wait = Math.max(0, toValue(options.delay) ?? 0);
|
|
20
|
+
if (wait === 0) show();
|
|
21
|
+
else timer = setTimeout(show, wait);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!shown.value) return;
|
|
25
|
+
const left = Math.max(0, toValue(options.minVisible) ?? 0) - (Date.now() - shownAt);
|
|
26
|
+
if (left <= 0) shown.value = false;
|
|
27
|
+
else timer = setTimeout(() => {
|
|
28
|
+
timer = void 0;
|
|
29
|
+
shown.value = false;
|
|
30
|
+
}, left);
|
|
31
|
+
};
|
|
32
|
+
watch(() => !!toValue(active), settle, { immediate: true });
|
|
33
|
+
onScopeDispose(clear);
|
|
34
|
+
return shown;
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
useLoadingGate
|
|
38
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type App, type Component, type ComputedRef, type InjectionKey, type MaybeRefOrGetter } from "vue";
|
|
2
|
+
import { type PseudoOptions } from "./pseudoLocale";
|
|
2
3
|
export type LabelScope = Record<string, string>;
|
|
3
4
|
export interface LpConfig {
|
|
4
5
|
/** Component rendered for internal links (RouterLink, NuxtLink). Plain `<a>` when unset. */
|
|
@@ -11,6 +12,15 @@ export interface LpConfig {
|
|
|
11
12
|
* desktop shell can hand in its own store. See `usePersisted`.
|
|
12
13
|
*/
|
|
13
14
|
storage?: KitStorage;
|
|
15
|
+
/**
|
|
16
|
+
* Show every kit label pseudo-localised ("Next" → "[Ñééẋţ]"): accented,
|
|
17
|
+
* about a third longer, and bracketed. A development switch for checking a
|
|
18
|
+
* screen before any translation exists: plain English left on it is text
|
|
19
|
+
* that never went through the labels, and anything clipped or overflowing
|
|
20
|
+
* will be in a real language too. `true` uses the defaults; an object tunes
|
|
21
|
+
* them (see `pseudoLocalize`).
|
|
22
|
+
*/
|
|
23
|
+
pseudoLocale?: boolean | PseudoOptions;
|
|
14
24
|
}
|
|
15
25
|
/**
|
|
16
26
|
* Synchronous key/value store, the shape of `localStorage`. Synchronous on
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed, inject, toValue, provide } from "vue";
|
|
2
|
+
import { pseudoLocalize } from "./pseudoLocale.js";
|
|
2
3
|
const LP_CONFIG = /* @__PURE__ */ Symbol.for("lp-config");
|
|
3
4
|
function provideLpConfig(config) {
|
|
4
5
|
provide(LP_CONFIG, layered(inject(LP_CONFIG, {}), config));
|
|
@@ -24,6 +25,7 @@ function mergeConfig(outer, inner) {
|
|
|
24
25
|
...inner,
|
|
25
26
|
linkComponent: inner.linkComponent ?? outer.linkComponent,
|
|
26
27
|
storage: inner.storage ?? outer.storage,
|
|
28
|
+
pseudoLocale: inner.pseudoLocale ?? outer.pseudoLocale,
|
|
27
29
|
labels
|
|
28
30
|
};
|
|
29
31
|
}
|
|
@@ -33,7 +35,15 @@ function useLpConfig() {
|
|
|
33
35
|
}
|
|
34
36
|
function useLabels(scope, defaults, own) {
|
|
35
37
|
const config = useLpConfig();
|
|
36
|
-
return computed(() =>
|
|
38
|
+
return computed(() => {
|
|
39
|
+
const labels = { ...defaults, ...config.value.labels?.[scope], ...own?.() };
|
|
40
|
+
const pseudo = config.value.pseudoLocale;
|
|
41
|
+
if (!pseudo) return labels;
|
|
42
|
+
const options = pseudo === true ? void 0 : pseudo;
|
|
43
|
+
return Object.fromEntries(
|
|
44
|
+
Object.entries(labels).map(([key, text]) => [key, typeof text === "string" ? pseudoLocalize(text, options) : text])
|
|
45
|
+
);
|
|
46
|
+
});
|
|
37
47
|
}
|
|
38
48
|
function useLinkComponent() {
|
|
39
49
|
const config = useLpConfig();
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ref, onMounted, onBeforeUnmount } from "vue";
|
|
2
|
+
import { useView, viewWindow } from "./useView.js";
|
|
2
3
|
function useMediaQuery(query) {
|
|
4
|
+
const view = useView();
|
|
3
5
|
const matches = ref(false);
|
|
4
6
|
let list;
|
|
5
7
|
const update = () => {
|
|
6
8
|
matches.value = !!list?.matches;
|
|
7
9
|
};
|
|
8
10
|
onMounted(() => {
|
|
9
|
-
list =
|
|
11
|
+
list = viewWindow(view.value).matchMedia?.(query);
|
|
10
12
|
update();
|
|
11
13
|
list?.addEventListener("change", update);
|
|
12
14
|
});
|
|
@@ -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;
|