Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@morfeo/core - @morfeo/web | hook into resolveProperty and theme.set #816

Closed
mauroerta opened this issue Sep 12, 2023 · 0 comments · Fixed by #817
Closed

@morfeo/core - @morfeo/web | hook into resolveProperty and theme.set #816

mauroerta opened this issue Sep 12, 2023 · 0 comments · Fixed by #817

Comments

@mauroerta
Copy link
Collaborator

mauroerta commented Sep 12, 2023

@morfeo/core

Remove from @morfeo/specs and @morfeo/core any reference to responsive design since it is specific to web development.
In order to do it we have to hook into the process of resolution of the properties, for example:

A style like the following is only allowed if @morfeo/web is imported:

morfeo.parsers.resolve({
  p: {
     xs: 'm',
     md: 'l',
  }
})

But, in reality, the logic to resolve this style is actually inside the core of morfeo, @morfeo/web only augments the type Style in order to make this possible.

The idea is to hook into the process of morfeo.resolve by exposing something like morfeo.onResolveProperty, this way we can move all the logic from @morfeo/core to @morfeo/web:

// Inside @morfeo/web

morfeo.onResolveProperty(responsiveGuard);

function responsiveGuard({ property, value, next, ...rest }) {
   if (isResponsive(value)) {
       return resolveResponsiveProperty({ property, value, ...rest })
   }

   return next({ property, value, ...rest });
}

⚠ This API exposed is just an example, the final implementation could be different

MRF-28

@mauroerta mauroerta converted this from a draft issue Sep 12, 2023
@mauroerta mauroerta changed the title @morfeo/core - @morfeo/web | hook into resolveProperty and theme.set [MRF-28] @morfeo/core - @morfeo/web | hook into resolveProperty and theme.set Sep 12, 2023
mauroerta pushed a commit that referenced this issue Sep 17, 2023
@mauroerta mauroerta mentioned this issue Sep 17, 2023
6 tasks
@github-project-automation github-project-automation bot moved this from Todo to Done in morfeo v1 Sep 17, 2023
mauroerta added a commit that referenced this issue Sep 17, 2023
Co-authored-by: Mauro Erta <mauro.erta@sap.com>
@mauroerta mauroerta changed the title [MRF-28] @morfeo/core - @morfeo/web | hook into resolveProperty and theme.set @morfeo/core - @morfeo/web | hook into resolveProperty and theme.set Sep 18, 2023
mauroerta pushed a commit that referenced this issue Sep 18, 2023
@mauroerta mauroerta mentioned this issue Sep 18, 2023
6 tasks
mauroerta added a commit that referenced this issue Sep 18, 2023
Co-authored-by: Mauro Erta <mauro.erta@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant