@dineug/erd-editor 3.0.5 → 3.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 +1 -0
- package/dist/components/erd/Erd.d.ts +1 -0
- package/dist/components/erd/canvas/shared-mouse-tracker/SharedMouseTracker.d.ts +4 -0
- package/dist/components/erd/canvas/shared-mouse-tracker/shared-mouse-cursor/SharedMouseCursor.d.ts +7 -0
- package/dist/components/erd/canvas/shared-mouse-tracker/shared-mouse-cursor/SharedMouseCursor.styles.d.ts +1 -0
- package/dist/components/erd-editor/ErdEditor.d.ts +4 -0
- package/dist/components/toolbar/Toolbar.d.ts +1 -0
- package/dist/engine/actions.d.ts +3 -0
- package/dist/engine/history.actions.d.ts +1 -1
- package/dist/engine/index.d.ts +1 -2
- package/dist/engine/modules/editor/actions.d.ts +5 -0
- package/dist/engine/modules/editor/atom.actions.d.ts +23 -0
- package/dist/engine/modules/editor/state.d.ts +9 -0
- package/dist/engine/replication-store.d.ts +23 -0
- package/dist/engine/rx-operators/bufferCircuitBreaker.d.ts +3 -0
- package/dist/engine/rx-operators/groupByStreamActions.d.ts +2 -2
- package/dist/engine/rx-operators/ignoreTagFilter.d.ts +1 -1
- package/dist/engine/rx-operators/index.d.ts +2 -0
- package/dist/engine/rx-operators/readonlyIgnoreFilter.d.ts +1 -1
- package/dist/engine/rx-operators/sharedStreamActionsCompressor.d.ts +3 -0
- package/dist/engine/shared-store.d.ts +15 -0
- package/dist/engine/store.d.ts +1 -1
- package/dist/engine/tag.d.ts +5 -2
- package/dist/engine.js +37 -4
- package/dist/erd-editor.js +13720 -19648
- package/dist/schemaGCService-gIQm27aj.js +15936 -0
- package/dist/utils/device-detect/index.d.ts +8 -7
- package/dist/utils/emitter.d.ts +15 -0
- package/dist/utils/globalEmitter.d.ts +2 -0
- package/dist/utils/globalEventObservable.d.ts +4 -0
- package/package.json +3 -5
- package/dist/index-dVzXEMES.js +0 -10581
- /package/dist/engine/{store.hooks.d.ts → store-hooks.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -54,6 +54,7 @@ interface ErdEditorElement extends HTMLElement {
|
|
|
54
54
|
setKeyBindingMap: (keyBindingMap: Partial<KeyBindingMap>) => void;
|
|
55
55
|
setSchemaSQL: (value: string) => void;
|
|
56
56
|
getSchemaSQL: (databaseVendor?: DatabaseVendor) => string;
|
|
57
|
+
getSharedStore: (config?: SharedStoreConfig) => SharedStore;
|
|
57
58
|
}
|
|
58
59
|
```
|
|
59
60
|
|
package/dist/components/erd/canvas/shared-mouse-tracker/shared-mouse-cursor/SharedMouseCursor.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from '@dineug/r-html';
|
|
2
|
+
import { SharedMouseTracker } from "../../../../../engine/modules/editor/state";
|
|
3
|
+
export type SharedMouseCursorProps = {
|
|
4
|
+
tracker: SharedMouseTracker;
|
|
5
|
+
};
|
|
6
|
+
declare const SharedMouseCursor: FC<SharedMouseCursorProps>;
|
|
7
|
+
export default SharedMouseCursor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cursor: import("@dineug/r-html").CSSTemplateLiterals;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DatabaseVendor } from "../../constants/sql/database";
|
|
2
|
+
import { SharedStore, SharedStoreConfig } from "../../engine/shared-store";
|
|
2
3
|
import { ThemeOptions } from "../../themes/radix-ui-theme";
|
|
3
4
|
import { Theme as ThemeType } from "../../themes/tokens";
|
|
4
5
|
import { KeyBindingMap, KeyBindingName } from "../../utils/keyboard-shortcut";
|
|
@@ -24,4 +25,7 @@ export interface ErdEditorElement extends ErdEditorProps, HTMLElement {
|
|
|
24
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;
|
|
25
26
|
setSchemaSQL: (value: string) => void;
|
|
26
27
|
getSchemaSQL: (databaseVendor?: DatabaseVendor) => string;
|
|
28
|
+
getSharedStore: (config?: SharedStoreConfig & {
|
|
29
|
+
mouseTracker?: boolean;
|
|
30
|
+
}) => SharedStore;
|
|
27
31
|
}
|
package/dist/engine/actions.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ export type ActionType = keyof RootActionMap;
|
|
|
28
28
|
export declare const actions: Actions;
|
|
29
29
|
export declare const ChangeActionTypes: ReadonlyArray<ActionType>;
|
|
30
30
|
export declare const ReadonlyIgnoreActionTypes: ReadonlyArray<ActionType>;
|
|
31
|
+
export declare const SharedStreamActionTypes: ReadonlyArray<ActionType>;
|
|
32
|
+
export declare const SharedActionTypes: ReadonlyArray<ActionType>;
|
|
33
|
+
export declare const SharedFollowingActionTypes: ReadonlyArray<ActionType>;
|
|
31
34
|
export declare const StreamRegroupMoveActionTypes: ReadonlyArray<ActionType>;
|
|
32
35
|
export declare const StreamRegroupColorActionTypes: ReadonlyArray<ActionType>;
|
|
33
36
|
export declare const StreamRegroupScrollActionTypes: ReadonlyArray<ActionType>;
|
|
@@ -3,7 +3,7 @@ import { History } from "./history";
|
|
|
3
3
|
import { RootState } from "./state";
|
|
4
4
|
import { Store } from "./store";
|
|
5
5
|
export type PushUndoHistory = (undoActions: AnyAction[], action: AnyAction, state: RootState) => void;
|
|
6
|
-
export type PushStreamHistory = (undoActions: AnyAction[], redoActions: AnyAction[], actions: AnyAction[]
|
|
6
|
+
export type PushStreamHistory = (undoActions: AnyAction[], redoActions: AnyAction[], actions: AnyAction[]) => void;
|
|
7
7
|
export declare const pushUndoHistoryMap: Record<string, PushUndoHistory>;
|
|
8
8
|
export declare const pushStreamHistoryMap: Record<string, PushStreamHistory>;
|
|
9
9
|
export declare const pushHistory: (store: Store, history: History) => (actions: AnyAction[]) => void;
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { type
|
|
2
|
-
export { createRxStore, type RxStore } from './rx-store';
|
|
1
|
+
export { createReplicationStore, type ReplicationStore, } from './replication-store';
|
|
@@ -28,6 +28,7 @@ export declare const ActionType: {
|
|
|
28
28
|
readonly changeOpenMap: "editor.changeOpenMap";
|
|
29
29
|
readonly dragstartColumn: "editor.dragstartColumn";
|
|
30
30
|
readonly dragendColumn: "editor.dragendColumn";
|
|
31
|
+
readonly sharedMouseTracker: "editor.sharedMouseTracker";
|
|
31
32
|
};
|
|
32
33
|
export type ActionType = ValuesType<typeof ActionType>;
|
|
33
34
|
export type ActionMap = {
|
|
@@ -89,5 +90,9 @@ export type ActionMap = {
|
|
|
89
90
|
columnIds: string[];
|
|
90
91
|
};
|
|
91
92
|
[ActionType.dragendColumn]: void;
|
|
93
|
+
[ActionType.sharedMouseTracker]: {
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
};
|
|
92
97
|
};
|
|
93
98
|
export type ReducerType<T extends keyof ActionMap> = Reducer<RootState, T, ActionMap, EngineContext>;
|
|
@@ -188,6 +188,17 @@ export declare const dragendColumnAction: {
|
|
|
188
188
|
toString(): string;
|
|
189
189
|
type: string;
|
|
190
190
|
};
|
|
191
|
+
export declare const sharedMouseTrackerAction: {
|
|
192
|
+
(payload: {
|
|
193
|
+
x: number;
|
|
194
|
+
y: number;
|
|
195
|
+
}): import("@dineug/r-html").AnyAction<{
|
|
196
|
+
x: number;
|
|
197
|
+
y: number;
|
|
198
|
+
}>;
|
|
199
|
+
toString(): string;
|
|
200
|
+
type: string;
|
|
201
|
+
};
|
|
191
202
|
export declare const editorReducers: {
|
|
192
203
|
"editor.changeHasHistory": ReducerType<"editor.changeHasHistory">;
|
|
193
204
|
"editor.selectAll": ReducerType<"editor.selectAll">;
|
|
@@ -213,6 +224,7 @@ export declare const editorReducers: {
|
|
|
213
224
|
"editor.changeOpenMap": ReducerType<"editor.changeOpenMap">;
|
|
214
225
|
"editor.dragstartColumn": ReducerType<"editor.dragstartColumn">;
|
|
215
226
|
"editor.dragendColumn": ReducerType<"editor.dragendColumn">;
|
|
227
|
+
"editor.sharedMouseTracker": ReducerType<"editor.sharedMouseTracker">;
|
|
216
228
|
};
|
|
217
229
|
export declare const actions: {
|
|
218
230
|
changeHasHistoryAction: {
|
|
@@ -403,4 +415,15 @@ export declare const actions: {
|
|
|
403
415
|
toString(): string;
|
|
404
416
|
type: string;
|
|
405
417
|
};
|
|
418
|
+
sharedMouseTrackerAction: {
|
|
419
|
+
(payload: {
|
|
420
|
+
x: number;
|
|
421
|
+
y: number;
|
|
422
|
+
}): import("@dineug/r-html").AnyAction<{
|
|
423
|
+
x: number;
|
|
424
|
+
y: number;
|
|
425
|
+
}>;
|
|
426
|
+
toString(): string;
|
|
427
|
+
type: string;
|
|
428
|
+
};
|
|
406
429
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Point, ValuesType } from "../../../internal-types";
|
|
2
2
|
export type Editor = {
|
|
3
|
+
id: string;
|
|
3
4
|
selectedMap: Record<string, SelectType>;
|
|
4
5
|
hasUndo: boolean;
|
|
5
6
|
hasRedo: boolean;
|
|
@@ -10,6 +11,7 @@ export type Editor = {
|
|
|
10
11
|
openMap: Record<string, boolean>;
|
|
11
12
|
draggableColumn: DraggableColumn | null;
|
|
12
13
|
draggingColumnMap: Record<string, boolean>;
|
|
14
|
+
sharedMouseTrackerMap: Record<string, SharedMouseTracker>;
|
|
13
15
|
};
|
|
14
16
|
export type Viewport = {
|
|
15
17
|
width: number;
|
|
@@ -34,6 +36,13 @@ export type DraggableColumn = {
|
|
|
34
36
|
tableId: string;
|
|
35
37
|
columnIds: string[];
|
|
36
38
|
};
|
|
39
|
+
export type SharedMouseTracker = {
|
|
40
|
+
id: string;
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
nickname: string;
|
|
44
|
+
timeoutId: any;
|
|
45
|
+
};
|
|
37
46
|
export declare const SelectType: {
|
|
38
47
|
readonly table: "table";
|
|
39
48
|
readonly memo: "memo";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AnyAction } from '@dineug/r-html';
|
|
2
|
+
import { EngineContext } from "./context";
|
|
3
|
+
import { Unsubscribe, ValuesType } from "../internal-types";
|
|
4
|
+
type ReducerRecord = {
|
|
5
|
+
[P in keyof InternalActionMap]: (payload: InternalActionMap[P]) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const InternalActionType: {
|
|
8
|
+
readonly change: "change";
|
|
9
|
+
};
|
|
10
|
+
type InternalActionType = ValuesType<typeof InternalActionType>;
|
|
11
|
+
type InternalActionMap = {
|
|
12
|
+
[InternalActionType.change]: void;
|
|
13
|
+
};
|
|
14
|
+
export type ReplicationStore = {
|
|
15
|
+
readonly value: string;
|
|
16
|
+
on: (reducers: Partial<ReducerRecord>) => Unsubscribe;
|
|
17
|
+
setInitialValue: (value: string) => void;
|
|
18
|
+
dispatch: (actions: Array<AnyAction> | AnyAction) => void;
|
|
19
|
+
dispatchSync: (actions: Array<AnyAction> | AnyAction) => void;
|
|
20
|
+
destroy: () => void;
|
|
21
|
+
};
|
|
22
|
+
export declare function createReplicationStore(context: EngineContext): ReplicationStore;
|
|
23
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnyAction } from '@dineug/r-html';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
2
|
+
import { MonoTypeOperatorFunction, Observable } from 'rxjs';
|
|
3
3
|
type Regroup = [string, Array<string> | ReadonlyArray<string>];
|
|
4
|
-
export declare const groupByStreamActions: (streamActionTypes: Array<string> | ReadonlyArray<string>, regroups?: Regroup[]) => (source$: Observable<Array<AnyAction>>) => Observable<AnyAction[]>;
|
|
4
|
+
export declare const groupByStreamActions: (streamActionTypes: Array<string> | ReadonlyArray<string>, regroups?: Regroup[], bufferClosingNotifierOperator?: MonoTypeOperatorFunction<Array<AnyAction>>) => (source$: Observable<Array<AnyAction>>) => Observable<AnyAction[]>;
|
|
5
5
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AnyAction } from '@dineug/r-html';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
export declare const ignoreTagFilter: (
|
|
3
|
+
export declare const ignoreTagFilter: (tags: number[]) => (source$: Observable<Array<AnyAction>>) => Observable<AnyAction[]>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AnyAction } from '@dineug/r-html';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
export declare const readonlyIgnoreFilter: (getReadonly: () => boolean) => (source$: Observable<Array<AnyAction>>) => Observable<AnyAction[]>;
|
|
3
|
+
export declare const readonlyIgnoreFilter: (getReadonly: () => boolean, passTags?: number[]) => (source$: Observable<Array<AnyAction>>) => Observable<AnyAction[]>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AnyAction } from '@dineug/r-html';
|
|
2
|
+
import { RxStore } from "./rx-store";
|
|
3
|
+
import { Unsubscribe } from "../internal-types";
|
|
4
|
+
export type SharedStore = {
|
|
5
|
+
connection: () => void;
|
|
6
|
+
disconnect: () => void;
|
|
7
|
+
dispatch: (actions: Array<AnyAction> | AnyAction) => void;
|
|
8
|
+
dispatchSync: (actions: Array<AnyAction> | AnyAction) => void;
|
|
9
|
+
subscribe: (fn: (value: AnyAction[]) => void) => Unsubscribe;
|
|
10
|
+
destroy: () => void;
|
|
11
|
+
};
|
|
12
|
+
export type SharedStoreConfig = {
|
|
13
|
+
getNickname?: () => string;
|
|
14
|
+
};
|
|
15
|
+
export declare function createSharedStore(store: RxStore, config?: SharedStoreConfig): SharedStore;
|
package/dist/engine/store.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { Store as StoreType } from '@dineug/r-html';
|
|
|
2
2
|
import { EngineContext } from "./context";
|
|
3
3
|
import { RootState } from "./state";
|
|
4
4
|
export type Store = StoreType<RootState, EngineContext>;
|
|
5
|
-
export declare function createStore(context: EngineContext): Store;
|
|
5
|
+
export declare function createStore(context: EngineContext, enableObservable?: boolean): Store;
|
package/dist/engine/tag.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { AnyAction, CompositionActions } from '@dineug/r-html';
|
|
|
2
2
|
import { GeneratorAction } from "./generator.actions";
|
|
3
3
|
export declare const Tag: {
|
|
4
4
|
readonly shared: 1;
|
|
5
|
+
readonly changeOnly: 2;
|
|
6
|
+
readonly following: 4;
|
|
5
7
|
};
|
|
6
|
-
export declare function attachActionTag(tag: number,
|
|
7
|
-
export declare
|
|
8
|
+
export declare function attachActionTag(tag: number, action: AnyAction): AnyAction;
|
|
9
|
+
export declare function attachActionsTag(tag: number, actions: AnyAction[]): AnyAction[];
|
|
10
|
+
export declare const attachChangeOnlyTag$: (...compositionActions: CompositionActions) => GeneratorAction;
|
package/dist/engine.js
CHANGED
|
@@ -1,11 +1,44 @@
|
|
|
1
|
-
import { E as
|
|
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-gIQm27aj.js";
|
|
2
2
|
/*!
|
|
3
3
|
* @dineug/erd-editor
|
|
4
|
-
* @version 3.0
|
|
4
|
+
* @version 3.1.0 | Sat Jan 06 2024
|
|
5
5
|
* @author SeungHwan-Lee <dineug2@gmail.com>
|
|
6
6
|
* @license MIT
|
|
7
7
|
*/
|
|
8
|
+
const b = {
|
|
9
|
+
change: "change"
|
|
10
|
+
};
|
|
11
|
+
function Y(u) {
|
|
12
|
+
const o = /* @__PURE__ */ new Set(), s = A(u, !1), m = w(s), c = new x(), S = new E((e) => s.subscribe((a) => e.next(a))).pipe(l(p), $(200)), n = /* @__PURE__ */ new Set(), f = new R(), g = (e) => (n.has(e) || n.add(e), () => {
|
|
13
|
+
n.delete(e);
|
|
14
|
+
}), i = (e, a) => {
|
|
15
|
+
n.forEach((t) => {
|
|
16
|
+
const h = Reflect.get(t, e);
|
|
17
|
+
I(h, a);
|
|
18
|
+
});
|
|
19
|
+
}, y = (e) => {
|
|
20
|
+
const a = O(e);
|
|
21
|
+
s.dispatchSync(T(j(a) ? "{}" : a)), f.run(d(s.state)).then((t) => {
|
|
22
|
+
(t.tableIds.length || t.tableColumnIds.length || t.relationshipIds.length || t.indexIds.length || t.indexColumnIds.length || t.memoIds.length) && (k(s.state, t), i(b.change, void 0));
|
|
23
|
+
});
|
|
24
|
+
}, r = (e) => {
|
|
25
|
+
c.next([e].flat());
|
|
26
|
+
}, C = (e) => {
|
|
27
|
+
F(() => r(e));
|
|
28
|
+
}, v = () => {
|
|
29
|
+
Array.from(o).forEach((e) => e.unsubscribe()), o.clear(), n.clear(), s.destroy(), m.destroy();
|
|
30
|
+
};
|
|
31
|
+
return o.add(S.subscribe(() => i(b.change, void 0))).add(c.pipe(l(p), G((e) => e.map((a) => J(a, "tags")))).subscribe(s.dispatchSync)), Object.freeze({
|
|
32
|
+
get value() {
|
|
33
|
+
return d(s.state);
|
|
34
|
+
},
|
|
35
|
+
on: g,
|
|
36
|
+
setInitialValue: y,
|
|
37
|
+
dispatch: C,
|
|
38
|
+
dispatchSync: r,
|
|
39
|
+
destroy: v
|
|
40
|
+
});
|
|
41
|
+
}
|
|
8
42
|
export {
|
|
9
|
-
|
|
10
|
-
r as createRxStore
|
|
43
|
+
Y as createReplicationStore
|
|
11
44
|
};
|