fusion-afx
fusion-afx copied to clipboard
Cannot use prototype as @process
All of these do not work:
// -> literally "Acme.Com:Processor" as result
<a href={props.href} @process.foo="Acme.Com:Processor">
// -> Expression "Acme.Com:Processor" could not be parsed. Error starting at character 18: ":Processor".
<a href={props.href} @process.foo={Acme.Com:Processor}>
// -> Prop-assignment "@process.foo" was not followed by quotes or braces
<a href={props.href} @process.foo=Acme.Com:Processor>
But this would work in "pure" Fusion:
@process.tracking = Acme.Com:Processor
You can do
<a href={props.href}>
<Acme.Com:Processor @path="process.foo"/>
@kdambekalns @Sebobo How about a syntax like this:
<a href={props.href} @process.foo=<Acme.Com:Processor/> >
This would allow to separate afx-attributes from expression and string attributes.
Another use case would be:
<Vendor.Site:TwoColumn
left=<Neos.Neos:ContentCollection nodePath="left"/>
right=<Neos.Neos:ContentCollection nodePath="right"/>
/>
Personally I dislike the tag/prototype in an attribute style. JSX also doesn't allow it I think.
Just found out some days ago that XSL also does it the same way as AFX does it now. Have a child tag and apply its result to an attribute of the parent.
JSX would allow you to do this <a href={props.href} @process.foo={<Acme.Com:Processor/>} >
UPDATE: I was wrong jsx does'nt allow this yet UPDATE2: Was wrong in beeing wrong. JSX supports this indeed
<a href={props.href} @process.foo={<Acme.Com:Processor/>} >
looks a bit better than the other proposals IMO.
it could maybe be solved with <a href={props.href} @process.foo={afx:<Acme.Com:Processor/>} >...</a>
as @mficzel pointed out in slack
Still don't like how the code looks when tags are contained in attributes.
@Sebobo JSX allows jsx in attributes like this:
<Foo stuff={<Bar />} />
In this regard it would make sense to allow an expression to contain afx again maybe like this:
afx`<Foo stuff={afx:<Bar />} />`
could be solved by my afx in eel approach similar to jsx: https://github.com/neos/fusion-afx/issues/28#issuecomment-1012425673 what do you think?