mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-06 10:46:57 +00:00
Rethink palette manager
The current content of $:/PaletteManager is moved into $:/PaletteEditor, and $:/PaletteManager repurposed as the control panel palette switcher
This commit is contained in:
parent
a053f03818
commit
c6bb2b51e6
@ -2,33 +2,4 @@ title: $:/core/ui/ControlPanel/Palette
|
||||
tags: $:/tags/ControlPanel/Appearance
|
||||
caption: {{$:/language/ControlPanel/Palette/Caption}}
|
||||
|
||||
\define lingo-base() $:/language/ControlPanel/Palette/
|
||||
|
||||
<$transclude $tiddler="$:/snippets/paletteswitcher" thumbnails="yes"/>
|
||||
|
||||
{{$:/snippets/palettetests}}
|
||||
|
||||
<$let
|
||||
paletteEditor={{{ [{$:/palette}get[editor]] :else[{$:/palette}get[palette-import]!match[]get[editor]] }}}
|
||||
>
|
||||
<%if [<paletteEditor>!match[]] %>
|
||||
<div>
|
||||
<<lingo CustomEditor/Prompt>>
|
||||
<$transclude $tiddler=<<paletteEditor>> $mode="block"/>
|
||||
</div>
|
||||
<%endif%>
|
||||
</$let>
|
||||
|
||||
<$reveal type="nomatch" state="$:/state/ShowPaletteEditor" text="yes">
|
||||
|
||||
<$button set="$:/state/ShowPaletteEditor" setTo="yes"><<lingo ShowEditor/Caption>></$button>
|
||||
|
||||
</$reveal>
|
||||
|
||||
<$reveal type="match" state="$:/state/ShowPaletteEditor" text="yes">
|
||||
|
||||
<$button set="$:/state/ShowPaletteEditor" setTo="no"><<lingo HideEditor/Caption>></$button>
|
||||
{{$:/PaletteManager}}
|
||||
|
||||
</$reveal>
|
||||
|
||||
{{$:/PaletteManager}}
|
94
core/ui/PaletteEditor.tid
Normal file
94
core/ui/PaletteEditor.tid
Normal file
@ -0,0 +1,94 @@
|
||||
title: $:/PaletteEditor
|
||||
|
||||
\define lingo-base() $:/language/ControlPanel/Palette/Editor/
|
||||
\define describePaletteColour(colour)
|
||||
<$transclude tiddler="$:/language/Docs/PaletteColours/$colour$"><$text text="$colour$"/></$transclude>
|
||||
\end
|
||||
\define edit-colour-placeholder()
|
||||
edit $(colourName)$
|
||||
\end
|
||||
\define colour-tooltip(showhide) $showhide$ editor for $(newColourName)$
|
||||
|
||||
\define resolve-colour(macrocall)
|
||||
\import $:/core/macros/utils
|
||||
\whitespace trim
|
||||
<$wikify name="name" text="""$macrocall$""">
|
||||
<<name>>
|
||||
</$wikify>
|
||||
\end
|
||||
|
||||
\define delete-colour-index-actions() <$action-setfield $index=<<colourName>>/>
|
||||
\define palette-manager-colour-row-segment()
|
||||
\whitespace trim
|
||||
<$edit-text index=<<colourName>> tag="input" placeholder=<<edit-colour-placeholder>> default=""/>
|
||||
<br>
|
||||
<$edit-text index=<<colourName>> type="color" tag="input" class="tc-palette-manager-colour-input"/>
|
||||
<$list filter="[<currentTiddler>getindex<colourName>removeprefix[<<]removesuffix[>>]] [<currentTiddler>getindex<colourName>removeprefix[<$]removesuffix[/>]]" variable="ignore">
|
||||
<$set name="state" value={{{ [[$:/state/palettemanager/]addsuffix<currentTiddler>addsuffix[/]addsuffix<colourName>] }}}>
|
||||
<$wikify name="newColourName" text="""<$macrocall $name="resolve-colour" macrocall={{{ [<currentTiddler>getindex<colourName>] }}}/>""">
|
||||
<$reveal state=<<state>> type="nomatch" text="show">
|
||||
<$button tooltip=<<colour-tooltip show>> aria-label=<<colour-tooltip show>> class="tc-btn-invisible" set=<<state>> setTo="show">{{$:/core/images/down-arrow}}<$text text=<<newColourName>> class="tc-small-gap-left"/></$button><br>
|
||||
</$reveal>
|
||||
<$reveal state=<<state>> type="match" text="show">
|
||||
<$button tooltip=<<colour-tooltip hide>> aria-label=<<colour-tooltip show>> class="tc-btn-invisible" actions="""<$action-deletetiddler $tiddler=<<state>>/>""">{{$:/core/images/up-arrow}}<$text text=<<newColourName>> class="tc-small-gap-left"/></$button><br>
|
||||
</$reveal>
|
||||
<$reveal state=<<state>> type="match" text="show">
|
||||
<$set name="colourName" value=<<newColourName>>>
|
||||
<br>
|
||||
<<palette-manager-colour-row-segment>>
|
||||
<br><br>
|
||||
</$set>
|
||||
</$reveal>
|
||||
</$wikify>
|
||||
</$set>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
\define palette-manager-colour-row()
|
||||
\whitespace trim
|
||||
<tr>
|
||||
<td>
|
||||
<span style="float:right;">
|
||||
<$button tooltip={{$:/language/ControlPanel/Palette/Editor/Delete/Hint}} aria-label={{$:/language/ControlPanel/Palette/Editor/Delete/Hint}} class="tc-btn-invisible" actions=<<delete-colour-index-actions>>>
|
||||
{{$:/core/images/delete-button}}</$button>
|
||||
</span>
|
||||
''<$macrocall $name="describePaletteColour" colour=<<colourName>>/>''<br/>
|
||||
<$macrocall $name="colourName" $output="text/plain"/>
|
||||
</td>
|
||||
<td>
|
||||
<<palette-manager-colour-row-segment>>
|
||||
</td>
|
||||
</tr>
|
||||
\end
|
||||
|
||||
\define palette-manager-table()
|
||||
\whitespace trim
|
||||
<table>
|
||||
<tbody>
|
||||
<$set name="colorList" filter="[{$:/state/palettemanager/showexternal}match[yes]]"
|
||||
value="[all[shadows+tiddlers]tag[$:/tags/Palette]indexes[]]" emptyValue="[<currentTiddler>indexes[]]">
|
||||
<$list filter=<<colorList>> variable="colourName"> <<palette-manager-colour-row>> </$list>
|
||||
</$set>
|
||||
</tbody>
|
||||
</table>
|
||||
\end
|
||||
\whitespace trim
|
||||
<$set name="currentTiddler" value={{$:/palette}}>
|
||||
|
||||
<<lingo Prompt>> <$link to={{$:/palette}}><$macrocall $name="currentTiddler" $output="text/plain"/></$link>
|
||||
|
||||
<$list filter="[all[current]is[shadow]is[tiddler]]" variable="listItem">
|
||||
<<lingo Prompt/Modified>>
|
||||
 
|
||||
<$button message="tm-delete-tiddler" param={{$:/palette}}><<lingo Reset/Caption>></$button>
|
||||
</$list>
|
||||
|
||||
<$list filter="[all[current]is[shadow]!is[tiddler]]" variable="listItem">
|
||||
<<lingo Clone/Prompt>>
|
||||
</$list>
|
||||
|
||||
<$button message="tm-new-tiddler" param={{$:/palette}}><<lingo Clone/Caption>></$button>
|
||||
|
||||
<$checkbox tiddler="$:/state/palettemanager/showexternal" field="text" checked="yes" unchecked="no"><span class="tc-small-gap-left"><<lingo Names/External/Show>></span></$checkbox>
|
||||
|
||||
<<palette-manager-table>>
|
@ -1,94 +1,32 @@
|
||||
title: $:/PaletteManager
|
||||
|
||||
\define lingo-base() $:/language/ControlPanel/Palette/Editor/
|
||||
\define describePaletteColour(colour)
|
||||
<$transclude tiddler="$:/language/Docs/PaletteColours/$colour$"><$text text="$colour$"/></$transclude>
|
||||
\end
|
||||
\define edit-colour-placeholder()
|
||||
edit $(colourName)$
|
||||
\end
|
||||
\define colour-tooltip(showhide) $showhide$ editor for $(newColourName)$
|
||||
\define lingo-base() $:/language/ControlPanel/Palette/
|
||||
|
||||
\define resolve-colour(macrocall)
|
||||
\import $:/core/macros/utils
|
||||
\whitespace trim
|
||||
<$wikify name="name" text="""$macrocall$""">
|
||||
<<name>>
|
||||
</$wikify>
|
||||
\end
|
||||
<$transclude $tiddler="$:/snippets/paletteswitcher" thumbnails="yes"/>
|
||||
|
||||
{{$:/snippets/palettetests}}
|
||||
|
||||
<$let
|
||||
paletteEditor={{{ [{$:/palette}get[editor]] :else[{$:/palette}get[palette-import]!match[]get[editor]] }}}
|
||||
>
|
||||
<%if [<paletteEditor>!match[]] %>
|
||||
<div>
|
||||
<<lingo CustomEditor/Prompt>>
|
||||
<$transclude $tiddler=<<paletteEditor>> $mode="block"/>
|
||||
</div>
|
||||
<%endif%>
|
||||
</$let>
|
||||
|
||||
<$reveal type="nomatch" state="$:/state/ShowPaletteEditor" text="yes">
|
||||
|
||||
<$button set="$:/state/ShowPaletteEditor" setTo="yes"><<lingo ShowEditor/Caption>></$button>
|
||||
|
||||
\define delete-colour-index-actions() <$action-setfield $index=<<colourName>>/>
|
||||
\define palette-manager-colour-row-segment()
|
||||
\whitespace trim
|
||||
<$edit-text index=<<colourName>> tag="input" placeholder=<<edit-colour-placeholder>> default=""/>
|
||||
<br>
|
||||
<$edit-text index=<<colourName>> type="color" tag="input" class="tc-palette-manager-colour-input"/>
|
||||
<$list filter="[<currentTiddler>getindex<colourName>removeprefix[<<]removesuffix[>>]] [<currentTiddler>getindex<colourName>removeprefix[<$]removesuffix[/>]]" variable="ignore">
|
||||
<$set name="state" value={{{ [[$:/state/palettemanager/]addsuffix<currentTiddler>addsuffix[/]addsuffix<colourName>] }}}>
|
||||
<$wikify name="newColourName" text="""<$macrocall $name="resolve-colour" macrocall={{{ [<currentTiddler>getindex<colourName>] }}}/>""">
|
||||
<$reveal state=<<state>> type="nomatch" text="show">
|
||||
<$button tooltip=<<colour-tooltip show>> aria-label=<<colour-tooltip show>> class="tc-btn-invisible" set=<<state>> setTo="show">{{$:/core/images/down-arrow}}<$text text=<<newColourName>> class="tc-small-gap-left"/></$button><br>
|
||||
</$reveal>
|
||||
<$reveal state=<<state>> type="match" text="show">
|
||||
<$button tooltip=<<colour-tooltip hide>> aria-label=<<colour-tooltip show>> class="tc-btn-invisible" actions="""<$action-deletetiddler $tiddler=<<state>>/>""">{{$:/core/images/up-arrow}}<$text text=<<newColourName>> class="tc-small-gap-left"/></$button><br>
|
||||
|
||||
<$reveal type="match" state="$:/state/ShowPaletteEditor" text="yes">
|
||||
|
||||
<$button set="$:/state/ShowPaletteEditor" setTo="no"><<lingo HideEditor/Caption>></$button>
|
||||
{{$:/PaletteEditor}}
|
||||
|
||||
</$reveal>
|
||||
<$reveal state=<<state>> type="match" text="show">
|
||||
<$set name="colourName" value=<<newColourName>>>
|
||||
<br>
|
||||
<<palette-manager-colour-row-segment>>
|
||||
<br><br>
|
||||
</$set>
|
||||
</$reveal>
|
||||
</$wikify>
|
||||
</$set>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
\define palette-manager-colour-row()
|
||||
\whitespace trim
|
||||
<tr>
|
||||
<td>
|
||||
<span style="float:right;">
|
||||
<$button tooltip={{$:/language/ControlPanel/Palette/Editor/Delete/Hint}} aria-label={{$:/language/ControlPanel/Palette/Editor/Delete/Hint}} class="tc-btn-invisible" actions=<<delete-colour-index-actions>>>
|
||||
{{$:/core/images/delete-button}}</$button>
|
||||
</span>
|
||||
''<$macrocall $name="describePaletteColour" colour=<<colourName>>/>''<br/>
|
||||
<$macrocall $name="colourName" $output="text/plain"/>
|
||||
</td>
|
||||
<td>
|
||||
<<palette-manager-colour-row-segment>>
|
||||
</td>
|
||||
</tr>
|
||||
\end
|
||||
|
||||
\define palette-manager-table()
|
||||
\whitespace trim
|
||||
<table>
|
||||
<tbody>
|
||||
<$set name="colorList" filter="[{$:/state/palettemanager/showexternal}match[yes]]"
|
||||
value="[all[shadows+tiddlers]tag[$:/tags/Palette]indexes[]]" emptyValue="[<currentTiddler>indexes[]]">
|
||||
<$list filter=<<colorList>> variable="colourName"> <<palette-manager-colour-row>> </$list>
|
||||
</$set>
|
||||
</tbody>
|
||||
</table>
|
||||
\end
|
||||
\whitespace trim
|
||||
<$set name="currentTiddler" value={{$:/palette}}>
|
||||
|
||||
<<lingo Prompt>> <$link to={{$:/palette}}><$macrocall $name="currentTiddler" $output="text/plain"/></$link>
|
||||
|
||||
<$list filter="[all[current]is[shadow]is[tiddler]]" variable="listItem">
|
||||
<<lingo Prompt/Modified>>
|
||||
 
|
||||
<$button message="tm-delete-tiddler" param={{$:/palette}}><<lingo Reset/Caption>></$button>
|
||||
</$list>
|
||||
|
||||
<$list filter="[all[current]is[shadow]!is[tiddler]]" variable="listItem">
|
||||
<<lingo Clone/Prompt>>
|
||||
</$list>
|
||||
|
||||
<$button message="tm-new-tiddler" param={{$:/palette}}><<lingo Clone/Caption>></$button>
|
||||
|
||||
<$checkbox tiddler="$:/state/palettemanager/showexternal" field="text" checked="yes" unchecked="no"><span class="tc-small-gap-left"><<lingo Names/External/Show>></span></$checkbox>
|
||||
|
||||
<<palette-manager-table>>
|
||||
|
Loading…
x
Reference in New Issue
Block a user