@dineug/erd-editor 3.7.0 → 3.9.0

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 (111) hide show
  1. package/README.md +1 -1
  2. package/dist/components/erd/automatic-table-placement/AutomaticTablePlacement.d.ts +0 -15
  3. package/dist/components/erd/automatic-table-placement/runElkPlacement.d.ts +11 -0
  4. package/dist/components/erd/canvas/CanvasScene.d.ts +3 -3
  5. package/dist/components/erd/canvas/column-drag-ghost/ColumnDragGhost.d.ts +10 -0
  6. package/dist/components/erd/canvas/column-drag-ghost/columnDragPointer.d.ts +28 -0
  7. package/dist/components/erd/canvas/entityDrag.d.ts +5 -4
  8. package/dist/components/erd/canvas/highlightTransition.d.ts +35 -0
  9. package/dist/components/erd/canvas/memo/useMoveMemo.d.ts +3 -1
  10. package/dist/components/erd/canvas/mixColor.d.ts +7 -0
  11. package/dist/components/erd/canvas/relationship-group/RelationshipGroup.d.ts +2 -0
  12. package/dist/components/erd/canvas/relationship-group/relationship/Relationship.d.ts +2 -0
  13. package/dist/components/erd/canvas/relationship-group/relationship/Relationship.template.d.ts +3 -3
  14. package/dist/components/erd/canvas/sceneHit.d.ts +7 -6
  15. package/dist/components/erd/canvas/sceneTokens.d.ts +58 -6
  16. package/dist/components/erd/canvas/table/Table.d.ts +7 -0
  17. package/dist/components/erd/canvas/table/cellLayout.d.ts +50 -20
  18. package/dist/components/erd/canvas/table/colorEdge.d.ts +10 -0
  19. package/dist/components/erd/canvas/table/column/Column.d.ts +35 -0
  20. package/dist/components/erd/canvas/table/goToErd.d.ts +18 -0
  21. package/dist/components/erd/canvas/table/useMoveTable.d.ts +3 -1
  22. package/dist/components/erd/canvas/table/useViewPin.d.ts +19 -0
  23. package/dist/components/erd/canvas/useMoveEntity.d.ts +15 -2
  24. package/dist/components/erd/content-compass/ContentCompass.d.ts +1 -1
  25. package/dist/components/erd/content-compass/compassGeometry.d.ts +27 -4
  26. package/dist/components/erd/diff-viewer/diff.d.ts +9 -2
  27. package/dist/components/erd/diff-viewer/diffContext.d.ts +9 -0
  28. package/dist/components/erd/floating-toolbar/FloatingToolbar.d.ts +3 -3
  29. package/dist/components/erd/floating-toolbar/FloatingToolbar.styles.d.ts +3 -0
  30. package/dist/components/erd/floating-toolbar/ToolbarCompass.template.d.ts +14 -0
  31. package/dist/components/erd/minimap/MinimapScene.d.ts +1 -1
  32. package/dist/components/erd/minimap/minimapGeometry.d.ts +4 -3
  33. package/dist/components/flowCenters.d.ts +10 -0
  34. package/dist/components/primitives/context-menu/context-menu-content/ContextMenuContent.d.ts +2 -0
  35. package/dist/components/primitives/context-menu/context-menu-content/fitMenu.d.ts +20 -0
  36. package/dist/components/primitives/icon/icons.d.ts +5 -2
  37. package/dist/components/sceneSourceContext.d.ts +10 -0
  38. package/dist/components/table-view/Table.styles.d.ts +6 -1
  39. package/dist/components/table-view/column/useColumnCell.d.ts +5 -0
  40. package/dist/components/theme-builder/ThemeBuilder.styles.d.ts +5 -0
  41. package/dist/components/visualization/Visualization.d.ts +3 -4
  42. package/dist/components/visualization/Visualization.styles.d.ts +4 -1
  43. package/dist/components/visualization/VisualizationFlow.d.ts +10 -0
  44. package/dist/components/visualization/VisualizationGraph.d.ts +10 -0
  45. package/dist/components/visualization/captureDrag.d.ts +14 -0
  46. package/dist/components/visualization/flowLayout.d.ts +29 -0
  47. package/dist/components/visualization/graphViewHandle.d.ts +33 -0
  48. package/dist/components/visualization/particles/ParticleLayer.d.ts +10 -0
  49. package/dist/components/visualization/particles/particleEdges.d.ts +15 -0
  50. package/dist/components/visualization/particles/particleLoop.d.ts +28 -0
  51. package/dist/components/visualization/particles/particlePath.d.ts +83 -0
  52. package/dist/components/visualization/useViewGestures.d.ts +24 -0
  53. package/dist/components/visualization/visualization-toolbar/VisualizationToolbar.d.ts +10 -0
  54. package/dist/components/visualization/visualization-toolbar/VisualizationToolbar.styles.d.ts +4 -0
  55. package/dist/components/visualization/visualizationView.d.ts +29 -5
  56. package/dist/components/visualization/zoomVisualization.d.ts +20 -0
  57. package/dist/constants/layout.d.ts +74 -1
  58. package/dist/constants/tablePlacement.d.ts +4 -3
  59. package/dist/constants/zoom.d.ts +7 -0
  60. package/dist/engine/actions.d.ts +6 -0
  61. package/dist/engine/index.js +12 -12
  62. package/dist/engine/modules/editor/actions.d.ts +60 -2
  63. package/dist/engine/modules/editor/atom.actions.d.ts +136 -0
  64. package/dist/engine/modules/editor/generator.actions.d.ts +19 -6
  65. package/dist/engine/modules/editor/state.d.ts +41 -0
  66. package/dist/engine/modules/editor/view.actions.d.ts +270 -0
  67. package/dist/engine/modules/editor/view.d.ts +28 -0
  68. package/dist/engine/modules/editor/view.generator.actions.d.ts +24 -0
  69. package/dist/engine/modules/settings/atom.actions.d.ts +17 -3
  70. package/dist/engine/modules/settings/generator.actions.d.ts +21 -4
  71. package/dist/engine/rx-operators/viewActionRedirect.d.ts +10 -0
  72. package/dist/engine/rx-operators/viewIgnoreFilter.d.ts +10 -0
  73. package/dist/engine/rx-store.d.ts +1 -0
  74. package/dist/engine/tag.d.ts +2 -0
  75. package/dist/erd-editor.umd.js +365 -314
  76. package/dist/hooks/usePinchZoom.d.ts +27 -0
  77. package/dist/index.js +6750 -5202
  78. package/dist/konva/scene/columnDropTarget.d.ts +12 -4
  79. package/dist/konva/scene/contentBounds.d.ts +12 -5
  80. package/dist/konva/scene/fitZoom.d.ts +16 -0
  81. package/dist/konva/scene/metrics.d.ts +6 -5
  82. package/dist/konva/scene/viewFreeze.d.ts +10 -7
  83. package/dist/konva/scene/viewLayout.d.ts +94 -0
  84. package/dist/konva/scene/viewport.d.ts +23 -4
  85. package/dist/{schemaGCService--wGet5O7.js → schemaGCService-CFiz1xOG.js} +3725 -3132
  86. package/dist/services/elk-layout/elkGraph.d.ts +40 -1
  87. package/dist/services/elk-layout/elkLayoutOptions.d.ts +22 -1
  88. package/dist/services/elk-layout/elkLayoutService.d.ts +5 -1
  89. package/dist/services/elk-layout/index.d.ts +10 -4
  90. package/dist/styles/elevation.styles.d.ts +7 -0
  91. package/dist/themes/radix-ui-theme.config.d.ts +12 -0
  92. package/dist/themes/tokens.d.ts +7 -0
  93. package/dist/utils/calcTable.d.ts +23 -1
  94. package/dist/utils/clickGesture.d.ts +19 -0
  95. package/dist/utils/domEvent.d.ts +8 -0
  96. package/dist/utils/draw-relationship/bezier.d.ts +32 -0
  97. package/dist/utils/draw-relationship/calc.d.ts +6 -1
  98. package/dist/utils/draw-relationship/geometrySource.d.ts +9 -0
  99. package/dist/utils/draw-relationship/incremental.d.ts +7 -1
  100. package/dist/utils/draw-relationship/index.d.ts +37 -11
  101. package/dist/utils/draw-relationship/pathFinding.d.ts +2 -1
  102. package/dist/utils/draw-relationship/route.d.ts +5 -3
  103. package/dist/utils/draw-relationship/sort.d.ts +2 -1
  104. package/dist/utils/draw-relationship/stub.d.ts +9 -4
  105. package/dist/utils/emitter.d.ts +4 -0
  106. package/dist/utils/keyboard-shortcut/index.d.ts +2 -1
  107. package/dist/utils/pinch.d.ts +34 -0
  108. package/dist/utils/validation.d.ts +1 -0
  109. package/dist/workers/elkLayout.shared-worker.js +1 -1
  110. package/dist/workers/exportPng.shared-worker.js +26 -26
  111. package/package.json +3 -3
@@ -1,5 +1,8 @@
1
+ import { ContentCompass } from '../erd/content-compass/compassGeometry';
2
+ import { Viewport } from '../../engine/modules/editor/state';
1
3
  import { Point } from '../../internal-types';
2
4
  import { Group, VisualizationLink, VisualizationNode } from './createVisualization';
5
+ export { DIM_OPACITY } from '../../konva/scene/viewLayout';
3
6
  /** The most of a table name a label shows before it is cut. */
4
7
  export declare const NAME_MAX_LENGTH = 15;
5
8
  /**
@@ -18,11 +21,6 @@ export declare const TABLE_RADIUS = 8;
18
21
  export declare const COLUMN_RADIUS = 4;
19
22
  /** A table draws larger than the columns that hang off it. */
20
23
  export declare const nodeRadius: (group: Group) => number;
21
- /**
22
- * What a dot, a line or a name fades to while it sits outside the lit
23
- * neighbourhood of a hovered table, so that neighbourhood reads on its own.
24
- */
25
- export declare const DIM_OPACITY = 0.2;
26
24
  /** The ids a hovered table lights up: nodes on one side, links on the other. */
27
25
  export type Highlight = {
28
26
  nodeIds: Set<string>;
@@ -63,6 +61,32 @@ export declare function createView(width: number, height: number): Visualization
63
61
  * const next = zoomAt(view, { x: event.offsetX, y: event.offsetY }, 1.2);
64
62
  */
65
63
  export declare function zoomAt(view: VisualizationView, point: Point, factor: number): VisualizationView;
64
+ /**
65
+ * The view that stands the whole graph in the middle of the stage, as large as
66
+ * the zoom allows with a margin clear of every edge. A graph with nothing
67
+ * placed yet gets the middle of the stage back, which is where the forces gather it.
68
+ *
69
+ * @example
70
+ * Object.assign(state, fitGraphView(nodes, viewport));
71
+ */
72
+ export declare function fitGraphView(nodes: VisualizationNode[], viewport: Viewport): VisualizationView;
73
+ /**
74
+ * The view holding the scene point given under the middle of the stage, at the
75
+ * scale it already stands at. What a press on the compass moves the graph by.
76
+ *
77
+ * @example
78
+ * Object.assign(state, centerGraphView(state, compass.target, viewport));
79
+ */
80
+ export declare function centerGraphView(view: VisualizationView, target: Point, viewport: Viewport): VisualizationView;
81
+ /**
82
+ * Which way the nearest dot lies while the stage holds none of them, read the
83
+ * way the scene beside it reads its own. Null while the graph is empty, while
84
+ * the stage has no size, and while any dot reaches the stage.
85
+ *
86
+ * @example
87
+ * const compass = graphCompass(state, nodes, viewport);
88
+ */
89
+ export declare function graphCompass(view: VisualizationView, nodes: Iterable<VisualizationNode>, viewport: Viewport): ContentCompass | null;
66
90
  /**
67
91
  * How much a wheel event scales the view, above one for a wheel rolled away
68
92
  * from the user. Exponential in the travel, so a notch each way cancels out.
@@ -0,0 +1,20 @@
1
+ import { AppContext } from '../appContext';
2
+ /**
3
+ * One step of zoom in the mode that is up. The Flow's runs through the canon
4
+ * the document's own does; the graph's holds the middle of the stage, which is
5
+ * where the same step lands for a view with no scroll under it.
6
+ *
7
+ * @example
8
+ * stepVisualizationZoom(app.value, ZOOM_STEP);
9
+ */
10
+ export declare function stepVisualizationZoom(app: AppContext, step: number): void;
11
+ /**
12
+ * The zoom of the mode that is up, at the level given rather than a step from
13
+ * where it stands. Absolute, so the reset chord lands on the same number
14
+ * whichever mode reads it and however far the reader had zoomed.
15
+ *
16
+ * @example
17
+ * setVisualizationZoom(app.value, ZOOM_RESET);
18
+ */
19
+ export declare function setVisualizationZoom(app: AppContext, level: number): void;
20
+ //# sourceMappingURL=zoomVisualization.d.ts.map
@@ -2,27 +2,94 @@ export declare const START_X = 200;
2
2
  export declare const START_Y = 100;
3
3
  export declare const START_ADD = 50;
4
4
  export declare const DUPLICATE_MIN_MOVE = 4;
5
+ /**
6
+ * How far, in screen px, a press on a cell that also takes a click travels
7
+ * before it carries its entity, so a double click that wobbles still edits.
8
+ */
9
+ export declare const CLICK_DRAG_MIN_MOVE = 4;
5
10
  export declare const DEFAULT_WIDTH = 1200;
6
11
  export declare const DEFAULT_HEIGHT: number;
12
+ /** The px a table cell's text is drawn at, which the scene and the view header scale read. */
13
+ export declare const CELL_FONT_SIZE = 12;
7
14
  export declare const INPUT_HEIGHT = 20;
8
15
  export declare const INPUT_MARGIN_RIGHT = 8;
16
+ /** The height of one row in the data type autocomplete list. */
17
+ export declare const DATA_TYPE_HINT_ROW_HEIGHT = 20;
18
+ /** How many of those rows the list shows before it scrolls the rest. */
19
+ export declare const DATA_TYPE_HINT_MAX_ROWS = 10;
9
20
  export declare const HEADER_ICON_HEIGHT = 12;
10
21
  export declare const HEADER_ICON_MARGIN_BOTTOM = 4;
11
22
  export declare const TABLE_BORDER = 1;
12
23
  export declare const TABLE_PADDING = 8;
13
24
  export declare const TABLE_HEADER_PADDING = 2;
14
- export declare const TABLE_HEADER_ICON_MARGIN_BOTTOM = 2;
15
25
  export declare const TABLE_HEADER_INPUT_HEIGHT: number;
26
+ /** The room a table's header band keeps above and below its input line. */
27
+ export declare const TABLE_HEADER_BAND_PADDING = 2;
28
+ /**
29
+ * What a table's header adds under the card's top padding. The band starts at
30
+ * the top border instead, over that padding: one input line and its own room,
31
+ * a little taller than a row, holding the add column and remove buttons too.
32
+ */
16
33
  export declare const TABLE_HEADER_HEIGHT: number;
17
34
  export declare const TABLE_HEADER_BUTTON_MARGIN_LEFT = 4;
35
+ /** How wide the colour a table wears along its left edge is drawn. */
36
+ export declare const TABLE_COLOR_WIDTH = 4;
37
+ /** The strip the two header buttons take along the right end of the header line. */
38
+ export declare const TABLE_HEADER_BUTTONS_WIDTH: number;
18
39
  export declare const COLUMN_DELETE_WIDTH = 12;
19
40
  export declare const COLUMN_KEY_WIDTH = 12;
41
+ /** The table icon before the name, at the key badge's size so the two stand in one column. */
42
+ export declare const TABLE_HEADER_ICON_SIZE = 12;
43
+ /** The gap after that icon, the one a key badge keeps, which lines the name up with the column names. */
44
+ export declare const TABLE_HEADER_ICON_GAP = 8;
45
+ /** Where the name starts along the header line, past that icon and its gap. */
46
+ export declare const TABLE_HEADER_NAME_X: number;
20
47
  export declare const COLUMN_MIN_WIDTH = 60;
21
48
  export declare const COLUMN_NOT_NULL_WIDTH = 35;
22
49
  export declare const COLUMN_UNIQUE_WIDTH = 22;
23
50
  export declare const COLUMN_AUTO_INCREMENT_WIDTH = 15;
24
51
  export declare const COLUMN_PADDING = 2;
25
52
  export declare const COLUMN_HEIGHT: number;
53
+ /** The table icon a view card draws beside its name, at the reference's 1rem. */
54
+ export declare const VIEW_TABLE_HEADER_ICON_SIZE = 16;
55
+ /** The gap between that icon and the name, the reference's one unit of spacing. */
56
+ export declare const VIEW_TABLE_HEADER_ICON_GAP = 4;
57
+ /** Where a view card's name starts along its header line, past that icon and gap. */
58
+ export declare const VIEW_TABLE_HEADER_NAME_X: number;
59
+ /** The size a view card draws its header name at, over the size its rows take. */
60
+ export declare const VIEW_TABLE_HEADER_FONT_SIZE = 14;
61
+ /**
62
+ * How much wider a string is at that size than at the one it was measured with.
63
+ * A face advances a glyph in proportion to its size, so a measured width scales
64
+ * rather than having to be measured a second time.
65
+ */
66
+ export declare const VIEW_TABLE_HEADER_FONT_SCALE: number;
67
+ /**
68
+ * How much wider again the header name is at the medium weight a view draws it
69
+ * in, over the regular every ui width was measured with. A host with no medium
70
+ * of its own synthesises one wider still, so the slot carries the room for both.
71
+ */
72
+ export declare const VIEW_TABLE_HEADER_WEIGHT_SCALE = 1.04;
73
+ /** The header a view card draws: the icon line with the card's own padding under it. */
74
+ export declare const VIEW_TABLE_HEADER_HEIGHT: number;
75
+ /** The key badge a view row draws, at the size the reference gives a row icon. */
76
+ export declare const VIEW_COLUMN_ICON_SIZE = 16;
77
+ /** The gap between that badge and the name, the reference's one and a half units. */
78
+ export declare const VIEW_COLUMN_ICON_GAP = 6;
79
+ /** The gap above and below the content of a view row, the reference's two units. */
80
+ export declare const VIEW_COLUMN_PADDING = 8;
81
+ /**
82
+ * The row a view card draws, written down as that icon line inside that padding
83
+ * rather than derived from INPUT_HEIGHT: a view row is a line of read only
84
+ * text, not the editable input box the document row is sized around.
85
+ */
86
+ export declare const VIEW_COLUMN_HEIGHT: number;
87
+ /** The width a view card is never drawn under, which is the reference's node minimum. */
88
+ export declare const VIEW_TABLE_MIN_WIDTH = 172;
89
+ /** The size of a button in a view card's header. */
90
+ export declare const VIEW_TABLE_HEADER_BUTTON_SIZE = 12;
91
+ /** The strip the two of them take along the right edge of that header. */
92
+ export declare const VIEW_TABLE_HEADER_BUTTONS_WIDTH: number;
26
93
  export declare const MEMO_BORDER = 1;
27
94
  export declare const MEMO_PADDING = 8;
28
95
  export declare const MEMO_HEADER_HEIGHT: number;
@@ -38,6 +105,12 @@ export declare const DIFF_TREE_WIDTH = 200;
38
105
  * two rows at partial alpha on a 1x display.
39
106
  */
40
107
  export declare const RELATIONSHIP_STROKE_WIDTH = 2;
108
+ /**
109
+ * The same connector inside a view, at the reference's hairline. A particle
110
+ * riding a lit one is 2.4 units across, so a heavier line swallows it: what a
111
+ * reader sees moving is the bulge the particle makes over the stroke, not a colour of its own.
112
+ */
113
+ export declare const VIEW_RELATIONSHIP_STROKE_WIDTH = 1;
41
114
  /**
42
115
  * The invisible band that catches the pointer for a connector, because
43
116
  * hit-testing follows the painted stroke. Narrower than NUDGE_GAP, so it stays
@@ -1,14 +1,15 @@
1
1
  import { ValuesType } from '../internal-types';
2
2
  /**
3
- * How the editor lays a document out when the author asks it to. Force is the
4
- * simulation the editor has always run, and the three below it are ELK
5
- * algorithms answered off the main thread.
3
+ * How a set of tables is laid out. Force is the simulation the editor has
4
+ * always run, the rest are ELK algorithms answered off the main thread, and
5
+ * viewLayered is the preset the views place with rather than one the author picks.
6
6
  */
7
7
  export declare const TablePlacement: {
8
8
  readonly force: "force";
9
9
  readonly layeredHorizontal: "layeredHorizontal";
10
10
  readonly layeredVertical: "layeredVertical";
11
11
  readonly flow: "flow";
12
+ readonly viewLayered: "viewLayered";
12
13
  };
13
14
  export type TablePlacement = ValuesType<typeof TablePlacement>;
14
15
  export declare const DEFAULT_TABLE_PLACEMENT: TablePlacement;
@@ -0,0 +1,7 @@
1
+ /** The zoom a scene opens at, and the one the reset chord puts it back to. */
2
+ export declare const ZOOM_RESET = 1;
3
+ /** How far one zoom chord steps the zoom, in or out. */
4
+ export declare const ZOOM_STEP = 0.04;
5
+ /** How far one wheel notch carrying the modifier zooms, on the ERD tab and in a view alike. */
6
+ export declare const WHEEL_ZOOM_STEP = 0.03;
7
+ //# sourceMappingURL=zoom.d.ts.map
@@ -28,6 +28,12 @@ export type ActionType = keyof RootActionMap;
28
28
  export declare const actions: Actions;
29
29
  export declare const ChangeActionTypes: ReadonlyArray<ActionType>;
30
30
  export declare const ReadonlyIgnoreActionTypes: ReadonlyArray<ActionType>;
31
+ /**
32
+ * What a view keeps from the document while it is active: every edit a
33
+ * readonly host refuses, less the host replacing the document outright, which
34
+ * a view cannot stand in the way of and answers by closing.
35
+ */
36
+ export declare const ViewIgnoreActionTypes: ReadonlyArray<ActionType>;
31
37
  export declare const SharedStreamActionTypes: ReadonlyArray<ActionType>;
32
38
  export declare const SharedActionTypes: ReadonlyArray<ActionType>;
33
39
  export declare const SharedFollowingActionTypes: ReadonlyArray<ActionType>;
@@ -1,33 +1,33 @@
1
- import { Rr as e, Wt as t, b as n, g as r, jn as i, l as a, m as o, n as s, on as c, q as l, r as u, t as d, ui as f } from "../schemaGCService--wGet5O7.js";
1
+ import { $i as e, Ln as t, Xt as n, Z as r, _ as i, fn as a, h as o, n as s, r as c, t as l, u, x as d, xi as f } from "../schemaGCService-CFiz1xOG.js";
2
2
  import { isEmpty as p } from "es-toolkit/compat";
3
3
  import { omit as m } from "es-toolkit";
4
4
  import { Observable as h, Subject as g, debounceTime as _, map as v } from "rxjs";
5
5
  //#region src/engine/replication-store.ts
6
6
  var y = { change: "change" };
7
7
  function b(b) {
8
- let x = /* @__PURE__ */ new Set(), S = r(b), C = a(S, !1);
9
- C.dispatchSync(c({
8
+ let x = /* @__PURE__ */ new Set(), S = i(b), C = u(S, !1);
9
+ C.dispatchSync(a({
10
10
  width: 0,
11
11
  height: 0
12
12
  }));
13
- let w = u(C), T = new g(), E = new h((e) => C.subscribe((t) => e.next(t))).pipe(o(n), _(200)), D = /* @__PURE__ */ new Set(), O = new d(), k = (e) => (D.has(e) || D.add(e), () => {
13
+ let w = c(C), T = new g(), E = new h((e) => C.subscribe((t) => e.next(t))).pipe(o(d), _(200)), D = /* @__PURE__ */ new Set(), O = new l(), k = (e) => (D.has(e) || D.add(e), () => {
14
14
  D.delete(e);
15
- }), A = (e, n) => {
15
+ }), A = (e, t) => {
16
16
  D.forEach((r) => {
17
17
  let i = Reflect.get(r, e);
18
- t(i, n);
18
+ n(i, t);
19
19
  });
20
- }, j = (t) => {
21
- let n = e(t);
22
- C.dispatchSync(l(p(n) ? "{}" : n)), O.run(f(C.state)).then((e) => {
23
- (e.tableIds.length || e.tableColumnIds.length || e.relationshipIds.length || e.indexIds.length || e.indexColumnIds.length || e.memoIds.length) && (s(C.state, e), C.dispatchSync(i()));
20
+ }, j = (n) => {
21
+ let i = f(n);
22
+ C.dispatchSync(r(p(i) ? "{}" : i)), O.run(e(C.state)).then((e) => {
23
+ (e.tableIds.length || e.tableColumnIds.length || e.relationshipIds.length || e.indexIds.length || e.indexColumnIds.length || e.memoIds.length) && (s(C.state, e), C.dispatchSync(t()));
24
24
  });
25
25
  }, M = (e) => {
26
26
  T.next([e].flat());
27
27
  };
28
- return x.add(E.subscribe(() => A(y.change, void 0))).add(T.pipe(o(n), v((e) => e.map((e) => m(e, ["tags"])))).subscribe(C.dispatchSync)), Object.freeze({
28
+ return x.add(E.subscribe(() => A(y.change, void 0))).add(T.pipe(o(d), v((e) => e.map((e) => m(e, ["tags"])))).subscribe(C.dispatchSync)), Object.freeze({
29
29
  get value() {
30
- return f(C.state);
30
+ return e(C.state);
31
31
  },
32
32
  on: k,
33
33
  setInitialValue: j,
@@ -1,9 +1,9 @@
1
1
  import { Reducer } from '@dineug/r-html';
2
2
  import { EngineContext } from '../../context';
3
3
  import { RootState } from '../../state';
4
- import { LWW, ValuesType } from '../../../internal-types';
4
+ import { LWW, Point, ValuesType } from '../../../internal-types';
5
5
  import { Rect } from '../../../utils/dragSelect';
6
- import { FocusType, MoveKey, SelectType, SharedFocus } from './state';
6
+ import { FocusType, MoveKey, SelectType, SharedFocus, ShowMode, ViewKind, VisualizationMode } from './state';
7
7
  export declare const ActionType: {
8
8
  readonly changeHasHistory: "editor.changeHasHistory";
9
9
  readonly selectAll: "editor.selectAll";
@@ -43,6 +43,17 @@ export declare const ActionType: {
43
43
  readonly validationIds: "editor.validationIds";
44
44
  readonly getLWW: "editor.getLWW";
45
45
  readonly mergeLWW: "editor.mergeLWW";
46
+ readonly viewOpen: "editor.viewOpen";
47
+ readonly viewClose: "editor.viewClose";
48
+ readonly viewScrollTo: "editor.viewScrollTo";
49
+ readonly viewStreamScrollTo: "editor.viewStreamScrollTo";
50
+ readonly viewChangeZoomLevel: "editor.viewChangeZoomLevel";
51
+ readonly viewStreamZoomLevel: "editor.viewStreamZoomLevel";
52
+ readonly viewMoveTable: "editor.viewMoveTable";
53
+ readonly viewSetLayout: "editor.viewSetLayout";
54
+ readonly viewChangeShowMode: "editor.viewChangeShowMode";
55
+ readonly viewSetCenters: "editor.viewSetCenters";
56
+ readonly changeVisualizationMode: "editor.changeVisualizationMode";
46
57
  };
47
58
  export type ActionType = ValuesType<typeof ActionType>;
48
59
  export type ActionMap = {
@@ -143,6 +154,53 @@ export type ActionMap = {
143
154
  [ActionType.mergeLWW]: {
144
155
  lww: LWW;
145
156
  };
157
+ [ActionType.viewOpen]: {
158
+ kind: ViewKind;
159
+ /** The tables the view opens narrowed to; none and it opens on the whole document. */
160
+ centerIds?: string[];
161
+ };
162
+ [ActionType.viewClose]: {
163
+ kind: ViewKind;
164
+ };
165
+ [ActionType.viewScrollTo]: {
166
+ originX: number;
167
+ originY: number;
168
+ kind?: ViewKind;
169
+ };
170
+ [ActionType.viewStreamScrollTo]: {
171
+ movementX: number;
172
+ movementY: number;
173
+ kind?: ViewKind;
174
+ };
175
+ [ActionType.viewChangeZoomLevel]: {
176
+ value: number;
177
+ kind?: ViewKind;
178
+ };
179
+ [ActionType.viewStreamZoomLevel]: {
180
+ value: number;
181
+ kind?: ViewKind;
182
+ };
183
+ [ActionType.viewMoveTable]: {
184
+ ids: string[];
185
+ movementX: number;
186
+ movementY: number;
187
+ kind?: ViewKind;
188
+ };
189
+ [ActionType.viewSetLayout]: {
190
+ kind: ViewKind;
191
+ positions: Record<string, Point>;
192
+ };
193
+ [ActionType.viewChangeShowMode]: {
194
+ value: ShowMode;
195
+ kind?: ViewKind;
196
+ };
197
+ [ActionType.viewSetCenters]: {
198
+ tableIds: string[];
199
+ kind?: ViewKind;
200
+ };
201
+ [ActionType.changeVisualizationMode]: {
202
+ value: VisualizationMode;
203
+ };
146
204
  };
147
205
  export type ReducerType<T extends keyof ActionMap> = Reducer<RootState, T, ActionMap, EngineContext>;
148
206
  //# sourceMappingURL=actions.d.ts.map
@@ -309,6 +309,17 @@ export declare const mergeLWWAction: {
309
309
  type: string;
310
310
  };
311
311
  export declare const editorReducers: {
312
+ "editor.viewOpen": ReducerType<"editor.viewOpen">;
313
+ "editor.viewClose": ReducerType<"editor.viewClose">;
314
+ "editor.viewScrollTo": ReducerType<"editor.viewScrollTo">;
315
+ "editor.viewStreamScrollTo": ReducerType<"editor.viewStreamScrollTo">;
316
+ "editor.viewChangeZoomLevel": ReducerType<"editor.viewChangeZoomLevel">;
317
+ "editor.viewStreamZoomLevel": ReducerType<"editor.viewStreamZoomLevel">;
318
+ "editor.viewMoveTable": ReducerType<"editor.viewMoveTable">;
319
+ "editor.viewSetLayout": ReducerType<"editor.viewSetLayout">;
320
+ "editor.viewChangeShowMode": ReducerType<"editor.viewChangeShowMode">;
321
+ "editor.viewSetCenters": ReducerType<"editor.viewSetCenters">;
322
+ "editor.changeVisualizationMode": ReducerType<"editor.changeVisualizationMode">;
312
323
  "editor.changeHasHistory": ReducerType<"editor.changeHasHistory">;
313
324
  "editor.selectAll": ReducerType<"editor.selectAll">;
314
325
  "editor.unselectAll": ReducerType<"editor.unselectAll">;
@@ -349,6 +360,131 @@ export declare const editorReducers: {
349
360
  "editor.mergeLWW": ReducerType<"editor.mergeLWW">;
350
361
  };
351
362
  export declare const actions: {
363
+ viewOpenAction: {
364
+ (payload: {
365
+ kind: import('./state').ViewKind;
366
+ centerIds?: string[];
367
+ }): import('@dineug/r-html').AnyAction<{
368
+ kind: import('./state').ViewKind;
369
+ centerIds?: string[];
370
+ }>;
371
+ toString(): string;
372
+ type: string;
373
+ };
374
+ viewCloseAction: {
375
+ (payload: {
376
+ kind: import('./state').ViewKind;
377
+ }): import('@dineug/r-html').AnyAction<{
378
+ kind: import('./state').ViewKind;
379
+ }>;
380
+ toString(): string;
381
+ type: string;
382
+ };
383
+ viewScrollToAction: {
384
+ (payload: {
385
+ originX: number;
386
+ originY: number;
387
+ kind?: import('./state').ViewKind;
388
+ }): import('@dineug/r-html').AnyAction<{
389
+ originX: number;
390
+ originY: number;
391
+ kind?: import('./state').ViewKind;
392
+ }>;
393
+ toString(): string;
394
+ type: string;
395
+ };
396
+ viewStreamScrollToAction: {
397
+ (payload: {
398
+ movementX: number;
399
+ movementY: number;
400
+ kind?: import('./state').ViewKind;
401
+ }): import('@dineug/r-html').AnyAction<{
402
+ movementX: number;
403
+ movementY: number;
404
+ kind?: import('./state').ViewKind;
405
+ }>;
406
+ toString(): string;
407
+ type: string;
408
+ };
409
+ viewChangeZoomLevelAction: {
410
+ (payload: {
411
+ value: number;
412
+ kind?: import('./state').ViewKind;
413
+ }): import('@dineug/r-html').AnyAction<{
414
+ value: number;
415
+ kind?: import('./state').ViewKind;
416
+ }>;
417
+ toString(): string;
418
+ type: string;
419
+ };
420
+ viewStreamZoomLevelAction: {
421
+ (payload: {
422
+ value: number;
423
+ kind?: import('./state').ViewKind;
424
+ }): import('@dineug/r-html').AnyAction<{
425
+ value: number;
426
+ kind?: import('./state').ViewKind;
427
+ }>;
428
+ toString(): string;
429
+ type: string;
430
+ };
431
+ viewMoveTableAction: {
432
+ (payload: {
433
+ ids: string[];
434
+ movementX: number;
435
+ movementY: number;
436
+ kind?: import('./state').ViewKind;
437
+ }): import('@dineug/r-html').AnyAction<{
438
+ ids: string[];
439
+ movementX: number;
440
+ movementY: number;
441
+ kind?: import('./state').ViewKind;
442
+ }>;
443
+ toString(): string;
444
+ type: string;
445
+ };
446
+ viewSetLayoutAction: {
447
+ (payload: {
448
+ kind: import('./state').ViewKind;
449
+ positions: Record<string, import('../../../internal-types').Point>;
450
+ }): import('@dineug/r-html').AnyAction<{
451
+ kind: import('./state').ViewKind;
452
+ positions: Record<string, import('../../../internal-types').Point>;
453
+ }>;
454
+ toString(): string;
455
+ type: string;
456
+ };
457
+ viewChangeShowModeAction: {
458
+ (payload: {
459
+ value: import('./state').ShowMode;
460
+ kind?: import('./state').ViewKind;
461
+ }): import('@dineug/r-html').AnyAction<{
462
+ value: import('./state').ShowMode;
463
+ kind?: import('./state').ViewKind;
464
+ }>;
465
+ toString(): string;
466
+ type: string;
467
+ };
468
+ viewSetCentersAction: {
469
+ (payload: {
470
+ tableIds: string[];
471
+ kind?: import('./state').ViewKind;
472
+ }): import('@dineug/r-html').AnyAction<{
473
+ tableIds: string[];
474
+ kind?: import('./state').ViewKind;
475
+ }>;
476
+ toString(): string;
477
+ type: string;
478
+ };
479
+ changeVisualizationModeAction: {
480
+ (payload: {
481
+ value: import('./state').VisualizationMode;
482
+ }): import('@dineug/r-html').AnyAction<{
483
+ value: import('./state').VisualizationMode;
484
+ }>;
485
+ toString(): string;
486
+ type: string;
487
+ };
352
488
  changeHasHistoryAction: {
353
489
  (payload: {
354
490
  hasUndo: boolean;
@@ -1,11 +1,17 @@
1
1
  import { GeneratorAction } from '../../generator.actions';
2
2
  import { Point } from '../../../internal-types';
3
3
  import { Rect } from '../../../utils/dragSelect';
4
+ import { GeometrySource } from '../../../utils/draw-relationship/geometrySource';
4
5
  import { ClipboardPayload } from '../../../utils/table-clipboard';
5
6
  import { MoveKey } from './state';
6
7
  export declare const loadJsonAction$: (value: string) => GeneratorAction;
7
8
  export declare const initialLoadJsonAction$: (value: string) => GeneratorAction;
8
- export declare const moveAllAction$: (movementX: number, movementY: number) => GeneratorAction;
9
+ /**
10
+ * Moves the selection by a pointer step, scaled by the zoom of the scene the
11
+ * drag runs in. From a view scene the step goes to that view's own placement,
12
+ * which holds tables alone, and the document's placement is left where it is.
13
+ */
14
+ export declare const moveAllAction$: (movementX: number, movementY: number, source?: GeometrySource) => GeneratorAction;
9
15
  export declare const removeSelectedAction$: () => GeneratorAction;
10
16
  export type DuplicateConfig = {
11
17
  tableIds?: string[];
@@ -15,7 +21,12 @@ export type DuplicateConfig = {
15
21
  };
16
22
  export declare const pasteEntitiesAction$: (payload: ClipboardPayload, pasteRound: number) => GeneratorAction;
17
23
  export declare const duplicateAction$: ({ tableIds, memoIds, offset, escapeCollision, }: DuplicateConfig) => GeneratorAction;
18
- export declare const dragSelectAction$: (dragRect: Rect) => GeneratorAction;
24
+ /**
25
+ * Selects what the rect covers among what the source shows, each entity read
26
+ * at the point and the size that source draws it: a view places its tables
27
+ * and shows no memo, so a marquee drawn over it picks by the view, not the document.
28
+ */
29
+ export declare const dragSelectAction$: (dragRect: Rect, source?: GeometrySource) => GeneratorAction;
19
30
  export declare const unselectAllAction$: () => GeneratorAction;
20
31
  export declare const focusMoveTableAction$: (moveKey: MoveKey, shiftKey: boolean) => GeneratorAction;
21
32
  export declare const drawStartRelationshipAction$: (relationshipType: number) => GeneratorAction;
@@ -26,17 +37,19 @@ export declare const loadSchemaGraphQLAction$: (value: string) => GeneratorActio
26
37
  export declare const loadSchemaDBMLAction$: (value: string) => GeneratorAction;
27
38
  export declare const loadSchemaAMLAction$: (value: string) => GeneratorAction;
28
39
  export declare const dragstartColumnAction$: ($mod: boolean) => GeneratorAction;
29
- export declare const dragoverColumnAction$: (targetId: string, targetTableId: string) => GeneratorAction;
40
+ /** A null targetId drops past the last row, which appends. */
41
+ export declare const dragoverColumnAction$: (targetId: string | null, targetTableId: string) => GeneratorAction;
30
42
  export declare const columnKeyHoverStartAction$: (columnId: string) => GeneratorAction;
31
43
  export declare const columnKeyHoverEndAction$: () => GeneratorAction;
32
44
  export declare const actions$: {
45
+ focusFlowTableAction$: (tableIds: string[]) => GeneratorAction;
33
46
  loadJsonAction$: (value: string) => GeneratorAction;
34
47
  initialLoadJsonAction$: (value: string) => GeneratorAction;
35
- moveAllAction$: (movementX: number, movementY: number) => GeneratorAction;
48
+ moveAllAction$: (movementX: number, movementY: number, source?: GeometrySource) => GeneratorAction;
36
49
  removeSelectedAction$: () => GeneratorAction;
37
50
  pasteEntitiesAction$: (payload: ClipboardPayload, pasteRound: number) => GeneratorAction;
38
51
  duplicateAction$: ({ tableIds, memoIds, offset, escapeCollision, }: DuplicateConfig) => GeneratorAction;
39
- dragSelectAction$: (dragRect: Rect) => GeneratorAction;
52
+ dragSelectAction$: (dragRect: Rect, source?: GeometrySource) => GeneratorAction;
40
53
  unselectAllAction$: () => GeneratorAction;
41
54
  focusMoveTableAction$: (moveKey: MoveKey, shiftKey: boolean) => GeneratorAction;
42
55
  drawStartRelationshipAction$: (relationshipType: number) => GeneratorAction;
@@ -47,7 +60,7 @@ export declare const actions$: {
47
60
  loadSchemaDBMLAction$: (value: string) => GeneratorAction;
48
61
  loadSchemaAMLAction$: (value: string) => GeneratorAction;
49
62
  dragstartColumnAction$: ($mod: boolean) => GeneratorAction;
50
- dragoverColumnAction$: (targetId: string, targetTableId: string) => GeneratorAction;
63
+ dragoverColumnAction$: (targetId: string | null, targetTableId: string) => GeneratorAction;
51
64
  columnKeyHoverStartAction$: (columnId: string) => GeneratorAction;
52
65
  columnKeyHoverEndAction$: () => GeneratorAction;
53
66
  };
@@ -36,6 +36,14 @@ export type Editor = {
36
36
  sharedSelectionTrackerMap: Record<string, SharedSelectionTracker>;
37
37
  sharedDragSelectTrackerMap: Record<string, SharedDragSelectTracker>;
38
38
  dragSelect: Rect | null;
39
+ /**
40
+ * The scene view a reader can stand in over the document: the Flow mode of
41
+ * the visualization tab, null while it is not open. Local to this client,
42
+ * never the file, the history or a peer.
43
+ */
44
+ views: EditorViews;
45
+ /** Which of its two modes the visualization tab shows. Remembered for the session. */
46
+ visualizationMode: VisualizationMode;
39
47
  };
40
48
  export type Viewport = {
41
49
  width: number;
@@ -90,6 +98,39 @@ export declare const SelectType: {
90
98
  readonly memo: "memo";
91
99
  };
92
100
  export type SelectType = ValuesType<typeof SelectType>;
101
+ export declare const ShowMode: {
102
+ readonly nameOnly: "nameOnly";
103
+ readonly keysOnly: "keysOnly";
104
+ readonly allFields: "allFields";
105
+ };
106
+ export type ShowMode = ValuesType<typeof ShowMode>;
107
+ export declare const ViewKind: {
108
+ readonly flow: "flow";
109
+ };
110
+ export type ViewKind = ValuesType<typeof ViewKind>;
111
+ export declare const VisualizationMode: {
112
+ readonly graph: "graph";
113
+ readonly flow: "flow";
114
+ };
115
+ export type VisualizationMode = ValuesType<typeof VisualizationMode>;
116
+ /**
117
+ * A scene drawn over the document in its own coordinates: the tables it places
118
+ * by id, the placement it is looked at through, and what it shows of each
119
+ * table. Memos are never placed, so a view draws none.
120
+ */
121
+ export type SceneView = {
122
+ kind: ViewKind;
123
+ showMode: ShowMode;
124
+ positions: Record<string, Point>;
125
+ originX: number;
126
+ originY: number;
127
+ zoomLevel: number;
128
+ /** The tables the view narrows to, and none while it shows the whole document. */
129
+ centerIds: string[];
130
+ };
131
+ export type EditorViews = {
132
+ flow: SceneView | null;
133
+ };
93
134
  export declare const FocusType: {
94
135
  readonly tableName: "tableName";
95
136
  readonly tableComment: "tableComment";