Skip to content

8. The canvas surface

Contents of ATD 0.1

The surface of a diagram (grammar/canvas.lark): its coordinates, notation, toolbox, forms, layout and viewpoints, each carrying the DISL construct named here (FR-003).

8.1 Coordinates and snapping

coordinates { … } (DISL §5.2) holds system <name> { … } (DISL's CoordinateSystem, §5.7), axis <name> { … } (DISL's Axis, §5.3 to §5.6), snapping <name> { … } (a snapping profile, DISL's Snapping, §5.9 and §5.10), default <system>, and settings of DISL's Coordinates.

8.2 Placement

A node's placement (DISL §5.8) is its setting placement: { … } (DISL's Placement), whose coordinates are values: a literal, @attribute for a two-way binding to an attribute, or ( CEL ). A node's snapping is its setting snapping.

8.3 Notation, themes, styles and definitions

notation { … } (DISL §6) holds:

  • theme { … }: DISL's Theme (tokens, modes, defaultMode, followSystem, contrast), its tokens keyed by dotted names (color.surface: "#FFFFFF");
  • style <name> [extends <names>] { … }: a named style, DISL's Style;
  • shape <name> { … }, marker <name> { … }, icon <name> { … }: custom shapes, markers and icons (DISL's ShapeDef, MarkerDef, IconDef);
  • canvas { … } and defaults { … }: DISL's Canvas and the notation's defaults;
  • node, edge and port notations (sections 8.4, 8.5);
  • settings of DISL's Notation (textMetric, fonts).

8.4 Node notation

node <Types> { … } is the notation of element types (DISL §6.9):

  • shape <value> [{ … }]: the shape, a built-in or defined one, with its parameters (DISL's ShapeInstance);
  • label <value> [as <id>] [{ … }]: a label, its text a value, its id after as, and DISL's Label as settings (editable, position, wrap, placeholder, …);
  • variant <name> [when <CEL>] { … }: a variant (DISL's NodeVariant), with the members of a node notation;
  • state <name> { … }: the style of a state (hover, selected, dropTarget, …, DISL's States);
  • compartment <id> { … }, badge <id> { … }, port <Types> { … }: DISL's Compartment, Badge and PortNotation;
  • settings of DISL's NodeNotation (style, size, anchors, container, icon, deletable, refusals, doubleClick, lod, tooltip, …), and of DISL's Style (fill, stroke, font, padding, …): a setting that is a property of Style and not of NodeNotation is a property of the node's inline style, its style when it names no style, or the style it adds to the one it names.

8.5 Edge notation

edge <Types> { … } is the notation of relation types (DISL §6.10), and of reference attributes: a name <Type>.<attribute> draws the edge DISL §6.10 draws for the reference attribute attribute of Type, whose type MUST be an element type, and self in it is the element that holds the attribute. Its members are line { … } (DISL's LineSpec), marker source|target|mid <value> [{ … }] (DISL §6.11), label, variant, state, and settings of DISL's EdgeNotation (selectable, deletable, reconnectable, layer, anchoring, stub, …) and, as for a node, of its inline Style.

8.6 Toolbox and context tools

toolbox { … } (DISL §7.1 to §7.4) holds group <id> ["<label>"] { … } (nested groups and tools, DISL's ToolGroup), tool <id> ["<label>"] { … } (DISL's Tool), context [for <Types>] [when <CEL>] { … } (a context tool set, DISL's ContextToolSet, whose tool [<name>] ["<label>"] { … } entries are DISL's ContextTool), template <id> ["<label>"] { … } (DISL's Template), and settings of DISL's Toolbox (generic, position, searchable, starters). A context tool has no id in DISL, so its name is optional and its block is not.

8.7 Forms

form <id> ["<label>"] [for <Types>] { … } is a form (DISL §7.5): field <attribute> ["<label>"] { … }, section [<id>] ["<label>"] { … } holding fields, sections and items, and item [<id>] ["<label>"] { … } for every other kind of form item, each with DISL's FormItem as settings; and settings of DISL's Form. A field of a form that an operation names as its paramsForm edits that operation's parameter of the same name, not an attribute. Forms are admitted in diagrams and designers (section 14.4). An embedded form is a node's setting form (DISL §7.6).

8.8 Layout

layout { … } (DISL §10) holds default <name>, algorithm <name> [capability <name>] { … }, and settings of DISL's Layout (animate, incremental, respect, trigger, containers). An algorithm is either one of DISL's (its setting algorithm: tidyTree, layered, force, rowPacked, rows, with DISL's LayoutConfig), or a capability of the layout extension point, named after capability and given its arguments as settings (section 13.3). A query argument is evaluated with self the node, or the edge, it is asked of. A layout capability's result may carry values, numbers its contract names for each node or edge it places, which the notation's CEL reads as layout.value(e, name): the number the default algorithm gave e under name, or null where it gave none, so that a drawing can follow numbers its layout computes (layout.flowRelaxation's top, sourceAt and targetAt).

8.9 Viewpoints

viewpoint <id> ["<label>"] { … } is a viewpoint (DISL §3.5, DISL's Viewpoint).

Referenced from