On Monday, August 9, 2021 at 7:01:42 PM UTC+2 davou...@gmail.com wrote: I don't suppose there is documentation of TW as finite state machine.
There is the TW dev documentation, that has been started, I think by 2 students as a project to analyse the internal structure of TW. See: https://tiddlywiki.com/dev/ ... This docs shows most of the internals, that core developers need to know. > Probably not, but thought I would ask. What I mean is documentation broken > down as: > > 1. Here are all the possible states TW can be in > > There are way to many states TW can have. All of the states the TW UI can have, are stored in tiddlers. ... Eg: The reveal widget <https://tiddlywiki.com/#RevealWidget> needs a state-tiddler to decide if it should be "open" or "closed". Depending on the value of a field or an index of the state-tiddler, the widget renders differently. The state of the field can be changed by actions. Actions are mainly triggered by buttons. ... Buttons are pressed by users. So in the end the whole system is "user event" driven. > > 1. Here are the rules for when TW is in a given state > > Most of the time the decision is created with matches. Eg. again the reveal widget has a type-field, where we define if it should compare the state-tiddler value with a given value. ... The result of the "match" decides if a state is eg: open or closed. ... Some other widgets have an "implicit" rule. Eg: the transclusion-widget <https://tiddlywiki.com/#TranscludeWidget>. If the widget is called with a tiddler attribute that doesn't exist is uses the content between transclusion-start and transclusion-end as the "value" that should be shown. This mechanism allows us to create very simple wikitext code that uses a fallback, if a value is missing. eg: The right sidebar shows a list of tiddlers. If a tiddler has a caption-field it is used. If the caption-field is missing, we show the tiddler title. eg <$transclude tiddler=<<currentTiddler>> field=caption> <$text text={{!!title}}/> </$transclude> The $view-widget has a very similar behaviour. ... > > 1. And here are the triggers that will change TW from one state to > another > > As I wrote. In normal cases changes are driven by the user. Whenever a button is clicked, there is usually an action-parameter somewhere, which triggers the change of a tiddler value. ... The TW core has an internal mechanism, that watches the state of every tiddler in the store. Whenever a tiddler is changed, a "change" event is triggered by the core. Every widget, that needs values from tiddlers listens to this "change" event and acts accordingly. Maybe there are too many states, or may different levels/granularities of > states. > The "granularity" the system can handle, is on the tiddler level. As above, every tiddler value change triggers a "change" event. So the smallest element we use to store state is a tiddler. hope that helps. mario -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/c0ab536d-c969-44f2-99a6-e34ac5b2584an%40googlegroups.com.