diff --git a/Gruntfile.js b/Gruntfile.js index ca10834..51fbad8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -119,7 +119,7 @@ module.exports = function(grunt) { } grunt.loadNpmTasks('grunt-browserify'); - grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-uglify-es'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-mocha-test'); diff --git a/lib/components/c_facets/Css.js b/lib/components/c_facets/Css.js index 97828df..b3a4449 100644 --- a/lib/components/c_facets/Css.js +++ b/lib/components/c_facets/Css.js @@ -21,13 +21,13 @@ var miloCore = require('milo-core') * depth: '->>' // defaults to '->>' * }, * classes: { - * '.someModelProp': 'some-css-class', // Apply css class if the value of '.someModelProp' is truthy + * '.someModelProp': 'some-css-class' | Array, // Apply css class if the value of '.someModelProp' is truthy * '.someOtherModelProp': { - * 'value-1': 'some-css-class', // Apply if the value of '.someOtherModelProp' == 'value-1' - * 'value-2: 'some-other-css-class' // etc + * 'value-1': 'some-css-class' | Array, // Apply if the value of '.someOtherModelProp' == 'value-1' + * 'value-2: 'some-other-css-class' | Array // etc * }, * '.anotherModelProp': function getCssClass(modelValue) { return ... } // Apply result of function - * '.oneMoreModelProp': 'my-$-class' // Template value of '.oneMoreModelProp' (By replacing $ character) + * '.oneMoreModelProp': 'my-$-class' | Array // Template value of '.oneMoreModelProp' (By replacing $ character) * } * } * ``` @@ -129,7 +129,7 @@ function CssFacet$del() { _.eachKey(this.activeModelPaths, function(modelPaths, cssClass) { modelPaths.clear(); - classList.remove(cssClass); + classList.remove(...cssClass.split(',')); }); } @@ -172,19 +172,19 @@ function updateSimple(modelPath, cssClass, data) { if (modelPaths.has(modelPath)) { modelPaths.delete(modelPath); - if (modelPaths.size === 0) // Only remove the class if no other model path is applying it - classList.remove(cssClass); + if (modelPaths.size === 0) // Only remove the class(es) if no other model path is applying it + classList.remove(...cssClass.split(',')); } }); // Apply new css class (cssClass / data can be null if this is a remove only operation) if (cssClass && data) { - cssClass = data ? cssClass.replace(/\$/g, data) : cssClass; // Process any template characters ($) in class name + cssClass = data ? [].concat(cssClass).map(cls => cls.replace(/\$/g, data)) : cssClass; // Process any template characters ($) in class name var modelPaths = this.activeModelPaths[cssClass] || (this.activeModelPaths[cssClass] = new Set()); modelPaths.add(modelPath); - classList.add(cssClass); + classList.add(...[].concat(cssClass)); } } diff --git a/package.json b/package.json index ef7d0ec..2f96a85 100644 --- a/package.json +++ b/package.json @@ -41,10 +41,10 @@ "brfs": "^1.4.3", "browserify": "^14.0.0", "eslintify": "^3.1.0", - "grunt": "^1.0.1", + "grunt": "1.0.1", "grunt-browserify": "^5.0.0", "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-uglify": "^2.0.0", + "grunt-contrib-uglify-es": "^3.3.0", "grunt-contrib-watch": "^1.0.0", "grunt-exorcise": "^2.1.1", "grunt-istanbul": "^0.7.1",