fusion-afx icon indicating copy to clipboard operation
fusion-afx copied to clipboard

Cannot use prototype as @process

Open kdambekalns opened this issue 6 years ago • 9 comments

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

kdambekalns avatar Jun 22 '18 14:06 kdambekalns

You can do

<a href={props.href}>
  <Acme.Com:Processor @path="process.foo"/>

Sebobo avatar Nov 11 '19 12:11 Sebobo

@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"/>
/>

mficzel avatar Jan 21 '20 08:01 mficzel

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.

Sebobo avatar Jan 21 '20 08:01 Sebobo

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

mficzel avatar Jan 21 '20 08:01 mficzel

<a href={props.href} @process.foo={<Acme.Com:Processor/>} > looks a bit better than the other proposals IMO.

Sebobo avatar Jan 21 '20 08:01 Sebobo

it could maybe be solved with <a href={props.href} @process.foo={afx:<Acme.Com:Processor/>} >...</a> as @mficzel pointed out in slack

mhsdesign avatar Nov 15 '21 18:11 mhsdesign

Still don't like how the code looks when tags are contained in attributes.

Sebobo avatar Nov 16 '21 12:11 Sebobo

@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 />} />`

mficzel avatar Nov 16 '21 14:11 mficzel

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?

mhsdesign avatar Jan 13 '22 19:01 mhsdesign