tw5-graph 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +65 -0
  2. package/package.json +39 -0
  3. package/plugins/graph/DefaultColourMappings.multids +8 -0
  4. package/plugins/graph/ViewTemplateBodyFilter/graph.tid +5 -0
  5. package/plugins/graph/ViewTemplateBodyFilter/properties.tid +5 -0
  6. package/plugins/graph/edges/fields/list.tid +7 -0
  7. package/plugins/graph/edges/fields/tags.tid +7 -0
  8. package/plugins/graph/edges/functions/links.tid +8 -0
  9. package/plugins/graph/edges/functions/transcludes.tid +8 -0
  10. package/plugins/graph/fieldtypes/filter.js +212 -0
  11. package/plugins/graph/fieldtypes/list.js +31 -0
  12. package/plugins/graph/fieldtypes/title.js +27 -0
  13. package/plugins/graph/filterrunprefixes/cache.js +118 -0
  14. package/plugins/graph/filters/gettyped.js +26 -0
  15. package/plugins/graph/graphengine.js +38 -0
  16. package/plugins/graph/icon.tid +16 -0
  17. package/plugins/graph/images/drag.tid +13 -0
  18. package/plugins/graph/macros/action.addedge.tid +16 -0
  19. package/plugins/graph/macros/edges.typed.tid +54 -0
  20. package/plugins/graph/macros/graph.view.tid +24 -0
  21. package/plugins/graph/macros/node.default.tid +9 -0
  22. package/plugins/graph/macros/nodes.neighbors.tid +62 -0
  23. package/plugins/graph/macros/nodes.writable.tid +37 -0
  24. package/plugins/graph/macros/properties.persistent.tid +27 -0
  25. package/plugins/graph/macros/properties.popup.tid +76 -0
  26. package/plugins/graph/macros/properties.river.tid +27 -0
  27. package/plugins/graph/macros/properties.settings.tid +54 -0
  28. package/plugins/graph/macros/properties.stack.tid +17 -0
  29. package/plugins/graph/macros/tiddlywiki.files +17 -0
  30. package/plugins/graph/nodes/neighbors/1.tid +8 -0
  31. package/plugins/graph/plugin.info +14 -0
  32. package/plugins/graph/presettypes/edges/fields.tid +18 -0
  33. package/plugins/graph/presettypes/edges/functions.tid +5 -0
  34. package/plugins/graph/presettypes/nodes/neighbors.tid +4 -0
  35. package/plugins/graph/presettypes/nodes/stack.tid +6 -0
  36. package/plugins/graph/propertytypes/actions.js +15 -0
  37. package/plugins/graph/propertytypes/boolean.js +23 -0
  38. package/plugins/graph/propertytypes/color.js +61 -0
  39. package/plugins/graph/propertytypes/enum.js +25 -0
  40. package/plugins/graph/propertytypes/filter.js +44 -0
  41. package/plugins/graph/propertytypes/image.js +185 -0
  42. package/plugins/graph/propertytypes/number.js +24 -0
  43. package/plugins/graph/propertytypes/string.js +13 -0
  44. package/plugins/graph/propertytypes/tiddlywiki.files +17 -0
  45. package/plugins/graph/readme.tid +5 -0
  46. package/plugins/graph/relink/attributes.js +52 -0
  47. package/plugins/graph/relink/attributes.multids +19 -0
  48. package/plugins/graph/relink/configprefix.js +76 -0
  49. package/plugins/graph/relink/fieldedgeprefix.js +39 -0
  50. package/plugins/graph/relink/fields.multids +11 -0
  51. package/plugins/graph/relink/graphprefix.js +28 -0
  52. package/plugins/graph/relink/operators.multids +3 -0
  53. package/plugins/graph/relink/propertyfields.js +81 -0
  54. package/plugins/graph/relink/utils.js +99 -0
  55. package/plugins/graph/settings.tid +13 -0
  56. package/plugins/graph/startup/messages.js +46 -0
  57. package/plugins/graph/stylesheets/base.css.tid +272 -0
  58. package/plugins/graph/stylesheets/fullscreen/core.css +11 -0
  59. package/plugins/graph/stylesheets/fullscreen/core.css.meta +3 -0
  60. package/plugins/graph/stylesheets/fullscreen.css.tid +48 -0
  61. package/plugins/graph/stylesheets/popup.css.tid +107 -0
  62. package/plugins/graph/subfilters.tid +23 -0
  63. package/plugins/graph/tags/GraphToolbar.tid +2 -0
  64. package/plugins/graph/tags/SettingsTab.tid +2 -0
  65. package/plugins/graph/tags/Template.tid +2 -0
  66. package/plugins/graph/tags/ViewEditTemplate.tid +2 -0
  67. package/plugins/graph/templates/live-graph.tid +34 -0
  68. package/plugins/graph/templates/standard-graph.tid +40 -0
  69. package/plugins/graph/ui/Buttons/center.tid +38 -0
  70. package/plugins/graph/ui/Buttons/export.tid +65 -0
  71. package/plugins/graph/ui/Buttons/fullscreen.tid +35 -0
  72. package/plugins/graph/ui/Buttons/settings.tid +28 -0
  73. package/plugins/graph/ui/Buttons/tiddlywiki.files +16 -0
  74. package/plugins/graph/ui/EditTemplate/Edges.tid +22 -0
  75. package/plugins/graph/ui/EditTemplate/Neighbors.tid +35 -0
  76. package/plugins/graph/ui/EditTemplate/Nodes.tid +12 -0
  77. package/plugins/graph/ui/EditTemplate/Popups.tid +27 -0
  78. package/plugins/graph/ui/EditTemplate/Properties.tid +21 -0
  79. package/plugins/graph/ui/EditTemplate/tiddlywiki.files +16 -0
  80. package/plugins/graph/ui/Modals/NewPropertySet.tid +20 -0
  81. package/plugins/graph/ui/Modals/NewView.tid +20 -0
  82. package/plugins/graph/ui/Modals/Select.tid +72 -0
  83. package/plugins/graph/ui/Modals/SelectField.tid +21 -0
  84. package/plugins/graph/ui/Modals/SelectTiddler.tid +15 -0
  85. package/plugins/graph/ui/Modals/Tiddler.tid +22 -0
  86. package/plugins/graph/ui/Modals/TiddlerHeader.tid +15 -0
  87. package/plugins/graph/ui/PropertyTypes/boolean.tid +11 -0
  88. package/plugins/graph/ui/PropertyTypes/color.tid +16 -0
  89. package/plugins/graph/ui/PropertyTypes/enum.tid +15 -0
  90. package/plugins/graph/ui/PropertyTypes/number.tid +17 -0
  91. package/plugins/graph/ui/Settings/Engine.tid +23 -0
  92. package/plugins/graph/ui/Settings/Graphs/EditTemplate.tid +52 -0
  93. package/plugins/graph/ui/Settings/Graphs.tid +49 -0
  94. package/plugins/graph/ui/Settings/Properties/ObjectsTypeTemplate.tid +46 -0
  95. package/plugins/graph/ui/Settings/Properties.tid +14 -0
  96. package/plugins/graph/ui/Settings/Toolbar.tid +5 -0
  97. package/plugins/graph/ui/SideBar/Graph.tid +77 -0
  98. package/plugins/graph/ui/Toolbars/GraphToolbar.tid +15 -0
  99. package/plugins/graph/ui/ViewTemplate/graph-object.tid +13 -0
  100. package/plugins/graph/ui/ViewTemplate/graph.tid +11 -0
  101. package/plugins/graph/ui/ViewTemplate/properties.tid +80 -0
  102. package/plugins/graph/ui/grouped-tabs.tid +109 -0
  103. package/plugins/graph/ui/selector.tid +74 -0
  104. package/plugins/graph/utils/propertyholder.js +80 -0
  105. package/plugins/graph/utils/widgetiterator.js +47 -0
  106. package/plugins/graph/utils.js +95 -0
  107. package/plugins/graph/widgets/action-delay.js +72 -0
  108. package/plugins/graph/widgets/action-modal.js +121 -0
  109. package/plugins/graph/widgets/action-typed.js +56 -0
  110. package/plugins/graph/widgets/action-with.js +70 -0
  111. package/plugins/graph/widgets/boundingbox.js +126 -0
  112. package/plugins/graph/widgets/fieldtranscriber/filter.js +93 -0
  113. package/plugins/graph/widgets/fieldtranscriber/json.js +34 -0
  114. package/plugins/graph/widgets/fieldtranscriber/plain.js +11 -0
  115. package/plugins/graph/widgets/fieldtranscriber.js +98 -0
  116. package/plugins/graph/widgets/graphobject.js +154 -0
  117. package/plugins/graph/widgets/messagerelay.js +115 -0
  118. package/plugins/graph/widgets/properties.js +130 -0
  119. package/plugins/graph/widgets/subclass/edge.js +55 -0
  120. package/plugins/graph/widgets/subclass/edit-color.js +52 -0
  121. package/plugins/graph/widgets/subclass/graph.js +380 -0
  122. package/plugins/graph/widgets/subclass/node.js +56 -0
  123. package/plugins/graph/widgets/tiddlywiki.files +43 -0
@@ -0,0 +1,49 @@
1
+ title: $:/plugins/flibbles/graph/ui/Settings/Graphs
2
+ tags: $:/tags/flibbles/graph/SettingsTab
3
+ caption: Graphs
4
+
5
+ \whitespace trim
6
+ \procedure graphList() :cache[all[shadows+tiddlers]insertafter{$:/config/flibbles/graph/sidebar}prefix[$:/graph/]else[$:/graph/Default]sort[]]
7
+
8
+ <$transclude $tiddler="$:/plugins/flibbles/graph/ui/grouped-tabs"
9
+ tabsList=<<graphList>>
10
+ default={{{ [subfilter<graphList>] }}}
11
+ explicitState="$:/state/flibbles/graph/settings/graphs"
12
+ >
13
+ <$fill $name=addButton>
14
+ <$button class="group-tab-new">
15
+ {{$:/core/images/new-button}}
16
+ <$action-modal $tiddler="$:/plugins/flibbles/graph/ui/Modals/NewGraph">
17
+ <$vars newTitle=`$:/graph/$(selection)$`>
18
+ <$action-createtiddler $basetitle=<<newTitle>> type="application/json" />
19
+ <$action-setfield $tiddler=<<qualifiedState>> text=<<newTitle>> />
20
+ </$vars>
21
+ </$action-modal>
22
+ <$action-sendmessage $message=tm-focus-selector $param="input.graph-select" />
23
+ </$button>
24
+ </$fill>
25
+ <$fill $name=button>
26
+ <$view tiddler=<<currentTab>> field=caption>
27
+ <$text text={{{ [<currentTab>removeprefix[$:/graph/]] }}} />
28
+ </$view>
29
+ </$fill>
30
+ <$fill $name=body>
31
+ <$let currentTiddler=<<currentTab>> >
32
+ <$transclude $tiddler="$:/plugins/flibbles/graph/ui/Settings/Graphs/EditTemplate" $mode=block />
33
+ </$let>
34
+
35
+ <$button>
36
+
37
+ <$vars graphName={{{ [<currentTab>removeprefix[$:/graph/]] }}}>
38
+ <$action-confirm $message=`Are you sure you wish to delete '$(graphName)$'`>
39
+ <%if [{$:/config/flibbles/graph/sidebar}match<currentTab>] %>
40
+ <$action-deletetiddler $tiddler="$:/config/flibbles/graph/sidebar"/>
41
+ <%endif%>
42
+ <$action-deletetiddler $tiddler=<<currentTab>>/>
43
+ </$action-confirm>
44
+ </$vars>
45
+
46
+ Delete Graph
47
+ </$button>
48
+ </$fill>
49
+ </$transclude>
@@ -0,0 +1,46 @@
1
+ title: $:/plugins/flibbles/graph/ui/Settings/Properties/ObjectsTypeTemplate
2
+
3
+ \define groupPrefix() $:/config/flibbles/graph/$(currentType)$/$(currentGroup)$/
4
+ \whitespace trim
5
+
6
+ <$let
7
+ currentType=<<currentTab>>
8
+ presetPrefix=`$:/plugins/flibbles/graph/presettypes/$(currentType)$/`
9
+ configPrefix=`$:/config/flibbles/graph/$(currentTab)$/`>
10
+
11
+
12
+ <$transclude $tiddler="$:/plugins/flibbles/graph/ui/grouped-tabs"
13
+ groupsList="[all[shadows+tiddlers]removeprefix<presetPrefix>]"
14
+ tabsList="[all[shadows+tiddlers]prefix<groupPrefix>]"
15
+ default={{{ [all[shadows+tiddlers]prefix[$:/graph/]else[$:/graph/core/Default]] }}}
16
+ state=`$:/state/flibbles/graph/settings/$(currentType)$`
17
+ orderFilter="[<currentGroup>addprefix<presetPrefix>get[orderable]match[yes]then<currentGroup>addprefix<configPrefix>]"
18
+ >
19
+ <$fill $name=addButton>
20
+ <%if [<currentGroup>addprefix<presetPrefix>get[fixed]else[no]!match[yes]] %>
21
+ <$button class="group-tab-new">
22
+ {{$:/core/images/new-button}}
23
+ <$action-modal $tiddler="$:/plugins/flibbles/graph/ui/Modals/NewPropertySet">
24
+ <$vars newTitle=`$(groupPrefix)$$(selection)$`>
25
+ <$action-createtiddler $basetitle=<<newTitle>> type="application/json" />
26
+ <$action-setfield $tiddler=<<tabsState>> text=<<newTitle>> />
27
+ </$vars>
28
+ </$action-modal>
29
+ <$action-sendmessage $message=tm-focus-selector $param="input.graph-select" />
30
+ </$button>
31
+ <%endif%>
32
+ </$fill>
33
+ <$fill $name=button>
34
+ <$view tiddler=<<currentTab>> field=caption><$text text={{{ [<currentTab>removeprefix<groupPrefix>] }}} /></$view>
35
+ </$fill>
36
+ <$fill $name=body>
37
+
38
+ <$let currentTiddler=<<currentTab>>
39
+ currentCategory={{{ [all[current]removeprefix<configPrefix>split[/]nth[]] }}} >
40
+
41
+ ! <$link><$view field=caption><$text text={{{ [all[current]removeprefix<configPrefix>removeprefix<currentCategory>removeprefix[/]] }}} /></$view></$link>
42
+
43
+ {{||$:/core/ui/ViewTemplate/body}}
44
+ </$let>
45
+ </$fill>
46
+ </$transclude>
@@ -0,0 +1,14 @@
1
+ title: $:/plugins/flibbles/graph/ui/Settings/Properties
2
+ tags: $:/tags/flibbles/graph/SettingsTab
3
+ caption: Properties
4
+
5
+ \function .tabs() :cache[all[shadows+tiddlers]removeprefix[$:/plugins/flibbles/graph/presettypes/]splitbefore[/]removesuffix[/]unique[]sort[]]
6
+
7
+ <$parameters default=<<.tabs>> >
8
+
9
+ <$transclude $variable=tabs
10
+ tabsList="[function[.tabs]]"
11
+ default=<<default>>
12
+ explicitState="$:/state/flibbles/graph/settings/properties"
13
+ template="$:/plugins/flibbles/graph/ui/Settings/Properties/ObjectsTypeTemplate"
14
+ />
@@ -0,0 +1,5 @@
1
+ title: $:/plugins/flibbles/graph/ui/Settings/Toolbar
2
+ tags: $:/tags/flibbles/graph/SettingsTab
3
+ caption: Toolbar
4
+
5
+ {{$:/plugins/flibbles/graph/ui/Toolbars/GraphToolbar}}
@@ -0,0 +1,77 @@
1
+ title: $:/plugins/flibbles/graph/ui/SideBar
2
+ caption: Graph
3
+ tags: $:/tags/SideBar
4
+
5
+ \procedure fs-state() $:/state/flibbles/graph/fullscreen
6
+
7
+ \whitespace trim
8
+
9
+ \parameters (state: "$:/config/flibbles/graph/sidebar", defaultGraph: "$:/graph/Default")
10
+
11
+ \function graph() [<state>get[text]else<defaultGraph>]
12
+
13
+ <$keyboard key="escape" actions="""<%if [<fs-state>is[tiddler]] %><$action-deletetiddler $tiddler=<<fs-state>> />""" >
14
+
15
+ <div class="graph-sidebar-disabled graph-error tc-page-controls">
16
+
17
+ <!-- Sidebar only works in fullscreen during mobile mode.
18
+ Otherwise, it's taking up too much space. -->
19
+
20
+ <$transclude $tiddler="$:/plugins/flibbles/graph/ui/Buttons/fullscreen" class=tc-btn-invisible $mode=inline />
21
+
22
+ </div>
23
+ <$boundingbox
24
+ class={{{ graph-sidebar-enabled [<fs-state>get[text]] +[join[ ]] }}}
25
+ width="[<windowWidth>subtract<boundingLeft>subtract[15]addsuffix[px]]"
26
+ height="[<windowHeight>subtract<boundingTop>subtract[15]addsuffix[px]]">
27
+
28
+ <$vars
29
+ graph-sidebar=yes
30
+ relayState=<<qualify graph-toolbar->> >
31
+
32
+ <$messagerelay to=<<relayState>> >
33
+
34
+ <div class="graph-sidebar-banner">
35
+
36
+ <$slot $name="banner">
37
+
38
+ <$select tiddler=<<state>> default=<<defaultGraph>> >
39
+
40
+ <$list filter="[<state>get[text]] [prefix[$:/graph/]else<defaultGraph>]" >
41
+
42
+ <option value=<<currentTiddler>> >
43
+
44
+ <$view field=caption>
45
+
46
+ <$text text={{{ [{!!title}removeprefix[$:/graph/]] }}} />
47
+
48
+ </$view>
49
+ </option>
50
+ </$list>
51
+ </$select>
52
+ <$vars currentTiddler=<<graph>> >
53
+
54
+ <$list filter="[[$:/tags/flibbles/graph/GraphToolbar]tagging[]!is[draft]] :filter[{!!title}addprefix[$:/config/flibbles/graph/GraphToolbarButtons/Visibility/]!text[hide]]" variable=listItem>
55
+
56
+ <$transclude tiddler=<<listItem>> mode=inline />
57
+
58
+ </$list>
59
+ </$vars>
60
+ </$slot>
61
+ </div>
62
+ </$messagerelay>
63
+ <$linkcatcher actions="""\whitespace trim
64
+ <%if [<fs-state>is[tiddler]] %>
65
+ <$action-listops $tiddler='$:/state/flibbles/graph/modal' $filter='[<navigateTo>]' />
66
+ <$action-sendmessage $message=tm-modal $param='$:/plugins/flibbles/graph/ui/Modals/Tiddler' tv-story-list='$:/state/flibbles/graph/modal' />
67
+ <%else%>
68
+ <$action-navigate $to=<<navigateTo>> />""">
69
+
70
+ <$graph.view $tiddler=<<graph>> $mode=inline >
71
+
72
+ <$messagerelay name=<<relayState>> />
73
+
74
+ </$graph.view>
75
+ </$linkcatcher>
76
+ </$vars>
77
+ </$boundingbox>
@@ -0,0 +1,15 @@
1
+ title: $:/plugins/flibbles/graph/ui/Toolbars/GraphToolbar
2
+ caption: Graph Toolbar
3
+ tags: $:/tags/ControlPanel/Toolbars
4
+
5
+ \procedure config-base() $:/config/flibbles/graph/GraphToolbarButtons/Visibility/
6
+
7
+ Choose which buttons are displayed on the sidebar graph's toolbar. Drag and drop to change the ordering
8
+
9
+ Buttons may not show up anyway if the assigned graph engine does not support them.
10
+
11
+ <$set name="tv-config-toolbar-icons" value="yes">
12
+
13
+ <$set name="tv-config-toolbar-text" value="yes">
14
+
15
+ <$macrocall $name="list-tagged-draggable" tag="$:/tags/flibbles/graph/GraphToolbar" itemTemplate="$:/core/ui/ControlPanel/Toolbars/ItemTemplate"/>
@@ -0,0 +1,13 @@
1
+ title: $:/plugins/flibbles/graph/ui/ViewTemplate/graph-object
2
+
3
+ \whitespace trim
4
+
5
+ <$let
6
+ descriptors={{{[all[current]removeprefix[$:/config/flibbles/graph/]]}}}
7
+ type={{{ [<descriptors>split[/]nth[1]] }}}
8
+ category={{{ [<descriptors>split[/]nth[2]] }}} >
9
+
10
+ <$transclude $tiddler=`$:/plugins/flibbles/graph/presettypes/$(type)$/$(category)$` />
11
+
12
+ <$transclude $tiddler="$:/plugins/flibbles/graph/ui/ViewTemplate/properties"
13
+ type={{{ [all[current]removeprefix[$:/config/flibbles/graph/]splitbefore[/]removesuffix[/]] }}} />
@@ -0,0 +1,11 @@
1
+ title: $:/plugins/flibbles/graph/ui/ViewTemplate/graph
2
+
3
+ \whitespace trim
4
+
5
+ <$let graphengine={{{ [{!!engine}!is[blank]] ~[<graphengine>] }}}>
6
+
7
+ <$transclude tiddler={{{ [{!!template}!is[blank]] ~[[$:/tags/flibbles/graph/Template]tagging[]] }}} >
8
+
9
+ <$transclude tiddler="$:/language/MissingTiddler/Hint"/>
10
+
11
+ </$transclude></$let>
@@ -0,0 +1,80 @@
1
+ title: $:/plugins/flibbles/graph/ui/ViewTemplate/properties
2
+
3
+ \procedure row(depth:0)
4
+ <$reveal tag=tr type="match" state=<<dropdownStateTitle>> text=open default=<<default>> >
5
+ <$let jsonEntry={{{ [<json>jsonextract<property>] }}}
6
+ propertyType={{{ [<jsonEntry>jsonget[type]] }}} >
7
+ <td class=graph-property-label>
8
+ <$list filter="[range<depth>]">&nbsp;&nbsp;</$list>
9
+ <$text text=<<property>> />
10
+ </td>
11
+ <td class=`graph-property-input graph-property-input-$(propertyType)$`>
12
+ <$transclude
13
+ $tiddler=`$:/plugins/flibbles/graph/ui/PropertyTypes/$(propertyType)$`
14
+ $mode=inline>
15
+ <$edit-text tag=input index=<<property>> />
16
+ </$transclude>
17
+ </td>
18
+ <td class=graph-property-remove>
19
+ <%if [all[current]getindex<property>] %>
20
+ <$button class=tc-btn-invisible tooltip="Unset this property">
21
+ <$action-setfield $index=<<property>> />
22
+ <$transclude $tiddler="$:/core/images/delete-button" $mode=inline />
23
+ </$button>
24
+ <%endif%>
25
+ </td>
26
+ </$let>
27
+ </$reveal>
28
+ <$list variable=property filter="[<json>jsonindexes[]] :filter[<json>jsonextract<currentTiddler>jsonget[parent]match<property>]">
29
+ <$transclude $variable=row depth={{{ [<depth>add[1]] }}} />
30
+ \end
31
+
32
+ \procedure arrows(state, default)
33
+ \whitespace trim
34
+ <$reveal type="nomatch" state=<<state>> text=open default=<<default>> >
35
+ <$button class=tc-btn-invisible>
36
+ <$action-setfield $tiddler=<<state>> $value=open />
37
+ {{$:/core/images/right-arrow}}
38
+ </$button>
39
+ </$reveal>
40
+ <$reveal type="match" state=<<state>> text=open default=<<default>> >
41
+ <$button class="tc-btn-invisible">
42
+ <$action-setfield $tiddler=<<state>> $value=close default=<<default>> />
43
+ {{$:/core/images/down-arrow}}
44
+ </$button>
45
+ </$reveal>
46
+ \end
47
+
48
+ \procedure section(header, filter, default)
49
+ \whitespace trim
50
+ <$qualify name=dropdownStateTitle title=`$:/state/dropdown/$(header)$`>
51
+ <tr>
52
+ <th colspan=3 align=left>
53
+ <$transclude $variable=arrows state=<<dropdownStateTitle>> default=<<default>> />
54
+ &#32;
55
+ <<header>>
56
+ </th>
57
+ </tr>
58
+ <$list variable=property filter=<<filter>> >
59
+ <<row>>
60
+ \end
61
+
62
+ \parameters (type)
63
+ \whitespace trim
64
+
65
+ <$list variable=json filter="[[graphengine]modules[]] :filter[moduleproperty[name]match<graphengine>] +[moduleproperty[properties]jsonextract<type>]" >
66
+
67
+ <table class=graph-property>
68
+
69
+ <$transclude $variable=section $mode=inline
70
+ header=Style
71
+ default=open
72
+ filter="""[<json>jsonindexes[]]
73
+ :filter[<json>jsonextract<currentTiddler>jsonget[type]!match[actions]]
74
+ :filter[<json>jsonextract<currentTiddler>jsonget[parent]count[]match[0]]
75
+ :filter[<json>jsonextract<currentTiddler>jsonget[hidden]else[false]!match[true]]""" />
76
+
77
+ <$transclude $variable=section $mode=inline
78
+ header=Actions
79
+ default=closed
80
+ filter="[<json>jsonindexes[]] :filter[<json>jsonextract<currentTiddler>jsonget[type]match[actions]]" />
@@ -0,0 +1,109 @@
1
+ title: $:/plugins/flibbles/graph/ui/grouped-tabs
2
+ code-body: yes
3
+
4
+ \procedure grouped-tabs-button()
5
+ \whitespace trim
6
+ <$button
7
+ class="group-tab-button"
8
+ set=<<tabsState>>
9
+ setTo=<<currentTab>>
10
+ dragTiddler=<<currentTab>>
11
+ default=<<default>>
12
+ selectedClass="tc-tab-selected"
13
+ tooltip={{!!tooltip}}
14
+ role="switch"
15
+ data-tab-title=<<currentTab>>
16
+ >
17
+ <%if [<orderable>match[yes]] %>
18
+ {{$:/plugins/flibbles/graph/images/drag}}
19
+ <%endif%>
20
+ <$tiddler tiddler=<<save-currentTiddler>>>
21
+ <$vars tv-wikilinks="no">
22
+ <span>
23
+ <$slot $name=button>
24
+ <$transclude tiddler=<<currentTab>> field="caption">
25
+ <$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
26
+ </$transclude>
27
+ </$slot>
28
+ </span>
29
+ </$vars>
30
+ </$tiddler>
31
+ </$button>
32
+ \end
33
+
34
+ \define grouped-tabs-tab()
35
+ \whitespace trim
36
+ <$set name="save-currentTiddler" value=<<currentTiddler>>>
37
+ <$tiddler tiddler=<<currentTab>>>
38
+ <$transclude $variable=grouped-tabs-button $fillignore=yes />
39
+ </$tiddler>
40
+ </$set>
41
+ \end
42
+
43
+ \procedure grouped-tabs-tab-body()
44
+ \whitespace trim
45
+ <$list filter=<<groupsList>> variable="currentGroup">
46
+ <$list filter=<<tabsList>> variable="currentTab">
47
+ <$reveal type="match" state=<<tabsState>> text=<<currentTab>> default=<<default>> retain=<<retain>> tag="div">
48
+ <$slot $name=body />
49
+ </$reveal>
50
+ </$list>
51
+ </$list>
52
+ \end
53
+
54
+ \function sort.by(tiddler) [<tiddler>each:list-item[list]is[tiddler]] =[all[]] +[unique[]]
55
+
56
+ \procedure grouped-tabs-drop-actions()
57
+ <$action-log
58
+ actionTiddler=<<actionTiddler>>
59
+ currentTab=<<currentTiddler>>
60
+ />
61
+ <$action-listops
62
+ $tiddler=<<orderTiddler>>
63
+ $field=list
64
+ $filter="[subfilter<tabsList>sort.by<orderTiddler>] +[insertbefore<actionTiddler>,<currentTab>]"/>
65
+ \end
66
+
67
+ \procedure grouped-tabs-tab-list()
68
+ \whitespace trim
69
+ <$list variable=currentGroup filter=<<groupsList>> >
70
+ <$let orderTiddler={{{ [<currentGroup>subfilter<orderFilter>] }}}
71
+ orderable={{{ [<orderTiddler>!is[blank]then[yes]else[no]] }}} >
72
+ <%if [<currentGroup>!is[blank]] %>
73
+ <div class="group-tab-header"><$text text={{{ [<currentGroup>titlecase[]] }}} /></div>
74
+ <%endif%>
75
+ <$list variable=currentTab filter="[subfilter<tabsList>sort.by<orderTiddler>]" >
76
+ <$droppable
77
+ actions=<<grouped-tabs-drop-actions>>
78
+ enable=<<orderable>> >
79
+ <div class="tc-droppable-placeholder"/>
80
+ <$transclude $variable=grouped-tabs-tab $fillignore=yes/>
81
+ </$droppable>
82
+ </$list>
83
+ <$tiddler tiddler="">
84
+ <$droppable
85
+ actions=<<grouped-tabs-drop-actions>>
86
+ enable=<<orderable>> >
87
+ <div class="tc-droppable-placeholder"/>
88
+ <$slot $name=addButton />
89
+ </$droppable>
90
+ </$tiddler>
91
+ </$let>
92
+ </$list>
93
+ \end
94
+
95
+ \parameters (tabsList, groupsList:"[[]]", state:"$:/state/flibbles/graph/grouped-tab", explicitState, default, class:"tc-vertical", retain, orderFilter)
96
+
97
+ <$qualify title=<<state>> name=qualifiedState>
98
+ <$let tabsState={{{ [<explicitState>minlength[1]] ~[<qualifiedState>] }}}>
99
+ <div class={{{ [[tc-tab-set]addsuffix[ ]addsuffix<class>] }}}>
100
+ <div class={{{ [[tc-tab-buttons]addsuffix[ ]addsuffix<class>] }}}>
101
+ <$transclude $variable=grouped-tabs-tab-list $fillignore=yes />
102
+ </div>
103
+ <div class={{{ [[tc-tab-divider]addsuffix[ ]addsuffix<class>] }}}/>
104
+ <div class={{{ [[tc-tab-content]addsuffix[ ]addsuffix<class>] }}}>
105
+ <$transclude $variable=grouped-tabs-tab-body $fillignore=yes />
106
+ </div>
107
+ </div>
108
+ </$let>
109
+ </$qualify>
@@ -0,0 +1,74 @@
1
+ title: $:/plugins/flibbles/graph/ui/selector
2
+ code-body: yes
3
+
4
+ \whitespace trim
5
+ \procedure select-accept-actions()
6
+ \whitespace trim
7
+ <$vars selectedTiddler={{$:/temp/graph/select/tiddler}}>
8
+ <$slot $name=action />
9
+ <$action-deletetiddler $filter="[[$:/temp/graph/select]] [[$:/temp/graph/select/tiddler]] [[$:/temp/graph/select/selected-item]] [[$:/temp/graph/select/refresh]]" />
10
+ </$vars>
11
+ \end
12
+
13
+ \procedure select-click-actions()
14
+ <$messagecatcher $completed="""<$transclude $variable=select-accept-actions $fillignore=yes />""" >
15
+ <$action-setfield $tiddler="$:/temp/graph/select/tiddler" text=<<navigateTo>> />
16
+ <$action-sendmessage $message=completed />
17
+ \end
18
+
19
+ \procedure select-close-actions()
20
+ \whitespace trim
21
+ <$slot $name=cancel />
22
+ <$action-deletetiddler $filter="[[$:/temp/graph/select]] [[$:/temp/graph/select/tiddler]] [[$:/temp/graph/select/selected-item]] [[$:/temp/graph/select/refresh]]" />
23
+ \end
24
+
25
+ \procedure select-cancel-actions()
26
+ \whitespace trim
27
+ <% if [{$:/temp/graph/select}match[]] %>
28
+ <$transclude $variable=select-close-actions $fillignore=yes />
29
+ <% elseif [{$:/temp/graph/select}!match{$:/temp/graph/select/tiddler}] %>
30
+ <$action-setfield $tiddler="$:/temp/graph/select/tiddler" text={{$:/temp/graph/select}}/>
31
+ <$action-deletetiddler $filter="$:/temp/graph/select/selected-item" />
32
+ <$action-setfield $tiddler="$:/temp/graph/select/refresh" text="yes"/>
33
+ <% else %>
34
+ <$action-deletetiddler $filter="[[$:/temp/graph/select]] [[$:/temp/graph/select/tiddler]] [[$:/temp/graph/select/selected-item]] [[$:/temp/graph/select/refresh]]" />
35
+ <% endif %>
36
+ \end
37
+
38
+ \parameters (configTiddler)
39
+
40
+ <$transclude
41
+ $variable=keyboard-driven-input
42
+ $fillignore=yes
43
+ $mode=inline
44
+ storeTitle="$:/temp/graph/select"
45
+ tiddler="$:/temp/graph/select/tiddler"
46
+ refreshTitle="$:/temp/graph/select/refresh"
47
+ selectionStateTitle="$:/temp/graph/select/selected-item"
48
+ configTiddlerFilter="[<configTiddler>]"
49
+ tag=input
50
+ placeholder="Type something"
51
+ class="tc-edit-texteditor graph-select"
52
+ focus=yes
53
+ inputCancelActions="<$transclude $variable=select-cancel-actions $fillignore=yes />"
54
+ inputAcceptActions="<$transclude $variable=select-accept-actions $fillignore=yes />"
55
+ />
56
+
57
+ <p>
58
+
59
+ <$linkcatcher actions=<<select-click-actions>> >
60
+
61
+ <$list filter={{{ [<configTiddler>get[first-search-filter]] }}} >
62
+
63
+ <$list-empty>
64
+
65
+ <$text text="New result" />
66
+
67
+ </$list-empty>
68
+ <$list-template>
69
+
70
+ <span class={{{[{$:/temp/graph/select/tiddler}match<currentTiddler>then[tc-list-item-selected]] }}}>
71
+
72
+ <$slot $name=list-item>
73
+
74
+ <$transclude tiddler="$:/core/ui/ListItemTemplate" mode=inline/>
@@ -0,0 +1,80 @@
1
+ /*\
2
+ title: $:/plugins/flibbles/graph/utils/propertyholder.js
3
+ type: application/javascript
4
+ module-type: graphutils
5
+
6
+ Class which holds properties, and evaluates their compiled value based on
7
+ a supplied set of definitions.
8
+
9
+ \*/
10
+
11
+ var Holder = exports.PropertyHolder = {};
12
+
13
+ var PropertyTypes = $tw.modules.getModulesByTypeAsHashmap("graphpropertytype");
14
+
15
+ /*
16
+ Takes an object of properties and converts them into values ready to be passed
17
+ to the engine, using the catalog and this as the context to define them.
18
+ */
19
+ Holder.evaluateProperties = function(properties, definitions) {
20
+ var output = Object.create(null);
21
+ // We set the definition and properties to the holder,
22
+ // because some properties may need to evaluate others
23
+ // and the holder will need to remember its rules and properties
24
+ // to do that nested evaluation without passing it around
25
+ this.definitions = definitions;
26
+ this.properties = properties;
27
+ for (var key in this.properties) {
28
+ var value = this.evaluateProperty(key);
29
+ if (value !== null) {
30
+ output[key] = value;
31
+ }
32
+ }
33
+ return output;
34
+ };
35
+
36
+ Holder.evaluateProperty = function(propertyName) {
37
+ var rule = this.definitions[propertyName],
38
+ value = this.properties[propertyName];
39
+ if (rule) {
40
+ if (value === undefined) {
41
+ value = rule.default;
42
+ }
43
+ if (rule && PropertyTypes[rule.type]) {
44
+ value = PropertyTypes[rule.type].toProperty(rule, value, {wiki: this.wiki, widget: this});
45
+ } else {
46
+ value = value || null;
47
+ }
48
+ }
49
+ return value;
50
+ };
51
+
52
+ /*
53
+ Checks if any property in the holder needs to check for refresh, and returns
54
+ true if any do need to refresh.
55
+ */
56
+ Holder.refreshProperties = function(changedTiddlers) {
57
+ for (var name in this.properties) {
58
+ if (this.refreshProperty(name, changedTiddlers)) {
59
+ return true;
60
+ }
61
+ }
62
+ return false;
63
+ };
64
+
65
+ Holder.refreshProperty = function(propertyName, changedTiddlers) {
66
+ var rule = this.definitions[propertyName];
67
+ if (rule) {
68
+ var type = PropertyTypes[rule.type],
69
+ raw = this.properties[propertyName];
70
+ if (raw === undefined) {
71
+ raw = rule.default;
72
+ }
73
+ if (type
74
+ && type.refresh
75
+ && type.refresh(rule, raw, changedTiddlers, this)) {
76
+ return true;
77
+ }
78
+ }
79
+ return false;
80
+ };
@@ -0,0 +1,47 @@
1
+ /*\
2
+ title: $:/plugins/flibbles/graph/utils/widgetiterator.js
3
+ type: application/javascript
4
+ module-type: graphutils
5
+
6
+ Can be used to iterate through a tree of widgets, given a root.
7
+
8
+ It goes depth-first, starting the the first leaf widget, and finishes with
9
+ the root widget.
10
+
11
+ \*/
12
+
13
+ exports.WidgetIterator = function(root) {
14
+ this.stack = [];
15
+ this.ptr = root;
16
+ while (this.ptr.children && this.ptr.children.length > 0) {
17
+ this.stack.push(0);
18
+ this.ptr = this.ptr.children[0];
19
+ }
20
+ };
21
+
22
+ exports.WidgetIterator.prototype.next = function() {
23
+ var rtn, ptr = this.ptr;
24
+ if (!ptr) {
25
+ rtn = {done: true};
26
+ } else {
27
+ rtn = {value: ptr, done: false};
28
+ ptr = ptr.parentWidget;
29
+ var index = this.stack.pop();
30
+ if (index !== undefined) {
31
+ index++;
32
+ if (ptr && ptr.children.length > index) {
33
+ ptr = ptr.children[index];
34
+ this.stack.push(index);
35
+ // Now dive to the lowest child
36
+ while (ptr.children && ptr.children.length > 0) {
37
+ this.stack.push(0);
38
+ ptr = ptr.children[0];
39
+ }
40
+ }
41
+ } else {
42
+ ptr = null;
43
+ }
44
+ }
45
+ this.ptr = ptr;
46
+ return rtn;
47
+ };