@dineug/erd-editor 3.3.0 → 3.4.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 +197 -17
- package/dist/components/erd/canvas/altDragDuplicate.d.ts +3 -0
- package/dist/components/erd/canvas/duplicate-ghost/DuplicateGhost.d.ts +4 -0
- package/dist/components/erd/canvas/duplicate-ghost/DuplicateGhost.styles.d.ts +2 -0
- package/dist/components/erd/canvas/shared-drag-select/SharedDragSelect.d.ts +4 -0
- package/dist/components/erd/canvas/table/column/Column.d.ts +7 -0
- package/dist/components/erd/canvas/table/column/column-data-type/ColumnDataType.d.ts +3 -3
- package/dist/components/erd/canvas/table/column/column-not-null/ColumnNotNull.d.ts +1 -1
- package/dist/components/erd/canvas/table/column/column-option/ColumnOption.d.ts +1 -1
- package/dist/components/erd/canvas/table/useSharedFocusTable.d.ts +6 -0
- package/dist/components/erd/canvas/useSharedSelectEntity.d.ts +4 -0
- package/dist/components/erd/erd-context-menu/menus/drawRelationshipMenus.d.ts +3 -2
- package/dist/components/erd/erd-context-menu/menus/exportMenus.d.ts +6 -6
- package/dist/components/erd/erd-context-menu/menus/importMenus.d.ts +6 -6
- package/dist/components/erd/erd-context-menu/menus/relationshipMenus.d.ts +1 -1
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-checkbox-column/IndexesCheckboxColumn.d.ts +1 -1
- package/dist/components/erd-editor/ErdEditor.d.ts +4 -0
- package/dist/components/erd-editor/ErdEditor.stories.d.ts +1 -1
- package/dist/components/global-styles/GlobalStyles.d.ts +14 -0
- package/dist/components/primitives/button/Button.stories.d.ts +4 -4
- package/dist/components/primitives/code-block/CodeBlock.stories.d.ts +4 -4
- package/dist/components/primitives/code-block/CodeBlock.styles.d.ts +6 -1
- package/dist/components/primitives/color-picker/ColorPicker.d.ts +1 -1
- package/dist/components/primitives/color-picker/ColorPicker.stories.d.ts +1 -1
- package/dist/components/primitives/context-menu/ContextMenu.stories.d.ts +1 -1
- package/dist/components/primitives/context-menu/context-menu-item/ContextMenuItem.d.ts +1 -1
- package/dist/components/primitives/context-menu/menu/Menu.d.ts +2 -2
- package/dist/components/primitives/edit-input/EditInput.d.ts +2 -2
- package/dist/components/primitives/edit-input/EditInput.stories.d.ts +6 -6
- package/dist/components/primitives/highlighted-text/HighlightedText.stories.d.ts +1 -1
- package/dist/components/primitives/icon/Icon.d.ts +2 -3
- package/dist/components/primitives/icon/Icon.stories.d.ts +3 -1
- package/dist/components/primitives/icon/icons.d.ts +59 -15
- package/dist/components/primitives/kbd/Kbd.stories.d.ts +3 -3
- package/dist/components/primitives/sash/Sash.stories.d.ts +5 -5
- package/dist/components/primitives/separator/Separator.stories.d.ts +3 -3
- package/dist/components/primitives/slider/Slider.stories.d.ts +4 -4
- package/dist/components/primitives/switch/Switch.stories.d.ts +3 -3
- package/dist/components/primitives/text-input/TextInput.d.ts +1 -1
- package/dist/components/primitives/text-input/TextInput.stories.d.ts +7 -7
- package/dist/components/primitives/toast/Toast.stories.d.ts +4 -4
- package/dist/constants/language.d.ts +7 -1
- package/dist/constants/layout.d.ts +20 -0
- package/dist/constants/schema.d.ts +11 -2
- package/dist/constants/sql/dataType/Databricks.d.ts +5 -0
- package/dist/constants/sql/dataType/MSSQL.d.ts +1 -1
- package/dist/constants/sql/dataType/MySQL.d.ts +1 -1
- package/dist/constants/sql/dataType/Oracle.d.ts +1 -1
- package/dist/constants/sql/dataType/Snowflake.d.ts +5 -0
- package/dist/constants/sql/database.d.ts +2 -0
- package/dist/engine/history.d.ts +5 -3
- package/dist/engine/hooks.d.ts +3 -3
- package/dist/engine/modules/editor/actions.d.ts +18 -1
- package/dist/engine/modules/editor/atom.actions.d.ts +78 -0
- package/dist/engine/modules/editor/generator.actions.d.ts +18 -0
- package/dist/engine/modules/editor/state.d.ts +23 -0
- package/dist/engine/modules/editor/utils/duplicate.d.ts +13 -0
- package/dist/engine/modules/memo/actions.d.ts +3 -0
- package/dist/engine/modules/memo/atom.actions.d.ts +12 -0
- package/dist/engine/modules/table/actions.d.ts +1 -0
- package/dist/engine/modules/table/atom.actions.d.ts +4 -0
- package/dist/engine.js +40 -51
- package/dist/erd-editor.js +30677 -26598
- package/dist/schemaGCService-DAGNq0wk.js +17092 -0
- package/dist/services/shikiService.d.ts +1 -1
- package/dist/styles/colorPicker.style.d.ts +10 -1
- package/dist/styles/fonts.styles.d.ts +2 -1
- package/dist/styles/reset.styles.d.ts +5 -1
- package/dist/styles/scrollbar.styles.d.ts +6 -1
- package/dist/styles/typography.styles.d.ts +2 -1
- package/dist/themes/radix-ui-theme.d.ts +1 -1
- package/dist/themes/tokens.d.ts +2 -2
- package/dist/utils/calcTable.d.ts +7 -0
- package/dist/utils/draw-relationship/chamfer.d.ts +2 -0
- package/dist/utils/draw-relationship/index.d.ts +73 -14
- package/dist/utils/draw-relationship/nudge.d.ts +3 -0
- package/dist/utils/draw-relationship/pathFinding.d.ts +9 -1
- package/dist/utils/draw-relationship/route.d.ts +32 -0
- package/dist/utils/draw-relationship/stub.d.ts +47 -0
- package/dist/utils/emitter.d.ts +16 -0
- package/dist/utils/file/importFile.d.ts +4 -1
- package/dist/utils/focus.d.ts +4 -2
- package/dist/utils/generator-code/aml.d.ts +4 -0
- package/dist/utils/generator-code/dbml.d.ts +4 -0
- package/dist/utils/generator-code/drizzle.d.ts +4 -0
- package/dist/utils/generator-code/go.d.ts +4 -0
- package/dist/utils/generator-code/sequelize.d.ts +4 -0
- package/dist/utils/generator-code/sqlalchemy.d.ts +4 -0
- package/dist/utils/generator-code/typeorm.d.ts +4 -0
- package/dist/utils/keyboard-shortcut/index.d.ts +1 -1
- package/dist/utils/promise.d.ts +1 -0
- package/dist/utils/schema-aml-parser/convert.d.ts +4 -0
- package/dist/utils/schema-aml-parser/dataType.d.ts +13 -0
- package/dist/utils/schema-aml-parser/index.d.ts +3 -0
- package/dist/utils/schema-aml-parser/parser.d.ts +2 -0
- package/dist/utils/schema-aml-parser/tokenizer.d.ts +25 -0
- package/dist/utils/schema-aml-parser/types.d.ts +79 -0
- package/dist/utils/schema-dbml-parser/convert.d.ts +4 -0
- package/dist/utils/schema-dbml-parser/dataType.d.ts +7 -0
- package/dist/utils/schema-dbml-parser/index.d.ts +3 -0
- package/dist/utils/schema-dbml-parser/parser.d.ts +2 -0
- package/dist/utils/schema-dbml-parser/tokenizer.d.ts +16 -0
- package/dist/utils/schema-dbml-parser/types.d.ts +62 -0
- package/dist/utils/schema-graphql-parser/convert.d.ts +4 -0
- package/dist/utils/schema-graphql-parser/dataType.d.ts +7 -0
- package/dist/utils/schema-graphql-parser/index.d.ts +3 -0
- package/dist/utils/schema-graphql-parser/parser.d.ts +2 -0
- package/dist/utils/schema-graphql-parser/types.d.ts +58 -0
- package/dist/utils/schema-sql/Databricks.d.ts +5 -0
- package/dist/utils/schema-sql/Snowflake.d.ts +5 -0
- package/dist/utils/sharedColor.d.ts +2 -0
- package/dist/utils/table-clipboard/copy.d.ts +7 -0
- package/dist/utils/table-clipboard/index.d.ts +2 -0
- package/dist/utils/table-clipboard/paste.d.ts +3 -0
- package/dist/utils/table-clipboard/payload.d.ts +83 -0
- package/dist/utils/table-clipboard/placement.d.ts +30 -0
- package/dist/utils/validation.d.ts +1 -0
- package/package.json +29 -25
- package/dist/schemaGCService-CLe8cLsy.js +0 -15866
package/README.md
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
|
-
# erd-editor
|
|
1
|
+
# @dineug/erd-editor
|
|
2
2
|
|
|
3
|
-
> Entity-Relationship Diagram Editor
|
|
3
|
+
> Entity-Relationship Diagram Editor as a custom element
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
+
`<erd-editor>` is a full database-schema editor in a single custom element. It has no
|
|
8
|
+
framework dependency and renders into a closed shadow root, so it drops into any page —
|
|
9
|
+
React, Vue, Svelte, or plain HTML — without leaking styles either way.
|
|
10
|
+
|
|
11
|
+
This is the same editor that powers [erd-editor.io](https://erd-editor.io), the
|
|
12
|
+
[VS Code extension](https://marketplace.visualstudio.com/items?itemName=dineug.vuerd-vscode)
|
|
13
|
+
and the [IntelliJ plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor).
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- Visual schema design — tables, columns, memos, and four relationship cardinalities
|
|
18
|
+
(zero-one, zero-N, one-only, one-N)
|
|
19
|
+
- Import — a `.sql` dump, a GraphQL SDL schema from any tool that emits one, a `.dbml` file, or
|
|
20
|
+
an `.aml` file
|
|
21
|
+
- SQL DDL export — Databricks, MariaDB, MSSQL, MySQL, Oracle, PostgreSQL, Snowflake and SQLite
|
|
22
|
+
- Code generation — TypeScript, GraphQL, C#, Java, JPA, Kotlin, Scala, Go,
|
|
23
|
+
SQLAlchemy, TypeORM, Sequelize, Drizzle, DBML, AML
|
|
24
|
+
- Export — `.erd.json`, `.sql`, `.png`
|
|
25
|
+
- Force-directed visualization of table relationships
|
|
26
|
+
- Quick search, undo / redo, remappable keyboard shortcuts, and a built-in theme builder
|
|
27
|
+
- Collaboration hooks — the editor emits and applies actions; you supply the transport
|
|
28
|
+
|
|
7
29
|
## Install
|
|
8
30
|
|
|
9
31
|
```sh
|
|
@@ -16,37 +38,195 @@ npm install @dineug/erd-editor
|
|
|
16
38
|
import '@dineug/erd-editor';
|
|
17
39
|
|
|
18
40
|
const editor = document.createElement('erd-editor');
|
|
41
|
+
// the editor fills its container, and a custom element is inline by default
|
|
42
|
+
Object.assign(editor.style, { display: 'block', width: '100%', height: '100vh' });
|
|
19
43
|
document.body.appendChild(editor);
|
|
44
|
+
|
|
45
|
+
// load a document without adding an undo entry, then keep it in sync
|
|
46
|
+
editor.setInitialValue(localStorage.getItem('my-diagram') ?? '');
|
|
47
|
+
editor.addEventListener('change', () => {
|
|
48
|
+
localStorage.setItem('my-diagram', editor.value);
|
|
49
|
+
});
|
|
20
50
|
```
|
|
21
51
|
|
|
22
|
-
|
|
52
|
+
`setInitialValue('')` starts an empty document.
|
|
53
|
+
|
|
54
|
+
### Server-side rendering
|
|
55
|
+
|
|
56
|
+
Importing the package registers the custom element at module scope, so it needs a DOM and
|
|
57
|
+
throws in Node. In Next.js, Nuxt, SvelteKit or Astro, reach it from a client-only path:
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
import('@dineug/erd-editor');
|
|
62
|
+
}, []);
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### HTML
|
|
23
66
|
|
|
24
67
|
```html
|
|
68
|
+
<erd-editor system-dark-mode enable-theme-builder></erd-editor>
|
|
25
69
|
<script type="module">
|
|
26
|
-
import '
|
|
70
|
+
import '@dineug/erd-editor';
|
|
27
71
|
|
|
28
|
-
const editor = document.
|
|
29
|
-
document.body.appendChild(editor);
|
|
72
|
+
const editor = document.querySelector('erd-editor');
|
|
30
73
|
</script>
|
|
31
|
-
<!-- or -->
|
|
32
|
-
<script type="module" src="https://esm.run/@dineug/erd-editor"></script>
|
|
33
74
|
```
|
|
34
75
|
|
|
35
|
-
|
|
76
|
+
```css
|
|
77
|
+
erd-editor {
|
|
78
|
+
display: block;
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 100vh;
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### CDN
|
|
36
85
|
|
|
37
86
|
```html
|
|
38
|
-
<erd-editor
|
|
87
|
+
<erd-editor style="display: block; width: 100%; height: 100vh"></erd-editor>
|
|
39
88
|
<script type="module">
|
|
40
89
|
import 'https://esm.run/@dineug/erd-editor';
|
|
41
|
-
|
|
42
|
-
const editor = document.querySelector('erd-editor');
|
|
43
90
|
</script>
|
|
44
91
|
```
|
|
45
92
|
|
|
46
|
-
##
|
|
93
|
+
## API
|
|
94
|
+
|
|
95
|
+
### Attributes
|
|
96
|
+
|
|
97
|
+
| Attribute | Property | Description |
|
|
98
|
+
| --- | --- | --- |
|
|
99
|
+
| `readonly` | `readonly` | Blocks editing and suppresses the `change` event. Assigning `value`, `setSchemaSQL()`, `setSchemaGraphQL()`, `setSchemaDBML()`, `setSchemaAML()` and `clear()` are ignored while it is set — load with `setInitialValue()` instead. Viewport actions and the SQL/code output settings still apply. |
|
|
100
|
+
| `system-dark-mode` | `systemDarkMode` | Follows the OS color scheme |
|
|
101
|
+
| `enable-theme-builder` | `enableThemeBuilder` | Shows the built-in theme builder |
|
|
102
|
+
|
|
103
|
+
### Properties
|
|
104
|
+
|
|
105
|
+
| Property | Description |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| `value: string` | The document as JSON — an `.erd.json` document ([schema](https://github.com/dineug/erd-editor/blob/main/json-schema/schema.json)). Assigning it loads the document as an edit, so it lands in the undo history; use `setInitialValue` to load without one. |
|
|
108
|
+
|
|
109
|
+
### Methods
|
|
110
|
+
|
|
111
|
+
| Method | Description |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| `setInitialValue(value: string)` | Load the initial document. Does not create a history entry. |
|
|
114
|
+
| `getSchemaSQL(vendor?)` | Export DDL. `vendor` is one of `Databricks`, `MariaDB`, `MSSQL`, `MySQL`, `Oracle`, `PostgreSQL`, `Snowflake`, `SQLite`; omit it to use the document's own setting. |
|
|
115
|
+
| `setSchemaSQL(value: string)` | Parse a DDL string and **replace** the current document with it. Lands in the undo history; an empty string is ignored. |
|
|
116
|
+
| `setSchemaGraphQL(value: string)` | Parse a GraphQL SDL string and **replace** the current document with it. Object types become tables, scalars map to the document's own dialect, and relationships are read from the fields that point at another type. Lands in the undo history; an empty string is ignored. |
|
|
117
|
+
| `setSchemaDBML(value: string)` | Parse a DBML string and **replace** the current document with it. Tables, columns, indexes and every `Ref` spelling are read; a `Project`, `TableGroup` or sticky `Note` is skipped, and text it cannot read loads an empty document rather than being refused. Lands in the undo history; an empty string is ignored. |
|
|
118
|
+
| `setSchemaAML(value: string)` | Parse an [AML](https://azimutt.app) string and **replace** the current document with it. Entities, attributes, indexes and every relation arrow are read, in the v2 and the legacy v1 spelling; a check, a struct type and a view are skipped, and text it cannot read loads an empty document rather than being refused. Lands in the undo history; an empty string is ignored. |
|
|
119
|
+
| `setDiffValue(value: string)` | Open the diff viewer against another document. |
|
|
120
|
+
| `setPresetTheme(options)` | Set `appearance`, `grayColor` and `accentColor`. |
|
|
121
|
+
| `setTheme(theme)` | Override individual theme tokens. |
|
|
122
|
+
| `setKeyBindingMap(map)` | Remap shortcuts. `edit`, `stop`, `search`, `undo`, `redo`, `zoomIn` and `zoomOut` are reserved. |
|
|
123
|
+
| `getSharedStore(config?)` | Returns `{ subscribe, dispatch, dispatchSync, connection, disconnect, destroy }`. `subscribe` gives you this editor's actions to relay; `dispatch` applies a peer's. You supply the transport. `config` is `{ getNickname?, mouseTracker?, focusTracker? }`; both trackers default to `true` and broadcast this editor's cursor and table focus to peers. |
|
|
124
|
+
| `focus()` / `blur()` | Move focus in and out of the editor. |
|
|
125
|
+
| `clear()` | Empty the document. |
|
|
126
|
+
| `destroy()` | Tear the editor down and release its listeners, subscriptions and shared stores. |
|
|
127
|
+
|
|
128
|
+
### Events
|
|
129
|
+
|
|
130
|
+
| Event | Description |
|
|
131
|
+
| --- | --- |
|
|
132
|
+
| `change` | The document changed. Debounced, and never fired while `readonly`. Read `editor.value`. |
|
|
133
|
+
| `changePresetTheme` | The theme was changed from inside the editor. `event.detail` carries the new options. |
|
|
134
|
+
|
|
135
|
+
## Syntax highlighting
|
|
136
|
+
|
|
137
|
+
The SQL and code-generation panels render as plain text unless a highlighter is supplied.
|
|
138
|
+
[`@dineug/erd-editor-shiki-worker`](https://www.npmjs.com/package/@dineug/erd-editor-shiki-worker)
|
|
139
|
+
runs one in a shared worker. It is a separate install:
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
npm install @dineug/erd-editor-shiki-worker
|
|
143
|
+
```
|
|
47
144
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
145
|
+
```js
|
|
146
|
+
import { setGetShikiServiceCallback } from '@dineug/erd-editor';
|
|
147
|
+
|
|
148
|
+
// deferred, so the highlighter never lands in your main chunk
|
|
149
|
+
import('@dineug/erd-editor-shiki-worker').then(({ getShikiService }) => {
|
|
150
|
+
setGetShikiServiceCallback(getShikiService);
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## File dialogs
|
|
155
|
+
|
|
156
|
+
Import and export go through injectable callbacks, so a host without a browser file dialog —
|
|
157
|
+
an IDE webview, for example — can supply its own. The two are not symmetric: export hands you
|
|
158
|
+
the finished file, while import only asks for one, and you push the content back in yourself.
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
import { setExportFileCallback, setImportFileCallback } from '@dineug/erd-editor';
|
|
162
|
+
|
|
163
|
+
setExportFileCallback((blob, { fileName }) => host.writeFile(fileName, blob));
|
|
164
|
+
|
|
165
|
+
setImportFileCallback(async ({ type, op, accept }) => {
|
|
166
|
+
const text = await host.pickFile(accept);
|
|
167
|
+
|
|
168
|
+
if (op === 'diff') {
|
|
169
|
+
editor.setDiffValue(text);
|
|
170
|
+
} else if (type === 'json') {
|
|
171
|
+
editor.value = text;
|
|
172
|
+
} else if (type === 'sql') {
|
|
173
|
+
editor.setSchemaSQL(text);
|
|
174
|
+
} else if (type === 'graphql') {
|
|
175
|
+
editor.setSchemaGraphQL(text);
|
|
176
|
+
} else if (type === 'dbml') {
|
|
177
|
+
editor.setSchemaDBML(text);
|
|
178
|
+
} else if (type === 'aml') {
|
|
179
|
+
editor.setSchemaAML(text);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Dispatch on every `type` you handle and ignore the rest. Assigning `value` clears the
|
|
185
|
+
document before it parses, so routing a payload there that is not an `.erd.json` document —
|
|
186
|
+
through a catch-all `else`, or because a `type` added later fell through — empties the
|
|
187
|
+
diagram instead of importing anything. `accept` carries the extensions for that type
|
|
188
|
+
(`.json`, `.sql`, or `.graphql,.gql,.graphqls`), ready to hand to a host file dialog.
|
|
189
|
+
|
|
190
|
+
Left unset, the editor uses the browser's own download and file-picker behavior.
|
|
191
|
+
|
|
192
|
+
## Headless replica
|
|
193
|
+
|
|
194
|
+
A second entry point runs the document store with no DOM, for hosts that need to apply an
|
|
195
|
+
action stream and serialize the result off the main thread:
|
|
196
|
+
|
|
197
|
+
```js
|
|
198
|
+
import { createReplicationStore } from '@dineug/erd-editor/engine.js';
|
|
199
|
+
|
|
200
|
+
// `toWidth` measures text for layout — a worker has no DOM, so you supply it
|
|
201
|
+
const store = createReplicationStore({ toWidth });
|
|
202
|
+
|
|
203
|
+
store.setInitialValue(savedJson);
|
|
204
|
+
store.on({ change: () => persist(store.value) });
|
|
205
|
+
store.dispatch(actions); // actions relayed from a live editor's shared store
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Development
|
|
209
|
+
|
|
210
|
+
This package is the editor core of the [erd-editor monorepo](https://github.com/dineug/erd-editor);
|
|
211
|
+
work on it from a workspace checkout.
|
|
212
|
+
|
|
213
|
+
```sh
|
|
214
|
+
pnpm --filter @dineug/erd-editor dev # builds workspace deps, then a dev server
|
|
215
|
+
pnpm --filter @dineug/erd-editor dev:storybook # component playground
|
|
216
|
+
pnpm exec vp run --filter @dineug/erd-editor --fail-if-no-match test
|
|
217
|
+
pnpm --filter @dineug/erd-editor e2e # Playwright
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Documentation
|
|
221
|
+
|
|
222
|
+
- [Documentation](https://docs.erd-editor.io)
|
|
51
223
|
- [Editing Guide](https://docs.erd-editor.io/docs/category/guides)
|
|
52
|
-
- [API](https://docs.erd-editor.io/docs/api/erd-editor-element)
|
|
224
|
+
- [Element API](https://docs.erd-editor.io/docs/api/erd-editor-element)
|
|
225
|
+
|
|
226
|
+
## Issues
|
|
227
|
+
|
|
228
|
+
Found a bug or want a feature? [Open an issue](https://github.com/dineug/erd-editor/issues).
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
[MIT](https://github.com/dineug/erd-editor/blob/main/LICENSE) © SeungHwan-Lee
|
|
@@ -16,6 +16,13 @@ export type ColumnProps = {
|
|
|
16
16
|
focusComment: boolean;
|
|
17
17
|
focusUnique: boolean;
|
|
18
18
|
focusAutoIncrement: boolean;
|
|
19
|
+
sharedFocusName: string | null;
|
|
20
|
+
sharedFocusDataType: string | null;
|
|
21
|
+
sharedFocusNotNull: string | null;
|
|
22
|
+
sharedFocusDefault: string | null;
|
|
23
|
+
sharedFocusComment: string | null;
|
|
24
|
+
sharedFocusUnique: string | null;
|
|
25
|
+
sharedFocusAutoIncrement: string | null;
|
|
19
26
|
editName: boolean;
|
|
20
27
|
editDataType: boolean;
|
|
21
28
|
editDefault: boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FC, Ref } from '@dineug/r-html';
|
|
2
2
|
import { AppContext } from '../../../../../appContext';
|
|
3
3
|
export type ColumnDataTypeProps = {
|
|
4
|
-
app
|
|
4
|
+
app?: Ref<AppContext>;
|
|
5
5
|
tableId: string;
|
|
6
6
|
columnId: string;
|
|
7
|
-
edit
|
|
8
|
-
focus
|
|
7
|
+
edit?: boolean;
|
|
8
|
+
focus?: boolean;
|
|
9
9
|
width: number;
|
|
10
10
|
value: string;
|
|
11
11
|
onInput?: (event: InputEvent) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FocusType } from '../../../../engine/modules/editor/state';
|
|
2
|
+
import { Ctx } from '../../../../internal-types';
|
|
3
|
+
export declare function useSharedFocusTable(ctx: Ctx, tableId: string): {
|
|
4
|
+
sharedFocusTableColor: () => string | null;
|
|
5
|
+
sharedFocusColor: (focusType: FocusType, columnId?: string) => string | null;
|
|
6
|
+
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { AppContext } from '../../../appContext';
|
|
2
|
+
import { Base64IconName } from '../../../primitives/icon/icons';
|
|
2
3
|
import { KeyBindingName } from '../../../../utils/keyboard-shortcut';
|
|
3
4
|
type Menu = {
|
|
4
|
-
iconName:
|
|
5
|
+
iconName: Base64IconName;
|
|
5
6
|
name: string;
|
|
6
7
|
keyBindingName: KeyBindingName;
|
|
7
8
|
relationshipType: number;
|
|
8
9
|
};
|
|
9
10
|
export declare const menus: Menu[];
|
|
10
11
|
export declare function createDrawRelationshipMenus({ store, keyBindingMap }: AppContext, onClose: () => void): {
|
|
11
|
-
iconName:
|
|
12
|
+
iconName: "ZeroOneN" | "ZeroOne" | "ZeroN" | "OneOnly" | "OneN" | "One" | "N";
|
|
12
13
|
name: string;
|
|
13
14
|
shortcut: string;
|
|
14
15
|
onClick: () => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AppContext } from '../../../appContext';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
name: string;
|
|
6
|
-
};
|
|
2
|
+
import { IconName } from '../../../primitives/icon/icons';
|
|
3
|
+
type Menu = {
|
|
4
|
+
icon: IconName;
|
|
7
5
|
name: string;
|
|
8
6
|
onClick: () => void;
|
|
9
|
-
}
|
|
7
|
+
};
|
|
8
|
+
export declare function createExportMenus(app: AppContext, onClose: () => void, root: HTMLElement): Menu[];
|
|
9
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AppContext } from '../../../appContext';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
name: string;
|
|
6
|
-
};
|
|
2
|
+
import { IconName } from '../../../primitives/icon/icons';
|
|
3
|
+
type Menu = {
|
|
4
|
+
icon: IconName;
|
|
7
5
|
name: string;
|
|
8
6
|
onClick: () => void;
|
|
9
|
-
}
|
|
7
|
+
};
|
|
8
|
+
export declare function createImportMenus(app: AppContext, onClose: () => void): Menu[];
|
|
9
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AppContext } from '../../../appContext';
|
|
2
2
|
export declare function createRelationshipMenus({ store }: AppContext, relationshipId?: string): {
|
|
3
3
|
checked: boolean;
|
|
4
|
-
iconName:
|
|
4
|
+
iconName: "ZeroOneN" | "ZeroOne" | "ZeroN" | "OneOnly" | "OneN" | "One" | "N";
|
|
5
5
|
name: string;
|
|
6
6
|
onClick: () => void;
|
|
7
7
|
}[];
|
|
@@ -2,7 +2,7 @@ import { FC } from '@dineug/r-html';
|
|
|
2
2
|
import { Index } from '../../../../../internal-types';
|
|
3
3
|
export type IndexesCheckboxColumnProps = {
|
|
4
4
|
tableId: string;
|
|
5
|
-
index: Index;
|
|
5
|
+
index: Index | null;
|
|
6
6
|
};
|
|
7
7
|
declare const IndexesCheckboxColumn: FC<IndexesCheckboxColumnProps>;
|
|
8
8
|
export default IndexesCheckboxColumn;
|
|
@@ -24,9 +24,13 @@ export interface ErdEditorElement extends ErdEditorProps, HTMLElement {
|
|
|
24
24
|
setTheme: (theme: Partial<ThemeType>) => void;
|
|
25
25
|
setKeyBindingMap: (keyBindingMap: Partial<Omit<KeyBindingMap, typeof KeyBindingName.edit | typeof KeyBindingName.stop | typeof KeyBindingName.search | typeof KeyBindingName.undo | typeof KeyBindingName.redo | typeof KeyBindingName.zoomIn | typeof KeyBindingName.zoomOut>>) => void;
|
|
26
26
|
setSchemaSQL: (value: string) => void;
|
|
27
|
+
setSchemaGraphQL: (value: string) => void;
|
|
28
|
+
setSchemaDBML: (value: string) => void;
|
|
29
|
+
setSchemaAML: (value: string) => void;
|
|
27
30
|
getSchemaSQL: (databaseVendor?: DatabaseVendor) => string;
|
|
28
31
|
getSharedStore: (config?: SharedStoreConfig & {
|
|
29
32
|
mouseTracker?: boolean;
|
|
33
|
+
focusTracker?: boolean;
|
|
30
34
|
}) => SharedStore;
|
|
31
35
|
setDiffValue: (value: string) => void;
|
|
32
36
|
}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { FC } from '@dineug/r-html';
|
|
2
2
|
export type GlobalStylesProps = {};
|
|
3
|
+
/**
|
|
4
|
+
* Renders nothing, and stays anyway.
|
|
5
|
+
*
|
|
6
|
+
* Every sheet it used to be responsible for is an adopted global literal now, so there is no
|
|
7
|
+
* markup left to emit. What is left is the `setGlobalStyleOrder` call above, which is a module
|
|
8
|
+
* side effect — it only runs if something imports this module, and the bucket order is the one
|
|
9
|
+
* thing in the style layer with no test-visible symptom until the cascade is already wrong.
|
|
10
|
+
*
|
|
11
|
+
* Being a component is what makes that import load-bearing on its face. `ErdEditor` renders
|
|
12
|
+
* `<${GlobalStyles} />`, which no bundler will drop and no `no-unused-imports` pass will offer to
|
|
13
|
+
* delete; a bare `import '@/components/global-styles/GlobalStyles'` in its place would be a naked
|
|
14
|
+
* side-effect import that `simple-import-sort` is free to move and a future cleanup is free to
|
|
15
|
+
* mistake for dead weight. The empty render is the cheaper half of that trade.
|
|
16
|
+
*/
|
|
3
17
|
declare const GlobalStyles: FC<GlobalStylesProps>;
|
|
4
18
|
export default GlobalStyles;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/html';
|
|
1
|
+
import { StoryObj } from '@storybook/html-vite';
|
|
2
2
|
import { ButtonProps } from './Button';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
5
|
render: (args: ButtonProps) => DocumentFragment;
|
|
6
6
|
argTypes: {
|
|
7
7
|
size: {
|
|
8
|
-
control:
|
|
8
|
+
control: "radio";
|
|
9
9
|
options: string[];
|
|
10
10
|
};
|
|
11
11
|
variant: {
|
|
12
|
-
control:
|
|
12
|
+
control: "radio";
|
|
13
13
|
options: string[];
|
|
14
14
|
};
|
|
15
15
|
text: {
|
|
16
|
-
control:
|
|
16
|
+
control: "text";
|
|
17
17
|
};
|
|
18
18
|
onClick: {
|
|
19
19
|
action: string;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/html';
|
|
1
|
+
import { StoryObj } from '@storybook/html-vite';
|
|
2
2
|
import { CodeBlockProps } from './CodeBlock';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
5
|
render: (args: CodeBlockProps) => DocumentFragment;
|
|
6
6
|
argTypes: {
|
|
7
7
|
value: {
|
|
8
|
-
control:
|
|
8
|
+
control: "text";
|
|
9
9
|
};
|
|
10
10
|
lang: {
|
|
11
|
-
control:
|
|
11
|
+
control: "select";
|
|
12
12
|
options: string[];
|
|
13
13
|
};
|
|
14
14
|
theme: {
|
|
15
|
-
control:
|
|
15
|
+
control: "radio";
|
|
16
16
|
options: string[];
|
|
17
17
|
};
|
|
18
18
|
onCopy: {
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export declare const clipboard: import('@dineug/r-html').CSSTemplateLiterals;
|
|
2
2
|
export declare const root: import('@dineug/r-html').CSSTemplateLiterals;
|
|
3
|
-
|
|
3
|
+
/** Out of flow, the root loses its content height and collapses to `min-height`. */
|
|
4
|
+
export declare const scroller: import('@dineug/r-html').CSSTemplateLiterals;
|
|
5
|
+
/** Sized by the preview, so the overlay stretched onto it has no scroll of its own to desync. */
|
|
6
|
+
export declare const layers: import('@dineug/r-html').CSSTemplateLiterals;
|
|
7
|
+
export declare const preview: import('@dineug/r-html').CSSTemplateLiterals;
|
|
8
|
+
export declare const textarea: import('@dineug/r-html').CSSTemplateLiterals;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DOMTemplateLiterals, FC } from '@dineug/r-html';
|
|
2
2
|
export type MenuProps = {
|
|
3
|
-
icon
|
|
3
|
+
icon?: DOMTemplateLiterals | string | null;
|
|
4
4
|
name: DOMTemplateLiterals | string;
|
|
5
|
-
right?: DOMTemplateLiterals | string;
|
|
5
|
+
right?: DOMTemplateLiterals | string | null;
|
|
6
6
|
};
|
|
7
7
|
declare const Menu: FC<MenuProps>;
|
|
8
8
|
export default Menu;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/html';
|
|
1
|
+
import { StoryObj } from '@storybook/html-vite';
|
|
2
2
|
import { EditInputProps } from './EditInput';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
5
|
render: (args: EditInputProps) => DocumentFragment;
|
|
6
6
|
argTypes: {
|
|
7
7
|
placeholder: {
|
|
8
|
-
control:
|
|
8
|
+
control: "text";
|
|
9
9
|
};
|
|
10
10
|
edit: {
|
|
11
|
-
control:
|
|
11
|
+
control: "boolean";
|
|
12
12
|
};
|
|
13
13
|
focus: {
|
|
14
|
-
control:
|
|
14
|
+
control: "boolean";
|
|
15
15
|
};
|
|
16
16
|
width: {
|
|
17
|
-
control:
|
|
17
|
+
control: "number";
|
|
18
18
|
};
|
|
19
19
|
value: {
|
|
20
|
-
control:
|
|
20
|
+
control: "text";
|
|
21
21
|
};
|
|
22
22
|
onInput: {
|
|
23
23
|
action: string;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { FC } from '@dineug/r-html';
|
|
2
|
+
import { IconName } from './icons';
|
|
2
3
|
export type IconProps = {
|
|
3
4
|
class?: any;
|
|
4
|
-
|
|
5
|
-
name: string;
|
|
5
|
+
name: IconName;
|
|
6
6
|
size?: number;
|
|
7
|
-
color?: string;
|
|
8
7
|
useTransition?: boolean;
|
|
9
8
|
title?: string;
|
|
10
9
|
rotate?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/html';
|
|
1
|
+
import { StoryObj } from '@storybook/html-vite';
|
|
2
2
|
import { IconProps } from './Icon';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
@@ -6,3 +6,5 @@ declare const meta: {
|
|
|
6
6
|
export default meta;
|
|
7
7
|
type Story = StoryObj<IconProps>;
|
|
8
8
|
export declare const Icons: Story;
|
|
9
|
+
export declare const RelationshipNotation: Story;
|
|
10
|
+
export declare const Sizes: Story;
|