stylefy

Clojure(Script) library for styling user interface components with ease.

MIT License

Downloads
121.5K
Stars
317
Committers
8
stylefy - 3.2.0 Latest Release

Published by Jarzka over 3 years ago

  • ::stylefy/media and ::stylefy/supports can now be defined using vector syntax. This is useful if the order of the rules matter in CSS.
  • All stylefy's special keywords now work inside stylefy/supports style map (manual mode and scoping were previously missing)
stylefy - 3.1.0

Published by Jarzka over 3 years ago

  • Adds a new feature: ::stylefy/scope, which can be used to define styles that are applied only when the current
    element is in some specific scope. See README.md for more info.
stylefy - 3.0.0

Published by Jarzka over 3 years ago

April 9, 2021

  • stylefy.impl.dom, which handles DOM manipulation when using styles in components, has been (mostly) removed and replaced with external modules. This change frees stylefy from depending on Reagent, which makes it possible to support many UI libraries / frameworks. At the beginning, three different modules are available:
    • stylefy/reagent, which is essentially stylefy.impl.dom that was shipped in previous versions.
    • stylefy/rum, which is functionally the same module as stylefy/reagent, but for Rum.
    • stylefy/generic-dom is a general-purpose solution that does not depend on any specific UI library / framework. It makes only synchronous DOM updates, so the wide support comes with the cost of performance.
  • Namespaced keywords are replaced with unnamespaced when caching CSS. This makes different module implementations easier to work with, and it also reduces the size of the cache by approximately 7%. Unsupported cache versions are cleared automatically, so no actions are required from the users of the library.
    • This also means that after upgrading stylefy to version 3.0.0, you should not downgrade it, or the cache is going to get corrupted! (if you absolutely must downgrade, turn caching off)
  • Style hashing now checks Garden units recursively. This makes sure that if Garden units are used deeply inside a style map, they are converted to CSS before hashing, so that the hash values are the same on both frontend and backend. This can cause changes in some autogenerated class names.
  • A warning message about namespace conflict between stylefy/class and clojure.core/class is now ignored.

Migration guide from previous versions (frontend only):

Assuming you are using Reagent, update stylefy version and add stylefy/reagent as a new dependency. Your dependencies should look something like this:

[stylefy "3.0.0"]
[stylefy/reagent "3.0.0"]

Require stylefy.reagent and initialise it together with stylefy (along with any other options you pass to stylefy/init):

(:require [stylefy.reagent :as stylefy-reagent])

(stylefy/init {:dom (stylefy-reagent/init)})

That's it!

stylefy - 2.2.2

Published by Jarzka over 3 years ago

  • Minor refactoring based on clj-kondo findings. No functional changes.

PR: https://github.com/Jarzka/stylefy/pull/54

stylefy - 2.2.1

Published by Jarzka over 4 years ago

  • Fix Figwheel warning
stylefy - 2.2.0

Published by Jarzka over 4 years ago

  • Make sure that keyframes, font-face, tag, class and prepare-styles always return nil, as the return value was never designed to be used anywhere.
stylefy - 2.1.1

Published by Jarzka over 4 years ago

  • Fix tests
stylefy - 2.1.0

Published by Jarzka over 4 years ago

  • Adds support for calling keyframes, font-face, tag and class on the backend.
stylefy - 2.0.0

Published by Jarzka over 4 years ago

  • BREAKING Removes the possibility to pass ::stylefy/with-classes to use-style via options map (second argument of use-style). If you do this, a warning message is logged and the value is ignored. This feature has been marked as deprecated since version 1.3.0 (2018). If you have used ::stylefy/with-classes in options map, you can easily replace it with :class. Notice that passing ::stylefy/with-classes via style map (first argument of use-style) is still perfectly valid, this change is only related to the options map.
  • :class in HTML attributes and :stylefy.core/with-classes in style map now support additional syntax: you can pass a string, a keyword or a vector of strings or keywords. You can also pass a vector of both keywords and strings if you wish. nil is also accepted and it will be ignored. Discussion: https://github.com/Jarzka/stylefy/issues/44
  • Adds basic support for Server-Side Rendering (SSR). This means that we can now use use-style on the backend, when generating Hiccup code. This new feature does not affect how you use stylefy on the frontend. If you don't need SSR, you can simply omit it by doing nothing.
stylefy - 1.14.1

Published by Jarzka over 4 years ago

If you have used stylefy's auto-generated class names in tests, you can expect the values of those tests to change.

stylefy - 1.14.0

Published by Jarzka about 5 years ago

  • Adds support for defining modes in vector format (because the order of CSS pseudoelements is sometimes important)

The project also got a new logo with this release.

stylefy - 1.14.0-beta1

Published by Jarzka about 5 years ago

  • Adds support for defining modes in vector format (because the order of CSS pseudoelements is sometimes important)
stylefy - 1.13.3

Published by Jarzka over 5 years ago

  • Fix incorrect version number
stylefy - 1.13.2

Published by Jarzka over 5 years ago

  • Fix compile error in 1.13.1
stylefy - 1.13.1

Published by Jarzka over 5 years ago

  • Prevents the developer from entering duplicate keyframe identifiers into the DOM by mistake (PR). Thanks @iterati.
stylefy - 1.13.0

Published by Jarzka over 5 years ago

  • Same as 1.13.0 beta 1 & 2.
stylefy - 1.13.0-beta2

Published by Jarzka over 5 years ago

  • DOM node for storing constant styles is not touched if new styles are not being added. Even touching the node can have font flickering effect on some browsers in certain situations.
stylefy - 1.13.0-beta1

Published by Jarzka over 5 years ago

  • Adds a new core API function: prepare-style.

This is ultimately the same thing as prepare-styles, but it takes only one style map as a parameter and returns it. This makes it easy to prepare a style along with use-style:

[:div (use-style (prepare-style style))]

I want to remind that just as with prepare-styles, the need for using prepare-style is rare, but when it's needed, it's now a bit easier to use if the render function needs only one or two style maps to be prepared. If there are multiple style maps that need to be prepared, it is recommended to call prepare-styles instead.

  • Updating DOM during prepare-styles has been heavily optimised

Previously DOM was updated after every single sub-style preparation. Now the update is done only after the whole style map has been prepared, and only if the style map does not already exist in the DOM.

stylefy - 1.12.0

Published by Jarzka over 5 years ago

  • Same as 1.12.0-beta1
stylefy - 1.12.0-beta1

Published by Jarzka over 5 years ago