<commit_before>plugin "ddgjs"

global {
    global.padding = 20.0
    global.stroke = 2.0
    global.selectedColor = Colors.red
    global.selectedColor2 = setOpacity(global.selectedColor, 0.25)
    global.subsetColor = Colors.purple
    global.subsetColor2 = setOpacity(global.subsetColor, 0.25)
}

Colors {
    Colors.black = rgba(0.0, 0.0, 0.0, 1.0)
    Colors.darkgray = rgba(0.1, 0.1, 0.1, 1.0)
    Colors.gray = rgba(0.8, 0.8, 0.8, 1.0)
    Colors.red = rgba(1.0, 0.0, 0.0, 1.0)
    Colors.pink = rgba(1.0, 0.4, 0.7, 1.0)
    Colors.yellow = rgba(1.0, 1.0, 0.0, 1.0)
    Colors.orange = rgba(1.0, 0.6, 0.0, 1.0)
    Colors.lightorange = rgba(1.0, 0.6, 0.0, 0.25)
    Colors.green = rgba(0.0, 1.0, 0.0, 1.0)
    Colors.blue = rgba(0.0, 0.0, 1.0, 1.0)
    Colors.sky = rgba(0.325, 0.718, 0.769, 1.0)
    Colors.lightsky = rgba(0.325, 0.718, 0.769, 0.25)
    Colors.lightblue = rgba(0.0, 0.0, 1.0, 0.25)
    Colors.cyan = rgba(0.0, 1.0, 1.0, 1.0)
    Colors.purple = rgba(0.5, 0.0, 0.5, 1.0)
    Colors.lightpurple = rgba(0.5, 0.0, 0.5, 0.25)
    Colors.white = rgba(1.0, 1.0, 1.0, 1.0)
    Colors.none = rgba(0.0, 0.0, 0.0, 0.0)
    Colors.bluegreen = rgba(0.44, 0.68, 0.60, 1.0)
}

Vertex v {
       v.shape = Circle { 
         r = 6.0
	 color = Colors.black	 
	 strokeWidth = 0.0
       }

       v.text = Text {
	 x = v.shape.x + global.padding
	 y = v.shape.y + global.padding
	 string = v.label
	 rotation = 0.0
	 color = v.shape.color
       }

       -- v.posFn = ensure onCanvas(v.shape)
       -- v.posFn = encourage center(v.shape)
}

-- Is this going to match too many times?
-- It'll match once for (e, v1, v2) and again for (e, v2, v1), because it's not ordered, as opposed to e := MkEdge(v1, v2), which can only match once
Edge e
where InVE(v1, e); InVE(v2, e)
-- where e := Mkedge(v1, v2)
with Vertex v1; Vertex v2 {
     e.shape = Line { 
     	     startX = v1.shape.x
     	     startY = v1.shape.y
     	     endX = v2.shape.x
     	     endY = v2.shape.y
	     color = Colors.black
	     thickness = 3.0
     }

     -- e.text = Text {
     --   x = midpointX(e.shape) + global.padding
     --   y = midpointY(e.shape) + global.padding
     --   string = e.label
     --   rotation = 0.0
     -- }

     e.layering1 = v1.shape above e.shape
     e.layering2 = v2.shape above e.shape
}

Face f
where f := MkFace(e1, e2, e3)
with Edge e1; Edge e2; Edge e3 {
     f.color = Colors.lightsky

     f.shape = Curve { 
     	     pathData = triangle(e1.shape, e2.shape, e3.shape)
	     strokeWidth = 0.0
	     fill = Colors.none
	     color = Colors.none
	     rotation = 0.0
     }

     -- f.text = Text {
     --   string = f.label
     --   color = f.color
     --   rotation = 0.0
     -- }
}

Vertex v; Vertex w
where InVS(v, K); InVS(w, K)
with SComplex K {
       LOCAL.repelFn = encourage repel(v.shape, w.shape)
}


Vertex v
where InVS(v, `K1`) 
with SComplex `K1` {
     v.posFn = encourage near(v.shape, -100.0, 0.0)
}

Vertex v
where InVS(v, `K2`) 
with SComplex `K2` {
     v.posFn = encourage near(v.shape, 100.0, 0.0)
}

/*
Vertex v; Vertex w
where InVS(v, `K1`); InVS(w, `K2`)
with SComplex `K1`; SComplex `K2` {
       LOCAL.repelFn = encourage repel(v.shape, w.shape)
} */

------------------ Things in a subset that result from a star

Vertex v
where InVS(v, S); S := StarV(v); IsSubsetOf(S, K)
with SSubset S; SComplex K {
      override v.shape.color = global.subsetColor
}

Edge e
where InES(e, S); S := StarV(v); IsSubsetOf(S, K)
with SSubset S; SComplex K; Vertex v {
      override e.shape.color = global.subsetColor
}
<commit_msg>[mesh] pull @wodeni's Style parser extension for plugin accessors<commit_after>plugin "ddgjs"

global {
    global.padding = 20.0
    global.stroke = 2.0
    global.selectedColor = Colors.red
    global.selectedColor2 = setOpacity(global.selectedColor, 0.25)
    global.subsetColor = Colors.purple
    global.subsetColor2 = setOpacity(global.subsetColor, 0.25)
}

Colors {
    Colors.black = rgba(0.0, 0.0, 0.0, 1.0)
    Colors.darkgray = rgba(0.1, 0.1, 0.1, 1.0)
    Colors.gray = rgba(0.8, 0.8, 0.8, 1.0)
    Colors.red = rgba(1.0, 0.0, 0.0, 1.0)
    Colors.pink = rgba(1.0, 0.4, 0.7, 1.0)
    Colors.yellow = rgba(1.0, 1.0, 0.0, 1.0)
    Colors.orange = rgba(1.0, 0.6, 0.0, 1.0)
    Colors.lightorange = rgba(1.0, 0.6, 0.0, 0.25)
    Colors.green = rgba(0.0, 1.0, 0.0, 1.0)
    Colors.blue = rgba(0.0, 0.0, 1.0, 1.0)
    Colors.sky = rgba(0.325, 0.718, 0.769, 1.0)
    Colors.lightsky = rgba(0.325, 0.718, 0.769, 0.25)
    Colors.lightblue = rgba(0.0, 0.0, 1.0, 0.25)
    Colors.cyan = rgba(0.0, 1.0, 1.0, 1.0)
    Colors.purple = rgba(0.5, 0.0, 0.5, 1.0)
    Colors.lightpurple = rgba(0.5, 0.0, 0.5, 0.25)
    Colors.white = rgba(1.0, 1.0, 1.0, 1.0)
    Colors.none = rgba(0.0, 0.0, 0.0, 0.0)
    Colors.bluegreen = rgba(0.44, 0.68, 0.60, 1.0)
}

Vertex v {
       v.shape = Circle { 
         r = 6.0
	 color = Colors.black	 
	 strokeWidth = 0.0
       }

       v.text = Text {
	 x = v.shape.x + global.padding
	 y = v.shape.y + global.padding
	 string = v.label
	 rotation = 0.0
	 color = v.shape.color
       }

       -- v.posFn = ensure onCanvas(v.shape)
       -- v.posFn = encourage center(v.shape)
}

-- Is this going to match too many times?
-- It'll match once for (e, v1, v2) and again for (e, v2, v1), because it's not ordered, as opposed to e := MkEdge(v1, v2), which can only match once
Edge e
where InVE(v1, e); InVE(v2, e)
-- where e := Mkedge(v1, v2)
with Vertex v1; Vertex v2 {
     e.shape = Line { 
     	     startX = v1.shape.x
     	     startY = v1.shape.y
     	     endX = v2.shape.x
     	     endY = v2.shape.y
	     color = Colors.black
	     thickness = 3.0
     }

     -- e.text = Text {
     --   x = midpointX(e.shape) + global.padding
     --   y = midpointY(e.shape) + global.padding
     --   string = e.label
     --   rotation = 0.0
     -- }

     e.layering1 = v1.shape above e.shape
     e.layering2 = v2.shape above e.shape
}

Face f
where f := MkFace(e1, e2, e3)
with Edge e1; Edge e2; Edge e3 {
     f.color = Colors.lightsky

     f.shape = Curve { 
     	     pathData = triangle(e1.shape, e2.shape, e3.shape)
	     strokeWidth = 0.0
	     fill = Colors.none
	     color = Colors.none
	     rotation = 0.0
     }

     -- f.text = Text {
     --   string = f.label
     --   color = f.color
     --   rotation = 0.0
     -- }
}

Vertex v; Vertex w
where InVS(v, K); InVS(w, K)
with SComplex K {
       LOCAL.repelFn = encourage repel(v.shape, w.shape)
}


Vertex v
where InVS(v, `K1`) 
with SComplex `K1` {
     -- TODO: Testing plugin accessors
     -- Doesn't pass Style compiler yet
     -- v.test1 = ddg["hello"]["vertexPosition"]
     -- v.test2 = encourage near(v.shape, -100.0, ddg["hello"][v.label])

     v.posFn = encourage near(v.shape, -100.0, 0.0)
}

Vertex v
where InVS(v, `K2`) 
with SComplex `K2` {
     v.posFn = encourage near(v.shape, 100.0, 0.0)
}

/*
Vertex v; Vertex w
where InVS(v, `K1`); InVS(w, `K2`)
with SComplex `K1`; SComplex `K2` {
       LOCAL.repelFn = encourage repel(v.shape, w.shape)
} */

------------------ Things in a subset that result from a star

Vertex v
where InVS(v, S); S := StarV(v); IsSubsetOf(S, K)
with SSubset S; SComplex K {
      override v.shape.color = global.subsetColor
}

Edge e
where InES(e, S); S := StarV(v); IsSubsetOf(S, K)
with SSubset S; SComplex K; Vertex v {
      override e.shape.color = global.subsetColor
}

{'fraction_non_alphanumeric': 0.16342517558076716, 'fraction_numerical': 0.06807131280388978, 'mean_word_length': 2.095735785953177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2749222', 'n_tokens_mistral': 3453, 'n_tokens_neox': 3118, 'n_words': 768}