@dineug/erd-editor 3.10.0 → 4.1.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 (392) hide show
  1. package/README.md +140 -158
  2. package/dist/components/appContext.d.ts +4 -0
  3. package/dist/components/erd/Erd.d.ts +3 -0
  4. package/dist/components/erd/automatic-table-placement/AutomaticTablePlacement.d.ts +2 -1
  5. package/dist/components/erd/automatic-table-placement/createAutomaticTablePlacement.d.ts +38 -2
  6. package/dist/components/erd/automatic-table-placement/elkPlacement.d.ts +42 -0
  7. package/dist/components/erd/automatic-table-placement/flowPlacement.d.ts +21 -0
  8. package/dist/components/erd/automatic-table-placement/placementActions.d.ts +14 -0
  9. package/dist/components/erd/automatic-table-placement/runElkPlacement.d.ts +0 -11
  10. package/dist/components/erd/canvas/DiffOutline.template.d.ts +14 -0
  11. package/dist/components/erd/canvas/SceneIcon.template.d.ts +2 -2
  12. package/dist/components/erd/canvas/entityDrag.d.ts +17 -1
  13. package/dist/components/erd/canvas/middleButtonPan.d.ts +11 -0
  14. package/dist/components/erd/canvas/sceneTokens.d.ts +40 -0
  15. package/dist/components/erd/canvas/table/Table.d.ts +9 -1
  16. package/dist/components/erd/canvas/table/doubleClick.d.ts +3 -4
  17. package/dist/components/erd/canvas/table-group/TableGroup.d.ts +17 -0
  18. package/dist/components/erd/canvas/table-group/TableGroupBody.d.ts +17 -0
  19. package/dist/components/erd/canvas/table-group/TableGroupDropTarget.d.ts +10 -0
  20. package/dist/components/erd/canvas/table-group/TableGroupSash.d.ts +35 -0
  21. package/dist/components/erd/canvas/table-group/TableGroups.d.ts +10 -0
  22. package/dist/components/erd/canvas/table-group/tableGroupBox.d.ts +40 -0
  23. package/dist/components/erd/canvas/table-group/titleLayout.d.ts +45 -0
  24. package/dist/components/erd/canvas/useMoveEntity.d.ts +2 -0
  25. package/dist/components/erd/diff-viewer/diff-tree/DiffTree.d.ts +19 -0
  26. package/dist/components/erd/diff-viewer/diff-tree/DiffTree.styles.d.ts +12 -0
  27. package/dist/components/erd/diff-viewer/diff-tree/diffTreeModel.d.ts +49 -0
  28. package/dist/components/erd/diff-viewer/diff.d.ts +21 -19
  29. package/dist/components/erd/draw-target/DrawTargetButtons.d.ts +16 -0
  30. package/dist/components/erd/draw-target/DrawTargetButtons.styles.d.ts +14 -0
  31. package/dist/components/erd/draw-target/drawTargetState.d.ts +26 -0
  32. package/dist/components/erd/draw-target/findDrawTarget.d.ts +29 -0
  33. package/dist/components/erd/draw-target/placePill.d.ts +47 -0
  34. package/dist/components/erd/erd-context-menu/ErdContextMenu.d.ts +6 -0
  35. package/dist/components/erd/erd-context-menu/menus/drawRelationshipMenus.d.ts +3 -0
  36. package/dist/components/erd/erd-context-menu/menus/exportMenus.d.ts +7 -2
  37. package/dist/components/erd/erd-context-menu/menus/importMenus.d.ts +5 -1
  38. package/dist/components/erd/erd-context-menu/menus/relationshipMenus.d.ts +6 -2
  39. package/dist/components/erd/erd-context-menu/menus/showMenus.d.ts +3 -1
  40. package/dist/components/erd/erd-context-menu/menus/tablePlacementMenus.d.ts +3 -0
  41. package/dist/components/erd/floating-toolbar/FloatingToolbar.d.ts +7 -4
  42. package/dist/components/erd/floating-toolbar/ToolbarCompass.template.d.ts +3 -1
  43. package/dist/components/erd/goToErdTarget.d.ts +40 -16
  44. package/dist/components/erd/hitTest.d.ts +16 -1
  45. package/dist/components/erd/minimap/MinimapScene.d.ts +1 -1
  46. package/dist/components/erd/minimap/table/Table.d.ts +3 -3
  47. package/dist/components/erd/minimap/table-group/TableGroup.d.ts +17 -0
  48. package/dist/components/erd/relationshipHighlight.d.ts +18 -0
  49. package/dist/components/erd/table-group/TableGroupDraft.d.ts +15 -0
  50. package/dist/components/erd/table-group/TableGroupDraft.styles.d.ts +6 -0
  51. package/dist/components/erd/table-group/tableGroupName.d.ts +21 -0
  52. package/dist/components/erd/table-group/useTableGroupDraw.d.ts +25 -0
  53. package/dist/components/erd/table-properties/TableProperties.styles.d.ts +2 -2
  54. package/dist/components/erd/table-properties/table-properties-indexes/indexes-key/IndexesKey.d.ts +6 -0
  55. package/dist/components/erd/table-properties/table-properties-tabs/TablePropertiesTabs.d.ts +3 -0
  56. package/dist/components/erd/welcome-screen/WelcomeScreen.d.ts +17 -0
  57. package/dist/components/erd/welcome-screen/WelcomeScreen.styles.d.ts +17 -0
  58. package/dist/components/erd/welcome-screen/welcome-hints/WelcomeHints.d.ts +21 -0
  59. package/dist/components/erd/welcome-screen/welcome-hints/WelcomeHints.styles.d.ts +19 -0
  60. package/dist/components/erd/welcome-screen/welcome-hints/hintArrows.d.ts +10 -0
  61. package/dist/components/erd/welcome-screen/welcomeLayout.d.ts +91 -0
  62. package/dist/components/erd-editor/ErdEditor.d.ts +66 -6
  63. package/dist/components/erd-editor/ErdEditor.styles.d.ts +4 -0
  64. package/dist/components/erd-editor/useErdEditorAttachElement.d.ts +14 -1
  65. package/dist/components/erd-editor/viewportLayout.d.ts +52 -0
  66. package/dist/components/explorer/Explorer.d.ts +12 -0
  67. package/dist/components/explorer/explorer-controller/ExplorerController.d.ts +11 -0
  68. package/dist/components/explorer/explorer-panel/ExplorerPanel.d.ts +14 -0
  69. package/dist/components/explorer/explorer-panel/ExplorerPanel.styles.d.ts +13 -0
  70. package/dist/components/explorer/explorer-search/ExplorerSearch.d.ts +12 -0
  71. package/dist/components/explorer/explorer-search/ExplorerSearch.styles.d.ts +13 -0
  72. package/dist/components/explorer/explorerCommands.d.ts +28 -0
  73. package/dist/components/explorer/explorerNavigation.d.ts +14 -0
  74. package/dist/components/explorer/explorerSearch.d.ts +71 -0
  75. package/dist/components/explorer/explorerTree.d.ts +90 -0
  76. package/dist/components/explorer/explorerView.d.ts +54 -0
  77. package/dist/components/{find-replace → explorer}/matchTarget.d.ts +5 -7
  78. package/dist/components/export-image/ExportImage.d.ts +23 -0
  79. package/dist/components/export-image/ExportImage.styles.d.ts +34 -0
  80. package/dist/components/export-image/exportImageActions.d.ts +48 -0
  81. package/dist/components/generator-code/GeneratorCode.d.ts +1 -0
  82. package/dist/components/generator-code/generator-code-context-menu/GeneratorCodeContextMenu.d.ts +3 -0
  83. package/dist/components/generator-code/generator-code-context-menu/menus/columnNameCaseMenus.d.ts +3 -0
  84. package/dist/components/generator-code/generator-code-context-menu/menus/languageMenus.d.ts +8 -0
  85. package/dist/components/generator-code/generator-code-context-menu/menus/tableNameCaseMenus.d.ts +3 -0
  86. package/dist/components/generator-code/generator-code-options/GeneratorCodeOptions.d.ts +17 -0
  87. package/dist/components/generator-code/generator-code-options/GeneratorCodeOptions.styles.d.ts +5 -0
  88. package/dist/components/generator-code/generatorCodeView.d.ts +12 -0
  89. package/dist/components/generator-code/languageSettings.d.ts +14 -0
  90. package/dist/components/locale-picker/LocalePicker.d.ts +13 -0
  91. package/dist/components/locale-picker/LocalePicker.styles.d.ts +19 -0
  92. package/dist/components/localeContext.d.ts +10 -0
  93. package/dist/components/localized/Localized.d.ts +18 -0
  94. package/dist/components/map-columns/MapColumnsBody.d.ts +24 -0
  95. package/dist/components/map-columns/MapColumnsDialog.d.ts +13 -0
  96. package/dist/components/map-columns/MapColumnsDialog.styles.d.ts +38 -0
  97. package/dist/components/map-columns/mapColumnsAction.d.ts +13 -0
  98. package/dist/components/map-columns/nameOf.d.ts +6 -0
  99. package/dist/components/map-columns/openMapColumns.d.ts +9 -0
  100. package/dist/components/primitives/code-block/CodeBlock.d.ts +6 -1
  101. package/dist/components/primitives/code-block/CodeBlock.styles.d.ts +2 -0
  102. package/dist/components/primitives/color-picker/ColorPicker.d.ts +10 -1
  103. package/dist/components/primitives/color-picker/ColorPicker.styles.d.ts +25 -0
  104. package/dist/components/primitives/color-picker/colorModel.d.ts +36 -0
  105. package/dist/components/primitives/color-picker/presetColors.d.ts +13 -0
  106. package/dist/components/primitives/color-picker/resolveColor.d.ts +7 -0
  107. package/dist/components/primitives/context-menu/ContextMenu.d.ts +2 -0
  108. package/dist/components/primitives/context-menu/context-menu-content/ContextMenuContent.d.ts +1 -0
  109. package/dist/components/primitives/context-menu/context-menu-content/fitMenu.d.ts +4 -4
  110. package/dist/components/primitives/context-menu/context-menu-separator/ContextMenuSeparator.d.ts +8 -0
  111. package/dist/components/primitives/context-menu/context-menu-separator/ContextMenuSeparator.styles.d.ts +2 -0
  112. package/dist/components/primitives/context-menu/menu/Menu.d.ts +2 -0
  113. package/dist/components/primitives/context-menu/submenu-chevron/SubmenuChevron.d.ts +5 -0
  114. package/dist/components/primitives/dialog/Dialog.d.ts +21 -0
  115. package/dist/components/primitives/dialog/Dialog.styles.d.ts +12 -0
  116. package/dist/components/primitives/highlighted-text/HighlightedText.d.ts +2 -5
  117. package/dist/components/primitives/icon/icons.d.ts +24 -3
  118. package/dist/components/primitives/sash/Sash.d.ts +1 -0
  119. package/dist/components/primitives/select/Select.d.ts +18 -0
  120. package/dist/components/primitives/select/Select.styles.d.ts +13 -0
  121. package/dist/components/primitives/text-input/TextInput.d.ts +2 -0
  122. package/dist/components/primitives/toast/Toast.d.ts +5 -1
  123. package/dist/components/primitives/toast/Toast.styles.d.ts +2 -2
  124. package/dist/components/primitives/tree/Tree.d.ts +30 -0
  125. package/dist/components/primitives/tree/Tree.styles.d.ts +5 -0
  126. package/dist/components/primitives/tree/treeModel.d.ts +42 -0
  127. package/dist/components/quick-search/QuickSearch.d.ts +2 -1
  128. package/dist/components/quick-search/QuickSearch.styles.d.ts +1 -0
  129. package/dist/components/quick-search/actions.d.ts +39 -7
  130. package/dist/components/quick-search/hangul.d.ts +16 -10
  131. package/dist/components/quick-search/paletteList.d.ts +7 -0
  132. package/dist/components/quick-search/paletteQuery.d.ts +5 -4
  133. package/dist/components/quick-search/scopedActions.d.ts +10 -15
  134. package/dist/components/schema-sql/SchemaSQL.d.ts +2 -0
  135. package/dist/components/schema-sql/SchemaSQL.styles.d.ts +7 -0
  136. package/dist/components/schema-sql/schema-sql-context-menu/SchemaSQLContextMenu.d.ts +3 -0
  137. package/dist/components/schema-sql/schema-sql-context-menu/menus/bracketMenus.d.ts +3 -0
  138. package/dist/components/schema-sql/schema-sql-context-menu/menus/headerMenus.d.ts +29 -0
  139. package/dist/components/schema-sql/schema-sql-context-menu/menus/statementsMenus.d.ts +27 -0
  140. package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.d.ts +24 -0
  141. package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.styles.d.ts +45 -0
  142. package/dist/components/schema-sql/schema-sql-options/ScriptEditor.d.ts +20 -0
  143. package/dist/components/schema-sql/schema-sql-options/ScriptEditor.styles.d.ts +13 -0
  144. package/dist/components/schema-sql/schema-sql-options/dropWarning.d.ts +8 -0
  145. package/dist/components/schema-sql/schemaSQLView.d.ts +71 -0
  146. package/dist/components/settings/Settings.styles.d.ts +7 -0
  147. package/dist/components/settings/columnTypeLabels.d.ts +8 -0
  148. package/dist/components/settings/lockSettingRows.d.ts +16 -0
  149. package/dist/components/settings/settings-lnb/SettingsLnb.d.ts +3 -0
  150. package/dist/components/settings/settingsPage.d.ts +10 -0
  151. package/dist/components/theme-builder/ThemeBuilder.d.ts +9 -1
  152. package/dist/components/theme-builder/ThemeBuilder.styles.d.ts +7 -4
  153. package/dist/components/toast-container/openStatusToast.d.ts +29 -0
  154. package/dist/components/toast-container/openToastWhileRunning.d.ts +1 -1
  155. package/dist/components/toolbar/Toolbar.d.ts +1 -0
  156. package/dist/components/toolbar/Toolbar.styles.d.ts +0 -1
  157. package/dist/components/visualization/graph-node/GraphNode.d.ts +2 -2
  158. package/dist/components/visualization/graphPan.d.ts +12 -0
  159. package/dist/components/visualization/visualizationView.d.ts +2 -2
  160. package/dist/constants/language.d.ts +1 -1
  161. package/dist/constants/layout.d.ts +41 -1
  162. package/dist/constants/open.d.ts +3 -1
  163. package/dist/constants/schema.d.ts +25 -4
  164. package/dist/constants/sql/dataType/PostgreSQL.d.ts +2 -1
  165. package/dist/constants/sql/dataType/SQLite.d.ts +3 -1
  166. package/dist/engine/actions.d.ts +20 -2
  167. package/dist/engine/context.d.ts +6 -0
  168. package/dist/engine/index.js +26 -21
  169. package/dist/engine/modules/editor/actions.d.ts +10 -2
  170. package/dist/engine/modules/editor/atom.actions.d.ts +49 -11
  171. package/dist/engine/modules/editor/generator.actions.d.ts +107 -8
  172. package/dist/engine/modules/editor/state.d.ts +16 -3
  173. package/dist/engine/modules/editor/utils/color.d.ts +21 -0
  174. package/dist/engine/modules/editor/utils/duplicate.d.ts +28 -1
  175. package/dist/engine/modules/editor/utils/focus.d.ts +16 -0
  176. package/dist/engine/modules/editor/utils/releaseHidden.d.ts +16 -0
  177. package/dist/engine/modules/editor/utils/selection.d.ts +12 -0
  178. package/dist/engine/modules/relationship/actions.d.ts +6 -0
  179. package/dist/engine/modules/relationship/atom.actions.d.ts +57 -1
  180. package/dist/engine/modules/relationship/endFlags.d.ts +14 -0
  181. package/dist/engine/modules/relationship/fkColumns.d.ts +25 -6
  182. package/dist/engine/modules/relationship/history.d.ts +1 -0
  183. package/dist/engine/modules/relationship/hooks.d.ts +0 -11
  184. package/dist/engine/modules/relationship/referenceType.d.ts +12 -0
  185. package/dist/engine/modules/settings/actions.d.ts +17 -4
  186. package/dist/engine/modules/settings/atom.actions.d.ts +63 -19
  187. package/dist/engine/modules/settings/generator.actions.d.ts +7 -0
  188. package/dist/engine/modules/settings/history.d.ts +1 -0
  189. package/dist/engine/modules/table/actions.d.ts +8 -0
  190. package/dist/engine/modules/table/atom.actions.d.ts +31 -0
  191. package/dist/engine/modules/table/generator.actions.d.ts +3 -3
  192. package/dist/engine/modules/table/history.d.ts +1 -0
  193. package/dist/engine/modules/table-column/generator.actions.d.ts +8 -0
  194. package/dist/engine/modules/table-column/hooks.d.ts +0 -6
  195. package/dist/engine/modules/table-column/keys.d.ts +14 -0
  196. package/dist/engine/modules/table-column/utils/dataType.d.ts +19 -1
  197. package/dist/engine/modules/table-group/actions.d.ts +63 -0
  198. package/dist/engine/modules/table-group/atom.actions.d.ts +238 -0
  199. package/dist/engine/modules/table-group/generator.actions.d.ts +111 -0
  200. package/dist/engine/modules/table-group/history.d.ts +13 -0
  201. package/dist/engine/peer-store.d.ts +9 -3
  202. package/dist/engine/replication-store.d.ts +6 -3
  203. package/dist/engine/rx-operators/groupByStreamActions.d.ts +5 -1
  204. package/dist/engine/rx-operators/lockIgnoreFilter.d.ts +8 -0
  205. package/dist/engine/rx-store.d.ts +2 -0
  206. package/dist/engine/settle.d.ts +9 -0
  207. package/dist/engine/store-hooks.d.ts +0 -8
  208. package/dist/erd-editor.umd.js +2350 -4222
  209. package/dist/hooks/useNavigatorLanguages.d.ts +7 -0
  210. package/dist/i18n/locales.d.ts +126 -0
  211. package/dist/i18n/menuLabel.d.ts +12 -0
  212. package/dist/i18n/messages/ar-SA.d.ts +425 -0
  213. package/dist/i18n/messages/de-DE.d.ts +405 -0
  214. package/dist/i18n/messages/en/code.d.ts +16 -0
  215. package/dist/i18n/messages/en/colorPicker.d.ts +35 -0
  216. package/dist/i18n/messages/en/common.d.ts +64 -0
  217. package/dist/i18n/messages/en/contextMenu.d.ts +29 -0
  218. package/dist/i18n/messages/en/explorer.d.ts +37 -0
  219. package/dist/i18n/messages/en/exportImage.d.ts +25 -0
  220. package/dist/i18n/messages/en/feedback.d.ts +11 -0
  221. package/dist/i18n/messages/en/findReplace.d.ts +40 -0
  222. package/dist/i18n/messages/en/floatingToolbar.d.ts +12 -0
  223. package/dist/i18n/messages/en/index.d.ts +408 -0
  224. package/dist/i18n/messages/en/mapColumns.d.ts +39 -0
  225. package/dist/i18n/messages/en/palette.d.ts +34 -0
  226. package/dist/i18n/messages/en/schemaSql.d.ts +28 -0
  227. package/dist/i18n/messages/en/settings.d.ts +22 -0
  228. package/dist/i18n/messages/en/shortcuts.d.ts +34 -0
  229. package/dist/i18n/messages/en/tableProperties.d.ts +34 -0
  230. package/dist/i18n/messages/en/themeBuilder.d.ts +7 -0
  231. package/dist/i18n/messages/en/toolbar.d.ts +8 -0
  232. package/dist/i18n/messages/en/visualization.d.ts +12 -0
  233. package/dist/i18n/messages/en/welcome.d.ts +13 -0
  234. package/dist/i18n/messages/es-ES.d.ts +410 -0
  235. package/dist/i18n/messages/eu-ES.d.ts +405 -0
  236. package/dist/i18n/messages/fa-IR.d.ts +405 -0
  237. package/dist/i18n/messages/fr-FR.d.ts +410 -0
  238. package/dist/i18n/messages/he-IL.d.ts +410 -0
  239. package/dist/i18n/messages/id-ID.d.ts +400 -0
  240. package/dist/i18n/messages/index.d.ts +11 -0
  241. package/dist/i18n/messages/it-IT.d.ts +410 -0
  242. package/dist/i18n/messages/ja-JP.d.ts +400 -0
  243. package/dist/i18n/messages/ko-KR.d.ts +400 -0
  244. package/dist/i18n/messages/nl-NL.d.ts +405 -0
  245. package/dist/i18n/messages/pl-PL.d.ts +415 -0
  246. package/dist/i18n/messages/pt-BR.d.ts +410 -0
  247. package/dist/i18n/messages/pt-PT.d.ts +410 -0
  248. package/dist/i18n/messages/ro-RO.d.ts +410 -0
  249. package/dist/i18n/messages/ru-RU.d.ts +415 -0
  250. package/dist/i18n/messages/sk-SK.d.ts +415 -0
  251. package/dist/i18n/messages/sl-SI.d.ts +415 -0
  252. package/dist/i18n/messages/sv-SE.d.ts +405 -0
  253. package/dist/i18n/messages/tr-TR.d.ts +405 -0
  254. package/dist/i18n/messages/uk-UA.d.ts +415 -0
  255. package/dist/i18n/messages/zh-CN.d.ts +400 -0
  256. package/dist/i18n/messages/zh-TW.d.ts +400 -0
  257. package/dist/i18n/resolveLocale.d.ts +11 -0
  258. package/dist/i18n/source.d.ts +7 -0
  259. package/dist/i18n/translate.d.ts +58 -0
  260. package/dist/index.d.ts +2 -0
  261. package/dist/index.js +31169 -12611
  262. package/dist/internal-types/index.d.ts +2 -4
  263. package/dist/konva/scene/contentBounds.d.ts +18 -12
  264. package/dist/konva/scene/metrics.d.ts +2 -0
  265. package/dist/konva/scene/renderScene.d.ts +10 -4
  266. package/dist/konva/scene/stacking.d.ts +21 -0
  267. package/dist/konva/scene/viewLayout.d.ts +2 -1
  268. package/dist/loadValue-BKvXDYoC.js +12925 -0
  269. package/dist/peer/index.d.ts +6 -3
  270. package/dist/peer/index.js +82 -75
  271. package/dist/services/elk-layout/elkGraph.d.ts +6 -4
  272. package/dist/services/elk-layout/elkLayoutOptions.d.ts +20 -0
  273. package/dist/services/elk-layout/elkLayoutService.d.ts +3 -3
  274. package/dist/services/export-png/ExportScene.d.ts +3 -3
  275. package/dist/services/export-png/documentScene.d.ts +14 -9
  276. package/dist/services/export-png/exportBox.d.ts +40 -5
  277. package/dist/services/export-png/exportPngService.d.ts +15 -0
  278. package/dist/services/export-png/exportTheme.d.ts +26 -0
  279. package/dist/services/export-png/index.d.ts +44 -11
  280. package/dist/services/export-png/renderPng.d.ts +18 -10
  281. package/dist/services/export-png/renderSvg.d.ts +22 -0
  282. package/dist/services/export-png/sceneSvg.d.ts +54 -0
  283. package/dist/services/shiki/graphqlGrammar.d.ts +8 -0
  284. package/dist/shared-store-2IUOt99m.js +1341 -0
  285. package/dist/styles/scrollbar.styles.d.ts +1 -1
  286. package/dist/themes/radix-ui-theme.d.ts +11 -3
  287. package/dist/themes/tokens.d.ts +18 -4
  288. package/dist/utils/calcTable.d.ts +9 -0
  289. package/dist/utils/clipboard.d.ts +9 -0
  290. package/dist/utils/collection/tableGroup.entity.d.ts +3 -0
  291. package/dist/utils/contrastText.d.ts +21 -0
  292. package/dist/utils/deepMerge.d.ts +8 -0
  293. package/dist/utils/device-detect/index.d.ts +2 -6
  294. package/dist/utils/diff/compareEntities.d.ts +39 -0
  295. package/dist/utils/diff/diffDocuments.d.ts +12 -0
  296. package/dist/utils/diff/index.d.ts +5 -0
  297. package/dist/utils/diff/pairEntities.d.ts +41 -0
  298. package/dist/utils/diff/types.d.ts +77 -0
  299. package/dist/utils/domEvent.d.ts +18 -0
  300. package/dist/utils/dragSelect.d.ts +2 -0
  301. package/dist/utils/draw-relationship/bezier.d.ts +2 -0
  302. package/dist/utils/draw-relationship/corner.d.ts +9 -0
  303. package/dist/utils/draw-relationship/index.d.ts +18 -18
  304. package/dist/utils/draw-relationship/loop.d.ts +29 -0
  305. package/dist/utils/draw-relationship/pathFinding.d.ts +1 -1
  306. package/dist/utils/draw-relationship/sort.d.ts +8 -1
  307. package/dist/utils/draw-relationship/stub.d.ts +4 -3
  308. package/dist/utils/emitter.d.ts +53 -12
  309. package/dist/utils/file/exportFile.d.ts +15 -5
  310. package/dist/utils/file/importFile.d.ts +9 -5
  311. package/dist/utils/file/importSchema.d.ts +45 -0
  312. package/dist/utils/find-replace/findMatches.d.ts +25 -12
  313. package/dist/utils/find-replace/matcher.d.ts +2 -0
  314. package/dist/utils/find-replace/present.d.ts +8 -5
  315. package/dist/utils/find-replace/preserveCase.d.ts +10 -0
  316. package/dist/utils/generator-code/columnTypes.d.ts +99 -0
  317. package/dist/utils/generator-code/doctrine.d.ts +6 -0
  318. package/dist/utils/generator-code/doctrineReservedWords.d.ts +7 -0
  319. package/dist/utils/generator-code/graphql.d.ts +6 -0
  320. package/dist/utils/generator-code/heck.d.ts +5 -0
  321. package/dist/utils/generator-code/java.d.ts +28 -0
  322. package/dist/utils/generator-code/jsonSchema.d.ts +50 -0
  323. package/dist/utils/generator-code/jsonShape.d.ts +37 -0
  324. package/dist/utils/generator-code/kotlin.d.ts +1 -0
  325. package/dist/utils/generator-code/mermaid.d.ts +5 -0
  326. package/dist/utils/generator-code/php.d.ts +28 -0
  327. package/dist/utils/generator-code/rust.d.ts +13 -0
  328. package/dist/utils/generator-code/rustTypes.d.ts +44 -0
  329. package/dist/utils/generator-code/scala.d.ts +1 -0
  330. package/dist/utils/generator-code/seaorm.d.ts +22 -0
  331. package/dist/utils/generator-code/swift.d.ts +44 -0
  332. package/dist/utils/generator-code/utils.d.ts +19 -0
  333. package/dist/utils/generator-code/zod.d.ts +25 -0
  334. package/dist/utils/globalEventObservable.d.ts +10 -1
  335. package/dist/utils/highlightWords.d.ts +29 -0
  336. package/dist/utils/index.d.ts +1 -2
  337. package/dist/utils/keyboard-shortcut/bindKeys.d.ts +9 -0
  338. package/dist/utils/keyboard-shortcut/index.d.ts +19 -4
  339. package/dist/utils/keyboard-shortcut/utils.d.ts +21 -0
  340. package/dist/utils/map-columns/alignTypes.d.ts +37 -0
  341. package/dist/utils/map-columns/buildRows.d.ts +102 -0
  342. package/dist/utils/map-columns/candidateKeys.d.ts +24 -0
  343. package/dist/utils/map-columns/index.d.ts +8 -0
  344. package/dist/utils/map-columns/mapping.d.ts +67 -0
  345. package/dist/utils/map-columns/prefill.d.ts +26 -0
  346. package/dist/utils/map-columns/toMapColumnsActions.d.ts +10 -0
  347. package/dist/utils/map-columns/validate.d.ts +45 -0
  348. package/dist/utils/memo.d.ts +4 -0
  349. package/dist/utils/schema-aml-parser/types.d.ts +2 -0
  350. package/dist/utils/schema-dbml-parser/tokenizer.d.ts +2 -0
  351. package/dist/utils/schema-dbml-parser/types.d.ts +11 -0
  352. package/dist/utils/schema-sql/Databricks.d.ts +8 -3
  353. package/dist/utils/schema-sql/MSSQL.d.ts +14 -2
  354. package/dist/utils/schema-sql/MariaDB.d.ts +6 -5
  355. package/dist/utils/schema-sql/MySQL.d.ts +13 -4
  356. package/dist/utils/schema-sql/Oracle.d.ts +19 -5
  357. package/dist/utils/schema-sql/PostgreSQL.d.ts +16 -4
  358. package/dist/utils/schema-sql/SQLite.d.ts +16 -4
  359. package/dist/utils/schema-sql/Snowflake.d.ts +8 -3
  360. package/dist/utils/schema-sql/index.d.ts +16 -1
  361. package/dist/utils/schema-sql/options.d.ts +57 -0
  362. package/dist/utils/schema-sql/utils.d.ts +101 -2
  363. package/dist/utils/stageCursor.d.ts +20 -0
  364. package/dist/utils/table-clipboard/placement.d.ts +2 -0
  365. package/dist/utils/tableColor.d.ts +29 -0
  366. package/dist/utils/tableGroup.d.ts +142 -0
  367. package/dist/utils/tableKeys.d.ts +11 -3
  368. package/dist/utils/takeover.d.ts +6 -0
  369. package/dist/utils/virtualRange.d.ts +15 -0
  370. package/dist/workers/elkLayout.shared-worker.js +1 -1
  371. package/dist/workers/exportPng.shared-worker.js +30 -30
  372. package/dist/workers/shiki.shared-worker.js +1 -1
  373. package/dist/workers/spawn.d.ts +1 -2
  374. package/dist/workers/spawn.inline.d.ts +0 -1
  375. package/package.json +4 -11
  376. package/dist/components/erd/diff-viewer/tree-viewer/TreeViewer.d.ts +0 -12
  377. package/dist/components/erd/diff-viewer/tree-viewer/TreeViewer.styles.d.ts +0 -6
  378. package/dist/components/find-replace/FindReplace.d.ts +0 -13
  379. package/dist/components/find-replace/FindReplace.styles.d.ts +0 -27
  380. package/dist/components/find-replace/panelLayout.d.ts +0 -17
  381. package/dist/components/generator-code/GeneratorCode.styles.d.ts +0 -2
  382. package/dist/loadValue-Mdc5K4qO.js +0 -10858
  383. package/dist/schemaGCService-CZtGFh2z.js +0 -42
  384. package/dist/services/schema-gc/index.d.ts +0 -18
  385. package/dist/services/schema-gc/procGC.d.ts +0 -4
  386. package/dist/services/schema-gc/schemaGC.shared-worker.d.ts +0 -2
  387. package/dist/services/schema-gc/schemaGCService.d.ts +0 -10
  388. package/dist/shared-store-D82WVL5a.js +0 -1129
  389. package/dist/styles/colorPicker.style.d.ts +0 -7
  390. package/dist/utils/draw-relationship/chamfer.d.ts +0 -3
  391. package/dist/workers/schemaGC.shared-worker.js +0 -1
  392. /package/dist/components/{find-replace → explorer}/fieldIcon.d.ts +0 -0
package/README.md CHANGED
@@ -2,32 +2,34 @@
2
2
 
3
3
  > Entity-Relationship Diagram Editor as a custom element
4
4
 
5
- ![erd-editor](https://github.com/dineug/erd-editor/blob/main/img/erd-editor-vscode.png?raw=true)
5
+ ![ERD Editor](https://github.com/dineug/erd-editor/blob/main/img/erd-editor-vscode.png?raw=true)
6
6
 
7
- `<erd-editor>` is a full database-schema editor in a single custom element. It has no
8
- framework dependency and renders into a closed shadow root, so it drops into any page —
9
- React, Vue, Svelte, or plain HTML — without leaking styles either way.
10
-
11
- This is the same editor that powers [erd-editor.io](https://erd-editor.io), the
12
- [Google Drive app](https://workspace.google.com/marketplace/app/erd_editor/428467403360), the
13
- [VS Code extension](https://marketplace.visualstudio.com/items?itemName=dineug.vuerd-vscode),
14
- the [IntelliJ plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor) and the
7
+ `<erd-editor>` is a database-schema editor in one custom element. It has no framework dependency
8
+ and renders into a closed shadow root, so it drops into React, Vue, Svelte or plain HTML without
9
+ leaking styles either way. It is the same editor as [erd-editor.io](https://erd-editor.io), the
10
+ [VS Code extension](https://marketplace.visualstudio.com/items?itemName=dineug.vuerd-vscode), the
11
+ [JetBrains plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor) and the
15
12
  [Obsidian plugin](https://community.obsidian.md/plugins/erd-editor).
16
13
 
17
14
  ## Features
18
15
 
19
- - Visual schema design — tables, columns, memos, and four relationship cardinalities
20
- (zero-one, zero-N, one-only, one-N)
21
- - Import — a `.sql` dump, a GraphQL SDL schema from any tool that emits one, a `.dbml` file, or
22
- an `.aml` file
23
- - SQL DDL export — Databricks, MariaDB, MSSQL, MySQL, Oracle, PostgreSQL, Snowflake and SQLite
24
- - Code generation — TypeScript, GraphQL, C#, Java, JPA, Kotlin, Scala, Go,
25
- SQLAlchemy, TypeORM, Sequelize, Drizzle, DBML, AML
26
- - Export — `.erd.json`, `.sql`, `.png`
27
- - Force-directed visualization of table relationships
28
- - Quick search over commands, and over tables, columns, comments and memos after `#`, `@` or `:`,
29
- find and replace, undo / redo, remappable keyboard shortcuts, and a built-in theme builder
30
- - Collaboration hooks — the editor emits and applies actions; you supply the transport
16
+ - **Design** — tables, columns, memos and table groups, four relationship cardinalities, ON DELETE
17
+ and ON UPDATE, alternate keys, Auto Layout
18
+ - **Import** — SQL DDL, GraphQL SDL, DBML and AML from the menu or [`setSchema*`](#importing-a-schema),
19
+ replacing the diagram or adding to it
20
+ - **Export** — DDL for eight databases, also from `getSchemaSQL()`, code in 22 languages and ORMs,
21
+ PNG and SVG
22
+ - **Navigate** — command palette (`Ctrl`/`Cmd`+`K`), an Explorer tree with find and replace, Graph
23
+ and Flow views
24
+ - **History** — undo and redo, time travel through the session, a diff viewer (`setDiffValue()`)
25
+ - **25 languages** and a System, Light or Dark theme, their pickers opt-in with an attribute
26
+ - **Collaboration** — [`getSharedStore()`](#collaboration) relays edits over your own transport,
27
+ and the [headless entries](#headless-replica) run the same document with no DOM
28
+
29
+ **Databases:** Databricks, MariaDB, MSSQL, MySQL, Oracle, PostgreSQL, Snowflake, SQLite
30
+
31
+ **Code:** TypeScript, GraphQL, C#, Java, JPA, Kotlin, Scala, Go, SQLAlchemy, TypeORM, Sequelize,
32
+ Drizzle, DBML, AML, Mermaid, PHP, Doctrine, Rust, SeaORM, Swift, Zod, JSON Schema
31
33
 
32
34
  ## Install
33
35
 
@@ -35,13 +37,9 @@ the [IntelliJ plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor) and
35
37
  npm install @dineug/erd-editor
36
38
  ```
37
39
 
38
- The package ships ES modules with its dependencies left as bare imports, so any bundler
39
- (Vite, webpack, Rspack, esbuild, …) resolves, dedupes and tree-shakes them like the rest of
40
- your app. Four features run in shared workers — schema garbage collection, the PNG export, the
41
- automatic table placement and the syntax highlighting — constructed as
42
- `new SharedWorker(new URL('./workers/…', import.meta.url))`, which those bundlers emit as worker
43
- files beside your chunks; a strict CSP needs `worker-src 'self'`. Without a bundler, use the UMD
44
- file described under [Script tag](#script-tag) instead.
40
+ The PNG and SVG export, the Flow and tree layouts and the syntax highlighting run in shared
41
+ workers, which Vite, webpack and Rspack emit beside your chunks and esbuild does not. A strict CSP
42
+ needs `worker-src 'self'`. Without a bundler, use the [script tag](#script-tag) build.
45
43
 
46
44
  ## Usage
47
45
 
@@ -49,26 +47,20 @@ file described under [Script tag](#script-tag) instead.
49
47
  import '@dineug/erd-editor';
50
48
 
51
49
  const editor = document.createElement('erd-editor');
52
- // the editor fills its container, and a custom element is inline by default
50
+ // a custom element is inline, and the editor fills its box
53
51
  Object.assign(editor.style, { display: 'block', width: '100%', height: '100vh' });
54
52
  document.body.appendChild(editor);
55
53
 
56
- // load a document without adding an undo entry, then keep it in sync
57
54
  editor.setInitialValue(localStorage.getItem('my-diagram') ?? '');
58
55
  editor.addEventListener('change', () => {
59
56
  localStorage.setItem('my-diagram', editor.value);
60
57
  });
61
58
  ```
62
59
 
63
- `setInitialValue('')` starts a new document, as an element given no value shows: it saves neither
64
- the scroll nor the zoom (Save Scroll Information and Save Zoom Information off), so looking around
65
- leaves `value` as it was. A document loaded from text keeps the switches it names, and one that
66
- names none saves both.
67
-
68
60
  ### Server-side rendering
69
61
 
70
- Importing the package registers the custom element at module scope, so it needs a DOM and
71
- throws in Node. In Next.js, Nuxt, SvelteKit or Astro, reach it from a client-only path:
62
+ Importing the package registers the element, which needs a DOM, so in Next.js, Nuxt, SvelteKit or
63
+ Astro import it on the client:
72
64
 
73
65
  ```js
74
66
  useEffect(() => {
@@ -78,215 +70,205 @@ useEffect(() => {
78
70
 
79
71
  ### Vite
80
72
 
81
- In development Vite pre-bundles dependencies into its cache directory, and the worker files
82
- would then be looked up there rather than beside the package. Exclude the editor packages from
83
- that step; a production build needs nothing.
73
+ In development, keep the editor out of Vite's pre-bundling and include the ELK bundle its layout
74
+ worker imports, or the Flow and tree layouts fail. A production build needs nothing.
84
75
 
85
76
  ```js
86
77
  // vite.config.js
87
78
  export default {
88
79
  optimizeDeps: {
89
80
  exclude: ['@dineug/erd-editor'],
81
+ include: ['@dineug/erd-editor > elkjs/lib/elk.bundled.js'],
90
82
  },
91
83
  };
92
84
  ```
93
85
 
94
86
  ### Script tag
95
87
 
96
- `dist/erd-editor.umd.js` is a self-contained build for a plain `<script>` tag: every
97
- dependency and all four workers are inside it, and it registers `<erd-editor>` and exposes the
98
- two file callbacks as `window.ErdEditor`. It is what `unpkg` and `jsdelivr` serve.
88
+ `dist/erd-editor.umd.js` bundles every dependency and worker, registers `<erd-editor>` and puts
89
+ `setExportFileCallback`, `setImportFileCallback` and `createKeyBindingMap` on `window.ErdEditor`.
90
+ Its workers are `data:` URLs, so a strict CSP needs `worker-src data:`. Pin a version beyond a demo.
99
91
 
100
92
  ```html
101
93
  <erd-editor style="display: block; width: 100%; height: 100vh"></erd-editor>
102
94
  <script src="https://cdn.jsdelivr.net/npm/@dineug/erd-editor/dist/erd-editor.umd.js"></script>
103
95
  ```
104
96
 
105
- The workers travel inside the file as `data:` URLs, so a strict CSP needs `worker-src data:`
106
- for this build. Pin a version in the URL for anything beyond a demo.
107
-
108
- ### HTML
109
-
110
- ```html
111
- <erd-editor system-dark-mode enable-theme-builder></erd-editor>
112
- <script type="module">
113
- import '@dineug/erd-editor';
114
-
115
- const editor = document.querySelector('erd-editor');
116
- </script>
117
- ```
118
-
119
- ```css
120
- erd-editor {
121
- display: block;
122
- width: 100%;
123
- height: 100vh;
124
- }
125
- ```
126
-
127
97
  ## API
128
98
 
99
+ The element's type is exported as `ErdEditorElement`. The
100
+ [Element API docs](https://docs.erd-editor.io/docs/api/erd-editor-element) cover each member in
101
+ full.
102
+
129
103
  ### Attributes
130
104
 
131
105
  | Attribute | Property | Description |
132
106
  | --- | --- | --- |
133
- | `readonly` | `readonly` | Blocks editing and suppresses the `change` event. Assigning `value`, `setSchemaSQL()`, `setSchemaGraphQL()`, `setSchemaDBML()`, `setSchemaAML()` and `clear()` are ignored while it is set — load with `setInitialValue()` instead. Viewport actions and the SQL/code output settings still apply. |
134
- | `system-dark-mode` | `systemDarkMode` | Follows the OS color scheme |
135
- | `enable-theme-builder` | `enableThemeBuilder` | Shows the built-in theme builder |
107
+ | `readonly` | `readonly` | Blocks editing and `change`; only `setInitialValue()` still loads. |
108
+ | `system-dark-mode` | `systemDarkMode` | Sets the appearance to `system`. |
109
+ | `enable-theme-builder` | `enableThemeBuilder` | Shows the theme builder and the palette's Theme. |
110
+ | `enable-locale-picker` | `enableLocalePicker` | Shows the language button and the palette's Display Language, System by default. |
111
+ | `enable-welcome-screen` | `enableWelcomeScreen` | Shows the welcome screen over an empty, editable diagram. |
112
+
113
+ An attribute is on when present with no value or `"true"`.
136
114
 
137
115
  ### Properties
138
116
 
139
117
  | Property | Description |
140
118
  | --- | --- |
141
- | `value: string` | The document as JSON — an `.erd.json` document ([schema](https://github.com/dineug/erd-editor/blob/main/json-schema/schema.json)). Assigning it loads the document as an edit, so it lands in the undo history; use `setInitialValue` to load without one. Assigning an empty string loads a new document, as `setInitialValue('')` does. |
119
+ | `value: string` | The document as a file saves it ([schema](https://github.com/dineug/erd-editor/blob/main/json-schema/schema.json)). Assigning one, or `''` for a new one, is an undoable load. |
120
+ | `runtimeValue: string` | Read only. The document as this editor holds it, to seed a collaborator. |
142
121
 
143
122
  ### Methods
144
123
 
145
124
  | Method | Description |
146
125
  | --- | --- |
147
- | `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. |
148
- | `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. |
149
- | `setSchemaSQL(value: string)` | Parse a DDL string and **replace** the current document with it. Lands in the undo history; an empty string is ignored. |
150
- | `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. |
151
- | `setSchemaDBML(value: string)` | Parse a DBML string and **replace** the current document with it. Tables, columns, indexes and every `Ref` spelling are read; a `Project`, `TableGroup` or sticky `Note` is skipped, and text it cannot read loads an empty document rather than being refused. Lands in the undo history; an empty string is ignored. |
152
- | `setSchemaAML(value: string)` | Parse an [AML](https://azimutt.app) string and **replace** the current document with it. Entities, attributes, indexes and every relation arrow are read, in the v2 and the legacy v1 spelling; a check, a struct type and a view are skipped, and text it cannot read loads an empty document rather than being refused. Lands in the undo history; an empty string is ignored. |
153
- | `setDiffValue(value: string)` | Open the diff viewer against another document. |
154
- | `setPresetTheme(options)` | Set `appearance`, `grayColor` and `accentColor`. |
155
- | `setTheme(theme)` | Override individual theme tokens. |
156
- | `setKeyBindingMap(map)` | Remap shortcuts, `search` and `findReplace` among them. `edit`, `stop`, `undo`, `redo`, `zoomIn`, `zoomOut` and `zoomReset` are reserved. |
157
- | `getSharedStore(config?)` | Returns `{ subscribe, dispatch, dispatchSync, connection, disconnect, destroy }`. `subscribe` gives you this editor's actions to relay; `dispatch` applies a peer's. You supply the transport. `config` is `{ getNickname?, mouseTracker?, focusTracker? }`; both trackers default to `true` and broadcast this editor's cursor and table focus to peers. |
158
- | `focus()` / `blur()` | Move focus in and out of the editor. |
159
- | `clear()` | Empty the document. Its settings stay, the save switches included, so a cleared file keeps saving what it saved. |
160
- | `destroy()` | Tear the editor down and release its listeners, subscriptions and shared stores. |
126
+ | `setInitialValue(value)` | Load a document with no undo entry; `''` starts a new one. |
127
+ | `getSchemaSQL(vendor?, options?)` | DDL for one of the eight databases, by default the document's. `options`: `statements` (`create`, `ifNotExists`, `recreate`), `header` (`none`, `use`, `createAndUse`). |
128
+ | `setSchemaSQL(value, options?)`, `setSchemaGraphQL`, `setSchemaDBML`, `setSchemaAML` | Replace the document with parsed DDL, GraphQL SDL, DBML or AML, or append it ([Importing a schema](#importing-a-schema)). |
129
+ | `setSchemaJSON(value, options?)` | Load an `.erd.json` document as `value` does, or append it. |
130
+ | `setDiffValue(value)` | Diff another document over the ERD tab. |
131
+ | `setPresetTheme(options)` | Set `appearance` (`light`, `dark`, `system`), `grayColor` and `accentColor`. |
132
+ | `setSystemAppearance(appearance)` | Name the light or dark `system` shows; `null` follows the OS. |
133
+ | `setLocale(locale)` | Set the display language, `'system'` or a [code](#display-language). |
134
+ | `setSystemLocale(tag)` | Name the BCP 47 language `system` shows; `null` reads `navigator.languages`. |
135
+ | `setTheme(theme)` | Override theme tokens; each call replaces the earlier overrides. |
136
+ | `setKeyBindingMap(map)` | Remap [shortcuts](#key-bindings) but `edit`, `stop`, `undo`, `redo` and the zoom keys. |
137
+ | `getSharedStore(config?)` | A [shared store](#collaboration) for collaboration. |
138
+ | `focus()` / `blur()` | Move focus in or out. |
139
+ | `clear()` | Empty the document and keep its settings, in one undo step. |
140
+ | `destroy()` | Release the editor's listeners, subscriptions and shared stores. |
161
141
 
162
142
  ### Events
163
143
 
164
144
  | Event | Description |
165
145
  | --- | --- |
166
- | `change` | The document changed. Debounced, and never fired while `readonly`. Read `editor.value`. A scroll or a zoom fires it too. A scroll leaves `value` as it was with Save Scroll Information off; a zoom moves the scroll position too, so it leaves `value` as it was only with Save Zoom Information and Save Scroll Information both off. `value` differs from a file another release or machine wrote from the load on, so a host that writes files tells an edit from such a change by a [headless replica](#headless-replica)'s `changed`, not by comparing bytes with the file. |
167
- | `changePresetTheme` | The theme was changed from inside the editor. `event.detail` carries the new options. |
146
+ | `change` | The document changed; read `editor.value`. |
147
+ | `changePresetTheme` | The theme changed in the editor; `event.detail` holds the options. |
148
+ | `changeLocale` | A language was picked in the editor; `event.detail.locale` holds it. |
168
149
 
169
- ## Key bindings
150
+ ### Loading and saving
170
151
 
171
- `createKeyBindingMap()` returns the shortcuts an editor listens for until `setKeyBindingMap`
172
- changes them, as a new map on every call. Each is a [tinykeys](https://github.com/jamiebuilds/tinykeys)
173
- chord that names its key by `KeyboardEvent.code`, where `$mod` is Cmd on macOS and Ctrl elsewhere.
152
+ - Save `value`. `runtimeValue` also keeps removed entities and only seeds a
153
+ [collaborator](#collaboration).
154
+ - `change` fires 200 ms after the last change, never under `readonly`, and never for scroll, zoom,
155
+ the open tab or the code settings while the document locks them, which a new document does.
156
+ - A file written by hand or by another release can differ from `value` once loaded, so detect edits
157
+ with a [replica](#headless-replica)'s `changed`, not by comparing bytes.
158
+
159
+ ### Importing a schema
160
+
161
+ - The four text `setSchema*` methods take `{ placement?: 'auto' | 'grid', mode?: 'replace' | 'append' }`,
162
+ and `setSchemaJSON` only `mode`. Each lands in one undo step and ignores `''`.
163
+ - `'grid'`, the default, lands at once in rows. `'auto'` lays the tables out as the Import menu does
164
+ and returns a `Promise` that resolves when they land; a later load supersedes it.
165
+ - `mode: 'append'` adds the tables below the diagram, as Import and Add does.
166
+
167
+ ### Theme and language
168
+
169
+ The element starts dark and English and stores neither choice: `setPresetTheme` and `setLocale`
170
+ set them, and your host keeps what `changePresetTheme` and `changeLocale` report.
171
+
172
+ ## Collaboration
173
+
174
+ A joiner starts from the first editor's `runtimeValue`, then each relays its actions:
174
175
 
175
176
  ```js
176
- import { createKeyBindingMap } from '@dineug/erd-editor';
177
+ joiner.setInitialValue(editor.runtimeValue);
177
178
 
178
- const shortcuts = Object.values(createKeyBindingMap())
179
- .flat()
180
- .map(({ shortcut }) => shortcut); // '$mod+KeyK', 'Alt+Enter', ...
179
+ const local = editor.getSharedStore();
180
+ const remote = joiner.getSharedStore();
181
+ local.subscribe(actions => remote.dispatch(actions));
182
+ remote.subscribe(actions => local.dispatch(actions));
181
183
  ```
182
184
 
183
- The editor listens on its own element, so a host that takes keys before the page does, with
184
- global hotkeys or a capture-phase `keydown` listener, has to let these through while the editor
185
- is focused. The `KeyBindingMap`, `KeyBindingName` and `ShortcutOption` types come with it.
185
+ An editor never forwards what it received, so with three or more, send each one's batches to every
186
+ other. Call `flushStreamBuffers()` before destroying a store, or the last drags and resizes never
187
+ reach the peers. `getSharedStore({ getNickname, mouseTracker, focusTracker })` also shares cursors
188
+ and focus.
186
189
 
187
- The page's own find is among them: while the editor is focused, on any of its tabs, `$mod+KeyF`
188
- opens its Find and Replace, bringing the ERD tab up, and is prevented, so the browser opens no find
189
- bar; while the diff viewer, time travel or the automatic placement preview covers the ERD tab, the
190
- press goes on to the page. `setKeyBindingMap({ findReplace: [] })` leaves it to the page on every
191
- tab, and the toolbar button, the quick search and the context menu still open Find and Replace.
190
+ ## Key bindings
192
191
 
193
- ## Syntax highlighting
192
+ `createKeyBindingMap()` returns the default shortcuts, and `setKeyBindingMap` replaces each list it
193
+ names. A chord is modifiers (`Shift`, `Alt`, `Control`, `Meta`, or `$mod` for Cmd on macOS and Ctrl
194
+ elsewhere) joined by `+` with a `KeyboardEvent.code` or `key`; a space separates the chords of a
195
+ sequence, such as `KeyT KeyG`. Several defaults, search and find and replace among them, stop the
196
+ keydown, so to leave `$mod+KeyF` to the page, call `setKeyBindingMap({ findReplace: [] })`.
194
197
 
195
- The SQL and code-generation panels are highlighted by [Shiki](https://shiki.style), in a shared
196
- worker of its own. There is nothing to install or register: the worker is built the first time a
197
- code panel renders, so a page that opens none never fetches the grammars.
198
+ ## Display language
198
199
 
199
- | | |
200
- | --- | --- |
201
- | Languages | SQL, TypeScript, GraphQL, C#, Java, Kotlin, Scala, Go, Python |
202
- | Themes | `github-dark`, `github-light`, picked from the editor's light / dark appearance |
200
+ `en`, `ar-SA`, `de-DE`, `es-ES`, `eu-ES`, `fa-IR`, `fr-FR`, `he-IL`, `id-ID`, `it-IT`, `ja-JP`,
201
+ `ko-KR`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sl-SI`, `sv-SE`, `tr-TR`,
202
+ `uk-UA`, `zh-CN` and `zh-TW`. Arabic, Hebrew and Persian lay the editor out right to left. The
203
+ `LocaleCode` and `LocaleOption` types are exported.
203
204
 
204
- Those are exactly the languages the panels emit — the JPA generator emits Java, the SQLAlchemy
205
- generator emits Python, the TypeORM, Sequelize and Drizzle generators emit TypeScript, and the
206
- DBML and AML generators are highlighted as SQL, the closest grammar shiki ships.
205
+ ## Workers
207
206
 
208
- Where `SharedWorker` is missing — Chrome on Android, Safari before 16.4 — the underlying error is
209
- logged and the panels render as plain text; nothing else is affected. The regex engine is plain
210
- JavaScript, so no host CSP needs `wasm-unsafe-eval`.
207
+ [Shiki](https://shiki.style) highlights the code panels with a JavaScript regex engine, so a CSP
208
+ needs no `wasm-unsafe-eval`. Without `SharedWorker`, as in Chrome on Android before Chrome 148, the
209
+ code panels show plain text, the Flow view and the Flow and tree layouts place nothing, an `'auto'`
210
+ import lands in rows, and PNG and SVG exports draw on the main thread.
211
211
 
212
212
  ## File dialogs
213
213
 
214
- Import and export go through injectable callbacks, so a host without a browser file dialog —
215
- an IDE webview, for example — can supply its own. The two are not symmetric: export hands you
216
- the finished file, while import only asks for one, and you push the content back in yourself.
214
+ Import and export go through page-wide callbacks, so a host without a browser file dialog, such as
215
+ an IDE webview, supplies its own:
217
216
 
218
217
  ```js
219
218
  import { setExportFileCallback, setImportFileCallback } from '@dineug/erd-editor';
220
219
 
221
220
  setExportFileCallback((blob, { fileName }) => host.writeFile(fileName, blob));
222
221
 
223
- setImportFileCallback(async ({ type, op, accept }) => {
222
+ setImportFileCallback(async ({ type, op, accept, mode }) => {
224
223
  const text = await host.pickFile(accept);
225
-
226
- if (op === 'diff') {
227
- editor.setDiffValue(text);
228
- } else if (type === 'json') {
229
- editor.value = text;
230
- } else if (type === 'sql') {
231
- editor.setSchemaSQL(text);
232
- } else if (type === 'graphql') {
233
- editor.setSchemaGraphQL(text);
234
- } else if (type === 'dbml') {
235
- editor.setSchemaDBML(text);
236
- } else if (type === 'aml') {
237
- editor.setSchemaAML(text);
238
- }
224
+ if (op === 'diff') return editor.setDiffValue(text);
225
+ if (type === 'json') return editor.setSchemaJSON(text, { mode });
226
+ const format = { sql: 'SQL', graphql: 'GraphQL', dbml: 'DBML', aml: 'AML' }[type];
227
+ if (format) editor[`setSchema${format}`](text, { placement: 'auto', mode });
239
228
  });
240
229
  ```
241
230
 
242
- Dispatch on every `type` you handle and ignore the rest. Assigning `value` clears the
243
- document before it parses, so routing a payload there that is not an `.erd.json` document —
244
- through a catch-all `else`, or because a `type` added later fell through — empties the
245
- diagram instead of importing anything. `accept` carries the extensions for that type
246
- (`.json`, `.sql`, or `.graphql,.gql,.graphqls`), ready to hand to a host file dialog.
247
-
248
- Left unset, the editor uses the browser's own download and file-picker behavior.
231
+ Skip a `type` you do not handle: a replacing `setSchemaJSON()` empties the document on any other
232
+ payload. Unset or `null`, the browser's download and file picker work.
249
233
 
250
234
  ## Headless replica
251
235
 
252
- A second entry point runs the document store with no DOM, for hosts that need to apply an
253
- action stream and serialize the result off the main thread:
236
+ `engine.js` applies the same actions with no DOM, so a worker can keep and serialize the document:
254
237
 
255
238
  ```js
256
239
  import { createReplicationStore } from '@dineug/erd-editor/engine.js';
257
240
 
258
- // `toWidth` measures text for layout — a worker has no DOM, so you supply it
259
- const store = createReplicationStore({ toWidth });
260
-
241
+ const store = createReplicationStore({ toWidth }); // a worker has no DOM to measure text
261
242
  store.setInitialValue(savedJson);
262
243
  store.on({ change: ({ value, changed }) => changed && persist(value) });
263
- store.dispatch(actions); // actions relayed from a live editor's shared store
244
+ store.dispatch(actions);
264
245
  ```
265
246
 
266
- `change` comes 200 ms after the last action that can change the document. `changed` is false
267
- when those actions left `value` as it was, such as a scroll with Save Scroll Information off, or a
268
- zoom with Save Zoom Information and Save Scroll Information both off: a zoom moves the scroll
269
- position too, so with only the scroll saved it changes `value`. It compares with the value the
270
- store last reported, or loaded, never with your file: a file another release or machine wrote
271
- serializes differently from the start.
247
+ `changed` is false when `value` matches what the store last reported or loaded.
272
248
 
273
- ## Development
249
+ `peer.js` runs a collaboration peer with no DOM: `createPeerStore({ nickname })` dispatches actions,
250
+ receives a peer's batches and undoes its own. The
251
+ [ERD Editor MCP server](https://github.com/dineug/erd-editor/tree/main/packages/mcp-server#readme)
252
+ is built on it.
274
253
 
275
- This package is the editor core of the [erd-editor monorepo](https://github.com/dineug/erd-editor);
276
- work on it from a workspace checkout.
254
+ ## Development
277
255
 
278
256
  ```sh
279
- pnpm --filter @dineug/erd-editor dev # builds workspace deps, then a dev server
257
+ pnpm --filter @dineug/erd-editor dev # dev server, workspace deps built first
280
258
  pnpm --filter @dineug/erd-editor dev:storybook # component playground
281
259
  pnpm exec vp run --filter @dineug/erd-editor --fail-if-no-match test
282
260
  pnpm --filter @dineug/erd-editor e2e # Playwright
283
261
  ```
284
262
 
263
+ What a change runs and carries is in
264
+ [AGENTS.md](https://github.com/dineug/erd-editor/blob/main/packages/erd-editor/AGENTS.md).
265
+
285
266
  ## Documentation
286
267
 
268
+ - [Editing Guide](https://docs.erd-editor.io/docs/category/guides) — every editor feature
269
+ - [Element API](https://docs.erd-editor.io/docs/api/erd-editor-element) — the `<erd-editor>`
270
+ element in full
287
271
  - [Documentation](https://docs.erd-editor.io)
288
- - [Editing Guide](https://docs.erd-editor.io/docs/category/guides)
289
- - [Element API](https://docs.erd-editor.io/docs/api/erd-editor-element)
290
272
 
291
273
  ## Issues
292
274
 
@@ -15,6 +15,10 @@ export type AppContext = EngineContext & {
15
15
  }>;
16
16
  keydown$: Subject<KeyboardEvent>;
17
17
  emitter: Emitter;
18
+ /** Set once appDestroy has run, so a render it sets off knows nothing is left to read. */
19
+ lifecycle: {
20
+ destroyed: boolean;
21
+ };
18
22
  };
19
23
  export type InjectAppContext = InjectEngineContext;
20
24
  export type AppContextOptions = RxStoreOptions & {
@@ -3,6 +3,9 @@ export type ErdProps = {
3
3
  isDarkMode: boolean;
4
4
  mouseTracking: boolean;
5
5
  readonly: boolean;
6
+ enableWelcomeScreen?: boolean;
7
+ enableThemeBuilder?: boolean;
8
+ enableLocalePicker?: boolean;
6
9
  };
7
10
  declare const Erd: FC<ErdProps>;
8
11
  export default Erd;
@@ -1,5 +1,6 @@
1
1
  import { FC, Ref } from '@dineug/r-html';
2
2
  import { AppContext } from '../../appContext';
3
+ import { I18n } from '../../../i18n/translate';
3
4
  export type AutomaticTablePlacementProps = {
4
5
  app: Ref<AppContext>;
5
6
  onChange: (tables: TablePoint[]) => void;
@@ -13,7 +14,7 @@ export type TablePoint = {
13
14
  export type PlacementToastState = {
14
15
  progress: number;
15
16
  };
16
- export declare function placementDescription({ progress, }: PlacementToastState): string;
17
+ export declare function placementDescription({ progress }: PlacementToastState, i18n?: I18n): string;
17
18
  declare const AutomaticTablePlacement: FC<AutomaticTablePlacementProps>;
18
19
  export default AutomaticTablePlacement;
19
20
  //# sourceMappingURL=AutomaticTablePlacement.d.ts.map
@@ -1,12 +1,43 @@
1
1
  import { RootState } from '../../../engine/state';
2
- import { Table } from '../../../internal-types';
3
- type Node = {
2
+ import { Table, TableGroup } from '../../../internal-types';
3
+ /** A table in no group, put at the node less its radius, as it always was. */
4
+ type TableNode = {
4
5
  id: string;
5
6
  r: number;
6
7
  x: number;
7
8
  y: number;
9
+ vx: number;
10
+ vy: number;
8
11
  ref: Table;
12
+ width: number;
13
+ height: number;
9
14
  };
15
+ /** A member, and where it stands from the corner of its group's box. */
16
+ type Member = {
17
+ ref: Table;
18
+ dx: number;
19
+ dy: number;
20
+ };
21
+ /**
22
+ * A group with members, moved as one box centred on the node: the members keep
23
+ * where they stand inside it, and the box, their bounds and the padding, is
24
+ * the rect the group is drawn at, so a preview shows the group where it goes.
25
+ */
26
+ type GroupNode = {
27
+ id: string;
28
+ r: number;
29
+ x: number;
30
+ y: number;
31
+ vx: number;
32
+ vy: number;
33
+ group: TableGroup;
34
+ width: number;
35
+ height: number;
36
+ members: Member[];
37
+ };
38
+ type Node = TableNode | GroupNode;
39
+ /** The least room a group's box keeps from another group's box or a table. */
40
+ export declare const GROUP_BOX_GAP = 100;
10
41
  /** The two readings of a simulation's heat that its progress is taken from. */
11
42
  type Cooling = {
12
43
  alpha(): number;
@@ -23,6 +54,11 @@ type Cooling = {
23
54
  * });
24
55
  */
25
56
  export declare function placementProgress(simulation: Cooling): number;
57
+ /**
58
+ * The force simulation that places the tables, around the middle of what the
59
+ * document draws. A group with members is one box in it, its members kept
60
+ * inside and the box kept clear of the others, so it is drawn where it goes.
61
+ */
26
62
  export declare function createAutomaticTablePlacement(state: RootState): import('d3-force').Simulation<Node, undefined>;
27
63
  export {};
28
64
  //# sourceMappingURL=createAutomaticTablePlacement.d.ts.map
@@ -0,0 +1,42 @@
1
+ import { FC } from '@dineug/r-html';
2
+ import { AppContext } from '../../appContext';
3
+ import { ElkLayoutPoint, ElkLayoutRequest } 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>;
13
+ /** How a layout ended: placed, given up on by whoever waited, or never answered. */
14
+ export type ElkLayoutAnswer = {
15
+ status: 'placed';
16
+ points: ElkLayoutPoint[];
17
+ } | {
18
+ status: 'cancelled';
19
+ } | {
20
+ status: 'failed';
21
+ error: unknown;
22
+ };
23
+ export type LayoutByElkOptions = {
24
+ /**
25
+ * Whether the toast waits until the layout has run long enough to say so,
26
+ * for a placement nobody asked to watch, rather than going up at once.
27
+ */
28
+ whenSlow?: boolean;
29
+ /** Ends the wait from outside, as Cancel does, and takes the toast down. */
30
+ signal?: AbortSignal;
31
+ };
32
+ /**
33
+ * One ELK layout behind the Placing toast, reading nothing but the request and
34
+ * the app context, so the document and a document not loaded yet are placed
35
+ * alike. Cancel and the stop key end the wait at once, the toast with it.
36
+ *
37
+ * @example
38
+ * const answer = await layoutByElk(app, request, { whenSlow: true });
39
+ */
40
+ export declare function layoutByElk({ emitter, shortcut$ }: AppContext, request: ElkLayoutRequest, { whenSlow, signal }?: LayoutByElkOptions): Promise<ElkLayoutAnswer>;
41
+ export {};
42
+ //# sourceMappingURL=elkPlacement.d.ts.map
@@ -0,0 +1,21 @@
1
+ import { AppContext } from '../../appContext';
2
+ import { ElkLayoutPoint, ElkLayoutRequest } from '../../../services/elk-layout';
3
+ /**
4
+ * What a Flow placement of a document asks ELK, measured on a plain store of
5
+ * its own with the editor's text measure, so nothing reaches the editor's
6
+ * store. Null under two tables or with no relationship, the grid's cases.
7
+ *
8
+ * @example
9
+ * const request = createFlowRequest(app, json);
10
+ */
11
+ export declare function createFlowRequest({ toWidth }: AppContext, json: string): ElkLayoutRequest | null;
12
+ /**
13
+ * Where each table of a document not loaded yet goes by Flow, measured from
14
+ * the corner of the block the tables make, so the caller decides where that
15
+ * block stands. Null leaves the tables to the grid, and says nothing of why.
16
+ *
17
+ * @example
18
+ * const points = await placeByFlow(app, json, controller.signal);
19
+ */
20
+ export declare function placeByFlow(app: AppContext, json: string, signal?: AbortSignal): Promise<ElkLayoutPoint[] | null>;
21
+ //# sourceMappingURL=flowPlacement.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { AnyAction } from '@dineug/r-html';
2
+ import { RootState } from '../../../engine/state';
3
+ import { TableMove } from '../../../konva/scene/contentBounds';
4
+ import { GeometrySource } from '../../../utils/draw-relationship/geometrySource';
5
+ /**
6
+ * What a placement lands as: each table at its point, each group with members
7
+ * at the rect round where they land, and the view centred on the box all of it
8
+ * fills, read before the move. Dispatched together, they are one undo entry.
9
+ *
10
+ * @example
11
+ * store.dispatch(toPlacementActions(store.state, points));
12
+ */
13
+ export declare function toPlacementActions(state: RootState, tables: ReadonlyArray<TableMove>, source?: GeometrySource): AnyAction[];
14
+ //# sourceMappingURL=placementActions.d.ts.map