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.
@@ -10,28 +10,28 @@ class S {
10
10
  this.slots = Array.from({ length: d + 1 }, () => []);
11
11
  }
12
12
  }
13
- function j(c) {
14
- const { nodeData: o, arrows: d = [], summaries: e = [] } = c, r = /* @__PURE__ */ new Map();
15
- function n(t) {
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(n)), s;
17
+ return r.set(t.id, s), t.children && (s.children = t.children.map(e)), s;
18
18
  }
19
- const i = n(o), l = [], m = /* @__PURE__ */ new Set();
19
+ const i = e(o), c = [], h = /* @__PURE__ */ new Set();
20
20
  for (const t of d) {
21
- m.add(t.from), m.add(t.to);
22
- const s = t.metadata, p = s?.parentId, y = s?.index ?? 1 / 0;
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
- l.push(t);
24
+ c.push(t);
25
25
  continue;
26
26
  }
27
- const g = r.get(p);
28
- if (g) {
29
- const w = Math.min(y, g.children.length);
30
- g.slots[w].push({ type: "arrow", arrow: t });
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
- l.push(t);
32
+ c.push(t);
33
33
  }
34
- for (const t of e) {
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 h = [];
45
- function u(t, s) {
46
- const p = " ".repeat(s), y = " ".repeat(s + 1), g = t.node.metadata, w = [t.node.topic], C = g?.refId ?? (m.has(t.node.id) ? t.node.id : void 0);
47
- C && w.push(`[^${C}]`), t.node.style && Object.keys(t.node.style).length > 0 && w.push(JSON.stringify(t.node.style)), h.push(`${p}- ${w.join(" ")}`);
48
- for (let I = 0; I <= t.children.length; I++) {
49
- for (const N of t.slots[I])
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 f = N.arrow, x = f.bidirectional ? `<-${f.label ?? ""}->` : `>-${f.label ?? ""}->`, b = f.delta1 ? ` (${f.delta1.x},${f.delta1.y})` : "", M = f.delta2 ? ` (${f.delta2.x},${f.delta2.y})` : "";
52
- h.push(`${y}- > [^${a(f.from)}]${b} ${x}${M} [^${a(f.to)}]`);
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 f = N.summary, x = f.end - f.start + 1, b = x === t.children.length ? "" : `:${x} `;
55
- h.push(`${y}- }${b}${f.label}`);
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
- I < t.children.length && u(t.children[I], s + 1);
57
+ w < t.children.length && f(t.children[w], s + 1);
58
58
  }
59
59
  }
60
- u(i, 0);
61
- for (const t of l) {
62
- const s = t.bidirectional ? `<-${t.label ?? ""}->` : `>-${t.label ?? ""}->`, p = t.delta1 ? ` (${t.delta1.x},${t.delta1.y})` : "", y = t.delta2 ? ` (${t.delta2.x},${t.delta2.y})` : "";
63
- h.push(`- > [^${a(t.from)}]${p} ${s}${y} [^${a(t.to)}]`);
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 h.join(`
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(c, o = "Root") {
98
- const d = c.split(`
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 e = {
102
+ const n = {
103
103
  arrowLines: [],
104
104
  nodeIdMap: /* @__PURE__ */ new Map()
105
- }, r = [], n = [], i = [];
105
+ }, r = [], e = [], i = [];
106
106
  for (const a of d) {
107
- const h = v(a), u = T(a);
108
- for (; n.length > 0 && n[n.length - 1].indent >= h; )
109
- n.pop();
110
- const t = n.length > 0 ? n[n.length - 1].node : null, s = t ? t.children ??= [] : i;
111
- if (u.type === "arrow") {
112
- e.arrowLines.push({
113
- content: u.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 (u.type === "summary") {
120
- const g = O(u.content, s, t?.id ?? "");
121
- g && r.push(g);
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 = $(), y = {
125
- topic: u.topic,
124
+ const p = I(), g = {
125
+ topic: f.topic,
126
126
  id: p
127
127
  };
128
- u.style && (y.style = u.style), u.refId && (e.nodeIdMap.set(u.refId, p), y.metadata = { refId: u.refId }), s.push(y), n.push({ indent: h, node: y });
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 l;
133
- i.length === 1 ? l = i[0] : l = {
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 m = e.arrowLines.map(({ content: a, parentId: h, index: u }) => {
139
- const t = R(a, e);
140
- return t && (t.metadata = { parentId: h, index: u }), t;
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: l,
144
- arrows: m.length > 0 ? m : void 0,
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(c) {
149
- const o = c.match(/^(\s*)/);
148
+ function v(l) {
149
+ const o = l.match(/^(\s*)/);
150
150
  return o ? o[1].length : 0;
151
151
  }
152
- function L(c) {
152
+ function L(l) {
153
153
  try {
154
- const o = c.trim().startsWith("{") ? c : `{${c}}`;
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(c) {
161
- const d = c.trim().replace(/^-\s*/, "");
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 e = d, r, n;
175
- const i = e.match(/\[\^([\w-]+)\]/);
176
- i && (r = i[1], e = e.replace(i[0], "").trim());
177
- const l = e.match(/\{([^}]+)\}/);
178
- return l && (n = L(l[1]), e = e.replace(l[0], "").trim()), {
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: e,
181
- content: e,
183
+ topic: n,
184
+ content: n,
182
185
  refId: r,
183
- style: n
186
+ style: e
184
187
  };
185
188
  }
186
- function R(c, o) {
187
- const d = c.match(
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], n = d[2], i = d[3], l = d[4].trim(), m = d[5], a = d[6], h = d[7];
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: l,
196
+ id: I(),
197
+ label: c,
195
198
  from: o.nodeIdMap.get(r) || r,
196
- to: o.nodeIdMap.get(h) || h,
197
- delta1: n && i ? { x: Number(n), y: Number(i) } : void 0,
198
- delta2: m && a ? { x: Number(m), y: Number(a) } : void 0,
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 e = c.match(/\[\^([\w-]+)\](?:\s*\(([\d.-]+),([\d.-]+)\))?\s*>-([^-]*)->(?:\s*\(([\d.-]+),([\d.-]+)\))?\s*\[\^([\w-]+)\]/);
203
- if (e) {
204
- const r = e[1], n = e[2], i = e[3], l = e[4].trim(), m = e[5], a = e[6], h = e[7];
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: l,
209
+ id: I(),
210
+ label: c,
208
211
  from: o.nodeIdMap.get(r) || r,
209
- to: o.nodeIdMap.get(h) || h,
210
- delta1: n && i ? { x: Number(n), y: Number(i) } : void 0,
211
- delta2: m && a ? { x: Number(m), y: Number(a) } : void 0
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(c, o, d) {
217
- const e = c.match(/^:(\d+)\s+(.*)/);
218
- let r, n;
219
- if (e ? (r = parseInt(e[1], 10), n = e[2]) : (r = o.length, n = c.trim()), o.length === 0 || r === 0)
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), l = o.indexOf(i[0]), m = o.indexOf(i[i.length - 1]);
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: n,
226
+ id: I(),
227
+ label: e,
225
228
  parent: d,
226
- start: l,
227
- end: m
229
+ start: c,
230
+ end: h
228
231
  };
229
232
  }
230
233
  export {
@@ -1,4 +1,4 @@
1
- import type { CustomSvg, Topic } from './types/dom';
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?: CustomSvg) => void;
85
- export declare const selectArrow: (this: MindElixirInstance, link: CustomSvg) => void;
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: CustomSvg): void;
88
+ export declare function editArrowLabel(this: MindElixirInstance, el: ArrowSvg): void;
89
89
  export declare function tidyArrow(this: MindElixirInstance): void;
@@ -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, SummarySvgGroup, Arrow, MainLineParams, SubLineParams, LangPack, TagObj, };
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';
@@ -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("./summary").SummarySvgGroup) => void;
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("./summary").SummarySvgGroup) => void;
20
+ editSummary: (this: MindElixirInstance, el: import("./docs").SummarySvg) => void;
20
21
  renderArrow(this: MindElixirInstance): void;
21
- editArrowLabel(this: MindElixirInstance, el: import("./docs").CustomSvg): void;
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").CustomSvg) => void;
26
- selectArrow: (this: MindElixirInstance, link: import("./docs").CustomSvg) => void;
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
- moveNodeBefore: (this: MindElixirInstance, from: Topic[], to: Topic) => Promise<void>;
40
- moveNodeAfter: (this: MindElixirInstance, from: Topic[], to: Topic) => Promise<void>;
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;
@@ -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: summary.SummarySvgGroup) => void;
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: summary.SummarySvgGroup) => void;
29
+ editSummary: (this: MindElixirInstance, el: import("./docs").SummarySvg) => void;
25
30
  renderArrow(this: MindElixirInstance): void;
26
- editArrowLabel(this: MindElixirInstance, el: import("./docs").CustomSvg): void;
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").CustomSvg) => void;
31
- selectArrow: (this: MindElixirInstance, link: import("./docs").CustomSvg) => void;
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
- moveNodeBefore: (this: MindElixirInstance, from: import("./docs").Topic[], to: import("./docs").Topic) => Promise<void>;
45
- moveNodeAfter: (this: MindElixirInstance, from: import("./docs").Topic[], to: import("./docs").Topic) => Promise<void>;
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;
@@ -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: SummarySvgGroup) => void;
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: SummarySvgGroup) => void;
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 type CustomLine = SVGPathElement;
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, CustomSvg } from './dom';
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, SummarySvgGroup } from '../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: SummarySvgGroup | null;
83
- currentArrow: CustomSvg | null;
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
- linkSvgGroup: SVGElement;
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
- onMove(deltaX: number, deltaY: number): void;
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 { CustomSvg } from '../types/dom';
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
- }) => CustomSvg;
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: MouseEvent | TouchEvent, silent?: boolean): void;
29
- _onSingleTap(evt: MouseEvent | TouchEvent): void;
30
- _delayedTapMove(evt: MouseEvent | TouchEvent): void;
28
+ _onTapStart(evt: PointerEvent, silent?: boolean): void;
29
+ _onSingleTap(evt: PointerEvent): void;
30
+ _delayedTapMove(evt: PointerEvent): void;
31
31
  _setupSelectionArea(): void;
32
- _onTapMove(evt: MouseEvent | TouchEvent): void;
33
- _handleMoveEvent(evt: MouseEvent | TouchEvent): void;
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: MouseEvent | TouchEvent | null, silent: boolean): void;
38
+ _onTapStop(evt: PointerEvent | null, silent: boolean): void;
39
39
  _updateElementSelection(): void;
40
- _emitEvent(name: keyof SelectionEvents, evt: MouseEvent | TouchEvent | null): unknown;
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 MouseEvent / TouchEvent-like object
44
+ * @param evt A PointerEvent-like object
45
45
  * @param silent If beforestart should be fired
46
46
  */
47
- trigger(evt: MouseEvent | TouchEvent, silent?: boolean): void;
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
@@ -16,7 +16,7 @@ export interface SelectionStore {
16
16
  changed: ChangedElements;
17
17
  }
18
18
  export interface SelectionEvent {
19
- event: MouseEvent | TouchEvent | null;
19
+ event: PointerEvent | null;
20
20
  store: SelectionStore;
21
21
  selection: SelectionArea;
22
22
  }