Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Configuration/Development/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,3 @@ PackageFactory:
PropTypes:
enable: true

Neos:
Neos:
fusion:
autoInclude:
'PackageFactory.AtomicFusion.PropTypes': true
6 changes: 6 additions & 0 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ Neos:
Fusion:
defaultContext:
PropTypes: \PackageFactory\AtomicFusion\PropTypes\Eel\PropTypesHelper

Neos:
Neos:
fusion:
autoInclude:
'PackageFactory.AtomicFusion.PropTypes': true
23 changes: 23 additions & 0 deletions Resources/Private/Fusion/Root.fusion
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
// this is only included in dev context
// todo not anymore
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats a proplem as we cant use eel here.
either put some logic in PropTypeExceptionHandler to determine if in dev context and fall back to the general exception handler (fusion settings)
or we use context aware objects.yaml and use an interface which we set in @exceptionHandler

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could of course achieve the previous behaviour with aop and \Neos\Neos\Domain\Service\FusionService::setPrependFusionIncludes

prototype(Neos.Fusion:Component) {
@exceptionHandler = 'PackageFactory\\AtomicFusion\\PropTypes\\Error\\ExceptionHandler\\PropTypeExceptionHandler'
}

prototype(PackageFactory.AtomicFusion:Component) {
@exceptionHandler = 'PackageFactory\\AtomicFusion\\PropTypes\\Error\\ExceptionHandler\\PropTypeExceptionHandler'
}

prototype(PackageFactory.AtomicFusion.PropTypes:PropsFromComponent) < prototype(Neos.Fusion:Value) {
Copy link
Copy Markdown
Contributor Author

@mhsdesign mhsdesign Oct 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming is WIP too - when we find a fitting name i will extract the prototypes into its own folders

suggestion by martin:

  • PackageFactory.AtomicFusion.PropTypes:ForComponent and PackageFactory.AtomicFusion.PropTypes:ForComponentArray

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i find PackageFactory.AtomicFusion.PropTypes:ForComponentCollection tempting, as i would name my php collection dto like that...

or we could also play with the words infer and props - they are common in typescript / js

or similar to React.ComponentProps<MyComponent>?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prop.Types:FromComponent
PackageFactory.AtomicFusion.PropTypes:PropTypesFromComponent

we could also use a prop isIterateable = true instead of adding a second prototype for array

type = null
isRequired = false

@context.type = ${this.type}
value = Neos.Fusion:Renderer {
renderPath = ${'/<' + type + '>/__meta/propTypes<Neos.Fusion:DataStructure>'}
@process.propsArrayToPropTypes = ${PropTypes.dataStructure(value)}
}

@process.makeRequired = ${this.isRequired ? value.isRequired : value}
@process.makeRequired.@position = "end"

}

prototype(PackageFactory.AtomicFusion.PropTypes:ArrayOfPropsFromComponent) < prototype(PackageFactory.AtomicFusion.PropTypes:ForComponent) {
type = null
isRequired = false

@process.makeArrayOf = ${PropTypes.arrayOf(value)}
}