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

Add a new Component-based API and a much more flexible rendering system #61

Merged
merged 1 commit into from
May 11, 2021

Conversation

JohnSundell
Copy link
Owner

  • Refactor Plot's rendering system to become much more flexible, by replacing the previous ElementRenderer class with a new, general-purpose Renderer struct, and by refactoring the Node enum into a struct that carries a free-form rendering closure. All of these changes are pure refactors - they don't affect the public API at all.
  • Add a new Component API that enables HTML <body> components to be defined in a very SwiftUI-like way. The new API ships with lots of built-in implementations that map to commonly used elements (such as div, a, ul, and so on), and enables the API user to easily define their own components as well. It also features an environment API (similar to the one that SwiftUI offers), the ability to apply modifiers to components, and complete interoperability with the existing Node-based API.
  • All of these changes are completely additive and fully backward compatible with the old API. The only potential situation that could cause these changes to be breaking for an API user is if a Node value was being switched on. Since it's now no longer an enum, that will no longer work, but it's highly unlikely that Plot's API has been used this way by any API user.
  • Update the documentation for the new Component API.

- Refactor Plot's rendering system to become much more flexible, by replacing the previous
   `ElementRenderer` class with a new, general-purpose `Renderer` struct, and by refactoring
   the `Node` enum into a struct that carries a free-form `rendering` closure. All of these changes
   are pure refactors - they don't affect the public API at all.
- Add a new `Component` API that enables HTML `<body>` components to be defined in a
   very SwiftUI-like way. The new API ships with lots of built-in implementations that map to
   commonly used elements (such as `div`, `a`, `ul`, and so on), and enables the API user to
   easily define their own components as well. It also features an environment API (similar to
   the one that SwiftUI offers), the ability to apply modifiers to components, and complete
   interoperability with the existing `Node`-based API.
- All of these changes are completely additive and fully backward compatible with the old API.
   The only potential situation that could cause these changes to be breaking for an API user is
   if a `Node` value was being switched on. Since it's now no longer an enum, that will no longer
   work, but it's highly unlikely that Plot's API has been used this way by any API user.
- Update the documentation for the new `Component` API.
@JohnSundell JohnSundell merged commit 80612b3 into master May 11, 2021
@JohnSundell JohnSundell deleted the component-api branch May 11, 2021 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant