@dineug/erd-editor 3.1.1 → 3.1.3
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 +168 -40
- package/dist/components/erd/virtual-scroll/VirtualScroll.d.ts +4 -0
- package/dist/components/erd/virtual-scroll/VirtualScroll.styles.d.ts +5 -0
- package/dist/components/erd/virtual-scroll/useVirtualScroll.d.ts +10 -0
- package/dist/engine.js +2 -2
- package/dist/erd-editor.js +7297 -7119
- package/dist/{schemaGCService-QZICWWMt.js → schemaGCService-SoMd6Ovy.js} +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
# Install
|
|
8
8
|
|
|
9
|
-
```
|
|
9
|
+
```sh
|
|
10
10
|
npm install @dineug/erd-editor
|
|
11
11
|
```
|
|
12
12
|
|
|
@@ -16,12 +16,7 @@ npm install @dineug/erd-editor
|
|
|
16
16
|
import '@dineug/erd-editor';
|
|
17
17
|
|
|
18
18
|
const editor = document.createElement('erd-editor');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### html
|
|
22
|
-
|
|
23
|
-
```html
|
|
24
|
-
<erd-editor readonly system-dark-mode enable-theme-builder></erd-editor>
|
|
19
|
+
document.body.appendChild(editor);
|
|
25
20
|
```
|
|
26
21
|
|
|
27
22
|
### CDN
|
|
@@ -31,12 +26,24 @@ const editor = document.createElement('erd-editor');
|
|
|
31
26
|
import 'https://esm.run/@dineug/erd-editor';
|
|
32
27
|
|
|
33
28
|
const editor = document.createElement('erd-editor');
|
|
29
|
+
document.body.appendChild(editor);
|
|
34
30
|
</script>
|
|
35
31
|
<!-- or -->
|
|
36
32
|
<script type="module" src="https://esm.run/@dineug/erd-editor"></script>
|
|
37
33
|
```
|
|
38
34
|
|
|
39
|
-
|
|
35
|
+
### html
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<erd-editor readonly system-dark-mode enable-theme-builder></erd-editor>
|
|
39
|
+
<script type="module">
|
|
40
|
+
import 'https://esm.run/@dineug/erd-editor';
|
|
41
|
+
|
|
42
|
+
const editor = document.querySelector('erd-editor');
|
|
43
|
+
</script>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
# ErdEditorElement
|
|
40
47
|
|
|
41
48
|
```ts
|
|
42
49
|
interface ErdEditorElement extends HTMLElement {
|
|
@@ -58,22 +65,131 @@ interface ErdEditorElement extends HTMLElement {
|
|
|
58
65
|
}
|
|
59
66
|
```
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
## readonly
|
|
69
|
+
|
|
70
|
+
Sets the editing capability of the editor.
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
editor.readonly = true;
|
|
74
|
+
// or
|
|
75
|
+
editor.setAttribute('readonly', 'true');
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<erd-editor readonly></erd-editor>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## systemDarkMode
|
|
83
|
+
|
|
84
|
+
Determines whether to automatically synchronize with the system's dark/light mode.
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
editor.systemDarkMode = true;
|
|
88
|
+
// or
|
|
89
|
+
editor.setAttribute('systemDarkMode', 'true');
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<erd-editor system-dark-mode></erd-editor>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## enableThemeBuilder
|
|
97
|
+
|
|
98
|
+
Determines if a UI for easily setting preset themes is provided.
|
|
99
|
+
|
|
100
|
+
<img src="https://github.com/dineug/erd-editor/blob/main/img/theme-builder.png?raw=true" width="400" />
|
|
62
101
|
|
|
63
102
|
```js
|
|
64
|
-
|
|
65
|
-
|
|
103
|
+
editor.enableThemeBuilder = true;
|
|
104
|
+
// or
|
|
105
|
+
editor.setAttribute('enableThemeBuilder', 'true');
|
|
66
106
|
```
|
|
67
107
|
|
|
68
|
-
|
|
108
|
+
```html
|
|
109
|
+
<erd-editor enable-theme-builder></erd-editor>
|
|
110
|
+
```
|
|
69
111
|
|
|
70
|
-
|
|
112
|
+
Triggers the `changePresetTheme` event upon changing the preset theme.
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
editor.addEventListener('changePresetTheme', event => {
|
|
116
|
+
const themeOptions = event.detail;
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## value
|
|
121
|
+
|
|
122
|
+
### getter
|
|
123
|
+
|
|
124
|
+
Retrieves the current editor state as JSON data.
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
const data = editor.value;
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### setter
|
|
131
|
+
|
|
132
|
+
Loads a previously saved editor state. It is recorded in the history list, enabling `Undo, Redo`.
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
editor.value = 'json...';
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## setInitialValue
|
|
139
|
+
|
|
140
|
+
Loads a previously saved editor state. It is not recorded in the history list, so `Undo, Redo` is not possible.
|
|
71
141
|
|
|
72
142
|
```js
|
|
73
143
|
editor.setInitialValue('json...');
|
|
74
144
|
```
|
|
75
145
|
|
|
76
|
-
|
|
146
|
+
## Event
|
|
147
|
+
|
|
148
|
+
### change
|
|
149
|
+
|
|
150
|
+
When there are changes in the editor, it emits an event.
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
editor.addEventListener('change', event => {
|
|
154
|
+
const data = event.target.value;
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## focus
|
|
159
|
+
|
|
160
|
+
Focuses on the editor.
|
|
161
|
+
|
|
162
|
+
```js
|
|
163
|
+
editor.focus();
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## blur
|
|
167
|
+
|
|
168
|
+
Removes focus from the editor.
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
editor.blur();
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## clear
|
|
175
|
+
|
|
176
|
+
Resets the editor state.
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
editor.clear();
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## destroy
|
|
183
|
+
|
|
184
|
+
Completely disables reusing the editor instance.
|
|
185
|
+
|
|
186
|
+
```js
|
|
187
|
+
editor.destroy();
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## setKeyBindingMap
|
|
191
|
+
|
|
192
|
+
Redefines keyboard shortcuts.
|
|
77
193
|
|
|
78
194
|
```ts
|
|
79
195
|
type ShortcutOption = {
|
|
@@ -106,10 +222,15 @@ editor.setKeyBindingMap({
|
|
|
106
222
|
|
|
107
223
|
### $mod
|
|
108
224
|
|
|
225
|
+
Switches `Control` key depending on the environment.
|
|
226
|
+
|
|
109
227
|
- Mac: $mod = Meta (⌘)
|
|
110
228
|
- Windows/Linux: $mod = Control
|
|
111
229
|
|
|
112
|
-
|
|
230
|
+
### Shortcut Table
|
|
231
|
+
|
|
232
|
+
Uses keyboard event `key, code` properties.
|
|
233
|
+
Use `code` for absolute positions and `key` for input values.
|
|
113
234
|
|
|
114
235
|
| Windows | macOS | `key` | `code` |
|
|
115
236
|
| ------------- | --------------- | ------------- | ------------------------------ |
|
|
@@ -126,31 +247,11 @@ editor.setKeyBindingMap({
|
|
|
126
247
|
| `=` | `=` | `=` | `Equal` |
|
|
127
248
|
| `+` | `+` | `+` | `Equal`\* |
|
|
128
249
|
|
|
129
|
-
## Events
|
|
130
|
-
|
|
131
|
-
### change
|
|
132
|
-
|
|
133
|
-
```js
|
|
134
|
-
editor.addEventListener('change', event => {
|
|
135
|
-
const data = event.target.value;
|
|
136
|
-
});
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### changePresetTheme
|
|
140
|
-
|
|
141
|
-
enableThemeBuilder: true will cause an event.
|
|
142
|
-
|
|
143
|
-
```js
|
|
144
|
-
editor.addEventListener('changePresetTheme', event => {
|
|
145
|
-
const themeOptions = event.detail;
|
|
146
|
-
});
|
|
147
|
-
```
|
|
148
|
-
|
|
149
250
|
## Theme
|
|
150
251
|
|
|
151
252
|
### setPresetTheme
|
|
152
253
|
|
|
153
|
-
|
|
254
|
+
Sets a preset theme.
|
|
154
255
|
|
|
155
256
|
```ts
|
|
156
257
|
type ThemeOptions = {
|
|
@@ -191,9 +292,9 @@ editor.setPresetTheme({ appearance: 'light' });
|
|
|
191
292
|
|
|
192
293
|
### setTheme
|
|
193
294
|
|
|
194
|
-
|
|
295
|
+
Allows customizing the theme.
|
|
195
296
|
|
|
196
|
-
####
|
|
297
|
+
#### JavaScript
|
|
197
298
|
|
|
198
299
|
```ts
|
|
199
300
|
type Theme = {
|
|
@@ -273,6 +374,7 @@ type Theme = {
|
|
|
273
374
|
keyPFK: string;
|
|
274
375
|
};
|
|
275
376
|
|
|
377
|
+
|
|
276
378
|
// example
|
|
277
379
|
editor.setTheme({...});
|
|
278
380
|
```
|
|
@@ -343,8 +445,34 @@ editor.setTheme({...});
|
|
|
343
445
|
}
|
|
344
446
|
```
|
|
345
447
|
|
|
346
|
-
##
|
|
448
|
+
## setSchemaSQL
|
|
449
|
+
|
|
450
|
+
Loads a schema SQL file.
|
|
451
|
+
|
|
452
|
+
```js
|
|
453
|
+
editor.setSchemaSQL('Schema SQL...');
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
## getSchemaSQL
|
|
457
|
+
|
|
458
|
+
Extracts the current editor state into a schema SQL.
|
|
459
|
+
If `databaseVendor` is not specified, it operates based on the currently set vendor.
|
|
460
|
+
|
|
461
|
+
```ts
|
|
462
|
+
type DatabaseVendor =
|
|
463
|
+
| 'MariaDB'
|
|
464
|
+
| 'MSSQL'
|
|
465
|
+
| 'MySQL'
|
|
466
|
+
| 'Oracle'
|
|
467
|
+
| 'PostgreSQL'
|
|
468
|
+
| 'SQLite';
|
|
469
|
+
|
|
470
|
+
const schemaSQL = editor.getSchemaSQL();
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
# Document
|
|
347
474
|
|
|
348
475
|
- [Web App](https://erd-editor.io)
|
|
349
476
|
- [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=dineug.vuerd-vscode)
|
|
350
477
|
- [Editing Guide](https://docs.erd-editor.io/docs/category/guides)
|
|
478
|
+
- [API](https://docs.erd-editor.io/docs/api/erd-editor-element)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const vertical: import("@dineug/r-html").CSSTemplateLiterals;
|
|
2
|
+
export declare const horizontal: import("@dineug/r-html").CSSTemplateLiterals;
|
|
3
|
+
export declare const ghostThumb: import("@dineug/r-html").CSSTemplateLiterals;
|
|
4
|
+
export declare const verticalThumb: import("@dineug/r-html").CSSTemplateLiterals;
|
|
5
|
+
export declare const horizontalThumb: import("@dineug/r-html").CSSTemplateLiterals;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Ctx } from "../../../internal-types";
|
|
2
|
+
export declare function useVirtualScroll(ctx: Ctx): {
|
|
3
|
+
state: {
|
|
4
|
+
selected: "vertical" | "horizontal" | null;
|
|
5
|
+
};
|
|
6
|
+
onScrollLeftStart: (event: MouseEvent) => void;
|
|
7
|
+
onScrollTopStart: (event: MouseEvent) => void;
|
|
8
|
+
getWidthRatio: () => number;
|
|
9
|
+
getHeightRatio: () => number;
|
|
10
|
+
};
|
package/dist/engine.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as A, E as w, u as x, O as E, F as l, J as $, p as G, bs as d, I as p, Y as I, c$ as O, br as T, aA as j, d5 as k, U as F, cY as J, cS as R } from "./schemaGCService-
|
|
1
|
+
import { D as A, E as w, u as x, O as E, F as l, J as $, p as G, bs as d, I as p, Y as I, c$ as O, br as T, aA as j, d5 as k, U as F, cY as J, cS as R } from "./schemaGCService-SoMd6Ovy.js";
|
|
2
2
|
/*!
|
|
3
3
|
* @dineug/erd-editor
|
|
4
|
-
* @version 3.1.
|
|
4
|
+
* @version 3.1.3 | Sat Jan 13 2024
|
|
5
5
|
* @author SeungHwan-Lee <dineug2@gmail.com>
|
|
6
6
|
* @license MIT
|
|
7
7
|
*/
|