@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/dist/peer/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $i as e,
|
|
2
|
-
import { c as q, d as J, f as oe, l as se, n as ce, t as le } from "../shared-store-
|
|
1
|
+
import { $i as e, At as t, Bi as n, C as r, Ci as i, F as a, Fn as o, I as s, Ii as c, Ln as l, Qi as u, Qn as d, Rn as f, Rt as p, T as m, V as h, Vi as g, W as _, Xi as v, Zi as y, Zt as b, _ as x, aa as S, an as C, bn as w, ca as T, ci as E, da as D, ea as O, et as ee, fa as k, fn as A, gn as te, h as j, ha as ne, hn as re, ia as ie, j as ae, ln as M, ma as N, nn as P, pa as F, qn as I, qr as L, ra as R, rn as z, ua as B, va as V, wn as H, xa as U, xi as W, y as G, zn as K } from "../store-hooks-DuzDVhPy.js";
|
|
2
|
+
import { c as q, d as J, f as oe, l as se, n as ce, t as le } from "../shared-store-BqPSXAEf.js";
|
|
3
3
|
import { isEmpty as ue } from "es-toolkit/compat";
|
|
4
4
|
//#region src/engine/presence.ts
|
|
5
|
-
var de =
|
|
5
|
+
var de = w / 3, fe = (e) => {
|
|
6
6
|
e?.unref?.();
|
|
7
7
|
}, pe = [
|
|
8
8
|
"sharedMouseTrackerMap",
|
|
@@ -17,16 +17,16 @@ function me(e) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
function he(e) {
|
|
20
|
-
let t = "",
|
|
20
|
+
let t = "", n = (n) => {
|
|
21
21
|
let r = q(e.state.editor.focusTable), i = se(r);
|
|
22
|
-
i === t && !n || (t = i, e.dispatch(
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
}),
|
|
26
|
-
t &&
|
|
22
|
+
i === t && !n || (t = i, e.dispatch(I({ focus: r })));
|
|
23
|
+
}, r = e.subscribe((e) => {
|
|
24
|
+
n(e.some((e) => e.type === K.type));
|
|
25
|
+
}), i = setInterval(() => {
|
|
26
|
+
t && n(!0);
|
|
27
27
|
}, de);
|
|
28
|
-
return fe(
|
|
29
|
-
|
|
28
|
+
return fe(i), Object.freeze({ destroy: () => {
|
|
29
|
+
r(), clearInterval(i);
|
|
30
30
|
} });
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
@@ -46,9 +46,9 @@ var _e = 2, Y = 10, X = (e) => Math.round(e.length * Y) + _e, Z = {
|
|
|
46
46
|
destroyed: "this document session was closed; open the document again"
|
|
47
47
|
}, Q = class extends Error {
|
|
48
48
|
constructor(e, t) {
|
|
49
|
-
super(ve[e]),
|
|
49
|
+
super(ve[e]), x(this, "code", void 0), x(this, "operation", void 0), this.name = "PeerStoreError", this.code = e, this.operation = t;
|
|
50
50
|
}
|
|
51
|
-
}, $ =
|
|
51
|
+
}, $ = v(G), ye = v(m), be = v([
|
|
52
52
|
"table.add",
|
|
53
53
|
"column.add",
|
|
54
54
|
"memo.add",
|
|
@@ -86,10 +86,10 @@ function xe(e) {
|
|
|
86
86
|
function Se(e) {
|
|
87
87
|
if (!e) return [];
|
|
88
88
|
let { tableId: t, columnId: n, focusType: r } = e;
|
|
89
|
-
return n === void 0 ? [
|
|
89
|
+
return n === void 0 ? [l({
|
|
90
90
|
tableId: t,
|
|
91
91
|
focusType: r
|
|
92
|
-
})] : [
|
|
92
|
+
})] : [o({
|
|
93
93
|
tableId: t,
|
|
94
94
|
columnId: n,
|
|
95
95
|
focusType: r,
|
|
@@ -97,50 +97,50 @@ function Se(e) {
|
|
|
97
97
|
shiftKey: !1
|
|
98
98
|
})];
|
|
99
99
|
}
|
|
100
|
-
function Ce({ nickname: e, toWidth: t = X, presence:
|
|
101
|
-
let
|
|
100
|
+
function Ce({ nickname: e, toWidth: t = X, presence: n = !0, readonly: r = !1 }) {
|
|
101
|
+
let i = null, a = J(j({ toWidth: t }), {
|
|
102
102
|
manualStreamFlush: !0,
|
|
103
103
|
observable: !1,
|
|
104
|
-
getHistory: (e) => (
|
|
105
|
-
}),
|
|
106
|
-
|
|
104
|
+
getHistory: (e) => (i = xe(oe(e)), i.history)
|
|
105
|
+
}), o = () => i?.getPushes() ?? 0, s = () => i?.getLimit() ?? 0, l = le(a, { getNickname: () => e }, { manualStreamFlush: !0 }), u = ge(a, l), d = /* @__PURE__ */ new Set(), p = a.state.editor.id, m = r, h = !1, g = null, _ = !1, v = 0, y = [], b = [], x = null;
|
|
106
|
+
a.dispatchSync(H({
|
|
107
107
|
width: 0,
|
|
108
108
|
height: 0
|
|
109
109
|
}));
|
|
110
|
-
let S =
|
|
111
|
-
|
|
110
|
+
let S = n ? he(a) : null, C = () => {
|
|
111
|
+
g ||= l.subscribe((e) => {
|
|
112
112
|
e.some((e) => $(e.type)) && v++;
|
|
113
|
-
for (let t of Array.from(d))
|
|
113
|
+
for (let t of Array.from(d)) P(t, e);
|
|
114
114
|
});
|
|
115
115
|
}, w = (e) => {
|
|
116
|
-
if (
|
|
116
|
+
if (h) throw new Q(Z.destroyed, e);
|
|
117
117
|
}, T = (e) => {
|
|
118
118
|
if (x) throw Error(`${e} cannot run inside a group`);
|
|
119
|
-
},
|
|
120
|
-
if (w(e),
|
|
121
|
-
},
|
|
122
|
-
let e =
|
|
119
|
+
}, E = (e) => {
|
|
120
|
+
if (w(e), m) throw new Q(Z.readonly, e);
|
|
121
|
+
}, D = () => {
|
|
122
|
+
let e = s();
|
|
123
123
|
if (!e) return;
|
|
124
124
|
let t = y.reduce((e, { historyEntries: t }) => e + t, 0);
|
|
125
125
|
for (; t > e;) t -= y.shift().historyEntries;
|
|
126
126
|
for (; y.length > e;) y.splice(y.findIndex(({ historyEntries: e }) => !e), 1);
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
let n = v, r =
|
|
130
|
-
|
|
131
|
-
let
|
|
127
|
+
}, O = (e, t = {}) => {
|
|
128
|
+
E("dispatch"), C();
|
|
129
|
+
let n = v, r = o(), i = U(a.state, a.context, [...Se(t.focus), ...e]);
|
|
130
|
+
a.dispatchSync(i), i.some((e) => ye(e.type)) && u.flush();
|
|
131
|
+
let s = {
|
|
132
132
|
label: t.label ?? null,
|
|
133
133
|
actions: i.filter((e) => $(e.type)),
|
|
134
134
|
createdIds: i.filter((e) => be(e.type)).map((e) => e.payload.id),
|
|
135
135
|
batches: v - n,
|
|
136
|
-
historyEntries:
|
|
136
|
+
historyEntries: o() - r
|
|
137
137
|
};
|
|
138
|
-
return x ? (x.unit.historyEntries +=
|
|
139
|
-
label:
|
|
140
|
-
historyEntries:
|
|
141
|
-
}),
|
|
142
|
-
},
|
|
143
|
-
if (
|
|
138
|
+
return x ? (x.unit.historyEntries += s.historyEntries, x.dispatched = !0) : y.push({
|
|
139
|
+
label: s.label,
|
|
140
|
+
historyEntries: s.historyEntries
|
|
141
|
+
}), s.historyEntries && (b = []), x || D(), s;
|
|
142
|
+
}, k = (e, t) => {
|
|
143
|
+
if (E("group"), x) return t();
|
|
144
144
|
let n = {
|
|
145
145
|
unit: {
|
|
146
146
|
label: e,
|
|
@@ -152,47 +152,47 @@ function Ce({ nickname: e, toWidth: t = X, presence: r = !0, readonly: i = !1 })
|
|
|
152
152
|
try {
|
|
153
153
|
return t();
|
|
154
154
|
} finally {
|
|
155
|
-
x = null, n.dispatched && (y.push(n.unit),
|
|
155
|
+
x = null, n.dispatched && (y.push(n.unit), D());
|
|
156
156
|
}
|
|
157
|
-
},
|
|
157
|
+
}, A = (e, t) => {
|
|
158
158
|
for (let n = 0; n < e.historyEntries; n++) t();
|
|
159
159
|
u.flush();
|
|
160
160
|
};
|
|
161
161
|
return Object.freeze({
|
|
162
|
-
editorId:
|
|
162
|
+
editorId: p,
|
|
163
163
|
get value() {
|
|
164
|
-
return
|
|
164
|
+
return V(a.state);
|
|
165
165
|
},
|
|
166
166
|
get state() {
|
|
167
|
-
return
|
|
167
|
+
return a.state;
|
|
168
168
|
},
|
|
169
169
|
get isReadonly() {
|
|
170
|
-
return
|
|
170
|
+
return m;
|
|
171
171
|
},
|
|
172
172
|
get isDestroyed() {
|
|
173
|
-
return
|
|
173
|
+
return h;
|
|
174
174
|
},
|
|
175
175
|
setReadonly: (e) => {
|
|
176
|
-
|
|
176
|
+
m = e;
|
|
177
177
|
},
|
|
178
178
|
setInitialValue: (e) => {
|
|
179
179
|
w("setInitialValue"), T("setInitialValue");
|
|
180
|
-
let t =
|
|
181
|
-
|
|
180
|
+
let t = c(e);
|
|
181
|
+
a.dispatchSync(f(), ee(ue(t) ? "{}" : t)), a.resetHistory(), y = [], b = [];
|
|
182
182
|
},
|
|
183
183
|
mergeClock: (e) => {
|
|
184
|
-
|
|
184
|
+
a.context.clock.merge(e);
|
|
185
185
|
},
|
|
186
|
-
dispatch:
|
|
186
|
+
dispatch: O,
|
|
187
187
|
receive: (e) => {
|
|
188
|
-
|
|
188
|
+
h || l.dispatchSync(e);
|
|
189
189
|
},
|
|
190
|
-
group:
|
|
190
|
+
group: k,
|
|
191
191
|
undo: () => {
|
|
192
|
-
|
|
192
|
+
E("undo"), T("undo"), C();
|
|
193
193
|
let e = [], t = y.pop();
|
|
194
194
|
for (; t && !t.historyEntries;) t.label !== null && e.push(t.label), t = y.pop();
|
|
195
|
-
return t ? (
|
|
195
|
+
return t ? (A(t, a.undo), b.push(t), {
|
|
196
196
|
label: t.label,
|
|
197
197
|
entries: t.historyEntries,
|
|
198
198
|
skipped: e
|
|
@@ -203,9 +203,9 @@ function Ce({ nickname: e, toWidth: t = X, presence: r = !0, readonly: i = !1 })
|
|
|
203
203
|
};
|
|
204
204
|
},
|
|
205
205
|
redo: () => {
|
|
206
|
-
|
|
206
|
+
E("redo"), T("redo"), C();
|
|
207
207
|
let e = b.pop();
|
|
208
|
-
return e ? (
|
|
208
|
+
return e ? (A(e, a.redo), y.push(e), {
|
|
209
209
|
label: e.label,
|
|
210
210
|
entries: e.historyEntries,
|
|
211
211
|
skipped: []
|
|
@@ -215,16 +215,16 @@ function Ce({ nickname: e, toWidth: t = X, presence: r = !0, readonly: i = !1 })
|
|
|
215
215
|
skipped: []
|
|
216
216
|
};
|
|
217
217
|
},
|
|
218
|
-
subscribe: (e) => (w("subscribe"), d.add(e),
|
|
218
|
+
subscribe: (e) => (w("subscribe"), d.add(e), _ || (_ = !0, g ? a.dispatchSync(K()) : C()), () => {
|
|
219
219
|
d.delete(e);
|
|
220
220
|
}),
|
|
221
221
|
flushStreamBuffers: () => {
|
|
222
|
-
|
|
222
|
+
h || u.flush();
|
|
223
223
|
},
|
|
224
224
|
destroy: () => {
|
|
225
|
-
|
|
225
|
+
h || (h = !0, S?.destroy(), g?.(), g = null, d.clear(), l.destroy(), a.destroy(), me(a.state.editor), y = [], b = []);
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
//#endregion
|
|
230
|
-
export {
|
|
230
|
+
export { O as BracketType, y as COLUMN_MIN_WIDTH, R as CanvasType, G as ChangeActionTypes, ie as ColumnOption, S as ColumnType, T as Database, n as DatabaseVendorList, g as DatabaseVendorToDatabase, W as FocusType, B as Language, u as MEMO_MIN_HEIGHT, e as MEMO_MIN_WIDTH, D as NameCase, k as OrderType, Q as PeerStoreError, Z as PeerStoreErrorCode, F as RelationshipType, N as SaveSettingType, i as SelectType, r as SharedFollowingActionTypes, ne as Show, m as StreamActionTypes, E as bHas, j as createEngineContext, Ce as createPeerStore, ce as createSchemaSQL, X as defaultToWidth, _ as editorActions$, te as indexActions, h as indexActions$, re as indexColumnActions, s as indexColumnActions$, L as measureTableSize, A as memoActions, b as memoActions$, M as relationshipActions, a as relationshipActions$, d as settingsActions, ae as settingsActions$, C as tableActions, p as tableActions$, z as tableColumnActions, t as tableColumnActions$ };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Xi as e, ba as t, ya as n } from "./store-hooks-DuzDVhPy.js";
|
|
2
2
|
import { DateTime as r } from "luxon";
|
|
3
3
|
//#region src/services/schema-gc/procGC.ts
|
|
4
|
-
function i({ collections: e }, { tableIds:
|
|
5
|
-
|
|
4
|
+
function i({ collections: e }, { tableIds: t, tableColumnIds: r, relationshipIds: i, indexIds: a, indexColumnIds: o, memoIds: s }) {
|
|
5
|
+
n(e).collection("tableEntities").removeMany(t), n(e).collection("tableColumnEntities").removeMany(r), n(e).collection("relationshipEntities").removeMany(i), n(e).collection("indexEntities").removeMany(a), n(e).collection("indexColumnEntities").removeMany(o), n(e).collection("memoEntities").removeMany(s);
|
|
6
6
|
}
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/services/schema-gc/schemaGCService.ts
|
|
9
9
|
var a = 3, o = class {
|
|
10
10
|
async run(a) {
|
|
11
|
-
let o = JSON.parse(a), c =
|
|
11
|
+
let o = JSON.parse(a), c = t(o), { doc: { tableIds: l, memoIds: u, indexIds: d, relationshipIds: f }, collections: p } = c, m = e(l), h = e(u), g = e(d), _ = e(f), v = s(r.now()), y = n(p).collection("tableEntities"), b = n(p).collection("tableColumnEntities"), x = n(p).collection("indexEntities"), S = n(p).collection("indexColumnEntities"), C = n(p).collection("relationshipEntities"), w = n(p).collection("memoEntities"), T = new Set(y.selectAll().filter(v(m)).map(({ id: e }) => e)), E = /* @__PURE__ */ new Set(), D = new Set(C.selectAll().filter(v(_)).map(({ id: e }) => e)), O = new Set(x.selectAll().filter(v(g)).map(({ id: e }) => e)), k = /* @__PURE__ */ new Set(), A = new Set(w.selectAll().filter(v(h)).map(({ id: e }) => e));
|
|
12
12
|
b.selectAll().filter(({ tableId: e }) => T.has(e)).forEach(({ id: e }) => E.add(e)), C.selectAll().filter(({ id: e, start: t, end: n }) => !D.has(e) && (T.has(t.tableId) || T.has(n.tableId))).forEach(({ id: e }) => D.add(e)), x.selectAll().filter(({ id: e, tableId: t }) => !O.has(e) && T.has(t)).forEach(({ id: e }) => O.add(e)), S.selectAll().filter(({ indexId: e }) => O.has(e)).forEach(({ id: e }) => k.add(e)), i(c, {
|
|
13
13
|
tableIds: [...T],
|
|
14
14
|
tableColumnIds: [...E],
|