This should move to heading
This should just flow.
Draft
This page is not yet fully completed - we are still working on the content here. Expect some rough edges 🙃
AFX is inspired by JSX. This means you can mostly write HTML and JSX. It also has decorators like Fusion.
All Fusion decorators can be used in AFX as well. This list denotes a few special cases and aliases:
In AFX you are allowed to so called spreads. But those are just syntactic sugar and will be transpiled to Fusion's @apply
meta property.
Neos.Fusion:Tag {
tagName = 'a'
[email protected]_1 = ${props}
content = 'Is the same as @apply'
}
attributes = Neos.Fusion:DataStructure {
class = 'my-button'
id = 'bestButton'
}
These meta properties translate directly to Fusion. But in AFX one is allowed to omit the describing subkey as short notation:
Neos.Fusion:Tag {
tagName = 'a'
@if.if_1 = ${true}
content = 'Is a shorthand for @if.*'
}
@key
overrides the default generated key for the object.Â
Heading
This is just flow content
Neos.Fusion:Array {
item_1 = Neos.Fusion:Tag {
tagName = 'h2'
content = 'Heading'
}
breakline = Neos.Fusion:Tag {
tagName = 'br'
selfClosingTag = true
}
item_3 = 'This is just flow content'
}
Content between the object tags gets written per default to the content
prop of the object. To change this you can define @children
Â
I do nothing
MySite:Button {
text = 'I do nothing'
}
prototype(Docs:Button) < prototype(Neos.Fusion:Component) {
renderer = afx``
}
Move an object to the prop of a parent with @path
Â
This should move to the heading
This is default content
Docs:Article {
heading = Neos.Fusion:Tag {
tagName = 'h2'
content = 'This should move to the heading'
}
content = Neos.Fusion:Tag {
tagName = 'p'
content = 'This is default content'
}
}
prototype(Docs:Article) < prototype(Neos.Fusion:Component) {
renderer = Neos.Fusion:Tag {
tagName = 'article'
attributes.class = 'my_article'
content = Neos.Fusion:Join {
item_0 = Neos.Fusion:Tag {
tagName = 'div'
attributes.class = 'my_article_heading'
content = ${props.heading}
}
item_1 = ${props.content}
}
}
}
This should just flow.
AFX gets transpiled to Fusion. See the transpiled output inside "Generated Fusion".
This is strong
This is just flow content
Neos.Fusion:Tag {
tagName = 'p'
attributes.class = 'hello'
content = Neos.Fusion:Join {
item_1 = Neos.Fusion:Tag {
tagName = 'strong'
content = 'This is strong'
}
item_2 = Neos.Fusion:Tag {
tagName = 'br'
}
item_3 = 'This is just flow content'
}
}
This is strong
This is just flow content
This example contains all common syntax patterns.
AFX Preview
{item}
Read more
Neos.Fusion:Tag {
tagName = 'article'
attributes.class = 'hello'
attributes.id = My.Site:IdGenerator {
}
content = Neos.Fusion:Join {
heading = Neos.Fusion:Tag {
tagName = 'h2'
@if.if_1 = ${!props.heading}
content = 'AFX Preview'
}
item_2 = Neos.Fusion:Loop {
items = 'props.items'
itemName = 'item'
content = Neos.Fusion:Tag {
tagName = 'p'
content = ${item}
}
}
item_3 = Neos.Fusion:Augmenter {
class = ${props.link == '#title' ? 'int' : 'ext'}
content = Neos.Fusion:Tag {
attributes.href = ${props.link}
@apply.spread_1 = ${props.linkProps}
tagName = 'a'
attributes.rel = 'bookmark'
content = 'Read more'
}
}
}
}
heading = null
linkProps = Neos.Fusion:DataStructure {
attributes.title = 'Click me'
attributes.href = '#top'
attributes.class = 'default-link'
attributes.rel = 'help'
}
items = Neos.Fusion:DataStructure {
first = 'First paragraph'
second = 'Second paragraph'
}
link = "https://www.neos.io/"
First paragraph
Second paragraph
Read more