motionary 14.2.0 → 14.4.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/CHANGELOG.md +108 -0
- package/README.md +10 -2
- package/README_ja.md +1 -1
- package/README_zh.md +1 -1
- package/bin/public-paths.mjs +4 -0
- package/dist/chunks/{anim-image-DkioZN9X.js → anim-image-C90aEUEU.js} +2 -2
- package/dist/chunks/{anim-image-CHdhCFU7.cjs → anim-image-Cv3XeE0I.cjs} +2 -2
- package/dist/chunks/audio-D0LwPShE.cjs +1 -1
- package/dist/chunks/audio-D7mfQAUI.js +1 -1
- package/dist/chunks/badge-wall-CITexuW7.cjs +1 -1
- package/dist/chunks/badge-wall-TxNk_TTE.js +1 -1
- package/dist/chunks/base-BvH4nAcv.cjs +1 -1
- package/dist/chunks/base-ByyAdGqz.js +1 -1
- package/dist/chunks/bg-generator-BJ0Obz4R.js +1 -1
- package/dist/chunks/bg-generator-CML8tPN8.cjs +1 -1
- package/dist/chunks/bind-B_CTL6Qn.js +1 -1
- package/dist/chunks/bind-Ui43-n2d.cjs +1 -1
- package/dist/chunks/builtins-CpH2mTyp.js +1 -1
- package/dist/chunks/builtins-DweCp29Z.cjs +1 -1
- package/dist/chunks/carousel-Bdl2DpWW.js +1 -1
- package/dist/chunks/carousel-DU3rHTq0.cjs +1 -1
- package/dist/chunks/cart-drawer-CkFMKMhx.cjs +1 -1
- package/dist/chunks/cart-drawer-S3X_-dcv.js +1 -1
- package/dist/chunks/code-export-DwrlLHA5.js +1 -1
- package/dist/chunks/code-export-PdGSl9WE.cjs +1 -1
- package/dist/chunks/color-picker-B_xWVH8H.cjs +1 -1
- package/dist/chunks/color-picker-C2PH87yD.js +1 -1
- package/dist/chunks/command-palette-7lHRJzV1.js +1 -1
- package/dist/chunks/command-palette-ISetAeX1.cjs +1 -1
- package/dist/chunks/core-BPPcJVGQ.js +1 -1
- package/dist/chunks/core-BjcOCpJt.cjs +1 -1
- package/dist/chunks/core-CfuLPjGf.js +1 -1
- package/dist/chunks/core-DbAYRKnS.cjs +1 -1
- package/dist/chunks/core-Dj6iomdc.js +1 -1
- package/dist/chunks/core-DjjKLmZ6.cjs +1 -1
- package/dist/chunks/countdown-C4M4Ymbd.js +1 -1
- package/dist/chunks/countdown-RQViryt7.cjs +1 -1
- package/dist/chunks/date-picker-BgApzPNn.cjs +1 -1
- package/dist/chunks/date-picker-D1FhYimW.js +1 -1
- package/dist/chunks/ease-HwYZnZat.cjs +1 -1
- package/dist/chunks/ease-XN8_0sXu.js +1 -1
- package/dist/chunks/equalizer-Dxl2dMWN.js +1 -1
- package/dist/chunks/equalizer-_eD_ZdCl.cjs +1 -1
- package/dist/chunks/festival-banner-Bs18K0MJ.cjs +1 -1
- package/dist/chunks/festival-banner-RkIBAUue.js +1 -1
- package/dist/chunks/field-B_JKBZ66.js +1 -1
- package/dist/chunks/field-Dwq8-CLN.cjs +1 -1
- package/dist/chunks/format-DrRrPbjl.cjs +1 -1
- package/dist/chunks/{format-ClNijrhe.js → format-xyZDr-fG.js} +2 -2
- package/dist/chunks/fx-DaVuB89C.cjs +1 -1
- package/dist/chunks/fx-lkOk6ZLK.js +1 -1
- package/dist/chunks/generative-BKoxWOSP.cjs +1 -1
- package/dist/chunks/generative-CbMIaqxn.js +1 -1
- package/dist/chunks/{gl-scene-Btp6k9ym.cjs → gl-scene-BWEuB7Dy.cjs} +2 -2
- package/dist/chunks/{gl-scene-6k5slLJ1.js → gl-scene-CfY6ZPpo.js} +2 -2
- package/dist/chunks/globe-DA0jyb6s.cjs +1 -1
- package/dist/chunks/globe-ejBBHY6v.js +1 -1
- package/dist/chunks/gpu-C0vrwBcn.js +1 -1
- package/dist/chunks/gpu-C2C6iBQC.cjs +1 -1
- package/dist/chunks/gpu-particles-BvUfEndq.js +1 -1
- package/dist/chunks/gpu-particles-wEO_rds1.cjs +1 -1
- package/dist/chunks/history-CLzpNgGy.cjs +470 -0
- package/dist/chunks/history-DYSOAKH5.js +449 -0
- package/dist/chunks/index-C9_FEsfz.cjs +1 -1
- package/dist/chunks/index-gwb-TO6r.js +1 -1
- package/dist/chunks/index-tags-B-JBecYg.js +1 -1
- package/dist/chunks/index-tags-hLIF2Clq.cjs +1 -1
- package/dist/chunks/key-click-BLm3BI8_.js +1 -1
- package/dist/chunks/key-click-v7I4K5Sr.cjs +1 -1
- package/dist/chunks/{keyframes-Dqk1X3Q5.cjs → keyframes-Biqj3_4d.cjs} +2 -2
- package/dist/chunks/{keyframes-BikOcXxh.js → keyframes-Czg-ppwY.js} +2 -2
- package/dist/chunks/leaderboard-BmACkMks.js +1 -1
- package/dist/chunks/leaderboard-DvSSQ8o3.cjs +1 -1
- package/dist/chunks/location-card-9SyNFFc7.js +1 -1
- package/dist/chunks/location-card-DSPTApUe.cjs +1 -1
- package/dist/chunks/lottie-icon-BoxkukMd.cjs +1 -1
- package/dist/chunks/lottie-icon-CGG_tfjT.js +1 -1
- package/dist/chunks/{lottie-player-DbEnSefT.cjs → lottie-player-CadcuqBD.cjs} +2 -2
- package/dist/chunks/{lottie-player-CwD15LsB.js → lottie-player-Cl99nJUM.js} +2 -2
- package/dist/chunks/lyrics-CRB7dA1j.cjs +1 -1
- package/dist/chunks/lyrics-D7iF9I0S.js +1 -1
- package/dist/chunks/manifest-i1lnR0qJ.js +1 -1
- package/dist/chunks/manifest-xr3WET80.cjs +1 -1
- package/dist/chunks/menu-CZ1zHTT9.cjs +1 -1
- package/dist/chunks/menu-DrQfp6bJ.js +1 -1
- package/dist/chunks/menu-toggle-DGXN4VsN.cjs +1 -1
- package/dist/chunks/menu-toggle-DI8fAtZ0.js +1 -1
- package/dist/chunks/nav-morph-C4rD3wrU.cjs +1 -1
- package/dist/chunks/nav-morph-CBZ5HXQo.js +1 -1
- package/dist/chunks/otp-C1l7yq3_.js +1 -1
- package/dist/chunks/otp-DUyEWYMi.cjs +1 -1
- package/dist/chunks/pagination-DHmYZZU9.cjs +1 -1
- package/dist/chunks/pagination-JG7Hw-q-.js +1 -1
- package/dist/chunks/{physics-playground-D4pkMRhy.js → physics-playground-TCy4CZZP.js} +2 -2
- package/dist/chunks/{physics-playground-CxN5MmrO.cjs → physics-playground-emNzCmHD.cjs} +2 -2
- package/dist/chunks/{play-CkjaaN6e.js → play-C0s-Tm6f.js} +2 -2
- package/dist/chunks/play-DCeKlDqE.cjs +1 -1
- package/dist/chunks/{player-DkhZKVZX.js → player-AcMlL3g3.js} +2 -2
- package/dist/chunks/player-BJPVdtzo.cjs +1 -1
- package/dist/chunks/player-core-BGIt5Gzl.js +1 -1
- package/dist/chunks/player-core-BTFa6_IO.cjs +1 -1
- package/dist/chunks/presence-BQ2mRjpt.js +1 -1
- package/dist/chunks/presence-DAthlALi.cjs +1 -1
- package/dist/chunks/presets-BYBVJVeP.js +1 -1
- package/dist/chunks/presets-CUHys3sK.cjs +1 -1
- package/dist/chunks/preview-C0qDmRNm.js +208 -0
- package/dist/chunks/preview-CyTKsXQP.cjs +213 -0
- package/dist/chunks/prize-wheel-B5YpUMgr.js +1 -1
- package/dist/chunks/prize-wheel-emDopI5c.cjs +1 -1
- package/dist/chunks/product-gallery-BpJEGKIw.js +1 -1
- package/dist/chunks/product-gallery-CKtSVhZk.cjs +1 -1
- package/dist/chunks/progress-ring-C75O4MUi.cjs +1 -1
- package/dist/chunks/progress-ring-CRSbrt2I.js +1 -1
- package/dist/chunks/prop-panel-D4DEkdXL.js +1 -1
- package/dist/chunks/prop-panel-DFqga6H5.cjs +1 -1
- package/dist/chunks/radar-D-bZRrgs.cjs +1 -1
- package/dist/chunks/radar-DE_QcCUX.js +1 -1
- package/dist/chunks/reactions-BL2iO8iy.cjs +1 -1
- package/dist/chunks/reactions-BV57Pw0R.js +1 -1
- package/dist/chunks/{registry-BCFobMY2.js → registry-Bf0vrAy1.js} +2 -2
- package/dist/chunks/registry-CibnX7Ui.cjs +1 -1
- package/dist/chunks/registry-RLD_spxR.js +1 -1
- package/dist/chunks/{registry-Cy7Nk97K.cjs → registry-s4yL_aQj.cjs} +2 -2
- package/dist/chunks/retro-button-CrbkhjHv.js +1 -1
- package/dist/chunks/retro-button-DrrBZ6w8.cjs +1 -1
- package/dist/chunks/rive-Bt5R5BjT.js +1 -1
- package/dist/chunks/rive-D6X4J0Mi.cjs +1 -1
- package/dist/chunks/{runtime-link-BWMZB3tC.cjs → runtime-link-CO7s1v7-.cjs} +2 -2
- package/dist/chunks/{runtime-link-3fqOLtwH.js → runtime-link-DY1IVAdN.js} +2 -2
- package/dist/chunks/{scene-Bc03O1V2.js → scene-BlBhOYVs.js} +3 -3
- package/dist/chunks/scene-C4h75wjo.cjs +1 -1
- package/dist/chunks/scroll-driven-CQbwzCdn.cjs +1 -1
- package/dist/chunks/scroll-driven-LghshrWq.js +1 -1
- package/dist/chunks/{scroll-scene-Xk4OKyWQ.cjs → scroll-scene-9q0f0-ry.cjs} +3 -3
- package/dist/chunks/{scroll-scene-CmvOpk6I.js → scroll-scene-fXFb6QAx.js} +3 -3
- package/dist/chunks/segmented-Bqxe4qRo.js +1 -1
- package/dist/chunks/segmented-CpB4mKIn.cjs +1 -1
- package/dist/chunks/shader-backdrop-BodjXMhw.cjs +1 -1
- package/dist/chunks/shader-backdrop-C49tKiU1.js +1 -1
- package/dist/chunks/shared-Bf72wLyt.cjs +1 -1
- package/dist/chunks/shared-CkKHWrtJ.js +1 -1
- package/dist/chunks/shared-jkgRH-Hx.cjs +1 -1
- package/dist/chunks/shared-o9CtwHmi.js +1 -1
- package/dist/chunks/sheet-B38ylIEW.cjs +1 -1
- package/dist/chunks/sheet-DZXot7SV.js +1 -1
- package/dist/chunks/sign-DvZ1jHxE.js +1 -1
- package/dist/chunks/sign-RAkQIWrM.cjs +1 -1
- package/dist/chunks/skeleton-reveal-CMqfJYM2.js +1 -1
- package/dist/chunks/skeleton-reveal-Dsd3Wp0n.cjs +1 -1
- package/dist/chunks/sparkline-3fxOzufX.js +1 -1
- package/dist/chunks/sparkline-DeKhZpVo.cjs +1 -1
- package/dist/chunks/spring-CLwlIQHm.js +1 -1
- package/dist/chunks/spring-XEl_diDJ.cjs +1 -1
- package/dist/chunks/stagger-B9sKPwQB.js +1 -1
- package/dist/chunks/stagger-DFKwqOQG.cjs +1 -1
- package/dist/chunks/suggestion-chips-BwKPsDra.js +1 -1
- package/dist/chunks/suggestion-chips-CAcbFTr4.cjs +1 -1
- package/dist/chunks/switch-CMtM5gqP.js +1 -1
- package/dist/chunks/switch-DiTlApGd.cjs +1 -1
- package/dist/chunks/tab-bar-BBlVAqbq.cjs +1 -1
- package/dist/chunks/tab-bar-COPkxGY6.js +1 -1
- package/dist/chunks/{ticker-DQIpLv48.js → ticker-C7KRT80i.js} +2 -2
- package/dist/chunks/{ticker-crNxbg2p.cjs → ticker-Clrkk12S.cjs} +2 -2
- package/dist/chunks/tip-D4DdDz83.js +1 -1
- package/dist/chunks/tip-VGS3qAUm.cjs +1 -1
- package/dist/chunks/toast-stack-Cx1aTwf5.js +1 -1
- package/dist/chunks/toast-stack-DprisNp_.cjs +1 -1
- package/dist/chunks/{tween-CnVJt41b.cjs → tween-Bnr2kPhW.cjs} +2 -2
- package/dist/chunks/{tween-Bx-UetkK.js → tween-C3K0CIlX.js} +2 -2
- package/dist/chunks/upload-progress-CEAWkP-p.cjs +1 -1
- package/dist/chunks/upload-progress-Px_Zdd9c.js +1 -1
- package/dist/chunks/variants-BV9wFxiP.js +1 -1
- package/dist/chunks/variants-BtqEJuki.cjs +1 -1
- package/dist/chunks/viewport-BAXHhZLV.js +1 -1
- package/dist/chunks/viewport-EFYGqMNa.cjs +1 -1
- package/dist/chunks/voice-button-9UauxvT9.cjs +1 -1
- package/dist/chunks/voice-button-CmbZldLT.js +1 -1
- package/dist/chunks/weather-card-4Eg6e43D.cjs +1 -1
- package/dist/chunks/weather-card-BdvgvAxQ.js +1 -1
- package/dist/chunks/worker-canvas-BLXaLvtq.js +1 -1
- package/dist/chunks/worker-canvas-BMBXAFWp.cjs +1 -1
- package/dist/chunks/xp-bar-CjOalkPm.js +1 -1
- package/dist/chunks/xp-bar-DkWfCTfB.cjs +1 -1
- package/dist/components/a11y.cjs +1 -1
- package/dist/components/a11y.js +1 -1
- package/dist/components/ai.cjs +1 -1
- package/dist/components/ai.js +1 -1
- package/dist/components/angular.cjs +1 -1
- package/dist/components/angular.js +1 -1
- package/dist/components/background.cjs +1 -1
- package/dist/components/background.js +1 -1
- package/dist/components/bridge.cjs +1 -1
- package/dist/components/bridge.js +1 -1
- package/dist/components/cards.cjs +1 -1
- package/dist/components/cards.js +1 -1
- package/dist/components/click.cjs +1 -1
- package/dist/components/click.js +1 -1
- package/dist/components/compat-v13.cjs +1 -1
- package/dist/components/compat-v13.js +2 -2
- package/dist/components/core.cjs +1 -1
- package/dist/components/core.js +1 -1
- package/dist/components/depth.cjs +1 -1
- package/dist/components/depth.js +1 -1
- package/dist/components/design.cjs +1 -1
- package/dist/components/design.js +1 -1
- package/dist/components/dotlottie.cjs +3 -3
- package/dist/components/dotlottie.js +3 -3
- package/dist/components/dsl.cjs +1 -1
- package/dist/components/dsl.js +1 -1
- package/dist/components/effects.cjs +1 -1
- package/dist/components/effects.js +3 -3
- package/dist/components/engine.cjs +1 -1
- package/dist/components/engine.js +1 -1
- package/dist/components/feedback.cjs +1 -1
- package/dist/components/feedback.js +1 -1
- package/dist/components/fx-3d.cjs +1 -1
- package/dist/components/fx-3d.js +1 -1
- package/dist/components/fx-ai.cjs +1 -1
- package/dist/components/fx-ai.js +1 -1
- package/dist/components/fx-chart.cjs +1 -1
- package/dist/components/fx-chart.js +1 -1
- package/dist/components/fx-cinema.cjs +1 -1
- package/dist/components/fx-cinema.js +1 -1
- package/dist/components/fx-cyber.cjs +1 -1
- package/dist/components/fx-cyber.js +1 -1
- package/dist/components/fx-festival.cjs +1 -1
- package/dist/components/fx-festival.js +1 -1
- package/dist/components/fx-focus.cjs +1 -1
- package/dist/components/fx-focus.js +1 -1
- package/dist/components/fx-form.cjs +1 -1
- package/dist/components/fx-form.js +1 -1
- package/dist/components/fx-game.cjs +1 -1
- package/dist/components/fx-game.js +1 -1
- package/dist/components/fx-genart.cjs +1 -1
- package/dist/components/fx-genart.js +1 -1
- package/dist/components/fx-geo.cjs +1 -1
- package/dist/components/fx-geo.js +1 -1
- package/dist/components/fx-gesture.cjs +1 -1
- package/dist/components/fx-gesture.js +1 -1
- package/dist/components/fx-gpu.cjs +1 -1
- package/dist/components/fx-gpu.js +1 -1
- package/dist/components/fx-light.cjs +1 -1
- package/dist/components/fx-light.js +1 -1
- package/dist/components/fx-lottie.cjs +1 -1
- package/dist/components/fx-lottie.js +1 -1
- package/dist/components/fx-morph.cjs +1 -1
- package/dist/components/fx-morph.js +1 -1
- package/dist/components/fx-music.cjs +1 -1
- package/dist/components/fx-music.js +1 -1
- package/dist/components/fx-organic.cjs +1 -1
- package/dist/components/fx-organic.js +1 -1
- package/dist/components/fx-paper.cjs +1 -1
- package/dist/components/fx-paper.js +1 -1
- package/dist/components/fx-perf.cjs +1 -1
- package/dist/components/fx-perf.js +1 -1
- package/dist/components/fx-physics.cjs +1 -1
- package/dist/components/fx-physics.js +1 -1
- package/dist/components/fx-retro.cjs +1 -1
- package/dist/components/fx-retro.js +1 -1
- package/dist/components/fx-safe.cjs +1 -1
- package/dist/components/fx-safe.js +1 -1
- package/dist/components/fx-shop.cjs +1 -1
- package/dist/components/fx-shop.js +1 -1
- package/dist/components/fx-social.cjs +1 -1
- package/dist/components/fx-social.js +1 -1
- package/dist/components/fx-spatial.cjs +1 -1
- package/dist/components/fx-spatial.js +1 -1
- package/dist/components/fx-surface.cjs +1 -1
- package/dist/components/fx-surface.js +1 -1
- package/dist/components/fx-text.cjs +1 -1
- package/dist/components/fx-text.js +1 -1
- package/dist/components/fx-transitions.cjs +1 -1
- package/dist/components/fx-transitions.js +1 -1
- package/dist/components/fx-video.cjs +1 -1
- package/dist/components/fx-video.js +1 -1
- package/dist/components/fx-weather.cjs +1 -1
- package/dist/components/fx-weather.js +1 -1
- package/dist/components/fx.cjs +1 -1
- package/dist/components/fx.js +1 -1
- package/dist/components/fx2.cjs +1 -1
- package/dist/components/fx2.js +1 -1
- package/dist/components/gesture.cjs +1 -1
- package/dist/components/gesture.js +1 -1
- package/dist/components/gl-model.cjs +3 -3
- package/dist/components/gl-model.js +3 -3
- package/dist/components/gl-pool.cjs +1 -1
- package/dist/components/gl-pool.js +1 -1
- package/dist/components/interaction.cjs +1 -1
- package/dist/components/interaction.js +1 -1
- package/dist/components/jsx.cjs +1 -1
- package/dist/components/jsx.js +1 -1
- package/dist/components/layout.cjs +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/lazy.cjs +1 -1
- package/dist/components/lazy.js +1 -1
- package/dist/components/lite.cjs +1 -1
- package/dist/components/lite.js +1 -1
- package/dist/components/marketplace.cjs +1 -1
- package/dist/components/marketplace.js +1 -1
- package/dist/components/motion-layout.cjs +1 -1
- package/dist/components/motion-layout.js +1 -1
- package/dist/components/motion-scene.cjs +1 -1
- package/dist/components/motion-scene.js +2 -2
- package/dist/components/motion-tokens.cjs +1 -1
- package/dist/components/motion-tokens.js +1 -1
- package/dist/components/motion.cjs +1 -1
- package/dist/components/motion.js +1 -1
- package/dist/components/native.cjs +1 -1
- package/dist/components/native.js +1 -1
- package/dist/components/offscreen.cjs +1 -1
- package/dist/components/offscreen.js +1 -1
- package/dist/components/packs.cjs +1 -1
- package/dist/components/packs.js +1 -1
- package/dist/components/page.cjs +1 -1
- package/dist/components/page.js +1 -1
- package/dist/components/perf-tasks.cjs +1 -1
- package/dist/components/perf-tasks.js +1 -1
- package/dist/components/perf.cjs +1 -1
- package/dist/components/perf.js +1 -1
- package/dist/components/physics.cjs +1 -1
- package/dist/components/physics.js +1 -1
- package/dist/components/plugins.cjs +1 -1
- package/dist/components/plugins.js +1 -1
- package/dist/components/react.cjs +1 -1
- package/dist/components/react.js +1 -1
- package/dist/components/reveal.cjs +1 -1
- package/dist/components/reveal.js +1 -1
- package/dist/components/scene-v2.cjs +1 -1
- package/dist/components/scene-v2.js +3 -3
- package/dist/components/snap-carousel.cjs +2 -2
- package/dist/components/snap-carousel.js +2 -2
- package/dist/components/solid.cjs +1 -1
- package/dist/components/solid.js +1 -1
- package/dist/components/studio-canvas.cjs +998 -0
- package/dist/components/studio-canvas.d.cts +377 -0
- package/dist/components/studio-canvas.d.ts +377 -0
- package/dist/components/studio-canvas.js +978 -0
- package/dist/components/studio.cjs +1024 -0
- package/dist/components/studio.d.cts +502 -0
- package/dist/components/studio.d.ts +502 -0
- package/dist/components/studio.js +1009 -0
- package/dist/components/svelte.cjs +1 -1
- package/dist/components/svelte.js +1 -1
- package/dist/components/svg.cjs +1 -1
- package/dist/components/svg.js +1 -1
- package/dist/components/text.cjs +1 -1
- package/dist/components/text.js +1 -1
- package/dist/components/timeline-editor.cjs +27 -674
- package/dist/components/timeline-editor.js +6 -654
- package/dist/components/timeline.cjs +1 -1
- package/dist/components/timeline.js +1 -1
- package/dist/components/tokens.cjs +1 -1
- package/dist/components/tokens.js +1 -1
- package/dist/components/transitions.cjs +1 -1
- package/dist/components/transitions.js +1 -1
- package/dist/components/ui.cjs +1 -1
- package/dist/components/ui.js +1 -1
- package/dist/components/vue.cjs +1 -1
- package/dist/components/vue.js +1 -1
- package/dist/components/webgl.cjs +1 -1
- package/dist/components/webgl.js +1 -1
- package/dist/components/widgets.cjs +5 -5
- package/dist/components/widgets.js +7 -7
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/components.umd.js +1 -1
- package/dist/effects/achievement-unlock.cjs +1 -1
- package/dist/effects/achievement-unlock.js +1 -1
- package/dist/effects/aurora-veil.cjs +1 -1
- package/dist/effects/aurora-veil.js +1 -1
- package/dist/effects/badge-pop.cjs +1 -1
- package/dist/effects/badge-pop.js +1 -1
- package/dist/effects/bars-grow.cjs +1 -1
- package/dist/effects/bars-grow.js +1 -1
- package/dist/effects/beat-bounce.cjs +1 -1
- package/dist/effects/beat-bounce.js +1 -1
- package/dist/effects/blob-button.cjs +1 -1
- package/dist/effects/blob-button.js +1 -1
- package/dist/effects/bloom.cjs +1 -1
- package/dist/effects/bloom.js +1 -1
- package/dist/effects/breathe.cjs +1 -1
- package/dist/effects/breathe.js +1 -1
- package/dist/effects/brushed-metal.cjs +1 -1
- package/dist/effects/brushed-metal.js +1 -1
- package/dist/effects/camera-dolly.cjs +1 -1
- package/dist/effects/camera-dolly.js +1 -1
- package/dist/effects/card-flip-3d.cjs +1 -1
- package/dist/effects/card-flip-3d.js +1 -1
- package/dist/effects/chest-open.cjs +1 -1
- package/dist/effects/chest-open.js +1 -1
- package/dist/effects/cloth.cjs +1 -1
- package/dist/effects/cloth.js +1 -1
- package/dist/effects/coin-burst.cjs +1 -1
- package/dist/effects/coin-burst.js +1 -1
- package/dist/effects/color-pulse.cjs +1 -1
- package/dist/effects/color-pulse.js +1 -1
- package/dist/effects/crt-power.cjs +1 -1
- package/dist/effects/crt-power.js +1 -1
- package/dist/effects/crumple.cjs +1 -1
- package/dist/effects/crumple.js +1 -1
- package/dist/effects/data-decode.cjs +1 -1
- package/dist/effects/data-decode.js +1 -1
- package/dist/effects/day-cycle.cjs +1 -1
- package/dist/effects/day-cycle.js +1 -1
- package/dist/effects/depth-in.cjs +1 -1
- package/dist/effects/depth-in.js +1 -1
- package/dist/effects/depth-pop.cjs +1 -1
- package/dist/effects/depth-pop.js +1 -1
- package/dist/effects/depth-stack.cjs +1 -1
- package/dist/effects/depth-stack.js +1 -1
- package/dist/effects/dolly-in.cjs +1 -1
- package/dist/effects/dolly-in.js +1 -1
- package/dist/effects/dots-pop.cjs +1 -1
- package/dist/effects/dots-pop.js +1 -1
- package/dist/effects/field-shake.cjs +1 -1
- package/dist/effects/field-shake.js +1 -1
- package/dist/effects/field-success.cjs +1 -1
- package/dist/effects/field-success.js +1 -1
- package/dist/effects/film-burn.cjs +1 -1
- package/dist/effects/film-burn.js +1 -1
- package/dist/effects/fire.cjs +1 -1
- package/dist/effects/fire.js +1 -1
- package/dist/effects/fireflies.cjs +1 -1
- package/dist/effects/fireflies.js +1 -1
- package/dist/effects/firework-burst.cjs +1 -1
- package/dist/effects/firework-burst.js +1 -1
- package/dist/effects/flip-chars.cjs +1 -1
- package/dist/effects/flip-chars.js +1 -1
- package/dist/effects/fluid.cjs +1 -1
- package/dist/effects/fluid.js +1 -1
- package/dist/effects/fly-to-cart.cjs +1 -1
- package/dist/effects/fly-to-cart.js +1 -1
- package/dist/effects/focus-draw.cjs +1 -1
- package/dist/effects/focus-draw.js +1 -1
- package/dist/effects/focus-glow.cjs +1 -1
- package/dist/effects/focus-glow.js +1 -1
- package/dist/effects/fog.cjs +1 -1
- package/dist/effects/fog.js +1 -1
- package/dist/effects/font-breathe.cjs +1 -1
- package/dist/effects/font-breathe.js +1 -1
- package/dist/effects/form-cascade.cjs +1 -1
- package/dist/effects/form-cascade.js +1 -1
- package/dist/effects/gen-skeleton.cjs +1 -1
- package/dist/effects/gen-skeleton.js +1 -1
- package/dist/effects/glass-frost.cjs +1 -1
- package/dist/effects/glass-frost.js +1 -1
- package/dist/effects/glitch-text.cjs +1 -1
- package/dist/effects/glitch-text.js +1 -1
- package/dist/effects/globe-spin.cjs +1 -1
- package/dist/effects/globe-spin.js +1 -1
- package/dist/effects/god-rays.cjs +1 -1
- package/dist/effects/god-rays.js +1 -1
- package/dist/effects/gpu-lift.cjs +1 -1
- package/dist/effects/gpu-lift.js +1 -1
- package/dist/effects/grain-flicker.cjs +1 -1
- package/dist/effects/grain-flicker.js +1 -1
- package/dist/effects/halftone-in.cjs +1 -1
- package/dist/effects/halftone-in.js +1 -1
- package/dist/effects/highlight-sweep.cjs +1 -1
- package/dist/effects/highlight-sweep.js +1 -1
- package/dist/effects/hologram.cjs +1 -1
- package/dist/effects/hologram.js +1 -1
- package/dist/effects/hud-frame.cjs +1 -1
- package/dist/effects/hud-frame.js +1 -1
- package/dist/effects/icon-pop.cjs +1 -1
- package/dist/effects/icon-pop.js +1 -1
- package/dist/effects/icon-swap.cjs +1 -1
- package/dist/effects/icon-swap.js +1 -1
- package/dist/effects/idle-reveal.cjs +1 -1
- package/dist/effects/idle-reveal.js +1 -1
- package/dist/effects/ink.cjs +1 -1
- package/dist/effects/ink.js +1 -1
- package/dist/effects/jump-cut.cjs +1 -1
- package/dist/effects/jump-cut.js +1 -1
- package/dist/effects/kaleido.cjs +1 -1
- package/dist/effects/kaleido.js +1 -1
- package/dist/effects/label-float.cjs +1 -1
- package/dist/effects/label-float.js +1 -1
- package/dist/effects/lantern-rise.cjs +1 -1
- package/dist/effects/lantern-rise.js +1 -1
- package/dist/effects/leaves.cjs +1 -1
- package/dist/effects/leaves.js +1 -1
- package/dist/effects/letterbox.cjs +1 -1
- package/dist/effects/letterbox.js +1 -1
- package/dist/effects/level-up.cjs +1 -1
- package/dist/effects/level-up.js +1 -1
- package/dist/effects/light-follow.cjs +1 -1
- package/dist/effects/light-follow.js +1 -1
- package/dist/effects/lightning.cjs +1 -1
- package/dist/effects/lightning.js +1 -1
- package/dist/effects/line-draw.cjs +1 -1
- package/dist/effects/line-draw.js +1 -1
- package/dist/effects/liquid-text.cjs +1 -1
- package/dist/effects/liquid-text.js +1 -1
- package/dist/effects/liquid-wipe.cjs +1 -1
- package/dist/effects/liquid-wipe.js +1 -1
- package/dist/effects/lottie-play.cjs +1 -1
- package/dist/effects/lottie-play.js +1 -1
- package/dist/effects/magnet.cjs +1 -1
- package/dist/effects/magnet.js +1 -1
- package/dist/effects/marching-ants.cjs +1 -1
- package/dist/effects/marching-ants.js +1 -1
- package/dist/effects/marker-pulse.cjs +1 -1
- package/dist/effects/marker-pulse.js +1 -1
- package/dist/effects/mention-glow.cjs +1 -1
- package/dist/effects/mention-glow.js +1 -1
- package/dist/effects/mesh-drift.cjs +1 -1
- package/dist/effects/mesh-drift.js +1 -1
- package/dist/effects/message-in.cjs +1 -1
- package/dist/effects/message-in.js +1 -1
- package/dist/effects/mosaic-flip.cjs +1 -1
- package/dist/effects/mosaic-flip.js +1 -1
- package/dist/effects/neon-ignite.cjs +1 -1
- package/dist/effects/neon-ignite.js +1 -1
- package/dist/effects/neon-pulse.cjs +1 -1
- package/dist/effects/neon-pulse.js +1 -1
- package/dist/effects/neon-write.cjs +1 -1
- package/dist/effects/neon-write.js +1 -1
- package/dist/effects/neu-press.cjs +1 -1
- package/dist/effects/neu-press.js +1 -1
- package/dist/effects/noise-reveal.cjs +1 -1
- package/dist/effects/noise-reveal.js +1 -1
- package/dist/effects/number-roll.cjs +1 -1
- package/dist/effects/number-roll.js +1 -1
- package/dist/effects/orbit-camera.cjs +1 -1
- package/dist/effects/orbit-camera.js +1 -1
- package/dist/effects/orbit-in.cjs +1 -1
- package/dist/effects/orbit-in.js +1 -1
- package/dist/effects/origami.cjs +1 -1
- package/dist/effects/origami.js +1 -1
- package/dist/effects/page-curl.cjs +1 -1
- package/dist/effects/page-curl.js +1 -1
- package/dist/effects/pan-reveal.cjs +1 -1
- package/dist/effects/pan-reveal.js +1 -1
- package/dist/effects/paper-unfold.cjs +1 -1
- package/dist/effects/paper-unfold.js +1 -1
- package/dist/effects/particle-text.cjs +1 -1
- package/dist/effects/particle-text.js +1 -1
- package/dist/effects/path-morph.cjs +1 -1
- package/dist/effects/path-morph.js +1 -1
- package/dist/effects/pearlescent.cjs +1 -1
- package/dist/effects/pearlescent.js +1 -1
- package/dist/effects/pencil-sketch.cjs +1 -1
- package/dist/effects/pencil-sketch.js +1 -1
- package/dist/effects/pin-drop.cjs +1 -1
- package/dist/effects/pin-drop.js +1 -1
- package/dist/effects/pinball.cjs +1 -1
- package/dist/effects/pinball.js +1 -1
- package/dist/effects/pinch-hint.cjs +1 -1
- package/dist/effects/pinch-hint.js +1 -1
- package/dist/effects/pixelate-in.cjs +1 -1
- package/dist/effects/pixelate-in.js +1 -1
- package/dist/effects/pointer-shadow.cjs +1 -1
- package/dist/effects/pointer-shadow.js +1 -1
- package/dist/effects/portal-open.cjs +1 -1
- package/dist/effects/portal-open.js +1 -1
- package/dist/effects/price-flip.cjs +1 -1
- package/dist/effects/price-flip.js +1 -1
- package/dist/effects/product-spin.cjs +1 -1
- package/dist/effects/product-spin.js +1 -1
- package/dist/effects/rack-focus.cjs +1 -1
- package/dist/effects/rack-focus.js +1 -1
- package/dist/effects/radial-spectrum.cjs +1 -1
- package/dist/effects/radial-spectrum.js +1 -1
- package/dist/effects/rain-glass.cjs +1 -1
- package/dist/effects/rain-glass.js +1 -1
- package/dist/effects/reaction-burst.cjs +1 -1
- package/dist/effects/reaction-burst.js +1 -1
- package/dist/effects/read-receipt.cjs +1 -1
- package/dist/effects/read-receipt.js +1 -1
- package/dist/effects/refraction.cjs +1 -1
- package/dist/effects/refraction.js +1 -1
- package/dist/effects/ring-sweep.cjs +1 -1
- package/dist/effects/ring-sweep.js +1 -1
- package/dist/effects/ripple-dissolve.cjs +1 -1
- package/dist/effects/ripple-dissolve.js +1 -1
- package/dist/effects/rope.cjs +1 -1
- package/dist/effects/rope.js +1 -1
- package/dist/effects/route-draw.cjs +1 -1
- package/dist/effects/route-draw.js +1 -1
- package/dist/effects/safe-fade.cjs +1 -1
- package/dist/effects/safe-fade.js +1 -1
- package/dist/effects/sakura.cjs +1 -1
- package/dist/effects/sakura.js +1 -1
- package/dist/effects/sale-shine.cjs +1 -1
- package/dist/effects/sale-shine.js +1 -1
- package/dist/effects/sankey-flow.cjs +1 -1
- package/dist/effects/sankey-flow.js +1 -1
- package/dist/effects/scanline-sweep.cjs +1 -1
- package/dist/effects/scanline-sweep.js +1 -1
- package/dist/effects/shatter.cjs +1 -1
- package/dist/effects/shatter.js +1 -1
- package/dist/effects/smoke.cjs +1 -1
- package/dist/effects/smoke.js +1 -1
- package/dist/effects/snowfall.cjs +1 -1
- package/dist/effects/snowfall.js +1 -1
- package/dist/effects/soft-body.cjs +1 -1
- package/dist/effects/soft-body.js +1 -1
- package/dist/effects/sound-particles.cjs +1 -1
- package/dist/effects/sound-particles.js +1 -1
- package/dist/effects/spatial-float.cjs +1 -1
- package/dist/effects/spatial-float.js +1 -1
- package/dist/effects/spectrum-mirror.cjs +1 -1
- package/dist/effects/spectrum-mirror.js +1 -1
- package/dist/effects/splash.cjs +1 -1
- package/dist/effects/splash.js +1 -1
- package/dist/effects/spooky-float.cjs +1 -1
- package/dist/effects/spooky-float.js +1 -1
- package/dist/effects/stock-pulse.cjs +1 -1
- package/dist/effects/stock-pulse.js +1 -1
- package/dist/effects/stream-text.cjs +1 -1
- package/dist/effects/stream-text.js +1 -1
- package/dist/effects/stroke-draw.cjs +1 -1
- package/dist/effects/stroke-draw.js +1 -1
- package/dist/effects/success-check.cjs +1 -1
- package/dist/effects/success-check.js +1 -1
- package/dist/effects/swipe-hint.cjs +1 -1
- package/dist/effects/swipe-hint.js +1 -1
- package/dist/effects/text-trail.cjs +1 -1
- package/dist/effects/text-trail.js +1 -1
- package/dist/effects/thinking-glow.cjs +1 -1
- package/dist/effects/thinking-glow.js +1 -1
- package/dist/effects/tilt-wobble.cjs +1 -1
- package/dist/effects/tilt-wobble.js +1 -1
- package/dist/effects/typing-dots.cjs +1 -1
- package/dist/effects/typing-dots.js +1 -1
- package/dist/effects/underline-sweep.cjs +1 -1
- package/dist/effects/underline-sweep.js +1 -1
- package/dist/effects/vhs-glitch.cjs +1 -1
- package/dist/effects/vhs-glitch.js +1 -1
- package/dist/effects/vine-grow.cjs +1 -1
- package/dist/effects/vine-grow.js +1 -1
- package/dist/effects/vinyl-spin.cjs +1 -1
- package/dist/effects/vinyl-spin.js +1 -1
- package/dist/effects/voice-wave.cjs +1 -1
- package/dist/effects/voice-wave.js +1 -1
- package/dist/effects/water-drop.cjs +1 -1
- package/dist/effects/water-drop.js +1 -1
- package/dist/effects/watercolor.cjs +1 -1
- package/dist/effects/watercolor.js +1 -1
- package/dist/effects/waveform-scope.cjs +1 -1
- package/dist/effects/waveform-scope.js +1 -1
- package/dist/effects/xmas-snow.cjs +1 -1
- package/dist/effects/xmas-snow.js +1 -1
- package/dist/effects/xp-gain.cjs +1 -1
- package/dist/effects/xp-gain.js +1 -1
- package/dist/effects/y2k-shine.cjs +1 -1
- package/dist/effects/y2k-shine.js +1 -1
- package/dist/element.cjs +1 -1
- package/dist/element.js +1 -1
- package/dist/element.umd.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/llms-full.txt +1 -1
- package/dist/llms.txt +1 -1
- package/dist/manifest.json +1 -1
- package/dist/presets/extended.cjs +1 -1
- package/dist/presets/extended.js +1 -1
- package/dist/presets-extended.umd.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/runtime/drag-snap.cjs +2 -2
- package/dist/runtime/drag-snap.iife.js +1 -1
- package/dist/runtime/drag-snap.js +2 -2
- package/dist/runtime/format-apng.cjs +3 -3
- package/dist/runtime/format-apng.iife.js +1 -1
- package/dist/runtime/format-apng.js +3 -3
- package/dist/runtime/format-css.cjs +3 -3
- package/dist/runtime/format-css.iife.js +1 -1
- package/dist/runtime/format-css.js +3 -3
- package/dist/runtime/format-gif.cjs +3 -3
- package/dist/runtime/format-gif.iife.js +1 -1
- package/dist/runtime/format-gif.js +3 -3
- package/dist/runtime/format-gltf.cjs +2 -2
- package/dist/runtime/format-gltf.iife.js +1 -1
- package/dist/runtime/format-gltf.js +2 -2
- package/dist/runtime/format-motion.cjs +4 -4
- package/dist/runtime/format-motion.iife.js +1 -1
- package/dist/runtime/format-motion.js +4 -4
- package/dist/runtime/format-obj.cjs +2 -2
- package/dist/runtime/format-obj.iife.js +1 -1
- package/dist/runtime/format-obj.js +2 -2
- package/dist/runtime/format-scene.cjs +2 -2
- package/dist/runtime/format-scene.iife.js +1 -1
- package/dist/runtime/format-scene.js +2 -2
- package/dist/runtime/format-sprite.cjs +3 -3
- package/dist/runtime/format-sprite.iife.js +1 -1
- package/dist/runtime/format-sprite.js +3 -3
- package/dist/runtime/format-svg.cjs +3 -3
- package/dist/runtime/format-svg.iife.js +1 -1
- package/dist/runtime/format-svg.js +3 -3
- package/dist/runtime/format-webp.cjs +3 -3
- package/dist/runtime/format-webp.iife.js +1 -1
- package/dist/runtime/format-webp.js +3 -3
- package/dist/runtime/gl.cjs +2 -2
- package/dist/runtime/gl.iife.js +1 -1
- package/dist/runtime/gl.js +2 -2
- package/dist/runtime/gltf-anim.cjs +2 -2
- package/dist/runtime/gltf-anim.iife.js +1 -1
- package/dist/runtime/gltf-anim.js +2 -2
- package/dist/runtime/gltf-decoders.cjs +2 -2
- package/dist/runtime/gltf-decoders.iife.js +1 -1
- package/dist/runtime/gltf-decoders.js +2 -2
- package/dist/runtime/lottie-state.cjs +2 -2
- package/dist/runtime/lottie-state.iife.js +1 -1
- package/dist/runtime/lottie-state.js +2 -2
- package/dist/runtime/physics.cjs +2 -2
- package/dist/runtime/physics.iife.js +1 -1
- package/dist/runtime/physics.js +2 -2
- package/dist/runtime/scroll.cjs +3 -3
- package/dist/runtime/scroll.iife.js +1 -1
- package/dist/runtime/scroll.js +3 -3
- package/dist/runtime/smooth.cjs +2 -2
- package/dist/runtime/smooth.iife.js +1 -1
- package/dist/runtime/smooth.js +2 -2
- package/dist/runtime/text.cjs +2 -2
- package/dist/runtime/text.iife.js +1 -1
- package/dist/runtime/text.js +2 -2
- package/dist/runtime/vector.cjs +3 -3
- package/dist/runtime/vector.iife.js +1 -1
- package/dist/runtime/vector.js +3 -3
- package/dist/runtime.cjs +4 -4
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.iife.js +2 -2
- package/dist/runtime.js +6 -6
- package/dist/solid.cjs +1 -1
- package/dist/solid.js +1 -1
- package/dist/svelte.cjs +1 -1
- package/dist/svelte.js +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +1 -1
- package/dist/widgets/add-to-cart.cjs +1 -1
- package/dist/widgets/add-to-cart.js +1 -1
- package/dist/widgets/badge-wall.cjs +1 -1
- package/dist/widgets/badge-wall.js +1 -1
- package/dist/widgets/bar-chart.cjs +1 -1
- package/dist/widgets/bar-chart.js +1 -1
- package/dist/widgets/bg-generator.cjs +1 -1
- package/dist/widgets/bg-generator.js +1 -1
- package/dist/widgets/carousel.cjs +1 -1
- package/dist/widgets/carousel.js +1 -1
- package/dist/widgets/cart-drawer.cjs +1 -1
- package/dist/widgets/cart-drawer.js +1 -1
- package/dist/widgets/chapter-nav.cjs +1 -1
- package/dist/widgets/chapter-nav.js +1 -1
- package/dist/widgets/chat-composer.cjs +1 -1
- package/dist/widgets/chat-composer.js +1 -1
- package/dist/widgets/clock-control.cjs +1 -1
- package/dist/widgets/clock-control.js +1 -1
- package/dist/widgets/code-export.cjs +1 -1
- package/dist/widgets/code-export.js +1 -1
- package/dist/widgets/color-picker.cjs +1 -1
- package/dist/widgets/color-picker.js +1 -1
- package/dist/widgets/command-palette.cjs +1 -1
- package/dist/widgets/command-palette.js +1 -1
- package/dist/widgets/compare.cjs +1 -1
- package/dist/widgets/compare.js +1 -1
- package/dist/widgets/countdown.cjs +1 -1
- package/dist/widgets/countdown.js +1 -1
- package/dist/widgets/cube-gallery.cjs +1 -1
- package/dist/widgets/cube-gallery.js +1 -1
- package/dist/widgets/date-picker.cjs +1 -1
- package/dist/widgets/date-picker.js +1 -1
- package/dist/widgets/disclosure.cjs +1 -1
- package/dist/widgets/disclosure.js +1 -1
- package/dist/widgets/dock.cjs +1 -1
- package/dist/widgets/dock.js +1 -1
- package/dist/widgets/dotlottie.cjs +1 -1
- package/dist/widgets/dotlottie.js +1 -1
- package/dist/widgets/equalizer.cjs +1 -1
- package/dist/widgets/equalizer.js +1 -1
- package/dist/widgets/festival-banner.cjs +1 -1
- package/dist/widgets/festival-banner.js +1 -1
- package/dist/widgets/field.cjs +1 -1
- package/dist/widgets/field.js +1 -1
- package/dist/widgets/file-drop.cjs +1 -1
- package/dist/widgets/file-drop.js +1 -1
- package/dist/widgets/gauge.cjs +1 -1
- package/dist/widgets/gauge.js +1 -1
- package/dist/widgets/gen-art.cjs +1 -1
- package/dist/widgets/gen-art.js +1 -1
- package/dist/widgets/gesture-sticker.cjs +1 -1
- package/dist/widgets/gesture-sticker.js +1 -1
- package/dist/widgets/gl-model.cjs +1 -1
- package/dist/widgets/gl-model.js +1 -1
- package/dist/widgets/gl-scene.cjs +2 -2
- package/dist/widgets/gl-scene.js +2 -2
- package/dist/widgets/globe.cjs +1 -1
- package/dist/widgets/globe.js +1 -1
- package/dist/widgets/gpu-particles.cjs +1 -1
- package/dist/widgets/gpu-particles.js +1 -1
- package/dist/widgets/gyro-card.cjs +1 -1
- package/dist/widgets/gyro-card.js +1 -1
- package/dist/widgets/hero-video.cjs +1 -1
- package/dist/widgets/hero-video.js +1 -1
- package/dist/widgets/hud-panel.cjs +1 -1
- package/dist/widgets/hud-panel.js +1 -1
- package/dist/widgets/hydrate.cjs +1 -1
- package/dist/widgets/hydrate.js +1 -1
- package/dist/widgets/install-button.cjs +1 -1
- package/dist/widgets/install-button.js +1 -1
- package/dist/widgets/kanban.cjs +1 -1
- package/dist/widgets/kanban.js +1 -1
- package/dist/widgets/keyframe-editor.cjs +1 -1
- package/dist/widgets/keyframe-editor.js +1 -1
- package/dist/widgets/kpi.cjs +1 -1
- package/dist/widgets/kpi.js +1 -1
- package/dist/widgets/leaderboard.cjs +1 -1
- package/dist/widgets/leaderboard.js +1 -1
- package/dist/widgets/liquid-nav.cjs +1 -1
- package/dist/widgets/liquid-nav.js +1 -1
- package/dist/widgets/location-card.cjs +1 -1
- package/dist/widgets/location-card.js +1 -1
- package/dist/widgets/lottie-icon.cjs +1 -1
- package/dist/widgets/lottie-icon.js +1 -1
- package/dist/widgets/lottie-player.cjs +2 -2
- package/dist/widgets/lottie-player.js +2 -2
- package/dist/widgets/lottie.cjs +1 -1
- package/dist/widgets/lottie.js +1 -1
- package/dist/widgets/lyrics.cjs +1 -1
- package/dist/widgets/lyrics.js +1 -1
- package/dist/widgets/masonry-flow.cjs +1 -1
- package/dist/widgets/masonry-flow.js +1 -1
- package/dist/widgets/menu-toggle.cjs +1 -1
- package/dist/widgets/menu-toggle.js +1 -1
- package/dist/widgets/menu.cjs +1 -1
- package/dist/widgets/menu.js +1 -1
- package/dist/widgets/message-list.cjs +1 -1
- package/dist/widgets/message-list.js +1 -1
- package/dist/widgets/milestones.cjs +1 -1
- package/dist/widgets/milestones.js +1 -1
- package/dist/widgets/modal.cjs +1 -1
- package/dist/widgets/modal.js +1 -1
- package/dist/widgets/motion-inspector.cjs +2 -2
- package/dist/widgets/motion-inspector.js +2 -2
- package/dist/widgets/motion-prefs.cjs +1 -1
- package/dist/widgets/motion-prefs.js +1 -1
- package/dist/widgets/motion-prompt.cjs +1 -1
- package/dist/widgets/motion-prompt.js +1 -1
- package/dist/widgets/motion-spec.cjs +1 -1
- package/dist/widgets/motion-spec.js +1 -1
- package/dist/widgets/motion.cjs +1 -1
- package/dist/widgets/motion.js +1 -1
- package/dist/widgets/music-player.cjs +1 -1
- package/dist/widgets/music-player.js +1 -1
- package/dist/widgets/native-preview.cjs +1 -1
- package/dist/widgets/native-preview.js +1 -1
- package/dist/widgets/nav-morph.cjs +1 -1
- package/dist/widgets/nav-morph.js +1 -1
- package/dist/widgets/notification-bell.cjs +1 -1
- package/dist/widgets/notification-bell.js +1 -1
- package/dist/widgets/odometer.cjs +1 -1
- package/dist/widgets/odometer.js +1 -1
- package/dist/widgets/organic-card.cjs +1 -1
- package/dist/widgets/organic-card.js +1 -1
- package/dist/widgets/otp.cjs +1 -1
- package/dist/widgets/otp.js +1 -1
- package/dist/widgets/pagination.cjs +1 -1
- package/dist/widgets/pagination.js +1 -1
- package/dist/widgets/panorama.cjs +1 -1
- package/dist/widgets/panorama.js +1 -1
- package/dist/widgets/parallax-layers.cjs +1 -1
- package/dist/widgets/parallax-layers.js +1 -1
- package/dist/widgets/pause-all.cjs +1 -1
- package/dist/widgets/pause-all.js +1 -1
- package/dist/widgets/perf-monitor.cjs +1 -1
- package/dist/widgets/perf-monitor.js +1 -1
- package/dist/widgets/physics-playground.cjs +2 -2
- package/dist/widgets/physics-playground.js +2 -2
- package/dist/widgets/plugin-card.cjs +3 -3
- package/dist/widgets/plugin-card.js +3 -3
- package/dist/widgets/plugin-store.cjs +1 -1
- package/dist/widgets/plugin-store.js +1 -1
- package/dist/widgets/presence.cjs +1 -1
- package/dist/widgets/presence.js +1 -1
- package/dist/widgets/prize-wheel.cjs +1 -1
- package/dist/widgets/prize-wheel.js +1 -1
- package/dist/widgets/product-gallery.cjs +1 -1
- package/dist/widgets/product-gallery.js +1 -1
- package/dist/widgets/progress-ring.cjs +1 -1
- package/dist/widgets/progress-ring.js +1 -1
- package/dist/widgets/prop-panel.cjs +1 -1
- package/dist/widgets/prop-panel.js +1 -1
- package/dist/widgets/pull-cord.cjs +1 -1
- package/dist/widgets/pull-cord.js +1 -1
- package/dist/widgets/radar.cjs +1 -1
- package/dist/widgets/radar.js +1 -1
- package/dist/widgets/reactions.cjs +1 -1
- package/dist/widgets/reactions.js +1 -1
- package/dist/widgets/red-envelope.cjs +1 -1
- package/dist/widgets/red-envelope.js +1 -1
- package/dist/widgets/retro-button.cjs +1 -1
- package/dist/widgets/retro-button.js +1 -1
- package/dist/widgets/rive.cjs +1 -1
- package/dist/widgets/rive.js +1 -1
- package/dist/widgets/route-transition.cjs +1 -1
- package/dist/widgets/route-transition.js +1 -1
- package/dist/widgets/scene.cjs +1 -1
- package/dist/widgets/scene.js +1 -1
- package/dist/widgets/scroll-ring.cjs +1 -1
- package/dist/widgets/scroll-ring.js +1 -1
- package/dist/widgets/scroll-scene.cjs +2 -2
- package/dist/widgets/scroll-scene.js +2 -2
- package/dist/widgets/segmented.cjs +1 -1
- package/dist/widgets/segmented.js +1 -1
- package/dist/widgets/shader-backdrop.cjs +1 -1
- package/dist/widgets/shader-backdrop.js +1 -1
- package/dist/widgets/sheet.cjs +1 -1
- package/dist/widgets/sheet.js +1 -1
- package/dist/widgets/shortcut.cjs +1 -1
- package/dist/widgets/shortcut.js +1 -1
- package/dist/widgets/skeleton-reveal.cjs +1 -1
- package/dist/widgets/skeleton-reveal.js +1 -1
- package/dist/widgets/sketch-chart.cjs +1 -1
- package/dist/widgets/sketch-chart.js +1 -1
- package/dist/widgets/smooth-scroll.cjs +2 -2
- package/dist/widgets/smooth-scroll.js +2 -2
- package/dist/widgets/snap-carousel.cjs +1 -1
- package/dist/widgets/snap-carousel.js +1 -1
- package/dist/widgets/sparkline.cjs +1 -1
- package/dist/widgets/sparkline.js +1 -1
- package/dist/widgets/spatial-card.cjs +1 -1
- package/dist/widgets/spatial-card.js +1 -1
- package/dist/widgets/star-rating.cjs +1 -1
- package/dist/widgets/star-rating.js +1 -1
- package/dist/widgets/stepper.cjs +1 -1
- package/dist/widgets/stepper.js +1 -1
- package/dist/widgets/sticky-wall.cjs +1 -1
- package/dist/widgets/sticky-wall.js +1 -1
- package/dist/widgets/stories.cjs +1 -1
- package/dist/widgets/stories.js +1 -1
- package/dist/widgets/suggestion-chips.cjs +1 -1
- package/dist/widgets/suggestion-chips.js +1 -1
- package/dist/widgets/swipe-deck.cjs +1 -1
- package/dist/widgets/swipe-deck.js +1 -1
- package/dist/widgets/switch.cjs +1 -1
- package/dist/widgets/switch.js +1 -1
- package/dist/widgets/tab-bar.cjs +1 -1
- package/dist/widgets/tab-bar.js +1 -1
- package/dist/widgets/terminal.cjs +1 -1
- package/dist/widgets/terminal.js +1 -1
- package/dist/widgets/text-splitter.cjs +3 -3
- package/dist/widgets/text-splitter.js +3 -3
- package/dist/widgets/theme-surface.cjs +1 -1
- package/dist/widgets/theme-surface.js +1 -1
- package/dist/widgets/theme-switcher.cjs +1 -1
- package/dist/widgets/theme-switcher.js +1 -1
- package/dist/widgets/tip.cjs +1 -1
- package/dist/widgets/tip.js +1 -1
- package/dist/widgets/toast-stack.cjs +1 -1
- package/dist/widgets/toast-stack.js +1 -1
- package/dist/widgets/token-editor.cjs +1 -1
- package/dist/widgets/token-editor.js +1 -1
- package/dist/widgets/upload-progress.cjs +1 -1
- package/dist/widgets/upload-progress.js +1 -1
- package/dist/widgets/video-card.cjs +1 -1
- package/dist/widgets/video-card.js +1 -1
- package/dist/widgets/voice-button.cjs +1 -1
- package/dist/widgets/voice-button.js +1 -1
- package/dist/widgets/volume-knob.cjs +1 -1
- package/dist/widgets/volume-knob.js +1 -1
- package/dist/widgets/weather-card.cjs +1 -1
- package/dist/widgets/weather-card.js +1 -1
- package/dist/widgets/worker-canvas.cjs +1 -1
- package/dist/widgets/worker-canvas.js +1 -1
- package/dist/widgets/xp-bar.cjs +1 -1
- package/dist/widgets/xp-bar.js +1 -1
- package/dist/widgets.umd.js +2 -2
- package/docs/ROADMAP.md +46 -1
- package/docs/studio-canvas.md +233 -0
- package/docs/studio.md +224 -0
- package/docs/versions.md +1 -1
- package/package.json +41 -1
|
@@ -0,0 +1,1009 @@
|
|
|
1
|
+
import { createStudioCanvas } from './studio-canvas.js';
|
|
2
|
+
import { i as historyKeyAction, n as setKeyframeEasing, s as setKeyframeProps, r as removeKeyframes, a as addKeyframe, u as updateLayers, d as addLayer, e as copyKeyframes, o as shiftKeyframes, g as editableKeyframes, p as pasteKeyframes } from '../chunks/history-DYSOAKH5.js';
|
|
3
|
+
import { s as sampleTimelineDoc, a as createTimelinePreview } from '../chunks/preview-C0qDmRNm.js';
|
|
4
|
+
import { l as loadMotionDoc, a as timelineDocToScene } from '../chunks/scene-BlBhOYVs.js';
|
|
5
|
+
import { e as TIMELINE_DOC_LIMITS, T as TimelineDocError, v as validateTimelineDoc, b as timelineDocDuration, i as isLayerLocked } from '../chunks/format-xyZDr-fG.js';
|
|
6
|
+
import { c as cubicBezier } from '../chunks/ease-XN8_0sXu.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 14.4 Motion Studio: easing curves for the curve editor — cubic-bezier control points, presets and spring
|
|
10
|
+
* parameters. Pure (no DOM). The timeline model stores an easing string per keyframe (`cubic-bezier(…)` / a named
|
|
11
|
+
* ease), so a spring is fitted to the closest cubic-bezier; the spring parameters themselves are kept in the Studio
|
|
12
|
+
* project file (`studio.springs`) so the editor can reopen them.
|
|
13
|
+
*/
|
|
14
|
+
/** Curve editor presets (the CSS keywords plus a few common shapes). */
|
|
15
|
+
const CURVE_PRESETS = {
|
|
16
|
+
linear: [0, 0, 1, 1],
|
|
17
|
+
ease: [0.25, 0.1, 0.25, 1],
|
|
18
|
+
'ease-in': [0.42, 0, 1, 1],
|
|
19
|
+
'ease-out': [0, 0, 0.58, 1],
|
|
20
|
+
'ease-in-out': [0.42, 0, 0.58, 1],
|
|
21
|
+
smooth: [0.22, 1, 0.36, 1],
|
|
22
|
+
snappy: [0.2, 0, 0, 1],
|
|
23
|
+
anticipate: [0.36, 0, 0.66, -0.56],
|
|
24
|
+
overshoot: [0.34, 1.56, 0.64, 1],
|
|
25
|
+
};
|
|
26
|
+
const r3 = (n) => Math.round(n * 1000) / 1000 + 0;
|
|
27
|
+
const NUM = '\\s*(-?(?:\\d+\\.?\\d*|\\.\\d+))\\s*';
|
|
28
|
+
const CB = /*#__PURE__*/ new RegExp(`^cubic-bezier\\(${NUM},${NUM},${NUM},${NUM}\\)$`);
|
|
29
|
+
/** The control points of an easing: a preset / CSS keyword or `cubic-bezier(…)` (`undefined` = linear). `null` for anything else (`steps()`, named eases like `bounce-out`). */
|
|
30
|
+
function parseBezier(easing) {
|
|
31
|
+
const s = (easing ?? 'linear').trim();
|
|
32
|
+
const p = CURVE_PRESETS[s];
|
|
33
|
+
if (p)
|
|
34
|
+
return [...p];
|
|
35
|
+
const m = CB.exec(s);
|
|
36
|
+
return m ? [+m[1], +m[2], +m[3], +m[4]] : null;
|
|
37
|
+
}
|
|
38
|
+
/** The easing string for control points: `linear`, else `cubic-bezier(x1, y1, x2, y2)` (x clamped to 0…1, 3 decimals). */
|
|
39
|
+
function bezierEasing(b) {
|
|
40
|
+
const c = (v, x) => r3(x ? Math.min(1, Math.max(0, v)) : Math.min(5, Math.max(-5, v)));
|
|
41
|
+
const v = [c(b[0], true), c(b[1], false), c(b[2], true), c(b[3], false)];
|
|
42
|
+
return v.join() === '0,0,1,1' ? 'linear' : `cubic-bezier(${v.join(', ')})`;
|
|
43
|
+
}
|
|
44
|
+
const pos = (v, d) => (typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : d);
|
|
45
|
+
/** Spring parameters with defaults (stiffness 170, damping 26, mass 1) for anything missing or invalid. */
|
|
46
|
+
const springParams = (s = {}) => ({
|
|
47
|
+
stiffness: pos(s.stiffness, 170),
|
|
48
|
+
damping: typeof s.damping === 'number' && Number.isFinite(s.damping) && s.damping >= 0 ? s.damping : 26,
|
|
49
|
+
mass: pos(s.mass, 1),
|
|
50
|
+
});
|
|
51
|
+
const fitCache = /*#__PURE__*/ new Map();
|
|
52
|
+
/**
|
|
53
|
+
* The cubic-bezier closest to a spring (unit step, from rest), and the time the spring takes to settle (ms). A cubic
|
|
54
|
+
* curve can overshoot once, so an underdamped spring keeps its first overshoot and loses later wobbles.
|
|
55
|
+
* Deterministic: a fixed-step simulation and a fixed search grid.
|
|
56
|
+
*/
|
|
57
|
+
function springBezier(input) {
|
|
58
|
+
const { stiffness: k, damping: c, mass: m } = springParams(input);
|
|
59
|
+
const key = `${k}|${c}|${m}`;
|
|
60
|
+
const hit = fitCache.get(key);
|
|
61
|
+
if (hit)
|
|
62
|
+
return hit;
|
|
63
|
+
// simulate at 1 ms until settled (max 10 s)
|
|
64
|
+
const xs = [0];
|
|
65
|
+
let x = 0, v = 0, t = 0;
|
|
66
|
+
while (t < 10000) {
|
|
67
|
+
v += ((-k * (x - 1) - c * v) / m) * 0.001;
|
|
68
|
+
x += v * 0.001;
|
|
69
|
+
xs.push(x);
|
|
70
|
+
t++;
|
|
71
|
+
if (Math.abs(1 - x) < 0.001 && Math.abs(v) < 0.01)
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
const N = 24;
|
|
75
|
+
const target = Array.from({ length: N + 1 }, (_, i) => xs[Math.round((i / N) * t)]);
|
|
76
|
+
target[N] = 1;
|
|
77
|
+
const over = xs.some((v) => v > 1.001); // a spring that never overshoots gets a curve that never does
|
|
78
|
+
let best = [0, 0, 1, 1], err = Infinity;
|
|
79
|
+
for (const x1 of [0.1, 0.2, 0.3, 0.4])
|
|
80
|
+
for (const x2 of [0.2, 0.4, 0.6, 0.8]) {
|
|
81
|
+
for (let a = 0; a <= 30; a++)
|
|
82
|
+
for (let b = 0; b <= 24; b++) {
|
|
83
|
+
const y1 = a / 10, y2 = 0.6 + b * 0.05;
|
|
84
|
+
if (!over && (y1 > 1 || y2 > 1.0001))
|
|
85
|
+
continue;
|
|
86
|
+
const f = cubicBezier(x1, y1, x2, y2);
|
|
87
|
+
let e = 0;
|
|
88
|
+
for (let i = 1; i < N && e < err; i++)
|
|
89
|
+
e += (f(i / N) - target[i]) ** 2;
|
|
90
|
+
if (e < err) {
|
|
91
|
+
err = e;
|
|
92
|
+
best = [x1, y1, x2, r3(y2)];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const out = { easing: bezierEasing(best), bezier: best, duration: t };
|
|
97
|
+
if (fitCache.size > 64)
|
|
98
|
+
fitCache.clear();
|
|
99
|
+
fitCache.set(key, out);
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 14.4 Motion Studio: save / load. A Studio project is `{ format: 'motionary-studio', version: 1, scene, studio }`:
|
|
105
|
+
* `scene` is the document as Scene Format v2 (`timelineDocToScene`, lossless), `studio` is editor state (time, zoom,
|
|
106
|
+
* fps, collapsed groups, spring parameters). `parseStudioProject` also opens a bare Scene v2 document, a
|
|
107
|
+
* `motionary-timeline` v1 document or `<usa-player>` animation JSON, checks size and shape (never evaluates input) and
|
|
108
|
+
* drops editor state that does not match the document. `sampleFrames` is the reference for "same animation":
|
|
109
|
+
* every frame at a fixed frame rate, a pure function of the document.
|
|
110
|
+
*/
|
|
111
|
+
const STUDIO_PROJECT_FORMAT = 'motionary-studio';
|
|
112
|
+
const STUDIO_PROJECT_VERSION = 1;
|
|
113
|
+
const r4 = (n) => Math.round(n * 1e4) / 1e4 + 0;
|
|
114
|
+
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
115
|
+
const fail = (path, message) => new TimelineDocError([{ path, message }]);
|
|
116
|
+
/** `ms` snapped to the nearest frame at `fps` (4 decimals, like the editor model). */
|
|
117
|
+
const frameTime = (ms, fps = 60) => r4((Math.round((ms * fps) / 1000) * 1000) / fps);
|
|
118
|
+
/** Every frame of the document at `fps` from `from` to `to` (default 0 … duration): the reference for "same animation". */
|
|
119
|
+
function sampleFrames(doc, o = {}) {
|
|
120
|
+
const fps = o.fps ?? 60, end = o.to ?? timelineDocDuration(doc), out = [];
|
|
121
|
+
for (let n = Math.round(((o.from ?? 0) * fps) / 1000), t = 0; (t = frameTime((n * 1000) / fps, fps)) <= end + 1e-9 && out.length < 1e5; n++)
|
|
122
|
+
out.push(sampleTimelineDoc(doc, t));
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
/** Editor state checked against the document: unknown ids, bad numbers and stale springs are dropped. */
|
|
126
|
+
function cleanUiState(doc, s) {
|
|
127
|
+
const ui = {};
|
|
128
|
+
if (!isObj(s))
|
|
129
|
+
return ui;
|
|
130
|
+
const num = (v, lo, hi, d) => (typeof v === 'number' && Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : d);
|
|
131
|
+
if (s.time !== undefined)
|
|
132
|
+
ui.time = num(s.time, 0, TIMELINE_DOC_LIMITS.time, 0);
|
|
133
|
+
if (s.zoom !== undefined)
|
|
134
|
+
ui.zoom = num(s.zoom, 1, 10000, 100);
|
|
135
|
+
if (s.fps !== undefined)
|
|
136
|
+
ui.fps = Number.isInteger(s.fps) && s.fps >= 1 && s.fps <= 240 ? s.fps : 60;
|
|
137
|
+
const groups = new Set(doc.layers.filter((l) => l.type === 'group').map((l) => l.id));
|
|
138
|
+
if (Array.isArray(s.collapsed))
|
|
139
|
+
ui.collapsed = [...new Set(s.collapsed.filter((id) => typeof id === 'string' && groups.has(id)))];
|
|
140
|
+
if (isObj(s.springs)) {
|
|
141
|
+
const easing = new Map(doc.layers.flatMap((l) => (l.keyframes || []).map((k) => [k.id, k.easing ?? 'linear'])));
|
|
142
|
+
const sp = {};
|
|
143
|
+
for (const id of Object.keys(s.springs)) {
|
|
144
|
+
const v = s.springs[id];
|
|
145
|
+
if (!isObj(v) || !['stiffness', 'damping', 'mass'].every((k) => typeof v[k] === 'number' && Number.isFinite(v[k])))
|
|
146
|
+
continue;
|
|
147
|
+
const p = springParams(v);
|
|
148
|
+
if (easing.get(id) === springBezier(p).easing)
|
|
149
|
+
sp[id] = p;
|
|
150
|
+
}
|
|
151
|
+
if (Object.keys(sp).length)
|
|
152
|
+
ui.springs = sp;
|
|
153
|
+
}
|
|
154
|
+
return ui;
|
|
155
|
+
}
|
|
156
|
+
/** The project as JSON text (stable: the same document and state always give the same text). */
|
|
157
|
+
function serializeStudioProject(doc, ui = {}, space = 2) {
|
|
158
|
+
const p = { format: STUDIO_PROJECT_FORMAT, version: 1, scene: timelineDocToScene(doc), studio: cleanUiState(doc, ui) };
|
|
159
|
+
return JSON.stringify(p, null, space) + (space ? '\n' : '');
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Open a Studio project, a Scene v2 document, a timeline v1 document or animation JSON (object or text). Throws a
|
|
163
|
+
* `TimelineDocError` for anything malformed or over the limits; `lost` lists what a scene had that the editor cannot hold.
|
|
164
|
+
*/
|
|
165
|
+
function parseStudioProject(input) {
|
|
166
|
+
let d = input;
|
|
167
|
+
if (typeof input === 'string') {
|
|
168
|
+
if (input.length > TIMELINE_DOC_LIMITS.textBytes)
|
|
169
|
+
throw fail('', `text longer than ${TIMELINE_DOC_LIMITS.textBytes} characters`);
|
|
170
|
+
try {
|
|
171
|
+
d = JSON.parse(input);
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
throw fail('', `invalid JSON (${e.message})`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (!isObj(d))
|
|
178
|
+
throw fail('', 'expected an object');
|
|
179
|
+
let ui;
|
|
180
|
+
if (d.format === STUDIO_PROJECT_FORMAT) {
|
|
181
|
+
if (d.version !== STUDIO_PROJECT_VERSION)
|
|
182
|
+
throw fail('version', `expected ${STUDIO_PROJECT_VERSION}`);
|
|
183
|
+
ui = d.studio;
|
|
184
|
+
d = d.scene;
|
|
185
|
+
if (!isObj(d) || d.format !== 'motionary-scene')
|
|
186
|
+
throw fail('scene', 'expected a Scene Format v2 document');
|
|
187
|
+
}
|
|
188
|
+
if (d.format === 'motionary-scene') {
|
|
189
|
+
// shape check before mapping (the mapping trusts its input)
|
|
190
|
+
const ok = Array.isArray(d.layers) && d.layers.length <= TIMELINE_DOC_LIMITS.layers && d.layers.every((l) => isObj(l) && (l.keyframes === undefined || (Array.isArray(l.keyframes) && l.keyframes.every((k) => isObj(k) && isObj(k.props)))));
|
|
191
|
+
if (!ok)
|
|
192
|
+
throw fail('layers', 'malformed scene layers');
|
|
193
|
+
}
|
|
194
|
+
let r;
|
|
195
|
+
try {
|
|
196
|
+
r = loadMotionDoc(d);
|
|
197
|
+
}
|
|
198
|
+
catch (e) {
|
|
199
|
+
throw e instanceof TimelineDocError ? e : fail('', String(e?.message || e));
|
|
200
|
+
}
|
|
201
|
+
const problems = validateTimelineDoc(r.doc);
|
|
202
|
+
if (problems.length)
|
|
203
|
+
throw new TimelineDocError(problems);
|
|
204
|
+
return { doc: r.doc, ui: cleanUiState(r.doc, ui), lost: r.lost };
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* motionary/studio (14.4) — Motion Studio 1.0: a timeline UI over the 13.6 timeline editor model, composed with the
|
|
209
|
+
* 14.3 canvas (`motionary/studio/canvas`).
|
|
210
|
+
*
|
|
211
|
+
* - Timeline: tracks and track groups (collapse, mute, lock), a time ruler, a scrubbable playhead, zoom.
|
|
212
|
+
* - Keyframes: drag, marquee, multi-select move, copy / paste, snapping to frames and to other keys (Alt: free).
|
|
213
|
+
* - Curve editor: cubic-bezier handles, presets, spring parameters (fitted to a cubic-bezier).
|
|
214
|
+
* - Inspector: the focused track's values at the playhead; editing adds a key there or changes the key there.
|
|
215
|
+
* - Preview: frame by frame, play / pause, deterministic seek (`createTimelinePreview`: same time → same DOM).
|
|
216
|
+
* - Undo / redo through the existing `createTimelineHistory` (one gesture = one step).
|
|
217
|
+
* - Save / load: Scene Format v2 and the Studio project file (`serializeStudioProject` / `parseStudioProject`).
|
|
218
|
+
*
|
|
219
|
+
* Nothing is reimplemented: edits are the editor model's operations (`shiftKeyframes`, `addKeyframe`, …), playback is
|
|
220
|
+
* its preview, the canvas is `createStudioCanvas`. Editor-only and opt-in: nothing in `motionary`, `motionary/core`,
|
|
221
|
+
* `motionary/motion` or `components/lite` imports it. SSR-safe at import; no listeners on window / document: the
|
|
222
|
+
* Studio listens on its own container, adds move / up / cancel listeners when a gesture starts and removes them when
|
|
223
|
+
* it ends or on `destroy()`.
|
|
224
|
+
*/
|
|
225
|
+
const STUDIO_VERSION = 1;
|
|
226
|
+
const SVG = 'http://www.w3.org/2000/svg';
|
|
227
|
+
const HEAD = 168;
|
|
228
|
+
const CW = 120, CP = 60; // curve box: 120 × 120 px, 60 px above / below for overshoot
|
|
229
|
+
const PROP = /^(--)?[a-zA-Z][\w-]*$/;
|
|
230
|
+
const r2 = (n) => Math.round(n * 100) / 100 + 0;
|
|
231
|
+
const fmt = (t) => `${(t / 1000).toFixed(3)} s`;
|
|
232
|
+
const parseVal = (v) => (/^\s*-?(\d+\.?\d*|\.\d+)\s*$/.test(v) ? +v : v.trim());
|
|
233
|
+
/** Build a Studio inside `root` for the history's document. */
|
|
234
|
+
function createStudio(root, o) {
|
|
235
|
+
const { history } = o;
|
|
236
|
+
const D = root.ownerDocument;
|
|
237
|
+
const coarse = !!D.defaultView?.matchMedia?.('(pointer: coarse)').matches;
|
|
238
|
+
const fps = o.fps && o.fps > 0 ? o.fps : 60, F = 1000 / fps, RH = o.rowHeight ?? (coarse ? 32 : 24), minLen = o.length ?? 2000;
|
|
239
|
+
let zoom = o.zoom ?? 100, time = 0, playing = false, dead = false;
|
|
240
|
+
let selection = [], focusId, focusAt, clip;
|
|
241
|
+
let collapsed = new Set(), springs = {};
|
|
242
|
+
let g = null;
|
|
243
|
+
const h = (tag, a = {}, parent, text) => {
|
|
244
|
+
const e = D.createElement(tag);
|
|
245
|
+
for (const k in a)
|
|
246
|
+
e.setAttribute(k, a[k]);
|
|
247
|
+
if (text !== undefined)
|
|
248
|
+
e.textContent = text;
|
|
249
|
+
parent?.append(e);
|
|
250
|
+
return e;
|
|
251
|
+
};
|
|
252
|
+
const btn = (act, label, text, parent, a = {}) => h('button', { type: 'button', 'data-act': act, 'aria-label': label, ...a }, parent, text);
|
|
253
|
+
const field = (f, label, parent, a = {}) => h('input', { 'data-field': f, 'aria-label': label, ...a }, parent);
|
|
254
|
+
// --- DOM ----------------------------------------------------------------------------------------------------------
|
|
255
|
+
const box = h('div', { 'data-studio': '', style: 'position:relative;font:12px/1.5 system-ui,sans-serif' }, root);
|
|
256
|
+
const bar = h('div', { role: 'toolbar', 'aria-label': 'Studio', style: 'display:flex;flex-wrap:wrap;gap:4px;align-items:center;padding:4px 0' }, box);
|
|
257
|
+
btn('prev', 'Previous frame', '⏮', bar);
|
|
258
|
+
const playBtn = btn('play', 'Play', '▶', bar, { 'aria-pressed': 'false' });
|
|
259
|
+
btn('next', 'Next frame', '⏭', bar);
|
|
260
|
+
const timeOut = h('output', { 'data-time': '', 'aria-label': 'Time', style: 'min-width:9em;font-variant-numeric:tabular-nums' }, bar);
|
|
261
|
+
btn('undo', 'Undo', '↶', bar);
|
|
262
|
+
btn('redo', 'Redo', '↷', bar);
|
|
263
|
+
btn('zoom-out', 'Zoom out', '−', bar);
|
|
264
|
+
btn('zoom-in', 'Zoom in', '+', bar);
|
|
265
|
+
const nameIn = field('track-name', 'New layer name', bar, { placeholder: 'Name', size: '10' });
|
|
266
|
+
const targetIn = field('track-target', 'New track target selector', bar, { placeholder: '#target', size: '10' });
|
|
267
|
+
btn('add-track', 'Add track', '+ Track', bar);
|
|
268
|
+
btn('add-group', 'Add group', '+ Group', bar);
|
|
269
|
+
const grid = h('div', { role: 'grid', 'aria-label': o.label || 'Timeline', 'aria-multiselectable': 'true', 'aria-colcount': '2', style: 'position:relative;overflow:auto;max-height:60vh;user-select:none;-webkit-user-select:none;border:1px solid #8885' }, box);
|
|
270
|
+
const headRow = h('div', { role: 'row', 'aria-rowindex': '1', style: `display:flex;height:${RH}px;position:sticky;top:0;z-index:2;background:Canvas` }, grid);
|
|
271
|
+
h('div', { role: 'columnheader', style: `flex:0 0 ${HEAD}px;padding-left:4px;box-sizing:border-box;position:sticky;left:0;background:Canvas;z-index:1` }, headRow, 'Layers');
|
|
272
|
+
const ruler = h('div', { role: 'columnheader', 'data-ruler': '', 'aria-label': 'Time ruler', style: 'position:relative;flex:1 0 auto;touch-action:none;cursor:ew-resize;overflow:hidden' }, headRow);
|
|
273
|
+
const ticks = h('div', { 'aria-hidden': 'true', style: 'position:absolute;inset:0;pointer-events:none' }, ruler);
|
|
274
|
+
const head = h('div', { 'data-playhead': '', role: 'slider', tabindex: '0', 'aria-label': 'Playhead', 'aria-valuemin': '0', style: 'position:absolute;top:0;bottom:0;width:3px;margin-left:-1px;background:#e5484d' }, ruler);
|
|
275
|
+
const body = h('div', { role: 'rowgroup' }, grid);
|
|
276
|
+
const insp = h('div', { 'data-inspector': '', role: 'group', 'aria-label': 'Properties', style: 'padding:4px 0' }, box);
|
|
277
|
+
const curve = h('div', { 'data-curve': '', role: 'group', 'aria-label': 'Easing', style: 'display:flex;flex-wrap:wrap;gap:6px;align-items:flex-start;padding:4px 0' }, box);
|
|
278
|
+
const status = h('div', { role: 'status', 'aria-live': 'polite', style: 'position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap' }, box);
|
|
279
|
+
const say = (m) => { status.textContent = m; };
|
|
280
|
+
// --- model ----------------------------------------------------------------------------------------------------------
|
|
281
|
+
const doc = () => history.doc;
|
|
282
|
+
const layer = (id) => doc().layers.find((l) => l.id === id);
|
|
283
|
+
const nameOf = (l) => l.name || l.id;
|
|
284
|
+
const len = () => Math.max(timelineDocDuration(doc()), minLen);
|
|
285
|
+
const px = (t) => r2((t * zoom) / 1000);
|
|
286
|
+
const keys = () => doc().layers.flatMap((l) => l.keyframes || []);
|
|
287
|
+
const keyOf = (id) => keys().find((k) => k.id === id);
|
|
288
|
+
const keyAt = (l, t) => l?.keyframes?.find((k) => Math.abs(k.time - t) < F / 2);
|
|
289
|
+
const depth = (l) => { let n = 0; for (let p = layer(l.parent); p && n < 32; p = layer(p.parent))
|
|
290
|
+
n++; return n; };
|
|
291
|
+
const visible = () => doc().layers.filter((l) => { for (let p = layer(l.parent), n = 0; p && n < 32; p = layer(p.parent), n++)
|
|
292
|
+
if (collapsed.has(p.id))
|
|
293
|
+
return false; return true; });
|
|
294
|
+
const edit = (next, label) => {
|
|
295
|
+
if (next === doc())
|
|
296
|
+
return false;
|
|
297
|
+
history.apply(next, { label });
|
|
298
|
+
say(label);
|
|
299
|
+
return true;
|
|
300
|
+
};
|
|
301
|
+
const editable = (ids) => editableKeyframes(doc(), ids);
|
|
302
|
+
const valuesAt = (id) => {
|
|
303
|
+
const l = layer(id);
|
|
304
|
+
if (!l?.keyframes?.length)
|
|
305
|
+
return {};
|
|
306
|
+
const one = { ...doc(), duration: undefined, layers: [{ ...l, parent: undefined, muted: undefined, solo: undefined }] };
|
|
307
|
+
return sampleTimelineDoc(one, time).layers[l.id] || {};
|
|
308
|
+
};
|
|
309
|
+
// --- preview + canvas ---------------------------------------------------------------------------------------------------
|
|
310
|
+
const copts = typeof o.canvas === 'object' ? o.canvas : {};
|
|
311
|
+
const canvas = o.stage && o.canvas !== false
|
|
312
|
+
? createStudioCanvas(o.stage, { ...copts, history, time, onSelect: (ids) => { copts.onSelect?.(ids); if (ids.length === 1)
|
|
313
|
+
api.focusLayer(ids[0]); } })
|
|
314
|
+
: undefined;
|
|
315
|
+
const preview = createTimelinePreview(o.stage || D.createElement('div'), doc(), {
|
|
316
|
+
onFrame: (f) => {
|
|
317
|
+
if (!playing)
|
|
318
|
+
return;
|
|
319
|
+
time = f.time;
|
|
320
|
+
drawTime();
|
|
321
|
+
if (time >= preview.duration)
|
|
322
|
+
stop();
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
// --- rendering --------------------------------------------------------------------------------------------------------
|
|
326
|
+
const sig = (e) => {
|
|
327
|
+
if (!e || !box.contains(e))
|
|
328
|
+
return;
|
|
329
|
+
for (const a of ['data-key', 'data-row-head', 'data-prop', 'data-key-prop', 'data-handle', 'data-field'])
|
|
330
|
+
if (e.hasAttribute(a))
|
|
331
|
+
return `[${a}="${e.getAttribute(a)}"]`;
|
|
332
|
+
const act = e.getAttribute('data-act'), row = e.closest('[data-layer]');
|
|
333
|
+
return act ? `${row ? `[data-layer="${row.getAttribute('data-layer')}"] ` : ''}[data-act="${act}"]` : undefined;
|
|
334
|
+
};
|
|
335
|
+
const refocus = (s) => { if (s)
|
|
336
|
+
box.querySelector(s)?.focus(); };
|
|
337
|
+
function render() {
|
|
338
|
+
if (dead)
|
|
339
|
+
return;
|
|
340
|
+
const s = sig(D.activeElement);
|
|
341
|
+
const rows = visible(), W = px(len()) + 40;
|
|
342
|
+
body.textContent = '';
|
|
343
|
+
grid.setAttribute('aria-rowcount', String(rows.length + 1));
|
|
344
|
+
ruler.style.minWidth = `${W}px`;
|
|
345
|
+
rows.forEach((l, i) => {
|
|
346
|
+
const n = nameOf(l), d = depth(l), grp = l.type === 'group', col = collapsed.has(l.id);
|
|
347
|
+
const row = h('div', { role: 'row', 'data-layer': l.id, 'aria-rowindex': String(i + 2), 'aria-level': String(d + 1), style: `display:flex;height:${RH}px;box-sizing:border-box;border-top:1px solid #8883` }, body);
|
|
348
|
+
if (grp)
|
|
349
|
+
row.setAttribute('aria-expanded', String(!col));
|
|
350
|
+
const hd = h('div', { role: 'rowheader', 'data-row-head': l.id, tabindex: '-1', style: `flex:0 0 ${HEAD}px;display:flex;align-items:center;gap:2px;padding-left:${4 + d * 12}px;box-sizing:border-box;overflow:hidden;white-space:nowrap;position:sticky;left:0;z-index:1;background:Canvas` }, row);
|
|
351
|
+
if (grp)
|
|
352
|
+
btn('collapse', `${col ? 'Expand' : 'Collapse'} ${n}`, col ? '▸' : '▾', hd, { 'aria-expanded': String(!col), tabindex: '-1' });
|
|
353
|
+
h('span', { style: `flex:1;overflow:hidden;text-overflow:ellipsis${grp ? ';font-weight:600' : ''}` }, hd, n);
|
|
354
|
+
btn('mute', `Mute ${n}`, 'M', hd, { 'aria-pressed': String(!!l.muted), tabindex: '-1' });
|
|
355
|
+
btn('lock', `Lock ${n}`, 'L', hd, { 'aria-pressed': String(!!l.locked), tabindex: '-1' });
|
|
356
|
+
const cell = h('div', { role: 'gridcell', 'data-keys': l.id, style: `position:relative;flex:1 0 auto;min-width:${W}px;touch-action:none` }, row);
|
|
357
|
+
const ks = coarse ? 16 : 11;
|
|
358
|
+
for (const k of l.keyframes || []) {
|
|
359
|
+
h('button', {
|
|
360
|
+
type: 'button', 'data-key': k.id, tabindex: '-1',
|
|
361
|
+
'aria-label': `${n}: ${Object.keys(k.props).join(', ') || 'empty'} at ${fmt(k.time)}${k.easing ? `, ${k.easing}` : ''}`,
|
|
362
|
+
style: `position:absolute;left:${px(k.time)}px;top:50%;width:${ks}px;height:${ks}px;margin:${-ks / 2}px 0 0 ${-ks / 2}px;padding:0;border:1px solid #0a84ff;border-radius:2px;transform:rotate(45deg);cursor:grab;touch-action:none`,
|
|
363
|
+
}, cell);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
// ruler ticks
|
|
367
|
+
ticks.textContent = '';
|
|
368
|
+
const step = [10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 30000].find((s) => (s * zoom) / 1000 >= 56) || 60000;
|
|
369
|
+
for (let tt = 0; tt <= len(); tt += step)
|
|
370
|
+
h('span', { style: `position:absolute;left:${px(tt)}px;bottom:0;border-left:1px solid #8888;padding-left:2px;font-size:10px;opacity:.7` }, ticks, `${tt / 1000}s`);
|
|
371
|
+
drawTime();
|
|
372
|
+
paint();
|
|
373
|
+
refocus(s);
|
|
374
|
+
}
|
|
375
|
+
/** Selection, focus and the panels that follow them — without rebuilding the rows (keys keep their elements). */
|
|
376
|
+
function paint() {
|
|
377
|
+
for (const b of body.querySelectorAll('[data-key]')) {
|
|
378
|
+
const on = selection.includes(b.getAttribute('data-key'));
|
|
379
|
+
b.setAttribute('aria-pressed', String(on));
|
|
380
|
+
b.style.background = on ? '#0a84ff' : 'Canvas';
|
|
381
|
+
}
|
|
382
|
+
for (const r of body.querySelectorAll('[data-layer]'))
|
|
383
|
+
r.style.background = r.getAttribute('data-layer') === focusId ? '#0a84ff1a' : '';
|
|
384
|
+
for (const e of body.querySelectorAll('[tabindex="0"]'))
|
|
385
|
+
e.setAttribute('tabindex', '-1');
|
|
386
|
+
const first = body.querySelector('[data-row-head]');
|
|
387
|
+
if (!focusAt || !box.querySelector(focusAt))
|
|
388
|
+
focusAt = first ? `[data-row-head="${first.getAttribute('data-row-head')}"]` : undefined;
|
|
389
|
+
if (focusAt)
|
|
390
|
+
box.querySelector(focusAt).setAttribute('tabindex', '0');
|
|
391
|
+
renderInspector();
|
|
392
|
+
renderCurve();
|
|
393
|
+
}
|
|
394
|
+
function drawTime() {
|
|
395
|
+
const n = Math.round(time / F), L = len();
|
|
396
|
+
head.style.left = `${px(time)}px`;
|
|
397
|
+
head.setAttribute('aria-valuenow', String(time));
|
|
398
|
+
head.setAttribute('aria-valuemax', String(L));
|
|
399
|
+
head.setAttribute('aria-valuetext', `${fmt(time)}, frame ${n}`);
|
|
400
|
+
timeOut.textContent = `${fmt(time)} · f${n}`;
|
|
401
|
+
playBtn.setAttribute('aria-pressed', String(playing));
|
|
402
|
+
playBtn.setAttribute('aria-label', playing ? 'Pause' : 'Play');
|
|
403
|
+
playBtn.textContent = playing ? '⏸' : '▶';
|
|
404
|
+
}
|
|
405
|
+
function renderInspector() {
|
|
406
|
+
insp.textContent = '';
|
|
407
|
+
const l = layer(focusId);
|
|
408
|
+
if (!l || l.type !== 'track') {
|
|
409
|
+
h('p', { style: 'margin:0;opacity:.7' }, insp, 'Focus a track to edit its values.');
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
h('div', { style: 'font-weight:600' }, insp, `${nameOf(l)} · ${fmt(time)}`);
|
|
413
|
+
const vals = valuesAt(l.id), k = keyAt(l, time);
|
|
414
|
+
for (const p of Object.keys(vals).sort()) {
|
|
415
|
+
const r = h('div', { style: 'display:flex;gap:4px;align-items:center' }, insp);
|
|
416
|
+
h('span', { style: 'min-width:7em' }, r, p);
|
|
417
|
+
h('input', { 'data-prop': p, 'aria-label': `${p} at ${fmt(time)}`, value: String(vals[p]) }, r);
|
|
418
|
+
const on = !!k && p in k.props;
|
|
419
|
+
h('button', { type: 'button', 'data-key-prop': p, 'aria-pressed': String(on), 'aria-label': `Keyframe ${p} at ${fmt(time)}` }, r, on ? '◆' : '◇');
|
|
420
|
+
}
|
|
421
|
+
const r = h('div', { style: 'display:flex;gap:4px;align-items:center' }, insp);
|
|
422
|
+
field('prop-name', 'New property', r, { placeholder: 'property' });
|
|
423
|
+
field('prop-value', 'New property value', r, { placeholder: 'value' });
|
|
424
|
+
btn('add-prop', 'Add property key', '+ Key', r);
|
|
425
|
+
}
|
|
426
|
+
const curveIds = () => editable(selection);
|
|
427
|
+
function renderCurve() {
|
|
428
|
+
curve.textContent = '';
|
|
429
|
+
const ids = curveIds(), k = ids.length ? keyOf(ids[0]) : undefined;
|
|
430
|
+
const b = parseBezier(k?.easing) || [0, 0, 1, 1];
|
|
431
|
+
const X = (x) => r2(x * CW), Y = (y) => r2(CP + (1 - y) * CW);
|
|
432
|
+
const svg = D.createElementNS(SVG, 'svg');
|
|
433
|
+
const sa = (e, a) => { for (const n in a)
|
|
434
|
+
e.setAttribute(n, String(a[n])); return e; };
|
|
435
|
+
sa(svg, { width: CW, height: CW + 2 * CP, viewBox: `0 0 ${CW} ${CW + 2 * CP}`, role: 'img', 'aria-label': `Curve ${k ? bezierEasing(b) : '(no keyframe selected)'}`, style: 'touch-action:none;overflow:visible;border:1px solid #8884' });
|
|
436
|
+
const el = (tag, a) => svg.appendChild(sa(D.createElementNS(SVG, tag), a));
|
|
437
|
+
el('rect', { x: 0, y: CP, width: CW, height: CW, fill: 'none', stroke: '#8886' });
|
|
438
|
+
el('path', { d: `M0 ${Y(0)} C${X(b[0])} ${Y(b[1])} ${X(b[2])} ${Y(b[3])} ${CW} ${Y(1)}`, fill: 'none', stroke: '#0a84ff', 'stroke-width': 2 });
|
|
439
|
+
el('line', { x1: 0, y1: Y(0), x2: X(b[0]), y2: Y(b[1]), stroke: '#8888' });
|
|
440
|
+
el('line', { x1: CW, y1: Y(1), x2: X(b[2]), y2: Y(b[3]), stroke: '#8888' });
|
|
441
|
+
for (const n of [1, 2]) {
|
|
442
|
+
const x = b[n * 2 - 2], y = b[n * 2 - 1];
|
|
443
|
+
el('circle', { 'data-handle': n, cx: X(x), cy: Y(y), r: coarse ? 11 : 6, fill: '#0a84ff', role: 'slider', tabindex: k ? 0 : -1, 'aria-label': `Control point ${n}`, 'aria-valuenow': x, 'aria-valuetext': `${x}, ${y}`, style: 'cursor:move;touch-action:none' });
|
|
444
|
+
}
|
|
445
|
+
curve.append(svg);
|
|
446
|
+
const side = h('div', { style: 'display:grid;gap:4px' }, curve);
|
|
447
|
+
const sel = h('select', { 'data-field': 'preset', 'aria-label': 'Curve preset' }, side);
|
|
448
|
+
const cur = bezierEasing(b);
|
|
449
|
+
h('option', { value: '' }, sel, 'Custom');
|
|
450
|
+
for (const p of Object.keys(CURVE_PRESETS)) {
|
|
451
|
+
const op = h('option', { value: p }, sel, p);
|
|
452
|
+
if (k && bezierEasing(CURVE_PRESETS[p]) === cur)
|
|
453
|
+
op.setAttribute('selected', '');
|
|
454
|
+
}
|
|
455
|
+
const sp = (k && springs[k.id]) || springParams();
|
|
456
|
+
for (const f of ['stiffness', 'damping', 'mass']) {
|
|
457
|
+
const lb = h('label', { style: 'display:flex;gap:4px;justify-content:space-between' }, side, f);
|
|
458
|
+
field(f, `Spring ${f}`, lb, { type: 'number', min: '0', step: 'any', value: String(sp[f]), style: 'width:6em' });
|
|
459
|
+
}
|
|
460
|
+
btn('spring', 'Apply spring', 'Spring', side);
|
|
461
|
+
if (!k)
|
|
462
|
+
for (const c of side.querySelectorAll('select,input,button'))
|
|
463
|
+
c.setAttribute('disabled', '');
|
|
464
|
+
}
|
|
465
|
+
// --- edits ------------------------------------------------------------------------------------------------------------
|
|
466
|
+
const setSel = (ids) => {
|
|
467
|
+
const have = new Set(keys().map((k) => k.id));
|
|
468
|
+
selection = [...new Set(ids)].filter((id) => have.has(id));
|
|
469
|
+
paint();
|
|
470
|
+
say(`${selection.length} keyframe${selection.length === 1 ? '' : 's'} selected`);
|
|
471
|
+
};
|
|
472
|
+
const nudge = (n) => {
|
|
473
|
+
const ids = editable(selection);
|
|
474
|
+
const ref = keyOf(focusAt?.startsWith('[data-key=') && ids.includes(focusAt.slice(11, -2)) ? focusAt.slice(11, -2) : ids[0]);
|
|
475
|
+
return !!ref && edit(shiftKeyframes(doc(), ids, frameTime(ref.time + n * F, fps) - ref.time), 'Nudge keyframes');
|
|
476
|
+
};
|
|
477
|
+
const stop = () => {
|
|
478
|
+
preview.pause();
|
|
479
|
+
playing = false;
|
|
480
|
+
api.setTime(time);
|
|
481
|
+
};
|
|
482
|
+
// --- pointer ------------------------------------------------------------------------------------------------------------
|
|
483
|
+
const timeAt = (x, el) => ((x - el.getBoundingClientRect().left) * 1000) / zoom;
|
|
484
|
+
function onDown(e) {
|
|
485
|
+
if (g || dead || e.button > 0)
|
|
486
|
+
return;
|
|
487
|
+
const t = e.target;
|
|
488
|
+
const k = t.closest('[data-key]'), cell = t.closest('[data-keys]'), hd = t.closest('[data-handle]'), rh = t.closest('[data-row-head]');
|
|
489
|
+
const st = { mode: 'none', x0: e.clientX, y0: e.clientY };
|
|
490
|
+
if (hd) {
|
|
491
|
+
const ids = curveIds(), kk = ids.length ? keyOf(ids[0]) : undefined;
|
|
492
|
+
if (!kk)
|
|
493
|
+
return;
|
|
494
|
+
Object.assign(st, { mode: 'curve', h: +hd.getAttribute('data-handle'), b: parseBezier(kk.easing) || [0, 0, 1, 1], start: doc(), ids });
|
|
495
|
+
}
|
|
496
|
+
else if (k && cell) {
|
|
497
|
+
const id = k.getAttribute('data-key');
|
|
498
|
+
focusId = cell.getAttribute('data-keys');
|
|
499
|
+
focusAt = `[data-key="${id}"]`;
|
|
500
|
+
if (e.shiftKey || e.ctrlKey || e.metaKey) {
|
|
501
|
+
const s = new Set(selection);
|
|
502
|
+
s.has(id) ? s.delete(id) : s.add(id);
|
|
503
|
+
setSel([...s]);
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
if (!selection.includes(id))
|
|
507
|
+
setSel([id]);
|
|
508
|
+
else
|
|
509
|
+
paint();
|
|
510
|
+
const ids = editable(selection), moving = new Set(ids);
|
|
511
|
+
Object.assign(st, { mode: 'drag', t0: keyOf(id).time, start: doc(), ids, others: [time, ...keys().filter((x) => !moving.has(x.id)).map((x) => x.time)] });
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
else if (t.closest('[data-ruler]')) {
|
|
515
|
+
st.mode = 'scrub';
|
|
516
|
+
api.setTime(timeAt(e.clientX, ruler));
|
|
517
|
+
}
|
|
518
|
+
else if (cell) {
|
|
519
|
+
Object.assign(st, { mode: 'marquee', base: e.shiftKey || e.ctrlKey || e.metaKey ? selection.slice() : [], left: cell.getBoundingClientRect().left });
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
if (rh)
|
|
523
|
+
api.focusLayer(rh.getAttribute('data-row-head'));
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
g = st;
|
|
527
|
+
try {
|
|
528
|
+
box.setPointerCapture?.(e.pointerId);
|
|
529
|
+
}
|
|
530
|
+
catch { /* synthetic or inactive pointer */ }
|
|
531
|
+
box.addEventListener('pointermove', onMove);
|
|
532
|
+
box.addEventListener('pointerup', onUp);
|
|
533
|
+
box.addEventListener('pointercancel', onCancel);
|
|
534
|
+
}
|
|
535
|
+
function onMove(e) {
|
|
536
|
+
if (!g)
|
|
537
|
+
return;
|
|
538
|
+
const dx = e.clientX - g.x0, dy = e.clientY - g.y0;
|
|
539
|
+
if (!g.moved && Math.abs(dx) + Math.abs(dy) < 3 && g.mode !== 'scrub')
|
|
540
|
+
return;
|
|
541
|
+
g.moved = true;
|
|
542
|
+
if (g.mode === 'scrub')
|
|
543
|
+
api.setTime(timeAt(e.clientX, ruler));
|
|
544
|
+
else if (g.mode === 'drag') {
|
|
545
|
+
const raw = g.t0 + (dx * 1000) / zoom;
|
|
546
|
+
let t = Math.round(raw * 1e4) / 1e4;
|
|
547
|
+
if (o.snap !== false && !e.altKey) {
|
|
548
|
+
let near;
|
|
549
|
+
for (const x of g.others)
|
|
550
|
+
if (near === undefined || Math.abs(x - raw) < Math.abs(near - raw))
|
|
551
|
+
near = x;
|
|
552
|
+
t = near !== undefined && (Math.abs(near - raw) * zoom) / 1000 <= 6 ? near : frameTime(raw, fps);
|
|
553
|
+
}
|
|
554
|
+
if (!g.began) {
|
|
555
|
+
history.begin('Move keyframes');
|
|
556
|
+
g.began = true;
|
|
557
|
+
}
|
|
558
|
+
history.apply(shiftKeyframes(g.start, g.ids, Math.max(0, t) - g.t0));
|
|
559
|
+
}
|
|
560
|
+
else if (g.mode === 'curve') {
|
|
561
|
+
const svg = curve.querySelector('svg'), r = svg.getBoundingClientRect();
|
|
562
|
+
const x = r2(Math.min(1, Math.max(0, (e.clientX - r.left) / CW))), y = r2(1 - (e.clientY - r.top - CP) / CW);
|
|
563
|
+
const b = g.b.slice();
|
|
564
|
+
b[g.h * 2 - 2] = x;
|
|
565
|
+
b[g.h * 2 - 1] = y;
|
|
566
|
+
if (!g.began) {
|
|
567
|
+
history.begin('Edit curve');
|
|
568
|
+
g.began = true;
|
|
569
|
+
}
|
|
570
|
+
history.apply(setKeyframeEasing(g.start, g.ids, bezierEasing(b)));
|
|
571
|
+
}
|
|
572
|
+
else if (g.mode === 'marquee') {
|
|
573
|
+
const x1 = Math.min(e.clientX, g.x0), x2 = Math.max(e.clientX, g.x0), y1 = Math.min(e.clientY, g.y0), y2 = Math.max(e.clientY, g.y0);
|
|
574
|
+
if (!g.box)
|
|
575
|
+
g.box = h('div', { 'data-marquee': '', 'aria-hidden': 'true' }, box);
|
|
576
|
+
g.box.style.cssText = `position:fixed;left:${x1}px;top:${y1}px;width:${x2 - x1}px;height:${y2 - y1}px;border:1px dashed #0a84ff;background:#0a84ff22;pointer-events:none;z-index:3`;
|
|
577
|
+
const t1 = ((x1 - g.left) * 1000) / zoom, t2 = ((x2 - g.left) * 1000) / zoom, top = body.getBoundingClientRect().top;
|
|
578
|
+
const r1 = Math.floor((y1 - top) / RH), rr2 = Math.floor((y2 - top) / RH);
|
|
579
|
+
const hits = visible().filter((_, i) => i >= r1 && i <= rr2).flatMap((l) => (l.keyframes || []).filter((k) => k.time >= t1 && k.time <= t2).map((k) => k.id));
|
|
580
|
+
const before = selection.join();
|
|
581
|
+
selection = [...new Set([...g.base, ...hits])];
|
|
582
|
+
if (selection.join() !== before)
|
|
583
|
+
paint();
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
function end(cancel) {
|
|
587
|
+
const s = g;
|
|
588
|
+
g = null;
|
|
589
|
+
box.removeEventListener('pointermove', onMove);
|
|
590
|
+
box.removeEventListener('pointerup', onUp);
|
|
591
|
+
box.removeEventListener('pointercancel', onCancel);
|
|
592
|
+
if (!s)
|
|
593
|
+
return;
|
|
594
|
+
s.box?.remove();
|
|
595
|
+
if (s.began) {
|
|
596
|
+
cancel ? history.cancel() : history.commit();
|
|
597
|
+
render();
|
|
598
|
+
}
|
|
599
|
+
if (s.mode === 'marquee')
|
|
600
|
+
setSel(cancel ? s.base : s.moved ? selection : s.base);
|
|
601
|
+
}
|
|
602
|
+
const onUp = () => end(false);
|
|
603
|
+
const onCancel = () => end(true);
|
|
604
|
+
function onWheel(e) {
|
|
605
|
+
if (!(e.ctrlKey || e.metaKey))
|
|
606
|
+
return;
|
|
607
|
+
e.preventDefault();
|
|
608
|
+
api.setZoom(zoom * (e.deltaY < 0 ? 1.25 : 0.8));
|
|
609
|
+
}
|
|
610
|
+
// --- keyboard -------------------------------------------------------------------------------------------------------------
|
|
611
|
+
function move(k, e) {
|
|
612
|
+
const rows = visible();
|
|
613
|
+
const at = focusAt ? box.querySelector(focusAt) : null;
|
|
614
|
+
const rowId = at?.closest('[data-layer]')?.getAttribute('data-layer');
|
|
615
|
+
let r = Math.max(0, rows.findIndex((l) => l.id === rowId));
|
|
616
|
+
const kid = at?.getAttribute('data-key');
|
|
617
|
+
const ks = (i) => rows[i]?.keyframes || [];
|
|
618
|
+
let i = kid ? ks(r).findIndex((x) => x.id === kid) : -1;
|
|
619
|
+
if (k === 'ArrowLeft')
|
|
620
|
+
i = Math.max(-1, i - 1);
|
|
621
|
+
else if (k === 'ArrowRight')
|
|
622
|
+
i = Math.min(ks(r).length - 1, i + 1);
|
|
623
|
+
else if (k === 'Home')
|
|
624
|
+
i = -1;
|
|
625
|
+
else if (k === 'End')
|
|
626
|
+
i = ks(r).length - 1;
|
|
627
|
+
else {
|
|
628
|
+
const t = i >= 0 ? ks(r)[i].time : undefined;
|
|
629
|
+
r = Math.min(rows.length - 1, Math.max(0, r + (k === 'ArrowUp' ? -1 : 1)));
|
|
630
|
+
i = t === undefined || !ks(r).length ? -1 : ks(r).reduce((b, x, j) => (Math.abs(x.time - t) < Math.abs(ks(r)[b].time - t) ? j : b), 0);
|
|
631
|
+
}
|
|
632
|
+
if (!rows[r])
|
|
633
|
+
return;
|
|
634
|
+
focusAt = i >= 0 ? `[data-key="${ks(r)[i].id}"]` : `[data-row-head="${rows[r].id}"]`;
|
|
635
|
+
focusId = rows[r].id;
|
|
636
|
+
render();
|
|
637
|
+
refocus(focusAt);
|
|
638
|
+
if (e)
|
|
639
|
+
e.preventDefault();
|
|
640
|
+
}
|
|
641
|
+
function onKey(e) {
|
|
642
|
+
if (e.defaultPrevented || dead)
|
|
643
|
+
return;
|
|
644
|
+
const t = e.target, k = e.key, mod = e.ctrlKey || e.metaKey;
|
|
645
|
+
if (/^(INPUT|SELECT|TEXTAREA)$/.test(t.tagName) || t.isContentEditable)
|
|
646
|
+
return;
|
|
647
|
+
const act = historyKeyAction(e);
|
|
648
|
+
if (act) {
|
|
649
|
+
e.preventDefault();
|
|
650
|
+
history[act]();
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
if (t.closest('[data-handle]')) {
|
|
654
|
+
const ids = curveIds(), kk = ids.length ? keyOf(ids[0]) : undefined, d = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, 1], ArrowDown: [0, -1] }[k];
|
|
655
|
+
if (!kk || !d)
|
|
656
|
+
return;
|
|
657
|
+
e.preventDefault();
|
|
658
|
+
const n = +t.getAttribute('data-handle'), b = parseBezier(kk.easing) || [0, 0, 1, 1], s = e.shiftKey ? 0.1 : 0.01;
|
|
659
|
+
b[n * 2 - 2] = r2(Math.min(1, Math.max(0, b[n * 2 - 2] + d[0] * s)));
|
|
660
|
+
b[n * 2 - 1] = r2(b[n * 2 - 1] + d[1] * s);
|
|
661
|
+
api.setBezier(b);
|
|
662
|
+
refocus(`[data-handle="${n}"]`);
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
if (t === head) {
|
|
666
|
+
const map = { ArrowLeft: -1, ArrowDown: -1, ArrowRight: 1, ArrowUp: 1, PageDown: -10, PageUp: 10 };
|
|
667
|
+
if (k === 'Home')
|
|
668
|
+
api.setTime(0);
|
|
669
|
+
else if (k === 'End')
|
|
670
|
+
api.setTime(len());
|
|
671
|
+
else if (map[k])
|
|
672
|
+
api.step(map[k]);
|
|
673
|
+
else
|
|
674
|
+
return;
|
|
675
|
+
e.preventDefault();
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
if (!t.closest('[role="grid"]'))
|
|
679
|
+
return;
|
|
680
|
+
const at = focusAt ? box.querySelector(focusAt) : null, row = layer(at?.closest('[data-layer]')?.getAttribute('data-layer') || undefined);
|
|
681
|
+
const lk = k.toLowerCase();
|
|
682
|
+
if (mod && lk === 'a')
|
|
683
|
+
api.selectAllKeys();
|
|
684
|
+
else if (mod && lk === 'c')
|
|
685
|
+
api.copy();
|
|
686
|
+
else if (mod && lk === 'v')
|
|
687
|
+
api.paste();
|
|
688
|
+
else if (mod)
|
|
689
|
+
return;
|
|
690
|
+
else if (e.altKey && (k === 'ArrowLeft' || k === 'ArrowRight')) {
|
|
691
|
+
nudge((k === 'ArrowLeft' ? -1 : 1) * (e.shiftKey ? 10 : 1));
|
|
692
|
+
refocus(focusAt);
|
|
693
|
+
}
|
|
694
|
+
else if (/^Arrow|^Home$|^End$/.test(k))
|
|
695
|
+
move(k, e);
|
|
696
|
+
else if (k === 'Delete' || k === 'Backspace')
|
|
697
|
+
api.deleteKeys();
|
|
698
|
+
else if (k === ',' || k === '<')
|
|
699
|
+
api.step(k === '<' || e.shiftKey ? -10 : -1);
|
|
700
|
+
else if (k === '.' || k === '>')
|
|
701
|
+
api.step(k === '>' || e.shiftKey ? 10 : 1);
|
|
702
|
+
else if (lk === 'k')
|
|
703
|
+
playing ? api.pause() : api.play();
|
|
704
|
+
else if ((k === 'Enter' || k === ' ') && at) {
|
|
705
|
+
const kid = at.getAttribute('data-key');
|
|
706
|
+
if (kid)
|
|
707
|
+
api.selectKeys([kid], { toggle: e.shiftKey });
|
|
708
|
+
else if (row?.type === 'group')
|
|
709
|
+
api.collapse(row.id, !collapsed.has(row.id));
|
|
710
|
+
else if (row)
|
|
711
|
+
api.focusLayer(row.id);
|
|
712
|
+
refocus(focusAt);
|
|
713
|
+
}
|
|
714
|
+
else if ((lk === 'm' || lk === 'l') && row)
|
|
715
|
+
api[lk === 'm' ? 'mute' : 'lock']([row.id], !row[lk === 'm' ? 'muted' : 'locked']);
|
|
716
|
+
else if (k === '-' || k === '=' || k === '+')
|
|
717
|
+
api.setZoom(zoom * (k === '-' ? 0.8 : 1.25));
|
|
718
|
+
else
|
|
719
|
+
return;
|
|
720
|
+
e.preventDefault();
|
|
721
|
+
}
|
|
722
|
+
// --- clicks / fields -------------------------------------------------------------------------------------------------------
|
|
723
|
+
const val = (f) => box.querySelector(`[data-field="${f}"]`)?.value.trim() ?? '';
|
|
724
|
+
function onClick(e) {
|
|
725
|
+
const b = e.target.closest('[data-act],[data-key-prop]');
|
|
726
|
+
if (!b || dead || b.disabled)
|
|
727
|
+
return;
|
|
728
|
+
const lid = b.closest('[data-layer]')?.getAttribute('data-layer') || '', l = layer(lid);
|
|
729
|
+
const kp = b.getAttribute('data-key-prop');
|
|
730
|
+
if (kp) {
|
|
731
|
+
if (b.getAttribute('aria-pressed') === 'true')
|
|
732
|
+
api.removeKey(focusId, kp);
|
|
733
|
+
else {
|
|
734
|
+
const v = valuesAt(focusId)[kp];
|
|
735
|
+
if (v !== undefined)
|
|
736
|
+
api.setValue(focusId, kp, v);
|
|
737
|
+
}
|
|
738
|
+
refocus(`[data-key-prop="${kp}"]`);
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
switch (b.getAttribute('data-act')) {
|
|
742
|
+
case 'prev':
|
|
743
|
+
api.step(-1);
|
|
744
|
+
break;
|
|
745
|
+
case 'next':
|
|
746
|
+
api.step(1);
|
|
747
|
+
break;
|
|
748
|
+
case 'play':
|
|
749
|
+
playing ? api.pause() : api.play();
|
|
750
|
+
break;
|
|
751
|
+
case 'undo':
|
|
752
|
+
history.undo();
|
|
753
|
+
break;
|
|
754
|
+
case 'redo':
|
|
755
|
+
history.redo();
|
|
756
|
+
break;
|
|
757
|
+
case 'zoom-in':
|
|
758
|
+
api.setZoom(zoom * 1.25);
|
|
759
|
+
break;
|
|
760
|
+
case 'zoom-out':
|
|
761
|
+
api.setZoom(zoom * 0.8);
|
|
762
|
+
break;
|
|
763
|
+
case 'add-track':
|
|
764
|
+
api.addTrack({ name: nameIn.value.trim() || undefined, target: targetIn.value.trim() || undefined });
|
|
765
|
+
break;
|
|
766
|
+
case 'add-group':
|
|
767
|
+
api.addGroup({ name: nameIn.value.trim() || undefined });
|
|
768
|
+
break;
|
|
769
|
+
case 'collapse':
|
|
770
|
+
api.collapse(lid, !collapsed.has(lid));
|
|
771
|
+
break;
|
|
772
|
+
case 'mute':
|
|
773
|
+
if (l)
|
|
774
|
+
api.mute([lid], !l.muted);
|
|
775
|
+
break;
|
|
776
|
+
case 'lock':
|
|
777
|
+
if (l)
|
|
778
|
+
api.lock([lid], !l.locked);
|
|
779
|
+
break;
|
|
780
|
+
case 'add-prop': {
|
|
781
|
+
const p = val('prop-name');
|
|
782
|
+
if (focusId && PROP.test(p) && !/^(__proto__|constructor|prototype)$/.test(p))
|
|
783
|
+
api.setValue(focusId, p, parseVal(val('prop-value')));
|
|
784
|
+
refocus('[data-field="prop-name"]');
|
|
785
|
+
break;
|
|
786
|
+
}
|
|
787
|
+
case 'spring':
|
|
788
|
+
api.setSpring({ stiffness: +val('stiffness'), damping: +val('damping'), mass: +val('mass') });
|
|
789
|
+
break;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
function onChange(e) {
|
|
793
|
+
const t = e.target;
|
|
794
|
+
const p = t.getAttribute('data-prop');
|
|
795
|
+
if (p && focusId) {
|
|
796
|
+
api.setValue(focusId, p, parseVal(t.value));
|
|
797
|
+
refocus(`[data-prop="${p}"]`);
|
|
798
|
+
}
|
|
799
|
+
else if (t.getAttribute('data-field') === 'preset' && CURVE_PRESETS[t.value]) {
|
|
800
|
+
api.setBezier(CURVE_PRESETS[t.value]);
|
|
801
|
+
refocus('[data-field="preset"]');
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
// --- API -------------------------------------------------------------------------------------------------------------------
|
|
805
|
+
const api = {
|
|
806
|
+
el: box,
|
|
807
|
+
canvas,
|
|
808
|
+
get time() { return time; },
|
|
809
|
+
get zoom() { return zoom; },
|
|
810
|
+
fps,
|
|
811
|
+
get playing() { return playing; },
|
|
812
|
+
get selection() { return selection.slice(); },
|
|
813
|
+
get focusedLayer() { return focusId; },
|
|
814
|
+
get collapsed() { return [...collapsed]; },
|
|
815
|
+
setTime(ms) {
|
|
816
|
+
const L = len();
|
|
817
|
+
time = Math.min(L, Math.max(0, frameTime(Math.min(L, Math.max(0, Number.isFinite(ms) ? ms : 0)), fps)));
|
|
818
|
+
canvas?.setTime(time);
|
|
819
|
+
preview.seek(time);
|
|
820
|
+
drawTime();
|
|
821
|
+
if (!playing)
|
|
822
|
+
renderInspector();
|
|
823
|
+
return time;
|
|
824
|
+
},
|
|
825
|
+
step: (n = 1) => api.setTime((Math.round(time / F) + Math.round(n)) * F),
|
|
826
|
+
play() {
|
|
827
|
+
if (playing || dead)
|
|
828
|
+
return;
|
|
829
|
+
playing = true;
|
|
830
|
+
if (time >= preview.duration)
|
|
831
|
+
api.setTime(0);
|
|
832
|
+
preview.play();
|
|
833
|
+
drawTime();
|
|
834
|
+
},
|
|
835
|
+
pause() { if (playing)
|
|
836
|
+
stop(); },
|
|
837
|
+
setZoom(z) {
|
|
838
|
+
zoom = Math.min(5000, Math.max(10, Number.isFinite(z) ? z : zoom));
|
|
839
|
+
render();
|
|
840
|
+
},
|
|
841
|
+
selectKeys(ids, s = {}) {
|
|
842
|
+
if (s.toggle) {
|
|
843
|
+
const set = new Set(selection);
|
|
844
|
+
for (const id of ids)
|
|
845
|
+
set.has(id) ? set.delete(id) : set.add(id);
|
|
846
|
+
setSel([...set]);
|
|
847
|
+
}
|
|
848
|
+
else
|
|
849
|
+
setSel(s.add ? [...selection, ...ids] : ids);
|
|
850
|
+
},
|
|
851
|
+
selectAllKeys: () => setSel(keys().map((k) => k.id)),
|
|
852
|
+
clearSelection: () => setSel([]),
|
|
853
|
+
focusLayer(id) {
|
|
854
|
+
focusId = layer(id) ? id : undefined;
|
|
855
|
+
if (focusId)
|
|
856
|
+
focusAt = `[data-row-head="${focusId}"]`;
|
|
857
|
+
render();
|
|
858
|
+
},
|
|
859
|
+
moveKeys: (dt, ids = selection) => edit(shiftKeyframes(doc(), editable(ids), dt), 'Move keyframes'),
|
|
860
|
+
copy() {
|
|
861
|
+
if (!selection.length)
|
|
862
|
+
return undefined;
|
|
863
|
+
return (clip = copyKeyframes(doc(), selection));
|
|
864
|
+
},
|
|
865
|
+
paste(at = time) {
|
|
866
|
+
if (!clip)
|
|
867
|
+
return [];
|
|
868
|
+
const r = pasteKeyframes(doc(), clip, { at });
|
|
869
|
+
if (!edit(r.doc, 'Paste keyframes'))
|
|
870
|
+
return [];
|
|
871
|
+
setSel(r.ids);
|
|
872
|
+
return r.ids;
|
|
873
|
+
},
|
|
874
|
+
deleteKeys(ids = selection) {
|
|
875
|
+
const ok = edit(removeKeyframes(doc(), editable(ids)), 'Delete keyframes');
|
|
876
|
+
if (ok)
|
|
877
|
+
setSel(selection);
|
|
878
|
+
return ok;
|
|
879
|
+
},
|
|
880
|
+
addTrack(t = {}) {
|
|
881
|
+
const f = layer(focusId), parent = t.parent ?? (f?.type === 'group' ? f.id : f?.parent);
|
|
882
|
+
const n = doc().layers.length + 1;
|
|
883
|
+
const next = addLayer(doc(), { type: 'track', name: t.name || t.target || `Track ${n}`, ...(t.target ? { target: t.target } : {}), ...(parent ? { parent } : {}) });
|
|
884
|
+
const id = next.layers.find((l) => !doc().layers.includes(l))?.id || '';
|
|
885
|
+
if (id) {
|
|
886
|
+
focusId = id;
|
|
887
|
+
focusAt = `[data-row-head="${id}"]`;
|
|
888
|
+
edit(next, 'Add track');
|
|
889
|
+
}
|
|
890
|
+
return id;
|
|
891
|
+
},
|
|
892
|
+
addGroup(t = {}) {
|
|
893
|
+
const f = layer(focusId), parent = t.parent ?? (f?.type === 'group' ? f.id : f?.parent);
|
|
894
|
+
const next = addLayer(doc(), { type: 'group', name: t.name || `Group ${doc().layers.length + 1}`, ...(parent ? { parent } : {}) });
|
|
895
|
+
const id = next.layers.find((l) => !doc().layers.includes(l))?.id || '';
|
|
896
|
+
if (id) {
|
|
897
|
+
focusId = id;
|
|
898
|
+
focusAt = `[data-row-head="${id}"]`;
|
|
899
|
+
edit(next, 'Add group');
|
|
900
|
+
}
|
|
901
|
+
return id;
|
|
902
|
+
},
|
|
903
|
+
collapse(id, v = true) {
|
|
904
|
+
if (layer(id)?.type !== 'group')
|
|
905
|
+
return;
|
|
906
|
+
v ? collapsed.add(id) : collapsed.delete(id);
|
|
907
|
+
render();
|
|
908
|
+
},
|
|
909
|
+
mute: (ids, v = true) => edit(updateLayers(doc(), ids, { muted: v }), v ? 'Mute' : 'Unmute'),
|
|
910
|
+
lock: (ids, v = true) => edit(updateLayers(doc(), ids, { locked: v }), v ? 'Lock' : 'Unlock'),
|
|
911
|
+
valuesAt,
|
|
912
|
+
setValue(id, p, v) {
|
|
913
|
+
const l = layer(id);
|
|
914
|
+
if (!l || l.type !== 'track' || isLayerLocked(doc(), id))
|
|
915
|
+
return false;
|
|
916
|
+
const k = keyAt(l, time);
|
|
917
|
+
return edit(k ? setKeyframeProps(doc(), k.id, { [p]: v }) : addKeyframe(doc(), id, { time, props: { [p]: v } }), `Set ${p}`);
|
|
918
|
+
},
|
|
919
|
+
removeKey(id, p) {
|
|
920
|
+
const k = keyAt(layer(id), time);
|
|
921
|
+
if (!k)
|
|
922
|
+
return false;
|
|
923
|
+
const rest = p ? Object.keys(k.props).filter((x) => x !== p) : [];
|
|
924
|
+
return edit(rest.length ? setKeyframeProps(doc(), k.id, { [p]: null }) : removeKeyframes(doc(), [k.id]), p ? `Remove ${p} key` : 'Remove keyframe');
|
|
925
|
+
},
|
|
926
|
+
setEasing: (easing, ids = selection) => edit(setKeyframeEasing(doc(), editable(ids), easing), 'Easing'),
|
|
927
|
+
setBezier: (b, ids = selection) => api.setEasing(bezierEasing(b), ids),
|
|
928
|
+
setSpring(s, ids = selection) {
|
|
929
|
+
const p = springParams(s), ok = editable(ids);
|
|
930
|
+
for (const id of ok)
|
|
931
|
+
springs[id] = p;
|
|
932
|
+
const changed = api.setEasing(springBezier(p).easing, ok);
|
|
933
|
+
if (!changed)
|
|
934
|
+
render();
|
|
935
|
+
return changed;
|
|
936
|
+
},
|
|
937
|
+
frames: () => sampleFrames(doc(), { fps }),
|
|
938
|
+
save: () => serializeStudioProject(doc(), { time, zoom, fps, collapsed: [...collapsed], springs }),
|
|
939
|
+
exportScene: () => timelineDocToScene(doc()),
|
|
940
|
+
load(input) {
|
|
941
|
+
const r = parseStudioProject(input);
|
|
942
|
+
if (playing)
|
|
943
|
+
stop();
|
|
944
|
+
springs = { ...(r.ui.springs || {}) };
|
|
945
|
+
collapsed = new Set(r.ui.collapsed || []);
|
|
946
|
+
selection = [];
|
|
947
|
+
focusId = undefined;
|
|
948
|
+
if (r.ui.zoom)
|
|
949
|
+
zoom = r.ui.zoom;
|
|
950
|
+
history.reset(r.doc);
|
|
951
|
+
api.setTime(r.ui.time ?? 0);
|
|
952
|
+
return r.lost;
|
|
953
|
+
},
|
|
954
|
+
undo: () => history.undo(),
|
|
955
|
+
redo: () => history.redo(),
|
|
956
|
+
destroy() {
|
|
957
|
+
if (dead)
|
|
958
|
+
return;
|
|
959
|
+
if (g?.began)
|
|
960
|
+
history.cancel();
|
|
961
|
+
end(true);
|
|
962
|
+
preview.pause();
|
|
963
|
+
dead = true;
|
|
964
|
+
unsub();
|
|
965
|
+
preview.destroy();
|
|
966
|
+
canvas?.destroy();
|
|
967
|
+
box.removeEventListener('pointerdown', onDown);
|
|
968
|
+
box.removeEventListener('keydown', onKey);
|
|
969
|
+
box.removeEventListener('click', onClick);
|
|
970
|
+
box.removeEventListener('change', onChange);
|
|
971
|
+
grid.removeEventListener('wheel', onWheel);
|
|
972
|
+
box.remove();
|
|
973
|
+
},
|
|
974
|
+
};
|
|
975
|
+
const unsub = history.subscribe((d) => {
|
|
976
|
+
if (dead)
|
|
977
|
+
return;
|
|
978
|
+
const have = new Set(d.layers.flatMap((l) => (l.keyframes || []).map((k) => k.id)));
|
|
979
|
+
selection = selection.filter((id) => have.has(id));
|
|
980
|
+
for (const id of collapsed)
|
|
981
|
+
if (!d.layers.some((l) => l.id === id))
|
|
982
|
+
collapsed.delete(id);
|
|
983
|
+
if (focusId && !layer(focusId))
|
|
984
|
+
focusId = undefined;
|
|
985
|
+
preview.setDoc(d);
|
|
986
|
+
// during a drag only what moves is updated, so the element under the pointer stays in place; the full render follows on release
|
|
987
|
+
if (g?.mode === 'drag')
|
|
988
|
+
for (const b of body.querySelectorAll('[data-key]')) {
|
|
989
|
+
const k = keyOf(b.getAttribute('data-key'));
|
|
990
|
+
if (k)
|
|
991
|
+
b.style.left = `${px(k.time)}px`;
|
|
992
|
+
}
|
|
993
|
+
else if (g?.mode === 'curve')
|
|
994
|
+
renderCurve();
|
|
995
|
+
else
|
|
996
|
+
render();
|
|
997
|
+
});
|
|
998
|
+
box.addEventListener('pointerdown', onDown);
|
|
999
|
+
box.addEventListener('keydown', onKey);
|
|
1000
|
+
box.addEventListener('click', onClick);
|
|
1001
|
+
box.addEventListener('change', onChange);
|
|
1002
|
+
grid.addEventListener('wheel', onWheel, { passive: false });
|
|
1003
|
+
render();
|
|
1004
|
+
api.setTime(0);
|
|
1005
|
+
return api;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
export { CURVE_PRESETS, STUDIO_PROJECT_FORMAT, STUDIO_PROJECT_VERSION, STUDIO_VERSION, bezierEasing, cleanUiState, createStudio, frameTime, parseBezier, parseStudioProject, sampleFrames, serializeStudioProject, springBezier, springParams };
|
|
1009
|
+
//# sourceMappingURL=https://raw.githubusercontent.com/HarrisonCN/Motionary/v14.4.0/dist/components/studio.js.map
|