Skip to content

Commit cf72150

Browse files
committed
bump version and build
1 parent 6c13d5d commit cf72150

File tree

3 files changed

+99
-87
lines changed

3 files changed

+99
-87
lines changed

dist/svelte-range-slider-pips.js

Lines changed: 49 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* svelte-range-slider-pips ~ 1.8.0
2+
* svelte-range-slider-pips ~ 1.8.1
33
* Multi-Thumb, Accessible, Beautiful Range Slider with Pips
44
* © MPL-2.0 ~ Simon Goellner <[email protected]> ~ 24/7/2021
55
*/
@@ -1347,15 +1347,15 @@
13471347

13481348
function get_each_context$1(ctx, list, i) {
13491349
const child_ctx = ctx.slice();
1350-
child_ctx[59] = list[i];
1351-
child_ctx[61] = i;
1350+
child_ctx[60] = list[i];
1351+
child_ctx[62] = i;
13521352
return child_ctx;
13531353
}
13541354

1355-
// (768:6) {#if float}
1355+
// (779:6) {#if float}
13561356
function create_if_block_2$1(ctx) {
13571357
let span;
1358-
let t_value = /*handleFormatter*/ ctx[19](/*value*/ ctx[59], /*index*/ ctx[61]) + "";
1358+
let t_value = /*handleFormatter*/ ctx[19](/*value*/ ctx[60], /*index*/ ctx[62]) + "";
13591359
let t;
13601360
let if_block0 = /*prefix*/ ctx[16] && create_if_block_4$1(ctx);
13611361
let if_block1 = /*suffix*/ ctx[17] && create_if_block_3$1(ctx);
@@ -1388,7 +1388,7 @@
13881388
if_block0 = null;
13891389
}
13901390

1391-
if (dirty[0] & /*handleFormatter, values*/ 524289 && t_value !== (t_value = /*handleFormatter*/ ctx[19](/*value*/ ctx[59], /*index*/ ctx[61]) + "")) set_data(t, t_value);
1391+
if (dirty[0] & /*handleFormatter, values*/ 524289 && t_value !== (t_value = /*handleFormatter*/ ctx[19](/*value*/ ctx[60], /*index*/ ctx[62]) + "")) set_data(t, t_value);
13921392

13931393
if (/*suffix*/ ctx[17]) {
13941394
if (if_block1) {
@@ -1411,7 +1411,7 @@
14111411
};
14121412
}
14131413

1414-
// (770:10) {#if prefix}
1414+
// (781:10) {#if prefix}
14151415
function create_if_block_4$1(ctx) {
14161416
let span;
14171417
let t;
@@ -1435,7 +1435,7 @@
14351435
};
14361436
}
14371437

1438-
// (770:104) {#if suffix}
1438+
// (781:104) {#if suffix}
14391439
function create_if_block_3$1(ctx) {
14401440
let span;
14411441
let t;
@@ -1459,7 +1459,7 @@
14591459
};
14601460
}
14611461

1462-
// (746:2) {#each values as value, index}
1462+
// (757:2) {#each values as value, index}
14631463
function create_each_block$1(ctx) {
14641464
let span1;
14651465
let span0;
@@ -1483,28 +1483,28 @@
14831483
t = space();
14841484
if (if_block) if_block.c();
14851485
attr(span0, "class", "rangeNub");
1486-
attr(span1, "style", span1_style_value = "" + ((/*vertical*/ ctx[5] ? "top" : "left") + ": " + /*$springPositions*/ ctx[26][/*index*/ ctx[61]] + "%; z-index: " + (/*activeHandle*/ ctx[23] === /*index*/ ctx[61] ? 3 : 2) + ";"));
1486+
attr(span1, "style", span1_style_value = "" + ((/*vertical*/ ctx[5] ? "top" : "left") + ": " + /*$springPositions*/ ctx[26][/*index*/ ctx[62]] + "%; z-index: " + (/*activeHandle*/ ctx[23] === /*index*/ ctx[62] ? 3 : 2) + ";"));
14871487
attr(span1, "role", "slider");
1488-
attr(span1, "data-handle", span1_data_handle_value = /*index*/ ctx[61]);
1488+
attr(span1, "data-handle", span1_data_handle_value = /*index*/ ctx[62]);
14891489
attr(span1, "class", "rangeHandle");
14901490

1491-
attr(span1, "aria-valuemin", span1_aria_valuemin_value = /*range*/ ctx[1] === true && /*index*/ ctx[61] === 1
1491+
attr(span1, "aria-valuemin", span1_aria_valuemin_value = /*range*/ ctx[1] === true && /*index*/ ctx[62] === 1
14921492
? /*values*/ ctx[0][0]
14931493
: /*min*/ ctx[2]);
14941494

1495-
attr(span1, "aria-valuemax", span1_aria_valuemax_value = /*range*/ ctx[1] === true && /*index*/ ctx[61] === 0
1495+
attr(span1, "aria-valuemax", span1_aria_valuemax_value = /*range*/ ctx[1] === true && /*index*/ ctx[62] === 0
14961496
? /*values*/ ctx[0][1]
14971497
: /*max*/ ctx[3]);
14981498

1499-
attr(span1, "aria-valuenow", span1_aria_valuenow_value = /*value*/ ctx[59]);
1500-
attr(span1, "aria-valuetext", span1_aria_valuetext_value = "" + (/*prefix*/ ctx[16] + /*handleFormatter*/ ctx[19](/*value*/ ctx[59], /*index*/ ctx[61]) + /*suffix*/ ctx[17]));
1499+
attr(span1, "aria-valuenow", span1_aria_valuenow_value = /*value*/ ctx[60]);
1500+
attr(span1, "aria-valuetext", span1_aria_valuetext_value = "" + (/*prefix*/ ctx[16] + /*handleFormatter*/ ctx[19](/*value*/ ctx[60], /*index*/ ctx[62]) + /*suffix*/ ctx[17]));
15011501
attr(span1, "aria-orientation", span1_aria_orientation_value = /*vertical*/ ctx[5] ? "vertical" : "horizontal");
15021502
attr(span1, "aria-disabled", /*disabled*/ ctx[8]);
15031503
attr(span1, "disabled", /*disabled*/ ctx[8]);
15041504
attr(span1, "tabindex", span1_tabindex_value = /*disabled*/ ctx[8] ? -1 : 0);
15051505
toggle_class(span1, "hoverable", /*hover*/ ctx[7] && !/*disabled*/ ctx[8]);
1506-
toggle_class(span1, "active", /*focus*/ ctx[21] && /*activeHandle*/ ctx[23] === /*index*/ ctx[61]);
1507-
toggle_class(span1, "press", /*handlePressed*/ ctx[22] && /*activeHandle*/ ctx[23] === /*index*/ ctx[61]);
1506+
toggle_class(span1, "active", /*focus*/ ctx[21] && /*activeHandle*/ ctx[23] === /*index*/ ctx[62]);
1507+
toggle_class(span1, "press", /*handlePressed*/ ctx[22] && /*activeHandle*/ ctx[23] === /*index*/ ctx[62]);
15081508
},
15091509
m(target, anchor) {
15101510
insert(target, span1, anchor);
@@ -1536,27 +1536,27 @@
15361536
if_block = null;
15371537
}
15381538

1539-
if (dirty[0] & /*vertical, $springPositions, activeHandle*/ 75497504 && span1_style_value !== (span1_style_value = "" + ((/*vertical*/ ctx[5] ? "top" : "left") + ": " + /*$springPositions*/ ctx[26][/*index*/ ctx[61]] + "%; z-index: " + (/*activeHandle*/ ctx[23] === /*index*/ ctx[61] ? 3 : 2) + ";"))) {
1539+
if (dirty[0] & /*vertical, $springPositions, activeHandle*/ 75497504 && span1_style_value !== (span1_style_value = "" + ((/*vertical*/ ctx[5] ? "top" : "left") + ": " + /*$springPositions*/ ctx[26][/*index*/ ctx[62]] + "%; z-index: " + (/*activeHandle*/ ctx[23] === /*index*/ ctx[62] ? 3 : 2) + ";"))) {
15401540
attr(span1, "style", span1_style_value);
15411541
}
15421542

1543-
if (dirty[0] & /*range, values, min*/ 7 && span1_aria_valuemin_value !== (span1_aria_valuemin_value = /*range*/ ctx[1] === true && /*index*/ ctx[61] === 1
1543+
if (dirty[0] & /*range, values, min*/ 7 && span1_aria_valuemin_value !== (span1_aria_valuemin_value = /*range*/ ctx[1] === true && /*index*/ ctx[62] === 1
15441544
? /*values*/ ctx[0][0]
15451545
: /*min*/ ctx[2])) {
15461546
attr(span1, "aria-valuemin", span1_aria_valuemin_value);
15471547
}
15481548

1549-
if (dirty[0] & /*range, values, max*/ 11 && span1_aria_valuemax_value !== (span1_aria_valuemax_value = /*range*/ ctx[1] === true && /*index*/ ctx[61] === 0
1549+
if (dirty[0] & /*range, values, max*/ 11 && span1_aria_valuemax_value !== (span1_aria_valuemax_value = /*range*/ ctx[1] === true && /*index*/ ctx[62] === 0
15501550
? /*values*/ ctx[0][1]
15511551
: /*max*/ ctx[3])) {
15521552
attr(span1, "aria-valuemax", span1_aria_valuemax_value);
15531553
}
15541554

1555-
if (dirty[0] & /*values*/ 1 && span1_aria_valuenow_value !== (span1_aria_valuenow_value = /*value*/ ctx[59])) {
1555+
if (dirty[0] & /*values*/ 1 && span1_aria_valuenow_value !== (span1_aria_valuenow_value = /*value*/ ctx[60])) {
15561556
attr(span1, "aria-valuenow", span1_aria_valuenow_value);
15571557
}
15581558

1559-
if (dirty[0] & /*prefix, handleFormatter, values, suffix*/ 720897 && span1_aria_valuetext_value !== (span1_aria_valuetext_value = "" + (/*prefix*/ ctx[16] + /*handleFormatter*/ ctx[19](/*value*/ ctx[59], /*index*/ ctx[61]) + /*suffix*/ ctx[17]))) {
1559+
if (dirty[0] & /*prefix, handleFormatter, values, suffix*/ 720897 && span1_aria_valuetext_value !== (span1_aria_valuetext_value = "" + (/*prefix*/ ctx[16] + /*handleFormatter*/ ctx[19](/*value*/ ctx[60], /*index*/ ctx[62]) + /*suffix*/ ctx[17]))) {
15601560
attr(span1, "aria-valuetext", span1_aria_valuetext_value);
15611561
}
15621562

@@ -1581,11 +1581,11 @@
15811581
}
15821582

15831583
if (dirty[0] & /*focus, activeHandle*/ 10485760) {
1584-
toggle_class(span1, "active", /*focus*/ ctx[21] && /*activeHandle*/ ctx[23] === /*index*/ ctx[61]);
1584+
toggle_class(span1, "active", /*focus*/ ctx[21] && /*activeHandle*/ ctx[23] === /*index*/ ctx[62]);
15851585
}
15861586

15871587
if (dirty[0] & /*handlePressed, activeHandle*/ 12582912) {
1588-
toggle_class(span1, "press", /*handlePressed*/ ctx[22] && /*activeHandle*/ ctx[23] === /*index*/ ctx[61]);
1588+
toggle_class(span1, "press", /*handlePressed*/ ctx[22] && /*activeHandle*/ ctx[23] === /*index*/ ctx[62]);
15891589
}
15901590
},
15911591
d(detaching) {
@@ -1597,7 +1597,7 @@
15971597
};
15981598
}
15991599

1600-
// (775:2) {#if range}
1600+
// (786:2) {#if range}
16011601
function create_if_block_1$1(ctx) {
16021602
let span;
16031603
let span_style_value;
@@ -1622,7 +1622,7 @@
16221622
};
16231623
}
16241624

1625-
// (781:2) {#if pips}
1625+
// (792:2) {#if pips}
16261626
function create_if_block$1(ctx) {
16271627
let rangepips;
16281628
let current;
@@ -1644,7 +1644,6 @@
16441644
suffix: /*suffix*/ ctx[17],
16451645
formatter: /*formatter*/ ctx[18],
16461646
focus: /*focus*/ ctx[21],
1647-
disabled: /*disabled*/ ctx[8],
16481647
percentOf: /*percentOf*/ ctx[25]
16491648
}
16501649
});
@@ -1674,7 +1673,6 @@
16741673
if (dirty[0] & /*suffix*/ 131072) rangepips_changes.suffix = /*suffix*/ ctx[17];
16751674
if (dirty[0] & /*formatter*/ 262144) rangepips_changes.formatter = /*formatter*/ ctx[18];
16761675
if (dirty[0] & /*focus*/ 2097152) rangepips_changes.focus = /*focus*/ ctx[21];
1677-
if (dirty[0] & /*disabled*/ 256) rangepips_changes.disabled = /*disabled*/ ctx[8];
16781676
if (dirty[0] & /*percentOf*/ 33554432) rangepips_changes.percentOf = /*percentOf*/ ctx[25];
16791677
rangepips.$set(rangepips_changes);
16801678
},
@@ -1944,8 +1942,9 @@
19441942
let slider;
19451943

19461944
// state management
1947-
let focus = false;
1945+
let valueLength = 0;
19481946

1947+
let focus = false;
19491948
let handleActivated = false;
19501949
let handlePressed = false;
19511950
let keyboardActive = false;
@@ -2409,20 +2408,20 @@
24092408
* @param {number} val the value to clamp
24102409
* @return {number} the value after it's been clamped
24112410
**/
2412-
$$invalidate(48, clampValue = function (val) {
2411+
$$invalidate(49, clampValue = function (val) {
24132412
// return the min/max if outside of that range
24142413
return val <= min ? min : val >= max ? max : val;
24152414
});
24162415
}
24172416

2418-
if ($$self.$$.dirty[0] & /*min, max, step*/ 28 | $$self.$$.dirty[1] & /*clampValue, precision*/ 131584) {
2417+
if ($$self.$$.dirty[0] & /*min, max, step*/ 28 | $$self.$$.dirty[1] & /*clampValue, precision*/ 262656) {
24192418
/**
24202419
* align the value with the steps so that it
24212420
* always sits on the closest (above/below) step
24222421
* @param {number} val the value to align
24232422
* @return {number} the value after it's been aligned
24242423
**/
2425-
$$invalidate(47, alignValueToStep = function (val) {
2424+
$$invalidate(48, alignValueToStep = function (val) {
24262425
// sanity check for performance
24272426
if (val <= min) {
24282427
return min;
@@ -2471,7 +2470,7 @@
24712470
});
24722471
}
24732472

2474-
if ($$self.$$.dirty[0] & /*values, max, min, springPositions, percentOf*/ 50331661 | $$self.$$.dirty[1] & /*alignValueToStep, springValues*/ 66560) {
2473+
if ($$self.$$.dirty[0] & /*values, max, min, percentOf, springPositions*/ 50331661 | $$self.$$.dirty[1] & /*alignValueToStep, valueLength, springValues*/ 136192) {
24752474
{
24762475
// check that "values" is an array, or set it as array
24772476
// to prevent any errors in springs, or range trimming
@@ -2480,18 +2479,25 @@
24802479
console.error("'values' prop should be an Array (https://github.com/simeydotme/svelte-range-slider-pips#slider-props)");
24812480
}
24822481

2483-
// trim the range as needed
2484-
$$invalidate(0, values = trimRange(values));
2482+
// trim the range so it remains as a min/max (only 2 handles)
2483+
// and also align the handles to the steps
2484+
$$invalidate(0, values = trimRange(values.map(v => alignValueToStep(v))));
24852485

2486-
// clamp the values to the steps and boundaries set up in the slider
2487-
$$invalidate(0, values = values.map(v => alignValueToStep(v)));
2488-
2489-
// update the spring function so that movement can happen in the UI
2490-
if (springPositions) {
2491-
springPositions.set(values.map(v => percentOf(v)));
2492-
} else {
2486+
// check if the valueLength (length of values[]) has changed,
2487+
// because if so we need to re-seed the spring function with the
2488+
// new values array.
2489+
if (valueLength !== values.length) {
2490+
// set the initial spring values when the slider initialises,
2491+
// or when values array length has changed
24932492
$$subscribe_springPositions($$invalidate(24, springPositions = spring(values.map(v => percentOf(v)), springValues)));
2493+
} else {
2494+
// update the value of the spring function for animated handles
2495+
// whenever the values has updated
2496+
springPositions.set(values.map(v => percentOf(v)));
24942497
}
2498+
2499+
// set the valueLength for the next check
2500+
$$invalidate(43, valueLength = values.length);
24952501
}
24962502
}
24972503
};
@@ -2579,7 +2585,7 @@
25792585
precision: 40,
25802586
springValues: 41
25812587
},
2582-
[-1, -1]
2588+
[-1, -1, -1]
25832589
);
25842590
}
25852591
}

0 commit comments

Comments
 (0)