@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.
- package/README.md +106 -280
- package/dist/components/dictionary/Dictionary.d.ts +12 -0
- package/dist/components/dictionary/Dictionary.styles.d.ts +33 -0
- package/dist/components/dictionary/checkCount.d.ts +28 -0
- package/dist/components/dictionary/checkSheet.d.ts +41 -0
- package/dist/components/dictionary/dictionary-context-menu/DictionaryContextMenu.d.ts +30 -0
- package/dist/components/dictionary/dictionaryCommit.d.ts +83 -0
- package/dist/components/dictionary/dictionaryFile.d.ts +23 -0
- package/dist/components/dictionary/dictionaryKeys.d.ts +48 -0
- package/dist/components/dictionary/dictionaryView.d.ts +65 -0
- package/dist/components/dictionary/domain-cell-editor/DomainCellEditor.d.ts +22 -0
- package/dist/components/dictionary/domain-cell-editor/DomainCellEditor.styles.d.ts +7 -0
- package/dist/components/dictionary/domain-cell-editor/openDomainCellEditor.d.ts +9 -0
- package/dist/components/dictionary/gridTheme.d.ts +18 -0
- package/dist/components/dictionary/sheets.d.ts +65 -0
- package/dist/components/erd/automatic-table-placement/flowPlacement.d.ts +4 -4
- package/dist/components/erd/canvas/DiffOutline.template.d.ts +14 -0
- package/dist/components/erd/canvas/EditOverlay.styles.d.ts +6 -0
- package/dist/components/erd/canvas/sceneHit.d.ts +5 -0
- package/dist/components/erd/canvas/sceneTokens.d.ts +8 -0
- package/dist/components/erd/canvas/table/Table.d.ts +6 -0
- package/dist/components/erd/canvas/table/blankLogicalName.d.ts +19 -0
- package/dist/components/erd/canvas/table/cellLayout.d.ts +4 -4
- package/dist/components/erd/canvas/table/column/Column.d.ts +32 -5
- package/dist/components/erd/canvas/table/dictionaryMarks.d.ts +29 -0
- package/dist/components/erd/canvas/table/useFocusTable.d.ts +1 -0
- package/dist/components/erd/diff-viewer/diff-tree/DiffTree.d.ts +19 -0
- package/dist/components/erd/diff-viewer/diff-tree/DiffTree.styles.d.ts +13 -0
- package/dist/components/erd/diff-viewer/diff-tree/diffTreeModel.d.ts +52 -0
- package/dist/components/erd/diff-viewer/diff.d.ts +21 -19
- package/dist/components/erd/draw-target/placePill.d.ts +1 -3
- package/dist/components/erd/erd-context-menu/menus/nameViewMenus.d.ts +22 -0
- package/dist/components/erd/floating-toolbar/FloatingToolbar.d.ts +7 -4
- package/dist/components/erd/floating-toolbar/nameViewDropdown.d.ts +16 -0
- package/dist/components/erd/floating-toolbar/nameViewDropdown.styles.d.ts +5 -0
- package/dist/components/erd/goToErdTarget.d.ts +40 -16
- package/dist/components/erd/readerNameView.d.ts +15 -0
- package/dist/components/erd/relationshipHighlight.d.ts +18 -0
- package/dist/components/erd/welcome-screen/welcome-hints/WelcomeHints.styles.d.ts +5 -0
- package/dist/components/erd/welcome-screen/welcomeLayout.d.ts +7 -3
- package/dist/components/erd-editor/ErdEditor.styles.d.ts +4 -0
- package/dist/components/erd-editor/viewportLayout.d.ts +52 -0
- package/dist/components/explorer/Explorer.d.ts +12 -0
- package/dist/components/explorer/explorer-controller/ExplorerController.d.ts +11 -0
- package/dist/components/explorer/explorer-panel/ExplorerPanel.d.ts +14 -0
- package/dist/components/explorer/explorer-panel/ExplorerPanel.styles.d.ts +13 -0
- package/dist/components/explorer/explorer-search/ExplorerSearch.d.ts +12 -0
- package/dist/components/explorer/explorer-search/ExplorerSearch.styles.d.ts +13 -0
- package/dist/components/explorer/explorerCommands.d.ts +28 -0
- package/dist/components/explorer/explorerNavigation.d.ts +14 -0
- package/dist/components/explorer/explorerSearch.d.ts +71 -0
- package/dist/components/explorer/explorerTree.d.ts +93 -0
- package/dist/components/explorer/explorerView.d.ts +54 -0
- package/dist/components/{find-replace → explorer}/fieldIcon.d.ts +4 -1
- package/dist/components/{find-replace → explorer}/matchTarget.d.ts +7 -9
- package/dist/components/export-image/ExportImage.d.ts +10 -0
- package/dist/components/export-image/exportImageActions.d.ts +2 -2
- package/dist/components/flowCenters.d.ts +9 -0
- package/dist/components/map-columns/nameOf.d.ts +11 -3
- package/dist/components/primitives/icon/icons.d.ts +13 -4
- package/dist/components/primitives/sash/Sash.d.ts +1 -0
- package/dist/components/primitives/tree/Tree.d.ts +30 -0
- package/dist/components/primitives/tree/Tree.styles.d.ts +5 -0
- package/dist/components/primitives/tree/treeModel.d.ts +42 -0
- package/dist/components/quick-search/QuickSearch.styles.d.ts +1 -0
- package/dist/components/quick-search/actions.d.ts +3 -4
- package/dist/components/quick-search/paletteList.d.ts +7 -0
- package/dist/components/quick-search/scopedActions.d.ts +5 -11
- package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.d.ts +2 -2
- package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.styles.d.ts +2 -0
- package/dist/components/schema-sql/schemaSQLView.d.ts +2 -0
- package/dist/components/settings/lockSettingRows.d.ts +2 -1
- package/dist/components/table-view/column/column-domain/ColumnDomain.d.ts +19 -0
- package/dist/components/table-view/column/column-domain/domainOptions.d.ts +13 -0
- package/dist/components/table-view/column/column-logical-name/ColumnLogicalName.d.ts +22 -0
- package/dist/components/table-view/column/column-logical-name/ColumnLogicalName.styles.d.ts +4 -0
- package/dist/components/table-view/column/columnViewText.d.ts +33 -0
- package/dist/components/table-view/column/useHintList.d.ts +24 -0
- package/dist/components/theme-builder/ThemeBuilder.styles.d.ts +3 -3
- package/dist/components/toolbar/Toolbar.styles.d.ts +0 -1
- package/dist/components/visualization/createVisualization.d.ts +2 -0
- package/dist/components/visualization/flowLayout.d.ts +2 -1
- package/dist/components/visualization/table/column/Column.d.ts +4 -0
- package/dist/components/visualization/visualization-toolbar/VisualizationToolbar.d.ts +2 -2
- package/dist/components/visualization/visualizationView.d.ts +15 -4
- package/dist/constants/layout.d.ts +18 -1
- package/dist/constants/open.d.ts +0 -1
- package/dist/constants/schema.d.ts +15 -2
- package/dist/engine/actions.d.ts +5 -2
- package/dist/engine/history.actions.d.ts +8 -0
- package/dist/engine/history.d.ts +11 -3
- package/dist/engine/index.js +17 -17
- package/dist/engine/modules/dictionary/actions.d.ts +74 -0
- package/dist/engine/modules/dictionary/atom.actions.d.ts +74 -0
- package/dist/engine/modules/dictionary/checks.d.ts +76 -0
- package/dist/engine/modules/dictionary/derive.d.ts +54 -0
- package/dist/engine/modules/dictionary/derivedNames.d.ts +23 -0
- package/dist/engine/modules/dictionary/dictionaryIndex.d.ts +73 -0
- package/dist/engine/modules/dictionary/domainLinks.d.ts +9 -0
- package/dist/engine/modules/dictionary/domainTypes.d.ts +27 -0
- package/dist/engine/modules/dictionary/entryWrites.d.ts +63 -0
- package/dist/engine/modules/dictionary/generator.actions.d.ts +126 -0
- package/dist/engine/modules/dictionary/history.d.ts +14 -0
- package/dist/engine/modules/dictionary/membership.d.ts +28 -0
- package/dist/engine/modules/dictionary/orderKeys.d.ts +13 -0
- package/dist/engine/modules/dictionary/termIndex.d.ts +24 -0
- package/dist/engine/modules/editor/actions.d.ts +18 -3
- package/dist/engine/modules/editor/atom.actions.d.ts +24 -6
- package/dist/engine/modules/editor/generator.actions.d.ts +22 -8
- package/dist/engine/modules/editor/state.d.ts +24 -0
- package/dist/engine/modules/editor/utils/nameView.d.ts +103 -0
- package/dist/engine/modules/editor/view.actions.d.ts +24 -1
- package/dist/engine/modules/editor/view.d.ts +8 -0
- package/dist/engine/modules/relationship/fkColumns.d.ts +10 -4
- package/dist/engine/modules/settings/actions.d.ts +13 -3
- package/dist/engine/modules/settings/atom.actions.d.ts +49 -5
- package/dist/engine/modules/settings/generator.actions.d.ts +2 -2
- package/dist/engine/modules/table/actions.d.ts +7 -0
- package/dist/engine/modules/table/atom.actions.d.ts +46 -0
- package/dist/engine/modules/table/generator.actions.d.ts +7 -0
- package/dist/engine/modules/table/history.d.ts +2 -0
- package/dist/engine/modules/table-column/actions.d.ts +7 -0
- package/dist/engine/modules/table-column/atom.actions.d.ts +49 -0
- package/dist/engine/modules/table-column/generator.actions.d.ts +5 -0
- package/dist/engine/modules/table-column/history.d.ts +3 -0
- package/dist/engine/modules/table-column/utils/dataType.d.ts +3 -1
- package/dist/engine/rx-store.d.ts +6 -0
- package/dist/engine/tag.d.ts +8 -0
- package/dist/erd-editor.umd.js +1586 -1018
- package/dist/i18n/messages/ar-SA.d.ts +166 -15
- package/dist/i18n/messages/de-DE.d.ts +134 -11
- package/dist/i18n/messages/en/code.d.ts +0 -1
- package/dist/i18n/messages/en/common.d.ts +11 -1
- package/dist/i18n/messages/en/contextMenu.d.ts +1 -0
- package/dist/i18n/messages/en/dictionary.d.ts +79 -0
- package/dist/i18n/messages/en/explorer.d.ts +37 -0
- package/dist/i18n/messages/en/findReplace.d.ts +7 -1
- package/dist/i18n/messages/en/index.d.ts +135 -12
- package/dist/i18n/messages/en/palette.d.ts +5 -7
- package/dist/i18n/messages/en/schemaSql.d.ts +1 -0
- package/dist/i18n/messages/en/settings.d.ts +1 -0
- package/dist/i18n/messages/en/shortcuts.d.ts +3 -1
- package/dist/i18n/messages/en/toolbar.d.ts +0 -1
- package/dist/i18n/messages/en/visualization.d.ts +2 -0
- package/dist/i18n/messages/es-ES.d.ts +142 -12
- package/dist/i18n/messages/eu-ES.d.ts +134 -11
- package/dist/i18n/messages/fa-IR.d.ts +134 -11
- package/dist/i18n/messages/fr-FR.d.ts +142 -12
- package/dist/i18n/messages/he-IL.d.ts +142 -12
- package/dist/i18n/messages/id-ID.d.ts +126 -10
- package/dist/i18n/messages/it-IT.d.ts +142 -12
- package/dist/i18n/messages/ja-JP.d.ts +126 -10
- package/dist/i18n/messages/ko-KR.d.ts +126 -10
- package/dist/i18n/messages/nl-NL.d.ts +134 -11
- package/dist/i18n/messages/pl-PL.d.ts +150 -13
- package/dist/i18n/messages/pt-BR.d.ts +142 -12
- package/dist/i18n/messages/pt-PT.d.ts +142 -12
- package/dist/i18n/messages/ro-RO.d.ts +142 -12
- package/dist/i18n/messages/ru-RU.d.ts +150 -13
- package/dist/i18n/messages/sk-SK.d.ts +150 -13
- package/dist/i18n/messages/sl-SI.d.ts +150 -13
- package/dist/i18n/messages/sv-SE.d.ts +134 -11
- package/dist/i18n/messages/tr-TR.d.ts +134 -11
- package/dist/i18n/messages/uk-UA.d.ts +150 -13
- package/dist/i18n/messages/zh-CN.d.ts +126 -10
- package/dist/i18n/messages/zh-TW.d.ts +126 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +34929 -25093
- package/dist/internal-types/index.d.ts +6 -0
- package/dist/konva/scene/columnDropTarget.d.ts +2 -2
- package/dist/loadValue-B5ojYrZ-.js +14682 -0
- package/dist/peer/index.d.ts +4 -0
- package/dist/peer/index.js +60 -59
- package/dist/services/export-png/ExportScene.d.ts +1 -1
- package/dist/services/export-png/documentScene.d.ts +7 -1
- package/dist/services/export-png/index.d.ts +11 -5
- package/dist/services/export-png/renderPng.d.ts +4 -1
- package/dist/services/export-png/renderSvg.d.ts +4 -1
- package/dist/shared-store-S7YWEz3E.js +1656 -0
- package/dist/styles/scrollbar.styles.d.ts +1 -1
- package/dist/themes/tokens.d.ts +21 -4
- package/dist/utils/calcTable.d.ts +20 -4
- package/dist/utils/collection/domain.entity.d.ts +3 -0
- package/dist/utils/collection/term.entity.d.ts +3 -0
- package/dist/utils/collection/word.entity.d.ts +3 -0
- package/dist/utils/dictionary-csv/csv.d.ts +13 -0
- package/dist/utils/dictionary-csv/decode.d.ts +7 -0
- package/dist/utils/dictionary-csv/dictionaryCsv.d.ts +55 -0
- package/dist/utils/dictionary-csv/index.d.ts +4 -0
- package/dist/utils/diff/compareEntities.d.ts +39 -0
- package/dist/utils/diff/diffDocuments.d.ts +12 -0
- package/dist/utils/diff/index.d.ts +5 -0
- package/dist/utils/diff/pairEntities.d.ts +41 -0
- package/dist/utils/diff/types.d.ts +81 -0
- package/dist/utils/emitter.d.ts +2 -8
- package/dist/utils/file/exportFile.d.ts +10 -0
- package/dist/utils/find-replace/findMatches.d.ts +31 -12
- package/dist/utils/find-replace/matcher.d.ts +2 -0
- package/dist/utils/find-replace/present.d.ts +4 -3
- package/dist/utils/find-replace/preserveCase.d.ts +10 -0
- package/dist/utils/find-replace/replaceActions.d.ts +9 -5
- package/dist/utils/focus.d.ts +2 -0
- package/dist/utils/formatCount.d.ts +10 -0
- package/dist/utils/keyboard-shortcut/index.d.ts +11 -3
- package/dist/utils/map-columns/alignTypes.d.ts +3 -3
- package/dist/utils/schema-sql/Databricks.d.ts +2 -2
- package/dist/utils/schema-sql/MSSQL.d.ts +1 -1
- package/dist/utils/schema-sql/MariaDB.d.ts +2 -2
- package/dist/utils/schema-sql/MySQL.d.ts +2 -2
- package/dist/utils/schema-sql/Oracle.d.ts +1 -1
- package/dist/utils/schema-sql/PostgreSQL.d.ts +1 -1
- package/dist/utils/schema-sql/SQLite.d.ts +2 -2
- package/dist/utils/schema-sql/Snowflake.d.ts +2 -2
- package/dist/utils/schema-sql/options.d.ts +2 -0
- package/dist/utils/schema-sql/utils.d.ts +14 -0
- package/dist/utils/table-clipboard/copy.d.ts +2 -3
- package/dist/utils/table-clipboard/index.d.ts +9 -1
- package/dist/utils/table-clipboard/paste.d.ts +2 -2
- package/dist/utils/table-clipboard/payload.d.ts +12 -0
- package/dist/utils/takeover.d.ts +6 -0
- package/dist/utils/validation.d.ts +1 -0
- package/dist/utils/virtualRange.d.ts +15 -0
- package/dist/workers/exportPng.shared-worker.js +30 -29
- package/package.json +8 -6
- package/dist/components/erd/diff-viewer/tree-viewer/TreeViewer.d.ts +0 -12
- package/dist/components/erd/diff-viewer/tree-viewer/TreeViewer.styles.d.ts +0 -6
- package/dist/components/find-replace/FindReplace.d.ts +0 -13
- package/dist/components/find-replace/FindReplace.styles.d.ts +0 -27
- package/dist/components/find-replace/panelLayout.d.ts +0 -20
- package/dist/konva/batchDraw.d.ts +0 -42
- package/dist/konva/host.d.ts +0 -30
- package/dist/konva/jsx-types.test-d.d.ts +0 -2
- package/dist/loadValue-B3EFSe9k.js +0 -12925
- package/dist/shared-store-fUggY7sI.js +0 -1341
package/README.md
CHANGED
|
@@ -4,155 +4,34 @@
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
`<erd-editor>` is a database-schema editor in
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
[
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
- **
|
|
23
|
-
|
|
24
|
-
- **
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- **
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- **
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
|
188
|
-
|
|
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
|
|
199
|
-
|
|
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
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
`worker-src data:`. Pin a version
|
|
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
|
|
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`;
|
|
244
|
-
| `system-dark-mode` | `systemDarkMode` |
|
|
245
|
-
| `enable-theme-builder` | `enableThemeBuilder` | Shows the theme builder
|
|
246
|
-
| `enable-locale-picker` | `enableLocalePicker` | Shows the
|
|
247
|
-
| `enable-welcome-screen` | `enableWelcomeScreen` | Shows the welcome screen over an empty, editable diagram
|
|
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"
|
|
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
|
|
264
|
-
| `getSchemaSQL(vendor?, options?)` | DDL for one of the
|
|
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
|
|
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)
|
|
271
|
-
| `setSystemLocale(tag)` | Name
|
|
272
|
-
| `setTheme(theme)` | Override theme tokens
|
|
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)
|
|
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
|
|
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
|
|
284
|
-
| `changePresetTheme` | The theme changed in the editor; `event.detail` holds the options
|
|
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
|
|
290
|
-
[collaborator](#collaboration).
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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
|
-
`
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
`
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
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
|
|
327
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
357
|
-
(`Shift`, `Alt`, `Control`, `Meta`, or `$mod
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
`
|
|
364
|
-
|
|
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
|
-
|
|
371
|
-
`
|
|
372
|
-
`
|
|
373
|
-
`
|
|
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
|
-
|
|
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
|
-
|
|
384
|
-
|
|
385
|
-
|
|
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
|
|
391
|
-
webview
|
|
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
|
-
|
|
408
|
-
`
|
|
409
|
-
|
|
410
|
-
|
|
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
|
-
|
|
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
|
-
`
|
|
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
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
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) —
|
|
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
|
|
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
|