semagrams

package semagrams

A library for developing interactive semantic diagrams

Attributes

Members list

Concise view

Type members

Classlikes

case class Actions(es: EditorState, m: UndoableVar[ACSet], ui: UIState)

This class bundles the common arguments to many actions one might want to do in a binding so that you don't have to pass them in every time, and then provides a bunch of commonly used actions as methods.

This class bundles the common arguments to many actions one might want to do in a binding so that you don't have to pass them in every time, and then provides a bunch of commonly used actions as methods.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
case class Background() extends Entity

An entity for the background of the Semagrams app.

An entity for the background of the Semagrams app.

Used as the source entity for click events on the background.

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Entity
class Object
trait Matchable
class Any
object Background extends EntityType

The EntityType for Background

The EntityType for Background

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class Binding[A](selector: PartialFunction[Event, IO[A]], predicate: Option[BindingPredicate], docs: String)

A Binding associates an IO returning A action to events.

A Binding associates an IO returning A action to events.

Attributes

A

The type that the binding eventually returns

docs

A description of the behavior of the binding, to be shown in a help screen.

modifiers

If present, the event only matches if these KeyModifiers are down.

selector

The function which says if an event "matches", and if so, what to do with it.

Todo:

selector should be concrete data that implements a trait, and part of that trait is a description of the binding, like "Ctrl-click on a box" or "press a".

actually use docs

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
object Binding

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Binding.type
case class BoundingBox(pos: Complex, dims: Complex)

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Controllers manage global state. They have an apply method which hooks them up to whatever they need in the EditorState, and also adds the right hooks to the main element.

Controllers manage global state. They have an apply method which hooks them up to whatever they need in the EditorState, and also adds the right hooks to the main element.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class EditorState(val elt: SvgElement, dispatcher: Dispatcher[IO], val eventQueue: Queue[IO, Event])

This is the main state for Semagrams.

This is the main state for Semagrams.

Even though we call this "state", notice that everything here is actually immutable. The state itself is all stored in Laminar stuff, like Vars and EventBuses.

We pass in dispatcher and eventQueue because this constructor can't run in IO, and thus can't make them itself. It can however use the dispatcher to attach the EventBus of events to the queue.

Attributes

dispatcher

An IO dispatcher, used to bind the EventBus of events to eventQueue.

elt

The main svg element of the semagram.

eventQueue

A queue to use for events. We might also throw things into this queue for testing purposes.

Graph
Supertypes
class Object
trait Matchable
class Any
trait Entity

A reference to an logically distinct part of the Semagram, for instance a vertex, an edge, a ui element, etc.

A reference to an logically distinct part of the Semagram, for instance a vertex, an edge, a ui element, etc.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class SubEntity
class Part
trait SrcPort
class Box
class Diagram
trait TgtPort
class Box
class Diagram
case class EntityCollection(em: EntityMap, ordering: Seq[Entity])

A collection of entities and sprites

A collection of entities and sprites

Attributes

em

an EntityMap mapping entities to Sprites and ACSets

ordering

the order in which the sprites should be placed in the window. This matters for figuring out which sprite should be on top in the case of overlaps.

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
object EntityMap

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
case class EntitySource[A](entities: (A, EntityMap) => Seq[(Entity, Sprite, ACSet)])

A wrapper around a function which extracts a sequence of entity, sprite, acset tuples from data of type A and an EntityMap with previously-extracted entities. The reason we have both something of type A and an EntityMap is that we might want to query, for instance, the boundary of a previously extracted vertex while constructing an edge.

A wrapper around a function which extracts a sequence of entity, sprite, acset tuples from data of type A and an EntityMap with previously-extracted entities. The reason we have both something of type A and an EntityMap is that we might want to query, for instance, the boundary of a previously extracted vertex while constructing an edge.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
class EntitySourceViewport[A](state: Signal[A], entitySources: Seq[EntitySource[A]]) extends Viewport

A basic implementation of Viewport that extracts entities using a sequence of EntitySourcess from a signal of type A.

A basic implementation of Viewport that extracts entities using a sequence of EntitySourcess from a signal of type A.

Later elements of entitySources have access to the entities, sprites and acsets extracted by previous elements.

Attributes

Graph
Supertypes
trait Viewport
class Object
trait Matchable
class Any

A runtime-introspectable type tag for an Entity.

A runtime-introspectable type tag for an Entity.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Background.type
class PartType
trait Ob
object Box.type
object InPort.type
object OutPort.type
object Wire.type
class DynOb
object E.type
object V.type
object I.type
object O.type
object S.type
object T.type
object Box.type
object Wire.type
object SrcPort.type
object TgtPort.type
object AnonEntity.type
enum Event

Attributes

Graph
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
enum GenericProperty[T] extends Property

Attributes

Graph
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
trait Property
class Object
trait Matchable
class Any

Attributes

Companion:
object
Graph
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Attributes

Companion:
enum
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Companion:
object
Graph
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Attributes

Companion:
enum
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
trait PValue[T] extends Property

A subtrait of Property that is simpler to implement when there's an implicit ReadWriter for your value type in scope

A subtrait of Property that is simpler to implement when there's an implicit ReadWriter for your value type in scope

Attributes

Graph
Supertypes
trait Property
class Object
trait Matchable
class Any
Known subtypes
object SName.type
object TName.type
object Program.type
object Concentration.type
object Rate.type
object SName.type
object TName.type
object Src.type
object Tgt.type
object boxTy.type
class diagTy[P]
case class PropMap(pmap: Map[Property, Any])

A dependently-typed, persistent mapping from properties to values; the type of the value stored for a given property depends on the property.

A dependently-typed, persistent mapping from properties to values; the type of the value stored for a given property depends on the property.

We implement this internally with a Map from Property to Any, and then enforce that only things of the right property are used by only exposing well-typed insertion mappings.

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
object PropMap

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
PropMap.type
trait Property

An attribute that can be attached to an Entity.

An attribute that can be attached to an Entity.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait PValue[T]
object SName.type
object TName.type
object Program.type
object Concentration.type
object Rate.type
object SName.type
object TName.type
object Src.type
object Tgt.type
object boxTy.type
class diagTy[P]
trait Attr
trait Hom
object IS.type
object IT.type
object OS.type
object OT.type
object Src.type
object Tgt.type
enum WireProp[T]
abstract class Semagram

The abstract class that you create an instance of to create a Semagram

The abstract class that you create an instance of to create a Semagram

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Sprite

A Sprite contains the information necessary to turn a sub-ACSet into a reactive SVG on the screen.

A Sprite contains the information necessary to turn a sub-ACSet into a reactive SVG on the screen.

TODO: Sprites should have an "injection" method for statically computing some layout that they want to have available for boundaryPt/bbox queries, or simply adding default properties. This injection is called before present, and the result is saved in the EntityMap. Currently, each sprite has some custom code for being able to have defaults; that should not be custom because then it is inconsistent.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Arrow
class DPBox
class Disc
class Rect
class Wire
class WireStub
case class SubEntity(parent: Entity, child: Entity) extends Entity

An entity that is logically a part of the parent

An entity that is logically a part of the parent

Attributes

Todo:

I'm not sure we really use this; is this necessary?

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Entity
class Object
trait Matchable
class Any
case class SubEntityType(parentTy: EntityType, childTy: EntityType) extends EntityType

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
case class TransformState(m: Var[Transform])

A bit of state storing the current affine transform of a viewport.

A bit of state storing the current affine transform of a viewport.

Currently unused.

Attributes

Todo:

use this for zooming/translation

maybe just use a Var[Transform] directly?

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
trait Viewport

A semagrams app is split into several viewports.

A semagrams app is split into several viewports.

The reason for this is that we might want to apply different affine transformations to different parts of the app. For instance, we might have UI elements in one viewport, and the main acset in another viewport, so that we can zoom out on the main acset without making all of the buttons tiny.

Currently transforms are unimplemented; however this was just the result of an incomplete refactor, and it should be straightforward to add them back.

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Viewport

Utility methods associated with Viewports

Utility methods associated with Viewports

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Types

type BindingPredicate = (EditorState, Event) => Boolean
type EntityMap = Map[Entity, (Sprite, ACSet)]

A map associating a Sprite and an ACSet to the entities alive in the Semagram.

A map associating a Sprite and an ACSet to the entities alive in the Semagram.

ACSets have properties associated to their roots, but also subparts, both of which might be used by the Sprite.

Attributes

type HandlerAttacher = (Entity, SvgElement) => Unit

Value members

Concrete methods

def baseSvg(): ReactiveSvgElement[SVGSVGElement]

This creates the svg element that will all of the Semagrams activity

This creates the svg element that will all of the Semagrams activity

Attributes

def bindEvent(ev: Event): Binding[Unit]

Matches events equal to ev

Matches events equal to ev

Attributes

Matches clicks on entities with button, returns the entity clicked on.

Matches clicks on entities with button, returns the entity clicked on.

Attributes

def clickOn[E <: Entity](button: MouseButton, ty: EntityType): Binding[E]

Matches clicks on entities of entity type ty with button button, returns the entity clicked on.

Matches clicks on entities of entity type ty with button button, returns the entity clicked on.

Attributes

Matches clicks on parts of part type ty with button button, returns the part clicked on.

Matches clicks on parts of part type ty with button button, returns the part clicked on.

Attributes

Matches clicks on parts with button button, returns the part clicked on.

Matches clicks on parts with button button, returns the part clicked on.

Attributes

clickOn for doubleclicks

clickOn for doubleclicks

Attributes

clickOnPart for doubleclicks

clickOnPart for doubleclicks

Attributes

clickOnPart for doubleclicks

clickOnPart for doubleclicks

Attributes

def keyDown(key: String): Binding[Unit]

Matches keydown events for key

Matches keydown events for key

Attributes

def keyUp(key: String): Binding[Unit]

Matches keyup events for key

Matches keyup events for key

Attributes

def mouseUp(button: MouseButton): Binding[Option[Entity]]

Matches a mouseup event either on or off an entity, returns an option of an entity.

Matches a mouseup event either on or off an entity, returns an option of an entity.

Attributes

Matches mouseup events on that are on an entity, returns that entity

Matches mouseup events on that are on an entity, returns that entity

Attributes

Concrete fields

val genProps: Map[String, Property]

Exports

Defined exports

final type Click = Click
Exported from Event$
Exported from Event$
Exported from Event$
final type KeyDown = KeyDown
Exported from Event$
final type KeyUp = KeyUp
Exported from Event$
final type MouseDown = MouseDown
Exported from Event$
final type MouseLeave = MouseLeave
Exported from Event$
final type MouseMove = MouseMove
Exported from Event$
final type MouseUp = MouseUp
Exported from Event$