Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

canner script

Siou edited this page May 13, 2019 · 7 revisions

To support a way for users to declare the schema easily. We take JSX as the interface. And canner-script is the pragma of JSX. If you're not familiar with how JSX transform to Javascript, please check out @babel/plugin-transform-react-jsx first since this page only explain the concepts of canner-script.

The Pragma

The default export function builder is the pragma of JSX. It finally returns a JSON.

Model

Basically, a type tag generates a model instance, and the method toJson is called immediately to return the JSON object of the tag.

Layout and Visitors

<Layout> is the tag which is used to rearrange the Layout of fields in Canner. It doesn't represent any data.

To separate the <Layout> information and data schema, we don't embed the layout information in the data schema. Instead, each <Layout> tag creates a Visitor that is used to change the component tree.

Clone this wiki locally