@dineug/erd-editor 3.6.0 → 3.8.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 (107) hide show
  1. package/README.md +21 -24
  2. package/dist/components/erd/automatic-table-placement/AutomaticTablePlacement.d.ts +5 -15
  3. package/dist/components/erd/automatic-table-placement/runElkPlacement.d.ts +23 -0
  4. package/dist/components/erd/canvas/CanvasScene.d.ts +3 -3
  5. package/dist/components/erd/canvas/entityDrag.d.ts +5 -4
  6. package/dist/components/erd/canvas/highlightTransition.d.ts +35 -0
  7. package/dist/components/erd/canvas/memo/useMoveMemo.d.ts +3 -1
  8. package/dist/components/erd/canvas/mixColor.d.ts +7 -0
  9. package/dist/components/erd/canvas/relationship-group/RelationshipGroup.d.ts +2 -0
  10. package/dist/components/erd/canvas/relationship-group/relationship/Relationship.d.ts +2 -0
  11. package/dist/components/erd/canvas/relationship-group/relationship/Relationship.template.d.ts +3 -3
  12. package/dist/components/erd/canvas/sceneHit.d.ts +7 -6
  13. package/dist/components/erd/canvas/sceneTokens.d.ts +30 -4
  14. package/dist/components/erd/canvas/table/Table.d.ts +7 -0
  15. package/dist/components/erd/canvas/table/cellLayout.d.ts +48 -18
  16. package/dist/components/erd/canvas/table/column/Column.d.ts +26 -0
  17. package/dist/components/erd/canvas/table/goToErd.d.ts +18 -0
  18. package/dist/components/erd/canvas/table/useMoveTable.d.ts +3 -1
  19. package/dist/components/erd/canvas/table/useViewPin.d.ts +19 -0
  20. package/dist/components/erd/canvas/useMoveEntity.d.ts +9 -2
  21. package/dist/components/erd/content-compass/ContentCompass.d.ts +1 -1
  22. package/dist/components/erd/content-compass/compassGeometry.d.ts +27 -4
  23. package/dist/components/erd/erd-context-menu/menus/tablePlacementMenus.d.ts +24 -0
  24. package/dist/components/erd/floating-toolbar/FloatingToolbar.d.ts +3 -3
  25. package/dist/components/erd/floating-toolbar/FloatingToolbar.styles.d.ts +3 -0
  26. package/dist/components/erd/floating-toolbar/ToolbarCompass.template.d.ts +14 -0
  27. package/dist/components/erd/minimap/MinimapScene.d.ts +1 -1
  28. package/dist/components/erd/minimap/minimapGeometry.d.ts +4 -3
  29. package/dist/components/flowCenters.d.ts +10 -0
  30. package/dist/components/primitives/code-block/CodeBlock.d.ts +2 -2
  31. package/dist/components/primitives/icon/icons.d.ts +7 -0
  32. package/dist/components/sceneSourceContext.d.ts +10 -0
  33. package/dist/components/theme-builder/ThemeBuilder.styles.d.ts +5 -0
  34. package/dist/components/visualization/Visualization.d.ts +3 -4
  35. package/dist/components/visualization/VisualizationFlow.d.ts +10 -0
  36. package/dist/components/visualization/VisualizationGraph.d.ts +10 -0
  37. package/dist/components/visualization/flowLayout.d.ts +29 -0
  38. package/dist/components/visualization/graphViewHandle.d.ts +33 -0
  39. package/dist/components/visualization/particles/ParticleLayer.d.ts +10 -0
  40. package/dist/components/visualization/particles/particleEdges.d.ts +15 -0
  41. package/dist/components/visualization/particles/particleLoop.d.ts +28 -0
  42. package/dist/components/visualization/particles/particlePath.d.ts +83 -0
  43. package/dist/components/visualization/useViewGestures.d.ts +24 -0
  44. package/dist/components/visualization/visualization-toolbar/VisualizationToolbar.d.ts +10 -0
  45. package/dist/components/visualization/visualization-toolbar/VisualizationToolbar.styles.d.ts +4 -0
  46. package/dist/components/visualization/visualizationView.d.ts +29 -5
  47. package/dist/components/visualization/zoomVisualization.d.ts +20 -0
  48. package/dist/constants/layout.d.ts +50 -0
  49. package/dist/constants/tablePlacement.d.ts +16 -0
  50. package/dist/constants/zoom.d.ts +7 -0
  51. package/dist/engine/actions.d.ts +6 -0
  52. package/dist/engine/index.js +12 -12
  53. package/dist/engine/modules/editor/actions.d.ts +60 -2
  54. package/dist/engine/modules/editor/atom.actions.d.ts +136 -0
  55. package/dist/engine/modules/editor/generator.actions.d.ts +16 -4
  56. package/dist/engine/modules/editor/state.d.ts +41 -0
  57. package/dist/engine/modules/editor/view.actions.d.ts +270 -0
  58. package/dist/engine/modules/editor/view.d.ts +28 -0
  59. package/dist/engine/modules/editor/view.generator.actions.d.ts +24 -0
  60. package/dist/engine/modules/settings/atom.actions.d.ts +17 -3
  61. package/dist/engine/modules/settings/generator.actions.d.ts +6 -4
  62. package/dist/engine/rx-operators/viewActionRedirect.d.ts +10 -0
  63. package/dist/engine/rx-operators/viewIgnoreFilter.d.ts +10 -0
  64. package/dist/erd-editor.umd.js +319 -282
  65. package/dist/index.d.ts +0 -1
  66. package/dist/index.dev.d.ts +0 -1
  67. package/dist/index.js +6238 -4937
  68. package/dist/konva/scene/columnDropTarget.d.ts +2 -1
  69. package/dist/konva/scene/contentBounds.d.ts +12 -5
  70. package/dist/konva/scene/fitZoom.d.ts +16 -0
  71. package/dist/konva/scene/metrics.d.ts +6 -5
  72. package/dist/konva/scene/viewFreeze.d.ts +10 -7
  73. package/dist/konva/scene/viewLayout.d.ts +89 -0
  74. package/dist/konva/scene/viewport.d.ts +17 -4
  75. package/dist/{schemaGCService--wGet5O7.js → schemaGCService-CXVjeF9p.js} +3145 -2655
  76. package/dist/services/elk-layout/elkGraph.d.ts +83 -0
  77. package/dist/services/elk-layout/elkLayout.shared-worker.d.ts +2 -0
  78. package/dist/services/elk-layout/elkLayoutOptions.d.ts +46 -0
  79. package/dist/services/elk-layout/elkLayoutService.d.ts +25 -0
  80. package/dist/services/elk-layout/elkWorkerRealm.d.ts +2 -0
  81. package/dist/services/elk-layout/index.d.ts +19 -0
  82. package/dist/services/shiki/index.d.ts +10 -0
  83. package/dist/services/shiki/shiki.shared-worker.d.ts +2 -0
  84. package/dist/services/shiki/shikiService.d.ts +18 -0
  85. package/dist/utils/calcTable.d.ts +27 -1
  86. package/dist/utils/clickGesture.d.ts +19 -0
  87. package/dist/utils/domEvent.d.ts +12 -0
  88. package/dist/utils/draw-relationship/bezier.d.ts +32 -0
  89. package/dist/utils/draw-relationship/calc.d.ts +6 -1
  90. package/dist/utils/draw-relationship/geometrySource.d.ts +9 -0
  91. package/dist/utils/draw-relationship/incremental.d.ts +7 -1
  92. package/dist/utils/draw-relationship/index.d.ts +37 -11
  93. package/dist/utils/draw-relationship/pathFinding.d.ts +2 -1
  94. package/dist/utils/draw-relationship/route.d.ts +5 -3
  95. package/dist/utils/draw-relationship/sort.d.ts +2 -1
  96. package/dist/utils/draw-relationship/stub.d.ts +9 -4
  97. package/dist/utils/emitter.d.ts +18 -7
  98. package/dist/utils/globalEventObservable.d.ts +6 -1
  99. package/dist/utils/keyboard-shortcut/index.d.ts +2 -1
  100. package/dist/utils/promise.d.ts +6 -0
  101. package/dist/workers/elkLayout.shared-worker.js +1 -0
  102. package/dist/workers/exportPng.shared-worker.js +26 -26
  103. package/dist/workers/shiki.shared-worker.js +1 -0
  104. package/dist/workers/spawn.d.ts +5 -3
  105. package/dist/workers/spawn.inline.d.ts +2 -0
  106. package/package.json +7 -4
  107. package/dist/services/shikiService.d.ts +0 -9
@@ -1,5 +1,6 @@
1
1
  import { RootState } from '../../engine/state';
2
2
  import { Point } from '../../internal-types';
3
+ import { GeometrySource } from '../../utils/draw-relationship/geometrySource';
3
4
  export type ColumnDropTarget = {
4
5
  tableId: string;
5
6
  columnId: string;
@@ -10,5 +11,5 @@ export type ColumnDropTarget = {
10
11
  * header, over bare canvas and past the last row. Arithmetic on the rects the
11
12
  * scene lays rows out with, never a hit canvas read, which costs a frame.
12
13
  */
13
- export declare function findColumnDropTarget(state: RootState, point: Point): ColumnDropTarget | null;
14
+ export declare function findColumnDropTarget(state: RootState, point: Point, source?: GeometrySource): ColumnDropTarget | null;
14
15
  //# sourceMappingURL=columnDropTarget.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { RootState } from '../../engine/state';
2
2
  import { Rect } from './metrics';
3
+ import { GeometrySource } from '../../utils/draw-relationship/geometrySource';
3
4
  /** The smallest box holding both. */
4
5
  export declare function unionRect(a: Rect, b: Rect): Rect;
5
6
  /** A table and the point it is about to be moved to, named before the move is dispatched. */
@@ -15,15 +16,21 @@ export type TableMove = {
15
16
  */
16
17
  export declare function getContentRect(state: RootState): Rect | null;
17
18
  /**
18
- * One box per table and memo, each table at the point named for it. The reader
19
- * that asks which entity is nearest needs them apart, where the box below folds
20
- * them together, and both are the same pass over the document.
19
+ * The box the scene drawn from a source fits inside: the document's content
20
+ * rect, or for a view the tables it shows at their view points and no memo,
21
+ * since a view places none. A view showing nothing has no box.
21
22
  */
22
- export declare function getContentRects(state: RootState, moves?: ReadonlyArray<TableMove>): Rect[];
23
+ export declare function getSceneContentRect(state: RootState, source?: GeometrySource): Rect | null;
24
+ /**
25
+ * One box per table and memo the source shows, each table at the point named
26
+ * for it. The reader that asks which entity is nearest needs them apart, where
27
+ * the box below folds them together, and both are the same pass over the scene.
28
+ */
29
+ export declare function getContentRects(state: RootState, moves?: ReadonlyArray<TableMove>, source?: GeometrySource): Rect[];
23
30
  /**
24
31
  * The content rect as it will stand once each table named is at its point. The
25
32
  * placement centres the view on where its tables land in the very dispatch that
26
33
  * moves them, so it has to know the box before any reducer has run.
27
34
  */
28
- export declare function getContentRectAfter(state: RootState, moves: ReadonlyArray<TableMove>): Rect | null;
35
+ export declare function getContentRectAfter(state: RootState, moves: ReadonlyArray<TableMove>, source?: GeometrySource): Rect | null;
29
36
  //# sourceMappingURL=contentBounds.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { Viewport } from '../../engine/modules/editor/state';
2
+ import { Rect } from './metrics';
3
+ /**
4
+ * Scene units left around the content when a fit takes it in, so a table at
5
+ * the edge of what is fitted is not flush against the edge of the screen.
6
+ */
7
+ export declare const FIT_PADDING = 200;
8
+ /** The closest the placement preview opens at: the whole document is what it is for. */
9
+ export declare const PREVIEW_ZOOM_MAX = 0.7;
10
+ /**
11
+ * The zoom a fit opens at: the content with its padding fitted into the screen
12
+ * on both axes, rounded to the two places a zoom is kept to, and held between
13
+ * the floor every zoom has and a ceiling, the preview's unless a view names its own.
14
+ */
15
+ export declare function previewZoomLevel(content: Rect, viewport: Viewport, maxZoom?: number): number;
16
+ //# sourceMappingURL=fitZoom.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { RootState } from '../../engine/state';
2
2
  import { Memo, Table } from '../../internal-types';
3
3
  import { ColumnWidth } from '../../utils/calcTable';
4
+ import { GeometrySource } from '../../utils/draw-relationship/geometrySource';
4
5
  export type Rect = {
5
6
  x: number;
6
7
  y: number;
@@ -12,19 +13,19 @@ export type Rect = {
12
13
  * relationship sort measures anchors against, so a scene node and the connectors
13
14
  * reaching it cannot disagree about where an edge is.
14
15
  */
15
- export declare function getTableRect(state: RootState, table: Table): Rect;
16
+ export declare function getTableRect(state: RootState, table: Table, source?: GeometrySource): Rect;
16
17
  /**
17
18
  * The cell widths a table's rows are laid out against. The total here and the
18
19
  * width in getTableRect are the same sum reached by two routes, the box through
19
20
  * the sort's cache and this fresh, which is the split the DOM scene drew with.
20
21
  */
21
- export declare function getTableWidths(state: RootState, table: Table): ColumnWidth;
22
+ export declare function getTableWidths(state: RootState, table: Table, source?: GeometrySource): ColumnWidth;
22
23
  /**
23
24
  * One column row, taken apart from the same sum calcTableHeight adds up: the
24
- * rows start below the header inside the table's inset, and each is one
25
- * COLUMN_HEIGHT tall.
25
+ * rows start below the header inside the table's inset, and each is one row
26
+ * height tall. Both of those come from the source, as they do in that sum.
26
27
  */
27
- export declare function getColumnRect(state: RootState, table: Table, index: number): Rect;
28
+ export declare function getColumnRect(state: RootState, table: Table, index: number, source?: GeometrySource): Rect;
28
29
  /** The box a memo occupies, sash and header included. */
29
30
  export declare function getMemoRect(memo: Memo): Rect;
30
31
  //# sourceMappingURL=metrics.d.ts.map
@@ -1,20 +1,23 @@
1
1
  import { RootState } from '../../engine/state';
2
2
  import { Point } from '../../internal-types';
3
3
  import { Rect } from './metrics';
4
+ import { GeometrySource } from '../../utils/draw-relationship/geometrySource';
5
+ /** One scene among every store on the page: its editor's id and the source it draws from. */
6
+ export declare const sceneKeyOf: (root: RootState, source: GeometrySource) => string;
4
7
  /**
5
8
  * Holds the content rect and the origin where they stand, so everything a drag
6
9
  * is watched against, the scroll ranges, both scrollbars and the minimap,
7
10
  * stands still together while it lasts and moves together on the drop.
8
11
  */
9
- export declare function freezeView(root: RootState): void;
10
- export declare function thawView(root: RootState): void;
11
- export declare function isViewFrozen(root: RootState): boolean;
12
- /** The content rect a drag began with while one holds this store's view, else the live one. */
13
- export declare function getViewContentRect(root: RootState): Rect | null;
12
+ export declare function freezeView(root: RootState, source?: GeometrySource): void;
13
+ export declare function thawView(root: RootState, source?: GeometrySource): void;
14
+ export declare function isViewFrozen(root: RootState, source?: GeometrySource): boolean;
15
+ /** The content rect a drag began with while one holds this scene's view, else the live one. */
16
+ export declare function getViewContentRect(root: RootState, source?: GeometrySource): Rect | null;
14
17
  /**
15
- * The origin a drag began from while one holds this store's view, else null.
18
+ * The origin a drag began from while one holds this scene's view, else null.
16
19
  * The scroll range keeps it inside its hull for the drag's duration, so the
17
20
  * thumb a drag scales against cannot shrink under the pointer as the origin closes in.
18
21
  */
19
- export declare function getFrozenOrigin(root: RootState): Point | null;
22
+ export declare function getFrozenOrigin(root: RootState, source?: GeometrySource): Point | null;
20
23
  //# sourceMappingURL=viewFreeze.d.ts.map
@@ -0,0 +1,89 @@
1
+ import { RootState } from '../../engine/state';
2
+ import { Point, Table } from '../../internal-types';
3
+ import { GeometrySource } from '../../utils/draw-relationship/geometrySource';
4
+ /**
5
+ * The ids a scene drawn from one source shows, each list in document order.
6
+ * To be read, never changed in place: for the document these are the
7
+ * document's own arrays, and with no view open the one shared empty set.
8
+ */
9
+ export type VisibleIds = {
10
+ tableIds: string[];
11
+ memoIds: string[];
12
+ relationshipIds: string[];
13
+ };
14
+ /** The tables a view lights and the relationships between them and what lit them. */
15
+ export type HighlightIds = {
16
+ tableIds: Set<string>;
17
+ relationshipIds: Set<string>;
18
+ };
19
+ /**
20
+ * What a box, a connector, a dot or a name fades to while it sits outside
21
+ * the lit neighbourhood of a hovered table, so that neighbourhood reads on its
22
+ * own. One value for the graph and the Flow scene, which fade the same way.
23
+ */
24
+ export declare const DIM_OPACITY = 0.2;
25
+ /**
26
+ * Where a table stands in the source given: its own placement in the
27
+ * document, or the point the view of that kind placed it at. A view that has
28
+ * not placed it yet shows it where the document has it, until a layout lands.
29
+ */
30
+ export declare function getTablePoint(state: RootState, table: Table, source?: GeometrySource): Point;
31
+ /**
32
+ * The same rows for every table at once, walked once over the document. What a
33
+ * scene hands its cards, since a card asking for its own would walk every link
34
+ * again, once per card drawn.
35
+ *
36
+ * @example
37
+ * const related = relationshipColumnIdsByTable(state).get(table.id);
38
+ */
39
+ export declare function relationshipColumnIdsByTable(state: RootState): Map<string, Set<string>>;
40
+ /**
41
+ * The rows a table shows in the source given, in column order: every row in
42
+ * the document, and in a view what its show mode says, none, all, or the key
43
+ * rows, a key row carrying a primary or foreign key flag or ending any relationship.
44
+ */
45
+ export declare function getVisibleColumnIds(state: RootState, table: Table, source?: GeometrySource): string[];
46
+ /**
47
+ * What a scene drawn from the source given shows: the whole document, or a
48
+ * view's centers with their neighbours one relationship out while it stands on
49
+ * centers and what its layout placed while it stands on none, with no memo and only the joining relationships.
50
+ */
51
+ export declare function getVisibleIds(state: RootState, source?: GeometrySource): VisibleIds;
52
+ /**
53
+ * Takes the hover for the view of the source given, or drops it on null. A
54
+ * null from a scene of another kind leaves the hover alone: a leave on the
55
+ * document scene beside it is not the view's table leaving the pointer.
56
+ */
57
+ export declare function setViewHoverTable(root: RootState, tableId: string | null, source?: GeometrySource): void;
58
+ /**
59
+ * Drops the hover one table holds as it leaves the scene of the source given.
60
+ * A node culled or unmounted under the pointer sends no mouseleave, and the
61
+ * entry left behind would light that table until the next hover and hold its view meanwhile.
62
+ */
63
+ export declare function clearViewHoverTable(root: RootState, tableId: string, source?: GeometrySource): void;
64
+ export declare function getViewHoverTable(root: RootState, source?: GeometrySource): string | null;
65
+ /**
66
+ * Pins the table in the view of the source given, or lets it go when it is
67
+ * the one already pinned. A second click on the same card is what releases it,
68
+ * so the gesture is its own toggle and nothing else has to clear the slot.
69
+ */
70
+ export declare function setViewPinnedTable(root: RootState, tableId: string, source?: GeometrySource): void;
71
+ /**
72
+ * Lets go of whatever the view of the source given pinned. The press on the
73
+ * background that clears a highlight, beside the second press on the card that
74
+ * took it, both of which are the reader saying the same thing.
75
+ */
76
+ export declare function clearViewPinnedTable(root: RootState, source?: GeometrySource): void;
77
+ /**
78
+ * The pin the view of the source given holds. One taken in a view that has
79
+ * since closed fails the identity below and is never read, which is why only a
80
+ * reader's own gesture ever clears the slot.
81
+ */
82
+ export declare function getViewPinnedTable(root: RootState, source?: GeometrySource): string | null;
83
+ /**
84
+ * What the view of the source given lights: the table hovered, the table
85
+ * pinned, and for each of those every shown relationship at it and the table
86
+ * at the other end. A narrowed view rests unlit like the whole document, since its centers seed nothing.
87
+ */
88
+ export declare function getHighlightIds(state: RootState, source?: GeometrySource): HighlightIds;
89
+ //# sourceMappingURL=viewLayout.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { RootState } from '../../engine/state';
2
2
  import { Memo, Point, Relationship, Settings, Table } from '../../internal-types';
3
3
  import { Rect } from './metrics';
4
+ import { GeometrySource } from '../../utils/draw-relationship/geometrySource';
4
5
  export type CullingRect = Rect;
5
6
  /** The origin and the zoom every scene layer is placed with. */
6
7
  export type SceneTransform = Pick<Settings, 'originX' | 'originY' | 'zoomLevel'>;
@@ -8,6 +9,18 @@ export type CullingRectOptions = SceneTransform & {
8
9
  viewportWidth: number;
9
10
  viewportHeight: number;
10
11
  };
12
+ /**
13
+ * The placement a reader standing outside every scene means: the active
14
+ * view's while one is open, else the document's. The zoom generators read
15
+ * it, since the redirect sends what they dispatch there too.
16
+ */
17
+ export declare function getActiveTransform(state: RootState): SceneTransform;
18
+ /**
19
+ * The placement a scene is drawn at: the document's own, or that of the view
20
+ * of the scene's kind. A view scene whose view is not open falls back to the
21
+ * document, so it draws something rather than nothing while one is opening.
22
+ */
23
+ export declare function getSceneTransform(state: RootState, source?: GeometrySource): SceneTransform;
11
24
  /**
12
25
  * Where a scene layer sits on the stage, so screen equals scene times the zoom
13
26
  * plus this. The document stores it directly: settings.originX and originY are
@@ -30,16 +43,16 @@ export declare function getOriginToPlace(zoomLevel: number, scene: Point, screen
30
43
  * measured in viewport pixels, never in the document, which is not the screen.
31
44
  */
32
45
  export declare function createCullingRect(options: CullingRectOptions): CullingRect;
33
- /** The culling rect for the editor's current origin, zoom and viewport. */
34
- export declare function getCullingRect(state: RootState): CullingRect;
46
+ /** The culling rect for the scene's current origin, zoom and the editor's viewport. */
47
+ export declare function getCullingRect(state: RootState, source?: GeometrySource): CullingRect;
35
48
  /** Inclusive overlap: a box touching the rect along an edge is still drawn. */
36
49
  export declare function intersects(rect: Rect, other: Rect): boolean;
37
- export declare function isTableVisible(rect: CullingRect, state: RootState, table: Table): boolean;
50
+ export declare function isTableVisible(rect: CullingRect, state: RootState, table: Table, source?: GeometrySource): boolean;
38
51
  export declare function isMemoVisible(rect: CullingRect, memo: Memo): boolean;
39
52
  /**
40
53
  * A connector is kept for its whole reach, not for its routed polyline: the
41
54
  * route holds neither the anchors nor the cardinality decorations, and either
42
55
  * can be on screen with every routed point off it.
43
56
  */
44
- export declare function isRelationshipVisible(rect: CullingRect, relationship: Relationship, strokeWidth?: number): boolean;
57
+ export declare function isRelationshipVisible(rect: CullingRect, relationship: Relationship, strokeWidth?: number, source?: GeometrySource): boolean;
45
58
  //# sourceMappingURL=viewport.d.ts.map