@dineug/erd-editor 3.3.1 → 3.5.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 (212) hide show
  1. package/README.md +197 -17
  2. package/dist/components/appContext.d.ts +8 -1
  3. package/dist/components/erd/automatic-table-placement/createAutomaticTablePlacement.d.ts +17 -1
  4. package/dist/components/erd/canvas/Canvas.d.ts +5 -0
  5. package/dist/components/erd/canvas/Canvas.styles.d.ts +11 -0
  6. package/dist/components/erd/canvas/CanvasScene.d.ts +18 -0
  7. package/dist/components/erd/canvas/EditOverlay.d.ts +8 -0
  8. package/dist/components/erd/canvas/EditOverlay.styles.d.ts +6 -0
  9. package/dist/components/erd/canvas/SceneIcon.template.d.ts +21 -0
  10. package/dist/components/erd/canvas/altDragDuplicate.d.ts +3 -0
  11. package/dist/components/erd/canvas/drag-select/DragSelect.d.ts +11 -0
  12. package/dist/components/erd/canvas/duplicate-ghost/DuplicateGhost.d.ts +9 -0
  13. package/dist/components/erd/canvas/entityDrag.d.ts +4 -0
  14. package/dist/components/erd/canvas/high-level-table/HighLevelTable.d.ts +4 -0
  15. package/dist/components/erd/canvas/memo/Memo.d.ts +2 -0
  16. package/dist/components/erd/canvas/memo/memo-sash/MemoSash.d.ts +11 -1
  17. package/dist/components/erd/canvas/memo/memoCaret.d.ts +26 -0
  18. package/dist/components/erd/canvas/memo/memoScroll.d.ts +28 -0
  19. package/dist/components/erd/canvas/memo/memoText.d.ts +33 -0
  20. package/dist/components/erd/canvas/memo/useMoveMemo.d.ts +6 -0
  21. package/dist/components/erd/canvas/relationship-group/RelationshipGroup.d.ts +15 -0
  22. package/dist/components/erd/canvas/relationship-group/relationship/Relationship.template.d.ts +17 -0
  23. package/dist/components/erd/canvas/sceneHit.d.ts +18 -0
  24. package/dist/components/erd/canvas/sceneKind.d.ts +11 -0
  25. package/dist/components/erd/canvas/sceneRetention.d.ts +31 -0
  26. package/dist/components/erd/canvas/sceneTokens.d.ts +67 -0
  27. package/dist/components/erd/canvas/shared-drag-select/SharedDragSelect.d.ts +8 -0
  28. package/dist/components/erd/canvas/shared-mouse-tracker/SharedMouseTracker.d.ts +1 -0
  29. package/dist/components/erd/canvas/shared-mouse-tracker/shared-mouse-cursor/SharedMouseCursor.d.ts +5 -0
  30. package/dist/components/erd/canvas/table/Table.d.ts +8 -0
  31. package/dist/components/erd/canvas/table/cellLayout.d.ts +63 -0
  32. package/dist/components/erd/canvas/table/column/Column.d.ts +23 -6
  33. package/dist/components/erd/canvas/table/doubleClick.d.ts +14 -0
  34. package/dist/components/erd/canvas/table/useMoveTable.d.ts +1 -1
  35. package/dist/components/erd/canvas/table/useSharedFocusTable.d.ts +6 -0
  36. package/dist/components/erd/canvas/useMoveEntity.d.ts +18 -0
  37. package/dist/components/erd/canvas/useSharedSelectEntity.d.ts +4 -0
  38. package/dist/components/erd/erd-context-menu/ErdContextMenu.d.ts +1 -2
  39. package/dist/components/erd/erd-context-menu/menus/drawRelationshipMenus.d.ts +3 -2
  40. package/dist/components/erd/erd-context-menu/menus/exportMenus.d.ts +7 -6
  41. package/dist/components/erd/erd-context-menu/menus/importMenus.d.ts +6 -6
  42. package/dist/components/erd/erd-context-menu/menus/relationshipMenus.d.ts +1 -1
  43. package/dist/components/erd/hide-sign/hideSignBounds.d.ts +9 -0
  44. package/dist/components/erd/hitTest.d.ts +22 -0
  45. package/dist/components/erd/minimap/Minimap.styles.d.ts +0 -1
  46. package/dist/components/erd/minimap/MinimapScene.d.ts +16 -0
  47. package/dist/components/erd/minimap/memo/Memo.d.ts +5 -0
  48. package/dist/components/erd/minimap/minimapGeometry.d.ts +52 -0
  49. package/dist/components/erd/minimap/table/Table.d.ts +5 -0
  50. package/dist/components/erd/table-properties/table-properties-indexes/indexes-checkbox-column/IndexesCheckboxColumn.d.ts +1 -1
  51. package/dist/components/erd/virtual-scroll/useVirtualScroll.d.ts +19 -0
  52. package/dist/components/erd-editor/ErdEditor.d.ts +4 -0
  53. package/dist/components/erd-editor/ErdEditor.stories.d.ts +1 -1
  54. package/dist/components/global-styles/GlobalStyles.d.ts +5 -0
  55. package/dist/components/primitives/button/Button.stories.d.ts +4 -4
  56. package/dist/components/primitives/code-block/CodeBlock.stories.d.ts +4 -4
  57. package/dist/components/primitives/code-block/CodeBlock.styles.d.ts +6 -1
  58. package/dist/components/primitives/color-picker/ColorPicker.d.ts +1 -1
  59. package/dist/components/primitives/color-picker/ColorPicker.stories.d.ts +1 -1
  60. package/dist/components/primitives/context-menu/ContextMenu.stories.d.ts +1 -1
  61. package/dist/components/primitives/context-menu/context-menu-item/ContextMenuItem.d.ts +1 -1
  62. package/dist/components/primitives/context-menu/menu/Menu.d.ts +2 -2
  63. package/dist/components/primitives/edit-input/EditInput.d.ts +2 -2
  64. package/dist/components/primitives/edit-input/EditInput.stories.d.ts +6 -6
  65. package/dist/components/primitives/highlighted-text/HighlightedText.stories.d.ts +1 -1
  66. package/dist/components/primitives/icon/Icon.d.ts +2 -3
  67. package/dist/components/primitives/icon/Icon.stories.d.ts +3 -1
  68. package/dist/components/primitives/icon/icons.d.ts +95 -26
  69. package/dist/components/primitives/kbd/Kbd.stories.d.ts +3 -3
  70. package/dist/components/primitives/sash/Sash.stories.d.ts +6 -6
  71. package/dist/components/primitives/separator/Separator.stories.d.ts +3 -3
  72. package/dist/components/primitives/slider/Slider.stories.d.ts +4 -4
  73. package/dist/components/primitives/switch/Switch.stories.d.ts +3 -3
  74. package/dist/components/primitives/text-input/TextInput.d.ts +1 -1
  75. package/dist/components/primitives/text-input/TextInput.stories.d.ts +7 -7
  76. package/dist/components/primitives/toast/Toast.d.ts +4 -0
  77. package/dist/components/primitives/toast/Toast.stories.d.ts +17 -4
  78. package/dist/components/primitives/toast/Toast.styles.d.ts +5 -0
  79. package/dist/components/{erd/canvas/table → table-view}/column/column-data-type/ColumnDataType.d.ts +4 -4
  80. package/dist/components/{erd/canvas/table → table-view}/column/column-not-null/ColumnNotNull.d.ts +1 -1
  81. package/dist/components/{erd/canvas/table → table-view}/column/column-option/ColumnOption.d.ts +1 -1
  82. package/dist/components/table-view/column/useColumnCell.d.ts +23 -0
  83. package/dist/components/themeContext.d.ts +9 -0
  84. package/dist/components/toast-container/openToastWhileRunning.d.ts +11 -0
  85. package/dist/components/visualization/Visualization.d.ts +6 -0
  86. package/dist/components/visualization/Visualization.styles.d.ts +6 -0
  87. package/dist/components/visualization/VisualizationScene.d.ts +21 -0
  88. package/dist/components/visualization/createVisualization.d.ts +67 -8
  89. package/dist/components/visualization/graph-node/GraphNode.d.ts +23 -0
  90. package/dist/components/visualization/table/Table.d.ts +0 -1
  91. package/dist/components/visualization/table/column/Column.d.ts +0 -1
  92. package/dist/components/visualization/visualizationView.d.ts +90 -0
  93. package/dist/constants/language.d.ts +7 -1
  94. package/dist/constants/layout.d.ts +13 -0
  95. package/dist/constants/schema.d.ts +12 -3
  96. package/dist/constants/sql/dataType/Databricks.d.ts +5 -0
  97. package/dist/constants/sql/dataType/MSSQL.d.ts +1 -1
  98. package/dist/constants/sql/dataType/MySQL.d.ts +1 -1
  99. package/dist/constants/sql/dataType/Oracle.d.ts +1 -1
  100. package/dist/constants/sql/dataType/Snowflake.d.ts +5 -0
  101. package/dist/constants/sql/database.d.ts +2 -0
  102. package/dist/engine/history.d.ts +5 -3
  103. package/dist/engine/hooks.d.ts +3 -3
  104. package/dist/engine/modules/editor/actions.d.ts +30 -1
  105. package/dist/engine/modules/editor/atom.actions.d.ts +131 -0
  106. package/dist/engine/modules/editor/generator.actions.d.ts +18 -0
  107. package/dist/engine/modules/editor/state.d.ts +43 -0
  108. package/dist/engine/modules/editor/utils/duplicate.d.ts +13 -0
  109. package/dist/engine/modules/memo/actions.d.ts +3 -0
  110. package/dist/engine/modules/memo/atom.actions.d.ts +12 -0
  111. package/dist/engine/modules/settings/atom.actions.d.ts +24 -0
  112. package/dist/engine/modules/table/actions.d.ts +1 -0
  113. package/dist/engine/modules/table/atom.actions.d.ts +4 -0
  114. package/dist/engine.js +40 -51
  115. package/dist/erd-editor.js +40775 -26895
  116. package/dist/konva/batchDraw.d.ts +41 -0
  117. package/dist/konva/host.d.ts +29 -0
  118. package/dist/konva/scene/columnDropTarget.d.ts +13 -0
  119. package/dist/konva/scene/konvaFlip.d.ts +18 -0
  120. package/dist/konva/scene/metrics.d.ts +29 -0
  121. package/dist/konva/scene/renderScene.d.ts +34 -0
  122. package/dist/konva/scene/viewport.d.ts +38 -0
  123. package/dist/konva/testHandle.d.ts +22 -0
  124. package/dist/konva/theme.d.ts +31 -0
  125. package/dist/konva/workerDomStubs.d.ts +1 -0
  126. package/dist/schemaGCService-DrlqIen8.js +17549 -0
  127. package/dist/services/export-png/ExportScene.d.ts +9 -0
  128. package/dist/services/export-png/documentScene.d.ts +20 -0
  129. package/dist/services/export-png/exportPng.shared-worker.d.ts +0 -0
  130. package/dist/services/export-png/exportPngService.d.ts +24 -0
  131. package/dist/services/export-png/index.d.ts +48 -0
  132. package/dist/services/export-png/pixelRatio.d.ts +21 -0
  133. package/dist/services/export-png/renderPng.d.ts +37 -0
  134. package/dist/services/export-png/textWidth.d.ts +27 -0
  135. package/dist/services/schema-gc/index.d.ts +5 -0
  136. package/dist/services/shikiService.d.ts +1 -1
  137. package/dist/styles/colorPicker.style.d.ts +6 -1
  138. package/dist/styles/fonts.styles.d.ts +2 -1
  139. package/dist/styles/reset.styles.d.ts +5 -1
  140. package/dist/styles/scrollbar.styles.d.ts +6 -1
  141. package/dist/styles/typography.styles.d.ts +2 -1
  142. package/dist/themes/radix-ui-theme.d.ts +1 -1
  143. package/dist/themes/tokens.d.ts +6 -2
  144. package/dist/utils/calcTable.d.ts +7 -0
  145. package/dist/utils/draw-relationship/chamfer.d.ts +2 -0
  146. package/dist/utils/draw-relationship/incremental.d.ts +70 -0
  147. package/dist/utils/draw-relationship/index.d.ts +78 -14
  148. package/dist/utils/draw-relationship/nudge.d.ts +4 -0
  149. package/dist/utils/draw-relationship/pathFinding.d.ts +7 -1
  150. package/dist/utils/draw-relationship/route.d.ts +27 -0
  151. package/dist/utils/draw-relationship/stub.d.ts +36 -0
  152. package/dist/utils/emitter.d.ts +32 -0
  153. package/dist/utils/file/exportFile.d.ts +10 -1
  154. package/dist/utils/file/importFile.d.ts +4 -1
  155. package/dist/utils/focus.d.ts +5 -3
  156. package/dist/utils/generator-code/aml.d.ts +4 -0
  157. package/dist/utils/generator-code/dbml.d.ts +4 -0
  158. package/dist/utils/generator-code/drizzle.d.ts +4 -0
  159. package/dist/utils/generator-code/go.d.ts +4 -0
  160. package/dist/utils/generator-code/sequelize.d.ts +4 -0
  161. package/dist/utils/generator-code/sqlalchemy.d.ts +4 -0
  162. package/dist/utils/generator-code/typeorm.d.ts +4 -0
  163. package/dist/utils/globalEventObservable.d.ts +13 -12
  164. package/dist/utils/icon.d.ts +9 -1
  165. package/dist/utils/keyboard-shortcut/index.d.ts +7 -1
  166. package/dist/utils/promise.d.ts +1 -0
  167. package/dist/utils/schema-aml-parser/convert.d.ts +4 -0
  168. package/dist/utils/schema-aml-parser/dataType.d.ts +12 -0
  169. package/dist/utils/schema-aml-parser/index.d.ts +3 -0
  170. package/dist/utils/schema-aml-parser/parser.d.ts +2 -0
  171. package/dist/utils/schema-aml-parser/tokenizer.d.ts +23 -0
  172. package/dist/utils/schema-aml-parser/types.d.ts +78 -0
  173. package/dist/utils/schema-dbml-parser/convert.d.ts +4 -0
  174. package/dist/utils/schema-dbml-parser/dataType.d.ts +7 -0
  175. package/dist/utils/schema-dbml-parser/index.d.ts +3 -0
  176. package/dist/utils/schema-dbml-parser/parser.d.ts +2 -0
  177. package/dist/utils/schema-dbml-parser/tokenizer.d.ts +16 -0
  178. package/dist/utils/schema-dbml-parser/types.d.ts +62 -0
  179. package/dist/utils/schema-graphql-parser/convert.d.ts +4 -0
  180. package/dist/utils/schema-graphql-parser/dataType.d.ts +7 -0
  181. package/dist/utils/schema-graphql-parser/index.d.ts +3 -0
  182. package/dist/utils/schema-graphql-parser/parser.d.ts +2 -0
  183. package/dist/utils/schema-graphql-parser/types.d.ts +58 -0
  184. package/dist/utils/schema-sql/Databricks.d.ts +5 -0
  185. package/dist/utils/schema-sql/Snowflake.d.ts +5 -0
  186. package/dist/utils/sharedColor.d.ts +2 -0
  187. package/dist/utils/table-clipboard/copy.d.ts +7 -0
  188. package/dist/utils/table-clipboard/index.d.ts +2 -0
  189. package/dist/utils/table-clipboard/paste.d.ts +3 -0
  190. package/dist/utils/table-clipboard/payload.d.ts +83 -0
  191. package/dist/utils/table-clipboard/placement.d.ts +30 -0
  192. package/dist/utils/validation.d.ts +1 -0
  193. package/package.json +34 -29
  194. package/dist/components/erd/canvas/canvas-svg/CanvasSvg.d.ts +0 -7
  195. package/dist/components/erd/canvas/canvas-svg/relationship/Relationship.template.d.ts +0 -3
  196. package/dist/components/erd/canvas/draw-relationship/DrawRelationship.styles.d.ts +0 -1
  197. package/dist/components/erd/canvas/high-level-table/HighLevelTable.styles.d.ts +0 -1
  198. package/dist/components/erd/canvas/memo/Memo.styles.d.ts +0 -6
  199. package/dist/components/erd/canvas/shared-mouse-tracker/shared-mouse-cursor/SharedMouseCursor.styles.d.ts +0 -1
  200. package/dist/components/erd/canvas/table/column/Column.styles.d.ts +0 -2
  201. package/dist/components/erd/drag-select/DragSelect.d.ts +0 -9
  202. package/dist/components/erd/drag-select/DragSelect.styles.d.ts +0 -1
  203. package/dist/schemaGCService-Br6jn6B2.js +0 -15866
  204. /package/dist/components/erd/canvas/{canvas-svg → relationship-group}/relationship/Relationship.d.ts +0 -0
  205. /package/dist/components/{erd/canvas/table → table-view}/Table.styles.d.ts +0 -0
  206. /package/dist/components/{erd/canvas/canvas-svg/CanvasSvg.styles.d.ts → table-view/column/Column.styles.d.ts} +0 -0
  207. /package/dist/components/{erd/canvas/table → table-view}/column/column-data-type/ColumnDataType.styles.d.ts +0 -0
  208. /package/dist/components/{erd/canvas/table → table-view}/column/column-key/ColumnKey.d.ts +0 -0
  209. /package/dist/components/{erd/canvas/table → table-view}/column/column-key/ColumnKey.styles.d.ts +0 -0
  210. /package/dist/components/{erd/canvas/table → table-view}/column/column-not-null/ColumnNotNull.styles.d.ts +0 -0
  211. /package/dist/components/{erd/canvas/table → table-view}/column/column-option/ColumnOption.styles.d.ts +0 -0
  212. /package/dist/{services/schema-gc/schemaGC.worker.d.ts → konva/jsx-types.test-d.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { AppContext } from '../../components/appContext';
2
2
  type ImportOptions = {
3
- type: 'json' | 'sql';
3
+ type: 'json' | 'sql' | 'graphql' | 'dbml' | 'aml';
4
4
  op: 'set' | 'diff';
5
5
  accept: string;
6
6
  };
@@ -8,5 +8,8 @@ type ImportFileCallback = (options: ImportOptions) => void;
8
8
  export declare function setImportFileCallback(callback: ImportFileCallback | null): void;
9
9
  export declare function importJSON({ store, emitter }: AppContext): void;
10
10
  export declare function importSchemaSQL({ store, emitter }: AppContext): void;
11
+ export declare function importGraphQL({ store, emitter }: AppContext): void;
12
+ export declare function importDBML({ store, emitter }: AppContext): void;
13
+ export declare function importAML({ store, emitter }: AppContext): void;
11
14
  export declare function importDiffJSON({ emitter }: AppContext): void;
12
15
  export {};
@@ -1,5 +1,7 @@
1
- import { FocusTable, FocusType } from '../engine/modules/editor/state';
2
- export declare function isFocus(focusTable: FocusTable | null, focusType: FocusType, tableId: string, columnId?: string | null): boolean;
1
+ import { FocusTable, FocusType, SharedFocus } from '../engine/modules/editor/state';
2
+ export declare function isFocus(focusTable: Pick<FocusTable, 'tableId' | 'columnId' | 'focusType'> | null, focusType: FocusType, tableId: string, columnId?: string | null): boolean;
3
3
  export declare const isSelectColumn: (focusTable: FocusTable | null, tableId: string, columnId: string) => boolean;
4
4
  export declare function isEdit(focusTable: FocusTable | null, focusType: FocusType, tableId: string, columnId?: string | null): boolean;
5
- export declare function lastCursorFocus(input: HTMLInputElement): void;
5
+ export declare function lastCursorFocus(input: HTMLInputElement | HTMLTextAreaElement): void;
6
+ export declare const toSharedFocus: (focusTable: FocusTable | null) => SharedFocus | null;
7
+ export declare const toSharedFocusKey: (focus: SharedFocus | null) => string;
@@ -0,0 +1,4 @@
1
+ import { RootState } from '../../engine/state';
2
+ import { FormatTableOptions } from './utils';
3
+ export declare function createCode(state: RootState): string;
4
+ export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
@@ -0,0 +1,4 @@
1
+ import { RootState } from '../../engine/state';
2
+ import { FormatTableOptions } from './utils';
3
+ export declare function createCode(state: RootState): string;
4
+ export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
@@ -0,0 +1,4 @@
1
+ import { RootState } from '../../engine/state';
2
+ import { FormatTableOptions } from './utils';
3
+ export declare function createCode(state: RootState): string;
4
+ export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
@@ -0,0 +1,4 @@
1
+ import { RootState } from '../../engine/state';
2
+ import { FormatTableOptions } from './utils';
3
+ export declare function createCode(state: RootState): string;
4
+ export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
@@ -0,0 +1,4 @@
1
+ import { RootState } from '../../engine/state';
2
+ import { FormatTableOptions } from './utils';
3
+ export declare function createCode(state: RootState): string;
4
+ export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
@@ -0,0 +1,4 @@
1
+ import { RootState } from '../../engine/state';
2
+ import { FormatTableOptions } from './utils';
3
+ export declare function createCode(state: RootState): string;
4
+ export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
@@ -0,0 +1,4 @@
1
+ import { RootState } from '../../engine/state';
2
+ import { FormatTableOptions } from './utils';
3
+ export declare function createCode(state: RootState): string;
4
+ export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
@@ -1,16 +1,17 @@
1
- export declare const keyup$: import('rxjs').Observable<KeyboardEvent>;
2
- export declare const mousedown$: import('rxjs').Observable<MouseEvent>;
3
- export declare const mousemove$: import('rxjs').Observable<MouseEvent>;
4
- export declare const mouseup$: import('rxjs').Observable<MouseEvent>;
5
- export declare const touchstart$: import('rxjs').Observable<TouchEvent>;
6
- export declare const touchmove$: import('rxjs').Observable<TouchEvent>;
7
- export declare const touchend$: import('rxjs').Observable<TouchEvent>;
8
- export declare const animationFrames$: import('rxjs').Observable<{
1
+ import { Observable } from 'rxjs';
2
+ export declare const keyup$: Observable<KeyboardEvent>;
3
+ export declare const mousedown$: Observable<MouseEvent>;
4
+ export declare const mousemove$: Observable<MouseEvent>;
5
+ export declare const mouseup$: Observable<MouseEvent>;
6
+ export declare const touchstart$: Observable<TouchEvent>;
7
+ export declare const touchmove$: Observable<TouchEvent>;
8
+ export declare const touchend$: Observable<TouchEvent>;
9
+ export declare const animationFrames$: Observable<{
9
10
  timestamp: number;
10
11
  elapsed: number;
11
12
  }>;
12
- export declare const moveStart$: import('rxjs').Observable<MouseEvent | TouchEvent>;
13
- export declare const moveEnd$: import('rxjs').Observable<MouseEvent | TouchEvent>;
13
+ export declare const moveStart$: Observable<MouseEvent | TouchEvent>;
14
+ export declare const moveEnd$: Observable<MouseEvent | TouchEvent>;
14
15
  export type DragMove = {
15
16
  movementX: number;
16
17
  movementY: number;
@@ -18,7 +19,7 @@ export type DragMove = {
18
19
  y: number;
19
20
  event: MouseEvent | TouchEvent;
20
21
  };
21
- export declare const move$: import('rxjs').Observable<{
22
+ export declare const move$: Observable<{
22
23
  event: MouseEvent;
23
24
  movementX: number;
24
25
  movementY: number;
@@ -31,7 +32,7 @@ export declare const move$: import('rxjs').Observable<{
31
32
  x: number;
32
33
  y: number;
33
34
  }>;
34
- export declare const drag$: import('rxjs').Observable<{
35
+ export declare const drag$: Observable<{
35
36
  event: MouseEvent;
36
37
  movementX: number;
37
38
  movementY: number;
@@ -1 +1,9 @@
1
- export declare function getRelationshipIcon(relationshipType: number): string | null;
1
+ import { IconNode } from 'lucide';
2
+ /**
3
+ * An icon node as an svg data uri, which is what css cursor takes. The glyph
4
+ * is drawn twice, the halo under the ink, with the caps and joins Icon.tsx puts
5
+ * on its svg so the cursor matches the menu item.
6
+ */
7
+ export declare function toCursorImage(node: IconNode, isDarkMode: boolean): string;
8
+ /** The draw-relationship cursor for a relationship type, or null for a type with no glyph. */
9
+ export declare function getRelationshipIcon(relationshipType: number, isDarkMode: boolean): string | null;
@@ -28,9 +28,15 @@ export declare const KeyBindingName: {
28
28
  readonly zoomOut: "zoomOut";
29
29
  };
30
30
  export type KeyBindingName = ValuesType<typeof KeyBindingName>;
31
- export declare const KeyBindingNameList: ("undo" | "redo" | "selectAllColumn" | "edit" | "addMemo" | "addTable" | "removeTable" | "addColumn" | "removeColumn" | "search" | "stop" | "primaryKey" | "selectAllTable" | "relationshipZeroOne" | "relationshipZeroN" | "relationshipOneOnly" | "relationshipOneN" | "tableProperties" | "zoomIn" | "zoomOut")[];
31
+ export declare const KeyBindingNameList: ("undo" | "redo" | "selectAllColumn" | "search" | "stop" | "edit" | "addMemo" | "addTable" | "removeTable" | "addColumn" | "removeColumn" | "primaryKey" | "selectAllTable" | "relationshipZeroOne" | "relationshipZeroN" | "relationshipOneOnly" | "relationshipOneN" | "tableProperties" | "zoomIn" | "zoomOut")[];
32
32
  export type KeyBindingMap = Record<KeyBindingName, ShortcutOption[]>;
33
33
  export declare const createKeyBindingMap: () => KeyBindingMap;
34
34
  export declare function shortcutToTuple(shortcut?: string): KeyBindingPress[];
35
35
  export declare function isMod(event: MouseEvent | TouchEvent | KeyboardEvent): boolean;
36
+ /**
37
+ * Whether the press still belongs to an IME composition. The browser finishes
38
+ * the composition on its own, so a binding that fired here would spend a key
39
+ * the text editor was owed and leave a half-formed syllable behind.
40
+ */
41
+ export declare function isComposing(event: KeyboardEvent): boolean;
36
42
  export declare function simpleShortcutToString(shortcut?: string): string;
@@ -1 +1,2 @@
1
+ export declare const delay: (ms: number) => Promise<void>;
1
2
  export declare function closePromise(): [Promise<void>, () => void];
@@ -0,0 +1,4 @@
1
+ import { ERDEditorSchemaV3 } from '@dineug/erd-editor-schema';
2
+ import { EngineContext } from '../../engine/context';
3
+ import { AMLModel } from './types';
4
+ export declare function convertToSchema(model: AMLModel, ctx: EngineContext, database: number): ERDEditorSchemaV3;
@@ -0,0 +1,12 @@
1
+ import { AMLModel } from './types';
2
+ /**
3
+ * enumValues carries the inline members, which never reach model.types. Both
4
+ * entry points take them as a trailing optional argument, and inline members
5
+ * take precedence over anything the name would resolve to.
6
+ */
7
+ export declare function resolveDataType(typeName: string, database: number, model: AMLModel, enumValues?: string[]): string;
8
+ /**
9
+ * Keeps the members where the column type cannot hold them. Pass database to
10
+ * drop it on the dialects whose ENUM(...) column already spells them out.
11
+ */
12
+ export declare function enumCommentSuffix(typeName: string, model: AMLModel, database: number, enumValues?: string[]): string;
@@ -0,0 +1,3 @@
1
+ import { ERDEditorSchemaV3 } from '@dineug/erd-editor-schema';
2
+ import { EngineContext } from '../../engine/context';
3
+ export declare function schemaAMLParserToSchemaJson(aml: string, ctx: EngineContext, prepare?: (schema: ERDEditorSchemaV3) => ERDEditorSchemaV3): string;
@@ -0,0 +1,2 @@
1
+ import { AMLParseResult } from './types';
2
+ export declare function parseAMLModel(source: string): AMLParseResult;
@@ -0,0 +1,23 @@
1
+ export declare const TokenKind: {
2
+ readonly identifier: 1;
3
+ readonly quoted: 2;
4
+ readonly string: 3;
5
+ readonly expression: 4;
6
+ readonly number: 5;
7
+ readonly punctuation: 6;
8
+ readonly doc: 7;
9
+ readonly comment: 8;
10
+ readonly newline: 9;
11
+ };
12
+ /**
13
+ * AML is indentation-sensitive, so every token carries its line's depth. A
14
+ * newline token opens the line that follows and holds that line's depth, and a
15
+ * synthetic one starts the stream so the first line reads like every other.
16
+ */
17
+ export type Token = {
18
+ kind: number;
19
+ value: string;
20
+ line: number;
21
+ depth: number;
22
+ };
23
+ export declare function tokenize(source: string): Token[];
@@ -0,0 +1,78 @@
1
+ /**
2
+ * tokenizer.ts and parser.ts own every AML syntax concern, resolving
3
+ * indentation, quoting and the constraint grammar into the flat fields below,
4
+ * so convert.ts never sees a token and a nested attribute arrives dotted.
5
+ */
6
+ export type AMLNamespace = {
7
+ database: string;
8
+ catalog: string;
9
+ schema: string;
10
+ };
11
+ /** A dash on either end reads as 1, an angle bracket as n. */
12
+ export type AMLCardinality = '1' | 'n';
13
+ export type AMLEndpoint = {
14
+ namespace: AMLNamespace;
15
+ entityName: string;
16
+ /** Dotted from the entity root, so a nested endpoint keeps settings.slug. */
17
+ attributePaths: string[];
18
+ };
19
+ export type AMLRelation = {
20
+ src: AMLEndpoint;
21
+ ref: AMLEndpoint;
22
+ srcCardinality: AMLCardinality;
23
+ refCardinality: AMLCardinality;
24
+ /** -item_kind=User>; the discriminator has no editor slot and is dropped. */
25
+ polymorphic: boolean;
26
+ };
27
+ /**
28
+ * One unique / unique=name / index / index=name constraint. A bare
29
+ * unique is a column flag; every other spelling groups by name.
30
+ */
31
+ export type AMLAttributeIndex = {
32
+ name: string;
33
+ unique: boolean;
34
+ };
35
+ export type AMLAttribute = {
36
+ /** Dotted from the entity root; a root attribute is its own name. */
37
+ path: string;
38
+ comment: string;
39
+ /** Holds the argument list and any array suffix; never the namespace. */
40
+ typeName: string;
41
+ /** Inline status post_status(draft, published) members. */
42
+ enumValues: string[];
43
+ /** AML is NOT NULL by default, so nullable is what clears this. */
44
+ notNull: boolean;
45
+ primaryKey: boolean;
46
+ indexes: AMLAttributeIndex[];
47
+ default: string;
48
+ autoIncrement: boolean;
49
+ };
50
+ export type AMLEntity = {
51
+ namespace: AMLNamespace;
52
+ name: string;
53
+ alias: string;
54
+ comment: string;
55
+ attributes: AMLAttribute[];
56
+ };
57
+ /** A struct and a custom type carry neither field, which is what stops a lookup. */
58
+ export type AMLType = {
59
+ values: string[];
60
+ /** type uid int -- the aliased name. */
61
+ alias: string;
62
+ };
63
+ export type AMLModel = {
64
+ entities: AMLEntity[];
65
+ /** Inline and standalone relations in source order, both with src filled. */
66
+ relations: AMLRelation[];
67
+ /** Keyed by the qualified name, so cms.post_status and post_status stay apart. */
68
+ types: Record<string, AMLType>;
69
+ skipped: string[];
70
+ };
71
+ export type AMLParseResult = {
72
+ ok: true;
73
+ model: AMLModel;
74
+ } | {
75
+ ok: false;
76
+ message: string;
77
+ };
78
+ export declare const EMPTY_NAMESPACE: AMLNamespace;
@@ -0,0 +1,4 @@
1
+ import { ERDEditorSchemaV3 } from '@dineug/erd-editor-schema';
2
+ import { EngineContext } from '../../engine/context';
3
+ import { DBMLModel } from './types';
4
+ export declare function convertToSchema(model: DBMLModel, ctx: EngineContext, database: number): ERDEditorSchemaV3;
@@ -0,0 +1,7 @@
1
+ import { DBMLModel } from './types';
2
+ export declare function resolveDataType(typeName: string, typeSchemaName: string, database: number, model: DBMLModel): string;
3
+ /**
4
+ * Keeps the members where the column type cannot hold them. Pass database to
5
+ * drop it on the dialects whose ENUM(...) column already spells them out.
6
+ */
7
+ export declare function enumCommentSuffix(typeName: string, typeSchemaName: string, model: DBMLModel, database: number): string;
@@ -0,0 +1,3 @@
1
+ import { ERDEditorSchemaV3 } from '@dineug/erd-editor-schema';
2
+ import { EngineContext } from '../../engine/context';
3
+ export declare function schemaDBMLParserToSchemaJson(dbml: string, ctx: EngineContext, prepare?: (schema: ERDEditorSchemaV3) => ERDEditorSchemaV3): string;
@@ -0,0 +1,2 @@
1
+ import { DBMLParseResult } from './types';
2
+ export declare function parseDBMLModel(source: string): DBMLParseResult;
@@ -0,0 +1,16 @@
1
+ export declare const TokenKind: {
2
+ readonly identifier: 1;
3
+ readonly quoted: 2;
4
+ readonly string: 3;
5
+ readonly expression: 4;
6
+ readonly number: 5;
7
+ readonly punctuation: 6;
8
+ readonly operator: 7;
9
+ readonly newline: 8;
10
+ };
11
+ export type Token = {
12
+ kind: number;
13
+ value: string;
14
+ line: number;
15
+ };
16
+ export declare function tokenize(source: string): Token[];
@@ -0,0 +1,62 @@
1
+ /**
2
+ * tokenizer.ts and parser.ts own every DBML syntax concern -- settings are
3
+ * resolved into the flat fields below, so convert.ts never sees a token.
4
+ */
5
+ export type DBMLEndpoint = {
6
+ schemaName: string;
7
+ tableName: string;
8
+ columnNames: string[];
9
+ };
10
+ export type DBMLInlineRef = {
11
+ /** -, <, > or <>, with the ? optionality markers dropped. */
12
+ operator: string;
13
+ target: DBMLEndpoint;
14
+ };
15
+ export type DBMLColumn = {
16
+ name: string;
17
+ comment: string;
18
+ /** Holds the argument list and any array suffix; never the schema. */
19
+ typeName: string;
20
+ typeSchemaName: string;
21
+ primaryKey: boolean;
22
+ unique: boolean;
23
+ notNull: boolean;
24
+ autoIncrement: boolean;
25
+ default: string;
26
+ inlineRefs: DBMLInlineRef[];
27
+ };
28
+ export type DBMLIndex = {
29
+ name: string;
30
+ unique: boolean;
31
+ /** [pk], which is DBML's only composite primary key spelling. */
32
+ primaryKey: boolean;
33
+ /** Expression columns are dropped, so these are column names only. */
34
+ columnNames: string[];
35
+ };
36
+ export type DBMLTable = {
37
+ schemaName: string;
38
+ name: string;
39
+ alias: string;
40
+ comment: string;
41
+ columns: DBMLColumn[];
42
+ indexes: DBMLIndex[];
43
+ };
44
+ export type DBMLRef = {
45
+ operator: string;
46
+ left: DBMLEndpoint;
47
+ right: DBMLEndpoint;
48
+ };
49
+ export type DBMLModel = {
50
+ tables: DBMLTable[];
51
+ refs: DBMLRef[];
52
+ /** Keyed by the qualified name, so s.status and status stay apart. */
53
+ enums: Record<string, string[]>;
54
+ skipped: string[];
55
+ };
56
+ export type DBMLParseResult = {
57
+ ok: true;
58
+ model: DBMLModel;
59
+ } | {
60
+ ok: false;
61
+ message: string;
62
+ };
@@ -0,0 +1,4 @@
1
+ import { ERDEditorSchemaV3 } from '@dineug/erd-editor-schema';
2
+ import { EngineContext } from '../../engine/context';
3
+ import { GraphQLModel } from './types';
4
+ export declare function convertToSchema(model: GraphQLModel, ctx: EngineContext, database: number): ERDEditorSchemaV3;
@@ -0,0 +1,7 @@
1
+ import { GraphQLModel } from './types';
2
+ export declare function resolveDataType(named: string, database: number, model: GraphQLModel): string;
3
+ /**
4
+ * Keeps the members where the column type cannot hold them. Pass database to
5
+ * drop it on the dialects whose ENUM(...) column already spells them out.
6
+ */
7
+ export declare function enumCommentSuffix(named: string, model: GraphQLModel, database?: number): string;
@@ -0,0 +1,3 @@
1
+ import { ERDEditorSchemaV3 } from '@dineug/erd-editor-schema';
2
+ import { EngineContext } from '../../engine/context';
3
+ export declare function schemaGraphQLParserToSchemaJson(sdl: string, ctx: EngineContext, prepare?: (schema: ERDEditorSchemaV3) => ERDEditorSchemaV3): string;
@@ -0,0 +1,2 @@
1
+ import { GraphQLParseResult } from './types';
2
+ export declare function parseGraphQLModel(sdl: string): GraphQLParseResult;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * parser.ts owns every graphql AST concern -- directives are resolved into
3
+ * the flat fields below, so convert.ts never imports from graphql.
4
+ */
5
+ export type GraphQLTypeRef = {
6
+ named: string;
7
+ /** The outermost wrapper is NonNull -- the column-level NOT NULL signal. */
8
+ nonNull: boolean;
9
+ isList: boolean;
10
+ /** The ! inside [T!] -- a cardinality signal, never a column one. */
11
+ itemNonNull: boolean;
12
+ };
13
+ export type GraphQLField = {
14
+ /** Already rewritten by @map / @column(name:) when either is present. */
15
+ name: string;
16
+ comment: string;
17
+ typeRef: GraphQLTypeRef;
18
+ primaryKey: boolean;
19
+ unique: boolean;
20
+ autoIncrement: boolean;
21
+ default: string;
22
+ /** @db.* or @column(dataType:); wins over the scalar lookup when set. */
23
+ dataType: string;
24
+ relationName: string;
25
+ /** Columns on this type. */
26
+ relationFields: string[];
27
+ /** Columns on the target type. */
28
+ relationReferences: string[];
29
+ /** Resolver fields keep their arguments; the target type decides the rest. */
30
+ hasArguments: boolean;
31
+ };
32
+ export type GraphQLIndex = {
33
+ name: string;
34
+ unique: boolean;
35
+ fieldNames: string[];
36
+ };
37
+ export type GraphQLTable = {
38
+ name: string;
39
+ comment: string;
40
+ fields: GraphQLField[];
41
+ indexes: GraphQLIndex[];
42
+ };
43
+ export type GraphQLModel = {
44
+ tables: GraphQLTable[];
45
+ enums: Record<string, string[]>;
46
+ /** scalar X declarations, so an unknown name can be told from a typo. */
47
+ customScalars: string[];
48
+ unions: Record<string, string[]>;
49
+ /** Pruned type names, so a field pointing at one is dropped rather than read. */
50
+ skipped: string[];
51
+ };
52
+ export type GraphQLParseResult = {
53
+ ok: true;
54
+ model: GraphQLModel;
55
+ } | {
56
+ ok: false;
57
+ message: string;
58
+ };
@@ -0,0 +1,5 @@
1
+ import { RootState } from '../../engine/state';
2
+ import { FormatIndexOptions, FormatTableOptions } from './utils';
3
+ export declare function createSchema(state: RootState): string;
4
+ export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
5
+ export declare function formatIndex({ collections }: RootState, { buffer, index, indexNames }: FormatIndexOptions): void;
@@ -0,0 +1,5 @@
1
+ import { RootState } from '../../engine/state';
2
+ import { FormatIndexOptions, FormatTableOptions } from './utils';
3
+ export declare function createSchema(state: RootState): string;
4
+ export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
5
+ export declare function formatIndex({ collections, settings: { bracketType } }: RootState, { buffer, index, indexNames }: FormatIndexOptions): void;
@@ -0,0 +1,2 @@
1
+ export declare const SharedColors: ReadonlyArray<string>;
2
+ export declare function toSharedColor(id: string): string;
@@ -1,3 +1,10 @@
1
1
  import { RootState } from '../../engine/state';
2
+ import { Settings } from '../../internal-types';
3
+ import { ClipboardPayload } from '.';
2
4
  export declare function tableCopyToText(state: RootState): string;
3
5
  export declare function tableCopyToHtml(state: RootState): string;
6
+ export declare function entitiesCopyToPayload({ editor: { selectedMap }, collections, }: RootState): ClipboardPayload | null;
7
+ export declare function columnsCopyToPayload({ editor: { focusTable }, collections, }: RootState): ClipboardPayload | null;
8
+ export declare function entitiesToTsv(payload: ClipboardPayload, settings: Settings): string;
9
+ export declare function entitiesToHtmlTable(payload: ClipboardPayload, settings: Settings): string;
10
+ export declare function payloadToHtml(payload: ClipboardPayload, tableHtml: string): string;
@@ -1,4 +1,6 @@
1
1
  import { ValuesType } from '../../internal-types';
2
+ export * from './payload';
3
+ export * from './placement';
2
4
  export type Cell = [CellType | '', string];
3
5
  export type Row = Cell[];
4
6
  export declare const CellType: {
@@ -1,4 +1,7 @@
1
1
  import { RootState } from '../../engine/state';
2
2
  import { Column } from '../../internal-types';
3
+ import { ClipboardPayload, ParseResult } from './payload';
3
4
  export declare function tablePasteFromTextToColumns({ settings: { show, columnOrder } }: RootState, text: string): Column[];
4
5
  export declare function tablePasteFromHtmlToColumns({ settings: { show, columnOrder } }: RootState, html: string): Column[];
6
+ export declare function readClipboardPayload(dataTransfer: DataTransfer): ParseResult;
7
+ export declare function payloadToColumns({ columns }: ClipboardPayload): Column[];
@@ -0,0 +1,83 @@
1
+ import { ValuesType } from '../../internal-types';
2
+ export declare const CLIPBOARD_MIME = "application/x-erd-editor";
3
+ export declare const CLIPBOARD_FORMAT = "erd-editor-clipboard";
4
+ export declare const CLIPBOARD_VERSION = 1;
5
+ export declare const CLIPBOARD_HTML_ATTR = "data-erd-editor";
6
+ export declare const CLIPBOARD_HTML_TRUNCATED_ATTR = "data-erd-editor-truncated";
7
+ export declare const HTML_PAYLOAD_MAX_BYTES = 1000000;
8
+ export declare const PayloadKind: {
9
+ readonly tables: "tables";
10
+ readonly columns: "columns";
11
+ };
12
+ export type PayloadKind = ValuesType<typeof PayloadKind>;
13
+ export type ClipboardTable = {
14
+ sourceId: string;
15
+ name: string;
16
+ comment: string;
17
+ columnIds: string[];
18
+ ui: {
19
+ x: number;
20
+ y: number;
21
+ zIndex: number;
22
+ widthName: number;
23
+ widthComment: number;
24
+ color: string;
25
+ };
26
+ };
27
+ export type ClipboardColumn = {
28
+ sourceId: string;
29
+ tableId: string;
30
+ name: string;
31
+ comment: string;
32
+ dataType: string;
33
+ default: string;
34
+ options: number;
35
+ ui: {
36
+ keys: number;
37
+ widthName: number;
38
+ widthComment: number;
39
+ widthDataType: number;
40
+ widthDefault: number;
41
+ };
42
+ };
43
+ export type ClipboardMemo = {
44
+ sourceId: string;
45
+ value: string;
46
+ ui: {
47
+ x: number;
48
+ y: number;
49
+ width: number;
50
+ height: number;
51
+ zIndex: number;
52
+ color: string;
53
+ };
54
+ };
55
+ export type ClipboardPayload = {
56
+ format: typeof CLIPBOARD_FORMAT;
57
+ version: number;
58
+ copyId: string;
59
+ kind: PayloadKind;
60
+ tables: ClipboardTable[];
61
+ columns: ClipboardColumn[];
62
+ memos: ClipboardMemo[];
63
+ };
64
+ export type ParseResult = {
65
+ status: 'ok';
66
+ payload: ClipboardPayload;
67
+ } | {
68
+ status: 'foreign';
69
+ } | {
70
+ status: 'unsupported';
71
+ version: number;
72
+ };
73
+ type CreatePayloadConfig = {
74
+ kind: PayloadKind;
75
+ copyId?: string;
76
+ tables?: ClipboardTable[];
77
+ columns?: ClipboardColumn[];
78
+ memos?: ClipboardMemo[];
79
+ };
80
+ export declare function createPayload({ kind, copyId, tables, columns, memos, }: CreatePayloadConfig): ClipboardPayload;
81
+ export declare function parsePayload(json: string): ParseResult;
82
+ export declare function migratePayload(payload: ClipboardPayload): ClipboardPayload;
83
+ export {};
@@ -0,0 +1,30 @@
1
+ import { Memo, Point, Settings, Table } from '../../internal-types';
2
+ export type PlacementEntity = {
3
+ sourceId: string;
4
+ ui: {
5
+ x: number;
6
+ y: number;
7
+ zIndex?: number;
8
+ };
9
+ };
10
+ export type PlacementSource = {
11
+ ui: {
12
+ x: number;
13
+ y: number;
14
+ };
15
+ };
16
+ export type PlacementPoint = {
17
+ x: number;
18
+ y: number;
19
+ zIndex: number;
20
+ };
21
+ export type ResolvePlacementConfig = {
22
+ entities: PlacementEntity[];
23
+ offset: Point;
24
+ escapeCollision: boolean;
25
+ settings: Settings;
26
+ tables: Table[];
27
+ memos: Memo[];
28
+ findSource: (sourceId: string) => PlacementSource | undefined | null;
29
+ };
30
+ export declare function resolvePlacement({ entities, offset, escapeCollision, settings, tables, memos, findSource, }: ResolvePlacementConfig): Map<string, PlacementPoint>;
@@ -14,3 +14,4 @@ export declare const hasCanvasType: (value: string) => boolean;
14
14
  export declare function textInRange(width: number): number;
15
15
  export declare function toSafeString(value: any): string;
16
16
  export declare function isHighLevelTable(zoomLevel: number): boolean;
17
+ export declare function isEditableTarget(target: EventTarget | null): boolean;