Skip to content

Commit

Permalink
noUiSlider 14.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leongersen committed May 5, 2020
1 parent d6c2af7 commit a86228f
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 47 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.MD
@@ -1,5 +1,9 @@
# Changelog

### 14.3.0 (*2020-05-05*)
- Added: Default `cssClasses` are now exposed and can be modified;
- Fixed: Destroying sliders with multiple classes in `cssClasses` fails (#1069);

### 14.2.0 (*2020-03-27*)
- Added: Slider api as event parameter (#1058);
- Added: Allow multiple classes in `cssClasses` option (#1054);
Expand Down
2 changes: 1 addition & 1 deletion distribute/nouislider.css
@@ -1,4 +1,4 @@
/*! nouislider - 14.2.0 - 3/27/2020 */
/*! nouislider - 14.3.0 - 5/5/2020 */
/* Functional styling;
* These styles are required for noUiSlider to function.
* You don't need to change these rules to apply your design.
Expand Down
91 changes: 50 additions & 41 deletions distribute/nouislider.js
@@ -1,4 +1,4 @@
/*! nouislider - 14.2.0 - 3/27/2020 */
/*! nouislider - 14.3.0 - 5/5/2020 */
(function(factory) {
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
Expand All @@ -13,7 +13,7 @@
})(function() {
"use strict";

var VERSION = "14.2.0";
var VERSION = "14.3.0";

//region Helper Methods

Expand Down Expand Up @@ -109,7 +109,7 @@

// http://youmightnotneedjquery.com/#remove_class
function removeClass(el, className) {
if (el.classList) {
if (el.classList && !/\s/.test(className)) {
el.classList.remove(className);
} else {
el.className = el.className.replace(
Expand Down Expand Up @@ -492,13 +492,56 @@
or true when everything is OK. It can also modify the option
object, to make sure all values can be correctly looped elsewhere. */

//region Defaults

var defaultFormatter = {
to: function(value) {
return value !== undefined && value.toFixed(2);
},
from: Number
};

var cssClasses = {
target: "target",
base: "base",
origin: "origin",
handle: "handle",
handleLower: "handle-lower",
handleUpper: "handle-upper",
touchArea: "touch-area",
horizontal: "horizontal",
vertical: "vertical",
background: "background",
connect: "connect",
connects: "connects",
ltr: "ltr",
rtl: "rtl",
textDirectionLtr: "txt-dir-ltr",
textDirectionRtl: "txt-dir-rtl",
draggable: "draggable",
drag: "state-drag",
tap: "state-tap",
active: "active",
tooltip: "tooltip",
pips: "pips",
pipsHorizontal: "pips-horizontal",
pipsVertical: "pips-vertical",
marker: "marker",
markerHorizontal: "marker-horizontal",
markerVertical: "marker-vertical",
markerNormal: "marker-normal",
markerLarge: "marker-large",
markerSub: "marker-sub",
value: "value",
valueHorizontal: "value-horizontal",
valueVertical: "value-vertical",
valueNormal: "value-normal",
valueLarge: "value-large",
valueSub: "value-sub"
};

//endregion

function validateFormat(entry) {
// Any object with a to and from method is supported.
if (isValidFormatter(entry)) {
Expand Down Expand Up @@ -878,44 +921,7 @@
orientation: "horizontal",
keyboardSupport: true,
cssPrefix: "noUi-",
cssClasses: {
target: "target",
base: "base",
origin: "origin",
handle: "handle",
handleLower: "handle-lower",
handleUpper: "handle-upper",
touchArea: "touch-area",
horizontal: "horizontal",
vertical: "vertical",
background: "background",
connect: "connect",
connects: "connects",
ltr: "ltr",
rtl: "rtl",
textDirectionLtr: "txt-dir-ltr",
textDirectionRtl: "txt-dir-rtl",
draggable: "draggable",
drag: "state-drag",
tap: "state-tap",
active: "active",
tooltip: "tooltip",
pips: "pips",
pipsHorizontal: "pips-horizontal",
pipsVertical: "pips-vertical",
marker: "marker",
markerHorizontal: "marker-horizontal",
markerVertical: "marker-vertical",
markerNormal: "marker-normal",
markerLarge: "marker-large",
markerSub: "marker-sub",
value: "value",
valueHorizontal: "value-horizontal",
valueVertical: "value-vertical",
valueNormal: "value-normal",
valueLarge: "value-large",
valueSub: "value-sub"
}
cssClasses: cssClasses
};

// AriaFormat defaults to regular format, if any.
Expand Down Expand Up @@ -2515,6 +2521,9 @@
// Exposed for unit testing, don't use this in your application.
__spectrum: Spectrum,
version: VERSION,
// A reference to the default classes, allows global changes.
// Use the cssClasses option for changes to one slider.
cssClasses: cssClasses,
create: initialize
};
});
2 changes: 1 addition & 1 deletion distribute/nouislider.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions distribute/nouislider.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "nouislider",
"version": "14.2.0",
"version": "14.3.0",
"main": "distribute/nouislider.js",
"style": "distribute/nouislider.min.css",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion tests/slider_classes.js
Expand Up @@ -2,7 +2,7 @@ QUnit.test("Classes", function (assert) {

document.getElementById('qunit-fixture').innerHTML = '<div class="slider"></div>';

noUiSlider.cssClasses.base += ' test';
noUiSlider.cssClasses.target += ' test';

var settings = {
start: [50, 100],
Expand Down

0 comments on commit a86228f

Please sign in to comment.