vevet 3.19.2 → 4.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -18
- package/lib/cjs/{Application → Vevet}/events/createOnPageLoad/index.js +7 -7
- package/lib/cjs/Vevet/events/createOnPageLoad/index.js.map +1 -0
- package/lib/cjs/Vevet/events/createOnPageLoad/types.js.map +1 -0
- package/lib/cjs/{Application → Vevet}/events/createViewport/index.js +19 -25
- package/lib/cjs/Vevet/events/createViewport/index.js.map +1 -0
- package/lib/cjs/Vevet/events/createViewport/types.js.map +1 -0
- package/lib/cjs/Vevet/exported.js +3 -0
- package/lib/cjs/Vevet/exported.js.map +1 -0
- package/lib/cjs/Vevet/global.js +3 -0
- package/lib/cjs/Vevet/global.js.map +1 -0
- package/lib/cjs/Vevet/index.js +94 -0
- package/lib/cjs/Vevet/index.js.map +1 -0
- package/lib/cjs/{Application → Vevet}/types.js.map +1 -1
- package/lib/cjs/{utils/internal → Vevet/utils}/fetchWebpSupport.js +1 -1
- package/lib/cjs/Vevet/utils/fetchWebpSupport.js.map +1 -0
- package/lib/cjs/Vevet/utils/getDeviceInfo.js.map +1 -0
- package/lib/cjs/base/Callbacks/index.js +65 -48
- package/lib/cjs/base/Callbacks/index.js.map +1 -1
- package/lib/cjs/base/Component/index.js +15 -4
- package/lib/cjs/base/Component/index.js.map +1 -1
- package/lib/cjs/base/Module/index.js +118 -64
- package/lib/cjs/base/Module/index.js.map +1 -1
- package/lib/cjs/base/MutableProps/index.js +30 -55
- package/lib/cjs/base/MutableProps/index.js.map +1 -1
- package/lib/cjs/base/Plugin/index.js +20 -1
- package/lib/cjs/base/Plugin/index.js.map +1 -1
- package/lib/cjs/components/AnimationFrame/index.js +14 -21
- package/lib/cjs/components/AnimationFrame/index.js.map +1 -1
- package/lib/cjs/components/Ctx2D/index.js +40 -25
- package/lib/cjs/components/Ctx2D/index.js.map +1 -1
- package/lib/cjs/components/Ctx2DPrerender/index.js +17 -7
- package/lib/cjs/components/Ctx2DPrerender/index.js.map +1 -1
- package/lib/cjs/components/CustomCursor/index.js +75 -51
- package/lib/cjs/components/CustomCursor/index.js.map +1 -1
- package/lib/cjs/components/{SmoothScroll → CustomScroll}/AnimatonFrame.js +2 -2
- package/lib/cjs/components/{SmoothScroll → CustomScroll}/AnimatonFrame.js.map +1 -1
- package/lib/cjs/components/{SmoothScroll → CustomScroll}/Elements.js +9 -9
- package/lib/cjs/components/{SmoothScroll → CustomScroll}/Elements.js.map +1 -1
- package/lib/cjs/components/{SmoothScroll → CustomScroll}/index.js +72 -66
- package/lib/cjs/components/CustomScroll/index.js.map +1 -0
- package/lib/cjs/components/CustomScroll/types.js.map +1 -0
- package/lib/cjs/components/{SmoothScrollDragPlugin → CustomScrollDragPlugin}/index.js +45 -44
- package/lib/cjs/components/CustomScrollDragPlugin/index.js.map +1 -0
- package/lib/cjs/components/CustomScrollDragPlugin/types.js.map +1 -0
- package/lib/cjs/components/{SmoothScrollKeyboardPlugin → CustomScrollKeyboardPlugin}/index.js +51 -47
- package/lib/cjs/components/CustomScrollKeyboardPlugin/index.js.map +1 -0
- package/lib/cjs/components/CustomScrollKeyboardPlugin/types.js.map +1 -0
- package/lib/cjs/components/DraggerBase/index.js +74 -26
- package/lib/cjs/components/DraggerBase/index.js.map +1 -1
- package/lib/cjs/components/DraggerDirection/index.js +12 -6
- package/lib/cjs/components/DraggerDirection/index.js.map +1 -1
- package/lib/cjs/components/DraggerMove/index.js +44 -13
- package/lib/cjs/components/DraggerMove/index.js.map +1 -1
- package/lib/cjs/components/Marquee/index.js +240 -160
- package/lib/cjs/components/Marquee/index.js.map +1 -1
- package/lib/cjs/components/Preloader/index.js +45 -16
- package/lib/cjs/components/Preloader/index.js.map +1 -1
- package/lib/cjs/components/ProgressPreloader/index.js +79 -41
- package/lib/cjs/components/ProgressPreloader/index.js.map +1 -1
- package/lib/cjs/components/ProgressPreloader/utils/preloadCustomElement.js +12 -1
- package/lib/cjs/components/ProgressPreloader/utils/preloadCustomElement.js.map +1 -1
- package/lib/cjs/components/ScrollBar/Bar/index.js +90 -36
- package/lib/cjs/components/ScrollBar/Bar/index.js.map +1 -1
- package/lib/cjs/components/ScrollBar/index.js +59 -20
- package/lib/cjs/components/ScrollBar/index.js.map +1 -1
- package/lib/cjs/components/ScrollView/index.js +56 -20
- package/lib/cjs/components/ScrollView/index.js.map +1 -1
- package/lib/cjs/components/SectionScrollProgress/index.js +68 -31
- package/lib/cjs/components/SectionScrollProgress/index.js.map +1 -1
- package/lib/cjs/components/SlideProgress/index.js +72 -38
- package/lib/cjs/components/SlideProgress/index.js.map +1 -1
- package/lib/cjs/components/SplitText/index.js +52 -23
- package/lib/cjs/components/SplitText/index.js.map +1 -1
- package/lib/cjs/components/SplitText/utils/splitBase.js +6 -1
- package/lib/cjs/components/SplitText/utils/splitBase.js.map +1 -1
- package/lib/cjs/components/SplitText/utils/wrapLetters.js +11 -3
- package/lib/cjs/components/SplitText/utils/wrapLetters.js.map +1 -1
- package/lib/cjs/components/SplitText/utils/wrapLines.js +11 -5
- package/lib/cjs/components/SplitText/utils/wrapLines.js.map +1 -1
- package/lib/cjs/components/SplitText/utils/wrapWords.js +13 -2
- package/lib/cjs/components/SplitText/utils/wrapWords.js.map +1 -1
- package/lib/cjs/components/Timeline/index.js +77 -21
- package/lib/cjs/components/Timeline/index.js.map +1 -1
- package/lib/cjs/components/index.js +4 -4
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/index.js +10 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types/index.js +19 -0
- package/lib/cjs/types/index.js.map +1 -0
- package/lib/cjs/utils/common/PCancelable.js +16 -0
- package/lib/cjs/utils/common/PCancelable.js.map +1 -1
- package/lib/cjs/utils/common/normalizedTimeoutCallback.js +19 -4
- package/lib/cjs/utils/common/normalizedTimeoutCallback.js.map +1 -1
- package/lib/cjs/utils/common/objectKeys.js +11 -1
- package/lib/cjs/utils/common/objectKeys.js.map +1 -1
- package/lib/cjs/utils/common/pickObjectProps.js +14 -2
- package/lib/cjs/utils/common/pickObjectProps.js.map +1 -1
- package/lib/cjs/utils/common/times.js +12 -3
- package/lib/cjs/utils/common/times.js.map +1 -1
- package/lib/cjs/utils/common/uid.js +4 -2
- package/lib/cjs/utils/common/uid.js.map +1 -1
- package/lib/cjs/utils/image/load.js +3 -3
- package/lib/cjs/utils/image/load.js.map +1 -1
- package/lib/cjs/utils/image/pathsToProps.js +12 -5
- package/lib/cjs/utils/image/pathsToProps.js.map +1 -1
- package/lib/cjs/utils/image/sizesToSrcSet.js +7 -3
- package/lib/cjs/utils/image/sizesToSrcSet.js.map +1 -1
- package/lib/cjs/utils/internal/getApp.js +12 -0
- package/lib/cjs/utils/internal/getApp.js.map +1 -1
- package/lib/cjs/utils/listeners/isIntersectionObserverSupported.js +1 -1
- package/lib/cjs/utils/listeners/onResize.js +13 -12
- package/lib/cjs/utils/listeners/onResize.js.map +1 -1
- package/lib/cjs/utils/math/clamp.js +10 -5
- package/lib/cjs/utils/math/clamp.js.map +1 -1
- package/lib/cjs/utils/math/clampScope.js +8 -1
- package/lib/cjs/utils/math/clampScope.js.map +1 -1
- package/lib/cjs/utils/math/easing.js +6 -2
- package/lib/cjs/utils/math/easing.js.map +1 -1
- package/lib/cjs/utils/math/inScope.js +6 -3
- package/lib/cjs/utils/math/inScope.js.map +1 -1
- package/lib/cjs/utils/math/lerp.js +11 -3
- package/lib/cjs/utils/math/lerp.js.map +1 -1
- package/lib/cjs/utils/math/normalizeNestedScope.js +12 -3
- package/lib/cjs/utils/math/normalizeNestedScope.js.map +1 -1
- package/lib/cjs/utils/math/scoped.js +18 -7
- package/lib/cjs/utils/math/scoped.js.map +1 -1
- package/lib/cjs/utils/math/spreadScope.js +17 -3
- package/lib/cjs/utils/math/spreadScope.js.map +1 -1
- package/lib/cjs/utils/math/wrap.js +9 -3
- package/lib/cjs/utils/math/wrap.js.map +1 -1
- package/lib/cjs/utils/scroll/getScrollValues.js +13 -1
- package/lib/cjs/utils/scroll/getScrollValues.js.map +1 -1
- package/lib/cjs/utils/scroll/isPageScrolling.js +30 -0
- package/lib/cjs/utils/scroll/isPageScrolling.js.map +1 -1
- package/lib/cjs/utils/scroll/normalizeWheel.js +7 -2
- package/lib/cjs/utils/scroll/normalizeWheel.js.map +1 -1
- package/lib/cjs/utils/scroll/onScroll.js +14 -7
- package/lib/cjs/utils/scroll/onScroll.js.map +1 -1
- package/lib/cjs/utils/scroll/scrollTo.js +8 -7
- package/lib/cjs/utils/scroll/scrollTo.js.map +1 -1
- package/lib/cjs/utils/scroll/scrollToElement.js +8 -6
- package/lib/cjs/utils/scroll/scrollToElement.js.map +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/{Application → Vevet}/events/createOnPageLoad/index.js +7 -7
- package/lib/esm/Vevet/events/createOnPageLoad/index.js.map +1 -0
- package/lib/esm/Vevet/events/createOnPageLoad/types.js.map +1 -0
- package/lib/esm/{Application → Vevet}/events/createViewport/index.js +20 -26
- package/lib/esm/Vevet/events/createViewport/index.js.map +1 -0
- package/lib/esm/Vevet/events/createViewport/types.js.map +1 -0
- package/lib/esm/Vevet/exported.js +2 -0
- package/lib/esm/Vevet/exported.js.map +1 -0
- package/lib/esm/Vevet/global.js +2 -0
- package/lib/esm/Vevet/global.js.map +1 -0
- package/lib/esm/Vevet/index.js +72 -0
- package/lib/esm/Vevet/index.js.map +1 -0
- package/lib/esm/{Application → Vevet}/types.js.map +1 -1
- package/lib/esm/{utils/internal → Vevet/utils}/fetchWebpSupport.js +1 -1
- package/lib/esm/Vevet/utils/fetchWebpSupport.js.map +1 -0
- package/lib/esm/Vevet/utils/getDeviceInfo.js.map +1 -0
- package/lib/esm/base/Callbacks/index.js +66 -48
- package/lib/esm/base/Callbacks/index.js.map +1 -1
- package/lib/esm/base/Component/index.js +15 -4
- package/lib/esm/base/Component/index.js.map +1 -1
- package/lib/esm/base/Module/index.js +119 -65
- package/lib/esm/base/Module/index.js.map +1 -1
- package/lib/esm/base/MutableProps/index.js +35 -60
- package/lib/esm/base/MutableProps/index.js.map +1 -1
- package/lib/esm/base/Plugin/index.js +20 -1
- package/lib/esm/base/Plugin/index.js.map +1 -1
- package/lib/esm/components/AnimationFrame/index.js +14 -21
- package/lib/esm/components/AnimationFrame/index.js.map +1 -1
- package/lib/esm/components/Ctx2D/index.js +40 -25
- package/lib/esm/components/Ctx2D/index.js.map +1 -1
- package/lib/esm/components/Ctx2DPrerender/index.js +17 -7
- package/lib/esm/components/Ctx2DPrerender/index.js.map +1 -1
- package/lib/esm/components/CustomCursor/index.js +75 -51
- package/lib/esm/components/CustomCursor/index.js.map +1 -1
- package/lib/esm/components/{SmoothScroll → CustomScroll}/AnimatonFrame.js +2 -2
- package/lib/esm/components/{SmoothScroll → CustomScroll}/AnimatonFrame.js.map +1 -1
- package/lib/esm/components/{SmoothScroll → CustomScroll}/Elements.js +8 -8
- package/lib/esm/components/{SmoothScroll → CustomScroll}/Elements.js.map +1 -1
- package/lib/esm/components/{SmoothScroll → CustomScroll}/index.js +30 -24
- package/lib/esm/components/CustomScroll/index.js.map +1 -0
- package/lib/esm/components/CustomScroll/types.js.map +1 -0
- package/lib/esm/components/{SmoothScrollDragPlugin → CustomScrollDragPlugin}/index.js +28 -27
- package/lib/esm/components/CustomScrollDragPlugin/index.js.map +1 -0
- package/lib/esm/components/CustomScrollDragPlugin/types.js.map +1 -0
- package/lib/esm/components/{SmoothScrollKeyboardPlugin → CustomScrollKeyboardPlugin}/index.js +37 -33
- package/lib/esm/components/CustomScrollKeyboardPlugin/index.js.map +1 -0
- package/lib/esm/components/CustomScrollKeyboardPlugin/types.js.map +1 -0
- package/lib/esm/components/DraggerBase/index.js +74 -28
- package/lib/esm/components/DraggerBase/index.js.map +1 -1
- package/lib/esm/components/DraggerDirection/index.js +12 -6
- package/lib/esm/components/DraggerDirection/index.js.map +1 -1
- package/lib/esm/components/DraggerMove/index.js +44 -13
- package/lib/esm/components/DraggerMove/index.js.map +1 -1
- package/lib/esm/components/Marquee/index.js +220 -161
- package/lib/esm/components/Marquee/index.js.map +1 -1
- package/lib/esm/components/Preloader/index.js +45 -16
- package/lib/esm/components/Preloader/index.js.map +1 -1
- package/lib/esm/components/ProgressPreloader/index.js +79 -40
- package/lib/esm/components/ProgressPreloader/index.js.map +1 -1
- package/lib/esm/components/ProgressPreloader/utils/preloadCustomElement.js +12 -1
- package/lib/esm/components/ProgressPreloader/utils/preloadCustomElement.js.map +1 -1
- package/lib/esm/components/ScrollBar/Bar/index.js +89 -32
- package/lib/esm/components/ScrollBar/Bar/index.js.map +1 -1
- package/lib/esm/components/ScrollBar/index.js +49 -15
- package/lib/esm/components/ScrollBar/index.js.map +1 -1
- package/lib/esm/components/ScrollView/index.js +56 -20
- package/lib/esm/components/ScrollView/index.js.map +1 -1
- package/lib/esm/components/SectionScrollProgress/index.js +68 -31
- package/lib/esm/components/SectionScrollProgress/index.js.map +1 -1
- package/lib/esm/components/SlideProgress/index.js +72 -38
- package/lib/esm/components/SlideProgress/index.js.map +1 -1
- package/lib/esm/components/SplitText/index.js +52 -23
- package/lib/esm/components/SplitText/index.js.map +1 -1
- package/lib/esm/components/SplitText/utils/splitBase.js +6 -1
- package/lib/esm/components/SplitText/utils/splitBase.js.map +1 -1
- package/lib/esm/components/SplitText/utils/wrapLetters.js +11 -3
- package/lib/esm/components/SplitText/utils/wrapLetters.js.map +1 -1
- package/lib/esm/components/SplitText/utils/wrapLines.js +11 -5
- package/lib/esm/components/SplitText/utils/wrapLines.js.map +1 -1
- package/lib/esm/components/SplitText/utils/wrapWords.js +13 -2
- package/lib/esm/components/SplitText/utils/wrapWords.js.map +1 -1
- package/lib/esm/components/Timeline/index.js +70 -22
- package/lib/esm/components/Timeline/index.js.map +1 -1
- package/lib/esm/components/index.js +4 -4
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/index.js +9 -3
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types/index.js +3 -0
- package/lib/esm/types/index.js.map +1 -0
- package/lib/esm/utils/common/PCancelable.js +16 -0
- package/lib/esm/utils/common/PCancelable.js.map +1 -1
- package/lib/esm/utils/common/normalizedTimeoutCallback.js +19 -4
- package/lib/esm/utils/common/normalizedTimeoutCallback.js.map +1 -1
- package/lib/esm/utils/common/objectKeys.js +11 -1
- package/lib/esm/utils/common/objectKeys.js.map +1 -1
- package/lib/esm/utils/common/pickObjectProps.js +14 -2
- package/lib/esm/utils/common/pickObjectProps.js.map +1 -1
- package/lib/esm/utils/common/times.js +12 -3
- package/lib/esm/utils/common/times.js.map +1 -1
- package/lib/esm/utils/common/uid.js +4 -2
- package/lib/esm/utils/common/uid.js.map +1 -1
- package/lib/esm/utils/image/load.js +3 -3
- package/lib/esm/utils/image/load.js.map +1 -1
- package/lib/esm/utils/image/pathsToProps.js +12 -5
- package/lib/esm/utils/image/pathsToProps.js.map +1 -1
- package/lib/esm/utils/image/sizesToSrcSet.js +7 -3
- package/lib/esm/utils/image/sizesToSrcSet.js.map +1 -1
- package/lib/esm/utils/internal/getApp.js +12 -0
- package/lib/esm/utils/internal/getApp.js.map +1 -1
- package/lib/esm/utils/listeners/isIntersectionObserverSupported.js +1 -1
- package/lib/esm/utils/listeners/onResize.js +11 -12
- package/lib/esm/utils/listeners/onResize.js.map +1 -1
- package/lib/esm/utils/math/clamp.js +10 -5
- package/lib/esm/utils/math/clamp.js.map +1 -1
- package/lib/esm/utils/math/clampScope.js +8 -1
- package/lib/esm/utils/math/clampScope.js.map +1 -1
- package/lib/esm/utils/math/easing.js +6 -2
- package/lib/esm/utils/math/easing.js.map +1 -1
- package/lib/esm/utils/math/inScope.js +6 -3
- package/lib/esm/utils/math/inScope.js.map +1 -1
- package/lib/esm/utils/math/lerp.js +11 -3
- package/lib/esm/utils/math/lerp.js.map +1 -1
- package/lib/esm/utils/math/normalizeNestedScope.js +12 -3
- package/lib/esm/utils/math/normalizeNestedScope.js.map +1 -1
- package/lib/esm/utils/math/scoped.js +17 -6
- package/lib/esm/utils/math/scoped.js.map +1 -1
- package/lib/esm/utils/math/spreadScope.js +17 -3
- package/lib/esm/utils/math/spreadScope.js.map +1 -1
- package/lib/esm/utils/math/wrap.js +9 -3
- package/lib/esm/utils/math/wrap.js.map +1 -1
- package/lib/esm/utils/scroll/getScrollValues.js +13 -1
- package/lib/esm/utils/scroll/getScrollValues.js.map +1 -1
- package/lib/esm/utils/scroll/isPageScrolling.js +30 -0
- package/lib/esm/utils/scroll/isPageScrolling.js.map +1 -1
- package/lib/esm/utils/scroll/normalizeWheel.js +7 -2
- package/lib/esm/utils/scroll/normalizeWheel.js.map +1 -1
- package/lib/esm/utils/scroll/onScroll.js +14 -7
- package/lib/esm/utils/scroll/onScroll.js.map +1 -1
- package/lib/esm/utils/scroll/scrollTo.js +8 -7
- package/lib/esm/utils/scroll/scrollTo.js.map +1 -1
- package/lib/esm/utils/scroll/scrollToElement.js +8 -6
- package/lib/esm/utils/scroll/scrollToElement.js.map +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/styles/base.scss +0 -2
- package/lib/styles/components/CustomCursor.scss +7 -7
- package/{src/styles/components/SmoothScroll.scss → lib/styles/components/CustomScroll.scss} +3 -3
- package/lib/styles/components/Preloader.scss +1 -1
- package/lib/styles/components/ScrollBar.scss +4 -4
- package/lib/styles/components/index.scss +1 -1
- package/lib/styles/index.scss +0 -1
- package/lib/types/Vevet/events/createOnPageLoad/index.d.ts +3 -0
- package/lib/types/Vevet/events/createOnPageLoad/index.d.ts.map +1 -0
- package/lib/types/Vevet/events/createOnPageLoad/types.d.ts +20 -0
- package/lib/types/Vevet/events/createOnPageLoad/types.d.ts.map +1 -0
- package/lib/types/Vevet/events/createViewport/index.d.ts +4 -0
- package/lib/types/Vevet/events/createViewport/index.d.ts.map +1 -0
- package/lib/types/Vevet/events/createViewport/types.d.ts +85 -0
- package/lib/types/Vevet/events/createViewport/types.d.ts.map +1 -0
- package/lib/types/Vevet/exported.d.ts +6 -0
- package/lib/types/Vevet/exported.d.ts.map +1 -0
- package/lib/types/Vevet/global.d.ts +51 -0
- package/lib/types/Vevet/global.d.ts.map +1 -0
- package/lib/types/Vevet/index.d.ts +4 -0
- package/lib/types/Vevet/index.d.ts.map +1 -0
- package/lib/types/Vevet/types.d.ts +43 -0
- package/lib/types/Vevet/types.d.ts.map +1 -0
- package/lib/types/Vevet/utils/fetchWebpSupport.d.ts +3 -0
- package/lib/types/Vevet/utils/fetchWebpSupport.d.ts.map +1 -0
- package/lib/types/Vevet/utils/getDeviceInfo.d.ts.map +1 -0
- package/lib/types/base/Callbacks/index.d.ts +67 -46
- package/lib/types/base/Callbacks/index.d.ts.map +1 -1
- package/lib/types/base/Callbacks/types.d.ts +46 -14
- package/lib/types/base/Callbacks/types.d.ts.map +1 -1
- package/lib/types/base/Component/index.d.ts +19 -5
- package/lib/types/base/Component/index.d.ts.map +1 -1
- package/lib/types/base/Component/types.d.ts +15 -3
- package/lib/types/base/Component/types.d.ts.map +1 -1
- package/lib/types/base/Module/index.d.ts +124 -74
- package/lib/types/base/Module/index.d.ts.map +1 -1
- package/lib/types/base/Module/types.d.ts +29 -3
- package/lib/types/base/Module/types.d.ts.map +1 -1
- package/lib/types/base/MutableProps/index.d.ts +34 -77
- package/lib/types/base/MutableProps/index.d.ts.map +1 -1
- package/lib/types/base/MutableProps/types.d.ts +14 -8
- package/lib/types/base/MutableProps/types.d.ts.map +1 -1
- package/lib/types/base/Plugin/index.d.ts +24 -1
- package/lib/types/base/Plugin/index.d.ts.map +1 -1
- package/lib/types/base/Plugin/types.d.ts +11 -0
- package/lib/types/base/Plugin/types.d.ts.map +1 -1
- package/lib/types/components/AnimationFrame/index.d.ts +20 -18
- package/lib/types/components/AnimationFrame/index.d.ts.map +1 -1
- package/lib/types/components/AnimationFrame/types.d.ts +18 -3
- package/lib/types/components/AnimationFrame/types.d.ts.map +1 -1
- package/lib/types/components/Ctx2D/index.d.ts +37 -15
- package/lib/types/components/Ctx2D/index.d.ts.map +1 -1
- package/lib/types/components/Ctx2D/types.d.ts +40 -13
- package/lib/types/components/Ctx2D/types.d.ts.map +1 -1
- package/lib/types/components/Ctx2DPrerender/index.d.ts +13 -4
- package/lib/types/components/Ctx2DPrerender/index.d.ts.map +1 -1
- package/lib/types/components/Ctx2DPrerender/types.d.ts +13 -2
- package/lib/types/components/Ctx2DPrerender/types.d.ts.map +1 -1
- package/lib/types/components/CustomCursor/index.d.ts +59 -36
- package/lib/types/components/CustomCursor/index.d.ts.map +1 -1
- package/lib/types/components/CustomCursor/types.d.ts +52 -12
- package/lib/types/components/CustomCursor/types.d.ts.map +1 -1
- package/lib/types/components/{SmoothScroll → CustomScroll}/AnimatonFrame.d.ts.map +1 -1
- package/lib/types/components/{SmoothScroll → CustomScroll}/Elements.d.ts +3 -3
- package/lib/types/components/{SmoothScroll → CustomScroll}/Elements.d.ts.map +1 -1
- package/lib/types/components/{SmoothScroll → CustomScroll}/index.d.ts +46 -32
- package/lib/types/components/CustomScroll/index.d.ts.map +1 -0
- package/lib/types/components/CustomScroll/types.d.ts +137 -0
- package/lib/types/components/CustomScroll/types.d.ts.map +1 -0
- package/lib/types/components/CustomScrollDragPlugin/index.d.ts +62 -0
- package/lib/types/components/CustomScrollDragPlugin/index.d.ts.map +1 -0
- package/lib/types/components/CustomScrollDragPlugin/types.d.ts +52 -0
- package/lib/types/components/CustomScrollDragPlugin/types.d.ts.map +1 -0
- package/lib/types/components/CustomScrollKeyboardPlugin/index.d.ts +47 -0
- package/lib/types/components/CustomScrollKeyboardPlugin/index.d.ts.map +1 -0
- package/lib/types/components/CustomScrollKeyboardPlugin/types.d.ts +16 -0
- package/lib/types/components/{SmoothScrollKeyboardPlugin → CustomScrollKeyboardPlugin}/types.d.ts.map +1 -1
- package/lib/types/components/DraggerBase/index.d.ts +93 -28
- package/lib/types/components/DraggerBase/index.d.ts.map +1 -1
- package/lib/types/components/DraggerBase/types.d.ts +21 -3
- package/lib/types/components/DraggerBase/types.d.ts.map +1 -1
- package/lib/types/components/DraggerDirection/index.d.ts +6 -2
- package/lib/types/components/DraggerDirection/index.d.ts.map +1 -1
- package/lib/types/components/DraggerDirection/types.d.ts +15 -1
- package/lib/types/components/DraggerDirection/types.d.ts.map +1 -1
- package/lib/types/components/DraggerMove/index.d.ts +38 -8
- package/lib/types/components/DraggerMove/index.d.ts.map +1 -1
- package/lib/types/components/DraggerMove/types.d.ts +15 -2
- package/lib/types/components/DraggerMove/types.d.ts.map +1 -1
- package/lib/types/components/Marquee/index.d.ts +59 -36
- package/lib/types/components/Marquee/index.d.ts.map +1 -1
- package/lib/types/components/Marquee/types.d.ts +18 -8
- package/lib/types/components/Marquee/types.d.ts.map +1 -1
- package/lib/types/components/Preloader/index.d.ts +52 -15
- package/lib/types/components/Preloader/index.d.ts.map +1 -1
- package/lib/types/components/Preloader/types.d.ts +16 -5
- package/lib/types/components/Preloader/types.d.ts.map +1 -1
- package/lib/types/components/ProgressPreloader/index.d.ts +85 -25
- package/lib/types/components/ProgressPreloader/index.d.ts.map +1 -1
- package/lib/types/components/ProgressPreloader/types.d.ts +51 -14
- package/lib/types/components/ProgressPreloader/types.d.ts.map +1 -1
- package/lib/types/components/ProgressPreloader/utils/preloadCustomElement.d.ts +3 -0
- package/lib/types/components/ProgressPreloader/utils/preloadCustomElement.d.ts.map +1 -1
- package/lib/types/components/ScrollBar/Bar/index.d.ts +81 -16
- package/lib/types/components/ScrollBar/Bar/index.d.ts.map +1 -1
- package/lib/types/components/ScrollBar/Bar/types.d.ts +38 -16
- package/lib/types/components/ScrollBar/Bar/types.d.ts.map +1 -1
- package/lib/types/components/ScrollBar/index.d.ts +49 -12
- package/lib/types/components/ScrollBar/index.d.ts.map +1 -1
- package/lib/types/components/ScrollBar/types.d.ts +8 -6
- package/lib/types/components/ScrollBar/types.d.ts.map +1 -1
- package/lib/types/components/ScrollView/index.d.ts +65 -21
- package/lib/types/components/ScrollView/index.d.ts.map +1 -1
- package/lib/types/components/SectionScrollProgress/index.d.ts +83 -28
- package/lib/types/components/SectionScrollProgress/index.d.ts.map +1 -1
- package/lib/types/components/SectionScrollProgress/types.d.ts +15 -6
- package/lib/types/components/SectionScrollProgress/types.d.ts.map +1 -1
- package/lib/types/components/SlideProgress/index.d.ts +59 -24
- package/lib/types/components/SlideProgress/index.d.ts.map +1 -1
- package/lib/types/components/SlideProgress/types.d.ts +24 -15
- package/lib/types/components/SlideProgress/types.d.ts.map +1 -1
- package/lib/types/components/SplitText/index.d.ts +64 -18
- package/lib/types/components/SplitText/index.d.ts.map +1 -1
- package/lib/types/components/SplitText/types.d.ts +36 -8
- package/lib/types/components/SplitText/types.d.ts.map +1 -1
- package/lib/types/components/SplitText/utils/splitBase.d.ts +3 -1
- package/lib/types/components/SplitText/utils/splitBase.d.ts.map +1 -1
- package/lib/types/components/SplitText/utils/wrapLetters.d.ts +3 -1
- package/lib/types/components/SplitText/utils/wrapLetters.d.ts.map +1 -1
- package/lib/types/components/SplitText/utils/wrapLines.d.ts +3 -1
- package/lib/types/components/SplitText/utils/wrapLines.d.ts.map +1 -1
- package/lib/types/components/SplitText/utils/wrapWords.d.ts +3 -1
- package/lib/types/components/SplitText/utils/wrapWords.d.ts.map +1 -1
- package/lib/types/components/Timeline/index.d.ts +69 -21
- package/lib/types/components/Timeline/index.d.ts.map +1 -1
- package/lib/types/components/Timeline/types.d.ts +32 -7
- package/lib/types/components/Timeline/types.d.ts.map +1 -1
- package/lib/types/components/index.d.ts +4 -4
- package/lib/types/components/index.d.ts.map +1 -1
- package/lib/types/index.d.ts +9 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/types/index.d.ts +3 -0
- package/lib/types/types/index.d.ts.map +1 -0
- package/lib/types/types/utility.d.ts +2 -3
- package/lib/types/types/utility.d.ts.map +1 -1
- package/lib/types/utils/common/PCancelable.d.ts +16 -0
- package/lib/types/utils/common/PCancelable.d.ts.map +1 -1
- package/lib/types/utils/common/normalizedTimeoutCallback.d.ts +19 -4
- package/lib/types/utils/common/normalizedTimeoutCallback.d.ts.map +1 -1
- package/lib/types/utils/common/objectKeys.d.ts +11 -1
- package/lib/types/utils/common/objectKeys.d.ts.map +1 -1
- package/lib/types/utils/common/pickObjectProps.d.ts +14 -2
- package/lib/types/utils/common/pickObjectProps.d.ts.map +1 -1
- package/lib/types/utils/common/times.d.ts +12 -3
- package/lib/types/utils/common/times.d.ts.map +1 -1
- package/lib/types/utils/common/uid.d.ts +4 -2
- package/lib/types/utils/common/uid.d.ts.map +1 -1
- package/lib/types/utils/image/load.d.ts +8 -5
- package/lib/types/utils/image/load.d.ts.map +1 -1
- package/lib/types/utils/image/pathsToProps.d.ts +10 -4
- package/lib/types/utils/image/pathsToProps.d.ts.map +1 -1
- package/lib/types/utils/image/sizesToSrcSet.d.ts +7 -3
- package/lib/types/utils/image/sizesToSrcSet.d.ts.map +1 -1
- package/lib/types/utils/internal/getApp.d.ts +9 -1
- package/lib/types/utils/internal/getApp.d.ts.map +1 -1
- package/lib/types/utils/listeners/isIntersectionObserverSupported.d.ts +1 -1
- package/lib/types/utils/listeners/onResize.d.ts +11 -12
- package/lib/types/utils/listeners/onResize.d.ts.map +1 -1
- package/lib/types/utils/math/clamp.d.ts +7 -2
- package/lib/types/utils/math/clamp.d.ts.map +1 -1
- package/lib/types/utils/math/clampScope.d.ts +8 -1
- package/lib/types/utils/math/clampScope.d.ts.map +1 -1
- package/lib/types/utils/math/easing.d.ts +4 -1
- package/lib/types/utils/math/easing.d.ts.map +1 -1
- package/lib/types/utils/math/inScope.d.ts +5 -2
- package/lib/types/utils/math/inScope.d.ts.map +1 -1
- package/lib/types/utils/math/lerp.d.ts +10 -2
- package/lib/types/utils/math/lerp.d.ts.map +1 -1
- package/lib/types/utils/math/normalizeNestedScope.d.ts +12 -3
- package/lib/types/utils/math/normalizeNestedScope.d.ts.map +1 -1
- package/lib/types/utils/math/scoped.d.ts +16 -5
- package/lib/types/utils/math/scoped.d.ts.map +1 -1
- package/lib/types/utils/math/spreadScope.d.ts +17 -3
- package/lib/types/utils/math/spreadScope.d.ts.map +1 -1
- package/lib/types/utils/math/wrap.d.ts +9 -3
- package/lib/types/utils/math/wrap.d.ts.map +1 -1
- package/lib/types/utils/scroll/getScrollValues.d.ts +13 -1
- package/lib/types/utils/scroll/getScrollValues.d.ts.map +1 -1
- package/lib/types/utils/scroll/isPageScrolling.d.ts +20 -0
- package/lib/types/utils/scroll/isPageScrolling.d.ts.map +1 -1
- package/lib/types/utils/scroll/normalizeWheel.d.ts +10 -2
- package/lib/types/utils/scroll/normalizeWheel.d.ts.map +1 -1
- package/lib/types/utils/scroll/onScroll.d.ts +10 -5
- package/lib/types/utils/scroll/onScroll.d.ts.map +1 -1
- package/lib/types/utils/scroll/scrollTo.d.ts +12 -9
- package/lib/types/utils/scroll/scrollTo.d.ts.map +1 -1
- package/lib/types/utils/scroll/scrollToElement.d.ts +9 -7
- package/lib/types/utils/scroll/scrollToElement.d.ts.map +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +6 -7
- package/src/{Application → Vevet}/events/createOnPageLoad/index.ts +8 -8
- package/src/Vevet/events/createOnPageLoad/types.ts +21 -0
- package/src/{Application → Vevet}/events/createViewport/index.ts +33 -35
- package/src/{Application → Vevet}/events/createViewport/stories/index.tsx +7 -5
- package/src/Vevet/events/createViewport/types.ts +93 -0
- package/src/Vevet/exported.ts +15 -0
- package/src/Vevet/global.ts +51 -0
- package/src/Vevet/index.ts +98 -0
- package/src/{Application → Vevet}/stories/index.tsx +2 -2
- package/src/Vevet/types.ts +48 -0
- package/src/base/Callbacks/index.ts +70 -51
- package/src/base/Callbacks/types.ts +53 -14
- package/src/base/Component/index.ts +19 -5
- package/src/base/Component/types.ts +15 -3
- package/src/base/Module/index.ts +125 -78
- package/src/base/Module/types.ts +32 -3
- package/src/base/MutableProps/index.ts +44 -73
- package/src/base/MutableProps/types.ts +15 -8
- package/src/base/Plugin/index.ts +24 -1
- package/src/base/Plugin/types.ts +11 -0
- package/src/components/AnimationFrame/index.ts +21 -28
- package/src/components/AnimationFrame/types.ts +23 -3
- package/src/components/Ctx2D/index.ts +46 -34
- package/src/components/Ctx2D/types.ts +53 -13
- package/src/components/Ctx2DPrerender/index.ts +18 -7
- package/src/components/Ctx2DPrerender/types.ts +13 -2
- package/src/components/CustomCursor/index.ts +85 -60
- package/src/components/CustomCursor/stories/index.tsx +0 -3
- package/src/components/CustomCursor/types.ts +63 -12
- package/src/components/{SmoothScroll → CustomScroll}/AnimatonFrame.ts +2 -2
- package/src/components/{SmoothScroll → CustomScroll}/Elements.ts +14 -14
- package/src/components/{SmoothScroll → CustomScroll}/index.ts +61 -44
- package/src/components/{SmoothScroll → CustomScroll}/stories/Default.tsx +8 -8
- package/src/components/{SmoothScroll → CustomScroll}/stories/WithHorizontal.tsx +9 -9
- package/src/components/{SmoothScroll → CustomScroll}/stories/WithInnerLerp.tsx +9 -9
- package/src/components/{SmoothScroll → CustomScroll}/stories/index.stories.tsx +1 -1
- package/src/components/CustomScroll/types.ts +165 -0
- package/src/components/{SmoothScrollDragPlugin → CustomScrollDragPlugin}/index.ts +41 -41
- package/src/components/{SmoothScrollDragPlugin → CustomScrollDragPlugin}/stories/index.stories.tsx +1 -1
- package/src/components/{SmoothScrollDragPlugin → CustomScrollDragPlugin}/stories/index.tsx +10 -10
- package/src/components/CustomScrollDragPlugin/types.ts +59 -0
- package/src/components/{SmoothScrollKeyboardPlugin → CustomScrollKeyboardPlugin}/index.ts +47 -43
- package/src/components/{SmoothScrollKeyboardPlugin → CustomScrollKeyboardPlugin}/stories/index.stories.tsx +1 -1
- package/src/components/{SmoothScrollKeyboardPlugin → CustomScrollKeyboardPlugin}/stories/index.tsx +10 -10
- package/src/components/{SmoothScrollKeyboardPlugin → CustomScrollKeyboardPlugin}/types.ts +6 -2
- package/src/components/DraggerBase/index.ts +101 -37
- package/src/components/DraggerBase/types.ts +25 -3
- package/src/components/DraggerDirection/index.ts +12 -6
- package/src/components/DraggerDirection/types.ts +18 -1
- package/src/components/DraggerMove/index.ts +44 -13
- package/src/components/DraggerMove/types.ts +17 -2
- package/src/components/Marquee/index.ts +255 -186
- package/src/components/Marquee/stories/index.tsx +16 -2
- package/src/components/Marquee/types.ts +18 -8
- package/src/components/Preloader/index.ts +56 -20
- package/src/components/Preloader/types.ts +18 -5
- package/src/components/ProgressPreloader/index.ts +104 -48
- package/src/components/ProgressPreloader/types.ts +65 -14
- package/src/components/ProgressPreloader/utils/preloadCustomElement.ts +13 -2
- package/src/components/ScrollBar/Bar/index.ts +112 -62
- package/src/components/ScrollBar/Bar/types.ts +46 -17
- package/src/components/ScrollBar/index.ts +65 -20
- package/src/components/ScrollBar/stories/{WithSmoothScrollComponent.tsx → WithCustomScrollComponent.tsx} +5 -5
- package/src/components/ScrollBar/stories/index.stories.tsx +3 -3
- package/src/components/ScrollBar/types.ts +10 -6
- package/src/components/ScrollView/index.ts +73 -27
- package/src/components/ScrollView/stories/index.tsx +5 -2
- package/src/components/SectionScrollProgress/index.ts +97 -41
- package/src/components/SectionScrollProgress/stories/WithCustomScroll.tsx +6 -6
- package/src/components/SectionScrollProgress/types.ts +19 -6
- package/src/components/SlideProgress/index.ts +78 -45
- package/src/components/SlideProgress/types.ts +24 -15
- package/src/components/SplitText/index.ts +71 -31
- package/src/components/SplitText/types.ts +48 -8
- package/src/components/SplitText/utils/splitBase.ts +6 -2
- package/src/components/SplitText/utils/wrapLetters.ts +11 -3
- package/src/components/SplitText/utils/wrapLines.ts +11 -5
- package/src/components/SplitText/utils/wrapWords.ts +14 -3
- package/src/components/Timeline/index.ts +98 -26
- package/src/components/Timeline/stories/index.stories.tsx +0 -5
- package/src/components/Timeline/types.ts +37 -7
- package/src/components/index.ts +4 -4
- package/src/index.ts +14 -4
- package/src/styles/base.scss +0 -2
- package/src/styles/components/CustomCursor.scss +7 -7
- package/{lib/styles/components/SmoothScroll.scss → src/styles/components/CustomScroll.scss} +3 -3
- package/src/styles/components/Preloader.scss +1 -1
- package/src/styles/components/ScrollBar.scss +4 -4
- package/src/styles/components/index.scss +1 -1
- package/src/styles/index.scss +0 -1
- package/src/types/index.ts +2 -0
- package/src/types/utility.ts +2 -2
- package/src/utils/common/PCancelable.ts +17 -0
- package/src/utils/common/normalizedTimeoutCallback.ts +19 -4
- package/src/utils/common/objectKeys.ts +12 -2
- package/src/utils/common/pickObjectProps.ts +16 -4
- package/src/utils/common/times.ts +12 -3
- package/src/utils/common/uid.ts +5 -3
- package/src/utils/image/load.ts +9 -4
- package/src/utils/image/pathsToProps.ts +12 -5
- package/src/utils/image/sizesToSrcSet.ts +7 -3
- package/src/utils/internal/getApp.ts +25 -0
- package/src/utils/listeners/isIntersectionObserverSupported.ts +1 -1
- package/src/utils/listeners/onResize.ts +16 -21
- package/src/utils/math/clamp.ts +10 -5
- package/src/utils/math/clampScope.ts +9 -2
- package/src/utils/math/easing.ts +6 -2
- package/src/utils/math/inScope.ts +6 -3
- package/src/utils/math/lerp.ts +11 -3
- package/src/utils/math/normalizeNestedScope.ts +12 -3
- package/src/utils/math/scoped.ts +17 -6
- package/src/utils/math/spreadScope.ts +17 -3
- package/src/utils/math/wrap.ts +9 -3
- package/src/utils/scroll/getScrollValues.ts +13 -1
- package/src/utils/scroll/isPageScrolling.ts +31 -0
- package/src/utils/scroll/normalizeWheel.ts +10 -2
- package/src/utils/scroll/onScroll.ts +18 -11
- package/src/utils/scroll/scrollTo.ts +16 -10
- package/src/utils/scroll/scrollToElement.ts +9 -7
- package/src/version.ts +1 -1
- package/lib/cjs/Application/events/createOnPageLoad/index.js.map +0 -1
- package/lib/cjs/Application/events/createOnPageLoad/types.js.map +0 -1
- package/lib/cjs/Application/events/createViewport/index.js.map +0 -1
- package/lib/cjs/Application/events/createViewport/types.js.map +0 -1
- package/lib/cjs/Application/index.js +0 -222
- package/lib/cjs/Application/index.js.map +0 -1
- package/lib/cjs/components/BaseTimeline/index.js +0 -125
- package/lib/cjs/components/BaseTimeline/index.js.map +0 -1
- package/lib/cjs/components/BaseTimeline/types.js.map +0 -1
- package/lib/cjs/components/SmoothScroll/index.js.map +0 -1
- package/lib/cjs/components/SmoothScroll/types.js.map +0 -1
- package/lib/cjs/components/SmoothScrollDragPlugin/index.js.map +0 -1
- package/lib/cjs/components/SmoothScrollDragPlugin/types.js.map +0 -1
- package/lib/cjs/components/SmoothScrollKeyboardPlugin/index.js.map +0 -1
- package/lib/cjs/components/SmoothScrollKeyboardPlugin/types.js +0 -3
- package/lib/cjs/components/SmoothScrollKeyboardPlugin/types.js.map +0 -1
- package/lib/cjs/utils/internal/fetchWebpSupport.js.map +0 -1
- package/lib/cjs/utils/internal/getDeviceInfo.js.map +0 -1
- package/lib/cjs/vevet.js +0 -6
- package/lib/cjs/vevet.js.map +0 -1
- package/lib/esm/Application/events/createOnPageLoad/index.js.map +0 -1
- package/lib/esm/Application/events/createOnPageLoad/types.js.map +0 -1
- package/lib/esm/Application/events/createViewport/index.js.map +0 -1
- package/lib/esm/Application/events/createViewport/types.js.map +0 -1
- package/lib/esm/Application/index.js +0 -134
- package/lib/esm/Application/index.js.map +0 -1
- package/lib/esm/components/BaseTimeline/index.js +0 -75
- package/lib/esm/components/BaseTimeline/index.js.map +0 -1
- package/lib/esm/components/BaseTimeline/types.js.map +0 -1
- package/lib/esm/components/SmoothScroll/index.js.map +0 -1
- package/lib/esm/components/SmoothScroll/types.js.map +0 -1
- package/lib/esm/components/SmoothScrollDragPlugin/index.js.map +0 -1
- package/lib/esm/components/SmoothScrollDragPlugin/types.js.map +0 -1
- package/lib/esm/components/SmoothScrollKeyboardPlugin/index.js.map +0 -1
- package/lib/esm/components/SmoothScrollKeyboardPlugin/types.js +0 -2
- package/lib/esm/components/SmoothScrollKeyboardPlugin/types.js.map +0 -1
- package/lib/esm/utils/internal/fetchWebpSupport.js.map +0 -1
- package/lib/esm/utils/internal/getDeviceInfo.js.map +0 -1
- package/lib/esm/vevet.js +0 -3
- package/lib/esm/vevet.js.map +0 -1
- package/lib/styles/globals/index.scss +0 -18
- package/lib/types/Application/events/createOnPageLoad/index.d.ts +0 -5
- package/lib/types/Application/events/createOnPageLoad/index.d.ts.map +0 -1
- package/lib/types/Application/events/createOnPageLoad/types.d.ts +0 -5
- package/lib/types/Application/events/createOnPageLoad/types.d.ts.map +0 -1
- package/lib/types/Application/events/createViewport/index.d.ts +0 -20
- package/lib/types/Application/events/createViewport/index.d.ts.map +0 -1
- package/lib/types/Application/events/createViewport/types.d.ts +0 -52
- package/lib/types/Application/events/createViewport/types.d.ts.map +0 -1
- package/lib/types/Application/index.d.ts +0 -89
- package/lib/types/Application/index.d.ts.map +0 -1
- package/lib/types/Application/types.d.ts +0 -41
- package/lib/types/Application/types.d.ts.map +0 -1
- package/lib/types/components/BaseTimeline/index.d.ts +0 -40
- package/lib/types/components/BaseTimeline/index.d.ts.map +0 -1
- package/lib/types/components/BaseTimeline/types.d.ts +0 -34
- package/lib/types/components/BaseTimeline/types.d.ts.map +0 -1
- package/lib/types/components/SmoothScroll/index.d.ts.map +0 -1
- package/lib/types/components/SmoothScroll/types.d.ts +0 -105
- package/lib/types/components/SmoothScroll/types.d.ts.map +0 -1
- package/lib/types/components/SmoothScrollDragPlugin/index.d.ts +0 -50
- package/lib/types/components/SmoothScrollDragPlugin/index.d.ts.map +0 -1
- package/lib/types/components/SmoothScrollDragPlugin/types.d.ts +0 -39
- package/lib/types/components/SmoothScrollDragPlugin/types.d.ts.map +0 -1
- package/lib/types/components/SmoothScrollKeyboardPlugin/index.d.ts +0 -31
- package/lib/types/components/SmoothScrollKeyboardPlugin/index.d.ts.map +0 -1
- package/lib/types/components/SmoothScrollKeyboardPlugin/types.d.ts +0 -12
- package/lib/types/utils/internal/fetchWebpSupport.d.ts +0 -3
- package/lib/types/utils/internal/fetchWebpSupport.d.ts.map +0 -1
- package/lib/types/utils/internal/getDeviceInfo.d.ts.map +0 -1
- package/lib/types/vevet.d.ts +0 -3
- package/lib/types/vevet.d.ts.map +0 -1
- package/src/Application/events/createOnPageLoad/types.ts +0 -5
- package/src/Application/events/createViewport/types.ts +0 -55
- package/src/Application/index.ts +0 -204
- package/src/Application/types.ts +0 -41
- package/src/components/BaseTimeline/index.ts +0 -123
- package/src/components/BaseTimeline/stories/Basic.tsx +0 -65
- package/src/components/BaseTimeline/stories/Nested.tsx +0 -108
- package/src/components/BaseTimeline/stories/index.stories.tsx +0 -16
- package/src/components/BaseTimeline/types.ts +0 -36
- package/src/components/SmoothScroll/types.ts +0 -114
- package/src/components/SmoothScrollDragPlugin/types.ts +0 -40
- package/src/components/Timeline/stories/Nested.tsx +0 -135
- package/src/styles/globals/index.scss +0 -18
- package/src/vevet.ts +0 -4
- /package/lib/cjs/{Application → Vevet}/events/createOnPageLoad/types.js +0 -0
- /package/lib/cjs/{Application → Vevet}/events/createViewport/types.js +0 -0
- /package/lib/cjs/{Application → Vevet}/types.js +0 -0
- /package/lib/cjs/{utils/internal → Vevet/utils}/getDeviceInfo.js +0 -0
- /package/lib/cjs/components/{BaseTimeline → CustomScroll}/types.js +0 -0
- /package/lib/cjs/components/{SmoothScroll → CustomScrollDragPlugin}/types.js +0 -0
- /package/lib/cjs/components/{SmoothScrollDragPlugin → CustomScrollKeyboardPlugin}/types.js +0 -0
- /package/lib/esm/{Application → Vevet}/events/createOnPageLoad/types.js +0 -0
- /package/lib/esm/{Application → Vevet}/events/createViewport/types.js +0 -0
- /package/lib/esm/{Application → Vevet}/types.js +0 -0
- /package/lib/esm/{utils/internal → Vevet/utils}/getDeviceInfo.js +0 -0
- /package/lib/esm/components/{BaseTimeline → CustomScroll}/types.js +0 -0
- /package/lib/esm/components/{SmoothScroll → CustomScrollDragPlugin}/types.js +0 -0
- /package/lib/esm/components/{SmoothScrollDragPlugin → CustomScrollKeyboardPlugin}/types.js +0 -0
- /package/lib/types/{utils/internal → Vevet/utils}/getDeviceInfo.d.ts +0 -0
- /package/lib/types/components/{SmoothScroll → CustomScroll}/AnimatonFrame.d.ts +0 -0
- /package/src/{Application → Vevet}/events/.eslintrc +0 -0
- /package/src/{Application → Vevet}/events/createViewport/stories/index.stories.tsx +0 -0
- /package/src/{Application → Vevet}/stories/index.stories.tsx +0 -0
- /package/src/{utils/internal → Vevet/utils}/fetchWebpSupport.ts +0 -0
- /package/src/{utils/internal → Vevet/utils}/getDeviceInfo.ts +0 -0
package/src/base/Plugin/index.ts
CHANGED
|
@@ -4,7 +4,9 @@ import { NPlugin } from './types';
|
|
|
4
4
|
export type { NPlugin };
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* A class for Plugins.
|
|
7
|
+
* A base abstract class for Plugins that extend the functionality of components.
|
|
8
|
+
* A plugin is designed to attach to a component and modify or enhance its behavior.
|
|
9
|
+
* It inherits from the {@link Module} class and adds functionality to work with a component.
|
|
8
10
|
*/
|
|
9
11
|
export abstract class Plugin<
|
|
10
12
|
StaticProps extends NPlugin.IStaticProps = NPlugin.IStaticProps,
|
|
@@ -12,20 +14,41 @@ export abstract class Plugin<
|
|
|
12
14
|
CallbacksTypes extends NPlugin.ICallbacksTypes = NPlugin.ICallbacksTypes,
|
|
13
15
|
Component = any,
|
|
14
16
|
> extends Module<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
17
|
+
/**
|
|
18
|
+
* Constructs the plugin.
|
|
19
|
+
*
|
|
20
|
+
* @param initialProps - Initial static and changeable properties for the plugin.
|
|
21
|
+
*/
|
|
15
22
|
constructor(initialProps?: StaticProps & ChangeableProps) {
|
|
16
23
|
super(initialProps, false);
|
|
17
24
|
}
|
|
18
25
|
|
|
26
|
+
/**
|
|
27
|
+
* The component to which the plugin is attached.
|
|
28
|
+
* This property must be set before initializing the plugin.
|
|
29
|
+
*/
|
|
19
30
|
private _component!: Component;
|
|
20
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves the component to which this plugin is attached.
|
|
34
|
+
*/
|
|
21
35
|
get component() {
|
|
22
36
|
return this._component;
|
|
23
37
|
}
|
|
24
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Sets the component for this plugin. This method is called by the parent component when the plugin is added.
|
|
41
|
+
*/
|
|
25
42
|
set component(value) {
|
|
26
43
|
this._component = value;
|
|
27
44
|
}
|
|
28
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Initializes the plugin and ensures it is properly associated with a component.
|
|
48
|
+
* If the component is not set before calling `init`, it throws an error.
|
|
49
|
+
*
|
|
50
|
+
* @throws {Error} If `component` is not set.
|
|
51
|
+
*/
|
|
29
52
|
public init() {
|
|
30
53
|
if (!this.component) {
|
|
31
54
|
throw new Error(
|
package/src/base/Plugin/types.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { NModule } from '../Module/types';
|
|
2
2
|
|
|
3
3
|
export namespace NPlugin {
|
|
4
|
+
/**
|
|
5
|
+
* Static properties for plugins. These properties remain constant throughout the lifecycle of the plugin.
|
|
6
|
+
*/
|
|
4
7
|
export interface IStaticProps extends NModule.IStaticProps {}
|
|
5
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Changeable properties for plugins. These properties can change dynamically during the lifecycle of the plugin.
|
|
11
|
+
* Extends from {@link NModule.IChangeableProps}, providing plugins with the ability to update their properties over time.
|
|
12
|
+
*/
|
|
6
13
|
export interface IChangeableProps extends NModule.IChangeableProps {}
|
|
7
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Defines the available callback types for plugins. These callbacks allow plugins to respond to lifecycle events or property changes.
|
|
17
|
+
* Extends from {@link NModule.ICallbacksTypes}, meaning that plugins share the same callback structure as modules.
|
|
18
|
+
*/
|
|
8
19
|
export interface ICallbacksTypes extends NModule.ICallbacksTypes {}
|
|
9
20
|
}
|
|
@@ -4,7 +4,8 @@ import { NAnimationFrame } from './types';
|
|
|
4
4
|
export type { NAnimationFrame };
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Launches an animation frame with a specified FPS, allowing
|
|
8
|
+
* control over playback and FPS calculations in real-time.
|
|
8
9
|
*/
|
|
9
10
|
export class AnimationFrame<
|
|
10
11
|
StaticProps extends
|
|
@@ -23,38 +24,39 @@ export class AnimationFrame<
|
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
/**
|
|
27
|
+
/** Whether the animation frame is currently playing */
|
|
27
28
|
protected _isPlaying: boolean;
|
|
28
29
|
|
|
30
|
+
/** Returns the current playback state of the animation frame */
|
|
29
31
|
get isPlaying() {
|
|
30
32
|
return this._isPlaying;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
/** The
|
|
35
|
+
/** The ID of the currently active requestAnimationFrame, or `null` if inactive */
|
|
34
36
|
protected _raf: number | null;
|
|
35
37
|
|
|
36
|
-
/**
|
|
38
|
+
/** Index of the current animation frame */
|
|
37
39
|
protected _rafIndex: number;
|
|
38
40
|
|
|
39
|
-
/**
|
|
41
|
+
/** The timestamp of the first frame in the animation sequence */
|
|
40
42
|
protected _rafFirst: null | number;
|
|
41
43
|
|
|
42
|
-
/**
|
|
44
|
+
/** The timestamp of the last frame in the animation sequence */
|
|
43
45
|
protected _rafLast: null | number;
|
|
44
46
|
|
|
45
|
-
/** Array of frame
|
|
47
|
+
/** Array storing the duration of each frame in milliseconds */
|
|
46
48
|
protected _durations: number[];
|
|
47
49
|
|
|
48
|
-
/**
|
|
50
|
+
/** The computed frames per second based on real-time performance */
|
|
49
51
|
protected _computedFPS: number;
|
|
50
52
|
|
|
51
|
-
/**
|
|
53
|
+
/** Returns the current computed FPS, which may differ from the set FPS */
|
|
52
54
|
get computedFPS() {
|
|
53
55
|
return this._computedFPS;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
/** Coefficient
|
|
57
|
-
get
|
|
58
|
+
/** Coefficient that scales based on a target of 60 FPS compared to the computed FPS */
|
|
59
|
+
get fpsMultiplier() {
|
|
58
60
|
return 60 / this.computedFPS;
|
|
59
61
|
}
|
|
60
62
|
|
|
@@ -78,7 +80,7 @@ export class AnimationFrame<
|
|
|
78
80
|
super._init();
|
|
79
81
|
|
|
80
82
|
if (this.props.isEnabled) {
|
|
81
|
-
this.
|
|
83
|
+
this._play();
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
|
|
@@ -96,7 +98,7 @@ export class AnimationFrame<
|
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
/**
|
|
101
|
+
/** Begins the animation loop */
|
|
100
102
|
public play() {
|
|
101
103
|
if (this.isDestroyed) {
|
|
102
104
|
return;
|
|
@@ -109,7 +111,7 @@ export class AnimationFrame<
|
|
|
109
111
|
this.changeProps({ isEnabled: true } as ChangeableProps);
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
/**
|
|
114
|
+
/** Internal method to start the animation loop */
|
|
113
115
|
protected _play() {
|
|
114
116
|
if (this.isPlaying) {
|
|
115
117
|
return;
|
|
@@ -123,7 +125,7 @@ export class AnimationFrame<
|
|
|
123
125
|
this._raf = window.requestAnimationFrame(this._animate.bind(this));
|
|
124
126
|
}
|
|
125
127
|
|
|
126
|
-
/**
|
|
128
|
+
/** Pauses the animation loop */
|
|
127
129
|
public pause() {
|
|
128
130
|
if (!this.props.isEnabled) {
|
|
129
131
|
return;
|
|
@@ -132,7 +134,7 @@ export class AnimationFrame<
|
|
|
132
134
|
this.changeProps({ isEnabled: false } as ChangeableProps);
|
|
133
135
|
}
|
|
134
136
|
|
|
135
|
-
/**
|
|
137
|
+
/** Internal method to pause the animation loop */
|
|
136
138
|
protected _pause() {
|
|
137
139
|
if (!this.isPlaying) {
|
|
138
140
|
return;
|
|
@@ -149,7 +151,7 @@ export class AnimationFrame<
|
|
|
149
151
|
this.callbacks.tbt('toggle', undefined);
|
|
150
152
|
}
|
|
151
153
|
|
|
152
|
-
/**
|
|
154
|
+
/** Handles each frame of the animation, calculates FPS, and triggers callbacks */
|
|
153
155
|
protected _animate() {
|
|
154
156
|
if (!this._isPlaying) {
|
|
155
157
|
return;
|
|
@@ -157,42 +159,34 @@ export class AnimationFrame<
|
|
|
157
159
|
|
|
158
160
|
this._raf = window.requestAnimationFrame(this._animate.bind(this));
|
|
159
161
|
|
|
160
|
-
// update time
|
|
161
162
|
const startTime = Date.now();
|
|
162
163
|
if (this._rafFirst === null) {
|
|
163
164
|
this._rafFirst = startTime;
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
// calculate frame index
|
|
167
167
|
const minFrameDuration =
|
|
168
168
|
this.props.fps === 'auto' ? 1 : 1000 / this.props.fps;
|
|
169
169
|
const newFrameIndex = Math.floor(
|
|
170
170
|
(startTime - this._rafFirst) / minFrameDuration,
|
|
171
171
|
);
|
|
172
172
|
|
|
173
|
-
// break if frame index the same
|
|
174
173
|
if (newFrameIndex <= this._rafIndex) {
|
|
175
174
|
return;
|
|
176
175
|
}
|
|
177
176
|
|
|
178
|
-
// update frame index
|
|
179
177
|
this._rafIndex = newFrameIndex;
|
|
180
178
|
|
|
181
|
-
// compute fps
|
|
182
179
|
this._computeFPS(startTime);
|
|
183
180
|
|
|
184
|
-
// launch callbacks
|
|
185
181
|
this.callbacks.tbt('frame', undefined);
|
|
186
182
|
|
|
187
|
-
// update vars
|
|
188
183
|
this._rafLast = startTime;
|
|
189
184
|
}
|
|
190
185
|
|
|
191
|
-
/**
|
|
186
|
+
/** Computes the real-time FPS based on the duration between frames */
|
|
192
187
|
protected _computeFPS(startTime: number) {
|
|
193
188
|
const lastFrameDuration = startTime - (this._rafLast ?? startTime);
|
|
194
189
|
|
|
195
|
-
// skip frames that seem not real
|
|
196
190
|
if (lastFrameDuration <= 0 || lastFrameDuration > 250) {
|
|
197
191
|
return;
|
|
198
192
|
}
|
|
@@ -215,11 +209,10 @@ export class AnimationFrame<
|
|
|
215
209
|
|
|
216
210
|
this._computedFPS = normalizedFPS;
|
|
217
211
|
|
|
218
|
-
// clear durations
|
|
219
212
|
this._durations = [];
|
|
220
213
|
}
|
|
221
214
|
|
|
222
|
-
/**
|
|
215
|
+
/** Destroys the animation frame and stops the loop */
|
|
223
216
|
protected _destroy() {
|
|
224
217
|
this.pause();
|
|
225
218
|
|
|
@@ -5,26 +5,46 @@ export namespace NAnimationFrame {
|
|
|
5
5
|
|
|
6
6
|
export interface IChangeableProps extends NComponent.IChangeableProps {
|
|
7
7
|
/**
|
|
8
|
-
* Frames per second
|
|
8
|
+
* Frames per second (FPS) for the animation.
|
|
9
|
+
* If set to 'auto', the FPS will be dynamically determined based on the system's performance.
|
|
9
10
|
* @default 'auto'
|
|
10
11
|
*/
|
|
11
12
|
fps?: 'auto' | number;
|
|
13
|
+
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
15
|
+
* The number of frames to test for detecting the real FPS when 'auto' is selected.
|
|
16
|
+
* This determines how many frames are measured before calculating the average FPS.
|
|
14
17
|
* @default 10
|
|
15
18
|
*/
|
|
16
19
|
autoFpsFrames?: number;
|
|
20
|
+
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
22
|
+
* Determines whether the AnimationFrame is enabled or not.
|
|
23
|
+
* When set to `true`, the animation loop will run.
|
|
19
24
|
* @default false
|
|
20
25
|
*/
|
|
21
26
|
isEnabled?: boolean;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
export interface ICallbacksTypes extends NComponent.ICallbacksTypes {
|
|
30
|
+
/**
|
|
31
|
+
* Triggered when the animation starts playing.
|
|
32
|
+
*/
|
|
25
33
|
play: undefined;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Triggered when the animation is paused.
|
|
37
|
+
*/
|
|
26
38
|
pause: undefined;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Triggered when the animation toggles between play and pause.
|
|
42
|
+
*/
|
|
27
43
|
toggle: undefined;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Triggered on each frame of the animation.
|
|
47
|
+
*/
|
|
28
48
|
frame: undefined;
|
|
29
49
|
}
|
|
30
50
|
}
|
|
@@ -6,15 +6,15 @@ import { getApp } from '@/utils/internal/getApp';
|
|
|
6
6
|
export type { NCtx2D };
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* It
|
|
11
|
-
* implement automatic resize.
|
|
9
|
+
* A class that simplifies working with an HTML5 Canvas element and its 2D context.
|
|
10
|
+
* It can handle automatic resizing and provides helper methods for rendering and managing canvas properties.
|
|
12
11
|
*/
|
|
13
12
|
export class Ctx2D<
|
|
14
13
|
StaticProps extends NCtx2D.IStaticProps = NCtx2D.IStaticProps,
|
|
15
14
|
ChangeableProps extends NCtx2D.IChangeableProps = NCtx2D.IChangeableProps,
|
|
16
15
|
CallbacksTypes extends NCtx2D.ICallbacksTypes = NCtx2D.ICallbacksTypes,
|
|
17
16
|
> extends ComponentClass<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
17
|
+
/** @inheritDoc */
|
|
18
18
|
protected _getDefaultProps() {
|
|
19
19
|
return {
|
|
20
20
|
...super._getDefaultProps(),
|
|
@@ -30,66 +30,69 @@ export class Ctx2D<
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/** The parent element of the canvas */
|
|
33
|
+
/** The parent element of the canvas used to calculate size */
|
|
34
34
|
get container() {
|
|
35
35
|
return this.props.container;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/** The
|
|
38
|
+
/** The canvas element created for rendering */
|
|
39
39
|
protected _canvas: HTMLCanvasElement;
|
|
40
40
|
|
|
41
|
-
/**
|
|
41
|
+
/** Returns the current canvas element */
|
|
42
42
|
get canvas() {
|
|
43
43
|
return this._canvas;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
/** 2D
|
|
46
|
+
/** The 2D rendering context for the canvas */
|
|
47
47
|
protected _ctx: CanvasRenderingContext2D;
|
|
48
48
|
|
|
49
|
-
/** 2D
|
|
49
|
+
/** Returns the 2D rendering context */
|
|
50
50
|
get ctx() {
|
|
51
51
|
return this._ctx;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
/** The current width of the canvas, considering the device pixel ratio (DPR) */
|
|
55
55
|
protected _width: number;
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
/** Returns the current width of the canvas (with DPR applied) */
|
|
58
58
|
get width() {
|
|
59
59
|
return this._width;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
/** Returns the width of the canvas without the device pixel ratio (DPR) */
|
|
63
63
|
get clientWidth() {
|
|
64
64
|
return this.width / this.dpr;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
/** The current height of the canvas, considering the device pixel ratio (DPR) */
|
|
68
68
|
protected _height: number;
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
/** Returns the current height of the canvas (with DPR applied) */
|
|
71
71
|
get height() {
|
|
72
72
|
return this._height;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
/** Returns the height of the canvas without the device pixel ratio (DPR) */
|
|
76
76
|
get clientHeight() {
|
|
77
77
|
return this.height / this.dpr;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
/**
|
|
80
|
+
/** The current device pixel ratio (DPR) */
|
|
81
81
|
protected _dpr: number;
|
|
82
82
|
|
|
83
|
-
/**
|
|
83
|
+
/** Returns the current device pixel ratio (DPR) */
|
|
84
84
|
get dpr() {
|
|
85
85
|
return this._dpr;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
/**
|
|
88
|
+
/** Checks if the canvas is ready to be rendered */
|
|
89
89
|
get canRender() {
|
|
90
90
|
return this.width > 0 && this.height > 0;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Constructor for the Ctx2D class.
|
|
95
|
+
*/
|
|
93
96
|
constructor(initialProps?: StaticProps & ChangeableProps, canInit = true) {
|
|
94
97
|
super(initialProps, false);
|
|
95
98
|
|
|
@@ -100,7 +103,7 @@ export class Ctx2D<
|
|
|
100
103
|
this._height = 0;
|
|
101
104
|
this._dpr = 1;
|
|
102
105
|
|
|
103
|
-
// create canvas
|
|
106
|
+
// create canvas element
|
|
104
107
|
this._canvas = document.createElement('canvas');
|
|
105
108
|
this._canvas.style.position = 'absolute';
|
|
106
109
|
this._canvas.style.top = '0';
|
|
@@ -108,14 +111,13 @@ export class Ctx2D<
|
|
|
108
111
|
this._canvas.style.width = '100%';
|
|
109
112
|
this._canvas.style.height = '100%';
|
|
110
113
|
|
|
111
|
-
// append canvas
|
|
114
|
+
// append canvas to container if required
|
|
112
115
|
if (shouldAppend && container instanceof Element) {
|
|
113
116
|
container.append(this._canvas);
|
|
114
|
-
|
|
115
117
|
this.addDestroyableAction(() => this.canvas.remove());
|
|
116
118
|
}
|
|
117
119
|
|
|
118
|
-
// create context
|
|
120
|
+
// create 2D context
|
|
119
121
|
this._ctx = this._canvas.getContext('2d')!;
|
|
120
122
|
|
|
121
123
|
if (canInit) {
|
|
@@ -123,19 +125,21 @@ export class Ctx2D<
|
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
|
|
128
|
+
/** @inheritDoc */
|
|
126
129
|
protected _onPropsMutate() {
|
|
127
130
|
super._onPropsMutate();
|
|
128
|
-
|
|
129
131
|
this.resize();
|
|
130
132
|
}
|
|
131
133
|
|
|
134
|
+
/** @inheritDoc */
|
|
132
135
|
protected _init() {
|
|
133
136
|
super._init();
|
|
134
|
-
|
|
135
137
|
this._setResize();
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* Sets up the resize event listener for the canvas, if enabled.
|
|
142
|
+
*/
|
|
139
143
|
protected _setResize() {
|
|
140
144
|
const { hasInitialResize, hasResize, viewportTarget, resizeDebounce } =
|
|
141
145
|
this.props;
|
|
@@ -158,7 +162,9 @@ export class Ctx2D<
|
|
|
158
162
|
}
|
|
159
163
|
}
|
|
160
164
|
|
|
161
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* Resizes the canvas based on the container or viewport size and applies the device pixel ratio (DPR).
|
|
167
|
+
*/
|
|
162
168
|
public resize() {
|
|
163
169
|
const { props, canvas } = this;
|
|
164
170
|
|
|
@@ -168,16 +174,17 @@ export class Ctx2D<
|
|
|
168
174
|
|
|
169
175
|
const { viewport } = getApp();
|
|
170
176
|
|
|
171
|
-
// calculate
|
|
177
|
+
// calculate DPR
|
|
172
178
|
if (typeof props.dpr === 'number') {
|
|
173
179
|
this._dpr = props.dpr;
|
|
174
180
|
} else {
|
|
175
181
|
this._dpr = viewport.dpr;
|
|
176
182
|
}
|
|
177
183
|
|
|
178
|
-
// calculate new width
|
|
184
|
+
// calculate new width and height
|
|
179
185
|
let newWidth = 0;
|
|
180
186
|
let newHeight = 0;
|
|
187
|
+
|
|
181
188
|
if (typeof props.width === 'number' && typeof props.height === 'number') {
|
|
182
189
|
newWidth = props.width;
|
|
183
190
|
newHeight = props.height;
|
|
@@ -189,27 +196,32 @@ export class Ctx2D<
|
|
|
189
196
|
newHeight = viewport.height;
|
|
190
197
|
}
|
|
191
198
|
|
|
192
|
-
// apply
|
|
199
|
+
// apply DPR
|
|
193
200
|
newWidth *= this._dpr;
|
|
194
201
|
newHeight *= this._dpr;
|
|
195
202
|
|
|
196
|
-
// update
|
|
203
|
+
// update canvas size
|
|
197
204
|
this._width = newWidth;
|
|
198
205
|
this._height = newHeight;
|
|
199
|
-
|
|
200
|
-
// apply sizes
|
|
201
206
|
canvas.width = newWidth;
|
|
202
207
|
canvas.height = newHeight;
|
|
203
208
|
|
|
204
|
-
//
|
|
209
|
+
// handle resize event and trigger callbacks
|
|
205
210
|
this._handleResize();
|
|
206
211
|
this.callbacks.tbt('resize', undefined);
|
|
207
212
|
}
|
|
208
213
|
|
|
209
|
-
/**
|
|
214
|
+
/**
|
|
215
|
+
* A method called after the canvas has been resized.
|
|
216
|
+
* This can be extended or customized in subclasses.
|
|
217
|
+
*/
|
|
210
218
|
protected _handleResize() {}
|
|
211
219
|
|
|
212
|
-
/**
|
|
220
|
+
/**
|
|
221
|
+
* Renders content on the canvas if it is ready.
|
|
222
|
+
*
|
|
223
|
+
* @param renderProp - A function that performs the actual rendering on the canvas.
|
|
224
|
+
*/
|
|
213
225
|
public render(renderProp: NCtx2D.TRender) {
|
|
214
226
|
if (!this.canRender) {
|
|
215
227
|
return;
|
|
@@ -4,33 +4,38 @@ import { TOnResizeTarget } from '@/utils/listeners/onResize';
|
|
|
4
4
|
export namespace NCtx2D {
|
|
5
5
|
export interface IStaticProps extends NComponent.IStaticProps {
|
|
6
6
|
/**
|
|
7
|
-
* The parent element of the canvas
|
|
8
|
-
* If `false`,
|
|
7
|
+
* The parent element of the canvas, used to calculate the canvas size.
|
|
8
|
+
* If set to `false`, the canvas size will be based on the `Window` object.
|
|
9
9
|
* @default false
|
|
10
10
|
*/
|
|
11
11
|
container?: false | Element;
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* Determines whether the canvas element should be appended to the parent element.
|
|
14
15
|
* @default true
|
|
15
16
|
*/
|
|
16
17
|
shouldAppend?: boolean;
|
|
18
|
+
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
20
|
+
* Resizes the canvas during initialization.
|
|
19
21
|
* @default true
|
|
20
22
|
*/
|
|
21
23
|
hasInitialResize?: boolean;
|
|
24
|
+
|
|
22
25
|
/**
|
|
23
|
-
*
|
|
26
|
+
* Enables updating the canvas size when the window is resized.
|
|
24
27
|
* @default false
|
|
25
28
|
*/
|
|
26
29
|
hasResize?: boolean;
|
|
30
|
+
|
|
27
31
|
/**
|
|
28
|
-
*
|
|
32
|
+
* The target for the viewport resize event.
|
|
29
33
|
* @default 'any'
|
|
30
34
|
*/
|
|
31
35
|
viewportTarget?: TOnResizeTarget;
|
|
36
|
+
|
|
32
37
|
/**
|
|
33
|
-
*
|
|
38
|
+
* The debounce time (in milliseconds) for the resize event.
|
|
34
39
|
* @default 0
|
|
35
40
|
*/
|
|
36
41
|
resizeDebounce?: number;
|
|
@@ -38,38 +43,73 @@ export namespace NCtx2D {
|
|
|
38
43
|
|
|
39
44
|
export interface IChangeableProps extends NComponent.IChangeableProps {
|
|
40
45
|
/**
|
|
41
|
-
* The width of the canvas without
|
|
42
|
-
* If `auto`, the width will
|
|
46
|
+
* The width of the canvas (without considering device pixel ratio).
|
|
47
|
+
* If set to `auto`, the width will match the container's width.
|
|
43
48
|
* @default 'auto'
|
|
44
49
|
*/
|
|
45
50
|
width?: 'auto' | number;
|
|
51
|
+
|
|
46
52
|
/**
|
|
47
|
-
* The height of the canvas (
|
|
48
|
-
* If `auto`, the height will
|
|
53
|
+
* The height of the canvas (without considering device pixel ratio).
|
|
54
|
+
* If set to `auto`, the height will match the container's height.
|
|
49
55
|
* @default 'auto'
|
|
50
56
|
*/
|
|
51
57
|
height?: 'auto' | number;
|
|
58
|
+
|
|
52
59
|
/**
|
|
53
|
-
*
|
|
54
|
-
* If `auto`, the
|
|
60
|
+
* The device pixel ratio (DPR) to be used for the canvas.
|
|
61
|
+
* If set to `auto`, the DPR will be automatically calculated.
|
|
55
62
|
* @default 'auto'
|
|
56
63
|
*/
|
|
57
64
|
dpr?: 'auto' | number;
|
|
58
65
|
}
|
|
59
66
|
|
|
60
67
|
export interface ICallbacksTypes extends NComponent.ICallbacksTypes {
|
|
68
|
+
/**
|
|
69
|
+
* Triggered when the canvas is resized.
|
|
70
|
+
*/
|
|
61
71
|
resize: undefined;
|
|
62
72
|
}
|
|
63
73
|
|
|
64
74
|
export interface IRenderProps {
|
|
75
|
+
/**
|
|
76
|
+
* The 2D rendering context of the canvas.
|
|
77
|
+
*/
|
|
65
78
|
ctx: CanvasRenderingContext2D;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The width of the canvas, including the device pixel ratio.
|
|
82
|
+
*/
|
|
66
83
|
width: number;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The height of the canvas, including the device pixel ratio.
|
|
87
|
+
*/
|
|
67
88
|
height: number;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The device pixel ratio for rendering on the canvas.
|
|
92
|
+
*/
|
|
68
93
|
dpr: number;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The client width of the canvas (before DPR is applied).
|
|
97
|
+
*/
|
|
69
98
|
clientWidth: number;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The client height of the canvas (before DPR is applied).
|
|
102
|
+
*/
|
|
70
103
|
clientHeight: number;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The HTMLCanvasElement associated with the canvas.
|
|
107
|
+
*/
|
|
71
108
|
canvas: HTMLCanvasElement;
|
|
72
109
|
}
|
|
73
110
|
|
|
111
|
+
/**
|
|
112
|
+
* A function that performs rendering on the canvas using the provided rendering properties.
|
|
113
|
+
*/
|
|
74
114
|
export type TRender = (props: IRenderProps) => void;
|
|
75
115
|
}
|