Ideas for a Streams rewrite

Sorry if I was blind. Is there a demo to test it?

No apologies, sorry if I was less than helpful – did this example look like the sort of thing you’re going for (right clicking and selecting todo) to change the template?

If so I can work up a demo or just show my work – it’s a fairly straightforward of the stream-row-body

1 Like

I must have had tomatoes on my eyes. This is great. But with demo, I meant a wiki to play with, the movie is to fast to grasp all the features. Did you implement @fastfreddy’s Fusion-Tools ? To my mind they are very important.
It is good you used the bullet to display the menu, the link to the tiddler is rather distracting.

I’m glad you think so, when you described to @vuk what you were going for I thought it sounded like a match.

I have used Fusion, but (I believe I saw you mention this recently), it is only really helpful for me if it preserves both the streams (outline-view) and also the fused version. I agree wholeheartedly (and think @saqimtiaz is on the same page with this) that better compatibility between Streams and Fusion would a big plus.

Perhaps it’s time for me to put this together, since it’s come up more than once – but previous conversations did not leave me with the impression that my thinking was too out-of-the-norm on this, so let me give you a quick overview (better structure and a formal demo of this would be good features for a rewrite):

$:/plugins/sq/streams/templates/stream-row-body controls the way that the nodes are rendered. This is extremely simple to set up conditional logic in. For example:

<$list filter="[all[current]!tag[Idea]!tag[Index]!tag[Praxis]!tag[Health]!tag[Source]!tag[Place]!tag[Journal]!tag[character]!tag[setting]!tag[reaction]!tag[description]!tag[element]!tag[concept]!tag[TODO]!tag[Notes]]">
  <$list filter="[all[current]!tag[Incomplete]]">
    <$transclude mode="block"/>
  </$list>
  <$list filter="[all[current]tag[Incomplete]]">
    <div style="color: red;">
      <p>{{!!text}}</p>
    </div>
  </$list>
</$list>

Above you see a very basic conditional statement from my stream-row-body which makes all items tagged Incomplete appear in red.

My Todo logic looks quite a bit more complicated, but I promise that’s illusory – you can see that it includes the logic for creating the checkbox:

<$list filter="[all[current]tag[TODO]]">
<span style="display: inline-flex; align-items: center;">
<$checkbox tag="done"/>
[[TODO|$:/TODO]] &nbsp;&nbsp;
<$button actions="<$action-setfield $field='datepicker-visible' $value={{{ [{!!datepicker-visible}match[yes]then[no]else[yes]] }}}/>" class="tc-btn-invisible" tooltip="Toggle Datepicker">
{{$:/core/images/down-arrow}}
</$button>
</span>
&nbsp;&nbsp; <$button tooltip={{$:/wilk/buttons/add-to-calendar!!description}} class=<<tv-config-toolbar-class>> actions=<<addToCalendarActions>> >
	<%if [<tv-config-toolbar-icons>match[yes]] %>
		{{$:/Notestreams/images/calendar|1em|G}}
	<%endif%>
	<%if [<tv-config-toolbar-text>match[yes]] %>
		<span class=tc-btn-text>Add to calendar</span>
	<%endif%>
</$button> 
<br> {{!!text}}  <br> <$reveal type="match" state="!!datepicker-visible" text="yes">
{{||$:/Notestreams/datepicker}}
</$reveal>
</$list>

$:/plugins/sq/streams/contextmenu/contextmenu-template is the relevant tiddler for the context menu: @saqimtiaz has a tagging system which allows you to add items to the context menu, but it does not allow for the contextual conditional statements which I have added to mine:

\define common-menu-items()
            <$macrocall $name="menu-item" title="Open" actions="""<$action-navigate/>"""/>
            <$macrocall $name="menu-item" title="Rename" subtitle="((streams-rename))" actions=<<rename-node-actions>>/>
            <$macrocall $name="menu-item" title="Add Description" subtitle="((add-description-actions))" actions=<<add-description-actions>>/>
						<$macrocall $name="menu-item" title="Mark as Stub" subtitle="((mark-stub))" actions=<<addStubTag>>/>
						<$macrocall $name="menu-item" title="Copy Title" subtitle="((copy-link))" actions="""<<copy-link>>/>"""/>
						<$macrocall $name="menu-item" title="Create Reference" subtitle="((create-link))" actions="""<<add-new-link>>/>"""/>
						<$macrocall $name="menu-item" title="Transclude as Note" subtitle="((transclude-config))" actions="""<<transcludeAsNote>>/>"""/>
            <$macrocall $name="menu-item" title="Delete" subtitle="((streams-delete))" actions=<<delete-node-actions>>/>
						<$macrocall $name="menu-item" title="Add to Daily Notes" subtitle="((transclude-tiddler))" actions=<<create-transclusion-and-append-to-daily-journal>>/>
						<$macrocall $name="menu-item" title="Edit Content" subtitle="" actions="""<<clarify-content-streams>>"""/>
						<$macrocall $name="menu-item" title="Yadda-yadda" subtitle="((yadda-yadda))" actions="""<<yadda-yadda-streams>>"""/>
						<$macrocall $name="menu-item" title="send to calendar" subtitle="" actions="""<<.addToCalendarActions>>"""/>
<$macrocall $name="menu-item" title="Cut from Stream"  subtitle="" actions="""<<copyTitleAndRemoveFromStream>>"""/>
<$macrocall $name="menu-item" title="Add to Stream"  subtitle="" actions="""<<add-to-streamlist>>"""/>
						\end

Here you can see the modifications to the common context menu items I’ve made

  <$list filter="[<currentTiddler>tag[Idea]]" variable="ideaCheck">
            <$macrocall $name="menu-item" title="Create Topic" subtitle="((create-topic))" actions=<<create-topic-actions>>/>
            <$macrocall $name="menu-item" title="Remove Idea Tag" subtitle="((remove-idea-tag))" actions=<<removeIdeaTag>>/>
            <$macrocall $name="menu-item" title="Adopt Index" subtitle="((adopt-index))" actions=<<adopt-index-actions>>/>
            <$macrocall $name="menu-item" title="Add Description" subtitle="((add-description))" actions=<<add-description-actions>>/>
            <$macrocall $name="menu-item" title="Recaption" subtitle="((recaption))" actions=<<recaption-actions>>/>
            <$macrocall $name="menu-item" title="Add Alias" subtitle="((add-alias))" actions=<<add-alias-actions>>/>
						<$macrocall $name="menu-item" title="Upgrade to Index" subtitle="((mark-index))" actions=<<mark-index-actions>>/>
            <<common-menu-items>>
        </$list>

And above you can see an example of a conditional filter I’ve applied which creates a custom menu for tiddlers tagged Idea (note the inclusion of <<common-menu-items>>)

I think my version is very sloppy atm and is overdue for some cleanup. If I can make some time this week, I’ll do that and put together a demo so we can get a better grasp on the potential of this as a long term feature.

3 Likes

Kinda an out-there idea, perhaps, but I was playing with the Sections Editor today, reflecting some on the nature of the outline vs the fused content, and it got me thinking some about this other point


I almost wish streams were even more flexible, rendering within sections of tiddlers, which could be infinitely branched off (excised) into new tiddlers that would each exist both in its outline and in its fused form, depending on the toggle.

Feel I’m a little fuzzy on the details, but I might work on writing something more concrete.

1 Like

You get a big heart by me but sections seem to be heresy in TW.
There is a link to sections PR for months that I highlighted in my most wanted thread , and transcluding a section would be … inimaginable.

@Mohammad did great work there - but to have the necessary stability for these heretic desires, sections should be named and not numbered.

Well, I don’t want to step on any core tenets of the church, it just occurs to me that what we are talking about,

would be a set of nodes that group around, not the tiddler itself, but an element of the tiddler – we can think of a stream-list as a collection of nodes that has some relationship toward the tiddler itself, and if we take it one step further we can talk about the relationships between these collections within the tiddler – since the natural state for text, as it grows, is to bubble off into smaller pieces, given the “tiddly” part of Tiddly-Wiki

I have had some success with transcluding multiple streamlists into one tiddler, which can all relate to one-another – really, at this point, all that we need is

  1. a better streams/fusion integration
  2. A UI that makes having multiple streamlists embedded in the same tiddler a more natural and less buggy process
2 Likes

Point 2. could be achived the way @linonetwo modified streams: By transfering it into a macro, that can be used anywhere.

My main use of Streams so far has been to ease the slideshow creation process with @Mohammad’s Tamasha. For those who don’t know how it works, each “slide” of a presentation is a tiddler tagged with an identifier of said presentation. To achieve this, I use @linonetwo’s macro version of Streams, as I didn’t find a way to automatically associate a common tag to a bunch of Streams nodes with the original Streams version.

@saqimtiaz A Streams rewrite could be a good idea as far as the “internals” are concerned, but for simple users like me, you may consider implementing a custom parser that would allow, for example, to automatically give a tag to each Streams-created tiddler using a simple syntax (e.g. tag:MyTag at the beginning of the line or whatever). A bit in the vein of what nb does.

@well-noted I’m interested in learning more about your custom menu.

1 Like

There is a streams configuration, that allows you to define a template-tiddler. If you create such a tiddler eg: stream-template and tag it: test – Every new node will be tagged test

Great point, thanks for reminding me about this, @JanJo. I think toying with this could yield inspiration.

Thank you for the information about this setting in Streams.
However, I don’t think that it really fits with my workflow, as I need to use a different tag for each presentation I make.

I personally would make 1 wiki per presentation. Just a thought.

I would be really happy if you could share your refactoring.

2 Likes

Ok, in this case your piece of advice is spot on.
This is not how I do it anyways. Kind of the opposite, actually. I use one big wiki to centralize everything. So presentations are just one of the “outputs”.

Sorry for anyone who’s been waiting for this. Instead, I’ve been toying around with @linonetwo’s outliner, attempting to get it to work with fusion, and implementing bidirectional editing (unfuse), borrowing from the sections code for inspiration:

It’s still a little hinky, but this should at least make clear what I’m thinking and act as a proof of concept

vivaldi_Q7ydIDmGc8

@linonetwo’s choice to have the stream-list for the outliner stored in another tiddler gave me inspiration – that tiddler’s text field is being left unused and, therefore, can hold the fused contents without compromising the nodes, allowing the user to switch between views easily.

I am thinking that by adding an editable title (or conditionally the caption) to a headline of this viewtemplate, we can essentially gain the “streams headlines” functionality that I mentioned above.

EDIT:
Something like this:


1 Like

Hi @well-noted , I really would like to test the thing you post there… even in beta

@JanJo, will post and tag you as soon as I have something ready to be beta-packaged :slight_smile: It works surprisingly well for a kitbash – but it’s definitely still in the proof-of-concept stage.

Ultimately it would need some feedback from others about how the parser should work (for example, I was going to have the parser remove lines that were blank, but then it occurred to me that some people might want blank tiddlers as placeholders, or else to hold field values or tags… :man_shrugging:

You can see in this example that I am using <br> to indicate node-breaks, in case others would want to have linebreaks within nodes (I don’t usually, myself, however…).

And then, I have no mechanism (yet) for parsing indented nodes - - my first thought it to use *, **, ***, etc. I think that would make it compatible with another of @saqimtiaz’s plugins which I don’t currently use but have looked at.

I spent some time working on this, enough to believe some sort of index specifically for this type of tiddler would work – however, it became obvious to me that it would take time and reflection before I could produce a working example, from which I’m not even sure many streams users would benefit unless it were also paired with something more general like flexible text parsing, so I thought it more sensible to set that aside and start here.

1 Like

Yes, I have this idea, expose as much feature to be override by \procedure as possible.

I’m not sure is it easy to replace {{||$:/plugins/linonetwo/streams-outliner-lib/templates/stream-root-template}} to <<stream-root-template>>, maybe this kind of transclusion have something special.

Sadly I encounter this issue