@dineug/erd-editor 3.9.1 → 3.9.2
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 +18 -0
- package/dist/engine/index.js +12 -12
- package/dist/engine/rx-operators/flushOnNotifier.d.ts +6 -0
- package/dist/engine/shared-store.d.ts +2 -2
- package/dist/erd-editor.umd.js +260 -260
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1386 -1384
- package/dist/peer/index.js +62 -62
- package/dist/{schemaGCService-_8A8Oh9Q.js → schemaGCService-BagQ1wfF.js} +4 -4
- package/dist/shared-store-BqPSXAEf.js +1072 -0
- package/dist/{store-hooks-DuNN9ZKu.js → store-hooks-DuzDVhPy.js} +249 -249
- package/dist/workers/exportPng.shared-worker.js +1 -1
- package/package.json +3 -3
- package/dist/shared-store-CtJL8B4I.js +0 -1072
package/README.md
CHANGED
|
@@ -160,6 +160,24 @@ erd-editor {
|
|
|
160
160
|
| `change` | The document changed. Debounced, and never fired while `readonly`. Read `editor.value`. |
|
|
161
161
|
| `changePresetTheme` | The theme was changed from inside the editor. `event.detail` carries the new options. |
|
|
162
162
|
|
|
163
|
+
## Key bindings
|
|
164
|
+
|
|
165
|
+
`createKeyBindingMap()` returns the shortcuts an editor listens for until `setKeyBindingMap`
|
|
166
|
+
changes them, as a new map on every call. Each is a [tinykeys](https://github.com/jamiebuilds/tinykeys)
|
|
167
|
+
chord that names its key by `KeyboardEvent.code`, where `$mod` is Cmd on macOS and Ctrl elsewhere.
|
|
168
|
+
|
|
169
|
+
```js
|
|
170
|
+
import { createKeyBindingMap } from '@dineug/erd-editor';
|
|
171
|
+
|
|
172
|
+
const shortcuts = Object.values(createKeyBindingMap())
|
|
173
|
+
.flat()
|
|
174
|
+
.map(({ shortcut }) => shortcut); // '$mod+KeyK', 'Alt+Enter', ...
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
The editor listens on its own element, so a host that takes keys before the page does, with
|
|
178
|
+
global hotkeys or a capture-phase `keydown` listener, has to let these through while the editor
|
|
179
|
+
is focused. The `KeyBindingMap`, `KeyBindingName` and `ShortcutOption` types come with it.
|
|
180
|
+
|
|
163
181
|
## Syntax highlighting
|
|
164
182
|
|
|
165
183
|
The SQL and code-generation panels are highlighted by [Shiki](https://shiki.style), in a shared
|
package/dist/engine/index.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as d, t as f } from "../schemaGCService-
|
|
1
|
+
import { Ii as e, Xn as t, c as n, et as r, h as i, nn as a, p as o, t as s, va as c, wn as l, y as u } from "../store-hooks-DuzDVhPy.js";
|
|
2
|
+
import { n as d, t as f } from "../schemaGCService-BagQ1wfF.js";
|
|
3
3
|
import { isEmpty as p } from "es-toolkit/compat";
|
|
4
4
|
import { omit as m } from "es-toolkit";
|
|
5
5
|
import { Observable as h, Subject as g, debounceTime as _, map as v } from "rxjs";
|
|
6
6
|
//#region src/engine/replication-store.ts
|
|
7
7
|
var y = { change: "change" };
|
|
8
8
|
function b(b) {
|
|
9
|
-
let x = /* @__PURE__ */ new Set(), S =
|
|
10
|
-
C.dispatchSync(
|
|
9
|
+
let x = /* @__PURE__ */ new Set(), S = i(b), C = n(S, !1);
|
|
10
|
+
C.dispatchSync(l({
|
|
11
11
|
width: 0,
|
|
12
12
|
height: 0
|
|
13
13
|
}));
|
|
14
|
-
let w =
|
|
14
|
+
let w = s(C), T = new g(), E = new h((e) => C.subscribe((t) => e.next(t))).pipe(o(u), _(200)), D = /* @__PURE__ */ new Set(), O = new f(), k = (e) => (D.has(e) || D.add(e), () => {
|
|
15
15
|
D.delete(e);
|
|
16
16
|
}), A = (e, t) => {
|
|
17
17
|
D.forEach((n) => {
|
|
18
18
|
let r = Reflect.get(n, e);
|
|
19
|
-
|
|
19
|
+
a(r, t);
|
|
20
20
|
});
|
|
21
|
-
}, j = (
|
|
22
|
-
let
|
|
23
|
-
C.dispatchSync(
|
|
24
|
-
(e.tableIds.length || e.tableColumnIds.length || e.relationshipIds.length || e.indexIds.length || e.indexColumnIds.length || e.memoIds.length) && (d(C.state, e), C.dispatchSync(
|
|
21
|
+
}, j = (n) => {
|
|
22
|
+
let i = e(n);
|
|
23
|
+
C.dispatchSync(r(p(i) ? "{}" : i)), O.run(c(C.state)).then((e) => {
|
|
24
|
+
(e.tableIds.length || e.tableColumnIds.length || e.relationshipIds.length || e.indexIds.length || e.indexColumnIds.length || e.memoIds.length) && (d(C.state, e), C.dispatchSync(t()));
|
|
25
25
|
});
|
|
26
26
|
}, M = (e) => {
|
|
27
27
|
T.next([e].flat());
|
|
28
28
|
};
|
|
29
|
-
return x.add(E.subscribe(() => A(y.change, void 0))).add(T.pipe(o(
|
|
29
|
+
return x.add(E.subscribe(() => A(y.change, void 0))).add(T.pipe(o(u), v((e) => e.map((e) => m(e, ["tags"])))).subscribe(C.dispatchSync)), Object.freeze({
|
|
30
30
|
get value() {
|
|
31
|
-
return
|
|
31
|
+
return c(C.state);
|
|
32
32
|
},
|
|
33
33
|
on: k,
|
|
34
34
|
setInitialValue: j,
|
|
@@ -6,4 +6,10 @@ import { StreamBufferOperator } from './groupByStreamActions';
|
|
|
6
6
|
* pending emits nothing and an extra tick is harmless.
|
|
7
7
|
*/
|
|
8
8
|
export declare const flushOnNotifier: (notifier$: Observable<unknown>) => StreamBufferOperator;
|
|
9
|
+
/**
|
|
10
|
+
* Closes a stream buffer after groupByStreamActions' 200 ms quiet period, or
|
|
11
|
+
* at once when the notifier fires: the editor keeps its timing, and a host
|
|
12
|
+
* can still send what is held before it lets the store go.
|
|
13
|
+
*/
|
|
14
|
+
export declare const quietPeriodOrNotifier: (notifier$: Observable<unknown>, quietMs?: number) => StreamBufferOperator;
|
|
9
15
|
//# sourceMappingURL=flushOnNotifier.d.ts.map
|
|
@@ -8,8 +8,8 @@ export type SharedStore = {
|
|
|
8
8
|
dispatchSync: (actions: Array<AnyAction> | AnyAction) => void;
|
|
9
9
|
subscribe: (fn: (value: AnyAction[]) => void) => Unsubscribe;
|
|
10
10
|
/**
|
|
11
|
-
* Sends the stream groups still held back from the peers, now
|
|
12
|
-
*
|
|
11
|
+
* Sends the stream groups still held back from the peers, now, rather than
|
|
12
|
+
* after their quiet period: what a host calls before it lets a store go.
|
|
13
13
|
*/
|
|
14
14
|
flushStreamBuffers: () => void;
|
|
15
15
|
destroy: () => void;
|