diff --git a/.gitignore b/.gitignore index ecae11e..74c3634 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ test.html node_modules/ +dist/ffnm.min.js.map +package-lock.json diff --git a/README.md b/README.md index 11f19a7..6014ae2 100644 --- a/README.md +++ b/README.md @@ -84,14 +84,20 @@ class:toggle('show', '#menu') ## Development +### Install + +```javascript +npm i +``` + ### Build ```javascript -tsc --outFile dist/ffnm.min.js src/core.ts +gulp ``` ### Watch mode ```javascript -tsc --watch --outFile dist/ffnm.min.js src/core.ts +gulp dev ``` diff --git a/dist/ffnm.min.js b/dist/ffnm.min.js index 7a74cc9..aa1912f 100644 --- a/dist/ffnm.min.js +++ b/dist/ffnm.min.js @@ -1,31 +1,2 @@ -//=== -// VARIABLES -//=== -var EVENTS; -(function (EVENTS) { - EVENTS[EVENTS["i-click"] = 0] = "i-click"; - EVENTS[EVENTS["i-scroll-up"] = 1] = "i-scroll-up"; - EVENTS[EVENTS["i-scroll-down"] = 2] = "i-scroll-down"; - EVENTS[EVENTS["i-hover"] = 3] = "i-hover"; -})(EVENTS || (EVENTS = {})); -//=== -// FUNCTIONS -//=== -function validateSyntax() { - // Get every items from EVENTS - var eventsKeys = R.filter(function (key) { return !isNaN(Number(EVENTS[key])); }, Object.keys(EVENTS)); - // Check all event syntax - return eventsKeys.map(function (event) { - return R.map(function (element) { - console.log(element.getAttribute(event)); - return /^${event}/.test(element.getAttribute(event)); - }, document.querySelectorAll("[" + event + "]")).every(function (item) { return item; }); - }).every(function (event) { return event; }); -} -//=== -// LINTER -//=== -//=== -// INIT -//=== -validateSyntax(); +"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,n){"object"==("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).R={})}(void 0,function(t){function a(t){return null!=t&&"object"==_typeof(t)&&!0===t["@@functional/placeholder"]}function o(r){return function t(n){return 0===arguments.length||a(n)?t:r.apply(this,arguments)}}function n(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return a(n)?t:o(function(t){return e(n,t)});default:return a(n)&&a(r)?t:a(n)?o(function(t){return e(t,r)}):a(r)?o(function(t){return e(n,t)}):e(n,r)}}}var r=n(function(t,n){return+t+ +n});function i(t,n){for(var r=(t=t||[]).length,e=(n=n||[]).length,u=[],i=0;i":sn(t,n)}function t(n,t){return x(function(t){return tn(t)+": "+u(n[t])},t.slice().sort())}switch(Object.prototype.toString.call(r)){case"[object Arguments]":return"(function() { return arguments; }("+x(u,r).join(", ")+"))";case"[object Array]":return"["+x(u,r).concat(t(r,fn(function(t){return/^\d+$/.test(t)},B(r)))).join(", ")+"]";case"[object Boolean]":return"object"==_typeof(r)?"new Boolean("+u(r.valueOf())+")":""+r;case"[object Date]":return"new Date("+(isNaN(r.valueOf())?u(NaN):tn(rn(r)))+")";case"[object Null]":return"null";case"[object Number]":return"object"==_typeof(r)?"new Number("+u(r.valueOf())+")":1/r==-1/0?"-0":r.toString(10);case"[object String]":return"object"==_typeof(r)?"new String("+u(r.valueOf())+")":tn(r);case"[object Undefined]":return"undefined";default:if("function"==typeof r.toString){var n=""+r;if("[object Object]"!=n)return n}return"{"+t(r,B(r)).join(", ")+"}"}}var ln=o(function(t){return sn(t,[])}),pn=n(function(t,n){if(p(t)){if(p(n))return t.concat(n);throw new TypeError(ln(n)+" is not an array")}if(w(t)){if(w(n))return t+n;throw new TypeError(ln(n)+" is not a string")}if(null!=t&&yt(t["fantasy-land/concat"]))return t["fantasy-land/concat"](n);if(null!=t&&yt(t.concat))return t.concat(n);throw new TypeError(ln(t)+' does not have a method named "concat" or "fantasy-land/concat"')}),hn=o(function(n){return f($(b,0,U(function(t){return t[0].length},n)),function(){for(var t=0;tt(n)?r:n}),le=$(r,0),pe=o(function(t){return le(t)/t.length}),he=o(function(t){var n=t.length;if(0===n)return NaN;var r=2-n%2,e=(n-r)/2;return pe(Array.prototype.slice.call(t,0).sort(function(t,n){return t { + return R.map((element) => { + console.log(element.getAttribute(event)); + return /^${event}/.test(element.getAttribute(event)); + }, document.querySelectorAll(`[${event}]`)).every(item => item); + }).every(event => event); +} + + +//=== +// LINTER +//=== + + +//=== +// INIT +//=== +validateSyntax(); diff --git a/src/core.ts b/src/core.ts deleted file mode 100644 index a3276e9..0000000 --- a/src/core.ts +++ /dev/null @@ -1,33 +0,0 @@ - -//=== -// VARIABLES -//=== -enum EVENTS {'i-click', 'i-scroll-up', 'i-scroll-down', 'i-hover'} - -//=== -// FUNCTIONS -//=== -function validateSyntax(): boolean { - - // Get every items from EVENTS - let eventsKeys: string[] = R.filter(key => !isNaN(Number(EVENTS[key])), Object.keys(EVENTS)); - - // Check all event syntax - return eventsKeys.map((event) => { - return R.map((element) => { - console.log(element.getAttribute(event)) - return /^${event}/.test(element.getAttribute(event)) - }, document.querySelectorAll(`[${event}]`)).every(item => item) - }).every(event => event) -} - - -//=== -// LINTER -//=== - - -//=== -// INIT -//=== -validateSyntax()