mind-elixir 5.11.1-beta.0 → 5.11.1-beta.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/dist/MindElixir.css +1 -1
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +698 -663
- package/dist/MindElixirLite.css +1 -1
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +547 -508
- package/dist/PlaintextConverter.js +99 -96
- package/dist/types/arrow.d.ts +4 -4
- package/dist/types/docs.d.ts +2 -2
- package/dist/types/index.d.ts +19 -18
- package/dist/types/methods.d.ts +22 -17
- package/dist/types/summary.d.ts +3 -8
- package/dist/types/types/dom.d.ts +6 -3
- package/dist/types/types/index.d.ts +12 -5
- package/dist/types/utils/panHelper.d.ts +3 -1
- package/dist/types/utils/svg.d.ts +2 -2
- package/dist/types/viselect/src/index.d.ts +9 -9
- package/dist/types/viselect/src/types.d.ts +1 -1
- package/dist/types/viselect/src/utils/events.d.ts +1 -1
- package/dist/types/viselect/src/utils/matchesTrigger.d.ts +5 -5
- package/package.json +18 -17
- package/readme/es.md +453 -0
- package/readme/fr.md +437 -0
- package/readme/ja.md +452 -0
- package/readme/ko.md +435 -0
- package/readme/pt.md +436 -0
- package/readme/ru.md +435 -0
- package/readme/zh.md +453 -0
|
@@ -10,28 +10,28 @@ class S {
|
|
|
10
10
|
this.slots = Array.from({ length: d + 1 }, () => []);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
function j(
|
|
14
|
-
const { nodeData: o, arrows: d = [], summaries:
|
|
15
|
-
function
|
|
13
|
+
function j(l) {
|
|
14
|
+
const { nodeData: o, arrows: d = [], summaries: n = [] } = l, r = /* @__PURE__ */ new Map();
|
|
15
|
+
function e(t) {
|
|
16
16
|
const s = new S(t);
|
|
17
|
-
return r.set(t.id, s), t.children && (s.children = t.children.map(
|
|
17
|
+
return r.set(t.id, s), t.children && (s.children = t.children.map(e)), s;
|
|
18
18
|
}
|
|
19
|
-
const i =
|
|
19
|
+
const i = e(o), c = [], h = /* @__PURE__ */ new Set();
|
|
20
20
|
for (const t of d) {
|
|
21
|
-
|
|
22
|
-
const s = t.metadata, p = s?.parentId,
|
|
21
|
+
h.add(t.from), h.add(t.to);
|
|
22
|
+
const s = t.metadata, p = s?.parentId, g = s?.index ?? 1 / 0;
|
|
23
23
|
if (!p) {
|
|
24
|
-
|
|
24
|
+
c.push(t);
|
|
25
25
|
continue;
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
const
|
|
30
|
-
|
|
27
|
+
const y = r.get(p);
|
|
28
|
+
if (y) {
|
|
29
|
+
const $ = Math.min(g, y.children.length);
|
|
30
|
+
y.slots[$].push({ type: "arrow", arrow: t });
|
|
31
31
|
} else
|
|
32
|
-
|
|
32
|
+
c.push(t);
|
|
33
33
|
}
|
|
34
|
-
for (const t of
|
|
34
|
+
for (const t of n) {
|
|
35
35
|
const s = r.get(t.parent);
|
|
36
36
|
if (s) {
|
|
37
37
|
const p = Math.min(t.end + 1, s.children.length);
|
|
@@ -41,32 +41,32 @@ function j(c) {
|
|
|
41
41
|
function a(t) {
|
|
42
42
|
return r.get(t)?.node.metadata?.refId ?? t;
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
function
|
|
46
|
-
const p = " ".repeat(s),
|
|
47
|
-
C &&
|
|
48
|
-
for (let
|
|
49
|
-
for (const N of t.slots[
|
|
44
|
+
const u = [];
|
|
45
|
+
function f(t, s) {
|
|
46
|
+
const p = " ".repeat(s), g = " ".repeat(s + 1), y = t.node.metadata, $ = [t.node.topic], C = y?.refId ?? (h.has(t.node.id) ? t.node.id : void 0);
|
|
47
|
+
C && $.push(`[^${C}]`), t.node.style && Object.keys(t.node.style).length > 0 && $.push(JSON.stringify(t.node.style)), u.push(`${p}- ${$.join(" ")}`);
|
|
48
|
+
for (let w = 0; w <= t.children.length; w++) {
|
|
49
|
+
for (const N of t.slots[w])
|
|
50
50
|
if (N.type === "arrow") {
|
|
51
|
-
const
|
|
52
|
-
|
|
51
|
+
const m = N.arrow, b = m.bidirectional ? `<-${m.label ?? ""}->` : `>-${m.label ?? ""}->`, x = m.delta1 ? ` (${m.delta1.x},${m.delta1.y})` : "", M = m.delta2 ? ` (${m.delta2.x},${m.delta2.y})` : "";
|
|
52
|
+
u.push(`${g}- > [^${a(m.from)}]${x} ${b}${M} [^${a(m.to)}]`);
|
|
53
53
|
} else if (N.type === "summary") {
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const m = N.summary, b = m.end - m.start + 1, x = b === t.children.length ? "" : `:${b} `;
|
|
55
|
+
u.push(`${g}- }${x}${m.label}`);
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
w < t.children.length && f(t.children[w], s + 1);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
for (const t of
|
|
62
|
-
const s = t.bidirectional ? `<-${t.label ?? ""}->` : `>-${t.label ?? ""}->`, p = t.delta1 ? ` (${t.delta1.x},${t.delta1.y})` : "",
|
|
63
|
-
|
|
60
|
+
f(i, 0);
|
|
61
|
+
for (const t of c) {
|
|
62
|
+
const s = t.bidirectional ? `<-${t.label ?? ""}->` : `>-${t.label ?? ""}->`, p = t.delta1 ? ` (${t.delta1.x},${t.delta1.y})` : "", g = t.delta2 ? ` (${t.delta2.x},${t.delta2.y})` : "";
|
|
63
|
+
u.push(`- > [^${a(t.from)}]${p} ${s}${g} [^${a(t.to)}]`);
|
|
64
64
|
}
|
|
65
|
-
return
|
|
65
|
+
return u.join(`
|
|
66
66
|
`) + `
|
|
67
67
|
`;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function I() {
|
|
70
70
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
|
|
71
71
|
}
|
|
72
72
|
const k = `- Root Node
|
|
@@ -94,71 +94,71 @@ const k = `- Root Node
|
|
|
94
94
|
- > [^node-2-1] <-Link position is not restricted, as long as the id can be found during rendering-> [^id8]
|
|
95
95
|
|
|
96
96
|
`;
|
|
97
|
-
function A(
|
|
98
|
-
const d =
|
|
97
|
+
function A(l, o = "Root") {
|
|
98
|
+
const d = l.split(`
|
|
99
99
|
`).filter((a) => a.trim());
|
|
100
100
|
if (d.length === 0)
|
|
101
101
|
throw new Error("Failed to parse plaintext: no root node found");
|
|
102
|
-
const
|
|
102
|
+
const n = {
|
|
103
103
|
arrowLines: [],
|
|
104
104
|
nodeIdMap: /* @__PURE__ */ new Map()
|
|
105
|
-
}, r = [],
|
|
105
|
+
}, r = [], e = [], i = [];
|
|
106
106
|
for (const a of d) {
|
|
107
|
-
const
|
|
108
|
-
for (;
|
|
109
|
-
|
|
110
|
-
const t =
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
content:
|
|
107
|
+
const u = v(a), f = T(a);
|
|
108
|
+
for (; e.length > 0 && e[e.length - 1].indent >= u; )
|
|
109
|
+
e.pop();
|
|
110
|
+
const t = e.length > 0 ? e[e.length - 1].node : null, s = t ? t.children ??= [] : i;
|
|
111
|
+
if (f.type === "arrow") {
|
|
112
|
+
n.arrowLines.push({
|
|
113
|
+
content: f.content,
|
|
114
114
|
parentId: t?.id ?? null,
|
|
115
115
|
index: s.length
|
|
116
116
|
});
|
|
117
117
|
continue;
|
|
118
118
|
}
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
|
|
119
|
+
if (f.type === "summary") {
|
|
120
|
+
const y = O(f.content, s, t?.id ?? "");
|
|
121
|
+
y && r.push(y);
|
|
122
122
|
continue;
|
|
123
123
|
}
|
|
124
|
-
const p =
|
|
125
|
-
topic:
|
|
124
|
+
const p = I(), g = {
|
|
125
|
+
topic: f.topic,
|
|
126
126
|
id: p
|
|
127
127
|
};
|
|
128
|
-
|
|
128
|
+
f.style && (g.style = f.style), f.refId && (n.nodeIdMap.set(f.refId, p), g.metadata = { refId: f.refId }), s.push(g), e.push({ indent: u, node: g });
|
|
129
129
|
}
|
|
130
130
|
if (i.length === 0)
|
|
131
131
|
throw new Error("Failed to parse plaintext: no root node found");
|
|
132
|
-
let
|
|
133
|
-
i.length === 1 ?
|
|
132
|
+
let c;
|
|
133
|
+
i.length === 1 ? c = i[0] : c = {
|
|
134
134
|
topic: o,
|
|
135
|
-
id:
|
|
135
|
+
id: I(),
|
|
136
136
|
children: i
|
|
137
137
|
};
|
|
138
|
-
const
|
|
139
|
-
const t = R(a,
|
|
140
|
-
return t && (t.metadata = { parentId:
|
|
138
|
+
const h = n.arrowLines.map(({ content: a, parentId: u, index: f }) => {
|
|
139
|
+
const t = R(a, n);
|
|
140
|
+
return t && (t.metadata = { parentId: u, index: f }), t;
|
|
141
141
|
}).filter((a) => a !== null);
|
|
142
142
|
return {
|
|
143
|
-
nodeData:
|
|
144
|
-
arrows:
|
|
143
|
+
nodeData: c,
|
|
144
|
+
arrows: h.length > 0 ? h : void 0,
|
|
145
145
|
summaries: r.length > 0 ? r : void 0
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
function v(
|
|
149
|
-
const o =
|
|
148
|
+
function v(l) {
|
|
149
|
+
const o = l.match(/^(\s*)/);
|
|
150
150
|
return o ? o[1].length : 0;
|
|
151
151
|
}
|
|
152
|
-
function L(
|
|
152
|
+
function L(l) {
|
|
153
153
|
try {
|
|
154
|
-
const o =
|
|
154
|
+
const o = l.trim().startsWith("{") ? l : `{${l}}`;
|
|
155
155
|
return JSON.parse(o);
|
|
156
156
|
} catch {
|
|
157
|
-
return
|
|
157
|
+
return null;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function T(
|
|
161
|
-
const d =
|
|
160
|
+
function T(l) {
|
|
161
|
+
const d = l.trim().replace(/^-\s*/, "");
|
|
162
162
|
if (d.startsWith(">"))
|
|
163
163
|
return {
|
|
164
164
|
type: "arrow",
|
|
@@ -171,60 +171,63 @@ function T(c) {
|
|
|
171
171
|
topic: "",
|
|
172
172
|
content: d.substring(1).trim()
|
|
173
173
|
};
|
|
174
|
-
let
|
|
175
|
-
const i =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
let n = d, r, e;
|
|
175
|
+
const i = n.match(/\s*(\{[^}]+\})\s*$/);
|
|
176
|
+
if (i) {
|
|
177
|
+
const h = L(i[1]);
|
|
178
|
+
h && (e = h, n = n.substring(0, n.length - i[0].length).trim());
|
|
179
|
+
}
|
|
180
|
+
const c = n.match(/\s*\[\^([\w-]+)\]\s*$/);
|
|
181
|
+
return c && (r = c[1], n = n.substring(0, n.length - c[0].length).trim()), {
|
|
179
182
|
type: "node",
|
|
180
|
-
topic:
|
|
181
|
-
content:
|
|
183
|
+
topic: n,
|
|
184
|
+
content: n,
|
|
182
185
|
refId: r,
|
|
183
|
-
style:
|
|
186
|
+
style: e
|
|
184
187
|
};
|
|
185
188
|
}
|
|
186
|
-
function R(
|
|
187
|
-
const d =
|
|
189
|
+
function R(l, o) {
|
|
190
|
+
const d = l.match(
|
|
188
191
|
/\[\^([\w-]+)\](?:\s*\(([\d.-]+),([\d.-]+)\))?\s*<-([^-]*)->(?:\s*\(([\d.-]+),([\d.-]+)\))?\s*\[\^([\w-]+)\]/
|
|
189
192
|
);
|
|
190
193
|
if (d) {
|
|
191
|
-
const r = d[1],
|
|
194
|
+
const r = d[1], e = d[2], i = d[3], c = d[4].trim(), h = d[5], a = d[6], u = d[7];
|
|
192
195
|
return {
|
|
193
|
-
id:
|
|
194
|
-
label:
|
|
196
|
+
id: I(),
|
|
197
|
+
label: c,
|
|
195
198
|
from: o.nodeIdMap.get(r) || r,
|
|
196
|
-
to: o.nodeIdMap.get(
|
|
197
|
-
delta1:
|
|
198
|
-
delta2:
|
|
199
|
+
to: o.nodeIdMap.get(u) || u,
|
|
200
|
+
delta1: e && i ? { x: Number(e), y: Number(i) } : void 0,
|
|
201
|
+
delta2: h && a ? { x: Number(h), y: Number(a) } : void 0,
|
|
199
202
|
bidirectional: !0
|
|
200
203
|
};
|
|
201
204
|
}
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
204
|
-
const r =
|
|
205
|
+
const n = l.match(/\[\^([\w-]+)\](?:\s*\(([\d.-]+),([\d.-]+)\))?\s*>-([^-]*)->(?:\s*\(([\d.-]+),([\d.-]+)\))?\s*\[\^([\w-]+)\]/);
|
|
206
|
+
if (n) {
|
|
207
|
+
const r = n[1], e = n[2], i = n[3], c = n[4].trim(), h = n[5], a = n[6], u = n[7];
|
|
205
208
|
return {
|
|
206
|
-
id:
|
|
207
|
-
label:
|
|
209
|
+
id: I(),
|
|
210
|
+
label: c,
|
|
208
211
|
from: o.nodeIdMap.get(r) || r,
|
|
209
|
-
to: o.nodeIdMap.get(
|
|
210
|
-
delta1:
|
|
211
|
-
delta2:
|
|
212
|
+
to: o.nodeIdMap.get(u) || u,
|
|
213
|
+
delta1: e && i ? { x: Number(e), y: Number(i) } : void 0,
|
|
214
|
+
delta2: h && a ? { x: Number(h), y: Number(a) } : void 0
|
|
212
215
|
};
|
|
213
216
|
}
|
|
214
217
|
return null;
|
|
215
218
|
}
|
|
216
|
-
function O(
|
|
217
|
-
const
|
|
218
|
-
let r,
|
|
219
|
-
if (
|
|
219
|
+
function O(l, o, d) {
|
|
220
|
+
const n = l.match(/^:(\d+)\s+(.*)/);
|
|
221
|
+
let r, e;
|
|
222
|
+
if (n ? (r = parseInt(n[1], 10), e = n[2]) : (r = o.length, e = l.trim()), o.length === 0 || r === 0)
|
|
220
223
|
return null;
|
|
221
|
-
const i = o.slice(-r),
|
|
224
|
+
const i = o.slice(-r), c = o.indexOf(i[0]), h = o.indexOf(i[i.length - 1]);
|
|
222
225
|
return {
|
|
223
|
-
id:
|
|
224
|
-
label:
|
|
226
|
+
id: I(),
|
|
227
|
+
label: e,
|
|
225
228
|
parent: d,
|
|
226
|
-
start:
|
|
227
|
-
end:
|
|
229
|
+
start: c,
|
|
230
|
+
end: h
|
|
228
231
|
};
|
|
229
232
|
}
|
|
230
233
|
export {
|
package/dist/types/arrow.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ArrowSvg, Topic } from './types/dom';
|
|
2
2
|
import { type MindElixirInstance, type Uid } from './index';
|
|
3
3
|
export interface ArrowStyle {
|
|
4
4
|
/**
|
|
@@ -81,9 +81,9 @@ export interface ArrowOptions {
|
|
|
81
81
|
}
|
|
82
82
|
export declare const createArrow: (this: MindElixirInstance, from: Topic, to: Topic, options?: ArrowOptions) => void;
|
|
83
83
|
export declare const createArrowFrom: (this: MindElixirInstance, arrow: Omit<Arrow, "id">) => void;
|
|
84
|
-
export declare const removeArrow: (this: MindElixirInstance, linkSvg?:
|
|
85
|
-
export declare const selectArrow: (this: MindElixirInstance, link:
|
|
84
|
+
export declare const removeArrow: (this: MindElixirInstance, linkSvg?: ArrowSvg) => void;
|
|
85
|
+
export declare const selectArrow: (this: MindElixirInstance, link: ArrowSvg) => void;
|
|
86
86
|
export declare const unselectArrow: (this: MindElixirInstance) => void;
|
|
87
87
|
export declare function renderArrow(this: MindElixirInstance): void;
|
|
88
|
-
export declare function editArrowLabel(this: MindElixirInstance, el:
|
|
88
|
+
export declare function editArrowLabel(this: MindElixirInstance, el: ArrowSvg): void;
|
|
89
89
|
export declare function tidyArrow(this: MindElixirInstance): void;
|
package/dist/types/docs.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Arrow } from './arrow';
|
|
2
|
+
import type { Summary } from './summary';
|
|
2
3
|
import type methods from './methods';
|
|
3
4
|
import type { MindElixirMethods } from './methods';
|
|
4
|
-
import type { Summary, SummarySvgGroup } from './summary';
|
|
5
5
|
import type { MindElixirData, MindElixirInstance, NodeObj, NodeObjExport, Options, Theme, TagObj } from './types';
|
|
6
6
|
import type { MainLineParams, SubLineParams } from './utils/generateBranch';
|
|
7
7
|
import type { LangPack } from './i18n';
|
|
8
|
-
export { methods, Theme, Options, MindElixirMethods, MindElixirInstance, MindElixirData, NodeObj, NodeObjExport, Summary,
|
|
8
|
+
export { methods, Theme, Options, MindElixirMethods, MindElixirInstance, MindElixirData, NodeObj, NodeObjExport, Summary, Arrow, MainLineParams, SubLineParams, LangPack, TagObj, };
|
|
9
9
|
export type * from './types/dom';
|
|
10
10
|
export type * from './utils/pubsub';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,42 +3,43 @@ import './markdown.css';
|
|
|
3
3
|
import { LEFT, RIGHT, SIDE, DARK_THEME, THEME } from './const';
|
|
4
4
|
import type { MindElixirData, MindElixirInstance, MindElixirMethods, Options } from './types/index';
|
|
5
5
|
import type { Topic } from './docs';
|
|
6
|
-
declare function MindElixir(this: MindElixirInstance, { el, direction, editable, contextMenu, toolBar, keypress, mouseSelectionButton, selectionContainer, before, newTopicName, allowUndo, generateMainBranch, generateSubBranch, overflowHidden, theme, alignment, scaleSensitivity, scaleMax, scaleMin, handleWheel, markdown, imageProxy, pasteHandler, }: Options): void;
|
|
6
|
+
declare function MindElixir(this: MindElixirInstance, { el, direction, editable, contextMenu, toolBar, keypress, mouseSelectionButton, selectionContainer, before, newTopicName, allowUndo, generateMainBranch, generateSubBranch, overflowHidden, theme, alignment, scaleSensitivity, scaleMax, scaleMin, handleWheel, markdown, imageProxy, pasteHandler, mobileMultiSelect, }: Options): void;
|
|
7
7
|
declare namespace MindElixir {
|
|
8
8
|
export var prototype: {
|
|
9
9
|
init(this: MindElixirInstance, data: MindElixirData): Error | undefined;
|
|
10
10
|
destroy(this: Partial<MindElixirInstance>): void;
|
|
11
|
+
enableMobileMultiSelect(this: MindElixirInstance, enable: boolean): void;
|
|
11
12
|
exportSvg: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string) => Blob;
|
|
12
13
|
exportPng: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string) => Promise<Blob | null>;
|
|
13
14
|
createSummary: (this: MindElixirInstance, options?: import("./summary").SummaryOptions) => void;
|
|
14
15
|
createSummaryFrom: (this: MindElixirInstance, summary: Omit<import("./summary").Summary, "id">) => void;
|
|
15
16
|
removeSummary: (this: MindElixirInstance, id: string) => void;
|
|
16
|
-
selectSummary: (this: MindElixirInstance, el: import("./
|
|
17
|
+
selectSummary: (this: MindElixirInstance, el: import("./docs").SummarySvg) => void;
|
|
17
18
|
unselectSummary: (this: MindElixirInstance) => void;
|
|
18
19
|
renderSummary: (this: MindElixirInstance) => void;
|
|
19
|
-
editSummary: (this: MindElixirInstance, el: import("./
|
|
20
|
+
editSummary: (this: MindElixirInstance, el: import("./docs").SummarySvg) => void;
|
|
20
21
|
renderArrow(this: MindElixirInstance): void;
|
|
21
|
-
editArrowLabel(this: MindElixirInstance, el: import("./docs").
|
|
22
|
+
editArrowLabel(this: MindElixirInstance, el: import("./docs").ArrowSvg): void;
|
|
22
23
|
tidyArrow(this: MindElixirInstance): void;
|
|
23
24
|
createArrow: (this: MindElixirInstance, from: Topic, to: Topic, options?: import("./arrow").ArrowOptions) => void;
|
|
24
25
|
createArrowFrom: (this: MindElixirInstance, arrow: Omit<import("./arrow").Arrow, "id">) => void;
|
|
25
|
-
removeArrow: (this: MindElixirInstance, linkSvg?: import("./docs").
|
|
26
|
-
selectArrow: (this: MindElixirInstance, link: import("./docs").
|
|
26
|
+
removeArrow: (this: MindElixirInstance, linkSvg?: import("./docs").ArrowSvg) => void;
|
|
27
|
+
selectArrow: (this: MindElixirInstance, link: import("./docs").ArrowSvg) => void;
|
|
27
28
|
unselectArrow: (this: MindElixirInstance) => void;
|
|
28
|
-
rmSubline: (this: MindElixirInstance, tpc: Topic) => Promise<void>;
|
|
29
|
-
reshapeNode: (this: MindElixirInstance, tpc: Topic, patchData: Partial<import("./docs").NodeObj<unknown>>) => Promise<void>;
|
|
30
|
-
insertSibling: (this: MindElixirInstance, type: "before" | "after", el?: Topic | undefined, node?: import("./docs").NodeObj<unknown> | undefined) => Promise<void>;
|
|
31
|
-
insertParent: (this: MindElixirInstance, el?: Topic | undefined, node?: import("./docs").NodeObj<unknown> | undefined) => Promise<void>;
|
|
32
|
-
addChild: (this: MindElixirInstance, el?: Topic | undefined, node?: import("./docs").NodeObj<unknown> | undefined) => Promise<void>;
|
|
33
|
-
copyNode: (this: MindElixirInstance, node: Topic, to: Topic) => Promise<void>;
|
|
34
|
-
copyNodes: (this: MindElixirInstance, tpcs: Topic[], to: Topic) => Promise<void>;
|
|
35
|
-
moveUpNode: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
36
|
-
moveDownNode: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
37
|
-
removeNodes: (this: MindElixirInstance, tpcs: Topic[]) => Promise<void>;
|
|
38
29
|
moveNodeIn: (this: MindElixirInstance, from: Topic[], to: Topic) => Promise<void>;
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
moveDownNode: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
31
|
+
moveUpNode: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
32
|
+
copyNode: (this: MindElixirInstance, node: Topic, to: Topic) => Promise<void>;
|
|
33
|
+
addChild: (this: MindElixirInstance, el?: Topic | undefined, node?: import("./docs").NodeObj<unknown> | undefined) => Promise<void>;
|
|
34
|
+
insertParent: (this: MindElixirInstance, el?: Topic | undefined, node?: import("./docs").NodeObj<unknown> | undefined) => Promise<void>;
|
|
41
35
|
beginEdit: (this: MindElixirInstance, el?: Topic | undefined) => Promise<void>;
|
|
36
|
+
insertSibling: (this: MindElixirInstance, type: "before" | "after", el?: Topic | undefined, node?: import("./docs").NodeObj<unknown> | undefined) => Promise<void>;
|
|
37
|
+
reshapeNode: (this: MindElixirInstance, tpc: Topic, patchData: Partial<import("./docs").NodeObj<unknown>>) => Promise<void>;
|
|
38
|
+
moveNodeAfter: (this: MindElixirInstance, from: Topic[], to: Topic) => Promise<void>;
|
|
39
|
+
moveNodeBefore: (this: MindElixirInstance, from: Topic[], to: Topic) => Promise<void>;
|
|
40
|
+
removeNodes: (this: MindElixirInstance, tpcs: Topic[]) => Promise<void>;
|
|
41
|
+
copyNodes: (this: MindElixirInstance, tpcs: Topic[], to: Topic) => Promise<void>;
|
|
42
|
+
rmSubline: (this: MindElixirInstance, tpc: Topic) => Promise<void>;
|
|
42
43
|
setNodeTopic: (this: MindElixirInstance, el: Topic, topic: string) => Promise<void>;
|
|
43
44
|
scrollIntoView: (this: MindElixirInstance, el: HTMLElement) => void;
|
|
44
45
|
selectNode: (this: MindElixirInstance, tpc: Topic, isNewNode?: boolean, e?: MouseEvent) => void;
|
package/dist/types/methods.d.ts
CHANGED
|
@@ -13,37 +13,42 @@ export type MindElixirMethods = typeof methods;
|
|
|
13
13
|
declare const methods: {
|
|
14
14
|
init(this: MindElixirInstance, data: MindElixirData): Error | undefined;
|
|
15
15
|
destroy(this: Partial<MindElixirInstance>): void;
|
|
16
|
+
/**
|
|
17
|
+
* @public
|
|
18
|
+
* @param {boolean} enable
|
|
19
|
+
*/
|
|
20
|
+
enableMobileMultiSelect(this: MindElixirInstance, enable: boolean): void;
|
|
16
21
|
exportSvg: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string) => Blob;
|
|
17
22
|
exportPng: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string) => Promise<Blob | null>;
|
|
18
23
|
createSummary: (this: MindElixirInstance, options?: summary.SummaryOptions) => void;
|
|
19
24
|
createSummaryFrom: (this: MindElixirInstance, summary: Omit<summary.Summary, "id">) => void;
|
|
20
25
|
removeSummary: (this: MindElixirInstance, id: string) => void;
|
|
21
|
-
selectSummary: (this: MindElixirInstance, el:
|
|
26
|
+
selectSummary: (this: MindElixirInstance, el: import("./docs").SummarySvg) => void;
|
|
22
27
|
unselectSummary: (this: MindElixirInstance) => void;
|
|
23
28
|
renderSummary: (this: MindElixirInstance) => void;
|
|
24
|
-
editSummary: (this: MindElixirInstance, el:
|
|
29
|
+
editSummary: (this: MindElixirInstance, el: import("./docs").SummarySvg) => void;
|
|
25
30
|
renderArrow(this: MindElixirInstance): void;
|
|
26
|
-
editArrowLabel(this: MindElixirInstance, el: import("./docs").
|
|
31
|
+
editArrowLabel(this: MindElixirInstance, el: import("./docs").ArrowSvg): void;
|
|
27
32
|
tidyArrow(this: MindElixirInstance): void;
|
|
28
33
|
createArrow: (this: MindElixirInstance, from: import("./docs").Topic, to: import("./docs").Topic, options?: arrow.ArrowOptions) => void;
|
|
29
34
|
createArrowFrom: (this: MindElixirInstance, arrow: Omit<arrow.Arrow, "id">) => void;
|
|
30
|
-
removeArrow: (this: MindElixirInstance, linkSvg?: import("./docs").
|
|
31
|
-
selectArrow: (this: MindElixirInstance, link: import("./docs").
|
|
35
|
+
removeArrow: (this: MindElixirInstance, linkSvg?: import("./docs").ArrowSvg) => void;
|
|
36
|
+
selectArrow: (this: MindElixirInstance, link: import("./docs").ArrowSvg) => void;
|
|
32
37
|
unselectArrow: (this: MindElixirInstance) => void;
|
|
33
|
-
rmSubline: (this: MindElixirInstance, tpc: import("./docs").Topic) => Promise<void>;
|
|
34
|
-
reshapeNode: (this: MindElixirInstance, tpc: import("./docs").Topic, patchData: Partial<import("./types").NodeObj<unknown>>) => Promise<void>;
|
|
35
|
-
insertSibling: (this: MindElixirInstance, type: "before" | "after", el?: import("./docs").Topic | undefined, node?: import("./types").NodeObj<unknown> | undefined) => Promise<void>;
|
|
36
|
-
insertParent: (this: MindElixirInstance, el?: import("./docs").Topic | undefined, node?: import("./types").NodeObj<unknown> | undefined) => Promise<void>;
|
|
37
|
-
addChild: (this: MindElixirInstance, el?: import("./docs").Topic | undefined, node?: import("./types").NodeObj<unknown> | undefined) => Promise<void>;
|
|
38
|
-
copyNode: (this: MindElixirInstance, node: import("./docs").Topic, to: import("./docs").Topic) => Promise<void>;
|
|
39
|
-
copyNodes: (this: MindElixirInstance, tpcs: import("./docs").Topic[], to: import("./docs").Topic) => Promise<void>;
|
|
40
|
-
moveUpNode: (this: MindElixirInstance, el?: import("./docs").Topic | undefined) => Promise<void>;
|
|
41
|
-
moveDownNode: (this: MindElixirInstance, el?: import("./docs").Topic | undefined) => Promise<void>;
|
|
42
|
-
removeNodes: (this: MindElixirInstance, tpcs: import("./docs").Topic[]) => Promise<void>;
|
|
43
38
|
moveNodeIn: (this: MindElixirInstance, from: import("./docs").Topic[], to: import("./docs").Topic) => Promise<void>;
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
moveDownNode: (this: MindElixirInstance, el?: import("./docs").Topic | undefined) => Promise<void>;
|
|
40
|
+
moveUpNode: (this: MindElixirInstance, el?: import("./docs").Topic | undefined) => Promise<void>;
|
|
41
|
+
copyNode: (this: MindElixirInstance, node: import("./docs").Topic, to: import("./docs").Topic) => Promise<void>;
|
|
42
|
+
addChild: (this: MindElixirInstance, el?: import("./docs").Topic | undefined, node?: import("./types").NodeObj<unknown> | undefined) => Promise<void>;
|
|
43
|
+
insertParent: (this: MindElixirInstance, el?: import("./docs").Topic | undefined, node?: import("./types").NodeObj<unknown> | undefined) => Promise<void>;
|
|
46
44
|
beginEdit: (this: MindElixirInstance, el?: import("./docs").Topic | undefined) => Promise<void>;
|
|
45
|
+
insertSibling: (this: MindElixirInstance, type: "before" | "after", el?: import("./docs").Topic | undefined, node?: import("./types").NodeObj<unknown> | undefined) => Promise<void>;
|
|
46
|
+
reshapeNode: (this: MindElixirInstance, tpc: import("./docs").Topic, patchData: Partial<import("./types").NodeObj<unknown>>) => Promise<void>;
|
|
47
|
+
moveNodeAfter: (this: MindElixirInstance, from: import("./docs").Topic[], to: import("./docs").Topic) => Promise<void>;
|
|
48
|
+
moveNodeBefore: (this: MindElixirInstance, from: import("./docs").Topic[], to: import("./docs").Topic) => Promise<void>;
|
|
49
|
+
removeNodes: (this: MindElixirInstance, tpcs: import("./docs").Topic[]) => Promise<void>;
|
|
50
|
+
copyNodes: (this: MindElixirInstance, tpcs: import("./docs").Topic[], to: import("./docs").Topic) => Promise<void>;
|
|
51
|
+
rmSubline: (this: MindElixirInstance, tpc: import("./docs").Topic) => Promise<void>;
|
|
47
52
|
setNodeTopic: (this: MindElixirInstance, el: import("./docs").Topic, topic: string) => Promise<void>;
|
|
48
53
|
scrollIntoView: (this: MindElixirInstance, el: HTMLElement) => void;
|
|
49
54
|
selectNode: (this: MindElixirInstance, tpc: import("./docs").Topic, isNewNode?: boolean, e?: MouseEvent) => void;
|
package/dist/types/summary.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MindElixirInstance } from '.';
|
|
1
|
+
import type { MindElixirInstance, SummarySvg } from '.';
|
|
2
2
|
export interface SummaryStyle {
|
|
3
3
|
/**
|
|
4
4
|
* stroke color of the summary
|
|
@@ -35,15 +35,10 @@ export interface Summary {
|
|
|
35
35
|
*/
|
|
36
36
|
style?: SummaryStyle;
|
|
37
37
|
}
|
|
38
|
-
export type SummarySvgGroup = SVGGElement & {
|
|
39
|
-
children: [SVGPathElement];
|
|
40
|
-
summaryObj: Summary;
|
|
41
|
-
labelEl?: HTMLDivElement;
|
|
42
|
-
};
|
|
43
38
|
export declare const createSummary: (this: MindElixirInstance, options?: SummaryOptions) => void;
|
|
44
39
|
export declare const createSummaryFrom: (this: MindElixirInstance, summary: Omit<Summary, "id">) => void;
|
|
45
40
|
export declare const removeSummary: (this: MindElixirInstance, id: string) => void;
|
|
46
|
-
export declare const selectSummary: (this: MindElixirInstance, el:
|
|
41
|
+
export declare const selectSummary: (this: MindElixirInstance, el: SummarySvg) => void;
|
|
47
42
|
export declare const unselectSummary: (this: MindElixirInstance) => void;
|
|
48
43
|
export declare const renderSummary: (this: MindElixirInstance) => void;
|
|
49
|
-
export declare const editSummary: (this: MindElixirInstance, el:
|
|
44
|
+
export declare const editSummary: (this: MindElixirInstance, el: SummarySvg) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Arrow } from '../arrow';
|
|
2
|
+
import type { Summary } from '../summary';
|
|
2
3
|
import type { NodeObj } from './index';
|
|
3
4
|
export interface Wrapper extends HTMLElement {
|
|
4
5
|
firstChild: Parent;
|
|
@@ -42,12 +43,14 @@ export interface Expander extends HTMLElement {
|
|
|
42
43
|
parentElement: Parent;
|
|
43
44
|
previousSibling: Topic;
|
|
44
45
|
}
|
|
45
|
-
export
|
|
46
|
-
export type CustomArrow = SVGPathElement;
|
|
47
|
-
export interface CustomSvg extends SVGGElement {
|
|
46
|
+
export interface ArrowSvg extends SVGGElement {
|
|
48
47
|
arrowObj: Arrow;
|
|
49
48
|
labelEl?: HTMLDivElement;
|
|
50
49
|
line: SVGPathElement;
|
|
51
50
|
arrow1: SVGPathElement;
|
|
52
51
|
arrow2: SVGPathElement;
|
|
53
52
|
}
|
|
53
|
+
export interface SummarySvg extends SVGGElement {
|
|
54
|
+
summaryObj: Summary;
|
|
55
|
+
labelEl?: HTMLDivElement;
|
|
56
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Topic,
|
|
1
|
+
import type { Topic, ArrowSvg, SummarySvg } from './dom';
|
|
2
2
|
import type { createBus, EventMap, Operation } from '../utils/pubsub';
|
|
3
3
|
import type { MindElixirMethods, OperationMap, Operations } from '../methods';
|
|
4
4
|
import type { LinkPanHelperInstance } from '../utils/LinkPanHelper';
|
|
5
5
|
import type { Arrow } from '../arrow';
|
|
6
|
-
import type { Summary
|
|
6
|
+
import type { Summary } from '../summary';
|
|
7
7
|
import type { MainLineParams, SubLineParams } from '../utils/generateBranch';
|
|
8
8
|
import type { ContextMenuOption } from '../plugin/contextMenu';
|
|
9
9
|
import type { createPanHelper } from '../utils/panHelper';
|
|
@@ -79,8 +79,8 @@ export interface MindElixirInstance extends Omit<Required<Options>, 'markdown' |
|
|
|
79
79
|
summaries: Summary[];
|
|
80
80
|
readonly currentNode: Topic | null;
|
|
81
81
|
currentNodes: Topic[];
|
|
82
|
-
currentSummary:
|
|
83
|
-
currentArrow:
|
|
82
|
+
currentSummary: SummarySvg | null;
|
|
83
|
+
currentArrow: ArrowSvg | null;
|
|
84
84
|
scaleVal: number;
|
|
85
85
|
tempDirection: 0 | 1 | 2 | null;
|
|
86
86
|
container: HTMLElement;
|
|
@@ -95,7 +95,7 @@ export interface MindElixirInstance extends Omit<Required<Options>, 'markdown' |
|
|
|
95
95
|
P3: HTMLElement;
|
|
96
96
|
line1: SVGElement;
|
|
97
97
|
line2: SVGElement;
|
|
98
|
-
|
|
98
|
+
arrowSvg: SVGElement;
|
|
99
99
|
/**
|
|
100
100
|
* @internal
|
|
101
101
|
*/
|
|
@@ -119,6 +119,8 @@ export interface MindElixirInstance extends Omit<Required<Options>, 'markdown' |
|
|
|
119
119
|
clearHistory?: () => void;
|
|
120
120
|
selection: SelectionArea;
|
|
121
121
|
panHelper: ReturnType<typeof createPanHelper>;
|
|
122
|
+
ptState?: number;
|
|
123
|
+
mobileMultiSelect: boolean;
|
|
122
124
|
}
|
|
123
125
|
type PathString = string;
|
|
124
126
|
/**
|
|
@@ -172,6 +174,11 @@ export interface Options {
|
|
|
172
174
|
* @default undefined
|
|
173
175
|
*/
|
|
174
176
|
pasteHandler?: (e: ClipboardEvent) => void;
|
|
177
|
+
/**
|
|
178
|
+
* Enable mobile multi-select mode
|
|
179
|
+
* @default false
|
|
180
|
+
*/
|
|
181
|
+
mobileMultiSelect?: boolean;
|
|
175
182
|
}
|
|
176
183
|
export type Uid = string;
|
|
177
184
|
export type Left = 0;
|
|
@@ -4,6 +4,8 @@ export declare function createPanHelper(mei: MindElixirInstance): {
|
|
|
4
4
|
y: number;
|
|
5
5
|
moved: boolean;
|
|
6
6
|
mousedown: boolean;
|
|
7
|
-
|
|
7
|
+
handlePointerDown(e: PointerEvent): void;
|
|
8
|
+
handlePointerMove(e: PointerEvent): boolean;
|
|
9
|
+
handlePointerUp(e: PointerEvent): void;
|
|
8
10
|
clear(): void;
|
|
9
11
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Arrow } from '../arrow';
|
|
2
2
|
import type { Summary } from '../summary';
|
|
3
3
|
import type { MindElixirInstance } from '../types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ArrowSvg } from '../types/dom';
|
|
5
5
|
export declare const svgNS = "http://www.w3.org/2000/svg";
|
|
6
6
|
export interface SvgTextOptions {
|
|
7
7
|
anchor?: 'start' | 'middle' | 'end';
|
|
@@ -31,5 +31,5 @@ export declare const createArrowGroup: (d: string, arrowd1: string, arrowd2: str
|
|
|
31
31
|
strokeDasharray?: string;
|
|
32
32
|
strokeLinecap?: "butt" | "round" | "square";
|
|
33
33
|
opacity?: string | number;
|
|
34
|
-
}) =>
|
|
34
|
+
}) => ArrowSvg;
|
|
35
35
|
export declare const editSvgText: (mei: MindElixirInstance, textEl: HTMLDivElement, node: Summary | Arrow) => void;
|
|
@@ -25,26 +25,26 @@ export default class SelectionArea extends EventTarget<SelectionEvents> {
|
|
|
25
25
|
private _scrollDelta;
|
|
26
26
|
constructor(opt: PartialSelectionOptions);
|
|
27
27
|
_toggleStartEvents(activate?: boolean): void;
|
|
28
|
-
_onTapStart(evt:
|
|
29
|
-
_onSingleTap(evt:
|
|
30
|
-
_delayedTapMove(evt:
|
|
28
|
+
_onTapStart(evt: PointerEvent, silent?: boolean): void;
|
|
29
|
+
_onSingleTap(evt: PointerEvent): void;
|
|
30
|
+
_delayedTapMove(evt: PointerEvent): void;
|
|
31
31
|
_setupSelectionArea(): void;
|
|
32
|
-
_onTapMove(evt:
|
|
33
|
-
_handleMoveEvent(evt:
|
|
32
|
+
_onTapMove(evt: PointerEvent): void;
|
|
33
|
+
_handleMoveEvent(evt: PointerEvent): void;
|
|
34
34
|
_onScroll(): void;
|
|
35
35
|
_onStartAreaScroll(): void;
|
|
36
36
|
_recalculateSelectionAreaRect(): void;
|
|
37
37
|
_redrawSelectionArea(): void;
|
|
38
|
-
_onTapStop(evt:
|
|
38
|
+
_onTapStop(evt: PointerEvent | null, silent: boolean): void;
|
|
39
39
|
_updateElementSelection(): void;
|
|
40
|
-
_emitEvent(name: keyof SelectionEvents, evt:
|
|
40
|
+
_emitEvent(name: keyof SelectionEvents, evt: PointerEvent | null): unknown;
|
|
41
41
|
_keepSelection(): void;
|
|
42
42
|
/**
|
|
43
43
|
* Manually triggers the start of a selection
|
|
44
|
-
* @param evt A
|
|
44
|
+
* @param evt A PointerEvent-like object
|
|
45
45
|
* @param silent If beforestart should be fired
|
|
46
46
|
*/
|
|
47
|
-
trigger(evt:
|
|
47
|
+
trigger(evt: PointerEvent, silent?: boolean): void;
|
|
48
48
|
/**
|
|
49
49
|
* Can be used if during a selection elements have been added
|
|
50
50
|
* Will update everything that can be selected
|