$transclude $variable --> template?

I think if a transclusion-widget needs a template there is something wrong in the concept of the code. Templates are usually resolved using transclusions.

The tiddler-widget sets the “currentTiddler” variable to a tiddler title and defines some class-variables.

If you do not need the class variables, your code can be reduced to a template itself.

Like so:

title: my-ad-hoc-field-editor

\whitespace trim

<h2><$text text=<<currentTiddler>>/></h2>

<div class="ad-hoc-fields-editor-container">
 <$fieldmangler >
  <$transclude $tiddler="$:/core/ui/EditTemplate/fields"/>
  </$fieldmangler>
</div>

that can be called with:

\define currentTiddler() "$:/.rgt/bk/data/macro-doc-ui"

<$transclude $tiddler="my-ad-hoc-field-editor"/>

I think this construction is much more flexible in the long run. Your own templates can manipulate the currentTiddler variable, because it is only a convention every UI element can use.