# chopsui-notes.md -rw-r--r-- 4.7 KiB View raw

#chopsui design notes

#questions

Should containers be generalized, i.e. there's not necessarily even going to be a tree unless the top-level node is a container? Or should nodes intrinsically have children? How does this choice play into the DSL, is the DSL aware of the (specialized) container types? Inclination is that the DSL can be conservatively specialized in cases like this and generalizing the internals is wise.

how to express the complex constraints of grid children? answer: with dedicated cell nodes, not by adding properties/interfaces to children as originally planned.

#dsl

yes, but optional - can also just use code

#namespaces

yes

#types & interfaces

host interface

container interface

window type

interfaces:

properties:

grid type

grid: children supports grid::layout | grid::cells
  grid::layout: children are grid::row | grid::column
    grid::row, grid::column has size constraints (similar to css grids)
  grid::cells[container]
    grid::cell(host) has row, col, rowspan, colspan

interfaces:

fixed_size interface has an immutable size signals:

contstrained_resizable interface

properties:

resizable interface

is assigned a size by external forces

methods:

presentation_manager type

methods:

signals:

#first-class tree proposal

#DSL example

namespace my_app

import
  layout::{grid,row,column}
  os::window
  widgets::*

@root
window title="My example"
  stylesheet name=window.css
    grid #root-grid
      grid::layout
        row #navbar
        row #body
        row
        column #left
        column #right grow
      grid::cells
        cell row=#navbar colspan=2 { navbar }
        cell row=2 statusbar
        cell row=#left
          text content=<
            This is my example application. I hope you like it.
          >
        cell row=#right
          text content="Your foobars will appear here."

# Defines a new type
@host(navbar)
menu [
  flow=horizontal
]
  item name="File"
    item name="Open" %select=on_select

@host(statusbar) : constrained_size(
  min_size: 100, 100
),
stacked flow=vertical
  bordered top=1 color=$black
  text content="Ready."

Pros compile:

Pros interpreted:

Maybe do both?

Should we extend the DSL to support nesting without indentation?

window ...
  +stylesheet
  +foobar
  +foobaz
    foobad
    foomad

equivalent to:

window
  stylesheet
    foobar
      foobaz
        foobad
        foomad