@inappstory/slide-api 0.0.28 → 0.0.29
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.cjs +14 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3981,6 +3981,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
3981
3981
|
create: false,
|
|
3982
3982
|
localData: {},
|
|
3983
3983
|
rangeClass: "slider-view",
|
|
3984
|
+
rangeBackgroundClass: "slider-background-view",
|
|
3984
3985
|
activeClass: "rangeslider--active",
|
|
3985
3986
|
horizontalClass: "rangeslider--horizontal",
|
|
3986
3987
|
verticalClass: "rangeslider--vertical",
|
|
@@ -4006,6 +4007,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
4006
4007
|
fill;
|
|
4007
4008
|
handle;
|
|
4008
4009
|
range;
|
|
4010
|
+
rangeBgView;
|
|
4009
4011
|
DIMENSION;
|
|
4010
4012
|
DIRECTION;
|
|
4011
4013
|
DIRECTION_STYLE;
|
|
@@ -4048,11 +4050,14 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
4048
4050
|
this.handle = getValueOrException(this.element.querySelector(`.${this.options.handleClass}`), `Empty .${this.options.handleClass}`);
|
|
4049
4051
|
this.range = getValueOrException(this.element.querySelector(`.${this.options.rangeClass}`), `Empty .${this.options.rangeClass}`);
|
|
4050
4052
|
this.range.id = this.id;
|
|
4053
|
+
this.rangeBgView = getValueOrException(this.element.querySelector(`.${this.options.rangeBackgroundClass}`), `Empty .${this.options.rangeBackgroundClass}`);
|
|
4051
4054
|
// if (this.range.classList.contains(this.options['horizontalClass'])) {
|
|
4052
4055
|
this.orientation = "horizontal";
|
|
4053
4056
|
// } else if (this.range.classList.contains(this.options['verticalClass'])) {
|
|
4054
4057
|
// this.orientation = 'vertical';
|
|
4055
4058
|
// }
|
|
4059
|
+
// enable expanded tap area (disabled by default for backward compatibility)
|
|
4060
|
+
this.element.classList.add("width-expanded-slider-tap-area");
|
|
4056
4061
|
this.DIMENSION = constants.orientation[this.orientation].dimension;
|
|
4057
4062
|
this.DIRECTION = constants.orientation[this.orientation].direction;
|
|
4058
4063
|
this.DIRECTION_STYLE = constants.orientation[this.orientation].directionStyle[this.layoutDirection];
|
|
@@ -4255,8 +4260,9 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
4255
4260
|
this.step = tryParseFloat(this.elementSlider.getAttribute("step"), 1);
|
|
4256
4261
|
}
|
|
4257
4262
|
this.handleDimension = getDimension(this.handle, ("offset" + ucfirst(this.DIMENSION)));
|
|
4258
|
-
this.rangeDimension = getDimension(this.
|
|
4259
|
-
this.maxHandlePos = this.rangeDimension - this.handleDimension;
|
|
4263
|
+
this.rangeDimension = getDimension(this.rangeBgView, ("offset" + ucfirst(this.DIMENSION)));
|
|
4264
|
+
// this.maxHandlePos = this.rangeDimension - this.handleDimension;
|
|
4265
|
+
this.maxHandlePos = this.rangeDimension;
|
|
4260
4266
|
this.grabPos = this.handleDimension / 2;
|
|
4261
4267
|
this.position = this.getPositionFromValue(this.value);
|
|
4262
4268
|
if (updateAttributes) {
|
|
@@ -4295,7 +4301,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
4295
4301
|
if ((" " + e.target.className + " ").replace(/[\n\t]/g, " ").indexOf(this.options.handleClass) > -1) {
|
|
4296
4302
|
return;
|
|
4297
4303
|
}
|
|
4298
|
-
const pos = this.getRelativePosition(e), rangePos = this.
|
|
4304
|
+
const pos = this.getRelativePosition(e), rangePos = this.rangeBgView.getBoundingClientRect()[this.DIRECTION], handlePos = this.getPositionFromNode(this.handle) - rangePos, setPos = this.orientation === "vertical" ? this.maxHandlePos - (pos - this.grabPos) : pos - this.grabPos;
|
|
4299
4305
|
this.setPosition(setPos);
|
|
4300
4306
|
if (pos >= handlePos && pos < handlePos + this.handleDimension) {
|
|
4301
4307
|
this.grabPos = pos - handlePos;
|
|
@@ -4352,11 +4358,14 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
4352
4358
|
uiPos = this.maxHandlePos - uiPos;
|
|
4353
4359
|
}
|
|
4354
4360
|
// this.rangeDimension - slider width
|
|
4355
|
-
this.fill.style.transform = "translateX(" + (uiPos
|
|
4361
|
+
this.fill.style.transform = "translateX(" + (uiPos - this.rangeDimension) + "px)";
|
|
4362
|
+
// this.fill.style.transform = "translateX(" + (uiPos + this.grabPos - this.rangeDimension) + "px)";
|
|
4356
4363
|
// this.fill.style[this.DIMENSION] = (uiPos + this.grabPos) + 'px';
|
|
4357
4364
|
const percentage = this.getPercentageFromValue(value);
|
|
4358
4365
|
// 1 + (scale - 1) * percentage
|
|
4359
|
-
this.handle.style.
|
|
4366
|
+
this.handle.style.setProperty("--offset", String(uiPos));
|
|
4367
|
+
this.handle.style.setProperty("--percentage", String(percentage));
|
|
4368
|
+
// this.handle.style.transform = "translateY(-50%) translateX(" + uiPos + "px) scale(calc(1 + (var(--scale-factor, 1) - 1) * " + percentage + "))";
|
|
4360
4369
|
// this.handle.style[this.DIRECTION_STYLE] = uiPos + 'px';
|
|
4361
4370
|
this.setValue(value);
|
|
4362
4371
|
// Update globals
|