Git Product home page Git Product logo

pyro's Introduction

hex.pm hex.pm Documentation hex.pm github.com

Pyro

Pyro is a suite of libraries for building UI in Phoenix.

  • Pyro

    Component tooling for Phoenix.

    • Customizable "overrides" system for granularly customizable themes
    • Extended component attributes, e.g. CSS merging
  • PyroComponents

    Ready-made Phoenix components, built with pyro.

    • Heex component library
    • Overrides presets to get started quickly while allowing deep customization
  • AshPyro

    Declarative UI for Ash Framework.

    • Ash extensions providing a declarative UI DSL
  • AshPyroComponents

    Components that automatically render PyroComponents declaratively via AshPyro.

About

For more details on Pyro, check out the About page.

Installation

To install Pyro and write your own components, follow the Get Started guide. For the other features, please see the "Get Started" guide for the appropriate library instead.

Development

As long as Elixir is already installed:

git clone [email protected]:frankdugan3/pyro.git
cd pyro
mix setup

For writing docs, there is a handy watcher script that automatically rebuilds/reloads the docs locally: ./watch_docs.sh

Prior Art

  • Surface UI: Surface changed the game for LiveView. Many of its improvements have made it upstream.
  • AshAuthenticationPhoenix: The component override system is pretty awesome, and directly inspired Pyro's override system.

pyro's People

Contributors

benediktziegler avatar dependabot[bot] avatar dev-guy avatar frankdugan3 avatar terrisgit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pyro's Issues

Create more override presets

It would be great to add several options for override presets. That would make it much easier to provide end-users to pick a good starting point for their overrides.

Not just different color schemes, but differing spacing, borders, layout etc. as well. This is important not only for a quick start, but also for demonstrating/validating the flexibility of the library.

Part of this would be to rename the current default override to ash and create a more generically appealing/unbranded theme as the default.

There are a lot of great theme inspirations on Hugo.

Bug: Follow up to #26 - similar issue caused by having no attributes for a component

I am using the code in the main branch which includes the fix for #26. I found another place where a similar error occurs.

** (KeyError) key :line not found in: nil

If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map
    (pyro 0.2.0) lib/pyro/component.ex:357: Pyro.Component.__on_definition__/6
      first_attr = List.first(attrs)

      # Automatically mark the doc type as a component
      Module.put_attribute(env.module, :doc, {first_attr.line - 1, type: :component})

Component RFC: Add "copy" feature to Extra.code/1

Describe the use case/problems solved for this component revision
It would be very convenient to add a copy-to-clipboard button to the <.code /> component.

This would add the following overridables:

  • copy-class - class of the copy button
  • copy-icon-name - name of the icon
  • copy - boolean to show/enable the button

Additional context
This PhoenixFiles blog is a pretty good example implementation.

Add tooling for programmatically generating class overrides

It would be good to be able to programmatically generate classes for things like colors. Lots of components will have repetitive classes for each color, but Tailwind requires those classes to be literal to be included by the compiler.

We can work around this because we already have a custom compiler, so we could create some kind of generator macro to accumulate the literal classes and add them to a safelist to ensure Tailwind picks them up.

Simplify Installation

Currently, there are a ton of steps to install. Would be good to toss around ideas about how to minimize those and work toward a smoother experience for the end user.

#1 is one way forward by using code patching. This issue is about making a better API and instructions.

Name/Branding for project?

I'm not super happy with Phlegethon as the project name (although it is growing on my). I'm open to any suggestions on better branding, as well as a logo (I have 0 design skill).

Component: Theme selector

We need a component to select dark/light/system theme. Should be flexible, providing various layouts, such as list of buttons, drop down menu, etc.

As always, plenty of overrides to customize it as well.

Check out priv/static/pyro.js to see the client-side API.

Chicken and egg problem with Tails

hi! I'm following the install instructions, and I've run into a situation I can't seem to find my way out of. I can compile tails without setting colors_file, but when I try to do mix phlegethon.setup after setting the colors file, I get:

== Compilation error in file lib/tails.ex ==
** (File.Error) could not read file "/home/axe/src/garage/assets/tailwind.phlegethon.colors.json": no such file or directory
    (elixir 1.14.3) lib/file.ex:358: File.read!/1
    lib/tails.ex:3: (module)
could not compile dependency :tails, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile tails", update it with "mix deps.update tails" or clean it with "mix deps.clean tails"

Do I need to generate a default first?

__on_definition__ : protocol Enumerable not implemented for nil of type Atom

Describe the bug

In on_definition,

Module.get_attribute(env.module, :__components__)[name][:attrs] is returning null for my component

I'm not sure why. Does it mean my component doesn't have any attributes declared?

https://github.com/frankdugan3/pyro/blob/c9c768ac344341e620baece70a3347fbf78479a6/lib/pyro/component.ex#LL336C1-L343C31

This causes:

** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom
    (elixir 1.15.0-rc.1) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir 1.15.0-rc.1) lib/enum.ex:166: Enumerable.reduce/3
    (elixir 1.15.0-rc.1) lib/enum.ex:4384: Enum.map/2
    (pyro 0.2.0) lib/pyro/component.ex:343: Pyro.Component.__on_definition__/6
    lib/kantan_web/controllers/auth_html.ex:2: (module)

To Reproduce

git clone https://github.com/dev-guy/phoenix-ash-svelte-flowbite.git
phoenix-ash-svelte-flowbite
git checkout lv8-issue2
mix setup
mix phx.server

Expected behavior
No error

Additional context

If you comment out this line:

https://github.com/dev-guy/phoenix-ash-svelte-flowbite/blob/cafd71308d49b4bb777fd6eb3d64e4c221a4f078/lib/kantan_web.ex#L97

The problem goes away. This line of code is turning everything under assets/svelte/*.svelte into a component, and it's possible that it's creating components that aren't following the rules, which would require woutdp/live_svelte#56 to be fixed.

I can't tell which project has the bug. Perhaps live_svelte needs to add an empty list to components' metadata. Or maybe Pyro's on_definition needs to check for nil.

I'm happy to create a PR for Pyro if that's OK with you, @frankdugan3

Component: Link

Phoenix's new <.link> component is a great implementation that covers all the bases, but it might be convenient to wrap it in order to provide override classes. Would be trivial to do and probably worth the effort to provide consistency across the framework.

One goofy alternative is to name the wrapper something like <.plink>.

Interested in how people feel about this.

Bug: broken links in readme

Describe the bug
Links to AshPyro and PyroComponents are broken in readme

To Reproduce

Expected behavior

Additional context
Are AshPyro and PyroComponents open source and available?

Pyro Proposal: Archetypes - Views - Archetype Configuration - Architecture - Components - UI Actions - Navigation

Proposal - Driving Concepts

Any ERP will not use more than 20 screen types. We call them archetypes. This is a human factor not a technical factor

Lets express it in functionnal programming (dsl design can wait)

Assuming we have 100 resource and 10 archetypes

#count function Language
10 archetypes() Language: Spark DSL
1000 view = archetype(resource, architecture) Language: Spark DSL
1000 architecture = tree of components Language: Php/HEEX/JSX/PHP
50 component Language: HTML/JS Function (JSX) / Ideally One Tag.
1M view_request = view(resource_instance) .
200 navigation_item = tree of {title, ui_action} .
2000 ui_action = see the action spec bellow. .

an architecture is an adaptation of the view archetype to the resource, it's the device used for customizing an archetype to a specific resource.

There is a clear separation between this 2 levels

--------------------------
archetype <- view types any app should have less that 20. This is a Human factor not a technical factor
archetype_config <- usage may dictate different type of configuraton
view <- an instance of call to the archetype function
--------------------------
architecture. <- built with the bricks of the design system. Hence the term architecture
components. <- provided by the design system
--------------------------

UI Actions are defined here:

https://gist.github.com/couhajjou/abe2c01ea24d5d48db52ec84c0eed987#gistcomment-4824306

DSL proposal

will follow
...
...

Bug: Compilation error hero_icons

Describe the bug
On following the steps to setup the project I called mix setup and got a compilation error:

== Compilation error in file lib/phlegethon/components/core.ex ==
** (File.Error) could not list directory "/Users/bryan/open_source/phlegethon/priv/hero_icons/optimized/24/outline": no such file or directory
(elixir 1.14.3) lib/file.ex:1637: File.ls!/1
lib/phlegethon/components/core.ex:934: (module)

To Reproduce

git clone [email protected]:frankdugan3/phlegethon.git
cd phlegethon
mix setup

Wait a long time...........
Compilation error

Expected behavior
NO compilation error.

Additional context
Nope.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.