-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
improvement: $:/snippets/peek-stylesheets to use modern tiddlywiki features #8794
Draft
DesignThinkerer
wants to merge
2
commits into
TiddlyWiki:master
Choose a base branch
from
DesignThinkerer:patch-2
base: master
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.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,52 @@ | ||
title: $:/snippets/peek-stylesheets | ||
|
||
\define expandable-stylesheets-list() | ||
\whitespace trim | ||
<ol> | ||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Stylesheet]!has[draft.of]]"> | ||
<$vars state=<<qualify "$:/state/peek-stylesheets/open/">>> | ||
<$set name="state" value={{{ [<state>addsuffix<currentTiddler>] }}}> | ||
<li> | ||
<$reveal type="match" state=<<state>> text="yes" tag="span"> | ||
<$button set=<<state>> setTo="no" class="tc-btn-invisible"> | ||
{{$:/core/images/down-arrow}} | ||
</$button> | ||
</$reveal> | ||
<$reveal type="nomatch" state=<<state>> text="yes" tag="span"> | ||
<$button set=<<state>> setTo="yes" class="tc-btn-invisible"> | ||
{{$:/core/images/right-arrow}} | ||
</$button> | ||
</$reveal> | ||
<$link> | ||
<$view field="title"/> | ||
</$link> | ||
<$reveal type="match" state=<<state>> text="yes" tag="div"> | ||
<$set name="source" tiddler=<<currentTiddler>>> | ||
<$wikify name="styles" text=<<source>>> | ||
\procedure expandable-content() | ||
<$wikify name="styles" text={{!!text}}> | ||
<$codeblock code=<<styles>> language="css"/> | ||
</$wikify> | ||
</$set> | ||
</$reveal> | ||
</li> | ||
</$set> | ||
</$vars> | ||
</$list> | ||
</ol> | ||
\end | ||
|
||
\define stylesheets-list() | ||
\procedure toggle-content() | ||
<$parameters openState="" open="[<openState>substitute[]get[text]else[no]]" openImage="$:/core/images/down-arrow" closedImage="$:/core/images/right-arrow" openCaption="" closedCaption=""> | ||
<%if [<openState>!is[blank]] %> | ||
<$checkbox tiddler={{{ [<openState>substitute[]] }}} field="text" checked="yes" style.appearance="none"> | ||
<span style.cursor="pointer"> | ||
<%if [subfilter<open>match[yes]] %> | ||
<$transclude $tiddler=<<openImage>> size="1em" /> <<openCaption>> | ||
<%else%> | ||
<$transclude $tiddler=<<closedImage>> size="1em" /> <<closedCaption>> | ||
<%endif%> | ||
</span> | ||
</$checkbox> | ||
<%endif%> | ||
</$parameters> | ||
\end | ||
|
||
\procedure expandable-list() | ||
\whitespace trim | ||
<$parameters filter="" openState="" open="[<openState>substitute[]get[text]else[no]]"> | ||
<ol> | ||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Stylesheet]!has[draft.of]]"> | ||
<$list filter=<<filter>> > | ||
<li> | ||
<$link> | ||
<$view field="title"/> | ||
</$link> | ||
<$set name="source" tiddler=<<currentTiddler>>> | ||
<$wikify name="styles" text=<<source>>> | ||
<pre> | ||
<code> | ||
<$text text=<<styles>>/> | ||
</code> | ||
</pre> | ||
</$wikify> | ||
</$set> | ||
<$transclude $variable="toggle-content" open=<<open>> openState=<<openState>> /> | ||
<$link/> | ||
<%if [subfilter<open>match[yes]]%> | ||
<<expandable-content>> | ||
<%endif%> | ||
</li> | ||
</$list> | ||
</ol> | ||
</$parameters> | ||
\end | ||
\whitespace trim | ||
|
||
<$vars modeState=<<qualify "$:/state/peek-stylesheets/mode/">>> | ||
<$let modeState=`$:/state/peek-stylesheets/mode/$(qualify)$` mode={{{ [<modeState>get[text]else[expand]] }}} listFilter="[all[shadows+tiddlers]tag[$:/tags/Stylesheet]!has[draft.of]]"> | ||
|
||
<$reveal type="nomatch" state=<<modeState>> text="expanded" tag="div"> | ||
<$button set=<<modeState>> setTo="expanded" class="tc-btn-invisible">{{$:/core/images/chevron-right}} {{$:/language/ControlPanel/Stylesheets/Expand/Caption}}</$button> | ||
</$reveal> | ||
<$reveal type="match" state=<<modeState>> text="expanded" tag="div"> | ||
<$button set=<<modeState>> setTo="restored" class="tc-btn-invisible">{{$:/core/images/chevron-down}} {{$:/language/ControlPanel/Stylesheets/Restore/Caption}}</$button> | ||
</$reveal> | ||
<$transclude $variable="toggle-content" openImage="$:/core/images/chevron-right" closedImage="$:/core/images/chevron-down" openState=<<modeState>> openCaption={{$:/language/ControlPanel/Stylesheets/Expand/Caption}} closedCaption={{$:/language/ControlPanel/Stylesheets/Restore/Caption}}/> | ||
|
||
<$reveal type="nomatch" state=<<modeState>> text="expanded" tag="div"> | ||
<<expandable-stylesheets-list>> | ||
</$reveal> | ||
<$reveal type="match" state=<<modeState>> text="expanded" tag="div"> | ||
<<stylesheets-list>> | ||
</$reveal> | ||
<%if [<mode>match[expand]]%> | ||
<$transclude $variable="expandable-list" filter=<<listFilter>> open="yes"/> | ||
<%else%> | ||
<$transclude $variable="expandable-list" filter=<<listFilter>> openState="$:/state/peek-tiddler/open/$(currentTiddler)$$(qualify)$"/> | ||
<%endif%> | ||
|
||
</$vars> | ||
</$let> |
Oops, something went wrong.
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.
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.
The "open", "closed" state value is wrong. It is
expanded
andrestored
Have a look at the state: https://tiddlywiki.com/#%24%3A%2Fstate%2Fpeek-stylesheets%2Fmode%2F-1116772087 at tiddlywiki.com and at: https://deploy-preview-8794--tiddlywiki-previews.netlify.app/#%24%3A%2Fstate%2Fpeek-stylesheets%2Fmode%2F-1116772087
current Version v5.3.6
PR version
It is not possible to change those values for backwards compatibility reasons. There may be unwanted side effects.
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.
Understood, sorry for the oversight 😅 I'm marking this PR as a draft for now and will request a review after more thorough testing.