@evermade/overflow-slider 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -209,6 +209,7 @@ type ArrowsOptions = {
209
209
  container: HTMLElement | null, // container for both arrows
210
210
  containerPrev: HTMLElement | null, // container for previous arrow
211
211
  containerNext: HTMLElement | null, // container for next arrow
212
+ movementType: 'view' | 'slide', // default 'view', how much to move when arrow is clicked
212
213
  };
213
214
  ```
214
215
 
@@ -456,6 +457,10 @@ Auto-play is not supported at the moment but can probably be implemented as a pl
456
457
 
457
458
  ## Changelog
458
459
 
460
+ ### 3.3.1
461
+
462
+ * Fix: FullWidthPlugin margin calculation not being run if there's too few slides for overflow and you resize screen without container width changing
463
+
459
464
  ### 3.3.0
460
465
 
461
466
  * Add: Ability to move each direction by one slide at a time via `moveToSlideInDirection` prev/next
@@ -30,7 +30,7 @@ function FullWidthPlugin(args) {
30
30
  update();
31
31
  slider.on('contentsChanged', update);
32
32
  slider.on('containerSizeChanged', update);
33
- window.addEventListener('resize', setCSS);
33
+ window.addEventListener('resize', update);
34
34
  };
35
35
  }
36
36
 
@@ -1 +1 @@
1
- const t=t=>{var n,e;return null!==(e=null===(n=t.container.parentElement)||void 0===n?void 0:n.offsetWidth)&&void 0!==e?e:window.innerWidth};function n(n){return e=>{var i,r,d;const o={targetWidth:null!==(i=null==n?void 0:n.targetWidth)&&void 0!==i?i:t,addMarginBefore:null===(r=null==n?void 0:n.addMarginBefore)||void 0===r||r,addMarginAfter:null===(d=null==n?void 0:n.addMarginAfter)||void 0===d||d},a=()=>{const t=e.container.querySelectorAll(e.options.slidesSelector);if(!t.length)return;const n=t[0],i=t[t.length-1],r=Math.floor((window.innerWidth-o.targetWidth(e))/2);o.addMarginBefore&&(n.style.marginInlineStart=`${r}px`),o.addMarginAfter&&(i.style.marginInlineEnd=`${r}px`),e.container.setAttribute("data-full-width-offset",r.toString()),l()},l=()=>{e.container.style.setProperty("--slider-container-target-width",`${o.targetWidth(e)}px`)};a(),e.on("contentsChanged",a),e.on("containerSizeChanged",a),window.addEventListener("resize",l)}}export{n as default};
1
+ const t=t=>{var n,e;return null!==(e=null===(n=t.container.parentElement)||void 0===n?void 0:n.offsetWidth)&&void 0!==e?e:window.innerWidth};function n(n){return e=>{var i,r,d;const o={targetWidth:null!==(i=null==n?void 0:n.targetWidth)&&void 0!==i?i:t,addMarginBefore:null===(r=null==n?void 0:n.addMarginBefore)||void 0===r||r,addMarginAfter:null===(d=null==n?void 0:n.addMarginAfter)||void 0===d||d},a=()=>{const t=e.container.querySelectorAll(e.options.slidesSelector);if(!t.length)return;const n=t[0],i=t[t.length-1],r=Math.floor((window.innerWidth-o.targetWidth(e))/2);o.addMarginBefore&&(n.style.marginInlineStart=`${r}px`),o.addMarginAfter&&(i.style.marginInlineEnd=`${r}px`),e.container.setAttribute("data-full-width-offset",r.toString()),l()},l=()=>{e.container.style.setProperty("--slider-container-target-width",`${o.targetWidth(e)}px`)};a(),e.on("contentsChanged",a),e.on("containerSizeChanged",a),window.addEventListener("resize",a)}}export{n as default};
@@ -30,7 +30,7 @@ function FullWidthPlugin(args) {
30
30
  update();
31
31
  slider.on('contentsChanged', update);
32
32
  slider.on('containerSizeChanged', update);
33
- window.addEventListener('resize', setCSS);
33
+ window.addEventListener('resize', update);
34
34
  };
35
35
  }
36
36
 
@@ -1 +1 @@
1
- const t=t=>{var n,e;return null!==(e=null===(n=t.container.parentElement)||void 0===n?void 0:n.offsetWidth)&&void 0!==e?e:window.innerWidth};function n(n){return e=>{var i,r,d;const o={targetWidth:null!==(i=null==n?void 0:n.targetWidth)&&void 0!==i?i:t,addMarginBefore:null===(r=null==n?void 0:n.addMarginBefore)||void 0===r||r,addMarginAfter:null===(d=null==n?void 0:n.addMarginAfter)||void 0===d||d},a=()=>{const t=e.container.querySelectorAll(e.options.slidesSelector);if(!t.length)return;const n=t[0],i=t[t.length-1],r=Math.floor((window.innerWidth-o.targetWidth(e))/2);o.addMarginBefore&&(n.style.marginInlineStart=`${r}px`),o.addMarginAfter&&(i.style.marginInlineEnd=`${r}px`),e.container.setAttribute("data-full-width-offset",r.toString()),l()},l=()=>{e.container.style.setProperty("--slider-container-target-width",`${o.targetWidth(e)}px`)};a(),e.on("contentsChanged",a),e.on("containerSizeChanged",a),window.addEventListener("resize",l)}}export{n as default};
1
+ const t=t=>{var n,e;return null!==(e=null===(n=t.container.parentElement)||void 0===n?void 0:n.offsetWidth)&&void 0!==e?e:window.innerWidth};function n(n){return e=>{var i,r,d;const o={targetWidth:null!==(i=null==n?void 0:n.targetWidth)&&void 0!==i?i:t,addMarginBefore:null===(r=null==n?void 0:n.addMarginBefore)||void 0===r||r,addMarginAfter:null===(d=null==n?void 0:n.addMarginAfter)||void 0===d||d},a=()=>{const t=e.container.querySelectorAll(e.options.slidesSelector);if(!t.length)return;const n=t[0],i=t[t.length-1],r=Math.floor((window.innerWidth-o.targetWidth(e))/2);o.addMarginBefore&&(n.style.marginInlineStart=`${r}px`),o.addMarginAfter&&(i.style.marginInlineEnd=`${r}px`),e.container.setAttribute("data-full-width-offset",r.toString()),l()},l=()=>{e.container.style.setProperty("--slider-container-target-width",`${o.targetWidth(e)}px`)};a(),e.on("contentsChanged",a),e.on("containerSizeChanged",a),window.addEventListener("resize",a)}}export{n as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evermade/overflow-slider",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "Accessible slider tha works with overflow: auto.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,6 +45,6 @@ export default function FullWidthPlugin( args: { [key: string]: unknown } ) {
45
45
  update();
46
46
  slider.on( 'contentsChanged', update );
47
47
  slider.on( 'containerSizeChanged', update );
48
- window.addEventListener( 'resize', setCSS );
48
+ window.addEventListener( 'resize', update );
49
49
  };
50
50
  }