@ultrst-armada/floks 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/package.json +13 -9
- package/packages/canvas-ui/dist/chunk-QRYNQ36L.js +123 -0
- package/packages/canvas-ui/dist/{chunk-OOTTFWXA.js → chunk-RH5NINIT.js} +1 -122
- package/packages/canvas-ui/dist/chunk-VESG3VP3.js +1522 -0
- package/packages/canvas-ui/dist/frnl-editable-node-graph/index.d.ts +110 -0
- package/packages/canvas-ui/dist/frnl-editable-node-graph/index.js +9 -0
- package/packages/canvas-ui/dist/index.d.ts +13 -2
- package/packages/canvas-ui/dist/index.js +63 -485
- package/packages/canvas-ui/dist/predictive/index.js +4 -2
- package/packages/canvas-ui/floks.manifest.json +25 -4
- package/packages/canvas-ui/package.json +11 -7
- package/packages/contracts/dist/index.js +2 -2
- package/packages/ui/dist/chunk-2SD6BIUX.js +0 -0
- package/packages/ui/dist/chunk-DGZBP3ND.js +832 -0
- package/packages/ui/dist/{chunk-2SFOC7KZ.js → chunk-KQAFKNQH.js} +77 -67
- package/packages/ui/dist/chunk-PH4NEHWR.js +99 -0
- package/packages/ui/dist/chunk-PRMOURNW.js +324 -0
- package/packages/ui/dist/{chunk-KYFSUQVT.js → chunk-SXRIBCJX.js} +124 -110
- package/packages/ui/dist/chunk-X4B3EBMY.js +22 -0
- package/packages/ui/dist/{chunk-DT6DZU63.js → chunk-X67KXI3H.js} +190 -152
- package/packages/ui/dist/chunk-YVWJ4SW7.js +394 -0
- package/packages/ui/dist/components/auth/index.d.ts +56 -14
- package/packages/ui/dist/components/auth/index.js +12 -3
- package/packages/ui/dist/components/graph/index.d.ts +29 -0
- package/packages/ui/dist/components/graph/index.js +10 -0
- package/packages/ui/dist/components/settings/index.js +2 -2
- package/packages/ui/dist/components/tiles/index.d.ts +83 -0
- package/packages/ui/dist/components/tiles/index.js +10 -0
- package/packages/ui/dist/components/workspace/index.d.ts +108 -33
- package/packages/ui/dist/components/workspace/index.js +15 -3
- package/packages/ui/dist/frnl/index.css +183 -0
- package/packages/ui/dist/frnl/index.d.ts +555 -0
- package/packages/ui/dist/frnl/index.js +48 -0
- package/packages/ui/dist/frnl/store.d.ts +29 -0
- package/packages/ui/dist/frnl/store.js +12 -0
- package/packages/ui/dist/hierarchy/index.d.ts +15 -51
- package/packages/ui/dist/hierarchy/index.js +6 -19
- package/packages/ui/dist/index.d.ts +9 -4
- package/packages/ui/dist/index.js +101 -46
- package/packages/ui/floks.manifest.json +99 -17
- package/packages/ui/package.json +24 -2
- package/packages/ui/dist/{chunk-ROILFUZW.js → chunk-ZPQC46RO.js} +3 -3
package/README.md
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
# Floks
|
|
2
2
|
This will be the counterpart Kloks but for the frontend components. This will store the canonical frontend elements that we will use in our Skipo projects.
|
|
3
|
+
|
|
4
|
+
## FrnlTS architecture
|
|
5
|
+
|
|
6
|
+
Floks is the canonical concrete frontend element library built on FrnlTS. FrnlTS provides the semantic UI runtime; Floks provides concrete reusable elements and their visual behavior.
|
|
7
|
+
|
|
8
|
+
- UI Primitive: use for atomic elements such as a simple Button.
|
|
9
|
+
- UI Composite: use when an element requires multiple semantic children, Slots, coordinated state, or Flows. Complex Button variants may therefore be composites.
|
|
10
|
+
- Shared runtime: Floks UI assets use the canonical FrnlTS Zustand store and Frnl semantic boundaries.
|
|
11
|
+
|
|
12
|
+
FrnlTS is consumed as the published @dinilmusick/frnlts package. Floks owns the concrete UI vocabulary; FrnlTS owns the semantic model.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultrst-armada/floks",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -61,21 +61,25 @@
|
|
|
61
61
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
65
|
+
"@testing-library/react": "^16.3.3",
|
|
64
66
|
"@types/node": "^22.0.0",
|
|
65
67
|
"@types/react": "^19.0.0",
|
|
66
68
|
"@types/react-dom": "^19.0.0",
|
|
67
|
-
"@ultrst-armada/kloks": "^1.4.
|
|
69
|
+
"@ultrst-armada/kloks": "^1.4.4",
|
|
70
|
+
"@ultrst-armada/frnlts": "^0.2.4",
|
|
71
|
+
"happy-dom": "^21.0.3",
|
|
68
72
|
"lucide-react": "^1.55.0",
|
|
69
73
|
"react": "^19.0.1",
|
|
70
74
|
"react-dom": "^19.0.1",
|
|
71
75
|
"tsup": "^8.4.0",
|
|
72
76
|
"typescript": "^5.7.3",
|
|
73
|
-
"vitest": "^3.1.0"
|
|
77
|
+
"vitest": "^3.1.0",
|
|
78
|
+
"zustand": "^5.0.3"
|
|
74
79
|
},
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
"packageManager": "pnpm@9.15.0"
|
|
80
|
+
"packageManager": "pnpm@9.15.0",
|
|
81
|
+
"repository": {
|
|
82
|
+
"type": "git",
|
|
83
|
+
"url": "git+https://github.com/dinilmusick/Floks.git"
|
|
84
|
+
}
|
|
81
85
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// src/predictive/usePredictiveGraph2D.ts
|
|
2
|
+
import { useState, useEffect, useMemo, useCallback } from "react";
|
|
3
|
+
import { computePredictiveGraph } from "@ultrst-armada/kloks/state-graph";
|
|
4
|
+
function usePredictiveGraph2D({
|
|
5
|
+
nodes,
|
|
6
|
+
connections,
|
|
7
|
+
selectedNodeId,
|
|
8
|
+
selectedNodeIds = [],
|
|
9
|
+
onSolidifyPredictiveNodes
|
|
10
|
+
}) {
|
|
11
|
+
const [isActive, setIsActive] = useState(false);
|
|
12
|
+
const [scenarioIndex, setScenarioIndex] = useState(0);
|
|
13
|
+
const targetNodes = useMemo(() => {
|
|
14
|
+
const idSet = new Set(selectedNodeIds || []);
|
|
15
|
+
if (selectedNodeId) idSet.add(selectedNodeId);
|
|
16
|
+
return nodes.filter((n) => idSet.has(n.id));
|
|
17
|
+
}, [nodes, selectedNodeId, selectedNodeIds]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (targetNodes.length === 0 && isActive) {
|
|
20
|
+
setIsActive(false);
|
|
21
|
+
setScenarioIndex(0);
|
|
22
|
+
}
|
|
23
|
+
}, [targetNodes.length, isActive]);
|
|
24
|
+
const { ghostNodes, traces, selectedNodesWithGhosts } = useMemo(() => {
|
|
25
|
+
if (!isActive || targetNodes.length === 0) {
|
|
26
|
+
return {
|
|
27
|
+
ghostNodes: [],
|
|
28
|
+
traces: [],
|
|
29
|
+
selectedNodesWithGhosts: /* @__PURE__ */ new Map()
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return computePredictiveGraph(targetNodes, connections, scenarioIndex);
|
|
33
|
+
}, [isActive, targetNodes, connections, scenarioIndex]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const handleKeyDown = (e) => {
|
|
36
|
+
const activeEl = document.activeElement;
|
|
37
|
+
if (activeEl && ["INPUT", "TEXTAREA", "SELECT"].includes(activeEl.tagName)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const isExplicitToggleKey = (e.ctrlKey || e.metaKey || e.altKey) && ["Tab", "p", "P", "g", "G"].includes(e.key) || ["p", "P", "g", "G", "`", "~"].includes(e.key);
|
|
41
|
+
if (!isActive && targetNodes.length > 0 && (e.key === "Tab" || isExplicitToggleKey)) {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
e.stopPropagation();
|
|
44
|
+
setIsActive(true);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (isActive && isExplicitToggleKey) {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
setIsActive((prev) => !prev);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (isActive && e.key === "Tab") {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
if (e.shiftKey) {
|
|
57
|
+
setScenarioIndex((i) => i <= 0 ? 12 : i - 1);
|
|
58
|
+
} else {
|
|
59
|
+
setScenarioIndex((i) => i + 1);
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (isActive && e.key === "Escape") {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
setIsActive(false);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
window.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
69
|
+
return () => {
|
|
70
|
+
window.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
71
|
+
};
|
|
72
|
+
}, [isActive, targetNodes.length]);
|
|
73
|
+
const toggleActive = useCallback(() => {
|
|
74
|
+
if (targetNodes.length > 0) {
|
|
75
|
+
setIsActive((prev) => !prev);
|
|
76
|
+
}
|
|
77
|
+
}, [targetNodes.length]);
|
|
78
|
+
const nextScenario = useCallback(() => {
|
|
79
|
+
setScenarioIndex((i) => i + 1);
|
|
80
|
+
}, []);
|
|
81
|
+
const prevScenario = useCallback(() => {
|
|
82
|
+
setScenarioIndex((i) => i <= 0 ? 12 : i - 1);
|
|
83
|
+
}, []);
|
|
84
|
+
const solidifyGhost = useCallback(
|
|
85
|
+
(ghost) => {
|
|
86
|
+
onSolidifyPredictiveNodes?.([ghost]);
|
|
87
|
+
},
|
|
88
|
+
[onSolidifyPredictiveNodes]
|
|
89
|
+
);
|
|
90
|
+
const solidifyAllForNode = useCallback(
|
|
91
|
+
(parentNodeId) => {
|
|
92
|
+
const ghosts = selectedNodesWithGhosts.get(parentNodeId);
|
|
93
|
+
if (ghosts && ghosts.length > 0) {
|
|
94
|
+
onSolidifyPredictiveNodes?.(ghosts);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
[selectedNodesWithGhosts, onSolidifyPredictiveNodes]
|
|
98
|
+
);
|
|
99
|
+
const solidifyAll = useCallback(() => {
|
|
100
|
+
if (ghostNodes.length > 0) {
|
|
101
|
+
onSolidifyPredictiveNodes?.(ghostNodes);
|
|
102
|
+
}
|
|
103
|
+
}, [ghostNodes, onSolidifyPredictiveNodes]);
|
|
104
|
+
return {
|
|
105
|
+
isActive,
|
|
106
|
+
scenarioIndex,
|
|
107
|
+
targetNodes,
|
|
108
|
+
ghostNodes,
|
|
109
|
+
traces,
|
|
110
|
+
selectedNodesWithGhosts,
|
|
111
|
+
toggleActive,
|
|
112
|
+
nextScenario,
|
|
113
|
+
prevScenario,
|
|
114
|
+
solidifyGhost,
|
|
115
|
+
solidifyAllForNode,
|
|
116
|
+
solidifyAll,
|
|
117
|
+
close: () => setIsActive(false)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export {
|
|
122
|
+
usePredictiveGraph2D
|
|
123
|
+
};
|
|
@@ -380,129 +380,8 @@ var PredictiveLayer2D = ({
|
|
|
380
380
|
] });
|
|
381
381
|
};
|
|
382
382
|
|
|
383
|
-
// src/predictive/usePredictiveGraph2D.ts
|
|
384
|
-
import { useState as useState2, useEffect, useMemo, useCallback } from "react";
|
|
385
|
-
import { computePredictiveGraph } from "@ultrst-armada/kloks/state-graph";
|
|
386
|
-
function usePredictiveGraph2D({
|
|
387
|
-
nodes,
|
|
388
|
-
connections,
|
|
389
|
-
selectedNodeId,
|
|
390
|
-
selectedNodeIds = [],
|
|
391
|
-
onSolidifyPredictiveNodes
|
|
392
|
-
}) {
|
|
393
|
-
const [isActive, setIsActive] = useState2(false);
|
|
394
|
-
const [scenarioIndex, setScenarioIndex] = useState2(0);
|
|
395
|
-
const targetNodes = useMemo(() => {
|
|
396
|
-
const idSet = new Set(selectedNodeIds || []);
|
|
397
|
-
if (selectedNodeId) idSet.add(selectedNodeId);
|
|
398
|
-
return nodes.filter((n) => idSet.has(n.id));
|
|
399
|
-
}, [nodes, selectedNodeId, selectedNodeIds]);
|
|
400
|
-
useEffect(() => {
|
|
401
|
-
if (targetNodes.length === 0 && isActive) {
|
|
402
|
-
setIsActive(false);
|
|
403
|
-
setScenarioIndex(0);
|
|
404
|
-
}
|
|
405
|
-
}, [targetNodes.length, isActive]);
|
|
406
|
-
const { ghostNodes, traces, selectedNodesWithGhosts } = useMemo(() => {
|
|
407
|
-
if (!isActive || targetNodes.length === 0) {
|
|
408
|
-
return {
|
|
409
|
-
ghostNodes: [],
|
|
410
|
-
traces: [],
|
|
411
|
-
selectedNodesWithGhosts: /* @__PURE__ */ new Map()
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
return computePredictiveGraph(targetNodes, connections, scenarioIndex);
|
|
415
|
-
}, [isActive, targetNodes, connections, scenarioIndex]);
|
|
416
|
-
useEffect(() => {
|
|
417
|
-
const handleKeyDown = (e) => {
|
|
418
|
-
const activeEl = document.activeElement;
|
|
419
|
-
if (activeEl && ["INPUT", "TEXTAREA", "SELECT"].includes(activeEl.tagName)) {
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
const isExplicitToggleKey = (e.ctrlKey || e.metaKey || e.altKey) && ["Tab", "p", "P", "g", "G"].includes(e.key) || ["p", "P", "g", "G", "`", "~"].includes(e.key);
|
|
423
|
-
if (!isActive && targetNodes.length > 0 && (e.key === "Tab" || isExplicitToggleKey)) {
|
|
424
|
-
e.preventDefault();
|
|
425
|
-
e.stopPropagation();
|
|
426
|
-
setIsActive(true);
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
if (isActive && isExplicitToggleKey) {
|
|
430
|
-
e.preventDefault();
|
|
431
|
-
e.stopPropagation();
|
|
432
|
-
setIsActive((prev) => !prev);
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
if (isActive && e.key === "Tab") {
|
|
436
|
-
e.preventDefault();
|
|
437
|
-
e.stopPropagation();
|
|
438
|
-
if (e.shiftKey) {
|
|
439
|
-
setScenarioIndex((i) => i <= 0 ? 12 : i - 1);
|
|
440
|
-
} else {
|
|
441
|
-
setScenarioIndex((i) => i + 1);
|
|
442
|
-
}
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
if (isActive && e.key === "Escape") {
|
|
446
|
-
e.preventDefault();
|
|
447
|
-
setIsActive(false);
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
window.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
451
|
-
return () => {
|
|
452
|
-
window.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
453
|
-
};
|
|
454
|
-
}, [isActive, targetNodes.length]);
|
|
455
|
-
const toggleActive = useCallback(() => {
|
|
456
|
-
if (targetNodes.length > 0) {
|
|
457
|
-
setIsActive((prev) => !prev);
|
|
458
|
-
}
|
|
459
|
-
}, [targetNodes.length]);
|
|
460
|
-
const nextScenario = useCallback(() => {
|
|
461
|
-
setScenarioIndex((i) => i + 1);
|
|
462
|
-
}, []);
|
|
463
|
-
const prevScenario = useCallback(() => {
|
|
464
|
-
setScenarioIndex((i) => i <= 0 ? 12 : i - 1);
|
|
465
|
-
}, []);
|
|
466
|
-
const solidifyGhost = useCallback(
|
|
467
|
-
(ghost) => {
|
|
468
|
-
onSolidifyPredictiveNodes?.([ghost]);
|
|
469
|
-
},
|
|
470
|
-
[onSolidifyPredictiveNodes]
|
|
471
|
-
);
|
|
472
|
-
const solidifyAllForNode = useCallback(
|
|
473
|
-
(parentNodeId) => {
|
|
474
|
-
const ghosts = selectedNodesWithGhosts.get(parentNodeId);
|
|
475
|
-
if (ghosts && ghosts.length > 0) {
|
|
476
|
-
onSolidifyPredictiveNodes?.(ghosts);
|
|
477
|
-
}
|
|
478
|
-
},
|
|
479
|
-
[selectedNodesWithGhosts, onSolidifyPredictiveNodes]
|
|
480
|
-
);
|
|
481
|
-
const solidifyAll = useCallback(() => {
|
|
482
|
-
if (ghostNodes.length > 0) {
|
|
483
|
-
onSolidifyPredictiveNodes?.(ghostNodes);
|
|
484
|
-
}
|
|
485
|
-
}, [ghostNodes, onSolidifyPredictiveNodes]);
|
|
486
|
-
return {
|
|
487
|
-
isActive,
|
|
488
|
-
scenarioIndex,
|
|
489
|
-
targetNodes,
|
|
490
|
-
ghostNodes,
|
|
491
|
-
traces,
|
|
492
|
-
selectedNodesWithGhosts,
|
|
493
|
-
toggleActive,
|
|
494
|
-
nextScenario,
|
|
495
|
-
prevScenario,
|
|
496
|
-
solidifyGhost,
|
|
497
|
-
solidifyAllForNode,
|
|
498
|
-
solidifyAll,
|
|
499
|
-
close: () => setIsActive(false)
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
|
|
503
383
|
export {
|
|
504
384
|
PredictiveGhostNodeCard,
|
|
505
385
|
PredictiveHudToolbar,
|
|
506
|
-
PredictiveLayer2D
|
|
507
|
-
usePredictiveGraph2D
|
|
386
|
+
PredictiveLayer2D
|
|
508
387
|
};
|