@takesix/react 0.2.1 → 0.3.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 +12 -5
- package/dist/BlockCard.d.ts +7 -3
- package/dist/fit.d.ts +14 -0
- package/dist/index.js +503 -431
- package/dist/style.css +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment as e, useCallback as t, useEffect as n, useId as r, useLayoutEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
2
2
|
import { DEFAULT_SIZE as c, MAX_BLOCKS_PER_LEVEL as l, SIZES as u, addBlock as d, addLink as f, buildIndex as p, canAddBlock as m, getLevel as h, groupBlocks as g, moveBlock as _, removeBlock as ee, updateBlock as v, visibleLinks as te } from "@takesix/core";
|
|
3
|
-
import { Fragment as
|
|
3
|
+
import { Fragment as ne, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
4
4
|
// src/icons.tsx
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */
|
|
5
|
+
function re({ size: e = 20 }) {
|
|
6
|
+
return /* @__PURE__ */ b("svg", {
|
|
7
7
|
width: e,
|
|
8
8
|
height: e,
|
|
9
9
|
viewBox: "0 0 24 24",
|
|
@@ -11,12 +11,12 @@ function ne({ size: e = 20 }) {
|
|
|
11
11
|
stroke: "currentColor",
|
|
12
12
|
strokeWidth: "1.5",
|
|
13
13
|
strokeLinecap: "round",
|
|
14
|
-
children: [/* @__PURE__ */
|
|
14
|
+
children: [/* @__PURE__ */ y("line", {
|
|
15
15
|
x1: "12",
|
|
16
16
|
y1: "5",
|
|
17
17
|
x2: "12",
|
|
18
18
|
y2: "19"
|
|
19
|
-
}), /* @__PURE__ */
|
|
19
|
+
}), /* @__PURE__ */ y("line", {
|
|
20
20
|
x1: "5",
|
|
21
21
|
y1: "12",
|
|
22
22
|
x2: "19",
|
|
@@ -24,8 +24,8 @@ function ne({ size: e = 20 }) {
|
|
|
24
24
|
})]
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return /* @__PURE__ */
|
|
27
|
+
function x() {
|
|
28
|
+
return /* @__PURE__ */ b("svg", {
|
|
29
29
|
width: "12",
|
|
30
30
|
height: "12",
|
|
31
31
|
viewBox: "0 0 24 24",
|
|
@@ -33,12 +33,12 @@ function S() {
|
|
|
33
33
|
stroke: "currentColor",
|
|
34
34
|
strokeWidth: "2.5",
|
|
35
35
|
strokeLinecap: "round",
|
|
36
|
-
children: [/* @__PURE__ */
|
|
36
|
+
children: [/* @__PURE__ */ y("line", {
|
|
37
37
|
x1: "18",
|
|
38
38
|
y1: "6",
|
|
39
39
|
x2: "6",
|
|
40
40
|
y2: "18"
|
|
41
|
-
}), /* @__PURE__ */
|
|
41
|
+
}), /* @__PURE__ */ y("line", {
|
|
42
42
|
x1: "6",
|
|
43
43
|
y1: "6",
|
|
44
44
|
x2: "18",
|
|
@@ -46,8 +46,8 @@ function S() {
|
|
|
46
46
|
})]
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
return /* @__PURE__ */
|
|
49
|
+
function S() {
|
|
50
|
+
return /* @__PURE__ */ b("svg", {
|
|
51
51
|
width: "12",
|
|
52
52
|
height: "12",
|
|
53
53
|
viewBox: "0 0 24 24",
|
|
@@ -56,16 +56,16 @@ function C() {
|
|
|
56
56
|
strokeWidth: "2.5",
|
|
57
57
|
strokeLinecap: "round",
|
|
58
58
|
strokeLinejoin: "round",
|
|
59
|
-
children: [/* @__PURE__ */
|
|
59
|
+
children: [/* @__PURE__ */ y("line", {
|
|
60
60
|
x1: "5",
|
|
61
61
|
y1: "12",
|
|
62
62
|
x2: "19",
|
|
63
63
|
y2: "12"
|
|
64
|
-
}), /* @__PURE__ */
|
|
64
|
+
}), /* @__PURE__ */ y("polyline", { points: "12 5 19 12 12 19" })]
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
return /* @__PURE__ */
|
|
67
|
+
function ie() {
|
|
68
|
+
return /* @__PURE__ */ b("svg", {
|
|
69
69
|
width: "12",
|
|
70
70
|
height: "12",
|
|
71
71
|
viewBox: "0 0 24 24",
|
|
@@ -74,19 +74,19 @@ function re() {
|
|
|
74
74
|
strokeWidth: "2.2",
|
|
75
75
|
strokeLinecap: "round",
|
|
76
76
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ y("line", {
|
|
78
78
|
x1: "5",
|
|
79
79
|
y1: "6",
|
|
80
80
|
x2: "19",
|
|
81
81
|
y2: "6"
|
|
82
82
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ y("line", {
|
|
84
84
|
x1: "5",
|
|
85
85
|
y1: "12",
|
|
86
86
|
x2: "19",
|
|
87
87
|
y2: "12"
|
|
88
88
|
}),
|
|
89
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ y("line", {
|
|
90
90
|
x1: "5",
|
|
91
91
|
y1: "18",
|
|
92
92
|
x2: "13",
|
|
@@ -95,71 +95,76 @@ function re() {
|
|
|
95
95
|
]
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
var
|
|
99
|
-
card: "
|
|
100
|
-
deleteBtn: "
|
|
101
|
-
sizeBtn: "
|
|
102
|
-
resizeHandle: "
|
|
103
|
-
cardResizing: "
|
|
104
|
-
detailsBtn: "
|
|
105
|
-
cardEditing: "
|
|
106
|
-
detailsBtnFilled: "
|
|
107
|
-
connectBtn: "
|
|
108
|
-
connectBtnActive: "
|
|
109
|
-
cardConnectingSource: "
|
|
110
|
-
cardConnectable: "
|
|
111
|
-
cardConnected: "
|
|
112
|
-
connectOverlay: "
|
|
113
|
-
cardUnlinkable: "
|
|
114
|
-
inside: "
|
|
115
|
-
selectOverlay: "
|
|
116
|
-
selectMark: "
|
|
117
|
-
cardSelected: "
|
|
118
|
-
connectOverlayConnected: "
|
|
119
|
-
header: "
|
|
120
|
-
cardWithDetails: "
|
|
121
|
-
addInside: "
|
|
122
|
-
dragHandle: "
|
|
123
|
-
cardDragged: "
|
|
124
|
-
cardZoomable: "
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
cardWide: "
|
|
130
|
-
editable: "
|
|
131
|
-
},
|
|
98
|
+
var C = {
|
|
99
|
+
card: "_card_nq4yy_1",
|
|
100
|
+
deleteBtn: "_deleteBtn_nq4yy_13",
|
|
101
|
+
sizeBtn: "_sizeBtn_nq4yy_38",
|
|
102
|
+
resizeHandle: "_resizeHandle_nq4yy_63",
|
|
103
|
+
cardResizing: "_cardResizing_nq4yy_74",
|
|
104
|
+
detailsBtn: "_detailsBtn_nq4yy_82",
|
|
105
|
+
cardEditing: "_cardEditing_nq4yy_102",
|
|
106
|
+
detailsBtnFilled: "_detailsBtnFilled_nq4yy_106",
|
|
107
|
+
connectBtn: "_connectBtn_nq4yy_115",
|
|
108
|
+
connectBtnActive: "_connectBtnActive_nq4yy_140",
|
|
109
|
+
cardConnectingSource: "_cardConnectingSource_nq4yy_151",
|
|
110
|
+
cardConnectable: "_cardConnectable_nq4yy_156",
|
|
111
|
+
cardConnected: "_cardConnected_nq4yy_165",
|
|
112
|
+
connectOverlay: "_connectOverlay_nq4yy_171",
|
|
113
|
+
cardUnlinkable: "_cardUnlinkable_nq4yy_183",
|
|
114
|
+
inside: "_inside_nq4yy_189",
|
|
115
|
+
selectOverlay: "_selectOverlay_nq4yy_196",
|
|
116
|
+
selectMark: "_selectMark_nq4yy_201",
|
|
117
|
+
cardSelected: "_cardSelected_nq4yy_217",
|
|
118
|
+
connectOverlayConnected: "_connectOverlayConnected_nq4yy_227",
|
|
119
|
+
header: "_header_nq4yy_237",
|
|
120
|
+
cardWithDetails: "_cardWithDetails_nq4yy_241",
|
|
121
|
+
addInside: "_addInside_nq4yy_245",
|
|
122
|
+
dragHandle: "_dragHandle_nq4yy_257",
|
|
123
|
+
cardDragged: "_cardDragged_nq4yy_288",
|
|
124
|
+
cardZoomable: "_cardZoomable_nq4yy_300",
|
|
125
|
+
icon: "_icon_nq4yy_316",
|
|
126
|
+
headerText: "_headerText_nq4yy_323",
|
|
127
|
+
title: "_title_nq4yy_328",
|
|
128
|
+
description: "_description_nq4yy_336",
|
|
129
|
+
cardWide: "_cardWide_nq4yy_350",
|
|
130
|
+
editable: "_editable_nq4yy_366"
|
|
131
|
+
}, ae = {
|
|
132
|
+
ArrowUp: -1,
|
|
133
|
+
ArrowLeft: -1,
|
|
134
|
+
ArrowDown: 1,
|
|
135
|
+
ArrowRight: 1
|
|
136
|
+
}, w = {
|
|
132
137
|
S: 2,
|
|
133
138
|
M: 3,
|
|
134
139
|
L: 4,
|
|
135
140
|
F: 6
|
|
136
|
-
},
|
|
141
|
+
}, T = {
|
|
137
142
|
S: "⅓",
|
|
138
143
|
M: "½",
|
|
139
144
|
L: "⅔",
|
|
140
145
|
F: "1"
|
|
141
|
-
},
|
|
146
|
+
}, E = {
|
|
142
147
|
S: "a third",
|
|
143
148
|
M: "half",
|
|
144
149
|
L: "two thirds",
|
|
145
150
|
F: "full width"
|
|
146
151
|
};
|
|
147
|
-
function
|
|
148
|
-
return u.reduce((t, n) => Math.abs(
|
|
152
|
+
function D(e) {
|
|
153
|
+
return u.reduce((t, n) => Math.abs(w[n] - e) < Math.abs(w[t] - e) ? n : t);
|
|
149
154
|
}
|
|
150
|
-
function
|
|
151
|
-
let [
|
|
155
|
+
function oe({ block: e, editing: t, onRename: r, onDescribe: i, onDelete: a, onAddChild: l, onDrillIn: d, connectingFrom: f, canLinkTo: p, isConnected: m, onStartConnect: h, onConnectTarget: g, onRegisterEl: _, isDragged: ee, dropPosition: v, canDropInside: te, onDragStartBlock: ne, onDragOverBlock: w, onDragEndBlock: oe, onMoveBy: se, onShowDetails: ce, selectable: O, selected: k, onToggleSelect: A, onResize: j }) {
|
|
156
|
+
let [M, N] = s(null), P = M ?? e.size ?? c, F = !!e.details?.trim(), le = e.children?.length ?? 0, I = le > 0, L = o(null), [R, z] = s(!1);
|
|
152
157
|
n(() => {
|
|
153
|
-
if (!
|
|
154
|
-
let e = () =>
|
|
158
|
+
if (!R) return;
|
|
159
|
+
let e = () => z(!1);
|
|
155
160
|
return window.addEventListener("pointerup", e), () => window.removeEventListener("pointerup", e);
|
|
156
|
-
}, [
|
|
157
|
-
let
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
}, [R]);
|
|
162
|
+
let B = P === "F" ? "y" : "x", V = f === e.id, H = f !== null && f !== e.id && p, U = f !== null && f !== e.id && !p, W = o(_);
|
|
163
|
+
W.current = _, n(() => (W.current(e.id, L.current), () => {
|
|
164
|
+
W.current(e.id, null);
|
|
160
165
|
}), [e.id]);
|
|
161
|
-
function
|
|
162
|
-
let e =
|
|
166
|
+
function G() {
|
|
167
|
+
let e = L.current.getBoundingClientRect();
|
|
163
168
|
return {
|
|
164
169
|
left: e.left,
|
|
165
170
|
top: e.top,
|
|
@@ -167,124 +172,133 @@ function ie({ block: e, editing: t, onRename: r, onDescribe: i, onDelete: a, onA
|
|
|
167
172
|
height: e.height
|
|
168
173
|
};
|
|
169
174
|
}
|
|
170
|
-
function
|
|
171
|
-
if (!
|
|
172
|
-
let
|
|
173
|
-
|
|
175
|
+
function ue(n) {
|
|
176
|
+
if (!I || !L.current) return;
|
|
177
|
+
let r = t ? "[data-text], [data-drag-handle], [data-resize-handle]" : "[data-drag-handle], [data-resize-handle]";
|
|
178
|
+
if (n.target.closest(r)) return;
|
|
179
|
+
let i = window.getSelection();
|
|
180
|
+
i && !i.isCollapsed && L.current.contains(i.anchorNode) || d(e, G());
|
|
174
181
|
}
|
|
175
|
-
let
|
|
176
|
-
return
|
|
177
|
-
className:
|
|
178
|
-
ref:
|
|
182
|
+
let K = C.card;
|
|
183
|
+
return I && !H && !O && (K += ` ${C.cardZoomable}`), k && (K += ` ${C.cardSelected}`), P === "F" && (K += ` ${C.cardWide}`), M && (K += ` ${C.cardResizing}`), t ? K += ` ${C.cardEditing}` : F && (K += ` ${C.cardWithDetails}`), ee && (K += ` ${C.cardDragged}`), V ? K += ` ${C.cardConnectingSource}` : H && m ? K += ` ${C.cardConnected}` : H ? K += ` ${C.cardConnectable}` : U && (K += ` ${C.cardUnlinkable}`), /* @__PURE__ */ b("div", {
|
|
184
|
+
className: K,
|
|
185
|
+
ref: L,
|
|
179
186
|
"data-block-id": e.id,
|
|
180
|
-
"data-size":
|
|
187
|
+
"data-size": P,
|
|
181
188
|
"data-drop": v ?? void 0,
|
|
182
|
-
"data-axis":
|
|
183
|
-
onClick:
|
|
184
|
-
draggable: t &&
|
|
189
|
+
"data-axis": B,
|
|
190
|
+
onClick: ue,
|
|
191
|
+
draggable: t && R,
|
|
185
192
|
onDragStart: (t) => {
|
|
186
|
-
|
|
193
|
+
R ? (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", e.id), ne(e.id)) : t.preventDefault();
|
|
187
194
|
},
|
|
188
195
|
onDragOver: (n) => {
|
|
189
196
|
if (!t) return;
|
|
190
|
-
let r = n.currentTarget.getBoundingClientRect(), i =
|
|
191
|
-
|
|
197
|
+
let r = n.currentTarget.getBoundingClientRect(), i = B === "y" ? (n.clientY - r.top) / r.height : (n.clientX - r.left) / r.width;
|
|
198
|
+
w(e.id, te && i > .25 && i < .75 ? "inside" : i < .5 ? "before" : "after");
|
|
192
199
|
},
|
|
193
200
|
onDragEnd: () => {
|
|
194
|
-
|
|
201
|
+
z(!1), oe();
|
|
195
202
|
},
|
|
196
203
|
children: [
|
|
197
|
-
t && /* @__PURE__ */
|
|
198
|
-
className:
|
|
204
|
+
t && /* @__PURE__ */ y("div", {
|
|
205
|
+
className: C.resizeHandle,
|
|
199
206
|
"data-resize-handle": !0,
|
|
200
207
|
title: "Drag to resize",
|
|
201
208
|
"aria-hidden": "true",
|
|
202
209
|
onPointerDown: (t) => {
|
|
203
|
-
t.preventDefault(), t.stopPropagation(), t.currentTarget.setPointerCapture?.(t.pointerId),
|
|
210
|
+
t.preventDefault(), t.stopPropagation(), t.currentTarget.setPointerCapture?.(t.pointerId), N(e.size ?? c);
|
|
204
211
|
},
|
|
205
212
|
onPointerMove: (e) => {
|
|
206
|
-
if (!
|
|
207
|
-
let t =
|
|
213
|
+
if (!M || !L.current) return;
|
|
214
|
+
let t = L.current.parentElement;
|
|
208
215
|
if (!t) return;
|
|
209
|
-
let n = parseFloat(getComputedStyle(t).columnGap) || 0, r = (t.getBoundingClientRect().width - 5 * n) / 6, i =
|
|
210
|
-
i !==
|
|
216
|
+
let n = parseFloat(getComputedStyle(t).columnGap) || 0, r = (t.getBoundingClientRect().width - 5 * n) / 6, i = D((e.clientX - L.current.getBoundingClientRect().left + n) / (r + n));
|
|
217
|
+
i !== M && N(i);
|
|
211
218
|
},
|
|
212
219
|
onPointerUp: () => {
|
|
213
|
-
|
|
220
|
+
M && M !== (e.size ?? c) && j(e.id, M), N(null);
|
|
214
221
|
},
|
|
215
|
-
onPointerCancel: () =>
|
|
222
|
+
onPointerCancel: () => N(null)
|
|
216
223
|
}),
|
|
217
|
-
t && /* @__PURE__ */
|
|
218
|
-
className:
|
|
224
|
+
t && /* @__PURE__ */ y("div", {
|
|
225
|
+
className: C.dragHandle,
|
|
219
226
|
"data-drag-handle": !0,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
227
|
+
role: "button",
|
|
228
|
+
tabIndex: 0,
|
|
229
|
+
"aria-label": `Move ${e.title}`,
|
|
230
|
+
"aria-keyshortcuts": "ArrowUp ArrowDown ArrowLeft ArrowRight",
|
|
231
|
+
title: "Drag to reorder, or focus and use the arrow keys",
|
|
232
|
+
onPointerDown: () => z(!0),
|
|
233
|
+
onKeyDown: (t) => {
|
|
234
|
+
let n = ae[t.key];
|
|
235
|
+
n && (t.preventDefault(), se(e.id, n));
|
|
236
|
+
}
|
|
223
237
|
}),
|
|
224
|
-
|
|
225
|
-
className: `${
|
|
238
|
+
O && /* @__PURE__ */ y("button", {
|
|
239
|
+
className: `${C.connectOverlay} ${C.selectOverlay}`,
|
|
226
240
|
onClick: (t) => {
|
|
227
|
-
t.stopPropagation(),
|
|
241
|
+
t.stopPropagation(), A(e.id);
|
|
228
242
|
},
|
|
229
243
|
"aria-label": `Select ${e.title}`,
|
|
230
|
-
"aria-pressed":
|
|
231
|
-
children: /* @__PURE__ */
|
|
232
|
-
className:
|
|
244
|
+
"aria-pressed": k,
|
|
245
|
+
children: /* @__PURE__ */ y("span", {
|
|
246
|
+
className: C.selectMark,
|
|
233
247
|
"aria-hidden": "true",
|
|
234
|
-
children:
|
|
248
|
+
children: k ? "✓" : ""
|
|
235
249
|
})
|
|
236
250
|
}),
|
|
237
|
-
|
|
238
|
-
className: `${
|
|
251
|
+
H && /* @__PURE__ */ y("button", {
|
|
252
|
+
className: `${C.connectOverlay} ${m ? C.connectOverlayConnected : ""}`,
|
|
239
253
|
onClick: (t) => {
|
|
240
254
|
t.stopPropagation(), g(e.id);
|
|
241
255
|
},
|
|
242
256
|
"aria-label": m ? `Disconnect from ${e.title}` : `Connect to ${e.title}`
|
|
243
257
|
}),
|
|
244
|
-
(t ||
|
|
245
|
-
className: `${
|
|
258
|
+
(t || F) && /* @__PURE__ */ y("button", {
|
|
259
|
+
className: `${C.detailsBtn} ${F ? C.detailsBtnFilled : ""}`,
|
|
246
260
|
onClick: (t) => {
|
|
247
|
-
t.stopPropagation(),
|
|
261
|
+
t.stopPropagation(), ce(e.id);
|
|
248
262
|
},
|
|
249
263
|
"aria-label": `Details of ${e.title}`,
|
|
250
|
-
title:
|
|
251
|
-
children: /* @__PURE__ */
|
|
264
|
+
title: F ? "Details" : "Add details",
|
|
265
|
+
children: /* @__PURE__ */ y(ie, {})
|
|
252
266
|
}),
|
|
253
|
-
t && /* @__PURE__ */
|
|
254
|
-
className:
|
|
267
|
+
t && /* @__PURE__ */ y("button", {
|
|
268
|
+
className: C.sizeBtn,
|
|
255
269
|
onClick: (t) => {
|
|
256
|
-
t.stopPropagation(),
|
|
270
|
+
t.stopPropagation(), j(e.id, u[(u.indexOf(P) + 1) % u.length]);
|
|
257
271
|
},
|
|
258
|
-
"aria-label": `Size of ${e.title}: ${
|
|
272
|
+
"aria-label": `Size of ${e.title}: ${E[P]}`,
|
|
259
273
|
title: "Size: click to change, or drag the right edge",
|
|
260
|
-
children:
|
|
274
|
+
children: T[P]
|
|
261
275
|
}),
|
|
262
|
-
t && /* @__PURE__ */
|
|
263
|
-
className:
|
|
276
|
+
t && /* @__PURE__ */ y("button", {
|
|
277
|
+
className: C.deleteBtn,
|
|
264
278
|
onClick: (t) => {
|
|
265
279
|
t.stopPropagation(), a(e.id);
|
|
266
280
|
},
|
|
267
281
|
"aria-label": `Delete ${e.title}`,
|
|
268
|
-
children: /* @__PURE__ */
|
|
282
|
+
children: /* @__PURE__ */ y(x, {})
|
|
269
283
|
}),
|
|
270
|
-
t && /* @__PURE__ */
|
|
271
|
-
className: `${
|
|
284
|
+
t && /* @__PURE__ */ y("button", {
|
|
285
|
+
className: `${C.connectBtn} ${V ? C.connectBtnActive : ""}`,
|
|
272
286
|
onClick: (t) => {
|
|
273
287
|
t.stopPropagation(), h(e.id);
|
|
274
288
|
},
|
|
275
|
-
"aria-label":
|
|
276
|
-
title:
|
|
277
|
-
children: /* @__PURE__ */
|
|
289
|
+
"aria-label": V ? "Cancel connection" : `Connect from ${e.title}`,
|
|
290
|
+
title: V ? "Cancel" : "Connect to another block",
|
|
291
|
+
children: /* @__PURE__ */ y(S, {})
|
|
278
292
|
}),
|
|
279
|
-
/* @__PURE__ */
|
|
280
|
-
className:
|
|
281
|
-
children: [e.icon && /* @__PURE__ */
|
|
282
|
-
className:
|
|
293
|
+
/* @__PURE__ */ b("div", {
|
|
294
|
+
className: C.header,
|
|
295
|
+
children: [e.icon && /* @__PURE__ */ y("span", {
|
|
296
|
+
className: C.icon,
|
|
283
297
|
children: e.icon
|
|
284
|
-
}), /* @__PURE__ */
|
|
285
|
-
className:
|
|
286
|
-
children: [/* @__PURE__ */
|
|
287
|
-
className: `${
|
|
298
|
+
}), /* @__PURE__ */ b("div", {
|
|
299
|
+
className: C.headerText,
|
|
300
|
+
children: [/* @__PURE__ */ y("h2", {
|
|
301
|
+
className: `${C.title} ${t ? C.editable : ""}`,
|
|
288
302
|
"data-text": !0,
|
|
289
303
|
contentEditable: t || void 0,
|
|
290
304
|
suppressContentEditableWarning: !0,
|
|
@@ -293,8 +307,8 @@ function ie({ block: e, editing: t, onRename: r, onDescribe: i, onDelete: a, onA
|
|
|
293
307
|
} : void 0,
|
|
294
308
|
onBlur: t ? (t) => r(e.id, t.currentTarget.textContent ?? "") : void 0,
|
|
295
309
|
children: e.title
|
|
296
|
-
}, `title-${t}`), (e.description || t) && /* @__PURE__ */
|
|
297
|
-
className: `${
|
|
310
|
+
}, `title-${t}`), (e.description || t) && /* @__PURE__ */ y("p", {
|
|
311
|
+
className: `${C.description} ${t ? C.editable : ""}`,
|
|
298
312
|
"data-text": !0,
|
|
299
313
|
contentEditable: t || void 0,
|
|
300
314
|
suppressContentEditableWarning: !0,
|
|
@@ -304,28 +318,28 @@ function ie({ block: e, editing: t, onRename: r, onDescribe: i, onDelete: a, onA
|
|
|
304
318
|
}, `desc-${t}`)]
|
|
305
319
|
})]
|
|
306
320
|
}),
|
|
307
|
-
|
|
308
|
-
className:
|
|
321
|
+
I && /* @__PURE__ */ b("button", {
|
|
322
|
+
className: C.inside,
|
|
309
323
|
"aria-label": `Zoom into ${e.title}`,
|
|
310
|
-
children: [
|
|
324
|
+
children: [le, " more inside"]
|
|
311
325
|
}),
|
|
312
|
-
!
|
|
313
|
-
className: `${
|
|
326
|
+
!I && t && /* @__PURE__ */ b("button", {
|
|
327
|
+
className: `${C.inside} ${C.addInside}`,
|
|
314
328
|
onClick: (t) => {
|
|
315
|
-
t.stopPropagation(),
|
|
329
|
+
t.stopPropagation(), L.current && l(e, G());
|
|
316
330
|
},
|
|
317
331
|
"aria-label": `Add child to ${e.title}`,
|
|
318
|
-
children: [/* @__PURE__ */
|
|
332
|
+
children: [/* @__PURE__ */ y(re, { size: 11 }), " add inside"]
|
|
319
333
|
})
|
|
320
334
|
]
|
|
321
335
|
});
|
|
322
336
|
}
|
|
323
337
|
// src/geometry.ts
|
|
324
|
-
var
|
|
325
|
-
function
|
|
338
|
+
var se = 2;
|
|
339
|
+
function ce(e, t, n, r) {
|
|
326
340
|
return e === "right" && t === "left" ? r.x - n.x : e === "left" && t === "right" ? n.x - r.x : e === "bottom" && t === "top" ? r.y - n.y : e === "top" && t === "bottom" ? n.y - r.y : null;
|
|
327
341
|
}
|
|
328
|
-
function
|
|
342
|
+
function O(e, t, n) {
|
|
329
343
|
switch (t) {
|
|
330
344
|
case "right": return {
|
|
331
345
|
x: e.x + n,
|
|
@@ -345,12 +359,12 @@ function j(e, t, n) {
|
|
|
345
359
|
};
|
|
346
360
|
}
|
|
347
361
|
}
|
|
348
|
-
function
|
|
362
|
+
function k(e, t, n) {
|
|
349
363
|
if (t <= 1) return 0;
|
|
350
364
|
let r = Math.min(16, n * .6 / t);
|
|
351
365
|
return (e - (t - 1) / 2) * r;
|
|
352
366
|
}
|
|
353
|
-
function
|
|
367
|
+
function A(e, t, n) {
|
|
354
368
|
let r = (e.left + e.right) / 2, i = (e.top + e.bottom) / 2, a = (t.left + t.right) / 2, o = (t.top + t.bottom) / 2, s = a - r, c = o - i;
|
|
355
369
|
if (Math.abs(c) < Math.min(e.height, t.height) * .5) {
|
|
356
370
|
let r = s >= 0;
|
|
@@ -371,28 +385,28 @@ function N(e, t, n) {
|
|
|
371
385
|
entryEdge: l ? "top" : "bottom"
|
|
372
386
|
};
|
|
373
387
|
}
|
|
374
|
-
function
|
|
388
|
+
function j(e, t, n, r, i) {
|
|
375
389
|
let a = (e.left + e.right) / 2, o = (e.top + e.bottom) / 2;
|
|
376
390
|
switch (t) {
|
|
377
391
|
case "right": return {
|
|
378
392
|
x: e.right - i.x,
|
|
379
|
-
y: o - i.y +
|
|
393
|
+
y: o - i.y + k(n, r, e.height)
|
|
380
394
|
};
|
|
381
395
|
case "left": return {
|
|
382
396
|
x: e.left - i.x,
|
|
383
|
-
y: o - i.y +
|
|
397
|
+
y: o - i.y + k(n, r, e.height)
|
|
384
398
|
};
|
|
385
399
|
case "bottom": return {
|
|
386
|
-
x: a - i.x +
|
|
400
|
+
x: a - i.x + k(n, r, e.width),
|
|
387
401
|
y: e.bottom - i.y
|
|
388
402
|
};
|
|
389
403
|
case "top": return {
|
|
390
|
-
x: a - i.x +
|
|
404
|
+
x: a - i.x + k(n, r, e.width),
|
|
391
405
|
y: e.top - i.y
|
|
392
406
|
};
|
|
393
407
|
}
|
|
394
408
|
}
|
|
395
|
-
function
|
|
409
|
+
function M(e, t, n, r, i, a, o) {
|
|
396
410
|
if (r === "bottom" && i === "bottom") {
|
|
397
411
|
let e = Math.max(a.y, o.y) + 32;
|
|
398
412
|
return [{
|
|
@@ -422,13 +436,13 @@ function F(e, t, n, r, i, a, o) {
|
|
|
422
436
|
y: s
|
|
423
437
|
}];
|
|
424
438
|
}
|
|
425
|
-
function
|
|
439
|
+
function N(e, t, n, r) {
|
|
426
440
|
return {
|
|
427
441
|
x: (e.x + 3 * t.x + 3 * n.x + r.x) / 8,
|
|
428
442
|
y: (e.y + 3 * t.y + 3 * n.y + r.y) / 8
|
|
429
443
|
};
|
|
430
444
|
}
|
|
431
|
-
function
|
|
445
|
+
function P(e, t, n) {
|
|
432
446
|
let r = {
|
|
433
447
|
x: n.left,
|
|
434
448
|
y: n.top
|
|
@@ -442,7 +456,7 @@ function ae(e, t, n) {
|
|
|
442
456
|
...n,
|
|
443
457
|
fromRect: a,
|
|
444
458
|
toRect: o,
|
|
445
|
-
...
|
|
459
|
+
...A(a, o, s)
|
|
446
460
|
});
|
|
447
461
|
}
|
|
448
462
|
let a = /* @__PURE__ */ new Map(), o = (e, t, n) => {
|
|
@@ -455,21 +469,34 @@ function ae(e, t, n) {
|
|
|
455
469
|
return i.forEach((e, t) => {
|
|
456
470
|
o(`${e.fromId}-${e.exitEdge}`, t, "exit"), o(`${e.toId}-${e.entryEdge}`, t, "entry");
|
|
457
471
|
}), i.map((e, t) => {
|
|
458
|
-
let n = a.get(`${e.fromId}-${e.exitEdge}`), i = a.get(`${e.toId}-${e.entryEdge}`), o = n.findIndex((e) => e.ci === t && e.role === "exit"), s = i.findIndex((e) => e.ci === t && e.role === "entry"), c =
|
|
459
|
-
if (f !== null && u + d > f -
|
|
460
|
-
let e = Math.max(0, f -
|
|
472
|
+
let n = a.get(`${e.fromId}-${e.exitEdge}`), i = a.get(`${e.toId}-${e.entryEdge}`), o = n.findIndex((e) => e.ci === t && e.role === "exit"), s = i.findIndex((e) => e.ci === t && e.role === "entry"), c = j(e.fromRect, e.exitEdge, o, n.length, r), l = j(e.toRect, e.entryEdge, s, i.length, r), u = e.headAtStart ? 14 : 0, d = e.headAtEnd ? 14 : 0, f = ce(e.exitEdge, e.entryEdge, c, l);
|
|
473
|
+
if (f !== null && u + d > f - se) {
|
|
474
|
+
let e = Math.max(0, f - se) / (u + d);
|
|
461
475
|
u *= e, d *= e;
|
|
462
476
|
}
|
|
463
|
-
let p =
|
|
477
|
+
let p = O(c, e.exitEdge, u), m = O(l, e.entryEdge, d), [h, g] = M(e.fromRect, e.toRect, r, e.exitEdge, e.entryEdge, p, m);
|
|
464
478
|
return {
|
|
465
479
|
key: e.key,
|
|
466
480
|
d: `M ${p.x} ${p.y} C ${h.x} ${h.y}, ${g.x} ${g.y}, ${m.x} ${m.y}`,
|
|
467
|
-
mid:
|
|
481
|
+
mid: N(p, h, g, m),
|
|
468
482
|
vertical: e.exitEdge === "top" && e.entryEdge === "bottom" || e.exitEdge === "bottom" && e.entryEdge === "top"
|
|
469
483
|
};
|
|
470
484
|
});
|
|
471
485
|
}
|
|
472
|
-
|
|
486
|
+
// src/fit.ts
|
|
487
|
+
var F = .6;
|
|
488
|
+
function le(e, t, n, r) {
|
|
489
|
+
if (e <= 0 || !t.length || r <= .6) return r;
|
|
490
|
+
let i = /* @__PURE__ */ new Map();
|
|
491
|
+
for (let e of t) {
|
|
492
|
+
let t = Math.round(e.top);
|
|
493
|
+
i.set(t, Math.max(i.get(t) ?? 0, e.height));
|
|
494
|
+
}
|
|
495
|
+
let a = (i.size - 1) * n * r;
|
|
496
|
+
for (let e of i.values()) a += e;
|
|
497
|
+
return a <= e ? r : Math.max(F, Math.floor(e / a * r * 100) / 100);
|
|
498
|
+
}
|
|
499
|
+
var I = {
|
|
473
500
|
popover: "_popover_1b6n3_1",
|
|
474
501
|
close: "_close_1b6n3_19",
|
|
475
502
|
row: "_row_1b6n3_39",
|
|
@@ -481,7 +508,7 @@ var L = {
|
|
|
481
508
|
btn: "_btn_1b6n3_83",
|
|
482
509
|
btnActive: "_btnActive_1b6n3_105",
|
|
483
510
|
danger: "_danger_1b6n3_112"
|
|
484
|
-
},
|
|
511
|
+
}, L = [
|
|
485
512
|
{
|
|
486
513
|
value: "forward",
|
|
487
514
|
symbol: "→",
|
|
@@ -498,7 +525,7 @@ var L = {
|
|
|
498
525
|
label: "No direction"
|
|
499
526
|
}
|
|
500
527
|
];
|
|
501
|
-
function
|
|
528
|
+
function R({ links: e, x: t, y: r, titleOf: i, onUpdate: a, onRemove: s, onClose: c }) {
|
|
502
529
|
let l = o(null);
|
|
503
530
|
return n(() => {
|
|
504
531
|
function e(e) {
|
|
@@ -510,9 +537,9 @@ function z({ links: e, x: t, y: r, titleOf: i, onUpdate: a, onRemove: s, onClose
|
|
|
510
537
|
return document.addEventListener("pointerdown", e), window.addEventListener("keydown", t), () => {
|
|
511
538
|
document.removeEventListener("pointerdown", e), window.removeEventListener("keydown", t);
|
|
512
539
|
};
|
|
513
|
-
}, [c]), /* @__PURE__ */
|
|
540
|
+
}, [c]), /* @__PURE__ */ b("div", {
|
|
514
541
|
ref: l,
|
|
515
|
-
className:
|
|
542
|
+
className: I.popover,
|
|
516
543
|
style: {
|
|
517
544
|
left: t,
|
|
518
545
|
top: r
|
|
@@ -520,12 +547,12 @@ function z({ links: e, x: t, y: r, titleOf: i, onUpdate: a, onRemove: s, onClose
|
|
|
520
547
|
role: "dialog",
|
|
521
548
|
"aria-label": e.length === 1 ? "Link" : `${e.length} links`,
|
|
522
549
|
onClick: (e) => e.stopPropagation(),
|
|
523
|
-
children: [/* @__PURE__ */
|
|
524
|
-
className:
|
|
550
|
+
children: [/* @__PURE__ */ y("button", {
|
|
551
|
+
className: I.close,
|
|
525
552
|
onClick: c,
|
|
526
553
|
"aria-label": "Close",
|
|
527
|
-
children: /* @__PURE__ */
|
|
528
|
-
}), e.map((e, t) => /* @__PURE__ */
|
|
554
|
+
children: /* @__PURE__ */ y(x, {})
|
|
555
|
+
}), e.map((e, t) => /* @__PURE__ */ y(z, {
|
|
529
556
|
link: e,
|
|
530
557
|
titleOf: i,
|
|
531
558
|
onUpdate: (t) => a(e, t),
|
|
@@ -533,7 +560,7 @@ function z({ links: e, x: t, y: r, titleOf: i, onUpdate: a, onRemove: s, onClose
|
|
|
533
560
|
}, e.id ?? t))]
|
|
534
561
|
});
|
|
535
562
|
}
|
|
536
|
-
function
|
|
563
|
+
function z({ link: e, titleOf: t, onUpdate: r, onRemove: i }) {
|
|
537
564
|
let [a, o] = s(e.label ?? "");
|
|
538
565
|
n(() => o(e.label ?? ""), [e.label]);
|
|
539
566
|
let c = e.direction ?? "forward";
|
|
@@ -541,24 +568,24 @@ function B({ link: e, titleOf: t, onUpdate: r, onRemove: i }) {
|
|
|
541
568
|
let t = a.trim();
|
|
542
569
|
t !== (e.label ?? "") && r({ label: t || void 0 });
|
|
543
570
|
}
|
|
544
|
-
return /* @__PURE__ */
|
|
545
|
-
className:
|
|
571
|
+
return /* @__PURE__ */ b("div", {
|
|
572
|
+
className: I.row,
|
|
546
573
|
children: [
|
|
547
|
-
/* @__PURE__ */
|
|
548
|
-
className:
|
|
574
|
+
/* @__PURE__ */ b("div", {
|
|
575
|
+
className: I.ends,
|
|
549
576
|
children: [
|
|
550
577
|
t(e.from),
|
|
551
578
|
" ",
|
|
552
|
-
/* @__PURE__ */
|
|
553
|
-
className:
|
|
554
|
-
children:
|
|
579
|
+
/* @__PURE__ */ y("span", {
|
|
580
|
+
className: I.endsArrow,
|
|
581
|
+
children: L.find((e) => e.value === c).symbol
|
|
555
582
|
}),
|
|
556
583
|
" ",
|
|
557
584
|
t(e.to)
|
|
558
585
|
]
|
|
559
586
|
}),
|
|
560
|
-
/* @__PURE__ */
|
|
561
|
-
className:
|
|
587
|
+
/* @__PURE__ */ y("input", {
|
|
588
|
+
className: I.label,
|
|
562
589
|
value: a,
|
|
563
590
|
placeholder: "Label",
|
|
564
591
|
"aria-label": "Label",
|
|
@@ -568,15 +595,15 @@ function B({ link: e, titleOf: t, onUpdate: r, onRemove: i }) {
|
|
|
568
595
|
e.key === "Enter" && (e.preventDefault(), l());
|
|
569
596
|
}
|
|
570
597
|
}),
|
|
571
|
-
/* @__PURE__ */
|
|
572
|
-
className:
|
|
598
|
+
/* @__PURE__ */ b("div", {
|
|
599
|
+
className: I.actions,
|
|
573
600
|
children: [
|
|
574
|
-
/* @__PURE__ */
|
|
575
|
-
className:
|
|
601
|
+
/* @__PURE__ */ y("div", {
|
|
602
|
+
className: I.directions,
|
|
576
603
|
role: "group",
|
|
577
604
|
"aria-label": "Direction",
|
|
578
|
-
children:
|
|
579
|
-
className: `${
|
|
605
|
+
children: L.map((e) => /* @__PURE__ */ y("button", {
|
|
606
|
+
className: `${I.btn} ${c === e.value ? I.btnActive : ""}`,
|
|
580
607
|
"aria-pressed": c === e.value,
|
|
581
608
|
"aria-label": e.label,
|
|
582
609
|
title: e.label,
|
|
@@ -584,8 +611,8 @@ function B({ link: e, titleOf: t, onUpdate: r, onRemove: i }) {
|
|
|
584
611
|
children: e.symbol
|
|
585
612
|
}, e.value))
|
|
586
613
|
}),
|
|
587
|
-
/* @__PURE__ */
|
|
588
|
-
className:
|
|
614
|
+
/* @__PURE__ */ y("button", {
|
|
615
|
+
className: I.btn,
|
|
589
616
|
onClick: () => r({
|
|
590
617
|
from: e.to,
|
|
591
618
|
to: e.from
|
|
@@ -595,8 +622,8 @@ function B({ link: e, titleOf: t, onUpdate: r, onRemove: i }) {
|
|
|
595
622
|
disabled: c !== "forward",
|
|
596
623
|
children: "⇄"
|
|
597
624
|
}),
|
|
598
|
-
/* @__PURE__ */
|
|
599
|
-
className: `${
|
|
625
|
+
/* @__PURE__ */ y("button", {
|
|
626
|
+
className: `${I.btn} ${I.danger}`,
|
|
600
627
|
onClick: i,
|
|
601
628
|
"aria-label": "Delete link",
|
|
602
629
|
title: "Delete link",
|
|
@@ -608,8 +635,8 @@ function B({ link: e, titleOf: t, onUpdate: r, onRemove: i }) {
|
|
|
608
635
|
});
|
|
609
636
|
}
|
|
610
637
|
// src/markdown.tsx
|
|
611
|
-
var
|
|
612
|
-
function
|
|
638
|
+
var B = /^(https?:\/\/|mailto:)/i;
|
|
639
|
+
function V(e) {
|
|
613
640
|
let t = e.replace(/\r\n?/g, "\n").split("\n"), n = [], r = 0;
|
|
614
641
|
for (; r < t.length;) {
|
|
615
642
|
let e = t[r];
|
|
@@ -655,25 +682,25 @@ function H(e) {
|
|
|
655
682
|
}
|
|
656
683
|
return n;
|
|
657
684
|
}
|
|
658
|
-
var
|
|
659
|
-
function
|
|
685
|
+
var H = /`([^`]+)`|\*\*([^*]+)\*\*|\*([^*]+)\*|\[([^\]]+)\]\(([^)\s]+)\)|\n/g;
|
|
686
|
+
function U(t) {
|
|
660
687
|
let n = [], r = 0, i = 0;
|
|
661
|
-
for (let a of t.matchAll(
|
|
688
|
+
for (let a of t.matchAll(H)) {
|
|
662
689
|
a.index > r && n.push(t.slice(r, a.index));
|
|
663
690
|
let [o, s, c, l, u, d] = a;
|
|
664
|
-
s === void 0 ? c === void 0 ? l === void 0 ? u === void 0 ? o === "\n" && n.push(/* @__PURE__ */
|
|
691
|
+
s === void 0 ? c === void 0 ? l === void 0 ? u === void 0 ? o === "\n" && n.push(/* @__PURE__ */ y("br", {}, i++)) : n.push(B.test(d) ? /* @__PURE__ */ y("a", {
|
|
665
692
|
href: d,
|
|
666
693
|
target: "_blank",
|
|
667
694
|
rel: "noopener noreferrer",
|
|
668
|
-
children:
|
|
669
|
-
}, i++) : /* @__PURE__ */
|
|
695
|
+
children: U(u)
|
|
696
|
+
}, i++) : /* @__PURE__ */ y(e, { children: U(u) }, i++)) : n.push(/* @__PURE__ */ y("em", { children: U(l) }, i++)) : n.push(/* @__PURE__ */ y("strong", { children: U(c) }, i++)) : n.push(/* @__PURE__ */ y("code", { children: s }, i++)), r = a.index + o.length;
|
|
670
697
|
}
|
|
671
698
|
return r < t.length && n.push(t.slice(r)), n;
|
|
672
699
|
}
|
|
673
|
-
function
|
|
674
|
-
return /* @__PURE__ */
|
|
700
|
+
function W({ source: e, className: t }) {
|
|
701
|
+
return /* @__PURE__ */ y("div", {
|
|
675
702
|
className: t,
|
|
676
|
-
children:
|
|
703
|
+
children: V(e).map((e, t) => {
|
|
677
704
|
switch (e.kind) {
|
|
678
705
|
case "heading": {
|
|
679
706
|
let n = [
|
|
@@ -681,19 +708,19 @@ function G({ source: e, className: t }) {
|
|
|
681
708
|
"h4",
|
|
682
709
|
"h5"
|
|
683
710
|
][e.level - 1];
|
|
684
|
-
return /* @__PURE__ */
|
|
711
|
+
return /* @__PURE__ */ y(n, { children: U(e.text) }, t);
|
|
685
712
|
}
|
|
686
|
-
case "paragraph": return /* @__PURE__ */
|
|
713
|
+
case "paragraph": return /* @__PURE__ */ y("p", { children: U(e.text) }, t);
|
|
687
714
|
case "list": {
|
|
688
715
|
let n = e.ordered ? "ol" : "ul";
|
|
689
|
-
return /* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ y(n, { children: e.items.map((e, t) => /* @__PURE__ */ y("li", { children: U(e) }, t)) }, t);
|
|
690
717
|
}
|
|
691
|
-
case "code": return /* @__PURE__ */
|
|
718
|
+
case "code": return /* @__PURE__ */ y("pre", { children: /* @__PURE__ */ y("code", { children: e.text }) }, t);
|
|
692
719
|
}
|
|
693
720
|
})
|
|
694
721
|
});
|
|
695
722
|
}
|
|
696
|
-
var
|
|
723
|
+
var G = {
|
|
697
724
|
panel: "_panel_24xow_1",
|
|
698
725
|
slideIn: "_slideIn_24xow_1",
|
|
699
726
|
close: "_close_24xow_24",
|
|
@@ -706,7 +733,7 @@ var K = {
|
|
|
706
733
|
empty: "_empty_24xow_124"
|
|
707
734
|
};
|
|
708
735
|
// src/DetailsPanel.tsx
|
|
709
|
-
function
|
|
736
|
+
function ue({ block: e, editing: t, onChange: r, onClose: i }) {
|
|
710
737
|
let [a, o] = s(e.details ?? "");
|
|
711
738
|
n(() => o(e.details ?? ""), [e.id, e.details]), n(() => {
|
|
712
739
|
function e(e) {
|
|
@@ -717,95 +744,96 @@ function oe({ block: e, editing: t, onChange: r, onClose: i }) {
|
|
|
717
744
|
function c() {
|
|
718
745
|
a !== (e.details ?? "") && r(a);
|
|
719
746
|
}
|
|
720
|
-
return /* @__PURE__ */
|
|
721
|
-
className:
|
|
747
|
+
return /* @__PURE__ */ b("aside", {
|
|
748
|
+
className: G.panel,
|
|
722
749
|
"aria-label": `Details: ${e.title}`,
|
|
723
750
|
children: [
|
|
724
|
-
/* @__PURE__ */
|
|
725
|
-
className:
|
|
751
|
+
/* @__PURE__ */ y("button", {
|
|
752
|
+
className: G.close,
|
|
726
753
|
onClick: i,
|
|
727
754
|
"aria-label": "Close details",
|
|
728
|
-
children: /* @__PURE__ */
|
|
755
|
+
children: /* @__PURE__ */ y(x, {})
|
|
729
756
|
}),
|
|
730
|
-
/* @__PURE__ */
|
|
731
|
-
className:
|
|
732
|
-
children: [e.icon && /* @__PURE__ */
|
|
733
|
-
className:
|
|
757
|
+
/* @__PURE__ */ b("div", {
|
|
758
|
+
className: G.head,
|
|
759
|
+
children: [e.icon && /* @__PURE__ */ y("span", {
|
|
760
|
+
className: G.icon,
|
|
734
761
|
children: e.icon
|
|
735
|
-
}), /* @__PURE__ */
|
|
736
|
-
className:
|
|
762
|
+
}), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("h2", {
|
|
763
|
+
className: G.title,
|
|
737
764
|
children: e.title
|
|
738
|
-
}), e.description && /* @__PURE__ */
|
|
739
|
-
className:
|
|
765
|
+
}), e.description && /* @__PURE__ */ y("p", {
|
|
766
|
+
className: G.description,
|
|
740
767
|
children: e.description
|
|
741
768
|
})] })]
|
|
742
769
|
}),
|
|
743
|
-
t ? /* @__PURE__ */
|
|
744
|
-
className:
|
|
770
|
+
t ? /* @__PURE__ */ b(ne, { children: [/* @__PURE__ */ y("textarea", {
|
|
771
|
+
className: G.editor,
|
|
745
772
|
value: a,
|
|
746
773
|
placeholder: "Details in Markdown: **bold**, *italic*, `code`, lists, [links](https://…)",
|
|
747
774
|
"aria-label": "Details (Markdown)",
|
|
748
775
|
onChange: (e) => o(e.target.value),
|
|
749
776
|
onBlur: c
|
|
750
|
-
}), a.trim() && /* @__PURE__ */
|
|
777
|
+
}), a.trim() && /* @__PURE__ */ y(W, {
|
|
751
778
|
source: a,
|
|
752
|
-
className:
|
|
753
|
-
})] }) : e.details?.trim() ? /* @__PURE__ */
|
|
779
|
+
className: G.body
|
|
780
|
+
})] }) : e.details?.trim() ? /* @__PURE__ */ y(W, {
|
|
754
781
|
source: e.details,
|
|
755
|
-
className:
|
|
756
|
-
}) : /* @__PURE__ */
|
|
757
|
-
className:
|
|
782
|
+
className: G.body
|
|
783
|
+
}) : /* @__PURE__ */ y("p", {
|
|
784
|
+
className: G.empty,
|
|
758
785
|
children: "No details"
|
|
759
786
|
})
|
|
760
787
|
]
|
|
761
788
|
});
|
|
762
789
|
}
|
|
763
|
-
var
|
|
764
|
-
viewer: "
|
|
765
|
-
breadcrumb: "
|
|
766
|
-
crumbItem: "
|
|
767
|
-
crumbSep: "
|
|
768
|
-
crumb: "
|
|
769
|
-
crumbActive: "
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
790
|
+
var K = {
|
|
791
|
+
viewer: "_viewer_1wq71_1",
|
|
792
|
+
breadcrumb: "_breadcrumb_1wq71_10",
|
|
793
|
+
crumbItem: "_crumbItem_1wq71_20",
|
|
794
|
+
crumbSep: "_crumbSep_1wq71_26",
|
|
795
|
+
crumb: "_crumb_1wq71_20",
|
|
796
|
+
crumbActive: "_crumbActive_1wq71_51",
|
|
797
|
+
crumbDrop: "_crumbDrop_1wq71_54",
|
|
798
|
+
backdrop: "_backdrop_1wq71_61",
|
|
799
|
+
slide: "_slide_1wq71_69",
|
|
800
|
+
slideCard: "_slideCard_1wq71_80",
|
|
801
|
+
slideHeader: "_slideHeader_1wq71_90",
|
|
802
|
+
headerDetailsBtn: "_headerDetailsBtn_1wq71_98",
|
|
803
|
+
slideHeaderTop: "_slideHeaderTop_1wq71_119",
|
|
804
|
+
slideIcon: "_slideIcon_1wq71_123",
|
|
805
|
+
slideHeaderText: "_slideHeaderText_1wq71_130",
|
|
806
|
+
slideTitle: "_slideTitle_1wq71_135",
|
|
807
|
+
slideDescription: "_slideDescription_1wq71_143",
|
|
808
|
+
gridArea: "_gridArea_1wq71_152",
|
|
809
|
+
arrowSvg: "_arrowSvg_1wq71_162",
|
|
810
|
+
arrow: "_arrow_1wq71_162",
|
|
811
|
+
arrowSvgEditing: "_arrowSvgEditing_1wq71_180",
|
|
812
|
+
arrowHit: "_arrowHit_1wq71_180",
|
|
813
|
+
arrowLabel: "_arrowLabel_1wq71_193",
|
|
814
|
+
arrowLabelOpen: "_arrowLabelOpen_1wq71_198",
|
|
815
|
+
arrowIndirect: "_arrowIndirect_1wq71_202",
|
|
816
|
+
arrowHead: "_arrowHead_1wq71_206",
|
|
817
|
+
empty: "_empty_1wq71_220",
|
|
818
|
+
gridAreaNested: "_gridAreaNested_1wq71_227",
|
|
819
|
+
grid: "_grid_1wq71_150",
|
|
820
|
+
levelTools: "_levelTools_1wq71_258",
|
|
821
|
+
groupBtn: "_groupBtn_1wq71_264",
|
|
822
|
+
groupBtnActive: "_groupBtnActive_1wq71_281",
|
|
823
|
+
fullHint: "_fullHint_1wq71_288",
|
|
824
|
+
addBlock: "_addBlock_1wq71_295",
|
|
825
|
+
linkBar: "_linkBar_1wq71_316",
|
|
826
|
+
linkBarCancel: "_linkBarCancel_1wq71_334"
|
|
799
827
|
};
|
|
800
828
|
// src/Viewer.tsx
|
|
801
|
-
function
|
|
829
|
+
function de(e) {
|
|
802
830
|
let t = [...new Set(e.links.map((e) => e.label).filter((e) => !!e))];
|
|
803
831
|
return e.links.length > 2 ? `${e.links.length} links` : t.length ? t.join(", ") : void 0;
|
|
804
832
|
}
|
|
805
|
-
function
|
|
833
|
+
function fe(e) {
|
|
806
834
|
return [e.from, e.to].sort().join("|");
|
|
807
835
|
}
|
|
808
|
-
function
|
|
836
|
+
function pe(e) {
|
|
809
837
|
return {
|
|
810
838
|
left: e.left,
|
|
811
839
|
top: e.top,
|
|
@@ -815,23 +843,23 @@ function ce(e) {
|
|
|
815
843
|
height: e.height
|
|
816
844
|
};
|
|
817
845
|
}
|
|
818
|
-
function
|
|
819
|
-
let d = o(null), f = o(null), m = o(!1), g = o(!1), _ = o(/* @__PURE__ */ new Map()), ee = o(null), v = r(), [
|
|
820
|
-
let e = L.findIndex((e) => !
|
|
846
|
+
function q({ document: e, editing: c, actions: u }) {
|
|
847
|
+
let d = o(null), f = o(null), m = o(!1), g = o(!1), _ = o(/* @__PURE__ */ new Map()), ee = o(null), v = o(null), ne = r(), [x, S] = s(null), [C, ae] = s(null), [w, T] = s(null), [E, D] = s(null), se = t(() => D(null), []), [ce, O] = s(null), k = t(() => O(null), []), [A, j] = s(null), [M, N] = s(null), [F, I] = s([]), [L, z] = s([]), [B, V] = s(0), [H, U] = s(0), [W, G] = s(0), [q, me] = s(1), J = a(() => p(e), [e]), he = ce ? J.get(ce)?.block : void 0, Y = a(() => {
|
|
848
|
+
let e = L.findIndex((e) => !J.has(e.id));
|
|
821
849
|
return e === -1 ? L : L.slice(0, e);
|
|
822
|
-
}, [L,
|
|
850
|
+
}, [L, J]);
|
|
823
851
|
n(() => {
|
|
824
|
-
Y !== L &&
|
|
852
|
+
Y !== L && z(Y);
|
|
825
853
|
}, [Y, L]);
|
|
826
|
-
let X = Y.length ? Y[Y.length - 1].id : null, Z = X === null ? void 0 :
|
|
854
|
+
let X = Y.length ? Y[Y.length - 1].id : null, Z = X === null ? void 0 : J.get(X)?.block, Q = a(() => h(e, X, J).slice(0, l), [
|
|
827
855
|
e,
|
|
828
856
|
X,
|
|
829
|
-
|
|
830
|
-
]), $ = a(() => te(e, X,
|
|
857
|
+
J
|
|
858
|
+
]), $ = a(() => te(e, X, J), [
|
|
831
859
|
e,
|
|
832
860
|
X,
|
|
833
|
-
|
|
834
|
-
]),
|
|
861
|
+
J
|
|
862
|
+
]), ge = X !== null, _e = c && Q.length < l;
|
|
835
863
|
i(() => {
|
|
836
864
|
let e = d.current;
|
|
837
865
|
if (!e) return;
|
|
@@ -850,12 +878,12 @@ function le({ document: e, editing: c, actions: u }) {
|
|
|
850
878
|
}, { once: !0 });
|
|
851
879
|
});
|
|
852
880
|
}, [B]), n(() => {
|
|
853
|
-
c || (S(null),
|
|
854
|
-
}, [c]), n(() =>
|
|
855
|
-
|
|
856
|
-
}, [$,
|
|
881
|
+
c || (S(null), D(null), T(null));
|
|
882
|
+
}, [c]), n(() => T(null), [X]), n(() => {
|
|
883
|
+
E && !$.some((e) => fe(e) === E) && D(null);
|
|
884
|
+
}, [$, E]), n(() => {
|
|
857
885
|
function e(e) {
|
|
858
|
-
e.key === "Escape" && (S(null),
|
|
886
|
+
e.key === "Escape" && (S(null), T(null));
|
|
859
887
|
}
|
|
860
888
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
861
889
|
}, []), n(() => {
|
|
@@ -867,14 +895,14 @@ function le({ document: e, editing: c, actions: u }) {
|
|
|
867
895
|
return;
|
|
868
896
|
}
|
|
869
897
|
let t = /* @__PURE__ */ new Map();
|
|
870
|
-
for (let [e, n] of _.current) t.set(e,
|
|
871
|
-
I(
|
|
898
|
+
for (let [e, n] of _.current) t.set(e, pe(n.getBoundingClientRect()));
|
|
899
|
+
I(P($.map((e) => ({
|
|
872
900
|
key: e.key,
|
|
873
901
|
fromId: e.from,
|
|
874
902
|
toId: e.to,
|
|
875
903
|
headAtStart: e.direction === "both",
|
|
876
904
|
headAtEnd: e.direction !== "none"
|
|
877
|
-
})), t,
|
|
905
|
+
})), t, pe(e.getBoundingClientRect())));
|
|
878
906
|
}
|
|
879
907
|
if (t) {
|
|
880
908
|
I([]);
|
|
@@ -890,232 +918,274 @@ function le({ document: e, editing: c, actions: u }) {
|
|
|
890
918
|
H,
|
|
891
919
|
W
|
|
892
920
|
]);
|
|
893
|
-
let
|
|
921
|
+
let ve = o("");
|
|
922
|
+
i(() => {
|
|
923
|
+
let e = v.current, t = d.current;
|
|
924
|
+
if (!e || t && (t.style.transform !== "" || t.style.transition !== "")) return;
|
|
925
|
+
let n = e.getBoundingClientRect(), r = `${Math.round(n.width)}x${Math.round(n.height)}|${Q.map((e) => e.id).join()}|${c}`;
|
|
926
|
+
if (r !== ve.current && (ve.current = r, q !== 1)) {
|
|
927
|
+
me(1);
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
930
|
+
let i = [...e.children].map((e) => pe(e.getBoundingClientRect())), a = parseFloat(getComputedStyle(e).rowGap) || 0, o = le(n.height, i, a, q);
|
|
931
|
+
o !== q && me(o);
|
|
932
|
+
}, [
|
|
933
|
+
Q,
|
|
934
|
+
c,
|
|
935
|
+
H,
|
|
936
|
+
W,
|
|
937
|
+
B,
|
|
938
|
+
q
|
|
939
|
+
]);
|
|
940
|
+
let ye = o(null);
|
|
894
941
|
n(() => {
|
|
895
942
|
let e = ee.current;
|
|
896
943
|
if (!e || typeof ResizeObserver > "u") return;
|
|
897
944
|
let t = new ResizeObserver(() => U((e) => e + 1));
|
|
898
|
-
|
|
945
|
+
ye.current = t, t.observe(e);
|
|
899
946
|
for (let e of _.current.values()) t.observe(e);
|
|
900
947
|
return () => {
|
|
901
|
-
t.disconnect(),
|
|
948
|
+
t.disconnect(), ye.current = null;
|
|
902
949
|
};
|
|
903
950
|
}, []);
|
|
904
|
-
let
|
|
951
|
+
let be = t((e, t) => {
|
|
905
952
|
let n = _.current.get(e);
|
|
906
|
-
n &&
|
|
907
|
-
}, []),
|
|
953
|
+
n && ye.current?.unobserve(n), t ? (_.current.set(e, t), ye.current?.observe(t)) : _.current.delete(e);
|
|
954
|
+
}, []), xe = a(() => {
|
|
908
955
|
let e = new Map($.map((e) => [e.key, e]));
|
|
909
956
|
return F.flatMap((t) => {
|
|
910
957
|
let n = e.get(t.key);
|
|
911
958
|
return n ? [{
|
|
912
959
|
...t,
|
|
913
960
|
link: n,
|
|
914
|
-
label:
|
|
961
|
+
label: de(n)
|
|
915
962
|
}] : [];
|
|
916
963
|
});
|
|
917
|
-
}, [F, $]),
|
|
918
|
-
if (!
|
|
919
|
-
let t =
|
|
920
|
-
return !t || !n ? !1 : !t.path.includes(e) && !n.path.includes(
|
|
921
|
-
}, [
|
|
922
|
-
function
|
|
923
|
-
f.current = t,
|
|
964
|
+
}, [F, $]), Se = t((e) => {
|
|
965
|
+
if (!x || e === x) return !1;
|
|
966
|
+
let t = J.get(x), n = J.get(e);
|
|
967
|
+
return !t || !n ? !1 : !t.path.includes(e) && !n.path.includes(x);
|
|
968
|
+
}, [x, J]), Ce = x ? J.get(x)?.block : void 0, we = a(() => x ? new Set((e.links ?? []).filter((e) => e.from === x).map((e) => e.to)) : /* @__PURE__ */ new Set(), [e.links, x]);
|
|
969
|
+
function Te(e, t) {
|
|
970
|
+
f.current = t, z((n) => [...n, {
|
|
924
971
|
id: e.id,
|
|
925
972
|
cardRect: t
|
|
926
973
|
}]), V((e) => e + 1);
|
|
927
974
|
}
|
|
928
|
-
function
|
|
929
|
-
u.add(e.id),
|
|
975
|
+
function Ee(e, t) {
|
|
976
|
+
u.add(e.id), Te(e, t);
|
|
930
977
|
}
|
|
931
|
-
function
|
|
978
|
+
function De(e) {
|
|
932
979
|
if (e >= Y.length) return;
|
|
933
980
|
let t = Y[Y.length - 1]?.cardRect, n = d.current;
|
|
934
981
|
if (t && n) {
|
|
935
982
|
let r = n.getBoundingClientRect(), i = t.width / r.width, a = t.height / r.height, o = t.left + t.width / 2 - (r.left + r.width / 2), s = t.top + t.height / 2 - (r.top + r.height / 2);
|
|
936
983
|
n.style.transition = "transform 0.35s cubic-bezier(0.4, 0, 0.8, 0)", n.style.transformOrigin = "center center", n.style.transform = `translate(${o}px, ${s}px) scale(${i}, ${a})`, g.current = !0, setTimeout(() => {
|
|
937
|
-
g.current = !1, m.current = !0,
|
|
984
|
+
g.current = !1, m.current = !0, z((t) => t.slice(0, e)), V((e) => e + 1);
|
|
938
985
|
}, 370);
|
|
939
|
-
} else
|
|
986
|
+
} else z((t) => t.slice(0, e)), V((e) => e + 1);
|
|
940
987
|
}
|
|
941
|
-
function
|
|
942
|
-
|
|
988
|
+
function Oe() {
|
|
989
|
+
ae(null), j(null), N(null);
|
|
943
990
|
}
|
|
944
|
-
function
|
|
945
|
-
if (C &&
|
|
946
|
-
|
|
991
|
+
function ke() {
|
|
992
|
+
if (C && A?.position === "inside" && A.id !== C) u.move(C, A.id, J.get(A.id)?.block.children?.length ?? 0);
|
|
993
|
+
else if (C && A && A.id !== C) {
|
|
994
|
+
let e = Q.map((e) => e.id).filter((e) => e !== C).indexOf(A.id) + +(A.position === "after");
|
|
947
995
|
e !== Q.findIndex((e) => e.id === C) && u.move(C, X, e);
|
|
948
996
|
}
|
|
949
|
-
|
|
997
|
+
Oe();
|
|
950
998
|
}
|
|
951
|
-
let
|
|
999
|
+
let Ae = (e) => e === 0 ? null : Y[e - 1].id, je = (t) => h(e, t, J).length < l, Me = (t) => c && t < Y.length ? {
|
|
1000
|
+
onDragOver: (e) => {
|
|
1001
|
+
C && je(Ae(t)) && (e.preventDefault(), j(null), M !== t && N(t));
|
|
1002
|
+
},
|
|
1003
|
+
onDragLeave: () => N(null),
|
|
1004
|
+
onDrop: (n) => {
|
|
1005
|
+
n.preventDefault();
|
|
1006
|
+
let r = Ae(t);
|
|
1007
|
+
C && u.move(C, r, h(e, r, J).length), Oe();
|
|
1008
|
+
}
|
|
1009
|
+
} : {}, Ne = o(null);
|
|
1010
|
+
function Pe(e, t) {
|
|
1011
|
+
let n = Q.findIndex((t) => t.id === e), r = n + t;
|
|
1012
|
+
n === -1 || r < 0 || r >= Q.length || (Ne.current = e, u.move(e, X, r));
|
|
1013
|
+
}
|
|
1014
|
+
n(() => {
|
|
1015
|
+
let e = Ne.current;
|
|
1016
|
+
e && (Ne.current = null, v.current?.querySelector(`[data-block-id="${CSS.escape(e)}"] [data-drag-handle]`)?.focus());
|
|
1017
|
+
}, [Q]);
|
|
1018
|
+
let Fe = c ? {
|
|
952
1019
|
onDragOver: (e) => {
|
|
953
1020
|
C && e.preventDefault();
|
|
954
1021
|
},
|
|
955
1022
|
onDrop: (e) => {
|
|
956
|
-
e.preventDefault(),
|
|
1023
|
+
e.preventDefault(), ke();
|
|
957
1024
|
}
|
|
958
1025
|
} : {};
|
|
959
|
-
function
|
|
960
|
-
|
|
1026
|
+
function Ie(e) {
|
|
1027
|
+
x && (u.toggleLink(x, e), S(null));
|
|
961
1028
|
}
|
|
962
|
-
let
|
|
1029
|
+
let Le = [{ label: e.title }, ...Y.map((e) => ({ label: J.get(e.id)?.block.title ?? "" }))], Re = (e) => /* @__PURE__ */ y(oe, {
|
|
963
1030
|
block: e,
|
|
964
1031
|
editing: c,
|
|
965
1032
|
onRename: u.rename,
|
|
966
1033
|
onDescribe: u.describe,
|
|
967
1034
|
onDelete: u.remove,
|
|
968
|
-
onAddChild:
|
|
969
|
-
onDrillIn:
|
|
970
|
-
connectingFrom:
|
|
971
|
-
canLinkTo:
|
|
972
|
-
isConnected:
|
|
973
|
-
onStartConnect: (e) => S(e ===
|
|
974
|
-
onConnectTarget:
|
|
975
|
-
onRegisterEl:
|
|
1035
|
+
onAddChild: Ee,
|
|
1036
|
+
onDrillIn: Te,
|
|
1037
|
+
connectingFrom: x,
|
|
1038
|
+
canLinkTo: Se(e.id),
|
|
1039
|
+
isConnected: we.has(e.id),
|
|
1040
|
+
onStartConnect: (e) => S(e === x ? null : e),
|
|
1041
|
+
onConnectTarget: Ie,
|
|
1042
|
+
onRegisterEl: be,
|
|
976
1043
|
isDragged: C === e.id,
|
|
977
|
-
dropPosition: C &&
|
|
978
|
-
|
|
1044
|
+
dropPosition: C && A?.id === e.id && A.id !== C ? A.position : null,
|
|
1045
|
+
canDropInside: !!C && C !== e.id && (e.children?.length ?? 0) < l,
|
|
1046
|
+
onDragStartBlock: ae,
|
|
979
1047
|
onDragOverBlock: (e, t) => {
|
|
980
|
-
C && (
|
|
1048
|
+
C && (A?.id !== e || A.position !== t) && j({
|
|
981
1049
|
id: e,
|
|
982
1050
|
position: t
|
|
983
1051
|
});
|
|
984
1052
|
},
|
|
985
|
-
onDragEndBlock:
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1053
|
+
onDragEndBlock: Oe,
|
|
1054
|
+
onMoveBy: Pe,
|
|
1055
|
+
onShowDetails: O,
|
|
1056
|
+
selectable: w !== null,
|
|
1057
|
+
selected: w?.includes(e.id) ?? !1,
|
|
1058
|
+
onToggleSelect: (e) => T((t) => t && (t.includes(e) ? t.filter((t) => t !== e) : [...t, e])),
|
|
990
1059
|
onResize: u.setSize
|
|
991
|
-
}, e.id),
|
|
992
|
-
className:
|
|
1060
|
+
}, e.id), ze = () => /* @__PURE__ */ y("button", {
|
|
1061
|
+
className: K.addBlock,
|
|
993
1062
|
onClick: () => u.add(X),
|
|
994
1063
|
"aria-label": "Add block",
|
|
995
|
-
children: /* @__PURE__ */
|
|
1064
|
+
children: /* @__PURE__ */ y(re, {})
|
|
996
1065
|
});
|
|
997
|
-
return /* @__PURE__ */
|
|
998
|
-
className:
|
|
1066
|
+
return /* @__PURE__ */ b("div", {
|
|
1067
|
+
className: K.viewer,
|
|
999
1068
|
children: [
|
|
1000
|
-
|
|
1001
|
-
className:
|
|
1069
|
+
ge && /* @__PURE__ */ y("nav", {
|
|
1070
|
+
className: K.breadcrumb,
|
|
1002
1071
|
"aria-label": "Breadcrumb",
|
|
1003
1072
|
onClick: (e) => {
|
|
1004
|
-
e.target.closest("button") || g.current ||
|
|
1073
|
+
e.target.closest("button") || g.current || De(Y.length - 1);
|
|
1005
1074
|
},
|
|
1006
|
-
children:
|
|
1007
|
-
className:
|
|
1008
|
-
children: [t > 0 && /* @__PURE__ */
|
|
1009
|
-
className:
|
|
1075
|
+
children: Le.map((e, t) => /* @__PURE__ */ b("span", {
|
|
1076
|
+
className: K.crumbItem,
|
|
1077
|
+
children: [t > 0 && /* @__PURE__ */ y("span", {
|
|
1078
|
+
className: K.crumbSep,
|
|
1010
1079
|
children: "/"
|
|
1011
|
-
}), /* @__PURE__ */
|
|
1012
|
-
className: `${
|
|
1013
|
-
onClick: () =>
|
|
1014
|
-
disabled: t ===
|
|
1015
|
-
"aria-current": t ===
|
|
1080
|
+
}), /* @__PURE__ */ y("button", {
|
|
1081
|
+
className: `${K.crumb} ${t === Le.length - 1 ? K.crumbActive : ""} ${M === t ? K.crumbDrop : ""}`,
|
|
1082
|
+
onClick: () => De(t),
|
|
1083
|
+
disabled: t === Le.length - 1,
|
|
1084
|
+
"aria-current": t === Le.length - 1 ? "location" : void 0,
|
|
1085
|
+
...Me(t),
|
|
1016
1086
|
children: e.label
|
|
1017
1087
|
})]
|
|
1018
1088
|
}, t))
|
|
1019
1089
|
}),
|
|
1020
|
-
|
|
1021
|
-
className:
|
|
1090
|
+
w && /* @__PURE__ */ b("div", {
|
|
1091
|
+
className: K.linkBar,
|
|
1022
1092
|
role: "status",
|
|
1023
1093
|
children: [
|
|
1024
|
-
/* @__PURE__ */
|
|
1094
|
+
/* @__PURE__ */ b("span", { children: [
|
|
1025
1095
|
"Select blocks to group: ",
|
|
1026
|
-
/* @__PURE__ */
|
|
1096
|
+
/* @__PURE__ */ y("strong", { children: w.length }),
|
|
1027
1097
|
" selected"
|
|
1028
1098
|
] }),
|
|
1029
|
-
/* @__PURE__ */
|
|
1030
|
-
className:
|
|
1031
|
-
disabled:
|
|
1099
|
+
/* @__PURE__ */ y("button", {
|
|
1100
|
+
className: K.linkBarCancel,
|
|
1101
|
+
disabled: w.length < 2,
|
|
1032
1102
|
onClick: () => {
|
|
1033
|
-
u.group(
|
|
1103
|
+
u.group(w), T(null);
|
|
1034
1104
|
},
|
|
1035
1105
|
children: "Group"
|
|
1036
1106
|
}),
|
|
1037
|
-
/* @__PURE__ */
|
|
1038
|
-
className:
|
|
1039
|
-
onClick: () =>
|
|
1107
|
+
/* @__PURE__ */ y("button", {
|
|
1108
|
+
className: K.linkBarCancel,
|
|
1109
|
+
onClick: () => T(null),
|
|
1040
1110
|
children: "Cancel"
|
|
1041
1111
|
})
|
|
1042
1112
|
]
|
|
1043
1113
|
}),
|
|
1044
|
-
|
|
1045
|
-
className:
|
|
1114
|
+
Ce && /* @__PURE__ */ b("div", {
|
|
1115
|
+
className: K.linkBar,
|
|
1046
1116
|
role: "status",
|
|
1047
|
-
children: [/* @__PURE__ */
|
|
1117
|
+
children: [/* @__PURE__ */ b("span", { children: [
|
|
1048
1118
|
"Linking from ",
|
|
1049
|
-
/* @__PURE__ */
|
|
1119
|
+
/* @__PURE__ */ y("strong", { children: Ce.title }),
|
|
1050
1120
|
": click a block on any level"
|
|
1051
|
-
] }), /* @__PURE__ */
|
|
1052
|
-
className:
|
|
1121
|
+
] }), /* @__PURE__ */ y("button", {
|
|
1122
|
+
className: K.linkBarCancel,
|
|
1053
1123
|
onClick: () => S(null),
|
|
1054
1124
|
children: "Cancel"
|
|
1055
1125
|
})]
|
|
1056
1126
|
}),
|
|
1057
|
-
|
|
1058
|
-
className:
|
|
1127
|
+
ge && /* @__PURE__ */ y("div", {
|
|
1128
|
+
className: K.backdrop,
|
|
1059
1129
|
onClick: () => {
|
|
1060
|
-
g.current ||
|
|
1130
|
+
g.current || De(Y.length - 1);
|
|
1061
1131
|
},
|
|
1062
1132
|
"aria-hidden": "true"
|
|
1063
1133
|
}),
|
|
1064
|
-
/* @__PURE__ */
|
|
1134
|
+
/* @__PURE__ */ b("div", {
|
|
1065
1135
|
ref: d,
|
|
1066
|
-
className: `${
|
|
1136
|
+
className: `${K.slide} ${ge ? K.slideCard : ""}`,
|
|
1067
1137
|
children: [(() => {
|
|
1068
1138
|
let t = Z ?? {
|
|
1069
1139
|
title: e.title,
|
|
1070
1140
|
description: e.description,
|
|
1071
1141
|
icon: void 0
|
|
1072
1142
|
};
|
|
1073
|
-
return /* @__PURE__ */
|
|
1074
|
-
className: `${
|
|
1143
|
+
return /* @__PURE__ */ b("div", {
|
|
1144
|
+
className: `${K.slideHeader} ${Z ? "" : K.slideHeaderTop}`,
|
|
1075
1145
|
children: [
|
|
1076
|
-
t.icon && /* @__PURE__ */
|
|
1077
|
-
className:
|
|
1146
|
+
t.icon && /* @__PURE__ */ y("span", {
|
|
1147
|
+
className: K.slideIcon,
|
|
1078
1148
|
children: t.icon
|
|
1079
1149
|
}),
|
|
1080
|
-
/* @__PURE__ */
|
|
1081
|
-
className:
|
|
1082
|
-
children: [/* @__PURE__ */
|
|
1083
|
-
className:
|
|
1150
|
+
/* @__PURE__ */ b("div", {
|
|
1151
|
+
className: K.slideHeaderText,
|
|
1152
|
+
children: [/* @__PURE__ */ y("h1", {
|
|
1153
|
+
className: K.slideTitle,
|
|
1084
1154
|
children: t.title
|
|
1085
|
-
}), t.description && /* @__PURE__ */
|
|
1086
|
-
className:
|
|
1155
|
+
}), t.description && /* @__PURE__ */ y("p", {
|
|
1156
|
+
className: K.slideDescription,
|
|
1087
1157
|
children: t.description
|
|
1088
1158
|
})]
|
|
1089
1159
|
}),
|
|
1090
|
-
Z && (c || Z.details?.trim()) && /* @__PURE__ */
|
|
1091
|
-
className:
|
|
1092
|
-
onClick: () =>
|
|
1160
|
+
Z && (c || Z.details?.trim()) && /* @__PURE__ */ b("button", {
|
|
1161
|
+
className: K.headerDetailsBtn,
|
|
1162
|
+
onClick: () => O(Z.id),
|
|
1093
1163
|
"aria-label": `Details of ${Z.title}`,
|
|
1094
1164
|
children: [
|
|
1095
|
-
/* @__PURE__ */
|
|
1165
|
+
/* @__PURE__ */ y(ie, {}),
|
|
1096
1166
|
" ",
|
|
1097
1167
|
Z.details?.trim() ? "Details" : "Add details"
|
|
1098
1168
|
]
|
|
1099
1169
|
})
|
|
1100
1170
|
]
|
|
1101
1171
|
});
|
|
1102
|
-
})(), /* @__PURE__ */
|
|
1172
|
+
})(), /* @__PURE__ */ b("div", {
|
|
1103
1173
|
ref: ee,
|
|
1104
|
-
className: `${
|
|
1174
|
+
className: `${K.gridArea} ${ge ? K.gridAreaNested : ""}`,
|
|
1105
1175
|
children: [
|
|
1106
|
-
c && Q.length >= 2 && /* @__PURE__ */
|
|
1107
|
-
className:
|
|
1176
|
+
c && Q.length >= 2 && /* @__PURE__ */ b("div", {
|
|
1177
|
+
className: K.levelTools,
|
|
1108
1178
|
role: "group",
|
|
1109
1179
|
"aria-label": "Level tools",
|
|
1110
|
-
children: [/* @__PURE__ */
|
|
1111
|
-
className: `${
|
|
1180
|
+
children: [/* @__PURE__ */ y("button", {
|
|
1181
|
+
className: `${K.groupBtn} ${w ? K.groupBtnActive : ""}`,
|
|
1112
1182
|
onClick: () => {
|
|
1113
|
-
S(null),
|
|
1183
|
+
S(null), T((e) => e ? null : []);
|
|
1114
1184
|
},
|
|
1115
|
-
"aria-pressed":
|
|
1185
|
+
"aria-pressed": w !== null,
|
|
1116
1186
|
children: "Group blocks"
|
|
1117
|
-
}), Q.length >= l && !
|
|
1118
|
-
className:
|
|
1187
|
+
}), Q.length >= l && !w && /* @__PURE__ */ b("span", {
|
|
1188
|
+
className: K.fullHint,
|
|
1119
1189
|
children: [
|
|
1120
1190
|
Q.length,
|
|
1121
1191
|
" of ",
|
|
@@ -1124,54 +1194,56 @@ function le({ document: e, editing: c, actions: u }) {
|
|
|
1124
1194
|
]
|
|
1125
1195
|
})]
|
|
1126
1196
|
}),
|
|
1127
|
-
/* @__PURE__ */
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1197
|
+
/* @__PURE__ */ b("div", {
|
|
1198
|
+
ref: v,
|
|
1199
|
+
className: K.grid,
|
|
1200
|
+
style: q < 1 ? { zoom: q } : void 0,
|
|
1201
|
+
...Fe,
|
|
1202
|
+
children: [Q.map((e) => Re(e)), _e && ze()]
|
|
1131
1203
|
}),
|
|
1132
|
-
Q.length === 0 && !c && /* @__PURE__ */
|
|
1133
|
-
className:
|
|
1204
|
+
Q.length === 0 && !c && /* @__PURE__ */ y("p", {
|
|
1205
|
+
className: K.empty,
|
|
1134
1206
|
children: "Nothing here yet"
|
|
1135
1207
|
}),
|
|
1136
|
-
|
|
1137
|
-
className: `${
|
|
1208
|
+
xe.length > 0 && /* @__PURE__ */ b("svg", {
|
|
1209
|
+
className: `${K.arrowSvg} ${c ? K.arrowSvgEditing : ""}`,
|
|
1138
1210
|
"aria-hidden": !c || void 0,
|
|
1139
|
-
children: [/* @__PURE__ */
|
|
1140
|
-
id:
|
|
1211
|
+
children: [/* @__PURE__ */ y("defs", { children: /* @__PURE__ */ y("marker", {
|
|
1212
|
+
id: ne,
|
|
1141
1213
|
markerWidth: 10,
|
|
1142
1214
|
markerHeight: "8",
|
|
1143
1215
|
refX: "0",
|
|
1144
1216
|
refY: "4",
|
|
1145
1217
|
orient: "auto-start-reverse",
|
|
1146
1218
|
markerUnits: "userSpaceOnUse",
|
|
1147
|
-
children: /* @__PURE__ */
|
|
1219
|
+
children: /* @__PURE__ */ y("path", {
|
|
1148
1220
|
d: "M 0 0 L 10 4 L 0 8 Z",
|
|
1149
|
-
className:
|
|
1221
|
+
className: K.arrowHead
|
|
1150
1222
|
})
|
|
1151
|
-
}) }),
|
|
1223
|
+
}) }), xe.map((e) => /* @__PURE__ */ b("g", {
|
|
1152
1224
|
"data-link": e.key,
|
|
1153
1225
|
children: [
|
|
1154
|
-
c && /* @__PURE__ */
|
|
1226
|
+
c && /* @__PURE__ */ y("path", {
|
|
1155
1227
|
d: e.d,
|
|
1156
|
-
className:
|
|
1228
|
+
className: K.arrowHit,
|
|
1157
1229
|
role: "button",
|
|
1158
|
-
"aria-label": `Edit link ${
|
|
1230
|
+
"aria-label": `Edit link ${J.get(e.link.from)?.block.title ?? e.link.from} – ${J.get(e.link.to)?.block.title ?? e.link.to}`,
|
|
1159
1231
|
onClick: (t) => {
|
|
1160
|
-
t.stopPropagation(),
|
|
1232
|
+
t.stopPropagation(), D(fe(e.link));
|
|
1161
1233
|
}
|
|
1162
1234
|
}),
|
|
1163
|
-
/* @__PURE__ */
|
|
1235
|
+
/* @__PURE__ */ y("path", {
|
|
1164
1236
|
d: e.d,
|
|
1165
|
-
className: `${
|
|
1166
|
-
markerEnd: e.link.direction === "none" ? void 0 : `url(#${
|
|
1167
|
-
markerStart: e.link.direction === "both" ? `url(#${
|
|
1237
|
+
className: `${K.arrow} ${e.link.direct ? "" : K.arrowIndirect}`,
|
|
1238
|
+
markerEnd: e.link.direction === "none" ? void 0 : `url(#${ne})`,
|
|
1239
|
+
markerStart: e.link.direction === "both" ? `url(#${ne})` : void 0
|
|
1168
1240
|
}),
|
|
1169
|
-
e.label && /* @__PURE__ */
|
|
1241
|
+
e.label && /* @__PURE__ */ y("text", {
|
|
1170
1242
|
x: e.vertical ? e.mid.x + 8 : e.mid.x,
|
|
1171
1243
|
y: e.mid.y,
|
|
1172
|
-
className: `${
|
|
1244
|
+
className: `${K.arrowLabel} ${E === fe(e.link) ? K.arrowLabelOpen : ""}`,
|
|
1173
1245
|
onClick: c ? (t) => {
|
|
1174
|
-
t.stopPropagation(),
|
|
1246
|
+
t.stopPropagation(), D(fe(e.link));
|
|
1175
1247
|
} : void 0,
|
|
1176
1248
|
textAnchor: e.vertical ? "start" : "middle",
|
|
1177
1249
|
dominantBaseline: "middle",
|
|
@@ -1181,34 +1253,34 @@ function le({ document: e, editing: c, actions: u }) {
|
|
|
1181
1253
|
}, e.key))]
|
|
1182
1254
|
}),
|
|
1183
1255
|
(() => {
|
|
1184
|
-
let e = c &&
|
|
1185
|
-
return e ? /* @__PURE__ */
|
|
1256
|
+
let e = c && xe.find((e) => fe(e.link) === E);
|
|
1257
|
+
return e ? /* @__PURE__ */ y(R, {
|
|
1186
1258
|
links: e.link.links,
|
|
1187
1259
|
x: e.mid.x,
|
|
1188
1260
|
y: e.mid.y,
|
|
1189
|
-
titleOf: (e) =>
|
|
1261
|
+
titleOf: (e) => J.get(e)?.block.title ?? e,
|
|
1190
1262
|
onUpdate: u.updateLink,
|
|
1191
1263
|
onRemove: u.removeLink,
|
|
1192
|
-
onClose:
|
|
1264
|
+
onClose: se
|
|
1193
1265
|
}) : null;
|
|
1194
1266
|
})()
|
|
1195
1267
|
]
|
|
1196
1268
|
})]
|
|
1197
1269
|
}),
|
|
1198
|
-
|
|
1199
|
-
block:
|
|
1270
|
+
he && /* @__PURE__ */ y(ue, {
|
|
1271
|
+
block: he,
|
|
1200
1272
|
editing: c,
|
|
1201
|
-
onChange: (e) => u.setDetails(
|
|
1202
|
-
onClose:
|
|
1273
|
+
onChange: (e) => u.setDetails(he.id, e),
|
|
1274
|
+
onClose: k
|
|
1203
1275
|
})
|
|
1204
1276
|
]
|
|
1205
1277
|
});
|
|
1206
1278
|
}
|
|
1207
|
-
var
|
|
1279
|
+
var me = { takeSix: "_takeSix_b98wp_4" }, J = {
|
|
1208
1280
|
title: "New block",
|
|
1209
1281
|
description: "Description"
|
|
1210
1282
|
};
|
|
1211
|
-
function
|
|
1283
|
+
function he({ document: e, onChange: t, editing: n = !1, theme: r = "auto", className: i }) {
|
|
1212
1284
|
let o = t !== void 0 && n, s = a(() => {
|
|
1213
1285
|
let n = (n) => {
|
|
1214
1286
|
n !== e && t?.(n);
|
|
@@ -1225,7 +1297,7 @@ function Z({ document: e, onChange: t, editing: n = !1, theme: r = "auto", class
|
|
|
1225
1297
|
n(ee(e, t));
|
|
1226
1298
|
},
|
|
1227
1299
|
add(t) {
|
|
1228
|
-
m(e, t) && n(d(e, t,
|
|
1300
|
+
m(e, t) && n(d(e, t, J).document);
|
|
1229
1301
|
},
|
|
1230
1302
|
setSize(t, r) {
|
|
1231
1303
|
n(v(e, t, { size: r === c ? void 0 : r }));
|
|
@@ -1273,14 +1345,14 @@ function Z({ document: e, onChange: t, editing: n = !1, theme: r = "auto", class
|
|
|
1273
1345
|
}
|
|
1274
1346
|
};
|
|
1275
1347
|
}, [e, t]);
|
|
1276
|
-
return /* @__PURE__ */
|
|
1277
|
-
className: `${
|
|
1348
|
+
return /* @__PURE__ */ y("div", {
|
|
1349
|
+
className: `${me.takeSix} ${i ?? ""}`,
|
|
1278
1350
|
"data-theme": r,
|
|
1279
|
-
children: /* @__PURE__ */
|
|
1351
|
+
children: /* @__PURE__ */ y(q, {
|
|
1280
1352
|
document: e,
|
|
1281
1353
|
editing: o,
|
|
1282
1354
|
actions: s
|
|
1283
1355
|
})
|
|
1284
1356
|
});
|
|
1285
1357
|
}
|
|
1286
|
-
export {
|
|
1358
|
+
export { he as TakeSix };
|