wurbo 0.2.0

A timy framework for WebAssembly Component model front-ends
Documentation
package demo:forms;

interface types {

  // Details required in order to add an event listener to an element
  record listen-details {
    selector: string,
    ty: string,
  }

  // Context for the minijinja rendering
  record page {
    title: string,
    target: option<string>
  }

  record input {
    placeholder: string,
    target: option<string>
  }

  record outrecord {
    value: string,
    target: option<string>
  }

  record output {
    // the resulting value of the total outputs combined
    value: option<string>,
    // optional id string: None is intial render, Some for update value
    id: option<string>,
    // the output dest for the username changes
    username: option<outrecord>,
    // the output dest for the password changes
    password: option<outrecord>,
    target: option<string>
  }

  // COntent for the entire page
  record content {
    page: page,
    input: input,
    output: option<output>,
    target: option<string>
  }

  // Context variants
  variant context {
    all-content(content),
    username(outrecord),
    password(outrecord),
  }
}

interface wurbo-in {

  use types.{listen-details};

  // Add an event listener to the given element
  addeventlistener: func(details: listen-details);

}

interface wurbo-out {

  use types.{context};

  // renders the initial Web component with the given data
  // and the target template to use as top level entry point
  render: func(ctx: context) -> result<string, string>;

  // activate listening 
  activate: func(selectors: option<list<string>>);
}

/// An example world for the component to target.
world main {
  import wurbo-in;
  export wurbo-out;
}