logo

Grimgrains

Unnamed repository; edit this file 'description' to name the repository.
commit: b2077cbc345468b59c84739cdacccfbce8d74a5b
parent f087df363db40c614cdc0ecf056f05526caccd75
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Mon,  5 Mar 2018 12:34:31 +1300

Starting Dom node

Diffstat:

Mriven.html1+
Mscripts/graph.js60++++++++----------------------------------------------------
Mscripts/lib/riven.graph.js17+++++++++++++++++
Mscripts/lib/riven.js14--------------
Ascripts/nodes/dom.js7+++++++
Mscripts/nodes/element.js2+-
Mscripts/nodes/template.js2+-
7 files changed, 35 insertions(+), 68 deletions(-)

diff --git a/riven.html b/riven.html @@ -10,6 +10,7 @@ <script src="scripts/nodes/database.js"></script> <script src="scripts/nodes/dictionary.js"></script> <script src="scripts/nodes/template.js"></script> + <script src="scripts/nodes/dom.js"></script> <script src="scripts/nodes/element.js"></script> <script src="scripts/dictionary/ingredients.js"></script> diff --git a/scripts/graph.js b/scripts/graph.js @@ -1,23 +1,3 @@ -function BangNode(id,rect) -{ - Node.call(this,id,rect); - - this.glyph = NODE_GLYPHS.bang -} - -function ValueNode(id,rect,param) -{ - Node.call(this,id,rect); - - this.glyph = NODE_GLYPHS.value - this.label = param - this.param = param - - this.answer = function() - { - return this.param - } -} function PrintNode(id,rect) { @@ -30,38 +10,10 @@ function PrintNode(id,rect) } } -function AddNode(id,rect) -{ - Node.call(this,id,rect); - - this.glyph = NODE_GLYPHS.equal - this.label = "add" - - this.add = function() - { - var sum = 0; - var values = this.request(); - for(id in values){ - sum += values[id]; - } - return sum - } - - this.receive = function(q) - { - this.send(this.add()) - } - - this.answer = function() - { - return this.add() - } -} - function graph() { Ø("query").cast({x:2,y:4},QueryNode) - Ø("print").cast({x:26,y:4},PrintNode) + Ø("print").cast({x:32,y:4},PrintNode) Ø("model").mesh({x:6,y:0},[ Ø("router").cast({x:5,y:2},RouterNode), @@ -72,14 +24,18 @@ function graph() ]) Ø("view").mesh({x:18,y:0},[ - Ø("template").cast({x:2,y:2},TemplateNode), - Ø("body").cast({x:2,y:8},ElementNode), + Ø("template").cast({x:5,y:2},TemplateNode), + Ø("dom").cast({x:5,y:8},DomNode), + Ø("header").cast({x:2,y:14},ElementNode), + Ø("body").cast({x:5,y:14},ElementNode), + Ø("footer").cast({x:8,y:14},ElementNode), ]) Ø("router").syphon("database") Ø("database").syphon(["recipes","ingredients","pages"]) - Ø("template").syphon("body") + Ø("template").syphon("dom") + Ø("dom").syphon(["header","body","footer"]) Ø("query").connect("router") Ø("router").connect("template") diff --git a/scripts/lib/riven.graph.js b/scripts/lib/riven.graph.js @@ -212,4 +212,21 @@ function Riven_Graph() } this.cursor.install(this); +} + +var NODE_GLYPHS = { + default: "M150,60 L150,60 L60,150 L150,240 L240,150 Z", + router:"M60,120 L60,120 L150,120 L240,60 M60,150 L60,150 L240,150 M60,180 L60,180 L150,180 L240,240", + parser:"M60,60 L60,60 L240,60 M120,120 A30,30 0 0,1 150,150 M150,150 A30,30 0 0,0 180,180 M180,180 L180,180 L240,180 M120,120 L120,120 L60,120 M60,240 L60,240 L240,240 M240,120 L240,120 L180,120 M60,180 L60,180 L120,180", + entry:"M60,150 L60,150 L240,150 L240,150 L150,240 M150,60 L150,60 L240,150", + bang:"M150,60 L150,60 L150,180 M150,240 L150,240 L150,240", + value:"M60,60 L60,60 L240,60 L240,240 L60,240 Z M60,150 L60,150 L240,150", + equal:"M60,60 L60,60 L240,60 M60,120 L60,120 L240,120 M60,180 L60,180 L240,180 M60,240 L60,240 L240,240", + render:"M60,60 L60,60 L240,60 L240,240 L60,240 Z M240,150 L240,150 L150,150 L150,240", + database:"M60,60 L60,60 L240,60 L240,240 L60,240 Z M120,120 L120,120 L180,120 M120,180 L120,180 L180,180 M120,150 L120,150 L180,150", + cache:"M60,60 L60,60 L240,60 L240,240 L60,240 Z", + builder:"M60,60 L60,60 L150,120 L240,120 M60,150 L60,150 L240,150 M60,240 L60,240 L150,180 L240,180", + selector:"M90,60 L90,60 L60,60 L60,90 M60,210 L60,210 L60,240 L90,240 M210,240 L210,240 L240,240 L240,210 M240,90 L240,90 L240,60 L210,60", + dom: "M150,60 L150,60 L60,150 L150,240 L240,150 Z", + element: "M150,60 L150,60 L240,150 L150,240 L60,150 Z M120,150 L120,150 L180,150 M150,120 L150,120 L150,180", } \ No newline at end of file diff --git a/scripts/lib/riven.js b/scripts/lib/riven.js @@ -33,7 +33,6 @@ function Ø(s,network = RIVEN.network) function Node(id,rect={x:0,y:0,w:2,h:2}) { - this.glyph = NODE_GLYPHS.default this.id = id; this.ports = {} this.rect = rect; @@ -206,16 +205,3 @@ function Node(id,rect={x:0,y:0,w:2,h:2}) var PORT_TYPES = {default:"default",input:"input",output:"output",request:"request",answer:"answer"} var ROUTE_TYPES = {default:"default",request:"request"} -var NODE_GLYPHS = { - default: "M150,60 L150,60 L60,150 L150,240 L240,150 Z", - router:"M60,120 L60,120 L150,120 L240,60 M60,150 L60,150 L240,150 M60,180 L60,180 L150,180 L240,240", - parser:"M60,60 L60,60 L240,60 M120,120 A30,30 0 0,1 150,150 M150,150 A30,30 0 0,0 180,180 M180,180 L180,180 L240,180 M120,120 L120,120 L60,120 M60,240 L60,240 L240,240 M240,120 L240,120 L180,120 M60,180 L60,180 L120,180", - entry:"M60,150 L60,150 L240,150 L240,150 L150,240 M150,60 L150,60 L240,150", - bang:"M150,60 L150,60 L150,180 M150,240 L150,240 L150,240", - value:"M60,60 L60,60 L240,60 L240,240 L60,240 Z M60,150 L60,150 L240,150", - equal:"M60,60 L60,60 L240,60 M60,120 L60,120 L240,120 M60,180 L60,180 L240,180 M60,240 L60,240 L240,240", - render:"M60,60 L60,60 L240,60 L240,240 L60,240 Z M240,150 L240,150 L150,150 L150,240", - database:"M60,60 L60,60 L240,60 L240,240 L60,240 Z M120,120 L120,120 L180,120 M120,180 L120,180 L180,180 M120,150 L120,150 L180,150", - cache:"M60,60 L60,60 L240,60 L240,240 L60,240 Z", - builder:"M60,60 L60,60 L150,120 L240,120 M60,150 L60,150 L240,150 M60,240 L60,240 L150,180 L240,180", -} diff --git a/scripts/nodes/dom.js b/scripts/nodes/dom.js @@ -0,0 +1,6 @@ +function DomNode(id,rect) +{ + Node.call(this,id,rect); + + this.glyph = NODE_GLYPHS.dom +}+ \ No newline at end of file diff --git a/scripts/nodes/element.js b/scripts/nodes/element.js @@ -2,5 +2,5 @@ function ElementNode(id,rect) { Node.call(this,id,rect); - this.glyph = NODE_GLYPHS.entry + this.glyph = NODE_GLYPHS.element } \ No newline at end of file diff --git a/scripts/nodes/template.js b/scripts/nodes/template.js @@ -6,6 +6,6 @@ function TemplateNode(id,rect) this.receive = function(page) { - console.log(page) + console.log("page",page) } } \ No newline at end of file