From 1be89a28bfdf1ac376150966eb84a3728cd0192f Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Fri, 8 Nov 2024 09:12:48 +0000 Subject: [PATCH] Make preview templates tag driven and extensible --- core/ui/Palettes/Preview/SideBar/Search.tid | 8 ++++ core/ui/Palettes/Preview/SideBar/Subtitle.tid | 7 ++++ core/ui/Palettes/Preview/SideBar/Title.tid | 7 ++++ core/ui/Palettes/Preview/Tiddler.tid | 10 +++++ core/ui/Palettes/Preview/Tiddler/Body.tid | 7 ++++ core/ui/Palettes/Preview/Tiddler/Header.tid | 14 +++++++ core/ui/Palettes/Preview/Tiddler/Subtitle.tid | 7 ++++ core/wiki/currpalettepreview.tid | 41 ++++--------------- core/wiki/tags/PreviewSideBar.tid | 2 + core/wiki/tags/PreviewTiddler.tid | 2 + 10 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 core/ui/Palettes/Preview/SideBar/Search.tid create mode 100644 core/ui/Palettes/Preview/SideBar/Subtitle.tid create mode 100644 core/ui/Palettes/Preview/SideBar/Title.tid create mode 100644 core/ui/Palettes/Preview/Tiddler.tid create mode 100644 core/ui/Palettes/Preview/Tiddler/Body.tid create mode 100644 core/ui/Palettes/Preview/Tiddler/Header.tid create mode 100644 core/ui/Palettes/Preview/Tiddler/Subtitle.tid create mode 100644 core/wiki/tags/PreviewSideBar.tid create mode 100644 core/wiki/tags/PreviewTiddler.tid diff --git a/core/ui/Palettes/Preview/SideBar/Search.tid b/core/ui/Palettes/Preview/SideBar/Search.tid new file mode 100644 index 000000000..5bf2cd96c --- /dev/null +++ b/core/ui/Palettes/Preview/SideBar/Search.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/Palettes/Preview/Sidebar/Search +tags: $:/tags/Preview/SideBar + +\whitespace trim +<$colour.div class="tc-palette-preview-thumbnail-sidebar-search" styleName="background-color" styleColour="background"> + <$colour.div class="tc-palette-preview-thumbnail-sidebar-search-box"> + + diff --git a/core/ui/Palettes/Preview/SideBar/Subtitle.tid b/core/ui/Palettes/Preview/SideBar/Subtitle.tid new file mode 100644 index 000000000..ad4889e22 --- /dev/null +++ b/core/ui/Palettes/Preview/SideBar/Subtitle.tid @@ -0,0 +1,7 @@ +title: $:/core/ui/Palettes/Preview/Sidebar/Subtitle +tags: $:/tags/Preview/SideBar + +\whitespace trim +<$colour.div class="tc-palette-preview-thumbnail-sidebar-subtitle"> + a non-linear personal web notebook + diff --git a/core/ui/Palettes/Preview/SideBar/Title.tid b/core/ui/Palettes/Preview/SideBar/Title.tid new file mode 100644 index 000000000..7a42f0017 --- /dev/null +++ b/core/ui/Palettes/Preview/SideBar/Title.tid @@ -0,0 +1,7 @@ +title: $:/core/ui/Palettes/Preview/Sidebar/Title +tags: $:/tags/Preview/SideBar + +\whitespace trim +<$colour.div class="tc-palette-preview-thumbnail-sidebar-title"> + ~TiddlyWiki + diff --git a/core/ui/Palettes/Preview/Tiddler.tid b/core/ui/Palettes/Preview/Tiddler.tid new file mode 100644 index 000000000..0dd664a41 --- /dev/null +++ b/core/ui/Palettes/Preview/Tiddler.tid @@ -0,0 +1,10 @@ +title: $:/core/ui/Palettes/Preview/Tiddler +tags: $:/tags/Preview/Story + +\parameters (title) +\whitespace trim +<$colour.div class="tc-palette-preview-thumbnail-tiddler" styleName="background-color" styleColour="tiddler-background"> + <$list filter="[all[shadows+tiddlers]tag[$:/tags/Preview/Tiddler]!has[draft.of]]" variable="componentTitle"> + <$transclude $tiddler=<> title=<>/> + </$list> +</$colour.div> \ No newline at end of file diff --git a/core/ui/Palettes/Preview/Tiddler/Body.tid b/core/ui/Palettes/Preview/Tiddler/Body.tid new file mode 100644 index 000000000..d87ddadf3 --- /dev/null +++ b/core/ui/Palettes/Preview/Tiddler/Body.tid @@ -0,0 +1,7 @@ +title: $:/core/ui/Palettes/Preview/Tiddler/Body +tags: $:/tags/Preview/Tiddler + +\whitespace trim +<$colour.div class="tc-palette-preview-thumbnail-tiddler-body" styleName="color" styleColour="foreground"> + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras non arcu ultricies, egestas odio tempus, vestibulum ipsum. Praesent diam lorem, elementum in venenatis eget, tincidunt quis lacus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam efficitur velit tortor, sit amet tristique felis viverra sit amet. Nullam posuere facilisis purus sed consectetur. Integer vel elit euismod, posuere ligula et, dictum tellus. Donec in odio diam. Sed metus magna, placerat at ligula et, imperdiet sagittis ex. +</$colour.div> diff --git a/core/ui/Palettes/Preview/Tiddler/Header.tid b/core/ui/Palettes/Preview/Tiddler/Header.tid new file mode 100644 index 000000000..5e4fdad9c --- /dev/null +++ b/core/ui/Palettes/Preview/Tiddler/Header.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/Palettes/Preview/Tiddler/Header +tags: $:/tags/Preview/Tiddler + +\whitespace trim +<$colour.div class="tc-palette-preview-thumbnail-tiddler-header"> +<$colour.div class="tc-palette-preview-thumbnail-tiddler-title" styleName="color" styleColour="tiddler-title-foreground"> + <$text text=<<title>>/> +</$colour.div> +<$colour.div class="tc-palette-preview-thumbnail-tiddler-toolbar" styleName="fill" styleColour="tiddler-controls-foreground"> + {{$:/core/images/down-arrow}} + {{$:/core/images/edit-button}} + {{$:/core/images/close-button}} +</$colour.div> +</$colour.div> diff --git a/core/ui/Palettes/Preview/Tiddler/Subtitle.tid b/core/ui/Palettes/Preview/Tiddler/Subtitle.tid new file mode 100644 index 000000000..949765ec7 --- /dev/null +++ b/core/ui/Palettes/Preview/Tiddler/Subtitle.tid @@ -0,0 +1,7 @@ +title: $:/core/ui/Palettes/Preview/Tiddler/Subtitle +tags: $:/tags/Preview/Tiddler + +\whitespace trim +<$colour.div class="tc-palette-preview-thumbnail-tiddler-subtitle" styleName="color" styleColour="tiddler-subtitle-foreground"> + Motovun Jack +</$colour.div> diff --git a/core/wiki/currpalettepreview.tid b/core/wiki/currpalettepreview.tid index 085196038..f19326916 100644 --- a/core/wiki/currpalettepreview.tid +++ b/core/wiki/currpalettepreview.tid @@ -25,44 +25,19 @@ title: $:/snippets/currpalettepreview <%endif%> \end $colour.div -\procedure palette-preview-thumbnail-tiddler(title) -<$colour.div class="tc-palette-preview-thumbnail-tiddler" styleName="background-color" styleColour="tiddler-background"> - <$colour.div class="tc-palette-preview-thumbnail-tiddler-header"> - <$colour.div class="tc-palette-preview-thumbnail-tiddler-title" styleName="color" styleColour="tiddler-title-foreground"> - <$text text=<<title>>/> - </$colour.div> - <$colour.div class="tc-palette-preview-thumbnail-tiddler-toolbar" styleName="fill" styleColour="tiddler-controls-foreground"> - {{$:/core/images/down-arrow}} - {{$:/core/images/edit-button}} - {{$:/core/images/close-button}} - </$colour.div> - </$colour.div> - <$colour.div class="tc-palette-preview-thumbnail-tiddler-subtitle" styleName="color" styleColour="tiddler-subtitle-foreground"> - Motovun Jack - </$colour.div> - <$colour.div class="tc-palette-preview-thumbnail-tiddler-body" styleName="color" styleColour="foreground"> - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras non arcu ultricies, egestas odio tempus, vestibulum ipsum. Praesent diam lorem, elementum in venenatis eget, tincidunt quis lacus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam efficitur velit tortor, sit amet tristique felis viverra sit amet. Nullam posuere facilisis purus sed consectetur. Integer vel elit euismod, posuere ligula et, dictum tellus. Donec in odio diam. Sed metus magna, placerat at ligula et, imperdiet sagittis ex. - </$colour.div> -</$colour.div> -\end palette-preview-thumbnail-tiddler - \procedure palette-preview-thumbnail() <$colour.div class="tc-palette-preview-thumbnail" styleName="background-color" styleColour="page-background"> <$colour.div class="tc-palette-preview-thumbnail-story"> - <<palette-preview-thumbnail-tiddler "HelloThere">> - <<palette-preview-thumbnail-tiddler "Getting Started">> + <$list filter="HelloThere GettingStarted" variable="title"> + <$list filter="[all[shadows+tiddlers]tag[$:/tags/Preview/Story]!has[draft.of]]" variable="componentTitle"> + <$transclude $tiddler=<<componentTitle>> title=<<title>>/> + </$list> + </$list> </$colour.div> <$colour.div class="tc-palette-preview-thumbnail-sidebar" styleName="color" styleColour="sidebar-foreground"> - <$colour.div class="tc-palette-preview-thumbnail-sidebar-title"> - ~TiddlyWiki - </$colour.div> - <$colour.div class="tc-palette-preview-thumbnail-sidebar-subtitle"> - a non-linear personal web notebook - </$colour.div> - <$colour.div class="tc-palette-preview-thumbnail-sidebar-search" styleName="background-color" styleColour="background"> - <$colour.div class="tc-palette-preview-thumbnail-sidebar-search-box"> - </$colour.div> - </$colour.div> + <$list filter="[all[shadows+tiddlers]tag[$:/tags/Preview/SideBar]!has[draft.of]]" variable="componentTitle"> + <$transclude $tiddler=<<componentTitle>> title=<<title>>/> + </$list> </$colour.div> </$colour.div> \end palette-preview-thumbnail diff --git a/core/wiki/tags/PreviewSideBar.tid b/core/wiki/tags/PreviewSideBar.tid new file mode 100644 index 000000000..36ada0ed9 --- /dev/null +++ b/core/wiki/tags/PreviewSideBar.tid @@ -0,0 +1,2 @@ +title: $:/tags/Preview/SideBar +list: $:/core/ui/Palettes/Preview/Sidebar/Title $:/core/ui/Palettes/Preview/Sidebar/Subtitle $:/core/ui/Palettes/Preview/Sidebar/Search diff --git a/core/wiki/tags/PreviewTiddler.tid b/core/wiki/tags/PreviewTiddler.tid new file mode 100644 index 000000000..3e0cd95f6 --- /dev/null +++ b/core/wiki/tags/PreviewTiddler.tid @@ -0,0 +1,2 @@ +title: $:/tags/Preview/Tiddler +list: $:/core/ui/Palettes/Preview/Tiddler/Header $:/core/ui/Palettes/Preview/Tiddler/Subtitle $:/core/ui/Palettes/Preview/Tiddler/Body \ No newline at end of file