Run the following commands:
cd components
npm install
oryarn install
yarn start
Directories
components/src/components
- contains a stenciljs-bootstraped projectcomponents/src/components/components
- contains a set of web components used when renderingcomponents/src/components/utils
- utility functions
<jsc-app></jsc-app>
is the main entry point for rendering a component. A component is rendered by providing a list of objects conforming to a speficic standard.
Here's an example of how we can render a Navbar component:
[
{
"component":"Navbar",
"sections":{
"links":[
{
"component":"NavLink",
"props":{
"label":"Home"
}
},
{
"component":"NavLink",
"props":{
"label":"About"
}
}
]
},
"props":{
"title": "Jaseci App"
}
}
]
The above code will generate the following markup.
<jsc-nav-bar label="Jaseci App">
<div slot="links">
<jsc-nav-link label="Home"></jsc-nav-link>
<jsc-nav-link label="About"></jsc-nav-link>
</div>
</jsc-nav-bar>
component
is used to determine which html element to generate.sections
are array of components to be rendered as a child ofcomponent
, each slot has a name to determine where it will be renderedprops
are attributes that will be attached to the generated element
The generated navbar might look like this:
- renderComponentTree
- The
renderComponentTree
functions accepts an array ofJaseciComponent
and converts it to a string of custom html elements.
- The
- renderComponent
renderComponent
accepts a singleJaseci Component
component and generates and converts it to a custom html element