1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-07 18:39:57 +00:00

Refactor to allow multiple tours to be loaded at once

This commit is contained in:
Jeremy Ruston 2023-09-10 15:23:05 +01:00
parent 4f026e45a8
commit dd9b4dc787
22 changed files with 77 additions and 40 deletions

View File

@ -0,0 +1,2 @@
title: $:/config/CurrentTour
text: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki

View File

@ -1,23 +1,49 @@
title: $:/plugins/tiddlywiki/tour/globals
tags: $:/tags/Global
<!--
The following state tiddlers control the tour. They should not be directly modified,
but rather use the appropriate procedure to ensure that all the associated actions are performed.
$:/config/CurrentTour - title of current tour definition tiddler
$:/config/ShowTour - "show" (default) or "hide"
$:/state/tour/step - title of current step of the tour
Tour definition tiddlers have the following fields:
tour-tag - name of tag used to define tour step sequence
logo - title of tiddler containing logo of tour
-->
\function tour-current-tag()
[{$:/config/CurrentTour}get[tour-tag]]
\end
\function tour-is-not-first-step()
[all[shadows+tiddlers]tag[$:/tags/Tour/IntroductionToTiddlyWiki]before{$:/state/tour/step}count[]compare:number:gt[0]]
\end
\procedure tour-initialise-current-tour-step()
<$transclude $tiddler={{$:/state/tour/step}} $field="enter-actions"/>
\end
\procedure tour-restart()
<$action-setfield $tiddler="$:/config/ShowTour" text="show"/>
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag[$:/tags/TourStep]first[]] }}}/>
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag<tour-current-tag>first[]] }}}/>
<<tour-initialise-current-tour-step>>
\end
\procedure tour-next-step()
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag[$:/tags/TourStep]after{$:/state/tour/step}else[$:/plugins/tiddlywiki/tour/steps/finished]] }}}/>
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag<tour-current-tag>after{$:/state/tour/step}else[$:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/finished]] }}}/>
<<tour-initialise-current-tour-step>>
\end
\procedure tour-previous-step()
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag[$:/tags/TourStep]before{$:/state/tour/step}] :else[all[shadows+tiddlers]tag[$:/tags/TourStep]first[]] }}}/>
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag<tour-current-tag>before{$:/state/tour/step}] :else[all[shadows+tiddlers]tag<tour-current-tag>first[]] }}}/>
<<tour-initialise-current-tour-step>>
\end

View File

@ -1,2 +1,2 @@
title: $:/state/tour/step
text: $:/plugins/tiddlywiki/tour/steps/welcome
text: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/welcome

View File

@ -1,4 +0,0 @@
title: $:/tags/TourStep
list: $:/plugins/tiddlywiki/tour/steps/welcome $:/plugins/tiddlywiki/tour/steps/tiddlers $:/plugins/tiddlywiki/tour/steps/links $:/plugins/tiddlywiki/tour/steps/closing-tiddlers $:/plugins/tiddlywiki/tour/steps/end-of-fullscreen $:/plugins/tiddlywiki/tour/steps/open-control-panel $:/plugins/tiddlywiki/tour/steps/close-control-panel $:/plugins/tiddlywiki/tour/steps/search $:/plugins/tiddlywiki/tour/steps/recent $:/plugins/tiddlywiki/tour/steps/create-tiddler
Introduction to ~TiddlyWiki

View File

@ -4,7 +4,7 @@ tags: $:/tags/PageTemplate
\define tour-buttons()
\define tv-action-refresh-policy() always
<div class="tc-tour-panel-navigation">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TourStep]before{$:/state/tour/step}count[]compare:number:gt[0]]" variable="ignore">
<$list filter="[function[tour-is-not-first-step]]" variable="ignore">
<$button class="tc-btn-big-green" style="background-color: red;">
<<tour-previous-step>>
back
@ -19,10 +19,13 @@ next
<$list filter="[{$:/config/ShowTour}!is[blank]else[show]match[show]]" variable="ignore">
<div class={{{ tc-tour-panel [{$:/state/tour/step}get[display-mode]else[normal]addprefix[tc-tour-panel-]] +[join[ ]] }}}>
[img class="tc-tour-panel-banner-image" [$:/plugins/tiddlywiki/tour/tiddlywiki-tour-logo]]
<$image class="tc-tour-panel-banner-image" source={{{ [{$:/config/CurrentTour}get[logo]] }}}/>
<div class="tc-tour-panel-inner">
<div class="tc-tiddler-controls tc-tour-panel-controls">
<$button set="$:/config/ShowTour" setTo="no" class="tc-btn-invisible">{{$:/core/images/close-button}}</$button> <span class="tc-tour-panel-controls-icon">{{$:/plugins/tiddlywiki/tour/tour-button-icon}}</span> ''Tour'': {{$:/tags/TourStep!!text}}
<$button set="$:/config/ShowTour" setTo="no" class="tc-btn-invisible">{{$:/core/images/close-button}}</$button> <span class="tc-tour-panel-controls-icon">{{$:/plugins/tiddlywiki/tour/tour-button-icon}}</span> ''Tour'':
<$transclude $tiddler={{$:/config/CurrentTour}} $field="description">
<$text text={{$:/config/CurrentTour}}/>
</$transclude>
</div>
<$transclude tiddler={{$:/state/tour/step}} mode="block"/>
<$list filter="[{$:/state/tour/step}has[selector]]" variable="ignore">

View File

@ -1,5 +1,5 @@
title: $:/plugins/tiddlywiki/tour/steps/close-control-panel
tags: $:/tags/TourStep
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/close-control-panel
tags: $:/tags/Tour/IntroductionToTiddlyWiki
selector: .tc-story-river div[data-tiddler-title='$:/ControlPanel'] .tc-btn-\%24\%3A\%2Fcore\%2Fui\%2FButtons\%2Fclose
! Close the control panel

View File

@ -1,7 +1,7 @@
title: $:/plugins/tiddlywiki/tour/steps/closing-tiddlers
tags: $:/tags/TourStep
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/closing-tiddlers
tags: $:/tags/Tour/IntroductionToTiddlyWiki
display-mode: fullscreen
enter-actions: <$action-setfield $tiddler="$:/temp/Tour/DemoStoryList" list="$:/plugins/tiddlywiki/tour/steps/tiddlers/Jupiter $:/plugins/tiddlywiki/tour/steps/tiddlers/Saturn"/>
enter-actions: <$action-setfield $tiddler="$:/temp/Tour/DemoStoryList" list="$:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/tiddlers/Jupiter $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/tiddlers/Saturn"/>
\define tour-simplified-tiddler-close-button() yes

View File

@ -1,5 +1,5 @@
title: $:/plugins/tiddlywiki/tour/steps/create-tiddler
tags: $:/tags/TourStep
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/create-tiddler
tags: $:/tags/Tour/IntroductionToTiddlyWiki
selector: .tc-story-river div[data-tiddler-title="Draft of 'New Tiddler'"] input[value]:not([value="Congratulations"])
selector-fallback-1: .tc-story-river div[data-tiddler-title='Draft of \'New Tiddler\''] .tc-btn-\%24\%3A\%2Fcore\%2Fui\%2FButtons\%2Fsave
selector-fallback-2: .tc-btn-\%24\%3A\%2Fcore\%2Fui\%2FButtons\%2Fnew-tiddler

View File

@ -1,5 +1,5 @@
title: $:/plugins/tiddlywiki/tour/steps/end-of-fullscreen
tags: $:/tags/TourStep
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/end-of-fullscreen
tags: $:/tags/Tour/IntroductionToTiddlyWiki
display-mode: fullscreen
! Going deeper

View File

@ -1,4 +1,4 @@
title: $:/plugins/tiddlywiki/tour/steps/finished
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/finished
! Congratulations

View File

@ -0,0 +1,6 @@
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki
tour-tag: $:/tags/Tour/IntroductionToTiddlyWiki
logo: $:/plugins/tiddlywiki/tour/tiddlywiki-tour-logo
description: Introduction to ~TiddlyWiki
An introductory tour to ~TiddlyWiki

View File

@ -1,7 +1,7 @@
title: $:/plugins/tiddlywiki/tour/steps/links
tags: $:/tags/TourStep
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/links
tags: $:/tags/Tour/IntroductionToTiddlyWiki
display-mode: fullscreen
enter-actions: <$action-setfield $tiddler="$:/temp/Tour/DemoStoryList" list="$:/plugins/tiddlywiki/tour/steps/tiddlers/Jupiter"/>
enter-actions: <$action-setfield $tiddler="$:/temp/Tour/DemoStoryList" list="$:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/tiddlers/Jupiter"/>
! How do links work in ~TiddlyWiki?
@ -20,7 +20,7 @@ Try clicking the link to "Saturn".
</$navigator>
<$list filter="[[$:/temp/Tour/DemoStoryList]contains[$:/plugins/tiddlywiki/tour/steps/tiddlers/Saturn]limit[1]]" variable="ignore">
<$list filter="[[$:/temp/Tour/DemoStoryList]contains[$:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/tiddlers/Saturn]limit[1]]" variable="ignore">
<$confetti/>

View File

@ -1,5 +1,5 @@
title: $:/plugins/tiddlywiki/tour/steps/open-control-panel
tags: $:/tags/TourStep
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/open-control-panel
tags: $:/tags/Tour/IntroductionToTiddlyWiki
selector: .tc-btn-\%24\%3A\%2Fcore\%2Fui\%2FButtons\%2Fcontrol-panel
! Welcome to ~TiddlyWiki

View File

@ -1,5 +1,5 @@
title: $:/plugins/tiddlywiki/tour/steps/recent
tags: $:/tags/TourStep
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/recent
tags: $:/tags/Tour/IntroductionToTiddlyWiki
selector: .tc-sidebar-tabs-main .tc-timeline > .tc-menu-list-item:nth-child(1) .tc-menu-list-subitem:nth-child(1) .tc-tiddlylink
selector-fallback-1: .tc-sidebar-tabs-main button:nth-child(3)

View File

@ -1,5 +1,5 @@
title: $:/plugins/tiddlywiki/tour/steps/search
tags: $:/tags/TourStep
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/search
tags: $:/tags/Tour/IntroductionToTiddlyWiki
selector: .tc-sidebar-search .tc-popup-handle
! Searching

View File

@ -0,0 +1,4 @@
title: $:/tags/Tour/IntroductionToTiddlyWiki
list: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/welcome $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/tiddlers $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/links $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/closing-tiddlers $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/end-of-fullscreen $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/open-control-panel $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/close-control-panel $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/search $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/recent $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/create-tiddler
Introduction to ~TiddlyWiki

View File

@ -1,4 +1,4 @@
title: $:/plugins/tiddlywiki/tour/steps/tiddlers/Jupiter
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/tiddlers/Jupiter
caption: Jupiter
Jupiter is the largest planet in the Solar System. It is the fifth planet from the Sun. Jupiter is a gas giant because it is so large and made of gas. The other gas giants in the Solar System are [[Saturn|$:/plugins/tiddlywiki/tour/steps/tiddlers/Saturn]], Uranus, and Neptune.
Jupiter is the largest planet in the Solar System. It is the fifth planet from the Sun. Jupiter is a gas giant because it is so large and made of gas. The other gas giants in the Solar System are [[Saturn|$:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/tiddlers/Saturn]], Uranus, and Neptune.

View File

@ -1,4 +1,4 @@
title: $:/plugins/tiddlywiki/tour/steps/tiddlers/Saturn
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/tiddlers/Saturn
caption: Saturn
Saturn is the sixth planet from the Sun located in the Solar System. It is the second largest planet in the Solar System, after Jupiter. Saturn is one of the four gas giant planets in the Solar System, along with [[Jupiter|$:/plugins/tiddlywiki/tour/steps/tiddlers/Jupiter]], Uranus, and Neptune.
Saturn is the sixth planet from the Sun located in the Solar System. It is the second largest planet in the Solar System, after Jupiter. Saturn is one of the four gas giant planets in the Solar System, along with [[Jupiter|$:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/tiddlers/Jupiter]], Uranus, and Neptune.

View File

@ -1,5 +1,5 @@
title: $:/plugins/tiddlywiki/tour/steps/tiddlers
tags: $:/tags/TourStep
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/tiddlers
tags: $:/tags/Tour/IntroductionToTiddlyWiki
display-mode: fullscreen
! How does ~TiddlyWiki work?
@ -10,7 +10,7 @@ A tiddler is like an index card.
<$let tv-wikilinks="no">
{{$:/plugins/tiddlywiki/tour/steps/tiddlers/Jupiter||$:/plugins/tiddlywiki/tour/simplified-tiddler}}
{{$:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/tiddlers/Jupiter||$:/plugins/tiddlywiki/tour/simplified-tiddler}}
</$let>

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -1,5 +1,5 @@
title: $:/plugins/tiddlywiki/tour/steps/welcome
tags: $:/tags/TourStep
title: $:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/welcome
tags: $:/tags/Tour/IntroductionToTiddlyWiki
display-mode: fullscreen
! Hello!