@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
package/README.md CHANGED
@@ -138,7 +138,7 @@ erd-editor {
138
138
 
139
139
  | Method | Description |
140
140
  | --- | --- |
141
- | `setInitialValue(value: string)` | Load the initial document. Does not create a history entry. |
141
+ | `setInitialValue(value: string)` | Load the initial document. Does not create a history entry, and clears the undo history, so nothing done before the load can be undone or redone onto it. |
142
142
  | `getSchemaSQL(vendor?)` | Export DDL. `vendor` is one of `Databricks`, `MariaDB`, `MSSQL`, `MySQL`, `Oracle`, `PostgreSQL`, `Snowflake`, `SQLite`; omit it to use the document's own setting. |
143
143
  | `setSchemaSQL(value: string)` | Parse a DDL string and **replace** the current document with it. Lands in the undo history; an empty string is ignored. |
144
144
  | `setSchemaGraphQL(value: string)` | Parse a GraphQL SDL string and **replace** the current document with it. Object types become tables, scalars map to the document's own dialect, and relationships are read from the fields that point at another type. Lands in the undo history; an empty string is ignored. |
@@ -1,7 +1,5 @@
1
1
  import { FC, Ref } from '@dineug/r-html';
2
2
  import { AppContext } from '../../appContext';
3
- import { Viewport } from '../../../engine/modules/editor/state';
4
- import { Rect } from '../../../konva/scene/metrics';
5
3
  export type AutomaticTablePlacementProps = {
6
4
  app: Ref<AppContext>;
7
5
  onChange: (tables: TablePoint[]) => void;
@@ -11,19 +9,6 @@ export type TablePoint = {
11
9
  x: number;
12
10
  y: number;
13
11
  };
14
- /**
15
- * Scene units left around the content when the preview fits it, so a table at
16
- * the edge of the document is not flush against the edge of the screen.
17
- */
18
- export declare const FIT_PADDING = 200;
19
- /** The closest the preview opens at: the whole document is what it is for. */
20
- export declare const PREVIEW_ZOOM_MAX = 0.7;
21
- /**
22
- * The zoom the preview opens at: the content with its padding fitted into the
23
- * screen on both axes, rounded to the two places a zoom is kept to, and held
24
- * between the floor every zoom has and the ceiling above.
25
- */
26
- export declare function previewZoomLevel(content: Rect, viewport: Viewport): number;
27
12
  /** How far the simulation has cooled, from 0 to 1. */
28
13
  export type PlacementToastState = {
29
14
  progress: number;
@@ -1,5 +1,15 @@
1
+ import { FC } from '@dineug/r-html';
1
2
  import { AppContext } from '../../appContext';
2
3
  import { ElkLayoutPoint, ElkPlacement } from '../../../services/elk-layout';
4
+ type PlacingToastProps = {
5
+ onCancel: () => void;
6
+ };
7
+ /**
8
+ * The message up while ELK works, and the whole of what a one-shot placement
9
+ * shows. There is no progress to follow and nothing to read off a layout that
10
+ * does not exist yet, so Cancel is the only thing on it. A view placement shows it too.
11
+ */
12
+ export declare const PlacingToast: FC<PlacingToastProps>;
3
13
  /**
4
14
  * Places every table by ELK and hands the layout straight over. No preview
5
15
  * overlay: one layout arrives at once, there is nothing to weigh before it
@@ -9,4 +19,5 @@ import { ElkLayoutPoint, ElkPlacement } from '../../../services/elk-layout';
9
19
  * runElkPlacement(app.value, placement, handleChangeAutomaticTablePlacement);
10
20
  */
11
21
  export declare function runElkPlacement(app: AppContext, placement: ElkPlacement, onChange: (tables: ElkLayoutPoint[]) => void): Promise<void>;
22
+ export {};
12
23
  //# sourceMappingURL=runElkPlacement.d.ts.map
@@ -4,9 +4,9 @@ export type CanvasSceneProps = {
4
4
  root: Ref<HTMLDivElement>;
5
5
  };
6
6
  /**
7
- * The four layers of the canvas, plus the one a drag opens. Background, scene
8
- * and presence carry the canvas transform, and the marquee layer stays in
9
- * screen space because that is where its own mousemove measures.
7
+ * The layers of the canvas, four over the document and four under a view,
8
+ * plus the one a drag opens. Each carries the canvas transform but the
9
+ * marquee, which stays in screen space where its own mousemove measures.
10
10
  */
11
11
  declare const CanvasScene: FC<CanvasSceneProps>;
12
12
  /**
@@ -0,0 +1,10 @@
1
+ import { FC } from '@dineug/r-html';
2
+ export type ColumnDragGhostProps = {};
3
+ /**
4
+ * The rows a column drag carries, drawn on the presence layer under the
5
+ * pointer where the browser used to hang its drag image. Each keeps its name
6
+ * and type where its table lays them out, and none of it answers a hit.
7
+ */
8
+ declare const ColumnDragGhost: FC<ColumnDragGhostProps>;
9
+ export default ColumnDragGhost;
10
+ //# sourceMappingURL=ColumnDragGhost.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { RootState } from '../../../../engine/state';
2
+ import { Point, Table } from '../../../../internal-types';
3
+ /**
4
+ * The pointer a column drag holds, in canvas units: where it is, where it took
5
+ * the rows it carries, and whether a drop target is under it right now.
6
+ */
7
+ export type ColumnDragPointer = {
8
+ x: number;
9
+ y: number;
10
+ /** The pointer's offset from the top left of the rows it carries. */
11
+ grabX: number;
12
+ grabY: number;
13
+ over: boolean;
14
+ };
15
+ /**
16
+ * Takes hold of the rows a drag carries at the press on one of them. The ghost
17
+ * stacks them in drag order, so the pressed row sits that many rows down it.
18
+ */
19
+ export declare function beginColumnDragPointer(root: RootState, table: Table, press: Point, { columnId, columnIds }: {
20
+ columnId: string;
21
+ columnIds: string[];
22
+ }): void;
23
+ /** Follows the pointer of a drag that began, and ignores one that never did. */
24
+ export declare function moveColumnDragPointer(root: RootState, { x, y }: Point, over: boolean): void;
25
+ export declare function endColumnDragPointer(root: RootState): void;
26
+ /** Reads the pointer through the observable, so a render tracks it. */
27
+ export declare function getColumnDragPointer(root: RootState): ColumnDragPointer | null;
28
+ //# sourceMappingURL=columnDragPointer.d.ts.map
@@ -1,7 +1,8 @@
1
1
  import { RootState } from '../../../engine/state';
2
- /** Raises the flag and holds the view as it stands until endEntityDrag. */
3
- export declare function beginEntityDrag(root: RootState): void;
4
- export declare function endEntityDrag(root: RootState): void;
2
+ import { GeometrySource } from '../../../utils/draw-relationship/geometrySource';
3
+ /** Raises the flag and holds the scene's view as it stands until endEntityDrag. */
4
+ export declare function beginEntityDrag(root: RootState, source?: GeometrySource): void;
5
+ export declare function endEntityDrag(root: RootState, source?: GeometrySource): void;
5
6
  /** Reads the flag through the observable, so a scene render tracks it. */
6
- export declare function isEntityDragActive(root: RootState): boolean;
7
+ export declare function isEntityDragActive(root: RootState, source?: GeometrySource): boolean;
7
8
  //# sourceMappingURL=entityDrag.d.ts.map
@@ -0,0 +1,35 @@
1
+ /** The time and the frame a transition runs on, so a spec can step it and count its frames. */
2
+ export type TransitionClock = {
3
+ now(): number;
4
+ requestFrame(callback: () => void): number;
5
+ cancelFrame(handle: number): void;
6
+ };
7
+ /** How long a highlight takes to come up or go out, the span the reference gives its edges. */
8
+ export declare const TRANSITION_MS = 300;
9
+ /**
10
+ * The key one transition is held under. The editor id leads so a scene that
11
+ * closes drops its own keys and no one else's, and the kind separates a table
12
+ * from a connector that was minted the same id.
13
+ */
14
+ export declare function transitionKey(editorId: string, kind: string, id: string): string;
15
+ /**
16
+ * What the key shows now: where the frame last put it, or the target it rests
17
+ * at. Reading a key that is not moving arms nothing, which is what keeps this
18
+ * module frameless in the export worker that carries it.
19
+ */
20
+ export declare function progressOf(key: string): number;
21
+ /**
22
+ * Sends a key toward the target given. A key already heading there is left
23
+ * alone, and a key asked for the first time settles on the target at once, so
24
+ * only a change a reader could have watched is animated.
25
+ */
26
+ export declare function transitionTo(key: string, target: number): void;
27
+ /** Drops every key one editor holds and cancels the frame if nothing else is moving. */
28
+ export declare function stopTransitions(editorId: string): void;
29
+ /**
30
+ * Runs the transitions on the clock given, or on the browser's own again when
31
+ * called with nothing. Whatever was moving lands on its target, since a start
32
+ * time taken from one clock means nothing against another.
33
+ */
34
+ export declare function setTransitionClock(next?: TransitionClock): void;
35
+ //# sourceMappingURL=highlightTransition.d.ts.map
@@ -1,7 +1,9 @@
1
+ import { Ref } from '@dineug/r-html';
1
2
  import { Ctx, Memo } from '../../../../internal-types';
3
+ import { GeometrySource } from '../../../../utils/draw-relationship/geometrySource';
2
4
  export declare function useMoveMemo(ctx: Ctx, props: {
3
5
  memo: Memo;
4
- }): {
6
+ }, source: Ref<GeometrySource>): {
5
7
  onMoveStart: (event: import('../sceneTokens').ScenePointerEvent) => void;
6
8
  };
7
9
  //# sourceMappingURL=useMoveMemo.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The colour a fraction of the way from one to the other, mixed straight in
3
+ * rgb. Both ends come back exactly as they were given, and a colour this
4
+ * cannot read is handed back whole rather than mangled into one that is not.
5
+ */
6
+ export declare function mixColor(from: string, to: string, t: number): string;
7
+ //# sourceMappingURL=mixColor.d.ts.map
@@ -5,6 +5,8 @@ export type RelationshipGroupProps = {
5
5
  relationships: RelationshipType[];
6
6
  viewport?: CullingRect;
7
7
  strokeWidth?: number;
8
+ /** The connectors a view lights, decided once by the scene rather than by each leaf. */
9
+ litIds?: Set<string>;
8
10
  };
9
11
  /**
10
12
  * Culling lives here, not in the parent, because a route is a side channel of
@@ -3,6 +3,8 @@ import { Relationship as RelationshipType } from '../../../../../internal-types'
3
3
  export type RelationshipProps = {
4
4
  relationship: RelationshipType;
5
5
  strokeWidth: number;
6
+ /** Whether the view lights this connector, decided by the scene it is drawn in. */
7
+ lit?: boolean;
6
8
  };
7
9
  declare const Relationship: FC<RelationshipProps>;
8
10
  export default Relationship;
@@ -11,8 +11,8 @@ export declare const segment: ({ x1, y1, x2, y2 }: PointToPoint) => number[];
11
11
  * One stroke of a cardinality marker. The paint, the width and the two naming
12
12
  * attributes are per node in konva, so every marker is drawn through here.
13
13
  */
14
- export declare function decorationLine(points: PointToPoint, stroke: string): DOMTemplateLiterals;
14
+ export declare function decorationLine(points: PointToPoint, stroke: string, strokeWidth: number): DOMTemplateLiterals;
15
15
  /** The optional ring of a cardinality marker, at either anchor. */
16
- export declare function decorationRing({ cx, cy }: Circle, stroke: string): DOMTemplateLiterals;
17
- export declare function relationshipShape(relationshipType: number, { path, line }: RelationshipPath, stroke: string): DOMTemplateLiterals | null;
16
+ export declare function decorationRing({ cx, cy }: Circle, stroke: string, strokeWidth: number): DOMTemplateLiterals;
17
+ export declare function relationshipShape(relationshipType: number, { path, line }: RelationshipPath, stroke: string, strokeWidth: number): DOMTemplateLiterals | null;
18
18
  //# sourceMappingURL=Relationship.template.d.ts.map
@@ -1,15 +1,16 @@
1
1
  import { Context } from 'konva/lib/Context';
2
2
  import { Shape } from 'konva/lib/Shape';
3
+ import { GeometrySource } from '../../../utils/draw-relationship/geometrySource';
3
4
  /** What konva calls to put a shape on the hit canvas, in the shape's own space. */
4
5
  export type HitFunc = (context: Context, shape: Shape) => void;
5
6
  /**
6
- * The box a column cell's text answers a press for: the full row height and
7
- * the gap to the next cell, which is the div the dom scene put the input in.
8
- * The text carries it so the cell needs no shape that exists only to be hit.
7
+ * One of those per source, built once. A row is not the same height in a view
8
+ * as in the document, and konva reads this off an attribute, so a function
9
+ * built per render would mark every cell dirty every frame.
9
10
  */
10
- export declare const columnCellHit: HitFunc;
11
- /** The header cell's box, the same way, at the header input's own height. */
12
- export declare const headerCellHit: HitFunc;
11
+ export declare const columnCellHit: Record<GeometrySource, HitFunc>;
12
+ /** One of those per source, built once, for the reason columnCellHit is. */
13
+ export declare const headerCellHit: Record<GeometrySource, HitFunc>;
13
14
  /**
14
15
  * The whole 24 unit box of a lucide icon, answered by the first shape it draws.
15
16
  * A circle's origin is its centre, so its own position is what puts the box
@@ -8,10 +8,20 @@ export type ScenePointerEvent = SceneMouseEvent | SceneTouchEvent;
8
8
  * make a cell wider or narrower than the width the layout reserved for it.
9
9
  */
10
10
  export declare const SCENE_FONT_FAMILY: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Open Sans', system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'";
11
+ /**
12
+ * The monospace face a view draws a type cell in, the same stack the code
13
+ * panels use. A second face on the scene, so the metrics below are kept per
14
+ * face rather than as the one pair the text face used to be the whole of.
15
+ */
16
+ export declare const SCENE_CODE_FONT_FAMILY: "'Menlo', 'Consolas', 'Bitstream Vera Sans Mono', monospace, 'Apple Color Emoji', 'Segoe UI Emoji'";
11
17
  /** The px behind font-size-1, which is what typography.paragraph resolves to. */
12
18
  export declare const SCENE_FONT_SIZE = 12;
13
- /** The css font shorthand konva builds for a cell's text, and measures it with. */
19
+ /** That shorthand in the text face. */
14
20
  export declare const SCENE_FONT: string;
21
+ /** The weight every cell but a view card's header name is drawn at. */
22
+ export declare const SCENE_FONT_WEIGHT = "normal";
23
+ /** The heavier weight a view card draws its header name at. */
24
+ export declare const VIEW_HEADER_FONT_WEIGHT = "500";
15
25
  /** The pair a canvas centres a drawn line by, which no line box is involved in. */
16
26
  export type SceneFontMetrics = {
17
27
  ascent: number;
@@ -19,13 +29,13 @@ export type SceneFontMetrics = {
19
29
  };
20
30
  /**
21
31
  * The ascent and descent konva centres a drawn line by, read with the measure
22
- * call konva makes itself. A canvas has no line box to lean on, so this pair is
23
- * the whole of where a baseline lands, and the editor has to read the same one.
32
+ * call konva makes itself, and kept per face: the scene draws a type cell in
33
+ * the code face, whose overhang is not the text face's and whose baseline is its own.
24
34
  *
25
35
  * @example
26
36
  * const { ascent, descent } = getSceneFontMetrics();
27
37
  */
28
- export declare function getSceneFontMetrics(): SceneFontMetrics;
38
+ export declare function getSceneFontMetrics(fontFamily?: string): SceneFontMetrics;
29
39
  /**
30
40
  * The px behind font-size-5 through font-size-9, in the order HighLevelTable
31
41
  * steps through them as the zoom falls. The scale itself is a CSS custom
@@ -36,12 +46,38 @@ export declare const HIGH_LEVEL_FONT_SIZES: readonly [20, 24, 28, 35, 60];
36
46
  export declare const TABLE_INSET: number;
37
47
  /** The radius Table.styles rounds a table box with. */
38
48
  export declare const TABLE_CORNER_RADIUS = 6;
39
- /** The min-height Table.styles gives the colour bar across a table header. */
40
- export declare const HEADER_COLOR_HEIGHT = 4;
41
49
  /** The 1.5px underline EditInput draws for a focused, edited or shared cell. */
42
50
  export declare const FOCUS_BORDER_HEIGHT = 1.5;
43
51
  /** What the ring outside a table box costs, as outline and box-shadow both do. */
44
52
  export declare const RING_WIDTH = 1;
53
+ /**
54
+ * The drop shadow a view card sits on, deeper than any a document box casts.
55
+ * The alpha is the shadow's own, since the minimap shadow token it borrows is
56
+ * an opaque black.
57
+ */
58
+ export declare const VIEW_CARD_SHADOW_BLUR = 20;
59
+ export declare const VIEW_CARD_SHADOW_OFFSET_X = 0;
60
+ export declare const VIEW_CARD_SHADOW_OFFSET_Y = 2;
61
+ export declare const VIEW_CARD_SHADOW_OPACITY = 0.4;
62
+ /** A drop shadow as the five konva shadow attrs a body sets from it. */
63
+ export type CardShadow = {
64
+ color: string;
65
+ blur: number;
66
+ offsetX: number;
67
+ offsetY: number;
68
+ opacity: number;
69
+ };
70
+ /** The shadow a view card casts, in the colour of the token it borrows. */
71
+ export declare function viewCardShadow(color: string): CardShadow;
72
+ export declare const DOCUMENT_CARD_SHADOW_BLUR = 10;
73
+ export declare const DOCUMENT_CARD_SHADOW_OFFSET_Y = 2;
74
+ /**
75
+ * The bloom a lit view card wears, drawn as a shadow on a stroke and never as
76
+ * a filled sibling: a fill behind the body would have to be reordered under it,
77
+ * and the ledger is the only thing allowed to order the scene.
78
+ */
79
+ export declare const VIEW_CARD_GLOW_BLUR = 14;
80
+ export declare const VIEW_CARD_GLOW_OPACITY = 0.55;
45
81
  /** The side of the square viewBox every icon is authored in. */
46
82
  export declare const ICON_VIEW_SIZE: number;
47
83
  /** What a colour is when the scene paints nothing, as a CSS keyword konva takes. */
@@ -51,6 +87,12 @@ export declare const TRANSPARENT = "transparent";
51
87
  * keeps the whole padded box clickable the way its div did.
52
88
  */
53
89
  export declare const HIT_FILL = "transparent";
90
+ /**
91
+ * The shadow a document table or memo casts, in a colour carrying its alpha. No
92
+ * shadow sets no attr at all, so the canvas never spends a blur on nothing, and
93
+ * a scene with no theme above it reads every token as undefined.
94
+ */
95
+ export declare function documentCardShadow(color: string | undefined): CardShadow | null;
54
96
  /** The hand a clickable scene node asks for, as the dom scene spelt it in css. */
55
97
  export declare const CURSOR_POINTER = "pointer";
56
98
  /** The beam a textarea carried on its own, which a drawn body has to ask for. */
@@ -60,9 +102,19 @@ export declare const CURSOR_INHERIT = "";
60
102
  /**
61
103
  * Points the stage container at a cursor. A konva node carries none of its own,
62
104
  * so the container is where the css the dom scene put on an element now lives.
105
+ * Under a hold the cursor is only noted, for the release to write back.
63
106
  *
64
107
  * @example
65
108
  * on:mouseenter={(event) => setSceneCursor(event, CURSOR_POINTER)}
66
109
  */
67
110
  export declare function setSceneCursor(event: ScenePointerEvent, cursor: string): void;
111
+ /**
112
+ * Keeps the container on a cursor for a mouse gesture, whatever the pointer runs
113
+ * over, and hands back the release that shows what the last hover asked for. A
114
+ * touch has no cursor to keep, so its press holds nothing.
115
+ *
116
+ * @example
117
+ * drag$.subscribe(handleMove).add(holdSceneCursor(event, 'ew-resize'));
118
+ */
119
+ export declare function holdSceneCursor(event: ScenePointerEvent, cursor: string): () => void;
68
120
  //# sourceMappingURL=sceneTokens.d.ts.map
@@ -10,6 +10,13 @@ export type TableProps = {
10
10
  editorFocused?: boolean;
11
11
  /** Off while the table is kept built but scrolled out of the culling rect. */
12
12
  visible?: boolean;
13
+ /** Whether the view lights this card, decided by the scene it is drawn in. */
14
+ lit?: boolean;
15
+ /**
16
+ * The rows of this table a relationship ends on, which a view tints. Decided
17
+ * by the scene, which walks the document's links once for every card it draws.
18
+ */
19
+ relatedColumnIds?: Set<string> | null;
13
20
  };
14
21
  declare const Table: FC<TableProps>;
15
22
  export default Table;
@@ -3,6 +3,7 @@ import { RootState } from '../../../../engine/state';
3
3
  import { Table } from '../../../../internal-types';
4
4
  import { Theme } from '../../../../themes/tokens';
5
5
  import { ColumnWidth } from '../../../../utils/calcTable';
6
+ import { GeometrySource } from '../../../../utils/draw-relationship/geometrySource';
6
7
  /** The four widths a column row measures from its table; the rest are fixed. */
7
8
  export type ColumnCellWidths = Pick<ColumnWidth, 'comment' | 'dataType' | 'default' | 'name'>;
8
9
  /** One editable box on a table, positioned inside the table's own group. */
@@ -16,12 +17,40 @@ export type ColumnCellSlot = CellSlot & {
16
17
  };
17
18
  /** Where the header cell row starts inside a table group. */
18
19
  export declare const HEADER_CELLS_X: number;
19
- export declare const HEADER_CELLS_Y: number;
20
- /** The text line inside a header cell and inside a column cell. */
21
- export declare const HEADER_TEXT_Y = 2;
22
- export declare const COLUMN_TEXT_Y = 2;
23
- /** Where the scene runs its focus rect inside a cell, header and column both. */
20
+ /**
21
+ * How far down a table group the header cells start. The document band starts
22
+ * at the top border, over the card's top padding, and keeps its own room over
23
+ * the line; a view sets its icon line inside that padding instead.
24
+ */
25
+ export declare function getHeaderCellsY(source?: GeometrySource): number;
26
+ /**
27
+ * The text line inside a header cell. The document pads its input box; a view
28
+ * starts its line at the top of the icon band, which the card's own padding has
29
+ * already put where the band wants it.
30
+ */
31
+ export declare function getHeaderTextY(source?: GeometrySource): number;
32
+ /**
33
+ * The box that line is centred in. The document uses the box its editor opens
34
+ * an input in; a view centres on the icon beside the name instead, so the two
35
+ * share one middle.
36
+ */
37
+ export declare function getHeaderTextHeight(source?: GeometrySource): number;
38
+ /** The text line inside a column cell, at the padding its own source lays rows out with. */
39
+ export declare function getColumnTextY(source?: GeometrySource): number;
40
+ /**
41
+ * The box that line is centred in, the same split: the editor's input box in
42
+ * the document, and the row's own icon band in a view, which is what leaves the
43
+ * text on the badge's middle.
44
+ */
45
+ export declare function getColumnTextHeight(source?: GeometrySource, fontFamily?: string): number;
46
+ /** Where the scene runs its focus rect inside a header cell. */
24
47
  export declare const CELL_UNDERLINE_Y: number;
48
+ /**
49
+ * The same rect inside a column cell, along the foot of the line box the row
50
+ * leaves between its two paddings. The document draws it alone, so the row it
51
+ * is measured against is the document's.
52
+ */
53
+ export declare function getColumnUnderlineY(): number;
25
54
  /**
26
55
  * The paint that focus rect takes, header and column both: the input colour
27
56
  * while the cell is being edited, and greyed out with the rest of the focus
@@ -30,35 +59,36 @@ export declare const CELL_UNDERLINE_Y: number;
30
59
  export declare function focusBorderFill(theme: Theme, edit: boolean, editorFocused: boolean | undefined): string;
31
60
  /**
32
61
  * The baseline one line of cell text is drawn on, down from the top of the
33
- * cell. Blink puts a painted baseline on the device grid before the zoom scales
34
- * it, so only a whole pixel survives both rasterisers unchanged.
62
+ * cell, in the face named or the scene's own. Blink puts a painted baseline on
63
+ * the device grid before the zoom scales it, so only a whole pixel survives both rasterisers.
35
64
  *
36
65
  * @example
37
66
  * const baseline = getCellTextBaseline();
38
67
  */
39
- export declare function getCellTextBaseline(): number;
68
+ export declare function getCellTextBaseline(fontFamily?: string): number;
40
69
  /**
41
- * The box one line of cell text is centred in. The scene hands konva this
42
- * height with verticalAlign middle and the editor gives its input the same one,
43
- * which is what puts the two baselines on one whole pixel instead of two.
70
+ * The box one line of cell text is centred in, in the face named or the
71
+ * scene's own. The scene hands konva this height with verticalAlign middle and
72
+ * the editor gives its input the same one, which puts the two baselines on one whole pixel.
44
73
  *
45
74
  * @example
46
75
  * const height = getCellTextHeight();
47
76
  */
48
- export declare function getCellTextHeight(): number;
49
- /** Where a column row's cells start, past the key badge. */
50
- export declare const COLUMN_CELLS_X: number;
77
+ export declare function getCellTextHeight(fontFamily?: string): number;
78
+ /** Where a column row's cells start, past the key badge its own source sizes. */
79
+ export declare function getColumnCellsX(source?: GeometrySource): number;
51
80
  /** The comment width a table draws at, clamped by the setting when it is set. */
52
81
  export declare function getWidthComment(state: RootState, table: Table): number;
53
82
  /**
54
- * The name and comment boxes across a table header. One list feeds both the
55
- * scene that draws them and the overlay that edits them, so an editor can never
56
- * sit anywhere but on the text it replaces.
83
+ * The name and comment boxes past a header's table icon. One list feeds the
84
+ * scene that draws them and the overlay that edits them, so an editor never
85
+ * sits anywhere but on the text it replaces. A view draws the name alone.
57
86
  */
58
- export declare function getHeaderCellSlots(state: RootState, table: Table): CellSlot[];
87
+ export declare function getHeaderCellSlots(state: RootState, table: Table, source?: GeometrySource): CellSlot[];
59
88
  /**
60
89
  * The cells of one column row, in the order the settings put them and at the x
61
- * each lands on once the ones before it have taken their width.
90
+ * each lands on once the ones before it have taken their width. A view lays
91
+ * out the name and the type and reads neither the show bits nor the order.
62
92
  */
63
- export declare function getColumnCellSlots(state: RootState, widths: ColumnCellWidths): ColumnCellSlot[];
93
+ export declare function getColumnCellSlots(state: RootState, widths: ColumnCellWidths, source?: GeometrySource): ColumnCellSlot[];
64
94
  //# sourceMappingURL=cellLayout.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The svg path of the colour a table wears along its left edge: the part of
3
+ * the card's outline left of the strip's width, so it follows both rounded
4
+ * corners where a rect that narrow could only round its own.
5
+ *
6
+ * @example
7
+ * <k-path data={getColorEdgePath(rect.height)} fill={table.ui.color} />
8
+ */
9
+ export declare function getColorEdgePath(height: number): string;
10
+ //# sourceMappingURL=colorEdge.d.ts.map
@@ -1,8 +1,43 @@
1
1
  import { FC } from '@dineug/r-html';
2
2
  import { SceneMouseEvent } from '../../sceneTokens';
3
+ import { DiffPaths } from '../../../diff-viewer/diff';
3
4
  import { Column } from '../../../../../internal-types';
5
+ import { GeometrySource } from '../../../../../utils/draw-relationship/geometrySource';
4
6
  export type ColumnProps = {
5
7
  column: Column;
8
+ /**
9
+ * The source the table drawing this row reads, which picks the row's cells. A
10
+ * prop rather than useSceneSource, the one leaf to depart from it: the table
11
+ * resolved it already, and a context costs an observable and a subscription per row.
12
+ */
13
+ source: GeometrySource;
14
+ /**
15
+ * Whether a relationship ends on this column, which a view tints the row
16
+ * for. Decided by the scene, which walks the links once for every card.
17
+ */
18
+ related?: boolean;
19
+ /**
20
+ * What the diff pane this row is drawn in changed of its column, which tints
21
+ * those cells. A prop for the reason source is one, and null outside a pane.
22
+ */
23
+ diffPaths?: DiffPaths | null;
24
+ /**
25
+ * How far the light has come up on the card this row is drawn in, which is
26
+ * what the row tint and the type cell above are both drawn at. One number, so
27
+ * the two of them come up over the one span of time and a document row reads none of it.
28
+ */
29
+ litAlpha?: number;
30
+ /**
31
+ * Whether the card rules a line under this row. A view card rules one under
32
+ * every row but the last, and a document table rules none.
33
+ */
34
+ divider?: boolean;
35
+ /**
36
+ * Whether this is the row a card ends at. A card draws no padding under its
37
+ * rows, so the last one meets the card's bottom border and takes the two
38
+ * corners it is rounded by, or its square tint would stand outside them.
39
+ */
40
+ last?: boolean;
6
41
  y: number;
7
42
  width: number;
8
43
  selected: boolean;
@@ -0,0 +1,18 @@
1
+ import { GeneratorAction } from '../../../../engine/generator.actions';
2
+ import { RxStore } from '../../../../engine/rx-store';
3
+ /**
4
+ * Stands the reader on one table in the document, selected, scrolled to the
5
+ * middle of the screen at the document's own zoom unless it is already on
6
+ * screen whole, since that scroll is the one change the host hears of. One that is gone is passed over.
7
+ */
8
+ export declare const showErdTableAction$: (tableId: string) => GeneratorAction;
9
+ /**
10
+ * The Go to ERD button's whole errand: the tab in one dispatch, the scroll and
11
+ * the selection in a second. A batch is classified by the state before it, so
12
+ * a scroll travelling with the tab change would be redirected into the view it leaves.
13
+ *
14
+ * @example
15
+ * goToErdTable(store, 'orders');
16
+ */
17
+ export declare function goToErdTable(store: RxStore, tableId: string): void;
18
+ //# sourceMappingURL=goToErd.d.ts.map
@@ -1,7 +1,9 @@
1
+ import { Ref } from '@dineug/r-html';
1
2
  import { Ctx, Table } from '../../../../internal-types';
3
+ import { GeometrySource } from '../../../../utils/draw-relationship/geometrySource';
2
4
  export declare function useMoveTable(ctx: Ctx, props: {
3
5
  table: Table;
4
- }): {
6
+ }, source: Ref<GeometrySource>): {
5
7
  onMoveStart: (event: import('../sceneTokens').ScenePointerEvent) => void;
6
8
  };
7
9
  //# sourceMappingURL=useMoveTable.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { Ref } from '@dineug/r-html';
2
+ import { AppContext } from '../../../appContext';
3
+ import { ScenePointerEvent } from '../sceneTokens';
4
+ import { Table } from '../../../../internal-types';
5
+ import { GeometrySource } from '../../../../utils/draw-relationship/geometrySource';
6
+ /**
7
+ * The click a view scene takes on a table: pressed with the main button and
8
+ * lifted without moving and without the modifier. It pins the highlight on
9
+ * that table, and a second click on the same one lets it go. Documents take none.
10
+ *
11
+ * @example
12
+ * const pin = useViewPin(app, props, sourceRef);
13
+ */
14
+ export declare function useViewPin(app: Ref<AppContext>, props: {
15
+ table: Table;
16
+ }, source: Ref<GeometrySource>): {
17
+ onPress: (event: ScenePointerEvent) => void;
18
+ };
19
+ //# sourceMappingURL=useViewPin.d.ts.map
@@ -1,12 +1,25 @@
1
+ import { Ref } from '@dineug/r-html';
1
2
  import { ScenePointerEvent } from './sceneTokens';
2
3
  import { SelectType } from '../../../engine/modules/editor/state';
3
4
  import { Ctx } from '../../../internal-types';
5
+ import { GeometrySource } from '../../../utils/draw-relationship/geometrySource';
4
6
  export type MoveEntityOptions = {
5
7
  /** Read late, because repeat hands a component a new entity in place. */
6
8
  entityId: () => string;
7
9
  selectType: SelectType;
8
- /** The scene kinds a drag never starts from, as closest read their classes. */
9
- blockedKinds: readonly string[];
10
+ /** The scene kinds a drag never starts from in the scene pressed, as closest read their classes. */
11
+ blockedKinds: (source: GeometrySource) => readonly string[];
12
+ /**
13
+ * The kinds whose press is a click as well: the drag waits for the pointer
14
+ * to travel before it lifts the entity into the drag layer, which takes it
15
+ * off the hit canvas, so a click or a double click there lands where it pressed.
16
+ */
17
+ clickKinds?: (source: GeometrySource) => readonly string[];
18
+ /**
19
+ * The scene the component already stands in, handed down rather than read
20
+ * again here, so a leaf pays for one context subscription and not two.
21
+ */
22
+ source: Ref<GeometrySource>;
10
23
  };
11
24
  /**
12
25
  * The pointer start every draggable entity shares: select it, hand an Alt drag
@@ -3,7 +3,7 @@ export type ContentCompassProps = {};
3
3
  /**
4
4
  * The one thing on a screen that has been panned off every table and memo: an
5
5
  * arrow at the nearest of them, how far off it lies, and a press that puts it
6
- * back in the middle of the screen.
6
+ * back in the middle. A pill of its own, for the diff viewer, which draws no bar to carry one.
7
7
  */
8
8
  declare const ContentCompass: FC<ContentCompassProps>;
9
9
  export default ContentCompass;