@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/index.es.js CHANGED
@@ -16145,17 +16145,17 @@ const LAYOUT_JUSTIFY = ['flex-start', 'center', 'flex-end', 'space-between'];
16145
16145
  /* src/components-flex/slider/Slider.svelte generated by Svelte v3.53.1 */
16146
16146
 
16147
16147
  function add_css$f(target) {
16148
- append_styles(target, "svelte-1slel1d", ".slider-list.svelte-1slel1d{-webkit-user-drag:none;margin:0;padding:0;list-style:none}");
16148
+ append_styles(target, "svelte-1rafop1", ".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}");
16149
16149
  }
16150
16150
 
16151
16151
  function get_each_context$1(ctx, list, i) {
16152
16152
  const child_ctx = ctx.slice();
16153
- child_ctx[31] = list[i];
16154
- child_ctx[33] = i;
16153
+ child_ctx[32] = list[i];
16154
+ child_ctx[34] = i;
16155
16155
  return child_ctx;
16156
16156
  }
16157
16157
 
16158
- // (174:4) {#each indicators ?? [] as indicator, i}
16158
+ // (183:4) {#each indicators ?? [] as indicator, i}
16159
16159
  function create_each_block$1(ctx) {
16160
16160
  let button;
16161
16161
  let i_1;
@@ -16165,7 +16165,7 @@ function create_each_block$1(ctx) {
16165
16165
  let dispose;
16166
16166
 
16167
16167
  function click_handler() {
16168
- return /*click_handler*/ ctx[19](/*i*/ ctx[33]);
16168
+ return /*click_handler*/ ctx[20](/*i*/ ctx[34]);
16169
16169
  }
16170
16170
 
16171
16171
  return {
@@ -16177,7 +16177,7 @@ function create_each_block$1(ctx) {
16177
16177
  attr(i_1, "style", i_1_style_value = objToStyle({
16178
16178
  .../*indicatorItemStyle*/ ctx[3],
16179
16179
  ...{
16180
- background: /*indicator*/ ctx[31].isActive ? '#555555' : '#AAAAAA'
16180
+ background: /*indicator*/ ctx[32].isActive ? '#555555' : '#AAAAAA'
16181
16181
  }
16182
16182
  }));
16183
16183
 
@@ -16200,10 +16200,10 @@ function create_each_block$1(ctx) {
16200
16200
  p(new_ctx, dirty) {
16201
16201
  ctx = new_ctx;
16202
16202
 
16203
- if (dirty[0] & /*indicatorItemStyle, indicators*/ 136 && i_1_style_value !== (i_1_style_value = objToStyle({
16203
+ if (dirty[0] & /*indicatorItemStyle, indicators*/ 72 && i_1_style_value !== (i_1_style_value = objToStyle({
16204
16204
  .../*indicatorItemStyle*/ ctx[3],
16205
16205
  ...{
16206
- background: /*indicator*/ ctx[31].isActive ? '#555555' : '#AAAAAA'
16206
+ background: /*indicator*/ ctx[32].isActive ? '#555555' : '#AAAAAA'
16207
16207
  }
16208
16208
  }))) {
16209
16209
  attr(i_1, "style", i_1_style_value);
@@ -16218,17 +16218,18 @@ function create_each_block$1(ctx) {
16218
16218
  }
16219
16219
 
16220
16220
  function create_fragment$j(ctx) {
16221
- let div1;
16221
+ let div2;
16222
+ let div0;
16222
16223
  let ul;
16223
16224
  let ul_style_value;
16224
16225
  let t;
16225
- let div0;
16226
+ let div1;
16226
16227
  let current;
16227
16228
  let mounted;
16228
16229
  let dispose;
16229
- const default_slot_template = /*#slots*/ ctx[17].default;
16230
- const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[16], null);
16231
- let each_value = /*indicators*/ ctx[7] ?? [];
16230
+ const default_slot_template = /*#slots*/ ctx[18].default;
16231
+ const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[17], null);
16232
+ let each_value = /*indicators*/ ctx[6] ?? [];
16232
16233
  let each_blocks = [];
16233
16234
 
16234
16235
  for (let i = 0; i < each_value.length; i += 1) {
@@ -16237,45 +16238,47 @@ function create_fragment$j(ctx) {
16237
16238
 
16238
16239
  return {
16239
16240
  c() {
16240
- div1 = element("div");
16241
+ div2 = element("div");
16242
+ div0 = element("div");
16241
16243
  ul = element("ul");
16242
16244
  if (default_slot) default_slot.c();
16243
16245
  t = space();
16244
- div0 = element("div");
16246
+ div1 = element("div");
16245
16247
 
16246
16248
  for (let i = 0; i < each_blocks.length; i += 1) {
16247
16249
  each_blocks[i].c();
16248
16250
  }
16249
16251
 
16250
- attr(ul, "class", "slider-list svelte-1slel1d");
16252
+ attr(ul, "class", "slider-list svelte-1rafop1");
16251
16253
  attr(ul, "style", ul_style_value = [/*containerStyle*/ ctx[5], /*overrideStyle*/ ctx[1]].join(' '));
16252
- attr(div0, "style", /*indicatorListStyle*/ ctx[4]);
16253
- attr(div1, "data-layer-id", /*layerId*/ ctx[0]);
16254
- attr(div1, "style", /*style*/ ctx[6]);
16255
- attr(div1, "class", "slider svelte-1slel1d");
16254
+ attr(div0, "class", "slider-container svelte-1rafop1");
16255
+ attr(div1, "style", /*indicatorListStyle*/ ctx[4]);
16256
+ attr(div2, "data-layer-id", /*layerId*/ ctx[0]);
16257
+ attr(div2, "class", "slider svelte-1rafop1");
16256
16258
  },
16257
16259
  m(target, anchor) {
16258
- insert(target, div1, anchor);
16259
- append(div1, ul);
16260
+ insert(target, div2, anchor);
16261
+ append(div2, div0);
16262
+ append(div0, ul);
16260
16263
 
16261
16264
  if (default_slot) {
16262
16265
  default_slot.m(ul, null);
16263
16266
  }
16264
16267
 
16265
- /*ul_binding*/ ctx[18](ul);
16266
- append(div1, t);
16267
- append(div1, div0);
16268
+ /*ul_binding*/ ctx[19](ul);
16269
+ append(div2, t);
16270
+ append(div2, div1);
16268
16271
 
16269
16272
  for (let i = 0; i < each_blocks.length; i += 1) {
16270
- each_blocks[i].m(div0, null);
16273
+ each_blocks[i].m(div1, null);
16271
16274
  }
16272
16275
 
16273
16276
  current = true;
16274
16277
 
16275
16278
  if (!mounted) {
16276
16279
  dispose = [
16277
- listen(ul, "mousedown", /*handleMousedown*/ ctx[10]),
16278
- listen(ul, "touchstart", /*handleTouchstart*/ ctx[9])
16280
+ listen(div0, "mousedown", /*handleMousedown*/ ctx[9]),
16281
+ listen(div0, "touchstart", /*handleTouchstart*/ ctx[8])
16279
16282
  ];
16280
16283
 
16281
16284
  mounted = true;
@@ -16283,15 +16286,15 @@ function create_fragment$j(ctx) {
16283
16286
  },
16284
16287
  p(ctx, dirty) {
16285
16288
  if (default_slot) {
16286
- if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 65536)) {
16289
+ if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 131072)) {
16287
16290
  update_slot_base(
16288
16291
  default_slot,
16289
16292
  default_slot_template,
16290
16293
  ctx,
16291
- /*$$scope*/ ctx[16],
16294
+ /*$$scope*/ ctx[17],
16292
16295
  !current
16293
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[16])
16294
- : get_slot_changes(default_slot_template, /*$$scope*/ ctx[16], dirty, null),
16296
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[17])
16297
+ : get_slot_changes(default_slot_template, /*$$scope*/ ctx[17], dirty, null),
16295
16298
  null
16296
16299
  );
16297
16300
  }
@@ -16301,8 +16304,8 @@ function create_fragment$j(ctx) {
16301
16304
  attr(ul, "style", ul_style_value);
16302
16305
  }
16303
16306
 
16304
- if (dirty[0] & /*handleClickIndicator, indicatorItemStyle, indicators*/ 392) {
16305
- each_value = /*indicators*/ ctx[7] ?? [];
16307
+ if (dirty[0] & /*handleClickIndicator, indicatorItemStyle, indicators*/ 200) {
16308
+ each_value = /*indicators*/ ctx[6] ?? [];
16306
16309
  let i;
16307
16310
 
16308
16311
  for (i = 0; i < each_value.length; i += 1) {
@@ -16313,7 +16316,7 @@ function create_fragment$j(ctx) {
16313
16316
  } else {
16314
16317
  each_blocks[i] = create_each_block$1(child_ctx);
16315
16318
  each_blocks[i].c();
16316
- each_blocks[i].m(div0, null);
16319
+ each_blocks[i].m(div1, null);
16317
16320
  }
16318
16321
  }
16319
16322
 
@@ -16325,15 +16328,11 @@ function create_fragment$j(ctx) {
16325
16328
  }
16326
16329
 
16327
16330
  if (!current || dirty[0] & /*indicatorListStyle*/ 16) {
16328
- attr(div0, "style", /*indicatorListStyle*/ ctx[4]);
16331
+ attr(div1, "style", /*indicatorListStyle*/ ctx[4]);
16329
16332
  }
16330
16333
 
16331
16334
  if (!current || dirty[0] & /*layerId*/ 1) {
16332
- attr(div1, "data-layer-id", /*layerId*/ ctx[0]);
16333
- }
16334
-
16335
- if (!current || dirty[0] & /*style*/ 64) {
16336
- attr(div1, "style", /*style*/ ctx[6]);
16335
+ attr(div2, "data-layer-id", /*layerId*/ ctx[0]);
16337
16336
  }
16338
16337
  },
16339
16338
  i(local) {
@@ -16346,9 +16345,9 @@ function create_fragment$j(ctx) {
16346
16345
  current = false;
16347
16346
  },
16348
16347
  d(detaching) {
16349
- if (detaching) detach(div1);
16348
+ if (detaching) detach(div2);
16350
16349
  if (default_slot) default_slot.d(detaching);
16351
- /*ul_binding*/ ctx[18](null);
16350
+ /*ul_binding*/ ctx[19](null);
16352
16351
  destroy_each(each_blocks, detaching);
16353
16352
  mounted = false;
16354
16353
  run_all(dispose);
@@ -16359,7 +16358,7 @@ function create_fragment$j(ctx) {
16359
16358
  function instance$j($$self, $$props, $$invalidate) {
16360
16359
  let indicators;
16361
16360
  let itemWidthPercentage;
16362
- let style;
16361
+ let baseContainerStyle;
16363
16362
  let containerStyle;
16364
16363
  let indicatorListStyle;
16365
16364
  let indicatorItemStyle;
@@ -16373,54 +16372,54 @@ function instance$j($$self, $$props, $$invalidate) {
16373
16372
  let isDragging = false;
16374
16373
  let startX = 0;
16375
16374
  let movedX = null;
16376
- let childCount = slotElement?.children?.length ?? 0;
16377
-
16378
- const calcTransformX = (index, itemCount, _movedX) => {
16379
- if (index === 0) return undefined;
16380
-
16381
- const movingX = (() => {
16382
- let result = 0;
16383
- const itemWidth = itemWidthPercentage;
16384
- const itemMargin = (100 - itemWidthPercentage) / 2;
16385
-
16386
- const movingMap = [...Array(currentIndex + 1)].map((_, index) => {
16387
- if (index === 0) return 0;
16388
- if (index === 1 || index === itemCount - 1) return itemWidth - itemMargin;
16389
- return itemWidth;
16390
- });
16391
-
16392
- movingMap.forEach(value => result += value);
16393
- return result;
16394
- })();
16375
+ let childCount = 0;
16376
+ let transformX;
16377
+ console.log('transformX', transformX);
16378
+
16379
+ const computeTransformX = (index, itemCount, movedX, itemWidthPercentage, gap) => {
16380
+ if (index === 0) return;
16381
+ let result = 0;
16382
+ const itemMargin = (100 - itemWidthPercentage) / 2;
16383
+
16384
+ for (let i = 1; i <= index; i++) {
16385
+ if (i === 1 || i === itemCount - 1) {
16386
+ result += itemWidthPercentage - itemMargin;
16387
+ } else {
16388
+ result += itemWidthPercentage;
16389
+ }
16390
+ }
16395
16391
 
16396
- return `translateX(calc(-${movingX}% - ${(props.gap ?? 0) * index}px + ${(movedX ?? 0) * -1}px))`;
16392
+ const moved = movedX ? ` + ${-movedX}px` : '';
16393
+ return `translateX(calc(-${result}% - ${gap * index}px${moved}))`;
16397
16394
  };
16398
16395
 
16399
16396
  const handleClickIndicator = index => {
16400
- $$invalidate(12, currentIndex = index);
16397
+ $$invalidate(11, currentIndex = index);
16401
16398
  };
16402
16399
 
16403
16400
  const setChildCount = () => {
16404
16401
  const count = slotElement?.children?.length ?? 0;
16405
16402
 
16406
16403
  if (count !== childCount) {
16407
- $$invalidate(14, childCount = slotElement?.children?.length ?? 0);
16404
+ $$invalidate(13, childCount = slotElement?.children?.length ?? 0);
16408
16405
  }
16409
16406
  };
16410
16407
 
16411
16408
  const toNext = () => {
16409
+ console.log('toNext');
16410
+
16412
16411
  if (currentIndex < childCount - 1) {
16413
- $$invalidate(12, currentIndex = currentIndex + 1);
16412
+ $$invalidate(11, currentIndex = currentIndex + 1);
16414
16413
  } else if (props.loop) {
16415
- $$invalidate(12, currentIndex = 0);
16414
+ $$invalidate(11, currentIndex = 0);
16416
16415
  }
16417
16416
  };
16418
16417
 
16419
16418
  const toPrev = () => {
16420
16419
  if (currentIndex > 0) {
16421
- $$invalidate(12, currentIndex = currentIndex - 1);
16420
+ $$invalidate(11, currentIndex = currentIndex - 1);
16422
16421
  } else if (props.loop) {
16423
- $$invalidate(12, currentIndex = childCount - 1);
16422
+ $$invalidate(11, currentIndex = childCount - 1);
16424
16423
  }
16425
16424
  };
16426
16425
 
@@ -16432,7 +16431,7 @@ function instance$j($$self, $$props, $$invalidate) {
16432
16431
  };
16433
16432
 
16434
16433
  const handleTouchmove = e => {
16435
- $$invalidate(13, movedX = startX - e.touches[0].clientX);
16434
+ $$invalidate(12, movedX = startX - e.touches[0].clientX);
16436
16435
 
16437
16436
  if (movedX > 10 || movedX < -10) {
16438
16437
  isDragging = true;
@@ -16446,7 +16445,7 @@ function instance$j($$self, $$props, $$invalidate) {
16446
16445
  toPrev();
16447
16446
  }
16448
16447
 
16449
- $$invalidate(13, movedX = null);
16448
+ $$invalidate(12, movedX = null);
16450
16449
  document.removeEventListener('touchmove', handleTouchmove);
16451
16450
  document.removeEventListener('touchend', handleTouchend);
16452
16451
  document.removeEventListener('click', handleClick);
@@ -16461,7 +16460,7 @@ function instance$j($$self, $$props, $$invalidate) {
16461
16460
  };
16462
16461
 
16463
16462
  const handleMousemove = e => {
16464
- $$invalidate(13, movedX = startX - e.clientX);
16463
+ $$invalidate(12, movedX = startX - e.clientX);
16465
16464
 
16466
16465
  if (movedX > 10 || movedX < -10) {
16467
16466
  isDragging = true;
@@ -16475,37 +16474,43 @@ function instance$j($$self, $$props, $$invalidate) {
16475
16474
  toPrev();
16476
16475
  }
16477
16476
 
16478
- $$invalidate(13, movedX = null);
16477
+ $$invalidate(12, movedX = null);
16479
16478
 
16480
16479
  if (isDragging) {
16481
- e.preventDefault();
16480
+ // e.preventDefault()
16482
16481
  e.stopPropagation();
16483
16482
  }
16484
16483
 
16485
16484
  document.removeEventListener('mousemove', handleMousemove);
16486
16485
  document.removeEventListener('mouseup', handleMouseup);
16486
+ document.removeEventListener('click', handleClick);
16487
16487
  };
16488
16488
 
16489
16489
  const handleMousedown = e => {
16490
16490
  startX = e.clientX;
16491
16491
  isDragging = false;
16492
16492
  document.addEventListener('mousemove', handleMousemove, { passive: true });
16493
- document.addEventListener('mouseup', handleMouseup, { passive: true });
16493
+ document.addEventListener('mouseup', handleMouseup, { passive: false });
16494
16494
  document.addEventListener('click', handleClick, { capture: true });
16495
16495
  };
16496
16496
 
16497
16497
  onMount$1(() => {
16498
16498
  setChildCount();
16499
- setInterval(setChildCount, 300);
16499
+ let autoSlideTimer;
16500
16500
 
16501
16501
  if (props.auto) {
16502
- setInterval(
16502
+ autoSlideTimer = setInterval(
16503
16503
  () => {
16504
16504
  toNext();
16505
16505
  },
16506
16506
  props.interval ?? 5000
16507
16507
  );
16508
16508
  }
16509
+
16510
+ return () => {
16511
+ // clearInterval(childCountTimer)
16512
+ if (autoSlideTimer) clearInterval(autoSlideTimer);
16513
+ };
16509
16514
  });
16510
16515
 
16511
16516
  function ul_binding($$value) {
@@ -16519,22 +16524,32 @@ function instance$j($$self, $$props, $$invalidate) {
16519
16524
 
16520
16525
  $$self.$$set = $$props => {
16521
16526
  if ('layerId' in $$props) $$invalidate(0, layerId = $$props.layerId);
16522
- if ('props' in $$props) $$invalidate(11, props = $$props.props);
16527
+ if ('props' in $$props) $$invalidate(10, props = $$props.props);
16523
16528
  if ('overrideStyle' in $$props) $$invalidate(1, overrideStyle = $$props.overrideStyle);
16524
- if ('$$scope' in $$props) $$invalidate(16, $$scope = $$props.$$scope);
16529
+ if ('$$scope' in $$props) $$invalidate(17, $$scope = $$props.$$scope);
16525
16530
  };
16526
16531
 
16527
16532
  $$self.$$.update = () => {
16528
- if ($$self.$$.dirty[0] & /*childCount, currentIndex*/ 20480) {
16529
- $$invalidate(7, indicators = [...Array(childCount)].map((_, i) => ({ index: i, isActive: i === currentIndex })));
16533
+ if ($$self.$$.dirty[0] & /*slotElement*/ 4) {
16534
+ if (slotElement) {
16535
+ $$invalidate(13, childCount = slotElement.children.length);
16536
+ }
16530
16537
  }
16531
16538
 
16532
- if ($$self.$$.dirty[0] & /*props*/ 2048) {
16533
- $$invalidate(15, itemWidthPercentage = props.itemWidthPercentage ?? 100);
16539
+ if ($$self.$$.dirty[0] & /*childCount, currentIndex*/ 10240) {
16540
+ $$invalidate(6, indicators = [...Array(childCount)].map((_, i) => ({ index: i, isActive: i === currentIndex })));
16534
16541
  }
16535
16542
 
16536
- if ($$self.$$.dirty[0] & /*props, itemWidthPercentage, movedX, currentIndex, childCount*/ 63488) {
16537
- $$invalidate(5, containerStyle = objToStyle({
16543
+ if ($$self.$$.dirty[0] & /*props*/ 1024) {
16544
+ $$invalidate(16, itemWidthPercentage = props.itemWidthPercentage ?? 100);
16545
+ }
16546
+
16547
+ if ($$self.$$.dirty[0] & /*currentIndex, childCount, movedX, itemWidthPercentage, props*/ 80896) {
16548
+ $$invalidate(14, transformX = computeTransformX(currentIndex, childCount, movedX, itemWidthPercentage, props.gap ?? 0));
16549
+ }
16550
+
16551
+ if ($$self.$$.dirty[0] & /*props, itemWidthPercentage, movedX*/ 70656) {
16552
+ $$invalidate(15, baseContainerStyle = {
16538
16553
  display: 'grid',
16539
16554
  // marginInline: `-${props.gap}px`,
16540
16555
  gap: `${props.gap}px`,
@@ -16543,14 +16558,18 @@ function instance$j($$self, $$props, $$invalidate) {
16543
16558
  gridAutoColumns: `minmax(${itemWidthPercentage}%, 1fr)`,
16544
16559
  flexShrink: 0,
16545
16560
  transition: movedX === null ? 'transform 0.5s' : undefined,
16546
- transform: calcTransformX(currentIndex, childCount),
16547
16561
  userSelect: 'none'
16562
+ });
16563
+ }
16564
+
16565
+ if ($$self.$$.dirty[0] & /*baseContainerStyle, transformX*/ 49152) {
16566
+ $$invalidate(5, containerStyle = objToStyle({
16567
+ ...baseContainerStyle,
16568
+ transform: transformX
16548
16569
  }));
16549
16570
  }
16550
16571
  };
16551
16572
 
16552
- $$invalidate(6, style = objToStyle({ overflow: 'hidden', width: '100%' }));
16553
-
16554
16573
  $$invalidate(4, indicatorListStyle = objToStyle({
16555
16574
  display: 'flex',
16556
16575
  justifyContent: 'center',
@@ -16574,7 +16593,6 @@ function instance$j($$self, $$props, $$invalidate) {
16574
16593
  indicatorItemStyle,
16575
16594
  indicatorListStyle,
16576
16595
  containerStyle,
16577
- style,
16578
16596
  indicators,
16579
16597
  handleClickIndicator,
16580
16598
  handleTouchstart,
@@ -16583,6 +16601,8 @@ function instance$j($$self, $$props, $$invalidate) {
16583
16601
  currentIndex,
16584
16602
  movedX,
16585
16603
  childCount,
16604
+ transformX,
16605
+ baseContainerStyle,
16586
16606
  itemWidthPercentage,
16587
16607
  $$scope,
16588
16608
  slots,
@@ -16594,7 +16614,7 @@ function instance$j($$self, $$props, $$invalidate) {
16594
16614
  class Slider extends SvelteComponent {
16595
16615
  constructor(options) {
16596
16616
  super();
16597
- init(this, options, instance$j, create_fragment$j, safe_not_equal, { layerId: 0, props: 11, overrideStyle: 1 }, add_css$f, [-1, -1]);
16617
+ init(this, options, instance$j, create_fragment$j, safe_not_equal, { layerId: 0, props: 10, overrideStyle: 1 }, add_css$f, [-1, -1]);
16598
16618
  }
16599
16619
  }
16600
16620