@plaidev/karte-action-sdk 1.1.268-29089806.0ded74d0 → 1.1.268-29090020.0f31d4b5

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.
@@ -5430,11 +5430,11 @@ const LAYOUT_ALIGN = ['flex-start', 'center', 'flex-end', 'stretch'];
5430
5430
  const LAYOUT_JUSTIFY = ['flex-start', 'center', 'flex-end', 'space-between'];
5431
5431
 
5432
5432
  var root_1$2 = $.template(`<button><i></i></button>`);
5433
- var root$d = $.template(`<div class="slider svelte-1slel1d"><ul class="slider-list svelte-1slel1d"><!></ul> <div></div></div>`);
5433
+ var root$d = $.template(`<div class="slider svelte-wwv1o"><div class="slider-container svelte-wwv1o"><ul class="slider-list svelte-wwv1o"><!></ul></div> <div></div></div>`);
5434
5434
 
5435
5435
  const $$css$e = {
5436
- hash: 'svelte-1slel1d',
5437
- code: '.slider-list.svelte-1slel1d {-webkit-user-drag:none;margin:0;padding:0;list-style:none;}'
5436
+ hash: 'svelte-wwv1o',
5437
+ code: '.slider.svelte-wwv1o {width:100%;overflow:hidden;overscroll-behavior:contain;touch-action:pan-y;}.slider-container.svelte-wwv1o {width:100%;overflow:hidden;overscroll-behavior:contain;touch-action:pan-y;}.slider-list.svelte-wwv1o {-webkit-user-drag:none;margin:0;padding:0;list-style:none;will-change:transform;}'
5438
5438
  };
5439
5439
 
5440
5440
  function Slider($$anchor, $$props) {
@@ -5443,7 +5443,6 @@ function Slider($$anchor, $$props) {
5443
5443
 
5444
5444
  const indicators = $.mutable_state();
5445
5445
  const itemWidthPercentage = $.mutable_state();
5446
- const style = $.mutable_state();
5447
5446
  const baseContainerStyle = $.mutable_state();
5448
5447
  const containerStyle = $.mutable_state();
5449
5448
  const indicatorListStyle = $.mutable_state();
@@ -5454,6 +5453,7 @@ function Slider($$anchor, $$props) {
5454
5453
 
5455
5454
  useInjectCustomizeCss(props());
5456
5455
 
5456
+ let containerElement = $.mutable_state();
5457
5457
  let slotElement = $.mutable_state();
5458
5458
  let currentIndex = $.mutable_state(0);
5459
5459
  let isDragging = false;
@@ -5461,8 +5461,8 @@ function Slider($$anchor, $$props) {
5461
5461
  let movedX = $.mutable_state(null);
5462
5462
  let childCount = $.mutable_state(0);
5463
5463
  let transformX = $.mutable_state();
5464
-
5465
- console.log('transformX', $.get(transformX));
5464
+ let lastFrame = 0;
5465
+ const THROTTLE = 16;
5466
5466
 
5467
5467
  const computeTransformX = (
5468
5468
  index,
@@ -5486,7 +5486,7 @@ function Slider($$anchor, $$props) {
5486
5486
 
5487
5487
  const moved = movedX ? ` + ${-movedX}px` : '';
5488
5488
 
5489
- return `translateX(calc(-${result}% - ${gap * index}px${moved}))`;
5489
+ return `translate3d(calc(-${result}% - ${gap * index}px${moved}), 0, 0)`;
5490
5490
  };
5491
5491
 
5492
5492
  const handleClickIndicator = (index) => {
@@ -5502,8 +5502,6 @@ function Slider($$anchor, $$props) {
5502
5502
  };
5503
5503
 
5504
5504
  const toNext = () => {
5505
- console.log('toNext');
5506
-
5507
5505
  if ($.get(currentIndex) < $.get(childCount) - 1) {
5508
5506
  $.set(currentIndex, $.get(currentIndex) + 1);
5509
5507
  } else if (props().loop) {
@@ -5520,20 +5518,33 @@ function Slider($$anchor, $$props) {
5520
5518
  };
5521
5519
 
5522
5520
  const handleClick = (e) => {
5523
- if (isDragging) {
5521
+ const isParentContainer = (el) => {
5522
+ if (!el) return false;
5523
+ return el === $.get(containerElement) || isParentContainer(el.parentElement);
5524
+ };
5525
+
5526
+ if (isParentContainer(e.target) && isDragging) {
5524
5527
  e.preventDefault();
5525
5528
  e.stopPropagation();
5526
5529
  }
5527
5530
  };
5528
5531
 
5529
- const handleTouchmove = (e) => {
5530
- $.set(movedX, startX - e.touches[0].clientX);
5532
+ const move = (moved) => {
5533
+ $.set(movedX, moved);
5531
5534
 
5532
- if ($.get(movedX) > 10 || $.get(movedX) < -10) {
5535
+ if ((moved > 10 || moved < -10) && !isDragging) {
5533
5536
  isDragging = true;
5534
5537
  }
5535
5538
  };
5536
5539
 
5540
+ const handleTouchmove = (e) => {
5541
+ const now = performance.now();
5542
+
5543
+ if (now - lastFrame < THROTTLE) return;
5544
+ move(startX - e.touches[0].clientX);
5545
+ lastFrame = now;
5546
+ };
5547
+
5537
5548
  const handleTouchend = () => {
5538
5549
  if ($.get(movedX) >= 32) {
5539
5550
  toNext();
@@ -5551,16 +5562,12 @@ function Slider($$anchor, $$props) {
5551
5562
  startX = e.touches[0].clientX;
5552
5563
  isDragging = false;
5553
5564
  document.addEventListener('touchmove', handleTouchmove, { passive: true });
5554
- document.addEventListener('touchend', handleTouchend, { passive: true });
5555
- document.addEventListener('click', handleClick, { capture: true });
5565
+ document.addEventListener('touchend', handleTouchend, { passive: false });
5566
+ document.addEventListener('click', handleClick);
5556
5567
  };
5557
5568
 
5558
5569
  const handleMousemove = (e) => {
5559
- $.set(movedX, startX - e.clientX);
5560
-
5561
- if ($.get(movedX) > 10 || $.get(movedX) < -10) {
5562
- isDragging = true;
5563
- }
5570
+ move(startX - e.clientX);
5564
5571
  };
5565
5572
 
5566
5573
  const handleMouseup = (e) => {
@@ -5573,7 +5580,6 @@ function Slider($$anchor, $$props) {
5573
5580
  $.set(movedX, null);
5574
5581
 
5575
5582
  if (isDragging) {
5576
- e.preventDefault();
5577
5583
  e.stopPropagation();
5578
5584
  }
5579
5585
 
@@ -5593,7 +5599,6 @@ function Slider($$anchor, $$props) {
5593
5599
  onMount$1(() => {
5594
5600
  setChildCount();
5595
5601
 
5596
- // const childCountTimer = setInterval(setChildCount, 300);
5597
5602
  let autoSlideTimer;
5598
5603
 
5599
5604
  if (props().auto) {
@@ -5606,7 +5611,6 @@ function Slider($$anchor, $$props) {
5606
5611
  }
5607
5612
 
5608
5613
  return () => {
5609
- // clearInterval(childCountTimer)
5610
5614
  if (autoSlideTimer) clearInterval(autoSlideTimer);
5611
5615
  };
5612
5616
  });
@@ -5634,10 +5638,6 @@ function Slider($$anchor, $$props) {
5634
5638
  $.set(itemWidthPercentage, props().itemWidthPercentage ?? 100);
5635
5639
  });
5636
5640
 
5637
- $.legacy_pre_effect(() => (objToStyle), () => {
5638
- $.set(style, objToStyle({ overflow: 'hidden', width: '100%' }));
5639
- });
5640
-
5641
5641
  $.legacy_pre_effect(
5642
5642
  () => (
5643
5643
  $.get(currentIndex),
@@ -5701,7 +5701,8 @@ function Slider($$anchor, $$props) {
5701
5701
  borderRadius: '100%',
5702
5702
  display: 'block',
5703
5703
  background: '#AAAAAA',
5704
- border: 0
5704
+ border: 0,
5705
+ cursor: 'pointer'
5705
5706
  });
5706
5707
  });
5707
5708
 
@@ -5709,16 +5710,19 @@ function Slider($$anchor, $$props) {
5709
5710
  $.init();
5710
5711
 
5711
5712
  var div = root$d();
5712
- var ul = $.child(div);
5713
+ var div_1 = $.child(div);
5714
+ var ul = $.child(div_1);
5713
5715
  var node = $.child(ul);
5714
5716
 
5715
5717
  $.slot(node, $$props, 'default', {}, null);
5716
5718
  $.reset(ul);
5717
5719
  $.bind_this(ul, ($$value) => $.set(slotElement, $$value), () => $.get(slotElement));
5720
+ $.reset(div_1);
5721
+ $.bind_this(div_1, ($$value) => $.set(containerElement, $$value), () => $.get(containerElement));
5718
5722
 
5719
- var div_1 = $.sibling(ul, 2);
5723
+ var div_2 = $.sibling(div_1, 2);
5720
5724
 
5721
- $.each(div_1, 5, () => $.get(indicators) ?? [], $.index, ($$anchor, indicator, i) => {
5725
+ $.each(div_2, 5, () => $.get(indicators) ?? [], $.index, ($$anchor, indicator, i) => {
5722
5726
  var button = root_1$2();
5723
5727
  var i_1 = $.child(button);
5724
5728
 
@@ -5749,15 +5753,14 @@ function Slider($$anchor, $$props) {
5749
5753
  $.append($$anchor, button);
5750
5754
  });
5751
5755
 
5752
- $.reset(div_1);
5756
+ $.reset(div_2);
5753
5757
  $.reset(div);
5754
5758
 
5755
5759
  $.template_effect(
5756
5760
  ($0) => {
5757
5761
  $.set_attribute(div, 'data-layer-id', layerId());
5758
- $.set_style(div, $.get(style));
5759
5762
  $.set_style(ul, $0);
5760
- $.set_style(div_1, $.get(indicatorListStyle));
5763
+ $.set_style(div_2, $.get(indicatorListStyle));
5761
5764
  },
5762
5765
  [
5763
5766
  () => [
@@ -5768,8 +5771,8 @@ function Slider($$anchor, $$props) {
5768
5771
  $.derived_safe_equal
5769
5772
  );
5770
5773
 
5771
- $.event('mousedown', ul, handleMousedown);
5772
- $.event('touchstart', ul, handleTouchstart);
5774
+ $.event('mousedown', div_1, handleMousedown);
5775
+ $.event('touchstart', div_1, handleTouchstart);
5773
5776
  $.append($$anchor, div);
5774
5777
  $.pop();
5775
5778
  }
@@ -5430,11 +5430,11 @@ const LAYOUT_ALIGN = ['flex-start', 'center', 'flex-end', 'stretch'];
5430
5430
  const LAYOUT_JUSTIFY = ['flex-start', 'center', 'flex-end', 'space-between'];
5431
5431
 
5432
5432
  var root_1$2 = $.template(`<button><i></i></button>`);
5433
- var root$d = $.template(`<div class="slider svelte-1slel1d"><ul class="slider-list svelte-1slel1d"><!></ul> <div></div></div>`);
5433
+ var root$d = $.template(`<div class="slider svelte-wwv1o"><div class="slider-container svelte-wwv1o"><ul class="slider-list svelte-wwv1o"><!></ul></div> <div></div></div>`);
5434
5434
 
5435
5435
  const $$css$e = {
5436
- hash: 'svelte-1slel1d',
5437
- code: '.slider-list.svelte-1slel1d {-webkit-user-drag:none;margin:0;padding:0;list-style:none;}'
5436
+ hash: 'svelte-wwv1o',
5437
+ code: '.slider.svelte-wwv1o {width:100%;overflow:hidden;overscroll-behavior:contain;touch-action:pan-y;}.slider-container.svelte-wwv1o {width:100%;overflow:hidden;overscroll-behavior:contain;touch-action:pan-y;}.slider-list.svelte-wwv1o {-webkit-user-drag:none;margin:0;padding:0;list-style:none;will-change:transform;}'
5438
5438
  };
5439
5439
 
5440
5440
  function Slider($$anchor, $$props) {
@@ -5443,7 +5443,6 @@ function Slider($$anchor, $$props) {
5443
5443
 
5444
5444
  const indicators = $.mutable_state();
5445
5445
  const itemWidthPercentage = $.mutable_state();
5446
- const style = $.mutable_state();
5447
5446
  const baseContainerStyle = $.mutable_state();
5448
5447
  const containerStyle = $.mutable_state();
5449
5448
  const indicatorListStyle = $.mutable_state();
@@ -5454,6 +5453,7 @@ function Slider($$anchor, $$props) {
5454
5453
 
5455
5454
  useInjectCustomizeCss(props());
5456
5455
 
5456
+ let containerElement = $.mutable_state();
5457
5457
  let slotElement = $.mutable_state();
5458
5458
  let currentIndex = $.mutable_state(0);
5459
5459
  let isDragging = false;
@@ -5461,8 +5461,8 @@ function Slider($$anchor, $$props) {
5461
5461
  let movedX = $.mutable_state(null);
5462
5462
  let childCount = $.mutable_state(0);
5463
5463
  let transformX = $.mutable_state();
5464
-
5465
- console.log('transformX', $.get(transformX));
5464
+ let lastFrame = 0;
5465
+ const THROTTLE = 16;
5466
5466
 
5467
5467
  const computeTransformX = (
5468
5468
  index,
@@ -5486,7 +5486,7 @@ function Slider($$anchor, $$props) {
5486
5486
 
5487
5487
  const moved = movedX ? ` + ${-movedX}px` : '';
5488
5488
 
5489
- return `translateX(calc(-${result}% - ${gap * index}px${moved}))`;
5489
+ return `translate3d(calc(-${result}% - ${gap * index}px${moved}), 0, 0)`;
5490
5490
  };
5491
5491
 
5492
5492
  const handleClickIndicator = (index) => {
@@ -5502,8 +5502,6 @@ function Slider($$anchor, $$props) {
5502
5502
  };
5503
5503
 
5504
5504
  const toNext = () => {
5505
- console.log('toNext');
5506
-
5507
5505
  if ($.get(currentIndex) < $.get(childCount) - 1) {
5508
5506
  $.set(currentIndex, $.get(currentIndex) + 1);
5509
5507
  } else if (props().loop) {
@@ -5520,20 +5518,33 @@ function Slider($$anchor, $$props) {
5520
5518
  };
5521
5519
 
5522
5520
  const handleClick = (e) => {
5523
- if (isDragging) {
5521
+ const isParentContainer = (el) => {
5522
+ if (!el) return false;
5523
+ return el === $.get(containerElement) || isParentContainer(el.parentElement);
5524
+ };
5525
+
5526
+ if (isParentContainer(e.target) && isDragging) {
5524
5527
  e.preventDefault();
5525
5528
  e.stopPropagation();
5526
5529
  }
5527
5530
  };
5528
5531
 
5529
- const handleTouchmove = (e) => {
5530
- $.set(movedX, startX - e.touches[0].clientX);
5532
+ const move = (moved) => {
5533
+ $.set(movedX, moved);
5531
5534
 
5532
- if ($.get(movedX) > 10 || $.get(movedX) < -10) {
5535
+ if ((moved > 10 || moved < -10) && !isDragging) {
5533
5536
  isDragging = true;
5534
5537
  }
5535
5538
  };
5536
5539
 
5540
+ const handleTouchmove = (e) => {
5541
+ const now = performance.now();
5542
+
5543
+ if (now - lastFrame < THROTTLE) return;
5544
+ move(startX - e.touches[0].clientX);
5545
+ lastFrame = now;
5546
+ };
5547
+
5537
5548
  const handleTouchend = () => {
5538
5549
  if ($.get(movedX) >= 32) {
5539
5550
  toNext();
@@ -5551,16 +5562,12 @@ function Slider($$anchor, $$props) {
5551
5562
  startX = e.touches[0].clientX;
5552
5563
  isDragging = false;
5553
5564
  document.addEventListener('touchmove', handleTouchmove, { passive: true });
5554
- document.addEventListener('touchend', handleTouchend, { passive: true });
5555
- document.addEventListener('click', handleClick, { capture: true });
5565
+ document.addEventListener('touchend', handleTouchend, { passive: false });
5566
+ document.addEventListener('click', handleClick);
5556
5567
  };
5557
5568
 
5558
5569
  const handleMousemove = (e) => {
5559
- $.set(movedX, startX - e.clientX);
5560
-
5561
- if ($.get(movedX) > 10 || $.get(movedX) < -10) {
5562
- isDragging = true;
5563
- }
5570
+ move(startX - e.clientX);
5564
5571
  };
5565
5572
 
5566
5573
  const handleMouseup = (e) => {
@@ -5573,7 +5580,6 @@ function Slider($$anchor, $$props) {
5573
5580
  $.set(movedX, null);
5574
5581
 
5575
5582
  if (isDragging) {
5576
- e.preventDefault();
5577
5583
  e.stopPropagation();
5578
5584
  }
5579
5585
 
@@ -5593,7 +5599,6 @@ function Slider($$anchor, $$props) {
5593
5599
  onMount$1(() => {
5594
5600
  setChildCount();
5595
5601
 
5596
- // const childCountTimer = setInterval(setChildCount, 300);
5597
5602
  let autoSlideTimer;
5598
5603
 
5599
5604
  if (props().auto) {
@@ -5606,7 +5611,6 @@ function Slider($$anchor, $$props) {
5606
5611
  }
5607
5612
 
5608
5613
  return () => {
5609
- // clearInterval(childCountTimer)
5610
5614
  if (autoSlideTimer) clearInterval(autoSlideTimer);
5611
5615
  };
5612
5616
  });
@@ -5634,10 +5638,6 @@ function Slider($$anchor, $$props) {
5634
5638
  $.set(itemWidthPercentage, props().itemWidthPercentage ?? 100);
5635
5639
  });
5636
5640
 
5637
- $.legacy_pre_effect(() => (objToStyle), () => {
5638
- $.set(style, objToStyle({ overflow: 'hidden', width: '100%' }));
5639
- });
5640
-
5641
5641
  $.legacy_pre_effect(
5642
5642
  () => (
5643
5643
  $.get(currentIndex),
@@ -5701,7 +5701,8 @@ function Slider($$anchor, $$props) {
5701
5701
  borderRadius: '100%',
5702
5702
  display: 'block',
5703
5703
  background: '#AAAAAA',
5704
- border: 0
5704
+ border: 0,
5705
+ cursor: 'pointer'
5705
5706
  });
5706
5707
  });
5707
5708
 
@@ -5709,16 +5710,19 @@ function Slider($$anchor, $$props) {
5709
5710
  $.init();
5710
5711
 
5711
5712
  var div = root$d();
5712
- var ul = $.child(div);
5713
+ var div_1 = $.child(div);
5714
+ var ul = $.child(div_1);
5713
5715
  var node = $.child(ul);
5714
5716
 
5715
5717
  $.slot(node, $$props, 'default', {}, null);
5716
5718
  $.reset(ul);
5717
5719
  $.bind_this(ul, ($$value) => $.set(slotElement, $$value), () => $.get(slotElement));
5720
+ $.reset(div_1);
5721
+ $.bind_this(div_1, ($$value) => $.set(containerElement, $$value), () => $.get(containerElement));
5718
5722
 
5719
- var div_1 = $.sibling(ul, 2);
5723
+ var div_2 = $.sibling(div_1, 2);
5720
5724
 
5721
- $.each(div_1, 5, () => $.get(indicators) ?? [], $.index, ($$anchor, indicator, i) => {
5725
+ $.each(div_2, 5, () => $.get(indicators) ?? [], $.index, ($$anchor, indicator, i) => {
5722
5726
  var button = root_1$2();
5723
5727
  var i_1 = $.child(button);
5724
5728
 
@@ -5749,15 +5753,14 @@ function Slider($$anchor, $$props) {
5749
5753
  $.append($$anchor, button);
5750
5754
  });
5751
5755
 
5752
- $.reset(div_1);
5756
+ $.reset(div_2);
5753
5757
  $.reset(div);
5754
5758
 
5755
5759
  $.template_effect(
5756
5760
  ($0) => {
5757
5761
  $.set_attribute(div, 'data-layer-id', layerId());
5758
- $.set_style(div, $.get(style));
5759
5762
  $.set_style(ul, $0);
5760
- $.set_style(div_1, $.get(indicatorListStyle));
5763
+ $.set_style(div_2, $.get(indicatorListStyle));
5761
5764
  },
5762
5765
  [
5763
5766
  () => [
@@ -5768,8 +5771,8 @@ function Slider($$anchor, $$props) {
5768
5771
  $.derived_safe_equal
5769
5772
  );
5770
5773
 
5771
- $.event('mousedown', ul, handleMousedown);
5772
- $.event('touchstart', ul, handleTouchstart);
5774
+ $.event('mousedown', div_1, handleMousedown);
5775
+ $.event('touchstart', div_1, handleTouchstart);
5773
5776
  $.append($$anchor, div);
5774
5777
  $.pop();
5775
5778
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.268-29089806.0ded74d0",
3
+ "version": "1.1.268-29090020.0f31d4b5",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",