@motifx-community/ui 0.1.0-beta.16 → 0.1.0-beta.18

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 (234) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/components/datagrid/DataGrid.d.ts +2 -1
  3. package/dist/components/datagrid/grid-column.d.ts +6 -0
  4. package/dist/components/datagrid/model/ColumnModel.d.ts +2 -0
  5. package/dist/components/datagrid/model/GridModel.d.ts +4 -0
  6. package/dist/components/datagrid/view/ColumnStyles.d.ts +7 -3
  7. package/dist/components/datagrid/view/GridBody.d.ts +56 -4
  8. package/dist/components/diagram/Diagram.d.ts +92 -0
  9. package/dist/components/diagram/DiagramEdgeView.d.ts +14 -4
  10. package/dist/components/diagram/DiagramLinks.d.ts +2 -0
  11. package/dist/components/diagram/DiagramNodeView.d.ts +19 -1
  12. package/dist/components/diagram/diagram-change.d.ts +3 -2
  13. package/dist/components/diagram/diagram-edge-click-event-args.d.ts +21 -0
  14. package/dist/components/diagram/diagram-edge-pointer-event-args.d.ts +6 -0
  15. package/dist/components/diagram/diagram-edge.d.ts +8 -0
  16. package/dist/components/diagram/diagram-links-host.d.ts +3 -0
  17. package/dist/components/diagram/diagram-node-click-event-args.d.ts +23 -0
  18. package/dist/components/diagram/diagram-node-context.d.ts +5 -0
  19. package/dist/components/diagram/diagram-node-host.d.ts +4 -0
  20. package/dist/components/diagram/diagram-node-pointer-event-args.d.ts +6 -0
  21. package/dist/components/diagram/diagram-props.d.ts +45 -0
  22. package/dist/components/diagram/diagram-text-changed-event-args.d.ts +7 -0
  23. package/dist/components/diagram/diagram-text-changing-event-args.d.ts +14 -0
  24. package/dist/components/diagram/diagram-text-editing-event-args.d.ts +11 -0
  25. package/dist/components/diagram/index.d.ts +7 -0
  26. package/dist/core/ui-strings.d.ts +5 -0
  27. package/dist/excel/index.js +1 -1
  28. package/dist/excel/index.js.map +1 -1
  29. package/dist/index.js +1644 -759
  30. package/dist/index.js.map +1 -1
  31. package/dist/locales/en.json +3 -0
  32. package/dist/locales/tr.json +3 -0
  33. package/dist/parts/table/RowHeights.d.ts +23 -0
  34. package/dist/parts/table/ScrollGeometry.d.ts +6 -1
  35. package/dist/parts/table/table-sheet-column.d.ts +2 -0
  36. package/dist/pdf/index.js +1 -1
  37. package/dist/pdf/index.js.map +1 -1
  38. package/dist/pdf/pdf-export-options.d.ts +4 -1
  39. package/dist/styles.css +58 -0
  40. package/dist/{tr-4GNbFdQh.js → tr-CMuuXBUb.js} +8 -2
  41. package/dist/{tr-4GNbFdQh.js.map → tr-CMuuXBUb.js.map} +1 -1
  42. package/docs/accordion.md +1 -1
  43. package/docs/actionsheet.md +1 -1
  44. package/docs/appbar.md +1 -1
  45. package/docs/appmenu-api.md +1 -1
  46. package/docs/appmenu-programmatic.md +1 -1
  47. package/docs/appmenu-search.md +1 -1
  48. package/docs/appmenu.md +1 -1
  49. package/docs/avatar.md +1 -1
  50. package/docs/badge.md +1 -1
  51. package/docs/bar-gauge-angles.md +1 -1
  52. package/docs/bar-gauge-data.md +1 -1
  53. package/docs/bar-gauge-labels.md +1 -1
  54. package/docs/bar-gauge.md +1 -1
  55. package/docs/barcode.md +1 -1
  56. package/docs/bottomnavigation.md +1 -1
  57. package/docs/bottomsheet.md +1 -1
  58. package/docs/breadcrumb.md +1 -1
  59. package/docs/button.md +1 -1
  60. package/docs/buttongroup.md +1 -1
  61. package/docs/buttons.md +1 -1
  62. package/docs/calendar.md +1 -1
  63. package/docs/card.md +1 -1
  64. package/docs/chart-bars.md +1 -1
  65. package/docs/chart-candles.md +1 -1
  66. package/docs/chart-funnel.md +1 -1
  67. package/docs/chart-heatmap.md +1 -1
  68. package/docs/chart-lines.md +1 -1
  69. package/docs/chart-live.md +1 -1
  70. package/docs/chart-pie.md +1 -1
  71. package/docs/chart-radar.md +1 -1
  72. package/docs/chart-ranges.md +1 -1
  73. package/docs/chart-references.md +1 -1
  74. package/docs/chart-scatter.md +1 -1
  75. package/docs/chart-waterfall.md +1 -1
  76. package/docs/chart-zoom.md +1 -1
  77. package/docs/chart.md +1 -1
  78. package/docs/chat.md +1 -1
  79. package/docs/checkbox.md +1 -1
  80. package/docs/chip.md +1 -1
  81. package/docs/choice.md +1 -1
  82. package/docs/colorbox.md +1 -1
  83. package/docs/combobox.md +1 -1
  84. package/docs/commands.md +1 -1
  85. package/docs/control.md +1 -1
  86. package/docs/data.md +1 -1
  87. package/docs/datagrid-api.md +3 -2
  88. package/docs/datagrid-bands.md +1 -1
  89. package/docs/datagrid-drag-select.md +1 -1
  90. package/docs/datagrid-drag.md +1 -1
  91. package/docs/datagrid-editing.md +1 -1
  92. package/docs/datagrid-filtering.md +1 -1
  93. package/docs/datagrid-forms.md +1 -1
  94. package/docs/datagrid-grouping.md +1 -1
  95. package/docs/datagrid-layout.md +1 -1
  96. package/docs/datagrid-lookups.md +1 -1
  97. package/docs/datagrid-master-detail.md +1 -1
  98. package/docs/datagrid-scrolling.md +77 -1
  99. package/docs/datagrid-selection.md +1 -1
  100. package/docs/datagrid.md +1 -1
  101. package/docs/datebox.md +1 -1
  102. package/docs/daterangebox.md +1 -1
  103. package/docs/diagram-api.md +19 -4
  104. package/docs/diagram-commands.md +2 -1
  105. package/docs/diagram-connections.md +8 -6
  106. package/docs/diagram-custom-nodes.md +1 -1
  107. package/docs/diagram-designer.md +1 -1
  108. package/docs/diagram-editing.md +132 -5
  109. package/docs/diagram-flow.md +21 -4
  110. package/docs/diagram-keyboard.md +5 -1
  111. package/docs/diagram-layout.md +1 -1
  112. package/docs/diagram-nodes.md +1 -1
  113. package/docs/diagram-tables.md +1 -1
  114. package/docs/diagram.md +11 -8
  115. package/docs/display.md +1 -1
  116. package/docs/draggable.md +1 -1
  117. package/docs/drawer.md +1 -1
  118. package/docs/dropdown.md +1 -1
  119. package/docs/editors.md +1 -1
  120. package/docs/expressioneditor.md +1 -1
  121. package/docs/expressions.md +1 -1
  122. package/docs/feedback.md +1 -1
  123. package/docs/fileuploader.md +1 -1
  124. package/docs/filterbuilder.md +1 -1
  125. package/docs/formlayout-schema.md +1 -1
  126. package/docs/formlayout.md +1 -1
  127. package/docs/foundations.md +1 -1
  128. package/docs/gallery.md +1 -1
  129. package/docs/gauge-base.md +1 -1
  130. package/docs/gauge-circular.md +1 -1
  131. package/docs/gauge-dashboards.md +1 -1
  132. package/docs/gauge-linear.md +1 -1
  133. package/docs/gauge-markers.md +1 -1
  134. package/docs/gauge-marks.md +1 -1
  135. package/docs/gauge-ranges.md +1 -1
  136. package/docs/gauge-scales.md +1 -1
  137. package/docs/gauge.md +1 -1
  138. package/docs/home.md +1 -1
  139. package/docs/keyboard.md +1 -1
  140. package/docs/language.md +1 -1
  141. package/docs/layout.md +1 -1
  142. package/docs/listbox.md +1 -1
  143. package/docs/loadpanel.md +1 -1
  144. package/docs/lookup.md +1 -1
  145. package/docs/markdown.md +1 -1
  146. package/docs/menus-api.md +1 -1
  147. package/docs/menus-context.md +1 -1
  148. package/docs/menus-customization.md +1 -1
  149. package/docs/menus-merging.md +1 -1
  150. package/docs/menus-programmatic.md +1 -1
  151. package/docs/menus.md +1 -1
  152. package/docs/multiview.md +1 -1
  153. package/docs/navigation.md +1 -1
  154. package/docs/numberbox.md +1 -1
  155. package/docs/otpinput.md +1 -1
  156. package/docs/pagination.md +1 -1
  157. package/docs/pivotgrid-api.md +1 -1
  158. package/docs/pivotgrid-chart.md +1 -1
  159. package/docs/pivotgrid-drilldown.md +1 -1
  160. package/docs/pivotgrid-export.md +1 -1
  161. package/docs/pivotgrid-fields.md +1 -1
  162. package/docs/pivotgrid-keyboard.md +1 -1
  163. package/docs/pivotgrid-layout.md +1 -1
  164. package/docs/pivotgrid-panel.md +1 -1
  165. package/docs/pivotgrid-remote.md +1 -1
  166. package/docs/pivotgrid-sorting.md +1 -1
  167. package/docs/pivotgrid-state.md +1 -1
  168. package/docs/pivotgrid-summaries.md +1 -1
  169. package/docs/pivotgrid.md +1 -1
  170. package/docs/popover.md +1 -1
  171. package/docs/progress.md +1 -1
  172. package/docs/qrcode.md +1 -1
  173. package/docs/radiogroup.md +1 -1
  174. package/docs/rating.md +1 -1
  175. package/docs/resizable.md +1 -1
  176. package/docs/ribbonmenu-api.md +1 -1
  177. package/docs/ribbonmenu-commands.md +1 -1
  178. package/docs/ribbonmenu-customization.md +1 -1
  179. package/docs/ribbonmenu-display.md +1 -1
  180. package/docs/ribbonmenu-layouts.md +1 -1
  181. package/docs/ribbonmenu-programmatic.md +1 -1
  182. package/docs/ribbonmenu.md +1 -1
  183. package/docs/scheduler-agenda.md +1 -1
  184. package/docs/scheduler-big-data.md +1 -1
  185. package/docs/scheduler-editing.md +1 -1
  186. package/docs/scheduler-form.md +1 -1
  187. package/docs/scheduler-icalendar.md +1 -1
  188. package/docs/scheduler-mobile.md +1 -1
  189. package/docs/scheduler-recurrence.md +1 -1
  190. package/docs/scheduler-resources.md +1 -1
  191. package/docs/scheduler-timeline.md +1 -1
  192. package/docs/scheduler.md +1 -1
  193. package/docs/scrollview.md +1 -1
  194. package/docs/shortcuteditor.md +1 -1
  195. package/docs/showcase-flowstudio.md +1 -1
  196. package/docs/showcase-home.md +1 -1
  197. package/docs/showcase-mail.md +1 -1
  198. package/docs/showcase.md +1 -1
  199. package/docs/signature.md +1 -1
  200. package/docs/skeleton.md +1 -1
  201. package/docs/slider.md +1 -1
  202. package/docs/sortable.md +1 -1
  203. package/docs/sparkline.md +1 -1
  204. package/docs/speeddial.md +1 -1
  205. package/docs/splitter.md +1 -1
  206. package/docs/stepper.md +1 -1
  207. package/docs/switch.md +1 -1
  208. package/docs/tabdocs-dock.md +1 -1
  209. package/docs/tabdocs-drag.md +1 -1
  210. package/docs/tabdocs-menus.md +1 -1
  211. package/docs/tabdocs-mobile.md +1 -1
  212. package/docs/tabdocs-tabs.md +1 -1
  213. package/docs/tabdocs-windows.md +1 -1
  214. package/docs/tabdocs-workspace.md +1 -1
  215. package/docs/tabdocs.md +1 -1
  216. package/docs/tabs.md +1 -1
  217. package/docs/tagbox.md +1 -1
  218. package/docs/textarea.md +1 -1
  219. package/docs/textbox.md +1 -1
  220. package/docs/tileview.md +1 -1
  221. package/docs/timeline.md +1 -1
  222. package/docs/toast.md +1 -1
  223. package/docs/tokens.md +1 -1
  224. package/docs/toolbar-api.md +1 -1
  225. package/docs/toolbar-customization.md +1 -1
  226. package/docs/toolbar.md +1 -1
  227. package/docs/tooltip.md +1 -1
  228. package/docs/treeview.md +1 -1
  229. package/docs/validationsummary.md +1 -1
  230. package/docs/window.md +1 -1
  231. package/docs/wizard.md +1 -1
  232. package/llms-full.txt +460 -214
  233. package/llms.txt +1 -1
  234. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  # Diagram: Build your own flow designer
2
2
 
3
- > Diagram · @motifx-community/ui 0.1.0-beta.16
3
+ > Diagram · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  A small flow designer, from a kind of step to a run of the flow: its card, the form of its settings, the data it reads from the steps before it, the checks, the definition a server reads, and the run. The designer is on this page with its code, and each section below takes one piece of it.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Diagram: Moving and selecting
2
2
 
3
- > Diagram · @motifx-community/ui 0.1.0-beta.16
3
+ > Diagram · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  The user moves, selects and deletes nodes and connections with the pointer and the keys, and the diagram writes every change to the app’s objects.
6
6
 
@@ -12,14 +12,15 @@ Drag a node to move it with the other selected nodes; its `x` and `y` are writte
12
12
  import { reactive } from '@motifx/core';
13
13
  import { Button, Diagram, Stack, Switch, type DiagramEdge, type DiagramNode } from '@motifx-community/ui';
14
14
 
15
- const NODES: DiagramNode[] = [
15
+ /** The nodes and connections each time the example is shown: the diagram changes the arrays it is given. */
16
+ const nodes = (): DiagramNode[] => [
16
17
  { id: 'start', x: 0, y: 100, text: 'Start' },
17
18
  { id: 'review', x: 220, y: 20, text: 'Review the request' },
18
19
  { id: 'approve', x: 220, y: 180, text: 'Approve' },
19
20
  { id: 'archive', x: 480, y: 100, text: 'Archive (fixed in place)', draggable: false },
20
21
  ];
21
22
 
22
- const EDGES: DiagramEdge[] = [
23
+ const edges = (): DiagramEdge[] => [
23
24
  { id: 'e1', source: 'start', target: 'review' },
24
25
  { id: 'e2', source: 'review', target: 'approve' },
25
26
  { id: 'e3', source: 'approve', target: 'archive' },
@@ -44,8 +45,8 @@ export default function Editing() {
44
45
  ref={(d: Diagram) => (diagram = d)}
45
46
  label="Approval flow"
46
47
  autoFit
47
- nodes={NODES}
48
- edges={EDGES}
48
+ nodes={nodes()}
49
+ edges={edges()}
49
50
  edgePath="rounded-step"
50
51
  snapToGrid={() => s.snap}
51
52
  onSelectionChanged={(e) => (s.told = e.nodes.length || e.edges.length ? `Selected: ${[...e.nodes.map((n) => n.text), ...e.edges.map((edge) => edge.id)].join(', ')}.` : 'Nothing selected.')}
@@ -57,6 +58,132 @@ export default function Editing() {
57
58
  }
58
59
  ```
59
60
 
61
+ ## Clicks, menus and hovering
62
+
63
+ A press selects a node, and `onNodeClick` tells the click, with where it was on the page (`at`); `onEdgeClick` comes before the connection is selected, and `cancel` leaves the selection as it is. A right click on a node or a connection, or the Menu key or Shift+F10 on the one under the keys, asks for the app’s menu: open a `ContextMenu` at `e.at`, and the browser’s own menu stays closed, unless `cancel`. A double click, or Alt+Enter, is `onNodeDblClick` or `onEdgeDblClick`, and `onNodePointerEnter` and `onNodePointerLeave` follow the pointer. Here the menu renames a node (`editText`) or deletes it, a double click marks a node or a connection done, and the line under the diagram names the node under the pointer.
64
+
65
+ ```tsx
66
+ import { reactive } from '@motifx/core';
67
+ import { ContextMenu, Diagram, Stack, type DiagramEdge, type DiagramNode, type MenuItem } from '@motifx-community/ui';
68
+
69
+ /** The nodes and connections each time the example is shown: the diagram changes the arrays it is given. */
70
+ const nodes = (): DiagramNode[] => [
71
+ { id: 'draft', x: 0, y: 80, text: 'Draft' },
72
+ { id: 'review', x: 240, y: 0, text: 'Review' },
73
+ { id: 'check', x: 240, y: 160, text: 'Check the sources' },
74
+ { id: 'publish', x: 480, y: 80, text: 'Publish' },
75
+ ];
76
+
77
+ const edges = (): DiagramEdge[] => [
78
+ { id: 'e1', source: 'draft', target: 'review' },
79
+ { id: 'e2', source: 'draft', target: 'check' },
80
+ { id: 'e3', source: 'review', target: 'publish' },
81
+ { id: 'e4', source: 'check', target: 'publish' },
82
+ ];
83
+
84
+ /**
85
+ * A right click on a node, or the Menu key on the node under the keys, opens the app's menu at `e.at`: Rename opens the
86
+ * text editor (`editText`), Delete takes the node away. A double click marks a node or a connection done, and the line
87
+ * under the diagram names the node under the pointer.
88
+ */
89
+ export default function ItemEvents() {
90
+ const s = reactive({ over: '', did: 'Right-click a node for its menu.' });
91
+ let diagram!: Diagram;
92
+ let menu!: ContextMenu;
93
+ let target: DiagramNode | null = null;
94
+
95
+ const items: MenuItem[] = [
96
+ { text: '&Rename', click: () => target && diagram.editText(target.id) },
97
+ {
98
+ text: '&Delete',
99
+ beginGroup: true,
100
+ click: () => {
101
+ if (!target) return;
102
+ diagram.select({ nodes: [target.id] });
103
+ if (diagram.deleteSelection()) s.did = `Deleted ${target.text}.`;
104
+ },
105
+ },
106
+ ];
107
+
108
+ return (
109
+ <Stack gap="md" class="docs-wide">
110
+ <Diagram
111
+ ref={(d: Diagram) => (diagram = d)}
112
+ label="Publishing steps"
113
+ autoFit
114
+ nodes={nodes()}
115
+ edges={edges()}
116
+ edgePath="rounded-step"
117
+ onNodeContextMenu={(e) => {
118
+ target = e.node;
119
+ menu.open(e.at, diagram);
120
+ }}
121
+ onNodeDblClick={(e) => {
122
+ const done = e.node.status !== 'done';
123
+ diagram.setNodeStatus(e.node.id, done ? 'done' : null);
124
+ s.did = done ? `Marked ${e.node.text} done.` : `Cleared the mark of ${e.node.text}.`;
125
+ }}
126
+ onEdgeDblClick={(e) => {
127
+ const done = e.edge.status !== 'done';
128
+ diagram.setEdgeStatus(e.edge.id, done ? 'done' : null);
129
+ s.did = done ? `Marked the connection ${e.edge.id} done.` : `Cleared the mark of ${e.edge.id}.`;
130
+ }}
131
+ onNodePointerEnter={(e) => (s.over = e.node.text ?? e.node.id)}
132
+ onNodePointerLeave={() => (s.over = '')}
133
+ />
134
+ <ContextMenu ref={(m: ContextMenu) => (menu = m)} target={null} label="Node" items={items} />
135
+ <output>{() => (s.over ? `Over ${s.over}. ` : '') + s.did}</output>
136
+ </Stack>
137
+ );
138
+ }
139
+ ```
140
+
141
+ ## Editing text in place
142
+
143
+ With `textEditable`, a double click on a node’s text, F2 or Alt+Enter on the node under the keys opens an editor over it: Enter or leaving it writes the text as a step of the history, and Escape keeps the old one. `editText(id)` opens it in code, and in a kind of one’s own `context.textPart(part)` names the part the editor covers. `onTextEditing` comes before the editor opens, `onTextChanging` when an edit ends with a new text, and `onTextChanged` after it was written. Here `onTextChanging` trims the text and refuses an empty one, and the line under the diagram tells the last change.
144
+
145
+ ```tsx
146
+ import { reactive } from '@motifx/core';
147
+ import { Diagram, Stack, type DiagramEdge, type DiagramNode } from '@motifx-community/ui';
148
+
149
+ /** The nodes and connections each time the example is shown: the diagram changes the arrays it is given. */
150
+ const nodes = (): DiagramNode[] => [
151
+ { id: 'plan', x: 0, y: 80, text: 'Plan' },
152
+ { id: 'write', x: 220, y: 0, text: 'Write' },
153
+ { id: 'send', x: 220, y: 160, text: 'Send' },
154
+ ];
155
+
156
+ const edges = (): DiagramEdge[] => [
157
+ { id: 'e1', source: 'plan', target: 'write' },
158
+ { id: 'e2', source: 'plan', target: 'send' },
159
+ ];
160
+
161
+ /**
162
+ * Double-click a node's text, or press F2 on the node under the keys, to edit it in place; Enter or leaving the editor
163
+ * writes the text, Escape keeps the old one. `onTextChanging` trims the text and refuses an empty one.
164
+ */
165
+ export default function EditText() {
166
+ const s = reactive({ last: 'No text changed yet.' });
167
+ return (
168
+ <Stack gap="md" class="docs-wide">
169
+ <Diagram
170
+ label="Steps"
171
+ autoFit
172
+ nodes={nodes()}
173
+ edges={edges()}
174
+ textEditable
175
+ onTextChanging={(e) => {
176
+ e.text = e.text.trim();
177
+ if (!e.text) e.cancel = true;
178
+ }}
179
+ onTextChanged={(e) => (s.last = `${e.previous} is now ${e.text}.`)}
180
+ />
181
+ <output>{() => s.last}</output>
182
+ </Stack>
183
+ );
184
+ }
185
+ ```
186
+
60
187
  ## Feedback
61
188
 
62
189
  Loading issues…
@@ -1,6 +1,6 @@
1
1
  # Diagram: Flow nodes
2
2
 
3
- > Diagram · @motifx-community/ui 0.1.0-beta.16
3
+ > Diagram · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  The pieces of a flow designer: the card, a kind of node to start one’s own from, ports with labels, the status a run shows on each node, and the connections of a node and the nodes at their other ends, for an app that walks the flow.
6
6
 
@@ -8,6 +8,8 @@ The pieces of a flow designer: the card, a kind of node to start one’s own fro
8
8
 
9
9
  The steps are cards. Run walks the flow: each step is `running`, then `done`, and the next steps are the nodes its connections go to (`nodesOf`); a decision goes out by the port of its answer, and the way it does not take is `skipped`.
10
10
 
11
+ The connection the run takes shows a status of its own: `setEdgeStatus`, the twin of `setNodeStatus`, paints its line and its marks in the status’s color, unless the connection has a `color` of its own, moves the line while it is `running`, dashes it while `waiting` and fades it when `skipped`. `statusText` stands in the line’s tip, such as how many rows went along, and a screen reader hears the status with the connection’s two nodes.
12
+
11
13
  ```tsx
12
14
  import { reactive } from '@motifx/core';
13
15
  import { Button, Diagram, Stack, cardKind, type DiagramCardNode, type DiagramEdge, type DiagramNodeKind } from '@motifx-community/ui';
@@ -15,7 +17,7 @@ import { Button, Diagram, Stack, cardKind, type DiagramCardNode, type DiagramEdg
15
17
  /** A glyph of the kit, drawn by the design language in use. */
16
18
  const glyph = (name: string) => <span class="mx-glyph" data-icon={name} aria-hidden="true" />;
17
19
 
18
- /** A run through a flow of cards: each step shows its status, and the next steps are the nodes its connections go to. */
20
+ /** A run through a flow of cards: each step and the connection the run takes show their statuses, and the next steps are the nodes its connections go to. */
19
21
  export default function FlowRun() {
20
22
  const s = reactive({ said: 'Run the flow to see each step take its status.', running: false, answer: 'yes' as 'yes' | 'no' });
21
23
 
@@ -56,6 +58,7 @@ export default function FlowRun() {
56
58
  const run = async () => {
57
59
  s.running = true;
58
60
  for (const node of nodes) diagram.setNodeStatus(node.id, 'waiting');
61
+ for (const edge of edges) diagram.setEdgeStatus(edge.id, 'waiting');
59
62
  let at: DiagramCardNode | undefined = nodes[0];
60
63
  while (at) {
61
64
  diagram.setNodeStatus(at.id, 'running');
@@ -64,8 +67,20 @@ export default function FlowRun() {
64
67
  diagram.setNodeStatus(at.id, 'done', at.id === 'query' ? '3 rows' : undefined);
65
68
  // A decision goes out by the port of its answer, and the ways it does not take are skipped.
66
69
  const decision = at.kind === 'decision';
67
- const next = diagram.nodesOf(at.id, { direction: 'out', port: decision ? s.answer : undefined });
68
- if (decision) for (const other of diagram.nodesOf(at.id, { direction: 'out' })) if (!next.includes(other)) diagram.setNodeStatus(other.id, 'skipped');
70
+ const port = decision ? s.answer : undefined;
71
+ const next = diagram.nodesOf(at.id, { direction: 'out', port });
72
+ if (decision) {
73
+ for (const other of diagram.nodesOf(at.id, { direction: 'out' })) if (!next.includes(other)) diagram.setNodeStatus(other.id, 'skipped');
74
+ for (const edge of diagram.edgesOf(at.id, { direction: 'out' })) if (edge.sourcePort !== port) diagram.setEdgeStatus(edge.id, 'skipped');
75
+ }
76
+ // The connection the run takes moves while it carries the step's result, then it is done too.
77
+ const taken = next.length ? diagram.edgesOf(at.id, { direction: 'out', port }).find((edge) => edge.target === next[0].id) : undefined;
78
+ if (taken) {
79
+ const carried = at.id === 'query' ? '3 rows' : undefined;
80
+ diagram.setEdgeStatus(taken.id, 'running', carried);
81
+ await wait(400);
82
+ diagram.setEdgeStatus(taken.id, 'done', carried);
83
+ }
69
84
  at = next[0];
70
85
  }
71
86
  s.said = 'The run reached the end.';
@@ -83,6 +98,7 @@ export default function FlowRun() {
83
98
  disabled={() => s.running}
84
99
  onclick={() => {
85
100
  for (const node of nodes) diagram.setNodeStatus(node.id, null);
101
+ for (const edge of edges) diagram.setEdgeStatus(edge.id, null);
86
102
  s.said = 'Run the flow to see each step take its status.';
87
103
  }}
88
104
  />
@@ -148,6 +164,7 @@ const next = diagram.nodesOf('check', { direction: 'out', port: 'yes' });
148
164
  | Member | Returns | Description |
149
165
  | --- | --- | --- |
150
166
  | `setNodeStatus(id, status, text?)` | `boolean` | Shows what a node is doing; `null` takes the status away. A screen reader hears it with the node’s name. Not a step of the history. Returns whether it changed. |
167
+ | `setEdgeStatus(id, status, text?)` | `boolean` | Shows what a connection is doing; `null` takes the status away. A screen reader hears it with the connection’s two nodes. Not a step of the history. Returns whether it changed. |
151
168
  | `edgesOf(id, options?)` | `DiagramEdge[]` | The connections of a node: `direction` `'in'`, `'out'` or `'both'`, and `port`, a port of the node. Followed in a getter. |
152
169
  | `nodesOf(id, options?)` | `DiagramNode[]` | The nodes at the other ends of those connections, each once. Followed in a getter. |
153
170
  | `cardKind(options?)` | `DiagramNodeKind` | A kind of node made from the card: a header with an icon, a title and a line under it, a body of its own, and a row for each labeled port. |
@@ -1,6 +1,6 @@
1
1
  # Diagram: Keyboard and accessibility
2
2
 
3
- > Diagram · @motifx-community/ui 0.1.0-beta.16
3
+ > Diagram · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Everything can be done with the keys, and a screen reader hears the diagram, its nodes and what the user does.
6
6
 
@@ -14,6 +14,10 @@ Everything can be done with the keys, and a screen reader hears the diagram, its
14
14
  | `Arrow keys` | Move from node to node once a node is selected, to the nearest node within 45 degrees of the direction of the key, and pan the view otherwise. With Shift, the view pans four times further. |
15
15
  | `Ctrl + arrow keys` | Move the selected nodes by one step of the grid, or the point under the keys; a run of a right-angled connection moves sideways. With Shift, by one unit. |
16
16
  | `Alt + arrow keys` | Resize the node under the keys, if it can be resized, by one step of the grid. With Shift, by one unit. |
17
+ | `Alt + Enter` | A double click on the node or the connection under the keys: the app hears `onNodeDblClick` or `onEdgeDblClick`, and with `textEditable` the node’s text is edited. |
18
+ | `Menu key, Shift + F10` | The context menu of the node or the connection under the keys: the app opens its menu at the middle of it (`onNodeContextMenu`, `onEdgeContextMenu`). |
19
+ | `F2` | Edits the text of the node under the keys, else the only one selected, in place (`textEditable`): an editor opens over the text. |
20
+ | `Enter, Escape (in the text editor)` | Enter writes the text as a step of the history, as leaving the editor does; Escape keeps the old one. |
17
21
  | `Ctrl + Z, Ctrl + Shift + Z, Ctrl + Y` | Undo and redo. |
18
22
  | `Ctrl + C, Ctrl + X, Ctrl + V, Ctrl + D` | Copy, cut, paste and duplicate. |
19
23
  | `Ctrl + A` | Selects every node and connection. |
@@ -1,6 +1,6 @@
1
1
  # Diagram: Layout, map and export
2
2
 
3
- > Diagram · @motifx-community/ui 0.1.0-beta.16
3
+ > Diagram · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Placing the nodes automatically, a map of the whole diagram, saving and loading, and images of the diagram.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Diagram: Nodes and styles
2
2
 
3
- > Diagram · @motifx-community/ui 0.1.0-beta.16
3
+ > Diagram · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  What a node holds and how it looks: kinds of node of the app’s own with any control of the kit inside, groups, lanes and notes, resizing, and the app’s own classes and styles on top of the design tokens.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Diagram: Tables and classes
2
2
 
3
- > Diagram · @motifx-community/ui 0.1.0-beta.16
3
+ > Diagram · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Table (entity relationship) and class diagrams with the built-in `table` and `class` kinds, the marks their connections end with, and texts at the ends of a connection.
6
6
 
package/docs/diagram.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Diagram
2
2
 
3
- > Diagram · @motifx-community/ui 0.1.0-beta.16
3
+ > Diagram · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Nodes and the connections between them on a surface that the user pans and zooms. The user draws connections between the ports of nodes and moves their ends. The diagram is only the surface: toolbars and menus belong to the app, which uses the diagram’s methods.
6
6
 
@@ -17,7 +17,8 @@ Each node has an `id` and a position in diagram units. A node without a size tak
17
17
  ```tsx
18
18
  import { Diagram, type DiagramEdge, type DiagramNode } from '@motifx-community/ui';
19
19
 
20
- const NODES: DiagramNode[] = [
20
+ /** The nodes and connections each time the example is shown: the diagram changes the arrays it is given. */
21
+ const nodes = (): DiagramNode[] => [
21
22
  { id: 'order', x: 0, y: 90, text: 'Order received' },
22
23
  { id: 'stock', x: 220, y: 0, text: 'Check the stock' },
23
24
  { id: 'payment', x: 220, y: 180, text: 'Take the payment' },
@@ -25,7 +26,7 @@ const NODES: DiagramNode[] = [
25
26
  { id: 'notify', x: 680, y: 70, width: 170, text: 'Send the tracking number to the customer' },
26
27
  ];
27
28
 
28
- const EDGES: DiagramEdge[] = [
29
+ const edges = (): DiagramEdge[] => [
29
30
  { id: 'e1', source: 'order', target: 'stock' },
30
31
  { id: 'e2', source: 'order', target: 'payment' },
31
32
  { id: 'e3', source: 'stock', target: 'ship', label: 'In stock' },
@@ -35,7 +36,7 @@ const EDGES: DiagramEdge[] = [
35
36
 
36
37
  /** Nodes and the connections between them, fitted into view once they are laid out. */
37
38
  export default function Basic() {
38
- return <Diagram class="diagram-basic" label="Order flow" autoFit nodes={NODES} edges={EDGES} />;
39
+ return <Diagram class="diagram-basic" label="Order flow" autoFit nodes={nodes()} edges={edges()} />;
39
40
  }
40
41
  ```
41
42
 
@@ -47,7 +48,8 @@ export default function Basic() {
47
48
  import { reactive } from '@motifx/core';
48
49
  import { Button, ButtonGroup, Diagram, Stack, type DiagramBackground, type DiagramNode, type DiagramViewport } from '@motifx-community/ui';
49
50
 
50
- const NODES: DiagramNode[] = Array.from({ length: 12 }, (_, i) => ({ id: `step-${i + 1}`, x: (i % 4) * 220, y: Math.floor(i / 4) * 140, text: `Step ${i + 1}` }));
51
+ /** The nodes each time the example is shown: the diagram changes the array it is given. */
52
+ const nodes = (): DiagramNode[] => Array.from({ length: 12 }, (_, i) => ({ id: `step-${i + 1}`, x: (i % 4) * 220, y: Math.floor(i / 4) * 140, text: `Step ${i + 1}` }));
51
53
 
52
54
  /** The view moved from code: zoom, fit and center on a node, each gliding there; the marks of the surface. */
53
55
  export default function View() {
@@ -67,7 +69,7 @@ export default function View() {
67
69
  ref={(d: Diagram) => (diagram = d)}
68
70
  label="Steps"
69
71
  autoFit
70
- nodes={NODES}
72
+ nodes={nodes()}
71
73
  background={() => s.background as DiagramBackground}
72
74
  onViewportChanged={(e) => (s.viewport = e.viewport)}
73
75
  />
@@ -84,7 +86,8 @@ export default function View() {
84
86
  ```tsx
85
87
  import { Diagram, type DiagramNode } from '@motifx-community/ui';
86
88
 
87
- const NODES: DiagramNode[] = [
89
+ /** The nodes each time the example is shown: the diagram changes the array it is given. */
90
+ const nodes = (): DiagramNode[] => [
88
91
  { id: 'north', x: 160, y: 0, text: 'North' },
89
92
  { id: 'west', x: 0, y: 120, text: 'West' },
90
93
  { id: 'east', x: 320, y: 120, text: 'East' },
@@ -93,7 +96,7 @@ const NODES: DiagramNode[] = [
93
96
 
94
97
  /** The view stays over the nodes' area, between half and twice the actual size. */
95
98
  export default function Limits() {
96
- return <Diagram class="diagram-limits" label="Compass" autoFit nodes={NODES} minZoom={0.5} maxZoom={2} bounds={{ x: -80, y: -80, width: 600, height: 440 }} background="lines" />;
99
+ return <Diagram class="diagram-limits" label="Compass" autoFit nodes={nodes()} minZoom={0.5} maxZoom={2} bounds={{ x: -80, y: -80, width: 600, height: 440 }} background="lines" />;
97
100
  }
98
101
  ```
99
102
 
package/docs/display.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Display
2
2
 
3
- > Display · @motifx-community/ui 0.1.0-beta.16
3
+ > Display · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Display components present content: people, counts and labels, cards, pictures, tiles, events in time, codes to scan, and placeholders while content loads.
6
6
 
package/docs/draggable.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Draggable and DropTarget
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.16
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Makes any content movable with the pointer, touch or the arrow keys, optionally along one axis, inside a boundary, by a handle or as a copy. `DropTarget` defines areas that accept it. To reorder items in a list, see [Sortable](sortable.md).
6
6
 
package/docs/drawer.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Drawer
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.16
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  A panel that slides in from an edge of the page or a container, either over the content or pushing it aside. Users can swipe it in from the edge and back out, and Escape, the scrim and the browser's back action close it.
6
6
 
package/docs/dropdown.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DropDown
2
2
 
3
- > Choice · @motifx-community/ui 0.1.0-beta.16
3
+ > Choice · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Selects one item from a list. The field shows the selected item, and the list opens below it on click or from the keyboard. The list can be searched, grouped and customized, and it stays fast with thousands of items.
6
6
 
package/docs/editors.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Editors
2
2
 
3
- > Editors · @motifx-community/ui 0.1.0-beta.16
3
+ > Editors · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Editors take values: text, numbers, dates and times, ranges, colors, ratings, codes, files and signatures. They share one field model, so a label, help text, validation and binding work the same in all of them.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # ExpressionEditor
2
2
 
3
- > Editors · @motifx-community/ui 0.1.0-beta.16
3
+ > Editors · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  A field for an expression of the data layer, or for a template with expressions in it. The text is colored as it is typed, its problems are underlined where they are, the words that may be written at the caret come in a list, and the call the caret is in shows its parameters. It has the label, help text and validation common to all fields.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Expression language
2
2
 
3
- > Data · @motifx-community/ui 0.1.0-beta.16
3
+ > Data · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  The data package carries a small expression language for the conditions, values and texts an application computes from data: the condition of a rule, the value a flow writes into a step, the body of a message. An expression changes nothing and reaches nothing by itself — it reads only the names it is given and their own fields, the moment and the time zone come from the evaluation, and limits stop runaway work — so the same expression with the same values always gives the same result, in the browser and on a server. It is checked against a schema as it is written, and it travels as text with a plain JSON tree.
6
6
 
package/docs/feedback.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Feedback
2
2
 
3
- > Feedback · @motifx-community/ui 0.1.0-beta.16
3
+ > Feedback · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Feedback components tell the reader what is happening: how far a task has come, that something is loading, what a control does, and what has just happened.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # FileUploader
2
2
 
3
- > Editors · @motifx-community/ui 0.1.0-beta.16
3
+ > Editors · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Lets users select files with a button or drop them on the box. Files are listed with their size and status, and can upload automatically, on a button click or programmatically, with progress, cancel, retry and remove for each file. Files that exceed the limits are listed with the reason.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # FilterBuilder
2
2
 
3
- > Data · @motifx-community/ui 0.1.0-beta.16
3
+ > Data · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Lets users build a filter visually, using groups joined by And, Or, Not And or Not Or, and conditions made of a field, an operation and a value. Its value is a data layer filter expression, so it works directly with in-memory rows and every adapter. DataGrid opens it from the filter panel, and you can also use it on its own for reports or saved searches.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # FormLayout: From a schema
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.16
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  A form can be made from a schema of its data object: a field for each property, with the editor its type, values and format call for, its title as the label and its description as the help text. The same schema checks the value in the form, in the application and on a server, with the data layer's `jsonSchema`, a subset of JSON Schema.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # FormLayout
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.16
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Arranges the fields of a data object on a grid. Each field gets an editor, chosen by name or by the type of its value, with two-way binding to the object. Groups, column spans and buttons organize the layout, and submitting the form validates every field first.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Foundations
2
2
 
3
- > Foundations · @motifx-community/ui 0.1.0-beta.16
3
+ > Foundations · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  The foundations are what every control of the kit shares: the Control base with its properties, keyboard and focus, and the language of the texts and formats.
6
6
 
package/docs/gallery.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Gallery
2
2
 
3
- > Display · @motifx-community/ui 0.1.0-beta.16
3
+ > Display · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Displays a horizontal set of slides, one or several at a time. Users navigate with the side buttons, the indicator dots, swipe gestures or the arrow keys, and it can run as an automatic slideshow. A slide can be an image with a caption or any other content.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Gauge: Base value
2
2
 
3
- > Gauges · @motifx-community/ui 0.1.0-beta.16
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  The fill starts at the start of the scale, or at a base value inside it. A scale with values on both sides of a target then fills from the target, either way.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Gauge: Circular
2
2
 
3
- > Gauges · @motifx-community/ui 0.1.0-beta.16
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  A circular gauge shows its value on an arc or a whole circle, with the value written in the middle. It reads best for one value whose scale the reader knows, such as a speed or a share.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Gauge: Dashboards
2
2
 
3
- > Gauges · @motifx-community/ui 0.1.0-beta.16
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Gauges of different kinds put together, all following the same values. Each gauge keeps its own scale, so readers compare values by their meaning, not by size alone.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Gauge: Linear
2
2
 
3
- > Gauges · @motifx-community/ui 0.1.0-beta.16
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  A linear gauge shows its value on a straight bar, across or upright. Bars fit in narrow places, line up in lists, and compare well side by side.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Gauge: Markers
2
2
 
3
- > Gauges · @motifx-community/ui 0.1.0-beta.16
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  A marker points at the value: a needle from the middle of an arc, a shape on or beside the track, or a callout that writes the value.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Gauge: Marks
2
2
 
3
- > Gauges · @motifx-community/ui 0.1.0-beta.16
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Marks show other values on the scale besides the gauge's own, such as a target, a limit, or the lowest and highest expected.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Gauge: Ranges
2
2
 
3
- > Gauges · @motifx-community/ui 0.1.0-beta.16
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Ranges give stretches of the scale a meaning, such as normal, high and critical. They show as a band beside the track, and the fill takes the color of the range its value is in.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Gauge: Scales
2
2
 
3
- > Gauges · @motifx-community/ui 0.1.0-beta.16
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  The scale tells the reader how to read the value: its ends, ticks with their values, or nothing at all.
6
6
 
package/docs/gauge.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Gauge
2
2
 
3
- > Gauges · @motifx-community/ui 0.1.0-beta.16
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Shows a value against its scale, as an arc, a circle or a straight bar. Ranges give stretches of the scale a meaning, markers and marks point at values, and every part takes its look from the design language.
6
6
 
package/docs/home.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @motifx-community/ui
2
2
 
3
- > Get started · @motifx-community/ui 0.1.0-beta.16
3
+ > Get started · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Components for MotifJS: objects you create when you need them, show anywhere and dispose when you are done, drawn from the MotifJS design system's tokens.
6
6
 
package/docs/keyboard.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Keyboard and focus
2
2
 
3
- > Foundations · @motifx-community/ui 0.1.0-beta.16
3
+ > Foundations · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Every control follows the same rules for Tab order, the active control of a container, focus handling, `&File` access keys and application-wide shortcuts.
6
6
 
package/docs/language.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Language
2
2
 
3
- > Foundations · @motifx-community/ui 0.1.0-beta.16
3
+ > Foundations · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  `uiLocale` controls the strings that controls display, the locale used for dates and numbers, and the text direction. The kit has one `uiLocale`, and each language pack is loaded on demand.
6
6
 
package/docs/layout.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Layout
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.16
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  Container controls for arranging other controls: `Stack` (a row or column), `Grid` (rows and columns), `Panel` (a plain box that can scroll), `GroupBox` (a titled frame), `DockPanel` (children docked to its edges) and `SplitContainer` (two panes with a splitter). All of them are controls, so they can disable and hide their content, and they lay out children added at any time.
6
6
 
package/docs/listbox.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ListBox
2
2
 
3
- > Data · @motifx-community/ui 0.1.0-beta.16
3
+ > Data · @motifx-community/ui 0.1.0-beta.18
4
4
 
5
5
  A list displayed directly on the page. Users select one or more items with the keyboard or pointer. Items can come from memory or a data source, can be searched and grouped, and long lists render only the visible rows.
6
6