@motifx-community/ui 0.1.0-beta.14 → 0.1.0-beta.16
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.
- package/CHANGELOG.md +113 -0
- package/README.md +2 -2
- package/dist/components/diagram/Diagram.d.ts +607 -0
- package/dist/components/diagram/DiagramAutoPan.d.ts +17 -0
- package/dist/components/diagram/DiagramBends.d.ts +70 -0
- package/dist/components/diagram/DiagramDragging.d.ts +66 -0
- package/dist/components/diagram/DiagramEdgeView.d.ts +78 -0
- package/dist/components/diagram/DiagramGrid.d.ts +13 -0
- package/dist/components/diagram/DiagramHistory.d.ts +16 -0
- package/dist/components/diagram/DiagramLinks.d.ts +177 -0
- package/dist/components/diagram/DiagramMap.d.ts +62 -0
- package/dist/components/diagram/DiagramNodeView.d.ts +143 -0
- package/dist/components/diagram/DiagramOverview.d.ts +20 -0
- package/dist/components/diagram/DiagramPanning.d.ts +34 -0
- package/dist/components/diagram/diagram-alignment.d.ts +2 -0
- package/dist/components/diagram/diagram-auto-pan-host.d.ts +8 -0
- package/dist/components/diagram/diagram-background.d.ts +2 -0
- package/dist/components/diagram/diagram-bends-host.d.ts +17 -0
- package/dist/components/diagram/diagram-card-kind.d.ts +42 -0
- package/dist/components/diagram/diagram-card-node.d.ts +11 -0
- package/dist/components/diagram/diagram-center-options.d.ts +6 -0
- package/dist/components/diagram/diagram-change.d.ts +11 -0
- package/dist/components/diagram/diagram-class-member.d.ts +13 -0
- package/dist/components/diagram/diagram-class-node.d.ts +12 -0
- package/dist/components/diagram/diagram-column-checked-event-args.d.ts +9 -0
- package/dist/components/diagram/diagram-connected-event-args.d.ts +6 -0
- package/dist/components/diagram/diagram-connecting-event-args.d.ts +9 -0
- package/dist/components/diagram/diagram-connection.d.ts +7 -0
- package/dist/components/diagram/diagram-data.d.ts +12 -0
- package/dist/components/diagram/diagram-deleted-event-args.d.ts +8 -0
- package/dist/components/diagram/diagram-deleting-event-args.d.ts +9 -0
- package/dist/components/diagram/diagram-dragging-host.d.ts +47 -0
- package/dist/components/diagram/diagram-drawn-node.d.ts +10 -0
- package/dist/components/diagram/diagram-edge-end.d.ts +2 -0
- package/dist/components/diagram/diagram-edge-path.d.ts +5 -0
- package/dist/components/diagram/diagram-edge-reshaped-event-args.d.ts +8 -0
- package/dist/components/diagram/diagram-edge-reshaping-event-args.d.ts +6 -0
- package/dist/components/diagram/diagram-edge.d.ts +49 -0
- package/dist/components/diagram/diagram-edit.d.ts +10 -0
- package/dist/components/diagram/diagram-export-options.d.ts +14 -0
- package/dist/components/diagram/diagram-export.d.ts +28 -0
- package/dist/components/diagram/diagram-fit-options.d.ts +12 -0
- package/dist/components/diagram/diagram-history-changed-event-args.d.ts +14 -0
- package/dist/components/diagram/diagram-history-step.d.ts +9 -0
- package/dist/components/diagram/diagram-kinds.d.ts +9 -0
- package/dist/components/diagram/diagram-layered.d.ts +39 -0
- package/dist/components/diagram/diagram-layout-direction.d.ts +2 -0
- package/dist/components/diagram/diagram-layout-options.d.ts +24 -0
- package/dist/components/diagram/diagram-layout-type.d.ts +5 -0
- package/dist/components/diagram/diagram-layout.d.ts +33 -0
- package/dist/components/diagram/diagram-line-look.d.ts +6 -0
- package/dist/components/diagram/diagram-line.d.ts +11 -0
- package/dist/components/diagram/diagram-links-host.d.ts +45 -0
- package/dist/components/diagram/diagram-links-options.d.ts +7 -0
- package/dist/components/diagram/diagram-map-props.d.ts +10 -0
- package/dist/components/diagram/diagram-map-target.d.ts +27 -0
- package/dist/components/diagram/diagram-marker.d.ts +6 -0
- package/dist/components/diagram/diagram-mini-map-options.d.ts +13 -0
- package/dist/components/diagram/diagram-mini-map-position.d.ts +2 -0
- package/dist/components/diagram/diagram-node-context.d.ts +26 -0
- package/dist/components/diagram/diagram-node-host.d.ts +23 -0
- package/dist/components/diagram/diagram-node-kind.d.ts +43 -0
- package/dist/components/diagram/diagram-node-move.d.ts +11 -0
- package/dist/components/diagram/diagram-node-resized-event-args.d.ts +8 -0
- package/dist/components/diagram/diagram-node-resizing-event-args.d.ts +6 -0
- package/dist/components/diagram/diagram-node-size.d.ts +8 -0
- package/dist/components/diagram/diagram-node-status.d.ts +2 -0
- package/dist/components/diagram/diagram-node-toggled-event-args.d.ts +7 -0
- package/dist/components/diagram/diagram-node.d.ts +56 -0
- package/dist/components/diagram/diagram-nodes-moved-event-args.d.ts +6 -0
- package/dist/components/diagram/diagram-nodes-moving-event-args.d.ts +6 -0
- package/dist/components/diagram/diagram-panning-host.d.ts +19 -0
- package/dist/components/diagram/diagram-pasted-event-args.d.ts +7 -0
- package/dist/components/diagram/diagram-pasting-event-args.d.ts +11 -0
- package/dist/components/diagram/diagram-path-ends.d.ts +11 -0
- package/dist/components/diagram/diagram-path-result.d.ts +6 -0
- package/dist/components/diagram/diagram-paths.d.ts +35 -0
- package/dist/components/diagram/diagram-point.d.ts +5 -0
- package/dist/components/diagram/diagram-port-place.d.ts +9 -0
- package/dist/components/diagram/diagram-port.d.ts +27 -0
- package/dist/components/diagram/diagram-props.d.ts +159 -0
- package/dist/components/diagram/diagram-reconnected-event-args.d.ts +10 -0
- package/dist/components/diagram/diagram-reconnecting-event-args.d.ts +11 -0
- package/dist/components/diagram/diagram-rect.d.ts +7 -0
- package/dist/components/diagram/diagram-resize-side.d.ts +2 -0
- package/dist/components/diagram/diagram-route.d.ts +10 -0
- package/dist/components/diagram/diagram-selection-changed-event-args.d.ts +9 -0
- package/dist/components/diagram/diagram-selection.d.ts +5 -0
- package/dist/components/diagram/diagram-side.d.ts +2 -0
- package/dist/components/diagram/diagram-table-column.d.ts +13 -0
- package/dist/components/diagram/diagram-table-node.d.ts +12 -0
- package/dist/components/diagram/diagram-tree.d.ts +14 -0
- package/dist/components/diagram/diagram-viewport-changed-event-args.d.ts +8 -0
- package/dist/components/diagram/diagram-viewport-options.d.ts +5 -0
- package/dist/components/diagram/diagram-viewport.d.ts +6 -0
- package/dist/components/diagram/index.d.ts +65 -0
- package/dist/components/diagram/swallow-next-click.d.ts +5 -0
- package/dist/components/expressioneditor/ExpressionEditor.d.ts +111 -0
- package/dist/components/expressioneditor/expression-editor-props.d.ts +24 -0
- package/dist/components/expressioneditor/index.d.ts +2 -0
- package/dist/components/formlayout/FormLayout.d.ts +10 -3
- package/dist/components/formlayout/form-editor-type.d.ts +1 -1
- package/dist/components/formlayout/form-item.d.ts +4 -1
- package/dist/components/formlayout/form-layout-props.d.ts +1 -1
- package/dist/components/formlayout/index.d.ts +1 -0
- package/dist/components/formlayout/schema-items.d.ts +26 -0
- package/dist/components/pivotgrid/model/PivotAxisWindow.d.ts +53 -1
- package/dist/components/pivotgrid/model/PivotCellWindow.d.ts +2 -0
- package/dist/components/pivotgrid/model/PivotWindows.d.ts +3 -6
- package/dist/components/toolbar/Toolbar.d.ts +5 -3
- package/dist/core/control.d.ts +2 -0
- package/dist/core/keyboard.d.ts +5 -0
- package/dist/core/measure/index.d.ts +2 -0
- package/dist/core/measure/picture.d.ts +27 -0
- package/dist/core/shortcut-options.d.ts +5 -2
- package/dist/core/ui-strings.d.ts +191 -0
- package/dist/generated/tokens.d.ts +1615 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11501 -705
- package/dist/index.js.map +1 -1
- package/dist/locales/en.json +180 -1
- package/dist/locales/tr.json +180 -1
- package/dist/styles.css +2262 -3
- package/dist/tokens/index.d.ts +1615 -0
- package/dist/tokens/index.js +1615 -0
- package/dist/tokens/index.js.map +1 -1
- package/dist/{tr-BGbF9uCs.js → tr-4GNbFdQh.js} +361 -3
- package/dist/{tr-BGbF9uCs.js.map → tr-4GNbFdQh.js.map} +1 -1
- package/docs/accordion.md +1 -1
- package/docs/actionsheet.md +1 -1
- package/docs/appbar.md +1 -1
- package/docs/appmenu-api.md +1 -1
- package/docs/appmenu-programmatic.md +1 -1
- package/docs/appmenu-search.md +1 -1
- package/docs/appmenu.md +1 -1
- package/docs/avatar.md +1 -1
- package/docs/badge.md +1 -1
- package/docs/bar-gauge-angles.md +1 -1
- package/docs/bar-gauge-data.md +1 -1
- package/docs/bar-gauge-labels.md +1 -1
- package/docs/bar-gauge.md +1 -1
- package/docs/barcode.md +1 -1
- package/docs/bottomnavigation.md +1 -1
- package/docs/bottomsheet.md +1 -1
- package/docs/breadcrumb.md +1 -1
- package/docs/button.md +1 -1
- package/docs/buttongroup.md +1 -1
- package/docs/buttons.md +1 -1
- package/docs/calendar.md +1 -1
- package/docs/card.md +1 -1
- package/docs/chart-bars.md +1 -1
- package/docs/chart-candles.md +1 -1
- package/docs/chart-funnel.md +1 -1
- package/docs/chart-heatmap.md +1 -1
- package/docs/chart-lines.md +1 -1
- package/docs/chart-live.md +1 -1
- package/docs/chart-pie.md +1 -1
- package/docs/chart-radar.md +1 -1
- package/docs/chart-ranges.md +1 -1
- package/docs/chart-references.md +1 -1
- package/docs/chart-scatter.md +1 -1
- package/docs/chart-waterfall.md +1 -1
- package/docs/chart-zoom.md +1 -1
- package/docs/chart.md +1 -1
- package/docs/chat.md +1 -1
- package/docs/checkbox.md +1 -1
- package/docs/chip.md +1 -1
- package/docs/choice.md +1 -1
- package/docs/colorbox.md +1 -1
- package/docs/combobox.md +1 -1
- package/docs/commands.md +1 -1
- package/docs/control.md +1 -1
- package/docs/data.md +2 -2
- package/docs/datagrid-api.md +1 -1
- package/docs/datagrid-bands.md +1 -1
- package/docs/datagrid-drag-select.md +1 -1
- package/docs/datagrid-drag.md +1 -1
- package/docs/datagrid-editing.md +1 -1
- package/docs/datagrid-filtering.md +1 -1
- package/docs/datagrid-forms.md +1 -1
- package/docs/datagrid-grouping.md +1 -1
- package/docs/datagrid-layout.md +1 -1
- package/docs/datagrid-lookups.md +1 -1
- package/docs/datagrid-master-detail.md +1 -1
- package/docs/datagrid-scrolling.md +1 -1
- package/docs/datagrid-selection.md +1 -1
- package/docs/datagrid.md +1 -1
- package/docs/datalayer-api.md +491 -0
- package/docs/datalayer-changes.md +501 -0
- package/docs/datalayer-odata.md +998 -0
- package/docs/datalayer-pivot.md +850 -0
- package/docs/datalayer-queries.md +516 -0
- package/docs/datalayer-rest.md +529 -0
- package/docs/datalayer-soap.md +576 -0
- package/docs/datalayer-source.md +464 -0
- package/docs/datalayer.md +264 -0
- package/docs/datebox.md +1 -1
- package/docs/daterangebox.md +1 -1
- package/docs/diagram-api.md +200 -0
- package/docs/diagram-commands.md +79 -0
- package/docs/diagram-connections.md +157 -0
- package/docs/diagram-custom-nodes.md +325 -0
- package/docs/diagram-designer.md +816 -0
- package/docs/diagram-editing.md +62 -0
- package/docs/diagram-flow.md +157 -0
- package/docs/diagram-keyboard.md +58 -0
- package/docs/diagram-layout.md +354 -0
- package/docs/diagram-nodes.md +206 -0
- package/docs/diagram-tables.md +212 -0
- package/docs/diagram.md +217 -0
- package/docs/display.md +1 -1
- package/docs/draggable.md +1 -1
- package/docs/drawer.md +1 -1
- package/docs/dropdown.md +1 -1
- package/docs/editors.md +1 -1
- package/docs/expressioneditor.md +469 -0
- package/docs/expressions.md +431 -0
- package/docs/feedback.md +1 -1
- package/docs/fileuploader.md +1 -1
- package/docs/filterbuilder.md +1 -1
- package/docs/formlayout-schema.md +143 -0
- package/docs/formlayout.md +16 -4
- package/docs/foundations.md +1 -1
- package/docs/gallery.md +1 -1
- package/docs/gauge-base.md +1 -1
- package/docs/gauge-circular.md +1 -1
- package/docs/gauge-dashboards.md +1 -1
- package/docs/gauge-linear.md +1 -1
- package/docs/gauge-markers.md +1 -1
- package/docs/gauge-marks.md +1 -1
- package/docs/gauge-ranges.md +1 -1
- package/docs/gauge-scales.md +1 -1
- package/docs/gauge.md +1 -1
- package/docs/home.md +1 -1
- package/docs/keyboard.md +2 -2
- package/docs/language.md +1 -1
- package/docs/layout.md +1 -1
- package/docs/listbox.md +1 -1
- package/docs/loadpanel.md +1 -1
- package/docs/lookup.md +1 -1
- package/docs/markdown.md +1 -1
- package/docs/menus-api.md +1 -1
- package/docs/menus-context.md +1 -1
- package/docs/menus-customization.md +1 -1
- package/docs/menus-merging.md +1 -1
- package/docs/menus-programmatic.md +1 -1
- package/docs/menus.md +1 -1
- package/docs/multiview.md +1 -1
- package/docs/navigation.md +1 -1
- package/docs/numberbox.md +1 -1
- package/docs/otpinput.md +1 -1
- package/docs/pagination.md +1 -1
- package/docs/pivotgrid-api.md +1 -1
- package/docs/pivotgrid-chart.md +1 -1
- package/docs/pivotgrid-drilldown.md +1 -1
- package/docs/pivotgrid-export.md +1 -1
- package/docs/pivotgrid-fields.md +1 -1
- package/docs/pivotgrid-keyboard.md +1 -1
- package/docs/pivotgrid-layout.md +1 -1
- package/docs/pivotgrid-panel.md +1 -1
- package/docs/pivotgrid-remote.md +122 -44
- package/docs/pivotgrid-sorting.md +3 -3
- package/docs/pivotgrid-state.md +1 -1
- package/docs/pivotgrid-summaries.md +1 -1
- package/docs/pivotgrid.md +1 -1
- package/docs/popover.md +1 -1
- package/docs/progress.md +1 -1
- package/docs/qrcode.md +1 -1
- package/docs/radiogroup.md +1 -1
- package/docs/rating.md +1 -1
- package/docs/resizable.md +1 -1
- package/docs/ribbonmenu-api.md +1 -1
- package/docs/ribbonmenu-commands.md +1 -1
- package/docs/ribbonmenu-customization.md +1 -1
- package/docs/ribbonmenu-display.md +1 -1
- package/docs/ribbonmenu-layouts.md +1 -1
- package/docs/ribbonmenu-programmatic.md +1 -1
- package/docs/ribbonmenu.md +1 -1
- package/docs/scheduler-agenda.md +1 -1
- package/docs/scheduler-big-data.md +1 -1
- package/docs/scheduler-editing.md +1 -1
- package/docs/scheduler-form.md +1 -1
- package/docs/scheduler-icalendar.md +1 -1
- package/docs/scheduler-mobile.md +1 -1
- package/docs/scheduler-recurrence.md +1 -1
- package/docs/scheduler-resources.md +1 -1
- package/docs/scheduler-timeline.md +1 -1
- package/docs/scheduler.md +1 -1
- package/docs/scrollview.md +1 -1
- package/docs/shortcuteditor.md +1 -1
- package/docs/showcase-flowstudio.md +61 -0
- package/docs/showcase-home.md +1 -1
- package/docs/showcase-mail.md +1 -1
- package/docs/showcase.md +1 -1
- package/docs/signature.md +1 -1
- package/docs/skeleton.md +1 -1
- package/docs/slider.md +1 -1
- package/docs/sortable.md +1 -1
- package/docs/sparkline.md +1 -1
- package/docs/speeddial.md +1 -1
- package/docs/splitter.md +1 -1
- package/docs/stepper.md +1 -1
- package/docs/switch.md +1 -1
- package/docs/tabdocs-dock.md +1 -1
- package/docs/tabdocs-drag.md +1 -1
- package/docs/tabdocs-menus.md +1 -1
- package/docs/tabdocs-mobile.md +1 -1
- package/docs/tabdocs-tabs.md +1 -1
- package/docs/tabdocs-windows.md +1 -1
- package/docs/tabdocs-workspace.md +1 -1
- package/docs/tabdocs.md +1 -1
- package/docs/tabs.md +1 -1
- package/docs/tagbox.md +1 -1
- package/docs/textarea.md +1 -1
- package/docs/textbox.md +1 -1
- package/docs/tileview.md +1 -1
- package/docs/timeline.md +1 -1
- package/docs/toast.md +1 -1
- package/docs/tokens.md +324 -1
- package/docs/toolbar-api.md +1 -1
- package/docs/toolbar-customization.md +1 -1
- package/docs/toolbar.md +1 -1
- package/docs/tooltip.md +1 -1
- package/docs/treeview.md +1 -1
- package/docs/validationsummary.md +1 -1
- package/docs/window.md +1 -1
- package/docs/wizard.md +1 -1
- package/llms-full.txt +10142 -462
- package/llms.txt +32 -1
- package/package.json +2 -2
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { ComponentBase } from '@motifx/core';
|
|
2
|
+
import type { DiagramBendsHost } from './diagram-bends-host';
|
|
3
|
+
import type { DiagramEdge } from './diagram-edge';
|
|
4
|
+
import type { DiagramPoint } from './diagram-point';
|
|
5
|
+
import type { DiagramEdgeView } from './DiagramEdgeView';
|
|
6
|
+
/**
|
|
7
|
+
* The points of the selected lines: a handle on each point of a line's own, which a drag moves and a double click
|
|
8
|
+
* takes away, one in the middle of each run, which a drag adds a point at; on a right-angled line one in the middle of
|
|
9
|
+
* each run between its turns, which a drag moves sideways, the line keeping the turns it has then, and a double click
|
|
10
|
+
* gives back to its own way. The keys move the same points and runs, add points and take them away. Each change is
|
|
11
|
+
* told before (it may be cancelled) and after.
|
|
12
|
+
*/
|
|
13
|
+
export declare class DiagramBends<E extends DiagramEdge = DiagramEdge> {
|
|
14
|
+
private readonly surface;
|
|
15
|
+
private readonly layer;
|
|
16
|
+
private readonly host;
|
|
17
|
+
private readonly autoPan;
|
|
18
|
+
/** The handles of each line that shows them, by its `id`, and what each stands for. */
|
|
19
|
+
private readonly handles;
|
|
20
|
+
/** The drag under way: the line, the handle, the pointer's way, its points and corners as it began. */
|
|
21
|
+
private session;
|
|
22
|
+
private stops;
|
|
23
|
+
/** The place of a line the keys are on (see `places`): its line's `id` and its order there. */
|
|
24
|
+
private keyed;
|
|
25
|
+
constructor(surface: ComponentBase, layer: ComponentBase, host: DiagramBendsHost<E>);
|
|
26
|
+
/** Whether a point is being dragged. */
|
|
27
|
+
get busy(): boolean;
|
|
28
|
+
/** Draws the handles of `views`, the selected lines that may be reshaped, a size on the screen at any zoom; other lines lose theirs. */
|
|
29
|
+
draw(views: readonly DiagramEdgeView<E>[], zoom: number): void;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Where the places of a line the keys go through stand, in their order along it: its points of its own, or the runs
|
|
33
|
+
* of a right-angled line, which move sideways; none for a line of the app's own.
|
|
34
|
+
*/
|
|
35
|
+
places(view: DiagramEdgeView<E>): DiagramPoint[];
|
|
36
|
+
/** Marks the place `index` of a line as the one the keys are on; with no line, none. */
|
|
37
|
+
showKey(view: DiagramEdgeView<E> | null, index?: number): void;
|
|
38
|
+
/**
|
|
39
|
+
* Moves the place `index` of a line by `dx`, `dy`: a point of its own, or a run of a right-angled line sideways, the
|
|
40
|
+
* line keeping the turns it has then. Returns whether it moved.
|
|
41
|
+
*/
|
|
42
|
+
nudge(view: DiagramEdgeView<E>, index: number, dx: number, dy: number): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Adds a point to a line after its point `index` (`-1`, before the first), halfway along the run there; a right-angled
|
|
45
|
+
* line takes none. Returns the new point's place among the line's points, or `-1`.
|
|
46
|
+
*/
|
|
47
|
+
add(view: DiagramEdgeView<E>, index: number): number;
|
|
48
|
+
/**
|
|
49
|
+
* Takes away the place `index` of a line: a point of its own, or, on a right-angled line, the turns it keeps, so that
|
|
50
|
+
* it goes its own way again. Returns whether it did.
|
|
51
|
+
*/
|
|
52
|
+
remove(view: DiagramEdgeView<E>, index: number): boolean;
|
|
53
|
+
/** The handles a line shows: none for a line of the app's own. */
|
|
54
|
+
private bendsOf;
|
|
55
|
+
private handle;
|
|
56
|
+
private pressed;
|
|
57
|
+
/** The pointer moved: the point follows it, or the run moves sideways with it, snapped to the grid when asked. */
|
|
58
|
+
private follow;
|
|
59
|
+
private released;
|
|
60
|
+
/** A double click takes a point away, or gives a right-angled line back to its own way. */
|
|
61
|
+
private doubled;
|
|
62
|
+
/** Gives a line other points at once, told before (it may be cancelled) and after; not while a point is dragged. */
|
|
63
|
+
private change;
|
|
64
|
+
/** Writes a line's points, none for an empty list or `undefined`, and draws it again. */
|
|
65
|
+
private setPoints;
|
|
66
|
+
private end;
|
|
67
|
+
private snap;
|
|
68
|
+
/** The point of the diagram under a point of the page, the view as it is now. */
|
|
69
|
+
private pointAt;
|
|
70
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ComponentBase } from '@motifx/core';
|
|
2
|
+
import type { DiagramDraggingHost } from './diagram-dragging-host';
|
|
3
|
+
import type { DiagramNode } from './diagram-node';
|
|
4
|
+
import type { DiagramResizeSide } from './diagram-resize-side';
|
|
5
|
+
import type { DiagramNodeView } from './DiagramNodeView';
|
|
6
|
+
/**
|
|
7
|
+
* The user moving nodes and selecting them: a drag of a node moves it with the other selected nodes, snapped to the
|
|
8
|
+
* grid when asked; a click selects, Shift or Ctrl adds or takes away; Shift and a drag of the surface selects the nodes
|
|
9
|
+
* inside a rectangle. Escape puts the dragged nodes back. Near an edge the view pans and the drag goes on.
|
|
10
|
+
*/
|
|
11
|
+
export declare class DiagramDragging<N extends DiagramNode = DiagramNode> {
|
|
12
|
+
private readonly surface;
|
|
13
|
+
private readonly host;
|
|
14
|
+
private readonly autoPan;
|
|
15
|
+
private readonly box;
|
|
16
|
+
/**
|
|
17
|
+
* The node drag under way: the node pressed, whether the press may drag it (off a drag handle it only selects), the
|
|
18
|
+
* nodes moved with where they started (the nodes of a moved group with it), the group a drop would take them into.
|
|
19
|
+
*/
|
|
20
|
+
private drag;
|
|
21
|
+
/** The resize under way: the node, the handle, its place and size as it began (and the size it gave), and the pointer's way. */
|
|
22
|
+
private resize;
|
|
23
|
+
/** The rectangle being dragged: where it began in the diagram, and the selection it adds to. */
|
|
24
|
+
private marquee;
|
|
25
|
+
private stops;
|
|
26
|
+
constructor(surface: ComponentBase, host: DiagramDraggingHost<N>);
|
|
27
|
+
/** Whether a drag, a resize or a rectangle is under way. */
|
|
28
|
+
get busy(): boolean;
|
|
29
|
+
/** A press on a node, not on one of its ports: a drag moves it (where `drags`), a click selects it. */
|
|
30
|
+
nodePressed(view: DiagramNodeView<N>, e: PointerEvent, drags?: boolean): void;
|
|
31
|
+
/** A press on a resize handle of a selected node: a drag resizes it from that side or corner. */
|
|
32
|
+
resizePressed(view: DiagramNodeView<N>, side: DiagramResizeSide, e: PointerEvent): void;
|
|
33
|
+
/** A press on the empty surface: with Shift it drags a rectangle that selects; returns whether it took the press. */
|
|
34
|
+
surfacePressed(e: PointerEvent): boolean;
|
|
35
|
+
dispose(): void;
|
|
36
|
+
private listen;
|
|
37
|
+
private pointerMove;
|
|
38
|
+
/**
|
|
39
|
+
* The drag begins: a node not selected becomes the selection (or joins it with Shift or Ctrl); the movable ones of the
|
|
40
|
+
* selection go, and the nodes of a moving group go with it.
|
|
41
|
+
*/
|
|
42
|
+
private startDrag;
|
|
43
|
+
private followDrag;
|
|
44
|
+
/**
|
|
45
|
+
* The node resized from its handle: the sides the handle moves follow the pointer, held to the node's smallest size
|
|
46
|
+
* and snapped to the grid when asked; the other sides stay.
|
|
47
|
+
*/
|
|
48
|
+
private followResize;
|
|
49
|
+
/**
|
|
50
|
+
* Lines the leading node up, at `x`, `y`, with the nodes that stay: the nearest of its left, middle and right to one of
|
|
51
|
+
* theirs within reach, and the same from top to bottom. Returns the shift that lines it up and the guides to draw.
|
|
52
|
+
*/
|
|
53
|
+
private lineUp;
|
|
54
|
+
private followMarquee;
|
|
55
|
+
private pointerUp;
|
|
56
|
+
/**
|
|
57
|
+
* The moves of a drop: each node where it went, and a node whose group did not move with it into the group it was
|
|
58
|
+
* dropped over, or out of its group onto the surface.
|
|
59
|
+
*/
|
|
60
|
+
private dropped;
|
|
61
|
+
/** Ends the drag, the resize or the rectangle; `undo` puts dragged or resized nodes back and the selection a rectangle changed. */
|
|
62
|
+
private end;
|
|
63
|
+
private place;
|
|
64
|
+
private selectNode;
|
|
65
|
+
private pointAt;
|
|
66
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Component, ComponentBase } from '@motifx/core';
|
|
2
|
+
import type { DiagramEdge } from './diagram-edge';
|
|
3
|
+
import type { DiagramLineLook } from './diagram-line-look';
|
|
4
|
+
import type { DiagramPoint } from './diagram-point';
|
|
5
|
+
import type { DiagramRect } from './diagram-rect';
|
|
6
|
+
import type { DiagramSide } from './diagram-side';
|
|
7
|
+
/**
|
|
8
|
+
* A connection on the surface: its line, the wider line the pointer finds it by, the marks at its ends and its label.
|
|
9
|
+
* 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
|
|
10
|
+
* (a line out of view in a large diagram).
|
|
11
|
+
*/
|
|
12
|
+
export declare class DiagramEdgeView<E extends DiagramEdge = DiagramEdge> {
|
|
13
|
+
private readonly edges;
|
|
14
|
+
private readonly labels;
|
|
15
|
+
private readonly told;
|
|
16
|
+
private parts;
|
|
17
|
+
/** The line as last worked out, written to its parts while it is shown. */
|
|
18
|
+
private drawn;
|
|
19
|
+
private selected;
|
|
20
|
+
private moving;
|
|
21
|
+
private label;
|
|
22
|
+
/** The texts at its ends. */
|
|
23
|
+
private endLabels;
|
|
24
|
+
/** The app's classes and style properties written last, so those it takes away are taken off. */
|
|
25
|
+
private drawnClasses;
|
|
26
|
+
private drawnStyle;
|
|
27
|
+
edge: E;
|
|
28
|
+
/** Where its ends stood when it was last drawn, on the nodes, with the sides they leave by; `null` while it is not drawn. */
|
|
29
|
+
ends: {
|
|
30
|
+
source: DiagramPoint;
|
|
31
|
+
sourceSide: DiagramSide;
|
|
32
|
+
target: DiagramPoint;
|
|
33
|
+
targetSide: DiagramSide;
|
|
34
|
+
} | null;
|
|
35
|
+
/** The points the line ran through when it was last drawn: its ends and corners (a curve's own points), and the shape it was drawn with. */
|
|
36
|
+
corners: DiagramPoint[];
|
|
37
|
+
shape: NonNullable<DiagramEdge['path']>;
|
|
38
|
+
/** Around the line, its marks and its labels as last worked out, in the diagram's units; `null` while it is not drawn. */
|
|
39
|
+
bounds: DiagramRect | null;
|
|
40
|
+
/** Whether it is on the page: it lies in view, or the diagram shows every line. */
|
|
41
|
+
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
|
+
});
|
|
46
|
+
/** The group of its parts; `null` until it is first shown. */
|
|
47
|
+
get group(): Component<SVGGElement> | null;
|
|
48
|
+
/** Puts it on the page or takes it off: its parts are made the first time. Returns whether they were made now. */
|
|
49
|
+
setLive(on: boolean): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Draws the line between two points on their nodes, each with the side it leaves by, through the connection's own
|
|
52
|
+
* points; an orthogonal line goes around `obstacles`, the nodes.
|
|
53
|
+
*/
|
|
54
|
+
draw(source: DiagramPoint, sourceSide: DiagramSide, target: DiagramPoint, targetSide: DiagramSide, shape: NonNullable<DiagramEdge['path']>, look: DiagramLineLook, obstacles: readonly DiagramRect[]): void;
|
|
55
|
+
/** Writes the line as last worked out to its parts, made now if it has none. */
|
|
56
|
+
private write;
|
|
57
|
+
private make;
|
|
58
|
+
/** Not drawn: one of its nodes is missing or not laid out yet. */
|
|
59
|
+
hide(): void;
|
|
60
|
+
/** What an image of the diagram draws of it: its line and marks, and its labels; `null` while it is not drawn or not on the page. */
|
|
61
|
+
get picture(): {
|
|
62
|
+
marks: ComponentBase[];
|
|
63
|
+
labels: ComponentBase[];
|
|
64
|
+
} | null;
|
|
65
|
+
/** Marks it while one of its ends is being moved. */
|
|
66
|
+
markMoving(on: boolean): void;
|
|
67
|
+
markSelected(on: boolean): void;
|
|
68
|
+
/** The app's color, width, classes and style properties; those it took away since the last draw come off. */
|
|
69
|
+
private drawLook;
|
|
70
|
+
remove(): void;
|
|
71
|
+
private drawMark;
|
|
72
|
+
private drawLabel;
|
|
73
|
+
/**
|
|
74
|
+
* The text at an end: by the node, on the side of the line away from its mark's toes; above a line that leaves by a
|
|
75
|
+
* side, after one that leaves by the top or the bottom.
|
|
76
|
+
*/
|
|
77
|
+
private drawEndLabel;
|
|
78
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Component, ComponentBase } from '@motifx/core';
|
|
2
|
+
import type { DiagramBackground } from './diagram-background';
|
|
3
|
+
import type { DiagramViewport } from './diagram-viewport';
|
|
4
|
+
/** The marks on the surface of a diagram: a pattern that moves and scales with the view, its marks a size on the screen. */
|
|
5
|
+
export declare class DiagramGrid {
|
|
6
|
+
readonly svg: Component<SVGSVGElement>;
|
|
7
|
+
private readonly pattern;
|
|
8
|
+
private readonly mark;
|
|
9
|
+
constructor(owner: ComponentBase);
|
|
10
|
+
/** Draws the marks for the view: `cross` is the length of a cross's arms, in pixels. */
|
|
11
|
+
draw(kind: DiagramBackground, gridSize: number, view: DiagramViewport, cross: number): void;
|
|
12
|
+
private path;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DiagramEdge } from './diagram-edge';
|
|
2
|
+
import type { DiagramHistoryStep } from './diagram-history-step';
|
|
3
|
+
import type { DiagramNode } from './diagram-node';
|
|
4
|
+
/** The steps the user took on a diagram, to undo and redo. A new step drops the steps undone before it. */
|
|
5
|
+
export declare class DiagramHistory<N extends DiagramNode = DiagramNode, E extends DiagramEdge = DiagramEdge> {
|
|
6
|
+
private done;
|
|
7
|
+
private undone;
|
|
8
|
+
get canUndo(): boolean;
|
|
9
|
+
get canRedo(): boolean;
|
|
10
|
+
add(step: DiagramHistoryStep<N, E>): void;
|
|
11
|
+
/** Puts the last step back; returns it, or `null` when there is none. */
|
|
12
|
+
undo(): DiagramHistoryStep<N, E> | null;
|
|
13
|
+
/** Makes the last step undone again; returns it, or `null` when there is none. */
|
|
14
|
+
redo(): DiagramHistoryStep<N, E> | null;
|
|
15
|
+
clear(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { type ComponentBase } from '@motifx/core';
|
|
2
|
+
import type { DiagramConnection } from './diagram-connection';
|
|
3
|
+
import type { DiagramEdge } from './diagram-edge';
|
|
4
|
+
import type { DiagramEdgeEnd } from './diagram-edge-end';
|
|
5
|
+
import type { DiagramLineLook } from './diagram-line-look';
|
|
6
|
+
import type { DiagramLinksHost } from './diagram-links-host';
|
|
7
|
+
import type { DiagramNode } from './diagram-node';
|
|
8
|
+
import type { DiagramPoint } from './diagram-point';
|
|
9
|
+
import type { DiagramPort } from './diagram-port';
|
|
10
|
+
import type { DiagramRect } from './diagram-rect';
|
|
11
|
+
import { DiagramBends } from './DiagramBends';
|
|
12
|
+
import { DiagramEdgeView } from './DiagramEdgeView';
|
|
13
|
+
import type { DiagramNodeView } from './DiagramNodeView';
|
|
14
|
+
/**
|
|
15
|
+
* The connections of a diagram: a line for each, matched by `id`; only the lines of what changed are drawn again. A
|
|
16
|
+
* drag from a port draws a new connection, and a drag of an end moves it, both under the diagram's rules.
|
|
17
|
+
*/
|
|
18
|
+
export declare class DiagramLinks<N extends DiagramNode = DiagramNode, E extends DiagramEdge = DiagramEdge> {
|
|
19
|
+
private readonly surface;
|
|
20
|
+
private readonly edgeLayer;
|
|
21
|
+
private readonly labelLayer;
|
|
22
|
+
private readonly handleLayer;
|
|
23
|
+
private readonly host;
|
|
24
|
+
private readonly autoPan;
|
|
25
|
+
/** The handles that move, add and take away the points of the selected lines; the keys do the same through it. */
|
|
26
|
+
readonly bends: DiagramBends<E>;
|
|
27
|
+
private readonly views;
|
|
28
|
+
/** The selected connections, by `id`, and the handles over their ends, which take an end to move it. */
|
|
29
|
+
private readonly selected;
|
|
30
|
+
private readonly handles;
|
|
31
|
+
/** The lines of each node, by its `id`. */
|
|
32
|
+
private readonly atNode;
|
|
33
|
+
/** The lines to draw with the next frame. */
|
|
34
|
+
private readonly dirty;
|
|
35
|
+
/** Where each node stood when it last moved, for the lines that went around it there. */
|
|
36
|
+
private readonly lastRects;
|
|
37
|
+
/** The lines that go around the nodes, as last drawn: a node that moves looks at these alone. */
|
|
38
|
+
private readonly goingAround;
|
|
39
|
+
/** Lines that go around the nodes worked out as if nothing stood in their way while out of view: they find their way once shown. */
|
|
40
|
+
private readonly plain;
|
|
41
|
+
/**
|
|
42
|
+
* Where lines are on the page, in a large diagram: those that reach into `inner`, and those on the page already that
|
|
43
|
+
* reach into `outer`, the selected and the one whose end is moved; `null` puts every line on the page.
|
|
44
|
+
*/
|
|
45
|
+
private region;
|
|
46
|
+
/** The lines in the order of the connections, for the order of their parts. */
|
|
47
|
+
private ordered;
|
|
48
|
+
/** The line of the connection being drawn. */
|
|
49
|
+
private readonly line;
|
|
50
|
+
/** Presses a port or an end of a line took: the surface does not pan for them. */
|
|
51
|
+
private readonly taken;
|
|
52
|
+
private look;
|
|
53
|
+
/** How near a port the pointer must come for a connection to snap to it, in pixels. */
|
|
54
|
+
private reach;
|
|
55
|
+
/**
|
|
56
|
+
* The connection being drawn: the end that stays (a port, or a node whose side is chosen), which end of the
|
|
57
|
+
* connection it is, where that end stands while an end of a line is moved (it does not move with the pointer), the
|
|
58
|
+
* line moved, where the pointer is, and the ports the connection may end at.
|
|
59
|
+
*/
|
|
60
|
+
private session;
|
|
61
|
+
private stops;
|
|
62
|
+
/**
|
|
63
|
+
* Set while nodes glide to their places: the lines that go around the nodes are drawn as if nothing stood in their
|
|
64
|
+
* way, which is quick, and find their way again once the nodes stand still.
|
|
65
|
+
*/
|
|
66
|
+
quick: boolean;
|
|
67
|
+
constructor(surface: ComponentBase, edgeLayer: ComponentBase, labelLayer: ComponentBase, handleLayer: ComponentBase, host: DiagramLinksHost<N, E>);
|
|
68
|
+
/** Matches the connections to their lines by `id`: a new one gets a line, a gone one loses it, all are drawn again. */
|
|
69
|
+
edgesChanged(): void;
|
|
70
|
+
/** Marks the selected connections, by `id`: each shows a handle over its ends, drawn with the next frame. */
|
|
71
|
+
select(ids: ReadonlySet<string>): void;
|
|
72
|
+
/**
|
|
73
|
+
* A node moved or changed its size: its lines are drawn again, those of the nodes hidden in it when it is a collapsed
|
|
74
|
+
* group, and the lines that go around the nodes it moved into the way of, or out of it.
|
|
75
|
+
*/
|
|
76
|
+
nodeChanged(id: string): void;
|
|
77
|
+
/** Whether a line finds its own way around the nodes: orthogonal, with no points of its own. */
|
|
78
|
+
private goesAround;
|
|
79
|
+
/**
|
|
80
|
+
* Puts on the page the lines in view, and takes off those far out of it (see `region`); `null` puts every line on it.
|
|
81
|
+
* A line put on the page that was worked out plainly is drawn again with its way.
|
|
82
|
+
*/
|
|
83
|
+
cull(inner: DiagramRect | null, outer: DiagramRect | null): void;
|
|
84
|
+
/** The corners of every line drawn, for a sketch of the diagram. */
|
|
85
|
+
sketches(): DiagramPoint[][];
|
|
86
|
+
/** Whether a line is to be on the page: see `region`. */
|
|
87
|
+
private wanted;
|
|
88
|
+
/** The nodes were read again: every line is drawn again (an unchanged one writes nothing). */
|
|
89
|
+
nodesChanged(): void;
|
|
90
|
+
/** What an image of the diagram draws of the lines, in the order of the connections: those drawn between two of `nodes` (by `id`), or every one drawn. */
|
|
91
|
+
pictures(nodes: ReadonlySet<string> | null): {
|
|
92
|
+
marks: ComponentBase[];
|
|
93
|
+
labels: ComponentBase[];
|
|
94
|
+
}[];
|
|
95
|
+
/** Draws the lines marked to draw, and the connection being drawn; called in a write of the diagram's frame. */
|
|
96
|
+
draw(look: DiagramLineLook, reach: number): void;
|
|
97
|
+
/**
|
|
98
|
+
* The handles over the ends of the selected connections, and over the points of their lines, a size on the screen at
|
|
99
|
+
* any zoom; none for a line that may not move.
|
|
100
|
+
*/
|
|
101
|
+
private drawHandles;
|
|
102
|
+
private handle;
|
|
103
|
+
/** How many connections a node has. */
|
|
104
|
+
countAt(id: string): number;
|
|
105
|
+
/** The line of a connection, by `id`. */
|
|
106
|
+
lineOf(id: string): DiagramEdgeView<E> | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* The lines drawn at a node, those of the nodes hidden in it when it is a collapsed group too, clockwise from the top
|
|
109
|
+
* by where their other ends are.
|
|
110
|
+
*/
|
|
111
|
+
linesAt(node: DiagramNodeView<N>): DiagramEdgeView<E>[];
|
|
112
|
+
/**
|
|
113
|
+
* The connection a line makes with its `end` taken to `node`, the other end kept: on the first of the node's own
|
|
114
|
+
* ports that allows it, on no port at a node that names none; `null` when it is not allowed.
|
|
115
|
+
*/
|
|
116
|
+
movedEnd(line: DiagramEdgeView<E>, end: DiagramEdgeEnd, node: DiagramNodeView<N>): DiagramConnection | null;
|
|
117
|
+
/**
|
|
118
|
+
* The connection the keys make from `from` to `to`, on the first of their own ports that allow it, on no port at a
|
|
119
|
+
* node that names none; `null` when none is allowed. From a node whose ports only end connections it runs backwards,
|
|
120
|
+
* as a drag from such a port draws it.
|
|
121
|
+
*/
|
|
122
|
+
connectionBetween(from: DiagramNodeView<N>, to: DiagramNodeView<N>): DiagramConnection | null;
|
|
123
|
+
/** Whether a press was taken by a port or by an end of a line. */
|
|
124
|
+
took(e: Event): boolean;
|
|
125
|
+
/** Adds a connection when the rules allow it, after `onConnecting`; returns the edge added, or `null`. */
|
|
126
|
+
connect(connection: DiagramConnection, byUser: boolean): E | null;
|
|
127
|
+
/** Whether `connection` may be made: `moving`, a connection whose end is being moved, does not count against it. */
|
|
128
|
+
allows(connection: DiagramConnection, moving: E | null): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* A press on a port draws a connection from it: from an output forwards, from an input backwards, from a port that
|
|
131
|
+
* does both the way the port it ends at allows.
|
|
132
|
+
*/
|
|
133
|
+
startConnect(view: DiagramNodeView<N>, port: DiagramPort, e: PointerEvent): void;
|
|
134
|
+
dispose(): void;
|
|
135
|
+
/** The two ends of a connection on their nodes, each with the side it leaves by; `null` while a node is missing or not laid out. */
|
|
136
|
+
private endsOf;
|
|
137
|
+
/**
|
|
138
|
+
* Where an end stands on `view`: its port; or, without one, the port that serves that end (an output for a source,
|
|
139
|
+
* an input for a target) and faces `toward` best: the side ports by the way they face, the node's own by nearness.
|
|
140
|
+
*/
|
|
141
|
+
private endAt;
|
|
142
|
+
/** What the other end turns to: its port when it has one (the middle of its places, for one on several sides), else the middle of its node. */
|
|
143
|
+
private anchorOf;
|
|
144
|
+
/** Puts the lines in the order of the connections, later ones over earlier ones; the drawn connection stays on top. */
|
|
145
|
+
/** Puts the parts of the lines in the order of the connections; a line not made yet has none. */
|
|
146
|
+
private order;
|
|
147
|
+
/** The line of the connection being drawn: from the end that stays to the port it would take, or to the pointer. */
|
|
148
|
+
private drawLine;
|
|
149
|
+
/** The side a line drawn from `from` enters the pointer by. */
|
|
150
|
+
private sideFrom;
|
|
151
|
+
/** A press near an end of a line moves that end. */
|
|
152
|
+
private edgePressed;
|
|
153
|
+
/** Takes an end of a line to move it: the other end stays where it is drawn, its place and its side, until the drop. */
|
|
154
|
+
private grabEnd;
|
|
155
|
+
private begin;
|
|
156
|
+
private pointerMove;
|
|
157
|
+
/** The pointer at a point of the page: what the connection would end at, marked, and the line drawn with the next frame. */
|
|
158
|
+
private follow;
|
|
159
|
+
/** Marks every port the connection being drawn may end at, and the port it starts from, so the user sees them all. */
|
|
160
|
+
private markAvailable;
|
|
161
|
+
private pointerUp;
|
|
162
|
+
private end;
|
|
163
|
+
/**
|
|
164
|
+
* The connection the session would make with `port`, from the end that stays the way it started; a port that does
|
|
165
|
+
* both turns it round when only the other way is allowed (an output dropped on it, or an input).
|
|
166
|
+
*/
|
|
167
|
+
private orient;
|
|
168
|
+
/** The port a connection would take at `point`, on the side nearest it: the nearest within reach, or the nearest of the node it is over. */
|
|
169
|
+
private targetAt;
|
|
170
|
+
/** Moves an end of a connection after `onReconnecting`: its fields are written, and it is drawn again. */
|
|
171
|
+
reconnect(view: DiagramEdgeView<E>, end: DiagramEdgeEnd, connection: DiagramConnection): void;
|
|
172
|
+
/** Whether a port takes no more connections: `moving` does not count. */
|
|
173
|
+
private full;
|
|
174
|
+
private newId;
|
|
175
|
+
/** The point of the diagram under a point of the page, the view as it is now. */
|
|
176
|
+
private pointAt;
|
|
177
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Bind, Component, IBaseProp } from '@motifx/core';
|
|
2
|
+
import { Control } from '../../core/control';
|
|
3
|
+
import type { DiagramMapProps } from './diagram-map-props';
|
|
4
|
+
import type { DiagramMapTarget } from './diagram-map-target';
|
|
5
|
+
/**
|
|
6
|
+
* The whole of a diagram at a glance: its nodes, the part in view outlined and the rest dimmed. A click takes the view
|
|
7
|
+
* there, a drag moves it, the wheel zooms; with the keys, the arrows pan and plus and minus zoom. The map has no
|
|
8
|
+
* buttons: the diagram's commands zoom and fit. A diagram shows one in a corner of its own with `miniMap`; this
|
|
9
|
+
* component puts it anywhere else, such as a side panel.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <Diagram ref={(d) => (diagram = d)} nodes={nodes} />
|
|
13
|
+
* <DiagramMap ref={(m) => (m.diagram = diagram)} />
|
|
14
|
+
*/
|
|
15
|
+
export declare class DiagramMap extends Control<HTMLDivElement, DiagramMapProps> {
|
|
16
|
+
readonly surface: Component<SVGSVGElement>;
|
|
17
|
+
/** The nodes, each kind of them one path: the groups under the others, the selected over them; thousands cost three elements. */
|
|
18
|
+
private readonly groups;
|
|
19
|
+
private readonly nodes;
|
|
20
|
+
private readonly chosen;
|
|
21
|
+
private readonly shade;
|
|
22
|
+
private readonly frame;
|
|
23
|
+
private room;
|
|
24
|
+
/** Around the nodes, in the diagram's units; `null` without nodes. */
|
|
25
|
+
private nodeBounds;
|
|
26
|
+
/** The part of the diagram the map shows; kept while the view is dragged, so the map does not move under the pointer. */
|
|
27
|
+
private box;
|
|
28
|
+
private held;
|
|
29
|
+
private watched;
|
|
30
|
+
private watches;
|
|
31
|
+
/** The press under way: the pointer, where it went down, how far from the middle of the view it took it, and whether it dragged. */
|
|
32
|
+
private session;
|
|
33
|
+
private stops;
|
|
34
|
+
constructor(props?: IBaseProp<DiagramMapProps>);
|
|
35
|
+
get diagram(): DiagramMapTarget | null;
|
|
36
|
+
set diagram(value: Bind<DiagramMapTarget | null>);
|
|
37
|
+
get label(): string;
|
|
38
|
+
set label(value: Bind<string>);
|
|
39
|
+
/** The diagram, while it is there. */
|
|
40
|
+
private get target();
|
|
41
|
+
/** Follows the diagram given: its nodes, its view and its selection. */
|
|
42
|
+
private watch;
|
|
43
|
+
private unwatch;
|
|
44
|
+
private writeLabel;
|
|
45
|
+
private draw;
|
|
46
|
+
/** A box for each node on the diagram's surface: a group outlined, a selected one marked. */
|
|
47
|
+
private drawNodes;
|
|
48
|
+
/** The part of the diagram the map shows, the view outlined in it and the rest of it dimmed. */
|
|
49
|
+
private drawView;
|
|
50
|
+
/** What the map shows: the nodes and the view, with room around them, as wide for its height as the map is. */
|
|
51
|
+
private boxOf;
|
|
52
|
+
/** The point of the diagram under a point of the page. */
|
|
53
|
+
private pointAt;
|
|
54
|
+
private pressed;
|
|
55
|
+
private pointerMove;
|
|
56
|
+
private released;
|
|
57
|
+
private end;
|
|
58
|
+
/** The wheel zooms the diagram around the point of it under the pointer. */
|
|
59
|
+
private wheel;
|
|
60
|
+
/** The arrows show more of the diagram on their side; plus and minus zoom. */
|
|
61
|
+
private keyDown;
|
|
62
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { type Component } from '@motifx/core';
|
|
2
|
+
import { type Size } from '../../core/measure';
|
|
3
|
+
import type { DiagramNode } from './diagram-node';
|
|
4
|
+
import type { DiagramNodeHost } from './diagram-node-host';
|
|
5
|
+
import type { DiagramNodeStatus } from './diagram-node-status';
|
|
6
|
+
import type { DiagramPoint } from './diagram-point';
|
|
7
|
+
import type { DiagramPort } from './diagram-port';
|
|
8
|
+
import type { DiagramPortPlace } from './diagram-port-place';
|
|
9
|
+
import type { DiagramRect } from './diagram-rect';
|
|
10
|
+
import type { DiagramSide } from './diagram-side';
|
|
11
|
+
/** What a node's status says, in the kit's language: its word, and the node's `statusText` after it. */
|
|
12
|
+
export declare function statusWords(status: DiagramNodeStatus, detail: string | undefined): string;
|
|
13
|
+
/**
|
|
14
|
+
* A node on the surface: the app's object drawn at its place with the content of its kind, its ports and, when it may
|
|
15
|
+
* be resized, its resize handles; its size measured as it is laid out.
|
|
16
|
+
*/
|
|
17
|
+
export declare class DiagramNodeView<N extends DiagramNode = DiagramNode> {
|
|
18
|
+
readonly part: Component<HTMLDivElement>;
|
|
19
|
+
/** Where the content of its kind goes: its text, or what the kind made. */
|
|
20
|
+
readonly body: Component<HTMLDivElement>;
|
|
21
|
+
/** The id of its element, which the diagram names as the active node to a screen reader. */
|
|
22
|
+
readonly elementId: string;
|
|
23
|
+
private readonly host;
|
|
24
|
+
/** A part for each port on each of its sides, by port and side. */
|
|
25
|
+
private readonly portParts;
|
|
26
|
+
private readonly resizers;
|
|
27
|
+
private readonly context;
|
|
28
|
+
/** The parts of the content ports stand beside, by port, and where those parts are: the share of the way across and down the node to their middles. */
|
|
29
|
+
private readonly anchors;
|
|
30
|
+
private offsets;
|
|
31
|
+
/** The ports, as read when it was drawn. */
|
|
32
|
+
private portList;
|
|
33
|
+
private label;
|
|
34
|
+
/** The mark of its status in its corner, while it has one. */
|
|
35
|
+
private statusMark;
|
|
36
|
+
private kind;
|
|
37
|
+
/** The kind whose content it holds now. */
|
|
38
|
+
private made;
|
|
39
|
+
/** Whether its content is made and laid out: it came into view once, or the diagram shows every node. */
|
|
40
|
+
entered: boolean;
|
|
41
|
+
/** Whether it is on the page: it lies in view, or the diagram shows every node. */
|
|
42
|
+
live: boolean;
|
|
43
|
+
/** The part a press drags the node from, when the kind's content named one. */
|
|
44
|
+
private handle;
|
|
45
|
+
/** What names it, when the kind's content gave it (`context.label`), and what stops the name following its data. */
|
|
46
|
+
private naming;
|
|
47
|
+
private stopNaming;
|
|
48
|
+
/** The app's and the kind's classes and the app's style properties written last, so those taken away come off. */
|
|
49
|
+
private drawnClasses;
|
|
50
|
+
private drawnStyle;
|
|
51
|
+
node: N;
|
|
52
|
+
/** Its border box as laid out, in the diagram's units: the zoom is a transform and does not change it. */
|
|
53
|
+
size: Size;
|
|
54
|
+
/** Hidden in a collapsed group. */
|
|
55
|
+
hidden: boolean;
|
|
56
|
+
constructor(node: N, host: DiagramNodeHost<N>);
|
|
57
|
+
/** Makes its content and lays it out: the first time it comes into view, or at once in a diagram that shows every node. */
|
|
58
|
+
enter(): void;
|
|
59
|
+
/** Puts it on the page or takes it off, its content and state kept. */
|
|
60
|
+
setLive(on: boolean): void;
|
|
61
|
+
/** Its ports: the node's own, its kind's, or one in the middle of each side. */
|
|
62
|
+
get ports(): readonly DiagramPort[];
|
|
63
|
+
/** Whether the node or its kind names ports of its own. */
|
|
64
|
+
get hasOwnPorts(): boolean;
|
|
65
|
+
/** Every port on each of its sides, where it stands now. */
|
|
66
|
+
get places(): DiagramPortPlace[];
|
|
67
|
+
/** Where a port stands: on the one of its sides nearest `toward`; `null` for a port it does not have. */
|
|
68
|
+
placeOf(id: string | undefined, toward: DiagramPoint): DiagramPortPlace | null;
|
|
69
|
+
/** How far along a side a port stands: beside the part its content anchors it to, else at its own offset. */
|
|
70
|
+
offsetOf(port: DiagramPort, side: DiagramSide): number;
|
|
71
|
+
/** Whether it holds other nodes. */
|
|
72
|
+
get isGroup(): boolean;
|
|
73
|
+
/** Whether it collapses to its header: a group, or a node of a kind that says so. */
|
|
74
|
+
get isCollapsible(): boolean;
|
|
75
|
+
/** Whether the user may resize it (a collapsed node not, until it opens), and the smallest size a resize leaves. */
|
|
76
|
+
get isResizable(): boolean;
|
|
77
|
+
get minSize(): Size;
|
|
78
|
+
port(id: string | undefined): DiagramPort | null;
|
|
79
|
+
/** Marks a port as the end a connection being drawn would take, or would be refused at; none for `null`. */
|
|
80
|
+
markPort(id: string | null, state: 'target' | 'refused' | null): void;
|
|
81
|
+
/** Marks the ports a connection being drawn may end at; none for `null`. */
|
|
82
|
+
markAvailable(ids: ReadonlySet<string> | null): void;
|
|
83
|
+
markSelected(on: boolean): void;
|
|
84
|
+
markMovable(on: boolean): void;
|
|
85
|
+
markDragging(on: boolean): void;
|
|
86
|
+
/** The node the keys are on. */
|
|
87
|
+
markActive(on: boolean): void;
|
|
88
|
+
/** A group under it is collapsed: it leaves the surface, in its place. */
|
|
89
|
+
markHidden(on: boolean): void;
|
|
90
|
+
/** A group that will take the node if it is dropped now. */
|
|
91
|
+
markDropTarget(on: boolean): void;
|
|
92
|
+
/** What a screen reader calls it: the name its kind's content gives, else its text, else its `id`. */
|
|
93
|
+
get name(): string;
|
|
94
|
+
/** Writes what the node says now; what did not change is not written again. */
|
|
95
|
+
draw(): void;
|
|
96
|
+
/** Moves the node to its place now, while it is dragged: only its place is written. */
|
|
97
|
+
drawPlace(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Writes the size the node gives, while it is resized too; without one it takes the size of its content, no smaller
|
|
100
|
+
* than its kind allows. A collapsed group keeps its width and takes the height of its header.
|
|
101
|
+
*/
|
|
102
|
+
drawSize(): void;
|
|
103
|
+
/** Whether it has a size to draw with: laid out, given, or likely (a node of a large diagram not seen yet). */
|
|
104
|
+
get isSized(): boolean;
|
|
105
|
+
/** Whether its size is known for sure: laid out, or both sides given. */
|
|
106
|
+
get isMeasured(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Its place and size in the diagram's units: a side it gives as given (no smaller than its kind allows), which holds
|
|
109
|
+
* at once while it is resized; else as laid out, or, not laid out yet in a large diagram, as it is likely to be.
|
|
110
|
+
*/
|
|
111
|
+
get rect(): DiagramRect;
|
|
112
|
+
/** The sides of its size it gives: a collapsed group takes one from its header. */
|
|
113
|
+
private get given();
|
|
114
|
+
/** Whether it is collapsed the way given: `'vertical'` to the height of its header, `'horizontal'` to its width. */
|
|
115
|
+
private folded;
|
|
116
|
+
/** Reads where the parts its ports stand beside are, with the window's next run. */
|
|
117
|
+
private readAnchors;
|
|
118
|
+
/** The share of the way across and down the node to the middle of each part a port stands beside; a part not laid out is left out. */
|
|
119
|
+
private readonly anchorsRead;
|
|
120
|
+
/** The ports stand where their parts are now; their connections are drawn again. */
|
|
121
|
+
private readonly anchorsWritten;
|
|
122
|
+
/** Makes the content of a kind, in place of what the last one made. */
|
|
123
|
+
private build;
|
|
124
|
+
/**
|
|
125
|
+
* A press on the node: a resize handle resizes, a port draws a connection, a control of the content keeps it, and
|
|
126
|
+
* the rest drags the node (off a drag handle, it only selects).
|
|
127
|
+
*/
|
|
128
|
+
private pressed;
|
|
129
|
+
/**
|
|
130
|
+
* Whether an event comes from a control inside `from`: a part that takes focus, a control of the kit whose focus is a
|
|
131
|
+
* 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
|
|
132
|
+
* as a stack, is looked into.
|
|
133
|
+
*/
|
|
134
|
+
private fromControl;
|
|
135
|
+
/** The app's and the kind's classes, and the app's style properties; those taken away since the last draw come off. */
|
|
136
|
+
private drawLook;
|
|
137
|
+
/** Its status: a mark in its corner with the status in its tip, and the same said with its name to a screen reader. */
|
|
138
|
+
private drawStatus;
|
|
139
|
+
/** A part for each port on each of its sides, matched by `id` and side, at its place there. */
|
|
140
|
+
private drawPorts;
|
|
141
|
+
/** The resize handles of a node the user may resize, at its sides and corners; shown while it is selected. */
|
|
142
|
+
private drawResizers;
|
|
143
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ComponentBase } from '@motifx/core';
|
|
2
|
+
import type { DiagramPoint } from './diagram-point';
|
|
3
|
+
import type { DiagramRect } from './diagram-rect';
|
|
4
|
+
/**
|
|
5
|
+
* The sketch of a diagram with too many nodes in view to draw in full: each node a box, a group an outline, the
|
|
6
|
+
* selected ones marked, and each line a plain line through its corners, every kind one path of its own, so a drawing
|
|
7
|
+
* of thousands costs a few elements.
|
|
8
|
+
*/
|
|
9
|
+
export declare class DiagramOverview {
|
|
10
|
+
private readonly lines;
|
|
11
|
+
private readonly groups;
|
|
12
|
+
private readonly nodes;
|
|
13
|
+
private readonly chosen;
|
|
14
|
+
constructor(layer: ComponentBase);
|
|
15
|
+
draw(nodes: readonly {
|
|
16
|
+
rect: DiagramRect;
|
|
17
|
+
group: boolean;
|
|
18
|
+
selected: boolean;
|
|
19
|
+
}[], lines: readonly (readonly DiagramPoint[])[]): void;
|
|
20
|
+
}
|