@studiometa/ui 0.2.13 → 0.2.15
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/atoms/AnchorScrollTo/AnchorScrollTo.cjs +4 -3
- package/atoms/AnchorScrollTo/AnchorScrollTo.cjs.map +7 -0
- package/atoms/AnchorScrollTo/AnchorScrollTo.d.ts +8 -15
- package/atoms/AnchorScrollTo/AnchorScrollTo.js +21 -1
- package/atoms/AnchorScrollTo/AnchorScrollTo.js.map +7 -0
- package/atoms/AnchorScrollTo/index.cjs +21 -0
- package/atoms/AnchorScrollTo/index.cjs.map +7 -0
- package/atoms/AnchorScrollTo/index.d.ts +1 -0
- package/atoms/AnchorScrollTo/index.js +2 -0
- package/atoms/AnchorScrollTo/index.js.map +7 -0
- package/atoms/Cursor/Cursor.cjs +8 -3
- package/atoms/Cursor/Cursor.cjs.map +7 -0
- package/atoms/Cursor/Cursor.d.ts +19 -117
- package/atoms/Cursor/Cursor.js +103 -1
- package/atoms/Cursor/Cursor.js.map +7 -0
- package/atoms/Cursor/index.cjs +21 -0
- package/atoms/Cursor/index.cjs.map +7 -0
- package/atoms/Cursor/index.d.ts +1 -0
- package/atoms/Cursor/index.js +2 -0
- package/atoms/Cursor/index.js.map +7 -0
- package/atoms/Figure/Figure.cjs +16 -9
- package/atoms/Figure/Figure.cjs.map +7 -0
- package/atoms/Figure/Figure.d.ts +18 -53
- package/atoms/Figure/Figure.js +51 -1
- package/atoms/Figure/Figure.js.map +7 -0
- package/atoms/Figure/FigureTwicPics.cjs +11 -10
- package/atoms/Figure/FigureTwicPics.cjs.map +7 -0
- package/atoms/Figure/FigureTwicPics.d.ts +16 -37
- package/atoms/Figure/FigureTwicPics.js +46 -1
- package/atoms/Figure/FigureTwicPics.js.map +7 -0
- package/atoms/Figure/index.cjs +5 -14
- package/atoms/Figure/index.cjs.map +7 -0
- package/atoms/Figure/index.d.ts +2 -2
- package/atoms/Figure/index.js +3 -1
- package/atoms/Figure/index.js.map +7 -0
- package/atoms/LargeText/LargeText.cjs +8 -3
- package/atoms/LargeText/LargeText.cjs.map +7 -0
- package/atoms/LargeText/LargeText.d.ts +19 -40
- package/atoms/LargeText/LargeText.js +60 -1
- package/atoms/LargeText/LargeText.js.map +7 -0
- package/atoms/LargeText/index.cjs +21 -0
- package/atoms/LargeText/index.cjs.map +7 -0
- package/atoms/LargeText/index.d.ts +1 -0
- package/atoms/LargeText/index.js +2 -0
- package/atoms/LargeText/index.js.map +7 -0
- package/atoms/LazyInclude/LazyInclude.cjs +3 -2
- package/atoms/LazyInclude/LazyInclude.cjs.map +7 -0
- package/atoms/LazyInclude/LazyInclude.d.ts +17 -36
- package/atoms/LazyInclude/LazyInclude.js +41 -1
- package/atoms/LazyInclude/LazyInclude.js.map +7 -0
- package/atoms/LazyInclude/index.cjs +21 -0
- package/atoms/LazyInclude/index.cjs.map +7 -0
- package/atoms/LazyInclude/index.d.ts +1 -0
- package/atoms/LazyInclude/index.js +2 -0
- package/atoms/LazyInclude/index.js.map +7 -0
- package/atoms/Prefetch/AbstractPrefetch.cjs +7 -6
- package/atoms/Prefetch/AbstractPrefetch.cjs.map +7 -0
- package/atoms/Prefetch/AbstractPrefetch.d.ts +12 -35
- package/atoms/Prefetch/AbstractPrefetch.js +52 -1
- package/atoms/Prefetch/AbstractPrefetch.js.map +7 -0
- package/atoms/Prefetch/PrefetchWhenOver.cjs +6 -8
- package/atoms/Prefetch/PrefetchWhenOver.cjs.map +7 -0
- package/atoms/Prefetch/PrefetchWhenOver.d.ts +8 -14
- package/atoms/Prefetch/PrefetchWhenOver.js +14 -1
- package/atoms/Prefetch/PrefetchWhenOver.js.map +7 -0
- package/atoms/Prefetch/PrefetchWhenVisible.cjs +6 -8
- package/atoms/Prefetch/PrefetchWhenVisible.cjs.map +7 -0
- package/atoms/Prefetch/PrefetchWhenVisible.d.ts +10 -14
- package/atoms/Prefetch/PrefetchWhenVisible.js +15 -1
- package/atoms/Prefetch/PrefetchWhenVisible.js.map +7 -0
- package/atoms/Prefetch/index.cjs +6 -16
- package/atoms/Prefetch/index.cjs.map +7 -0
- package/atoms/Prefetch/index.d.ts +3 -3
- package/atoms/Prefetch/index.js +4 -1
- package/atoms/Prefetch/index.js.map +7 -0
- package/atoms/ScrollAnimation/AbstractScrollAnimation.cjs +18 -14
- package/atoms/ScrollAnimation/AbstractScrollAnimation.cjs.map +7 -0
- package/atoms/ScrollAnimation/AbstractScrollAnimation.d.ts +19 -89
- package/atoms/ScrollAnimation/AbstractScrollAnimation.js +62 -1
- package/atoms/ScrollAnimation/AbstractScrollAnimation.js.map +7 -0
- package/atoms/ScrollAnimation/ScrollAnimation.cjs +6 -14
- package/atoms/ScrollAnimation/ScrollAnimation.cjs.map +7 -0
- package/atoms/ScrollAnimation/ScrollAnimation.d.ts +13 -51
- package/atoms/ScrollAnimation/ScrollAnimation.js +16 -1
- package/atoms/ScrollAnimation/ScrollAnimation.js.map +7 -0
- package/atoms/ScrollAnimation/ScrollAnimationChild.cjs +31 -10
- package/atoms/ScrollAnimation/ScrollAnimationChild.cjs.map +7 -0
- package/atoms/ScrollAnimation/ScrollAnimationChild.d.ts +19 -6
- package/atoms/ScrollAnimation/ScrollAnimationChild.js +45 -1
- package/atoms/ScrollAnimation/ScrollAnimationChild.js.map +7 -0
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.cjs +7 -9
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.cjs.map +7 -0
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.d.ts +8 -2
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js +12 -1
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js.map +7 -0
- package/atoms/ScrollAnimation/ScrollAnimationParent.cjs +9 -8
- package/atoms/ScrollAnimation/ScrollAnimationParent.cjs.map +7 -0
- package/atoms/ScrollAnimation/ScrollAnimationParent.d.ts +14 -26
- package/atoms/ScrollAnimation/ScrollAnimationParent.js +22 -1
- package/atoms/ScrollAnimation/ScrollAnimationParent.js.map +7 -0
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.cjs +7 -9
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.cjs.map +7 -0
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.d.ts +15 -2
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.js +12 -1
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.js.map +7 -0
- package/atoms/ScrollAnimation/animationScrollWithEase.cjs +9 -5
- package/atoms/ScrollAnimation/animationScrollWithEase.cjs.map +7 -0
- package/atoms/ScrollAnimation/animationScrollWithEase.d.ts +10 -8
- package/atoms/ScrollAnimation/animationScrollWithEase.js +31 -1
- package/atoms/ScrollAnimation/animationScrollWithEase.js.map +7 -0
- package/atoms/ScrollAnimation/index.cjs +10 -24
- package/atoms/ScrollAnimation/index.cjs.map +7 -0
- package/atoms/ScrollAnimation/index.d.ts +7 -7
- package/atoms/ScrollAnimation/index.js +8 -1
- package/atoms/ScrollAnimation/index.js.map +7 -0
- package/atoms/ScrollReveal/ScrollReveal.cjs +6 -3
- package/atoms/ScrollReveal/ScrollReveal.cjs.map +7 -0
- package/atoms/ScrollReveal/ScrollReveal.d.ts +16 -59
- package/atoms/ScrollReveal/ScrollReveal.js +47 -1
- package/atoms/ScrollReveal/ScrollReveal.js.map +7 -0
- package/atoms/ScrollReveal/index.cjs +4 -12
- package/atoms/ScrollReveal/index.cjs.map +7 -0
- package/atoms/ScrollReveal/index.d.ts +1 -1
- package/atoms/ScrollReveal/index.js +2 -1
- package/atoms/ScrollReveal/index.js.map +7 -0
- package/atoms/index.cjs +6 -18
- package/atoms/index.cjs.map +7 -0
- package/atoms/index.d.ts +8 -8
- package/atoms/index.js +9 -1
- package/atoms/index.js.map +7 -0
- package/decorators/index.cjs +4 -12
- package/decorators/index.cjs.map +7 -0
- package/decorators/index.d.ts +1 -1
- package/decorators/index.js +2 -1
- package/decorators/index.js.map +7 -0
- package/decorators/withTransition.cjs +23 -17
- package/decorators/withTransition.cjs.map +7 -0
- package/decorators/withTransition.d.ts +21 -33
- package/decorators/withTransition.js +50 -1
- package/decorators/withTransition.js.map +7 -0
- package/index.cjs +2 -1
- package/index.cjs.map +7 -0
- package/index.d.ts +5 -5
- package/index.js +6 -1
- package/index.js.map +7 -0
- package/molecules/Accordion/Accordion.cjs +8 -10
- package/molecules/Accordion/Accordion.cjs.map +7 -0
- package/molecules/Accordion/Accordion.d.ts +5 -23
- package/molecules/Accordion/Accordion.js +14 -1
- package/molecules/Accordion/Accordion.js.map +7 -0
- package/molecules/Accordion/AccordionCore.cjs +7 -8
- package/molecules/Accordion/AccordionCore.cjs.map +7 -0
- package/molecules/Accordion/AccordionCore.d.ts +22 -70
- package/molecules/Accordion/AccordionCore.js +27 -1
- package/molecules/Accordion/AccordionCore.js.map +7 -0
- package/molecules/Accordion/AccordionItem.cjs +39 -23
- package/molecules/Accordion/AccordionItem.cjs.map +7 -0
- package/molecules/Accordion/AccordionItem.d.ts +24 -94
- package/molecules/Accordion/AccordionItem.js +146 -1
- package/molecules/Accordion/AccordionItem.js.map +7 -0
- package/molecules/Accordion/index.cjs +22 -0
- package/molecules/Accordion/index.cjs.map +7 -0
- package/molecules/Accordion/index.d.ts +2 -0
- package/molecules/Accordion/index.js +3 -0
- package/molecules/Accordion/index.js.map +7 -0
- package/molecules/Menu/Menu.cjs +7 -10
- package/molecules/Menu/Menu.cjs.map +7 -0
- package/molecules/Menu/Menu.d.ts +24 -84
- package/molecules/Menu/Menu.js +108 -1
- package/molecules/Menu/Menu.js.map +7 -0
- package/molecules/Menu/MenuBtn.cjs +4 -4
- package/molecules/Menu/MenuBtn.cjs.map +7 -0
- package/molecules/Menu/MenuBtn.d.ts +7 -9
- package/molecules/Menu/MenuBtn.js +22 -1
- package/molecules/Menu/MenuBtn.js.map +7 -0
- package/molecules/Menu/MenuList.cjs +9 -9
- package/molecules/Menu/MenuList.cjs.map +7 -0
- package/molecules/Menu/MenuList.d.ts +16 -53
- package/molecules/Menu/MenuList.js +104 -1
- package/molecules/Menu/MenuList.js.map +7 -0
- package/molecules/Menu/index.cjs +6 -16
- package/molecules/Menu/index.cjs.map +7 -0
- package/molecules/Menu/index.d.ts +3 -3
- package/molecules/Menu/index.js +4 -1
- package/molecules/Menu/index.js.map +7 -0
- package/molecules/Modal/Modal.cjs +35 -13
- package/molecules/Modal/Modal.cjs.map +7 -0
- package/molecules/Modal/Modal.d.ts +69 -140
- package/molecules/Modal/Modal.js +150 -1
- package/molecules/Modal/Modal.js.map +7 -0
- package/molecules/Modal/ModalWithTransition.cjs +5 -7
- package/molecules/Modal/ModalWithTransition.cjs.map +7 -0
- package/molecules/Modal/ModalWithTransition.d.ts +6 -22
- package/molecules/Modal/ModalWithTransition.js +41 -1
- package/molecules/Modal/ModalWithTransition.js.map +7 -0
- package/molecules/Modal/index.cjs +22 -0
- package/molecules/Modal/index.cjs.map +7 -0
- package/molecules/Modal/index.d.ts +2 -0
- package/molecules/Modal/index.js +3 -0
- package/molecules/Modal/index.js.map +7 -0
- package/molecules/Panel/Panel.cjs +38 -26
- package/molecules/Panel/Panel.cjs.map +7 -0
- package/molecules/Panel/Panel.d.ts +22 -21
- package/molecules/Panel/Panel.js +98 -1
- package/molecules/Panel/Panel.js.map +7 -0
- package/molecules/Panel/index.cjs +21 -0
- package/molecules/Panel/index.cjs.map +7 -0
- package/molecules/Panel/index.d.ts +1 -0
- package/molecules/Panel/index.js +2 -0
- package/molecules/Panel/index.js.map +7 -0
- package/molecules/Slider/AbstractSliderChild.cjs +8 -9
- package/molecules/Slider/AbstractSliderChild.cjs.map +7 -0
- package/molecules/Slider/AbstractSliderChild.d.ts +11 -30
- package/molecules/Slider/AbstractSliderChild.js +43 -1
- package/molecules/Slider/AbstractSliderChild.js.map +7 -0
- package/molecules/Slider/Slider.cjs +31 -18
- package/molecules/Slider/Slider.cjs.map +7 -0
- package/molecules/Slider/Slider.d.ts +40 -157
- package/molecules/Slider/Slider.js +271 -1
- package/molecules/Slider/Slider.js.map +7 -0
- package/molecules/Slider/SliderBtn.cjs +5 -7
- package/molecules/Slider/SliderBtn.cjs.map +7 -0
- package/molecules/Slider/SliderBtn.d.ts +12 -23
- package/molecules/Slider/SliderBtn.js +29 -1
- package/molecules/Slider/SliderBtn.js.map +7 -0
- package/molecules/Slider/SliderCount.cjs +5 -7
- package/molecules/Slider/SliderCount.cjs.map +7 -0
- package/molecules/Slider/SliderCount.d.ts +10 -16
- package/molecules/Slider/SliderCount.js +14 -1
- package/molecules/Slider/SliderCount.js.map +7 -0
- package/molecules/Slider/SliderDots.cjs +5 -7
- package/molecules/Slider/SliderDots.cjs.map +7 -0
- package/molecules/Slider/SliderDots.d.ts +11 -31
- package/molecules/Slider/SliderDots.js +24 -1
- package/molecules/Slider/SliderDots.js.map +7 -0
- package/molecules/Slider/SliderDrag.cjs +3 -2
- package/molecules/Slider/SliderDrag.cjs.map +7 -0
- package/molecules/Slider/SliderDrag.d.ts +12 -30
- package/molecules/Slider/SliderDrag.js +29 -1
- package/molecules/Slider/SliderDrag.js.map +7 -0
- package/molecules/Slider/SliderItem.cjs +7 -3
- package/molecules/Slider/SliderItem.cjs.map +7 -0
- package/molecules/Slider/SliderItem.d.ts +21 -33
- package/molecules/Slider/SliderItem.js +85 -1
- package/molecules/Slider/SliderItem.js.map +7 -0
- package/molecules/Slider/SliderProgress.cjs +5 -7
- package/molecules/Slider/SliderProgress.cjs.map +7 -0
- package/molecules/Slider/SliderProgress.d.ts +10 -25
- package/molecules/Slider/SliderProgress.js +21 -1
- package/molecules/Slider/SliderProgress.js.map +7 -0
- package/molecules/Slider/index.cjs +11 -26
- package/molecules/Slider/index.cjs.map +7 -0
- package/molecules/Slider/index.d.ts +8 -8
- package/molecules/Slider/index.js +9 -1
- package/molecules/Slider/index.js.map +7 -0
- package/molecules/Sticky/Sticky.cjs +12 -8
- package/molecules/Sticky/Sticky.cjs.map +7 -0
- package/molecules/Sticky/Sticky.d.ts +30 -68
- package/molecules/Sticky/Sticky.js +101 -1
- package/molecules/Sticky/Sticky.js.map +7 -0
- package/molecules/Sticky/index.cjs +21 -0
- package/molecules/Sticky/index.cjs.map +7 -0
- package/molecules/Sticky/index.d.ts +1 -0
- package/molecules/Sticky/index.js +2 -0
- package/molecules/Sticky/index.js.map +7 -0
- package/molecules/TableOfContent/TableOfContent.cjs +6 -8
- package/molecules/TableOfContent/TableOfContent.cjs.map +7 -0
- package/molecules/TableOfContent/TableOfContent.d.ts +19 -41
- package/molecules/TableOfContent/TableOfContent.js +37 -1
- package/molecules/TableOfContent/TableOfContent.js.map +7 -0
- package/molecules/TableOfContent/TableOfContentAnchor.cjs +7 -5
- package/molecules/TableOfContent/TableOfContentAnchor.cjs.map +7 -0
- package/molecules/TableOfContent/TableOfContentAnchor.d.ts +14 -17
- package/molecules/TableOfContent/TableOfContentAnchor.js +35 -1
- package/molecules/TableOfContent/TableOfContentAnchor.js.map +7 -0
- package/molecules/TableOfContent/index.cjs +5 -14
- package/molecules/TableOfContent/index.cjs.map +7 -0
- package/molecules/TableOfContent/index.d.ts +2 -2
- package/molecules/TableOfContent/index.js +3 -1
- package/molecules/TableOfContent/index.js.map +7 -0
- package/molecules/Tabs/Tabs.cjs +40 -22
- package/molecules/Tabs/Tabs.cjs.map +7 -0
- package/molecules/Tabs/Tabs.d.ts +28 -90
- package/molecules/Tabs/Tabs.js +115 -1
- package/molecules/Tabs/Tabs.js.map +7 -0
- package/molecules/Tabs/index.cjs +21 -0
- package/molecules/Tabs/index.cjs.map +7 -0
- package/molecules/Tabs/index.d.ts +1 -0
- package/molecules/Tabs/index.js +2 -0
- package/molecules/Tabs/index.js.map +7 -0
- package/molecules/index.cjs +8 -24
- package/molecules/index.cjs.map +7 -0
- package/molecules/index.d.ts +9 -10
- package/molecules/index.js +10 -1
- package/molecules/index.js.map +7 -0
- package/organisms/Frame/Frame.cjs +21 -43
- package/organisms/Frame/Frame.cjs.map +7 -0
- package/organisms/Frame/Frame.d.ts +21 -98
- package/organisms/Frame/Frame.js +155 -1
- package/organisms/Frame/Frame.js.map +7 -0
- package/organisms/Frame/FrameAnchor.cjs +3 -2
- package/organisms/Frame/FrameAnchor.cjs.map +7 -0
- package/organisms/Frame/FrameAnchor.d.ts +7 -16
- package/organisms/Frame/FrameAnchor.js +13 -1
- package/organisms/Frame/FrameAnchor.js.map +7 -0
- package/organisms/Frame/FrameForm.cjs +3 -2
- package/organisms/Frame/FrameForm.cjs.map +7 -0
- package/organisms/Frame/FrameForm.d.ts +10 -16
- package/organisms/Frame/FrameForm.js +13 -1
- package/organisms/Frame/FrameForm.js.map +7 -0
- package/organisms/Frame/FrameTarget.cjs +15 -9
- package/organisms/Frame/FrameTarget.cjs.map +7 -0
- package/organisms/Frame/FrameTarget.d.ts +17 -26
- package/organisms/Frame/FrameTarget.js +70 -1
- package/organisms/Frame/FrameTarget.js.map +7 -0
- package/organisms/Frame/index.cjs +7 -18
- package/organisms/Frame/index.cjs.map +7 -0
- package/organisms/Frame/index.d.ts +4 -4
- package/organisms/Frame/index.js +5 -1
- package/organisms/Frame/index.js.map +7 -0
- package/organisms/index.cjs +2 -1
- package/organisms/index.cjs.map +7 -0
- package/organisms/index.d.ts +1 -1
- package/organisms/index.js +2 -1
- package/organisms/index.js.map +7 -0
- package/package.json +2 -2
- package/primitives/Draggable/Draggable.cjs +3 -2
- package/primitives/Draggable/Draggable.cjs.map +7 -0
- package/primitives/Draggable/Draggable.d.ts +10 -11
- package/primitives/Draggable/Draggable.js +25 -1
- package/primitives/Draggable/Draggable.js.map +7 -0
- package/primitives/Draggable/index.cjs +21 -0
- package/primitives/Draggable/index.cjs.map +7 -0
- package/primitives/Draggable/index.d.ts +1 -0
- package/primitives/Draggable/index.js +2 -0
- package/primitives/Draggable/index.js.map +7 -0
- package/primitives/Sentinel/Sentinel.cjs +3 -2
- package/primitives/Sentinel/Sentinel.cjs.map +7 -0
- package/primitives/Sentinel/Sentinel.d.ts +6 -5
- package/primitives/Sentinel/Sentinel.js +10 -1
- package/primitives/Sentinel/Sentinel.js.map +7 -0
- package/primitives/Sentinel/index.cjs +21 -0
- package/primitives/Sentinel/index.cjs.map +7 -0
- package/primitives/Sentinel/index.d.ts +1 -0
- package/primitives/Sentinel/index.js +2 -0
- package/primitives/Sentinel/index.js.map +7 -0
- package/primitives/Transition/Transition.cjs +13 -3
- package/primitives/Transition/Transition.cjs.map +7 -0
- package/primitives/Transition/Transition.d.ts +13 -7
- package/primitives/Transition/Transition.js +11 -1
- package/primitives/Transition/Transition.js.map +7 -0
- package/primitives/Transition/index.cjs +21 -0
- package/primitives/Transition/index.cjs.map +7 -0
- package/primitives/Transition/index.d.ts +1 -0
- package/primitives/Transition/index.js +2 -0
- package/primitives/Transition/index.js.map +7 -0
- package/primitives/index.cjs +6 -16
- package/primitives/index.cjs.map +7 -0
- package/primitives/index.d.ts +3 -3
- package/primitives/index.js +4 -1
- package/primitives/index.js.map +7 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/ui/molecules/Slider/SliderProgress.ts"],
|
|
4
|
+
"sourcesContent": ["import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { transform, map, domScheduler } from '@studiometa/js-toolkit/utils';\nimport { AbstractSliderChild } from './AbstractSliderChild.js';\n\nexport interface SliderProgressProps extends BaseProps {\n $refs: {\n progress: HTMLElement;\n };\n}\n\n/**\n * SliderProgress class.\n */\nexport class SliderProgress<T extends BaseProps = BaseProps> extends AbstractSliderChild<\n T & SliderProgressProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'SliderProgress',\n refs: ['progress'],\n };\n\n /**\n * Update the progress indicator.\n */\n update(index:number) {\n domScheduler.read(() => {\n const { progress } = this.$refs;\n const x = map(index, 0, this.$parent.indexMax, progress.clientWidth * -1, 0);\n domScheduler.write(() => {\n transform(progress, { x });\n });\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,WAAW,KAAK,oBAAoB;AAC7C,SAAS,2BAA2B;AAW7B,MAAM,uBAAwD,oBAEnE;AAAA,EAIA,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,IACN,MAAM,CAAC,UAAU;AAAA,EACnB;AAAA,EAKA,OAAO,OAAc;AACnB,iBAAa,KAAK,MAAM;AACtB,YAAM,EAAE,SAAS,IAAI,KAAK;AAC1B,YAAM,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,UAAU,SAAS,cAAc,IAAI,CAAC;AAC3E,mBAAa,MAAM,MAAM;AACvB,kBAAU,UAAU,EAAE,EAAE,CAAC;AAAA,MAC3B,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
5
|
var __copyProps = (to, from, except, desc) => {
|
|
12
6
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
7
|
for (let key of __getOwnPropNames(from))
|
|
@@ -16,28 +10,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
10
|
}
|
|
17
11
|
return to;
|
|
18
12
|
};
|
|
19
|
-
var
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
15
|
|
|
22
|
-
// packages/ui/molecules/Slider/index.
|
|
16
|
+
// packages/ui/molecules/Slider/index.ts
|
|
23
17
|
var Slider_exports = {};
|
|
24
|
-
__export(Slider_exports, {
|
|
25
|
-
AbstractSliderChild: () => import_AbstractSliderChild.default,
|
|
26
|
-
Slider: () => import_Slider.default,
|
|
27
|
-
SliderBtn: () => import_SliderBtn.default,
|
|
28
|
-
SliderCount: () => import_SliderCount.default,
|
|
29
|
-
SliderDots: () => import_SliderDots.default,
|
|
30
|
-
SliderDrag: () => import_SliderDrag.default,
|
|
31
|
-
SliderItem: () => import_SliderItem.default,
|
|
32
|
-
SliderProgress: () => import_SliderProgress.default
|
|
33
|
-
});
|
|
34
18
|
module.exports = __toCommonJS(Slider_exports);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
19
|
+
__reExport(Slider_exports, require("./AbstractSliderChild.cjs"), module.exports);
|
|
20
|
+
__reExport(Slider_exports, require("./Slider.cjs"), module.exports);
|
|
21
|
+
__reExport(Slider_exports, require("./SliderBtn.cjs"), module.exports);
|
|
22
|
+
__reExport(Slider_exports, require("./SliderCount.cjs"), module.exports);
|
|
23
|
+
__reExport(Slider_exports, require("./SliderDrag.cjs"), module.exports);
|
|
24
|
+
__reExport(Slider_exports, require("./SliderItem.cjs"), module.exports);
|
|
25
|
+
__reExport(Slider_exports, require("./SliderProgress.cjs"), module.exports);
|
|
26
|
+
__reExport(Slider_exports, require("./SliderDots.cjs"), module.exports);
|
|
43
27
|
if (module.exports.default) module.exports = module.exports.default;
|
|
28
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/ui/molecules/Slider/index.ts"],
|
|
4
|
+
"sourcesContent": ["export * from './AbstractSliderChild.js';\nexport * from './Slider.js';\nexport * from './SliderBtn.js';\nexport * from './SliderCount.js';\nexport * from './SliderDrag.js';\nexport * from './SliderItem.js';\nexport * from './SliderProgress.js';\nexport * from './SliderDots.js';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,sCAAd;AACA,2BAAc,yBADd;AAEA,2BAAc,4BAFd;AAGA,2BAAc,8BAHd;AAIA,2BAAc,6BAJd;AAKA,2BAAc,6BALd;AAMA,2BAAc,iCANd;AAOA,2BAAc,6BAPd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
1
|
+
export * from './AbstractSliderChild.js';
|
|
2
|
+
export * from './Slider.js';
|
|
3
|
+
export * from './SliderBtn.js';
|
|
4
|
+
export * from './SliderCount.js';
|
|
5
|
+
export * from './SliderDrag.js';
|
|
6
|
+
export * from './SliderItem.js';
|
|
7
|
+
export * from './SliderProgress.js';
|
|
8
|
+
export * from './SliderDots.js';
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
export * from "./AbstractSliderChild.js";
|
|
2
|
+
export * from "./Slider.js";
|
|
3
|
+
export * from "./SliderBtn.js";
|
|
4
|
+
export * from "./SliderCount.js";
|
|
5
|
+
export * from "./SliderDrag.js";
|
|
6
|
+
export * from "./SliderItem.js";
|
|
7
|
+
export * from "./SliderProgress.js";
|
|
8
|
+
export * from "./SliderDots.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/ui/molecules/Slider/index.ts"],
|
|
4
|
+
"sourcesContent": ["export * from './AbstractSliderChild.js';\nexport * from './Slider.js';\nexport * from './SliderBtn.js';\nexport * from './SliderCount.js';\nexport * from './SliderDrag.js';\nexport * from './SliderItem.js';\nexport * from './SliderProgress.js';\nexport * from './SliderDots.js';\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -21,10 +21,10 @@ var __publicField = (obj, key, value) => {
|
|
|
21
21
|
return value;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
// packages/ui/molecules/Sticky/Sticky.
|
|
24
|
+
// packages/ui/molecules/Sticky/Sticky.ts
|
|
25
25
|
var Sticky_exports = {};
|
|
26
26
|
__export(Sticky_exports, {
|
|
27
|
-
|
|
27
|
+
Sticky: () => Sticky
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(Sticky_exports);
|
|
30
30
|
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
@@ -80,8 +80,10 @@ var _Sticky = class extends import_js_toolkit.Base {
|
|
|
80
80
|
}
|
|
81
81
|
setSentinelSize() {
|
|
82
82
|
const { instances } = this;
|
|
83
|
-
const index = instances.
|
|
84
|
-
const height = instances.slice(0, index).filter(
|
|
83
|
+
const index = instances.indexOf(this);
|
|
84
|
+
const height = instances.slice(0, index).filter(
|
|
85
|
+
(instance) => this.closestRelativeElement(instance.$el).contains(this.$el)
|
|
86
|
+
).reduce((acc, instance) => acc + instance.$el.offsetHeight, 0);
|
|
85
87
|
this.$refs.sentinelRef.style.height = `${height + 1}px`;
|
|
86
88
|
this.$el.style.top = `${height}px`;
|
|
87
89
|
this.$el.style.zIndex = String(this.$options.zIndex - index);
|
|
@@ -92,10 +94,11 @@ var _Sticky = class extends import_js_toolkit.Base {
|
|
|
92
94
|
return;
|
|
93
95
|
}
|
|
94
96
|
const { instances } = this;
|
|
95
|
-
index = index ?? instances.
|
|
96
|
-
this.y = instances.slice(0, index).filter((instance) => instance.isSticky && !instance.isVisible).reduce(
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
index = index ?? instances.indexOf(this);
|
|
98
|
+
this.y = instances.slice(0, index).filter((instance) => instance.isSticky && !instance.isVisible).reduce(
|
|
99
|
+
(y, instance) => y - instance.$refs.inner.offsetHeight,
|
|
100
|
+
this.isVisible ? 0 : this.$refs.inner.offsetHeight * -1
|
|
101
|
+
);
|
|
99
102
|
}
|
|
100
103
|
closestRelativeElement(element) {
|
|
101
104
|
let parent = element.parentElement;
|
|
@@ -123,3 +126,4 @@ __publicField(Sticky, "config", {
|
|
|
123
126
|
});
|
|
124
127
|
__publicField(Sticky, "instances", /* @__PURE__ */ new Set());
|
|
125
128
|
if (module.exports.default) module.exports = module.exports.default;
|
|
129
|
+
//# sourceMappingURL=Sticky.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/ui/molecules/Sticky/Sticky.ts"],
|
|
4
|
+
"sourcesContent": ["import { Base } from '@studiometa/js-toolkit';\nimport type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { Sentinel } from '../../primitives/index.js';\n\n/**\n * @typedef {Object} StickyRefs\n * @property {HTMLElement} inner\n * @property {HTMLElement} sentinelRef\n */\n\n/**\n * @typedef {Object} StickyPrivateInterface\n * @property {StickyRefs} $refs\n * @property {{ zIndex: number, hideWhenUp: boolean, hideWhenDown: boolean }} $options\n * @property {{ Sentinel: Sentinel[] }} $children\n */\n\nexport interface StickyProps extends BaseProps {\n $refs: {\n inner: HTMLElement;\n sentinelRef: HTMLElement;\n };\n $options: {\n zIndex: number;\n hideWhenUp: boolean;\n hideWhenDown: boolean;\n };\n $children: {\n Sentinel: Sentinel[];\n };\n}\n\n/**\n * Sticky class.\n */\nexport class Sticky<T extends BaseProps = BaseProps> extends Base<T & StickyProps> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'Sticky',\n refs: ['inner', 'sentinelRef'],\n components: {\n Sentinel,\n },\n options: {\n zIndex: {\n type: Number,\n default: 100,\n },\n hideWhenUp: Boolean,\n hideWhenDown: Boolean,\n },\n };\n\n /**\n * Holder for all instances.\n */\n // eslint-disable-next-line no-use-before-define\n static instances: Set<Sticky> = new Set();\n\n /**\n * Is the component sticky?\n */\n isSticky = false;\n\n /**\n * Is the component visible?\n */\n isVisible = true;\n\n /**\n * Set the Y value.\n */\n set y(value: number) {\n this.$refs.inner.style.transform = `translateY(${value}px) translateZ(0px)`;\n }\n\n /**\n * Get instances as array.\n */\n get instances(): Sticky[] {\n return Array.from(Sticky.instances);\n }\n\n /**\n * Mounted hook.\n */\n mounted() {\n Sticky.instances.add(this);\n this.setSentinelSize();\n }\n\n /**\n * Resized hook.\n */\n resized() {\n this.setSentinelSize();\n }\n\n /**\n * Destroyed hook.\n */\n destroyed() {\n Sticky.instances.delete(this);\n }\n\n /**\n * Scrolled hook.\n */\n scrolled(props) {\n if (!this.isSticky || props.y === props.last.y) {\n return;\n }\n\n if (\n (props.direction.y === 'DOWN' && this.$options.hideWhenDown) ||\n (props.direction.y === 'UP' && this.$options.hideWhenUp)\n ) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Listen to the sentinel's `intersected` event to set the `isSticky` value.\n *\n * @param {IntersectionObserverEntry[]} entries\n * @returns {void}\n */\n onSentinelIntersected([entry]: IntersectionObserverEntry[]) {\n this.isSticky = entry.isIntersecting && entry.boundingClientRect.y < 0;\n this.setPosition();\n }\n\n /**\n * Hide the sticky component when another one is sticky.\n */\n hide() {\n if (!this.isVisible) {\n return;\n }\n\n this.isVisible = false;\n this.$el.classList.add('pointer-events-none');\n\n this.instances.forEach((instance, index) => instance.setPosition(index));\n }\n\n /**\n * Show the sticky component when the other one is not sticky anymore.\n */\n show() {\n if (this.isVisible) {\n return;\n }\n\n this.isVisible = true;\n this.$el.classList.remove('pointer-events-none');\n this.instances.forEach((instance, index) => instance.setPosition(index));\n }\n\n /**\n * Set the sentinel height based on the previous instances.\n */\n setSentinelSize() {\n const { instances } = this;\n const index = instances.indexOf(this);\n const height = instances\n .slice(0, index)\n .filter(\n // Test each instance sticky context against the current element\n (instance) => this.closestRelativeElement(instance.$el).contains(this.$el),\n )\n .reduce((acc, instance) => acc + instance.$el.offsetHeight, 0);\n\n this.$refs.sentinelRef.style.height = `${height + 1}px`;\n this.$el.style.top = `${height}px`;\n this.$el.style.zIndex = String(this.$options.zIndex - index);\n }\n\n /**\n * Set the component's position.\n *\n * @param {number} [index] The instance index in all the pages' instances.\n * @returns {void}\n */\n setPosition(index?: number) {\n if (!this.isSticky) {\n this.y = 0;\n return;\n }\n\n const { instances } = this;\n\n // eslint-disable-next-line no-param-reassign\n index = index ?? instances.indexOf(this);\n\n this.y = (instances\n .slice(0, index)\n .filter((instance) => instance.isSticky && !instance.isVisible)\n .reduce<number>(\n (y: number, instance) => y - instance.$refs.inner.offsetHeight,\n this.isVisible ? 0 : this.$refs.inner.offsetHeight * -1,\n )) as number;\n }\n\n /**\n * Find the first parent which has a relative position.\n */\n closestRelativeElement(element:HTMLElement) {\n let parent = element.parentElement;\n\n while (getComputedStyle(parent).position !== 'relative' && parent.parentElement) {\n parent = parent.parentElement;\n }\n\n return parent;\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Base } from '@studiometa/js-toolkit';
|
|
2
|
+
import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';
|
|
3
|
+
import { Sentinel } from '../../primitives/index.js';
|
|
1
4
|
/**
|
|
2
5
|
* @typedef {Object} StickyRefs
|
|
3
6
|
* @property {HTMLElement} inner
|
|
@@ -9,80 +12,64 @@
|
|
|
9
12
|
* @property {{ zIndex: number, hideWhenUp: boolean, hideWhenDown: boolean }} $options
|
|
10
13
|
* @property {{ Sentinel: Sentinel[] }} $children
|
|
11
14
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
export interface StickyProps extends BaseProps {
|
|
16
|
+
$refs: {
|
|
17
|
+
inner: HTMLElement;
|
|
18
|
+
sentinelRef: HTMLElement;
|
|
19
|
+
};
|
|
20
|
+
$options: {
|
|
21
|
+
zIndex: number;
|
|
22
|
+
hideWhenUp: boolean;
|
|
23
|
+
hideWhenDown: boolean;
|
|
24
|
+
};
|
|
25
|
+
$children: {
|
|
26
|
+
Sentinel: Sentinel[];
|
|
27
|
+
};
|
|
28
|
+
}
|
|
15
29
|
/**
|
|
16
30
|
* Sticky class.
|
|
17
31
|
*/
|
|
18
|
-
export
|
|
32
|
+
export declare class Sticky<T extends BaseProps = BaseProps> extends Base<T & StickyProps> {
|
|
19
33
|
/**
|
|
20
34
|
* Config.
|
|
21
35
|
*/
|
|
22
|
-
static config:
|
|
23
|
-
name: string;
|
|
24
|
-
refs: string[];
|
|
25
|
-
components: {
|
|
26
|
-
Sentinel: typeof Sentinel;
|
|
27
|
-
};
|
|
28
|
-
options: {
|
|
29
|
-
zIndex: {
|
|
30
|
-
type: NumberConstructor;
|
|
31
|
-
default: number;
|
|
32
|
-
};
|
|
33
|
-
hideWhenUp: BooleanConstructor;
|
|
34
|
-
hideWhenDown: BooleanConstructor;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
36
|
+
static config: BaseConfig;
|
|
37
37
|
/**
|
|
38
38
|
* Holder for all instances.
|
|
39
|
-
* @type {Set<StickyInterface>}
|
|
40
39
|
*/
|
|
41
|
-
static instances: Set<
|
|
40
|
+
static instances: Set<Sticky>;
|
|
42
41
|
/**
|
|
43
42
|
* Is the component sticky?
|
|
44
|
-
* @type {boolean}
|
|
45
43
|
*/
|
|
46
44
|
isSticky: boolean;
|
|
47
45
|
/**
|
|
48
46
|
* Is the component visible?
|
|
49
|
-
* @type {Boolean}
|
|
50
47
|
*/
|
|
51
48
|
isVisible: boolean;
|
|
52
49
|
/**
|
|
53
50
|
* Set the Y value.
|
|
54
|
-
*
|
|
55
|
-
* @this {StickyInterface}
|
|
56
|
-
* @param {number} value
|
|
57
|
-
* @returns {void}
|
|
58
51
|
*/
|
|
59
|
-
set y(
|
|
52
|
+
set y(value: number);
|
|
60
53
|
/**
|
|
61
54
|
* Get instances as array.
|
|
62
|
-
* @return {Array<StickyInterface>}
|
|
63
55
|
*/
|
|
64
|
-
get instances():
|
|
56
|
+
get instances(): Sticky[];
|
|
65
57
|
/**
|
|
66
58
|
* Mounted hook.
|
|
67
|
-
* @this {StickyInterface}
|
|
68
59
|
*/
|
|
69
|
-
mounted(
|
|
60
|
+
mounted(): void;
|
|
70
61
|
/**
|
|
71
62
|
* Resized hook.
|
|
72
|
-
* @this {StickyInterface}
|
|
73
|
-
* @returns {void}
|
|
74
63
|
*/
|
|
75
|
-
resized(
|
|
64
|
+
resized(): void;
|
|
76
65
|
/**
|
|
77
66
|
* Destroyed hook.
|
|
78
|
-
* @this {StickyInterface}
|
|
79
67
|
*/
|
|
80
|
-
destroyed(
|
|
68
|
+
destroyed(): void;
|
|
81
69
|
/**
|
|
82
70
|
* Scrolled hook.
|
|
83
|
-
* @this {StickyInterface}
|
|
84
71
|
*/
|
|
85
|
-
scrolled(
|
|
72
|
+
scrolled(props: any): void;
|
|
86
73
|
/**
|
|
87
74
|
* Listen to the sentinel's `intersected` event to set the `isSticky` value.
|
|
88
75
|
*
|
|
@@ -92,50 +79,25 @@ export default class Sticky extends Base {
|
|
|
92
79
|
onSentinelIntersected([entry]: IntersectionObserverEntry[]): void;
|
|
93
80
|
/**
|
|
94
81
|
* Hide the sticky component when another one is sticky.
|
|
95
|
-
* @this {StickyInterface}
|
|
96
82
|
*/
|
|
97
|
-
hide(
|
|
83
|
+
hide(): void;
|
|
98
84
|
/**
|
|
99
85
|
* Show the sticky component when the other one is not sticky anymore.
|
|
100
|
-
* @this {StickyInterface}
|
|
101
86
|
*/
|
|
102
|
-
show(
|
|
87
|
+
show(): void;
|
|
103
88
|
/**
|
|
104
89
|
* Set the sentinel height based on the previous instances.
|
|
105
|
-
* @this {StickyInterface}
|
|
106
90
|
*/
|
|
107
|
-
setSentinelSize(
|
|
91
|
+
setSentinelSize(): void;
|
|
108
92
|
/**
|
|
109
93
|
* Set the component's position.
|
|
110
94
|
*
|
|
111
|
-
* @this {StickyInterface}
|
|
112
95
|
* @param {number} [index] The instance index in all the pages' instances.
|
|
113
96
|
* @returns {void}
|
|
114
97
|
*/
|
|
115
|
-
setPosition(
|
|
98
|
+
setPosition(index?: number): void;
|
|
116
99
|
/**
|
|
117
100
|
* Find the first parent which has a relative position.
|
|
118
|
-
*
|
|
119
|
-
* @param {HTMLElement} element
|
|
120
|
-
* @returns {HTMLElement}
|
|
121
101
|
*/
|
|
122
102
|
closestRelativeElement(element: HTMLElement): HTMLElement;
|
|
123
103
|
}
|
|
124
|
-
export type StickyRefs = {
|
|
125
|
-
inner: HTMLElement;
|
|
126
|
-
sentinelRef: HTMLElement;
|
|
127
|
-
};
|
|
128
|
-
export type StickyPrivateInterface = {
|
|
129
|
-
$refs: StickyRefs;
|
|
130
|
-
$options: {
|
|
131
|
-
zIndex: number;
|
|
132
|
-
hideWhenUp: boolean;
|
|
133
|
-
hideWhenDown: boolean;
|
|
134
|
-
};
|
|
135
|
-
$children: {
|
|
136
|
-
Sentinel: Sentinel[];
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
export type StickyInterface = Sticky & StickyPrivateInterface;
|
|
140
|
-
import { Base } from "@studiometa/js-toolkit";
|
|
141
|
-
import { Sentinel } from "../../primitives/index.js";
|
|
@@ -1 +1,101 @@
|
|
|
1
|
-
import{Base
|
|
1
|
+
import { Base } from "@studiometa/js-toolkit";
|
|
2
|
+
import { Sentinel } from "../../primitives/index.js";
|
|
3
|
+
class Sticky extends Base {
|
|
4
|
+
static config = {
|
|
5
|
+
name: "Sticky",
|
|
6
|
+
refs: ["inner", "sentinelRef"],
|
|
7
|
+
components: {
|
|
8
|
+
Sentinel
|
|
9
|
+
},
|
|
10
|
+
options: {
|
|
11
|
+
zIndex: {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: 100
|
|
14
|
+
},
|
|
15
|
+
hideWhenUp: Boolean,
|
|
16
|
+
hideWhenDown: Boolean
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
static instances = /* @__PURE__ */ new Set();
|
|
20
|
+
isSticky = false;
|
|
21
|
+
isVisible = true;
|
|
22
|
+
set y(value) {
|
|
23
|
+
this.$refs.inner.style.transform = `translateY(${value}px) translateZ(0px)`;
|
|
24
|
+
}
|
|
25
|
+
get instances() {
|
|
26
|
+
return Array.from(Sticky.instances);
|
|
27
|
+
}
|
|
28
|
+
mounted() {
|
|
29
|
+
Sticky.instances.add(this);
|
|
30
|
+
this.setSentinelSize();
|
|
31
|
+
}
|
|
32
|
+
resized() {
|
|
33
|
+
this.setSentinelSize();
|
|
34
|
+
}
|
|
35
|
+
destroyed() {
|
|
36
|
+
Sticky.instances.delete(this);
|
|
37
|
+
}
|
|
38
|
+
scrolled(props) {
|
|
39
|
+
if (!this.isSticky || props.y === props.last.y) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (props.direction.y === "DOWN" && this.$options.hideWhenDown || props.direction.y === "UP" && this.$options.hideWhenUp) {
|
|
43
|
+
this.hide();
|
|
44
|
+
} else {
|
|
45
|
+
this.show();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
onSentinelIntersected([entry]) {
|
|
49
|
+
this.isSticky = entry.isIntersecting && entry.boundingClientRect.y < 0;
|
|
50
|
+
this.setPosition();
|
|
51
|
+
}
|
|
52
|
+
hide() {
|
|
53
|
+
if (!this.isVisible) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this.isVisible = false;
|
|
57
|
+
this.$el.classList.add("pointer-events-none");
|
|
58
|
+
this.instances.forEach((instance, index) => instance.setPosition(index));
|
|
59
|
+
}
|
|
60
|
+
show() {
|
|
61
|
+
if (this.isVisible) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.isVisible = true;
|
|
65
|
+
this.$el.classList.remove("pointer-events-none");
|
|
66
|
+
this.instances.forEach((instance, index) => instance.setPosition(index));
|
|
67
|
+
}
|
|
68
|
+
setSentinelSize() {
|
|
69
|
+
const { instances } = this;
|
|
70
|
+
const index = instances.indexOf(this);
|
|
71
|
+
const height = instances.slice(0, index).filter(
|
|
72
|
+
(instance) => this.closestRelativeElement(instance.$el).contains(this.$el)
|
|
73
|
+
).reduce((acc, instance) => acc + instance.$el.offsetHeight, 0);
|
|
74
|
+
this.$refs.sentinelRef.style.height = `${height + 1}px`;
|
|
75
|
+
this.$el.style.top = `${height}px`;
|
|
76
|
+
this.$el.style.zIndex = String(this.$options.zIndex - index);
|
|
77
|
+
}
|
|
78
|
+
setPosition(index) {
|
|
79
|
+
if (!this.isSticky) {
|
|
80
|
+
this.y = 0;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const { instances } = this;
|
|
84
|
+
index = index ?? instances.indexOf(this);
|
|
85
|
+
this.y = instances.slice(0, index).filter((instance) => instance.isSticky && !instance.isVisible).reduce(
|
|
86
|
+
(y, instance) => y - instance.$refs.inner.offsetHeight,
|
|
87
|
+
this.isVisible ? 0 : this.$refs.inner.offsetHeight * -1
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
closestRelativeElement(element) {
|
|
91
|
+
let parent = element.parentElement;
|
|
92
|
+
while (getComputedStyle(parent).position !== "relative" && parent.parentElement) {
|
|
93
|
+
parent = parent.parentElement;
|
|
94
|
+
}
|
|
95
|
+
return parent;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
Sticky
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=Sticky.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/ui/molecules/Sticky/Sticky.ts"],
|
|
4
|
+
"sourcesContent": ["import { Base } from '@studiometa/js-toolkit';\nimport type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { Sentinel } from '../../primitives/index.js';\n\n/**\n * @typedef {Object} StickyRefs\n * @property {HTMLElement} inner\n * @property {HTMLElement} sentinelRef\n */\n\n/**\n * @typedef {Object} StickyPrivateInterface\n * @property {StickyRefs} $refs\n * @property {{ zIndex: number, hideWhenUp: boolean, hideWhenDown: boolean }} $options\n * @property {{ Sentinel: Sentinel[] }} $children\n */\n\nexport interface StickyProps extends BaseProps {\n $refs: {\n inner: HTMLElement;\n sentinelRef: HTMLElement;\n };\n $options: {\n zIndex: number;\n hideWhenUp: boolean;\n hideWhenDown: boolean;\n };\n $children: {\n Sentinel: Sentinel[];\n };\n}\n\n/**\n * Sticky class.\n */\nexport class Sticky<T extends BaseProps = BaseProps> extends Base<T & StickyProps> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'Sticky',\n refs: ['inner', 'sentinelRef'],\n components: {\n Sentinel,\n },\n options: {\n zIndex: {\n type: Number,\n default: 100,\n },\n hideWhenUp: Boolean,\n hideWhenDown: Boolean,\n },\n };\n\n /**\n * Holder for all instances.\n */\n // eslint-disable-next-line no-use-before-define\n static instances: Set<Sticky> = new Set();\n\n /**\n * Is the component sticky?\n */\n isSticky = false;\n\n /**\n * Is the component visible?\n */\n isVisible = true;\n\n /**\n * Set the Y value.\n */\n set y(value: number) {\n this.$refs.inner.style.transform = `translateY(${value}px) translateZ(0px)`;\n }\n\n /**\n * Get instances as array.\n */\n get instances(): Sticky[] {\n return Array.from(Sticky.instances);\n }\n\n /**\n * Mounted hook.\n */\n mounted() {\n Sticky.instances.add(this);\n this.setSentinelSize();\n }\n\n /**\n * Resized hook.\n */\n resized() {\n this.setSentinelSize();\n }\n\n /**\n * Destroyed hook.\n */\n destroyed() {\n Sticky.instances.delete(this);\n }\n\n /**\n * Scrolled hook.\n */\n scrolled(props) {\n if (!this.isSticky || props.y === props.last.y) {\n return;\n }\n\n if (\n (props.direction.y === 'DOWN' && this.$options.hideWhenDown) ||\n (props.direction.y === 'UP' && this.$options.hideWhenUp)\n ) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Listen to the sentinel's `intersected` event to set the `isSticky` value.\n *\n * @param {IntersectionObserverEntry[]} entries\n * @returns {void}\n */\n onSentinelIntersected([entry]: IntersectionObserverEntry[]) {\n this.isSticky = entry.isIntersecting && entry.boundingClientRect.y < 0;\n this.setPosition();\n }\n\n /**\n * Hide the sticky component when another one is sticky.\n */\n hide() {\n if (!this.isVisible) {\n return;\n }\n\n this.isVisible = false;\n this.$el.classList.add('pointer-events-none');\n\n this.instances.forEach((instance, index) => instance.setPosition(index));\n }\n\n /**\n * Show the sticky component when the other one is not sticky anymore.\n */\n show() {\n if (this.isVisible) {\n return;\n }\n\n this.isVisible = true;\n this.$el.classList.remove('pointer-events-none');\n this.instances.forEach((instance, index) => instance.setPosition(index));\n }\n\n /**\n * Set the sentinel height based on the previous instances.\n */\n setSentinelSize() {\n const { instances } = this;\n const index = instances.indexOf(this);\n const height = instances\n .slice(0, index)\n .filter(\n // Test each instance sticky context against the current element\n (instance) => this.closestRelativeElement(instance.$el).contains(this.$el),\n )\n .reduce((acc, instance) => acc + instance.$el.offsetHeight, 0);\n\n this.$refs.sentinelRef.style.height = `${height + 1}px`;\n this.$el.style.top = `${height}px`;\n this.$el.style.zIndex = String(this.$options.zIndex - index);\n }\n\n /**\n * Set the component's position.\n *\n * @param {number} [index] The instance index in all the pages' instances.\n * @returns {void}\n */\n setPosition(index?: number) {\n if (!this.isSticky) {\n this.y = 0;\n return;\n }\n\n const { instances } = this;\n\n // eslint-disable-next-line no-param-reassign\n index = index ?? instances.indexOf(this);\n\n this.y = (instances\n .slice(0, index)\n .filter((instance) => instance.isSticky && !instance.isVisible)\n .reduce<number>(\n (y: number, instance) => y - instance.$refs.inner.offsetHeight,\n this.isVisible ? 0 : this.$refs.inner.offsetHeight * -1,\n )) as number;\n }\n\n /**\n * Find the first parent which has a relative position.\n */\n closestRelativeElement(element:HTMLElement) {\n let parent = element.parentElement;\n\n while (getComputedStyle(parent).position !== 'relative' && parent.parentElement) {\n parent = parent.parentElement;\n }\n\n return parent;\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// packages/ui/molecules/Sticky/index.ts
|
|
17
|
+
var Sticky_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(Sticky_exports);
|
|
19
|
+
__reExport(Sticky_exports, require("./Sticky.cjs"), module.exports);
|
|
20
|
+
if (module.exports.default) module.exports = module.exports.default;
|
|
21
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Sticky.js';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
6
|
var __export = (target, all) => {
|
|
@@ -17,21 +15,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
19
|
var __publicField = (obj, key, value) => {
|
|
23
20
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
21
|
return value;
|
|
25
22
|
};
|
|
26
23
|
|
|
27
|
-
// packages/ui/molecules/TableOfContent/TableOfContent.
|
|
24
|
+
// packages/ui/molecules/TableOfContent/TableOfContent.ts
|
|
28
25
|
var TableOfContent_exports = {};
|
|
29
26
|
__export(TableOfContent_exports, {
|
|
30
|
-
|
|
27
|
+
TableOfContent: () => TableOfContent
|
|
31
28
|
});
|
|
32
29
|
module.exports = __toCommonJS(TableOfContent_exports);
|
|
33
30
|
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
34
|
-
var import_TableOfContentAnchor =
|
|
31
|
+
var import_TableOfContentAnchor = require("./TableOfContentAnchor.cjs");
|
|
35
32
|
var TableOfContent = class extends import_js_toolkit.Base {
|
|
36
33
|
mounted() {
|
|
37
34
|
if (this.$options.withTemplate) {
|
|
@@ -48,7 +45,7 @@ var TableOfContent = class extends import_js_toolkit.Base {
|
|
|
48
45
|
anchor.href = `#${section.id}`;
|
|
49
46
|
anchor.innerHTML = section.textContent;
|
|
50
47
|
anchor.dataset.component = "TableOfContentAnchor";
|
|
51
|
-
this.$refs.list.
|
|
48
|
+
this.$refs.list.append(li);
|
|
52
49
|
});
|
|
53
50
|
}
|
|
54
51
|
};
|
|
@@ -56,7 +53,7 @@ __publicField(TableOfContent, "config", {
|
|
|
56
53
|
name: "TableOfContent",
|
|
57
54
|
refs: ["itemTemplate", "list"],
|
|
58
55
|
components: {
|
|
59
|
-
TableOfContentAnchor: import_TableOfContentAnchor.
|
|
56
|
+
TableOfContentAnchor: import_TableOfContentAnchor.TableOfContentAnchor
|
|
60
57
|
},
|
|
61
58
|
options: {
|
|
62
59
|
contentSelector: String,
|
|
@@ -64,3 +61,4 @@ __publicField(TableOfContent, "config", {
|
|
|
64
61
|
}
|
|
65
62
|
});
|
|
66
63
|
if (module.exports.default) module.exports = module.exports.default;
|
|
64
|
+
//# sourceMappingURL=TableOfContent.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/ui/molecules/TableOfContent/TableOfContent.ts"],
|
|
4
|
+
"sourcesContent": ["import { Base } from '@studiometa/js-toolkit';\nimport type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { TableOfContentAnchor } from './TableOfContentAnchor.js';\n\nexport interface TableOfContentProps extends BaseProps {\n $refs: {\n itemTemplate: HTMLTemplateElement;\n list: HTMLUListElement;\n };\n $options: {\n contentSelector: string;\n withTemplate: boolean;\n };\n $children: {\n TableOfContentAnchor: TableOfContentAnchor[];\n };\n}\n\n/**\n * TableOfContent class.\n */\nexport class TableOfContent<T extends BaseProps = BaseProps> extends Base<T & TableOfContentProps> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'TableOfContent',\n refs: ['itemTemplate', 'list'],\n components: {\n TableOfContentAnchor,\n },\n options: {\n contentSelector: String,\n withTemplate: Boolean,\n },\n };\n\n /**\n * Generate anchors on mount and update the component to instantiate the\n * `TableOfContentAnchor` components.\n */\n mounted() {\n if (this.$options.withTemplate) {\n this.generateAnchors();\n this.$update();\n }\n }\n\n /**\n * Generate all anchors.\n *\n * @todo Read anchor template from a ref?\n * @todo Better API to easily override the template function, maybe a `render` function?\n */\n generateAnchors() {\n document.querySelectorAll(this.$options.contentSelector).forEach((section) => {\n const tpl = document.createElement('div');\n tpl.innerHTML = this.$refs.itemTemplate.innerHTML;\n const li = tpl.querySelector('li');\n const anchor = li.querySelector('a');\n anchor.href = `#${section.id}`;\n anchor.innerHTML = section.textContent;\n anchor.dataset.component = 'TableOfContentAnchor';\n this.$refs.list.append(li);\n });\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAqB;AAErB,kCAAqC;AAmB9B,IAAM,iBAAN,cAA8D,uBAA8B;AAAA,EAoBjG,UAAU;AACR,QAAI,KAAK,SAAS,cAAc;AAC9B,WAAK,gBAAgB;AACrB,WAAK,QAAQ;AAAA,IACf;AAAA,EACF;AAAA,EAQA,kBAAkB;AAChB,aAAS,iBAAiB,KAAK,SAAS,eAAe,EAAE,QAAQ,CAAC,YAAY;AAC5E,YAAM,MAAM,SAAS,cAAc,KAAK;AACxC,UAAI,YAAY,KAAK,MAAM,aAAa;AACxC,YAAM,KAAK,IAAI,cAAc,IAAI;AACjC,YAAM,SAAS,GAAG,cAAc,GAAG;AACnC,aAAO,OAAO,IAAI,QAAQ;AAC1B,aAAO,YAAY,QAAQ;AAC3B,aAAO,QAAQ,YAAY;AAC3B,WAAK,MAAM,KAAK,OAAO,EAAE;AAAA,IAC3B,CAAC;AAAA,EACH;AACF;AAzCE,cAJW,gBAIJ,UAAqB;AAAA,EAC1B,MAAM;AAAA,EACN,MAAM,CAAC,gBAAgB,MAAM;AAAA,EAC7B,YAAY;AAAA,IACV;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,iBAAiB;AAAA,IACjB,cAAc;AAAA,EAChB;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|