logo

Grimgrains

Unnamed repository; edit this file 'description' to name the repository.
commit: df9fcabad335d7e3e62be9873dbb951fbee7a8a1
parent 40b9198cddf0b585992ad49b7d1e306fd00f10fb
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Mon,  5 Mar 2018 20:58:53 +1300

Updated Riven core

Diffstat:

Mlinks/main.css5+++--
Mscripts/graph.js32++++++++++++++++----------------
Mscripts/lib/riven.graph.js2+-
Mscripts/lib/riven.js38++++++++++++++------------------------
Mscripts/nodes/query.js2+-
5 files changed, 35 insertions(+), 44 deletions(-)

diff --git a/links/main.css b/links/main.css @@ -1 +1,2 @@ -body { background:blue; }- \ No newline at end of file +body { background:blue; } +yu { display: block; border:3px solid red; padding:10px; margin:10px; }+ \ No newline at end of file diff --git a/scripts/graph.js b/scripts/graph.js @@ -1,29 +1,29 @@ function graph() { - Ø("query").cast({x:2,y:4},QueryNode) + Ø("query").create({x:2,y:4},QueryNode) Ø("model").mesh({x:6,y:0},[ - Ø("router").cast({x:5,y:2},RouterNode), - Ø("database").cast({x:5,y:9},DatabaseNode), - Ø("recipes").cast({x:2,y:17},DictionaryNode), - Ø("ingredients").cast({x:5,y:17},DictionaryNode), - Ø("pages").cast({x:8,y:17},DictionaryNode), + Ø("router").create({x:5,y:2},RouterNode), + Ø("database").create({x:5,y:9},DatabaseNode), + Ø("recipes").create({x:2,y:17},DictionaryNode), + Ø("ingredients").create({x:5,y:17},DictionaryNode), + Ø("pages").create({x:8,y:17},DictionaryNode), ]) - Ø("view").mesh({x:18,y:0},[ - Ø("template").cast({x:2,y:2},TemplateNode), - Ø("main").cast({x:8,y:7},DomNode), + Ø("view").mesh({x:19,y:0},[ + Ø("template").create({x:2,y:2},TemplateNode), + Ø("main").create({x:8,y:7},DomNode), - Ø("header").cast({x:2,y:12},DomNode), - Ø("logo").cast({x:2,y:17},DomNode), - Ø("search").cast({x:6,y:17},DomNode), - Ø("menu").cast({x:10,y:17},DomNode), + Ø("header").create({x:2,y:12},DomNode), + Ø("logo").create({x:2,y:17},DomNode), + Ø("search").create({x:6,y:17},DomNode), + Ø("menu").create({x:10,y:17},DomNode), - Ø("body").cast({x:14,y:12},DomNode), - Ø("related").cast({x:14,y:17},DomNode), + Ø("body").create({x:14,y:12},DomNode), + Ø("related").create({x:14,y:17},DomNode), - Ø("footer").cast({x:10,y:12},DomNode), + Ø("footer").create({x:10,y:12},DomNode), ]) Ø("router").syphon("database") diff --git a/scripts/lib/riven.graph.js b/scripts/lib/riven.graph.js @@ -61,7 +61,7 @@ function Riven_Graph() function draw_glyph(node) { var rect = get_rect(node); - return !node.is_mesh ? `<path class='glyph' transform="translate(${rect.x+(GRID_SIZE/4)},${rect.y-(GRID_SIZE/4)}) scale(0.1)" d='${node.glyph}'/>` : "" + return !node.is_mesh && node.glyph ? `<path class='glyph' transform="translate(${rect.x+(GRID_SIZE/4)},${rect.y-(GRID_SIZE/4)}) scale(0.1)" d='${node.glyph}'/>` : "" } function draw_port(port) diff --git a/scripts/lib/riven.js b/scripts/lib/riven.js @@ -4,12 +4,6 @@ function Riven() { this.network = {} - - this.add = function(node) - { - node.setup(); - this.network[node.id] = node - } } // QUERY @@ -48,20 +42,13 @@ function Node(id,rect={x:0,y:0,w:2,h:2}) this.ports.request = new Port(this,"request",PORT_TYPES.request) } - this.create = function(pos = {x:0,y:0}) - { - this.rect.x = pos.x - this.rect.y = pos.y - RIVEN.add(this); - return this - } - - this.cast = function(pos = {x:0,y:0},type,param) + this.create = function(pos = {x:0,y:0},type = Node,param) { var node = new type(this.id,rect,param) this.rect.x = pos.x this.rect.y = pos.y - RIVEN.add(node); + node.setup(); + RIVEN.network[node.id] = node return node } @@ -70,7 +57,8 @@ function Node(id,rect={x:0,y:0,w:2,h:2}) var node = new Mesh(this.id,pos) node.rect.x = pos.x node.rect.y = pos.y - RIVEN.add(node); + node.setup(); + RIVEN.network[node.id] = node if(n instanceof Array){ for(id in n){ @@ -87,7 +75,7 @@ function Node(id,rect={x:0,y:0,w:2,h:2}) return node; } - // Connection + // Connect this.connect = function(q,type = ROUTE_TYPES.output) { @@ -101,7 +89,7 @@ function Node(id,rect={x:0,y:0,w:2,h:2}) } } - this.syphon = function(q,type) + this.syphon = function(q) { this.connect(q,ROUTE_TYPES.request) } @@ -112,6 +100,8 @@ function Node(id,rect={x:0,y:0,w:2,h:2}) this.syphon(q) } + // Target + this.signal = function(target) { for(port_id in this.ports){ @@ -127,11 +117,6 @@ function Node(id,rect={x:0,y:0,w:2,h:2}) // SEND/RECEIVE - this.bang = function() - { - this.send(true) - } - this.send = function(payload) { for(route_id in this.ports.output.routes){ @@ -152,6 +137,11 @@ function Node(id,rect={x:0,y:0,w:2,h:2}) } } + this.bang = function() + { + this.send(true) + } + // REQUEST/ANSWER this.answer = function(q) diff --git a/scripts/nodes/query.js b/scripts/nodes/query.js @@ -9,7 +9,7 @@ function QueryNode(id,rect) { var hash = window.location.hash.substring(1).replace(/[^0-9a-z]/gi," ").trim().toLowerCase() if(hash == ""){ - hash = "home"; + hash = "spinach"; } this.label = hash this.send(hash)