From c3bc3545a201ea18ef87a46ffc0171472d1740de Mon Sep 17 00:00:00 2001
From: Jake Read <jake.read@cba.mit.edu>
Date: Sat, 14 Dec 2019 18:25:34 -0500
Subject: [PATCH] rm old view code -> scratch

---
 view/fconstant.js |  15 --
 view/fexample.js  |  71 -------
 view/fjiggle.js   |  10 -
 view/flink.js     | 136 ------------
 view/frect.js     | 138 ------------
 view/vbzt.js      | 119 -----------
 view/vfloater.js  | 531 ----------------------------------------------
 view/vfloop.js    | 184 ----------------
 view/vptch.js     | 152 -------------
 9 files changed, 1356 deletions(-)
 delete mode 100644 view/fconstant.js
 delete mode 100644 view/fexample.js
 delete mode 100644 view/fjiggle.js
 delete mode 100644 view/flink.js
 delete mode 100644 view/frect.js
 delete mode 100644 view/vbzt.js
 delete mode 100644 view/vfloater.js
 delete mode 100644 view/vfloop.js
 delete mode 100644 view/vptch.js

diff --git a/view/fconstant.js b/view/fconstant.js
deleted file mode 100644
index c8e9cc6..0000000
--- a/view/fconstant.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-view/fconstant.js
-
-D3 utility, not mine
-*/
-
-
-// constant: a fn' wrpper for a value,
-// because chained accessors ...
-
-export default function(x) {
-  return function() {
-    return x;
-  };
-}
diff --git a/view/fexample.js b/view/fexample.js
deleted file mode 100644
index d7a86e7..0000000
--- a/view/fexample.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-view/fexample.js
-
-Jake Read at the Center for Bits and Atoms
-(c) Massachusetts Institute of Technology 2019
-
-This work may be reproduced, modified, distributed, performed, and
-displayed for any purpose, but must acknowledge the squidworks and cuttlefish projects.
-Copyright is retained and must be preserved. The work is provided as is;
-no warranty is provided, and users accept all liability.
-*/
-
-// this is a custom d3 force, written as an es6 module like the lord intended
-// an experiment,
-// also: jake learns how the pros write js (?)
-
-import constant from './fconstant.js'
-
-// this force just
-// to start, I'm going to .vx things with some right bias, just to
-// test
-export default function(x){
-  var strength = constant(0.1),
-      nodes,
-      strengths,
-      xz
-
-  // starting off strong w/ this mystery,
-  if(typeof x !== 'function') x = constant(x == null ? 0 : +x)
-
-  // alpha is the energy in the simulation,
-  // that is slowly 'annealed' out
-  function force(alpha) {
-    for(var i = 0, n = nodes.length, node; i < n; ++i){
-      node = nodes[i]
-      let vxa = (xz[i] - node.x) * strengths[i] * alpha
-      // console.log('did', vxa)
-      node.vx += vxa
-    }
-  }
-
-  function initialize() {
-    if(!nodes) return;
-    var i, n = nodes.length
-    strengths = new Array(n)
-    xz = new Array(n)
-    for(i = 0; i < n; ++i){
-      // recall, x is a fn we can pass into this constructor
-      // to define how we set strength,
-      strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes)
-      // that '+strengths()' "coerces" whatever strength returns into a number,
-    }
-  }
-
-  // public handles?
-  force.initialize = function(_){
-    nodes = _;
-    initialize()
-  }
-
-  force.strength = function(_){
-    // bonkers
-    return arguments.length ? (strength = typeof _ === 'function' ? _ : constant(+_), initialize(), force) : strength;
-  }
-
-  force.x = function(_){
-    return arguments.length ? (x = typeof _ === 'function' ? _ : constant(+_), initialize(), force) : x;
-  }
-
-  return force
-}
diff --git a/view/fjiggle.js b/view/fjiggle.js
deleted file mode 100644
index e40c6bd..0000000
--- a/view/fjiggle.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
-view/fjiggle.js
-
-D3 utility, not mine 
-*/
-
-
-export default function() {
-  return (Math.random() - 0.5) * 1e-6;
-}
diff --git a/view/flink.js b/view/flink.js
deleted file mode 100644
index 83389de..0000000
--- a/view/flink.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-view/flink.js
-
-D3 custom force for def-to-def links 
-
-Jake Read at the Center for Bits and Atoms
-(c) Massachusetts Institute of Technology 2019
-
-This work may be reproduced, modified, distributed, performed, and
-displayed for any purpose, but must acknowledge the squidworks and cuttlefish projects.
-Copyright is retained and must be preserved. The work is provided as is;
-no warranty is provided, and users accept all liability.
-*/
-
-import constant from "./fconstant.js";
-import jiggle from "./fjiggle.js";
-
-function index(d) {
-  return d.index;
-}
-
-function find(nodeById, nodeId) {
-  var node = nodeById.get(nodeId);
-  if (!node) throw new Error("missing: " + nodeId);
-  return node;
-}
-
-export default function(links) {
-  var id = index,
-      strength = defaultStrength,
-      strengths,
-      distance = constant(30),
-      distances,
-      nodes,
-      count,
-      bias,
-      iterations = 1;
-
-  // forgive me,
-  var lheight = 27
-
-  if (links == null) links = [];
-
-  function defaultStrength(link) {
-    return 1 / Math.min(count[link.source.index], count[link.target.index]);
-  }
-
-  function force(alpha) {
-    for (var k = 0, n = links.length; k < iterations; ++k) {
-      for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) {
-        link = links[i], source = link.source, target = link.target;
-        // little more premonition here
-        // to start, refactor so that source (outputs) x- terms are offset to their right-most side
-        // and that target (inputs) x- terms are offset to their left-most side,
-        x = target.x + target.vx + target.bb.x1 - (source.x - source.vx + source.bb.x2) || jiggle();
-        y = target.y + target.vy + link.toff + link.ty * lheight - source.y - source.vy - link.soff - link.sy * lheight || jiggle();
-        l = Math.sqrt(x * x + y * y);
-        l = (l - distances[i]) / l * alpha * strengths[i];
-        x *= l, y *= l;
-        // seems like we *should* just have to mux here?
-        target.vx -= x * (b = bias[i]);
-        target.vy -= y * b;
-        source.vx += x * (b = 1 - b);
-        source.vy += y * b;
-      }
-    }
-  }
-
-  function initialize() {
-    if (!nodes) return;
-
-    var i,
-        n = nodes.length,
-        m = links.length,
-        nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d])),
-        link;
-
-    for (i = 0, count = new Array(n); i < m; ++i) {
-      link = links[i], link.index = i;
-      if (typeof link.source !== "object") link.source = find(nodeById, link.source);
-      if (typeof link.target !== "object") link.target = find(nodeById, link.target);
-      count[link.source.index] = (count[link.source.index] || 0) + 1;
-      count[link.target.index] = (count[link.target.index] || 0) + 1;
-    }
-
-    for (i = 0, bias = new Array(m); i < m; ++i) {
-      link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);
-    }
-
-    strengths = new Array(m), initializeStrength();
-    distances = new Array(m), initializeDistance();
-  }
-
-  function initializeStrength() {
-    if (!nodes) return;
-
-    for (var i = 0, n = links.length; i < n; ++i) {
-      strengths[i] = +strength(links[i], i, links);
-    }
-  }
-
-  function initializeDistance() {
-    if (!nodes) return;
-
-    for (var i = 0, n = links.length; i < n; ++i) {
-      distances[i] = +distance(links[i], i, links);
-    }
-  }
-
-  force.initialize = function(_) {
-    nodes = _;
-    initialize();
-  };
-
-  force.links = function(_) {
-    return arguments.length ? (links = _, initialize(), force) : links;
-  };
-
-  force.id = function(_) {
-    return arguments.length ? (id = _, force) : id;
-  };
-
-  force.iterations = function(_) {
-    return arguments.length ? (iterations = +_, force) : iterations;
-  };
-
-  force.strength = function(_) {
-    return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initializeStrength(), force) : strength;
-  };
-
-  force.distance = function(_) {
-    return arguments.length ? (distance = typeof _ === "function" ? _ : constant(+_), initializeDistance(), force) : distance;
-  };
-
-  return force;
-}
diff --git a/view/frect.js b/view/frect.js
deleted file mode 100644
index 2fa90ab..0000000
--- a/view/frect.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-view/frect.js
-
-D3 custom force for rectangular collisions, needs work 
-
-Jake Read at the Center for Bits and Atoms
-(c) Massachusetts Institute of Technology 2019
-
-This work may be reproduced, modified, distributed, performed, and
-displayed for any purpose, but must acknowledge the squidworks and cuttlefish projects.
-Copyright is retained and must be preserved. The work is provided as is;
-no warranty is provided, and users accept all liability.
-*/
-
-import constant from "./fconstant.js";
-import jiggle from "./fjiggle.js";
-
-const quadtree = d3.quadtree
-
-function x(d) {
-  return d.x + d.vx;
-}
-
-function y(d) {
-  return d.y + d.vy;
-}
-
-export default function(radius) {
-  var nodes,
-      radii,
-      strength = 1,
-      iterations = 1
-
-  if (typeof radius !== "function") radius = constant(radius == null ? 1 : +radius)
-
-  function force() {
-    var i, n = nodes.length,
-        tree,
-        node,
-        xi,
-        yi,
-        ri,
-        ri2;
-
-    for (var k = 0; k < iterations; ++k) {
-      // we pass to the qt, x and y as they will be computed in the
-      // next step (see fn's above)
-      tree = quadtree(nodes, x, y)
-      for (i = 0; i < n; ++i) {
-        node = nodes[i]
-        // node left, right (a note: .bb.x- should be 0-based)
-        var nxl = node.x + node.bb.x1
-        var nxr = node.x + node.bb.x2
-        var nyt = node.y + node.bb.y1
-        var nyb = node.y + node.bb.y2
-        // node center-by-bounding-box
-        var cnx = (nxr - nxl) / 2 + nxl
-        var cny = (nyb - nyt) / 2 + nyt
-        // for each node, visit each...
-        //console.log(`visit ${node.index}`)
-        tree.visit(apply)
-      }
-    }
-
-    function apply(quad, x0, y0, x1, y1) {
-      let updated = false
-      var data = quad.data, r
-      if (data) {
-        var rj = data.r
-        r = ri + rj
-        // prevents from op'ing twice
-        if (data.index > node.index) {
-          // quad.data is the node,
-          // by domain intersections...
-          //                              | -------- x ------ |
-          //          | ------------ x ------ |
-          // | ---- x --- |
-          // data left, right
-          let dxl = data.x + data.bb.x1
-          let dxr = data.x + data.bb.x2
-          // dxr or dxl within nx,
-          if(nxl < dxr && dxr < nxr || nxl < dxl && dxl < nxr){
-            // now write these
-            let dyt = data.y + data.bb.y1
-            let dyb = data.y + data.bb.y2
-            // and check,
-            if(nyt < dyt && dyt < nyb || nyt < dyb && dyb < nyb){
-              updated = true
-              // ok then, compute centers to find a direction for force-exertion
-              // maybe should also do this in prepare also (and the node data, only once)
-              let cdx = (dxr - dxl) / 2 + dxl
-              let cdy = (dyb - dyt) / 2 + dyt
-              // x overlap term
-              let xo = 0
-              if(cnx < cdx){
-                xo = nxr - dxl
-              } else {
-                xo = nxl - dxr
-              }
-              // y overlap term
-              let yo = 0
-              if(cny < cdy){
-                yo = nyb - dyt
-              } else {
-                yo = nyt - dyb
-              }
-              // just assert one axis
-              if(Math.abs(xo) > Math.abs(yo)){
-                node.vy -= yo * strength
-                data.vy += yo * strength
-              } else {
-                node.vx -= xo * strength
-                data.vx += xo * strength
-              }
-            }
-          }
-        }
-        return
-      } // end if-data
-      return updated
-    } // end apply()
-  }
-
-  function initialize() {
-    if (!nodes) return
-  }
-
-  force.initialize = function(_) {
-    nodes = _
-    initialize()
-  }
-
-  force.strength = function(_) {
-    return arguments.length ? (strength = +_, force) : strength
-  }
-
-  return force
-}
diff --git a/view/vbzt.js b/view/vbzt.js
deleted file mode 100644
index e8c2849..0000000
--- a/view/vbzt.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-view/vbzt.js
-
-bezier drawing
-
-Jake Read at the Center for Bits and Atoms
-(c) Massachusetts Institute of Technology 2019
-
-This work may be reproduced, modified, distributed, performed, and
-displayed for any purpose, but must acknowledge the squidworks and cuttlefish projects.
-Copyright is retained and must be preserved. The work is provided as is;
-no warranty is provided, and users accept all liability.
-*/
-
-
-/* ---------------------------        ---------------------------- */
-/* ----------------------- DRAWING BEZIERS ----------------------- */
-/* ---------------------------        ---------------------------- */
-
-function BezierTools(View) {
-  let view = View
-
-  let svg = {}
-  let svgns = 'http://www.w3.org/2000/svg'
-
-  this.getRightHandle = (div) => {
-    let x = div.offsetParent.offsetLeft + (div.offsetLeft + div.clientWidth)
-    let y = div.offsetParent.offsetTop + (div.offsetTop + div.clientHeight / 2)
-    return {
-      x: x,
-      y: y
-    }
-  }
-
-  this.getLeftHandle = (div) => {
-    let x = div.offsetParent.offsetLeft + (div.offsetLeft)
-    let y = div.offsetParent.offsetTop + (div.offsetTop + div.clientHeight / 2)
-    return {
-      x: x,
-      y: y
-    }
-  }
-
-  this.getFloaterHandle = (div) => {
-    let x = parseFloat(div.style.left)
-    let y = parseFloat(div.style.top) + (div.clientHeight / 2)
-    return {
-      x: x,
-      y: y
-    }
-  }
-
-  this.clear = () => {
-    // pick out svg elements and delete them ?
-    $(view.plane).children('.svg').remove()
-  }
-
-  let redrawBezier = (bz) => {
-    var bl = Math.sqrt(Math.pow((bz.x1 - bz.x2), 2) + Math.pow((bz.y1 - bz.y2), 2)) * 0.6
-    var ps = 'M ' + bz.x1 + ' ' + bz.y1 + ' C ' + (bz.x1 + bl) + ' ' + bz.y1
-    var pe = ' ' + (bz.x2 - bl) + ' ' + bz.y2 + ' ' + bz.x2 + ' ' + bz.y2
-    bz.elem.setAttribute('d', ps + pe)
-  }
-
-  let newBezier = (head, tail, width) => {
-    var bz = {}
-    bz.elem = document.createElementNS(svgns, 'path')
-    bz.elem.style.stroke = '#1a1a1a'
-    bz.elem.style.fill = 'none'
-    bz.elem.style.strokeWidth = width + 'px'
-    //bz.elem.style.zIndex = '-1'``
-    bz.x1 = 0
-    bz.y1 = 0
-    bz.x2 = tail.x - head.x
-    bz.y2 = tail.y - head.y
-    redrawBezier(bz)
-    return bz
-  }
-
-  this.writeBezier = (head, tail) => {
-    let svg = document.createElementNS(svgns, 'svg')
-    svg.style.position = 'absolute'
-    svg.style.left = head.x + 'px'
-    svg.style.top = head.y + 'px'
-    //svg.style.zIndex = '-1'
-    svg.style.overflow = 'visible'
-    svg.setAttribute('width', 12)
-    svg.setAttribute('height', 12)
-    svg.setAttribute('class', 'svg')
-    //svg.setAttribute('id', 'svg' + '_' + id)
-    let bz = newBezier(head, tail, 7)
-    svg.appendChild(bz.elem)
-    view.plane.append(svg)
-    return bz.elem
-  }
-
-  // these are 'def' objects
-  this.drawLink = (output, input) => {
-    let head = this.getRightHandle(output.de)
-    let tail = this.getLeftHandle(input.de)
-    let bz = this.writeBezier(head, tail)
-    bz.addEventListener('mouseenter', (evt) => {
-      bz.style.stroke = 'blue'
-    })
-    bz.addEventListener('mouseout', (evt) => {
-      bz.style.stroke = '#1a1a1a'
-    })
-    bz.addEventListener('contextmenu', (evt) => {
-      evt.preventDefault()
-      evt.stopPropagation()
-      // nice
-      view.requestRemoveLink(output, input).then(() => {
-        //console.log('req to rm link promise ok')
-      })
-    })
-  }
-}
-
-export default BezierTools
diff --git a/view/vfloater.js b/view/vfloater.js
deleted file mode 100644
index b4ad9b3..0000000
--- a/view/vfloater.js
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
-view/vfloater.js
-
-Jake Read at the Center for Bits and Atoms
-(c) Massachusetts Institute of Technology 2019
-
-This work may be reproduced, modified, distributed, performed, and
-displayed for any purpose, but must acknowledge the squidworks and cuttlefish projects.
-Copyright is retained and must be preserved. The work is provided as is;
-no warranty is provided, and users accept all liability.
-*/
-
-import DomTools from './vdom.js'
-
-function Floater(view, grouptype) {
-  // want one,
-  // altho, non-ideal ...
-  let dt = new DomTools(view)
-  // TODO:
-  /*
-  ... think ... think ...
-  -> button to expand, and gather? div-related?
-  -> button drags as well ? titlematter does hover, not drag, two funcitons ?
-  -> !!!!!!!!!!!!! button for fixed ! fixed !!!!!!!!!!!!!!!
-  -> roll sim back, so that fixed / unfixed is meaningful
-  -> explosions afterwards
-  */
-  // a floater is an individual that can be dragged, fixed/unfixed, etc
-  // it is exactly the thing we give to d3 to lay out
-  this.x = 0
-  this.y = 0
-  // want these,
-  this.w = 101
-  this.h = 101
-  // if it has fx, fy, it is fixed
-  this.r = 101 // to default,
-  // these are handy,
-  this.bb = {}
-  this.bb.x1 = -50
-  this.bb.y1 = -50
-  this.bb.x2 = 51
-  this.bb.y2 = 51
-  // by default, no
-  this.isFixed = false
-  // will have this to track within simulation links
-  this.simIndex = null
-
-  // every floater has *at least* this ...
-  // this is where we put the buttonz
-  this.ownElement = $(`<div>`).addClass('float').get(0)
-  $(this.ownElement).append(`<i class="em em-pushpin"></i>`)
-  $(this.ownElement).on('click', (evt) => {
-    if (this.isFixed === true) {
-      this.free()
-    } else {
-      this.fix()
-    }
-  }).on('mouseover', (evt) => {
-    document.body.style.cursor = 'pointer'
-  }).on('mouseout', (evt) => [
-    document.body.style.cursor = 'auto'
-  ])
-  $(view.plane).append(this.ownElement)
-  // fixed <i class="em em-round_pushpin"></i>
-  // open <i class="em em-pushpin"></i>
-
-  // this is a list of elements to carry about
-  this.bag = [] // gets {element, x, y}
-  // fuuu
-  let writeTitleMatter = (div, def) => {
-    let md = false
-    div.onmouseover = () => {
-      def.highlight()
-      if (!md) document.body.style.cursor = 'grab'
-    }
-    div.onmouseout = () => {
-      def.unhighlight()
-      if (!md) document.body.style.cursor = 'auto'
-    }
-    div.onmousedown = (evt) => {
-      md = true
-      document.body.style.cursor = 'grabbing'
-      // pin to current position,
-      this.fix()
-      evt.preventDefault()
-      evt.stopPropagation()
-      let domElemMouseMove = (evt) => {
-        // TRANSFORMS here to move div about on drag
-        evt.preventDefault()
-        evt.stopPropagation()
-        // need to find that top-level view's scale transform
-        this.fx += evt.movementX / view.tls
-        this.fy += evt.movementY / view.tls
-        this.newFix()
-        this.tick()
-      }
-
-      function rmOnMouseUp(evt) {
-        md = false
-        document.body.style.cursor = 'auto'
-        document.removeEventListener('mousemove', domElemMouseMove)
-        document.removeEventListener('mouseup', rmOnMouseUp)
-      }
-
-      document.addEventListener('mousemove', domElemMouseMove)
-      document.addEventListener('mouseup', rmOnMouseUp)
-    }
-  }
-
-  // -------------------------------------------- TAKE
-
-  // take up new things
-  this.typeset = []
-  this.take = (div, def, stall, resize) => {
-    let type = ''
-    // cover view-containing ... ??
-    // if ($(div).is('.native') && $(div).children().contains('.view'))
-    let item = {
-      type: '',
-      de: div,
-      def: def,
-      offsetX: 0,
-      offsetY: 0
-    }
-    // always nice to do this first,
-    // defs -> the dom
-    $(view.plane).append(item.de)
-    // only a few cases we will allow,
-    if ($(div).is('.inputs')) {
-      item.type = 'inputs'
-    } else if ($(div).is('.outputs')) {
-      item.type = 'outputs'
-    } else if ($(div).is('.defcore')) {
-      item.type = 'core'
-    } else if ($(div).is('.nativewrap')) {
-      item.type = 'native'
-      // at the gitgo, set this to our current width...
-      // this width thing is happening because you're rewriting the
-      // so ... not a take, a swap ? !!! FFUUUUU
-      // native element's wrapper ...
-      this.calculateSizes()
-      if (this.w < 200) {
-        $(item.de).css('width', `200px`)
-      } else {
-        $(item.de).css('width', `${this.w}px`)
-      }
-      // and for non-spec'd heights,
-      if (item.de.clientHeight < 10) {
-        $(item.de).css('height', '200px')
-      }
-      // ok then, resizeable also
-      dt.makeResizeable(item.de, this.onElementResize, resize)
-    } else if ($(div).is('.defbutton')) {
-      item.type = 'button'
-    } else {
-      // best guess, but..
-      item.type = 'core'
-      console.error('no thx, no recognized type when taking div into floater')
-    }
-    // put it in the baaaag
-    this.typeset.push(item.type)
-    this.bag.push(item)
-    // (also) write the drag content, if there's a header on board
-    let header = $(div).children('.header').get(0)
-    if (header) {
-      writeTitleMatter(header, item.def)
-    }
-    // just want to do this once,
-    if (stall !== true) this.onChange()
-  } // end take
-
-  this.fitNativeToFloater = () => {
-    this.calculateSizes(true)
-    // find it,
-    let nt = this.bag.find((cnd) => {
-      return cnd.type === 'native'
-    })
-    if (!nt) {
-      console.error('not finding a native element to resize here')
-    } else {
-      $(nt.de).css('width', `${this.w}px`)
-      // want also to reset the resizing handle ...
-      // kind of messy call, but
-      let w = nt.de.clientWidth
-      let h = nt.de.clientHeight
-      let handle = $(nt.de).children('.resizehandle').get(0)
-      dt.writeTransform(handle, {
-        x: w,
-        y: h
-      })
-    }
-  }
-
-  // to catch,
-  this.onElementResize = () => {
-    // this is a lot,
-    this.onChange()
-    // our parent,
-    view.kick()
-  }
-
-  // GROUP TYPES:
-  // 'edges' ... (core) with (outputs) and .edges || (inputs)
-  // 'unwrapped' ... (core) with (outputs) and .unwrapped || (inputs)
-  // 'wrapped' ... (core) with (inputs) and (outputs) and (native .view) and .wrapped
-  // 'std' ... (core) with some set of (inputs) and (outputs) and (native)
-
-  this.makeEdges = () => {
-    this.grouptype === 'edges'
-    this.onChange()
-  }
-
-  // -------------------------------------------- CHANGE
-
-  this.grouptype = grouptype
-  // don't want to do this all the time
-  // to 'open' ... put core with outputs,
-  // to 'unwrap' ... put core with inputs, it will go below
-  this.onChange = () => {
-    // find types,
-    let core = this.bag.find((cnd) => {
-      return cnd.type === 'core'
-    })
-    let inputs = this.bag.find((cnd) => {
-      return cnd.type === 'inputs'
-    })
-    let outputs = this.bag.find((cnd) => {
-      return cnd.type === 'outputs'
-    })
-    let native = this.bag.find((cnd) => {
-      return cnd.type === 'native'
-    })
-    // possible to have many,
-    let buttons = []
-    for (let item of this.bag) {
-      if (item.type === 'button') buttons.push(item)
-    }
-
-    let spaces = 5
-
-    // TYPE CASES BY TYPESET
-    //console.log('FLT onchange, floater has', core ? '(core)' : '', inputs ? '(inputs)' : '', outputs ? '(outputs)' : '', native ? '(native)' : '')
-
-    if (this.grouptype === 'std') {
-      // 'std' ... (core) with some set of (inputs) and (outputs) and (native)
-      core.offsetX = -core.de.clientWidth
-      core.offsetY = 0
-      if (inputs) {
-        inputs.offsetX = core.offsetX - inputs.de.clientWidth - spaces - 2
-        inputs.offsetY = 0
-      }
-      if (outputs) {
-        outputs.offsetX = spaces
-        outputs.offsetY = 0
-      }
-      if (native) {
-        // calc sizes, ignoring native
-        this.calculateSizes(true)
-        native.offsetX = this.bb.x1
-        native.offsetY = this.bb.y2 + spaces
-        // for resizing,
-        if (outputs) {
-          let gap = native.de.clientWidth - this.w
-          if (gap > 1) {
-            outputs.offsetX += gap
-          }
-        }
-      }
-    } else if (this.grouptype === 'unwrapped') {
-      // 'unwrapped' ... (core) with (outputs) and .unwrapped || (inputs)
-      if (core) {
-        // unwrapped, left side, core, outputs, etc
-        core.offsetX = -core.de.clientWidth
-        core.offsetY = 0
-        if (outputs) {
-          outputs.offsetX = spaces
-          outputs.offsetY = 0
-        }
-        if (native) {
-          this.calculateSizes(true)
-          native.offsetX = this.bb.x1
-          native.offsetY = this.bb.y2 + spaces
-          if (outputs) {
-            let gap = native.de.clientWidth - this.w
-            if (gap > 1) {
-              outputs.offsetX += gap
-            }
-          }
-        }
-      } else {
-        // unwrapped, right side, it's the lonely inputs
-        if (inputs) {
-          inputs.offsetX = -inputs.de.clientWidth
-          inputs.offsetY = 0
-        }
-      }
-    } else if (this.grouptype === 'wrapped') {
-      // should have 'em all let's just wyld out
-      // the view attached is king,
-      let ntw = native.de.clientWidth
-      let nth = native.de.clientHeight
-      // left ...
-      native.offsetX = -core.de.clientWidth
-      native.offsetY = core.de.clientHeight + spaces
-      // core
-      core.offsetX = -core.de.clientWidth
-      core.offsetY = 0
-      // inputs, well left
-      inputs.offsetX = core.offsetX - inputs.de.clientWidth - spaces
-      inputs.offsetY = $(inputs.de).children('.header').get(0).clientHeight + spaces + native.offsetY
-      // ouputs, as is tradition
-      outputs.offsetX = ntw + spaces + core.offsetX
-      outputs.offsetY = inputs.offsetY
-    } else if (this.grouptype === 'edges') {
-      if(core && outputs){
-        this.edgetype = 'left'
-        // and on top of self,
-        core.offsetX = -core.de.clientWidth
-        core.offsetY = -core.de.clientHeight - 25
-        outputs.offsetX = core.offsetX
-        outputs.offsetY = core.offsetY - outputs.de.clientHeight - spaces
-      } else {
-        this.edgetype = 'right'
-        inputs.offsetX = -inputs.de.clientWidth
-        inputs.offsetY = -inputs.de.clientHeight - 25
-      }
-    } else {
-      console.error(`this floater grouptype not written or recognized: '${this.grouptype}'`)
-    }
-
-    // now we can cover buttons, using core offsets
-    // cover buttons, if(buttons.length){
-    if (buttons.length > 0) {
-      if (!core) console.error('watch buttons not-on core?')
-      let inc = 0
-      for (let btn of buttons) {
-        btn.offsetX = core.offsetX + inc
-        btn.offsetY = -20 - core.offsetY
-        inc += 20
-      }
-    }
-    // ok,
-
-    // now we can execute this,
-    this.moveTo()
-    // oy oy oy
-  } // end onChange
-
-  let writePosition = (element, x, y) => {
-    $(element).css('left', `${x}px`).css('top', `${y}px`)
-  }
-
-  let readPosition = (element) => {
-    let it = $(element)
-    return {
-      x: parseInt(it.css('left')),
-      y: parseInt(it.css('top'))
-    }
-  }
-
-  let readSize = (element) => {
-    return {
-      w: element.clientWidth,
-      h: element.clientHeight
-    }
-  }
-
-  this.moveTo = (x, y, backdoor) => {
-    // but still probably want to check our offsets,
-    if (this.isFixed && !backdoor) {
-      this.x = this.fx
-      this.y = this.fy
-    }
-    // to just draw new position, run with no args
-    if (x === undefined) {
-      x = this.x
-      y = this.y
-    } else {
-      this.x = x
-      this.y = y
-    }
-    // will return this ...
-    let desire = {
-      x: 0,
-      y: 0
-    }
-    // check bounds,
-    if(!view.isTopLevel){
-      // bummer to do so many times !
-      let bounds = view.getCurrentBounds()
-      this.calculateSizes()
-      //
-      if(this.grouptype === 'edges'){
-        //console.log('bounds', bounds)
-        // x1, y1, x2, y2, w, h
-        if(this.edgetype === 'left'){
-          this.x = - this.bb.x1
-          this.y = - this.bb.y1 + 17 + 5
-        } else {
-          this.x = bounds.x2 - this.bb.x2 - 2
-          this.y = bounds.y1 - this.bb.y1 + 17 + 5
-        }
-      } else {
-        //console.log('place bounds', this.bb)
-        //console.log('bounds', bounds)
-        // x needs to contend with offset,
-        // this.bb.x1 probably -ve,
-        // this.bb.y1 probably -ve,
-        // want to track, but won't push things left or up,
-        this.x = Math.max(bounds.x1 - this.bb.x1, this.x) // lower bounds
-        this.y = Math.max(bounds.y1 - this.bb.y1, this.y)
-
-        // want-right term,
-        let rbnd = bounds.x2 - this.bb.x2
-        if(this.x > rbnd){
-          desire.x = this.x - rbnd
-          this.x = rbnd
-          // wants to go right
-        }
-        // want-down term,
-        let lbnd = bounds.y2 - this.bb.y2
-        if(this.y > lbnd){
-          desire.y = this.y - lbnd
-          this.y = lbnd
-          // wants to go down
-        }
-      }
-    }
-    // do work
-    writePosition(this.ownElement, x - 16.5, y - 20)
-    for (let item of this.bag) {
-      writePosition(item.de, this.x + item.offsetX, this.y + item.offsetY)
-    }
-    // aaaand tell em what we waaaaant
-    return desire
-  }
-
-  this.newFix = () => {
-    this.moveTo(this.fx, this.fy, true)
-  }
-
-  // as is tradition, we'll keep things local,
-  // and just make sure we re-calculate during relevant events... ?
-  this.calculateSizes = (nonNative) => {
-    // from core of xy, values like
-    //
-    //   * -------------- (y1) -------- *
-    //   |                 |            |
-    //   |(x1) --------- (x,y) ---- (x2)|
-    //   |                |             |
-    //   |                |             |
-    //   * ------------ (y2) ---------- *
-
-    let x1 = 0
-    let y1 = 0
-    let x2 = 0
-    let y2 = 0
-    for (let item of this.bag) {
-      // items are str8 cut dom elements,
-      if (nonNative && item.type === 'native') continue
-      let wt = readSize(item.de)
-      // we know item offsets, so
-      if (item.offsetX < x1) x1 = item.offsetX
-      if (item.offsetY < y1) y1 = item.offsetY
-      if (item.offsetX + wt.w > x2) x2 = item.offsetX + wt.w
-      if (item.offsetY + wt.h > y2) y2 = item.offsetY + wt.h
-      // corners
-    }
-    this.bb.x1 = x1
-    this.bb.y1 = y1
-    this.bb.x2 = x2
-    this.bb.y2 = y2
-    // ok,
-    this.w = x2 - x1
-    this.h = y2 - y1
-    // also,
-    this.r = Math.max(this.w, this.h) / 2
-    // check,
-    let aspect = this.w / this.h
-    if (aspect > 8 || aspect < 0.125) {
-      //console.error(`warning: deviously large aspect for 'circular' collisions: ${aspect}, logging floater`, this)
-    }
-  }
-
-  this.tick = () => {
-    // will use to bother the simulation
-    view.tick()
-  }
-
-  this.free = () => {
-    this.x = this.fx
-    this.y = this.fy
-    delete this.fx
-    delete this.fy
-    this.isFixed = false
-    $(this.ownElement).html(`<i class="em em-pushpin"></i>`)
-    this.tick()
-  }
-
-  this.fix = () => {
-    $(this.ownElement).html(`<i class="em em-round_pushpin"></i>`)
-    this.isFixed = true
-    this.fx = this.x
-    this.fy = this.y
-    this.moveTo(this.fx, this.fy, true)
-  }
-
-  this.fixTo = (x, y) => {
-    this.x = x
-    this.y = y
-    this.fix()
-  }
-
-  // RIP
-  this.cleanup = () => {
-    // js deletes things that are unreachable, so
-    // there are a few objects that are on the canvas we want to get rid of
-    $(this.ownElement).remove()
-    // also, any handle added to a native element
-    // not being able to search by js subset is kind of a bummer here, but
-    let native = this.bag.find((cnd) => {
-      return cnd.type === 'native'
-    })
-    if (native) {
-      $(native.de).children('.resizehandle').remove()
-    }
-  }
-  //
-}
-
-export default Floater
diff --git a/view/vfloop.js b/view/vfloop.js
deleted file mode 100644
index e108190..0000000
--- a/view/vfloop.js
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-view/vfloop.js
-
-force loop for the dom div document world
-
-Jake Read at the Center for Bits and Atoms
-(c) Massachusetts Institute of Technology 2019
-
-This work may be reproduced, modified, distributed, performed, and
-displayed for any purpose, but must acknowledge the squidworks and cuttlefish projects.
-Copyright is retained and must be preserved. The work is provided as is;
-no warranty is provided, and users accept all liability.
-*/
-
-import frect from './frect.js'
-import flink from './flink.js'
-
-function Floop(View) {
-  // it's not always the top level,
-  let view = View
-
-  // top level
-  let nodes = []
-  let links = []
-
-  let onTick = () => {
-    //console.log('tick')
-    // bounds
-    // let's also draw some svgs into the plane, to debug ...
-    // ok ok, so ...
-    let pa = {
-      x: 0,
-      y: 0
-    }
-    for (let nd of nodes) {
-      // moveTo() calls drawLinks
-      let p = nd.moveTo()
-      pa.x += p.x
-      pa.y += p.y
-    }
-    if (pa.x > 2 || pa.y > 2) {
-      let incx = 0
-      let incy = 0
-      if (pa.x > 2) incx = pa.x
-      if (pa.y > 2) incy = pa.y
-      // hot/quickfix
-      //view.requestSizeIncrease(incx, incy)
-    }
-    view.drawLinks()
-  }
-
-  let onEnd = () => {
-    //console.log(`FLOOP COMPLETE ${view.name}`)
-  }
-
-  let isquit = false;
-
-  this.quit = () => {
-    if(isquit){
-      isquit = false
-      this.reset()
-    } else {
-      this.sim.stop()
-      isquit = true
-    }
-  }
-
-  this.tick = () => {
-    if(isquit){
-      view.drawLinks()
-    } else {
-      this.sim.alpha(1)
-      this.sim.restart()
-    }
-  }
-
-  // try this 1st with one-type of def / deg, then rewrite deg structure
-  // a bit confusion, floop.reset !== floop.sim.restart()
-  this.reset = () => {
-    if(isquit) return
-    //console.log(`FLOOP RESET ${view.name}`)
-    // if we don't stop it before we write new stuff, lots of NaNs appear
-    if (this.sim) this.sim.stop()
-    // a new sim,
-    nodes.length = 0
-    links.length = 0
-
-    // NODEHUNTR 1K1
-    for (let df in view.defs) {
-      let def = view.defs[df]
-      for (let fl in view.defs[df].floaters) {
-        // ok, have def indice df, and floater indice fl
-        let floater = def.floaters[fl]
-        // we are going to flatten this, basically, so we want to track,
-        // oh no, this time they are the same, node just keeps a list of floaters
-        // we still have to push it in tho
-        // we also want to make sure sizes are all up to date ...
-        floater.calculateSizes()
-        // have to track this, for below
-        floater.simIndex = nodes.length
-        nodes.push(floater)
-        // ok,
-      } // end for-each floater-in-def
-    } // end for-each-def
-
-    // LINKHUNTR 9000
-    for (let nd in nodes) {
-      let node = nodes[nd]
-      // ok, if it contains a *set* of outputs
-      let otps = node.bag.find((cand) => {
-        return cand.type === 'outputs'
-      })
-      if (otps) {
-        //console.log('got `em')
-        // small reacharound & walkabout,
-        for (let opi in otps.def.outputs) {
-          let op = otps.def.outputs[opi]
-          for (let cn of op.connections) {
-            // cn is an input, we need to find a reciprocal,
-            // there won't *really* be that many floaters, max 4 or so,
-            // so this is almost acceptable
-            let recip
-            let inindex
-            let inoff
-            // 'l1' and 'l2' tags are labels for these loops, so that I can break both
-            // by saying 'break l1'
-            l1: for (let flt of cn.parent.floaters) {
-              l2: for (let item of flt.bag) {
-                if (item.type === 'inputs') {
-                  inindex = cn.ind
-                  inoff = item.offsetY
-                  recip = flt
-                  break l1
-                }
-              }
-            }
-            if (recip) {
-              // yikes: toff, yoff by bagitem's y-offset ...
-              links.push({
-                source: parseInt(nd), // the node that the link is from ...
-                sy: opi,
-                soff: otps.offsetY,
-                target: recip.simIndex, // pointing at ...
-                ty: inindex,
-                toff: inoff
-              })
-            } else {
-              console.error('could not find reciprocal floater for an output')
-            }
-          }
-        }
-      }
-    } // end node-in-node search for links
-
-    // do calc sizes for each,
-    for(let nd of nodes) {
-      nd.calculateSizes()
-    }
-
-    // we restart the simulation by writing over it w/ a new one
-    this.sim = d3.forceSimulation(nodes)
-      // don't touch,
-      .force('rectcollide', frect().strength(1))
-      // small charge to repel
-      // .force('charge', d3.forceManyBody().strength(-1000))
-      // spring 2gether
-      /*
-      .force('link', d3.forceLink(links).distance((link) => {
-        // nodes are floaters, links have indice, could do like
-        return 150
-      }).strength(1)) */
-      // our link,
-      .force('dirlink', flink(links).distance((link) => {
-        return 100
-      }).strength(0.1))
-      .on('tick', onTick)
-      .on('end', onEnd)
-    // to go manuel, call sim.stop()
-    // then we can call sim.tick() as we wish,
-  } // end this.reset()
-
-}
-
-export default Floop
diff --git a/view/vptch.js b/view/vptch.js
deleted file mode 100644
index da4dfc8..0000000
--- a/view/vptch.js
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
-view/vptch.js
-
-Jake Read at the Center for Bits and Atoms
-(c) Massachusetts Institute of Technology 2019
-
-This work may be reproduced, modified, distributed, performed, and
-displayed for any purpose, but must acknowledge the squidworks and cuttlefish projects.
-Copyright is retained and must be preserved. The work is provided as is;
-no warranty is provided, and users accept all liability.
-*/
-
-// patches are programs that are *incomplete without you*
-
-import GoGetter from '../../gogetter.js'
-
-function PatchSet(View) {
-  let view = View
-  let gg = new GoGetter()
-
-  // load from server should be assumed, just rip that *baybie*
-  this.findPatches = () => {
-    // and then,
-    if (!(view.interpreterName)) {
-      console.error('view has unknown interpeter, cannot save ... refresh view first')
-      return false
-    }
-    return gg.recursivePathSearch('save/contexts/' + view.interpreterName + '/', '.json', false)
-  }
-
-  this.findSystems = () => {
-    return gg.recursivePathSearch('save/systems/', '.json', false)
-  }
-
-  this.getSystem = (name) => {
-    return gg.getJson('/save/systems/' + name + '.json')
-  }
-
-  // write a prgmem
-  this.writeCurrent = (debug) => {
-    if (debug) console.log('saving ...')
-    // riperoni ok, save them all
-    let patch = {
-      // cerntakt
-      interpreterName: view.interpreterName,
-      interpreterVersion: view.interpreterVersion,
-      hunks: []
-    }
-    // the hunks,
-    for (let df of view.defs) {
-      // we save them all,
-      // on load, compare to existing in same position
-      if (debug) console.log('writing prep for', df)
-      // in order, u c
-      // the 'prep' is a patch-rep for a hunk, forgive my names
-      let prep = {
-        type: df.type,
-        name: df.name,
-        inputs: [],
-        outputs: [],
-        states: []
-      }
-      // HERE: we save state just with the index / value ?
-      if (df.states !== undefined) {
-        for (let st of df.states) {
-          prep.states.push({
-            name: st.name,
-            type: st.type,
-            value: st.value
-          })
-        }
-      }
-      // putting these in there, for sport - also allows us to save / edit without running
-      if (df.inputs !== undefined) {
-        for (let ip of df.inputs) {
-          prep.inputs.push({
-            name: ip.name,
-            type: ip.type
-          })
-        }
-      }
-      // roll for links,
-      // outputs
-      if (df.outputs !== undefined) {
-        for (let otp of df.outputs) {
-          let oprep = {
-            name: otp.name,
-            type: otp.type
-          }
-          if (otp.connections.length > 0) {
-            oprep.connections = []
-            for (let cn of otp.connections) {
-              // connections is an array of
-              //console.log('cn', cn)
-              oprep.connections.push({
-                inHunkIndex: cn.parent.ind,
-                inHunkInput: cn.ind
-              })
-            }
-          }
-          prep.outputs.push(oprep)
-        }
-      }
-
-      //
-      if (debug) console.log('wrote prep like: ', prep)
-      patch.hunks.push(prep)
-    }
-    // we have this now,
-    if (debug) console.log('the final patch: ', patch)
-    return patch
-  } // end writeCurrent
-
-  this.getPatch = (name) => {
-    return gg.getJson('/save/contexts/' + view.interpreterName + '/' + name + '.json')
-  }
-
-  // MERGE: it's a doozy:
-  this.mergePatch = (patch, debug) => {
-    return new Promise((resolve, reject) => {
-      console.log('merge for', patch)
-      // (2) check that we have a patch for this interpreter,
-      //console.log('the patch', patch)
-      if (patch.interpreterName !== view.interpreterName) {
-        console.warn(`WARN: loading patch built in a different interpreter... some hunks may not exist: patch for: "${patch.interpreterName}", but view is connected to "${view.interpreterName}"`)
-      }
-      if (patch.interpreterVersion !== view.interpreterVersion) {
-        console.warn(`WARN: loading patch built in a different version of the interpreter... patch from "${patch.interpreterVersion}" and manager is running "${view.interpreterVersion}"`)
-      }
-      // (3) we're going to load all of the hunks, one by one (not touching links)
-      mergeHunkList(patch, debug).then((defs) => {
-        // (4) then we can follow on adding links,
-        mergeLinkList(patch, debug).then(() => {
-          view.tlv.globalOrganize()
-          resolve(defs)
-        }).catch((errmsg) => {
-          // link catch
-          reject(`mergePatch error during link loading;`)
-          console.log(errmsg)
-        })
-      }).catch((errmsg) => {
-        // hunk catch
-        reject(`mergePatch error during hunk loading; ${errmsg}`)
-        console.log(errmsg)
-      })
-      // continue loading ... write a bootload of messages, in queu, waiting for each response?
-    })
-  }
-
-}
-
-export default PatchSet
-- 
GitLab