diff --git a/bower.json b/bower.json index 809598a5..bb29284d 100644 --- a/bower.json +++ b/bower.json @@ -35,6 +35,6 @@ "jquery": "3.2.1", "fancybox": "^2.1.6", "philip": "1.3.6", - "smalltalk": "2.2.1" + "smalltalk": "2.3.1" } } diff --git a/modules/philip/.bower.json b/modules/philip/.bower.json index 36ddf899..cf8380e9 100644 --- a/modules/philip/.bower.json +++ b/modules/philip/.bower.json @@ -33,7 +33,6 @@ "commit": "7475a4547d8a8abe3f615ac983a41ef26d14509b" }, "_source": "https://github.com/coderaiser/domfs-philip.git", - "_target": "^1.3.6", - "_originalSource": "philip", - "_direct": true + "_target": "1.3.6", + "_originalSource": "philip" } \ No newline at end of file diff --git a/modules/smalltalk/.bower.json b/modules/smalltalk/.bower.json index ad2c7f53..19194f8b 100644 --- a/modules/smalltalk/.bower.json +++ b/modules/smalltalk/.bower.json @@ -21,18 +21,19 @@ "**/.*", "screen", "example", - "test" + "test", + "webpack.config.js" ], "dependencies": {}, - "version": "2.2.1", - "_release": "2.2.1", + "version": "2.3.1", + "_release": "2.3.1", "_resolution": { "type": "version", - "tag": "v2.2.1", - "commit": "6f932632431f39e2646d9a9c3551c12f45d56971" + "tag": "v2.3.1", + "commit": "fffdfc6c567ae774f6fbf033b74788aa366317dc" }, "_source": "https://github.com/coderaiser/smalltalk.git", - "_target": "^2.2.1", + "_target": "^2.3.1", "_originalSource": "smalltalk", "_direct": true } \ No newline at end of file diff --git a/modules/smalltalk/ChangeLog b/modules/smalltalk/ChangeLog index ccff021f..c05b1ffa 100644 --- a/modules/smalltalk/ChangeLog +++ b/modules/smalltalk/ChangeLog @@ -1,3 +1,21 @@ +2017.05.17, v2.3.1 + +feature: +- (bower) ignore: add webpack.config.js + + +2017.05.17, v2.3.0 + +feature: +- (package) browserify -> webpack: add sourcemaps + + +2017.05.16, v2.2.2 + +fix: +- (smalltalk) prompt value is a number + + 2017.05.10, v2.2.1 fix: diff --git a/modules/smalltalk/README.md b/modules/smalltalk/README.md index 30690ec6..5a5a1df6 100644 --- a/modules/smalltalk/README.md +++ b/modules/smalltalk/README.md @@ -1,6 +1,5 @@ # Smalltalk [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage][CoverageIMGURL]][CoverageURL] - Simple [Promise](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise)-based replacement of native Alert, Confirm and Prompt. # Install @@ -69,7 +68,7 @@ When `webpack` `rollup` or `browserify` used, you can import `es5` version with: import smalltalk from 'smalltalk/legacy'; ``` -#License +# License MIT [NPMIMGURL]: https://img.shields.io/npm/v/smalltalk.svg?style=flat diff --git a/modules/smalltalk/bower.json b/modules/smalltalk/bower.json index 23dc1c14..e2d28370 100644 --- a/modules/smalltalk/bower.json +++ b/modules/smalltalk/bower.json @@ -21,7 +21,8 @@ "**/.*", "screen", "example", - "test" + "test", + "webpack.config.js" ], "dependencies": {} } diff --git a/modules/smalltalk/dist/smalltalk.min.css b/modules/smalltalk/dist/smalltalk.min.css index 7c559a57..f52dbba9 100644 --- a/modules/smalltalk/dist/smalltalk.min.css +++ b/modules/smalltalk/dist/smalltalk.min.css @@ -1 +1,2 @@ -.smalltalk{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:.2s opacity;transition:.2s opacity;bottom:0;left:0;overflow:auto;padding:20px;position:fixed;right:0;top:0;z-index:100}.smalltalk .page .content-area,.smalltalk .page header{overflow:hidden;text-overflow:ellipsis;max-width:500px}.smalltalk+.smalltalk{-webkit-transition:ease 1s;transition:ease 1s;display:none}.smalltalk .page{border-radius:3px;background:#fff;-webkit-box-shadow:0 4px 23px 5px rgba(0,0,0,.2),0 2px 6px rgba(0,0,0,.15);box-shadow:0 4px 23px 5px rgba(0,0,0,.2),0 2px 6px rgba(0,0,0,.15);color:#333;min-width:400px;padding:0;position:relative;z-index:0}@media only screen and (max-width:500px){.smalltalk .page{min-width:0}}.smalltalk .page>.close-button{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAQAAAC1QeVaAAAAUklEQVR4XqXPYQrAIAhAYW/gXd8NJxTopVqsGEhtf+L9/ERU2k/HSMFQpKcYJeNFI9Be0LCMij8cYyjj5EHIivGBkwLfrbX3IF8PqumVmnDpEG+eDsKibPG2JwAAAABJRU5ErkJggg==);background-position:center;background-repeat:no-repeat;height:14px;position:absolute;right:7px;top:7px;width:14px;z-index:1}.smalltalk .page>.close-button:hover{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAQAAAC1QeVaAAAAnUlEQVR4XoWQQQ6CQAxFewjkJkMCyXgJPMk7AiYczyBeZEAX6AKctGIaN+bt+trk9wtGQc/IkhnoKGxqqiWxOSZalapWFZ6VrIUDExsN0a5JRBq9LoVOR0eEQMoEhKizXhhsn0p1sCWVo7CwOf1RytPL8CPvwuBUoHL6ugeK30CVD1TqK7V/hdpe+VNChhOzV8xWny/+xosHF8578W/Hmc1OOC3wmwAAAABJRU5ErkJggg==)}.smalltalk .page header{white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:#333;font-size:120%;font-weight:700;margin:0;padding:14px 17px;text-shadow:#fff 0 1px 2px}.smalltalk .page .content-area{padding:6px 17px;position:relative}.smalltalk .page .action-area{padding:14px 17px}.smalltalk .page .button-strip{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.smalltalk .page .button-strip>button{margin-left:10px}.smalltalk button:enabled:active{background-image:-webkit-gradient(linear,left top,left bottom,from(#e7e7e7),color-stop(38%,#e7e7e7),to(#d7d7d7));background-image:linear-gradient(#e7e7e7,#e7e7e7 38%,#d7d7d7);-webkit-box-shadow:none;box-shadow:none;text-shadow:none}.smalltalk .smalltalk,.smalltalk button{min-height:2em;min-width:4em}.smalltalk button::-moz-focus-inner{border:0}.smalltalk button{-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:-webkit-gradient(linear,left top,left bottom,from(#ededed),color-stop(38%,#ededed),to(#dedede));background-image:linear-gradient(#ededed,#ededed 38%,#dedede);border:1px solid rgba(0,0,0,.25);border-radius:2px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.08),inset 0 1px 2px rgba(255,255,255,.75);box-shadow:0 1px 0 rgba(0,0,0,.08),inset 0 1px 2px rgba(255,255,255,.75);color:#444;font:inherit;margin:0 1px 0 0;text-shadow:0 1px 0 #f0f0f0}.smalltalk button:enabled:focus,.smalltalk input:enabled:focus{-webkit-transition:border-color .2s;transition:border-color .2s;border-color:#4d90fe;outline:0}.smalltalk input{width:100%;border:1px solid #bfbfbf;border-radius:2px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#444;font:inherit;margin:0;min-height:2em;padding:3px;outline:0}button{font-family:Ubuntu,Arial,sans-serif} +.smalltalk{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:.2s opacity;transition:.2s opacity;bottom:0;left:0;overflow:auto;padding:20px;position:fixed;right:0;top:0;z-index:100}.smalltalk .page .content-area,.smalltalk .page header{overflow:hidden;text-overflow:ellipsis;max-width:500px}.smalltalk+.smalltalk{-webkit-transition:ease 1s;transition:ease 1s;display:none}.smalltalk .page{border-radius:3px;background:#fff;-webkit-box-shadow:0 4px 23px 5px rgba(0,0,0,.2),0 2px 6px rgba(0,0,0,.15);box-shadow:0 4px 23px 5px rgba(0,0,0,.2),0 2px 6px rgba(0,0,0,.15);color:#333;min-width:400px;padding:0;position:relative;z-index:0}@media only screen and (max-width:500px){.smalltalk .page{min-width:0}}.smalltalk .page>.close-button{background-image:url(../img/IDR_CLOSE_DIALOG.png);background-position:center;background-repeat:no-repeat;height:14px;position:absolute;right:7px;top:7px;width:14px;z-index:1}.smalltalk .page>.close-button:hover{background-image:url(../img/IDR_CLOSE_DIALOG_H.png)}.smalltalk .page header{white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:#333;font-size:120%;font-weight:700;margin:0;padding:14px 17px;text-shadow:#fff 0 1px 2px}.smalltalk .page .content-area{padding:6px 17px;position:relative}.smalltalk .page .action-area{padding:14px 17px}.smalltalk .page .button-strip{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.smalltalk .page .button-strip>button{margin-left:10px}.smalltalk button:enabled:active{background-image:-webkit-gradient(linear,left top,left bottom,from(#e7e7e7),color-stop(38%,#e7e7e7),to(#d7d7d7));background-image:linear-gradient(#e7e7e7,#e7e7e7 38%,#d7d7d7);-webkit-box-shadow:none;box-shadow:none;text-shadow:none}.smalltalk .smalltalk,.smalltalk button{min-height:2em;min-width:4em}.smalltalk button::-moz-focus-inner{border:0}.smalltalk button{-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:-webkit-gradient(linear,left top,left bottom,from(#ededed),color-stop(38%,#ededed),to(#dedede));background-image:linear-gradient(#ededed,#ededed 38%,#dedede);border:1px solid rgba(0,0,0,.25);border-radius:2px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.08),inset 0 1px 2px rgba(255,255,255,.75);box-shadow:0 1px 0 rgba(0,0,0,.08),inset 0 1px 2px rgba(255,255,255,.75);color:#444;font:inherit;margin:0 1px 0 0;text-shadow:0 1px 0 #f0f0f0}.smalltalk button:enabled:focus,.smalltalk input:enabled:focus{-webkit-transition:border-color .2s;transition:border-color .2s;border-color:#4d90fe;outline:0}.smalltalk input{width:100%;border:1px solid #bfbfbf;border-radius:2px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#444;font:inherit;margin:0;min-height:2em;padding:3px;outline:0}button{font-family:Ubuntu,Arial,sans-serif} +/*# sourceMappingURL=smalltalk.min.css.map */ \ No newline at end of file diff --git a/modules/smalltalk/dist/smalltalk.min.js b/modules/smalltalk/dist/smalltalk.min.js index 08bbd8be..fb8ac210 100644 --- a/modules/smalltalk/dist/smalltalk.min.js +++ b/modules/smalltalk/dist/smalltalk.min.js @@ -1 +1,2 @@ -!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.smalltalk=n()}}(function(){return function n(t,e,r){function o(i,a){if(!e[i]){if(!t[i]){var c="function"==typeof require&&require;if(!a&&c)return c(i,!0);if(u)return u(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var l=e[i]={exports:{}};t[i][0].call(l.exports,function(n){var e=t[i][1][n];return o(e?e:n)},l,l.exports,n,t,e,r)}return e[i].exports}for(var u="function"==typeof require&&require,i=0;i=t.length)return t.apply(void 0,r(e));var a=function(){return n.apply(void 0,[t].concat(r(e),Array.prototype.slice.call(arguments)))},c=t.length-arguments.length,f=i(a)[c];return f||a}},{}],smalltalk:[function(n,t,e){"use strict";function r(n,t,e,r){return'
\n
\n
'+n+'
\n
\n '+t+"\n "+e+'\n
\n
\n
'+r.map(function(n,t){return""}).join("")+"\n
\n
\n
"}function o(n,t,e,o,u){var i=E(),a=E(),c=document.createElement("div"),s=["cancel","close","ok"],p=new Promise(function(n,t){var e=u&&!u.cancel,r=function(){};i(n),a(e?r:t)}),v=r(n,t,e,o);return c.innerHTML=v,c.className="smalltalk",document.body.appendChild(c),l(c,["ok","input"]).forEach(function(n){return n.focus()}),l(c,["input"]).forEach(function(n){n.setSelectionRange(0,e.length)}),d("click",c,s,function(n){return f(n.target,c,i(),a())}),["click","contextmenu"].forEach(function(n){return c.addEventListener(n,function(){return l(c,["ok","input"]).forEach(function(n){return n.focus()})})}),c.addEventListener("keydown",y(c,i(),a())),p}function u(n,t,e,r){var o={ENTER:13,ESC:27,TAB:9,LEFT:37,UP:38,RIGHT:39,DOWN:40},u=r.keyCode,d=r.target,s=["ok","cancel","input"],p=l(n,s).map(i);switch(u){case o.ENTER:f(d,n,t,e),r.preventDefault();break;case o.ESC:m(),e();break;case o.TAB:r.shiftKey&&c(n,p),c(n,p),r.preventDefault();break;default:["left","right","up","down"].filter(function(n){return u===o[n.toUpperCase()]}).forEach(function(){a(n,p)})}r.stopPropagation()}function i(n){return n.getAttribute("data-name").replace("js-","")}function a(n,t){var e=document.activeElement,r=i(e),o=/ok|cancel/.test(r),u=t.length-1,a=function(n){return"cancel"===n?"ok":"cancel"};if("input"!==r&&u&&o){var c=a(r);l(n,[c]).forEach(function(n){n.focus()})}}function c(n,t){var e=document.activeElement,r=i(e),o=t.length-1,u=t.indexOf(r),a=k(o,u),c=t[a];l(n,[c]).forEach(function(n){return n.focus()})}function f(n,t,e,r){var o=n.getAttribute("data-name").replace("js-","");if(/close|cancel/.test(o))return r(),void m();var u=l(t,["input"]).reduce(function(n,t){return t.value},null);e(u),m()}function l(n,t){var e=function(n){return n},r=t.map(function(t){return n.querySelector('[data-name="js-'+t+'"]')}).filter(e);return r}function d(n,t,e,r){l(t,e).forEach(function(t){return t.addEventListener(n,r)})}function s(n){var t=document.querySelector(n);t.parentElement.removeChild(t)}function p(n){for(var t=arguments.length,e=Array(t>1?t-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:"",r=arguments[3],u=e.replace(/\"/g,"""),i='';return o(n,t,i,g,r)},e.confirm=function(n,t,e){return o(n,t,"",g,e)};var E=function(){var n=void 0;return function(){for(var t=arguments.length,e=Array(t),r=0;r\n
\n
'+n+'
\n
\n '+t+"\n "+e+'\n
\n
\n
'+r.map(function(n,t){return""}).join("")+"\n
\n
\n "}function o(n,t,e,o,u){var c=g(),i=g(),a=document.createElement("div"),p=["cancel","close","ok"],d=new Promise(function(n,t){var e=u&&!u.cancel,r=function(){};c(n),i(e?r:t)}),m=r(n,t,e,o);return a.innerHTML=m,a.className="smalltalk",document.body.appendChild(a),l(a,["ok","input"]).forEach(function(n){return n.focus()}),l(a,["input"]).forEach(function(n){n.setSelectionRange(0,e.length)}),s("click",a,p,function(n){return f(n.target,a,c(),i())}),["click","contextmenu"].forEach(function(n){return a.addEventListener(n,function(){return l(a,["ok","input"]).forEach(function(n){return n.focus()})})}),a.addEventListener("keydown",v(a,c(),i())),d}function u(n,t,e,r){var o={ENTER:13,ESC:27,TAB:9,LEFT:37,UP:38,RIGHT:39,DOWN:40},u=r.keyCode,s=r.target,p=["ok","cancel","input"],d=l(n,p).map(c);switch(u){case o.ENTER:f(s,n,t,e),r.preventDefault();break;case o.ESC:m(),e();break;case o.TAB:r.shiftKey&&a(n,d),a(n,d),r.preventDefault();break;default:["left","right","up","down"].filter(function(n){return u===o[n.toUpperCase()]}).forEach(function(){i(n,d)})}r.stopPropagation()}function c(n){return n.getAttribute("data-name").replace("js-","")}function i(n,t){var e=document.activeElement,r=c(e),o=/ok|cancel/.test(r),u=t.length-1;if("input"!==r&&u&&o){l(n,[function(n){return"cancel"===n?"ok":"cancel"}(r)]).forEach(function(n){n.focus()})}}function a(n,t){var e=document.activeElement,r=c(e),o=t.length-1,u=t.indexOf(r);l(n,[t[E(o,u)]]).forEach(function(n){return n.focus()})}function f(n,t,e,r){if(/close|cancel/.test(n.getAttribute("data-name").replace("js-","")))return r(),void m();e(l(t,["input"]).reduce(function(n,t){return t.value},null)),m()}function l(n,t){var e=function(n){return n};return t.map(function(t){return n.querySelector('[data-name="js-'+t+'"]')}).filter(e)}function s(n,t,e,r){l(t,e).forEach(function(t){return t.addEventListener(n,r)})}function p(n){var t=document.querySelector(n);t.parentElement.removeChild(t)}window.Promise=window.Promise||e(0);var d=e(1),v=d(u),m=function(n){for(var t=arguments.length,e=Array(t>1?t-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:"",r=arguments[3];return o(n,t,'',y,r)},t.confirm=function(n,t,e){return o(n,t,"",y,e)};var g=function(){var n=void 0;return function(){for(var t=arguments.length,e=Array(t),r=0;r=t.length)return t.apply(void 0,r(e));var i=function(){return n.apply(void 0,[t].concat(r(e),Array.prototype.slice.call(arguments)))},a=t.length-arguments.length;return c(i)[a]||i}}]); +//# sourceMappingURL=smalltalk.min.js.map \ No newline at end of file diff --git a/modules/smalltalk/dist/smalltalk.native.min.js b/modules/smalltalk/dist/smalltalk.native.min.js index 811847f6..c5979cd0 100644 --- a/modules/smalltalk/dist/smalltalk.native.min.js +++ b/modules/smalltalk/dist/smalltalk.native.min.js @@ -1 +1,2 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.smalltalk=e()}}(function(){return function e(n,r,t){function o(i,u){if(!r[i]){if(!n[i]){var l="function"==typeof require&&require;if(!u&&l)return l(i,!0);if(f)return f(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var c=r[i]={exports:{}};n[i][0].call(c.exports,function(e){var r=n[i][1][e];return o(r?r:e)},c,c.exports,e,n,r,t)}return r[i].exports}for(var f="function"==typeof require&&require,i=0;i1)for(var r=1;r=t.length)return t.apply(void 0,r(e));var a=function(){return n.apply(void 0,[t].concat(r(e),Array.prototype.slice.call(arguments)))},c=t.length-arguments.length,f=i(a)[c];return f||a}},{}],smalltalk:[function(n,t,e){"use strict";function r(n,t,e,r){return'
\n
\n
'+n+'
\n
\n '+t+"\n "+e+'\n
\n
\n
'+r.map(function(n,t){return""}).join("")+"\n
\n
\n
"}function o(n,t,e,o,u){var i=E(),a=E(),c=document.createElement("div"),s=["cancel","close","ok"],p=new Promise(function(n,t){var e=u&&!u.cancel,r=function(){};i(n),a(e?r:t)}),v=r(n,t,e,o);return c.innerHTML=v,c.className="smalltalk",document.body.appendChild(c),l(c,["ok","input"]).forEach(function(n){return n.focus()}),l(c,["input"]).forEach(function(n){n.setSelectionRange(0,e.length)}),d("click",c,s,function(n){return f(n.target,c,i(),a())}),["click","contextmenu"].forEach(function(n){return c.addEventListener(n,function(){return l(c,["ok","input"]).forEach(function(n){return n.focus()})})}),c.addEventListener("keydown",y(c,i(),a())),p}function u(n,t,e,r){var o={ENTER:13,ESC:27,TAB:9,LEFT:37,UP:38,RIGHT:39,DOWN:40},u=r.keyCode,d=r.target,s=["ok","cancel","input"],p=l(n,s).map(i);switch(u){case o.ENTER:f(d,n,t,e),r.preventDefault();break;case o.ESC:m(),e();break;case o.TAB:r.shiftKey&&c(n,p),c(n,p),r.preventDefault();break;default:["left","right","up","down"].filter(function(n){return u===o[n.toUpperCase()]}).forEach(function(){a(n,p)})}r.stopPropagation()}function i(n){return n.getAttribute("data-name").replace("js-","")}function a(n,t){var e=document.activeElement,r=i(e),o=/ok|cancel/.test(r),u=t.length-1,a=function(n){return"cancel"===n?"ok":"cancel"};if("input"!==r&&u&&o){var c=a(r);l(n,[c]).forEach(function(n){n.focus()})}}function c(n,t){var e=document.activeElement,r=i(e),o=t.length-1,u=t.indexOf(r),a=k(o,u),c=t[a];l(n,[c]).forEach(function(n){return n.focus()})}function f(n,t,e,r){var o=n.getAttribute("data-name").replace("js-","");if(/close|cancel/.test(o))return r(),void m();var u=l(t,["input"]).reduce(function(n,t){return t.value},null);e(u),m()}function l(n,t){var e=function(n){return n},r=t.map(function(t){return n.querySelector('[data-name="js-'+t+'"]')}).filter(e);return r}function d(n,t,e,r){l(t,e).forEach(function(t){return t.addEventListener(n,r)})}function s(n){var t=document.querySelector(n);t.parentElement.removeChild(t)}function p(n){for(var t=arguments.length,e=Array(t>1?t-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:"",r=arguments[3],u=e.replace(/\"/g,"""),i='';return o(n,t,i,g,r)},e.confirm=function(n,t,e){return o(n,t,"",g,e)};var E=function(){var n=void 0;return function(){for(var t=arguments.length,e=Array(t),r=0;r1)for(var e=1;e\n
\n
'+t+'
\n
\n '+n+"\n "+e+'\n
\n
\n
'+r.map(function(t,n){return""}).join("")+"\n
\n
\n "}function o(t,n,e,o,i){var u=_(),c=_(),a=document.createElement("div"),h=["cancel","close","ok"],p=new Promise(function(t,n){var e=i&&!i.cancel,r=function(){};u(t),c(e?r:n)}),d=r(t,n,e,o);return a.innerHTML=d,a.className="smalltalk",document.body.appendChild(a),f(a,["ok","input"]).forEach(function(t){return t.focus()}),f(a,["input"]).forEach(function(t){t.setSelectionRange(0,e.length)}),l("click",a,h,function(t){return s(t.target,a,u(),c())}),["click","contextmenu"].forEach(function(t){return a.addEventListener(t,function(){return f(a,["ok","input"]).forEach(function(t){return t.focus()})})}),a.addEventListener("keydown",v(a,u(),c())),p}function i(t,n,e,r){var o={ENTER:13,ESC:27,TAB:9,LEFT:37,UP:38,RIGHT:39,DOWN:40},i=r.keyCode,l=r.target,h=["ok","cancel","input"],p=f(t,h).map(u);switch(i){case o.ENTER:s(l,t,n,e),r.preventDefault();break;case o.ESC:d(),e();break;case o.TAB:r.shiftKey&&a(t,p),a(t,p),r.preventDefault();break;default:["left","right","up","down"].filter(function(t){return i===o[t.toUpperCase()]}).forEach(function(){c(t,p)})}r.stopPropagation()}function u(t){return t.getAttribute("data-name").replace("js-","")}function c(t,n){var e=document.activeElement,r=u(e),o=/ok|cancel/.test(r),i=n.length-1;if("input"!==r&&i&&o){f(t,[function(t){return"cancel"===t?"ok":"cancel"}(r)]).forEach(function(t){t.focus()})}}function a(t,n){var e=document.activeElement,r=u(e),o=n.length-1,i=n.indexOf(r);f(t,[n[g(o,i)]]).forEach(function(t){return t.focus()})}function s(t,n,e,r){if(/close|cancel/.test(t.getAttribute("data-name").replace("js-","")))return r(),void d();e(f(n,["input"]).reduce(function(t,n){return n.value},null)),d()}function f(t,n){var e=function(t){return t};return n.map(function(n){return t.querySelector('[data-name="js-'+n+'"]')}).filter(e)}function l(t,n,e,r){f(n,e).forEach(function(n){return n.addEventListener(t,r)})}function h(t){var n=document.querySelector(t);n.parentElement.removeChild(n)}window.Promise=window.Promise||e(0);var p=e(4),v=p(i),d=function(t){for(var n=arguments.length,e=Array(n>1?n-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:"",r=arguments[3];return o(t,n,'',y,r)},n.confirm=function(t,n,e){return o(t,n,"",y,e)};var _=function(){var t=void 0;return function(){for(var n=arguments.length,e=Array(n),r=0;r=n.length)return n.apply(void 0,r(e));var c=function(){return t.apply(void 0,[n].concat(r(e),Array.prototype.slice.call(arguments)))},a=n.length-arguments.length;return u(c)[a]||c}}]); +//# sourceMappingURL=smalltalk.poly.min.js.map \ No newline at end of file diff --git a/modules/smalltalk/lib/smalltalk.js b/modules/smalltalk/lib/smalltalk.js index 9284f9b5..ead08640 100644 --- a/modules/smalltalk/lib/smalltalk.js +++ b/modules/smalltalk/lib/smalltalk.js @@ -1,5 +1,7 @@ 'use strict'; +window.Promise = window.Promise || require('es6-promise'); + const currify = require('currify/legacy'); const keyDown = currify(keyDown_); @@ -13,7 +15,7 @@ exports.alert = (title, msg) => { }; exports.prompt = (title, msg, value = '', options) => { - const val = value.replace(/\"/g, '"'); + const val = String(value).replace(/\"/g, '"'); const valueStr = ``; return showDialog(title, msg, valueStr, BUTTON_OK_CANCEL, options); diff --git a/modules/smalltalk/lib/smalltalk.native.js b/modules/smalltalk/lib/smalltalk.native.js index 582dd535..0003e5b4 100644 --- a/modules/smalltalk/lib/smalltalk.native.js +++ b/modules/smalltalk/lib/smalltalk.native.js @@ -1,7 +1,9 @@ 'use strict'; -exports.alert = (title, message) => { - const promise = new Promise(function(resolve) { +window.Promise = window.Promise || require('es6-promise'); + +exports.alert = (title, message) => { + const promise = new Promise((resolve) => { alert(message); resolve(); }); @@ -9,32 +11,33 @@ exports.alert = (title, message) => { return promise; }; -exports.prompt = (title, message, value, options) => { - const o = options, - promise = new Promise(function(resolve, reject) { - const noCancel = o && !o.cancel, - result = prompt(message, value); - - if (result !== null) - resolve(result); - else if (!noCancel) - reject(); - }); +exports.prompt = (title, message, value, options) => { + const o = options; + const promise = new Promise((resolve, reject) => { + const noCancel = o && !o.cancel; + const result = prompt(message, value); + + if (result !== null) + return resolve(result); + + if (!noCancel) + reject(); + }); return promise; }; -exports.confirm = (title, message, options) => { - const o = options, - noCancel = o && !o.cancel, - promise = new Promise(function(resolve, reject) { - const is = confirm(message); - - if (is || noCancel) - resolve(); - else - reject(); - }); +exports.confirm = (title, message, options) => { + const o = options; + const noCancel = o && !o.cancel; + const promise = new Promise((resolve, reject) => { + const is = confirm(message); + + if (is || noCancel) + return resolve(); + + reject(); + }); return promise; }; diff --git a/modules/smalltalk/package.json b/modules/smalltalk/package.json index 583386b1..bf3fb165 100644 --- a/modules/smalltalk/package.json +++ b/modules/smalltalk/package.json @@ -1,6 +1,6 @@ { "name": "smalltalk", - "version": "2.2.1", + "version": "2.3.1", "description": "Promise-based Alert, Confirm and Prompt replacement", "homepage": "http://github.com/coderaiser/smalltalk", "repository": { @@ -8,9 +8,6 @@ "url": "git://github.com/coderaiser/smalltalk.git" }, "main": "lib/smalltalk.js", - "config": { - "poly": "node_modules/promise-polyfill/promise.min.js" - }, "babel": { "presets": [ "es2015" @@ -18,33 +15,21 @@ }, "scripts": { "watch": "nodemon --watch lib --watch test --exec", + "watch:client": "redrun compile:client -- --watch", "watch:test": "npm run watch -- npm test", "watch:lint": "npm run watch -- 'npm run lint'", "watch:lint:js": "npm run watch -- \"run lint:js\"", "watch:coverage": "redrun watch -- redrun coverage", "coverage": "nyc npm test", "report": "nyc report --reporter=text-lcov | coveralls", - "compile:js": "babel -d legacy lib", - "compile:css": "postcss css/*.css -d dist --use autoprefixer", - "minify:css": "minify dist/smalltalk.css > dist/smalltalk.min.css", - "minify:js": "minify dist/smalltalk.js > dist/smalltalk.min.js", - "minify:js-native": "minify dist/smalltalk.native.js > dist/smalltalk.native.min.js", - "build:js-poly": "cat $npm_package_config_poly dist/smalltalk.min.js > dist/smalltalk.poly.min.js", - "build:js-poly-native": "cat $npm_package_config_poly dist/smalltalk.native.min.js > dist/smalltalk.native.poly.min.js", - "build:js-full": "redrun bundle:js minify:js build:js-poly", - "build:js-native-full": "redrun bundle:js:native minify:js-native build:js-poly-native", - "build": "redrun build:js build:css", - "build:js": "redrun compile:js build:js-full build:js-native-full legacy:index clean:js", - "build:css": "redrun compile:css minify:css clean:css", - "bundle:base": "browserify -s smalltalk --ng false", - "bundle:js": "redrun bundle:base -- -r ./legacy/smalltalk.js:smalltalk ./legacy/smalltalk.js -o dist/smalltalk.js", - "bundle:js:native": "redrun bundle:base -- -r ./legacy/smalltalk.native.js:smalltalk ./legacy/smalltalk.native.js -o dist/smalltalk.native.js", + "compile:server": "babel -d legacy lib", + "compile:client": "webpack --progress", + "compile:client:poly": "BUILD_TYPE=poly webpack --progress", + "build": "redrun clean build:js build:css", + "build:js": "redrun compile:* legacy:index", + "build:css": "postcss css/*.css -o dist/smalltalk.min.css -m --use autoprefixer postcss-clean", "legacy:index": "echo \"module.exports = require('./smalltalk');\" > legacy/index.js", - "clean:js": "rimraf dist/smalltalk.js dist/smalltalk.native.js", - "clean:css": "rimraf dist/smalltalk.css", - "bower": "bower", - "babel": "babel", - "minify": "minify", + "clean": "rimraf dist", "wisdom": "npm run build", "lint:css": "stylelint css/*.css", "lint:js": "jshint lib test && jscs lib test && eslint lib test", @@ -65,26 +50,28 @@ "devDependencies": { "autoprefixer": "^7.0.1", "babel-cli": "^6.1.1", + "babel-loader": "^7.0.0", "babel-preset-es2015": "^6.0.15", - "browserify": "^14.0.0", "coveralls": "^2.11.11", "eslint": "^3.0.1", + "glob": "^7.1.1", "jscs": "^3.0.3", "jshint": "^2.8.0", - "minify": "^2.0.0", "nodemon": "^1.9.2", "nyc": "^10.0.0", + "postcss-clean": "^1.0.2", "postcss-cli": "^4.0.0", - "promise-polyfill": "^6.0.0", "redrun": "^5.0.1", "rimraf": "^2.5.3", "sinon": "^2.0.0", "stylelint": "^7.0.2", "stylelint-config-standard": "^16.0.0", "systemjs": "^0.20.2", - "tape": "^4.6.0" + "tape": "^4.6.0", + "webpack": "^2.5.1" }, "dependencies": { - "currify": "^2.0.3" + "currify": "^2.0.3", + "es6-promise": "^4.1.0" } }