-
Notifications
You must be signed in to change notification settings - Fork 4
atomic-css major refactor! Please Review. Fixes #17 #21
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
Open
seanhess
wants to merge
5
commits into
main
Choose a base branch
from
atomic-css
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
classier, stuck on [] wierd solution with catchall list instance and empty list ToCSS major refactor! Class->Rule, Rule+media, new modules done! big improvement on before media separate type removed context wip wip refactoring back simple html definition merge selector coming along, stuck with Html : Html got Html effect to work with funky nested state stuff View with Html (). Stuck as attributes require annotations better factoring of atomic utility classes with property-based overrides! hover, bold external classes promising direction with 2 different operators wip looking good! Just can't do single tags sexy stuck on newtypes / stack layer ModAtts, ModStyles - figured out how to do single tags! moved things into atomic cleanup moving files into place example of using blaze making progress! forced to redefine everything WIP - wait, how would blaze work interesting! external type family, Category Attributes and Styles Working? Moved addAttribute to Attributable stuck - cant figure out how to resolve text reverted IsHtml Working! Wow! Styles [Rule] etc. refactored Styleable refactor Render fixed blaze example, much simpler! improved blaze CSS override rules, tests render tests, pseudo + media> NEEDS: parent? RuleSelector = Custom | FromClass refactoring: Styleable -> CSS, Attributable -> Html, etc render tests merge classes with attribute uniqueRules built in ancestor! Ready to publish atomic-css examples working switched to colon separator PxRem, Length, TRBL tests exports renamed to atomic-css renaming refactor module names refactor names and modules attributes removed web.view more refactors added Styleable to CSS fixed align infinite loop pseudo refactor attributable, styleable (a -> b) exports fixed blaze example slow error: speedup with rule map refactored Html to a list newtype remove Empty
Thanks! I'll take a deeper into it but the new interface operator looks quite intuitive! |
Any and all comments welcome! I'd especially like to hear how you like the new interface. I'm open to hearing ideas about better operators if you can think of any. Take a look at https://github.com/seanhess/atomic-css/blob/atomic-css/example/app/Main.hs |
This was referenced May 14, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As mentioned in #20 - I have completely rewritten this library. It is now focused exclusively on implementing Atomic CSS. The "View" type with its ViewId reader context will be moved to hyperbole. This library could now be used with Blaze or another html combinator library if desired.
@kfigiela @Skyfold @benjaminweb @benjamin-thomas @tusharad - please review if you can!
New library:
atomic-css
This libary will be named "atomic-css" instead of "web-view". The old package will be deprecated. There will be a Web.Hyperbole.View that builds on this libary to add the features it needs.
This will be explicity opt-in for Hyperbole. I changed my mind about ease-of-use. I think it will help to inform users that this functionality comes from this package.
New Interface
Instead of tags requiring a "Mod" argument, we have implemented two operators in the style of Blaze's
(!)
. Attributes are applied with@
, and Utility classes are applied with~
.This is what it used to be:
These are completely separate, so while you can compose attributes with each other, you can't compose an attribute and a utility:
Built-in Html Monad
This library includes an
Html
monad, which makes this a functional rendering library. It does not export any HTML tag functions, leaving this to downstream libraries.Override Styles, Fixes #17
CSS now automatically overrides any previously applied utilities that affect the same property. If you create a "component" that sets some styles, you can easily override anything without worrying about precedence:
Easy Custom CSS
I started down this path after becoming annoyed at the difficulty writing css-only tooltips. These required custom selectors. The previous interface was confusing. Now, you can create custom css rules, and these will not be modified by
hover
, etc. The example below predicatably adds a "tooltips" class to the the parent, and shows the ".tooltip" child when you hover over anything inside it.It's also much easier to define your own utilities if any are missing or you need something custom: