@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
@@ -0,0 +1,24 @@
1
+ import { AppContext } from '../../../appContext';
2
+ import { IconName } from '../../../primitives/icon/icons';
3
+ import { TablePlacement } from '../../../../constants/tablePlacement';
4
+ type Menu = {
5
+ name: string;
6
+ iconName: IconName;
7
+ placement: TablePlacement;
8
+ };
9
+ export declare const menus: Menu[];
10
+ /**
11
+ * The placements the author can ask for. Each one emits the same action, and
12
+ * the editor reads the placement to decide between the preview it watches
13
+ * settle and the layout ELK answers in one go.
14
+ *
15
+ * @example
16
+ * createTablePlacementMenus(app.value, props.onClose).map(menu => ...);
17
+ */
18
+ export declare function createTablePlacementMenus({ emitter }: AppContext, onClose: () => void): {
19
+ name: string;
20
+ iconName: IconName;
21
+ onClick: () => void;
22
+ }[];
23
+ export {};
24
+ //# sourceMappingURL=tablePlacementMenus.d.ts.map
@@ -1,9 +1,9 @@
1
1
  import { FC } from '@dineug/r-html';
2
2
  export type FloatingToolbarProps = {};
3
3
  /**
4
- * The tools over the canvas: which of the two a press means, the notation the
5
- * next relationship is drawn in, and zen mode. It is the one surface zen mode
6
- * leaves standing, because the way out of zen mode is in it.
4
+ * The bar over the bottom of the canvas: which of the two a press means, the
5
+ * zoom, the notation the next relationship is drawn in, zen mode, and which
6
+ * way the content lies once the screen holds none. It is the one surface zen mode leaves standing.
7
7
  */
8
8
  declare const FloatingToolbar: FC<FloatingToolbarProps>;
9
9
  export default FloatingToolbar;
@@ -1,4 +1,7 @@
1
1
  export declare const root: import('@dineug/r-html').CSSTemplateLiterals;
2
2
  export declare const menu: import('@dineug/r-html').CSSTemplateLiterals;
3
+ export declare const readout: import('@dineug/r-html').CSSTemplateLiterals;
3
4
  export declare const divider: import('@dineug/r-html').CSSTemplateLiterals;
5
+ export declare const compass: import('@dineug/r-html').CSSTemplateLiterals;
6
+ export declare const compassDistance: import('@dineug/r-html').CSSTemplateLiterals;
4
7
  //# sourceMappingURL=FloatingToolbar.styles.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { DOMTemplateLiterals } from '@dineug/r-html';
2
+ import { ContentCompass } from '../content-compass/compassGeometry';
3
+ export type ToolbarCompassOptions = {
4
+ compass: ContentCompass | null;
5
+ className?: string;
6
+ onClick: () => void;
7
+ };
8
+ /**
9
+ * The last group of a bottom bar once the screen holds no content: which way it
10
+ * lies and how far. A template rather than a component, so the label changes in
11
+ * the same pass as the bar and a menu anchored over it moves with it.
12
+ */
13
+ export declare function toolbarCompass({ compass, className, onClick, }: ToolbarCompassOptions): DOMTemplateLiterals | null;
14
+ //# sourceMappingURL=ToolbarCompass.template.d.ts.map
@@ -2,7 +2,7 @@ import { FC } from '@dineug/r-html';
2
2
  import { Stage } from 'konva/lib/Stage';
3
3
  export type MinimapSceneProps = {};
4
4
  /**
5
- * The whole document on one layer, with no culling: a thumbnail that dropped
5
+ * The whole scene on one layer, with no culling: a thumbnail that dropped
6
6
  * what is off screen would stop being a map of where the rest of it is. Boxes
7
7
  * only, because a connector between two of them is noise at this size.
8
8
  */
@@ -3,6 +3,7 @@ import { RootState } from '../../../engine/state';
3
3
  import { Point } from '../../../internal-types';
4
4
  import { Rect } from '../../../konva/scene/metrics';
5
5
  import { SceneTransform } from '../../../konva/scene/viewport';
6
+ import { GeometrySource } from '../../../utils/draw-relationship/geometrySource';
6
7
  /** The scene placement plus the screen looking at it, which is all a visible rect is read from. */
7
8
  export type ViewTransform = SceneTransform & {
8
9
  viewportWidth: number;
@@ -45,8 +46,8 @@ export type MinimapLayout = {
45
46
  /** Where the box sits inside the MINIMAP_SIZE square, centred along its shorter side. */
46
47
  offset: Point;
47
48
  };
48
- /** The view as the store holds it, for every reader that maps the screen onto the thumbnail. */
49
- export declare function getViewTransform(state: RootState): ViewTransform;
49
+ /** The placement as the store holds it, for every reader that maps the screen onto the thumbnail. */
50
+ export declare function getViewTransform(state: RootState, source?: GeometrySource): ViewTransform;
50
51
  /**
51
52
  * The scene the screen actually covers, read back through the very origin
52
53
  * getSceneOrigin places the scene layer at. One screen pixel buys one over the
@@ -64,7 +65,7 @@ export declare function getReachRect(view: ViewTransform, { left, top }: ScrollR
64
65
  * around it, snapped to the grid, then widened along its shorter side where
65
66
  * that would draw under MINIMAP_BOX_MIN_SIDE. A drag holds its content still.
66
67
  */
67
- export declare function getMinimapLayout(state: RootState): MinimapLayout;
68
+ export declare function getMinimapLayout(state: RootState, source?: GeometrySource): MinimapLayout;
68
69
  /** A scene point in the thumbnail's own pixels; scene zero lands where the layer is placed. */
69
70
  export declare function toMinimapPoint({ map, ratio }: MinimapLayout, point: Point): Point;
70
71
  /** The scene point under a thumbnail pixel, the mapping above inverted. */
@@ -0,0 +1,10 @@
1
+ import { AppContext } from './appContext';
2
+ /**
3
+ * Narrows the Flow view to the tables given and their one hop. State alone:
4
+ * the placement loop reads the display set it names and asks for the layout,
5
+ * so this and the mount never hold two answers to the one question.
6
+ */
7
+ export declare function focusFlowView(app: AppContext, tableIds: string[]): void;
8
+ /** Widens the Flow view back to everything it placed, through that same one channel: state alone. */
9
+ export declare function showAllFlowView(app: AppContext): void;
10
+ //# sourceMappingURL=flowCenters.d.ts.map
@@ -1,8 +1,8 @@
1
1
  import { FC } from '@dineug/r-html';
2
- import { ShikiService } from '../../../services/shikiService';
2
+ import { Lang } from '../../../constants/language';
3
3
  export type CodeBlockProps = {
4
4
  value: string;
5
- lang: Parameters<ShikiService['codeToHtml']>[1]['lang'];
5
+ lang: Lang;
6
6
  theme?: 'dark' | 'light';
7
7
  onCopy?: (value: string) => void;
8
8
  };
@@ -10,17 +10,20 @@ declare const LUCIDE_ICON: {
10
10
  brackets: IconNode;
11
11
  'case-sensitive': IconNode;
12
12
  check: IconNode;
13
+ 'chevron-down': IconNode;
13
14
  'chevron-right': IconNode;
14
15
  code: IconNode;
15
16
  contrast: IconNode;
16
17
  copy: IconNode;
17
18
  database: IconNode;
18
19
  diff: IconNode;
20
+ 'external-link': IconNode;
19
21
  eye: IconNode;
20
22
  'file-diff': IconNode;
21
23
  'file-image': IconNode;
22
24
  'file-input': IconNode;
23
25
  'file-output': IconNode;
26
+ fullscreen: IconNode;
24
27
  'grip-vertical': IconNode;
25
28
  hand: IconNode;
26
29
  'key-round': IconNode;
@@ -29,6 +32,7 @@ declare const LUCIDE_ICON: {
29
32
  minus: IconNode;
30
33
  'moon-star': IconNode;
31
34
  'mouse-pointer-2': IconNode;
35
+ network: IconNode;
32
36
  palette: IconNode;
33
37
  plus: IconNode;
34
38
  'redo-2': IconNode;
@@ -41,8 +45,11 @@ declare const LUCIDE_ICON: {
41
45
  'sticky-note': IconNode;
42
46
  sun: IconNode;
43
47
  table: IconNode;
48
+ 'table-2': IconNode;
44
49
  'table-properties': IconNode;
45
50
  'undo-2': IconNode;
51
+ 'wand-sparkles': IconNode;
52
+ waypoints: IconNode;
46
53
  workflow: IconNode;
47
54
  x: IconNode;
48
55
  };
@@ -0,0 +1,10 @@
1
+ import { Ctx } from '../internal-types';
2
+ import { GeometrySource } from '../utils/draw-relationship/geometrySource';
3
+ /**
4
+ * Which coordinate system the scene a component sits in is drawn from. Each
5
+ * root that opens a scene provides its own inside its wrapper, so an export or
6
+ * a minimap of the document keeps it while a Flow scene beside them reads its view.
7
+ */
8
+ export declare const sceneSourceContext: import('@dineug/r-html').Context<GeometrySource>;
9
+ export declare const useSceneSource: (ctx: Ctx) => import('@dineug/r-html').Ref<GeometrySource>;
10
+ //# sourceMappingURL=sceneSourceContext.d.ts.map
@@ -1,3 +1,8 @@
1
+ /**
2
+ * A panel placed over whichever tab is up. The tab wrapper raises no stacking
3
+ * context of its own, so a raised descendant inside it would paint over an
4
+ * unraised sibling; the same step, later in the root, keeps this panel on top.
5
+ */
1
6
  export declare const root: import('@dineug/r-html').CSSTemplateLiterals;
2
7
  export declare const title: import('@dineug/r-html').CSSTemplateLiterals;
3
8
  export declare const subTitle: import('@dineug/r-html').CSSTemplateLiterals;
@@ -1,10 +1,9 @@
1
1
  import { FC } from '@dineug/r-html';
2
- import { Visualization } from './createVisualization';
3
2
  export type VisualizationProps = {};
4
3
  /**
5
- * The dom shell around the graph: the Stage container, the wheel that zooms
6
- * it, and the table preview that opens over a hovered table dot. The layout,
7
- * the view and the hover live in one observable here and never reach the store.
4
+ * The tab, which mounts one of its two modes at a time and the toolbar that
5
+ * picks between them. Each mode builds its own Stage on mount, so the choice
6
+ * is which sibling stands here rather than a branch inside one of them.
8
7
  */
9
8
  declare const Visualization: FC<VisualizationProps>;
10
9
  export default Visualization;
@@ -0,0 +1,10 @@
1
+ import { FC } from '@dineug/r-html';
2
+ export type VisualizationFlowProps = {};
3
+ /**
4
+ * The Flow mode of the tab: the tables of a display set, placed once by ELK
5
+ * and kept for the session, drawn by the same scene the ERD is. The wheel
6
+ * moves the screen and a drag on the background pans, as the ERD tab reads them.
7
+ */
8
+ declare const VisualizationFlow: FC<VisualizationFlowProps>;
9
+ export default VisualizationFlow;
10
+ //# sourceMappingURL=VisualizationFlow.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { FC } from '@dineug/r-html';
2
+ export type VisualizationGraphProps = {};
3
+ /**
4
+ * The Graph mode of the tab, the force graph: the Stage container, the wheel
5
+ * that zooms it, and the table preview that opens over a hovered table dot.
6
+ * The layout, the view and the hover live in one observable here and never reach the store.
7
+ */
8
+ declare const VisualizationGraph: FC<VisualizationGraphProps>;
9
+ export default VisualizationGraph;
10
+ //# sourceMappingURL=VisualizationGraph.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { AppContext } from '../appContext';
2
+ import { RxStore } from '../../engine/rx-store';
3
+ /**
4
+ * Fits what the Flow view shows into the screen, the way a placement preview
5
+ * opens, with no ceiling but the zoom's own: a view is read up close as
6
+ * readily as from afar, where a preview of the whole document is only ever the latter.
7
+ */
8
+ export declare function fitFlowView(store: RxStore): void;
9
+ /**
10
+ * The one place a Flow placement is asked for. The landing the display set
11
+ * already has under this key is stood back on, an ask already out for it is
12
+ * joined, and anything else is one new ask; a Tidy up forces that ask and its fit.
13
+ *
14
+ * @example
15
+ * onMounted(() => ensureFlowPlaced(app.value));
16
+ */
17
+ export declare function ensureFlowPlaced(app: AppContext, { force }?: {
18
+ force?: boolean;
19
+ }): Promise<void>;
20
+ /**
21
+ * Keeps the Flow view placed for as long as the tab draws it: placed again
22
+ * after any batch that changed what it is placed over, and never at the
23
+ * subscription itself, which the mount has asked for already. Returns the teardown.
24
+ *
25
+ * @example
26
+ * onMounted(() => addUnsubscribe(keepFlowPlaced(app.value)));
27
+ */
28
+ export declare function keepFlowPlaced(app: AppContext): () => void;
29
+ //# sourceMappingURL=flowLayout.d.ts.map
@@ -0,0 +1,33 @@
1
+ import { VisualizationNode } from './createVisualization';
2
+ import { VisualizationState, VisualizationView } from './visualizationView';
3
+ /** What the graph lets the bar beside it reach: the view it draws with, and where its dots stand. */
4
+ export type GraphViewHandle = {
5
+ state: VisualizationState;
6
+ nodes: () => VisualizationNode[];
7
+ };
8
+ /** Hands the graph of the editor given to whatever reads it, for as long as it is mounted. */
9
+ export declare function registerGraphView(editorId: string, handle: GraphViewHandle): void;
10
+ /**
11
+ * Takes the handle back as the graph unmounts. Only its own: a second graph
12
+ * that registered in between owns the slot, and this must not empty it.
13
+ */
14
+ export declare function unregisterGraphView(editorId: string, handle: GraphViewHandle): void;
15
+ /**
16
+ * The graph of the editor given, or the resting handle while none is mounted.
17
+ * The version is read rather than merely counted, so a render that reached
18
+ * this is redrawn once a graph registers.
19
+ *
20
+ * @example
21
+ * const { state, nodes } = getGraphView(store.state.editor.id);
22
+ */
23
+ export declare function getGraphView(editorId: string): GraphViewHandle;
24
+ /**
25
+ * Moves the view of the graph of the editor given, and does nothing at all
26
+ * while none is mounted. The resting handle is one object every editor shares,
27
+ * so a press before the mount must not be written into it.
28
+ *
29
+ * @example
30
+ * updateGraphView(editor.id, ({ state }) => zoomAt(state, center, 1.04));
31
+ */
32
+ export declare function updateGraphView(editorId: string, next: (handle: GraphViewHandle) => VisualizationView | null): void;
33
+ //# sourceMappingURL=graphViewHandle.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { FC } from '@dineug/r-html';
2
+ export type ParticleLayerProps = {};
3
+ /**
4
+ * The layer the particles of a view's lit connectors run on, under the scene,
5
+ * since a card hides the connectors behind it and a particle riding one goes
6
+ * with them. Its one empty layer is committed at mount and drawn by the loop alone.
7
+ */
8
+ declare const ParticleLayer: FC<ParticleLayerProps>;
9
+ export default ParticleLayer;
10
+ //# sourceMappingURL=ParticleLayer.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { RootState } from '../../../engine/state';
2
+ import { GeometrySource } from '../../../utils/draw-relationship/geometrySource';
3
+ import { MeasuredPath } from './particlePath';
4
+ /** One lit connector as the particles ride it, from its PK end to its FK end. */
5
+ export type ParticleEdge = {
6
+ id: string;
7
+ path: MeasuredPath;
8
+ };
9
+ /**
10
+ * The connectors a view lights, measured for the particles to ride: those the
11
+ * hover or the pin reaches, in the order the view shows them. None for the
12
+ * document, none at rest, and none past the cap, where the light stands alone.
13
+ */
14
+ export declare function getParticleEdges(state: RootState, source?: GeometrySource): ParticleEdge[];
15
+ //# sourceMappingURL=particleEdges.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { Layer } from 'konva/lib/Layer';
2
+ import { Point } from '../../../internal-types';
3
+ import { ParticleEdge } from './particleEdges';
4
+ /** The time and the frame a loop runs on, so a spec can freeze a phase or count frames. */
5
+ export type ParticleClock = {
6
+ now(): number;
7
+ requestFrame(callback: () => void): number;
8
+ cancelFrame(handle: number): void;
9
+ };
10
+ /** The clock every shipped loop runs on: wall time and the browser's own animation frame. */
11
+ export declare const particleClock: ParticleClock;
12
+ export type ParticleLoop = {
13
+ /** The lit connectors to run particles on and the colour to paint them; an empty list clears the layer. */
14
+ setEdges(edges: ParticleEdge[], fill: string): void;
15
+ /** Where the scene layers stand, so the circles land over the connectors they ride. */
16
+ setPlacement(origin: Point, zoomLevel: number): void;
17
+ /** Cancels the frame out, if any, and takes every circle off the layer. */
18
+ stop(): void;
19
+ };
20
+ /** The name every group of one connector's particles carries, beside the connector's own id. */
21
+ export declare const PARTICLE_GROUP_NAME = "particle-edge";
22
+ /**
23
+ * One requestAnimationFrame loop that owns the drawing of one layer. It runs
24
+ * a frame only while there is something to move or clear, so a scene with
25
+ * nothing lit costs no frame, and the view has one loop for as long as the layer lives.
26
+ */
27
+ export declare function createParticleLoop(layer: Layer, clock?: ParticleClock): ParticleLoop;
28
+ //# sourceMappingURL=particleLoop.d.ts.map
@@ -0,0 +1,83 @@
1
+ import { Point } from '../../../internal-types';
2
+ /** How many particles ride one lit connector at a time, as the reference draws them. */
3
+ export declare const PARTICLE_COUNT = 6;
4
+ /** How long one particle takes from the PK end to the FK end, in milliseconds. */
5
+ export declare const ANIMATE_DURATION = 6000;
6
+ /**
7
+ * How long after the one before it each particle leaves the PK end: one
8
+ * second, which over six particles fills the six second run, so a connector
9
+ * carries all six at every moment rather than a bunch that thins out.
10
+ */
11
+ export declare const PARTICLE_INTERVAL: number;
12
+ /**
13
+ * The most lit connectors a view animates. Past it the particles stay off and
14
+ * only the fade and the highlight remain, since six circles on each of more
15
+ * connectors than this is more than a frame has room for.
16
+ */
17
+ export declare const PARTICLE_EDGE_MAX = 60;
18
+ /** How long one particle is along the run it rides, in scene units. */
19
+ export declare const PARTICLE_RX = 5;
20
+ /** How thick it is across that run, which is what makes the circle an elongated blur. */
21
+ export declare const PARTICLE_RY = 1.2;
22
+ /** How opaque the far edge of a particle's gradient is, against 1 at its centre. */
23
+ export declare const PARTICLE_EDGE_ALPHA = 0.4;
24
+ /**
25
+ * How far either side of a point the direction is measured over, as a fraction
26
+ * of the whole run, guide lines included: about one chord of the curve, so a
27
+ * window spans a bend and the angle turns through it rather than stepping.
28
+ */
29
+ export declare const TANGENT_WINDOW: number;
30
+ /** A polyline with the distance along it each point sits at, so a distance names a point on it. */
31
+ export type MeasuredPath = {
32
+ points: Point[];
33
+ /** How far along the path each point is: zero for the first, the length for the last. */
34
+ distances: number[];
35
+ length: number;
36
+ };
37
+ /** Copies the polyline and measures it, so the path handed back shares nothing with the caller. */
38
+ export declare function measurePath(points: Point[]): MeasuredPath;
39
+ /**
40
+ * The point so far along the path from its first point. A distance past
41
+ * either end lands on that end, and a zero-length run between two points
42
+ * hands back the first of them rather than dividing by nothing.
43
+ */
44
+ export declare function pointAlong(path: MeasuredPath, distance: number): Point;
45
+ /**
46
+ * How far along a connector each of its particles is at a moment: the first
47
+ * leaves the PK end at zero, each next one an interval later, and every one
48
+ * runs the whole length in a period and starts over, easing in and out of it.
49
+ */
50
+ export declare function particlePhase(elapsedMs: number, edgeLength: number): number[];
51
+ /**
52
+ * Which way the path runs at a distance along it, in degrees, so a particle
53
+ * lies along the run it rides. Measured between the points a window either
54
+ * side of it, never off the one chord it sits in, which steps at every bend.
55
+ */
56
+ export declare function tangentAt(path: MeasuredPath, distance: number): number;
57
+ /**
58
+ * The gradient one particle is filled with: its colour at the centre, the same
59
+ * colour at a fraction of its opacity at the edge. Handed to the node whole,
60
+ * so the loop that moves circles sets attributes and computes nothing.
61
+ */
62
+ export declare function particleGradient(fill: string): {
63
+ fill: string;
64
+ fillPriority: string;
65
+ fillRadialGradientStartPoint: {
66
+ x: number;
67
+ y: number;
68
+ };
69
+ fillRadialGradientStartRadius: number;
70
+ fillRadialGradientEndPoint: {
71
+ x: number;
72
+ y: number;
73
+ };
74
+ fillRadialGradientEndRadius: number;
75
+ fillRadialGradientColorStops: (string | number)[];
76
+ };
77
+ /**
78
+ * The same colour carrying an alpha channel. Every palette token reaching here
79
+ * is a six digit hex, and a colour in any other spelling is handed back as it
80
+ * came rather than mangled into one the canvas would refuse.
81
+ */
82
+ export declare function withAlpha(color: string, alpha: number): string;
83
+ //# sourceMappingURL=particlePath.d.ts.map
@@ -0,0 +1,24 @@
1
+ import { Ref } from '@dineug/r-html';
2
+ import { Ctx } from '../../internal-types';
3
+ import { ViewSource } from '../../utils/draw-relationship/geometrySource';
4
+ export type ViewGestureOptions = {
5
+ /** The box the scene hangs in, which a press and a wheel are measured against. */
6
+ root: Ref<HTMLDivElement>;
7
+ /** The Stage container, which says whether a press landed on a table. */
8
+ canvas: Ref<HTMLDivElement>;
9
+ /** The view the gestures land in, named so they never reach the active one. */
10
+ source: ViewSource;
11
+ };
12
+ /**
13
+ * The gestures a view scene takes on its box: the wheel moves the screen and
14
+ * with the modifier zooms it, a press on the background pans, and with the
15
+ * modifier it opens the marquee of this scene. Every one lands in the view named.
16
+ *
17
+ * @example
18
+ * const { handleWheel, handleMousedown } = useViewGestures(ctx, { root, canvas, source });
19
+ */
20
+ export declare function useViewGestures(ctx: Ctx, { root, canvas, source }: ViewGestureOptions): {
21
+ handleWheel: (event: WheelEvent) => void;
22
+ handleMousedown: (event: MouseEvent | TouchEvent) => void;
23
+ };
24
+ //# sourceMappingURL=useViewGestures.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { FC } from '@dineug/r-html';
2
+ export type VisualizationToolbarProps = {};
3
+ /**
4
+ * The bar over the bottom of the Visualization tab: which of the two modes is
5
+ * up, the zoom, the placement tools of the Flow, how much of a card it draws,
6
+ * the way back to the whole document, and which way the content lies and how far once the screen holds none.
7
+ */
8
+ declare const VisualizationToolbar: FC<VisualizationToolbarProps>;
9
+ export default VisualizationToolbar;
10
+ //# sourceMappingURL=VisualizationToolbar.d.ts.map
@@ -0,0 +1,4 @@
1
+ export declare const showModeTrigger: import('@dineug/r-html').CSSTemplateLiterals;
2
+ export declare const showModeLabel: import('@dineug/r-html').CSSTemplateLiterals;
3
+ export declare const showModeMenu: import('@dineug/r-html').CSSTemplateLiterals;
4
+ //# sourceMappingURL=VisualizationToolbar.styles.d.ts.map
@@ -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
@@ -4,6 +4,8 @@ export declare const START_ADD = 50;
4
4
  export declare const DUPLICATE_MIN_MOVE = 4;
5
5
  export declare const DEFAULT_WIDTH = 1200;
6
6
  export declare const DEFAULT_HEIGHT: number;
7
+ /** The px a table cell's text is drawn at, which the scene and the view header scale read. */
8
+ export declare const CELL_FONT_SIZE = 12;
7
9
  export declare const INPUT_HEIGHT = 20;
8
10
  export declare const INPUT_MARGIN_RIGHT = 8;
9
11
  export declare const HEADER_ICON_HEIGHT = 12;
@@ -23,6 +25,48 @@ export declare const COLUMN_UNIQUE_WIDTH = 22;
23
25
  export declare const COLUMN_AUTO_INCREMENT_WIDTH = 15;
24
26
  export declare const COLUMN_PADDING = 2;
25
27
  export declare const COLUMN_HEIGHT: number;
28
+ /** The table icon a view card draws beside its name, at the reference's 1rem. */
29
+ export declare const VIEW_TABLE_HEADER_ICON_SIZE = 16;
30
+ /** The gap between that icon and the name, the reference's one unit of spacing. */
31
+ export declare const VIEW_TABLE_HEADER_ICON_GAP = 4;
32
+ /** The size a view card draws its header name at, over the size its rows take. */
33
+ export declare const VIEW_TABLE_HEADER_FONT_SIZE = 14;
34
+ /**
35
+ * How much wider a string is at that size than at the one it was measured with.
36
+ * A face advances a glyph in proportion to its size, so a measured width scales
37
+ * rather than having to be measured a second time.
38
+ */
39
+ export declare const VIEW_TABLE_HEADER_FONT_SCALE: number;
40
+ /**
41
+ * How much wider again the header name is at the medium weight a view draws it
42
+ * in, over the regular every ui width was measured with. A host with no medium
43
+ * of its own synthesises one wider still, so the slot carries the room for both.
44
+ */
45
+ export declare const VIEW_TABLE_HEADER_WEIGHT_SCALE = 1.04;
46
+ /**
47
+ * The header a view card draws: the icon line with the card's own padding under
48
+ * it, and none of the icon band the document header keeps above the name,
49
+ * because a view offers no edit affordance there.
50
+ */
51
+ export declare const VIEW_TABLE_HEADER_HEIGHT: number;
52
+ /** The key badge a view row draws, at the size the reference gives a row icon. */
53
+ export declare const VIEW_COLUMN_ICON_SIZE = 16;
54
+ /** The gap between that badge and the name, the reference's one and a half units. */
55
+ export declare const VIEW_COLUMN_ICON_GAP = 6;
56
+ /** The gap above and below the content of a view row, the reference's two units. */
57
+ export declare const VIEW_COLUMN_PADDING = 8;
58
+ /**
59
+ * The row a view card draws, written down as that icon line inside that padding
60
+ * rather than derived from INPUT_HEIGHT: a view row is a line of read only
61
+ * text, not the editable input box the document row is sized around.
62
+ */
63
+ export declare const VIEW_COLUMN_HEIGHT: number;
64
+ /** The width a view card is never drawn under, which is the reference's node minimum. */
65
+ export declare const VIEW_TABLE_MIN_WIDTH = 172;
66
+ /** The size of a button in a view card's header. */
67
+ export declare const VIEW_TABLE_HEADER_BUTTON_SIZE = 12;
68
+ /** The strip the two of them take along the right edge of that header. */
69
+ export declare const VIEW_TABLE_HEADER_BUTTONS_WIDTH: number;
26
70
  export declare const MEMO_BORDER = 1;
27
71
  export declare const MEMO_PADDING = 8;
28
72
  export declare const MEMO_HEADER_HEIGHT: number;
@@ -38,6 +82,12 @@ export declare const DIFF_TREE_WIDTH = 200;
38
82
  * two rows at partial alpha on a 1x display.
39
83
  */
40
84
  export declare const RELATIONSHIP_STROKE_WIDTH = 2;
85
+ /**
86
+ * The same connector inside a view, at the reference's hairline. A particle
87
+ * riding a lit one is 2.4 units across, so a heavier line swallows it: what a
88
+ * reader sees moving is the bulge the particle makes over the stroke, not a colour of its own.
89
+ */
90
+ export declare const VIEW_RELATIONSHIP_STROKE_WIDTH = 1;
41
91
  /**
42
92
  * The invisible band that catches the pointer for a connector, because
43
93
  * hit-testing follows the painted stroke. Narrower than NUDGE_GAP, so it stays
@@ -0,0 +1,16 @@
1
+ import { ValuesType } from '../internal-types';
2
+ /**
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
+ */
7
+ export declare const TablePlacement: {
8
+ readonly force: "force";
9
+ readonly layeredHorizontal: "layeredHorizontal";
10
+ readonly layeredVertical: "layeredVertical";
11
+ readonly flow: "flow";
12
+ readonly viewLayered: "viewLayered";
13
+ };
14
+ export type TablePlacement = ValuesType<typeof TablePlacement>;
15
+ export declare const DEFAULT_TABLE_PLACEMENT: TablePlacement;
16
+ //# sourceMappingURL=tablePlacement.d.ts.map