-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support dynamic "Style Containers" for alternate style mounting #14
Conversation
`runtime` is more of an "implementation detail" ns, so things that clients might reasonably want to access shouldn't live there.
element is used." | ||
(:require [spade.container :refer [IStyleContainer]])) | ||
|
||
(defonce ^:dynamic *injected-styles* (atom nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this *injected-styles*
shared between containers ? If so would that work for the case where you have the same style being injected into two different target containers ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*injected-styles*
is not shared! We may even be able to get rid of it, but basically it is the default storage atom for the default DOM container. In other words, every container created by (dom/create-container)
(IE without any args) will share this atom and store style elements in <head>
. Any container created by (dom/create-container element)
will have its own styles storage atom created by default. Finally, you can provide your own storage atom if you wish for some reason.
I have posted just one question re |
Closes #12
This comes "batteries included" for use with Reagent, shown off in the demo.cljs:
This also enables support for non-DOM targets, with the
AtomStyleContainer
:The atom provided to this Style Container will be filled with
class-name -> styles
pairs, and clients may handle them however needed to combine with the rest of the rendered content.