feat: update tw plugins

This commit is contained in:
tiddlygit-test 2020-08-08 17:44:29 +08:00
parent 40f725a80c
commit ab89d73315
429 changed files with 14456 additions and 8 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -0,0 +1,3 @@
tags: picture
title: $:/plugins/bimlas/kin-filter/README/concept.svg
type: image/svg+xml

View file

@ -0,0 +1,2 @@
tags: kin-example-top
title: A

View file

@ -0,0 +1,2 @@
tags: A
title: B

View file

@ -0,0 +1,3 @@
tags: B
title: C
list: D

View file

@ -0,0 +1,3 @@
tags: C
title: D
list: E

View file

@ -0,0 +1,3 @@
tags: C
title: E
list: G

View file

@ -0,0 +1,2 @@
tags: B
title: F

View file

@ -0,0 +1,2 @@
tags: F
title: G

View file

@ -0,0 +1,2 @@
tags: F
title: H

View file

@ -0,0 +1,76 @@
title: $:/plugins/bimlas/kin-filter/README/examples
type: text/vnd.tiddlywiki
\define item-class(highlightfilter) <$list filter="[[kin-example-top]kin::to[]subfilter<__highlightfilter__>is[current]first[]]">highlighted-toc-item</$list>
\define kin-example-with-toc(n,eg,ie)
<div class="doc-example">
`$eg$`
<dd>&rarr; $ie$</dd>
<$list filter="[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix[$n$]]" variable=".state">
<$reveal state=<<.state>> type="nomatch" text="show">
<dl>
<dd><$button set=<<.state>> setTo="show">Try it</$button></dd>
</dl>
</$reveal>
<$reveal state=<<.state>> type="match" text="show">
<dl>
<dd><$button set=<<.state>> setTo="">Hide</$button></dd>
</dl>
<blockquote class="doc-example-result">
<ul><$list filter="[[kin-example-top]kin::to[]subfilter<__eg__>sort[]]" emptyMessage="(empty)">
<li><$link><$view field="title"/></$link></li>
</$list></ul>
Results highlighted in the tree:
<<kin-toc "$eg$">>
</blockquote>
</$reveal>
</$list>
</div>
\end
\define each-level(highlightfilter)
<li>
<$wikify name="transcluded-item-class" text="""<$macrocall $name="item-class" highlightfilter=<<__highlightfilter__>>/>""">
<$link class=<<transcluded-item-class>> ><<currentTiddler>></$link>
</$wikify>
<ul>
<$list filter="[[kin-example-top]kin::to[]tag<currentTiddler>]">
<$macrocall $name="each-level" highlightfilter=<<__highlightfilter__>>/>
</$list>
</ul>
</li>
\end
\define kin-toc(highlightfilter)
<$tiddler tiddler="kin-example-top">
<ul>
<$macrocall $name="each-level" highlightfilter=<<__highlightfilter__>>/>
</ul>
</$tiddler>
\end
<style>
.highlighted-toc-item {
color: red !important;
}
</style>
Example tree (to really understand, look at the tiddlers):
<<kin-toc "!is[current]">>
''The tree'' below the examples only helps in understanding the filter, it ''is not part of the output''.
''Feel free to edit [[this tiddler|$:/plugins/bimlas/kin-filter/README/examples]] to test your own filter expressions as well!'' If you want to undo the changes you made, just delete the tiddler, it will restore itself to its initial state.
<<kin-example-with-toc 1 "[kin[C]]" "input titles which are family members of the parameter title">>
<<kin-example-with-toc 2 "[kin[C]kin[F]]" "common family members of each of the specified titles (intersection)">>
<<kin-example-with-toc 3 "[kin[C]!kin[F]]" "difference of families of the specified titles (complement)">>
<<kin-example-with-toc 4 "[[C]] [[F]] +[kin[]]" "collected titles which are family members of any of the input tiddlers (union)">>
<<kin-example-with-toc 5 "[kin::to[B]]" "successors of the given tiddler">>
<<kin-example-with-toc 6 "[kin::from[E]kin::to[B]]" "subset of the family tree">>
<<kin-example-with-toc 7 "[kin::from:2[E]]" "ancestors of the given tiddler until the given depth">>
<<kin-example-with-toc 8 "[kin:tags:from[G]]" "ancestors of tiddler based on `tags` field (`tags` points to parents)">>
<<kin-example-with-toc 9 "[kin:list:to[G]]" "ancestors of tiddler based on `list` field (`list` point to children)">>

View file

@ -0,0 +1,49 @@
title: $:/plugins/bimlas/kin-filter/README/syntax
type: text/vnd.tiddlywiki
! Kin filter operator
* https://gitlab.com/bimlas/tw5-kin-filter (official repository)
* https://github.com/bimlas/tw5-kin-filter (mirror, please star if you like it)
The purpose of the ''kin'' operator with examples:
* Finds related tags, related tiddlers in any depth
* Finds out where base tiddler originates and what other elements originate from it
* Finds the ancestors and successors of a family member
* Finds the "leaves" of the branch of the base tiddler in a tree-like structure (where the base tiddler is a leaf)
* Finds the super- and subsets / groups of a mathematical set (where the base tiddler is a set)
[img[$:/plugins/bimlas/kin-filter/README/concept.svg]]
|''input''|a [[selection of titles|https://tiddlywiki.com/#Title%20Selection]]|
|''suffix''|the ''kin'' operator uses a rich suffix, see below for details|
|''parameter''|''B'' base tiddler title or nothing|
|''output''|''with parameter B''<br>&raquo; those input titles which are ''kin with B'' <br>''without B''<br>&raquo; ''all'' tiddler titles which are ''kin with input titles'' (treat input titles as base tiddlers)|
|''`!` output''|''with parameter B''<br>&raquo; those input titles which are ''//NOT// kin with B''<br>''without parameter B''<br>&raquo; ignored|
The ''kin'' operator uses an extended syntax that permits multiple fields and flags to be passed:
```
[kin:<field>:<direction>:<depth>[<operand>]]
```
* ''field'': name of the [[field|https://tiddlywiki.com/#TiddlerFields]] which connecting tiddlers (assumed to be a [[title list|https://tiddlywiki.com/#Title%20List]], defaulting to `tags`)
* ''direction'': collect the tiddler titles in this direction relative to the base tiddler
** ''from'': collect kins of base tiddler pointing from it (including the base tiddler title itself)
** ''to'': collect kins of base tiddler pointing to it (including the base tiddler title itself)
** ''with'': (the default) union of the aboves
* ''depth'': maximum depth of the collected labels in the tree structure relative to the base tiddler (a positive number, not limited by default)
* ''operand'': filter operand, the base tiddler
''kin'' is a [[modifier|https://tiddlywiki.com/#Selection%20Constructors]], but without ''B'' parameter is a [[constructor|https://tiddlywiki.com/#Selection%20Constructors]].
!! Installation instructions
To add the plugin to your own ~TiddlyWiki5, just drag this link to the browser window:
$:/plugins/bimlas/kin-filter
For other installation options see the repositories above.
//Select the next tab to continue.//

View file

@ -0,0 +1,137 @@
/*\
title: $:/plugins/bimlas/kin-filter/kin.js
type: application/javascript
module-type: filteroperator
Finds out where a tiddler originates from and what other tiddlers originate from it
\*/
(function() {
/*jslint node: true, browser: true */
/*global $tw: true */
"use strict";
function collectTitlesRecursively(baseTiddler,baseTitle,options) {
var cacheName = "kin-filter-" + baseTitle + "-" + options.fieldName + "-",
titlesPointingFromBase = {},
titlesPointingToBase = {},
resultsFrom = [],
resultsTo = [];
/* Copy of findListingsOfTiddler, but it's searching in shadows as well. */
function findListingsOfTiddler(targetTitle,fieldName) {
fieldName = fieldName || "list";
var titles = [];
options.wiki.eachTiddlerPlusShadows(function(tiddler,title) {
var list = $tw.utils.parseStringArray(tiddler.fields[fieldName]);
if(list && list.indexOf(targetTitle) !== -1) {
titles.push(title);
}
});
return titles;
}
function addToResultsIfNotFoundAlready(alreadyFound,title,depth) {
if(title in alreadyFound) {
return false;
}
alreadyFound[title] = depth;
return true
}
function collectTitlesPointingFrom(tiddler,title,currentDepth) {
if(addToResultsIfNotFoundAlready(titlesPointingFromBase,title,currentDepth)) {
currentDepth += 1;
if(tiddler) {
$tw.utils.each(tiddler.getFieldList(options.fieldName),function(targetTitle) {
collectTitlesPointingFrom(options.wiki.getTiddler(targetTitle),targetTitle,currentDepth);
});
}
}
}
function collectTitlesPointingTo(title,currentDepth) {
if(addToResultsIfNotFoundAlready(titlesPointingToBase,title,currentDepth)) {
currentDepth += 1;
$tw.utils.each(findListingsOfTiddler(title,options.fieldName),function(targetTitle) {
collectTitlesPointingTo(targetTitle,currentDepth);
});
}
}
function getObjectKeysByExpression(object,callback) {
var key,
results = [];
for (key in object) {
if (object.hasOwnProperty(key) && callback(object[key])) {
results.push(key);
}
}
return results;
}
function getResultsInGivenDepth(cachedData) {
if(options.depth) {
return getObjectKeysByExpression(cachedData,function(value) {
return value <= options.depth;
})
} else {
return Object.keys(cachedData);
}
}
if((options.direction === "from") || (options.direction === "with")) {
resultsFrom = $tw.wiki.getGlobalCache(cacheName + "from",function() {
collectTitlesPointingFrom(baseTiddler,baseTitle,0);
return titlesPointingFromBase;
});
resultsFrom = getResultsInGivenDepth(resultsFrom);
}
if((options.direction === "to") || (options.direction === "with")) {
resultsTo = $tw.wiki.getGlobalCache(cacheName + "to",function() {
collectTitlesPointingTo(baseTitle,0);
return titlesPointingToBase;
});
resultsTo = getResultsInGivenDepth(resultsTo);
}
return $tw.utils.pushTop(resultsFrom,resultsTo);
}
/*
Export our filter function
*/
exports.kin = function(source,operator,options) {
var results = [],
needsExclusion = operator.prefix === "!",
suffixes = operator.suffixes || [],
filterOptions = {
wiki: options.wiki,
fieldName: ((suffixes[0] || [])[0] || "tags").toLowerCase(),
direction: ((suffixes[1] || [])[0] || "with").toLowerCase(),
depth: Number((suffixes[2] || [])[0]),
};
if((operator.operand === "") && (needsExclusion)) {
return [];
}
if(operator.operand !== "") {
var baseTitle = operator.operand,
baseTiddler = options.wiki.getTiddler(baseTitle),
foundTitles = collectTitlesRecursively(baseTiddler,baseTitle,filterOptions);
source(function(tiddler,title) {
if(needsExclusion === (foundTitles.indexOf(title) === -1)) {
results.push(title);
}
});
} else {
source(function(tiddler,title) {
results = $tw.utils.pushTop(results,collectTitlesRecursively(tiddler,title,filterOptions));
});
}
return results;
}
})();

View file

@ -0,0 +1,10 @@
{
"title": "$:/plugins/bimlas/kin-filter",
"description": "Kin filter: Recursively looking for kinship between tiddler titles",
"author": "bimlas",
"version": "1.0.0",
"core-version": ">=5.1.18",
"source": "https://gitlab.com/bimlas/tw5-kin-filter",
"plugin-type": "plugin",
"list": "README/syntax README/examples"
}

View file

@ -0,0 +1,82 @@
tags:
title: $:/plugins/bimlas/locator/README/CHANGELOG
type: text/vnd.tiddlywiki
Unreleased
[[See GitLab for detailed change history of this release|https://gitlab.com/bimlas/tw5-locator/compare/master...dev]]
!! 2.0.0
[[See GitLab for detailed change history of this release|https://gitlab.com/bimlas/tw5-locator/compare/v1.5.0...v2.0.0]]
''ALMOST COMPLETE REWRITING, BACKWARDS INCOMPATIBLE CHANGES ARE INTRODUCED''
* ''It does not require the `kin` filter operator at all''
* ''You can filter to any field besides the tags''
* You can use the standard search from any `locator-view`
* You can use any field to link tiddlers (as "tags")
* You can also navigate through tiddler links
* You can use arbitrary templates to display context items and field values
* ''INCOMPATIBLE CHANGES''<br />//Before upgrading to the new version, make a backup (as before upgrading any plugin) and make the following changes.//
** Renamed `locator-tags` to `locator-fields`<br />//Change the macro call in your tiddlers//
** `locator-view` does not supporting `finalFilter` and `tagFilter`<br />//Remove them from your macrocalls//
** Removed `filter-grandchildren` filter<br />//Because it can no longer be passed through parameters.//
** The "Open in Locator sidebar" toolbar button is moved from `$:/plugins/bimlas/locator/viewtemplate/open-in-sidebar` to `$:/plugins/bimlas/locator/viewtemplate/open-in-sidebar` and its code is changed as well<br />//Compare the old tiddler with the shadow and note the changes if any. Transfer them to the new tiddler and delete the old tiddler.//
!! 1.5.0
[[See GitLab for detailed change history of this release|https://gitlab.com/bimlas/tw5-locator/compare/v1.4.0...v1.5.0]]
* Move tiddler from current context to higher- or subtopic by drag-n-dropping in the Locator sidebar
* Assign any tiddler to any of the titles in the Locator sidebar by drag-n-dropping
* Show the (top-level) base tag to be able to move the tiddler titles there
* Add button to open search results in advanced search
* Show buttons using the Kin filter only when the filter operator is available
* Fix related tag issue (not all of them were listed)
* Fix whitespace issue
* Refactor the code
* Add tutorial to the demo
!! 1.4.0
[[See GitLab for detailed change history of this release|https://gitlab.com/bimlas/tw5-locator/compare/v1.3.1...v1.4.0]]
* When there was a space in the search string and "new tiddler" button is used from search, the tiddler title was encapsulated (`[[title with spaces]]`)
* When there was a space in any of the breadcrumbs in sidebar and "new tiddler" button is used from it, the tiddler got all of the breadcrumb tags, the title with spaces was encapsulated (literally `[[title with spaces]]` tag)
* Add more tips to [[$:/plugins/bimlas/locator/README/TIPS]]
* Add descriptive tooltip to buttons
!! 1.3.1
[[See GitLab for detailed change history of this release|https://gitlab.com/bimlas/tw5-locator/compare/v1.3.0...v1.3.1]]
* Add base tag if there is no breadcrumbs when creating new tiddler in current context
* Reword documentation
!! 1.3.0
[[See GitLab for detailed change history of this release|https://gitlab.com/bimlas/tw5-locator/compare/v1.2.0...v1.3.0]]
* Create new tiddler from search text
!! 1.2.0
[[See GitLab for detailed change history of this release|https://gitlab.com/bimlas/tw5-locator/compare/v1.1.0...v1.2.0]]
* Add button to create new tiddler in current context
* Ability to use additional filter on tags
!! 1.1.0
[[See GitLab for detailed change history of this release|https://gitlab.com/bimlas/tw5-locator/compare/v1.0.0...v1.1.0]]
* ''I realized that most functions work without the `kin` filter''
* Use the same "style" for breadcrumb- and list items
* Show real tags instead of tag pills
* Turn off filter of direct tag in the breadcrumbs by its tag icon
* Ancestor tags in breadcrumbs of search are operating like direct labels, they can be removed one by one
!! 1.0.0
* First public release

View file

@ -0,0 +1,38 @@
tags:
title: $:/plugins/bimlas/locator/README/README
type: text/vnd.tiddlywiki
! Locator
Locator provides ''a universal interface for navigating between your tiddlers and searching, filtering them'' without the need to write [[filter expressions|https://tiddlywiki.com/#Filters]]. The plugin contains ''a table of contents widget and an enhanced search engine'' that contains a ''visual filter builder to filter results by tags and field values''. You can ''organize the tiddlers to any number of trees, even by custom fields or links in text''. Unlike [[classic Table of Contents|https://tiddlywiki.com/#Table-of-Contents%20Macros%20(Examples)]], [[standard search|$:/core/ui/AdvancedSearch/Standard]], [[filter search|$:/core/ui/AdvancedSearch/Filter]] and [[list of tags|$:/core/ui/MoreSideBar/Tags]], this plugin handles these functions organically.
* https://bimlas.gitlab.io/tw5-locator (demo + install)
* https://gitlab.com/bimlas/tw5-locator (main repository)
* https://github.com/bimlas/tw5-locator (mirror, ''please star if you like the plugin'')
! Benefits compared to built-in solutions
* ''Shows field values''<br/>You can mark a tiddler with multiple tags and field values, but in the classic ToC you don't see them while browsing, in Locator you can apply them as filters.
* ''Easy way to search for field values''<br/>Find tags, field values in the standard search based on part of their name or view the all fields of the search results at a glance.
* ''Limit the scope of search''<br/>You don't have to store your recipes and family tree in a separate wiki just to make them easier to find: you can define the scope of your search with some clicks (without the need to write filters in [[$:/AdvancedSearch]]).
* ''Reorder the hierarchy with drag-n-drop''<br />You can easily move tiddlers between topics by drag-n-dropping them.
* ''Create mindmaps''<br />You can associate tiddlers with any field other than the tag, so you can create complex graphs that you can browse through text only user interface.
* ''There is no need to include a table of contents in the main tiddler of each topic''<br/>Just press the "Locator sidebar" button on the tiddler's toolbar and you can browse it's children, links right away in the sidebar.
* ''Create new tiddler in current scope''<br />The "new tiddler" button in Locator creates a new tiddler pre-filled with the currently selected field values and named by the search query (like a special "new here" button).
* ''Phone friendlier''<br/>The width of the classic ToC is increasing and the size of the text is decrasing as we move down in the context, while Locator remains readable.
! Usage
See the [[demo|https://bimlas.gitlab.io/tw5-locator]] for a complete tutorial
! Installation instructions
''The plugin consists of separate parts'', each of them can be used on its own, so ''it is possible to use only the parts you like'', but they can be used most effectively together because ''they interact with each other''.
To add the plugin to your own ~TiddlyWiki5, just drag this link to the browser window and ''create or drag the required tiddlers from the demo'':
$:/plugins/bimlas/locator
For other installation options see the links above.
//Select the next tab to continue.//

View file

@ -0,0 +1,55 @@
tags:
title: $:/plugins/bimlas/locator/README/TIPS
type: text/vnd.tiddlywiki
! Tips
!! Organic navigation
* In `locator-fields`, look for a tag and apply it recursively; the `locator-search` only affects tiddlers associated with it at any depth
* Click on the tag in `locator-fields` and open its tiddler, then click on the "locator sidebar" button; the `locator-view` sidebar will show it's hierarchy
* Navigate in the hierarchy in `locator-view` sidebar then search for a term in `locator-search`; pressing the "search in context" button restricting the search to the context of `locator-view` sidebar
* If you cannot find what you are searching for, then you may want to create a new tiddler, use the "new tiddler" button in one of the Locator macros
!! Taking good habits
''To get the least chance of writing the same note you wrote earlier, look for a new tiddler before creating a note. To force yourself'', hide the "new tiddler" button inside the Page Toolbar and ''use the "new tiddler" button inside the Locator search'', so if you want to create a new tiddler you must first look for it. If you are absolutely sure that there is no tiddler yet and you need to create a new tiddler, this solution is also useful because search text defines the default name of the new tiddler.
!! Let the "Locator sidebar" button automatically focus to the Locator sidebar
For example, the More -> Tags sidebar is currently open when we use the "Locator sidebar" toolbar button on one of the tiddlers, but we do not see the effect because the Locator sidebar is not visible, thus we need to modify to let button automatically open the corresponding sidebar.
* If we don't know exactly, look for the sidebar tiddler's title (used as `text` parameter in the code below)
** Open the Advanced Search -> Filter and look for the sidebar name in the `caption` field, for example `[caption[Locator]]` will result [[Locator view]]
* Find the state tiddler that contains the sidebar tiddler's title (used as `$tiddler` parameter in the code below)
** Open the Advanced Search -> Filter and look for `[text[Locator view]]` for example
** Switch between Locator sidebar and another sidebar to see which state tiddler is changing, this is what we are looking for ([[$:/state/tab/sidebar--595412856]] for example)
* Use the name of the state tiddler and the title of the sidebar in the code below and add this line to [[$:/plugins/bimlas/locator/viewtemplate/open-in-sidebar]] tiddler
```
<!-- Original code of the button... -->
...
<$button tooltip="Browse hierarchy of tag in Locator sidebar" aria-label="locator sidebar" class=<<tv-config-toolbar-class>>>
<!-- ADD THIS LINE -->
<$action-setfield $tiddler="$:/state/tab/sidebar--595412856" text="Locator view"/>
```
If you rename the sidebar, you must also update this change! See [[this thread on Google Groups|https://groups.google.com/d/msg/tiddlywiki/xAe_fvhzoCY/UoKZc7ZZDQAJ]] for details.
!! Speed up (on phones)
!!! Conditional view
Because we don't look at the table of contents and search results at the same time, we can ''hide the Locator while we are using the standard search''.
To achieve this, place the Locator view in the following condition:
```
<$reveal type="match" default="" text={{{ [prefix[$:/state/popup/search-dropdown]] }}}>
<<locator-view baseTitle:"TableOfContents">>
</$reveal>
```
''When you open TiddlyWiki'', the search entry is in focus by default, so ''the Locator sidebar is not visible''. To fix this, change the text of [[$:/config/Search/AutoFocus]] [[hidden setting|https://tiddlywiki.com/#Hidden%20Setting%3A%20Search%20AutoFocus]] to `false`.
//Select the next tab to continue.//

View file

@ -0,0 +1,56 @@
tags:
title: $:/plugins/bimlas/locator/README/macros
type: text/vnd.tiddlywiki
! Usage of the macros
!! `locator-view`
This is ''a [[Table of Contents macro|https://tiddlywiki.com/#Table-of-Contents%20Macros%20(Examples)]] that lets you navigate the wiki'' just as you would with a file manager on the file system. The macro can be placed anywhere you want, for example put it in the sidebar.
* Create a new tiddler
* Add the [[$:/tags/SideBar]] tag
* Add the `caption` field to change the title of the tab ("Contents" for example)
* Call the macro by placing this text in the tiddler:
```
<<locator-view baseTitle:"TableOfContents">>
```
Optional parameters:
; `fieldOfRelationship` (`tags` by default)
: The default field which the tree is based on.
; `templateOfContextItems` (`$:/plugins/bimlas/locator/field-templates/link` by default)
: The default template to display the context items with.
!! `locator-search` and `locator-fields`
The `locator-search` macro can be used in the same way as standard search, but ''you can narrow the scope of the search to the context by the fields filter'', in `locator-fields` you can `search for field values`.
* Create a new tiddler
* Add the [[$:/tags/SearchResults]] tag
* Add the `caption` field to change the title of the tab ("Locator" for example)
* Call the macro by placing this text in the tiddler:
```
<<locator-search>>
```
Do the same with `<<locator-fields>>` macro.
If you want to use `locator-fields` in the sidebar (like the sidebar -> More -> Tags tab) insted of standard search, you should also define the `searchTiddler` variable before the macro call:
* Create a new tiddler
* Add the [[$:/tags/SideBar]] tag
* Add the `caption` field to change the title of the tab ("Fields" for example)
* Call the macro by placing this text in the tiddler:
```
<$vars searchTiddler=" ">
<<locator-fields>>
</$vars>
```
//Select the next tab to continue.//

View file

@ -0,0 +1,15 @@
tags: $:/tags/Actions
title: $:/plugins/bimlas/locator/actions/add-field-value
type: text/vnd.tiddlywiki
\define assign-value()
<$action-setfield $tiddler=<<actionTiddler>> $field=<<currentField>> $value=<<currentTiddler>>/>
\end
\define assign-list-item()
<$action-listops $tiddler=<<actionTiddler>> $field=<<currentField>> $subfilter="[all[current]]"/>
\end
<$list filter="[title<currentField>subfilter<filter-field-is-list>]" emptyMessage=<<assign-value>> variable="null">
<<assign-list-item>>
</$list>

View file

@ -0,0 +1,6 @@
tags: $:/tags/Actions
title: $:/plugins/bimlas/locator/actions/add-to-history
type: text/vnd.tiddlywiki
<$action-listops $tiddler=<<contextState>> $field="history" $subfilter="[all[current]]"/>
{{$:/plugins/bimlas/locator/actions/remove-filters}}

View file

@ -0,0 +1,27 @@
tags: $:/tags/Actions
title: $:/plugins/bimlas/locator/actions/move-to-another-context
type: text/vnd.tiddlywiki
\define add-action-tiddler-to-current-tiddler()
<$tiddler tiddler={{{ [subfilter<filter-history>last[]] }}}>
{{||$:/plugins/bimlas/locator/actions/remove-field-value}}
</$tiddler>
{{||$:/plugins/bimlas/locator/actions/add-field-value}}
\end
\define add-current-tiddler-to-action-tiddler()
<$vars originalCurrentTiddler=<<currentTiddler>>>
<$tiddler tiddler=<<actionTiddler>>>
<$vars actionTiddler={{{ [subfilter<filter-history>last[]] }}}>
{{||$:/plugins/bimlas/locator/actions/remove-field-value}}
</$vars>
<$vars actionTiddler=<<originalCurrentTiddler>>>
{{||$:/plugins/bimlas/locator/actions/add-field-value}}
</$vars>
</$tiddler>
</$vars>
\end
<$list filter="[title<contextState>locator-direction-of-traverse<currentField>regexp[to]]" emptyMessage=<<add-current-tiddler-to-action-tiddler>> variable="null">
<<add-action-tiddler-to-current-tiddler>>
</$list>

View file

@ -0,0 +1,15 @@
tags: $:/tags/Actions
title: $:/plugins/bimlas/locator/actions/remove-field-value
type: text/vnd.tiddlywiki
\define remove-value()
<$action-setfield $tiddler=<<actionTiddler>> $field=<<currentField>> $value=""/>
\end
\define remove-list-item()
<$action-listops $tiddler=<<actionTiddler>> $field=<<currentField>> $subfilter="-[all[current]]"/>
\end
<$list filter="[title<currentField>subfilter<filter-field-is-list>]" emptyMessage=<<remove-value>> variable="null">
<<remove-list-item>>
</$list>

View file

@ -0,0 +1,7 @@
tags: $:/tags/Actions
title: $:/plugins/bimlas/locator/actions/remove-filters
type: text/vnd.tiddlywiki
<$action-deletetiddler $tiddler=<<intersectionState>>/>
<$action-deletetiddler $tiddler=<<differenceState>>/>
<$action-setfield $tiddler=<<contextState>> opened-fields-filters=""/>

View file

@ -0,0 +1,8 @@
tags:
title: $:/plugins/bimlas/locator/buttons/clear-search-input
type: text/vnd.tiddlywiki
<$button tooltip="Clear search text, show all results" class=<<link-button-class>>>
<$action-setfield $tiddler="$:/temp/search" text=" "/>
{{$:/core/images/preview-open}}
</$button>

View file

@ -0,0 +1,8 @@
tags:
title: $:/plugins/bimlas/locator/buttons/collapse-history
type: text/vnd.tiddlywiki
<$button tooltip="Collapse history" class=<<link-button-class>>>
<$action-listops $tiddler=<<contextState>> $field="history" $filter="[title<contextState>each:list-item[history]last[]]"/>
{{$:/core/images/fold-button}}
</$button>

View file

@ -0,0 +1,7 @@
tags:
title: $:/plugins/bimlas/locator/buttons/context-arrow
type: text/vnd.tiddlywiki
<$list filter="[title<contextState>field:invert-direction[yes]]" emptyMessage={{$:/core/images/right-arrow}}>
{{$:/core/images/left-arrow}}
</$list>

View file

@ -0,0 +1,16 @@
tags:
title: $:/plugins/bimlas/locator/buttons/copy-filter-to-advanced-search
type: text/vnd.tiddlywiki
<!--
Since the search term may contain characters that affect the filter, I
do not copy the search term, I just refer to the tiddler.
-->
<$wikify name="filter" text="<<filter-search-context>> +[search{<<searchTiddler>>}]">
<$button tooltip="Continue filtering in advanced search" class=<<link-button-class>>>
<$action-setfield $tiddler="$:/temp/advancedsearch" text=<<filter>>/>
<$action-setfield $tiddler="$:/state/tab--1498284803" text="$:/core/ui/AdvancedSearch/Filter"/>
<$action-navigate $to="$:/AdvancedSearch"/>
{{$:/core/images/advanced-search-button}}
</$button>
</$wikify>

View file

@ -0,0 +1,39 @@
tags:
title: $:/plugins/bimlas/locator/buttons/create-new-tiddler
type: text/vnd.tiddlywiki
\define add-as-list()
<$action-listops $tiddler="$:/temp/bimlas/locator/new-tiddler" $field=<<field>> $subfilter=<<__valueAsFilter__>>/>
\end
\define add-as-value()
<$action-setfield $tiddler="$:/temp/bimlas/locator/new-tiddler" $field=<<field>> $value={{{ [subfilter<__valueAsFilter__>] }}}/>
\end
\define add-field-value(valueAsFilter)
<$list filter="[title<field>subfilter<filter-field-is-list>]" emptyMessage=<<add-as-value>>>
<<add-as-list>>
</$list>
\end
\define add-filters-as-field-values()
<$list filter="[title<intersectionState>indexes[]]" variable="field">
<$list filter="[title<intersectionState>locator-selected-field-values<field>first[]]">
<<add-field-value "[title<intersectionState>locator-selected-field-values<field>]">>
</$list>
</$list>
\end
\define add-to-current-context()
<$set name="field" filter=<<filter-field-of-relationship>>>
<<add-field-value "[subfilter<filter-history>last[]]">>
</$set>
\end
<$button tooltip="Create new tiddler in the current context" class=<<link-button-class>>>
<<add-filters-as-field-values>>
<<add-to-current-context>>
<$action-sendmessage $message="tm-new-tiddler" $param="$:/temp/bimlas/locator/new-tiddler" title={{{ [title<titleOfNewTiddler>] [title{$:/language/DefaultNewTiddlerTitle}] -[[]] +[first[]] }}}/>
<$action-deletetiddler $tiddler="$:/temp/bimlas/locator/new-tiddler"/>
{{$:/core/images/new-button}}
</$button>

View file

@ -0,0 +1,22 @@
tags:
title: $:/plugins/bimlas/locator/buttons/go-down-to-context
type: text/vnd.tiddlywiki
\define node()
<$button tooltip="Go to context, show chidlren of this tiddler" class=<<link-button-class>> actions={{$:/plugins/bimlas/locator/actions/add-to-history}}>
{{$:/plugins/bimlas/locator/buttons/context-arrow}}
</$button>
\end
\define leaf()
<$button class=<<link-button-class>>>
{{$:/core/images/blank}}
</$button>
\end
\define go-down-to-context()
<!-- I have to use macro to use $(...)$ in filter expression -->
<$list filter="[all[current]locator-enlist-children:$(currentField)$<contextState>] [title<contextState>field:allow-to-open-leaves[yes]] +[first[]]" emptyMessage=<<leaf>> variable="null"><<node>></$list>
\end
<<go-down-to-context>>

View file

@ -0,0 +1,12 @@
tags:
title: $:/plugins/bimlas/locator/buttons/go-up-to-context
type: text/vnd.tiddlywiki
\define actions()
<$action-listops $tiddler=<<contextState>> $field="history" $filter="[subfilter<filter-history>allbefore<currentTiddler>] [all[current]]"/>
{{$:/plugins/bimlas/locator/actions/remove-filters}}
\end
<$button tooltip="Go to context, show chidlren of this tiddler" class=<<link-button-class>> actions=<<actions>>>
{{$:/plugins/bimlas/locator/buttons/context-arrow}}
</$button>

View file

@ -0,0 +1,11 @@
tags:
title: $:/plugins/bimlas/locator/buttons/open-field-settings
type: text/vnd.tiddlywiki
<$button
to="$:/plugins/bimlas/locator/settings/settings"
tooltip="Open field settings"
class=<<link-button-class>>
>
{{$:/core/images/options-button}}<$list filter="[title<contextState>!regexp[^\$:/state/bimlas/locator/search/]]" variable="null"> Open field settings</$list>
</$button>

View file

@ -0,0 +1,18 @@
tags:
title: $:/plugins/bimlas/locator/buttons/remove-filters-of-current-field
type: text/vnd.tiddlywiki
\define actions()
<$action-setfield $tiddler=<<intersectionState>> $index=<<currentField>> $value=""/>
<$action-setfield $tiddler=<<differenceState>> $index=<<currentField>> $value=""/>
<$action-listops $tiddler=<<contextState>> $field="opened-fields-filters" $subfilter="-[<currentField>]"/>
<$list filter="[<recursiveFilteringOfCurrentFieldAvailable>regexp[yes]]" variable="null">
<$action-setfield $tiddler="$:/state/bimlas/locator/search/recursive-filters/" $index=<<currentField>> $value=""/>
</$list>
\end
<$list filter="[title<intersectionState>] [title<differenceState>] +[locator-selected-field-values<currentField>first[]]" variable="null">
<$button tooltip="Remove field filters" class=<<link-button-class>> actions=<<actions>>>
{{$:/core/images/cancel-button}}
</$button>
</$list>

View file

@ -0,0 +1,9 @@
tags:
title: $:/plugins/bimlas/locator/buttons/remove-filters
type: text/vnd.tiddlywiki
<$list filter="[title<intersectionState>] [title<differenceState>] +[locator-selected-field-values[]first[]]" variable="null">
<$button tooltip="Remove field filters" class=<<link-button-class>> actions={{$:/plugins/bimlas/locator/actions/remove-filters}}>
{{$:/core/images/cancel-button}}
</$button>
</$list>

View file

@ -0,0 +1,40 @@
tags:
title: $:/plugins/bimlas/locator/buttons/search-in-context
type: text/vnd.tiddlywiki
\define copy-field(sourceTiddler destinationTiddler field)
<$set name="value" tiddler=<<__sourceTiddler__>> field=<<__field__>>>
<$action-setfield $tiddler=<<__destinationTiddler__>> $field=<<__field__>> $value=<<value>>/>
</$set>
\end
\define clear-data-tiddler(tiddler)
<$action-deletetiddler $tiddler=<<__tiddler__>>/>
<$action-setfield $tiddler=<<__tiddler__>> type="application/json"/>
\end
\define search-in-current-context()
<$action-listops $tiddler="$:/state/bimlas/locator/search/intersection/" $index={{{ [subfilter<filter-field-of-relationship>] }}} $subfilter="[subfilter<filter-history>last[]]"/>
<$action-listops $tiddler="$:/state/bimlas/locator/search/recursive-filters/" $index={{{ [subfilter<filter-field-of-relationship>] }}} $filter="[subfilter<filter-history>last[]]"/>
\end
\define copy-filters()
<$macrocall $name="copy-field" sourceTiddler=<<intersectionState>> destinationTiddler="$:/state/bimlas/locator/search/intersection/" field="text"/>
<$macrocall $name="copy-field" sourceTiddler=<<differenceState>> destinationTiddler="$:/state/bimlas/locator/search/difference/" field="text"/>
\end
\define reset-search-context()
<$action-deletetiddler $tiddler="$:/state/bimlas/locator/search/context/"/>
<$list filter="[<recursiveFilteringAvailable>regexp[yes]]" variable="null">
<$macrocall $name="clear-data-tiddler" tiddler="$:/state/bimlas/locator/search/recursive-filters/"/>
</$list>
<$macrocall $name="clear-data-tiddler" tiddler="$:/state/bimlas/locator/search/intersection/"/>
<$macrocall $name="clear-data-tiddler" tiddler="$:/state/bimlas/locator/search/difference/"/>
\end
<$button tooltip="Restrict search to this context (in full depth)" class=<<link-button-class>>>
<<reset-search-context>>
<<copy-filters>>
<<search-in-current-context>>
{{$:/core/images/advanced-search-button}}
</$button>

View file

@ -0,0 +1,19 @@
tags:
title: $:/plugins/bimlas/locator/buttons/toggle-context-settings
type: text/vnd.tiddlywiki
\define opened()
<$button tooltip="Toggle context settings" class=<<link-button-class additionalClasses:"active">>>
<$action-setfield $tiddler=<<contextState>> $field="context-settings-opened" $value=""/>
{{$:/core/images/options-button}}
</$button>
\end
\define closed()
<$button tooltip="Toggle context settings" class=<<link-button-class>>>
<$action-setfield $tiddler=<<contextState>> $field="context-settings-opened" $value="yes"/>
{{$:/core/images/options-button}}
</$button>
\end
<$list filter="[title<contextState>field:context-settings-opened[yes]]" emptyMessage=<<closed>>><<opened>></$list>

View file

@ -0,0 +1,41 @@
list-after: $:/core/ui/EditTemplate/title
tags: $:/tags/EditTemplate
title: $:/plugins/bimlas/locator/edit-template/locator-references
type: text/vnd.tiddlywiki
\define prompt()
The following references to this tiddler in //<<__field__>>// [[Locator field|$:/plugins/bimlas/locator/settings/settings]] will not be automatically updated:
\end
\define children-by-field(field)
<$list filter="[title{!!draft.of}locator-enlist-children:$field$[]first[]]" variable="null">
<$vars stateTiddler=<<qualify "$:/state/bimlas/locator/edit/references/$field$">> >
<$reveal type="nomatch" state=<<stateTiddler>> text="show">
<$button set=<<stateTiddler>> setTo="show" class="tc-btn-invisible">
{{$:/core/images/right-arrow}}
<<prompt>>
</$button>
</$reveal>
<$reveal type="match" state=<<stateTiddler>> text="show">
<$button set=<<stateTiddler>> setTo="hide" class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
<<prompt>>
</$button>
</$reveal>
<$reveal type="match" state=<<stateTiddler>> text="show">
<$list filter="[title{!!draft.of}locator-enlist-children:$field$[]]" template="$:/core/ui/ListItemTemplate">
<$link/>
</$list>
</$reveal>
</$vars>
</$list>
\end
<$reveal state="!!draft.title" type="nomatch" text={{!!draft.of}} tag="div">
<$list filter="[locator-enlist-relationship-fields[]] -[[tags]] -[[list]] -[[LINKS-IN-TEXT]]" variable="currentField">
<$macrocall $name="children-by-field" field=<<currentField>>/>
</$list>
</$reveal>

View file

@ -0,0 +1,6 @@
caption: Color
tags: $:/tags/bimlas/locator/field-templates
title: $:/plugins/bimlas/locator/field-templates/color
type: text/vnd.tiddlywiki
<input type="color" name="favcolor" value=<<currentTiddler>> disabled> <$view field="title"/>

View file

@ -0,0 +1,16 @@
caption: Edit fields + Transclusion
tags: $:/tags/bimlas/locator/context-item-templates
title: $:/plugins/bimlas/locator/field-templates/edit-fields-plus-transclusion
type: text/vnd.tiddlywiki
\define frame-classes() tc-tiddler-frame tc-tiddler-edit-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$
{{||$:/plugins/bimlas/locator/field-templates/link}}
<div class=<<frame-classes>> data-tiddler-title=<<currentTiddler>>>
<$fieldmangler>
{{||$:/core/ui/EditTemplate/tags}}
{{||$:/core/ui/EditTemplate/fields}}
</$fieldmangler>
</div>
<$transclude mode="block"/>
<hr style="border-top: double"/>

View file

@ -0,0 +1,15 @@
caption: Edit fields
tags: $:/tags/bimlas/locator/context-item-templates
title: $:/plugins/bimlas/locator/field-templates/edit-fields
type: text/vnd.tiddlywiki
\define frame-classes() tc-tiddler-frame tc-tiddler-edit-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$
{{||$:/plugins/bimlas/locator/field-templates/link}}
<div class=<<frame-classes>> data-tiddler-title=<<currentTiddler>>>
<$fieldmangler>
{{||$:/core/ui/EditTemplate/tags}}
{{||$:/core/ui/EditTemplate/fields}}
</$fieldmangler>
</div>
<hr style="border-top: double"/>

View file

@ -0,0 +1,9 @@
caption: Fields + Transclusion
tags: $:/tags/bimlas/locator/context-item-templates
title: $:/plugins/bimlas/locator/field-templates/fields-plus-transclusion
type: text/vnd.tiddlywiki
{{||$:/plugins/bimlas/locator/field-templates/link}}
{{||$:/plugins/bimlas/locator/viewtemplate/field-list}}
<$transclude mode="block"/>
<hr style="border-top: double"/>

View file

@ -0,0 +1,8 @@
caption: Fields
tags: $:/tags/bimlas/locator/context-item-templates
title: $:/plugins/bimlas/locator/field-templates/fields
type: text/vnd.tiddlywiki
{{||$:/plugins/bimlas/locator/field-templates/link}}
{{||$:/plugins/bimlas/locator/viewtemplate/field-list}}
<hr style="border-top: double"/>

View file

@ -0,0 +1,6 @@
caption: Icon
tags: $:/tags/bimlas/locator/field-templates
title: $:/plugins/bimlas/locator/field-templates/icon
type: text/vnd.tiddlywiki
<button class="tc-btn-invisible" disabled><$transclude><<currentTiddler>></$transclude></button> {{||$:/plugins/bimlas/locator/field-templates/link}}

View file

@ -0,0 +1,8 @@
caption: Link
tags: $:/tags/bimlas/locator/field-templates $:/tags/bimlas/locator/context-item-templates
title: $:/plugins/bimlas/locator/field-templates/link
type: text/vnd.tiddlywiki
<$link to=<<currentTiddler>>>
<$transclude field="caption"><$view field="title"/></$transclude>
</$link>

View file

@ -0,0 +1,6 @@
caption: Tag
tags: $:/tags/bimlas/locator/field-templates
title: $:/plugins/bimlas/locator/field-templates/tag
type: text/vnd.tiddlywiki
<<tag>>

View file

@ -0,0 +1,6 @@
caption: Text
tags: $:/tags/bimlas/locator/field-templates
title: $:/plugins/bimlas/locator/field-templates/text
type: text/vnd.tiddlywiki
<$view field="title"/>

View file

@ -0,0 +1,9 @@
caption: Transclusion
tags: $:/tags/bimlas/locator/context-item-templates
title: $:/plugins/bimlas/locator/field-templates/transclusion
type: text/vnd.tiddlywiki
{{||$:/plugins/bimlas/locator/field-templates/link}}
<br/>
<$transclude mode="block"/>
<hr style="border-top: double"/>

View file

@ -0,0 +1,36 @@
tags: $:/tags/Macro
title: $:/plugins/bimlas/locator/macros/locator-fields
type: text/vnd.tiddlywiki
\define locator-fields()
<!-- Hide internal macros, do not make them globally available -->
<$importvariables filter="[all[tiddlers+shadows]prefix[$:/plugins/bimlas/locator/macros/]]">
<$vars
contextState="$:/state/bimlas/locator/search/context/"
intersectionState="$:/state/bimlas/locator/search/intersection/"
differenceState="$:/state/bimlas/locator/search/difference/"
recursiveFilteringAvailable="yes"
>
{{$:/plugins/bimlas/locator/templates/search-toolbar}} {{$:/plugins/bimlas/locator/buttons/remove-filters}}
<p><$checkbox tiddler=<<contextState>> field="limit-to-fields-of-filtered-tiddlers" checked="yes" unchecked="no" default="yes"> Limit to fields of filtered tiddlers</$checkbox></p>
<$list filter="[subfilter<filter-selected-field-values>first[]]" emptyMessage="""<$list filter="0" variable="resultCount" template="$:/language/Search/Matches"/>""">
<$list filter="[subfilter<filter-search-context>count[]]" variable="resultCount" template="$:/language/Search/Matches"/>
</$list>
<!-- searchTiddler variable does not available in transcluded tiddlers by default -->
<$set name="filterContextItems" filter="[<contextState>field:limit-to-fields-of-filtered-tiddlers[no]]" value="[!is[system]]" emptyValue=<<filter-search-context>>>
<$vars searchedFieldValue={{$(searchTiddler)$}}>
{{$:/plugins/bimlas/locator/templates/field-names}}
</$vars>
</$set>
<$list filter="[subfilter<filter-selected-field-values>first[]]">
<$list filter="[subfilter<filter-search-context>limit[250]]" template="$:/core/ui/ListItemTemplate"/>
</$list>
</$vars>
</$importvariables>
\end

View file

@ -0,0 +1,32 @@
tags: $:/tags/Macro
title: $:/plugins/bimlas/locator/macros/locator-search
type: text/vnd.tiddlywiki
\define locator-search()
<!-- Hide internal macros, do not make them globally available -->
<$importvariables filter="[all[tiddlers+shadows]prefix[$:/plugins/bimlas/locator/macros/]]">
<$vars
contextState="$:/state/bimlas/locator/search/context/"
intersectionState="$:/state/bimlas/locator/search/intersection/"
differenceState="$:/state/bimlas/locator/search/difference/"
filterContextItems="[subfilter<filter-search-context>search{$(searchTiddler)$}]"
recursiveFilteringAvailable="yes"
>
{{$:/plugins/bimlas/locator/templates/search-toolbar}}
<$list filter="[subfilter<filterContextItems>count[]]" variable="resultCount" template="$:/language/Search/Matches"/>
{{$:/plugins/bimlas/locator/templates/fields-filter}}
//<small>{{$:/language/Search/Matches/Title}}</small>//
<$list filter="[subfilter<filterContextItems>search:title{$(searchTiddler)$}limit[250]]" template="$:/core/ui/ListItemTemplate"/>
//<small>{{$:/language/Search/Matches/All}}</small>//
<$list filter="[subfilter<filterContextItems>limit[250]]" template="$:/core/ui/ListItemTemplate"/>
</$vars>
</$importvariables>
\end

View file

@ -0,0 +1,39 @@
tags: $:/tags/Macro
title: $:/plugins/bimlas/locator/macros/locator-view
type: text/vnd.tiddlywiki
\define locator-view(baseTitle fieldOfRelationship:"tags" templateOfContextItems:"$:/plugins/bimlas/locator/field-templates/link")
<!-- Hide internal macros, do not make them globally available -->
<$importvariables filter="[all[tiddlers+shadows]prefix[$:/plugins/bimlas/locator/macros/]]">
<$vars
contextState="$:/state/bimlas/locator/view/context/$(currentTiddler)$"
intersectionState="$:/state/bimlas/locator/view/intersection/$(currentTiddler)$"
differenceState="$:/state/bimlas/locator/view/difference/$(currentTiddler)$"
defaultFieldOfRelationship=<<__fieldOfRelationship__>>
>
<!-- I have to create them nested because internal variables use external ones -->
<$vars currentField={{{ [subfilter<filter-field-of-relationship>] }}}>
<$vars filterContextItems=<<filter-view-context>>>
<div class="tc-table-of-contents">
{{$:/plugins/bimlas/locator/templates/history}}
---
{{$:/plugins/bimlas/locator/templates/context-settings}}
<div class="bimlas-locator right">
{{||$:/plugins/bimlas/locator/templates/view-toolbar}}
</div>
{{$:/plugins/bimlas/locator/templates/fields-filter}}
<ol class="bimlas-locator">
<$list filter="[subfilter<filter-field-of-relationship>regexp[^LINKS-IN-TEXT$]]" emptyMessage={{$:/plugins/bimlas/locator/templates/list-of-context-items}}>
{{||$:/plugins/bimlas/locator/templates/list-of-links-in-text}}
</$list>
</ol>
</div>
</$vars>
</$vars>
</$vars>
</$importvariables>
\end

View file

@ -0,0 +1,6 @@
tags:
title: $:/plugins/bimlas/locator/macros/css-classes
type: text/vnd.tiddlywiki
\define link-button-class(additionalClasses) tc-btn-invisible tc-tiddlylink bimlas-locator $additionalClasses$
\define menu-list-item-class() tc-menu-list-item bimlas-locator

View file

@ -0,0 +1,18 @@
tags:
title: $:/plugins/bimlas/locator/macros/filters
type: text/vnd.tiddlywiki
\define filter-history() [<__baseTitle__>] [title<contextState>each:list-item[history]] -[[]]
\define filter-selected-field-values() [title<intersectionState>] [title<differenceState>] +[locator-selected-field-values<currentField>]
\define filter-field-is-list() [addprefix[$:/config/bimlas/locator/fields/]field:field-type[list]]
\define filter-unfiltered-view-context-items() [subfilter<filter-history>last[]locator-enlist-children:$(currentField)$<contextState>!has[draft.of]]
\define filter-view-context() [subfilter<filter-history>last[]locator-enlist-children:$(currentField)$<contextState>!has[draft.of]locator-fields-filter<intersectionState>!locator-fields-filter<differenceState>]
\define filter-search-context() [!is[system]locator-fields-filter:recursive[$(intersectionState)$]!locator-fields-filter:recursive[$(differenceState)$]]
\define filter-field-of-relationship() [title<contextState>get[field-of-relationship]] [<defaultFieldOfRelationship>] +[first[]]
<!--
I know that `filter-view-context` uses a code duplication of
`filter-unfiltered-view-context-items`, but I have to do this way, becuse
$(variable)$ works only with variables defined in direct parent macro, thus
I cannot add another level to call chain
-->

View file

@ -0,0 +1,325 @@
/*\
title: $:/plugins/bimlas/locator/macros/javascript-filters.js
type: application/javascript
module-type: filteroperator
Special filters used by Locator
\*/
(function() {
/*jslint node: true, browser: true */
/*global $tw: true */
"use strict";
function getFieldDefinition(options,field) {
var fieldOptionsTiddler = "$:/config/bimlas/locator/fields/" + field;
return options.wiki.getCacheForTiddler(fieldOptionsTiddler,"fieldListingOperator",function() {
var fieldOptions = options.wiki.getTiddler(fieldOptionsTiddler) || {fields: {}};
var filterOperators = options.wiki.getFilterOperators();
var fieldDefinitions = {
"value": {
fieldType: "value",
direction: fieldOptions.fields["field-direction"],
enlistChildren: {
"to": function(title,input,prefix) {
return filterOperators["field"](input,{operand: title,prefix: prefix,suffix: field},options);
},
"from": function(title,unusedInput,unusedPrefix) {
return (options.wiki.getTiddler(title) || {fields: {}}).fields[field] || []
}
}
},
"list": {
fieldType: "list",
direction: fieldOptions.fields["field-direction"],
enlistChildren: {
"to": function(title,input,prefix) {
return filterOperators["contains"](input,{operand: title,prefix: prefix,suffix: field},options);
},
"from": function(title,unusedInput,unusedPrefix) {
return options.wiki.getTiddlerList(title,field) || [];
}
}
}
};
var linksInTextDefinition = {
fieldType: "value",
direction: fieldOptions.fields["field-direction"],
enlistChildren: {
"to": function(title,unusedInput,unusedPrefix) {
return options.wiki.getTiddlerBacklinks(title);
},
"from": function(title,unusedInput,unusedPrefix) {
return options.wiki.getTiddlerLinks(title);
}
}
};
return field === "LINKS-IN-TEXT"
? linksInTextDefinition
: fieldDefinitions[fieldOptions.fields["field-type"] || "value"];
});
}
function getActiveFilters(options,filterState) {
return options.wiki.getCacheForTiddler(filterState,"activeFilters",function() {
var filteredFields = options.wiki.getTiddlerDataCached(filterState,{});
var results = {};
$tw.utils.each(filteredFields,function(valuesAsString,field) {
var values = $tw.utils.parseStringArray(valuesAsString) || [];
if(values.length) {
results[field] = values;
}
});
return results;
});
}
function applyFieldsFilters(source,options,filterState,filterFunc,prefix) {
var activeFilters = getActiveFilters(options,filterState);
var results = source;
if(!Object.keys(activeFilters).length) return results;
$tw.utils.each(activeFilters,function(values,field) {
$tw.utils.each(values,function(value) {
if(value === "ANY-VALUE") {
var filterOperators = options.wiki.getFilterOperators();
results = filterOperators["has"](results,{operand: field,prefix: prefix},options);
} else {
results = filterFunc(results,field,value,prefix);
}
results = options.wiki.makeTiddlerIterator(results);
});
});
return results;
}
function getDirectionOfTraverse(options,contextState,fieldOfRelationship) {
var direction = getFieldDefinition(options,fieldOfRelationship).direction;
if(isDirectionInverted(options,contextState)) {
direction = invertDirection(direction);
}
return direction;
}
function isDirectionInverted(options,contextState) {
var contextStateTiddler = options.wiki.getTiddler(contextState) || {fields: []};
return contextStateTiddler.fields["invert-direction"] === "yes"
}
function invertDirection(direction) {
return ["from","to"][(direction === "from") + 0];
}
function enlistChildren(options,parentTitle,fieldOfRelationship,directionOfTraverse) {
return options.wiki.getGlobalCache("bimlas-locator-enlist-children-" + parentTitle + "-" + fieldOfRelationship + "-" + directionOfTraverse, function() {
var fieldDefinition = getFieldDefinition(options, fieldOfRelationship);
var allTiddlers = options.wiki.makeTiddlerIterator(options.wiki.getTiddlers());
return fieldDefinition.enlistChildren[directionOfTraverse](parentTitle,allTiddlers);
});
}
/*
Filter titles matching to Locator fields filter
Input: list of tiddlers
Param: filterState
Prefix: "!" to exclude matching tiddlers
Suffix: "recusive" enables recursive filtering
*/
exports["locator-fields-filter"] = function(source,operator,options) {
var results = source;
var activeRecursiveFilters = getActiveFilters(options,"$:/state/bimlas/locator/search/recursive-filters/");
if(operator.suffix === "recursive") {
results = applyFieldsFilters(results,options,operator.operand,recursiveFilterFunc,operator.prefix);
} else {
results = applyFieldsFilters(results,options,operator.operand,directFilterFunc,operator.prefix);
}
return results;
function directFilterFunc(input,field,value,prefix) {
var fieldDefinition = getFieldDefinition(options,field);
return fieldDefinition.enlistChildren["to"](value,input,prefix);
}
function recursiveFilterFunc(input,field,fieldValue,prefix) {
var isRecursiveFilteringActive = $tw.utils.hop(activeRecursiveFilters,field) && (activeRecursiveFilters[field].indexOf(fieldValue) >= 0);
if(!isRecursiveFilteringActive) {
return directFilterFunc(input,field,fieldValue,prefix);
}
var fieldDirection = getFieldDefinition(options,field).direction;
var children = [];
collectChildrenRecursively(fieldValue);
var compareFunc = (prefix !== "!")
? function(index) { return index >= 0 }
: function(index) { return index < 0 };
var results = [];
input(function(tiddler,title) {
if(compareFunc(children.indexOf(title))) {
results = $tw.utils.pushTop(results, title);
}
});
return results;
function collectChildrenRecursively(parent) {
$tw.utils.each(enlistChildren(options,parent,field,fieldDirection),function(child) {
if(children.indexOf(child) < 0) {
$tw.utils.pushTop(children, child);
$tw.utils.pushTop(children, collectChildrenRecursively(child));
}
});
}
}
};
/*
Filter fields that are not disabled in Locator field options
Input: list of fields
Param (optional): if called from toggleable fields filter (`locator-view` and `locator-search`), set to "nested"
*/
exports["locator-enabled-fields"] = function(source,operator,options) {
var typeOfFieldsFilter = operator.operand || "regular";
var excludedFields = options.wiki.filterTiddlers("[all[tiddlers+shadows]field:hide-in-" + typeOfFieldsFilter + "-fields-filter[yes]removeprefix[$:/config/bimlas/locator/fields/]]") || [];
var results = [];
source(function(tiddler,title) {
if(excludedFields.indexOf(title) < 0) {
results.push(title);
}
});
return results;
};
/*
List fields which can be used to build tree ("tags" for example)
Input: none
Param (optional): field to check if it's a relationship field
*/
exports["locator-enlist-relationship-fields"] = function(source,operator,options) {
var relationshipFields = options.wiki.getGlobalCache("bimlas-locator-enlist-relationship-fields",function() {
return options.wiki.filterTiddlers("[all[tiddlers+shadows]prefix[$:/config/bimlas/locator/fields/]has[field-direction]removeprefix[$:/config/bimlas/locator/fields/]]");
});
if(operator.operand) {
return relationshipFields.indexOf(operator.operand) >= 0
? [operator.operand]
: [];
}
return relationshipFields;
};
/*
List field values according to Locator field settings
Input: list of tiddlers
Param: field
*/
exports["locator-enlist-field-values"] = function(source,operator,options) {
var fieldDefinition = getFieldDefinition(options,operator.operand);
var results = [];
source(function(tiddler,title) {
if(!tiddler) return;
var value = fieldDefinition.enlistChildren["from"](title);
if(!value) return;
results = $tw.utils.pushTop(results,value);
});
return results;
};
/*
List of active field filters
Input: filterState
Param (optional): field
*/
exports["locator-selected-field-values"] = function(source,operator,options) {
var activeFilters = {};
source(function(tiddler,title) {
$tw.utils.each(getActiveFilters(options,title),function(value,key) {
activeFilters[key] = $tw.utils.pushTop(activeFilters[key] || [],value);
});
});
if(!Object.keys(activeFilters).length) return [];
return operator.operand
? activeFilters[operator.operand] || []
: ["TODO: Join active filter values (array of arrays)"];
};
/*
List of active field names
Input: filterState
Param (optional): none
*/
exports["locator-selected-field-names"] = function(source,operator,options) {
var fieldNames = [];
source(function(tiddler,title) {
fieldNames = $tw.utils.pushTop(fieldNames,Object.keys(getActiveFilters(options,title)));
});
return fieldNames;
};
/*
List children of input elements based on selected relationship field
Input: parent tiddlers
Param (optional): contextState
Suffix: field of relationship
*/
exports["locator-enlist-children"] = function(source,operator,options) {
var fieldOfRelationship = operator.suffix;
var directionOfTraverse = getDirectionOfTraverse(options,operator.operand,fieldOfRelationship);
var results = [];
source(function(tiddler,title) {
results = $tw.utils.pushTop(results, enlistChildren(options,title,fieldOfRelationship,directionOfTraverse));
results = options.wiki.sortByList(results,title);
});
return results;
};
/*
Get direction of traverse: field direction + optional invert direction
Input: contextState
Param: field of relationship
*/
exports["locator-direction-of-traverse"] = function(source,operator,options) {
var results = [];
source(function(tiddler,title) {
results = [getDirectionOfTraverse(options,title,operator.operand)];
});
return results;
};
})();

View file

@ -0,0 +1,11 @@
tags:
title: $:/plugins/bimlas/locator/macros/template-macros
type: text/vnd.tiddlywiki
\define droppable-menu-list-item(content actions)
<$droppable actions=<<__actions__>>>
<div class="tc-droppable-placeholder" style="display: block">
<<__content__>>
</div>
</$droppable>
\end

View file

@ -0,0 +1,10 @@
{
"title": "$:/plugins/bimlas/locator",
"description": "Locator: Discover and search by context",
"author": "bimlas",
"version": "2.0.0",
"core-version": ">=5.1.18",
"source": "https://gitlab.com/bimlas/tw5-locator",
"plugin-type": "plugin",
"list": "README/README README/macros README/TIPS README/CHANGELOG"
}

View file

@ -0,0 +1,6 @@
tags:
title: $:/config/bimlas/locator/fields/LINKS-IN-TEXT
type: text/vnd.tiddlywiki
field-direction: from
$:/plugins/bimlas/locator/field-templates/link

View file

@ -0,0 +1,5 @@
tags:
title: $:/config/bimlas/locator/fields/bag
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes
hide-in-regular-fields-filter: yes

View file

@ -0,0 +1,4 @@
tags:
title: $:/config/bimlas/locator/fields/caption
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes

View file

@ -0,0 +1,5 @@
tags:
title: $:/config/bimlas/locator/fields/color
type: text/vnd.tiddlywiki
$:/plugins/bimlas/locator/field-templates/color

View file

@ -0,0 +1,5 @@
tags:
title: $:/config/bimlas/locator/fields/created
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes
hide-in-regular-fields-filter: yes

View file

@ -0,0 +1,5 @@
tags:
title: $:/config/bimlas/locator/fields/draft.of
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes
hide-in-regular-fields-filter: yes

View file

@ -0,0 +1,5 @@
tags:
title: $:/config/bimlas/locator/fields/draft.title
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes
hide-in-regular-fields-filter: yes

View file

@ -0,0 +1,5 @@
tags:
title: $:/config/bimlas/locator/fields/icon
type: text/vnd.tiddlywiki
$:/plugins/bimlas/locator/field-templates/icon

View file

@ -0,0 +1,7 @@
tags:
title: $:/config/bimlas/locator/fields/list-after
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes
hide-in-regular-fields-filter: yes
$:/plugins/bimlas/locator/field-templates/link

View file

@ -0,0 +1,7 @@
tags:
title: $:/config/bimlas/locator/fields/list-before
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes
hide-in-regular-fields-filter: yes
$:/plugins/bimlas/locator/field-templates/link

View file

@ -0,0 +1,8 @@
tags:
title: $:/config/bimlas/locator/fields/list
type: text/vnd.tiddlywiki
field-type: list
hide-in-nested-fields-filter: yes
hide-in-regular-fields-filter: yes
$:/plugins/bimlas/locator/field-templates/link

View file

@ -0,0 +1,5 @@
tags:
title: $:/config/bimlas/locator/fields/modified
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes
hide-in-regular-fields-filter: yes

View file

@ -0,0 +1,5 @@
tags:
title: $:/config/bimlas/locator/fields/revision
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes
hide-in-regular-fields-filter: yes

View file

@ -0,0 +1,7 @@
tags:
title: $:/config/bimlas/locator/fields/tags
type: text/vnd.tiddlywiki
field-type: list
field-direction: to
$:/plugins/bimlas/locator/field-templates/tag

View file

@ -0,0 +1,5 @@
tags:
title: $:/config/bimlas/locator/fields/text
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes
hide-in-regular-fields-filter: yes

View file

@ -0,0 +1,7 @@
tags:
title: $:/config/bimlas/locator/fields/title
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes
hide-in-regular-fields-filter: yes
$:/plugins/bimlas/locator/field-templates/link

View file

@ -0,0 +1,4 @@
tags:
title: $:/config/bimlas/locator/fields/type
type: text/vnd.tiddlywiki
hide-in-nested-fields-filter: yes

View file

@ -0,0 +1,143 @@
tags:
title: $:/plugins/bimlas/locator/settings/settings
type: text/vnd.tiddlywiki
\define show-in-fields()
<$select field="hide-in-nested-fields-filter" default="">
<option value="">Show</option>
<option value="yes">Hide</option>
</$select> in nested filter (`locator-view`, `locator-search`)<br/>
<$select field="hide-in-regular-fields-filter" default="">
<option value="">Show</option>
<option value="yes">Hide</option>
</$select> in regular filter (`locator-fields` and tiddler info)
\end
\define field-type()
<$select field="field-type" default="">
<option value="">Value</option>
<option value="list">List</option>
</$select>
\end
\define field-direction()
<$select field="field-direction" default="">
<option value="">No</option>
<option value="to">Yes</option>
<!--
I blocked it because a tree with children on top is difficult to handle:
For example, there is a tiddler named "Father" which has "Kid" in the "children" field
If you want to filter tiddlers by field values (for example, in the fields filter),
"Father" will be listed among those tiddlers that have "Kid" in the "children" field.
In fact, we wanted to children of "Kid".
Filtering "Kid" in the "Fields" search tab will list the tiddlers that have "Kid" in
their "children" field (for example, "Father"). If you turn on recursive filtering,
it will list all tiddlers starting with "Kid" (so "Father" will not be listed).
The "Create tiddler in context" button also has to be aware of the direction of the
field, which also complicates the code.
If you do make this option available, remember to tell the user that when renaming a
tiddler, he must rewrite the field values that refer to the current tiddler. If you
want to rewrite it automatically, make sure it works properly with the Relink plugin
(does not adding the new name more than once to the field).
-->
<!-- <option value="from">From</option> -->
</$select>
\end
\define template()
<$select field="text" default="$:/plugins/bimlas/locator/field-templates/text">
<$list filter="[all[tiddlers+shadows]tag[$:/tags/bimlas/locator/field-templates]]">
<option value=<<currentTiddler>>><$transclude field="caption"><$view field="title"/></$transclude></option>
</$list>
</$select>
<$transclude/>
\end
\define settings(field)
<$importvariables filter="[all[tiddlers+shadows]prefix[$:/plugins/bimlas/locator/macros/]]">
<h3><$link to="$:/config/bimlas/locator/fields/$field$"><$text text=<<__field__>>/></$link></h3>
<div class="tc-control-panel">
<table>
<tbody>
<tr>
<td>Description</td>
<td>//{{$:/language/Docs/Fields/$field$}}//</td>
</tr>
<tr>
<td>Show in fields filter</td>
<td>
<<show-in-fields>>
</td>
</tr>
<tr>
<td>Field type</td>
<td>
<<field-type>>
<p>//Does the field contain a single value (for example `Franz Kafka`) or a list of values (`[[Franz Kafka]] [[Dostojevskij]]`)?//</p>
</td>
</tr>
<tr>
<td>Does the field represent a tree?</td>
<td>
<<field-direction>>
<p>//If the field contains the title(s) of other tiddler(s) (like "tags"), set it to "Yes".//</p>
</td>
</tr>
<tr>
<td>Template</td>
<td>
<<template>>
<p>//The template to display in the field filter.//</p>
<p>//You can create your own field template tiddlers by adding the// <<tag "$:/tags/bimlas/locator/field-templates">> //tag to them (click on this tag pill for examples).//</p>
</td>
</tr>
</tbody>
</table>
</div>
</$importvariables>
\end
\define option()
<option value=<<currentTiddler>>>
<$view field="title"/>
<$list filter="[subfilter<settingsTiddler>is[tiddler]] [subfilter<settingsTiddler>is[shadow]] +[first[]]">~</$list>
<$list filter="[subfilter<settingsTiddler>is[tiddler]]">*</$list>
</option>
\end
\define settingsTiddler() [title<currentTiddler>addprefix[$:/config/bimlas/locator/fields/]]
Select field to edit its settings:
<$select tiddler="$:/temp/bimlas/locator/settings-of-field">
<optgroup label="Fields of regular tiddlers">
<$list filter="[!is[system]fields[]sort[]]">
<<option>>
</$list>
</optgroup>
<optgroup label="Fields of system tiddlers">
<$list filter="[all[tiddlers+shadows]is[system]fields[]] -[!is[system]fields[]] +[sort[]]">
<<option>>
</$list>
</optgroup>
</$select>
* //`~`: Has custom settings//
* //`*`: Settings modified by user//
To set up a new field, first add it to at least one tiddler.
<p>//You can create your own context item template tiddlers by adding the// <<tag "$:/tags/bimlas/locator/context-item-templates">> //tag to them (click on this tag pill for examples).//</p>
<$list filter="[title{$:/temp/bimlas/locator/settings-of-field}] -[[]]">
<$list filter=<<settingsTiddler>>>
<$macrocall $name="settings" field={{$:/temp/bimlas/locator/settings-of-field}}/>
</$list>
</$list>

View file

@ -0,0 +1,55 @@
tags: $:/tags/Stylesheet
title: $:/plugins/bimlas/locator/stylesheet
type: text/vnd.tiddlywiki
.tc-tiddler-frame.bimlas-locator-explanation {
max-width: 400px;
}
.bimlas-locator-explanation svg {
width: 1rem;
height: 1rem;
}
.tc-drop-down button.bimlas-locator {
width: auto;
padding: 0;
display: inline-block;
background-color: inherit;
}
ol.bimlas-locator {
list-style-type: none;
margin: 0;
padding-left: 0;
}
ol.bimlas-locator ol {
margin-left: 0.75em;
padding-left: 0.3em;
border-left: 1px dashed;
}
li.toc-item.bimlas-locator, .tc-menu-list-item.bimlas-locator {
margin-top: 3px;
margin-bottom: 0;
}
.tc-menu-list-item.bimlas-locator > .tc-droppable {
display: inline-block;
}
.tc-block-dropdown.tc-search-drop-down .bimlas-locator a {
padding: 0;
}
.tc-block-dropdown.tc-search-drop-down .bimlas-locator a:hover {
background-color: initial;
}
button.bimlas-locator svg {
margin: 0 0.25em;
}
button.bimlas-locator.active svg {
fill: <<colour dirty-indicator>>;
}
.bimlas-locator.right {
float: right;
margin-right: 1em;
}
.bimlas-locator.context-settings {
border-width: 1px;
border-style: dashed;
padding: 0.5em;
}

View file

@ -0,0 +1,10 @@
tags:
title: $:/plugins/bimlas/locator/templates/context-item
type: text/vnd.tiddlywiki
<li class="toc-item">
{{||$:/plugins/bimlas/locator/buttons/go-down-to-context}}
<$list filter="[title<contextState>get[template-of-context-items]] [title<__templateOfContextItems__>] -[[]] +[first[]]" variable="template">
<$transclude tiddler=<<template>>/>
</$list>
</li>

View file

@ -0,0 +1,53 @@
tags:
title: $:/plugins/bimlas/locator/templates/context-settings
type: text/vnd.tiddlywiki
\define field-of-relationship()
Tree is based on field:<br/>
<$select tiddler=<<contextState>> field="field-of-relationship" default=<<defaultFieldOfRelationship>>>
<$list filter="[locator-enlist-relationship-fields[]]" variable="currentField">
<option value=<<currentField>>>
<$list filter="[subfilter<filter-unfiltered-view-context-items>count[]]" variable="count">
(<<count>>) <<currentField>>
</$list>
</option>
</$list>
</$select>
\end
\define template-of-context-items()
Template of context items:<br/>
<$select tiddler=<<contextState>> field="template-of-context-items" default=<<__templateOfContextItems__>>>
<$list filter="[all[tiddlers+shadows]tag[$:/tags/bimlas/locator/context-item-templates]]">
<option value=<<currentTiddler>>>
<$transclude field="caption"><$view field="title"/></$transclude>
</option>
</$list>
</$select>
\end
<$list filter="[title<contextState>field:context-settings-opened[yes]]">
<div class="bimlas-locator context-settings">
<<field-of-relationship>><br/>
<<template-of-context-items>><br/>
<$checkbox
tiddler=<<contextState>>
field="invert-direction"
checked="yes"
unchecked="no"
default="no"
>
Invert direction
</$checkbox><br/>
<$checkbox
tiddler=<<contextState>>
field="allow-to-open-leaves"
checked="yes"
unchecked="no"
default="no"
>
Allow to open leaves
</$checkbox><br/>
{{$:/plugins/bimlas/locator/buttons/open-field-settings}}
</div>
</$list>

View file

@ -0,0 +1,43 @@
tags:
title: $:/plugins/bimlas/locator/templates/field-names
type: text/vnd.tiddlywiki
\define close-actions()
<$action-listops $tiddler=<<contextState>> $field="opened-fields-filters" $subfilter="-[<currentField>]"/>
\end
\define open-actions()
<$action-listops $tiddler=<<contextState>> $field="opened-fields-filters" $subfilter="[<currentField>]"/>
\end
\define closed()
<$button class=<<fieldButtonClass>> actions=<<open-actions>>>
{{$:/core/images/down-arrow}} <<currentField>>
</$button>
{{$:/plugins/bimlas/locator/buttons/remove-filters-of-current-field}}
\end
\define opened()
<$button class=<<fieldButtonClass>> actions=<<close-actions>>>
{{$:/core/images/up-arrow}} <<currentField>>
</$button>
{{$:/plugins/bimlas/locator/buttons/remove-filters-of-current-field}}
{{$:/plugins/bimlas/locator/templates/field-values}}
\end
\define field-names() [title<intersectionState>] [title<differenceState>] +[locator-selected-field-names[]] [subfilter<filterContextItems>fields[]locator-enabled-fields<typeOfFieldsFilter>] +[sort[]]
\define has-field-value-to-list() [subfilter<filterContextItems>has<currentField>search:$(currentField)$<searchedFieldValue>] [subfilter<filter-selected-field-values>] +[first[]]
<ol class="bimlas-locator">
<$list filter=<<field-names>> variable="currentField">
<$list filter=<<has-field-value-to-list>> variable="null">
<$set name="recursiveFilteringOfCurrentFieldAvailable" filter="[<recursiveFilteringAvailable>regexp[yes]] [locator-enlist-relationship-fields<currentField>] +[count[]regexp[2]]" value="yes" emptyValue="no">
<$set name="fieldButtonClass" filter="[subfilter<filter-selected-field-values>first[]]" value=<<link-button-class additionalClasses:"active">> emptyValue=<<link-button-class>>>
<li class=<<menu-list-item-class>>>
<$list filter="[title<contextState>contains:opened-fields-filters<currentField>]" emptyMessage=<<closed>>><<opened>></$list>
</li>
</$set>
</$set>
</$list>
</$list>
</ol>

View file

@ -0,0 +1,7 @@
tags:
title: $:/plugins/bimlas/locator/templates/field-value-template
type: text/vnd.tiddlywiki
<$list filter="[[$:/config/bimlas/locator/fields/]addsuffix<currentField>get[text]]" emptyMessage={{$:/plugins/bimlas/locator/field-templates/text}} variable="template">
<$transclude tiddler=<<template>>/>
</$list>

View file

@ -0,0 +1,106 @@
tags:
title: $:/plugins/bimlas/locator/templates/field-values
type: text/vnd.tiddlywiki
\define remove-filtering-of-current-field()
<$action-setfield $tiddler=<<intersectionState>> $index=<<currentField>> $value=""/>
<$action-setfield $tiddler=<<differenceState>> $index=<<currentField>> $value=""/>
<$list filter="[<recursiveFilteringOfCurrentFieldAvailable>regexp[yes]]" variable="null">
<$action-setfield $tiddler="$:/state/bimlas/locator/search/recursive-filters/" $index=<<currentField>> $value=""/>
</$list>
\end
\define remove-from-intersection-state()
<$action-listops $tiddler=<<intersectionState>> $index=<<currentField>> $subfilter="-[all[current]]"/>
\end
\define remove-from-difference-state()
<$action-listops $tiddler=<<differenceState>> $index=<<currentField>> $subfilter="-[all[current]]"/>
\end
\define activate-actions()
<<__beforeActivateActions__>>
<$action-listops $tiddler=<<__filterState__>> $index=<<currentField>> $subfilter="[all[current]]"/>
\end
\define inactivate-actions()
<$action-listops $tiddler=<<__filterState__>> $index=<<currentField>> $subfilter="-[all[current]]"/>
<$list filter="[<recursiveFilteringOfCurrentFieldAvailable>regexp[yes]]" variable="null">
<$action-listops $tiddler="$:/state/bimlas/locator/search/recursive-filters/" $index=<<currentField>> $subfilter="-[all[current]]"/>
</$list>
\end
\define button-inactive()
<$button tooltip=<<__tooltip__>> class=<<link-button-class>> actions=<<activate-actions>>>
<<__icon__>>
</$button>
\end
\define button-active()
<$button tooltip=<<__tooltip__>> class=<<link-button-class additionalClasses:"active">> actions=<<inactivate-actions>>>
<<__icon__>>
</$button>
\end
\define toggle-button(filterState icon beforeActivateActions tooltip)
<$list filter="[title<__filterState__>locator-selected-field-values<currentField>is[current]]" emptyMessage=<<button-inactive>>>
<<button-active>>
</$list>
\end
\define field-values-of-context-items() [subfilter<filterContextItems>locator-enlist-field-values<currentField>search:title<searchedFieldValue>] [subfilter<filter-selected-field-values>] +[sort[]]
<ol class="bimlas-locator">
<li class=<<menu-list-item-class>>>
<$tiddler tiddler="ANY-VALUE">
<$macrocall
$name="toggle-button"
filterState=<<intersectionState>>
icon={{$:/core/images/new-button}}
beforeActivateActions=<<remove-filtering-of-current-field>>
tooltip="Toggle filtering to any value"
/>
<$macrocall
$name="toggle-button"
filterState=<<differenceState>>
icon={{$:/core/images/close-button}}
beforeActivateActions=<<remove-filtering-of-current-field>>
tooltip="Toggle filtering to any value"
/>
__Any value__
</$tiddler>
</li>
<$list filter="[subfilter<field-values-of-context-items>regexp[^ANY-VALUE$]count[]] -[[1]]" variable="null">
<$list filter=<<field-values-of-context-items>>>
<li class=<<menu-list-item-class>>>
<$macrocall
$name="toggle-button"
filterState=<<intersectionState>>
icon={{$:/core/images/new-button}}
beforeActivateActions=<<remove-from-difference-state>>
tooltip="Toggle filtering to this value"
/>
<$macrocall
$name="toggle-button"
filterState=<<differenceState>>
icon={{$:/core/images/close-button}}
beforeActivateActions=<<remove-from-intersection-state>>
tooltip="Toggle filtering to this value"
/>
<$list filter="[<recursiveFilteringOfCurrentFieldAvailable>regexp[yes]]" variable="null">
<$macrocall
$name="toggle-button"
filterState="$:/state/bimlas/locator/search/recursive-filters/"
icon={{$:/core/images/link}}
tooltip="Toggle recursive filtering to this value"
/>
</$list>
<$macrocall
$name="droppable-menu-list-item"
content={{$:/plugins/bimlas/locator/templates/field-value-template}}
actions={{$:/plugins/bimlas/locator/actions/add-field-value}}
/>
</li>
</$list>
</$list>
</ol>

View file

@ -0,0 +1,34 @@
tags:
title: $:/plugins/bimlas/locator/templates/fields-filter
type: text/vnd.tiddlywiki
\define open-actions()
<$action-listops $tiddler=<<contextState>> $field="opened-fields-filters" $subfilter="[[FIELDS-FILTER]]"/>
\end
\define close-actions()
<$action-listops $tiddler=<<contextState>> $field="opened-fields-filters" $subfilter="-[[FIELDS-FILTER]]"/>
\end
\define opened()
<$button class=<<fieldsFilterButtonClass>> actions=<<close-actions>>>
{{$:/core/images/up-arrow}} __Filter by fields__
</$button>
{{$:/plugins/bimlas/locator/buttons/remove-filters}}
<ol class="bimlas-locator">
{{$:/plugins/bimlas/locator/templates/field-names}}
</ol>
\end
\define closed()
<$button class=<<fieldsFilterButtonClass>> actions=<<open-actions>>>
{{$:/core/images/down-arrow}} __Filter by fields__
</$button>
{{$:/plugins/bimlas/locator/buttons/remove-filters}}
\end
<$set name="fieldsFilterButtonClass" filter="[subfilter<filter-selected-field-values>first[]]" value=<<link-button-class additionalClasses:"active">> emptyValue=<<link-button-class>>>
<$vars typeOfFieldsFilter="nested">
<$list filter="[title<contextState>contains:opened-fields-filters[FIELDS-FILTER]]" emptyMessage=<<closed>>><<opened>></$list>
</$vars>
</$set>

View file

@ -0,0 +1,6 @@
tags:
title: $:/plugins/bimlas/locator/templates/history-item
type: text/vnd.tiddlywiki
{{||$:/plugins/bimlas/locator/buttons/go-up-to-context}}
{{||$:/plugins/bimlas/locator/field-templates/link}}

View file

@ -0,0 +1,7 @@
tags:
title: $:/plugins/bimlas/locator/templates/history
type: text/vnd.tiddlywiki
<$list filter=<<filter-history>>>
<$macrocall $name="droppable-menu-list-item" content={{$:/plugins/bimlas/locator/templates/history-item}} actions={{$:/plugins/bimlas/locator/actions/move-to-another-context}}/>
</$list>

View file

@ -0,0 +1,11 @@
tags:
title: $:/plugins/bimlas/locator/templates/list-of-context-items
type: text/vnd.tiddlywiki
<$list filter=<<filterContextItems>>>
<$macrocall
$name="droppable-menu-list-item"
content={{$:/plugins/bimlas/locator/templates/context-item}}
actions={{$:/plugins/bimlas/locator/actions/move-to-another-context}}
/>
</$list>

View file

@ -0,0 +1,7 @@
tags:
title: $:/plugins/bimlas/locator/templates/list-of-links-in-text
type: text/vnd.tiddlywiki
<$list filter="[subfilter<filterContextItems>sort[]]">
{{||$:/plugins/bimlas/locator/templates/context-item}}
</$list>

View file

@ -0,0 +1,12 @@
tags:
title: $:/plugins/bimlas/locator/templates/search-toolbar
type: text/vnd.tiddlywiki
<$vars
titleOfNewTiddler={{$:/temp/search}}
>
{{$:/plugins/bimlas/locator/buttons/clear-search-input}}
{{$:/plugins/bimlas/locator/buttons/copy-filter-to-advanced-search}}
{{$:/plugins/bimlas/locator/buttons/create-new-tiddler}}
{{$:/plugins/bimlas/locator/buttons/open-field-settings}}
</$vars>

View file

@ -0,0 +1,12 @@
tags:
title: $:/plugins/bimlas/locator/templates/view-toolbar
type: text/vnd.tiddlywiki
<$list filter="[title<contextState>!field:invert-direction[yes]]" variable="null">
<$list filter="[subfilter<filter-field-of-relationship>!regexp[^LINKS-IN-TEXT$]]">
{{||$:/plugins/bimlas/locator/buttons/create-new-tiddler}}
</$list>
{{$:/plugins/bimlas/locator/buttons/search-in-context}}
</$list>
{{$:/plugins/bimlas/locator/buttons/collapse-history}}
{{$:/plugins/bimlas/locator/buttons/toggle-context-settings}}

View file

@ -0,0 +1,20 @@
tags:
title: $:/plugins/bimlas/locator/viewtemplate/field-list
type: text/vnd.tiddlywiki
<table class="tc-view-field-table">
<tbody>
<$list filter="[all[current]fields[]locator-enabled-fields[]sort[title]] -text" variable="currentField">
<tr class="tc-view-field">
<td class="tc-view-field-name">
<$text text=<<currentField>>/>
</td>
<td class="tc-view-field-value">
<$list filter="[all[current]locator-enlist-field-values<currentField>]">
{{||$:/plugins/bimlas/locator/templates/field-value-template}}
</$list>
</td>
</tr>
</$list>
</tbody>
</table>

View file

@ -0,0 +1,9 @@
caption: {{$:/language/TiddlerInfo/Fields/Caption}} (Locator)
list-after: $:/core/ui/TiddlerInfo/Fields
tags: $:/tags/TiddlerInfo
title: $:/plugins/bimlas/locator/viewtemplate/fields-info
type: text/vnd.tiddlywiki
{{||$:/plugins/bimlas/locator/viewtemplate/field-list}}
{{$:/plugins/bimlas/locator/buttons/open-field-settings}}

View file

@ -0,0 +1,26 @@
tags: $:/tags/ViewToolbar
title: $:/plugins/bimlas/locator/viewtemplate/open-in-sidebar
type: text/vnd.tiddlywiki
caption: {{$:/core/images/chevron-right}} locator sidebar
description: Browse hierarchy of tag in Locator sidebar
list-before: $:/core/ui/Buttons/open-window
\whitespace trim
<$button tooltip="Browse hierarchy of tag in Locator sidebar" aria-label="locator sidebar" class=<<tv-config-toolbar-class>>>
<$vars
contextState="$:/state/bimlas/locator/view/context/"
intersectionState="$:/state/bimlas/locator/view/intersection/"
differenceState="$:/state/bimlas/locator/view/difference/"
>
{{||$:/plugins/bimlas/locator/actions/add-to-history}}
</$vars>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]" variable="listItem">
{{$:/core/images/chevron-right}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text">
<$text text=" "/>
<$text text="locator sidebar"/>
</span>
</$list>
</$button>

View file

@ -6,4 +6,4 @@ tags: static
title: sitemapserver
type: text/vnd.tiddlywiki
https://wiki.onetwo.ren/
https://onetwo.ren/wiki/

View file

@ -0,0 +1,10 @@
/*\
title: $:/plugins/felixhayashi/hotzone/config.js
type: application/javascript
module-type: library
@preserve
\*/
(function(){"use strict";exports.config={classNames:{storyRiver:"tc-story-river",tiddlerFrame:"tc-tiddler-frame",tiddlerTitle:"tc-title"},references:{userConfig:"$:/config/hotzone/focusOffset",focussedTiddlerStore:"$:/temp/focussedTiddler"},checkbackTime:$tw.utils.getAnimationDuration()}})();

View file

@ -0,0 +1,13 @@
{
"title": "$:/plugins/felixhayashi/hotzone",
"description": "HotZone Be notified when tiddlers are scrolled into view",
"author": "Felix Küppers",
"version": "0.0.3",
"released": "",
"core-version": ">=5.1.5",
"source": "https://github.com/felixhayashi/TW5-HotZone",
"type": "application/json",
"plugin-type": "plugin",
"list": "Configuration License Readme",
"dependents": ""
}

View file

@ -0,0 +1,10 @@
/*\
title: $:/plugins/felixhayashi/hotzone/hotzone.js
type: application/javascript
module-type: startup
@preserve
\*/
(function(){"use strict";exports.name="hotzone";exports.platforms=["browser"];exports.after=["story"];exports.synchronous=true;exports.startup=function(){var t=require("$:/plugins/felixhayashi/hotzone/config.js").config;var e=null;var i=false;var r=document.getElementsByClassName(t.classNames.storyRiver)[0];var s=$tw.wiki.getTiddlerData(t.references.userConfig,{});var a=isNaN(parseInt(s.focusOffset))?150:parseInt(s.focusOffset);var n=function(e,i,r){if(!(e instanceof Element))return;if(!$tw.utils.hasClass(e,t.classNames.tiddlerFrame))return;var s=e.getElementsByClassName(t.classNames.tiddlerTitle)[0];if(s){var a=s.innerText||s.textContent;return a.trim()}};var o=function(t){if(!i){i=true;window.setTimeout(f,t||0)}};var l=function(e,i){$tw.wiki.addTiddler(new $tw.Tiddler({title:t.references.focussedTiddlerStore,text:e},$tw.wiki.getModificationFields()));if(i){var r=document.getElementsByClassName("hzone-focus")[0];if(r){$tw.utils.removeClass(r,"hzone-focus")}$tw.utils.addClass(i,"hzone-focus")}};var f=function(){i=false;var s=$tw.wiki.getTiddler("$:/StoryList");if(s&&s.fields.list.length){var o=null;var f=Number.MAX_VALUE;var d=r.children;var u=t.classNames.tiddlerFrame;for(var c=d.length;c--;){if($tw.utils.hasClass(d[c],u)){var v=d[c].getBoundingClientRect();var w=Math.min(Math.abs(a-v.top),Math.abs(a-v.bottom));if(w<f){o=d[c];f=w}}}var m=n(o);if(m!==e&&$tw.wiki.getTiddler(m)){e=m;l(e,o);return}}else if(e){e="";l(e)}};var d=function(t){if(t["$:/HistoryList"]){if(!$tw.wiki.tiddlerExists("$:/HistoryList"))return;var e=$tw.wiki.getTiddler("$:/HistoryList").fields["current-tiddler"];var i=$tw.wiki.getTiddlerList("$:/StoryList");var r=i.indexOf(e)>=0;if(!r)return;o($tw.utils.getAnimationDuration()+100)}else if(t["$:/StoryList"]){o($tw.utils.getAnimationDuration()+100)}};var u=function(t){o(250)};$tw.wiki.addEventListener("change",d);window.addEventListener("scroll",u,false);u()}})();

View file

@ -0,0 +1,12 @@
title: $:/plugins/felixhayashi/hotzone/Configuration
Please see the [[GitHub page|https://github.com/felixhayashi/TW5-HotZone]] for more information on the options.
Save and reload the wiki to activate changes.
<table>
<tr>
<th align="left">Focus offset:</th>
<td><$edit-text tiddler="$:/config/hotzone/focusOffset" tag="input" default="71px" /></td>
</tr>
</table>

View file

@ -0,0 +1 @@
title: $:/temp/focussedTiddler

View file

@ -0,0 +1,5 @@
title: $:/plugins/felixhayashi/hotzone/License
This code is released under the BSD license. For the exact terms visit:
https://github.com/felixhayashi/TW5-HotZone/blob/master/LICENSE

View file

@ -0,0 +1,3 @@
title: $:/plugins/felixhayashi/hotzone/Readme
Please visit the [[GitHub page|https://github.com/felixhayashi/TW5-HotZone]] for more information.

Some files were not shown because too many files have changed in this diff Show more