@dineug/erd-editor 3.10.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -158
- package/dist/components/appContext.d.ts +4 -0
- package/dist/components/erd/Erd.d.ts +3 -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/DiffOutline.template.d.ts +14 -0
- 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/sceneTokens.d.ts +40 -0
- package/dist/components/erd/canvas/table/Table.d.ts +9 -1
- package/dist/components/erd/canvas/table/doubleClick.d.ts +3 -4
- 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/diff-viewer/diff-tree/DiffTree.d.ts +19 -0
- package/dist/components/erd/diff-viewer/diff-tree/DiffTree.styles.d.ts +12 -0
- package/dist/components/erd/diff-viewer/diff-tree/diffTreeModel.d.ts +49 -0
- package/dist/components/erd/diff-viewer/diff.d.ts +21 -19
- 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 +47 -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 +6 -2
- 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/FloatingToolbar.d.ts +7 -4
- package/dist/components/erd/floating-toolbar/ToolbarCompass.template.d.ts +3 -1
- package/dist/components/erd/goToErdTarget.d.ts +40 -16
- 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/relationshipHighlight.d.ts +18 -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.styles.d.ts +2 -2
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-key/IndexesKey.d.ts +6 -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 +19 -0
- package/dist/components/erd/welcome-screen/welcome-hints/hintArrows.d.ts +10 -0
- package/dist/components/erd/welcome-screen/welcomeLayout.d.ts +91 -0
- package/dist/components/erd-editor/ErdEditor.d.ts +66 -6
- package/dist/components/erd-editor/ErdEditor.styles.d.ts +4 -0
- package/dist/components/erd-editor/useErdEditorAttachElement.d.ts +14 -1
- 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 +90 -0
- package/dist/components/explorer/explorerView.d.ts +54 -0
- package/dist/components/{find-replace → explorer}/matchTarget.d.ts +5 -7
- 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/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 +24 -3
- package/dist/components/primitives/sash/Sash.d.ts +1 -0
- 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/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.d.ts +2 -1
- package/dist/components/quick-search/QuickSearch.styles.d.ts +1 -0
- package/dist/components/quick-search/actions.d.ts +39 -7
- package/dist/components/quick-search/hangul.d.ts +16 -10
- package/dist/components/quick-search/paletteList.d.ts +7 -0
- package/dist/components/quick-search/paletteQuery.d.ts +5 -4
- package/dist/components/quick-search/scopedActions.d.ts +10 -15
- 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 +7 -4
- 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/toolbar/Toolbar.styles.d.ts +0 -1
- package/dist/components/visualization/graph-node/GraphNode.d.ts +2 -2
- package/dist/components/visualization/graphPan.d.ts +12 -0
- package/dist/components/visualization/visualizationView.d.ts +2 -2
- package/dist/constants/language.d.ts +1 -1
- package/dist/constants/layout.d.ts +41 -1
- package/dist/constants/open.d.ts +3 -1
- package/dist/constants/schema.d.ts +25 -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.js +26 -21
- 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 +6 -0
- package/dist/engine/modules/relationship/atom.actions.d.ts +57 -1
- package/dist/engine/modules/relationship/endFlags.d.ts +14 -0
- package/dist/engine/modules/relationship/fkColumns.d.ts +25 -6
- package/dist/engine/modules/relationship/history.d.ts +1 -0
- package/dist/engine/modules/relationship/hooks.d.ts +0 -11
- 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/hooks.d.ts +0 -6
- 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 +6 -3
- 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/engine/store-hooks.d.ts +0 -8
- package/dist/erd-editor.umd.js +2350 -4222
- 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 +425 -0
- package/dist/i18n/messages/de-DE.d.ts +405 -0
- package/dist/i18n/messages/en/code.d.ts +16 -0
- package/dist/i18n/messages/en/colorPicker.d.ts +35 -0
- package/dist/i18n/messages/en/common.d.ts +64 -0
- package/dist/i18n/messages/en/contextMenu.d.ts +29 -0
- package/dist/i18n/messages/en/explorer.d.ts +37 -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 +40 -0
- package/dist/i18n/messages/en/floatingToolbar.d.ts +12 -0
- package/dist/i18n/messages/en/index.d.ts +408 -0
- package/dist/i18n/messages/en/mapColumns.d.ts +39 -0
- package/dist/i18n/messages/en/palette.d.ts +34 -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 +34 -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 +8 -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 +410 -0
- package/dist/i18n/messages/eu-ES.d.ts +405 -0
- package/dist/i18n/messages/fa-IR.d.ts +405 -0
- package/dist/i18n/messages/fr-FR.d.ts +410 -0
- package/dist/i18n/messages/he-IL.d.ts +410 -0
- package/dist/i18n/messages/id-ID.d.ts +400 -0
- package/dist/i18n/messages/index.d.ts +11 -0
- package/dist/i18n/messages/it-IT.d.ts +410 -0
- package/dist/i18n/messages/ja-JP.d.ts +400 -0
- package/dist/i18n/messages/ko-KR.d.ts +400 -0
- package/dist/i18n/messages/nl-NL.d.ts +405 -0
- package/dist/i18n/messages/pl-PL.d.ts +415 -0
- package/dist/i18n/messages/pt-BR.d.ts +410 -0
- package/dist/i18n/messages/pt-PT.d.ts +410 -0
- package/dist/i18n/messages/ro-RO.d.ts +410 -0
- package/dist/i18n/messages/ru-RU.d.ts +415 -0
- package/dist/i18n/messages/sk-SK.d.ts +415 -0
- package/dist/i18n/messages/sl-SI.d.ts +415 -0
- package/dist/i18n/messages/sv-SE.d.ts +405 -0
- package/dist/i18n/messages/tr-TR.d.ts +405 -0
- package/dist/i18n/messages/uk-UA.d.ts +415 -0
- package/dist/i18n/messages/zh-CN.d.ts +400 -0
- package/dist/i18n/messages/zh-TW.d.ts +400 -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 +31169 -12611
- 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 +2 -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-BKvXDYoC.js +12925 -0
- package/dist/peer/index.d.ts +6 -3
- package/dist/peer/index.js +82 -75
- 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-2IUOt99m.js +1341 -0
- package/dist/styles/scrollbar.styles.d.ts +1 -1
- package/dist/themes/radix-ui-theme.d.ts +11 -3
- package/dist/themes/tokens.d.ts +18 -4
- package/dist/utils/calcTable.d.ts +9 -0
- 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/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 +77 -0
- 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 +53 -12
- 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 +25 -12
- package/dist/utils/find-replace/matcher.d.ts +2 -0
- package/dist/utils/find-replace/present.d.ts +8 -5
- package/dist/utils/find-replace/preserveCase.d.ts +10 -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 +19 -0
- 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 +19 -4
- package/dist/utils/keyboard-shortcut/utils.d.ts +21 -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/schema-aml-parser/types.d.ts +2 -0
- package/dist/utils/schema-dbml-parser/tokenizer.d.ts +2 -0
- package/dist/utils/schema-dbml-parser/types.d.ts +11 -0
- package/dist/utils/schema-sql/Databricks.d.ts +8 -3
- package/dist/utils/schema-sql/MSSQL.d.ts +14 -2
- package/dist/utils/schema-sql/MariaDB.d.ts +6 -5
- package/dist/utils/schema-sql/MySQL.d.ts +13 -4
- package/dist/utils/schema-sql/Oracle.d.ts +19 -5
- 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 +16 -1
- package/dist/utils/schema-sql/options.d.ts +57 -0
- package/dist/utils/schema-sql/utils.d.ts +101 -2
- package/dist/utils/stageCursor.d.ts +20 -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 +11 -3
- package/dist/utils/takeover.d.ts +6 -0
- package/dist/utils/virtualRange.d.ts +15 -0
- package/dist/workers/elkLayout.shared-worker.js +1 -1
- package/dist/workers/exportPng.shared-worker.js +30 -30
- 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 +4 -11
- 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 -17
- package/dist/components/generator-code/GeneratorCode.styles.d.ts +0 -2
- package/dist/loadValue-Mdc5K4qO.js +0 -10858
- package/dist/schemaGCService-CZtGFh2z.js +0 -42
- 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 -10
- package/dist/shared-store-D82WVL5a.js +0 -1129
- 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/dist/components/{find-replace → explorer}/fieldIcon.d.ts +0 -0
package/README.md
CHANGED
|
@@ -2,32 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
> Entity-Relationship Diagram Editor as a custom element
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
|
-
`<erd-editor>` is a
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
[Google Drive app](https://workspace.google.com/marketplace/app/erd_editor/428467403360), the
|
|
13
|
-
[VS Code extension](https://marketplace.visualstudio.com/items?itemName=dineug.vuerd-vscode),
|
|
14
|
-
the [IntelliJ plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor) and the
|
|
7
|
+
`<erd-editor>` is a database-schema editor in one custom element. It has no framework dependency
|
|
8
|
+
and renders into a closed shadow root, so it drops into React, Vue, Svelte or plain HTML without
|
|
9
|
+
leaking styles either way. It is the same editor as [erd-editor.io](https://erd-editor.io), the
|
|
10
|
+
[VS Code extension](https://marketplace.visualstudio.com/items?itemName=dineug.vuerd-vscode), the
|
|
11
|
+
[JetBrains plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor) and the
|
|
15
12
|
[Obsidian plugin](https://community.obsidian.md/plugins/erd-editor).
|
|
16
13
|
|
|
17
14
|
## Features
|
|
18
15
|
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
- Import —
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
- **Design** — tables, columns, memos and table groups, four relationship cardinalities, ON DELETE
|
|
17
|
+
and ON UPDATE, alternate keys, Auto Layout
|
|
18
|
+
- **Import** — SQL DDL, GraphQL SDL, DBML and AML from the menu or [`setSchema*`](#importing-a-schema),
|
|
19
|
+
replacing the diagram or adding to it
|
|
20
|
+
- **Export** — DDL for eight databases, also from `getSchemaSQL()`, code in 22 languages and ORMs,
|
|
21
|
+
PNG and SVG
|
|
22
|
+
- **Navigate** — command palette (`Ctrl`/`Cmd`+`K`), an Explorer tree with find and replace, Graph
|
|
23
|
+
and Flow views
|
|
24
|
+
- **History** — undo and redo, time travel through the session, a diff viewer (`setDiffValue()`)
|
|
25
|
+
- **25 languages** and a System, Light or Dark theme, their pickers opt-in with an attribute
|
|
26
|
+
- **Collaboration** — [`getSharedStore()`](#collaboration) relays edits over your own transport,
|
|
27
|
+
and the [headless entries](#headless-replica) run the same document with no DOM
|
|
28
|
+
|
|
29
|
+
**Databases:** Databricks, MariaDB, MSSQL, MySQL, Oracle, PostgreSQL, Snowflake, SQLite
|
|
30
|
+
|
|
31
|
+
**Code:** TypeScript, GraphQL, C#, Java, JPA, Kotlin, Scala, Go, SQLAlchemy, TypeORM, Sequelize,
|
|
32
|
+
Drizzle, DBML, AML, Mermaid, PHP, Doctrine, Rust, SeaORM, Swift, Zod, JSON Schema
|
|
31
33
|
|
|
32
34
|
## Install
|
|
33
35
|
|
|
@@ -35,13 +37,9 @@ the [IntelliJ plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor) and
|
|
|
35
37
|
npm install @dineug/erd-editor
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
The
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
automatic table placement and the syntax highlighting — constructed as
|
|
42
|
-
`new SharedWorker(new URL('./workers/…', import.meta.url))`, which those bundlers emit as worker
|
|
43
|
-
files beside your chunks; a strict CSP needs `worker-src 'self'`. Without a bundler, use the UMD
|
|
44
|
-
file described under [Script tag](#script-tag) instead.
|
|
40
|
+
The PNG and SVG export, the Flow and tree layouts and the syntax highlighting run in shared
|
|
41
|
+
workers, which Vite, webpack and Rspack emit beside your chunks and esbuild does not. A strict CSP
|
|
42
|
+
needs `worker-src 'self'`. Without a bundler, use the [script tag](#script-tag) build.
|
|
45
43
|
|
|
46
44
|
## Usage
|
|
47
45
|
|
|
@@ -49,26 +47,20 @@ file described under [Script tag](#script-tag) instead.
|
|
|
49
47
|
import '@dineug/erd-editor';
|
|
50
48
|
|
|
51
49
|
const editor = document.createElement('erd-editor');
|
|
52
|
-
//
|
|
50
|
+
// a custom element is inline, and the editor fills its box
|
|
53
51
|
Object.assign(editor.style, { display: 'block', width: '100%', height: '100vh' });
|
|
54
52
|
document.body.appendChild(editor);
|
|
55
53
|
|
|
56
|
-
// load a document without adding an undo entry, then keep it in sync
|
|
57
54
|
editor.setInitialValue(localStorage.getItem('my-diagram') ?? '');
|
|
58
55
|
editor.addEventListener('change', () => {
|
|
59
56
|
localStorage.setItem('my-diagram', editor.value);
|
|
60
57
|
});
|
|
61
58
|
```
|
|
62
59
|
|
|
63
|
-
`setInitialValue('')` starts a new document, as an element given no value shows: it saves neither
|
|
64
|
-
the scroll nor the zoom (Save Scroll Information and Save Zoom Information off), so looking around
|
|
65
|
-
leaves `value` as it was. A document loaded from text keeps the switches it names, and one that
|
|
66
|
-
names none saves both.
|
|
67
|
-
|
|
68
60
|
### Server-side rendering
|
|
69
61
|
|
|
70
|
-
Importing the package registers the
|
|
71
|
-
|
|
62
|
+
Importing the package registers the element, which needs a DOM, so in Next.js, Nuxt, SvelteKit or
|
|
63
|
+
Astro import it on the client:
|
|
72
64
|
|
|
73
65
|
```js
|
|
74
66
|
useEffect(() => {
|
|
@@ -78,215 +70,205 @@ useEffect(() => {
|
|
|
78
70
|
|
|
79
71
|
### Vite
|
|
80
72
|
|
|
81
|
-
In development
|
|
82
|
-
|
|
83
|
-
that step; a production build needs nothing.
|
|
73
|
+
In development, keep the editor out of Vite's pre-bundling and include the ELK bundle its layout
|
|
74
|
+
worker imports, or the Flow and tree layouts fail. A production build needs nothing.
|
|
84
75
|
|
|
85
76
|
```js
|
|
86
77
|
// vite.config.js
|
|
87
78
|
export default {
|
|
88
79
|
optimizeDeps: {
|
|
89
80
|
exclude: ['@dineug/erd-editor'],
|
|
81
|
+
include: ['@dineug/erd-editor > elkjs/lib/elk.bundled.js'],
|
|
90
82
|
},
|
|
91
83
|
};
|
|
92
84
|
```
|
|
93
85
|
|
|
94
86
|
### Script tag
|
|
95
87
|
|
|
96
|
-
`dist/erd-editor.umd.js`
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
`dist/erd-editor.umd.js` bundles every dependency and worker, registers `<erd-editor>` and puts
|
|
89
|
+
`setExportFileCallback`, `setImportFileCallback` and `createKeyBindingMap` on `window.ErdEditor`.
|
|
90
|
+
Its workers are `data:` URLs, so a strict CSP needs `worker-src data:`. Pin a version beyond a demo.
|
|
99
91
|
|
|
100
92
|
```html
|
|
101
93
|
<erd-editor style="display: block; width: 100%; height: 100vh"></erd-editor>
|
|
102
94
|
<script src="https://cdn.jsdelivr.net/npm/@dineug/erd-editor/dist/erd-editor.umd.js"></script>
|
|
103
95
|
```
|
|
104
96
|
|
|
105
|
-
The workers travel inside the file as `data:` URLs, so a strict CSP needs `worker-src data:`
|
|
106
|
-
for this build. Pin a version in the URL for anything beyond a demo.
|
|
107
|
-
|
|
108
|
-
### HTML
|
|
109
|
-
|
|
110
|
-
```html
|
|
111
|
-
<erd-editor system-dark-mode enable-theme-builder></erd-editor>
|
|
112
|
-
<script type="module">
|
|
113
|
-
import '@dineug/erd-editor';
|
|
114
|
-
|
|
115
|
-
const editor = document.querySelector('erd-editor');
|
|
116
|
-
</script>
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
```css
|
|
120
|
-
erd-editor {
|
|
121
|
-
display: block;
|
|
122
|
-
width: 100%;
|
|
123
|
-
height: 100vh;
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
97
|
## API
|
|
128
98
|
|
|
99
|
+
The element's type is exported as `ErdEditorElement`. The
|
|
100
|
+
[Element API docs](https://docs.erd-editor.io/docs/api/erd-editor-element) cover each member in
|
|
101
|
+
full.
|
|
102
|
+
|
|
129
103
|
### Attributes
|
|
130
104
|
|
|
131
105
|
| Attribute | Property | Description |
|
|
132
106
|
| --- | --- | --- |
|
|
133
|
-
| `readonly` | `readonly` | Blocks editing and
|
|
134
|
-
| `system-dark-mode` | `systemDarkMode` |
|
|
135
|
-
| `enable-theme-builder` | `enableThemeBuilder` | Shows the
|
|
107
|
+
| `readonly` | `readonly` | Blocks editing and `change`; only `setInitialValue()` still loads. |
|
|
108
|
+
| `system-dark-mode` | `systemDarkMode` | Sets the appearance to `system`. |
|
|
109
|
+
| `enable-theme-builder` | `enableThemeBuilder` | Shows the theme builder and the palette's Theme. |
|
|
110
|
+
| `enable-locale-picker` | `enableLocalePicker` | Shows the language button and the palette's Display Language, System by default. |
|
|
111
|
+
| `enable-welcome-screen` | `enableWelcomeScreen` | Shows the welcome screen over an empty, editable diagram. |
|
|
112
|
+
|
|
113
|
+
An attribute is on when present with no value or `"true"`.
|
|
136
114
|
|
|
137
115
|
### Properties
|
|
138
116
|
|
|
139
117
|
| Property | Description |
|
|
140
118
|
| --- | --- |
|
|
141
|
-
| `value: string` | The document as
|
|
119
|
+
| `value: string` | The document as a file saves it ([schema](https://github.com/dineug/erd-editor/blob/main/json-schema/schema.json)). Assigning one, or `''` for a new one, is an undoable load. |
|
|
120
|
+
| `runtimeValue: string` | Read only. The document as this editor holds it, to seed a collaborator. |
|
|
142
121
|
|
|
143
122
|
### Methods
|
|
144
123
|
|
|
145
124
|
| Method | Description |
|
|
146
125
|
| --- | --- |
|
|
147
|
-
| `setInitialValue(value
|
|
148
|
-
| `getSchemaSQL(vendor?)` |
|
|
149
|
-
| `setSchemaSQL(value
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
157
|
-
| `
|
|
158
|
-
| `
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
126
|
+
| `setInitialValue(value)` | Load a document with no undo entry; `''` starts a new one. |
|
|
127
|
+
| `getSchemaSQL(vendor?, options?)` | DDL for one of the eight databases, by default the document's. `options`: `statements` (`create`, `ifNotExists`, `recreate`), `header` (`none`, `use`, `createAndUse`). |
|
|
128
|
+
| `setSchemaSQL(value, options?)`, `setSchemaGraphQL`, `setSchemaDBML`, `setSchemaAML` | Replace the document with parsed DDL, GraphQL SDL, DBML or AML, or append it ([Importing a schema](#importing-a-schema)). |
|
|
129
|
+
| `setSchemaJSON(value, options?)` | Load an `.erd.json` document as `value` does, or append it. |
|
|
130
|
+
| `setDiffValue(value)` | Diff another document over the ERD tab. |
|
|
131
|
+
| `setPresetTheme(options)` | Set `appearance` (`light`, `dark`, `system`), `grayColor` and `accentColor`. |
|
|
132
|
+
| `setSystemAppearance(appearance)` | Name the light or dark `system` shows; `null` follows the OS. |
|
|
133
|
+
| `setLocale(locale)` | Set the display language, `'system'` or a [code](#display-language). |
|
|
134
|
+
| `setSystemLocale(tag)` | Name the BCP 47 language `system` shows; `null` reads `navigator.languages`. |
|
|
135
|
+
| `setTheme(theme)` | Override theme tokens; each call replaces the earlier overrides. |
|
|
136
|
+
| `setKeyBindingMap(map)` | Remap [shortcuts](#key-bindings) but `edit`, `stop`, `undo`, `redo` and the zoom keys. |
|
|
137
|
+
| `getSharedStore(config?)` | A [shared store](#collaboration) for collaboration. |
|
|
138
|
+
| `focus()` / `blur()` | Move focus in or out. |
|
|
139
|
+
| `clear()` | Empty the document and keep its settings, in one undo step. |
|
|
140
|
+
| `destroy()` | Release the editor's listeners, subscriptions and shared stores. |
|
|
161
141
|
|
|
162
142
|
### Events
|
|
163
143
|
|
|
164
144
|
| Event | Description |
|
|
165
145
|
| --- | --- |
|
|
166
|
-
| `change` | The document changed
|
|
167
|
-
| `changePresetTheme` | The theme
|
|
146
|
+
| `change` | The document changed; read `editor.value`. |
|
|
147
|
+
| `changePresetTheme` | The theme changed in the editor; `event.detail` holds the options. |
|
|
148
|
+
| `changeLocale` | A language was picked in the editor; `event.detail.locale` holds it. |
|
|
168
149
|
|
|
169
|
-
|
|
150
|
+
### Loading and saving
|
|
170
151
|
|
|
171
|
-
`
|
|
172
|
-
|
|
173
|
-
|
|
152
|
+
- Save `value`. `runtimeValue` also keeps removed entities and only seeds a
|
|
153
|
+
[collaborator](#collaboration).
|
|
154
|
+
- `change` fires 200 ms after the last change, never under `readonly`, and never for scroll, zoom,
|
|
155
|
+
the open tab or the code settings while the document locks them, which a new document does.
|
|
156
|
+
- A file written by hand or by another release can differ from `value` once loaded, so detect edits
|
|
157
|
+
with a [replica](#headless-replica)'s `changed`, not by comparing bytes.
|
|
158
|
+
|
|
159
|
+
### Importing a schema
|
|
160
|
+
|
|
161
|
+
- The four text `setSchema*` methods take `{ placement?: 'auto' | 'grid', mode?: 'replace' | 'append' }`,
|
|
162
|
+
and `setSchemaJSON` only `mode`. Each lands in one undo step and ignores `''`.
|
|
163
|
+
- `'grid'`, the default, lands at once in rows. `'auto'` lays the tables out as the Import menu does
|
|
164
|
+
and returns a `Promise` that resolves when they land; a later load supersedes it.
|
|
165
|
+
- `mode: 'append'` adds the tables below the diagram, as Import and Add does.
|
|
166
|
+
|
|
167
|
+
### Theme and language
|
|
168
|
+
|
|
169
|
+
The element starts dark and English and stores neither choice: `setPresetTheme` and `setLocale`
|
|
170
|
+
set them, and your host keeps what `changePresetTheme` and `changeLocale` report.
|
|
171
|
+
|
|
172
|
+
## Collaboration
|
|
173
|
+
|
|
174
|
+
A joiner starts from the first editor's `runtimeValue`, then each relays its actions:
|
|
174
175
|
|
|
175
176
|
```js
|
|
176
|
-
|
|
177
|
+
joiner.setInitialValue(editor.runtimeValue);
|
|
177
178
|
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
const local = editor.getSharedStore();
|
|
180
|
+
const remote = joiner.getSharedStore();
|
|
181
|
+
local.subscribe(actions => remote.dispatch(actions));
|
|
182
|
+
remote.subscribe(actions => local.dispatch(actions));
|
|
181
183
|
```
|
|
182
184
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
An editor never forwards what it received, so with three or more, send each one's batches to every
|
|
186
|
+
other. Call `flushStreamBuffers()` before destroying a store, or the last drags and resizes never
|
|
187
|
+
reach the peers. `getSharedStore({ getNickname, mouseTracker, focusTracker })` also shares cursors
|
|
188
|
+
and focus.
|
|
186
189
|
|
|
187
|
-
|
|
188
|
-
opens its Find and Replace, bringing the ERD tab up, and is prevented, so the browser opens no find
|
|
189
|
-
bar; while the diff viewer, time travel or the automatic placement preview covers the ERD tab, the
|
|
190
|
-
press goes on to the page. `setKeyBindingMap({ findReplace: [] })` leaves it to the page on every
|
|
191
|
-
tab, and the toolbar button, the quick search and the context menu still open Find and Replace.
|
|
190
|
+
## Key bindings
|
|
192
191
|
|
|
193
|
-
|
|
192
|
+
`createKeyBindingMap()` returns the default shortcuts, and `setKeyBindingMap` replaces each list it
|
|
193
|
+
names. A chord is modifiers (`Shift`, `Alt`, `Control`, `Meta`, or `$mod` for Cmd on macOS and Ctrl
|
|
194
|
+
elsewhere) joined by `+` with a `KeyboardEvent.code` or `key`; a space separates the chords of a
|
|
195
|
+
sequence, such as `KeyT KeyG`. Several defaults, search and find and replace among them, stop the
|
|
196
|
+
keydown, so to leave `$mod+KeyF` to the page, call `setKeyBindingMap({ findReplace: [] })`.
|
|
194
197
|
|
|
195
|
-
|
|
196
|
-
worker of its own. There is nothing to install or register: the worker is built the first time a
|
|
197
|
-
code panel renders, so a page that opens none never fetches the grammars.
|
|
198
|
+
## Display language
|
|
198
199
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
`en`, `ar-SA`, `de-DE`, `es-ES`, `eu-ES`, `fa-IR`, `fr-FR`, `he-IL`, `id-ID`, `it-IT`, `ja-JP`,
|
|
201
|
+
`ko-KR`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sl-SI`, `sv-SE`, `tr-TR`,
|
|
202
|
+
`uk-UA`, `zh-CN` and `zh-TW`. Arabic, Hebrew and Persian lay the editor out right to left. The
|
|
203
|
+
`LocaleCode` and `LocaleOption` types are exported.
|
|
203
204
|
|
|
204
|
-
|
|
205
|
-
generator emits Python, the TypeORM, Sequelize and Drizzle generators emit TypeScript, and the
|
|
206
|
-
DBML and AML generators are highlighted as SQL, the closest grammar shiki ships.
|
|
205
|
+
## Workers
|
|
207
206
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
207
|
+
[Shiki](https://shiki.style) highlights the code panels with a JavaScript regex engine, so a CSP
|
|
208
|
+
needs no `wasm-unsafe-eval`. Without `SharedWorker`, as in Chrome on Android before Chrome 148, the
|
|
209
|
+
code panels show plain text, the Flow view and the Flow and tree layouts place nothing, an `'auto'`
|
|
210
|
+
import lands in rows, and PNG and SVG exports draw on the main thread.
|
|
211
211
|
|
|
212
212
|
## File dialogs
|
|
213
213
|
|
|
214
|
-
Import and export go through
|
|
215
|
-
an IDE webview,
|
|
216
|
-
the finished file, while import only asks for one, and you push the content back in yourself.
|
|
214
|
+
Import and export go through page-wide callbacks, so a host without a browser file dialog, such as
|
|
215
|
+
an IDE webview, supplies its own:
|
|
217
216
|
|
|
218
217
|
```js
|
|
219
218
|
import { setExportFileCallback, setImportFileCallback } from '@dineug/erd-editor';
|
|
220
219
|
|
|
221
220
|
setExportFileCallback((blob, { fileName }) => host.writeFile(fileName, blob));
|
|
222
221
|
|
|
223
|
-
setImportFileCallback(async ({ type, op, accept }) => {
|
|
222
|
+
setImportFileCallback(async ({ type, op, accept, mode }) => {
|
|
224
223
|
const text = await host.pickFile(accept);
|
|
225
|
-
|
|
226
|
-
if (
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
editor.value = text;
|
|
230
|
-
} else if (type === 'sql') {
|
|
231
|
-
editor.setSchemaSQL(text);
|
|
232
|
-
} else if (type === 'graphql') {
|
|
233
|
-
editor.setSchemaGraphQL(text);
|
|
234
|
-
} else if (type === 'dbml') {
|
|
235
|
-
editor.setSchemaDBML(text);
|
|
236
|
-
} else if (type === 'aml') {
|
|
237
|
-
editor.setSchemaAML(text);
|
|
238
|
-
}
|
|
224
|
+
if (op === 'diff') return editor.setDiffValue(text);
|
|
225
|
+
if (type === 'json') return editor.setSchemaJSON(text, { mode });
|
|
226
|
+
const format = { sql: 'SQL', graphql: 'GraphQL', dbml: 'DBML', aml: 'AML' }[type];
|
|
227
|
+
if (format) editor[`setSchema${format}`](text, { placement: 'auto', mode });
|
|
239
228
|
});
|
|
240
229
|
```
|
|
241
230
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
through a catch-all `else`, or because a `type` added later fell through — empties the
|
|
245
|
-
diagram instead of importing anything. `accept` carries the extensions for that type
|
|
246
|
-
(`.json`, `.sql`, or `.graphql,.gql,.graphqls`), ready to hand to a host file dialog.
|
|
247
|
-
|
|
248
|
-
Left unset, the editor uses the browser's own download and file-picker behavior.
|
|
231
|
+
Skip a `type` you do not handle: a replacing `setSchemaJSON()` empties the document on any other
|
|
232
|
+
payload. Unset or `null`, the browser's download and file picker work.
|
|
249
233
|
|
|
250
234
|
## Headless replica
|
|
251
235
|
|
|
252
|
-
|
|
253
|
-
action stream and serialize the result off the main thread:
|
|
236
|
+
`engine.js` applies the same actions with no DOM, so a worker can keep and serialize the document:
|
|
254
237
|
|
|
255
238
|
```js
|
|
256
239
|
import { createReplicationStore } from '@dineug/erd-editor/engine.js';
|
|
257
240
|
|
|
258
|
-
|
|
259
|
-
const store = createReplicationStore({ toWidth });
|
|
260
|
-
|
|
241
|
+
const store = createReplicationStore({ toWidth }); // a worker has no DOM to measure text
|
|
261
242
|
store.setInitialValue(savedJson);
|
|
262
243
|
store.on({ change: ({ value, changed }) => changed && persist(value) });
|
|
263
|
-
store.dispatch(actions);
|
|
244
|
+
store.dispatch(actions);
|
|
264
245
|
```
|
|
265
246
|
|
|
266
|
-
`
|
|
267
|
-
when those actions left `value` as it was, such as a scroll with Save Scroll Information off, or a
|
|
268
|
-
zoom with Save Zoom Information and Save Scroll Information both off: a zoom moves the scroll
|
|
269
|
-
position too, so with only the scroll saved it changes `value`. It compares with the value the
|
|
270
|
-
store last reported, or loaded, never with your file: a file another release or machine wrote
|
|
271
|
-
serializes differently from the start.
|
|
247
|
+
`changed` is false when `value` matches what the store last reported or loaded.
|
|
272
248
|
|
|
273
|
-
|
|
249
|
+
`peer.js` runs a collaboration peer with no DOM: `createPeerStore({ nickname })` dispatches actions,
|
|
250
|
+
receives a peer's batches and undoes its own. The
|
|
251
|
+
[ERD Editor MCP server](https://github.com/dineug/erd-editor/tree/main/packages/mcp-server#readme)
|
|
252
|
+
is built on it.
|
|
274
253
|
|
|
275
|
-
|
|
276
|
-
work on it from a workspace checkout.
|
|
254
|
+
## Development
|
|
277
255
|
|
|
278
256
|
```sh
|
|
279
|
-
pnpm --filter @dineug/erd-editor dev #
|
|
257
|
+
pnpm --filter @dineug/erd-editor dev # dev server, workspace deps built first
|
|
280
258
|
pnpm --filter @dineug/erd-editor dev:storybook # component playground
|
|
281
259
|
pnpm exec vp run --filter @dineug/erd-editor --fail-if-no-match test
|
|
282
260
|
pnpm --filter @dineug/erd-editor e2e # Playwright
|
|
283
261
|
```
|
|
284
262
|
|
|
263
|
+
What a change runs and carries is in
|
|
264
|
+
[AGENTS.md](https://github.com/dineug/erd-editor/blob/main/packages/erd-editor/AGENTS.md).
|
|
265
|
+
|
|
285
266
|
## Documentation
|
|
286
267
|
|
|
268
|
+
- [Editing Guide](https://docs.erd-editor.io/docs/category/guides) — every editor feature
|
|
269
|
+
- [Element API](https://docs.erd-editor.io/docs/api/erd-editor-element) — the `<erd-editor>`
|
|
270
|
+
element in full
|
|
287
271
|
- [Documentation](https://docs.erd-editor.io)
|
|
288
|
-
- [Editing Guide](https://docs.erd-editor.io/docs/category/guides)
|
|
289
|
-
- [Element API](https://docs.erd-editor.io/docs/api/erd-editor-element)
|
|
290
272
|
|
|
291
273
|
## Issues
|
|
292
274
|
|
|
@@ -15,6 +15,10 @@ export type AppContext = EngineContext & {
|
|
|
15
15
|
}>;
|
|
16
16
|
keydown$: Subject<KeyboardEvent>;
|
|
17
17
|
emitter: Emitter;
|
|
18
|
+
/** Set once appDestroy has run, so a render it sets off knows nothing is left to read. */
|
|
19
|
+
lifecycle: {
|
|
20
|
+
destroyed: boolean;
|
|
21
|
+
};
|
|
18
22
|
};
|
|
19
23
|
export type InjectAppContext = InjectEngineContext;
|
|
20
24
|
export type AppContextOptions = RxStoreOptions & {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC, Ref } from '@dineug/r-html';
|
|
2
2
|
import { AppContext } from '../../appContext';
|
|
3
|
+
import { I18n } from '../../../i18n/translate';
|
|
3
4
|
export type AutomaticTablePlacementProps = {
|
|
4
5
|
app: Ref<AppContext>;
|
|
5
6
|
onChange: (tables: TablePoint[]) => void;
|
|
@@ -13,7 +14,7 @@ export type TablePoint = {
|
|
|
13
14
|
export type PlacementToastState = {
|
|
14
15
|
progress: number;
|
|
15
16
|
};
|
|
16
|
-
export declare function placementDescription({ progress
|
|
17
|
+
export declare function placementDescription({ progress }: PlacementToastState, i18n?: I18n): string;
|
|
17
18
|
declare const AutomaticTablePlacement: FC<AutomaticTablePlacementProps>;
|
|
18
19
|
export default AutomaticTablePlacement;
|
|
19
20
|
//# sourceMappingURL=AutomaticTablePlacement.d.ts.map
|
|
@@ -1,12 +1,43 @@
|
|
|
1
1
|
import { RootState } from '../../../engine/state';
|
|
2
|
-
import { Table } from '../../../internal-types';
|
|
3
|
-
|
|
2
|
+
import { Table, TableGroup } from '../../../internal-types';
|
|
3
|
+
/** A table in no group, put at the node less its radius, as it always was. */
|
|
4
|
+
type TableNode = {
|
|
4
5
|
id: string;
|
|
5
6
|
r: number;
|
|
6
7
|
x: number;
|
|
7
8
|
y: number;
|
|
9
|
+
vx: number;
|
|
10
|
+
vy: number;
|
|
8
11
|
ref: Table;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
9
14
|
};
|
|
15
|
+
/** A member, and where it stands from the corner of its group's box. */
|
|
16
|
+
type Member = {
|
|
17
|
+
ref: Table;
|
|
18
|
+
dx: number;
|
|
19
|
+
dy: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A group with members, moved as one box centred on the node: the members keep
|
|
23
|
+
* where they stand inside it, and the box, their bounds and the padding, is
|
|
24
|
+
* the rect the group is drawn at, so a preview shows the group where it goes.
|
|
25
|
+
*/
|
|
26
|
+
type GroupNode = {
|
|
27
|
+
id: string;
|
|
28
|
+
r: number;
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
vx: number;
|
|
32
|
+
vy: number;
|
|
33
|
+
group: TableGroup;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
members: Member[];
|
|
37
|
+
};
|
|
38
|
+
type Node = TableNode | GroupNode;
|
|
39
|
+
/** The least room a group's box keeps from another group's box or a table. */
|
|
40
|
+
export declare const GROUP_BOX_GAP = 100;
|
|
10
41
|
/** The two readings of a simulation's heat that its progress is taken from. */
|
|
11
42
|
type Cooling = {
|
|
12
43
|
alpha(): number;
|
|
@@ -23,6 +54,11 @@ type Cooling = {
|
|
|
23
54
|
* });
|
|
24
55
|
*/
|
|
25
56
|
export declare function placementProgress(simulation: Cooling): number;
|
|
57
|
+
/**
|
|
58
|
+
* The force simulation that places the tables, around the middle of what the
|
|
59
|
+
* document draws. A group with members is one box in it, its members kept
|
|
60
|
+
* inside and the box kept clear of the others, so it is drawn where it goes.
|
|
61
|
+
*/
|
|
26
62
|
export declare function createAutomaticTablePlacement(state: RootState): import('d3-force').Simulation<Node, undefined>;
|
|
27
63
|
export {};
|
|
28
64
|
//# sourceMappingURL=createAutomaticTablePlacement.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FC } from '@dineug/r-html';
|
|
2
|
+
import { AppContext } from '../../appContext';
|
|
3
|
+
import { ElkLayoutPoint, ElkLayoutRequest } from '../../../services/elk-layout';
|
|
4
|
+
type PlacingToastProps = {
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The message up while ELK works, and the whole of what a one-shot placement
|
|
9
|
+
* shows. There is no progress to follow and nothing to read off a layout that
|
|
10
|
+
* does not exist yet, so Cancel is the only thing on it. A view placement shows it too.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PlacingToast: FC<PlacingToastProps>;
|
|
13
|
+
/** How a layout ended: placed, given up on by whoever waited, or never answered. */
|
|
14
|
+
export type ElkLayoutAnswer = {
|
|
15
|
+
status: 'placed';
|
|
16
|
+
points: ElkLayoutPoint[];
|
|
17
|
+
} | {
|
|
18
|
+
status: 'cancelled';
|
|
19
|
+
} | {
|
|
20
|
+
status: 'failed';
|
|
21
|
+
error: unknown;
|
|
22
|
+
};
|
|
23
|
+
export type LayoutByElkOptions = {
|
|
24
|
+
/**
|
|
25
|
+
* Whether the toast waits until the layout has run long enough to say so,
|
|
26
|
+
* for a placement nobody asked to watch, rather than going up at once.
|
|
27
|
+
*/
|
|
28
|
+
whenSlow?: boolean;
|
|
29
|
+
/** Ends the wait from outside, as Cancel does, and takes the toast down. */
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* One ELK layout behind the Placing toast, reading nothing but the request and
|
|
34
|
+
* the app context, so the document and a document not loaded yet are placed
|
|
35
|
+
* alike. Cancel and the stop key end the wait at once, the toast with it.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* const answer = await layoutByElk(app, request, { whenSlow: true });
|
|
39
|
+
*/
|
|
40
|
+
export declare function layoutByElk({ emitter, shortcut$ }: AppContext, request: ElkLayoutRequest, { whenSlow, signal }?: LayoutByElkOptions): Promise<ElkLayoutAnswer>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=elkPlacement.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AppContext } from '../../appContext';
|
|
2
|
+
import { ElkLayoutPoint, ElkLayoutRequest } from '../../../services/elk-layout';
|
|
3
|
+
/**
|
|
4
|
+
* What a Flow placement of a document asks ELK, measured on a plain store of
|
|
5
|
+
* its own with the editor's text measure, so nothing reaches the editor's
|
|
6
|
+
* store. Null under two tables or with no relationship, the grid's cases.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const request = createFlowRequest(app, json);
|
|
10
|
+
*/
|
|
11
|
+
export declare function createFlowRequest({ toWidth }: AppContext, json: string): ElkLayoutRequest | null;
|
|
12
|
+
/**
|
|
13
|
+
* Where each table of a document not loaded yet goes by Flow, measured from
|
|
14
|
+
* the corner of the block the tables make, so the caller decides where that
|
|
15
|
+
* block stands. Null leaves the tables to the grid, and says nothing of why.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* const points = await placeByFlow(app, json, controller.signal);
|
|
19
|
+
*/
|
|
20
|
+
export declare function placeByFlow(app: AppContext, json: string, signal?: AbortSignal): Promise<ElkLayoutPoint[] | null>;
|
|
21
|
+
//# sourceMappingURL=flowPlacement.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AnyAction } from '@dineug/r-html';
|
|
2
|
+
import { RootState } from '../../../engine/state';
|
|
3
|
+
import { TableMove } from '../../../konva/scene/contentBounds';
|
|
4
|
+
import { GeometrySource } from '../../../utils/draw-relationship/geometrySource';
|
|
5
|
+
/**
|
|
6
|
+
* What a placement lands as: each table at its point, each group with members
|
|
7
|
+
* at the rect round where they land, and the view centred on the box all of it
|
|
8
|
+
* fills, read before the move. Dispatched together, they are one undo entry.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* store.dispatch(toPlacementActions(store.state, points));
|
|
12
|
+
*/
|
|
13
|
+
export declare function toPlacementActions(state: RootState, tables: ReadonlyArray<TableMove>, source?: GeometrySource): AnyAction[];
|
|
14
|
+
//# sourceMappingURL=placementActions.d.ts.map
|