Created
January 8, 2015 22:31
-
-
Save Arlen22/02c0b6a4cd46df21de86 to your computer and use it in GitHub Desktop.
Static Tag Macro demonstration
This file contains 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
<<taga $:/tags/GettingStarted>> |
This file contains 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
\define tag-styles() | |
background-color:$(backgroundColor)$; | |
fill:$(foregroundColor)$; | |
color:$(foregroundColor)$; | |
\end | |
\define tag-body-inner(colour,fallbackTarget,colourA,colourB) | |
<$set name="foregroundColor" value=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">>> | |
<$set name="backgroundColor" value="""$colour$"""><!--popup=<<qualify "$:/state/popup/tag">>--> | |
<$button popup=<<qualify "$:/state/popup/tag">> class="tc-btn-invisible tc-tag-label" style=<<tag-styles>> static="yes"> | |
<$transclude tiddler={{!!icon}}/> <$view field="title" format="text" /> | |
</$button> | |
<$reveal state=<<qualify "$:/state/popup/tag">> render="always" type="popup" position="below" animate="yes" ><div class="tc-drop-down"><$transclude tiddler="$:/core/ui/ListItemTemplate"/> | |
<hr> | |
<$list filter="[all[current]tagging[]]" template="$:/core/ui/ListItemTemplate"/> | |
</div> | |
</$reveal> | |
</$set> | |
</$set> | |
\end | |
\define tag-body(colour,palette) | |
<span class="tc-tag-list-item"> | |
<$macrocall $name="tag-body-inner" colour="""$colour$""" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}}/> | |
</span> | |
\end | |
<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}}/> |
This file contains 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
\define taga(tag) | |
{{$tag$||StaticTagMacro}} | |
\end |
After doing this I changed things around some more and added a way to notify popup reveals directly from the popup mechanism when there is a change rather than waiting for the whole program to update. It still needs a bit of help, but it is better. Of course, I also included always render for all popups. The result is that dropdowns open almost instantly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/Arlen22/TiddlyWiki5/tree/tagMacroTest