@dineug/erd-editor 3.9.2 → 4.0.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 +321 -133
- package/dist/components/appContext.d.ts +4 -0
- package/dist/components/erd/Erd.d.ts +4 -0
- package/dist/components/erd/automatic-table-placement/AutomaticTablePlacement.d.ts +2 -1
- package/dist/components/erd/automatic-table-placement/createAutomaticTablePlacement.d.ts +38 -2
- package/dist/components/erd/automatic-table-placement/elkPlacement.d.ts +42 -0
- package/dist/components/erd/automatic-table-placement/flowPlacement.d.ts +21 -0
- package/dist/components/erd/automatic-table-placement/placementActions.d.ts +14 -0
- package/dist/components/erd/automatic-table-placement/runElkPlacement.d.ts +0 -11
- package/dist/components/erd/canvas/SceneIcon.template.d.ts +2 -2
- package/dist/components/erd/canvas/entityDrag.d.ts +17 -1
- package/dist/components/erd/canvas/middleButtonPan.d.ts +11 -0
- package/dist/components/erd/canvas/relationship-group/relationship/Relationship.d.ts +2 -0
- package/dist/components/erd/canvas/relationship-group/relationship/RelationshipActionLabel.d.ts +32 -0
- package/dist/components/erd/canvas/sceneTokens.d.ts +38 -0
- package/dist/components/erd/canvas/table/Table.d.ts +9 -1
- package/dist/components/erd/canvas/table/cellLayout.d.ts +11 -0
- package/dist/components/erd/canvas/table/column/Column.d.ts +7 -0
- package/dist/components/erd/canvas/table/doubleClick.d.ts +3 -4
- package/dist/components/erd/canvas/table/goToErd.d.ts +3 -10
- package/dist/components/erd/canvas/table-group/TableGroup.d.ts +17 -0
- package/dist/components/erd/canvas/table-group/TableGroupBody.d.ts +17 -0
- package/dist/components/erd/canvas/table-group/TableGroupDropTarget.d.ts +10 -0
- package/dist/components/erd/canvas/table-group/TableGroupSash.d.ts +35 -0
- package/dist/components/erd/canvas/table-group/TableGroups.d.ts +10 -0
- package/dist/components/erd/canvas/table-group/tableGroupBox.d.ts +40 -0
- package/dist/components/erd/canvas/table-group/titleLayout.d.ts +45 -0
- package/dist/components/erd/canvas/useMoveEntity.d.ts +2 -0
- package/dist/components/erd/draw-target/DrawTargetButtons.d.ts +16 -0
- package/dist/components/erd/draw-target/DrawTargetButtons.styles.d.ts +14 -0
- package/dist/components/erd/draw-target/drawTargetState.d.ts +26 -0
- package/dist/components/erd/draw-target/findDrawTarget.d.ts +29 -0
- package/dist/components/erd/draw-target/placePill.d.ts +49 -0
- package/dist/components/erd/erd-context-menu/ErdContextMenu.d.ts +6 -0
- package/dist/components/erd/erd-context-menu/menus/drawRelationshipMenus.d.ts +3 -0
- package/dist/components/erd/erd-context-menu/menus/exportMenus.d.ts +7 -2
- package/dist/components/erd/erd-context-menu/menus/importMenus.d.ts +5 -1
- package/dist/components/erd/erd-context-menu/menus/relationshipMenus.d.ts +16 -1
- package/dist/components/erd/erd-context-menu/menus/showMenus.d.ts +3 -1
- package/dist/components/erd/erd-context-menu/menus/tablePlacementMenus.d.ts +3 -0
- package/dist/components/erd/floating-toolbar/ToolbarCompass.template.d.ts +3 -1
- package/dist/components/erd/goToErdTarget.d.ts +85 -0
- package/dist/components/erd/hitTest.d.ts +16 -1
- package/dist/components/erd/minimap/MinimapScene.d.ts +1 -1
- package/dist/components/erd/minimap/table/Table.d.ts +3 -3
- package/dist/components/erd/minimap/table-group/TableGroup.d.ts +17 -0
- package/dist/components/erd/table-group/TableGroupDraft.d.ts +15 -0
- package/dist/components/erd/table-group/TableGroupDraft.styles.d.ts +6 -0
- package/dist/components/erd/table-group/tableGroupName.d.ts +21 -0
- package/dist/components/erd/table-group/useTableGroupDraw.d.ts +25 -0
- package/dist/components/erd/table-properties/TableProperties.d.ts +2 -0
- package/dist/components/erd/table-properties/TableProperties.styles.d.ts +24 -2
- package/dist/components/erd/table-properties/table-properties-indexes/TablePropertiesIndexes.d.ts +2 -0
- package/dist/components/erd/table-properties/table-properties-indexes/TablePropertiesIndexes.styles.d.ts +32 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-checkbox-column/IndexesCheckboxColumn.d.ts +7 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-checkbox-column/IndexesCheckboxColumn.styles.d.ts +5 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-column/IndexesColumn.d.ts +7 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-column/IndexesColumn.styles.d.ts +3 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-index/IndexesIndex.d.ts +7 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-index/IndexesIndex.styles.d.ts +6 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-key/IndexesKey.d.ts +21 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-key/IndexesKey.styles.d.ts +13 -0
- package/dist/components/erd/table-properties/table-properties-tabs/TablePropertiesTabs.d.ts +3 -0
- package/dist/components/erd/welcome-screen/WelcomeScreen.d.ts +17 -0
- package/dist/components/erd/welcome-screen/WelcomeScreen.styles.d.ts +17 -0
- package/dist/components/erd/welcome-screen/welcome-hints/WelcomeHints.d.ts +21 -0
- package/dist/components/erd/welcome-screen/welcome-hints/WelcomeHints.styles.d.ts +14 -0
- package/dist/components/erd/welcome-screen/welcome-hints/hintArrows.d.ts +10 -0
- package/dist/components/erd/welcome-screen/welcomeLayout.d.ts +87 -0
- package/dist/components/erd-editor/ErdEditor.d.ts +67 -7
- package/dist/components/erd-editor/useErdEditorAttachElement.d.ts +14 -1
- package/dist/components/export-image/ExportImage.d.ts +23 -0
- package/dist/components/export-image/ExportImage.styles.d.ts +34 -0
- package/dist/components/export-image/exportImageActions.d.ts +48 -0
- package/dist/components/find-replace/FindReplace.d.ts +13 -0
- package/dist/components/find-replace/FindReplace.styles.d.ts +27 -0
- package/dist/components/find-replace/fieldIcon.d.ts +5 -0
- package/dist/components/find-replace/matchTarget.d.ts +26 -0
- package/dist/components/find-replace/panelLayout.d.ts +20 -0
- package/dist/components/generator-code/GeneratorCode.d.ts +1 -0
- package/dist/components/generator-code/generator-code-context-menu/GeneratorCodeContextMenu.d.ts +3 -0
- package/dist/components/generator-code/generator-code-context-menu/menus/columnNameCaseMenus.d.ts +3 -0
- package/dist/components/generator-code/generator-code-context-menu/menus/languageMenus.d.ts +8 -0
- package/dist/components/generator-code/generator-code-context-menu/menus/tableNameCaseMenus.d.ts +3 -0
- package/dist/components/generator-code/generator-code-options/GeneratorCodeOptions.d.ts +17 -0
- package/dist/components/generator-code/generator-code-options/GeneratorCodeOptions.styles.d.ts +5 -0
- package/dist/components/generator-code/generatorCodeView.d.ts +12 -0
- package/dist/components/generator-code/languageSettings.d.ts +14 -0
- package/dist/components/locale-picker/LocalePicker.d.ts +13 -0
- package/dist/components/locale-picker/LocalePicker.styles.d.ts +19 -0
- package/dist/components/localeContext.d.ts +10 -0
- package/dist/components/localized/Localized.d.ts +18 -0
- package/dist/components/map-columns/MapColumnsBody.d.ts +24 -0
- package/dist/components/map-columns/MapColumnsDialog.d.ts +13 -0
- package/dist/components/map-columns/MapColumnsDialog.styles.d.ts +38 -0
- package/dist/components/map-columns/mapColumnsAction.d.ts +13 -0
- package/dist/components/map-columns/nameOf.d.ts +6 -0
- package/dist/components/map-columns/openMapColumns.d.ts +9 -0
- package/dist/components/primitives/code-block/CodeBlock.d.ts +6 -1
- package/dist/components/primitives/code-block/CodeBlock.styles.d.ts +2 -0
- package/dist/components/primitives/color-picker/ColorPicker.d.ts +10 -1
- package/dist/components/primitives/color-picker/ColorPicker.styles.d.ts +25 -0
- package/dist/components/primitives/color-picker/colorModel.d.ts +36 -0
- package/dist/components/primitives/color-picker/presetColors.d.ts +13 -0
- package/dist/components/primitives/color-picker/resolveColor.d.ts +7 -0
- package/dist/components/primitives/context-menu/ContextMenu.d.ts +2 -0
- package/dist/components/primitives/context-menu/context-menu-content/ContextMenuContent.d.ts +1 -0
- package/dist/components/primitives/context-menu/context-menu-content/fitMenu.d.ts +4 -4
- package/dist/components/primitives/context-menu/context-menu-separator/ContextMenuSeparator.d.ts +8 -0
- package/dist/components/primitives/context-menu/context-menu-separator/ContextMenuSeparator.styles.d.ts +2 -0
- package/dist/components/primitives/context-menu/menu/Menu.d.ts +2 -0
- package/dist/components/primitives/context-menu/submenu-chevron/SubmenuChevron.d.ts +5 -0
- package/dist/components/primitives/dialog/Dialog.d.ts +21 -0
- package/dist/components/primitives/dialog/Dialog.styles.d.ts +12 -0
- package/dist/components/primitives/highlighted-text/HighlightedText.d.ts +2 -5
- package/dist/components/primitives/icon/icons.d.ts +27 -1
- package/dist/components/primitives/select/Select.d.ts +18 -0
- package/dist/components/primitives/select/Select.styles.d.ts +13 -0
- package/dist/components/primitives/text-input/TextInput.d.ts +2 -0
- package/dist/components/primitives/toast/Toast.d.ts +5 -1
- package/dist/components/primitives/toast/Toast.styles.d.ts +2 -2
- package/dist/components/quick-search/QuickSearch.d.ts +2 -1
- package/dist/components/quick-search/QuickSearch.styles.d.ts +6 -0
- package/dist/components/quick-search/actions.d.ts +60 -2
- package/dist/components/quick-search/hangul.d.ts +79 -0
- package/dist/components/quick-search/paletteQuery.d.ts +38 -0
- package/dist/components/quick-search/scopedActions.d.ts +42 -0
- package/dist/components/schema-sql/SchemaSQL.d.ts +2 -0
- package/dist/components/schema-sql/SchemaSQL.styles.d.ts +7 -0
- package/dist/components/schema-sql/schema-sql-context-menu/SchemaSQLContextMenu.d.ts +3 -0
- package/dist/components/schema-sql/schema-sql-context-menu/menus/bracketMenus.d.ts +3 -0
- package/dist/components/schema-sql/schema-sql-context-menu/menus/headerMenus.d.ts +29 -0
- package/dist/components/schema-sql/schema-sql-context-menu/menus/statementsMenus.d.ts +27 -0
- package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.d.ts +24 -0
- package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.styles.d.ts +45 -0
- package/dist/components/schema-sql/schema-sql-options/ScriptEditor.d.ts +20 -0
- package/dist/components/schema-sql/schema-sql-options/ScriptEditor.styles.d.ts +13 -0
- package/dist/components/schema-sql/schema-sql-options/dropWarning.d.ts +8 -0
- package/dist/components/schema-sql/schemaSQLView.d.ts +71 -0
- package/dist/components/settings/Settings.styles.d.ts +7 -0
- package/dist/components/settings/columnTypeLabels.d.ts +8 -0
- package/dist/components/settings/lockSettingRows.d.ts +16 -0
- package/dist/components/settings/settings-lnb/SettingsLnb.d.ts +3 -0
- package/dist/components/settings/settingsPage.d.ts +10 -0
- package/dist/components/theme-builder/ThemeBuilder.d.ts +9 -1
- package/dist/components/theme-builder/ThemeBuilder.styles.d.ts +8 -5
- package/dist/components/toast-container/openStatusToast.d.ts +29 -0
- package/dist/components/toast-container/openToastWhileRunning.d.ts +1 -1
- package/dist/components/toolbar/Toolbar.d.ts +1 -0
- package/dist/components/visualization/graph-node/GraphNode.d.ts +2 -2
- package/dist/components/visualization/graphPan.d.ts +12 -0
- package/dist/components/visualization/table/column/Column.d.ts +4 -0
- package/dist/components/visualization/visualizationView.d.ts +2 -2
- package/dist/constants/language.d.ts +1 -1
- package/dist/constants/layout.d.ts +47 -0
- package/dist/constants/open.d.ts +4 -0
- package/dist/constants/schema.d.ts +38 -4
- package/dist/constants/sql/dataType/PostgreSQL.d.ts +2 -1
- package/dist/constants/sql/dataType/SQLite.d.ts +3 -1
- package/dist/engine/actions.d.ts +20 -2
- package/dist/engine/context.d.ts +6 -0
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +29 -18
- package/dist/engine/modules/editor/actions.d.ts +10 -2
- package/dist/engine/modules/editor/atom.actions.d.ts +49 -11
- package/dist/engine/modules/editor/generator.actions.d.ts +107 -8
- package/dist/engine/modules/editor/state.d.ts +16 -3
- package/dist/engine/modules/editor/utils/color.d.ts +21 -0
- package/dist/engine/modules/editor/utils/duplicate.d.ts +28 -1
- package/dist/engine/modules/editor/utils/focus.d.ts +16 -0
- package/dist/engine/modules/editor/utils/releaseHidden.d.ts +16 -0
- package/dist/engine/modules/editor/utils/selection.d.ts +12 -0
- package/dist/engine/modules/relationship/actions.d.ts +19 -0
- package/dist/engine/modules/relationship/atom.actions.d.ts +111 -1
- package/dist/engine/modules/relationship/endFlags.d.ts +14 -0
- package/dist/engine/modules/relationship/fkColumns.d.ts +40 -4
- package/dist/engine/modules/relationship/generator.actions.d.ts +5 -2
- package/dist/engine/modules/relationship/history.d.ts +3 -0
- package/dist/engine/modules/relationship/referenceType.d.ts +12 -0
- package/dist/engine/modules/settings/actions.d.ts +17 -4
- package/dist/engine/modules/settings/atom.actions.d.ts +63 -19
- package/dist/engine/modules/settings/generator.actions.d.ts +7 -0
- package/dist/engine/modules/settings/history.d.ts +1 -0
- package/dist/engine/modules/table/actions.d.ts +8 -0
- package/dist/engine/modules/table/atom.actions.d.ts +31 -0
- package/dist/engine/modules/table/generator.actions.d.ts +3 -3
- package/dist/engine/modules/table/history.d.ts +1 -0
- package/dist/engine/modules/table-column/generator.actions.d.ts +8 -0
- package/dist/engine/modules/table-column/keys.d.ts +14 -0
- package/dist/engine/modules/table-column/utils/dataType.d.ts +19 -1
- package/dist/engine/modules/table-group/actions.d.ts +63 -0
- package/dist/engine/modules/table-group/atom.actions.d.ts +238 -0
- package/dist/engine/modules/table-group/generator.actions.d.ts +111 -0
- package/dist/engine/modules/table-group/history.d.ts +13 -0
- package/dist/engine/peer-store.d.ts +9 -3
- package/dist/engine/replication-store.d.ts +18 -1
- package/dist/engine/rx-operators/groupByStreamActions.d.ts +5 -1
- package/dist/engine/rx-operators/lockIgnoreFilter.d.ts +8 -0
- package/dist/engine/rx-store.d.ts +2 -0
- package/dist/engine/settle.d.ts +9 -0
- package/dist/erd-editor.umd.js +2523 -4060
- package/dist/hooks/useNavigatorLanguages.d.ts +7 -0
- package/dist/i18n/locales.d.ts +126 -0
- package/dist/i18n/menuLabel.d.ts +12 -0
- package/dist/i18n/messages/ar-SA.d.ts +399 -0
- package/dist/i18n/messages/de-DE.d.ts +375 -0
- package/dist/i18n/messages/en/code.d.ts +17 -0
- package/dist/i18n/messages/en/colorPicker.d.ts +35 -0
- package/dist/i18n/messages/en/common.d.ts +65 -0
- package/dist/i18n/messages/en/contextMenu.d.ts +29 -0
- package/dist/i18n/messages/en/exportImage.d.ts +25 -0
- package/dist/i18n/messages/en/feedback.d.ts +11 -0
- package/dist/i18n/messages/en/findReplace.d.ts +36 -0
- package/dist/i18n/messages/en/floatingToolbar.d.ts +12 -0
- package/dist/i18n/messages/en/index.d.ts +378 -0
- package/dist/i18n/messages/en/mapColumns.d.ts +39 -0
- package/dist/i18n/messages/en/palette.d.ts +40 -0
- package/dist/i18n/messages/en/schemaSql.d.ts +28 -0
- package/dist/i18n/messages/en/settings.d.ts +22 -0
- package/dist/i18n/messages/en/shortcuts.d.ts +32 -0
- package/dist/i18n/messages/en/tableProperties.d.ts +34 -0
- package/dist/i18n/messages/en/themeBuilder.d.ts +7 -0
- package/dist/i18n/messages/en/toolbar.d.ts +9 -0
- package/dist/i18n/messages/en/visualization.d.ts +12 -0
- package/dist/i18n/messages/en/welcome.d.ts +13 -0
- package/dist/i18n/messages/es-ES.d.ts +381 -0
- package/dist/i18n/messages/eu-ES.d.ts +375 -0
- package/dist/i18n/messages/fa-IR.d.ts +375 -0
- package/dist/i18n/messages/fr-FR.d.ts +381 -0
- package/dist/i18n/messages/he-IL.d.ts +381 -0
- package/dist/i18n/messages/id-ID.d.ts +369 -0
- package/dist/i18n/messages/index.d.ts +11 -0
- package/dist/i18n/messages/it-IT.d.ts +381 -0
- package/dist/i18n/messages/ja-JP.d.ts +369 -0
- package/dist/i18n/messages/ko-KR.d.ts +369 -0
- package/dist/i18n/messages/nl-NL.d.ts +375 -0
- package/dist/i18n/messages/pl-PL.d.ts +387 -0
- package/dist/i18n/messages/pt-BR.d.ts +381 -0
- package/dist/i18n/messages/pt-PT.d.ts +381 -0
- package/dist/i18n/messages/ro-RO.d.ts +381 -0
- package/dist/i18n/messages/ru-RU.d.ts +387 -0
- package/dist/i18n/messages/sk-SK.d.ts +387 -0
- package/dist/i18n/messages/sl-SI.d.ts +387 -0
- package/dist/i18n/messages/sv-SE.d.ts +375 -0
- package/dist/i18n/messages/tr-TR.d.ts +375 -0
- package/dist/i18n/messages/uk-UA.d.ts +387 -0
- package/dist/i18n/messages/zh-CN.d.ts +369 -0
- package/dist/i18n/messages/zh-TW.d.ts +369 -0
- package/dist/i18n/resolveLocale.d.ts +11 -0
- package/dist/i18n/source.d.ts +7 -0
- package/dist/i18n/translate.d.ts +58 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +28966 -11220
- package/dist/internal-types/index.d.ts +2 -4
- package/dist/konva/scene/contentBounds.d.ts +18 -12
- package/dist/konva/scene/metrics.d.ts +7 -0
- package/dist/konva/scene/renderScene.d.ts +10 -4
- package/dist/konva/scene/stacking.d.ts +21 -0
- package/dist/konva/scene/viewLayout.d.ts +2 -1
- package/dist/loadValue-B3EFSe9k.js +12925 -0
- package/dist/peer/index.d.ts +6 -3
- package/dist/peer/index.js +87 -83
- package/dist/services/elk-layout/elkGraph.d.ts +6 -4
- package/dist/services/elk-layout/elkLayoutOptions.d.ts +20 -0
- package/dist/services/elk-layout/elkLayoutService.d.ts +3 -3
- package/dist/services/export-png/ExportScene.d.ts +3 -3
- package/dist/services/export-png/documentScene.d.ts +14 -9
- package/dist/services/export-png/exportBox.d.ts +40 -5
- package/dist/services/export-png/exportPngService.d.ts +15 -0
- package/dist/services/export-png/exportTheme.d.ts +26 -0
- package/dist/services/export-png/index.d.ts +44 -11
- package/dist/services/export-png/renderPng.d.ts +18 -10
- package/dist/services/export-png/renderSvg.d.ts +22 -0
- package/dist/services/export-png/sceneSvg.d.ts +54 -0
- package/dist/services/shiki/graphqlGrammar.d.ts +8 -0
- package/dist/shared-store-fUggY7sI.js +1341 -0
- package/dist/themes/radix-ui-theme.d.ts +11 -3
- package/dist/themes/tokens.d.ts +9 -0
- package/dist/utils/calcTable.d.ts +18 -1
- package/dist/utils/clipboard.d.ts +9 -0
- package/dist/utils/collection/tableGroup.entity.d.ts +3 -0
- package/dist/utils/contrastText.d.ts +21 -0
- package/dist/utils/deepMerge.d.ts +8 -0
- package/dist/utils/device-detect/index.d.ts +2 -6
- package/dist/utils/domEvent.d.ts +18 -0
- package/dist/utils/dragSelect.d.ts +2 -0
- package/dist/utils/draw-relationship/bezier.d.ts +2 -0
- package/dist/utils/draw-relationship/corner.d.ts +9 -0
- package/dist/utils/draw-relationship/index.d.ts +18 -18
- package/dist/utils/draw-relationship/loop.d.ts +29 -0
- package/dist/utils/draw-relationship/pathFinding.d.ts +1 -1
- package/dist/utils/draw-relationship/sort.d.ts +8 -1
- package/dist/utils/draw-relationship/stub.d.ts +4 -3
- package/dist/utils/emitter.d.ts +64 -4
- package/dist/utils/file/exportFile.d.ts +15 -5
- package/dist/utils/file/importFile.d.ts +9 -5
- package/dist/utils/file/importSchema.d.ts +45 -0
- package/dist/utils/find-replace/findMatches.d.ts +90 -0
- package/dist/utils/find-replace/index.d.ts +5 -0
- package/dist/utils/find-replace/matcher.d.ts +53 -0
- package/dist/utils/find-replace/present.d.ts +24 -0
- package/dist/utils/find-replace/replaceActions.d.ts +20 -0
- package/dist/utils/generator-code/columnTypes.d.ts +99 -0
- package/dist/utils/generator-code/doctrine.d.ts +6 -0
- package/dist/utils/generator-code/doctrineReservedWords.d.ts +7 -0
- package/dist/utils/generator-code/graphql.d.ts +6 -0
- package/dist/utils/generator-code/heck.d.ts +5 -0
- package/dist/utils/generator-code/java.d.ts +28 -0
- package/dist/utils/generator-code/jsonSchema.d.ts +50 -0
- package/dist/utils/generator-code/jsonShape.d.ts +37 -0
- package/dist/utils/generator-code/kotlin.d.ts +1 -0
- package/dist/utils/generator-code/mermaid.d.ts +5 -0
- package/dist/utils/generator-code/php.d.ts +28 -0
- package/dist/utils/generator-code/rust.d.ts +13 -0
- package/dist/utils/generator-code/rustTypes.d.ts +44 -0
- package/dist/utils/generator-code/scala.d.ts +1 -0
- package/dist/utils/generator-code/seaorm.d.ts +22 -0
- package/dist/utils/generator-code/swift.d.ts +44 -0
- package/dist/utils/generator-code/utils.d.ts +31 -1
- package/dist/utils/generator-code/zod.d.ts +25 -0
- package/dist/utils/globalEventObservable.d.ts +10 -1
- package/dist/utils/highlightWords.d.ts +29 -0
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/keyboard-shortcut/bindKeys.d.ts +9 -0
- package/dist/utils/keyboard-shortcut/index.d.ts +15 -1
- package/dist/utils/keyboard-shortcut/utils.d.ts +21 -0
- package/dist/utils/loadValue.d.ts +7 -0
- package/dist/utils/map-columns/alignTypes.d.ts +37 -0
- package/dist/utils/map-columns/buildRows.d.ts +102 -0
- package/dist/utils/map-columns/candidateKeys.d.ts +24 -0
- package/dist/utils/map-columns/index.d.ts +8 -0
- package/dist/utils/map-columns/mapping.d.ts +67 -0
- package/dist/utils/map-columns/prefill.d.ts +26 -0
- package/dist/utils/map-columns/toMapColumnsActions.d.ts +10 -0
- package/dist/utils/map-columns/validate.d.ts +45 -0
- package/dist/utils/memo.d.ts +4 -0
- package/dist/utils/referentialAction.d.ts +21 -0
- package/dist/utils/schema-aml-parser/types.d.ts +8 -0
- package/dist/utils/schema-dbml-parser/tokenizer.d.ts +2 -0
- package/dist/utils/schema-dbml-parser/types.d.ts +14 -0
- package/dist/utils/schema-sql/Databricks.d.ts +13 -3
- package/dist/utils/schema-sql/MSSQL.d.ts +19 -2
- package/dist/utils/schema-sql/MariaDB.d.ts +10 -4
- package/dist/utils/schema-sql/MySQL.d.ts +18 -4
- package/dist/utils/schema-sql/Oracle.d.ts +23 -4
- package/dist/utils/schema-sql/PostgreSQL.d.ts +16 -4
- package/dist/utils/schema-sql/SQLite.d.ts +16 -4
- package/dist/utils/schema-sql/Snowflake.d.ts +8 -3
- package/dist/utils/schema-sql/index.d.ts +21 -1
- package/dist/utils/schema-sql/options.d.ts +57 -0
- package/dist/utils/schema-sql/utils.d.ts +120 -2
- package/dist/utils/schema-sql-parser/index.d.ts +5 -1
- package/dist/utils/stageCursor.d.ts +20 -0
- package/dist/utils/table-clipboard/payload.d.ts +3 -0
- package/dist/utils/table-clipboard/placement.d.ts +2 -0
- package/dist/utils/tableColor.d.ts +29 -0
- package/dist/utils/tableGroup.d.ts +142 -0
- package/dist/utils/tableKeys.d.ts +54 -0
- package/dist/workers/elkLayout.shared-worker.js +1 -1
- package/dist/workers/exportPng.shared-worker.js +30 -28
- package/dist/workers/shiki.shared-worker.js +1 -1
- package/dist/workers/spawn.d.ts +1 -2
- package/dist/workers/spawn.inline.d.ts +0 -1
- package/package.json +12 -18
- package/dist/components/generator-code/GeneratorCode.styles.d.ts +0 -2
- package/dist/schemaGCService-BagQ1wfF.js +0 -38
- package/dist/services/schema-gc/index.d.ts +0 -18
- package/dist/services/schema-gc/procGC.d.ts +0 -4
- package/dist/services/schema-gc/schemaGC.shared-worker.d.ts +0 -2
- package/dist/services/schema-gc/schemaGCService.d.ts +0 -5
- package/dist/shared-store-BqPSXAEf.js +0 -1072
- package/dist/store-hooks-DuzDVhPy.js +0 -10282
- package/dist/styles/colorPicker.style.d.ts +0 -7
- package/dist/utils/draw-relationship/chamfer.d.ts +0 -3
- package/dist/workers/schemaGC.shared-worker.js +0 -1
package/README.md
CHANGED
|
@@ -2,29 +2,157 @@
|
|
|
2
2
|
|
|
3
3
|
> Entity-Relationship Diagram Editor as a custom element
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
|
-
`<erd-editor>` is a
|
|
8
|
-
|
|
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 —
|
|
9
10
|
React, Vue, Svelte, or plain HTML — without leaking styles either way.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
[
|
|
13
|
-
|
|
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
|
|
14
|
+
[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
|
|
16
|
+
[Obsidian plugin](https://community.obsidian.md/plugins/erd-editor).
|
|
14
17
|
|
|
15
18
|
## Features
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
28
156
|
|
|
29
157
|
## Install
|
|
30
158
|
|
|
@@ -32,13 +160,11 @@ and the [IntelliJ plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor)
|
|
|
32
160
|
npm install @dineug/erd-editor
|
|
33
161
|
```
|
|
34
162
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
`
|
|
40
|
-
files beside your chunks; a strict CSP needs `worker-src 'self'`. Without a bundler, use the UMD
|
|
41
|
-
file described under [Script tag](#script-tag) instead.
|
|
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
168
|
|
|
43
169
|
## Usage
|
|
44
170
|
|
|
@@ -46,23 +172,20 @@ file described under [Script tag](#script-tag) instead.
|
|
|
46
172
|
import '@dineug/erd-editor';
|
|
47
173
|
|
|
48
174
|
const editor = document.createElement('erd-editor');
|
|
49
|
-
//
|
|
175
|
+
// a custom element is inline, and the editor fills its box
|
|
50
176
|
Object.assign(editor.style, { display: 'block', width: '100%', height: '100vh' });
|
|
51
177
|
document.body.appendChild(editor);
|
|
52
178
|
|
|
53
|
-
// load a document without adding an undo entry, then keep it in sync
|
|
54
179
|
editor.setInitialValue(localStorage.getItem('my-diagram') ?? '');
|
|
55
180
|
editor.addEventListener('change', () => {
|
|
56
181
|
localStorage.setItem('my-diagram', editor.value);
|
|
57
182
|
});
|
|
58
183
|
```
|
|
59
184
|
|
|
60
|
-
`setInitialValue('')` starts an empty document.
|
|
61
|
-
|
|
62
185
|
### Server-side rendering
|
|
63
186
|
|
|
64
|
-
Importing the package registers the
|
|
65
|
-
|
|
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:
|
|
66
189
|
|
|
67
190
|
```js
|
|
68
191
|
useEffect(() => {
|
|
@@ -72,202 +195,267 @@ useEffect(() => {
|
|
|
72
195
|
|
|
73
196
|
### Vite
|
|
74
197
|
|
|
75
|
-
In development Vite
|
|
76
|
-
|
|
77
|
-
|
|
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.
|
|
78
201
|
|
|
79
202
|
```js
|
|
80
203
|
// vite.config.js
|
|
81
204
|
export default {
|
|
82
205
|
optimizeDeps: {
|
|
83
206
|
exclude: ['@dineug/erd-editor'],
|
|
207
|
+
include: ['@dineug/erd-editor > elkjs/lib/elk.bundled.js'],
|
|
84
208
|
},
|
|
85
209
|
};
|
|
86
210
|
```
|
|
87
211
|
|
|
88
212
|
### Script tag
|
|
89
213
|
|
|
90
|
-
`dist/erd-editor.umd.js
|
|
91
|
-
|
|
92
|
-
|
|
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.
|
|
93
218
|
|
|
94
219
|
```html
|
|
95
220
|
<erd-editor style="display: block; width: 100%; height: 100vh"></erd-editor>
|
|
96
221
|
<script src="https://cdn.jsdelivr.net/npm/@dineug/erd-editor/dist/erd-editor.umd.js"></script>
|
|
97
222
|
```
|
|
98
223
|
|
|
99
|
-
The workers travel inside the file as `data:` URLs, so a strict CSP needs `worker-src data:`
|
|
100
|
-
for this build. Pin a version in the URL for anything beyond a demo.
|
|
101
|
-
|
|
102
224
|
### HTML
|
|
103
225
|
|
|
226
|
+
In a page a bundler serves:
|
|
227
|
+
|
|
104
228
|
```html
|
|
105
|
-
<erd-editor system-dark-mode
|
|
229
|
+
<erd-editor system-dark-mode style="display: block; height: 100vh"></erd-editor>
|
|
106
230
|
<script type="module">
|
|
107
231
|
import '@dineug/erd-editor';
|
|
108
|
-
|
|
109
|
-
const editor = document.querySelector('erd-editor');
|
|
110
232
|
</script>
|
|
111
233
|
```
|
|
112
234
|
|
|
113
|
-
```css
|
|
114
|
-
erd-editor {
|
|
115
|
-
display: block;
|
|
116
|
-
width: 100%;
|
|
117
|
-
height: 100vh;
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
235
|
## API
|
|
122
236
|
|
|
237
|
+
The package exports the element's type as `ErdEditorElement`.
|
|
238
|
+
|
|
123
239
|
### Attributes
|
|
124
240
|
|
|
125
241
|
| Attribute | Property | Description |
|
|
126
242
|
| --- | --- | --- |
|
|
127
|
-
| `readonly` | `readonly` | Blocks editing and
|
|
128
|
-
| `system-dark-mode` | `systemDarkMode` |
|
|
129
|
-
| `enable-theme-builder` | `enableThemeBuilder` | Shows the
|
|
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. |
|
|
248
|
+
|
|
249
|
+
An attribute is on when present with no value or `"true"`, off for any other value (`"false"`,
|
|
250
|
+
`"readonly"`).
|
|
130
251
|
|
|
131
252
|
### Properties
|
|
132
253
|
|
|
133
254
|
| Property | Description |
|
|
134
255
|
| --- | --- |
|
|
135
|
-
| `value: string` | The document as
|
|
256
|
+
| `value: string` | The document as a file saves it ([schema](https://github.com/dineug/erd-editor/blob/main/json-schema/schema.json)). Assigning one, or `''` for a new one, is an undoable load. |
|
|
257
|
+
| `runtimeValue: string` | Read only. The document as this editor holds it, to seed a collaborator. |
|
|
136
258
|
|
|
137
259
|
### Methods
|
|
138
260
|
|
|
139
261
|
| Method | Description |
|
|
140
262
|
| --- | --- |
|
|
141
|
-
| `setInitialValue(value
|
|
142
|
-
| `getSchemaSQL(vendor?)` |
|
|
143
|
-
| `setSchemaSQL(value
|
|
144
|
-
| `
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
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. |
|
|
265
|
+
| `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
|
+
| `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. |
|
|
268
|
+
| `setPresetTheme(options)` | Set `appearance` (`light`, `dark`, `system`), `grayColor` and `accentColor`. |
|
|
269
|
+
| `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`. |
|
|
273
|
+
| `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`. |
|
|
275
|
+
| `focus()` / `blur()` | Move focus in or out. |
|
|
276
|
+
| `clear()` | Empty the document and keep its settings; one undo brings it back. |
|
|
277
|
+
| `destroy()` | Release the editor's listeners, subscriptions and shared stores. |
|
|
155
278
|
|
|
156
279
|
### Events
|
|
157
280
|
|
|
158
281
|
| Event | Description |
|
|
159
282
|
| --- | --- |
|
|
160
|
-
| `change` | The document changed
|
|
161
|
-
| `changePresetTheme` | The theme
|
|
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). |
|
|
285
|
+
| `changeLocale` | A language was picked in the editor; `event.detail.locale` holds it. |
|
|
162
286
|
|
|
163
|
-
|
|
287
|
+
### Loading and saving
|
|
288
|
+
|
|
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.
|
|
305
|
+
|
|
306
|
+
### Importing a schema
|
|
307
|
+
|
|
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.
|
|
323
|
+
|
|
324
|
+
### Theme and language
|
|
164
325
|
|
|
165
|
-
`
|
|
166
|
-
|
|
167
|
-
|
|
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.
|
|
330
|
+
|
|
331
|
+
## Collaboration
|
|
332
|
+
|
|
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:
|
|
168
335
|
|
|
169
336
|
```js
|
|
170
|
-
|
|
337
|
+
joiner.setInitialValue(editor.runtimeValue);
|
|
171
338
|
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
339
|
+
const local = editor.getSharedStore();
|
|
340
|
+
const remote = joiner.getSharedStore();
|
|
341
|
+
local.subscribe(actions => remote.dispatch(actions));
|
|
342
|
+
remote.subscribe(actions => local.dispatch(actions));
|
|
175
343
|
```
|
|
176
344
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
is focused. The `KeyBindingMap`, `KeyBindingName` and `ShortcutOption` types come with it.
|
|
345
|
+
An editor never forwards what it received, so with three or more, send each one's batches to every
|
|
346
|
+
other.
|
|
180
347
|
|
|
181
|
-
|
|
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.
|
|
182
353
|
|
|
183
|
-
|
|
184
|
-
worker of its own. There is nothing to install or register: the worker is built the first time a
|
|
185
|
-
code panel renders, so a page that opens none never fetches the grammars.
|
|
354
|
+
## Key bindings
|
|
186
355
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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.
|
|
367
|
+
|
|
368
|
+
## Display language
|
|
369
|
+
|
|
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
|
|
191
377
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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).
|
|
195
382
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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.
|
|
199
387
|
|
|
200
388
|
## File dialogs
|
|
201
389
|
|
|
202
|
-
Import and export go through
|
|
203
|
-
|
|
204
|
-
the finished file, while import only asks for one, and you push the content back in yourself.
|
|
390
|
+
Import and export go through page-wide callbacks, so a host without a browser file dialog (an IDE
|
|
391
|
+
webview) supplies its own:
|
|
205
392
|
|
|
206
393
|
```js
|
|
207
394
|
import { setExportFileCallback, setImportFileCallback } from '@dineug/erd-editor';
|
|
208
395
|
|
|
209
396
|
setExportFileCallback((blob, { fileName }) => host.writeFile(fileName, blob));
|
|
210
397
|
|
|
211
|
-
setImportFileCallback(async ({ type, op, accept }) => {
|
|
398
|
+
setImportFileCallback(async ({ type, op, accept, mode }) => {
|
|
212
399
|
const text = await host.pickFile(accept);
|
|
213
|
-
|
|
214
|
-
if (
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
editor.value = text;
|
|
218
|
-
} else if (type === 'sql') {
|
|
219
|
-
editor.setSchemaSQL(text);
|
|
220
|
-
} else if (type === 'graphql') {
|
|
221
|
-
editor.setSchemaGraphQL(text);
|
|
222
|
-
} else if (type === 'dbml') {
|
|
223
|
-
editor.setSchemaDBML(text);
|
|
224
|
-
} else if (type === 'aml') {
|
|
225
|
-
editor.setSchemaAML(text);
|
|
226
|
-
}
|
|
400
|
+
if (op === 'diff') return editor.setDiffValue(text);
|
|
401
|
+
if (type === 'json') return editor.setSchemaJSON(text, { mode });
|
|
402
|
+
const format = { sql: 'SQL', graphql: 'GraphQL', dbml: 'DBML', aml: 'AML' }[type];
|
|
403
|
+
if (format) editor[`setSchema${format}`](text, { placement: 'auto', mode });
|
|
227
404
|
});
|
|
228
405
|
```
|
|
229
406
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
Left unset, the editor uses the browser's own download and file-picker behavior.
|
|
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.
|
|
237
413
|
|
|
238
414
|
## Headless replica
|
|
239
415
|
|
|
240
|
-
|
|
241
|
-
action stream and serialize the result off the main thread:
|
|
416
|
+
The `engine.js` replica takes the same actions with no DOM:
|
|
242
417
|
|
|
243
418
|
```js
|
|
244
419
|
import { createReplicationStore } from '@dineug/erd-editor/engine.js';
|
|
245
420
|
|
|
246
|
-
|
|
247
|
-
const store = createReplicationStore({ toWidth });
|
|
248
|
-
|
|
421
|
+
const store = createReplicationStore({ toWidth }); // a worker has no DOM to measure text
|
|
249
422
|
store.setInitialValue(savedJson);
|
|
250
|
-
store.on({ change: () => persist(
|
|
251
|
-
store.dispatch(actions);
|
|
423
|
+
store.on({ change: ({ value, changed }) => changed && persist(value) });
|
|
424
|
+
store.dispatch(actions);
|
|
252
425
|
```
|
|
253
426
|
|
|
254
|
-
|
|
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.
|
|
255
432
|
|
|
256
|
-
|
|
257
|
-
|
|
433
|
+
### Headless peer
|
|
434
|
+
|
|
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.
|
|
439
|
+
|
|
440
|
+
## Development
|
|
258
441
|
|
|
259
442
|
```sh
|
|
260
|
-
pnpm --filter @dineug/erd-editor dev #
|
|
443
|
+
pnpm --filter @dineug/erd-editor dev # dev server, workspace deps built first
|
|
261
444
|
pnpm --filter @dineug/erd-editor dev:storybook # component playground
|
|
262
445
|
pnpm exec vp run --filter @dineug/erd-editor --fail-if-no-match test
|
|
263
446
|
pnpm --filter @dineug/erd-editor e2e # Playwright
|
|
264
447
|
```
|
|
265
448
|
|
|
449
|
+
What a change runs and carries is in
|
|
450
|
+
[AGENTS.md](https://github.com/dineug/erd-editor/blob/main/packages/erd-editor/AGENTS.md).
|
|
451
|
+
|
|
266
452
|
## Documentation
|
|
267
453
|
|
|
454
|
+
- [Editing Guide](https://docs.erd-editor.io/docs/category/guides) — editing, import and export,
|
|
455
|
+
relationships, quick search, visualization, code generation, settings
|
|
456
|
+
- [Element API](https://docs.erd-editor.io/docs/api/erd-editor-element) — the `<erd-editor>`
|
|
457
|
+
element's API
|
|
268
458
|
- [Documentation](https://docs.erd-editor.io)
|
|
269
|
-
- [Editing Guide](https://docs.erd-editor.io/docs/category/guides)
|
|
270
|
-
- [Element API](https://docs.erd-editor.io/docs/api/erd-editor-element)
|
|
271
459
|
|
|
272
460
|
## Issues
|
|
273
461
|
|
|
@@ -15,6 +15,10 @@ export type AppContext = EngineContext & {
|
|
|
15
15
|
}>;
|
|
16
16
|
keydown$: Subject<KeyboardEvent>;
|
|
17
17
|
emitter: Emitter;
|
|
18
|
+
/** Set once appDestroy has run, so a render it sets off knows nothing is left to read. */
|
|
19
|
+
lifecycle: {
|
|
20
|
+
destroyed: boolean;
|
|
21
|
+
};
|
|
18
22
|
};
|
|
19
23
|
export type InjectAppContext = InjectEngineContext;
|
|
20
24
|
export type AppContextOptions = RxStoreOptions & {
|