dishui 0.0.105 → 0.0.106
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/.release-verified.json +2 -2
- package/dist/components/ChoicePicker/index.js +8 -6
- package/dist/components/ChoicePicker/index.js.map +1 -1
- package/dist/components/Column/index.d.ts +3 -2
- package/dist/components/Column/index.js +5 -17
- package/dist/components/Column/index.js.map +1 -1
- package/dist/components/ConfirmDialog/index.d.ts +20 -0
- package/dist/components/ConfirmDialog/index.js +84 -0
- package/dist/components/ConfirmDialog/index.js.map +1 -0
- package/dist/components/DateTimeInput/index.js +28 -26
- package/dist/components/DateTimeInput/index.js.map +1 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/MultipleChoice/index.js +2 -1
- package/dist/components/MultipleChoice/index.js.map +1 -1
- package/dist/components/Row/index.d.ts +3 -2
- package/dist/components/Row/index.js +5 -17
- package/dist/components/Row/index.js.map +1 -1
- package/dist/components/Tab/index.js +80 -0
- package/dist/components/Tab/index.js.map +1 -0
- package/dist/components/Tabs/index.js +28 -33
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/tabNavigation.d.ts +2 -0
- package/dist/components/Tabs/tabNavigation.js +14 -0
- package/dist/components/Tabs/tabNavigation.js.map +1 -0
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.d.ts +1 -1
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js +25 -26
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js.map +1 -1
- package/dist/components/pro/FileExplorer/Breadcrumb.js +8 -11
- package/dist/components/pro/FileExplorer/Breadcrumb.js.map +1 -1
- package/dist/components/pro/Flow/Flow.js +184 -182
- package/dist/components/pro/Flow/Flow.js.map +1 -1
- package/dist/components/pro/Flow/archify/convert.js +26 -26
- package/dist/components/pro/Flow/archify/convert.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLayoutActions.js +13 -11
- package/dist/components/pro/Flow/hooks/useLayoutActions.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js +73 -83
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.d.ts +2 -0
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js +73 -49
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.d.ts +1 -0
- package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js +12 -14
- package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js +113 -113
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js.map +1 -1
- package/dist/css.d.ts +1 -0
- package/dist/dishui.css +1 -1
- package/dist/index-nostyled.d.ts +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +113 -111
- package/dist/layouts/Sidebar.js +201 -107
- package/dist/layouts/Sidebar.js.map +1 -1
- package/dist/utils/flexLayout.d.ts +5 -0
- package/dist/utils/flexLayout.js +19 -0
- package/dist/utils/flexLayout.js.map +1 -0
- package/package.json +63 -57
|
@@ -19,19 +19,19 @@ import { MediaOverlay as T } from "./nodes/MediaOverlay.js";
|
|
|
19
19
|
import E from "./panels/FlowPanelGroup.js";
|
|
20
20
|
import D from "./panels/Breadcrumb.js";
|
|
21
21
|
import O from "./panels/ContextMenu.js";
|
|
22
|
-
import { MiniMapRenderer as
|
|
23
|
-
import { useUndoRedo as
|
|
24
|
-
import { useClipboard as
|
|
25
|
-
import { useCompactMode as
|
|
26
|
-
import { usePdfExport as
|
|
27
|
-
import { useKeyboardShortcuts as
|
|
28
|
-
import { useMindMap as
|
|
22
|
+
import { MiniMapRenderer as ee } from "./canvas/MiniMapRenderer.js";
|
|
23
|
+
import { useUndoRedo as te } from "./hooks/useUndoRedo.js";
|
|
24
|
+
import { useClipboard as k } from "./hooks/useClipboard.js";
|
|
25
|
+
import { useCompactMode as ne } from "./hooks/useCompactMode.js";
|
|
26
|
+
import { usePdfExport as A } from "./hooks/usePdfExport.js";
|
|
27
|
+
import { useKeyboardShortcuts as j } from "./hooks/useKeyboardShortcuts.js";
|
|
28
|
+
import { useMindMap as M } from "./hooks/useMindMap.js";
|
|
29
29
|
/* empty css */
|
|
30
|
-
import { forwardRef as
|
|
31
|
-
import { jsx as
|
|
32
|
-
import { EditorView as
|
|
30
|
+
import { forwardRef as N, useCallback as P, useEffect as F, useImperativeHandle as re, useMemo as I, useRef as L, useState as R } from "react";
|
|
31
|
+
import { jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
32
|
+
import { EditorView as V } from "@codemirror/view";
|
|
33
33
|
//#region src/components/pro/Flow/Flow.tsx
|
|
34
|
-
function
|
|
34
|
+
function ie(e) {
|
|
35
35
|
let t = !1, n = { ...e.canvases };
|
|
36
36
|
for (let [e, r] of Object.entries(n)) {
|
|
37
37
|
let i = r.nodes.map((e) => {
|
|
@@ -79,19 +79,19 @@ function re(e) {
|
|
|
79
79
|
canvases: n
|
|
80
80
|
} : e;
|
|
81
81
|
}
|
|
82
|
-
var
|
|
82
|
+
var ae = {
|
|
83
83
|
nodeIds: /* @__PURE__ */ new Set(),
|
|
84
84
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
85
85
|
lineIds: /* @__PURE__ */ new Set()
|
|
86
86
|
};
|
|
87
|
-
function
|
|
88
|
-
let { selection: s, setSelection: l, currentCanvas: d, setDoc: p, currentCanvasId: m } = o(), { viewport: h } = c(), { copy: g, cut: _, paste: v, duplicate: y } =
|
|
87
|
+
function oe({ onUndo: e, onRedo: t, groupRef: r, geoGroupRef: i, ungroupRef: a }) {
|
|
88
|
+
let { selection: s, setSelection: l, currentCanvas: d, setDoc: p, currentCanvasId: m } = o(), { viewport: h } = c(), { copy: g, cut: _, paste: v, duplicate: y } = k(), b = f(), x = P(() => {
|
|
89
89
|
l({
|
|
90
90
|
nodeIds: new Set(d.nodes.map((e) => e.id)),
|
|
91
91
|
edgeIds: new Set(d.edges.map((e) => e.id)),
|
|
92
92
|
lineIds: new Set(d.lines.map((e) => e.id))
|
|
93
93
|
});
|
|
94
|
-
}, [d, l]), S =
|
|
94
|
+
}, [d, l]), S = P((e) => {
|
|
95
95
|
let t = s.nodeIds, r = s.lineIds;
|
|
96
96
|
if (t.size + r.size < 2) return;
|
|
97
97
|
let i = d.nodes.filter((e) => t.has(e.id)), a = d.lines.filter((e) => r.has(e.id)), o = Infinity, c = Infinity, f = -Infinity, h = -Infinity;
|
|
@@ -146,7 +146,7 @@ function ae({ onUndo: e, onRedo: t, groupRef: r, geoGroupRef: i, ungroupRef: a }
|
|
|
146
146
|
p,
|
|
147
147
|
m,
|
|
148
148
|
l
|
|
149
|
-
]), C =
|
|
149
|
+
]), C = P(() => S("flowGroup"), [S]), w = P(() => S("geometryGroup"), [S]), T = P(() => {
|
|
150
150
|
let e = s.nodeIds;
|
|
151
151
|
if (e.size === 0) return;
|
|
152
152
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
@@ -187,25 +187,27 @@ function ae({ onUndo: e, onRedo: t, groupRef: r, geoGroupRef: i, ungroupRef: a }
|
|
|
187
187
|
l
|
|
188
188
|
]);
|
|
189
189
|
r.current = C, i.current = w, a.current = T;
|
|
190
|
-
let E =
|
|
190
|
+
let E = P((e) => {
|
|
191
191
|
let t = s.nodeIds, n = s.lineIds;
|
|
192
|
-
(t.size
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
let
|
|
192
|
+
if (t.size === 0 && n.size === 0) return;
|
|
193
|
+
let r = (t, n, r) => e === "front" ? n + 1 : e === "back" ? r - 1 : e === "up" ? t + 1 : t - 1;
|
|
194
|
+
p((e) => {
|
|
195
|
+
let i = e.canvases[m];
|
|
196
|
+
if (!i) return e;
|
|
197
|
+
let a = i.nodes.map((e) => e.zIndex ?? 0), o = a.length > 0 ? Math.max(...a) : 0, s = a.length > 0 ? Math.min(...a) : 0, c = i.lines.map((e) => e.zIndex ?? 0), l = c.length > 0 ? Math.max(...c) : 0, u = c.length > 0 ? Math.min(...c) : 0;
|
|
196
198
|
return {
|
|
197
|
-
...
|
|
199
|
+
...e,
|
|
198
200
|
canvases: {
|
|
199
|
-
...
|
|
201
|
+
...e.canvases,
|
|
200
202
|
[m]: {
|
|
201
203
|
...i,
|
|
202
204
|
nodes: i.nodes.map((e) => t.has(e.id) ? {
|
|
203
205
|
...e,
|
|
204
|
-
zIndex:
|
|
206
|
+
zIndex: r(e.zIndex ?? 0, o, s)
|
|
205
207
|
} : e),
|
|
206
208
|
lines: i.lines.map((e) => n.has(e.id) ? {
|
|
207
209
|
...e,
|
|
208
|
-
zIndex:
|
|
210
|
+
zIndex: r(e.zIndex ?? 0, l, u)
|
|
209
211
|
} : e)
|
|
210
212
|
}
|
|
211
213
|
}
|
|
@@ -216,7 +218,7 @@ function ae({ onUndo: e, onRedo: t, groupRef: r, geoGroupRef: i, ungroupRef: a }
|
|
|
216
218
|
p,
|
|
217
219
|
m
|
|
218
220
|
]);
|
|
219
|
-
|
|
221
|
+
F(() => {
|
|
220
222
|
let e = (e) => {
|
|
221
223
|
let t = e.target;
|
|
222
224
|
if (t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable) return;
|
|
@@ -306,7 +308,7 @@ function ae({ onUndo: e, onRedo: t, groupRef: r, geoGroupRef: i, ungroupRef: a }
|
|
|
306
308
|
l,
|
|
307
309
|
h
|
|
308
310
|
]);
|
|
309
|
-
let D =
|
|
311
|
+
let D = I(() => ({
|
|
310
312
|
undo: e,
|
|
311
313
|
redo: t,
|
|
312
314
|
copy: g,
|
|
@@ -336,54 +338,54 @@ function ae({ onUndo: e, onRedo: t, groupRef: r, geoGroupRef: i, ungroupRef: a }
|
|
|
336
338
|
T,
|
|
337
339
|
E
|
|
338
340
|
]);
|
|
339
|
-
return
|
|
341
|
+
return j(D), M(), null;
|
|
340
342
|
}
|
|
341
|
-
function
|
|
342
|
-
return t.current =
|
|
343
|
+
function se({ pixiRef: e, exportPdfRef: t }) {
|
|
344
|
+
return t.current = A(e), null;
|
|
343
345
|
}
|
|
344
|
-
var
|
|
345
|
-
let [O,
|
|
346
|
-
|
|
347
|
-
let
|
|
348
|
-
|
|
349
|
-
|
|
346
|
+
var H = N(function({ initialDocument: e, onChange: t, width: n, height: r, readOnly: o = !1, onBack: c, onExportPNG: u, onPublish: d, showMiniMap: f = !0, showGrid: v = !0, gridSize: y = 20, className: b, showAI: x = !0, showAIConfig: S = !0, aiConfig: C }, E) {
|
|
347
|
+
let [O, k] = R(() => ie(e ?? i())), [A, j] = R(ae), M = L(null), N = L(null), I = L(null), V = L(null), H = ne(V), { wrappedSetDoc: U, setDocTransient: W, undo: G, redo: K, canUndo: q, canRedo: J } = te(O, k), Y = L(null), X = L(null), Z = L(null), fe = L(null), pe = L(t);
|
|
348
|
+
pe.current = t;
|
|
349
|
+
let me = L(O);
|
|
350
|
+
F(() => {
|
|
351
|
+
me.current !== O && (me.current = O, o || pe.current?.(O));
|
|
350
352
|
}, [O, o]);
|
|
351
|
-
let
|
|
352
|
-
|
|
353
|
+
let Q = L(O);
|
|
354
|
+
Q.current = O, re(E, () => ({
|
|
353
355
|
exportPNG: async (e) => {
|
|
354
|
-
let t =
|
|
356
|
+
let t = M.current;
|
|
355
357
|
return !t || t.destroyed ? null : t.exportPNG(e);
|
|
356
358
|
},
|
|
357
|
-
getDocument: () =>
|
|
359
|
+
getDocument: () => Q.current
|
|
358
360
|
}), []);
|
|
359
|
-
let
|
|
360
|
-
|
|
361
|
+
let he = P((e) => {
|
|
362
|
+
U((t) => {
|
|
361
363
|
let n = typeof e == "function" ? e(t) : e;
|
|
362
364
|
return o ? n.canvases === t.canvases && n.title === t.title ? n : t : n;
|
|
363
365
|
});
|
|
364
|
-
}, [
|
|
365
|
-
|
|
366
|
+
}, [U, o]), ge = P((e) => {
|
|
367
|
+
W((t) => {
|
|
366
368
|
let n = typeof e == "function" ? e(t) : e;
|
|
367
369
|
return o ? n.canvases === t.canvases && n.title === t.title ? n : t : n;
|
|
368
370
|
});
|
|
369
|
-
}, [
|
|
371
|
+
}, [W, o]), _e = P(() => {
|
|
372
|
+
o || G();
|
|
373
|
+
}, [o, G]), $ = P(() => {
|
|
370
374
|
o || K();
|
|
371
|
-
}, [o, K]),
|
|
372
|
-
|
|
373
|
-
}, [
|
|
374
|
-
N.current = e, P.current && !L.current && (L.current = new k(P.current));
|
|
375
|
-
}, []), ye = F(async () => {
|
|
375
|
+
}, [o, K]), ve = P((e) => {
|
|
376
|
+
M.current = e, N.current && !I.current && (I.current = new ee(N.current));
|
|
377
|
+
}, []), ye = P(async () => {
|
|
376
378
|
if (u) return void u();
|
|
377
|
-
let e =
|
|
379
|
+
let e = M.current;
|
|
378
380
|
if (!e || e.destroyed) return;
|
|
379
381
|
let t = await e.exportPNG(16777215);
|
|
380
|
-
t && m(t, `${h(
|
|
381
|
-
}, [u]), be =
|
|
382
|
-
await
|
|
382
|
+
t && m(t, `${h(Q.current.title)}.png`);
|
|
383
|
+
}, [u]), be = P(async () => {
|
|
384
|
+
await fe.current?.();
|
|
383
385
|
}, []);
|
|
384
|
-
|
|
386
|
+
F(() => {
|
|
385
387
|
let e = !1, t = null, n = () => {
|
|
386
|
-
let e =
|
|
388
|
+
let e = M.current, t = I.current;
|
|
387
389
|
if (!e || e.destroyed || !t) return;
|
|
388
390
|
let n = {
|
|
389
391
|
x: e.world.position.x,
|
|
@@ -393,8 +395,8 @@ var U = P(function({ initialDocument: e, onChange: t, width: n, height: r, readO
|
|
|
393
395
|
i && t.update(i.nodes, n, e.app.screen.width, e.app.screen.height);
|
|
394
396
|
}, r = () => {
|
|
395
397
|
if (e) return;
|
|
396
|
-
let i =
|
|
397
|
-
i && !i.destroyed &&
|
|
398
|
+
let i = M.current;
|
|
399
|
+
i && !i.destroyed && I.current ? (i.app.ticker.add(n), t = i) : requestAnimationFrame(r);
|
|
398
400
|
};
|
|
399
401
|
return r(), () => {
|
|
400
402
|
e = !0, t && !t.destroyed && t.app.ticker.remove(n);
|
|
@@ -404,64 +406,64 @@ var U = P(function({ initialDocument: e, onChange: t, width: n, height: r, readO
|
|
|
404
406
|
width: n ?? "100%",
|
|
405
407
|
height: r ?? "100%"
|
|
406
408
|
};
|
|
407
|
-
return /* @__PURE__ */
|
|
408
|
-
ref:
|
|
409
|
+
return /* @__PURE__ */ z("div", {
|
|
410
|
+
ref: V,
|
|
409
411
|
className: `flow-container ${b ?? ""}`,
|
|
410
412
|
style: xe,
|
|
411
|
-
children: /* @__PURE__ */
|
|
413
|
+
children: /* @__PURE__ */ z(a, {
|
|
412
414
|
doc: O,
|
|
413
|
-
setDoc:
|
|
414
|
-
setDocTransient:
|
|
415
|
-
selection:
|
|
416
|
-
setSelection:
|
|
417
|
-
children: /* @__PURE__ */
|
|
415
|
+
setDoc: he,
|
|
416
|
+
setDocTransient: ge,
|
|
417
|
+
selection: A,
|
|
418
|
+
setSelection: j,
|
|
419
|
+
children: /* @__PURE__ */ z(s, {
|
|
418
420
|
showMiniMap: f,
|
|
419
421
|
showGrid: v,
|
|
420
422
|
gridSize: y,
|
|
421
423
|
showAI: x,
|
|
422
424
|
readOnly: o,
|
|
423
|
-
children: /* @__PURE__ */
|
|
425
|
+
children: /* @__PURE__ */ B(l, {
|
|
424
426
|
initialConfig: C,
|
|
425
427
|
showAIConfig: S,
|
|
426
428
|
children: [
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
-
onUndo:
|
|
429
|
-
onRedo:
|
|
430
|
-
groupRef:
|
|
431
|
-
geoGroupRef:
|
|
432
|
-
ungroupRef:
|
|
429
|
+
/* @__PURE__ */ z(oe, {
|
|
430
|
+
onUndo: _e,
|
|
431
|
+
onRedo: $,
|
|
432
|
+
groupRef: Y,
|
|
433
|
+
geoGroupRef: X,
|
|
434
|
+
ungroupRef: Z
|
|
433
435
|
}),
|
|
434
|
-
/* @__PURE__ */
|
|
435
|
-
pixiRef:
|
|
436
|
-
exportPdfRef:
|
|
436
|
+
/* @__PURE__ */ z(se, {
|
|
437
|
+
pixiRef: M,
|
|
438
|
+
exportPdfRef: fe
|
|
437
439
|
}),
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
compact:
|
|
440
|
-
toolbar: o ? null : /* @__PURE__ */
|
|
441
|
-
compact:
|
|
440
|
+
/* @__PURE__ */ B(le, {
|
|
441
|
+
compact: H,
|
|
442
|
+
toolbar: o ? null : /* @__PURE__ */ z(g, {
|
|
443
|
+
compact: H,
|
|
442
444
|
onBack: c,
|
|
443
|
-
onUndo:
|
|
444
|
-
onRedo:
|
|
445
|
-
canUndo:
|
|
446
|
-
canRedo:
|
|
447
|
-
onGroup: () =>
|
|
448
|
-
onGeoGroup: () =>
|
|
449
|
-
onUngroup: () =>
|
|
445
|
+
onUndo: _e,
|
|
446
|
+
onRedo: $,
|
|
447
|
+
canUndo: q,
|
|
448
|
+
canRedo: J,
|
|
449
|
+
onGroup: () => Y.current?.(),
|
|
450
|
+
onGeoGroup: () => X.current?.(),
|
|
451
|
+
onUngroup: () => Z.current?.(),
|
|
450
452
|
onExportPNG: ye,
|
|
451
453
|
onExportPDF: be,
|
|
452
454
|
onPublish: d
|
|
453
455
|
}),
|
|
454
456
|
children: [
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
-
/* @__PURE__ */
|
|
458
|
-
!o && /* @__PURE__ */
|
|
459
|
-
/* @__PURE__ */
|
|
460
|
-
canvasRef:
|
|
461
|
-
pixiRef:
|
|
462
|
-
miniMapRef:
|
|
457
|
+
/* @__PURE__ */ z(p, { onPixiReady: ve }),
|
|
458
|
+
/* @__PURE__ */ z(T, {}),
|
|
459
|
+
/* @__PURE__ */ B(ce, { children: [!o && /* @__PURE__ */ z(_, {}), /* @__PURE__ */ z(D, {})] }),
|
|
460
|
+
!o && /* @__PURE__ */ z(de, {}),
|
|
461
|
+
/* @__PURE__ */ z(ue, {
|
|
462
|
+
canvasRef: N,
|
|
463
|
+
pixiRef: M,
|
|
464
|
+
miniMapRef: I
|
|
463
465
|
}),
|
|
464
|
-
/* @__PURE__ */
|
|
466
|
+
/* @__PURE__ */ z(w, {})
|
|
465
467
|
]
|
|
466
468
|
})
|
|
467
469
|
]
|
|
@@ -470,15 +472,15 @@ var U = P(function({ initialDocument: e, onChange: t, width: n, height: r, readO
|
|
|
470
472
|
})
|
|
471
473
|
});
|
|
472
474
|
});
|
|
473
|
-
function
|
|
475
|
+
function ce({ children: e }) {
|
|
474
476
|
let { presentation: t } = c();
|
|
475
|
-
return /* @__PURE__ */
|
|
477
|
+
return /* @__PURE__ */ z("div", {
|
|
476
478
|
className: "flow-overlay",
|
|
477
479
|
style: { display: t ? "none" : void 0 },
|
|
478
480
|
children: e
|
|
479
481
|
});
|
|
480
482
|
}
|
|
481
|
-
var
|
|
483
|
+
var U = [
|
|
482
484
|
{
|
|
483
485
|
id: "shapes",
|
|
484
486
|
label: "Shapes",
|
|
@@ -522,43 +524,43 @@ var W = [
|
|
|
522
524
|
showKey: "showAI"
|
|
523
525
|
}
|
|
524
526
|
];
|
|
525
|
-
function
|
|
527
|
+
function W(e) {
|
|
526
528
|
switch (e) {
|
|
527
|
-
case "shapes": return /* @__PURE__ */
|
|
528
|
-
case "icons": return /* @__PURE__ */
|
|
529
|
-
case "media": return /* @__PURE__ */
|
|
530
|
-
case "inspector": return /* @__PURE__ */
|
|
531
|
-
case "outline": return /* @__PURE__ */
|
|
532
|
-
case "json": return /* @__PURE__ */
|
|
533
|
-
case "ai": return /* @__PURE__ */
|
|
529
|
+
case "shapes": return /* @__PURE__ */ z(y, {});
|
|
530
|
+
case "icons": return /* @__PURE__ */ z(b, {});
|
|
531
|
+
case "media": return /* @__PURE__ */ z(v, {});
|
|
532
|
+
case "inspector": return /* @__PURE__ */ z(x, {});
|
|
533
|
+
case "outline": return /* @__PURE__ */ z(S, {});
|
|
534
|
+
case "json": return /* @__PURE__ */ z(X, {});
|
|
535
|
+
case "ai": return /* @__PURE__ */ z(C, {});
|
|
534
536
|
default: return null;
|
|
535
537
|
}
|
|
536
538
|
}
|
|
537
|
-
var
|
|
539
|
+
var G = /* @__PURE__ */ new Set([
|
|
538
540
|
"shapes",
|
|
539
541
|
"icons",
|
|
540
542
|
"media"
|
|
541
|
-
])
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}), [
|
|
549
|
-
|
|
543
|
+
]), K = (e) => ({
|
|
544
|
+
id: e.id,
|
|
545
|
+
label: e.label,
|
|
546
|
+
icon: e.icon,
|
|
547
|
+
content: W(e.id)
|
|
548
|
+
});
|
|
549
|
+
function le({ children: t, toolbar: n, compact: r }) {
|
|
550
|
+
let i = c(), { panelDocks: a, setPanelDock: o, presentation: s, readOnly: l, setPendingPlacement: u } = i, { setShowPalette: d, setShowInspector: f, setShowOutline: p, setShowJson: m, setShowAI: h } = i, g = l ? [] : U.filter((e) => !e.showKey || i[e.showKey]), [_, v] = R(null), y = L(null);
|
|
551
|
+
F(() => {
|
|
550
552
|
if (!r) {
|
|
551
|
-
|
|
553
|
+
y.current = null;
|
|
552
554
|
return;
|
|
553
555
|
}
|
|
554
|
-
let e = i.pendingPlacement, t = e ? `${e.type}:${e.data?.svgId ?? ""}:${e.data?.mediaKind ?? ""}` : null, n =
|
|
555
|
-
|
|
556
|
+
let e = i.pendingPlacement, t = e ? `${e.type}:${e.data?.svgId ?? ""}:${e.data?.mediaKind ?? ""}` : null, n = y.current;
|
|
557
|
+
y.current = t, t && t !== n && _ && G.has(_) && v(null);
|
|
556
558
|
}, [
|
|
557
559
|
i.pendingPlacement,
|
|
558
560
|
r,
|
|
559
|
-
|
|
561
|
+
_
|
|
560
562
|
]);
|
|
561
|
-
let [
|
|
563
|
+
let [b, x] = R(null), S = P((e, t) => o(e, t), [o]), C = P((e) => {
|
|
562
564
|
e === "inspector" ? f(!1) : e === "outline" ? p(!1) : e === "json" ? m(!1) : e === "ai" ? h(!1) : d(!1);
|
|
563
565
|
}, [
|
|
564
566
|
f,
|
|
@@ -568,86 +570,86 @@ function ce({ children: t, toolbar: n, compact: r }) {
|
|
|
568
570
|
d
|
|
569
571
|
]);
|
|
570
572
|
if (r && !s) {
|
|
571
|
-
let r = g.find((e) => e.id ===
|
|
572
|
-
return /* @__PURE__ */
|
|
573
|
+
let r = g.find((e) => e.id === _) ?? null;
|
|
574
|
+
return /* @__PURE__ */ B("div", {
|
|
573
575
|
className: "flow-workspace",
|
|
574
576
|
children: [
|
|
575
577
|
n,
|
|
576
|
-
g.length > 0 && /* @__PURE__ */
|
|
578
|
+
g.length > 0 && /* @__PURE__ */ z("div", {
|
|
577
579
|
className: "flow-mobile-panel-bar",
|
|
578
|
-
children: /* @__PURE__ */
|
|
580
|
+
children: /* @__PURE__ */ z(e, {
|
|
579
581
|
placeholder: "选择面板…",
|
|
580
582
|
options: g.map((e) => ({
|
|
581
583
|
value: e.id,
|
|
582
584
|
label: e.label
|
|
583
585
|
})),
|
|
584
|
-
value:
|
|
586
|
+
value: _ ?? void 0,
|
|
585
587
|
onChange: (e) => {
|
|
586
|
-
u(null),
|
|
588
|
+
u(null), v(String(e));
|
|
587
589
|
}
|
|
588
590
|
})
|
|
589
591
|
}),
|
|
590
|
-
/* @__PURE__ */
|
|
592
|
+
/* @__PURE__ */ B("div", {
|
|
591
593
|
className: "flow-workspace-main",
|
|
592
|
-
children: [/* @__PURE__ */
|
|
594
|
+
children: [/* @__PURE__ */ z("div", {
|
|
593
595
|
className: "flow-stage",
|
|
594
596
|
children: t
|
|
595
|
-
}), r && /* @__PURE__ */
|
|
597
|
+
}), r && /* @__PURE__ */ B("div", {
|
|
596
598
|
className: "flow-mobile-panel",
|
|
597
|
-
children: [/* @__PURE__ */
|
|
599
|
+
children: [/* @__PURE__ */ B("div", {
|
|
598
600
|
className: "flow-mobile-panel-header",
|
|
599
|
-
children: [/* @__PURE__ */
|
|
601
|
+
children: [/* @__PURE__ */ B("span", {
|
|
600
602
|
className: "flow-mobile-panel-title",
|
|
601
|
-
children: [r.icon && /* @__PURE__ */
|
|
603
|
+
children: [r.icon && /* @__PURE__ */ z("span", {
|
|
602
604
|
className: "flow-panel-tab-icon",
|
|
603
605
|
children: r.icon
|
|
604
606
|
}), r.label]
|
|
605
|
-
}), /* @__PURE__ */
|
|
607
|
+
}), /* @__PURE__ */ z("button", {
|
|
606
608
|
type: "button",
|
|
607
609
|
className: "flow-mobile-panel-close",
|
|
608
610
|
"aria-label": "关闭面板",
|
|
609
|
-
onClick: () =>
|
|
611
|
+
onClick: () => v(null),
|
|
610
612
|
children: "✕"
|
|
611
613
|
})]
|
|
612
|
-
}), /* @__PURE__ */
|
|
614
|
+
}), /* @__PURE__ */ z("div", {
|
|
613
615
|
className: "flow-mobile-panel-body",
|
|
614
|
-
children:
|
|
616
|
+
children: W(r.id)
|
|
615
617
|
})]
|
|
616
618
|
})]
|
|
617
619
|
})
|
|
618
620
|
]
|
|
619
621
|
});
|
|
620
622
|
}
|
|
621
|
-
let
|
|
622
|
-
return /* @__PURE__ */
|
|
623
|
+
let w = (e) => a[e] ?? "left", T = g.filter((e) => w(e.id) === "left").map(K), D = g.filter((e) => w(e.id) === "right").map(K), O = g.filter((e) => w(e.id) === "float");
|
|
624
|
+
return /* @__PURE__ */ B("div", {
|
|
623
625
|
className: "flow-workspace",
|
|
624
|
-
children: [!s && n, /* @__PURE__ */
|
|
626
|
+
children: [!s && n, /* @__PURE__ */ B("div", {
|
|
625
627
|
className: "flow-workspace-main",
|
|
626
628
|
children: [
|
|
627
|
-
!s &&
|
|
628
|
-
tabs:
|
|
629
|
-
defaultTab:
|
|
629
|
+
!s && T.length > 0 && /* @__PURE__ */ z(E, {
|
|
630
|
+
tabs: T,
|
|
631
|
+
defaultTab: T[0]?.id,
|
|
630
632
|
resizeEdge: "right",
|
|
631
633
|
defaultWidth: 220,
|
|
632
634
|
dock: "left",
|
|
633
|
-
onDock:
|
|
634
|
-
onClose:
|
|
635
|
+
onDock: S,
|
|
636
|
+
onClose: C
|
|
635
637
|
}),
|
|
636
|
-
/* @__PURE__ */
|
|
638
|
+
/* @__PURE__ */ z("div", {
|
|
637
639
|
className: "flow-stage",
|
|
638
640
|
children: t
|
|
639
641
|
}),
|
|
640
|
-
!s &&
|
|
641
|
-
tabs:
|
|
642
|
-
defaultTab:
|
|
642
|
+
!s && D.length > 0 && /* @__PURE__ */ z(E, {
|
|
643
|
+
tabs: D,
|
|
644
|
+
defaultTab: D[0]?.id,
|
|
643
645
|
resizeEdge: "left",
|
|
644
646
|
defaultWidth: 220,
|
|
645
647
|
dock: "right",
|
|
646
|
-
onDock:
|
|
647
|
-
onClose:
|
|
648
|
+
onDock: S,
|
|
649
|
+
onClose: C
|
|
648
650
|
}),
|
|
649
|
-
!s &&
|
|
650
|
-
tabs: [
|
|
651
|
+
!s && O.map((e, t) => /* @__PURE__ */ z(E, {
|
|
652
|
+
tabs: [K(e)],
|
|
651
653
|
resizeEdge: "right",
|
|
652
654
|
defaultWidth: 220,
|
|
653
655
|
dock: "float",
|
|
@@ -655,20 +657,20 @@ function ce({ children: t, toolbar: n, compact: r }) {
|
|
|
655
657
|
top: 48 + t * 40,
|
|
656
658
|
left: 24 + t * 30
|
|
657
659
|
},
|
|
658
|
-
onDock:
|
|
659
|
-
onClose:
|
|
660
|
-
onDragHintChange:
|
|
660
|
+
onDock: S,
|
|
661
|
+
onClose: C,
|
|
662
|
+
onDragHintChange: x
|
|
661
663
|
}, e.id)),
|
|
662
|
-
!s &&
|
|
663
|
-
className: `flow-dock-dropzone flow-dock-dropzone--${
|
|
664
|
-
children: /* @__PURE__ */
|
|
664
|
+
!s && b && /* @__PURE__ */ z("div", {
|
|
665
|
+
className: `flow-dock-dropzone flow-dock-dropzone--${b}`,
|
|
666
|
+
children: /* @__PURE__ */ z("span", { children: b === "left" ? "⇤ 停靠左侧" : "停靠右侧 ⇥" })
|
|
665
667
|
})
|
|
666
668
|
]
|
|
667
669
|
})]
|
|
668
670
|
});
|
|
669
671
|
}
|
|
670
|
-
function
|
|
671
|
-
let { showMiniMap: r, setViewport: i, presentation: a } = c(), o =
|
|
672
|
+
function ue({ canvasRef: e, pixiRef: t, miniMapRef: n }) {
|
|
673
|
+
let { showMiniMap: r, setViewport: i, presentation: a } = c(), o = L(!1), s = P((r, a) => {
|
|
672
674
|
let o = e.current, s = t.current, c = n.current;
|
|
673
675
|
if (!o || !s || s.destroyed || !c) return;
|
|
674
676
|
let l = o.getBoundingClientRect();
|
|
@@ -686,17 +688,17 @@ function le({ canvasRef: e, pixiRef: t, miniMapRef: n }) {
|
|
|
686
688
|
t,
|
|
687
689
|
n,
|
|
688
690
|
i
|
|
689
|
-
]), l =
|
|
691
|
+
]), l = P((e) => {
|
|
690
692
|
e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), o.current = !0, s(e.clientX, e.clientY);
|
|
691
|
-
}, [s]), u =
|
|
693
|
+
}, [s]), u = P((e) => {
|
|
692
694
|
o.current && s(e.clientX, e.clientY);
|
|
693
|
-
}, [s]), d =
|
|
695
|
+
}, [s]), d = P((e) => {
|
|
694
696
|
o.current = !1;
|
|
695
697
|
try {
|
|
696
698
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
697
699
|
} catch {}
|
|
698
700
|
}, []);
|
|
699
|
-
return /* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ z("div", {
|
|
700
702
|
className: "flow-minimap",
|
|
701
703
|
style: {
|
|
702
704
|
display: r && !a ? void 0 : "none",
|
|
@@ -706,7 +708,7 @@ function le({ canvasRef: e, pixiRef: t, miniMapRef: n }) {
|
|
|
706
708
|
onPointerMove: u,
|
|
707
709
|
onPointerUp: d,
|
|
708
710
|
title: "点击或拖动以移动画布",
|
|
709
|
-
children: /* @__PURE__ */
|
|
711
|
+
children: /* @__PURE__ */ z("canvas", {
|
|
710
712
|
ref: e,
|
|
711
713
|
width: 180,
|
|
712
714
|
height: 120,
|
|
@@ -752,14 +754,14 @@ function Y(e, t, n) {
|
|
|
752
754
|
} catch {}
|
|
753
755
|
}
|
|
754
756
|
function X() {
|
|
755
|
-
let { setDoc: e, currentCanvasId: n, selection: r, currentCanvas: i } = o(), [a, s] =
|
|
756
|
-
|
|
757
|
+
let { setDoc: e, currentCanvasId: n, selection: r, currentCanvas: i } = o(), [a, s] = R(""), [c, l] = R(null), u = L(!1), d = L(null), f = L(null), p = I(() => r.nodeIds.size + r.edgeIds.size + r.lineIds.size === 1 ? r.nodeIds.size === 1 ? [...r.nodeIds][0] : r.edgeIds.size === 1 ? [...r.edgeIds][0] : r.lineIds.size === 1 ? [...r.lineIds][0] : null : null, [r]);
|
|
758
|
+
F(() => {
|
|
757
759
|
if (u.current) {
|
|
758
760
|
u.current = !1;
|
|
759
761
|
return;
|
|
760
762
|
}
|
|
761
763
|
s(JSON.stringify(i, null, 2)), l(null);
|
|
762
|
-
}, [i]),
|
|
764
|
+
}, [i]), F(() => {
|
|
763
765
|
let e = f.current;
|
|
764
766
|
if (e && J(e), !p) return;
|
|
765
767
|
let t = setTimeout(() => {
|
|
@@ -770,7 +772,7 @@ function X() {
|
|
|
770
772
|
let n = f.current, r = t.scrollDOM;
|
|
771
773
|
r.style.scrollBehavior = "smooth";
|
|
772
774
|
let i = t.state.doc.line(e.startLine);
|
|
773
|
-
t.dispatch({ effects:
|
|
775
|
+
t.dispatch({ effects: V.scrollIntoView(i.from, {
|
|
774
776
|
y: "start",
|
|
775
777
|
yMargin: 0
|
|
776
778
|
}) });
|
|
@@ -785,7 +787,7 @@ function X() {
|
|
|
785
787
|
}, 120);
|
|
786
788
|
return () => clearTimeout(t);
|
|
787
789
|
}, [p, a]);
|
|
788
|
-
let m =
|
|
790
|
+
let m = P((t) => {
|
|
789
791
|
s(t);
|
|
790
792
|
try {
|
|
791
793
|
let r = JSON.parse(t);
|
|
@@ -800,7 +802,7 @@ function X() {
|
|
|
800
802
|
l(e.message?.slice(0, 60) ?? "Invalid JSON");
|
|
801
803
|
}
|
|
802
804
|
}, [e, n]), h = p ? r.nodeIds.has(p) ? "Node" : r.edgeIds.has(p) ? "Edge" : "Line" : null;
|
|
803
|
-
return /* @__PURE__ */
|
|
805
|
+
return /* @__PURE__ */ B("div", {
|
|
804
806
|
style: {
|
|
805
807
|
display: "flex",
|
|
806
808
|
flexDirection: "column",
|
|
@@ -808,14 +810,14 @@ function X() {
|
|
|
808
810
|
minHeight: 0
|
|
809
811
|
},
|
|
810
812
|
children: [
|
|
811
|
-
/* @__PURE__ */
|
|
813
|
+
/* @__PURE__ */ z("div", {
|
|
812
814
|
className: "flow-json-header",
|
|
813
|
-
children: /* @__PURE__ */
|
|
815
|
+
children: /* @__PURE__ */ z("span", {
|
|
814
816
|
className: "flow-json-scope",
|
|
815
817
|
children: h ? `${h}: ${p.slice(0, 8)}` : "Canvas"
|
|
816
818
|
})
|
|
817
819
|
}),
|
|
818
|
-
c && /* @__PURE__ */
|
|
820
|
+
c && /* @__PURE__ */ z("div", {
|
|
819
821
|
style: {
|
|
820
822
|
fontSize: 11,
|
|
821
823
|
color: "oklch(var(--er))",
|
|
@@ -824,13 +826,13 @@ function X() {
|
|
|
824
826
|
},
|
|
825
827
|
children: c
|
|
826
828
|
}),
|
|
827
|
-
/* @__PURE__ */
|
|
829
|
+
/* @__PURE__ */ z("div", {
|
|
828
830
|
ref: f,
|
|
829
831
|
style: {
|
|
830
832
|
flex: 1,
|
|
831
833
|
minHeight: 0
|
|
832
834
|
},
|
|
833
|
-
children: /* @__PURE__ */
|
|
835
|
+
children: /* @__PURE__ */ z(t, {
|
|
834
836
|
ref: d,
|
|
835
837
|
value: a,
|
|
836
838
|
onChange: m,
|
|
@@ -843,8 +845,8 @@ function X() {
|
|
|
843
845
|
]
|
|
844
846
|
});
|
|
845
847
|
}
|
|
846
|
-
function
|
|
847
|
-
let { contextMenu: e, setContextMenu: t } = c(), { doc: n, setDoc: i, currentCanvasId: a, pushCanvas: s, setSelection: l } = o(), { duplicate: d } =
|
|
848
|
+
function de() {
|
|
849
|
+
let { contextMenu: e, setContextMenu: t } = c(), { doc: n, setDoc: i, currentCanvasId: a, pushCanvas: s, setSelection: l } = o(), { duplicate: d } = k();
|
|
848
850
|
if (!e) return null;
|
|
849
851
|
let f = n.canvases[a];
|
|
850
852
|
if (!f) return t(null), null;
|
|
@@ -930,7 +932,7 @@ function ue() {
|
|
|
930
932
|
} : t;
|
|
931
933
|
}), s(e);
|
|
932
934
|
}
|
|
933
|
-
})), m.length === 0 ? null : /* @__PURE__ */
|
|
935
|
+
})), m.length === 0 ? null : /* @__PURE__ */ z(O, {
|
|
934
936
|
x: e.x,
|
|
935
937
|
y: e.y,
|
|
936
938
|
items: m,
|
|
@@ -945,6 +947,6 @@ function Z(e, t) {
|
|
|
945
947
|
}
|
|
946
948
|
}
|
|
947
949
|
//#endregion
|
|
948
|
-
export {
|
|
950
|
+
export { H as default };
|
|
949
951
|
|
|
950
952
|
//# sourceMappingURL=Flow.js.map
|