@plaidev/karte-action-sdk 1.1.268-29088092.6390e271 → 1.1.268-29089896.0dceea5e
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/dist/hydrate/index.es.js +122 -104
- package/dist/index.es.js +111 -91
- package/dist/svelte5/hydrate/index.es.js +85 -43
- package/dist/svelte5/index.es.js +85 -43
- package/dist/svelte5/index.front2.es.js +85 -43
- package/package.json +1 -1
@@ -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-
|
5433
|
+
var root$d = $.template(`<div class="slider svelte-1rafop1"><div class="slider-container svelte-1rafop1"><ul class="slider-list svelte-1rafop1"><!></ul></div> <div></div></div>`);
|
5434
5434
|
|
5435
5435
|
const $$css$e = {
|
5436
|
-
hash: 'svelte-
|
5437
|
-
code: '.slider-list.svelte-
|
5436
|
+
hash: 'svelte-1rafop1',
|
5437
|
+
code: '.slider.svelte-1rafop1 {width:100%;overflow:hidden;}.slider-container.svelte-1rafop1 {width:100%;overflow:hidden;overscroll-behavior:contain;touch-action:pan-y;}.slider-list.svelte-1rafop1 {-webkit-user-drag:none;margin:0;padding:0;list-style:none;}'
|
5438
5438
|
};
|
5439
5439
|
|
5440
5440
|
function Slider($$anchor, $$props) {
|
@@ -5443,7 +5443,7 @@ function Slider($$anchor, $$props) {
|
|
5443
5443
|
|
5444
5444
|
const indicators = $.mutable_state();
|
5445
5445
|
const itemWidthPercentage = $.mutable_state();
|
5446
|
-
const
|
5446
|
+
const baseContainerStyle = $.mutable_state();
|
5447
5447
|
const containerStyle = $.mutable_state();
|
5448
5448
|
const indicatorListStyle = $.mutable_state();
|
5449
5449
|
const indicatorItemStyle = $.mutable_state();
|
@@ -5458,27 +5458,34 @@ function Slider($$anchor, $$props) {
|
|
5458
5458
|
let isDragging = false;
|
5459
5459
|
let startX = 0;
|
5460
5460
|
let movedX = $.mutable_state(null);
|
5461
|
-
let childCount = $.mutable_state(
|
5462
|
-
|
5463
|
-
|
5464
|
-
|
5465
|
-
|
5466
|
-
|
5467
|
-
|
5468
|
-
|
5469
|
-
|
5470
|
-
|
5471
|
-
|
5472
|
-
|
5473
|
-
|
5474
|
-
|
5475
|
-
|
5461
|
+
let childCount = $.mutable_state(0);
|
5462
|
+
let transformX = $.mutable_state();
|
5463
|
+
|
5464
|
+
console.log('transformX', $.get(transformX));
|
5465
|
+
|
5466
|
+
const computeTransformX = (
|
5467
|
+
index,
|
5468
|
+
itemCount,
|
5469
|
+
movedX,
|
5470
|
+
itemWidthPercentage,
|
5471
|
+
gap
|
5472
|
+
) => {
|
5473
|
+
if (index === 0) return;
|
5474
|
+
|
5475
|
+
let result = 0;
|
5476
|
+
const itemMargin = (100 - itemWidthPercentage) / 2;
|
5477
|
+
|
5478
|
+
for (let i = 1; i <= index; i++) {
|
5479
|
+
if (i === 1 || i === itemCount - 1) {
|
5480
|
+
result += itemWidthPercentage - itemMargin;
|
5481
|
+
} else {
|
5482
|
+
result += itemWidthPercentage;
|
5483
|
+
}
|
5484
|
+
}
|
5476
5485
|
|
5477
|
-
|
5478
|
-
return result;
|
5479
|
-
})();
|
5486
|
+
const moved = movedX ? ` + ${-movedX}px` : '';
|
5480
5487
|
|
5481
|
-
return `translateX(calc(-${
|
5488
|
+
return `translateX(calc(-${result}% - ${gap * index}px${moved}))`;
|
5482
5489
|
};
|
5483
5490
|
|
5484
5491
|
const handleClickIndicator = (index) => {
|
@@ -5494,6 +5501,8 @@ function Slider($$anchor, $$props) {
|
|
5494
5501
|
};
|
5495
5502
|
|
5496
5503
|
const toNext = () => {
|
5504
|
+
console.log('toNext');
|
5505
|
+
|
5497
5506
|
if ($.get(currentIndex) < $.get(childCount) - 1) {
|
5498
5507
|
$.set(currentIndex, $.get(currentIndex) + 1);
|
5499
5508
|
} else if (props().loop) {
|
@@ -5563,34 +5572,47 @@ function Slider($$anchor, $$props) {
|
|
5563
5572
|
$.set(movedX, null);
|
5564
5573
|
|
5565
5574
|
if (isDragging) {
|
5566
|
-
e.preventDefault()
|
5575
|
+
// e.preventDefault()
|
5567
5576
|
e.stopPropagation();
|
5568
5577
|
}
|
5569
5578
|
|
5570
5579
|
document.removeEventListener('mousemove', handleMousemove);
|
5571
5580
|
document.removeEventListener('mouseup', handleMouseup);
|
5581
|
+
document.removeEventListener('click', handleClick);
|
5572
5582
|
};
|
5573
5583
|
|
5574
5584
|
const handleMousedown = (e) => {
|
5575
5585
|
startX = e.clientX;
|
5576
5586
|
isDragging = false;
|
5577
5587
|
document.addEventListener('mousemove', handleMousemove, { passive: true });
|
5578
|
-
document.addEventListener('mouseup', handleMouseup, { passive:
|
5588
|
+
document.addEventListener('mouseup', handleMouseup, { passive: false });
|
5579
5589
|
document.addEventListener('click', handleClick, { capture: true });
|
5580
5590
|
};
|
5581
5591
|
|
5582
5592
|
onMount$1(() => {
|
5583
5593
|
setChildCount();
|
5584
|
-
|
5594
|
+
|
5595
|
+
let autoSlideTimer;
|
5585
5596
|
|
5586
5597
|
if (props().auto) {
|
5587
|
-
setInterval(
|
5598
|
+
autoSlideTimer = setInterval(
|
5588
5599
|
() => {
|
5589
5600
|
toNext();
|
5590
5601
|
},
|
5591
5602
|
props().interval ?? 5000
|
5592
5603
|
);
|
5593
5604
|
}
|
5605
|
+
|
5606
|
+
return () => {
|
5607
|
+
// clearInterval(childCountTimer)
|
5608
|
+
if (autoSlideTimer) clearInterval(autoSlideTimer);
|
5609
|
+
};
|
5610
|
+
});
|
5611
|
+
|
5612
|
+
$.legacy_pre_effect(() => ($.get(slotElement)), () => {
|
5613
|
+
if ($.get(slotElement)) {
|
5614
|
+
$.set(childCount, $.get(slotElement).children.length);
|
5615
|
+
}
|
5594
5616
|
});
|
5595
5617
|
|
5596
5618
|
$.legacy_pre_effect(
|
@@ -5610,20 +5632,27 @@ function Slider($$anchor, $$props) {
|
|
5610
5632
|
$.set(itemWidthPercentage, props().itemWidthPercentage ?? 100);
|
5611
5633
|
});
|
5612
5634
|
|
5613
|
-
$.legacy_pre_effect(
|
5614
|
-
|
5615
|
-
|
5635
|
+
$.legacy_pre_effect(
|
5636
|
+
() => (
|
5637
|
+
$.get(currentIndex),
|
5638
|
+
$.get(childCount),
|
5639
|
+
$.get(movedX),
|
5640
|
+
$.get(itemWidthPercentage),
|
5641
|
+
$.deep_read_state(props())
|
5642
|
+
),
|
5643
|
+
() => {
|
5644
|
+
$.set(transformX, computeTransformX($.get(currentIndex), $.get(childCount), $.get(movedX), $.get(itemWidthPercentage), props().gap ?? 0));
|
5645
|
+
}
|
5646
|
+
);
|
5616
5647
|
|
5617
5648
|
$.legacy_pre_effect(
|
5618
5649
|
() => (
|
5619
5650
|
$.deep_read_state(props()),
|
5620
5651
|
$.get(itemWidthPercentage),
|
5621
|
-
$.get(movedX)
|
5622
|
-
$.get(currentIndex),
|
5623
|
-
$.get(childCount)
|
5652
|
+
$.get(movedX)
|
5624
5653
|
),
|
5625
5654
|
() => {
|
5626
|
-
$.set(
|
5655
|
+
$.set(baseContainerStyle, {
|
5627
5656
|
display: 'grid',
|
5628
5657
|
// marginInline: `-${props.gap}px`,
|
5629
5658
|
gap: `${props().gap}px`,
|
@@ -5632,8 +5661,20 @@ function Slider($$anchor, $$props) {
|
|
5632
5661
|
gridAutoColumns: `minmax(${$.get(itemWidthPercentage)}%, 1fr)`,
|
5633
5662
|
flexShrink: 0,
|
5634
5663
|
transition: $.get(movedX) === null ? 'transform 0.5s' : undefined,
|
5635
|
-
transform: calcTransformX($.get(currentIndex), $.get(childCount), $.get(movedX)),
|
5636
5664
|
userSelect: 'none'
|
5665
|
+
});
|
5666
|
+
}
|
5667
|
+
);
|
5668
|
+
|
5669
|
+
$.legacy_pre_effect(
|
5670
|
+
() => (
|
5671
|
+
$.get(baseContainerStyle),
|
5672
|
+
$.get(transformX)
|
5673
|
+
),
|
5674
|
+
() => {
|
5675
|
+
$.set(containerStyle, objToStyle({
|
5676
|
+
...$.get(baseContainerStyle),
|
5677
|
+
transform: $.get(transformX)
|
5637
5678
|
}));
|
5638
5679
|
}
|
5639
5680
|
);
|
@@ -5662,16 +5703,18 @@ function Slider($$anchor, $$props) {
|
|
5662
5703
|
$.init();
|
5663
5704
|
|
5664
5705
|
var div = root$d();
|
5665
|
-
var
|
5706
|
+
var div_1 = $.child(div);
|
5707
|
+
var ul = $.child(div_1);
|
5666
5708
|
var node = $.child(ul);
|
5667
5709
|
|
5668
5710
|
$.slot(node, $$props, 'default', {}, null);
|
5669
5711
|
$.reset(ul);
|
5670
5712
|
$.bind_this(ul, ($$value) => $.set(slotElement, $$value), () => $.get(slotElement));
|
5713
|
+
$.reset(div_1);
|
5671
5714
|
|
5672
|
-
var
|
5715
|
+
var div_2 = $.sibling(div_1, 2);
|
5673
5716
|
|
5674
|
-
$.each(
|
5717
|
+
$.each(div_2, 5, () => $.get(indicators) ?? [], $.index, ($$anchor, indicator, i) => {
|
5675
5718
|
var button = root_1$2();
|
5676
5719
|
var i_1 = $.child(button);
|
5677
5720
|
|
@@ -5702,15 +5745,14 @@ function Slider($$anchor, $$props) {
|
|
5702
5745
|
$.append($$anchor, button);
|
5703
5746
|
});
|
5704
5747
|
|
5705
|
-
$.reset(
|
5748
|
+
$.reset(div_2);
|
5706
5749
|
$.reset(div);
|
5707
5750
|
|
5708
5751
|
$.template_effect(
|
5709
5752
|
($0) => {
|
5710
5753
|
$.set_attribute(div, 'data-layer-id', layerId());
|
5711
|
-
$.set_style(div, $.get(style));
|
5712
5754
|
$.set_style(ul, $0);
|
5713
|
-
$.set_style(
|
5755
|
+
$.set_style(div_2, $.get(indicatorListStyle));
|
5714
5756
|
},
|
5715
5757
|
[
|
5716
5758
|
() => [
|
@@ -5721,8 +5763,8 @@ function Slider($$anchor, $$props) {
|
|
5721
5763
|
$.derived_safe_equal
|
5722
5764
|
);
|
5723
5765
|
|
5724
|
-
$.event('mousedown',
|
5725
|
-
$.event('touchstart',
|
5766
|
+
$.event('mousedown', div_1, handleMousedown);
|
5767
|
+
$.event('touchstart', div_1, handleTouchstart);
|
5726
5768
|
$.append($$anchor, div);
|
5727
5769
|
$.pop();
|
5728
5770
|
}
|