1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-06 22:04:19 +00:00

refactor to use modern tiddlywiki features:

Replace reveal widget by conditional shortcut syntax, use string substitution, let widget
This commit is contained in:
Théophile Desmedt 2024-12-02 19:03:53 +01:00 committed by GitHub
parent 028c80782d
commit 904cfde568
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,35 +1,28 @@
title: $:/snippets/peek-stylesheets title: $:/snippets/peek-stylesheets
\define expandable-stylesheets-list() \procedure expandable-stylesheets-list()
\whitespace trim \whitespace trim
<ol> <ol>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Stylesheet]!has[draft.of]]"> <$list filter="[all[shadows+tiddlers]tag[$:/tags/Stylesheet]!has[draft.of]]">
<$vars state=<<qualify "$:/state/peek-stylesheets/open/">>> <$let openState=`$:/state/peek-tiddler/open/$(currentTiddler)$$(qualify)$` open={{{ [<openState>get[text]else[no]] }}}>
<$set name="state" value={{{ [<state>addsuffix<currentTiddler>] }}}>
<li> <li>
<$reveal type="match" state=<<state>> text="yes" tag="span"> <$checkbox tiddler=<<openState>> field="text" checked="yes" style.appearance="none">
<$button set=<<state>> setTo="no" class="tc-btn-invisible"> <span style.cursor="pointer">
{{$:/core/images/down-arrow}} <%if [<open>match[yes]]%>
</$button> {{$:/core/images/down-arrow|1em}}
</$reveal> <%else%>
<$reveal type="nomatch" state=<<state>> text="yes" tag="span"> {{$:/core/images/right-arrow|1em}}
<$button set=<<state>> setTo="yes" class="tc-btn-invisible"> <%endif%>
{{$:/core/images/right-arrow}} </span>
</$button> </$checkbox>
</$reveal> <$link/>
<$link> <%if [<open>match[yes]]%>
<$view field="title"/> <$wikify name="styles" text={{!!text}}>
</$link>
<$reveal type="match" state=<<state>> text="yes" tag="div">
<$set name="source" tiddler=<<currentTiddler>>>
<$wikify name="styles" text=<<source>>>
<$codeblock code=<<styles>> language="css"/> <$codeblock code=<<styles>> language="css"/>
</$wikify> </$wikify>
</$set> <%endif%>
</$reveal>
</li> </li>
</$set> </$let>
</$vars>
</$list> </$list>
</ol> </ol>
\end \end
@ -39,38 +32,36 @@ title: $:/snippets/peek-stylesheets
<ol> <ol>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Stylesheet]!has[draft.of]]"> <$list filter="[all[shadows+tiddlers]tag[$:/tags/Stylesheet]!has[draft.of]]">
<li> <li>
<$link> <$link/>
<$view field="title"/> <$wikify name="styles" text={{!!text}}>
</$link>
<$set name="source" tiddler=<<currentTiddler>>>
<$wikify name="styles" text=<<source>>>
<pre> <pre>
<code> <code>
<$text text=<<styles>>/> <$text text=<<styles>>/>
</code> </code>
</pre> </pre>
</$wikify> </$wikify>
</$set>
</li> </li>
</$list> </$list>
</ol> </ol>
\end \end
\whitespace trim \whitespace trim
<$vars modeState=<<qualify "$:/state/peek-stylesheets/mode/">>> <$let modeState=`$:/state/peek-stylesheets/mode/$(qualify)$` mode={{{ [<modeState>get[text]else[expand]] }}}>
<$reveal type="nomatch" state=<<modeState>> text="expanded" tag="div"> <$checkbox tiddler=<<modeState>> field="text" checked="yes" style.appearance="none">
<$button set=<<modeState>> setTo="expanded" class="tc-btn-invisible">{{$:/core/images/chevron-right}} {{$:/language/ControlPanel/Stylesheets/Expand/Caption}}</$button> <span style.cursor="pointer">
</$reveal> <%if [<mode>match[expand]]%>
<$reveal type="match" state=<<modeState>> text="expanded" tag="div"> {{$:/core/images/chevron-right|1em}} {{$:/language/ControlPanel/Stylesheets/Expand/Caption}}
<$button set=<<modeState>> setTo="restored" class="tc-btn-invisible">{{$:/core/images/chevron-down}} {{$:/language/ControlPanel/Stylesheets/Restore/Caption}}</$button> <%else%>
</$reveal> {{$:/core/images/chevron-down|1em}} {{$:/language/ControlPanel/Stylesheets/Restore/Caption}}
<%endif%>
</span>
</$checkbox>
<$reveal type="nomatch" state=<<modeState>> text="expanded" tag="div"> <%if [<mode>match[expand]]%>
<<expandable-stylesheets-list>> <<expandable-stylesheets-list>>
</$reveal> <%else%>
<$reveal type="match" state=<<modeState>> text="expanded" tag="div">
<<stylesheets-list>> <<stylesheets-list>>
</$reveal> <%endif%>
</$vars> </$let>