@bemedev/mind-flow 1.4.0 → 1.4.1
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/lib/index.cjs.js +1 -1
- package/lib/index.es.js +535 -634
- package/lib/output.css +1 -1
- package/lib/server.cjs.js +26 -237
- package/lib/server.es.js +28 -239
- package/lib/ui/Flow.d.ts +3 -3
- package/lib/ui/Flow.d.ts.map +1 -1
- package/lib/ui/components/FlowChart.types.d.ts +8 -8
- package/package.json +2 -2
- package/src/ui/Flow.tsx +7 -28
- package/src/ui/components/FlowChart.types.ts +8 -8
package/lib/server.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isDefined, toArray, type } from "@bemedev/app/bemedev";
|
|
2
|
-
import { Dynamic, createComponent, escape, memo, mergeProps, ssr, ssrAttribute, ssrClassList,
|
|
2
|
+
import { Dynamic, createComponent, escape, memo, mergeProps, ssr, ssrAttribute, ssrClassList, ssrHydrationKey, ssrStyle, ssrStyleProperty } from "solid-js/web";
|
|
3
3
|
import { createState } from "@bemedev/app-solidjs";
|
|
4
|
-
import { For, Show, createComponent as createComponent$1, createContext as createContext$1, createEffect,
|
|
4
|
+
import { For, Show, createComponent as createComponent$1, createContext as createContext$1, createEffect, createSignal, on, onCleanup, onMount, useContext } from "solid-js";
|
|
5
5
|
import { createMachine, deepEqual, interpret, toArray as toArray$1 } from "@bemedev/app";
|
|
6
6
|
import { nanoid } from "nanoid";
|
|
7
7
|
import { DragDropProvider, DragDropSensors, DragOverlay, createDraggable, useDragDropContext } from "@thisbeyond/solid-dnd";
|
|
@@ -994,14 +994,14 @@ var DragBounds = () => {
|
|
|
994
994
|
};
|
|
995
995
|
//#endregion
|
|
996
996
|
//#region src/ui/components/EdgeComponent.tsx
|
|
997
|
-
var _tmpl$$
|
|
997
|
+
var _tmpl$$7 = [
|
|
998
998
|
"<path",
|
|
999
999
|
" class=\"",
|
|
1000
1000
|
"\" style=\"",
|
|
1001
1001
|
"\"",
|
|
1002
1002
|
"></path>"
|
|
1003
1003
|
];
|
|
1004
|
-
var _tmpl$2$
|
|
1004
|
+
var _tmpl$2$4 = [
|
|
1005
1005
|
"<g",
|
|
1006
1006
|
" cursor=\"pointer\" transform=\"",
|
|
1007
1007
|
"\" style=\"",
|
|
@@ -1066,19 +1066,19 @@ var EdgeComponent = (props) => {
|
|
|
1066
1066
|
get when() {
|
|
1067
1067
|
return vector();
|
|
1068
1068
|
},
|
|
1069
|
-
children: (v) => [ssr(_tmpl$$
|
|
1069
|
+
children: (v) => [ssr(_tmpl$$7, ssrHydrationKey(), `relative cursor-pointer fill-transparent ${!!props.isNew ? "stroke-[rgba(168,168,168,0.4)] stroke-3 z-200" : ""} ${selected() && !props.isNew ? "stroke-[rgba(168,168,168,1)] stroke-4 z-100" : ""} ${!selected() && !props.isNew ? "stroke-[rgba(168,168,168,0.8)] stroke-3" : ""}`, ssrStyleProperty("pointer-events:", props.isNew ? "none" : "all"), ssrAttribute("d", escape(draw(v()), true), false)), createComponent(Show, {
|
|
1070
1070
|
get when() {
|
|
1071
1071
|
return selected();
|
|
1072
1072
|
},
|
|
1073
1073
|
get children() {
|
|
1074
|
-
return ssr(_tmpl$2$
|
|
1074
|
+
return ssr(_tmpl$2$4, ssrHydrationKey(), `translate(${escape(middlePoint().x, true)}, ${escape(middlePoint().y, true)})`, ssrStyleProperty("pointer-events:", "all") + ssrStyleProperty(";z-index:", "30"));
|
|
1075
1075
|
}
|
|
1076
1076
|
})]
|
|
1077
1077
|
});
|
|
1078
1078
|
};
|
|
1079
1079
|
//#endregion
|
|
1080
1080
|
//#region src/ui/components/EdgesBoard.tsx
|
|
1081
|
-
var _tmpl$$
|
|
1081
|
+
var _tmpl$$6 = [
|
|
1082
1082
|
"<svg",
|
|
1083
1083
|
" class=\"pointer-events-none h-full w-full overflow-visible\"><!--$-->",
|
|
1084
1084
|
"<!--/--><!--$-->",
|
|
@@ -1099,7 +1099,7 @@ var EdgesBoard = () => {
|
|
|
1099
1099
|
selector: ({ context }) => Object.keys(context.edgesPositions ?? {}),
|
|
1100
1100
|
equals: (prev, next) => prev.length === next.length
|
|
1101
1101
|
});
|
|
1102
|
-
return ssr(_tmpl$$
|
|
1102
|
+
return ssr(_tmpl$$6, ssrHydrationKey(), escape(createComponent(Show, {
|
|
1103
1103
|
get when() {
|
|
1104
1104
|
return hasNewEdge();
|
|
1105
1105
|
},
|
|
@@ -1118,12 +1118,12 @@ var EdgesBoard = () => {
|
|
|
1118
1118
|
};
|
|
1119
1119
|
//#endregion
|
|
1120
1120
|
//#region src/ui/components/NodeComponent.tsx
|
|
1121
|
-
var _tmpl$$
|
|
1121
|
+
var _tmpl$$5 = [
|
|
1122
1122
|
"<svg",
|
|
1123
1123
|
" class=\"cursor-pointer overflow-visible rounded-full bg-green-500 p-0.5 text-center font-bold hover:bg-green-600\" style=\"",
|
|
1124
1124
|
"\" viewBox=\"0 0 1024 1024\" preserveAspectRatio=\"xMaxYMax\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"white\"><g id=\"background\"><path d=\"M467.40667,277.66696c-0.05948,-14.53055 5.75527,-22.95613 -8.62044,-20.90487c-112.55699,16.0607 -222.1609,112.14558 -245.06161,239.85765c-46.52056,259.43466 231.33083,443.06705 449.51209,316.97506c117.31668,-67.80002 160.95215,-190.43324 151.34416,-288.29849c-5.92276,-60.32819 -27.80273,-107.95668 -53.44246,-144.25469l59.39269,-42.05363c111.72214,156.309 73.11535,351.55635 -25.06953,459.45565c-184.18877,202.4124 -470.46624,145.52064 -592.95027,-32.92123c-156.18269,-227.53604 -27.15324,-543.64371 261.18883,-582.44416c5.0579,-0.68061 3.56556,-7.04079 3.56442,-8.58985c-0.05594,-76.3354 -0.11021,-76.7687 1.10909,-77.24589c2.06886,-0.80969 151.41433,118.4561 151.92482,118.95524c4.65592,4.55233 -0.99548,7.829 -29.07828,30.50907c-120.49369,97.31245 -120.4977,98.55675 -123.0691,97.87586c-0.43639,-0.11555 -0.80698,-0.31322 -0.74442,-66.91571Z\"></path><path d=\"M316.61562,611.03414c0.11517,-90.16257 -0.25516,-99.92912 0.64739,-101.78856c1.56486,-3.22393 131.99102,0.91032 134.6959,-1.89763c2.21336,-2.2977 -0.59362,-129.97807 1.1376,-132.37034c0.7253,-1.00225 11.10552,-0.99175 12.07474,-0.99077c104.50336,0.10564 104.90098,-0.37811 105.967,0.85765c1.56461,1.81373 0.25596,114.18436 0.67852,129.81412c0.1322,4.88975 3.22386,3.28152 99.72028,3.4563c33.0841,0.05992 36.14259,-1.40368 36.21852,4.50462c0.11713,9.11348 1.41954,110.45369 -0.40274,113.92715c-1.81106,3.45208 -130.39967,-0.42618 -134.48289,1.62075c-2.29035,1.14816 -0.36989,101.12392 -1.11542,130.51904c-0.09548,3.76459 -2.13506,3.20617 -47.84854,3.17365c-69.30253,-0.0493 -69.31099,-0.25627 -69.65762,-0.42191c-3.77927,-1.80595 0.16287,-129.33555 -2.24266,-132.58994c-1.79931,-2.43424 -124.06108,-0.29118 -132.80252,-0.97392c-3.81102,-0.29766 -2.58229,-14.8847 -2.58758,-16.8402Z\"></path></g></svg>"
|
|
1125
1125
|
];
|
|
1126
|
-
var _tmpl$2$
|
|
1126
|
+
var _tmpl$2$3 = [
|
|
1127
1127
|
"<div",
|
|
1128
1128
|
" class=\"",
|
|
1129
1129
|
"\" style=\"",
|
|
@@ -1198,12 +1198,12 @@ var NodeComponent = (props) => {
|
|
|
1198
1198
|
if (!edges) return false;
|
|
1199
1199
|
return edges.some(({ to }) => to === props.id);
|
|
1200
1200
|
} });
|
|
1201
|
-
return ssr(_tmpl$2$
|
|
1201
|
+
return ssr(_tmpl$2$3, ssrHydrationKey(), `flex flex-col absolute cursor-grab bg-white rounded-md shadow-md select-none transition-[border,box-shadow] duration-200 ease-in-out hover:shadow-lg draggable ${selected() ? "border border-[#e38c29] z-100" : ""} ${!selected() ? "border border-[#e6d4be] z-1" : ""} group min-w-48`, ssrStyleProperty("top:", `${escape(node().y, true)}px`) + ssrStyleProperty(";left:", `${escape(node().x, true)}px`), ssrAttribute("id", escape(props.id, true), false), `pointer-events-none absolute flex items-center justify-end -top-7.5 right-0 transition-all duration-200 ease-in-out space-x-2 ${selected() ? "w-full opacity-100" : ""} ${!selected() ? "w-0 -right-3 opacity-0 overflow-hidden" : ""}`, ssrStyleProperty("overflow:", "visible") + ssrStyleProperty(";pointer-events:", "all") + ssrStyleProperty(";width:", `${escape(12, true) * 2}px`) + ssrStyleProperty(";height:", `${escape(12, true) * 2}px`), escape(createComponent(Show, {
|
|
1202
1202
|
get when() {
|
|
1203
1203
|
return hasParent();
|
|
1204
1204
|
},
|
|
1205
1205
|
get children() {
|
|
1206
|
-
return ssr(_tmpl$$
|
|
1206
|
+
return ssr(_tmpl$$5, ssrHydrationKey(), ssrStyleProperty("pointer-events:", "all") + ssrStyleProperty(";fill-rule:", "evenodd") + ssrStyleProperty(";clip-rule:", "evenodd") + ssrStyleProperty(";stroke-linejoin:", "round") + ssrStyleProperty(";stroke-miterlimit:", "2") + ssrStyleProperty(";width:", `${escape(12, true) * 2}px`) + ssrStyleProperty(";height:", `${escape(12, true) * 2}px`));
|
|
1207
1207
|
}
|
|
1208
1208
|
})), ssrStyleProperty("pointer-events:", "all") + ssrStyleProperty(";width:", `${escape(12, true) * 2}px`) + ssrStyleProperty(";height:", `${escape(12, true) * 2}px`), escape(createComponent(Show, {
|
|
1209
1209
|
get when() {
|
|
@@ -1258,13 +1258,13 @@ function cn(...inputs) {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
//#endregion
|
|
1260
1260
|
//#region src/ui/components/Panels.tsx
|
|
1261
|
-
var _tmpl$$
|
|
1261
|
+
var _tmpl$$4 = [
|
|
1262
1262
|
"<div",
|
|
1263
1263
|
" class=\"",
|
|
1264
1264
|
"\">",
|
|
1265
1265
|
"</div>"
|
|
1266
1266
|
];
|
|
1267
|
-
var _tmpl$2$
|
|
1267
|
+
var _tmpl$2$2 = [
|
|
1268
1268
|
"<div",
|
|
1269
1269
|
" class=\"pointer-events-none absolute inset-0\"><!--$-->",
|
|
1270
1270
|
"<!--/--><!--$-->",
|
|
@@ -1288,7 +1288,7 @@ var Panel = (props) => {
|
|
|
1288
1288
|
return props.children;
|
|
1289
1289
|
},
|
|
1290
1290
|
keyed: true,
|
|
1291
|
-
children: (Children) => ssr(_tmpl$$
|
|
1291
|
+
children: (Children) => ssr(_tmpl$$4, ssrHydrationKey(), `${escape(cn(props.class) || "", true)} ${exists ? "z-50" : ""}`, escape(createComponent(Children, {})))
|
|
1292
1292
|
});
|
|
1293
1293
|
};
|
|
1294
1294
|
/**
|
|
@@ -1300,7 +1300,7 @@ var Panel = (props) => {
|
|
|
1300
1300
|
* @returns Rendered overlay panels JSX elements.
|
|
1301
1301
|
*/
|
|
1302
1302
|
var Panels = (props) => {
|
|
1303
|
-
return ssr(_tmpl$2$
|
|
1303
|
+
return ssr(_tmpl$2$2, ssrHydrationKey(), escape(createComponent(Panel, {
|
|
1304
1304
|
get children() {
|
|
1305
1305
|
return props.topLeft;
|
|
1306
1306
|
},
|
|
@@ -1319,7 +1319,7 @@ var Panels = (props) => {
|
|
|
1319
1319
|
};
|
|
1320
1320
|
//#endregion
|
|
1321
1321
|
//#region src/ui/components/NodesBoard.tsx
|
|
1322
|
-
var _tmpl$$
|
|
1322
|
+
var _tmpl$$3 = [
|
|
1323
1323
|
"<div",
|
|
1324
1324
|
" class=\"relative h-full w-full overflow-auto\"><!--$-->",
|
|
1325
1325
|
"<!--/--><div class=\"",
|
|
@@ -1330,7 +1330,7 @@ var _tmpl$$6 = [
|
|
|
1330
1330
|
"<!--/--><!--$-->",
|
|
1331
1331
|
"<!--/--></div></div></div>"
|
|
1332
1332
|
];
|
|
1333
|
-
var _tmpl$2$
|
|
1333
|
+
var _tmpl$2$1 = [
|
|
1334
1334
|
"<div",
|
|
1335
1335
|
" class=\"absolute right-4 bottom-4 z-50 flex items-center gap-2 rounded-xl border border-gray-200 bg-white/90 p-2 shadow-lg backdrop-blur-md\"><button type=\"button\" class=\"flex size-9 cursor-pointer items-center justify-center rounded-lg bg-gray-100 text-lg font-bold text-gray-700 shadow-sm transition-all duration-150 hover:bg-gray-200 active:scale-95\" title=\"Zoom out\" aria-label=\"Zoom out\">-</button><button type=\"button\" class=\"h-9 cursor-pointer rounded-lg px-2 text-xs font-semibold text-gray-700 transition-colors hover:bg-gray-100\" title=\"Reset zoom\" aria-label=\"Reset zoom\"><!--$-->",
|
|
1336
1336
|
"<!--/-->%</button><button type=\"button\" class=\"flex size-9 cursor-pointer items-center justify-center rounded-lg bg-gray-100 text-lg font-bold text-gray-700 shadow-sm transition-all duration-150 hover:bg-gray-200 active:scale-95\" title=\"Zoom in\" aria-label=\"Zoom in\">+</button><div class=\"h-5 w-px bg-gray-300\"></div><button type=\"button\" class=\"flex size-9 cursor-pointer items-center justify-center rounded-lg bg-blue-600 text-white shadow transition-all duration-150 hover:bg-blue-700 active:scale-95\" title=\"Add parent node\" aria-label=\"Add parent node\"><svg class=\"size-5\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\"></path></svg></button></div>"
|
|
@@ -1477,7 +1477,7 @@ var NodesBoard = (props) => {
|
|
|
1477
1477
|
},
|
|
1478
1478
|
get children() {
|
|
1479
1479
|
return [
|
|
1480
|
-
ssr(_tmpl$$
|
|
1480
|
+
ssr(_tmpl$$3, ssrHydrationKey(), escape(createComponent(DragDropSensors, {})), `relative cursor-crosshair overflow-hidden ${isPanning() ? "cursor-grabbing" : ""}`, ssrStyleProperty("height:", escape(cHeight(), true)) + ssrStyleProperty(";width:", escape(cWidth(), true)), ssrStyleProperty("scale:", escape(zoom(), true)) + ssrStyleProperty(";transform-origin:", "top left"), escape(createComponent(DragBounds, {})), escape(createComponent(EdgesBoard, {})), escape(createComponent(For, {
|
|
1481
1481
|
get each() {
|
|
1482
1482
|
return nodeIds();
|
|
1483
1483
|
},
|
|
@@ -1489,7 +1489,7 @@ var NodesBoard = (props) => {
|
|
|
1489
1489
|
})
|
|
1490
1490
|
}))),
|
|
1491
1491
|
createComponent(Panels, mergeProps(() => props.panels)),
|
|
1492
|
-
ssr(_tmpl$2$
|
|
1492
|
+
ssr(_tmpl$2$1, ssrHydrationKey(), escape(Math.round(zoom() * 100))),
|
|
1493
1493
|
createComponent(Show, {
|
|
1494
1494
|
get when() {
|
|
1495
1495
|
return !selectedId();
|
|
@@ -1504,7 +1504,7 @@ var NodesBoard = (props) => {
|
|
|
1504
1504
|
};
|
|
1505
1505
|
//#endregion
|
|
1506
1506
|
//#region src/ui/components/FlowChart.tsx
|
|
1507
|
-
var _tmpl$$
|
|
1507
|
+
var _tmpl$$2 = [
|
|
1508
1508
|
"<div",
|
|
1509
1509
|
" class=\"relative h-full w-full\"><div class=\"h-full w-full\" style=\"",
|
|
1510
1510
|
"\">",
|
|
@@ -1593,7 +1593,7 @@ var FlowChart = (props) => {
|
|
|
1593
1593
|
window.removeEventListener("pointerup", handlePointerUp);
|
|
1594
1594
|
});
|
|
1595
1595
|
});
|
|
1596
|
-
return ssr(_tmpl$$
|
|
1596
|
+
return ssr(_tmpl$$2, ssrHydrationKey(), ssrStyleProperty("cursor:", fromSignal() ? "inherit" : "crosshair"), escape(createComponent(NodesBoard, {
|
|
1597
1597
|
get panels() {
|
|
1598
1598
|
return props.panels;
|
|
1599
1599
|
},
|
|
@@ -1603,194 +1603,6 @@ var FlowChart = (props) => {
|
|
|
1603
1603
|
})));
|
|
1604
1604
|
};
|
|
1605
1605
|
//#endregion
|
|
1606
|
-
//#region src/ui/globals/helpers/espace.ts
|
|
1607
|
-
/**
|
|
1608
|
-
* Returns a zero-width space if string is empty, preserving layout flow.
|
|
1609
|
-
*
|
|
1610
|
-
* @param newText - The input text string.
|
|
1611
|
-
*
|
|
1612
|
-
* @returns The input text or zero-width visible space placeholder.
|
|
1613
|
-
*/
|
|
1614
|
-
var espace = (newText) => {
|
|
1615
|
-
if (newText === "") return "";
|
|
1616
|
-
return newText;
|
|
1617
|
-
};
|
|
1618
|
-
//#endregion
|
|
1619
|
-
//#region src/ui/globals/signals/createTyping.ts
|
|
1620
|
-
/**
|
|
1621
|
-
* Creates a reactive typewriter effect signal with oscillatory typing delay and
|
|
1622
|
-
* optional rewind.
|
|
1623
|
-
*
|
|
1624
|
-
* @param props - Configuration properties of type {@linkcode Props}.
|
|
1625
|
-
*
|
|
1626
|
-
* @returns An object containing the current text signal, type trigger, and text
|
|
1627
|
-
* setter.
|
|
1628
|
-
*/
|
|
1629
|
-
var createTyping = ({ content, min, ...props }) => {
|
|
1630
|
-
const rewind = props.rewind ?? false;
|
|
1631
|
-
const rewindDelay = props.rewindDelay ?? 500;
|
|
1632
|
-
const OSCILLATION = Math.min(min / 10 + content.length / 10, 10);
|
|
1633
|
-
const [text, setText] = createSignal("");
|
|
1634
|
-
let timeoutId;
|
|
1635
|
-
let index = 0;
|
|
1636
|
-
let isTyping = true;
|
|
1637
|
-
const max = min + OSCILLATION;
|
|
1638
|
-
let interval = min;
|
|
1639
|
-
let intervalDirection = 1;
|
|
1640
|
-
const type = () => {
|
|
1641
|
-
if (isTyping) {
|
|
1642
|
-
if (index < content.length) {
|
|
1643
|
-
setText((prev) => prev + content[index]);
|
|
1644
|
-
index++;
|
|
1645
|
-
timeoutId = setTimeout(type, interval);
|
|
1646
|
-
} else if (rewind) {
|
|
1647
|
-
isTyping = false;
|
|
1648
|
-
intervalDirection = 1;
|
|
1649
|
-
timeoutId = setTimeout(type, rewindDelay);
|
|
1650
|
-
}
|
|
1651
|
-
} else if (index > 0) {
|
|
1652
|
-
index--;
|
|
1653
|
-
setText(espace(content.substring(0, index)));
|
|
1654
|
-
timeoutId = setTimeout(type, interval);
|
|
1655
|
-
} else {
|
|
1656
|
-
isTyping = true;
|
|
1657
|
-
intervalDirection = 1;
|
|
1658
|
-
timeoutId = setTimeout(type, rewindDelay);
|
|
1659
|
-
}
|
|
1660
|
-
interval += intervalDirection;
|
|
1661
|
-
if (interval >= max) intervalDirection = -1;
|
|
1662
|
-
else if (interval <= min) intervalDirection = 1;
|
|
1663
|
-
};
|
|
1664
|
-
onCleanup(() => {
|
|
1665
|
-
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
1666
|
-
});
|
|
1667
|
-
return {
|
|
1668
|
-
text,
|
|
1669
|
-
type,
|
|
1670
|
-
setText
|
|
1671
|
-
};
|
|
1672
|
-
};
|
|
1673
|
-
//#endregion
|
|
1674
|
-
//#region src/ui/globals/components/atoms/TypingText.tsx
|
|
1675
|
-
var _tmpl$$4 = [
|
|
1676
|
-
"<div",
|
|
1677
|
-
">",
|
|
1678
|
-
"</div>"
|
|
1679
|
-
];
|
|
1680
|
-
/**
|
|
1681
|
-
* Renders animated text with a typewriter keystroke animation effect.
|
|
1682
|
-
*
|
|
1683
|
-
* @param props - Component configuration properties of type {@linkcode Props}.
|
|
1684
|
-
*
|
|
1685
|
-
* @returns Rendered animated typing text JSX container.
|
|
1686
|
-
*/
|
|
1687
|
-
var TypingText = (props) => {
|
|
1688
|
-
const min = props.interval ?? 62;
|
|
1689
|
-
const rewind = props.rewind ?? false;
|
|
1690
|
-
const rewindDelay = props.rewindDelay ?? 500;
|
|
1691
|
-
const content = props.children;
|
|
1692
|
-
const disabled = createMemo(() => props.disabled ? props.disabled() : false, false);
|
|
1693
|
-
const { text, type, setText } = createTyping({
|
|
1694
|
-
content,
|
|
1695
|
-
min,
|
|
1696
|
-
rewind,
|
|
1697
|
-
rewindDelay
|
|
1698
|
-
});
|
|
1699
|
-
createEffect(on(disabled, () => setText("")));
|
|
1700
|
-
createEffect(() => {
|
|
1701
|
-
if (disabled()) setText(content);
|
|
1702
|
-
else type();
|
|
1703
|
-
});
|
|
1704
|
-
return ssr(_tmpl$$4, ssrHydrationKey() + ssrAttribute("class", escape(props.class, true), false), escape(text()));
|
|
1705
|
-
};
|
|
1706
|
-
//#endregion
|
|
1707
|
-
//#region src/ui/globals/components/molecules/FadingDots.tsx
|
|
1708
|
-
var _tmpl$$3 = [
|
|
1709
|
-
"<div",
|
|
1710
|
-
" class=\"mt-4 flex items-center justify-center space-x-4\">",
|
|
1711
|
-
"</div>"
|
|
1712
|
-
];
|
|
1713
|
-
/**
|
|
1714
|
-
* Loading animation component displaying animated pulsing dots.
|
|
1715
|
-
*
|
|
1716
|
-
* @param props - Fading dots configuration properties.
|
|
1717
|
-
* @param props.count - The number of dots to display.
|
|
1718
|
-
* @param props.duration - Animation duration in milliseconds. Defaults to 500.
|
|
1719
|
-
* @param props.innerProps - Additional properties and CSS styles applied to dot
|
|
1720
|
-
* elements.
|
|
1721
|
-
*
|
|
1722
|
-
* @returns Rendered animated dots container JSX element.
|
|
1723
|
-
*/
|
|
1724
|
-
var FadingDots = ({ count: length, innerProps = {}, duration = 500 }) => {
|
|
1725
|
-
const [local, rest] = splitProps(innerProps, ["class", "style"]);
|
|
1726
|
-
return ssr(_tmpl$$3, ssrHydrationKey(), escape(Array.from({ length }, (_, i) => ssrElement("span", mergeProps({
|
|
1727
|
-
get ["class"]() {
|
|
1728
|
-
return cn("rounded-full animate-out direction-alternate repeat-infinite fade-out-5 size-4 bg-gray-600", local.class);
|
|
1729
|
-
},
|
|
1730
|
-
get style() {
|
|
1731
|
-
return {
|
|
1732
|
-
...local.style,
|
|
1733
|
-
"animation-duration": `${duration}ms`,
|
|
1734
|
-
"animation-delay": `${duration / i}ms`
|
|
1735
|
-
};
|
|
1736
|
-
},
|
|
1737
|
-
"aria-hidden": "true"
|
|
1738
|
-
}, rest), void 0, true))));
|
|
1739
|
-
};
|
|
1740
|
-
//#endregion
|
|
1741
|
-
//#region src/ui/globals/components/organisms/LoadingFallback.tsx
|
|
1742
|
-
var _tmpl$$2 = [
|
|
1743
|
-
"<div",
|
|
1744
|
-
" role=\"status\" aria-live=\"polite\" aria-label=\"Chargement en cours\"><div class=\"relative\"><div",
|
|
1745
|
-
" aria-hidden=\"true\"></div><div",
|
|
1746
|
-
" aria-hidden=\"true\"></div></div><div class=\"text-center\"",
|
|
1747
|
-
"><!--$-->",
|
|
1748
|
-
"<!--/--><!--$-->",
|
|
1749
|
-
"<!--/--></div></div>"
|
|
1750
|
-
];
|
|
1751
|
-
/**
|
|
1752
|
-
* Fallback loading screen component displaying an animated spinner and typewriter
|
|
1753
|
-
* text.
|
|
1754
|
-
*
|
|
1755
|
-
* @example
|
|
1756
|
-
* ```tsx
|
|
1757
|
-
* <Show when={data()} fallback={<LoadingFallback />}>
|
|
1758
|
-
* <DataComponent data={data()!} />
|
|
1759
|
-
* </Show>;
|
|
1760
|
-
* ```;
|
|
1761
|
-
*
|
|
1762
|
-
* @param props - Loading fallback properties of type
|
|
1763
|
-
* {@linkcode LoadingFallbackProps}.
|
|
1764
|
-
*
|
|
1765
|
-
* @returns Rendered full-screen loading fallback JSX element.
|
|
1766
|
-
*/
|
|
1767
|
-
var LoadingFallback = (props) => {
|
|
1768
|
-
const message = props.message ?? "Chargement en cours...";
|
|
1769
|
-
const spinnerSizes = {
|
|
1770
|
-
sm: "w-8 h-8",
|
|
1771
|
-
md: "w-12 h-12",
|
|
1772
|
-
lg: "w-16 h-16",
|
|
1773
|
-
xl: "w-24 h-24"
|
|
1774
|
-
};
|
|
1775
|
-
const size = props.size ?? "lg";
|
|
1776
|
-
return ssr(_tmpl$$2, ssrHydrationKey() + ssrAttribute("class", escape(cn("flex flex-col items-center justify-center gap-6", "h-screen w-screen overflow-hidden p-4", props.class), true), false), ssrAttribute("class", escape(cn(spinnerSizes[size], "rounded-full border-4 border-[#4B9CAD]/20", "animate-spin", "border-t-[#4B9CAD]"), true), false), ssrAttribute("class", escape(cn("absolute inset-2", "rounded-full border-4 border-transparent", "border-b-[#4B9CAD]/40", "animate-spin", "animation-duration-[1.5s]", "direction-[reverse]"), true), false), ssrAttribute("aria-label", escape(message, true), false), escape(createComponent(TypingText, {
|
|
1777
|
-
"class": "text-lg font-medium text-gray-700 md:text-xl dark:text-gray-300",
|
|
1778
|
-
get interval() {
|
|
1779
|
-
return props.interval ?? 80;
|
|
1780
|
-
},
|
|
1781
|
-
get rewind() {
|
|
1782
|
-
return props.rewind ?? true;
|
|
1783
|
-
},
|
|
1784
|
-
get rewindDelay() {
|
|
1785
|
-
return props.rewindDelay ?? 2e3;
|
|
1786
|
-
},
|
|
1787
|
-
children: message
|
|
1788
|
-
})), escape(createComponent(FadingDots, {
|
|
1789
|
-
count: 5,
|
|
1790
|
-
innerProps: { class: "bg-[#3d8091]" }
|
|
1791
|
-
})));
|
|
1792
|
-
};
|
|
1793
|
-
//#endregion
|
|
1794
1606
|
//#region src/ui/Flow.tsx
|
|
1795
1607
|
var _tmpl$$1 = [
|
|
1796
1608
|
"<div",
|
|
@@ -1798,47 +1610,24 @@ var _tmpl$$1 = [
|
|
|
1798
1610
|
"\" class=\"relative flex h-full w-full rounded-lg border-2 border-gray-600 bg-white bg-size-[30px_30px]\">",
|
|
1799
1611
|
"</div>"
|
|
1800
1612
|
];
|
|
1801
|
-
var _tmpl$2$1 = [
|
|
1802
|
-
"<div",
|
|
1803
|
-
" class=\"relative flex flex-1 items-center justify-center\">",
|
|
1804
|
-
"</div>"
|
|
1805
|
-
];
|
|
1806
1613
|
/**
|
|
1807
1614
|
* Root Flow component wrapping the {@linkcode FlowChart} inside the flow context
|
|
1808
1615
|
* provider.
|
|
1809
1616
|
*
|
|
1810
|
-
* @template | {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
1811
|
-
* {@linkcode NodeData}.
|
|
1617
|
+
* @template | Type {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
1618
|
+
* extending type {@linkcode NodeData}.
|
|
1812
1619
|
*
|
|
1813
1620
|
* @param props - Flow chart configuration and callbacks of type
|
|
1814
1621
|
* {@linkcode FlowProps}.
|
|
1815
1622
|
*
|
|
1816
1623
|
* @returns The rendered Solid component.
|
|
1817
1624
|
*
|
|
1818
|
-
* @see {@linkcode Provider}
|
|
1625
|
+
* @see {@linkcode Provider}
|
|
1819
1626
|
*/
|
|
1820
1627
|
var Flow = (props) => {
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
get when() {
|
|
1825
|
-
return isMounted();
|
|
1826
|
-
},
|
|
1827
|
-
keyed: true,
|
|
1828
|
-
get fallback() {
|
|
1829
|
-
return ssr(_tmpl$2$1, ssrHydrationKey(), escape(createComponent(LoadingFallback, {
|
|
1830
|
-
message: "Chart is loading...",
|
|
1831
|
-
interval: 35,
|
|
1832
|
-
rewind: true,
|
|
1833
|
-
rewindDelay: 1e3
|
|
1834
|
-
})));
|
|
1835
|
-
},
|
|
1836
|
-
get children() {
|
|
1837
|
-
return createComponent(Provider, { get children() {
|
|
1838
|
-
return createComponent(FlowChart, props);
|
|
1839
|
-
} });
|
|
1840
|
-
}
|
|
1841
|
-
})));
|
|
1628
|
+
return ssr(_tmpl$$1, ssrHydrationKey(), ssrStyleProperty("background-image:", "radial-gradient(circle, #b8b8b8bf 1px, rgba(0, 0, 0, 0) 1px)"), escape(createComponent(Provider, { get children() {
|
|
1629
|
+
return createComponent(FlowChart, props);
|
|
1630
|
+
} })));
|
|
1842
1631
|
};
|
|
1843
1632
|
//#endregion
|
|
1844
1633
|
//#region src/ui/globals/directives/clickOutside.ts
|
package/lib/ui/Flow.d.ts
CHANGED
|
@@ -5,15 +5,15 @@ import { FlowProps } from './components/FlowChart.types';
|
|
|
5
5
|
* Root Flow component wrapping the {@linkcode FlowChart} inside the flow context
|
|
6
6
|
* provider.
|
|
7
7
|
*
|
|
8
|
-
* @template | {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
9
|
-
* {@linkcode NodeData}.
|
|
8
|
+
* @template | Type {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
9
|
+
* extending type {@linkcode NodeData}.
|
|
10
10
|
*
|
|
11
11
|
* @param props - Flow chart configuration and callbacks of type
|
|
12
12
|
* {@linkcode FlowProps}.
|
|
13
13
|
*
|
|
14
14
|
* @returns The rendered Solid component.
|
|
15
15
|
*
|
|
16
|
-
* @see {@linkcode Provider}
|
|
16
|
+
* @see {@linkcode Provider}
|
|
17
17
|
*/
|
|
18
18
|
export declare const Flow: <D extends NodeData = NodeData>(props: FlowProps<D>) => JSX.Element;
|
|
19
19
|
//# sourceMappingURL=Flow.d.ts.map
|
package/lib/ui/Flow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flow.d.ts","sourceRoot":"","sources":["../../src/ui/Flow.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Flow.d.ts","sourceRoot":"","sources":["../../src/ui/Flow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAGjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAChD,OAAO,SAAS,CAAC,CAAC,CAAC,KAClB,GAAG,CAAC,OAeN,CAAC"}
|
|
@@ -15,8 +15,8 @@ export type FlowPanels = {
|
|
|
15
15
|
* Configuration options and callback handlers for the {@linkcode FlowChart}
|
|
16
16
|
* component.
|
|
17
17
|
*
|
|
18
|
-
* @template | {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
19
|
-
* {@linkcode NodeData}.
|
|
18
|
+
* @template | Type {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
19
|
+
* extending type {@linkcode NodeData}.
|
|
20
20
|
*/
|
|
21
21
|
export type FlowProps<D extends NodeData = NodeData> = {
|
|
22
22
|
/** Optional delay in milliseconds before mounting the flowchart canvas. */
|
|
@@ -64,24 +64,24 @@ export type FlowProps<D extends NodeData = NodeData> = {
|
|
|
64
64
|
/**
|
|
65
65
|
* Type alias extracting the non-undefined flowchart configuration object.
|
|
66
66
|
*
|
|
67
|
-
* @template | {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
68
|
-
* {@linkcode NodeData}.
|
|
67
|
+
* @template | Type {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
68
|
+
* extending type {@linkcode NodeData}.
|
|
69
69
|
*/
|
|
70
70
|
export type ConfigFrom<D extends NodeData = NodeData> = NotUndefined<FlowProps<D>['config']>;
|
|
71
71
|
/**
|
|
72
72
|
* Type alias extracting the non-undefined list of nodes from flowchart
|
|
73
73
|
* configuration.
|
|
74
74
|
*
|
|
75
|
-
* @template | {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
76
|
-
* {@linkcode NodeData}.
|
|
75
|
+
* @template | Type {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
76
|
+
* extending type {@linkcode NodeData}.
|
|
77
77
|
*/
|
|
78
78
|
export type NodesFrom<D extends NodeData> = NotUndefined<ConfigFrom<D>['nodes']>;
|
|
79
79
|
/**
|
|
80
80
|
* Type alias extracting the non-undefined list of edges from flowchart
|
|
81
81
|
* configuration.
|
|
82
82
|
*
|
|
83
|
-
* @template | {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
84
|
-
* {@linkcode NodeData}.
|
|
83
|
+
* @template | Type {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
84
|
+
* extending type {@linkcode NodeData}.
|
|
85
85
|
*/
|
|
86
86
|
export type EdgesFrom<D extends NodeData> = NotUndefined<ConfigFrom<D>['edges']>;
|
|
87
87
|
//# sourceMappingURL=FlowChart.types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemedev/mind-flow",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Flow Chart UI library for Solid.js applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"diagram",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@bemedev/app": "^2.5.0",
|
|
66
66
|
"@bemedev/app-cli": "^2.5.0",
|
|
67
67
|
"@bemedev/app-solidjs": "^2.5.1",
|
|
68
|
-
"@bemedev/dev-utils": "^1.
|
|
68
|
+
"@bemedev/dev-utils": "^1.5.0",
|
|
69
69
|
"@rollup/plugin-babel": "^7.1.0",
|
|
70
70
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
71
71
|
"@size-limit/file": "^13.0.3",
|
package/src/ui/Flow.tsx
CHANGED
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {} from 'solid-js/web';
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
3
2
|
|
|
4
3
|
import type { NodeData } from '../services/main.machine.typings';
|
|
5
4
|
import { FlowChart } from './components/FlowChart';
|
|
6
5
|
import { Provider } from './components/FlowChart.context';
|
|
7
6
|
import type { FlowProps } from './components/FlowChart.types';
|
|
8
|
-
import { LoadingFallback } from './globals/components/organisms/LoadingFallback';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* Root Flow component wrapping the {@linkcode FlowChart} inside the flow context
|
|
12
10
|
* provider.
|
|
13
11
|
*
|
|
14
|
-
* @template | {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
15
|
-
* {@linkcode NodeData}.
|
|
12
|
+
* @template | Type {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
13
|
+
* extending type {@linkcode NodeData}.
|
|
16
14
|
*
|
|
17
15
|
* @param props - Flow chart configuration and callbacks of type
|
|
18
16
|
* {@linkcode FlowProps}.
|
|
19
17
|
*
|
|
20
18
|
* @returns The rendered Solid component.
|
|
21
19
|
*
|
|
22
|
-
* @see {@linkcode Provider}
|
|
20
|
+
* @see {@linkcode Provider}
|
|
23
21
|
*/
|
|
24
22
|
export const Flow = <D extends NodeData = NodeData>(
|
|
25
23
|
props: FlowProps<D>,
|
|
26
24
|
): JSX.Element => {
|
|
27
|
-
const [isMounted, setIsMounted] = createSignal(false);
|
|
28
|
-
|
|
29
|
-
// onMount never runs on the server, only in the browser
|
|
30
|
-
onMount(() => setTimeout(() => setIsMounted(true), props.delay));
|
|
31
25
|
return (
|
|
32
26
|
<div
|
|
33
27
|
style={{
|
|
@@ -37,24 +31,9 @@ export const Flow = <D extends NodeData = NodeData>(
|
|
|
37
31
|
|
|
38
32
|
class='relative flex h-full w-full rounded-lg border-2 border-gray-600 bg-white bg-size-[30px_30px]'
|
|
39
33
|
>
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
fallback={
|
|
44
|
-
<div class='relative flex flex-1 items-center justify-center'>
|
|
45
|
-
<LoadingFallback
|
|
46
|
-
message='Chart is loading...'
|
|
47
|
-
interval={35}
|
|
48
|
-
rewind
|
|
49
|
-
rewindDelay={1_000}
|
|
50
|
-
/>
|
|
51
|
-
</div>
|
|
52
|
-
}
|
|
53
|
-
>
|
|
54
|
-
<Provider>
|
|
55
|
-
<FlowChart {...props} />
|
|
56
|
-
</Provider>
|
|
57
|
-
</Show>
|
|
34
|
+
<Provider>
|
|
35
|
+
<FlowChart {...props} />
|
|
36
|
+
</Provider>
|
|
58
37
|
</div>
|
|
59
38
|
);
|
|
60
39
|
};
|
|
@@ -19,8 +19,8 @@ export type FlowPanels = {
|
|
|
19
19
|
* Configuration options and callback handlers for the {@linkcode FlowChart}
|
|
20
20
|
* component.
|
|
21
21
|
*
|
|
22
|
-
* @template | {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
23
|
-
* {@linkcode NodeData}.
|
|
22
|
+
* @template | Type {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
23
|
+
* extending type {@linkcode NodeData}.
|
|
24
24
|
*/
|
|
25
25
|
export type FlowProps<D extends NodeData = NodeData> = {
|
|
26
26
|
/** Optional delay in milliseconds before mounting the flowchart canvas. */
|
|
@@ -66,8 +66,8 @@ export type FlowProps<D extends NodeData = NodeData> = {
|
|
|
66
66
|
/**
|
|
67
67
|
* Type alias extracting the non-undefined flowchart configuration object.
|
|
68
68
|
*
|
|
69
|
-
* @template | {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
70
|
-
* {@linkcode NodeData}.
|
|
69
|
+
* @template | Type {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
70
|
+
* extending type {@linkcode NodeData}.
|
|
71
71
|
*/
|
|
72
72
|
export type ConfigFrom<D extends NodeData = NodeData> = NotUndefined<
|
|
73
73
|
FlowProps<D>['config']
|
|
@@ -77,8 +77,8 @@ export type ConfigFrom<D extends NodeData = NodeData> = NotUndefined<
|
|
|
77
77
|
* Type alias extracting the non-undefined list of nodes from flowchart
|
|
78
78
|
* configuration.
|
|
79
79
|
*
|
|
80
|
-
* @template | {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
81
|
-
* {@linkcode NodeData}.
|
|
80
|
+
* @template | Type {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
81
|
+
* extending type {@linkcode NodeData}.
|
|
82
82
|
*/
|
|
83
83
|
export type NodesFrom<D extends NodeData> = NotUndefined<ConfigFrom<D>['nodes']>;
|
|
84
84
|
|
|
@@ -86,7 +86,7 @@ export type NodesFrom<D extends NodeData> = NotUndefined<ConfigFrom<D>['nodes']>
|
|
|
86
86
|
* Type alias extracting the non-undefined list of edges from flowchart
|
|
87
87
|
* configuration.
|
|
88
88
|
*
|
|
89
|
-
* @template | {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
90
|
-
* {@linkcode NodeData}.
|
|
89
|
+
* @template | Type {@linkcode NodeData} `D` - Custom node data dictionary type
|
|
90
|
+
* extending type {@linkcode NodeData}.
|
|
91
91
|
*/
|
|
92
92
|
export type EdgesFrom<D extends NodeData> = NotUndefined<ConfigFrom<D>['edges']>;
|