@dineug/erd-editor 4.0.0 → 4.2.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 (234) hide show
  1. package/README.md +106 -280
  2. package/dist/components/dictionary/Dictionary.d.ts +12 -0
  3. package/dist/components/dictionary/Dictionary.styles.d.ts +33 -0
  4. package/dist/components/dictionary/checkCount.d.ts +28 -0
  5. package/dist/components/dictionary/checkSheet.d.ts +41 -0
  6. package/dist/components/dictionary/dictionary-context-menu/DictionaryContextMenu.d.ts +30 -0
  7. package/dist/components/dictionary/dictionaryCommit.d.ts +83 -0
  8. package/dist/components/dictionary/dictionaryFile.d.ts +23 -0
  9. package/dist/components/dictionary/dictionaryKeys.d.ts +48 -0
  10. package/dist/components/dictionary/dictionaryView.d.ts +65 -0
  11. package/dist/components/dictionary/domain-cell-editor/DomainCellEditor.d.ts +22 -0
  12. package/dist/components/dictionary/domain-cell-editor/DomainCellEditor.styles.d.ts +7 -0
  13. package/dist/components/dictionary/domain-cell-editor/openDomainCellEditor.d.ts +9 -0
  14. package/dist/components/dictionary/gridTheme.d.ts +18 -0
  15. package/dist/components/dictionary/sheets.d.ts +65 -0
  16. package/dist/components/erd/automatic-table-placement/flowPlacement.d.ts +4 -4
  17. package/dist/components/erd/canvas/DiffOutline.template.d.ts +14 -0
  18. package/dist/components/erd/canvas/EditOverlay.styles.d.ts +6 -0
  19. package/dist/components/erd/canvas/sceneHit.d.ts +5 -0
  20. package/dist/components/erd/canvas/sceneTokens.d.ts +8 -0
  21. package/dist/components/erd/canvas/table/Table.d.ts +6 -0
  22. package/dist/components/erd/canvas/table/blankLogicalName.d.ts +19 -0
  23. package/dist/components/erd/canvas/table/cellLayout.d.ts +4 -4
  24. package/dist/components/erd/canvas/table/column/Column.d.ts +32 -5
  25. package/dist/components/erd/canvas/table/dictionaryMarks.d.ts +29 -0
  26. package/dist/components/erd/canvas/table/useFocusTable.d.ts +1 -0
  27. package/dist/components/erd/diff-viewer/diff-tree/DiffTree.d.ts +19 -0
  28. package/dist/components/erd/diff-viewer/diff-tree/DiffTree.styles.d.ts +13 -0
  29. package/dist/components/erd/diff-viewer/diff-tree/diffTreeModel.d.ts +52 -0
  30. package/dist/components/erd/diff-viewer/diff.d.ts +21 -19
  31. package/dist/components/erd/draw-target/placePill.d.ts +1 -3
  32. package/dist/components/erd/erd-context-menu/menus/nameViewMenus.d.ts +22 -0
  33. package/dist/components/erd/floating-toolbar/FloatingToolbar.d.ts +7 -4
  34. package/dist/components/erd/floating-toolbar/nameViewDropdown.d.ts +16 -0
  35. package/dist/components/erd/floating-toolbar/nameViewDropdown.styles.d.ts +5 -0
  36. package/dist/components/erd/goToErdTarget.d.ts +40 -16
  37. package/dist/components/erd/readerNameView.d.ts +15 -0
  38. package/dist/components/erd/relationshipHighlight.d.ts +18 -0
  39. package/dist/components/erd/welcome-screen/welcome-hints/WelcomeHints.styles.d.ts +5 -0
  40. package/dist/components/erd/welcome-screen/welcomeLayout.d.ts +7 -3
  41. package/dist/components/erd-editor/ErdEditor.styles.d.ts +4 -0
  42. package/dist/components/erd-editor/viewportLayout.d.ts +52 -0
  43. package/dist/components/explorer/Explorer.d.ts +12 -0
  44. package/dist/components/explorer/explorer-controller/ExplorerController.d.ts +11 -0
  45. package/dist/components/explorer/explorer-panel/ExplorerPanel.d.ts +14 -0
  46. package/dist/components/explorer/explorer-panel/ExplorerPanel.styles.d.ts +13 -0
  47. package/dist/components/explorer/explorer-search/ExplorerSearch.d.ts +12 -0
  48. package/dist/components/explorer/explorer-search/ExplorerSearch.styles.d.ts +13 -0
  49. package/dist/components/explorer/explorerCommands.d.ts +28 -0
  50. package/dist/components/explorer/explorerNavigation.d.ts +14 -0
  51. package/dist/components/explorer/explorerSearch.d.ts +71 -0
  52. package/dist/components/explorer/explorerTree.d.ts +93 -0
  53. package/dist/components/explorer/explorerView.d.ts +54 -0
  54. package/dist/components/{find-replace → explorer}/fieldIcon.d.ts +4 -1
  55. package/dist/components/{find-replace → explorer}/matchTarget.d.ts +7 -9
  56. package/dist/components/export-image/ExportImage.d.ts +10 -0
  57. package/dist/components/export-image/exportImageActions.d.ts +2 -2
  58. package/dist/components/flowCenters.d.ts +9 -0
  59. package/dist/components/map-columns/nameOf.d.ts +11 -3
  60. package/dist/components/primitives/icon/icons.d.ts +13 -4
  61. package/dist/components/primitives/sash/Sash.d.ts +1 -0
  62. package/dist/components/primitives/tree/Tree.d.ts +30 -0
  63. package/dist/components/primitives/tree/Tree.styles.d.ts +5 -0
  64. package/dist/components/primitives/tree/treeModel.d.ts +42 -0
  65. package/dist/components/quick-search/QuickSearch.styles.d.ts +1 -0
  66. package/dist/components/quick-search/actions.d.ts +3 -4
  67. package/dist/components/quick-search/paletteList.d.ts +7 -0
  68. package/dist/components/quick-search/scopedActions.d.ts +5 -11
  69. package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.d.ts +2 -2
  70. package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.styles.d.ts +2 -0
  71. package/dist/components/schema-sql/schemaSQLView.d.ts +2 -0
  72. package/dist/components/settings/lockSettingRows.d.ts +2 -1
  73. package/dist/components/table-view/column/column-domain/ColumnDomain.d.ts +19 -0
  74. package/dist/components/table-view/column/column-domain/domainOptions.d.ts +13 -0
  75. package/dist/components/table-view/column/column-logical-name/ColumnLogicalName.d.ts +22 -0
  76. package/dist/components/table-view/column/column-logical-name/ColumnLogicalName.styles.d.ts +4 -0
  77. package/dist/components/table-view/column/columnViewText.d.ts +33 -0
  78. package/dist/components/table-view/column/useHintList.d.ts +24 -0
  79. package/dist/components/theme-builder/ThemeBuilder.styles.d.ts +3 -3
  80. package/dist/components/toolbar/Toolbar.styles.d.ts +0 -1
  81. package/dist/components/visualization/createVisualization.d.ts +2 -0
  82. package/dist/components/visualization/flowLayout.d.ts +2 -1
  83. package/dist/components/visualization/table/column/Column.d.ts +4 -0
  84. package/dist/components/visualization/visualization-toolbar/VisualizationToolbar.d.ts +2 -2
  85. package/dist/components/visualization/visualizationView.d.ts +15 -4
  86. package/dist/constants/layout.d.ts +18 -1
  87. package/dist/constants/open.d.ts +0 -1
  88. package/dist/constants/schema.d.ts +15 -2
  89. package/dist/engine/actions.d.ts +5 -2
  90. package/dist/engine/history.actions.d.ts +8 -0
  91. package/dist/engine/history.d.ts +11 -3
  92. package/dist/engine/index.js +17 -17
  93. package/dist/engine/modules/dictionary/actions.d.ts +74 -0
  94. package/dist/engine/modules/dictionary/atom.actions.d.ts +74 -0
  95. package/dist/engine/modules/dictionary/checks.d.ts +76 -0
  96. package/dist/engine/modules/dictionary/derive.d.ts +54 -0
  97. package/dist/engine/modules/dictionary/derivedNames.d.ts +23 -0
  98. package/dist/engine/modules/dictionary/dictionaryIndex.d.ts +73 -0
  99. package/dist/engine/modules/dictionary/domainLinks.d.ts +9 -0
  100. package/dist/engine/modules/dictionary/domainTypes.d.ts +27 -0
  101. package/dist/engine/modules/dictionary/entryWrites.d.ts +63 -0
  102. package/dist/engine/modules/dictionary/generator.actions.d.ts +126 -0
  103. package/dist/engine/modules/dictionary/history.d.ts +14 -0
  104. package/dist/engine/modules/dictionary/membership.d.ts +28 -0
  105. package/dist/engine/modules/dictionary/orderKeys.d.ts +13 -0
  106. package/dist/engine/modules/dictionary/termIndex.d.ts +24 -0
  107. package/dist/engine/modules/editor/actions.d.ts +18 -3
  108. package/dist/engine/modules/editor/atom.actions.d.ts +24 -6
  109. package/dist/engine/modules/editor/generator.actions.d.ts +22 -8
  110. package/dist/engine/modules/editor/state.d.ts +24 -0
  111. package/dist/engine/modules/editor/utils/nameView.d.ts +103 -0
  112. package/dist/engine/modules/editor/view.actions.d.ts +24 -1
  113. package/dist/engine/modules/editor/view.d.ts +8 -0
  114. package/dist/engine/modules/relationship/fkColumns.d.ts +10 -4
  115. package/dist/engine/modules/settings/actions.d.ts +13 -3
  116. package/dist/engine/modules/settings/atom.actions.d.ts +49 -5
  117. package/dist/engine/modules/settings/generator.actions.d.ts +2 -2
  118. package/dist/engine/modules/table/actions.d.ts +7 -0
  119. package/dist/engine/modules/table/atom.actions.d.ts +46 -0
  120. package/dist/engine/modules/table/generator.actions.d.ts +7 -0
  121. package/dist/engine/modules/table/history.d.ts +2 -0
  122. package/dist/engine/modules/table-column/actions.d.ts +7 -0
  123. package/dist/engine/modules/table-column/atom.actions.d.ts +49 -0
  124. package/dist/engine/modules/table-column/generator.actions.d.ts +5 -0
  125. package/dist/engine/modules/table-column/history.d.ts +3 -0
  126. package/dist/engine/modules/table-column/utils/dataType.d.ts +3 -1
  127. package/dist/engine/rx-store.d.ts +6 -0
  128. package/dist/engine/tag.d.ts +8 -0
  129. package/dist/erd-editor.umd.js +1586 -1018
  130. package/dist/i18n/messages/ar-SA.d.ts +166 -15
  131. package/dist/i18n/messages/de-DE.d.ts +134 -11
  132. package/dist/i18n/messages/en/code.d.ts +0 -1
  133. package/dist/i18n/messages/en/common.d.ts +11 -1
  134. package/dist/i18n/messages/en/contextMenu.d.ts +1 -0
  135. package/dist/i18n/messages/en/dictionary.d.ts +79 -0
  136. package/dist/i18n/messages/en/explorer.d.ts +37 -0
  137. package/dist/i18n/messages/en/findReplace.d.ts +7 -1
  138. package/dist/i18n/messages/en/index.d.ts +135 -12
  139. package/dist/i18n/messages/en/palette.d.ts +5 -7
  140. package/dist/i18n/messages/en/schemaSql.d.ts +1 -0
  141. package/dist/i18n/messages/en/settings.d.ts +1 -0
  142. package/dist/i18n/messages/en/shortcuts.d.ts +3 -1
  143. package/dist/i18n/messages/en/toolbar.d.ts +0 -1
  144. package/dist/i18n/messages/en/visualization.d.ts +2 -0
  145. package/dist/i18n/messages/es-ES.d.ts +142 -12
  146. package/dist/i18n/messages/eu-ES.d.ts +134 -11
  147. package/dist/i18n/messages/fa-IR.d.ts +134 -11
  148. package/dist/i18n/messages/fr-FR.d.ts +142 -12
  149. package/dist/i18n/messages/he-IL.d.ts +142 -12
  150. package/dist/i18n/messages/id-ID.d.ts +126 -10
  151. package/dist/i18n/messages/it-IT.d.ts +142 -12
  152. package/dist/i18n/messages/ja-JP.d.ts +126 -10
  153. package/dist/i18n/messages/ko-KR.d.ts +126 -10
  154. package/dist/i18n/messages/nl-NL.d.ts +134 -11
  155. package/dist/i18n/messages/pl-PL.d.ts +150 -13
  156. package/dist/i18n/messages/pt-BR.d.ts +142 -12
  157. package/dist/i18n/messages/pt-PT.d.ts +142 -12
  158. package/dist/i18n/messages/ro-RO.d.ts +142 -12
  159. package/dist/i18n/messages/ru-RU.d.ts +150 -13
  160. package/dist/i18n/messages/sk-SK.d.ts +150 -13
  161. package/dist/i18n/messages/sl-SI.d.ts +150 -13
  162. package/dist/i18n/messages/sv-SE.d.ts +134 -11
  163. package/dist/i18n/messages/tr-TR.d.ts +134 -11
  164. package/dist/i18n/messages/uk-UA.d.ts +150 -13
  165. package/dist/i18n/messages/zh-CN.d.ts +126 -10
  166. package/dist/i18n/messages/zh-TW.d.ts +126 -10
  167. package/dist/index.d.ts +1 -0
  168. package/dist/index.js +34929 -25093
  169. package/dist/internal-types/index.d.ts +6 -0
  170. package/dist/konva/scene/columnDropTarget.d.ts +2 -2
  171. package/dist/loadValue-B5ojYrZ-.js +14682 -0
  172. package/dist/peer/index.d.ts +4 -0
  173. package/dist/peer/index.js +60 -59
  174. package/dist/services/export-png/ExportScene.d.ts +1 -1
  175. package/dist/services/export-png/documentScene.d.ts +7 -1
  176. package/dist/services/export-png/index.d.ts +11 -5
  177. package/dist/services/export-png/renderPng.d.ts +4 -1
  178. package/dist/services/export-png/renderSvg.d.ts +4 -1
  179. package/dist/shared-store-S7YWEz3E.js +1656 -0
  180. package/dist/styles/scrollbar.styles.d.ts +1 -1
  181. package/dist/themes/tokens.d.ts +21 -4
  182. package/dist/utils/calcTable.d.ts +20 -4
  183. package/dist/utils/collection/domain.entity.d.ts +3 -0
  184. package/dist/utils/collection/term.entity.d.ts +3 -0
  185. package/dist/utils/collection/word.entity.d.ts +3 -0
  186. package/dist/utils/dictionary-csv/csv.d.ts +13 -0
  187. package/dist/utils/dictionary-csv/decode.d.ts +7 -0
  188. package/dist/utils/dictionary-csv/dictionaryCsv.d.ts +55 -0
  189. package/dist/utils/dictionary-csv/index.d.ts +4 -0
  190. package/dist/utils/diff/compareEntities.d.ts +39 -0
  191. package/dist/utils/diff/diffDocuments.d.ts +12 -0
  192. package/dist/utils/diff/index.d.ts +5 -0
  193. package/dist/utils/diff/pairEntities.d.ts +41 -0
  194. package/dist/utils/diff/types.d.ts +81 -0
  195. package/dist/utils/emitter.d.ts +2 -8
  196. package/dist/utils/file/exportFile.d.ts +10 -0
  197. package/dist/utils/find-replace/findMatches.d.ts +31 -12
  198. package/dist/utils/find-replace/matcher.d.ts +2 -0
  199. package/dist/utils/find-replace/present.d.ts +4 -3
  200. package/dist/utils/find-replace/preserveCase.d.ts +10 -0
  201. package/dist/utils/find-replace/replaceActions.d.ts +9 -5
  202. package/dist/utils/focus.d.ts +2 -0
  203. package/dist/utils/formatCount.d.ts +10 -0
  204. package/dist/utils/keyboard-shortcut/index.d.ts +11 -3
  205. package/dist/utils/map-columns/alignTypes.d.ts +3 -3
  206. package/dist/utils/schema-sql/Databricks.d.ts +2 -2
  207. package/dist/utils/schema-sql/MSSQL.d.ts +1 -1
  208. package/dist/utils/schema-sql/MariaDB.d.ts +2 -2
  209. package/dist/utils/schema-sql/MySQL.d.ts +2 -2
  210. package/dist/utils/schema-sql/Oracle.d.ts +1 -1
  211. package/dist/utils/schema-sql/PostgreSQL.d.ts +1 -1
  212. package/dist/utils/schema-sql/SQLite.d.ts +2 -2
  213. package/dist/utils/schema-sql/Snowflake.d.ts +2 -2
  214. package/dist/utils/schema-sql/options.d.ts +2 -0
  215. package/dist/utils/schema-sql/utils.d.ts +14 -0
  216. package/dist/utils/table-clipboard/copy.d.ts +2 -3
  217. package/dist/utils/table-clipboard/index.d.ts +9 -1
  218. package/dist/utils/table-clipboard/paste.d.ts +2 -2
  219. package/dist/utils/table-clipboard/payload.d.ts +12 -0
  220. package/dist/utils/takeover.d.ts +6 -0
  221. package/dist/utils/validation.d.ts +1 -0
  222. package/dist/utils/virtualRange.d.ts +15 -0
  223. package/dist/workers/exportPng.shared-worker.js +30 -29
  224. package/package.json +8 -6
  225. package/dist/components/erd/diff-viewer/tree-viewer/TreeViewer.d.ts +0 -12
  226. package/dist/components/erd/diff-viewer/tree-viewer/TreeViewer.styles.d.ts +0 -6
  227. package/dist/components/find-replace/FindReplace.d.ts +0 -13
  228. package/dist/components/find-replace/FindReplace.styles.d.ts +0 -27
  229. package/dist/components/find-replace/panelLayout.d.ts +0 -20
  230. package/dist/konva/batchDraw.d.ts +0 -42
  231. package/dist/konva/host.d.ts +0 -30
  232. package/dist/konva/jsx-types.test-d.d.ts +0 -2
  233. package/dist/loadValue-B3EFSe9k.js +0 -12925
  234. package/dist/shared-store-fUggY7sI.js +0 -1341
package/README.md CHANGED
@@ -4,155 +4,34 @@
4
4
 
5
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 database-schema editor in a single custom element: design tables and
8
- relationships visually, import SQL DDL, GraphQL SDL, DBML or AML, and export DDL or generated code.
9
- It has no framework dependency and renders into a closed shadow root, so it drops into any page —
10
- React, Vue, Svelte, or plain HTML — without leaking styles either way.
11
-
12
- It is the same editor as [erd-editor.io](https://erd-editor.io), the
13
- [Google Drive app](https://workspace.google.com/marketplace/app/erd_editor/428467403360), 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
14
10
  [VS Code extension](https://marketplace.visualstudio.com/items?itemName=dineug.vuerd-vscode), the
15
- [IntelliJ plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor) and the
11
+ [JetBrains plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor) and the
16
12
  [Obsidian plugin](https://community.obsidian.md/plugins/erd-editor).
17
13
 
18
14
  ## Features
19
15
 
20
- ### Design
21
-
22
- - **Visual schema design** — tables, columns, memos, and four relationship cardinalities (Zero One,
23
- Zero N, One Only, One N)
24
- - **Quick edits** — `Alt`+`N` adds a table and `Alt`+`Enter` a column, `Alt`+`K` toggles the primary
25
- key on the focused column, or on every selected column when it is one of them, and `Delete` or
26
- `Backspace` removes the selection, each in one undo step; the Shortcuts page of the editor's
27
- Settings tab lists every key, and `setKeyBindingMap` remaps them
28
- - **Link existing columns** — while you draw a relationship with a mouse or a pen, the buttons
29
- beside the table it ends on either map the parent's key onto columns that table already has or add
30
- new ones, named after the parent table when the key is one word (`user_id` for `user`'s `id`), and
31
- **Map Columns** in a relationship's right-click menu changes its columns later
32
- - **Referential actions** — set **On Delete** and **On Update** (NO ACTION, CASCADE, SET NULL, SET
33
- DEFAULT, RESTRICT) from a relationship's right-click menu, which marks one the current database
34
- leaves out; the line shows them at its child end as `D:C U:R`, and View Option's Referential
35
- Actions hides the labels. SQL, DBML and AML import read them, and the DDL export and the code
36
- generators that have a place for them write the ones the target supports
37
- - **Alternate keys** — View Option's Alternate Key marks the columns of each unique index over two
38
- or more columns as `AK1.1`, `AK1.2`, and SQL import reads a UNIQUE over several columns as one
39
- such index
40
- - **Table groups** — draw a box behind related tables, which you name and can color, with
41
- **New Table Group** in the canvas menu or the command palette, or group the selected tables from
42
- their right-click menu. A table joins a group when you drop it inside and leaves when you drop it
43
- outside, dragging a group by its title moves its tables with it, each member's header takes the
44
- group's color, View Option hides the groups, and DBML import and the Code Generator's DBML carry
45
- them as `TableGroup`s
46
- - **Auto Layout** — place every table again by Force, Flow or a vertical or horizontal tree from the
47
- canvas menu or the command palette, table groups kept together, in one undo step; Force shows a
48
- preview you apply or cancel, and the others land at once
49
- - **Copy, paste and colors** — copy tables and memos and paste them as new ones, into another
50
- diagram too or into a spreadsheet as a grid, hold `Alt` while dragging to duplicate them, and
51
- color a table, memo or table group from its right-click menu
52
- - **Clean diffs** — the scroll position and zoom, the open tab, the code generator's language and
53
- name cases and the bracket type are locked in a new document
54
- ([Loading and saving](#loading-and-saving)), so the file keeps the values they had when locked
55
- and looking around never changes it; the file, written in a fixed order, also leaves out
56
- measured widths, connector anchors and removed items
57
-
58
- ### Import
59
-
60
- - **SQL DDL import** — bring in a `.sql` dump from any of the eight vendors below. The parser reads
61
- `CREATE TABLE`, `CREATE INDEX`, `ALTER TABLE` constraints and table and column comments
62
- (`COMMENT ON`, SQL Server's `sp_addextendedproperty`), and skips what it does not recognize, so an
63
- awkward dump imports partially rather than failing outright
64
- - **GraphQL SDL import** — bring in a schema from any tool that emits SDL. Object types become
65
- tables, scalars map to the diagram's own dialect, and the fields that point at another type become
66
- the relationships; the root types and the wrapper types Relay, Federation and Hasura generate are
67
- left out rather than drawn as tables
68
- - **DBML import** — bring in a `.dbml` file written for dbdiagram.io or dbdocs.io, or emitted by
69
- `sql2dbml` or `prisma-dbml-generator`. Tables, columns, indexes, enums, header colors, every `Ref`
70
- spelling and each `TableGroup` arrive; a `Project` or a sticky `Note` is skipped rather than
71
- refused
72
- - **AML import** — bring in an `.aml` file written for [Azimutt](https://azimutt.app), in either the
73
- v2 or the legacy v1 spelling. Entities, attributes, indexes, enums, colors and every relation
74
- arrow arrive; a check and a struct type are skipped rather than refused, and a view arrives as a
75
- table
76
- - **Imports land laid out** — a schema picked from the Import menu, the command palette or a host's
77
- file dialog arrives with its tables placed by their relationships (in rows when it has none), and
78
- one undo puts the previous diagram back; a `setSchema*` call, as from your own file dialog, is
79
- laid out the same way when given `{ placement: 'auto' }`
80
- - **Import and Add** — the menu beside Import, and its five formats in the command palette, add a
81
- `.sql`, GraphQL, DBML, AML or `.erd.json` file to the diagram instead of replacing it: its tables
82
- arrive below everything already there, laid out the same way (an `.erd.json` file keeps its own
83
- placement), selected, and one undo takes them away. A table whose name is already taken arrives as
84
- a second table rather than merging, and a foreign key to a table outside the file is dropped;
85
- `{ mode: 'append' }` does the same from `setSchemaJSON` and the four `setSchema*` methods, which
86
- lay the tables out only with `placement: 'auto'` and stand them in rows otherwise
87
-
88
- ### Export and code
89
-
90
- - **SQL DDL export** — Databricks, MariaDB, MSSQL, MySQL, Oracle, PostgreSQL, Snowflake and SQLite,
91
- from the Schema SQL tab, which saves the DDL as a `.sql` file or copies it, and from
92
- `getSchemaSQL(vendor?, options?)`
93
- - **Schema SQL options** — a panel beside the DDL picks the database and the bracket type, CREATE
94
- TABLE IF NOT EXISTS or drop and re-create and a `USE` or `CREATE + USE` header, each where the
95
- database has it, and the tables by table group, and keeps SQL of your own to write before and
96
- after the tables. The statements, header and tables stay with this editor until the element goes
97
- and never reach the file; the scripts are saved in the document
98
- - **Code generation** — TypeScript, GraphQL, C#, Java, JPA, Kotlin, Scala, Go, SQLAlchemy, TypeORM,
99
- Sequelize, Drizzle, DBML, AML, Mermaid, PHP, Doctrine, Rust, SeaORM, Swift, Zod and JSON Schema,
100
- from the Code Generator tab. Its options panel picks the language, the database, the table and
101
- column name cases and, for Doctrine, JPA and SeaORM, the bracket type, and saves the code as a
102
- file with the language's extension
103
- - **Export** — `.erd.json`, `.sql`, and a `.png` or `.svg` from a dialog with a preview: transparent
104
- background, light or dark, the PNG at 1x to 3x or copied to the clipboard instead
105
-
106
- ### Find and navigate
107
-
108
- - **Quick search** — `Ctrl`/`Cmd`+`K` opens the command palette to run editor commands (new table,
109
- import, export, Auto Layout, tabs, theme, language and more), or to jump to a table after `#`, a
110
- column after `@`, and a comment or memo after `:`; Korean also matches by its initial consonants
111
- (`ㅅㅇㅈ` finds 사용자)
112
- - **Find and replace** — `Ctrl`/`Cmd`+`F` searches table and column names, comments and memos, with
113
- match case, whole word and regular expressions, and one undo takes back a Replace All
114
- - **Visualization** — Graph mode draws a force-directed view of how the tables relate. Flow mode
115
- lays them out by their relationships, lights a table you hover and the tables it relates to, and
116
- shows names only, keys only or all fields; **Focus on this table** in a table's right-click menu
117
- opens Flow on that table and its neighbours, or, when it is one of several selected tables, as
118
- **Focus on selected tables** on all of them and their neighbours, as `Alt`+`F` does for the
119
- selection, and neither view writes its layout into the file
120
- - **Zoom and pan** — pinch a trackpad or two fingers to zoom, drag with the middle button to pan
121
- from anywhere, and click the zoom level on the floating toolbar to go back to 100%
122
- - **Time travel** — replay this editing session's history on the canvas and jump to any point in it,
123
- from the toolbar
124
- - **Diff viewer** — compare the diagram with another `.json` file from the canvas menu, or from
125
- `setDiffValue`
126
- - **Undo / redo** — every edit, from the toolbar or `Ctrl`/`Cmd`+`Z` and `Ctrl`/`Cmd`+`Shift`+`Z`,
127
- in the editor's own history
128
-
129
- ### Language and theme
130
-
131
- - **Display language** — the editor's menus, panels, dialogs, command palette and messages in 25
132
- languages, Arabic, Hebrew and Persian laid out right to left while the diagram stays left to
133
- right. The element shows English until the host turns on `enable-locale-picker`, which adds the
134
- toolbar's language button and **Display Language** and follows System, or calls `setLocale`
135
- ([Display language](#display-language)); table and column names, SQL keywords, data types and
136
- generated code stay as they are
137
- - **Theme** — once the host sets `enable-theme-builder`, the toolbar's theme builder picks the
138
- appearance, a gray color and an accent color, and **Theme** in the command palette picks the
139
- appearance; System follows the OS color scheme or what `setSystemAppearance` names, and the
140
- element stores nothing (`changePresetTheme` tells the host)
141
- - **Welcome screen** — opt-in with `enable-welcome-screen`: an empty diagram you can edit opens on a
142
- menu of New Table, New Memo, Import, Command Palette and Shortcuts, with arrows at the toolbar's
143
- search, theme and language buttons where the element shows them and at the floating toolbar where
144
- the canvas has room, until its first table, shown memo or shown table group
145
-
146
- ### Collaboration hooks
147
-
148
- - **Collaboration hooks** — the editor emits the actions it makes and applies a peer's through
149
- `getSharedStore()`; you supply the transport, and seed a joining editor with its `runtimeValue`
150
- ([Collaboration](#collaboration))
151
- - **Headless entries** — `engine.js` runs a replica with no DOM, so a worker can apply the same
152
- actions and serialize the document off the main thread, and `peer.js` runs a peer that edits by
153
- dispatching actions, which the
154
- [ERD Editor MCP server](https://github.com/dineug/erd-editor/tree/main/packages/mcp-server#readme)
155
- is built on
16
+ - **Design** — tables, columns, memos and table groups, four relationship cardinalities, ON DELETE
17
+ and ON UPDATE, alternate keys, Auto Layout
18
+ - **Naming standards** — logical and physical names, physical names and data types derived from
19
+ word, term and domain dictionaries, which have their own tab with CSV import and export and checks
20
+ - **Import** — SQL DDL, GraphQL SDL, DBML and AML from the menu or [`setSchema*`](#importing-a-schema),
21
+ replacing the diagram or adding to it
22
+ - **Export** — DDL for eight databases, also from `getSchemaSQL()`, code in 22 languages and ORMs,
23
+ PNG and SVG
24
+ - **Navigate** — command palette (`Ctrl`/`Cmd`+`K`), an Explorer tree with find and replace, Graph
25
+ and Flow views
26
+ - **History** — undo and redo, time travel through the session, a diff viewer (`setDiffValue()`)
27
+ - **25 languages** and a System, Light or Dark theme, their pickers opt-in with an attribute
28
+ - **Collaboration** — [`getSharedStore()`](#collaboration) relays edits over your own transport,
29
+ and the [headless entries](#headless-replica) run the same document with no DOM
30
+
31
+ **Databases:** Databricks, MariaDB, MSSQL, MySQL, Oracle, PostgreSQL, Snowflake, SQLite
32
+
33
+ **Code:** TypeScript, GraphQL, C#, Java, JPA, Kotlin, Scala, Go, SQLAlchemy, TypeORM, Sequelize,
34
+ Drizzle, DBML, AML, Mermaid, PHP, Doctrine, Rust, SeaORM, Swift, Zod, JSON Schema
156
35
 
157
36
  ## Install
158
37
 
@@ -160,11 +39,9 @@ It is the same editor as [erd-editor.io](https://erd-editor.io), the
160
39
  npm install @dineug/erd-editor
161
40
  ```
162
41
 
163
- Your bundler resolves, dedupes and tree-shakes the package's ES modules and dependencies. The PNG
164
- and SVG export, the Flow and tree layouts and the syntax highlighting run in shared workers spawned
165
- as `new SharedWorker(new URL('./workers/…', import.meta.url), { type: 'module', name })`, which
166
- Vite, webpack and Rspack emit beside your chunks and esbuild does not. A strict CSP needs
167
- `worker-src 'self'`. Without a bundler, use the [Script tag](#script-tag) build.
42
+ The PNG and SVG export, the Flow and tree layouts and the syntax highlighting run in shared
43
+ workers, which Vite, webpack and Rspack emit beside your chunks and esbuild does not. A strict CSP
44
+ needs `worker-src 'self'`. Without a bundler, use the [script tag](#script-tag) build.
168
45
 
169
46
  ## Usage
170
47
 
@@ -184,8 +61,8 @@ editor.addEventListener('change', () => {
184
61
 
185
62
  ### Server-side rendering
186
63
 
187
- Importing the package registers the element, which throws without a DOM, so in Next.js, Nuxt,
188
- SvelteKit or Astro import it on the client:
64
+ Importing the package registers the element, which needs a DOM, so in Next.js, Nuxt, SvelteKit or
65
+ Astro import it on the client:
189
66
 
190
67
  ```js
191
68
  useEffect(() => {
@@ -195,9 +72,8 @@ useEffect(() => {
195
72
 
196
73
  ### Vite
197
74
 
198
- In development Vite would look the worker files up in its pre-bundle cache, so exclude the editor
199
- and include the CommonJS ELK bundle its layout worker imports, or the Flow and tree layouts fail. A
200
- production build needs nothing.
75
+ In development, keep the editor out of Vite's pre-bundling and include the ELK bundle its layout
76
+ worker imports, or the Flow and tree layouts fail. A production build needs nothing.
201
77
 
202
78
  ```js
203
79
  // vite.config.js
@@ -211,43 +87,33 @@ export default {
211
87
 
212
88
  ### Script tag
213
89
 
214
- `dist/erd-editor.umd.js`, served by `unpkg` and `jsdelivr`, bundles every dependency and worker,
215
- registers `<erd-editor>` and puts `setExportFileCallback`, `setImportFileCallback` and
216
- `createKeyBindingMap` on `window.ErdEditor`. Its workers are `data:` URLs, so a strict CSP needs
217
- `worker-src data:`. Pin a version in the URL beyond a demo.
90
+ `dist/erd-editor.umd.js` bundles every dependency and worker, registers `<erd-editor>` and puts
91
+ `setExportFileCallback`, `setImportFileCallback`, `createKeyBindingMap` and `dictionaryRowChords`
92
+ on `window.ErdEditor`.
93
+ Its workers are `data:` URLs, so a strict CSP needs `worker-src data:`. Pin a version beyond a demo.
218
94
 
219
95
  ```html
220
96
  <erd-editor style="display: block; width: 100%; height: 100vh"></erd-editor>
221
97
  <script src="https://cdn.jsdelivr.net/npm/@dineug/erd-editor/dist/erd-editor.umd.js"></script>
222
98
  ```
223
99
 
224
- ### HTML
225
-
226
- In a page a bundler serves:
227
-
228
- ```html
229
- <erd-editor system-dark-mode style="display: block; height: 100vh"></erd-editor>
230
- <script type="module">
231
- import '@dineug/erd-editor';
232
- </script>
233
- ```
234
-
235
100
  ## API
236
101
 
237
- The package exports the element's type as `ErdEditorElement`.
102
+ The element's type is exported as `ErdEditorElement`. The
103
+ [Element API docs](https://docs.erd-editor.io/docs/api/erd-editor-element) cover each member in
104
+ full.
238
105
 
239
106
  ### Attributes
240
107
 
241
108
  | Attribute | Property | Description |
242
109
  | --- | --- | --- |
243
- | `readonly` | `readonly` | Blocks editing and `change`; `clear()` and every load you start but `setInitialValue()` are ignored. |
244
- | `system-dark-mode` | `systemDarkMode` | On, sets the appearance to `system`; off, keeps the light or dark it shows. |
245
- | `enable-theme-builder` | `enableThemeBuilder` | Shows the theme builder's toolbar button and the palette's Theme. |
246
- | `enable-locale-picker` | `enableLocalePicker` | Shows the toolbar's language button and the palette's Display Language, and makes System the default. |
247
- | `enable-welcome-screen` | `enableWelcomeScreen` | Shows the welcome screen over an empty, editable diagram, again after an undo back to empty. |
110
+ | `readonly` | `readonly` | Blocks editing and `change`; only `setInitialValue()` still loads. |
111
+ | `system-dark-mode` | `systemDarkMode` | Sets the appearance to `system`. |
112
+ | `enable-theme-builder` | `enableThemeBuilder` | Shows the theme builder and the palette's Theme. |
113
+ | `enable-locale-picker` | `enableLocalePicker` | Shows the language button and the palette's Display Language, System by default. |
114
+ | `enable-welcome-screen` | `enableWelcomeScreen` | Shows the welcome screen over an empty, editable diagram. |
248
115
 
249
- An attribute is on when present with no value or `"true"`, off for any other value (`"false"`,
250
- `"readonly"`).
116
+ An attribute is on when present with no value or `"true"`.
251
117
 
252
118
  ### Properties
253
119
 
@@ -260,78 +126,59 @@ An attribute is on when present with no value or `"true"`, off for any other val
260
126
 
261
127
  | Method | Description |
262
128
  | --- | --- |
263
- | `setInitialValue(value)` | Load a document with no undo entry, clearing the history; `''` starts a new one. |
264
- | `getSchemaSQL(vendor?, options?)` | DDL for one of the [eight vendors](#export-and-code), by default the document's, scripts included. `options` (`SchemaSQLOptions`): `statements` `create` (default), `ifNotExists` or `recreate`; `header` `none` (default), `use` or `createAndUse`, written only for a plain-identifier database name. |
129
+ | `setInitialValue(value)` | Load a document with no undo entry; `''` starts a new one. |
130
+ | `getSchemaSQL(vendor?, options?)` | DDL for one of the eight databases, by default the document's. `options`: `statements` (`create`, `ifNotExists`, `recreate`), `header` (`none`, `use`, `createAndUse`), `logicalNameAsComment` (`true` writes a table's or column's logical name where its comment is empty). |
265
131
  | `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)). |
266
132
  | `setSchemaJSON(value, options?)` | Load an `.erd.json` document as `value` does, or append it. |
267
- | `setDiffValue(value)` | Diff another document over the ERD tab without switching to it; it opens nothing before that tab first shows. |
133
+ | `setDiffValue(value)` | Diff another document over the ERD tab. |
268
134
  | `setPresetTheme(options)` | Set `appearance` (`light`, `dark`, `system`), `grayColor` and `accentColor`. |
269
135
  | `setSystemAppearance(appearance)` | Name the light or dark `system` shows; `null` follows the OS. |
270
- | `setLocale(locale)` | Set the display language, `'system'` or a [code](#display-language); emits nothing. |
271
- | `setSystemLocale(tag)` | Name, as a BCP 47 tag, the language `system` shows, for a host with its own UI language; `null` reads `navigator.languages`. |
272
- | `setTheme(theme)` | Override theme tokens with string values. Each call replaces the earlier overrides, which outlast `setPresetTheme`. |
136
+ | `setLocale(locale)` | Set the display language, `'system'` or a [code](#display-language). |
137
+ | `setSystemLocale(tag)` | Name the BCP 47 language `system` shows; `null` reads `navigator.languages`. |
138
+ | `setTheme(theme)` | Override theme tokens; each call replaces the earlier overrides. |
273
139
  | `setKeyBindingMap(map)` | Remap [shortcuts](#key-bindings) but `edit`, `stop`, `undo`, `redo` and the zoom keys. |
274
- | `getSharedStore(config?)` | A [shared store](#collaboration): `subscribe`, `dispatch`, `dispatchSync`, `connection`, `disconnect`, `flushStreamBuffers`, `destroy`. |
140
+ | `getSharedStore(config?)` | A [shared store](#collaboration) for collaboration. |
275
141
  | `focus()` / `blur()` | Move focus in or out. |
276
- | `clear()` | Empty the document and keep its settings; one undo brings it back. |
142
+ | `clear()` | Empty the document and keep its settings, in one undo step. |
277
143
  | `destroy()` | Release the editor's listeners, subscriptions and shared stores. |
278
144
 
279
145
  ### Events
280
146
 
281
147
  | Event | Description |
282
148
  | --- | --- |
283
- | `change` | The document changed; read `editor.value` ([Loading and saving](#loading-and-saving)). |
284
- | `changePresetTheme` | The theme changed in the editor; `event.detail` holds the options (`appearance: 'system'` for System). |
149
+ | `change` | The document changed; read `editor.value`. |
150
+ | `changePresetTheme` | The theme changed in the editor; `event.detail` holds the options. |
285
151
  | `changeLocale` | A language was picked in the editor; `event.detail.locale` holds it. |
286
152
 
287
153
  ### Loading and saving
288
154
 
289
- Save `value`; `runtimeValue`, which also keeps removed entities, only seeds a
290
- [collaborator](#collaboration).
291
-
292
- A new document locks each setting the Settings tab lists under **Lock**, which then saves its value
293
- at locking. A loaded document keeps its locks, or has all on if it predates them. A replacing load
294
- (`value`, an import, a peer's load, or the undo of a load or of `clear()`) keeps on screen what the
295
- incoming document locks (for an import, the current locks), scroll and zoom aside, and takes its
296
- values for the rest.
297
-
298
- `change` fires 200 ms after the last change, never under `readonly` or for a scroll, zoom, tab, code
299
- setting or bracket type under its lock. A file another release wrote, or one edited by hand, can
300
- differ from `value` once loaded: detect edits by a [replica](#headless-replica)'s `changed`, not by
301
- bytes.
302
-
303
- Under `readonly`, only the scroll, zoom, tab, database, code language, name cases and bracket type
304
- change; a peer's actions relayed into `getSharedStore().dispatch` still apply.
155
+ - Save `value`. `runtimeValue` also keeps removed entities and only seeds a
156
+ [collaborator](#collaboration).
157
+ - `change` fires 200 ms after the last change, never under `readonly`, and never for scroll, zoom,
158
+ the open tab, the name view or the code settings while the document locks them, which a new
159
+ document does.
160
+ - A file written by hand or by another release can differ from `value` once loaded, so detect edits
161
+ with a [replica](#headless-replica)'s `changed`, not by comparing bytes.
305
162
 
306
163
  ### Importing a schema
307
164
 
308
- The four text `setSchema*` methods take
309
- `{ placement?: 'auto' | 'grid', mode?: 'replace' | 'append' }`, `setSchemaJSON` only `mode`; each
310
- lands in one undo step and ignores `''`; a replace with unreadable text loads an empty document.
311
-
312
- `'grid'`, the default, lands at once in rows. `'auto'` lays the tables out first, as the Import menu
313
- does, and returns a `Promise` that resolves on landing, keeping settings changed meanwhile. A load
314
- before then (a replacing import, `value`, `setInitialValue`, `clear()`, a peer's load or the undo of
315
- a load or `clear()`) supersedes it, and it resolves with nothing loaded; a readonly editor resolves
316
- at once.
317
-
318
- `mode: 'append'` is [Import and Add](#import), table groups included: it lands below hidden groups
319
- too, keeps every setting but the tab and scroll, and selects new groups while groups show. An
320
- `'auto'` append supersedes nothing: it lands after earlier `'auto'` imports, below the diagram as it
321
- stands then, and only a later load or replace drops it. From another tab it brings up the ERD tab
322
- first; a readonly editor adds nothing.
165
+ - The four text `setSchema*` methods take `{ placement?: 'auto' | 'grid', mode?: 'replace' | 'append' }`,
166
+ and `setSchemaJSON` only `mode`. Each lands in one undo step and ignores `''`.
167
+ - `'grid'`, the default, lands at once in rows. `'auto'` lays the tables out as the Import menu does
168
+ and returns a `Promise` that resolves when they land; a later load supersedes it.
169
+ - `mode: 'append'` adds the tables below the diagram, as Import and Add does.
170
+ - A replace by the four text methods keeps the document's word, term and domain dictionaries, which
171
+ the text cannot hold; a replacing `setSchemaJSON` takes the ones its document holds, as `value`
172
+ does.
323
173
 
324
174
  ### Theme and language
325
175
 
326
- The element starts dark; `setPresetTheme({ appearance: 'system' })` follows the OS, or the light or
327
- dark `setSystemAppearance` names. `setLocale` applies at once, so one set before appending paints
328
- the first frame. `setSystemLocale` matters only under System and shows English for a tag the
329
- editor lacks. Neither choice is stored; keep what `changePresetTheme` and `changeLocale` report.
176
+ The element starts dark and English and stores neither choice: `setPresetTheme` and `setLocale`
177
+ set them, and your host keeps what `changePresetTheme` and `changeLocale` report.
330
178
 
331
179
  ## Collaboration
332
180
 
333
- A joiner starts from the first editor's runtime value, so an undo there restores removed entities
334
- whole in both; then each relays its actions:
181
+ A joiner starts from the first editor's `runtimeValue`, then each relays its actions:
335
182
 
336
183
  ```js
337
184
  joiner.setInitialValue(editor.runtimeValue);
@@ -343,52 +190,40 @@ remote.subscribe(actions => local.dispatch(actions));
343
190
  ```
344
191
 
345
192
  An editor never forwards what it received, so with three or more, send each one's batches to every
346
- other.
347
-
348
- `getSharedStore` takes `{ getNickname?, mouseTracker?, focusTracker? }`; `mouseTracker` broadcasts
349
- the cursor and `focusTracker` the focused cell, selection and drag box, both on by default.
350
- `disconnect()` holds outgoing actions while your transport is down; `connection()` releases them.
351
- Call `flushStreamBuffers()` before destroying the store or editor, or drags, color changes and memo
352
- resizes in their quiet period never reach the peers.
193
+ other. Call `flushStreamBuffers()` before destroying a store, or the last drags and resizes never
194
+ reach the peers. `getSharedStore({ getNickname, mouseTracker, focusTracker })` also shares cursors
195
+ and focus.
353
196
 
354
197
  ## Key bindings
355
198
 
356
- `createKeyBindingMap()` returns a new map of the default shortcuts. A chord is its modifiers
357
- (`Shift`, `Alt`, `Control`, `Meta`, or `$mod`: Cmd on macOS and iOS, Ctrl elsewhere) joined by `+`,
358
- then a `KeyboardEvent.code` or a `key` in any case, matching only those exact modifiers.
359
-
360
- Entries are `ShortcutOption`s, `{ shortcut, preventDefault?, stopPropagation? }`; a remapped one
361
- without flags lets the browser default run and the keydown bubble. `setKeyBindingMap` replaces each
362
- list it names. The defaults stop `search`, `findReplace`, `undo`, `redo`, `focusView`, zoom and
363
- `zenMode`, so bubble-phase listeners miss them while the editor is focused, and a host that takes
364
- keys first (global hotkeys, a capture listener) must let them through, or leave `$mod+KeyF` to the
365
- page with `setKeyBindingMap({ findReplace: [] })`. The `KeyBindingMap`, `KeyBindingName` and
366
- `ShortcutOption` types are exported.
199
+ `createKeyBindingMap()` returns the default shortcuts, and `setKeyBindingMap` replaces each list it
200
+ names. A chord is modifiers (`Shift`, `Alt`, `Control`, `Meta`, or `$mod` for Cmd on macOS and Ctrl
201
+ elsewhere) joined by `+` with a `KeyboardEvent.code` or `key`; a space separates the chords of a
202
+ sequence, such as `KeyT KeyG`. Several defaults, search and find and replace among them, stop the
203
+ keydown, so to leave `$mod+KeyF` to the page, call `setKeyBindingMap({ findReplace: [] })`.
204
+ `dictionaryRowChords(map)` lists the chords the Dictionary tab's grid inserts and deletes rows by
205
+ under a map: the one-press chords of `addColumn` and `removeColumn`, and those of `addColumn` with
206
+ `Shift` held as well, for Insert above, which no binding names. A host that keeps its own hotkeys
207
+ off the editor's keys takes both lists.
367
208
 
368
209
  ## Display language
369
210
 
370
- The codes are `en`, `ar-SA`, `de-DE`, `es-ES`, `eu-ES`, `fa-IR`, `fr-FR`, `he-IL`, `id-ID`, `it-IT`,
371
- `ja-JP`, `ko-KR`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sl-SI`, `sv-SE`,
372
- `tr-TR`, `uk-UA`, `zh-CN` and `zh-TW`. `setLocale('system')` follows System even without
373
- `enable-locale-picker`. The `LocaleCode` and `LocaleOption` types are exported; cast a stored
374
- string `as LocaleOption`, since an unknown value is ignored.
375
-
376
- ## Syntax highlighting
211
+ `en`, `ar-SA`, `de-DE`, `es-ES`, `eu-ES`, `fa-IR`, `fr-FR`, `he-IL`, `id-ID`, `it-IT`, `ja-JP`,
212
+ `ko-KR`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sl-SI`, `sv-SE`, `tr-TR`,
213
+ `uk-UA`, `zh-CN` and `zh-TW`. Arabic, Hebrew and Persian lay the editor out right to left. The
214
+ `LocaleCode` and `LocaleOption` types are exported.
377
215
 
378
- [Shiki](https://shiki.style) highlights the panels' code, DBML and AML as SQL, with a JavaScript
379
- regex engine, so a CSP needs no `wasm-unsafe-eval`, from a shared worker built when a code panel
380
- first renders; with a bundler, a page that opens none never fetches the grammars (the UMD file
381
- carries them).
216
+ ## Workers
382
217
 
383
- Without `SharedWorker`, as in Chrome on Android before Chrome 148, the panels log the error and show
384
- plain text, the Flow view places nothing, Auto Layout's Flow and tree placements say "Could not
385
- place tables" (Force works), an `'auto'` import lands in rows, and PNG and SVG exports draw on the
386
- main thread.
218
+ [Shiki](https://shiki.style) highlights the code panels with a JavaScript regex engine, so a CSP
219
+ needs no `wasm-unsafe-eval`. Without `SharedWorker`, as in Chrome on Android before Chrome 148, the
220
+ code panels show plain text, the Flow view and the Flow and tree layouts place nothing, an `'auto'`
221
+ import lands in rows, and PNG and SVG exports draw on the main thread.
387
222
 
388
223
  ## File dialogs
389
224
 
390
- Import and export go through page-wide callbacks, so a host without a browser file dialog (an IDE
391
- webview) supplies its own:
225
+ Import and export go through page-wide callbacks, so a host without a browser file dialog, such as
226
+ an IDE webview, supplies its own:
392
227
 
393
228
  ```js
394
229
  import { setExportFileCallback, setImportFileCallback } from '@dineug/erd-editor';
@@ -404,16 +239,14 @@ setImportFileCallback(async ({ type, op, accept, mode }) => {
404
239
  });
405
240
  ```
406
241
 
407
- Export gets `.erd.json`, `.sql`, PNG, SVG and the Code Generator's file. An import's `op` is
408
- `'diff'` for the Diff Viewer, whose file goes to `setDiffValue()`, so test it first; otherwise it is
409
- `'set'`. Skip a `type` you do not handle: a replacing `setSchemaJSON()` empties the document on any
410
- other payload. `accept` lists the type's extensions (`.json`, `.sql`,
411
- `.graphql,.gql,.graphqls`, `.dbml`, `.aml`), and `mode` is `'append'` from Import and Add. Unset or
412
- `null`, the browser's download and file picker work.
242
+ Skip a `type` you do not handle: a replacing `setSchemaJSON()` empties the document on any other
243
+ payload. Unset or `null`, the browser's download and file picker work. The Dictionary tab's Import
244
+ CSV always opens the browser's file picker, since no `type` names CSV, and its Export CSV goes
245
+ through the export callback.
413
246
 
414
247
  ## Headless replica
415
248
 
416
- The `engine.js` replica takes the same actions with no DOM:
249
+ `engine.js` applies the same actions with no DOM, so a worker can keep and serialize the document:
417
250
 
418
251
  ```js
419
252
  import { createReplicationStore } from '@dineug/erd-editor/engine.js';
@@ -424,18 +257,12 @@ store.on({ change: ({ value, changed }) => changed && persist(value) });
424
257
  store.dispatch(actions);
425
258
  ```
426
259
 
427
- `value` and `runtimeValue` mirror the element's; `dispatch` applies on the next microtask,
428
- `dispatchSync` at once, and `destroy` releases the store. `change` comes 200 ms after the last
429
- document action, locked settings included, with `changed` false when `value` matches what the store
430
- last reported or loaded, never your file. `ReplicationStore` and `ReplicationChange` are exported
431
- types.
432
-
433
- ### Headless peer
260
+ `changed` is false when `value` matches what the store last reported or loaded.
434
261
 
435
- `peer.js` runs a collaboration peer with no DOM, the base of the ERD Editor MCP server. Its
436
- `createPeerStore({ nickname })` store dispatches actions, receives a peer's batches and undoes its
437
- own dispatches; `PeerStoreError`, per-module action barrels (`tableActions`, `tableActions$`, …) and
438
- `createSchemaSQL` come with it.
262
+ `peer.js` runs a collaboration peer with no DOM: `createPeerStore({ nickname })` dispatches actions,
263
+ receives a peer's batches and undoes its own. The
264
+ [ERD Editor MCP server](https://github.com/dineug/erd-editor/tree/main/packages/mcp-server#readme)
265
+ is built on it.
439
266
 
440
267
  ## Development
441
268
 
@@ -451,10 +278,9 @@ What a change runs and carries is in
451
278
 
452
279
  ## Documentation
453
280
 
454
- - [Editing Guide](https://docs.erd-editor.io/docs/category/guides) — editing, import and export,
455
- relationships, quick search, visualization, code generation, settings
281
+ - [Editing Guide](https://docs.erd-editor.io/docs/category/guides) — every editor feature
456
282
  - [Element API](https://docs.erd-editor.io/docs/api/erd-editor-element) — the `<erd-editor>`
457
- element's API
283
+ element in full
458
284
  - [Documentation](https://docs.erd-editor.io)
459
285
 
460
286
  ## Issues
@@ -0,0 +1,12 @@
1
+ import { FC } from '@dineug/r-html';
2
+ export type DictionaryProps = {
3
+ readonly: boolean;
4
+ };
5
+ /**
6
+ * The Dictionary tab: the sheet switch, the search and the row and file tools
7
+ * over a grid of the sheet shown, and its row count and selection under it.
8
+ * Every edit, paste or clear the grid commits is one dispatch and one undo.
9
+ */
10
+ declare const Dictionary: FC<DictionaryProps>;
11
+ export default Dictionary;
12
+ //# sourceMappingURL=Dictionary.d.ts.map
@@ -0,0 +1,33 @@
1
+ /** The bar, the sheet under it and the status line at the foot. */
2
+ export declare const root: import('@dineug/r-html').CSSTemplateLiterals;
3
+ /**
4
+ * The sheet switch, the search and the row and file tools, on one line while
5
+ * they fit and on more where they do not, since the tab clips what overflows
6
+ * it and a narrow pane would hide the tools. Each control stands 28px high.
7
+ */
8
+ export declare const bar: import('@dineug/r-html').CSSTemplateLiterals;
9
+ export declare const segments: import('@dineug/r-html').CSSTemplateLiterals;
10
+ export declare const segment: import('@dineug/r-html').CSSTemplateLiterals;
11
+ /** A sheet's row count beside its name, quieter than the name. */
12
+ export declare const count: import('@dineug/r-html').CSSTemplateLiterals;
13
+ /** The check sheet's count in the colour of the loudest check it holds. */
14
+ export declare const countError: import('@dineug/r-html').CSSTemplateLiterals;
15
+ export declare const countWarning: import('@dineug/r-html').CSSTemplateLiterals;
16
+ /** The search takes what the switch and the tools leave, up to a width that keeps it a field. */
17
+ export declare const searchField: import('@dineug/r-html').CSSTemplateLiterals;
18
+ export declare const searchIcon: import('@dineug/r-html').CSSTemplateLiterals;
19
+ export declare const search: import('@dineug/r-html').CSSTemplateLiterals;
20
+ /** Clears the search, shown while it holds text. */
21
+ export declare const clear: import('@dineug/r-html').CSSTemplateLiterals;
22
+ /** The row and file tools, pushed to the bar's end, a rule between the two groups. */
23
+ export declare const tools: import('@dineug/r-html').CSSTemplateLiterals;
24
+ export declare const tool: import('@dineug/r-html').CSSTemplateLiterals;
25
+ /** Delete, which reads as the one tool that takes rows away once it is under the pointer. */
26
+ export declare const toolDanger: import('@dineug/r-html').CSSTemplateLiterals;
27
+ export declare const divider: import('@dineug/r-html').CSSTemplateLiterals;
28
+ /** The grid fills what the bar and the status line leave. */
29
+ export declare const sheet: import('@dineug/r-html').CSSTemplateLiterals;
30
+ /** What to do on a sheet with no row, over the grid's empty cells and out of the pointer's way. */
31
+ export declare const empty: import('@dineug/r-html').CSSTemplateLiterals;
32
+ export declare const status: import('@dineug/r-html').CSSTemplateLiterals;
33
+ //# sourceMappingURL=Dictionary.styles.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { DictionaryCheck, DictionaryCheckLevel } from '../../engine/modules/dictionary/checks';
2
+ /** What an idle period hands its task: how long it may run, and whether it waited past its timeout instead. */
3
+ export type IdleBudget = Pick<IdleDeadline, 'didTimeout' | 'timeRemaining'>;
4
+ /** How long an idle task may wait for the browser to go idle before it runs anyway. */
5
+ export declare const IDLE_TIMEOUT_MS = 1000;
6
+ /** How long a slice runs where the browser names no idle time: one that timed out, or a timer's. */
7
+ export declare const SLICE_MS = 8;
8
+ /** Runs a task once the browser is idle, or on a timer where it names no idle time, and hands back its cancel. */
9
+ export declare function whenIdle(task: (budget: IdleBudget) => void): () => void;
10
+ export type CheckCountOptions = {
11
+ /** The checks of the document a step at a time (walkDictionaryChecks). */
12
+ walk: () => Iterator<ReadonlyArray<DictionaryCheck>>;
13
+ /** Whether a count is still wanted: a slice that finds none drops the walk. */
14
+ wanted: () => boolean;
15
+ /** Takes the number of checks and the loudest of their levels once a walk ends. */
16
+ done: (count: number, mark: DictionaryCheckLevel | null) => void;
17
+ };
18
+ /**
19
+ * Counts the checks on idle, a slice per idle period: each takes steps until
20
+ * its time runs out, one at least, and the next goes on where it stopped, so
21
+ * a slice outlasts its period by one step at most. A restart drops a walk begun.
22
+ */
23
+ export declare function createCheckCount({ walk, wanted, done }: CheckCountOptions): {
24
+ /** Counts afresh on the next idle period, once however many restarts come before it. */
25
+ restart(): void;
26
+ stop(): void;
27
+ };
28
+ //# sourceMappingURL=checkCount.d.ts.map