View Source About
Pyro
is a component library for Phoenix
with (optional) declarative UI for Ash Framework
. Specifically, it provides five things:
- Component tooling
- A component library for
Phoenix
- A declarative UI DSL extension for
Ash Framework
- "Smart components" for
Ash Framework
- Overrides (Themes)
what-problem-is-it-solving
What "problem" is it solving?
The default model of Phoenix is to generate, then customize. While this does provide great isolation, I have found it pretty tedious to repeatedly make very similar copy & paste boilerplate changes to the generated code every time I create a new Phoenix app. Additionally, some things (like timezone localization and extended Ecto types) are quite complicated and it would be nice for them to be handled by a library that is updated with future improvements. Copy & pasting boilerplate will lead to maintenance burdens down the road.
The tricky part is handling all the bespoke features in each app while sharing as much as possible. The goal is to provide a wide array of helpers and components with sane defaults, while allowing very granular overrides.
Ash Framework
provides an excellent foundation for this on the backend. Its deep extensibility allows the DSL to be extended, and that's exactly where Pyro pours on the gas! By combining the flexible configuration of components with Ash's extensible DSL, Pyro can seamlessly add declarative UI config to Phoenix LiveView.
general-principles
General Principles
- Maximal flexibility
- Application defaults through presets & custom overrides
- Bespoke configuration (via DSL in resources)
- Components allow overriding defaults through props
- Clean, standards-compliant HTML markup
- Avoid senseless
div
s - Use the right tag(s) for the job
- Use native, semantic HTML where possible
- Avoid senseless
- Progressive enhancement
- Don't require JS (where possible)
- Use JS to enhance UX (where sensible)
- No external JS dependencies
- Should be able to bundle with ESBuild (no Node/NPM).
- Accessible
- Responsive
- Built-in
i18n
viagettext
(internationalization)