Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

riverjs

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

riverjs - npm Package Compare versions

Comparing version 1.0.83 to 1.0.84

2

bower.json
{
"name": "riverjs",
"version": "1.0.83",
"version": "1.0.84",
"main": "dist/river.js",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/zhang-ning/RiverJS",

@@ -753,13 +753,11 @@ /*

});
define('river.grammer.jcompile',function(){
return function(){
define('river.grammer.jcompile',function(exports,require,module){
return function(str,scope,element){
//jcompile should never be used when sub tag structutor contain any other grammer tag,cause it will be totally replace by innnerHTML.
var element = this.node;
var scope = this.scope;
var reg = this.reg;
var key = element.textContent.replace(reg,'');
//element.innerHTML = scope[key];
// console.log(this.eom.msg);
var key = element.textContent.replace(/.*{{\s*|\s*}}.*/g,'');
var before = element.textContent.replace(/{{.*/,'');
var after = element.textContent.replace(/.*}}/,'');
scope.onchange(key,function(value){
element.innerHTML = before + value + after;
});
};

@@ -766,0 +764,0 @@ });

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

var _$river={sandbox:function(){var e={};return{create:function(t,n){t=t.toLowerCase(),e[t]=n},run:function(t){var n={need:function(t){t=t.toLowerCase();var r=Object.create(n);r.exports={};var o=e[t]&&e[t].call(r,r.exports,r.need,r)||void 0;return o=o||r.exports},exports:{}};t.call(n,n.exports,n.need,n)}}}};_$river.module=_$river.sandbox(),Object.create=Object.create||function(e){var t=function(){};return t.prototype=e,new t};var define=_$river.module.create,main=_$river.module.run;define("river.engine",function(){function e(e){return a.need("river.grammer."+e)}function t(t,r){var o={hasRepeat:!1,context:r},i={scope:{},node:t,eom:{},reg:l};if(t.attributes&&t.attributes.length)for(var a=0;a<t.attributes.length;a++){var s=t.attributes[a],u=s.nodeName,f=s.nodeValue.replace(l,""),p=e(u);if("scope"===u?(o.context=i,p.call(o.context,f,o.context.scope,o.context.node),r&&c.inherit(o.context.scope,r.scope)):c.isFunction(p)&&(o.context?(o.context.node=t,p.call(o.context,f,o.context.scope,o.context.node),n(s,o.context)):(o.context=i,e("scope").call(o.context,f),p.call(o.context,f,o.context.scope,o.context.node))),"repeat"===u){o.hasRepeat=!0;break}}return o}function n(e,t){if(l.test(e.nodeValue)){for(var n=e.nodeValue.replace(/\r|\n/g,"").replace(l,""),r=n.split("."),o={},i=0;i<r.length;i++)"object"==typeof o&&(o=o[r[i]]||t.scope[r[i]]);o="object"==typeof o?JSON.stringify(o):o,"undefined"==typeof o&&(o=""),c.buildobj(n,".",t.eom,function(t,n){t[n]=t[n]||[],t[n].push({element:e,expression:e.nodeValue})}),e.nodeValue=e.nodeValue.replace(/\r|\n/g,"").replace(/{{.*}}/,o)}}function r(e,t){if(e.childNodes&&e.childNodes.length)for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n],i=t?t.context:void 0,a=o(r,i);if(a.hasRepeat)break}}function o(e,o){var i=t(e,o);return i.context&&n(e,i.context),"CODE"===e.nodeName||"PRE"===e.nodeName||i.hasRepeat||(i.context?r(e,i):r(e)),i}function i(e,t){var n=!1,r=!0,o=e.document,i=o.documentElement,a=o.addEventListener?"addEventListener":"attachEvent",c=o.addEventListener?"removeEventListener":"detachEvent",l=o.addEventListener?"":"on",s=function(r){("readystatechange"!=r.type||"complete"==o.readyState)&&(("load"==r.type?e:o)[c](l+r.type,s,!1),!n&&(n=!0)&&t.call(e,r.type||r))},u=function(){try{i.doScroll("left")}catch(e){return void setTimeout(u,50)}s("poll")};if("complete"==o.readyState)t.call(e,"lazy");else{if(o.createEventObject&&i.doScroll){try{r=!e.frameElement}catch(f){}r&&u()}o[a](l+"DOMContentLoaded",s,!1),o[a](l+"readystatechange",s,!1),e[a](l+"load",s,!1)}}var a=this,c=a.need("river.core.tools"),l=/.*{{\s*|\s*}}.*/g;return{scan:o,ready:i}}),define("river.scenario",function(){function e(e,t){var n=document.createEvent("MouseEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function t(e,t,n,r){var o=document.createEvent("Events");o.initEvent(e,!0,!0),o.view=null,o.altKey=!1,o.ctrlKey=!1,o.shiftKey=!1,o.metaKey=!1,o.keyCode=t,o.charCode=n,r.dispatchEvent(o)}this.need("river.core.tools");return{trigger:e,key:t}}),define("river.core.Date",function(){function e(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(var n in t)new RegExp("("+n+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[n]:("00"+t[n]).substr((""+t[n]).length)));return e}var t=function(t){var n=new Date,r=new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours()+parseInt(t),n.getUTCMinutes(),n.getUTCSeconds());return{date:r,toString:function(t){return r.toString=e,r.toString(t)}}};return{getDateByCity:t}}),define("river.core.model",function(){function e(n,r,o,i){var a=this,d=i[r],v=n==d;if(!v)if(s(n)||u(n)){if(o&&o[r]){p(o[r],function(e){e.element.nodeValue=e.expression.replace(/{{.*}}/,n),"INPUT"==e.element.nodeName&&(e.element.value=e.expression.replace(/{{.*}}/,n))});var h=a.__listeners__&&a.__listeners__[r];if(h)for(var _=0,m=h.length;m>_;_++)h[_](n,i[r])}i[r]=n}else c(n)?(i[r]=d?d:[],t(n,i[r],o[r],a,r,i)):l(n)&&(d=d?d:{},f(n,function(t,n){e.call(a,t,n,o[r],d)}))}function t(e,t,o,i,c,l){for(var s=e.length>=t.length?e.length:t.length,u=a.expect,f=o.repeatContainer,p=0,d=0;s>d;d++){var v=e[d],h="undefined"!=typeof v;if(h&&!u(v).toEqual(t[d])){var _=r(o,v,i,c,d,l),m=f.children[d];"object"==typeof v?(t[d]=t[d]||{},n(t[d],v)):t[d]=v,o.splice(d,1,_),f.insertBefore(_.repeat,m),m&&f.removeChild(m)}else h||(t.splice(d-p,1),o.splice(d-p,1),f.removeChild(f.children[d-p]),p++)}}function n(e,t){for(var n in t)e[n]=t[n]}function r(e,t,n,r,o,i){var c=e.trans,l=e.repeatNode,s=e.reg,u=e.key,f=l.cloneNode(!0),p={},d=function(e){this.__eom__={},this.__last__={},this.__listeners__={},this[u]=e,this.__eom__[u]=p,this.__last__[u]=i[r]&&i[r][o]||a.clone(t)};d.prototype=n;var v=new d(t);return c(s,f,v,u,p),p.repeat=f,p}function o(e){if("object"==typeof e)for(var t in e)this[t]=e[t];else this._$value=e;this.__listeners__={}}function i(){var t=this.__eom__,n=this.__last__,r=this;t&&f(this,function(o,i){/__/.test(i)||t[i]&&!a.expect(n[i]).toEqual(o)&&e.call(r,o,i,t,n)})}var a=this.need("river.core.tools"),c=a.isArray,l=a.isObject,s=a.isString,u=a.isNumber,f=a.each,p=a.loop;return o.prototype.apply=function(){var e=Object.getPrototypeOf(this),t=this;i.call(t),i.call(e)},o.prototype.watch=function(){},o.prototype.onchange=function(e,t){var n=this.__listeners__[e]=this.__listeners__[e]||[];n.push(t)},o.prototype.inject=function(e){var t=this;f(e,function(n,r){t[r]=e[r]})},o}),define("river.core.tools",function(){function e(e,t){var n=function(){for(var t in e)e.hasOwnProperty&&e.hasOwnProperty(t)?this[t]=e[t]:n.prototype[t]=e[t]};for(var r in t)n.prototype[r]=t[r];var o=new n;for(var i in o)e[i]=o[i];return e}function t(e){var t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]}function n(){for(var e="$$",t=1;8>=t;t++){var n=Math.floor(16*Math.random()).toString(16);e+=n,(3==t||5==t)&&(e+="-")}return e}function r(e,t){for(var n={},r=0;r<e.length;r++)t.call(n,e[r],r)}function o(e,t){var n={};for(var r in e)e.hasOwnProperty&&e.hasOwnProperty(r)&&t.call(n,e[r],r)}function i(e,t){return window.Object.prototype.toString.call(t)==="[object "+e+"]"}function a(e,t,n,r){var o=e.split(t),i=o.shift();return n=n||{},o.length?(n[i]=n[i]||{},a(o.join(t),t,n[i],r)):"function"==typeof r&&r(n,i),n}function c(e,t){if("object"!=typeof e)return e;t=t?t:i("Object",e)?{}:[];for(var n in e){var r=i("Object",e[n]),o=i("Array",e[n]),a=r||o;a?(t[n]=r?{}:[],c(e[n],t[n])):t[n]=e[n]}return t}function l(e,t){this._diffFlag=!0;for(var n in t){var r=i("Object",t[n])||i("Array",t[n]);if(!this._diffFlag)return!1;if(r&&e)l.call(this,e[n],t[n]);else{if(!e){this._diffFlag=!1;break}if(e[n]!=t[n]){this._diffFlag=!1;break}}}return this._diffFlag}function s(e){function t(t){return n?e==t:r?l.call({},t,e)&&l.call({},e,t):void 0}var n="string"==typeof e||"number"==typeof e||"boolean"==typeof e||"undefined"==typeof e,r="function"!=typeof e;return{toEqual:t}}var u=(Object.prototype.toString,{inherit:e,compile:t,guid:n,loop:r,each:o,clone:c,expect:s,isArray:function(e){return i("Array",e)},isObject:function(e){return i("Object",e)},isFunction:function(e){return i("Function",e)},isString:function(e){return i("String",e)},isNumber:function(e){return i("Number",e)},buildobj:a});return u}),define("river.grammer.jbind",function(e,t,n){function r(e,t,n){function r(n){n!==c&&(i(e,t,n),c=n,t.apply())}{var a=o(e,t),c=n.value=a||"";e.split(".")}this.eom[e]=this.eom[e]||[],this.eom[e].push({element:n,expression:"{{"+e+"}}"});var l;n.onfocus=function(){var e=this;l=setInterval(function(){r(e.value)},30)},n.onblur=function(){clearInterval(l)}}function o(e,t){var n="";if(!t)throw new TypeError("value not exists");var r=e.replace(/\..*/,""),i=t[r];return"object"==typeof i?n=o(e.replace(r+".",""),i):"undefined"!=typeof i&&(n=i),n}function i(e,t,n){if(!t)throw new TypeError("value not exists");var r=e.replace(/\..*/,""),o=t[r];"object"==typeof o?i(e.replace(r+".",""),o,n):t[r]=n}e=n.exports=r}),define("river.grammer.jChange",function(){function e(e){var t=this.scope[e],n=this.scope;this.node.onchange=function(){t.call({},this.value),n.apply()}}return e}),define("river.grammer.jclick",function(e,t,n){function r(e,t,n){var r=e.replace(/\(.*\)/,""),o=t[r],i=/\((.*)\)/,a=e.match(i),c=[];a&&a.length&&(c=a[1].split(","));for(var l=[],s=0,u=c.length;u>s;s++)l[s]=t[c[s]];this.eom;n.onclick=function(){o.apply(n,l),t.apply()}}e=n.exports=r}),define("river.grammer.jcompile",function(){return function(){{var e=this.node,t=(this.scope,this.reg);e.textContent.replace(t,"")}}}),define("river.grammer.jon",function(){function e(e,t,n){var r=e.replace(/\(.*\)/,""),o=r.replace(/\s*[\||:].*/,""),i=r.replace(/.*[\||:]\s*/,""),a=t[i],c=/\((.*)\)/,l=e.match(c),s=[];l&&l.length&&(s=l[1].split(","));var u="on"+o;n[u]=function(e){for(var r=[],o=0,i=s.length;i>o;o++){var c=t[s[o]]?t[s[o]]:"";r.push(c)}a.apply(n,[e].concat(r)),t.apply()}}return e}),define("river.grammer.repeat",function(e,t){function n(e){return l.need("river.grammer."+e)}function r(e,t,n){var r=/.*\./,l=e.replace(s,"").replace(r,""),f=t[l],p=e.replace(u,""),d=n.parentNode,v=d.removeChild(n),h=document.createDocumentFragment(),_=this.reg,m=this.eom[l]=[];v.removeAttribute("repeat"),i=v,a=d,m.repeatNode=v,m.repeatContainer=d,m.trans=o,m.key=p,m.reg=_,t.__children__=t.__children__||[],f&&f.length&&(f.forEach(function(e,n){var r=v.cloneNode(!0),i={},a=function(e){this[p]=e};a.prototype=t;var s=new a(e);s.__eom__={},s.__eom__[p]=i,s.__last__={},s.__last__[p]=t.__last__&&t.__last__[l][n]||c.clone(e),s.__listeners__={},t.__children__.push(s),o(_,r,s,p,i),i.repeat=r,m.push(i),h.appendChild(r)}),d.appendChild(h))}function o(e,t,i,a,l){var u=!1;if(t.attributes&&t.attributes.length&&Array.prototype.forEach.call(t.attributes,function(o){if(e.test(o.nodeValue)){var p=o.nodeValue.replace(e,"").replace(a+".","");l[p]||(l[p]=[]),l[p].push({element:o,expression:o.nodeValue});var d="object"==typeof i[a]?i[a][p]:i[a];o.nodeValue=o.nodeValue.replace(/{{.*}}/,d)}if(f.node=t,f.scope=i,f.reg=e,f.eom=l,"repeat"===o.nodeName){u=!0;var v=o.nodeValue.replace(s,"").replace(/\..*/,"");f.scope=i[v],r.call(f,o.nodeValue.replace(e,""),i[v],t)}else{var h=n(o.nodeName);if(c.isFunction(h)){var _=o.nodeValue.replace(e,"");f.eom={},h.call(f,_,i,f.node)}}}),e.test(t.nodeValue)){var p=t.nodeValue.replace(e,"").replace(a+".","");c.buildobj(p,".",l,function(e,n){e[n]=e[n]||[],e[n].push({element:t,expression:t.nodeValue})});var d="object"==typeof i[a]?i[a][p]:i[a];"object"==typeof i[a]&&c.buildobj(p,".",i[a],function(e,t){d=e[t]}),t.nodeValue=t.nodeValue.replace(/{{.*}}/,d)}t.childNodes&&t.childNodes.length&&!u&&Array.prototype.forEach.call(t.childNodes,function(t){o(e,t,i,a,l)})}var i,a,c=t("river.core.tools"),l=(t("river.engine").scan,t("river.core.model"),this),s=/.*in\s/,u=/\sin.*/,f={};return r}),define("river.grammer.scope",function(){function e(e){this.node.setAttribute("scope","");var o=t.need(e);if(r.isObject(o)){var i=new n;o.__last__=r.clone(o),o.__eom__=this.eom;for(var a in i)o[a]=i[a];this.scope=o}else if(r.isFunction(o)){var c=new n;this.scope=c,o.call(c),c.__last__=r.clone(c),c.__eom__=this.eom}else{var l=(r.guid(),new n);l.__last__=r.clone(l),l.__eom__=this.eom,this.scope=l}}var t=this,n=t.need("river.core.model"),r=t.need("river.core.tools");return e}),main(function(e,t){var n=t("river.engine");n.ready(window,function(){n.scan(document)})});
var _$river={sandbox:function(){var e={};return{create:function(t,n){t=t.toLowerCase(),e[t]=n},run:function(t){var n={need:function(t){t=t.toLowerCase();var r=Object.create(n);r.exports={};var o=e[t]&&e[t].call(r,r.exports,r.need,r)||void 0;return o=o||r.exports},exports:{}};t.call(n,n.exports,n.need,n)}}}};_$river.module=_$river.sandbox(),Object.create=Object.create||function(e){var t=function(){};return t.prototype=e,new t};var define=_$river.module.create,main=_$river.module.run;define("river.engine",function(){function e(e){return a.need("river.grammer."+e)}function t(t,r){var o={hasRepeat:!1,context:r},i={scope:{},node:t,eom:{},reg:l};if(t.attributes&&t.attributes.length)for(var a=0;a<t.attributes.length;a++){var s=t.attributes[a],u=s.nodeName,f=s.nodeValue.replace(l,""),p=e(u);if("scope"===u?(o.context=i,p.call(o.context,f,o.context.scope,o.context.node),r&&c.inherit(o.context.scope,r.scope)):c.isFunction(p)&&(o.context?(o.context.node=t,p.call(o.context,f,o.context.scope,o.context.node),n(s,o.context)):(o.context=i,e("scope").call(o.context,f),p.call(o.context,f,o.context.scope,o.context.node))),"repeat"===u){o.hasRepeat=!0;break}}return o}function n(e,t){if(l.test(e.nodeValue)){for(var n=e.nodeValue.replace(/\r|\n/g,"").replace(l,""),r=n.split("."),o={},i=0;i<r.length;i++)"object"==typeof o&&(o=o[r[i]]||t.scope[r[i]]);o="object"==typeof o?JSON.stringify(o):o,"undefined"==typeof o&&(o=""),c.buildobj(n,".",t.eom,function(t,n){t[n]=t[n]||[],t[n].push({element:e,expression:e.nodeValue})}),e.nodeValue=e.nodeValue.replace(/\r|\n/g,"").replace(/{{.*}}/,o)}}function r(e,t){if(e.childNodes&&e.childNodes.length)for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n],i=t?t.context:void 0,a=o(r,i);if(a.hasRepeat)break}}function o(e,o){var i=t(e,o);return i.context&&n(e,i.context),"CODE"===e.nodeName||"PRE"===e.nodeName||i.hasRepeat||(i.context?r(e,i):r(e)),i}function i(e,t){var n=!1,r=!0,o=e.document,i=o.documentElement,a=o.addEventListener?"addEventListener":"attachEvent",c=o.addEventListener?"removeEventListener":"detachEvent",l=o.addEventListener?"":"on",s=function(r){("readystatechange"!=r.type||"complete"==o.readyState)&&(("load"==r.type?e:o)[c](l+r.type,s,!1),!n&&(n=!0)&&t.call(e,r.type||r))},u=function(){try{i.doScroll("left")}catch(e){return void setTimeout(u,50)}s("poll")};if("complete"==o.readyState)t.call(e,"lazy");else{if(o.createEventObject&&i.doScroll){try{r=!e.frameElement}catch(f){}r&&u()}o[a](l+"DOMContentLoaded",s,!1),o[a](l+"readystatechange",s,!1),e[a](l+"load",s,!1)}}var a=this,c=a.need("river.core.tools"),l=/.*{{\s*|\s*}}.*/g;return{scan:o,ready:i}}),define("river.scenario",function(){function e(e,t){var n=document.createEvent("MouseEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function t(e,t,n,r){var o=document.createEvent("Events");o.initEvent(e,!0,!0),o.view=null,o.altKey=!1,o.ctrlKey=!1,o.shiftKey=!1,o.metaKey=!1,o.keyCode=t,o.charCode=n,r.dispatchEvent(o)}this.need("river.core.tools");return{trigger:e,key:t}}),define("river.core.Date",function(){function e(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(var n in t)new RegExp("("+n+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[n]:("00"+t[n]).substr((""+t[n]).length)));return e}var t=function(t){var n=new Date,r=new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours()+parseInt(t),n.getUTCMinutes(),n.getUTCSeconds());return{date:r,toString:function(t){return r.toString=e,r.toString(t)}}};return{getDateByCity:t}}),define("river.core.model",function(){function e(n,r,o,i){var a=this,d=i[r],v=n==d;if(!v)if(s(n)||u(n)){if(o&&o[r]){p(o[r],function(e){e.element.nodeValue=e.expression.replace(/{{.*}}/,n),"INPUT"==e.element.nodeName&&(e.element.value=e.expression.replace(/{{.*}}/,n))});var h=a.__listeners__&&a.__listeners__[r];if(h)for(var _=0,g=h.length;g>_;_++)h[_](n,i[r])}i[r]=n}else c(n)?(i[r]=d?d:[],t(n,i[r],o[r],a,r,i)):l(n)&&(d=d?d:{},f(n,function(t,n){e.call(a,t,n,o[r],d)}))}function t(e,t,o,i,c,l){for(var s=e.length>=t.length?e.length:t.length,u=a.expect,f=o.repeatContainer,p=0,d=0;s>d;d++){var v=e[d],h="undefined"!=typeof v;if(h&&!u(v).toEqual(t[d])){var _=r(o,v,i,c,d,l),g=f.children[d];"object"==typeof v?(t[d]=t[d]||{},n(t[d],v)):t[d]=v,o.splice(d,1,_),f.insertBefore(_.repeat,g),g&&f.removeChild(g)}else h||(t.splice(d-p,1),o.splice(d-p,1),f.removeChild(f.children[d-p]),p++)}}function n(e,t){for(var n in t)e[n]=t[n]}function r(e,t,n,r,o,i){var c=e.trans,l=e.repeatNode,s=e.reg,u=e.key,f=l.cloneNode(!0),p={},d=function(e){this.__eom__={},this.__last__={},this.__listeners__={},this[u]=e,this.__eom__[u]=p,this.__last__[u]=i[r]&&i[r][o]||a.clone(t)};d.prototype=n;var v=new d(t);return c(s,f,v,u,p),p.repeat=f,p}function o(e){if("object"==typeof e)for(var t in e)this[t]=e[t];else this._$value=e;this.__listeners__={}}function i(){var t=this.__eom__,n=this.__last__,r=this;t&&f(this,function(o,i){/__/.test(i)||t[i]&&!a.expect(n[i]).toEqual(o)&&e.call(r,o,i,t,n)})}var a=this.need("river.core.tools"),c=a.isArray,l=a.isObject,s=a.isString,u=a.isNumber,f=a.each,p=a.loop;return o.prototype.apply=function(){var e=Object.getPrototypeOf(this),t=this;i.call(t),i.call(e)},o.prototype.watch=function(){},o.prototype.onchange=function(e,t){var n=this.__listeners__[e]=this.__listeners__[e]||[];n.push(t)},o.prototype.inject=function(e){var t=this;f(e,function(n,r){t[r]=e[r]})},o}),define("river.core.tools",function(){function e(e,t){var n=function(){for(var t in e)e.hasOwnProperty&&e.hasOwnProperty(t)?this[t]=e[t]:n.prototype[t]=e[t]};for(var r in t)n.prototype[r]=t[r];var o=new n;for(var i in o)e[i]=o[i];return e}function t(e){var t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]}function n(){for(var e="$$",t=1;8>=t;t++){var n=Math.floor(16*Math.random()).toString(16);e+=n,(3==t||5==t)&&(e+="-")}return e}function r(e,t){for(var n={},r=0;r<e.length;r++)t.call(n,e[r],r)}function o(e,t){var n={};for(var r in e)e.hasOwnProperty&&e.hasOwnProperty(r)&&t.call(n,e[r],r)}function i(e,t){return window.Object.prototype.toString.call(t)==="[object "+e+"]"}function a(e,t,n,r){var o=e.split(t),i=o.shift();return n=n||{},o.length?(n[i]=n[i]||{},a(o.join(t),t,n[i],r)):"function"==typeof r&&r(n,i),n}function c(e,t){if("object"!=typeof e)return e;t=t?t:i("Object",e)?{}:[];for(var n in e){var r=i("Object",e[n]),o=i("Array",e[n]),a=r||o;a?(t[n]=r?{}:[],c(e[n],t[n])):t[n]=e[n]}return t}function l(e,t){this._diffFlag=!0;for(var n in t){var r=i("Object",t[n])||i("Array",t[n]);if(!this._diffFlag)return!1;if(r&&e)l.call(this,e[n],t[n]);else{if(!e){this._diffFlag=!1;break}if(e[n]!=t[n]){this._diffFlag=!1;break}}}return this._diffFlag}function s(e){function t(t){return n?e==t:r?l.call({},t,e)&&l.call({},e,t):void 0}var n="string"==typeof e||"number"==typeof e||"boolean"==typeof e||"undefined"==typeof e,r="function"!=typeof e;return{toEqual:t}}var u=(Object.prototype.toString,{inherit:e,compile:t,guid:n,loop:r,each:o,clone:c,expect:s,isArray:function(e){return i("Array",e)},isObject:function(e){return i("Object",e)},isFunction:function(e){return i("Function",e)},isString:function(e){return i("String",e)},isNumber:function(e){return i("Number",e)},buildobj:a});return u}),define("river.grammer.jbind",function(e,t,n){function r(e,t,n){function r(n){n!==c&&(i(e,t,n),c=n,t.apply())}{var a=o(e,t),c=n.value=a||"";e.split(".")}this.eom[e]=this.eom[e]||[],this.eom[e].push({element:n,expression:"{{"+e+"}}"});var l;n.onfocus=function(){var e=this;l=setInterval(function(){r(e.value)},30)},n.onblur=function(){clearInterval(l)}}function o(e,t){var n="";if(!t)throw new TypeError("value not exists");var r=e.replace(/\..*/,""),i=t[r];return"object"==typeof i?n=o(e.replace(r+".",""),i):"undefined"!=typeof i&&(n=i),n}function i(e,t,n){if(!t)throw new TypeError("value not exists");var r=e.replace(/\..*/,""),o=t[r];"object"==typeof o?i(e.replace(r+".",""),o,n):t[r]=n}e=n.exports=r}),define("river.grammer.jChange",function(){function e(e){var t=this.scope[e],n=this.scope;this.node.onchange=function(){t.call({},this.value),n.apply()}}return e}),define("river.grammer.jclick",function(e,t,n){function r(e,t,n){var r=e.replace(/\(.*\)/,""),o=t[r],i=/\((.*)\)/,a=e.match(i),c=[];a&&a.length&&(c=a[1].split(","));for(var l=[],s=0,u=c.length;u>s;s++)l[s]=t[c[s]];this.eom;n.onclick=function(){o.apply(n,l),t.apply()}}e=n.exports=r}),define("river.grammer.jcompile",function(){return function(e,t,n){var r=n.textContent.replace(/.*{{\s*|\s*}}.*/g,""),o=n.textContent.replace(/{{.*/,""),i=n.textContent.replace(/.*}}/,"");t.onchange(r,function(e){n.innerHTML=o+e+i})}}),define("river.grammer.jon",function(){function e(e,t,n){var r=e.replace(/\(.*\)/,""),o=r.replace(/\s*[\||:].*/,""),i=r.replace(/.*[\||:]\s*/,""),a=t[i],c=/\((.*)\)/,l=e.match(c),s=[];l&&l.length&&(s=l[1].split(","));var u="on"+o;n[u]=function(e){for(var r=[],o=0,i=s.length;i>o;o++){var c=t[s[o]]?t[s[o]]:"";r.push(c)}a.apply(n,[e].concat(r)),t.apply()}}return e}),define("river.grammer.repeat",function(e,t){function n(e){return l.need("river.grammer."+e)}function r(e,t,n){var r=/.*\./,l=e.replace(s,"").replace(r,""),f=t[l],p=e.replace(u,""),d=n.parentNode,v=d.removeChild(n),h=document.createDocumentFragment(),_=this.reg,g=this.eom[l]=[];v.removeAttribute("repeat"),i=v,a=d,g.repeatNode=v,g.repeatContainer=d,g.trans=o,g.key=p,g.reg=_,t.__children__=t.__children__||[],f&&f.length&&(f.forEach(function(e,n){var r=v.cloneNode(!0),i={},a=function(e){this[p]=e};a.prototype=t;var s=new a(e);s.__eom__={},s.__eom__[p]=i,s.__last__={},s.__last__[p]=t.__last__&&t.__last__[l][n]||c.clone(e),s.__listeners__={},t.__children__.push(s),o(_,r,s,p,i),i.repeat=r,g.push(i),h.appendChild(r)}),d.appendChild(h))}function o(e,t,i,a,l){var u=!1;if(t.attributes&&t.attributes.length&&Array.prototype.forEach.call(t.attributes,function(o){if(e.test(o.nodeValue)){var p=o.nodeValue.replace(e,"").replace(a+".","");l[p]||(l[p]=[]),l[p].push({element:o,expression:o.nodeValue});var d="object"==typeof i[a]?i[a][p]:i[a];o.nodeValue=o.nodeValue.replace(/{{.*}}/,d)}if(f.node=t,f.scope=i,f.reg=e,f.eom=l,"repeat"===o.nodeName){u=!0;var v=o.nodeValue.replace(s,"").replace(/\..*/,"");f.scope=i[v],r.call(f,o.nodeValue.replace(e,""),i[v],t)}else{var h=n(o.nodeName);if(c.isFunction(h)){var _=o.nodeValue.replace(e,"");f.eom={},h.call(f,_,i,f.node)}}}),e.test(t.nodeValue)){var p=t.nodeValue.replace(e,"").replace(a+".","");c.buildobj(p,".",l,function(e,n){e[n]=e[n]||[],e[n].push({element:t,expression:t.nodeValue})});var d="object"==typeof i[a]?i[a][p]:i[a];"object"==typeof i[a]&&c.buildobj(p,".",i[a],function(e,t){d=e[t]}),t.nodeValue=t.nodeValue.replace(/{{.*}}/,d)}t.childNodes&&t.childNodes.length&&!u&&Array.prototype.forEach.call(t.childNodes,function(t){o(e,t,i,a,l)})}var i,a,c=t("river.core.tools"),l=(t("river.engine").scan,t("river.core.model"),this),s=/.*in\s/,u=/\sin.*/,f={};return r}),define("river.grammer.scope",function(){function e(e){this.node.setAttribute("scope","");var o=t.need(e);if(r.isObject(o)){var i=new n;o.__last__=r.clone(o),o.__eom__=this.eom;for(var a in i)o[a]=i[a];this.scope=o}else if(r.isFunction(o)){var c=new n;this.scope=c,o.call(c),c.__last__=r.clone(c),c.__eom__=this.eom}else{var l=(r.guid(),new n);l.__last__=r.clone(l),l.__eom__=this.eom,this.scope=l}}var t=this,n=t.need("river.core.model"),r=t.need("river.core.tools");return e}),main(function(e,t){var n=t("river.engine");n.ready(window,function(){n.scan(document)})});
//# sourceMappingURL=river.map

@@ -1,13 +0,11 @@

define('river.grammer.jcompile',function(){
return function(){
define('river.grammer.jcompile',function(exports,require,module){
return function(str,scope,element){
//jcompile should never be used when sub tag structutor contain any other grammer tag,cause it will be totally replace by innnerHTML.
var element = this.node;
var scope = this.scope;
var reg = this.reg;
var key = element.textContent.replace(reg,'');
//element.innerHTML = scope[key];
// console.log(this.eom.msg);
var key = element.textContent.replace(/.*{{\s*|\s*}}.*/g,'');
var before = element.textContent.replace(/{{.*/,'');
var after = element.textContent.replace(/.*}}/,'');
scope.onchange(key,function(value){
element.innerHTML = before + value + after;
});
};
});
{
"name": "riverjs",
"version": "1.0.83",
"version": "1.0.84",
"description": "a simple font-end framework with extendable two-way binding",

@@ -5,0 +5,0 @@ "main": "Gruntfile.js",

@@ -7,70 +7,28 @@ #RiverJS

###Build tool
```
npm install -g riverjs
```
###Tutorials
[RiverJS](http://besideriver.com/RiverJS)
###New way wrap module
```
touch app/hello.js
```
###How to setup dev environment
```javascript
\\@sourcefile: app/hello.js
exports.to = function(who) {
console.log('hello ' + who);
}
fork to your own repertory then
```
git branch -d new-feature-dev
```
riverjs build app
```
```html
\\index.html
<script>
main(function(exports,require,module){
var hello = require('app.hello');
hello.to('world');
});
</script>
```
###Tutorials
[RiverJS](http://besideriver.com/RiverJS)
###How to setup dev environment
1 you need to install nodejs
2 install karma
2 install dev dependence
```javascript
npm install -g karam
```
3 install the dev dependence
```javascript
cd RiverJS
npm install
```
3 use `make test` to start karma
4 download [PhantomJS](http://phantomjs.org) and put the bin file into
4 write your own feature wite unit test
```
mv /your/path/phantomjs /usr/bin/
```
5 send pull request to me
or you can change the `karma.conf.js`
```
browsers: ['Chrome']
```
###How to make a distrucbute

@@ -89,3 +47,3 @@

###Lisense
one line to give the program's name and a brief description
one line to give the [RIverJS](http://besideriver.com/RiverJS) and a brief description
Copyright (C) 2014 copyright holder

@@ -92,0 +50,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc