Socket
Socket
Sign inDemoInstall

rangetouch

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-beta.1 to 2.0.0

.vscode/settings.json

29

bundles.json
{
"rangetouch": {
"js": {
"rangetouch.js": [
"src/js/rangetouch.js"
]
"js": {
"rangetouch.js": {
"src": "./src/js/rangetouch.js",
"dist": "./dist/",
"formats": ["es", "umd"]
},
"docs.js": {
"src": "./docs/src/js/docs.js",
"dist": "./docs/dist/",
"formats": ["iife"]
}
},
"docs": {
"less": {
"docs.css": [
"docs/src/less/docs.less"
]
},
"js": {
"docs.js": [
"docs/src/js/docs.js"
]
"css": {
"docs.css": {
"src": "./docs/src/less/docs.less",
"dist": "./docs/dist/"
}
}
}

@@ -8,3 +8,3 @@ {

"docs": {
"bucket": "rangetouch",
"bucket": "rangetouch.com",
"domain": "rangetouch.com",

@@ -11,0 +11,0 @@ "region": "us-east-1"

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("RangeTouch",t):e.RangeTouch=t()}(this,function(){"use strict";function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var t=function(e){return null!=e?e.constructor:null},n=function(e,t){return!!(e&&t&&e instanceof t)},r=function(e){return null==e},u=function(e){return t(e)===Object},i=function(e){return t(e)===String},o=function(e){return Array.isArray(e)},a=function(e){return n(e,NodeList)},c={nullOrUndefined:r,object:u,number:function(e){return t(e)===Number&&!Number.isNaN(e)},string:i,boolean:function(e){return t(e)===Boolean},function:function(e){return t(e)===Function},array:o,nodeList:a,element:function(e){return n(e,Element)},event:function(e){return n(e,Event)},empty:function(e){return r(e)||(i(e)||o(e)||a(e))&&!e.length||u(e)&&!Object.keys(e).length}};function l(e,t){if(1>t){var n=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}var s={addCSS:!0,thumbWidth:15,watch:!0};return function(){function t(e,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),c.element(e)?this.element=e:c.string(e)&&(this.element=document.querySelector(e)),c.element(this.element)&&c.empty(this.element.rangeTouch)&&(this.config=Object.assign({},s,n),this.init())}return n=t,u=[{key:"setup",value:function(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=null;if(c.empty(e)||c.string(e)?r=Array.from(document.querySelectorAll(c.string(e)?e:'input[type="range"]')):c.element(e)?r=[e]:c.nodeList(e)?r=Array.from(e):c.array(e)&&(r=e.filter(c.element)),c.empty(r))return null;var u=Object.assign({},s,n);c.string(e)&&u.watch&&new MutationObserver(function(n){Array.from(n).forEach(function(n){Array.from(n.addedNodes).forEach(function(n){c.element(n)&&function(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}(n,e)&&new t(n,u)})})}).observe(document.body,{childList:!0,subtree:!0});return r.map(function(e){return new t(e,n)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}],(r=[{key:"init",value:function(){t.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){t.enabled&&(this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,n=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(e){t.element[n](e,function(e){return t.set(e)},!1)})}},{key:"get",value:function(e){if(!t.enabled||!c.event(e))return null;var n,r=e.target,u=e.changedTouches[0],i=parseFloat(r.getAttribute("min"))||0,o=parseFloat(r.getAttribute("max"))||100,a=parseFloat(r.getAttribute("step"))||1,s=r.getBoundingClientRect(),f=100/s.width*(this.config.thumbWidth/2)/100;return 0>(n=100/s.width*(u.clientX-s.left))?n=0:100<n&&(n=100),50>n?n-=(100-2*n)*f:50<n&&(n+=2*(n-50)*f),i+l(n/100*(o-i),a)}},{key:"set",value:function(e){t.enabled&&c.event(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),function(e,t){if(e&&t){var n=new Event(t);e.dispatchEvent(n)}}(e.target,"touchend"===e.type?"change":"input"))}}])&&e(n.prototype,r),u&&e(n,u),t;var n,r,u}()});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("RangeTouch",t):e.RangeTouch=t()}(this,function(){"use strict";function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var t={addCSS:!0,thumbWidth:15,watch:!0};var n=function(e){return null!=e?e.constructor:null},r=function(e,t){return!!(e&&t&&e instanceof t)},u=function(e){return null==e},i=function(e){return n(e)===Object},o=function(e){return n(e)===String},a=function(e){return Array.isArray(e)},c=function(e){return r(e,NodeList)},l={nullOrUndefined:u,object:i,number:function(e){return n(e)===Number&&!Number.isNaN(e)},string:o,boolean:function(e){return n(e)===Boolean},function:function(e){return n(e)===Function},array:a,nodeList:c,element:function(e){return r(e,Element)},event:function(e){return r(e,Event)},empty:function(e){return u(e)||(o(e)||a(e)||c(e))&&!e.length||i(e)&&!Object.keys(e).length}};function s(e,t){if(1>t){var n=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}return function(){function n(e,r){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,n),l.element(e)?this.element=e:l.string(e)&&(this.element=document.querySelector(e)),l.element(this.element)&&l.empty(this.element.rangeTouch)&&(this.config=Object.assign({},t,r),this.init())}return r=n,i=[{key:"setup",value:function(e){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},u=null;if(l.empty(e)||l.string(e)?u=Array.from(document.querySelectorAll(l.string(e)?e:'input[type="range"]')):l.element(e)?u=[e]:l.nodeList(e)?u=Array.from(e):l.array(e)&&(u=e.filter(l.element)),l.empty(u))return null;var i=Object.assign({},t,r);l.string(e)&&i.watch&&new MutationObserver(function(t){Array.from(t).forEach(function(t){Array.from(t.addedNodes).forEach(function(t){l.element(t)&&function(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}(t,e)&&new n(t,i)})})}).observe(document.body,{childList:!0,subtree:!0});return u.map(function(e){return new n(e,r)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}],(u=[{key:"init",value:function(){n.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){n.enabled&&(this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,n=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(e){t.element[n](e,function(e){return t.set(e)},!1)})}},{key:"get",value:function(e){if(!n.enabled||!l.event(e))return null;var t,r=e.target,u=e.changedTouches[0],i=parseFloat(r.getAttribute("min"))||0,o=parseFloat(r.getAttribute("max"))||100,a=parseFloat(r.getAttribute("step"))||1,c=r.getBoundingClientRect(),f=100/c.width*(this.config.thumbWidth/2)/100;return 0>(t=100/c.width*(u.clientX-c.left))?t=0:100<t&&(t=100),50>t?t-=(100-2*t)*f:50<t&&(t+=2*(t-50)*f),i+s(t/100*(o-i),a)}},{key:"set",value:function(e){n.enabled&&l.event(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),function(e,t){if(e&&t){var n=new Event(t);e.dispatchEvent(n)}}(e.target,"touchend"===e.type?"change":"input"))}}])&&e(r.prototype,u),i&&e(r,i),n;var r,u,i}()});

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define("RangeTouch",t):t()}(0,function(){"use strict";function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var t=function(e){return null!=e?e.constructor:null},n=function(e,t){return!!(e&&t&&e instanceof t)},r=function(e){return null==e},i=function(e){return t(e)===Object},u=function(e){return t(e)===String},o=function(e){return Array.isArray(e)},c=function(e){return n(e,NodeList)},a={nullOrUndefined:r,object:i,number:function(e){return t(e)===Number&&!Number.isNaN(e)},string:u,boolean:function(e){return t(e)===Boolean},function:function(e){return t(e)===Function},array:o,nodeList:c,element:function(e){return n(e,Element)},event:function(e){return n(e,Event)},empty:function(e){return r(e)||(u(e)||o(e)||c(e))&&!e.length||i(e)&&!Object.keys(e).length}};function l(e,t){if(1>t){var n=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}var s={addCSS:!0,thumbWidth:15,watch:!0},f=function(){function t(e,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),a.element(e)?this.element=e:a.string(e)&&(this.element=document.querySelector(e)),a.element(this.element)&&a.empty(this.element.rangeTouch)&&(this.config=Object.assign({},s,n),this.init())}return n=t,i=[{key:"setup",value:function(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=null;if(a.empty(e)||a.string(e)?r=Array.from(document.querySelectorAll(a.string(e)?e:'input[type="range"]')):a.element(e)?r=[e]:a.nodeList(e)?r=Array.from(e):a.array(e)&&(r=e.filter(a.element)),a.empty(r))return null;var i=Object.assign({},s,n);a.string(e)&&i.watch&&new MutationObserver(function(n){Array.from(n).forEach(function(n){Array.from(n.addedNodes).forEach(function(n){a.element(n)&&function(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}(n,e)&&new t(n,i)})})}).observe(document.body,{childList:!0,subtree:!0});return r.map(function(e){return new t(e,n)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}],(r=[{key:"init",value:function(){t.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){t.enabled&&(this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,n=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(e){t.element[n](e,function(e){return t.set(e)},!1)})}},{key:"get",value:function(e){if(!t.enabled||!a.event(e))return null;var n,r=e.target,i=e.changedTouches[0],u=parseFloat(r.getAttribute("min"))||0,o=parseFloat(r.getAttribute("max"))||100,c=parseFloat(r.getAttribute("step"))||1,s=r.getBoundingClientRect(),f=100/s.width*(this.config.thumbWidth/2)/100;return 0>(n=100/s.width*(i.clientX-s.left))?n=0:100<n&&(n=100),50>n?n-=(100-2*n)*f:50<n&&(n+=2*(n-50)*f),u+l(n/100*(o-u),c)}},{key:"set",value:function(e){t.enabled&&a.event(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),function(e,t){if(e&&t){var n=new Event(t);e.dispatchEvent(n)}}(e.target,"touchend"===e.type?"change":"input"))}}])&&e(n.prototype,r),i&&e(n,i),t;var n,r,i}();document.addEventListener("DOMContentLoaded",function(){["dist/docs.svg"].forEach(function(e){var t=new XMLHttpRequest,n=document.body;"withCredentials"in t&&(t.open("GET",e,!0),t.onload=function(){var e=document.createElement("div");e.setAttribute("hidden",""),e.innerHTML=t.responseText,n.insertBefore(e,n.childNodes[0])},t.send())}),window.shr.setup({count:{classname:"btn__count"}}),f.setup(".js-example",{thumbWidth:20})})});
!function(){"use strict";function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var t={addCSS:!0,thumbWidth:15,watch:!0};var n=function(e){return null!=e?e.constructor:null},r=function(e,t){return!!(e&&t&&e instanceof t)},i=function(e){return null==e},u=function(e){return n(e)===Object},o=function(e){return n(e)===String},a=function(e){return Array.isArray(e)},c=function(e){return r(e,NodeList)},l={nullOrUndefined:i,object:u,number:function(e){return n(e)===Number&&!Number.isNaN(e)},string:o,boolean:function(e){return n(e)===Boolean},function:function(e){return n(e)===Function},array:a,nodeList:c,element:function(e){return r(e,Element)},event:function(e){return r(e,Event)},empty:function(e){return i(e)||(o(e)||a(e)||c(e))&&!e.length||u(e)&&!Object.keys(e).length}};function s(e,t){if(1>t){var n=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}var f=function(){function n(e,r){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,n),l.element(e)?this.element=e:l.string(e)&&(this.element=document.querySelector(e)),l.element(this.element)&&l.empty(this.element.rangeTouch)&&(this.config=Object.assign({},t,r),this.init())}return r=n,u=[{key:"setup",value:function(e){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=null;if(l.empty(e)||l.string(e)?i=Array.from(document.querySelectorAll(l.string(e)?e:'input[type="range"]')):l.element(e)?i=[e]:l.nodeList(e)?i=Array.from(e):l.array(e)&&(i=e.filter(l.element)),l.empty(i))return null;var u=Object.assign({},t,r);l.string(e)&&u.watch&&new MutationObserver(function(t){Array.from(t).forEach(function(t){Array.from(t.addedNodes).forEach(function(t){l.element(t)&&function(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}(t,e)&&new n(t,u)})})}).observe(document.body,{childList:!0,subtree:!0});return i.map(function(e){return new n(e,r)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}],(i=[{key:"init",value:function(){n.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){n.enabled&&(this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,n=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(e){t.element[n](e,function(e){return t.set(e)},!1)})}},{key:"get",value:function(e){if(!n.enabled||!l.event(e))return null;var t,r=e.target,i=e.changedTouches[0],u=parseFloat(r.getAttribute("min"))||0,o=parseFloat(r.getAttribute("max"))||100,a=parseFloat(r.getAttribute("step"))||1,c=r.getBoundingClientRect(),f=100/c.width*(this.config.thumbWidth/2)/100;return 0>(t=100/c.width*(i.clientX-c.left))?t=0:100<t&&(t=100),50>t?t-=(100-2*t)*f:50<t&&(t+=2*(t-50)*f),u+s(t/100*(o-u),a)}},{key:"set",value:function(e){n.enabled&&l.event(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),function(e,t){if(e&&t){var n=new Event(t);e.dispatchEvent(n)}}(e.target,"touchend"===e.type?"change":"input"))}}])&&e(r.prototype,i),u&&e(r,u),n;var r,i,u}(),d=function(e){var t=new XMLHttpRequest,n=document.body;"withCredentials"in t&&(t.open("GET",e,!0),t.onload=function(){var e=document.createElement("div");e.setAttribute("hidden",""),e.innerHTML=t.responseText,n.insertBefore(e,n.childNodes[0])},t.send())};document.addEventListener("DOMContentLoaded",function(){["dist/docs.svg"].forEach(d),window.shr.setup({count:{classname:"btn__count"}}),f.setup(".js-example",{thumbWidth:20})})}();

@@ -7,27 +7,28 @@ // ==========================================================================

document.addEventListener('DOMContentLoaded', () => {
const loadSprite = url => {
const xhr = new XMLHttpRequest();
const { body } = document;
const loadSprite = url => {
const xhr = new XMLHttpRequest();
const { body } = document;
// Check for CORS support
// If you're loading from same domain, you can remove the whole if/else statement
// XHR for Chrome/Firefox/Opera/Safari/IE10+
if (!('withCredentials' in xhr)) {
return;
}
// Check for CORS support
// If you're loading from same domain, you can remove the whole if/else statement
// XHR for Chrome/Firefox/Opera/Safari/IE10+
if (!('withCredentials' in xhr)) {
return;
}
xhr.open('GET', url, true);
xhr.open('GET', url, true);
// Inject hidden div with sprite on load
xhr.onload = () => {
const container = document.createElement('div');
container.setAttribute('hidden', '');
container.innerHTML = xhr.responseText;
body.insertBefore(container, body.childNodes[0]);
};
xhr.send();
// Inject hidden div with sprite on load
xhr.onload = () => {
const container = document.createElement('div');
container.setAttribute('hidden', '');
container.innerHTML = xhr.responseText;
body.insertBefore(container, body.childNodes[0]);
};
xhr.send();
};
document.addEventListener('DOMContentLoaded', () => {
// Load the sprite
['dist/docs.svg'].forEach(loadSprite);

@@ -44,10 +45,2 @@

RangeTouch.setup('.js-example', { thumbWidth: 20 });
// Test MutationObserver
/* setTimeout(() => {
const input = document.createElement('input');
input.type = 'range';
input.className = 'js-example';
document.getElementById('test').appendChild(input);
}, 2000); */
});

@@ -21,9 +21,8 @@ // ==========================================================================

// SVGs
// Images
const svgstore = require('gulp-svgstore');
const svgmin = require('gulp-svgmin');
const imagemin = require('gulp-imagemin');
// Utils
const plumber = require('gulp-plumber');
const concat = require('gulp-concat');
const rename = require('gulp-rename');

@@ -37,3 +36,2 @@ const replace = require('gulp-replace');

const publish = require('gulp-awspublish');
const open = require('gulp-open');

@@ -66,4 +64,2 @@ const pkg = require('./package.json');

},
// Output paths
output: path.join(root, 'dist/'),
},

@@ -78,3 +74,3 @@ docs: {

// Output paths
output: path.join(root, 'docs/dist/'),
dist: path.join(root, 'docs/dist/'),
// Docs

@@ -112,111 +108,74 @@ root: path.join(root, 'docs/'),

// JavaScript
// Formats to build
const formats = {
es: {
ext: 'mjs',
polyfill: false,
},
umd: {
ext: 'js',
polyfill: false,
},
};
const namespace = 'RangeTouch';
const build = {
js: (files, bundle) => {
Object.entries(formats).forEach(([format, task]) => {
Object.keys(files).forEach(key => {
const name = `js-${key}`;
tasks.js.push(name);
Object.entries(bundles.js).forEach(([filename, entry]) => {
entry.formats.forEach(format => {
const name = `js:${filename}:${format}`;
tasks.js.push(name);
gulp.task(name, () => {
return gulp
.src(bundles[bundle].js[key])
.pipe(plumber())
.pipe(concat(key))
.pipe(sourcemaps.init())
.pipe(
rollup(
{
plugins: [resolve(), commonjs(), babel(babelrc)],
},
{
name: namespace,
// exports: 'named',
format,
},
),
)
.pipe(terser())
.pipe(
rename({
extname: `.${task.ext}`,
}),
)
.pipe(size(sizeOptions))
.pipe(gulp.dest(paths[bundle].output));
});
});
});
},
less: (files, bundle) => {
Object.keys(files).forEach(key => {
const name = `less-${key}`;
tasks.less.push(name);
gulp.task(name, () => {
return gulp
.src(bundles[bundle].less[key])
.pipe(less())
.pipe(concat(key))
.pipe(
prefix(browserslist, {
cascade: false,
}),
)
.pipe(clean())
.pipe(size(sizeOptions))
.pipe(gulp.dest(paths[bundle].output));
});
});
},
sprite: bundle => {
const name = `sprite-${bundle}`;
tasks.sprite.push(name);
// Process Icons
gulp.task(name, () => {
return gulp
.src(paths[bundle].src.sprite)
.src(entry.src)
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(
svgmin({
plugins: [
{
removeDesc: true,
},
],
}),
rollup(
{
plugins: [resolve(), commonjs(), babel(babelrc)],
},
{
name: namespace,
// exports: 'named',
format,
},
),
)
.pipe(svgstore())
.pipe(terser())
.pipe(
rename({
basename: bundle === 'rangetouch' ? 'sprite' : bundle,
extname: `.${format === 'es' ? 'mjs' : 'js'}`,
}),
)
.pipe(size(sizeOptions))
.pipe(gulp.dest(paths[bundle].output));
.pipe(gulp.dest(entry.dist));
});
},
};
});
});
// Core files
build.js(bundles.rangetouch.js, 'rangetouch');
// CSS
// Docs files
build.less(bundles.docs.less, 'docs');
build.js(bundles.docs.js, 'docs');
build.sprite('docs');
Object.entries(bundles.css).forEach(([filename, entry]) => {
const name = `less:${filename}`;
tasks.less.push(name);
gulp.task(name, () => {
return gulp
.src(entry.src)
.pipe(less())
.pipe(
prefix(browserslist, {
cascade: false,
}),
)
.pipe(clean())
.pipe(size(sizeOptions))
.pipe(gulp.dest(entry.dist));
});
});
// SVG Sprite
const name = 'sprite';
tasks.sprite.push(name);
gulp.task(name, () => {
return gulp
.src(paths.docs.src.sprite)
.pipe(imagemin())
.pipe(svgstore())
.pipe(rename({ basename: 'docs' }))
.pipe(size(sizeOptions))
.pipe(gulp.dest(paths.docs.dist));
});
// Build all JS

@@ -305,6 +264,27 @@ gulp.task('js', gulp.parallel(...tasks.js));

// Replace versions in rangetouch.js
gulp.task('docs:svg', () => {
const { domain, publisher } = deploy.cdn;
if (!publisher) {
throw new Error('No publisher instance. Check AWS configuration.');
}
return gulp
.src(path.join(root, 'docs/dist/docs.js'))
.pipe(replace(localpath, `https://${domain}/${version}`))
.pipe(
rename(path => {
path.dirname = path.dirname.replace('.', version);
}),
)
.pipe(publisher.publish(headers.cdn))
.pipe(publish.reporter());
});
// Replace local file paths with remote paths in docs
// e.g. "../dist/rangetouch.js" to "https://cdn.rangetouch.com/x.x.x/rangetouch.js"
gulp.task('docs:paths', () => {
const { domain, publisher } = deploy.docs;
const { publisher } = deploy.docs;
const { domain } = deploy.cdn;

@@ -324,3 +304,4 @@ if (!publisher) {

gulp.task('docs:error', () => {
const { domain, publisher } = deploy.docs;
const { publisher } = deploy.docs;
const { domain } = deploy.cdn;

@@ -339,21 +320,5 @@ if (!publisher) {

// Publish to Docs bucket
gulp.task('docs', gulp.parallel('docs:readme', 'docs:src', 'docs:paths', 'docs:error'));
gulp.task('docs', gulp.parallel('docs:readme', 'docs:src', 'docs:svg', 'docs:paths', 'docs:error'));
// Open the docs site to check it's sweet
gulp.task('open', () => {
const { bucket } = deploy.docs;
log(`Opening ${bucket}...`);
// A file must be specified or gulp will skip the task
// Doesn't matter which file since we set the URL above
// Weird, I know...
return gulp.src([`${paths.docs.root}index.html`]).pipe(
open('', {
url: `https://${bucket}`,
}),
);
});
// Do everything
gulp.task('deploy', gulp.series(gulp.parallel(...tasks.js, ...tasks.less, ...tasks.sprite), 'cdn', 'docs'));
{
"name": "rangetouch",
"version": "2.0.0-beta.1",
"version": "2.0.0",
"description": "A super tiny library to make input type='range' sliders work better on touch devices",

@@ -47,5 +47,3 @@ "homepage": "https://rangetouch.com",

"gulp-clean-css": "^4.0.0",
"gulp-concat": "^2.6.1",
"gulp-less": "^4.0.1",
"gulp-open": "^3.0.1",
"gulp-plumber": "^1.2.1",

@@ -57,3 +55,3 @@ "gulp-rename": "^1.4.0",

"gulp-sourcemaps": "^2.6.4",
"gulp-svgmin": "^2.1.0",
"gulp-imagemin": "^5.0.3",
"gulp-svgstore": "^7.0.1",

@@ -63,13 +61,12 @@ "gulp-terser": "^1.1.7",

"prettier-stylelint": "^0.4.2",
"rollup-plugin-babel": "^4.0.3",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-uglify": "^6.0.0",
"run-sequence": "^2.2.1",
"stylelint": "^9.7.1",
"stylelint": "^9.10.1",
"stylelint-config-prettier": "^4.0.0",
"stylelint-config-recommended": "^2.1.0",
"stylelint-order": "^1.0.0"
"stylelint-order": "^2.0.0"
}
}
// ==========================================================================
// rangetouch.js v2.0.0-beta.1
// rangetouch.js v2.0.0
// Making <input type="range"> work on touch devices

@@ -8,2 +8,3 @@ // https://github.com/sampotts/rangetouch

import defaults from './config';
import { matches } from './utils/css';

@@ -14,8 +15,2 @@ import { trigger } from './utils/events';

const defaults = {
addCSS: true, // Add CSS to the element to improve usability (required here or in your CSS!)
thumbWidth: 15, // The width of the thumb handle
watch: true, // Watch for new elements that match a string target
};
class RangeTouch {

@@ -22,0 +17,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc