From 1e10496fd6f5e3f68bdc830ff42b10522aeee651 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 2 Apr 2025 22:05:43 +0100 Subject: [PATCH] Introduce filter visualisation --- .../AdvancedSearch/FilterResults/Inspect.tid | 8 +- .../config/AdvancedSearchFilterDefaultTab.tid | 2 +- core/wiki/macros/inspect-filter.tid | 96 +++++++++++++++++++ themes/tiddlywiki/vanilla/base.tid | 70 ++++++++++++++ 4 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 core/wiki/macros/inspect-filter.tid diff --git a/core/ui/AdvancedSearch/FilterResults/Inspect.tid b/core/ui/AdvancedSearch/FilterResults/Inspect.tid index 26501c899..a22777b58 100644 --- a/core/ui/AdvancedSearch/FilterResults/Inspect.tid +++ b/core/ui/AdvancedSearch/FilterResults/Inspect.tid @@ -2,10 +2,8 @@ title: $:/core/ui/AdvancedSearch/Filter/FilterResults/Inspect tags: $:/tags/AdvancedSearch/FilterResults caption: {{$:/language/Search/Filter/FilterResults/Inspect/Caption}} +\whitespace trim + \procedure lingo-base() $:/language/Search/ - -<$let json={{{ [inspect{$:/temp/advancedsearch}] }}}> - <$transclude $variable="copy-to-clipboard-above-right" src=<>/> - <$codeblock code=<> language="application/json" }}}/> - +<$transclude $variable="inspect-filter" filter={{$:/temp/advancedsearch}} /> diff --git a/core/wiki/config/AdvancedSearchFilterDefaultTab.tid b/core/wiki/config/AdvancedSearchFilterDefaultTab.tid index 95e83dabf..e976956c9 100644 --- a/core/wiki/config/AdvancedSearchFilterDefaultTab.tid +++ b/core/wiki/config/AdvancedSearchFilterDefaultTab.tid @@ -1,2 +1,2 @@ title: $:/state/tab-1749438307 -text: $:/core/ui/AdvancedSearch/Filter/FilterResults/Results +text: $:/core/ui/AdvancedSearch/Filter/FilterResults/Inspect diff --git a/core/wiki/macros/inspect-filter.tid b/core/wiki/macros/inspect-filter.tid new file mode 100644 index 000000000..4f4c791b8 --- /dev/null +++ b/core/wiki/macros/inspect-filter.tid @@ -0,0 +1,96 @@ +title: $:/core/macros/inspect-filter +tags: $:/tags/Macro + +\whitespace trim + +\procedure inspect-list(jsonList,prompt,class:"tc-box") +
>> +
+ <$text text=<>/> + <$text text={{{ [jsonindexes[]count[]] }}}/> +
+
+ <$list filter="[jsonindexes[]limit[10]]" variable="indexList"> + <$list-template> +
+ <$text text={{{ [jsonget] }}} /> +
+ + <$list-empty> +
+ (No items) +
+ + +
+
+\end inspect-list + +\procedure inspect-operator(jsonOperator) +
+
+ Operator + + <$text text={{{ [jsonget[prefix]] }}} /> + <$text text={{{ [jsonget[operatorName]] }}} /> + + <%if [jsonindexes[suffixes]length[]compare:number:gt[0]] %> + <$list filter="[jsonindexes[suffixes]]" variable="indexSuffix"> + + :<$text text={{{ [jsonget[suffixes],] }}} /> + + + <%endif%> + <$list filter="[jsonindexes[operands]]" variable="indexOperand"> + + <$text text={{{ [jsonget[operands],] }}} /> + + +
+
+ <$transclude $variable="inspect-list" jsonList={{{ [jsonextract[input]] }}} prompt="Operator Input" class="tc-box tc-inspect-input-box"/> + <$transclude $variable="inspect-list" jsonList={{{ [jsonextract[output]] }}} prompt="Operator Output" class="tc-box tc-inspect-output-box"/> +
+
+\end inspect-operator + +\procedure inspect-run(jsonRun) +
+
+ Run + :<$text text={{{ [jsonget[prefixName]] }}} /> + <%if [jsonindexes[suffixes]length[]compare:number:gt[0]] %> + <$list filter="[jsonindexes[suffixes]]" variable="indexSuffix"> + + :<$text text={{{ [jsonget[suffixes],] }}} /> + + + <%endif%> +
+
+ <$transclude $variable="inspect-list" jsonList={{{ [jsonextract[input]] }}} prompt="Run Input" class="tc-box tc-inspect-input-box"/> + <$list filter="[jsonindexes[operators]]" variable="indexOperator"> + <$transclude $variable="inspect-operator" jsonOperator={{{ [jsonextract[operators],] }}}/> + + <$transclude $variable="inspect-list" jsonList={{{ [jsonextract[output]] }}} prompt="Run Output" class="tc-box tc-inspect-output-box"> +
+
+\end inspect-run + +\procedure inspect-filter(filter,inputFilter:"[all[tiddler]]") +<$let json={{{ [subfilterinspect] }}}> +
+
+ Filter + <$text text={{{ [jsonget[inputFilter]] }}}/> +
+
+ <$transclude $variable="inspect-list" jsonList={{{ [jsonextract[input]] }}} prompt="Filter Input" class="tc-box tc-inspect-input-box"/> + <$list filter="[jsonindexes[runs]]" variable="indexRun"> + <$transclude $variable="inspect-run" jsonRun={{{ [jsonextract[runs],] }}}/> + + <$transclude $variable="inspect-list" jsonList={{{ [jsonextract[output]] }}} prompt="Filter Output" class="tc-box tc-inspect-output-box"/> +
+
+ +\end inspect-filter diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index c795ad362..80153a686 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -3490,6 +3490,76 @@ span.tc-translink > a:first-child { padding: 0.25em 1em; } +/* +** Filter Inspection +*/ + +.tc-box { + border: 1px solid var(--box-foreground-color);); + border-radius: 4px; +} + +.tc-box .tc-box { + margin: 0.5em; +} + +.tc-inspect-filter-box { + --box-background-color: <>; + --box-foreground-color: <>; +} + +.tc-inspect-run-box { + --box-background-color: #ffc; + --box-foreground-color: #440; +} + +.tc-inspect-operator-box { + --box-background-color: #fcc; + --box-foreground-color: #400; +} + +.tc-inspect-input-box { + --box-background-color: #fcf; + --box-foreground-color: #404; +} + +.tc-inspect-output-box { + --box-background-color: #cff; + --box-foreground-color: #044; +} + +.tc-box-header { + padding: 0.25em; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + color: var(--box-background-color); + background-color: var(--box-foreground-color); +} + +.tc-box-content { + padding: 0.25em; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + color: var(--box-foreground-color); + background-color: var(--box-background-color); +} + +.tc-box-content-list-item { + +} + +.tc-box-content-list-empty { + +} + +.tc-pill { + padding: 0.125em 0.25em; + margin: 0 0.25em; + border-radius: 6px; + color: var(--box-foreground-color); + background-color: var(--box-background-color); +} + /* ** Flexbox utility classes */