Skip to content

jsl/design/Classable

Package name: jsl/design/Classable

Summary

Classable

Base Type for defining Tree Node objects with name/class

Multis

Function Description
class Optional Class Set for a Classable Element
name? Optional Name for a Classable Element
name! Force name resolution from an element

General Definitions

Function Description
to-class-vector Helper Method for managing the class vector initialization.

Definitions

Classable

Base Type for defining Tree Node objects with name/class

public deftype Classable

The class concept here is similar to the HTML/CSS class concept. Ie, it allows us to group various objects together into some logical set that we can query for later.

Multis

class

Optional Class Set for a Classable Element

public defmulti class (v:Classable) -> Vector<String>

  • Returns Vector<String>

The class set is used to indicate a set of elements that are serve a particular common function. This is similar to the class attribute in HTML where they are used for styling among other things.

name?

Optional Name for a Classable Element

public defmulti name? (v:Classable) -> Maybe<String>

  • Returns Maybe<String>

In general, the name of each element in a container should be unique. Nothing prevents the user from using the same name for multiple elements, but functions that use the elements derived from Classable may fail in subtle ways if they expect to find one element with a particular name.

name!

Force name resolution from an element

public defmulti name! (v:Classable) -> String

  • Returns String
  • Throws ValueError - If the element does not have a name

General Definitions

to-class-vector

Helper Method for managing the class vector initialization.

public defn to-class-vector (x:Seqable<String>|String) -> Vector<String>

  • Returns Vector<String>