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

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 (220) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/components/diagram/Diagram.d.ts +92 -0
  3. package/dist/components/diagram/DiagramEdgeView.d.ts +14 -4
  4. package/dist/components/diagram/DiagramLinks.d.ts +2 -0
  5. package/dist/components/diagram/DiagramNodeView.d.ts +19 -1
  6. package/dist/components/diagram/diagram-change.d.ts +3 -2
  7. package/dist/components/diagram/diagram-edge-click-event-args.d.ts +21 -0
  8. package/dist/components/diagram/diagram-edge-pointer-event-args.d.ts +6 -0
  9. package/dist/components/diagram/diagram-edge.d.ts +8 -0
  10. package/dist/components/diagram/diagram-links-host.d.ts +3 -0
  11. package/dist/components/diagram/diagram-node-click-event-args.d.ts +23 -0
  12. package/dist/components/diagram/diagram-node-context.d.ts +5 -0
  13. package/dist/components/diagram/diagram-node-host.d.ts +4 -0
  14. package/dist/components/diagram/diagram-node-pointer-event-args.d.ts +6 -0
  15. package/dist/components/diagram/diagram-props.d.ts +45 -0
  16. package/dist/components/diagram/diagram-text-changed-event-args.d.ts +7 -0
  17. package/dist/components/diagram/diagram-text-changing-event-args.d.ts +14 -0
  18. package/dist/components/diagram/diagram-text-editing-event-args.d.ts +11 -0
  19. package/dist/components/diagram/index.d.ts +7 -0
  20. package/dist/core/ui-strings.d.ts +5 -0
  21. package/dist/index.js +2096 -1557
  22. package/dist/index.js.map +1 -1
  23. package/dist/locales/en.json +3 -0
  24. package/dist/locales/tr.json +3 -0
  25. package/dist/styles.css +54 -0
  26. package/dist/{tr-4GNbFdQh.js → tr-CMuuXBUb.js} +8 -2
  27. package/dist/{tr-4GNbFdQh.js.map → tr-CMuuXBUb.js.map} +1 -1
  28. package/docs/accordion.md +1 -1
  29. package/docs/actionsheet.md +1 -1
  30. package/docs/appbar.md +1 -1
  31. package/docs/appmenu-api.md +1 -1
  32. package/docs/appmenu-programmatic.md +1 -1
  33. package/docs/appmenu-search.md +1 -1
  34. package/docs/appmenu.md +1 -1
  35. package/docs/avatar.md +1 -1
  36. package/docs/badge.md +1 -1
  37. package/docs/bar-gauge-angles.md +1 -1
  38. package/docs/bar-gauge-data.md +1 -1
  39. package/docs/bar-gauge-labels.md +1 -1
  40. package/docs/bar-gauge.md +1 -1
  41. package/docs/barcode.md +1 -1
  42. package/docs/bottomnavigation.md +1 -1
  43. package/docs/bottomsheet.md +1 -1
  44. package/docs/breadcrumb.md +1 -1
  45. package/docs/button.md +1 -1
  46. package/docs/buttongroup.md +1 -1
  47. package/docs/buttons.md +1 -1
  48. package/docs/calendar.md +1 -1
  49. package/docs/card.md +1 -1
  50. package/docs/chart-bars.md +1 -1
  51. package/docs/chart-candles.md +1 -1
  52. package/docs/chart-funnel.md +1 -1
  53. package/docs/chart-heatmap.md +1 -1
  54. package/docs/chart-lines.md +1 -1
  55. package/docs/chart-live.md +1 -1
  56. package/docs/chart-pie.md +1 -1
  57. package/docs/chart-radar.md +1 -1
  58. package/docs/chart-ranges.md +1 -1
  59. package/docs/chart-references.md +1 -1
  60. package/docs/chart-scatter.md +1 -1
  61. package/docs/chart-waterfall.md +1 -1
  62. package/docs/chart-zoom.md +1 -1
  63. package/docs/chart.md +1 -1
  64. package/docs/chat.md +1 -1
  65. package/docs/checkbox.md +1 -1
  66. package/docs/chip.md +1 -1
  67. package/docs/choice.md +1 -1
  68. package/docs/colorbox.md +1 -1
  69. package/docs/combobox.md +1 -1
  70. package/docs/commands.md +1 -1
  71. package/docs/control.md +1 -1
  72. package/docs/data.md +1 -1
  73. package/docs/datagrid-api.md +1 -1
  74. package/docs/datagrid-bands.md +1 -1
  75. package/docs/datagrid-drag-select.md +1 -1
  76. package/docs/datagrid-drag.md +1 -1
  77. package/docs/datagrid-editing.md +1 -1
  78. package/docs/datagrid-filtering.md +1 -1
  79. package/docs/datagrid-forms.md +1 -1
  80. package/docs/datagrid-grouping.md +1 -1
  81. package/docs/datagrid-layout.md +1 -1
  82. package/docs/datagrid-lookups.md +1 -1
  83. package/docs/datagrid-master-detail.md +1 -1
  84. package/docs/datagrid-scrolling.md +1 -1
  85. package/docs/datagrid-selection.md +1 -1
  86. package/docs/datagrid.md +1 -1
  87. package/docs/datebox.md +1 -1
  88. package/docs/daterangebox.md +1 -1
  89. package/docs/diagram-api.md +19 -4
  90. package/docs/diagram-commands.md +2 -1
  91. package/docs/diagram-connections.md +8 -6
  92. package/docs/diagram-custom-nodes.md +1 -1
  93. package/docs/diagram-designer.md +1 -1
  94. package/docs/diagram-editing.md +132 -5
  95. package/docs/diagram-flow.md +21 -4
  96. package/docs/diagram-keyboard.md +5 -1
  97. package/docs/diagram-layout.md +1 -1
  98. package/docs/diagram-nodes.md +1 -1
  99. package/docs/diagram-tables.md +1 -1
  100. package/docs/diagram.md +11 -8
  101. package/docs/display.md +1 -1
  102. package/docs/draggable.md +1 -1
  103. package/docs/drawer.md +1 -1
  104. package/docs/dropdown.md +1 -1
  105. package/docs/editors.md +1 -1
  106. package/docs/expressioneditor.md +1 -1
  107. package/docs/expressions.md +1 -1
  108. package/docs/feedback.md +1 -1
  109. package/docs/fileuploader.md +1 -1
  110. package/docs/filterbuilder.md +1 -1
  111. package/docs/formlayout-schema.md +1 -1
  112. package/docs/formlayout.md +1 -1
  113. package/docs/foundations.md +1 -1
  114. package/docs/gallery.md +1 -1
  115. package/docs/gauge-base.md +1 -1
  116. package/docs/gauge-circular.md +1 -1
  117. package/docs/gauge-dashboards.md +1 -1
  118. package/docs/gauge-linear.md +1 -1
  119. package/docs/gauge-markers.md +1 -1
  120. package/docs/gauge-marks.md +1 -1
  121. package/docs/gauge-ranges.md +1 -1
  122. package/docs/gauge-scales.md +1 -1
  123. package/docs/gauge.md +1 -1
  124. package/docs/home.md +1 -1
  125. package/docs/keyboard.md +1 -1
  126. package/docs/language.md +1 -1
  127. package/docs/layout.md +1 -1
  128. package/docs/listbox.md +1 -1
  129. package/docs/loadpanel.md +1 -1
  130. package/docs/lookup.md +1 -1
  131. package/docs/markdown.md +1 -1
  132. package/docs/menus-api.md +1 -1
  133. package/docs/menus-context.md +1 -1
  134. package/docs/menus-customization.md +1 -1
  135. package/docs/menus-merging.md +1 -1
  136. package/docs/menus-programmatic.md +1 -1
  137. package/docs/menus.md +1 -1
  138. package/docs/multiview.md +1 -1
  139. package/docs/navigation.md +1 -1
  140. package/docs/numberbox.md +1 -1
  141. package/docs/otpinput.md +1 -1
  142. package/docs/pagination.md +1 -1
  143. package/docs/pivotgrid-api.md +1 -1
  144. package/docs/pivotgrid-chart.md +1 -1
  145. package/docs/pivotgrid-drilldown.md +1 -1
  146. package/docs/pivotgrid-export.md +1 -1
  147. package/docs/pivotgrid-fields.md +1 -1
  148. package/docs/pivotgrid-keyboard.md +1 -1
  149. package/docs/pivotgrid-layout.md +1 -1
  150. package/docs/pivotgrid-panel.md +1 -1
  151. package/docs/pivotgrid-remote.md +1 -1
  152. package/docs/pivotgrid-sorting.md +1 -1
  153. package/docs/pivotgrid-state.md +1 -1
  154. package/docs/pivotgrid-summaries.md +1 -1
  155. package/docs/pivotgrid.md +1 -1
  156. package/docs/popover.md +1 -1
  157. package/docs/progress.md +1 -1
  158. package/docs/qrcode.md +1 -1
  159. package/docs/radiogroup.md +1 -1
  160. package/docs/rating.md +1 -1
  161. package/docs/resizable.md +1 -1
  162. package/docs/ribbonmenu-api.md +1 -1
  163. package/docs/ribbonmenu-commands.md +1 -1
  164. package/docs/ribbonmenu-customization.md +1 -1
  165. package/docs/ribbonmenu-display.md +1 -1
  166. package/docs/ribbonmenu-layouts.md +1 -1
  167. package/docs/ribbonmenu-programmatic.md +1 -1
  168. package/docs/ribbonmenu.md +1 -1
  169. package/docs/scheduler-agenda.md +1 -1
  170. package/docs/scheduler-big-data.md +1 -1
  171. package/docs/scheduler-editing.md +1 -1
  172. package/docs/scheduler-form.md +1 -1
  173. package/docs/scheduler-icalendar.md +1 -1
  174. package/docs/scheduler-mobile.md +1 -1
  175. package/docs/scheduler-recurrence.md +1 -1
  176. package/docs/scheduler-resources.md +1 -1
  177. package/docs/scheduler-timeline.md +1 -1
  178. package/docs/scheduler.md +1 -1
  179. package/docs/scrollview.md +1 -1
  180. package/docs/shortcuteditor.md +1 -1
  181. package/docs/showcase-flowstudio.md +1 -1
  182. package/docs/showcase-home.md +1 -1
  183. package/docs/showcase-mail.md +1 -1
  184. package/docs/showcase.md +1 -1
  185. package/docs/signature.md +1 -1
  186. package/docs/skeleton.md +1 -1
  187. package/docs/slider.md +1 -1
  188. package/docs/sortable.md +1 -1
  189. package/docs/sparkline.md +1 -1
  190. package/docs/speeddial.md +1 -1
  191. package/docs/splitter.md +1 -1
  192. package/docs/stepper.md +1 -1
  193. package/docs/switch.md +1 -1
  194. package/docs/tabdocs-dock.md +1 -1
  195. package/docs/tabdocs-drag.md +1 -1
  196. package/docs/tabdocs-menus.md +1 -1
  197. package/docs/tabdocs-mobile.md +1 -1
  198. package/docs/tabdocs-tabs.md +1 -1
  199. package/docs/tabdocs-windows.md +1 -1
  200. package/docs/tabdocs-workspace.md +1 -1
  201. package/docs/tabdocs.md +1 -1
  202. package/docs/tabs.md +1 -1
  203. package/docs/tagbox.md +1 -1
  204. package/docs/textarea.md +1 -1
  205. package/docs/textbox.md +1 -1
  206. package/docs/tileview.md +1 -1
  207. package/docs/timeline.md +1 -1
  208. package/docs/toast.md +1 -1
  209. package/docs/tokens.md +1 -1
  210. package/docs/toolbar-api.md +1 -1
  211. package/docs/toolbar-customization.md +1 -1
  212. package/docs/toolbar.md +1 -1
  213. package/docs/tooltip.md +1 -1
  214. package/docs/treeview.md +1 -1
  215. package/docs/validationsummary.md +1 -1
  216. package/docs/window.md +1 -1
  217. package/docs/wizard.md +1 -1
  218. package/llms-full.txt +382 -213
  219. package/llms.txt +1 -1
  220. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,38 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.0-beta.17] - 2026-11-28
10
+
11
+ Needs `@motifx/core` 1.2.0-rc.31 and `@motifx-community/data` 0.1.0-beta.3.
12
+
13
+ ### Added
14
+
15
+ - `Diagram` events for the nodes and connections the user points at, clicks or opens a menu on: `onNodeClick`,
16
+ `onNodeDblClick`, `onNodeContextMenu`, `onNodePointerEnter`, `onNodePointerLeave`, and the same five for connections
17
+ (`onEdgeClick`, `onEdgeDblClick`, `onEdgeContextMenu`, `onEdgePointerEnter`, `onEdgePointerLeave`). Each carries the
18
+ item, the pointer's place (`at`, where the app opens its own menu) and `cancel`. The keys reach them too: the Menu key
19
+ or Shift+F10 on the item under the keys opens its menu, and Alt+Enter is its double click.
20
+ - A connection's `status` and `statusText`, as a node's: `setEdgeStatus` marks the connections a run goes along as
21
+ waiting, running (its line moving), done, skipped or failed, in the look's colors, with the text in the line's tip and
22
+ the status said to a screen reader with the connection's two nodes.
23
+ - A node's text edited in place (`textEditable`): a double click on the text, F2 or the new `rename` command opens an
24
+ editor over it. Enter or leaving it writes the text as a step of the history (a `text` change), Escape keeps the old
25
+ one, and an empty text is refused. `editText(id)` opens it in code; `onTextEditing`, `onTextChanging` (change or
26
+ refuse the new text) and `onTextChanged`. A kind with content of its own names the part that shows the text with
27
+ `context.textPart`; `cardKind` and the built-in kinds do.
28
+
29
+ ### Fixed
30
+
31
+ - A `DataGrid` row is as wide as its columns, never as its content (#7). A column with `flex` that got less room than
32
+ its filter-row editor asks for kept the editor's width in the filter row: that row grew wider than the others, its
33
+ cells no longer lined up with the headers, and the grid scrolled sideways. A long text in a cell and a group's title
34
+ widened their own rows in the same way. Each row is a grid sized to its content, so its flexing tracks grew with what
35
+ its cells held; the cells of a row no longer pass their content's width to it (`contain: inline-size`).
36
+ - The rows of a `cardKind` node follow the order of its `ports` when they change (#8). A port added among the others got
37
+ its row, and its port beside it, at the bottom of the card, after the ports that came after it. Each row keeps its
38
+ place among the rows of its side, and they are put in order when a place changes; a card whose ports did not change
39
+ does no extra work.
40
+
9
41
  ## [0.1.0-beta.16] - 2026-11-27
10
42
 
11
43
  Needs `@motifx/core` 1.2.0-rc.31 and `@motifx-community/data` 0.1.0-beta.3.
@@ -20,6 +20,8 @@ import type { DiagramData } from './diagram-data';
20
20
  import type { DiagramDeletedEventArgs } from './diagram-deleted-event-args';
21
21
  import type { DiagramDeletingEventArgs } from './diagram-deleting-event-args';
22
22
  import type { DiagramDrawnNode } from './diagram-drawn-node';
23
+ import type { DiagramEdgeClickEventArgs } from './diagram-edge-click-event-args';
24
+ import type { DiagramEdgePointerEventArgs } from './diagram-edge-pointer-event-args';
23
25
  import type { DiagramEdgeReshapedEventArgs } from './diagram-edge-reshaped-event-args';
24
26
  import type { DiagramEdgeReshapingEventArgs } from './diagram-edge-reshaping-event-args';
25
27
  import type { DiagramEdge } from './diagram-edge';
@@ -30,6 +32,8 @@ import type { DiagramFitOptions } from './diagram-fit-options';
30
32
  import type { DiagramLayoutOptions } from './diagram-layout-options';
31
33
  import type { DiagramMiniMapOptions } from './diagram-mini-map-options';
32
34
  import type { DiagramNode } from './diagram-node';
35
+ import type { DiagramNodeClickEventArgs } from './diagram-node-click-event-args';
36
+ import type { DiagramNodePointerEventArgs } from './diagram-node-pointer-event-args';
33
37
  import type { DiagramNodesMovedEventArgs } from './diagram-nodes-moved-event-args';
34
38
  import type { DiagramNodesMovingEventArgs } from './diagram-nodes-moving-event-args';
35
39
  import type { DiagramPoint } from './diagram-point';
@@ -39,6 +43,9 @@ import type { DiagramReconnectingEventArgs } from './diagram-reconnecting-event-
39
43
  import type { DiagramRect } from './diagram-rect';
40
44
  import type { DiagramSelection } from './diagram-selection';
41
45
  import type { DiagramSelectionChangedEventArgs } from './diagram-selection-changed-event-args';
46
+ import type { DiagramTextChangedEventArgs } from './diagram-text-changed-event-args';
47
+ import type { DiagramTextChangingEventArgs } from './diagram-text-changing-event-args';
48
+ import type { DiagramTextEditingEventArgs } from './diagram-text-editing-event-args';
42
49
  import type { DiagramViewport } from './diagram-viewport';
43
50
  import type { DiagramViewportChangedEventArgs } from './diagram-viewport-changed-event-args';
44
51
  import type { DiagramViewportOptions } from './diagram-viewport-options';
@@ -139,6 +146,27 @@ export declare class Diagram<N extends DiagramNode = DiagramNode, E extends Diag
139
146
  private readonly pastingEmitter;
140
147
  private readonly pastedEmitter;
141
148
  private readonly historyChangedEmitter;
149
+ private readonly nodeClickEmitter;
150
+ private readonly nodeDblClickEmitter;
151
+ private readonly nodeMenuEmitter;
152
+ private readonly nodeMenu;
153
+ private readonly nodePointerEnterEmitter;
154
+ private readonly nodePointerLeaveEmitter;
155
+ private readonly edgeClickEmitter;
156
+ private readonly edgeDblClickEmitter;
157
+ private readonly edgeMenuEmitter;
158
+ private readonly edgeMenu;
159
+ private readonly edgePointerEnterEmitter;
160
+ private readonly edgePointerLeaveEmitter;
161
+ private readonly textEditingEmitter;
162
+ private readonly textChangingEmitter;
163
+ private readonly textChangedEmitter;
164
+ /** What every node's part asks of the diagram and tells it: one object for all the nodes, however many. */
165
+ private readonly nodeHost;
166
+ /** When the Menu key or Shift+F10 last opened the app's menu: the `contextmenu` event the browser sends after it stays its own. */
167
+ private menuKeyAt;
168
+ /** The node whose text is edited in place, and its editor, while it is. */
169
+ private editing;
142
170
  /** The size of the surface, from its size observer; 0 until it is laid out. */
143
171
  private room;
144
172
  /** The view last told: a change is told from it. */
@@ -183,6 +211,8 @@ export declare class Diagram<N extends DiagramNode = DiagramNode, E extends Diag
183
211
  set guides(value: Bind<boolean>);
184
212
  get history(): boolean;
185
213
  set history(value: Bind<boolean>);
214
+ get textEditable(): boolean;
215
+ set textEditable(value: Bind<boolean>);
186
216
  get commandScope(): ComponentBase | null;
187
217
  set commandScope(value: Bind<ComponentBase | null>);
188
218
  /** Whether there is a step to undo, and one to redo. */
@@ -359,9 +389,56 @@ export declare class Diagram<N extends DiagramNode = DiagramNode, E extends Diag
359
389
  * were hidden in a group or shown again, or the surface changed its size. A map follows the diagram with it.
360
390
  */
361
391
  get onContentChanged(): MotifEvent<void>;
392
+ get onNodeClick(): MotifEvent<DiagramNodeClickEventArgs<N>>;
393
+ get onNodeDblClick(): MotifEvent<DiagramNodeClickEventArgs<N>>;
394
+ get onNodeContextMenu(): MotifEvent<DiagramNodeClickEventArgs<N>>;
395
+ get onNodePointerEnter(): MotifEvent<DiagramNodePointerEventArgs<N>>;
396
+ get onNodePointerLeave(): MotifEvent<DiagramNodePointerEventArgs<N>>;
397
+ get onEdgeClick(): MotifEvent<DiagramEdgeClickEventArgs<E>>;
398
+ get onEdgeDblClick(): MotifEvent<DiagramEdgeClickEventArgs<E>>;
399
+ get onEdgeContextMenu(): MotifEvent<DiagramEdgeClickEventArgs<E>>;
400
+ get onEdgePointerEnter(): MotifEvent<DiagramEdgePointerEventArgs<E>>;
401
+ get onEdgePointerLeave(): MotifEvent<DiagramEdgePointerEventArgs<E>>;
402
+ get onTextEditing(): MotifEvent<DiagramTextEditingEventArgs<N>>;
403
+ get onTextChanging(): MotifEvent<DiagramTextChangingEventArgs<N>>;
404
+ get onTextChanged(): MotifEvent<DiagramTextChangedEventArgs<N>>;
362
405
  /** Makes the selection these nodes and connections, the ones that exist and may be selected; tells when it changed. */
363
406
  private choose;
364
407
  private edgeClicked;
408
+ /** What the pointer did on a node: told; a double click on its text edits it, a right click opens the app's menu. */
409
+ private nodeTold;
410
+ /** What the pointer did on a connection, besides a click: told; a right click opens the app's menu. */
411
+ private edgeTold;
412
+ /** What a click on a node tells: where it was on the page, or for a key the middle of the node. */
413
+ private nodeArgs;
414
+ /** What a click on a connection tells: where it was on the page, or for a key the middle between its ends. */
415
+ private edgeArgs;
416
+ /** A double click on a node, or Alt+Enter on it: told, then its text is edited (`textEditable`), unless canceled. */
417
+ private nodeOpened;
418
+ /**
419
+ * A right click on a node, or the Menu key on it: told to the app, which opens its menu there; the browser's own
420
+ * stays closed, unless canceled. Nothing is told while nobody listens. Returns whether the app took it.
421
+ */
422
+ private nodeMenuAsked;
423
+ /** A right click on a connection, or the Menu key on it, as `nodeMenuAsked`. */
424
+ private edgeMenuAsked;
425
+ /** The Menu key or Shift+F10: the context menu of the connection or the node under the keys. Returns whether the app took it. */
426
+ private keyMenu;
427
+ /** Alt+Enter: a double click on the connection or the node under the keys. Returns whether there was one. */
428
+ private keyOpen;
429
+ /** What a screen reader calls a connection: its label, else its two nodes. */
430
+ private edgeName;
431
+ /** The node F2 and the `rename` command edit the text of: the one under the keys, else the only one selected. */
432
+ private renameTarget;
433
+ /** Opens the editor of a node's text over it, after `onTextEditing`; an edit going on elsewhere is written first. */
434
+ private startEditing;
435
+ /**
436
+ * Ends the edit of a node's text: `write` writes the editor's text, after `onTextChanging`, as a step of the history.
437
+ * The editor goes; when it had focus, focus comes back to the diagram, on the node.
438
+ */
439
+ private stopEditing;
440
+ /** Writes a node's new text, after `onTextChanging`, as a step of the history, and tells it. */
441
+ private writeText;
365
442
  private canMove;
366
443
  /** Asks `onNodesMoving` before nodes move; `false` when it cancels. */
367
444
  private startMoving;
@@ -543,6 +620,21 @@ export declare class Diagram<N extends DiagramNode = DiagramNode, E extends Diag
543
620
  * `statusText` are written, and saved with it unless the app leaves them out. Returns whether it changed.
544
621
  */
545
622
  setNodeStatus(id: string, status: DiagramNodeStatus | null, text?: string): boolean;
623
+ /**
624
+ * Shows what a connection is doing as a run goes along it (`null` takes the status away): the look's color of the
625
+ * status on its line and its marks, unless it has a `color` of its own, a line that moves while it runs, and the
626
+ * status in the line's tip; a screen reader hears it with the connection's two nodes. Not a step of the history: the
627
+ * connection's `status` and `statusText` are written, and saved with it unless the app leaves them out. Returns
628
+ * whether it changed.
629
+ */
630
+ setEdgeStatus(id: string, status: DiagramNodeStatus | null, text?: string): boolean;
631
+ /**
632
+ * Edits a node's text in place, as a double click on it does with `textEditable`: an editor opens over the text, and
633
+ * Enter or leaving it writes the new text as a step of the history, Escape keeps the old one. The node is selected
634
+ * and brought into view. Returns whether the editor opened: not in a read-only diagram, not for a node off the page
635
+ * (out of view in a large diagram, or in a collapsed group), and not when `onTextEditing` cancels.
636
+ */
637
+ editText(id: string): boolean;
546
638
  /**
547
639
  * The connections of a node: those that end at it (`direction: 'in'`), start at it (`'out'`) or either, at one of its
548
640
  * ports or any. Read in a getter, it follows the connections as they are drawn, taken away and moved.
@@ -1,9 +1,16 @@
1
1
  import type { Component, ComponentBase } from '@motifx/core';
2
2
  import type { DiagramEdge } from './diagram-edge';
3
3
  import type { DiagramLineLook } from './diagram-line-look';
4
+ import type { DiagramPointerAct } from './diagram-node-host';
4
5
  import type { DiagramPoint } from './diagram-point';
5
6
  import type { DiagramRect } from './diagram-rect';
6
7
  import type { DiagramSide } from './diagram-side';
8
+ /** What a line tells its diagram: a press, a click, and the rest the pointer does on it. */
9
+ export interface EdgeTold<E extends DiagramEdge> {
10
+ pressed: (view: DiagramEdgeView<E>, e: PointerEvent) => void;
11
+ clicked: (view: DiagramEdgeView<E>, e: MouseEvent) => void;
12
+ pointer: (what: Exclude<DiagramPointerAct, 'click'>, view: DiagramEdgeView<E>, e: MouseEvent) => void;
13
+ }
7
14
  /**
8
15
  * A connection on the surface: its line, the wider line the pointer finds it by, the marks at its ends and its label.
9
16
  * Its way is worked out at every draw; its parts are made the first time it is shown, and leave the page while it is not
@@ -14,6 +21,8 @@ export declare class DiagramEdgeView<E extends DiagramEdge = DiagramEdge> {
14
21
  private readonly labels;
15
22
  private readonly told;
16
23
  private parts;
24
+ /** The tip of its status, while it has one. */
25
+ private tip;
17
26
  /** The line as last worked out, written to its parts while it is shown. */
18
27
  private drawn;
19
28
  private selected;
@@ -39,10 +48,7 @@ export declare class DiagramEdgeView<E extends DiagramEdge = DiagramEdge> {
39
48
  bounds: DiagramRect | null;
40
49
  /** Whether it is on the page: it lies in view, or the diagram shows every line. */
41
50
  live: boolean;
42
- constructor(edges: ComponentBase, labels: ComponentBase, edge: E, told: {
43
- pressed: (view: DiagramEdgeView<E>, e: PointerEvent) => void;
44
- clicked: (view: DiagramEdgeView<E>, e: MouseEvent) => void;
45
- });
51
+ constructor(edges: ComponentBase, labels: ComponentBase, edge: E, told: EdgeTold<E>);
46
52
  /** The group of its parts; `null` until it is first shown. */
47
53
  get group(): Component<SVGGElement> | null;
48
54
  /** Puts it on the page or takes it off: its parts are made the first time. Returns whether they were made now. */
@@ -67,6 +73,10 @@ export declare class DiagramEdgeView<E extends DiagramEdge = DiagramEdge> {
67
73
  markSelected(on: boolean): void;
68
74
  /** The app's color, width, classes and style properties; those it took away since the last draw come off. */
69
75
  private drawLook;
76
+ /** Writes its status again, as `setEdgeStatus` changed it: nothing else of the line changes. */
77
+ drawState(): void;
78
+ /** Its status: the look's color of it on the line and its marks, and the status in the line's tip. */
79
+ private drawStatus;
70
80
  remove(): void;
71
81
  private drawMark;
72
82
  private drawLabel;
@@ -25,6 +25,8 @@ export declare class DiagramLinks<N extends DiagramNode = DiagramNode, E extends
25
25
  /** The handles that move, add and take away the points of the selected lines; the keys do the same through it. */
26
26
  readonly bends: DiagramBends<E>;
27
27
  private readonly views;
28
+ /** What every line tells the diagram: one object for all the lines, however many. */
29
+ private readonly told;
28
30
  /** The selected connections, by `id`, and the handles over their ends, which take an end to move it. */
29
31
  private readonly selected;
30
32
  private readonly handles;
@@ -1,4 +1,4 @@
1
- import { type Component } from '@motifx/core';
1
+ import { ComponentBase, type Component } from '@motifx/core';
2
2
  import { type Size } from '../../core/measure';
3
3
  import type { DiagramNode } from './diagram-node';
4
4
  import type { DiagramNodeHost } from './diagram-node-host';
@@ -42,6 +42,10 @@ export declare class DiagramNodeView<N extends DiagramNode = DiagramNode> {
42
42
  live: boolean;
43
43
  /** The part a press drags the node from, when the kind's content named one. */
44
44
  private handle;
45
+ /** The part that shows its text, when the kind's content named one (`context.textPart`). */
46
+ private textHolder;
47
+ /** The editor of its text, over the part that shows it, while the text is edited. */
48
+ private editor;
45
49
  /** What names it, when the kind's content gave it (`context.label`), and what stops the name following its data. */
46
50
  private naming;
47
51
  private stopNaming;
@@ -126,6 +130,20 @@ export declare class DiagramNodeView<N extends DiagramNode = DiagramNode> {
126
130
  * the rest drags the node (off a drag handle, it only selects).
127
131
  */
128
132
  private pressed;
133
+ /** Whether an event comes from a port, a resize handle or the editor of its text: none of them is the node's own. */
134
+ private fromHandle;
135
+ /** Whether an event came from the part that shows its text: anywhere on a node of a text, off its ports and handles. */
136
+ isTextEvent(e: Event): boolean;
137
+ /** The part its text is edited over: the one that shows it, else its content. */
138
+ private get textPlace();
139
+ /** Whether its text is being edited in place. */
140
+ get isEditing(): boolean;
141
+ /**
142
+ * Puts the editor of its text over the part that shows the text, as wide as it and no narrower than the editor's
143
+ * own smallest; `null` takes it away. The editor is placed with the window's next measuring round, when the node is
144
+ * laid out, and moves and zooms with the node.
145
+ */
146
+ holdEditor(editor: ComponentBase | null): void;
129
147
  /**
130
148
  * Whether an event comes from a control inside `from`: a part that takes focus, a control of the kit whose focus is a
131
149
  * part of its own (a field), or one that is off (a button that is off keeps the press too). A layout of the kit, such
@@ -2,10 +2,11 @@ import type { DiagramEdge } from './diagram-edge';
2
2
  import type { DiagramNode } from './diagram-node';
3
3
  /**
4
4
  * What a step of the history did: nodes moved or resized, a node collapsed, a connection made, moved or its line
5
- * reshaped, items deleted or pasted, the nodes laid out, or a change the app made (`Diagram.record`).
5
+ * reshaped, items deleted or pasted, the nodes laid out, a node's text edited in place, or a change the app made
6
+ * (`Diagram.record`).
6
7
  */
7
8
  export interface DiagramChange<N extends DiagramNode = DiagramNode, E extends DiagramEdge = DiagramEdge> {
8
- readonly kind: 'move' | 'resize' | 'collapse' | 'connect' | 'reconnect' | 'reshape' | 'delete' | 'paste' | 'layout' | 'edit';
9
+ readonly kind: 'move' | 'resize' | 'collapse' | 'connect' | 'reconnect' | 'reshape' | 'delete' | 'paste' | 'layout' | 'text' | 'edit';
9
10
  readonly nodes: readonly N[];
10
11
  readonly edges: readonly E[];
11
12
  }
@@ -0,0 +1,21 @@
1
+ import type { DiagramEdge } from './diagram-edge';
2
+ import type { DiagramPoint } from './diagram-point';
3
+ /**
4
+ * A connection clicked, double-clicked or asked for its context menu: with the pointer on its line or its labels, or
5
+ * with the keys on the connection under them (Alt+Enter stands for a double click; the Menu key or Shift+F10 for the
6
+ * context menu).
7
+ */
8
+ export interface DiagramEdgeClickEventArgs<E extends DiagramEdge = DiagramEdge> {
9
+ readonly edge: E;
10
+ /** The browser's event: the pointer's, or the key's. */
11
+ readonly event: MouseEvent | KeyboardEvent;
12
+ /** Whether a key asked for it. */
13
+ readonly byKeyboard: boolean;
14
+ /**
15
+ * Where it happened on the page, in pixels: the pointer, or the middle of the line for a key. A context menu opens
16
+ * there with `menu.open(e.at, diagram)`.
17
+ */
18
+ readonly at: DiagramPoint;
19
+ /** With `true`, the diagram skips its own response: a click does not select the connection, and the browser shows its own context menu. */
20
+ cancel: boolean;
21
+ }
@@ -0,0 +1,6 @@
1
+ import type { DiagramEdge } from './diagram-edge';
2
+ /** The pointer came over a connection or left it: its line, its marks and its labels alike. */
3
+ export interface DiagramEdgePointerEventArgs<E extends DiagramEdge = DiagramEdge> {
4
+ readonly edge: E;
5
+ readonly event: PointerEvent;
6
+ }
@@ -1,5 +1,6 @@
1
1
  import type { DiagramEdgePath } from './diagram-edge-path';
2
2
  import type { DiagramMarker } from './diagram-marker';
3
+ import type { DiagramNodeStatus } from './diagram-node-status';
3
4
  import type { DiagramPathEnds } from './diagram-path-ends';
4
5
  import type { DiagramPathResult } from './diagram-path-result';
5
6
  import type { DiagramPoint } from './diagram-point';
@@ -46,4 +47,11 @@ export interface DiagramEdge {
46
47
  selectable?: boolean;
47
48
  /** `false` keeps the user from deleting it. Default: `true`. */
48
49
  deletable?: boolean;
50
+ /**
51
+ * What the connection is doing as a run goes along it, as `Diagram.setEdgeStatus` writes it: the same statuses as a
52
+ * node's, drawn in the look's colors of them unless the connection has a `color` of its own.
53
+ */
54
+ status?: DiagramNodeStatus;
55
+ /** A short text with the status, such as how many rows went along: in the line's tip and said with it. */
56
+ statusText?: string;
49
57
  }
@@ -7,6 +7,7 @@ import type { DiagramEdgePath } from './diagram-edge-path';
7
7
  import type { DiagramEdgeReshapedEventArgs } from './diagram-edge-reshaped-event-args';
8
8
  import type { DiagramEdgeReshapingEventArgs } from './diagram-edge-reshaping-event-args';
9
9
  import type { DiagramNode } from './diagram-node';
10
+ import type { DiagramPointerAct } from './diagram-node-host';
10
11
  import type { DiagramNodeView } from './DiagramNodeView';
11
12
  import type { DiagramPoint } from './diagram-point';
12
13
  import type { DiagramReconnectedEventArgs } from './diagram-reconnected-event-args';
@@ -16,6 +17,8 @@ import type { DiagramViewport } from './diagram-viewport';
16
17
  export interface DiagramLinksHost<N extends DiagramNode = DiagramNode, E extends DiagramEdge = DiagramEdge> extends DiagramAutoPanHost {
17
18
  /** A click on a connection, which selects it. */
18
19
  edgeClicked(edge: E, e: MouseEvent): void;
20
+ /** What else the pointer did on a connection: a double click, a right click, or it came over the line or left it. */
21
+ edgeTold(what: Exclude<DiagramPointerAct, 'click'>, edge: E, e: MouseEvent): void;
19
22
  /** The connections: the array the diagram was given, which a new connection is added to. */
20
23
  edges(): E[];
21
24
  view(id: string): DiagramNodeView<N> | undefined;
@@ -0,0 +1,23 @@
1
+ import type { DiagramNode } from './diagram-node';
2
+ import type { DiagramPoint } from './diagram-point';
3
+ /**
4
+ * A node clicked, double-clicked or asked for its context menu: with the pointer, or with the keys on the node under
5
+ * them (Alt+Enter stands for a double click; the Menu key or Shift+F10 for the context menu).
6
+ */
7
+ export interface DiagramNodeClickEventArgs<N extends DiagramNode = DiagramNode> {
8
+ readonly node: N;
9
+ /** The browser's event: the pointer's, or the key's. */
10
+ readonly event: MouseEvent | KeyboardEvent;
11
+ /** Whether a key asked for it. */
12
+ readonly byKeyboard: boolean;
13
+ /**
14
+ * Where it happened on the page, in pixels: the pointer, or the middle of the node for a key. A context menu opens
15
+ * there with `menu.open(e.at, diagram)`.
16
+ */
17
+ readonly at: DiagramPoint;
18
+ /**
19
+ * With `true`, the diagram skips its own response: a double click does not edit the node's text, and the browser
20
+ * shows its own context menu. A click has none, as a press selects the node before it.
21
+ */
22
+ cancel: boolean;
23
+ }
@@ -23,4 +23,9 @@ export interface DiagramNodeContext<N extends DiagramNode = DiagramNode> {
23
23
  * and the diagram says it, in place of the node's `text`. For a name the user changes inside the content.
24
24
  */
25
25
  label(read: () => string): void;
26
+ /**
27
+ * Makes `part` the place that shows the node's `text`: an edit of the text in place (`textEditable`) opens over it,
28
+ * and a double click on it starts one. Without it, a kind with content of its own has its text edited over the node.
29
+ */
30
+ textPart(part: ComponentBase): void;
26
31
  }
@@ -20,4 +20,8 @@ export interface DiagramNodeHost<N extends DiagramNode = DiagramNode> {
20
20
  pressed(view: DiagramNodeView<N>, port: DiagramPort | null, e: PointerEvent, drags: boolean): void;
21
21
  /** A press on a resize handle of the node. */
22
22
  resizePressed(view: DiagramNodeView<N>, side: DiagramResizeSide, e: PointerEvent): void;
23
+ /** What the pointer did on the node, off its ports and handles: a click, a double click, a right click, or it came over the node or left it. */
24
+ told(what: DiagramPointerAct, view: DiagramNodeView<N>, e: MouseEvent): void;
23
25
  }
26
+ /** What the pointer did on a node or a connection. */
27
+ export type DiagramPointerAct = 'click' | 'dblclick' | 'contextmenu' | 'enter' | 'leave';
@@ -0,0 +1,6 @@
1
+ import type { DiagramNode } from './diagram-node';
2
+ /** The pointer came over a node or left it: over its content, its ports and its frame alike. */
3
+ export interface DiagramNodePointerEventArgs<N extends DiagramNode = DiagramNode> {
4
+ readonly node: N;
5
+ readonly event: PointerEvent;
6
+ }
@@ -6,6 +6,8 @@ import type { DiagramConnectingEventArgs } from './diagram-connecting-event-args
6
6
  import type { DiagramConnection } from './diagram-connection';
7
7
  import type { DiagramDeletedEventArgs } from './diagram-deleted-event-args';
8
8
  import type { DiagramDeletingEventArgs } from './diagram-deleting-event-args';
9
+ import type { DiagramEdgeClickEventArgs } from './diagram-edge-click-event-args';
10
+ import type { DiagramEdgePointerEventArgs } from './diagram-edge-pointer-event-args';
9
11
  import type { DiagramEdgeReshapedEventArgs } from './diagram-edge-reshaped-event-args';
10
12
  import type { DiagramEdgeReshapingEventArgs } from './diagram-edge-reshaping-event-args';
11
13
  import type { DiagramNodeToggledEventArgs } from './diagram-node-toggled-event-args';
@@ -13,7 +15,9 @@ import type { DiagramColumnCheckedEventArgs } from './diagram-column-checked-eve
13
15
  import type { DiagramHistoryChangedEventArgs } from './diagram-history-changed-event-args';
14
16
  import type { DiagramLayoutOptions } from './diagram-layout-options';
15
17
  import type { DiagramMiniMapOptions } from './diagram-mini-map-options';
18
+ import type { DiagramNodeClickEventArgs } from './diagram-node-click-event-args';
16
19
  import type { DiagramNodeKind } from './diagram-node-kind';
20
+ import type { DiagramNodePointerEventArgs } from './diagram-node-pointer-event-args';
17
21
  import type { DiagramNodeResizedEventArgs } from './diagram-node-resized-event-args';
18
22
  import type { DiagramNodeResizingEventArgs } from './diagram-node-resizing-event-args';
19
23
  import type { DiagramPastedEventArgs } from './diagram-pasted-event-args';
@@ -27,6 +31,9 @@ import type { DiagramNode } from './diagram-node';
27
31
  import type { DiagramReconnectedEventArgs } from './diagram-reconnected-event-args';
28
32
  import type { DiagramReconnectingEventArgs } from './diagram-reconnecting-event-args';
29
33
  import type { DiagramRect } from './diagram-rect';
34
+ import type { DiagramTextChangedEventArgs } from './diagram-text-changed-event-args';
35
+ import type { DiagramTextChangingEventArgs } from './diagram-text-changing-event-args';
36
+ import type { DiagramTextEditingEventArgs } from './diagram-text-editing-event-args';
30
37
  import type { DiagramViewport } from './diagram-viewport';
31
38
  import type { DiagramViewportChangedEventArgs } from './diagram-viewport-changed-event-args';
32
39
  /** Props of `Diagram`. Each prop is also a settable property, and a function is tracked, except the callbacks. */
@@ -69,6 +76,12 @@ export interface DiagramProps<N extends DiagramNode = DiagramNode, E extends Dia
69
76
  guides?: Bind<boolean>;
70
77
  /** Keeps the user's steps to undo and redo. Default: `true`. */
71
78
  history?: Bind<boolean>;
79
+ /**
80
+ * Whether the user edits a node's `text` in place: a double click on the text, F2 or the `rename` command on the node
81
+ * under the keys opens an editor over it; Enter or leaving it writes the text as a step of the history, Escape keeps
82
+ * the old one. `editText()` opens it in code. Default: `false`.
83
+ */
84
+ textEditable?: Bind<boolean>;
72
85
  /**
73
86
  * The component the diagram's commands are held to: their keys work while focus is inside it, and the toolbars and
74
87
  * menus inside it that name them run this diagram's. Give the editor that holds the diagram and its toolbar. Default:
@@ -154,6 +167,38 @@ export interface DiagramProps<N extends DiagramNode = DiagramNode, E extends Dia
154
167
  onPasted?: (e: DiagramPastedEventArgs<N, E>) => void;
155
168
  /** Occurs whenever the history changes: a step added, undone or redone, or the history cleared. */
156
169
  onHistoryChanged?: (e: DiagramHistoryChangedEventArgs<N, E>) => void;
170
+ /** Occurs when the user clicks a node; a press selects it before. Not after a drag. */
171
+ onNodeClick?: (e: DiagramNodeClickEventArgs<N>) => void;
172
+ /** Occurs when the user double-clicks a node, or presses Alt+Enter on the node under the keys; `cancel` keeps its text from being edited. */
173
+ onNodeDblClick?: (e: DiagramNodeClickEventArgs<N>) => void;
174
+ /**
175
+ * Occurs when the user right-clicks a node, or presses the Menu key or Shift+F10 on the node under the keys: open a
176
+ * menu at `at`. The browser's own menu does not open, unless `cancel`.
177
+ */
178
+ onNodeContextMenu?: (e: DiagramNodeClickEventArgs<N>) => void;
179
+ /** Occurs when the pointer comes over a node. */
180
+ onNodePointerEnter?: (e: DiagramNodePointerEventArgs<N>) => void;
181
+ /** Occurs when the pointer leaves a node. */
182
+ onNodePointerLeave?: (e: DiagramNodePointerEventArgs<N>) => void;
183
+ /** Occurs when the user clicks a connection, before it is selected; `cancel` leaves the selection as it is. */
184
+ onEdgeClick?: (e: DiagramEdgeClickEventArgs<E>) => void;
185
+ /** Occurs when the user double-clicks a connection, or presses Alt+Enter on the connection under the keys. */
186
+ onEdgeDblClick?: (e: DiagramEdgeClickEventArgs<E>) => void;
187
+ /**
188
+ * Occurs when the user right-clicks a connection, or presses the Menu key or Shift+F10 on the connection under the
189
+ * keys: open a menu at `at`. The browser's own menu does not open, unless `cancel`.
190
+ */
191
+ onEdgeContextMenu?: (e: DiagramEdgeClickEventArgs<E>) => void;
192
+ /** Occurs when the pointer comes over a connection. */
193
+ onEdgePointerEnter?: (e: DiagramEdgePointerEventArgs<E>) => void;
194
+ /** Occurs when the pointer leaves a connection. */
195
+ onEdgePointerLeave?: (e: DiagramEdgePointerEventArgs<E>) => void;
196
+ /** Occurs before the editor of a node's text opens (`textEditable`); `cancel` keeps it closed. */
197
+ onTextEditing?: (e: DiagramTextEditingEventArgs<N>) => void;
198
+ /** Occurs when an edit of a node's text ends with a new text, before it is written: change it, or `cancel` keeps the old one. */
199
+ onTextChanging?: (e: DiagramTextChangingEventArgs<N>) => void;
200
+ /** Occurs after an edit wrote a node's new text, as a step of the history. */
201
+ onTextChanged?: (e: DiagramTextChangedEventArgs<N>) => void;
157
202
  /** Occurs at most once a frame after nodes moved, changed their size, came, went or were hidden or shown, or the surface changed its size. */
158
203
  onContentChanged?: () => void;
159
204
  }
@@ -0,0 +1,7 @@
1
+ import type { DiagramNode } from './diagram-node';
2
+ /** A node's text was changed by an edit in place: its `text` holds the new one, a step of the history. */
3
+ export interface DiagramTextChangedEventArgs<N extends DiagramNode = DiagramNode> {
4
+ readonly node: N;
5
+ readonly text: string;
6
+ readonly previous: string;
7
+ }
@@ -0,0 +1,14 @@
1
+ import type { DiagramNode } from './diagram-node';
2
+ /**
3
+ * The user ended an edit of a node's text with a text other than its own: change the text written, or cancel to keep
4
+ * the old one, such as for a name already taken. The editor closes either way.
5
+ */
6
+ export interface DiagramTextChangingEventArgs<N extends DiagramNode = DiagramNode> {
7
+ readonly node: N;
8
+ /** The text to write to the node's `text`. */
9
+ text: string;
10
+ /** The node's text now. */
11
+ readonly previous: string;
12
+ /** With `true`, the node keeps its text. */
13
+ cancel: boolean;
14
+ }
@@ -0,0 +1,11 @@
1
+ import type { DiagramNode } from './diagram-node';
2
+ /** The user is about to edit a node's text in place: change the text the editor starts with, or cancel the edit. */
3
+ export interface DiagramTextEditingEventArgs<N extends DiagramNode = DiagramNode> {
4
+ readonly node: N;
5
+ /** The text the editor starts with: the node's `text`. */
6
+ text: string;
7
+ /** Whether a key started it (F2, or the `rename` command), not a double click. */
8
+ readonly byKeyboard: boolean;
9
+ /** With `true`, the editor does not open. */
10
+ cancel: boolean;
11
+ }
@@ -57,6 +57,13 @@ export type { DiagramClassNode } from './diagram-class-node';
57
57
  export type { DiagramClassMember } from './diagram-class-member';
58
58
  export type { DiagramEdgeReshapingEventArgs } from './diagram-edge-reshaping-event-args';
59
59
  export type { DiagramEdgeReshapedEventArgs } from './diagram-edge-reshaped-event-args';
60
+ export type { DiagramNodeClickEventArgs } from './diagram-node-click-event-args';
61
+ export type { DiagramNodePointerEventArgs } from './diagram-node-pointer-event-args';
62
+ export type { DiagramEdgeClickEventArgs } from './diagram-edge-click-event-args';
63
+ export type { DiagramEdgePointerEventArgs } from './diagram-edge-pointer-event-args';
64
+ export type { DiagramTextEditingEventArgs } from './diagram-text-editing-event-args';
65
+ export type { DiagramTextChangingEventArgs } from './diagram-text-changing-event-args';
66
+ export type { DiagramTextChangedEventArgs } from './diagram-text-changed-event-args';
60
67
  export type { DiagramLayoutOptions } from './diagram-layout-options';
61
68
  export type { DiagramLayoutType } from './diagram-layout-type';
62
69
  export type { DiagramLayoutDirection } from './diagram-layout-direction';
@@ -1061,6 +1061,11 @@ export interface UiStrings {
1061
1061
  diagramStatusWaiting: string;
1062
1062
  diagramStatusSkipped: string;
1063
1063
  diagramStatusSaid: string;
1064
+ /** A connection without a label, as its status is said (`{source}`, `{target}`: its nodes' names). */
1065
+ diagramEdgeName: string;
1066
+ /** The command that edits a node's text in place, and the accessible name of its editor (`{name}`: the node's). */
1067
+ diagramRename: string;
1068
+ diagramTextEditor: string;
1064
1069
  /** ExpressionEditor: the name of its list of words for the caret. */
1065
1070
  expressionEditorSuggestions: string;
1066
1071
  /** ExpressionEditor: the problems of an expression, by their code (`{name}`, `{expected}` … are filled in). */