@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/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 y, jsx as b, jsxs as x } from "react/jsx-runtime";
3
+ import { Fragment as ne, jsx as y, jsxs as b } from "react/jsx-runtime";
4
4
  // src/icons.tsx
5
- function ne({ size: e = 20 }) {
6
- return /* @__PURE__ */ x("svg", {
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__ */ b("line", {
14
+ children: [/* @__PURE__ */ y("line", {
15
15
  x1: "12",
16
16
  y1: "5",
17
17
  x2: "12",
18
18
  y2: "19"
19
- }), /* @__PURE__ */ b("line", {
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 S() {
28
- return /* @__PURE__ */ x("svg", {
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__ */ b("line", {
36
+ children: [/* @__PURE__ */ y("line", {
37
37
  x1: "18",
38
38
  y1: "6",
39
39
  x2: "6",
40
40
  y2: "18"
41
- }), /* @__PURE__ */ b("line", {
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 C() {
50
- return /* @__PURE__ */ x("svg", {
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__ */ b("line", {
59
+ children: [/* @__PURE__ */ y("line", {
60
60
  x1: "5",
61
61
  y1: "12",
62
62
  x2: "19",
63
63
  y2: "12"
64
- }), /* @__PURE__ */ b("polyline", { points: "12 5 19 12 12 19" })]
64
+ }), /* @__PURE__ */ y("polyline", { points: "12 5 19 12 12 19" })]
65
65
  });
66
66
  }
67
- function re() {
68
- return /* @__PURE__ */ x("svg", {
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__ */ b("line", {
77
+ /* @__PURE__ */ y("line", {
78
78
  x1: "5",
79
79
  y1: "6",
80
80
  x2: "19",
81
81
  y2: "6"
82
82
  }),
83
- /* @__PURE__ */ b("line", {
83
+ /* @__PURE__ */ y("line", {
84
84
  x1: "5",
85
85
  y1: "12",
86
86
  x2: "19",
87
87
  y2: "12"
88
88
  }),
89
- /* @__PURE__ */ b("line", {
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 w = {
99
- card: "_card_21d5p_1",
100
- deleteBtn: "_deleteBtn_21d5p_13",
101
- sizeBtn: "_sizeBtn_21d5p_38",
102
- resizeHandle: "_resizeHandle_21d5p_63",
103
- cardResizing: "_cardResizing_21d5p_74",
104
- detailsBtn: "_detailsBtn_21d5p_82",
105
- cardEditing: "_cardEditing_21d5p_102",
106
- detailsBtnFilled: "_detailsBtnFilled_21d5p_106",
107
- connectBtn: "_connectBtn_21d5p_115",
108
- connectBtnActive: "_connectBtnActive_21d5p_140",
109
- cardConnectingSource: "_cardConnectingSource_21d5p_151",
110
- cardConnectable: "_cardConnectable_21d5p_156",
111
- cardConnected: "_cardConnected_21d5p_165",
112
- connectOverlay: "_connectOverlay_21d5p_171",
113
- cardUnlinkable: "_cardUnlinkable_21d5p_183",
114
- inside: "_inside_21d5p_189",
115
- selectOverlay: "_selectOverlay_21d5p_196",
116
- selectMark: "_selectMark_21d5p_201",
117
- cardSelected: "_cardSelected_21d5p_217",
118
- connectOverlayConnected: "_connectOverlayConnected_21d5p_227",
119
- header: "_header_21d5p_237",
120
- cardWithDetails: "_cardWithDetails_21d5p_241",
121
- addInside: "_addInside_21d5p_245",
122
- dragHandle: "_dragHandle_21d5p_257",
123
- cardDragged: "_cardDragged_21d5p_283",
124
- cardZoomable: "_cardZoomable_21d5p_293",
125
- title: "_title_21d5p_298",
126
- description: "_description_21d5p_299",
127
- icon: "_icon_21d5p_315",
128
- headerText: "_headerText_21d5p_322",
129
- cardWide: "_cardWide_21d5p_349",
130
- editable: "_editable_21d5p_365"
131
- }, T = {
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
- }, E = {
141
+ }, T = {
137
142
  S: "⅓",
138
143
  M: "½",
139
144
  L: "⅔",
140
145
  F: "1"
141
- }, D = {
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 O(e) {
148
- return u.reduce((t, n) => Math.abs(T[n] - e) < Math.abs(T[t] - e) ? n : t);
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 ie({ 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, onDragStartBlock: te, onDragOverBlock: y, onDragEndBlock: T, onShowDetails: ie, selectable: k, selected: A, onToggleSelect: j, onResize: M }) {
151
- let [N, P] = s(null), F = N ?? e.size ?? c, I = !!e.details?.trim(), ae = e.children?.length ?? 0, L = ae > 0, R = o(null), [z, B] = s(!1);
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 (!z) return;
154
- let e = () => B(!1);
158
+ if (!R) return;
159
+ let e = () => z(!1);
155
160
  return window.addEventListener("pointerup", e), () => window.removeEventListener("pointerup", e);
156
- }, [z]);
157
- let V = F === "F" ? "y" : "x", H = f === e.id, U = f !== null && f !== e.id && p, W = f !== null && f !== e.id && !p, G = o(_);
158
- G.current = _, n(() => (G.current(e.id, R.current), () => {
159
- G.current(e.id, null);
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 K() {
162
- let e = R.current.getBoundingClientRect();
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 oe(t) {
171
- if (!L || !R.current || t.target.closest("[data-text], [data-drag-handle], [data-resize-handle]")) return;
172
- let n = window.getSelection();
173
- n && !n.isCollapsed && R.current.contains(n.anchorNode) || d(e, K());
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 q = w.card;
176
- return L && !U && !k && (q += ` ${w.cardZoomable}`), A && (q += ` ${w.cardSelected}`), F === "F" && (q += ` ${w.cardWide}`), N && (q += ` ${w.cardResizing}`), t ? q += ` ${w.cardEditing}` : I && (q += ` ${w.cardWithDetails}`), ee && (q += ` ${w.cardDragged}`), H ? q += ` ${w.cardConnectingSource}` : U && m ? q += ` ${w.cardConnected}` : U ? q += ` ${w.cardConnectable}` : W && (q += ` ${w.cardUnlinkable}`), /* @__PURE__ */ x("div", {
177
- className: q,
178
- ref: R,
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": F,
187
+ "data-size": P,
181
188
  "data-drop": v ?? void 0,
182
- "data-axis": V,
183
- onClick: oe,
184
- draggable: t && z,
189
+ "data-axis": B,
190
+ onClick: ue,
191
+ draggable: t && R,
185
192
  onDragStart: (t) => {
186
- z ? (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", e.id), te(e.id)) : t.preventDefault();
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 = V === "y" ? r.top + r.height / 2 : r.left + r.width / 2;
191
- y(e.id, (V === "y" ? n.clientY : n.clientX) < i ? "before" : "after");
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
- B(!1), T();
201
+ z(!1), oe();
195
202
  },
196
203
  children: [
197
- t && /* @__PURE__ */ b("div", {
198
- className: w.resizeHandle,
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), P(e.size ?? c);
210
+ t.preventDefault(), t.stopPropagation(), t.currentTarget.setPointerCapture?.(t.pointerId), N(e.size ?? c);
204
211
  },
205
212
  onPointerMove: (e) => {
206
- if (!N || !R.current) return;
207
- let t = R.current.parentElement;
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 = O((e.clientX - R.current.getBoundingClientRect().left + n) / (r + n));
210
- i !== N && P(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
- N && N !== (e.size ?? c) && M(e.id, N), P(null);
220
+ M && M !== (e.size ?? c) && j(e.id, M), N(null);
214
221
  },
215
- onPointerCancel: () => P(null)
222
+ onPointerCancel: () => N(null)
216
223
  }),
217
- t && /* @__PURE__ */ b("div", {
218
- className: w.dragHandle,
224
+ t && /* @__PURE__ */ y("div", {
225
+ className: C.dragHandle,
219
226
  "data-drag-handle": !0,
220
- title: "Drag to reorder",
221
- "aria-hidden": "true",
222
- onPointerDown: () => B(!0)
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
- k && /* @__PURE__ */ b("button", {
225
- className: `${w.connectOverlay} ${w.selectOverlay}`,
238
+ O && /* @__PURE__ */ y("button", {
239
+ className: `${C.connectOverlay} ${C.selectOverlay}`,
226
240
  onClick: (t) => {
227
- t.stopPropagation(), j(e.id);
241
+ t.stopPropagation(), A(e.id);
228
242
  },
229
243
  "aria-label": `Select ${e.title}`,
230
- "aria-pressed": A,
231
- children: /* @__PURE__ */ b("span", {
232
- className: w.selectMark,
244
+ "aria-pressed": k,
245
+ children: /* @__PURE__ */ y("span", {
246
+ className: C.selectMark,
233
247
  "aria-hidden": "true",
234
- children: A ? "✓" : ""
248
+ children: k ? "✓" : ""
235
249
  })
236
250
  }),
237
- U && /* @__PURE__ */ b("button", {
238
- className: `${w.connectOverlay} ${m ? w.connectOverlayConnected : ""}`,
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 || I) && /* @__PURE__ */ b("button", {
245
- className: `${w.detailsBtn} ${I ? w.detailsBtnFilled : ""}`,
258
+ (t || F) && /* @__PURE__ */ y("button", {
259
+ className: `${C.detailsBtn} ${F ? C.detailsBtnFilled : ""}`,
246
260
  onClick: (t) => {
247
- t.stopPropagation(), ie(e.id);
261
+ t.stopPropagation(), ce(e.id);
248
262
  },
249
263
  "aria-label": `Details of ${e.title}`,
250
- title: I ? "Details" : "Add details",
251
- children: /* @__PURE__ */ b(re, {})
264
+ title: F ? "Details" : "Add details",
265
+ children: /* @__PURE__ */ y(ie, {})
252
266
  }),
253
- t && /* @__PURE__ */ b("button", {
254
- className: w.sizeBtn,
267
+ t && /* @__PURE__ */ y("button", {
268
+ className: C.sizeBtn,
255
269
  onClick: (t) => {
256
- t.stopPropagation(), M(e.id, u[(u.indexOf(F) + 1) % u.length]);
270
+ t.stopPropagation(), j(e.id, u[(u.indexOf(P) + 1) % u.length]);
257
271
  },
258
- "aria-label": `Size of ${e.title}: ${D[F]}`,
272
+ "aria-label": `Size of ${e.title}: ${E[P]}`,
259
273
  title: "Size: click to change, or drag the right edge",
260
- children: E[F]
274
+ children: T[P]
261
275
  }),
262
- t && /* @__PURE__ */ b("button", {
263
- className: w.deleteBtn,
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__ */ b(S, {})
282
+ children: /* @__PURE__ */ y(x, {})
269
283
  }),
270
- t && /* @__PURE__ */ b("button", {
271
- className: `${w.connectBtn} ${H ? w.connectBtnActive : ""}`,
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": H ? "Cancel connection" : `Connect from ${e.title}`,
276
- title: H ? "Cancel" : "Connect to another block",
277
- children: /* @__PURE__ */ b(C, {})
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__ */ x("div", {
280
- className: w.header,
281
- children: [e.icon && /* @__PURE__ */ b("span", {
282
- className: w.icon,
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__ */ x("div", {
285
- className: w.headerText,
286
- children: [/* @__PURE__ */ b("h2", {
287
- className: `${w.title} ${t ? w.editable : ""}`,
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__ */ b("p", {
297
- className: `${w.description} ${t ? w.editable : ""}`,
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
- L && /* @__PURE__ */ x("button", {
308
- className: w.inside,
321
+ I && /* @__PURE__ */ b("button", {
322
+ className: C.inside,
309
323
  "aria-label": `Zoom into ${e.title}`,
310
- children: [ae, " more inside"]
324
+ children: [le, " more inside"]
311
325
  }),
312
- !L && t && /* @__PURE__ */ x("button", {
313
- className: `${w.inside} ${w.addInside}`,
326
+ !I && t && /* @__PURE__ */ b("button", {
327
+ className: `${C.inside} ${C.addInside}`,
314
328
  onClick: (t) => {
315
- t.stopPropagation(), R.current && l(e, K());
329
+ t.stopPropagation(), L.current && l(e, G());
316
330
  },
317
331
  "aria-label": `Add child to ${e.title}`,
318
- children: [/* @__PURE__ */ b(ne, { size: 11 }), " add inside"]
332
+ children: [/* @__PURE__ */ y(re, { size: 11 }), " add inside"]
319
333
  })
320
334
  ]
321
335
  });
322
336
  }
323
337
  // src/geometry.ts
324
- var k = 2;
325
- function A(e, t, n, r) {
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 j(e, t, n) {
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 M(e, t, n) {
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 N(e, t, n) {
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 P(e, t, n, r, i) {
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 + M(n, r, e.height)
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 + M(n, r, e.height)
397
+ y: o - i.y + k(n, r, e.height)
384
398
  };
385
399
  case "bottom": return {
386
- x: a - i.x + M(n, r, e.width),
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 + M(n, r, e.width),
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 F(e, t, n, r, i, a, o) {
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 I(e, t, n, r) {
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 ae(e, t, n) {
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
- ...N(a, o, s)
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 = P(e.fromRect, e.exitEdge, o, n.length, r), l = P(e.toRect, e.entryEdge, s, i.length, r), u = e.headAtStart ? 14 : 0, d = e.headAtEnd ? 14 : 0, f = A(e.exitEdge, e.entryEdge, c, l);
459
- if (f !== null && u + d > f - k) {
460
- let e = Math.max(0, f - k) / (u + d);
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 = j(c, e.exitEdge, u), m = j(l, e.entryEdge, d), [h, g] = F(e.fromRect, e.toRect, r, e.exitEdge, e.entryEdge, p, m);
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: I(p, h, g, m),
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
- var L = {
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
- }, R = [
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 z({ links: e, x: t, y: r, titleOf: i, onUpdate: a, onRemove: s, onClose: c }) {
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__ */ x("div", {
540
+ }, [c]), /* @__PURE__ */ b("div", {
514
541
  ref: l,
515
- className: L.popover,
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__ */ b("button", {
524
- className: L.close,
550
+ children: [/* @__PURE__ */ y("button", {
551
+ className: I.close,
525
552
  onClick: c,
526
553
  "aria-label": "Close",
527
- children: /* @__PURE__ */ b(S, {})
528
- }), e.map((e, t) => /* @__PURE__ */ b(B, {
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 B({ link: e, titleOf: t, onUpdate: r, onRemove: i }) {
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__ */ x("div", {
545
- className: L.row,
571
+ return /* @__PURE__ */ b("div", {
572
+ className: I.row,
546
573
  children: [
547
- /* @__PURE__ */ x("div", {
548
- className: L.ends,
574
+ /* @__PURE__ */ b("div", {
575
+ className: I.ends,
549
576
  children: [
550
577
  t(e.from),
551
578
  " ",
552
- /* @__PURE__ */ b("span", {
553
- className: L.endsArrow,
554
- children: R.find((e) => e.value === c).symbol
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__ */ b("input", {
561
- className: L.label,
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__ */ x("div", {
572
- className: L.actions,
598
+ /* @__PURE__ */ b("div", {
599
+ className: I.actions,
573
600
  children: [
574
- /* @__PURE__ */ b("div", {
575
- className: L.directions,
601
+ /* @__PURE__ */ y("div", {
602
+ className: I.directions,
576
603
  role: "group",
577
604
  "aria-label": "Direction",
578
- children: R.map((e) => /* @__PURE__ */ b("button", {
579
- className: `${L.btn} ${c === e.value ? L.btnActive : ""}`,
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__ */ b("button", {
588
- className: L.btn,
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__ */ b("button", {
599
- className: `${L.btn} ${L.danger}`,
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 V = /^(https?:\/\/|mailto:)/i;
612
- function H(e) {
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 U = /`([^`]+)`|\*\*([^*]+)\*\*|\*([^*]+)\*|\[([^\]]+)\]\(([^)\s]+)\)|\n/g;
659
- function W(t) {
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(U)) {
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__ */ b("br", {}, i++)) : n.push(V.test(d) ? /* @__PURE__ */ b("a", {
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: W(u)
669
- }, i++) : /* @__PURE__ */ b(e, { children: W(u) }, i++)) : n.push(/* @__PURE__ */ b("em", { children: W(l) }, i++)) : n.push(/* @__PURE__ */ b("strong", { children: W(c) }, i++)) : n.push(/* @__PURE__ */ b("code", { children: s }, i++)), r = a.index + o.length;
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 G({ source: e, className: t }) {
674
- return /* @__PURE__ */ b("div", {
700
+ function W({ source: e, className: t }) {
701
+ return /* @__PURE__ */ y("div", {
675
702
  className: t,
676
- children: H(e).map((e, t) => {
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__ */ b(n, { children: W(e.text) }, t);
711
+ return /* @__PURE__ */ y(n, { children: U(e.text) }, t);
685
712
  }
686
- case "paragraph": return /* @__PURE__ */ b("p", { children: W(e.text) }, t);
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__ */ b(n, { children: e.items.map((e, t) => /* @__PURE__ */ b("li", { children: W(e) }, t)) }, t);
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__ */ b("pre", { children: /* @__PURE__ */ b("code", { children: e.text }) }, t);
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 K = {
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 oe({ block: e, editing: t, onChange: r, onClose: i }) {
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__ */ x("aside", {
721
- className: K.panel,
747
+ return /* @__PURE__ */ b("aside", {
748
+ className: G.panel,
722
749
  "aria-label": `Details: ${e.title}`,
723
750
  children: [
724
- /* @__PURE__ */ b("button", {
725
- className: K.close,
751
+ /* @__PURE__ */ y("button", {
752
+ className: G.close,
726
753
  onClick: i,
727
754
  "aria-label": "Close details",
728
- children: /* @__PURE__ */ b(S, {})
755
+ children: /* @__PURE__ */ y(x, {})
729
756
  }),
730
- /* @__PURE__ */ x("div", {
731
- className: K.head,
732
- children: [e.icon && /* @__PURE__ */ b("span", {
733
- className: K.icon,
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__ */ x("div", { children: [/* @__PURE__ */ b("h2", {
736
- className: K.title,
762
+ }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("h2", {
763
+ className: G.title,
737
764
  children: e.title
738
- }), e.description && /* @__PURE__ */ b("p", {
739
- className: K.description,
765
+ }), e.description && /* @__PURE__ */ y("p", {
766
+ className: G.description,
740
767
  children: e.description
741
768
  })] })]
742
769
  }),
743
- t ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("textarea", {
744
- className: K.editor,
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__ */ b(G, {
777
+ }), a.trim() && /* @__PURE__ */ y(W, {
751
778
  source: a,
752
- className: K.body
753
- })] }) : e.details?.trim() ? /* @__PURE__ */ b(G, {
779
+ className: G.body
780
+ })] }) : e.details?.trim() ? /* @__PURE__ */ y(W, {
754
781
  source: e.details,
755
- className: K.body
756
- }) : /* @__PURE__ */ b("p", {
757
- className: K.empty,
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 q = {
764
- viewer: "_viewer_1knu3_1",
765
- breadcrumb: "_breadcrumb_1knu3_10",
766
- crumbItem: "_crumbItem_1knu3_20",
767
- crumbSep: "_crumbSep_1knu3_26",
768
- crumb: "_crumb_1knu3_20",
769
- crumbActive: "_crumbActive_1knu3_51",
770
- backdrop: "_backdrop_1knu3_54",
771
- slide: "_slide_1knu3_62",
772
- slideCard: "_slideCard_1knu3_73",
773
- slideHeader: "_slideHeader_1knu3_83",
774
- headerDetailsBtn: "_headerDetailsBtn_1knu3_91",
775
- slideHeaderTop: "_slideHeaderTop_1knu3_112",
776
- slideIcon: "_slideIcon_1knu3_116",
777
- slideHeaderText: "_slideHeaderText_1knu3_123",
778
- slideTitle: "_slideTitle_1knu3_128",
779
- slideDescription: "_slideDescription_1knu3_136",
780
- gridArea: "_gridArea_1knu3_144",
781
- arrowSvg: "_arrowSvg_1knu3_153",
782
- arrow: "_arrow_1knu3_153",
783
- arrowSvgEditing: "_arrowSvgEditing_1knu3_171",
784
- arrowHit: "_arrowHit_1knu3_171",
785
- arrowLabel: "_arrowLabel_1knu3_184",
786
- arrowLabelOpen: "_arrowLabelOpen_1knu3_189",
787
- arrowIndirect: "_arrowIndirect_1knu3_193",
788
- arrowHead: "_arrowHead_1knu3_197",
789
- empty: "_empty_1knu3_211",
790
- gridAreaNested: "_gridAreaNested_1knu3_218",
791
- grid: "_grid_1knu3_144",
792
- levelTools: "_levelTools_1knu3_243",
793
- groupBtn: "_groupBtn_1knu3_249",
794
- groupBtnActive: "_groupBtnActive_1knu3_266",
795
- fullHint: "_fullHint_1knu3_273",
796
- addBlock: "_addBlock_1knu3_280",
797
- linkBar: "_linkBar_1knu3_301",
798
- linkBarCancel: "_linkBarCancel_1knu3_319"
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 se(e) {
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 J(e) {
833
+ function fe(e) {
806
834
  return [e.from, e.to].sort().join("|");
807
835
  }
808
- function ce(e) {
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 le({ document: e, editing: c, actions: u }) {
819
- let d = o(null), f = o(null), m = o(!1), g = o(!1), _ = o(/* @__PURE__ */ new Map()), ee = o(null), v = r(), [y, S] = s(null), [C, w] = s(null), [T, E] = s(null), [D, O] = s(null), k = t(() => O(null), []), [A, j] = s(null), M = t(() => j(null), []), [N, P] = s(null), [F, I] = s([]), [L, R] = s([]), [B, V] = s(0), [H, U] = s(0), [W, G] = s(0), K = a(() => p(e), [e]), le = A ? K.get(A)?.block : void 0, Y = a(() => {
820
- let e = L.findIndex((e) => !K.has(e.id));
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, K]);
850
+ }, [L, J]);
823
851
  n(() => {
824
- Y !== L && R(Y);
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 : K.get(X)?.block, Q = a(() => h(e, X, K).slice(0, l), [
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
- K
830
- ]), $ = a(() => te(e, X, K), [
857
+ J
858
+ ]), $ = a(() => te(e, X, J), [
831
859
  e,
832
860
  X,
833
- K
834
- ]), ue = X !== null, de = c && Q.length < l;
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), O(null), E(null));
854
- }, [c]), n(() => E(null), [X]), n(() => {
855
- D && !$.some((e) => J(e) === D) && O(null);
856
- }, [$, D]), n(() => {
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), E(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, ce(n.getBoundingClientRect()));
871
- I(ae($.map((e) => ({
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, ce(e.getBoundingClientRect())));
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 fe = o(null);
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
- fe.current = t, t.observe(e);
945
+ ye.current = t, t.observe(e);
899
946
  for (let e of _.current.values()) t.observe(e);
900
947
  return () => {
901
- t.disconnect(), fe.current = null;
948
+ t.disconnect(), ye.current = null;
902
949
  };
903
950
  }, []);
904
- let pe = t((e, t) => {
951
+ let be = t((e, t) => {
905
952
  let n = _.current.get(e);
906
- n && fe.current?.unobserve(n), t ? (_.current.set(e, t), fe.current?.observe(t)) : _.current.delete(e);
907
- }, []), me = a(() => {
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: se(n)
961
+ label: de(n)
915
962
  }] : [];
916
963
  });
917
- }, [F, $]), he = t((e) => {
918
- if (!y || e === y) return !1;
919
- let t = K.get(y), n = K.get(e);
920
- return !t || !n ? !1 : !t.path.includes(e) && !n.path.includes(y);
921
- }, [y, K]), ge = y ? K.get(y)?.block : void 0, _e = a(() => y ? new Set((e.links ?? []).filter((e) => e.from === y).map((e) => e.to)) : /* @__PURE__ */ new Set(), [e.links, y]);
922
- function ve(e, t) {
923
- f.current = t, R((n) => [...n, {
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 ye(e, t) {
929
- u.add(e.id), ve(e, t);
975
+ function Ee(e, t) {
976
+ u.add(e.id), Te(e, t);
930
977
  }
931
- function be(e) {
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, R((t) => t.slice(0, e)), V((e) => e + 1);
984
+ g.current = !1, m.current = !0, z((t) => t.slice(0, e)), V((e) => e + 1);
938
985
  }, 370);
939
- } else R((t) => t.slice(0, e)), V((e) => e + 1);
986
+ } else z((t) => t.slice(0, e)), V((e) => e + 1);
940
987
  }
941
- function xe() {
942
- w(null), P(null);
988
+ function Oe() {
989
+ ae(null), j(null), N(null);
943
990
  }
944
- function Se() {
945
- if (C && N && N.id !== C) {
946
- let e = Q.map((e) => e.id).filter((e) => e !== C).indexOf(N.id) + +(N.position === "after");
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
- xe();
997
+ Oe();
950
998
  }
951
- let Ce = c ? {
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(), Se();
1023
+ e.preventDefault(), ke();
957
1024
  }
958
1025
  } : {};
959
- function we(e) {
960
- y && (u.toggleLink(y, e), S(null));
1026
+ function Ie(e) {
1027
+ x && (u.toggleLink(x, e), S(null));
961
1028
  }
962
- let Te = [{ label: e.title }, ...Y.map((e) => ({ label: K.get(e.id)?.block.title ?? "" }))], Ee = (e) => /* @__PURE__ */ b(ie, {
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: ye,
969
- onDrillIn: ve,
970
- connectingFrom: y,
971
- canLinkTo: he(e.id),
972
- isConnected: _e.has(e.id),
973
- onStartConnect: (e) => S(e === y ? null : e),
974
- onConnectTarget: we,
975
- onRegisterEl: pe,
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 && N?.id === e.id && N.id !== C ? N.position : null,
978
- onDragStartBlock: w,
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 && (N?.id !== e || N.position !== t) && P({
1048
+ C && (A?.id !== e || A.position !== t) && j({
981
1049
  id: e,
982
1050
  position: t
983
1051
  });
984
1052
  },
985
- onDragEndBlock: xe,
986
- onShowDetails: j,
987
- selectable: T !== null,
988
- selected: T?.includes(e.id) ?? !1,
989
- onToggleSelect: (e) => E((t) => t && (t.includes(e) ? t.filter((t) => t !== e) : [...t, e])),
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), De = () => /* @__PURE__ */ b("button", {
992
- className: q.addBlock,
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__ */ b(ne, {})
1064
+ children: /* @__PURE__ */ y(re, {})
996
1065
  });
997
- return /* @__PURE__ */ x("div", {
998
- className: q.viewer,
1066
+ return /* @__PURE__ */ b("div", {
1067
+ className: K.viewer,
999
1068
  children: [
1000
- ue && /* @__PURE__ */ b("nav", {
1001
- className: q.breadcrumb,
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 || be(Y.length - 1);
1073
+ e.target.closest("button") || g.current || De(Y.length - 1);
1005
1074
  },
1006
- children: Te.map((e, t) => /* @__PURE__ */ x("span", {
1007
- className: q.crumbItem,
1008
- children: [t > 0 && /* @__PURE__ */ b("span", {
1009
- className: q.crumbSep,
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__ */ b("button", {
1012
- className: `${q.crumb} ${t === Te.length - 1 ? q.crumbActive : ""}`,
1013
- onClick: () => be(t),
1014
- disabled: t === Te.length - 1,
1015
- "aria-current": t === Te.length - 1 ? "location" : void 0,
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
- T && /* @__PURE__ */ x("div", {
1021
- className: q.linkBar,
1090
+ w && /* @__PURE__ */ b("div", {
1091
+ className: K.linkBar,
1022
1092
  role: "status",
1023
1093
  children: [
1024
- /* @__PURE__ */ x("span", { children: [
1094
+ /* @__PURE__ */ b("span", { children: [
1025
1095
  "Select blocks to group: ",
1026
- /* @__PURE__ */ b("strong", { children: T.length }),
1096
+ /* @__PURE__ */ y("strong", { children: w.length }),
1027
1097
  " selected"
1028
1098
  ] }),
1029
- /* @__PURE__ */ b("button", {
1030
- className: q.linkBarCancel,
1031
- disabled: T.length < 2,
1099
+ /* @__PURE__ */ y("button", {
1100
+ className: K.linkBarCancel,
1101
+ disabled: w.length < 2,
1032
1102
  onClick: () => {
1033
- u.group(T), E(null);
1103
+ u.group(w), T(null);
1034
1104
  },
1035
1105
  children: "Group"
1036
1106
  }),
1037
- /* @__PURE__ */ b("button", {
1038
- className: q.linkBarCancel,
1039
- onClick: () => E(null),
1107
+ /* @__PURE__ */ y("button", {
1108
+ className: K.linkBarCancel,
1109
+ onClick: () => T(null),
1040
1110
  children: "Cancel"
1041
1111
  })
1042
1112
  ]
1043
1113
  }),
1044
- ge && /* @__PURE__ */ x("div", {
1045
- className: q.linkBar,
1114
+ Ce && /* @__PURE__ */ b("div", {
1115
+ className: K.linkBar,
1046
1116
  role: "status",
1047
- children: [/* @__PURE__ */ x("span", { children: [
1117
+ children: [/* @__PURE__ */ b("span", { children: [
1048
1118
  "Linking from ",
1049
- /* @__PURE__ */ b("strong", { children: ge.title }),
1119
+ /* @__PURE__ */ y("strong", { children: Ce.title }),
1050
1120
  ": click a block on any level"
1051
- ] }), /* @__PURE__ */ b("button", {
1052
- className: q.linkBarCancel,
1121
+ ] }), /* @__PURE__ */ y("button", {
1122
+ className: K.linkBarCancel,
1053
1123
  onClick: () => S(null),
1054
1124
  children: "Cancel"
1055
1125
  })]
1056
1126
  }),
1057
- ue && /* @__PURE__ */ b("div", {
1058
- className: q.backdrop,
1127
+ ge && /* @__PURE__ */ y("div", {
1128
+ className: K.backdrop,
1059
1129
  onClick: () => {
1060
- g.current || be(Y.length - 1);
1130
+ g.current || De(Y.length - 1);
1061
1131
  },
1062
1132
  "aria-hidden": "true"
1063
1133
  }),
1064
- /* @__PURE__ */ x("div", {
1134
+ /* @__PURE__ */ b("div", {
1065
1135
  ref: d,
1066
- className: `${q.slide} ${ue ? q.slideCard : ""}`,
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__ */ x("div", {
1074
- className: `${q.slideHeader} ${Z ? "" : q.slideHeaderTop}`,
1143
+ return /* @__PURE__ */ b("div", {
1144
+ className: `${K.slideHeader} ${Z ? "" : K.slideHeaderTop}`,
1075
1145
  children: [
1076
- t.icon && /* @__PURE__ */ b("span", {
1077
- className: q.slideIcon,
1146
+ t.icon && /* @__PURE__ */ y("span", {
1147
+ className: K.slideIcon,
1078
1148
  children: t.icon
1079
1149
  }),
1080
- /* @__PURE__ */ x("div", {
1081
- className: q.slideHeaderText,
1082
- children: [/* @__PURE__ */ b("h1", {
1083
- className: q.slideTitle,
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__ */ b("p", {
1086
- className: q.slideDescription,
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__ */ x("button", {
1091
- className: q.headerDetailsBtn,
1092
- onClick: () => j(Z.id),
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__ */ b(re, {}),
1165
+ /* @__PURE__ */ y(ie, {}),
1096
1166
  " ",
1097
1167
  Z.details?.trim() ? "Details" : "Add details"
1098
1168
  ]
1099
1169
  })
1100
1170
  ]
1101
1171
  });
1102
- })(), /* @__PURE__ */ x("div", {
1172
+ })(), /* @__PURE__ */ b("div", {
1103
1173
  ref: ee,
1104
- className: `${q.gridArea} ${ue ? q.gridAreaNested : ""}`,
1174
+ className: `${K.gridArea} ${ge ? K.gridAreaNested : ""}`,
1105
1175
  children: [
1106
- c && Q.length >= 2 && /* @__PURE__ */ x("div", {
1107
- className: q.levelTools,
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__ */ b("button", {
1111
- className: `${q.groupBtn} ${T ? q.groupBtnActive : ""}`,
1180
+ children: [/* @__PURE__ */ y("button", {
1181
+ className: `${K.groupBtn} ${w ? K.groupBtnActive : ""}`,
1112
1182
  onClick: () => {
1113
- S(null), E((e) => e ? null : []);
1183
+ S(null), T((e) => e ? null : []);
1114
1184
  },
1115
- "aria-pressed": T !== null,
1185
+ "aria-pressed": w !== null,
1116
1186
  children: "Group blocks"
1117
- }), Q.length >= l && !T && /* @__PURE__ */ x("span", {
1118
- className: q.fullHint,
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__ */ x("div", {
1128
- className: q.grid,
1129
- ...Ce,
1130
- children: [Q.map((e) => Ee(e)), de && De()]
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__ */ b("p", {
1133
- className: q.empty,
1204
+ Q.length === 0 && !c && /* @__PURE__ */ y("p", {
1205
+ className: K.empty,
1134
1206
  children: "Nothing here yet"
1135
1207
  }),
1136
- me.length > 0 && /* @__PURE__ */ x("svg", {
1137
- className: `${q.arrowSvg} ${c ? q.arrowSvgEditing : ""}`,
1208
+ xe.length > 0 && /* @__PURE__ */ b("svg", {
1209
+ className: `${K.arrowSvg} ${c ? K.arrowSvgEditing : ""}`,
1138
1210
  "aria-hidden": !c || void 0,
1139
- children: [/* @__PURE__ */ b("defs", { children: /* @__PURE__ */ b("marker", {
1140
- id: v,
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__ */ b("path", {
1219
+ children: /* @__PURE__ */ y("path", {
1148
1220
  d: "M 0 0 L 10 4 L 0 8 Z",
1149
- className: q.arrowHead
1221
+ className: K.arrowHead
1150
1222
  })
1151
- }) }), me.map((e) => /* @__PURE__ */ x("g", {
1223
+ }) }), xe.map((e) => /* @__PURE__ */ b("g", {
1152
1224
  "data-link": e.key,
1153
1225
  children: [
1154
- c && /* @__PURE__ */ b("path", {
1226
+ c && /* @__PURE__ */ y("path", {
1155
1227
  d: e.d,
1156
- className: q.arrowHit,
1228
+ className: K.arrowHit,
1157
1229
  role: "button",
1158
- "aria-label": `Edit link ${K.get(e.link.from)?.block.title ?? e.link.from} – ${K.get(e.link.to)?.block.title ?? e.link.to}`,
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(), O(J(e.link));
1232
+ t.stopPropagation(), D(fe(e.link));
1161
1233
  }
1162
1234
  }),
1163
- /* @__PURE__ */ b("path", {
1235
+ /* @__PURE__ */ y("path", {
1164
1236
  d: e.d,
1165
- className: `${q.arrow} ${e.link.direct ? "" : q.arrowIndirect}`,
1166
- markerEnd: e.link.direction === "none" ? void 0 : `url(#${v})`,
1167
- markerStart: e.link.direction === "both" ? `url(#${v})` : void 0
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__ */ b("text", {
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: `${q.arrowLabel} ${D === J(e.link) ? q.arrowLabelOpen : ""}`,
1244
+ className: `${K.arrowLabel} ${E === fe(e.link) ? K.arrowLabelOpen : ""}`,
1173
1245
  onClick: c ? (t) => {
1174
- t.stopPropagation(), O(J(e.link));
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 && me.find((e) => J(e.link) === D);
1185
- return e ? /* @__PURE__ */ b(z, {
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) => K.get(e)?.block.title ?? e,
1261
+ titleOf: (e) => J.get(e)?.block.title ?? e,
1190
1262
  onUpdate: u.updateLink,
1191
1263
  onRemove: u.removeLink,
1192
- onClose: k
1264
+ onClose: se
1193
1265
  }) : null;
1194
1266
  })()
1195
1267
  ]
1196
1268
  })]
1197
1269
  }),
1198
- le && /* @__PURE__ */ b(oe, {
1199
- block: le,
1270
+ he && /* @__PURE__ */ y(ue, {
1271
+ block: he,
1200
1272
  editing: c,
1201
- onChange: (e) => u.setDetails(le.id, e),
1202
- onClose: M
1273
+ onChange: (e) => u.setDetails(he.id, e),
1274
+ onClose: k
1203
1275
  })
1204
1276
  ]
1205
1277
  });
1206
1278
  }
1207
- var Y = { takeSix: "_takeSix_b98wp_4" }, X = {
1279
+ var me = { takeSix: "_takeSix_b98wp_4" }, J = {
1208
1280
  title: "New block",
1209
1281
  description: "Description"
1210
1282
  };
1211
- function Z({ document: e, onChange: t, editing: n = !1, theme: r = "auto", className: i }) {
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, X).document);
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__ */ b("div", {
1277
- className: `${Y.takeSix} ${i ?? ""}`,
1348
+ return /* @__PURE__ */ y("div", {
1349
+ className: `${me.takeSix} ${i ?? ""}`,
1278
1350
  "data-theme": r,
1279
- children: /* @__PURE__ */ b(le, {
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 { Z as TakeSix };
1358
+ export { he as TakeSix };