@studiometa/ui 0.2.23 → 0.2.24
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 +2 -12
- package/atoms/AnchorScrollTo/AnchorScrollTo.cjs +11 -0
- package/atoms/AnchorScrollTo/AnchorScrollTo.cjs.map +2 -2
- package/atoms/AnchorScrollTo/AnchorScrollTo.js +11 -0
- package/atoms/AnchorScrollTo/AnchorScrollTo.js.map +2 -2
- package/atoms/Button/StyledButton.twig +6 -4
- package/atoms/Button/StyledButtonRounded.twig +65 -0
- package/atoms/Cursor/Cursor.cjs +12 -0
- package/atoms/Cursor/Cursor.cjs.map +2 -2
- package/atoms/Cursor/Cursor.js +12 -0
- package/atoms/Cursor/Cursor.js.map +2 -2
- package/atoms/Figure/Figure.cjs +27 -3
- package/atoms/Figure/Figure.cjs.map +2 -2
- package/atoms/Figure/Figure.js +27 -3
- package/atoms/Figure/Figure.js.map +2 -2
- package/atoms/Figure/Figure.twig +6 -1
- package/atoms/Figure/FigureTwicpics.cjs +21 -0
- package/atoms/Figure/FigureTwicpics.cjs.map +1 -1
- package/atoms/Figure/FigureTwicpics.js +21 -0
- package/atoms/Figure/FigureTwicpics.js.map +1 -1
- package/atoms/LargeText/LargeText.cjs +27 -0
- package/atoms/LargeText/LargeText.cjs.map +2 -2
- package/atoms/LargeText/LargeText.js +27 -0
- package/atoms/LargeText/LargeText.js.map +2 -2
- package/atoms/LazyInclude/LazyInclude.cjs +15 -0
- package/atoms/LazyInclude/LazyInclude.cjs.map +2 -2
- package/atoms/LazyInclude/LazyInclude.js +15 -0
- package/atoms/LazyInclude/LazyInclude.js.map +2 -2
- package/atoms/Prefetch/AbstractPrefetch.cjs +12 -0
- package/atoms/Prefetch/AbstractPrefetch.cjs.map +2 -2
- package/atoms/Prefetch/AbstractPrefetch.js +12 -0
- package/atoms/Prefetch/AbstractPrefetch.js.map +2 -2
- package/atoms/Prefetch/PrefetchWhenOver.cjs +6 -0
- package/atoms/Prefetch/PrefetchWhenOver.cjs.map +2 -2
- package/atoms/Prefetch/PrefetchWhenOver.js +6 -0
- package/atoms/Prefetch/PrefetchWhenOver.js.map +2 -2
- package/atoms/Prefetch/PrefetchWhenVisible.cjs +6 -0
- package/atoms/Prefetch/PrefetchWhenVisible.cjs.map +2 -2
- package/atoms/Prefetch/PrefetchWhenVisible.js +6 -0
- package/atoms/Prefetch/PrefetchWhenVisible.js.map +2 -2
- package/atoms/ScrollAnimation/AbstractScrollAnimation.cjs +12 -0
- package/atoms/ScrollAnimation/AbstractScrollAnimation.cjs.map +2 -2
- package/atoms/ScrollAnimation/AbstractScrollAnimation.js +12 -0
- package/atoms/ScrollAnimation/AbstractScrollAnimation.js.map +2 -2
- package/atoms/ScrollAnimation/ScrollAnimation.cjs +6 -0
- package/atoms/ScrollAnimation/ScrollAnimation.cjs.map +1 -1
- package/atoms/ScrollAnimation/ScrollAnimation.js +6 -0
- package/atoms/ScrollAnimation/ScrollAnimation.js.map +1 -1
- package/atoms/ScrollAnimation/ScrollAnimationChild.cjs +18 -1
- package/atoms/ScrollAnimation/ScrollAnimationChild.cjs.map +2 -2
- package/atoms/ScrollAnimation/ScrollAnimationChild.js +18 -1
- package/atoms/ScrollAnimation/ScrollAnimationChild.js.map +2 -2
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.cjs +3 -0
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.cjs.map +1 -1
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js +3 -0
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js.map +1 -1
- package/atoms/ScrollAnimation/ScrollAnimationParent.cjs +6 -0
- package/atoms/ScrollAnimation/ScrollAnimationParent.cjs.map +1 -1
- package/atoms/ScrollAnimation/ScrollAnimationParent.js +6 -0
- package/atoms/ScrollAnimation/ScrollAnimationParent.js.map +1 -1
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.cjs +3 -0
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.cjs.map +1 -1
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.js +3 -0
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.js.map +1 -1
- package/atoms/ScrollAnimation/animationScrollWithEase.cjs +6 -0
- package/atoms/ScrollAnimation/animationScrollWithEase.cjs.map +2 -2
- package/atoms/ScrollAnimation/animationScrollWithEase.js +6 -0
- package/atoms/ScrollAnimation/animationScrollWithEase.js.map +2 -2
- package/atoms/ScrollReveal/ScrollReveal.cjs +12 -0
- package/atoms/ScrollReveal/ScrollReveal.cjs.map +1 -1
- package/atoms/ScrollReveal/ScrollReveal.js +12 -0
- package/atoms/ScrollReveal/ScrollReveal.js.map +1 -1
- package/decorators/withTransition.cjs +16 -2
- package/decorators/withTransition.cjs.map +2 -2
- package/decorators/withTransition.js +16 -2
- package/decorators/withTransition.js.map +2 -2
- package/molecules/Accordion/AccordionCore.cjs +9 -0
- package/molecules/Accordion/AccordionCore.cjs.map +2 -2
- package/molecules/Accordion/AccordionCore.js +9 -0
- package/molecules/Accordion/AccordionCore.js.map +2 -2
- package/molecules/Accordion/AccordionItem.cjs +33 -1
- package/molecules/Accordion/AccordionItem.cjs.map +2 -2
- package/molecules/Accordion/AccordionItem.d.ts +1 -1
- package/molecules/Accordion/AccordionItem.js +29 -1
- package/molecules/Accordion/AccordionItem.js.map +2 -2
- package/molecules/Menu/Menu.cjs +47 -0
- package/molecules/Menu/Menu.cjs.map +1 -1
- package/molecules/Menu/Menu.js +47 -0
- package/molecules/Menu/Menu.js.map +1 -1
- package/molecules/Menu/MenuBtn.cjs +24 -0
- package/molecules/Menu/MenuBtn.cjs.map +1 -1
- package/molecules/Menu/MenuBtn.js +24 -0
- package/molecules/Menu/MenuBtn.js.map +1 -1
- package/molecules/Menu/MenuList.cjs +39 -0
- package/molecules/Menu/MenuList.cjs.map +2 -2
- package/molecules/Menu/MenuList.js +39 -0
- package/molecules/Menu/MenuList.js.map +2 -2
- package/molecules/Modal/Modal.cjs +50 -1
- package/molecules/Modal/Modal.cjs.map +2 -2
- package/molecules/Modal/Modal.d.ts +3 -3
- package/molecules/Modal/Modal.js +50 -1
- package/molecules/Modal/Modal.js.map +2 -2
- package/molecules/Modal/ModalWithTransition.cjs +6 -0
- package/molecules/Modal/ModalWithTransition.cjs.map +2 -2
- package/molecules/Modal/ModalWithTransition.js +6 -0
- package/molecules/Modal/ModalWithTransition.js.map +2 -2
- package/molecules/Panel/Panel.cjs +19 -0
- package/molecules/Panel/Panel.cjs.map +2 -2
- package/molecules/Panel/Panel.js +19 -0
- package/molecules/Panel/Panel.js.map +2 -2
- package/molecules/Slider/AbstractSliderChild.cjs +24 -0
- package/molecules/Slider/AbstractSliderChild.cjs.map +2 -2
- package/molecules/Slider/AbstractSliderChild.js +24 -0
- package/molecules/Slider/AbstractSliderChild.js.map +2 -2
- package/molecules/Slider/Slider.cjs +97 -0
- package/molecules/Slider/Slider.cjs.map +2 -2
- package/molecules/Slider/Slider.d.ts +3 -2
- package/molecules/Slider/Slider.js +97 -0
- package/molecules/Slider/Slider.js.map +2 -2
- package/molecules/Slider/SliderBtn.cjs +22 -2
- package/molecules/Slider/SliderBtn.cjs.map +2 -2
- package/molecules/Slider/SliderBtn.d.ts +1 -0
- package/molecules/Slider/SliderBtn.js +22 -2
- package/molecules/Slider/SliderBtn.js.map +2 -2
- package/molecules/Slider/SliderCount.cjs +9 -0
- package/molecules/Slider/SliderCount.cjs.map +2 -2
- package/molecules/Slider/SliderCount.js +9 -0
- package/molecules/Slider/SliderCount.js.map +2 -2
- package/molecules/Slider/SliderDots.cjs +19 -0
- package/molecules/Slider/SliderDots.cjs.map +2 -2
- package/molecules/Slider/SliderDots.js +19 -0
- package/molecules/Slider/SliderDots.js.map +2 -2
- package/molecules/Slider/SliderDrag.cjs +15 -0
- package/molecules/Slider/SliderDrag.cjs.map +2 -2
- package/molecules/Slider/SliderDrag.js +15 -0
- package/molecules/Slider/SliderDrag.js.map +2 -2
- package/molecules/Slider/SliderItem.cjs +75 -14
- package/molecules/Slider/SliderItem.cjs.map +2 -2
- package/molecules/Slider/SliderItem.d.ts +12 -11
- package/molecules/Slider/SliderItem.js +75 -14
- package/molecules/Slider/SliderItem.js.map +2 -2
- package/molecules/Slider/SliderProgress.cjs +6 -0
- package/molecules/Slider/SliderProgress.cjs.map +2 -2
- package/molecules/Slider/SliderProgress.js +6 -0
- package/molecules/Slider/SliderProgress.js.map +2 -2
- package/molecules/Sticky/Sticky.cjs +56 -0
- package/molecules/Sticky/Sticky.cjs.map +2 -2
- package/molecules/Sticky/Sticky.js +56 -0
- package/molecules/Sticky/Sticky.js.map +2 -2
- package/molecules/TableOfContent/TableOfContent.cjs +13 -0
- package/molecules/TableOfContent/TableOfContent.cjs.map +1 -1
- package/molecules/TableOfContent/TableOfContent.js +13 -0
- package/molecules/TableOfContent/TableOfContent.js.map +1 -1
- package/molecules/TableOfContent/TableOfContentAnchor.cjs +16 -0
- package/molecules/TableOfContent/TableOfContentAnchor.cjs.map +2 -2
- package/molecules/TableOfContent/TableOfContentAnchor.js +16 -0
- package/molecules/TableOfContent/TableOfContentAnchor.js.map +2 -2
- package/molecules/Tabs/Tabs.cjs +16 -0
- package/molecules/Tabs/Tabs.cjs.map +2 -2
- package/molecules/Tabs/Tabs.d.ts +3 -3
- package/molecules/Tabs/Tabs.js +16 -0
- package/molecules/Tabs/Tabs.js.map +2 -2
- package/organisms/Frame/Frame.cjs +30 -0
- package/organisms/Frame/Frame.cjs.map +2 -2
- package/organisms/Frame/Frame.js +30 -0
- package/organisms/Frame/Frame.js.map +2 -2
- package/organisms/Frame/FrameAnchor.cjs +6 -0
- package/organisms/Frame/FrameAnchor.cjs.map +1 -1
- package/organisms/Frame/FrameAnchor.js +6 -0
- package/organisms/Frame/FrameAnchor.js.map +1 -1
- package/organisms/Frame/FrameForm.cjs +6 -0
- package/organisms/Frame/FrameForm.cjs.map +1 -1
- package/organisms/Frame/FrameForm.js +6 -0
- package/organisms/Frame/FrameForm.js.map +1 -1
- package/organisms/Frame/FrameTarget.cjs +25 -2
- package/organisms/Frame/FrameTarget.cjs.map +2 -2
- package/organisms/Frame/FrameTarget.js +25 -2
- package/organisms/Frame/FrameTarget.js.map +2 -2
- package/organisms/Hero/Hero.twig +151 -0
- package/package.json +2 -2
- package/primitives/Draggable/Draggable.cjs +18 -0
- package/primitives/Draggable/Draggable.cjs.map +2 -2
- package/primitives/Draggable/Draggable.js +18 -0
- package/primitives/Draggable/Draggable.js.map +2 -2
- package/primitives/Sentinel/Sentinel.cjs +3 -0
- package/primitives/Sentinel/Sentinel.cjs.map +2 -2
- package/primitives/Sentinel/Sentinel.js +3 -0
- package/primitives/Sentinel/Sentinel.js.map +2 -2
- package/primitives/Transition/Transition.cjs +3 -0
- package/primitives/Transition/Transition.cjs.map +1 -1
- package/primitives/Transition/Transition.js +3 -0
- package/primitives/Transition/Transition.js.map +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/ui/molecules/Slider/SliderDots.ts"],
|
|
4
|
-
"sourcesContent": ["import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { withTransition } from '../../decorators/index.js';\nimport { AbstractSliderChild } from './AbstractSliderChild.js';\n\nexport interface SliderDotsProps extends BaseProps {\n $refs: {\n dots: HTMLButtonElement[];\n };\n}\n\n/**\n * SliderDots class.\n */\nexport class SliderDots<\n T extends BaseProps = BaseProps,\n> extends withTransition<AbstractSliderChild>(AbstractSliderChild)<T & SliderDotsProps> {\n /**\n * Config.\n */\n static config:BaseConfig = {\n name: 'SliderDots',\n refs: ['dots[]'],\n };\n\n /**\n * Get target.\n * @returns {HTMLButtonElement[]}\n */\n get target() {\n return this.$refs.dots;\n }\n\n /**\n * The current active index.\n */\n currentIndex = 0;\n\n /**\n * Update dots classes according to the new index.\n *\n * @param {number} index\n * @returns {void}\n */\n update(index:number) {\n this.leave(this.$refs.dots[this.currentIndex]);\n this.enter(this.$refs.dots[index]);\n this.currentIndex = index;\n }\n\n /**\n * Go to the given index on dot click.\n */\n onDotsClick(event:MouseEvent, index:number) {\n this.$parent.goTo(index);\n }\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AAW7B,MAAM,mBAEH,eAAoC,mBAAmB,EAAuB;AAAA,EAItF,OAAO,
|
|
4
|
+
"sourcesContent": ["import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { withTransition } from '../../decorators/index.js';\nimport { AbstractSliderChild } from './AbstractSliderChild.js';\n\nexport interface SliderDotsProps extends BaseProps {\n $refs: {\n dots: HTMLButtonElement[];\n };\n}\n\n/**\n * SliderDots class.\n */\nexport class SliderDots<\n T extends BaseProps = BaseProps,\n> extends withTransition<AbstractSliderChild>(AbstractSliderChild)<T & SliderDotsProps> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'SliderDots',\n refs: ['dots[]'],\n };\n\n /**\n * Get target.\n * @returns {HTMLButtonElement[]}\n */\n get target() {\n return this.$refs.dots;\n }\n\n /**\n * The current active index.\n */\n currentIndex = 0;\n\n /**\n * Update dots classes according to the new index.\n *\n * @param {number} index\n * @returns {void}\n */\n update(index: number) {\n this.leave(this.$refs.dots[this.currentIndex]);\n this.enter(this.$refs.dots[index]);\n this.currentIndex = index;\n }\n\n /**\n * Go to the given index on dot click.\n */\n onDotsClick(event: MouseEvent, index: number) {\n this.$parent.goTo(index);\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AAW7B,MAAM,mBAEH,eAAoC,mBAAmB,EAAuB;AAAA;AAAA;AAAA;AAAA,EAItF,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,IACN,MAAM,CAAC,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,SAAS;AACX,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA,EAKA,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQf,OAAO,OAAe;AACpB,SAAK,MAAM,KAAK,MAAM,KAAK,KAAK,YAAY,CAAC;AAC7C,SAAK,MAAM,KAAK,MAAM,KAAK,KAAK,CAAC;AACjC,SAAK,eAAe;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY,OAAmB,OAAe;AAC5C,SAAK,QAAQ,KAAK,KAAK;AAAA,EACzB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -29,19 +29,34 @@ __export(SliderDrag_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(SliderDrag_exports);
|
|
30
30
|
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
31
31
|
var SliderDrag = class extends (0, import_js_toolkit.withDrag)(import_js_toolkit.Base) {
|
|
32
|
+
/**
|
|
33
|
+
* Test if the scroll should be blocked. Used with the touchmove event to prevent
|
|
34
|
+
* scrolling vertically when trying to drag the slider.
|
|
35
|
+
*/
|
|
32
36
|
get shouldPreventScroll() {
|
|
33
37
|
const { distance } = this.$services.get("dragged");
|
|
34
38
|
return Math.abs(distance.x) > this.$options.scrollLockThreshold && Math.abs(distance.x) > Math.abs(distance.y);
|
|
35
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Touchmove handler.
|
|
42
|
+
* @param {TouchEvent} event
|
|
43
|
+
* @returns {void}
|
|
44
|
+
*/
|
|
36
45
|
onTouchmove(event) {
|
|
37
46
|
if (this.shouldPreventScroll) {
|
|
38
47
|
event.preventDefault();
|
|
39
48
|
}
|
|
40
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Emit drag events.
|
|
52
|
+
*/
|
|
41
53
|
dragged(props) {
|
|
42
54
|
this.$emit(props.mode, props);
|
|
43
55
|
}
|
|
44
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Config.
|
|
59
|
+
*/
|
|
45
60
|
__publicField(SliderDrag, "config", {
|
|
46
61
|
name: "SliderDrag",
|
|
47
62
|
emits: ["start", "drag", "drop", "inertia", "stop"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/ui/molecules/Slider/SliderDrag.ts"],
|
|
4
|
-
"sourcesContent": ["import type { BaseProps, BaseConfig, DragServiceProps } from '@studiometa/js-toolkit';\nimport { Base, withDrag } from '@studiometa/js-toolkit';\n\nexport interface SliderDragProps extends BaseProps {\n $options: {\n scrollLockThreshold: number;\n };\n}\n\n/**\n * SliderDrag class.\n */\nexport class SliderDrag<T extends BaseProps = BaseProps> extends withDrag(Base)<\n T & SliderDragProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'SliderDrag',\n emits: ['start', 'drag', 'drop', 'inertia', 'stop'],\n options: {\n scrollLockThreshold: {\n type: Number,\n default: 10,\n },\n },\n };\n\n /**\n * Test if the scroll should be blocked. Used with the touchmove event to prevent\n * scrolling vertically when trying to drag the slider.\n */\n get shouldPreventScroll() {\n const { distance } = this.$services.get('dragged') as DragServiceProps;\n return (\n Math.abs(distance.x) > this.$options.scrollLockThreshold &&\n Math.abs(distance.x) > Math.abs(distance.y)\n );\n }\n\n /**\n * Touchmove handler.\n * @param {TouchEvent} event\n * @returns {void}\n */\n onTouchmove(event:TouchEvent) {\n if (this.shouldPreventScroll) {\n event.preventDefault();\n }\n }\n\n /**\n * Emit drag events.\n */\n dragged(props:DragServiceProps) {\n this.$emit(props.mode, props);\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA+B;AAWxB,IAAM,aAAN,kBAA0D,4BAAS,sBAAI,EAE5E;AAAA,EAmBA,IAAI,sBAAsB;AACxB,UAAM,EAAE,SAAS,IAAI,KAAK,UAAU,IAAI,SAAS;AACjD,WACE,KAAK,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,uBACrC,KAAK,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,SAAS,CAAC;AAAA,EAE9C;AAAA,EAOA,YAAY,
|
|
4
|
+
"sourcesContent": ["import type { BaseProps, BaseConfig, DragServiceProps } from '@studiometa/js-toolkit';\nimport { Base, withDrag } from '@studiometa/js-toolkit';\n\nexport interface SliderDragProps extends BaseProps {\n $options: {\n scrollLockThreshold: number;\n };\n}\n\n/**\n * SliderDrag class.\n */\nexport class SliderDrag<T extends BaseProps = BaseProps> extends withDrag(Base)<\n T & SliderDragProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'SliderDrag',\n emits: ['start', 'drag', 'drop', 'inertia', 'stop'],\n options: {\n scrollLockThreshold: {\n type: Number,\n default: 10,\n },\n },\n };\n\n /**\n * Test if the scroll should be blocked. Used with the touchmove event to prevent\n * scrolling vertically when trying to drag the slider.\n */\n get shouldPreventScroll() {\n const { distance } = this.$services.get('dragged') as DragServiceProps;\n return (\n Math.abs(distance.x) > this.$options.scrollLockThreshold &&\n Math.abs(distance.x) > Math.abs(distance.y)\n );\n }\n\n /**\n * Touchmove handler.\n * @param {TouchEvent} event\n * @returns {void}\n */\n onTouchmove(event: TouchEvent) {\n if (this.shouldPreventScroll) {\n event.preventDefault();\n }\n }\n\n /**\n * Emit drag events.\n */\n dragged(props: DragServiceProps) {\n this.$emit(props.mode, props);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA+B;AAWxB,IAAM,aAAN,kBAA0D,4BAAS,sBAAI,EAE5E;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBA,IAAI,sBAAsB;AACxB,UAAM,EAAE,SAAS,IAAI,KAAK,UAAU,IAAI,SAAS;AACjD,WACE,KAAK,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,uBACrC,KAAK,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,SAAS,CAAC;AAAA,EAE9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,YAAY,OAAmB;AAC7B,QAAI,KAAK,qBAAqB;AAC5B,YAAM,eAAe;AAAA,IACvB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQ,OAAyB;AAC/B,SAAK,MAAM,MAAM,MAAM,KAAK;AAAA,EAC9B;AACF;AAAA;AAAA;AAAA;AAxCE,cANW,YAMJ,UAAqB;AAAA,EAC1B,MAAM;AAAA,EACN,OAAO,CAAC,SAAS,QAAQ,QAAQ,WAAW,MAAM;AAAA,EAClD,SAAS;AAAA,IACP,qBAAqB;AAAA,MACnB,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Base, withDrag } from "@studiometa/js-toolkit";
|
|
2
2
|
class SliderDrag extends withDrag(Base) {
|
|
3
|
+
/**
|
|
4
|
+
* Config.
|
|
5
|
+
*/
|
|
3
6
|
static config = {
|
|
4
7
|
name: "SliderDrag",
|
|
5
8
|
emits: ["start", "drag", "drop", "inertia", "stop"],
|
|
@@ -10,15 +13,27 @@ class SliderDrag extends withDrag(Base) {
|
|
|
10
13
|
}
|
|
11
14
|
}
|
|
12
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Test if the scroll should be blocked. Used with the touchmove event to prevent
|
|
18
|
+
* scrolling vertically when trying to drag the slider.
|
|
19
|
+
*/
|
|
13
20
|
get shouldPreventScroll() {
|
|
14
21
|
const { distance } = this.$services.get("dragged");
|
|
15
22
|
return Math.abs(distance.x) > this.$options.scrollLockThreshold && Math.abs(distance.x) > Math.abs(distance.y);
|
|
16
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Touchmove handler.
|
|
26
|
+
* @param {TouchEvent} event
|
|
27
|
+
* @returns {void}
|
|
28
|
+
*/
|
|
17
29
|
onTouchmove(event) {
|
|
18
30
|
if (this.shouldPreventScroll) {
|
|
19
31
|
event.preventDefault();
|
|
20
32
|
}
|
|
21
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Emit drag events.
|
|
36
|
+
*/
|
|
22
37
|
dragged(props) {
|
|
23
38
|
this.$emit(props.mode, props);
|
|
24
39
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/ui/molecules/Slider/SliderDrag.ts"],
|
|
4
|
-
"sourcesContent": ["import type { BaseProps, BaseConfig, DragServiceProps } from '@studiometa/js-toolkit';\nimport { Base, withDrag } from '@studiometa/js-toolkit';\n\nexport interface SliderDragProps extends BaseProps {\n $options: {\n scrollLockThreshold: number;\n };\n}\n\n/**\n * SliderDrag class.\n */\nexport class SliderDrag<T extends BaseProps = BaseProps> extends withDrag(Base)<\n T & SliderDragProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'SliderDrag',\n emits: ['start', 'drag', 'drop', 'inertia', 'stop'],\n options: {\n scrollLockThreshold: {\n type: Number,\n default: 10,\n },\n },\n };\n\n /**\n * Test if the scroll should be blocked. Used with the touchmove event to prevent\n * scrolling vertically when trying to drag the slider.\n */\n get shouldPreventScroll() {\n const { distance } = this.$services.get('dragged') as DragServiceProps;\n return (\n Math.abs(distance.x) > this.$options.scrollLockThreshold &&\n Math.abs(distance.x) > Math.abs(distance.y)\n );\n }\n\n /**\n * Touchmove handler.\n * @param {TouchEvent} event\n * @returns {void}\n */\n onTouchmove(event:TouchEvent) {\n if (this.shouldPreventScroll) {\n event.preventDefault();\n }\n }\n\n /**\n * Emit drag events.\n */\n dragged(props:DragServiceProps) {\n this.$emit(props.mode, props);\n }\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,MAAM,gBAAgB;AAWxB,MAAM,mBAAoD,SAAS,IAAI,EAE5E;AAAA,EAIA,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,IACN,OAAO,CAAC,SAAS,QAAQ,QAAQ,WAAW,MAAM;AAAA,IAClD,SAAS;AAAA,MACP,qBAAqB;AAAA,QACnB,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EAMA,IAAI,sBAAsB;AACxB,UAAM,EAAE,SAAS,IAAI,KAAK,UAAU,IAAI,SAAS;AACjD,WACE,KAAK,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,uBACrC,KAAK,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,SAAS,CAAC;AAAA,EAE9C;AAAA,EAOA,YAAY,
|
|
4
|
+
"sourcesContent": ["import type { BaseProps, BaseConfig, DragServiceProps } from '@studiometa/js-toolkit';\nimport { Base, withDrag } from '@studiometa/js-toolkit';\n\nexport interface SliderDragProps extends BaseProps {\n $options: {\n scrollLockThreshold: number;\n };\n}\n\n/**\n * SliderDrag class.\n */\nexport class SliderDrag<T extends BaseProps = BaseProps> extends withDrag(Base)<\n T & SliderDragProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'SliderDrag',\n emits: ['start', 'drag', 'drop', 'inertia', 'stop'],\n options: {\n scrollLockThreshold: {\n type: Number,\n default: 10,\n },\n },\n };\n\n /**\n * Test if the scroll should be blocked. Used with the touchmove event to prevent\n * scrolling vertically when trying to drag the slider.\n */\n get shouldPreventScroll() {\n const { distance } = this.$services.get('dragged') as DragServiceProps;\n return (\n Math.abs(distance.x) > this.$options.scrollLockThreshold &&\n Math.abs(distance.x) > Math.abs(distance.y)\n );\n }\n\n /**\n * Touchmove handler.\n * @param {TouchEvent} event\n * @returns {void}\n */\n onTouchmove(event: TouchEvent) {\n if (this.shouldPreventScroll) {\n event.preventDefault();\n }\n }\n\n /**\n * Emit drag events.\n */\n dragged(props: DragServiceProps) {\n this.$emit(props.mode, props);\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,MAAM,gBAAgB;AAWxB,MAAM,mBAAoD,SAAS,IAAI,EAE5E;AAAA;AAAA;AAAA;AAAA,EAIA,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,IACN,OAAO,CAAC,SAAS,QAAQ,QAAQ,WAAW,MAAM;AAAA,IAClD,SAAS;AAAA,MACP,qBAAqB;AAAA,QACnB,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,sBAAsB;AACxB,UAAM,EAAE,SAAS,IAAI,KAAK,UAAU,IAAI,SAAS;AACjD,WACE,KAAK,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,uBACrC,KAAK,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,SAAS,CAAC;AAAA,EAE9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,YAAY,OAAmB;AAC7B,QAAI,KAAK,qBAAqB;AAC5B,YAAM,eAAe;AAAA,IACvB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQ,OAAyB;AAC/B,SAAK,MAAM,MAAM,MAAM,KAAK;AAAA,EAC9B;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -32,19 +32,55 @@ var import_utils = require("@studiometa/js-toolkit/utils");
|
|
|
32
32
|
var SliderItem = class extends (0, import_js_toolkit.withIntersectionObserver)(import_js_toolkit.Base, {
|
|
33
33
|
threshold: [0, 1]
|
|
34
34
|
}) {
|
|
35
|
+
/**
|
|
36
|
+
* Wether the SliderItem is visible or not.
|
|
37
|
+
* @type {boolean}
|
|
38
|
+
*/
|
|
35
39
|
isVisible = false;
|
|
40
|
+
/**
|
|
41
|
+
* The SliderItem `x` position.
|
|
42
|
+
* @type {number}
|
|
43
|
+
*/
|
|
36
44
|
x = 0;
|
|
45
|
+
/**
|
|
46
|
+
* The smoothed `x` position.
|
|
47
|
+
* @type {number}
|
|
48
|
+
*/
|
|
37
49
|
dampedX = 0;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Item original position.
|
|
52
|
+
*/
|
|
53
|
+
__rect;
|
|
54
|
+
shouldEvaluateRect = false;
|
|
55
|
+
get rect() {
|
|
56
|
+
if (!this.__rect || this.shouldEvaluateRect) {
|
|
57
|
+
this.shouldEvaluateRect = false;
|
|
58
|
+
const x = this.x * -1;
|
|
59
|
+
const rect = this.$el.getBoundingClientRect().toJSON();
|
|
60
|
+
this.__rect = {
|
|
61
|
+
...rect,
|
|
62
|
+
left: rect.left + x,
|
|
63
|
+
right: rect.left + x + rect.width,
|
|
64
|
+
x: rect.left + x
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return this.__rect;
|
|
41
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Update SliderItem bounding rectangle on resize.
|
|
71
|
+
*/
|
|
42
72
|
resized() {
|
|
43
|
-
this.
|
|
73
|
+
this.shouldEvaluateRect = true;
|
|
44
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Reset position to `0` on destroy.
|
|
77
|
+
*/
|
|
45
78
|
destroyed() {
|
|
46
79
|
this.moveInstantly(0);
|
|
47
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Intersected hook.
|
|
83
|
+
*/
|
|
48
84
|
intersected([{ intersectionRatio, isIntersecting }]) {
|
|
49
85
|
if (intersectionRatio >= 1) {
|
|
50
86
|
this.$emit("is-fully-visible");
|
|
@@ -58,6 +94,14 @@ var SliderItem = class extends (0, import_js_toolkit.withIntersectionObserver)(i
|
|
|
58
94
|
}
|
|
59
95
|
this.isVisible = isIntersecting;
|
|
60
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Ticked hook.
|
|
99
|
+
*
|
|
100
|
+
* @todo create AbstractSliderItem with `render` method
|
|
101
|
+
* @todo add state to SliderItem
|
|
102
|
+
* @todo add origin to SliderItem
|
|
103
|
+
* @returns {void}
|
|
104
|
+
*/
|
|
61
105
|
ticked() {
|
|
62
106
|
this.dampedX = (0, import_utils.damp)(this.x, this.dampedX, 0.1, 1e-5);
|
|
63
107
|
this.render();
|
|
@@ -65,45 +109,62 @@ var SliderItem = class extends (0, import_js_toolkit.withIntersectionObserver)(i
|
|
|
65
109
|
this.$services.disable("ticked");
|
|
66
110
|
}
|
|
67
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Enable the SliderItem.
|
|
114
|
+
*/
|
|
68
115
|
activate() {
|
|
69
116
|
this.$el.classList.add("is-active");
|
|
70
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Disable the SliderItem.
|
|
120
|
+
*/
|
|
71
121
|
disactivate() {
|
|
72
122
|
this.$el.classList.remove("is-active");
|
|
73
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Move the SliderItem to the given target position.
|
|
126
|
+
*/
|
|
74
127
|
move(targetPosition) {
|
|
75
128
|
this.x = targetPosition;
|
|
76
129
|
if (!this.$services.has("ticked")) {
|
|
77
130
|
this.$services.enable("ticked");
|
|
78
131
|
}
|
|
79
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Move the SliderItem instantly to the given target position.
|
|
135
|
+
*/
|
|
80
136
|
moveInstantly(targetPosition) {
|
|
81
137
|
this.x = targetPosition;
|
|
82
138
|
this.dampedX = targetPosition;
|
|
83
139
|
this.render();
|
|
84
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Render the component.
|
|
143
|
+
*/
|
|
85
144
|
render() {
|
|
86
145
|
import_utils.domScheduler.write(() => {
|
|
87
146
|
(0, import_utils.transform)(this.$el, { x: this.dampedX });
|
|
88
147
|
});
|
|
89
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Check if SliderItem is partially visible for the given target position.
|
|
151
|
+
*/
|
|
90
152
|
willBeVisible(targetPosition) {
|
|
91
153
|
return this.rect.x + targetPosition < window.innerWidth * 1.5 && this.rect.x + targetPosition + this.rect.width > window.innerWidth * -0.5;
|
|
92
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Check if SliderItem is fully visible for the given target position.
|
|
157
|
+
*
|
|
158
|
+
* @param {number} targetPosition
|
|
159
|
+
* @returns {boolean}
|
|
160
|
+
*/
|
|
93
161
|
willBeFullyVisible(targetPosition) {
|
|
94
162
|
return this.rect.x + targetPosition < window.innerWidth && this.rect.x + targetPosition > 0 && this.rect.x + targetPosition + this.rect.width < window.innerWidth && this.rect.x + targetPosition + this.rect.width > 0;
|
|
95
163
|
}
|
|
96
|
-
updateRectAdjustedWithX() {
|
|
97
|
-
const x = this.x * -1;
|
|
98
|
-
const rect = this.$el.getBoundingClientRect().toJSON();
|
|
99
|
-
this.rect = {
|
|
100
|
-
...rect,
|
|
101
|
-
left: rect.left + x,
|
|
102
|
-
right: rect.left + x + rect.width,
|
|
103
|
-
x: rect.left + x
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Config.
|
|
167
|
+
*/
|
|
107
168
|
__publicField(SliderItem, "config", {
|
|
108
169
|
name: "SliderItem",
|
|
109
170
|
emits: ["is-fully-visible", "is-partially-visible", "is-hidden"]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/ui/molecules/Slider/SliderItem.ts"],
|
|
4
|
-
"sourcesContent": ["import { Base, withIntersectionObserver } from '@studiometa/js-toolkit';\nimport type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { damp, domScheduler, transform } from '@studiometa/js-toolkit/utils';\n\n/**\n * Manage a slider item and its state transition.\n */\nexport class SliderItem<T extends BaseProps = BaseProps> extends withIntersectionObserver(Base, {\n threshold: [0, 1],\n})<T> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'SliderItem',\n emits: ['is-fully-visible', 'is-partially-visible', 'is-hidden'],\n };\n\n /**\n * Wether the SliderItem is visible or not.\n * @type {boolean}\n */\n isVisible = false;\n\n /**\n * The SliderItem `x` position.\n * @type {number}\n */\n x = 0;\n\n /**\n * The smoothed `x` position.\n * @type {number}\n */\n dampedX = 0;\n\n /**\n * Item original position.\n */\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA+C;AAE/C,mBAA8C;AAKvC,IAAM,aAAN,kBAA0D,4CAAyB,wBAAM;AAAA,EAC9F,WAAW,CAAC,GAAG,CAAC;AAClB,CAAC,EAAK;AAAA,EAaJ,YAAY;AAAA,EAMZ,IAAI;AAAA,EAMJ,UAAU;AAAA,EAKV;AAAA,
|
|
4
|
+
"sourcesContent": ["import { Base, withIntersectionObserver } from '@studiometa/js-toolkit';\nimport type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { damp, domScheduler, transform } from '@studiometa/js-toolkit/utils';\n\n/**\n * Manage a slider item and its state transition.\n */\nexport class SliderItem<T extends BaseProps = BaseProps> extends withIntersectionObserver(Base, {\n threshold: [0, 1],\n})<T> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'SliderItem',\n emits: ['is-fully-visible', 'is-partially-visible', 'is-hidden'],\n };\n\n /**\n * Wether the SliderItem is visible or not.\n * @type {boolean}\n */\n isVisible = false;\n\n /**\n * The SliderItem `x` position.\n * @type {number}\n */\n x = 0;\n\n /**\n * The smoothed `x` position.\n * @type {number}\n */\n dampedX = 0;\n\n /**\n * Item original position.\n */\n __rect: {\n x: number;\n y: number;\n top: number;\n right: number;\n bottom: number;\n left: number;\n width: number;\n height: number;\n };\n\n shouldEvaluateRect = false;\n\n get rect() {\n if (!this.__rect || this.shouldEvaluateRect) {\n this.shouldEvaluateRect = false;\n const x = this.x * -1;\n const rect = this.$el.getBoundingClientRect().toJSON();\n this.__rect = {\n ...rect,\n left: rect.left + x,\n right: rect.left + x + rect.width,\n x: rect.left + x,\n };\n }\n\n return this.__rect;\n }\n\n /**\n * Update SliderItem bounding rectangle on resize.\n */\n resized() {\n this.shouldEvaluateRect = true;\n }\n\n /**\n * Reset position to `0` on destroy.\n */\n destroyed() {\n this.moveInstantly(0);\n }\n\n /**\n * Intersected hook.\n */\n intersected([{ intersectionRatio, isIntersecting }]: IntersectionObserverEntry[]) {\n if (intersectionRatio >= 1) {\n this.$emit('is-fully-visible');\n this.$el.setAttribute('aria-hidden', 'false');\n } else if (intersectionRatio > 0) {\n this.$emit('is-partially-visible');\n this.$el.setAttribute('aria-hidden', 'true');\n } else {\n this.$emit('is-hidden');\n this.$el.setAttribute('aria-hidden', 'true');\n }\n\n this.isVisible = isIntersecting;\n }\n\n /**\n * Ticked hook.\n *\n * @todo create AbstractSliderItem with `render` method\n * @todo add state to SliderItem\n * @todo add origin to SliderItem\n * @returns {void}\n */\n ticked() {\n this.dampedX = damp(this.x, this.dampedX, 0.1, 0.00001);\n this.render();\n\n if (this.dampedX === this.x) {\n this.$services.disable('ticked');\n }\n }\n\n /**\n * Enable the SliderItem.\n */\n activate() {\n this.$el.classList.add('is-active');\n }\n\n /**\n * Disable the SliderItem.\n */\n disactivate() {\n this.$el.classList.remove('is-active');\n }\n\n /**\n * Move the SliderItem to the given target position.\n */\n move(targetPosition: number) {\n this.x = targetPosition;\n\n if (!this.$services.has('ticked')) {\n this.$services.enable('ticked');\n }\n }\n\n /**\n * Move the SliderItem instantly to the given target position.\n */\n moveInstantly(targetPosition: number) {\n this.x = targetPosition;\n this.dampedX = targetPosition;\n this.render();\n }\n\n /**\n * Render the component.\n */\n render() {\n domScheduler.write(() => {\n transform(this.$el, { x: this.dampedX });\n });\n }\n\n /**\n * Check if SliderItem is partially visible for the given target position.\n */\n willBeVisible(targetPosition: number) {\n return (\n this.rect.x + targetPosition < window.innerWidth * 1.5 &&\n this.rect.x + targetPosition + this.rect.width > window.innerWidth * -0.5\n );\n }\n\n /**\n * Check if SliderItem is fully visible for the given target position.\n *\n * @param {number} targetPosition\n * @returns {boolean}\n */\n willBeFullyVisible(targetPosition) {\n return (\n this.rect.x + targetPosition < window.innerWidth &&\n this.rect.x + targetPosition > 0 &&\n this.rect.x + targetPosition + this.rect.width < window.innerWidth &&\n this.rect.x + targetPosition + this.rect.width > 0\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -27,7 +27,18 @@ export declare class SliderItem<T extends BaseProps = BaseProps> extends SliderI
|
|
|
27
27
|
/**
|
|
28
28
|
* Item original position.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
__rect: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
top: number;
|
|
34
|
+
right: number;
|
|
35
|
+
bottom: number;
|
|
36
|
+
left: number;
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
};
|
|
40
|
+
shouldEvaluateRect: boolean;
|
|
41
|
+
get rect(): {
|
|
31
42
|
x: number;
|
|
32
43
|
y: number;
|
|
33
44
|
top: number;
|
|
@@ -37,10 +48,6 @@ export declare class SliderItem<T extends BaseProps = BaseProps> extends SliderI
|
|
|
37
48
|
width: number;
|
|
38
49
|
height: number;
|
|
39
50
|
};
|
|
40
|
-
/**
|
|
41
|
-
* Set SliderItem bounding rectangle on mount.
|
|
42
|
-
*/
|
|
43
|
-
mounted(): void;
|
|
44
51
|
/**
|
|
45
52
|
* Update SliderItem bounding rectangle on resize.
|
|
46
53
|
*/
|
|
@@ -93,11 +100,5 @@ export declare class SliderItem<T extends BaseProps = BaseProps> extends SliderI
|
|
|
93
100
|
* @returns {boolean}
|
|
94
101
|
*/
|
|
95
102
|
willBeFullyVisible(targetPosition: any): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Update the bounding rectangle values without the current transformation.
|
|
98
|
-
*
|
|
99
|
-
* @returns {void}
|
|
100
|
-
*/
|
|
101
|
-
updateRectAdjustedWithX(): void;
|
|
102
103
|
}
|
|
103
104
|
export {};
|
|
@@ -3,23 +3,62 @@ import { damp, domScheduler, transform } from "@studiometa/js-toolkit/utils";
|
|
|
3
3
|
class SliderItem extends withIntersectionObserver(Base, {
|
|
4
4
|
threshold: [0, 1]
|
|
5
5
|
}) {
|
|
6
|
+
/**
|
|
7
|
+
* Config.
|
|
8
|
+
*/
|
|
6
9
|
static config = {
|
|
7
10
|
name: "SliderItem",
|
|
8
11
|
emits: ["is-fully-visible", "is-partially-visible", "is-hidden"]
|
|
9
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Wether the SliderItem is visible or not.
|
|
15
|
+
* @type {boolean}
|
|
16
|
+
*/
|
|
10
17
|
isVisible = false;
|
|
18
|
+
/**
|
|
19
|
+
* The SliderItem `x` position.
|
|
20
|
+
* @type {number}
|
|
21
|
+
*/
|
|
11
22
|
x = 0;
|
|
23
|
+
/**
|
|
24
|
+
* The smoothed `x` position.
|
|
25
|
+
* @type {number}
|
|
26
|
+
*/
|
|
12
27
|
dampedX = 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Item original position.
|
|
30
|
+
*/
|
|
31
|
+
__rect;
|
|
32
|
+
shouldEvaluateRect = false;
|
|
33
|
+
get rect() {
|
|
34
|
+
if (!this.__rect || this.shouldEvaluateRect) {
|
|
35
|
+
this.shouldEvaluateRect = false;
|
|
36
|
+
const x = this.x * -1;
|
|
37
|
+
const rect = this.$el.getBoundingClientRect().toJSON();
|
|
38
|
+
this.__rect = {
|
|
39
|
+
...rect,
|
|
40
|
+
left: rect.left + x,
|
|
41
|
+
right: rect.left + x + rect.width,
|
|
42
|
+
x: rect.left + x
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return this.__rect;
|
|
16
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Update SliderItem bounding rectangle on resize.
|
|
49
|
+
*/
|
|
17
50
|
resized() {
|
|
18
|
-
this.
|
|
51
|
+
this.shouldEvaluateRect = true;
|
|
19
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Reset position to `0` on destroy.
|
|
55
|
+
*/
|
|
20
56
|
destroyed() {
|
|
21
57
|
this.moveInstantly(0);
|
|
22
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Intersected hook.
|
|
61
|
+
*/
|
|
23
62
|
intersected([{ intersectionRatio, isIntersecting }]) {
|
|
24
63
|
if (intersectionRatio >= 1) {
|
|
25
64
|
this.$emit("is-fully-visible");
|
|
@@ -33,6 +72,14 @@ class SliderItem extends withIntersectionObserver(Base, {
|
|
|
33
72
|
}
|
|
34
73
|
this.isVisible = isIntersecting;
|
|
35
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Ticked hook.
|
|
77
|
+
*
|
|
78
|
+
* @todo create AbstractSliderItem with `render` method
|
|
79
|
+
* @todo add state to SliderItem
|
|
80
|
+
* @todo add origin to SliderItem
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
36
83
|
ticked() {
|
|
37
84
|
this.dampedX = damp(this.x, this.dampedX, 0.1, 1e-5);
|
|
38
85
|
this.render();
|
|
@@ -40,44 +87,58 @@ class SliderItem extends withIntersectionObserver(Base, {
|
|
|
40
87
|
this.$services.disable("ticked");
|
|
41
88
|
}
|
|
42
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Enable the SliderItem.
|
|
92
|
+
*/
|
|
43
93
|
activate() {
|
|
44
94
|
this.$el.classList.add("is-active");
|
|
45
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Disable the SliderItem.
|
|
98
|
+
*/
|
|
46
99
|
disactivate() {
|
|
47
100
|
this.$el.classList.remove("is-active");
|
|
48
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Move the SliderItem to the given target position.
|
|
104
|
+
*/
|
|
49
105
|
move(targetPosition) {
|
|
50
106
|
this.x = targetPosition;
|
|
51
107
|
if (!this.$services.has("ticked")) {
|
|
52
108
|
this.$services.enable("ticked");
|
|
53
109
|
}
|
|
54
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Move the SliderItem instantly to the given target position.
|
|
113
|
+
*/
|
|
55
114
|
moveInstantly(targetPosition) {
|
|
56
115
|
this.x = targetPosition;
|
|
57
116
|
this.dampedX = targetPosition;
|
|
58
117
|
this.render();
|
|
59
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Render the component.
|
|
121
|
+
*/
|
|
60
122
|
render() {
|
|
61
123
|
domScheduler.write(() => {
|
|
62
124
|
transform(this.$el, { x: this.dampedX });
|
|
63
125
|
});
|
|
64
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Check if SliderItem is partially visible for the given target position.
|
|
129
|
+
*/
|
|
65
130
|
willBeVisible(targetPosition) {
|
|
66
131
|
return this.rect.x + targetPosition < window.innerWidth * 1.5 && this.rect.x + targetPosition + this.rect.width > window.innerWidth * -0.5;
|
|
67
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Check if SliderItem is fully visible for the given target position.
|
|
135
|
+
*
|
|
136
|
+
* @param {number} targetPosition
|
|
137
|
+
* @returns {boolean}
|
|
138
|
+
*/
|
|
68
139
|
willBeFullyVisible(targetPosition) {
|
|
69
140
|
return this.rect.x + targetPosition < window.innerWidth && this.rect.x + targetPosition > 0 && this.rect.x + targetPosition + this.rect.width < window.innerWidth && this.rect.x + targetPosition + this.rect.width > 0;
|
|
70
141
|
}
|
|
71
|
-
updateRectAdjustedWithX() {
|
|
72
|
-
const x = this.x * -1;
|
|
73
|
-
const rect = this.$el.getBoundingClientRect().toJSON();
|
|
74
|
-
this.rect = {
|
|
75
|
-
...rect,
|
|
76
|
-
left: rect.left + x,
|
|
77
|
-
right: rect.left + x + rect.width,
|
|
78
|
-
x: rect.left + x
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
142
|
}
|
|
82
143
|
export {
|
|
83
144
|
SliderItem
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/ui/molecules/Slider/SliderItem.ts"],
|
|
4
|
-
"sourcesContent": ["import { Base, withIntersectionObserver } from '@studiometa/js-toolkit';\nimport type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { damp, domScheduler, transform } from '@studiometa/js-toolkit/utils';\n\n/**\n * Manage a slider item and its state transition.\n */\nexport class SliderItem<T extends BaseProps = BaseProps> extends withIntersectionObserver(Base, {\n threshold: [0, 1],\n})<T> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'SliderItem',\n emits: ['is-fully-visible', 'is-partially-visible', 'is-hidden'],\n };\n\n /**\n * Wether the SliderItem is visible or not.\n * @type {boolean}\n */\n isVisible = false;\n\n /**\n * The SliderItem `x` position.\n * @type {number}\n */\n x = 0;\n\n /**\n * The smoothed `x` position.\n * @type {number}\n */\n dampedX = 0;\n\n /**\n * Item original position.\n */\n
|
|
5
|
-
"mappings": "AAAA,SAAS,MAAM,gCAAgC;AAE/C,SAAS,MAAM,cAAc,iBAAiB;AAKvC,MAAM,mBAAoD,yBAAyB,MAAM;AAAA,EAC9F,WAAW,CAAC,GAAG,CAAC;AAClB,CAAC,EAAK;AAAA,EAIJ,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,IACN,OAAO,CAAC,oBAAoB,wBAAwB,WAAW;AAAA,EACjE;AAAA,EAMA,YAAY;AAAA,EAMZ,IAAI;AAAA,EAMJ,UAAU;AAAA,EAKV;AAAA,
|
|
4
|
+
"sourcesContent": ["import { Base, withIntersectionObserver } from '@studiometa/js-toolkit';\nimport type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { damp, domScheduler, transform } from '@studiometa/js-toolkit/utils';\n\n/**\n * Manage a slider item and its state transition.\n */\nexport class SliderItem<T extends BaseProps = BaseProps> extends withIntersectionObserver(Base, {\n threshold: [0, 1],\n})<T> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'SliderItem',\n emits: ['is-fully-visible', 'is-partially-visible', 'is-hidden'],\n };\n\n /**\n * Wether the SliderItem is visible or not.\n * @type {boolean}\n */\n isVisible = false;\n\n /**\n * The SliderItem `x` position.\n * @type {number}\n */\n x = 0;\n\n /**\n * The smoothed `x` position.\n * @type {number}\n */\n dampedX = 0;\n\n /**\n * Item original position.\n */\n __rect: {\n x: number;\n y: number;\n top: number;\n right: number;\n bottom: number;\n left: number;\n width: number;\n height: number;\n };\n\n shouldEvaluateRect = false;\n\n get rect() {\n if (!this.__rect || this.shouldEvaluateRect) {\n this.shouldEvaluateRect = false;\n const x = this.x * -1;\n const rect = this.$el.getBoundingClientRect().toJSON();\n this.__rect = {\n ...rect,\n left: rect.left + x,\n right: rect.left + x + rect.width,\n x: rect.left + x,\n };\n }\n\n return this.__rect;\n }\n\n /**\n * Update SliderItem bounding rectangle on resize.\n */\n resized() {\n this.shouldEvaluateRect = true;\n }\n\n /**\n * Reset position to `0` on destroy.\n */\n destroyed() {\n this.moveInstantly(0);\n }\n\n /**\n * Intersected hook.\n */\n intersected([{ intersectionRatio, isIntersecting }]: IntersectionObserverEntry[]) {\n if (intersectionRatio >= 1) {\n this.$emit('is-fully-visible');\n this.$el.setAttribute('aria-hidden', 'false');\n } else if (intersectionRatio > 0) {\n this.$emit('is-partially-visible');\n this.$el.setAttribute('aria-hidden', 'true');\n } else {\n this.$emit('is-hidden');\n this.$el.setAttribute('aria-hidden', 'true');\n }\n\n this.isVisible = isIntersecting;\n }\n\n /**\n * Ticked hook.\n *\n * @todo create AbstractSliderItem with `render` method\n * @todo add state to SliderItem\n * @todo add origin to SliderItem\n * @returns {void}\n */\n ticked() {\n this.dampedX = damp(this.x, this.dampedX, 0.1, 0.00001);\n this.render();\n\n if (this.dampedX === this.x) {\n this.$services.disable('ticked');\n }\n }\n\n /**\n * Enable the SliderItem.\n */\n activate() {\n this.$el.classList.add('is-active');\n }\n\n /**\n * Disable the SliderItem.\n */\n disactivate() {\n this.$el.classList.remove('is-active');\n }\n\n /**\n * Move the SliderItem to the given target position.\n */\n move(targetPosition: number) {\n this.x = targetPosition;\n\n if (!this.$services.has('ticked')) {\n this.$services.enable('ticked');\n }\n }\n\n /**\n * Move the SliderItem instantly to the given target position.\n */\n moveInstantly(targetPosition: number) {\n this.x = targetPosition;\n this.dampedX = targetPosition;\n this.render();\n }\n\n /**\n * Render the component.\n */\n render() {\n domScheduler.write(() => {\n transform(this.$el, { x: this.dampedX });\n });\n }\n\n /**\n * Check if SliderItem is partially visible for the given target position.\n */\n willBeVisible(targetPosition: number) {\n return (\n this.rect.x + targetPosition < window.innerWidth * 1.5 &&\n this.rect.x + targetPosition + this.rect.width > window.innerWidth * -0.5\n );\n }\n\n /**\n * Check if SliderItem is fully visible for the given target position.\n *\n * @param {number} targetPosition\n * @returns {boolean}\n */\n willBeFullyVisible(targetPosition) {\n return (\n this.rect.x + targetPosition < window.innerWidth &&\n this.rect.x + targetPosition > 0 &&\n this.rect.x + targetPosition + this.rect.width < window.innerWidth &&\n this.rect.x + targetPosition + this.rect.width > 0\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -30,6 +30,9 @@ module.exports = __toCommonJS(SliderProgress_exports);
|
|
|
30
30
|
var import_utils = require("@studiometa/js-toolkit/utils");
|
|
31
31
|
var import_AbstractSliderChild = require("./AbstractSliderChild.cjs");
|
|
32
32
|
var SliderProgress = class extends import_AbstractSliderChild.AbstractSliderChild {
|
|
33
|
+
/**
|
|
34
|
+
* Update the progress indicator.
|
|
35
|
+
*/
|
|
33
36
|
update(index) {
|
|
34
37
|
import_utils.domScheduler.read(() => {
|
|
35
38
|
const { progress } = this.$refs;
|
|
@@ -40,6 +43,9 @@ var SliderProgress = class extends import_AbstractSliderChild.AbstractSliderChil
|
|
|
40
43
|
});
|
|
41
44
|
}
|
|
42
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Config.
|
|
48
|
+
*/
|
|
43
49
|
__publicField(SliderProgress, "config", {
|
|
44
50
|
name: "SliderProgress",
|
|
45
51
|
refs: ["progress"]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA6C;AAC7C,iCAAoC;AAW7B,IAAM,iBAAN,cAA8D,+CAEnE;AAAA,EAYA,OAAO,
|
|
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": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA6C;AAC7C,iCAAoC;AAW7B,IAAM,iBAAN,cAA8D,+CAEnE;AAAA;AAAA;AAAA;AAAA,EAYA,OAAO,OAAe;AACpB,8BAAa,KAAK,MAAM;AACtB,YAAM,EAAE,SAAS,IAAI,KAAK;AAC1B,YAAM,QAAI,kBAAI,OAAO,GAAG,KAAK,QAAQ,UAAU,SAAS,cAAc,IAAI,CAAC;AAC3E,gCAAa,MAAM,MAAM;AACvB,oCAAU,UAAU,EAAE,EAAE,CAAC;AAAA,MAC3B,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;AAAA;AAAA;AAAA;AAjBE,cANW,gBAMJ,UAAqB;AAAA,EAC1B,MAAM;AAAA,EACN,MAAM,CAAC,UAAU;AACnB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { transform, map, domScheduler } from "@studiometa/js-toolkit/utils";
|
|
2
2
|
import { AbstractSliderChild } from "./AbstractSliderChild.js";
|
|
3
3
|
class SliderProgress extends AbstractSliderChild {
|
|
4
|
+
/**
|
|
5
|
+
* Config.
|
|
6
|
+
*/
|
|
4
7
|
static config = {
|
|
5
8
|
name: "SliderProgress",
|
|
6
9
|
refs: ["progress"]
|
|
7
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Update the progress indicator.
|
|
13
|
+
*/
|
|
8
14
|
update(index) {
|
|
9
15
|
domScheduler.read(() => {
|
|
10
16
|
const { progress } = this.$refs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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,
|
|
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;AAAA;AAAA;AAAA,EAIA,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,IACN,MAAM,CAAC,UAAU;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,OAAe;AACpB,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
6
|
"names": []
|
|
7
7
|
}
|