@ultrst-armada/floks 1.2.5 → 1.2.7

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.
Files changed (38) hide show
  1. package/package.json +13 -11
  2. package/packages/canvas-ui/dist/chunk-QRYNQ36L.js +123 -0
  3. package/packages/canvas-ui/dist/{chunk-OOTTFWXA.js → chunk-RH5NINIT.js} +1 -122
  4. package/packages/canvas-ui/dist/chunk-VESG3VP3.js +1522 -0
  5. package/packages/canvas-ui/dist/frnl-editable-node-graph/index.d.ts +110 -0
  6. package/packages/canvas-ui/dist/frnl-editable-node-graph/index.js +9 -0
  7. package/packages/canvas-ui/dist/index.d.ts +13 -2
  8. package/packages/canvas-ui/dist/index.js +62 -484
  9. package/packages/canvas-ui/dist/predictive/index.js +4 -2
  10. package/packages/canvas-ui/floks.manifest.json +25 -4
  11. package/packages/canvas-ui/package.json +11 -7
  12. package/packages/ui/dist/chunk-2SD6BIUX.js +0 -0
  13. package/packages/ui/dist/{chunk-YDOKOBRJ.js → chunk-DGZBP3ND.js} +106 -491
  14. package/packages/ui/dist/{chunk-2SFOC7KZ.js → chunk-KQAFKNQH.js} +77 -67
  15. package/packages/ui/dist/chunk-PH4NEHWR.js +99 -0
  16. package/packages/ui/dist/chunk-TKGKVCB7.js +323 -0
  17. package/packages/ui/dist/{chunk-DT6DZU63.js → chunk-X67KXI3H.js} +190 -152
  18. package/packages/ui/dist/chunk-YVWJ4SW7.js +394 -0
  19. package/packages/ui/dist/components/auth/index.d.ts +56 -14
  20. package/packages/ui/dist/components/auth/index.js +12 -3
  21. package/packages/ui/dist/components/composite/index.js +1 -1
  22. package/packages/ui/dist/components/graph/index.d.ts +29 -0
  23. package/packages/ui/dist/components/graph/index.js +10 -0
  24. package/packages/ui/dist/components/layout/index.js +2 -2
  25. package/packages/ui/dist/components/settings/index.js +2 -2
  26. package/packages/ui/dist/components/tiles/index.d.ts +83 -0
  27. package/packages/ui/dist/components/tiles/index.js +10 -0
  28. package/packages/ui/dist/components/workspace/index.d.ts +108 -33
  29. package/packages/ui/dist/components/workspace/index.js +15 -3
  30. package/packages/ui/dist/frnl/index.js +9 -7
  31. package/packages/ui/dist/hierarchy/index.js +2 -2
  32. package/packages/ui/dist/index.d.ts +5 -2
  33. package/packages/ui/dist/index.js +68 -39
  34. package/packages/ui/floks.manifest.json +99 -17
  35. package/packages/ui/package.json +18 -3
  36. package/packages/ui/dist/{chunk-MYXPGPI3.js → chunk-GWW3BGOB.js} +3 -3
  37. package/packages/ui/dist/{chunk-TORWRS3V.js → chunk-SXRIBCJX.js} +3 -3
  38. package/packages/ui/dist/{chunk-NPIMIWVO.js → chunk-ZPQC46RO.js} +4 -4
@@ -1,3 +1,10 @@
1
+ import {
2
+ frnlButton,
3
+ frnlTextInput
4
+ } from "./chunk-YVWJ4SW7.js";
5
+ import {
6
+ useFloksFrnlStore
7
+ } from "./chunk-X4B3EBMY.js";
1
8
  import {
2
9
  BaseInput
3
10
  } from "./chunk-W42SJGOJ.js";
@@ -6,9 +13,20 @@ import {
6
13
  } from "./chunk-A2CDQISJ.js";
7
14
 
8
15
  // src/components/auth/AuthPage.tsx
9
- import { useState } from "react";
16
+ import React, { useId, useMemo, useState } from "react";
10
17
  import { LogIn, UserPlus, Eye, EyeOff, Shield, ArrowRight, AlertCircle } from "lucide-react";
18
+ import { defineFrnlComponent } from "@ultrst-armada/frnlts";
19
+ import { useFrnlComponent } from "@ultrst-armada/frnlts/react";
11
20
  import { jsx, jsxs } from "react/jsx-runtime";
21
+ var AUTH_PAGE_REQUIRED_SERVICES = ["auth"];
22
+ var authPageDefinition = defineFrnlComponent({
23
+ name: "AuthPage",
24
+ states: {
25
+ idle: { name: "idle", events: { login: { functionId: "AuthPage.idle.login" }, register: { functionId: "AuthPage.idle.register" } }, visualParameters: {}, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } },
26
+ loading: { name: "loading", events: {}, visualParameters: { opacity: 0.75 }, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } },
27
+ error: { name: "error", events: { retry: { functionId: "AuthPage.error.retry" } }, visualParameters: {}, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } }
28
+ }
29
+ });
12
30
  var AuthPage = ({
13
31
  appName = "SKIPO",
14
32
  appSubtitle = "WORKSPACE",
@@ -18,103 +36,93 @@ var AuthPage = ({
18
36
  onSuccess,
19
37
  onSwitchToAdmin
20
38
  }) => {
39
+ const store = useFloksFrnlStore();
40
+ const generated = useId().replace(/[:/]/g, "");
41
+ const componentId = `AuthPage.${generated}`;
21
42
  const [mode, setMode] = useState("login");
22
43
  const [name, setName] = useState("");
23
44
  const [email, setEmail] = useState("");
24
45
  const [password, setPassword] = useState("");
25
46
  const [showPassword, setShowPassword] = useState(false);
26
- const [loading, setLoading] = useState(false);
27
47
  const [error, setError] = useState(null);
48
+ const [loading, setLoading] = useState(false);
49
+ const handlers = useMemo(() => ({
50
+ "AuthPage.idle.login": () => {
51
+ },
52
+ "AuthPage.idle.register": () => {
53
+ },
54
+ "AuthPage.error.retry": () => setError(null)
55
+ }), []);
56
+ const frnl = useFrnlComponent({
57
+ id: componentId,
58
+ definition: authPageDefinition,
59
+ store,
60
+ state: error ? "error" : loading ? "loading" : "idle",
61
+ properties: { mode, appName },
62
+ handlers
63
+ });
28
64
  const submit = async (e) => {
29
65
  e.preventDefault();
30
- setError(null);
31
66
  const cleanEmail = email.trim();
32
67
  if (!cleanEmail) return setError("Email address is required.");
33
68
  if (!password) return setError("Password is required.");
34
- if (mode === "register" && !name.trim()) return setError("Please enter your full name or display name.");
35
- if (mode === "register" && password.length < 4) return setError("Password must be at least 4 characters long.");
69
+ if (mode === "register" && !name.trim()) return setError("Display name is required.");
36
70
  setLoading(true);
71
+ setError(null);
37
72
  try {
38
73
  const result = mode === "login" ? await onLogin(cleanEmail, password) : await onRegister({ name: name.trim(), email: cleanEmail, password });
39
74
  if (!result.success) throw new Error(result.error || "Authentication failed.");
40
75
  onSuccess?.(result);
41
- } catch (err) {
42
- setError(err?.message || "An unexpected error occurred.");
76
+ } catch (e2) {
77
+ setError(e2 instanceof Error ? e2.message : "Authentication failed.");
43
78
  } finally {
44
79
  setLoading(false);
45
80
  }
46
81
  };
47
- return /* @__PURE__ */ jsxs("div", { className: "min-h-screen w-full bg-[var(--skipo-bg)] text-[var(--skipo-text)] font-mono flex flex-col justify-between select-none", children: [
82
+ return /* @__PURE__ */ jsxs("div", { id: componentId, "data-frnl-component": "AuthPage", "data-frnl-state": frnl.state, className: "min-h-screen w-full bg-[var(--skipo-bg)] text-[var(--skipo-text)] font-mono flex flex-col justify-between", children: [
48
83
  /* @__PURE__ */ jsxs("header", { className: "border-b-2 border-[var(--skipo-border-color)] bg-[var(--skipo-surface)] px-6 py-3.5 flex items-center justify-between", children: [
49
84
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
50
- /* @__PURE__ */ jsx("div", { className: "w-8 h-8 bg-[var(--skipo-accent)] text-black font-black flex items-center justify-center border border-[var(--skipo-border-color)]", children: "\u25B2" }),
51
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
52
- /* @__PURE__ */ jsx("span", { className: "text-sm font-black uppercase tracking-wider", children: appName }),
53
- /* @__PURE__ */ jsx("span", { className: "text-[10px] text-[var(--skipo-text-muted)] font-bold", children: appSubtitle })
54
- ] }) })
85
+ /* @__PURE__ */ jsx("div", { className: "w-8 h-8 bg-[var(--skipo-accent)] text-black font-black flex items-center justify-center", children: "\u25B2" }),
86
+ /* @__PURE__ */ jsxs("div", { children: [
87
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-black uppercase", children: appName }),
88
+ /* @__PURE__ */ jsx("span", { className: "ml-2 text-[10px] text-[var(--skipo-text-muted)]", children: appSubtitle })
89
+ ] })
55
90
  ] }),
56
- onSwitchToAdmin && /* @__PURE__ */ jsxs("button", { type: "button", onClick: onSwitchToAdmin, className: "px-3 py-1.5 text-xs font-black uppercase tracking-wider border-2 border-[#D4AF37] bg-[#D4AF37]/10 text-[#D4AF37] hover:bg-[#D4AF37] hover:text-black flex items-center gap-1.5 shadow-[2px_2px_0px_#D4AF37]", children: [
91
+ onSwitchToAdmin && /* @__PURE__ */ jsxs("button", { type: "button", onClick: onSwitchToAdmin, className: "px-3 py-1.5 text-[10px] font-black border-2 border-[var(--skipo-accent)] text-[var(--skipo-accent)] flex items-center gap-1.5", children: [
57
92
  /* @__PURE__ */ jsx(Shield, { size: 13 }),
58
- " ADMIN LOGIN ",
93
+ " ADMIN ",
59
94
  /* @__PURE__ */ jsx(ArrowRight, { size: 13 })
60
95
  ] })
61
96
  ] }),
62
97
  /* @__PURE__ */ jsx("main", { className: "flex-1 flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md border-2 border-[var(--skipo-border-color)] bg-[var(--skipo-surface)] shadow-[6px_6px_0px_var(--skipo-border-color)] p-6", children: [
63
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-2 mb-6 border-b border-[var(--skipo-border-color)] pb-3", children: ["login", "register"].map((next) => /* @__PURE__ */ jsxs(
64
- "button",
65
- {
66
- type: "button",
67
- onClick: () => {
68
- setMode(next);
69
- setError(null);
70
- },
71
- className: `py-2 text-xs font-black uppercase tracking-wider flex items-center justify-center gap-1.5 border ${mode === next ? "bg-[var(--skipo-accent)] text-black border-[var(--skipo-border-color)]" : "bg-[var(--skipo-bg)] text-[var(--skipo-text-muted)] border-transparent"}`,
72
- children: [
73
- next === "login" ? /* @__PURE__ */ jsx(LogIn, { size: 13 }) : /* @__PURE__ */ jsx(UserPlus, { size: 13 }),
74
- next === "login" ? "SIGN IN" : "CREATE ACCOUNT"
75
- ]
76
- },
77
- next
78
- )) }),
79
- /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
80
- /* @__PURE__ */ jsx("h2", { className: "text-sm font-black uppercase tracking-wider", children: mode === "login" ? "WORKSPACE SIGN IN" : "NEW DEVELOPER ACCOUNT" }),
81
- /* @__PURE__ */ jsx("p", { className: "text-xs text-[var(--skipo-text-muted)] mt-1", children: mode === "login" ? "Sign in to access your workspaces and application control plane." : "Create an account to manage your workspaces and applications." })
82
- ] }),
83
- error && /* @__PURE__ */ jsxs("div", { className: "mb-4 p-3 border-2 border-red-500/80 bg-red-950/40 text-red-300 text-xs flex items-start gap-2", children: [
84
- /* @__PURE__ */ jsx(AlertCircle, { size: 15, className: "shrink-0 mt-0.5" }),
85
- /* @__PURE__ */ jsx("div", { children: error })
86
- ] }),
87
- /* @__PURE__ */ jsxs("form", { onSubmit: submit, className: "space-y-4", children: [
88
- mode === "register" && /* @__PURE__ */ jsxs("div", { children: [
89
- /* @__PURE__ */ jsx("label", { className: "block text-[11px] font-bold text-[var(--skipo-text-muted)] uppercase tracking-wider mb-1", children: "Full Name" }),
90
- /* @__PURE__ */ jsx("input", { value: name, onChange: (e) => setName(e.target.value), placeholder: "e.g. Jane Developer", required: true, className: "w-full bg-[var(--skipo-bg)] border border-[var(--skipo-border-color)] focus:border-[var(--skipo-accent)] text-[var(--skipo-text)] text-xs px-3 py-2.5 outline-none font-mono" })
91
- ] }),
92
- /* @__PURE__ */ jsxs("div", { children: [
93
- /* @__PURE__ */ jsx("label", { className: "block text-[11px] font-bold text-[var(--skipo-text-muted)] uppercase tracking-wider mb-1", children: "Email Address or Username" }),
94
- /* @__PURE__ */ jsx("input", { value: email, onChange: (e) => setEmail(e.target.value), placeholder: "e.g. developer@example.com", autoComplete: "username", required: true, className: "w-full bg-[var(--skipo-bg)] border border-[var(--skipo-border-color)] focus:border-[var(--skipo-accent)] text-[var(--skipo-text)] text-xs px-3 py-2.5 outline-none font-mono" })
95
- ] }),
96
- /* @__PURE__ */ jsxs("div", { children: [
97
- /* @__PURE__ */ jsx("label", { className: "block text-[11px] font-bold text-[var(--skipo-text-muted)] uppercase tracking-wider mb-1", children: "Password" }),
98
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
99
- /* @__PURE__ */ jsx("input", { type: showPassword ? "text" : "password", value: password, onChange: (e) => setPassword(e.target.value), autoComplete: mode === "login" ? "current-password" : "new-password", required: true, className: "w-full bg-[var(--skipo-bg)] border border-[var(--skipo-border-color)] focus:border-[var(--skipo-accent)] text-[var(--skipo-text)] text-xs px-3 py-2.5 outline-none font-mono pr-10" }),
100
- /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setShowPassword((v) => !v), className: "absolute right-3 top-2.5 text-[var(--skipo-text-muted)]", children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { size: 14 }) : /* @__PURE__ */ jsx(Eye, { size: 14 }) })
101
- ] })
98
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2 mb-5", children: [
99
+ /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
100
+ setMode("login");
101
+ setError(null);
102
+ }, className: `py-2 text-[10px] font-black border ${mode === "login" ? "bg-[var(--skipo-accent)] text-black" : "bg-[var(--skipo-bg)]"}`, children: [
103
+ /* @__PURE__ */ jsx(LogIn, { size: 13, className: "inline mr-1" }),
104
+ " SIGN IN"
102
105
  ] }),
103
- /* @__PURE__ */ jsxs("button", { type: "submit", disabled: loading, className: "w-full py-2.5 bg-[var(--skipo-accent)] hover:opacity-90 text-black font-black text-xs uppercase tracking-wider flex items-center justify-center gap-2 shadow-[2px_2px_0px_#000] disabled:opacity-50", children: [
104
- /* @__PURE__ */ jsx(LogIn, { size: 14 }),
105
- " ",
106
- loading ? "PROCESSING..." : mode === "login" ? "SIGN IN TO WORKSPACE" : "CREATE ACCOUNT"
106
+ /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
107
+ setMode("register");
108
+ setError(null);
109
+ }, className: `py-2 text-[10px] font-black border ${mode === "register" ? "bg-[var(--skipo-accent)] text-black" : "bg-[var(--skipo-bg)]"}`, children: [
110
+ /* @__PURE__ */ jsx(UserPlus, { size: 13, className: "inline mr-1" }),
111
+ " CREATE ACCOUNT"
107
112
  ] })
108
113
  ] }),
109
- onSwitchToAdmin && /* @__PURE__ */ jsxs("div", { className: "mt-6 pt-4 border-t border-[var(--skipo-border-color)] flex items-center justify-between text-[11px] text-[var(--skipo-text-muted)]", children: [
110
- /* @__PURE__ */ jsx("span", { children: "System Administrator?" }),
111
- /* @__PURE__ */ jsxs("button", { type: "button", onClick: onSwitchToAdmin, className: "text-[#D4AF37] hover:underline font-bold flex items-center gap-1", children: [
112
- "Switch to Admin Portal ",
113
- /* @__PURE__ */ jsx(ArrowRight, { size: 11 })
114
- ] })
115
- ] })
116
- ] }) }),
117
- /* @__PURE__ */ jsx("footer", { className: "border-t border-[var(--skipo-border-color)] py-2 px-4 text-center text-[10px] text-[var(--skipo-text-muted)]", children: footerText || `${appName} WORKSPACE SYSTEM` })
114
+ error && /* @__PURE__ */ jsxs("div", { className: "mb-4 p-3 border-2 border-red-500/80 bg-red-950/30 text-red-300 text-xs flex items-center gap-2", children: [
115
+ /* @__PURE__ */ jsx(AlertCircle, { size: 14 }),
116
+ error
117
+ ] }),
118
+ /* @__PURE__ */ jsxs("form", { onSubmit: submit, className: "space-y-3", children: [
119
+ mode === "register" && React.createElement(frnlTextInput, { id: componentId + ".name", label: "Full Name", value: name, onChange: (e) => setName(e.target.value) }),
120
+ React.createElement(frnlTextInput, { id: componentId + ".email", label: "Email Address", value: email, onChange: (e) => setEmail(e.target.value), type: "email", autoComplete: "username" }),
121
+ /* @__PURE__ */ jsx("div", { children: React.createElement(frnlTextInput, { id: componentId + ".password", label: "Password", value: password, onChange: (e) => setPassword(e.target.value), type: showPassword ? "text" : "password", autoComplete: mode === "login" ? "current-password" : "new-password", trailingIcon: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Toggle password visibility", onClick: () => setShowPassword((v) => !v), children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { size: 13 }) : /* @__PURE__ */ jsx(Eye, { size: 13 }) }) }) }),
122
+ React.createElement(frnlButton, { type: "submit", disabled: loading, loading, variant: "accent", size: "lg", className: "w-full", icon: /* @__PURE__ */ jsx(ArrowRight, { size: 13 }) }, mode === "login" ? "SIGN IN TO WORKSPACE" : "CREATE ACCOUNT")
123
+ ] }),
124
+ /* @__PURE__ */ jsx("p", { className: "mt-5 pt-3 border-t border-[var(--skipo-border-color)] text-center text-[10px] text-[var(--skipo-text-muted)]", children: footerText || `${appName} WORKSPACE SYSTEM` })
125
+ ] }) })
118
126
  ] });
119
127
  };
120
128
 
@@ -261,6 +269,8 @@ var LoginModal = ({
261
269
  };
262
270
 
263
271
  export {
272
+ AUTH_PAGE_REQUIRED_SERVICES,
273
+ authPageDefinition,
264
274
  AuthPage,
265
275
  LoginModal
266
276
  };
@@ -0,0 +1,99 @@
1
+ import {
2
+ useFloksFrnlStore
3
+ } from "./chunk-X4B3EBMY.js";
4
+
5
+ // src/components/tiles/TilesMenu.tsx
6
+ import React, { useId, useMemo } from "react";
7
+ import { Search, Plus } from "lucide-react";
8
+ import { defineFrnlComponent } from "@ultrst-armada/frnlts";
9
+ import { useFrnlComponent } from "@ultrst-armada/frnlts/react";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ var tilesMenuDefinition = defineFrnlComponent({
12
+ name: "tilesMenu",
13
+ states: {
14
+ idle: { name: "idle", events: { search: { functionId: "tilesMenu.idle.search" }, select: { functionId: "tilesMenu.idle.select" }, create: { functionId: "tilesMenu.idle.create" } }, visualParameters: {}, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } },
15
+ loading: { name: "loading", events: {}, visualParameters: { opacity: 0.7 }, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } },
16
+ error: { name: "error", events: { dismiss: { functionId: "tilesMenu.error.dismiss" } }, visualParameters: {}, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } }
17
+ }
18
+ });
19
+ function TilesMenu({
20
+ id,
21
+ title,
22
+ subtitle,
23
+ tiles,
24
+ searchPlaceholder = "Search...",
25
+ emptyText = "No tiles found.",
26
+ loading = false,
27
+ error = null,
28
+ createLabel = "NEW",
29
+ onSelect,
30
+ onCreate,
31
+ renderTile
32
+ }) {
33
+ const store = useFloksFrnlStore();
34
+ const generated = useId().replace(/[:/]/g, "");
35
+ const componentId = id ?? `tilesMenu.${generated}`;
36
+ const [query, setQuery] = React.useState("");
37
+ const [selectedId, setSelectedId] = React.useState(null);
38
+ const state = error ? "error" : loading ? "loading" : "idle";
39
+ const handlers = useMemo(() => ({
40
+ "tilesMenu.idle.search": (value) => setQuery(String(value ?? "")),
41
+ "tilesMenu.idle.select": (tile) => onSelect(tile),
42
+ "tilesMenu.idle.create": () => onCreate?.(),
43
+ "tilesMenu.error.dismiss": () => {
44
+ }
45
+ }), [onCreate, onSelect]);
46
+ const frnl = useFrnlComponent({
47
+ id: componentId,
48
+ definition: tilesMenuDefinition,
49
+ store,
50
+ state,
51
+ properties: { title, tileCount: tiles.length, query },
52
+ handlers
53
+ });
54
+ const filtered = tiles.filter((tile) => {
55
+ const q = query.trim().toLowerCase();
56
+ return !q || tile.title.toLowerCase().includes(q) || (tile.description ?? "").toLowerCase().includes(q);
57
+ });
58
+ return /* @__PURE__ */ jsxs("section", { id: componentId, "data-frnl-component": "tilesMenu", "data-frnl-state": frnl.state, className: "w-full font-mono text-[var(--skipo-text)]", children: [
59
+ /* @__PURE__ */ jsxs("header", { className: "flex flex-wrap items-center gap-3 mb-4", children: [
60
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-[220px]", children: [
61
+ /* @__PURE__ */ jsx("h2", { className: "text-sm font-black uppercase tracking-wider", children: title }),
62
+ subtitle && /* @__PURE__ */ jsx("p", { className: "text-[10px] text-[var(--skipo-text-muted)] mt-1", children: subtitle })
63
+ ] }),
64
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
65
+ /* @__PURE__ */ jsxs("label", { className: "relative", children: [
66
+ /* @__PURE__ */ jsx(Search, { size: 13, className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--skipo-text-muted)]" }),
67
+ /* @__PURE__ */ jsx("input", { value: query, onChange: (e) => {
68
+ setQuery(e.target.value);
69
+ frnl.events.search(e.target.value);
70
+ }, placeholder: searchPlaceholder, className: "h-8 w-48 bg-[var(--skipo-bg)] border border-[var(--skipo-border-color)] pl-8 pr-2 text-xs outline-none" })
71
+ ] }),
72
+ onCreate && /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => frnl.events.create(void 0), className: "h-8 px-3 bg-[var(--skipo-accent)] text-black text-[10px] font-black uppercase flex items-center gap-1.5", children: [
73
+ /* @__PURE__ */ jsx(Plus, { size: 13 }),
74
+ createLabel
75
+ ] })
76
+ ] })
77
+ ] }),
78
+ error && /* @__PURE__ */ jsx("div", { className: "mb-3 border border-red-500/70 bg-red-500/10 p-3 text-xs text-red-300", children: error }),
79
+ loading ? /* @__PURE__ */ jsx("div", { className: "border border-dashed border-[var(--skipo-border-color)] p-8 text-center text-xs text-[var(--skipo-text-muted)]", children: "LOADING..." }) : filtered.length === 0 ? /* @__PURE__ */ jsx("div", { className: "border border-dashed border-[var(--skipo-border-color)] p-8 text-center text-xs text-[var(--skipo-text-muted)]", children: emptyText }) : /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3", children: filtered.map((tile) => {
80
+ const selected = selectedId === tile.id;
81
+ return /* @__PURE__ */ jsx("button", { type: "button", onClick: () => {
82
+ setSelectedId(tile.id);
83
+ frnl.events.select(tile);
84
+ }, className: `text-left p-4 border-2 bg-[var(--skipo-surface)] transition-colors ${selected ? "border-[var(--skipo-accent)]" : "border-[var(--skipo-border-color)] hover:border-[var(--skipo-accent)]"}`, children: renderTile ? renderTile(tile, selected) : /* @__PURE__ */ jsxs(Fragment, { children: [
85
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs font-black uppercase", children: [
86
+ tile.icon,
87
+ tile.title
88
+ ] }),
89
+ /* @__PURE__ */ jsx("p", { className: "mt-2 text-[11px] text-[var(--skipo-text-muted)]", children: tile.description }),
90
+ tile.metadata && /* @__PURE__ */ jsx("div", { className: "mt-2 text-[10px]", children: tile.metadata })
91
+ ] }) }, tile.id);
92
+ }) })
93
+ ] });
94
+ }
95
+
96
+ export {
97
+ tilesMenuDefinition,
98
+ TilesMenu
99
+ };
@@ -0,0 +1,323 @@
1
+ import {
2
+ TilesMenu
3
+ } from "./chunk-PH4NEHWR.js";
4
+ import {
5
+ useFloksFrnlStore
6
+ } from "./chunk-X4B3EBMY.js";
7
+
8
+ // src/components/graph/GraphsMenu.tsx
9
+ import { GitBranch, Network } from "lucide-react";
10
+
11
+ // src/frnl/frnlNodeGraph.tsx
12
+ import { useMemo } from "react";
13
+ import {
14
+ Background,
15
+ Controls,
16
+ MiniMap,
17
+ ReactFlow
18
+ } from "@xyflow/react";
19
+ import { defineFrnlComponent } from "@ultrst-armada/frnlts";
20
+ import { useFrnlComponent } from "@ultrst-armada/frnlts/react";
21
+ import { jsx, jsxs } from "react/jsx-runtime";
22
+ var frnlNodeGraphDefinition = defineFrnlComponent({
23
+ name: "frnlNodeGraph",
24
+ states: {
25
+ idle: {
26
+ name: "idle",
27
+ events: {
28
+ nodeClick: { functionId: "frnlNodeGraph.idle.nodeClick" },
29
+ nodeDrag: { functionId: "frnlNodeGraph.idle.nodeDrag" },
30
+ connect: { functionId: "frnlNodeGraph.idle.connect" },
31
+ nodesChange: { functionId: "frnlNodeGraph.idle.nodesChange" },
32
+ edgesChange: { functionId: "frnlNodeGraph.idle.edgesChange" },
33
+ selectionChange: { functionId: "frnlNodeGraph.idle.selectionChange" },
34
+ viewportChange: { functionId: "frnlNodeGraph.idle.viewportChange" }
35
+ },
36
+ visualParameters: {
37
+ canvasBackground: "var(--frnl-node-graph-background, var(--skipo-bg-panel, #0f172a))",
38
+ edgeColor: "var(--frnl-node-graph-edge, var(--skipo-border-subtle, #334155))",
39
+ selectionColor: "var(--frnl-node-graph-selection, var(--skipo-accent, #38bdf8))"
40
+ },
41
+ phases: { sustainPhase: { visualDefinition: { parameters: {} } } }
42
+ },
43
+ disabled: {
44
+ name: "disabled",
45
+ events: {
46
+ nodeClick: { functionId: "frnlNodeGraph.disabled.nodeClick" },
47
+ nodeDrag: { functionId: "frnlNodeGraph.disabled.nodeDrag" },
48
+ connect: { functionId: "frnlNodeGraph.disabled.connect" },
49
+ nodesChange: { functionId: "frnlNodeGraph.disabled.nodesChange" },
50
+ edgesChange: { functionId: "frnlNodeGraph.disabled.edgesChange" },
51
+ selectionChange: { functionId: "frnlNodeGraph.disabled.selectionChange" },
52
+ viewportChange: { functionId: "frnlNodeGraph.disabled.viewportChange" }
53
+ },
54
+ visualParameters: { opacity: 0.65 },
55
+ phases: { sustainPhase: { visualDefinition: { parameters: {} } } }
56
+ }
57
+ }
58
+ });
59
+ var frnlNodeGraph = ({
60
+ id = "frnlNodeGraph",
61
+ parentId,
62
+ nodes,
63
+ edges,
64
+ nodeTypes,
65
+ editable = true,
66
+ fitView = true,
67
+ showControls = true,
68
+ showMiniMap = false,
69
+ showBackground = true,
70
+ className = "",
71
+ style,
72
+ onNodesChange,
73
+ onEdgesChange,
74
+ onConnect,
75
+ onNodeClick,
76
+ onNodeDragStop,
77
+ onSelectionChange,
78
+ onViewportChange
79
+ }) => {
80
+ const store = useFloksFrnlStore();
81
+ const handlers = useMemo(() => {
82
+ const forward = (fn) => (value) => fn?.(value);
83
+ const forwardNode = (fn) => (value) => {
84
+ const payload = value;
85
+ fn?.(payload.event, payload.node);
86
+ };
87
+ return {
88
+ "frnlNodeGraph.idle.nodeClick": forwardNode(onNodeClick),
89
+ "frnlNodeGraph.idle.nodeDrag": forwardNode(onNodeDragStop),
90
+ "frnlNodeGraph.idle.connect": forward(onConnect),
91
+ "frnlNodeGraph.idle.nodesChange": forward(onNodesChange),
92
+ "frnlNodeGraph.idle.edgesChange": forward(onEdgesChange),
93
+ "frnlNodeGraph.idle.selectionChange": forward(onSelectionChange),
94
+ "frnlNodeGraph.idle.viewportChange": forward(onViewportChange),
95
+ "frnlNodeGraph.disabled.nodeClick": () => {
96
+ },
97
+ "frnlNodeGraph.disabled.nodeDrag": () => {
98
+ },
99
+ "frnlNodeGraph.disabled.connect": () => {
100
+ },
101
+ "frnlNodeGraph.disabled.nodesChange": () => {
102
+ },
103
+ "frnlNodeGraph.disabled.edgesChange": () => {
104
+ },
105
+ "frnlNodeGraph.disabled.selectionChange": () => {
106
+ },
107
+ "frnlNodeGraph.disabled.viewportChange": () => {
108
+ }
109
+ };
110
+ }, [onConnect, onEdgesChange, onNodeClick, onNodeDragStop, onNodesChange, onSelectionChange, onViewportChange]);
111
+ const frnl = useFrnlComponent({
112
+ id,
113
+ parentId,
114
+ definition: frnlNodeGraphDefinition,
115
+ store,
116
+ state: editable ? "idle" : "disabled",
117
+ properties: { editable, nodeCount: nodes.length, edgeCount: edges.length },
118
+ handlers
119
+ });
120
+ const graphStyle = useMemo(() => ({
121
+ width: "100%",
122
+ height: "100%",
123
+ opacity: frnl.visualParameters.opacity,
124
+ background: frnl.visualParameters.canvasBackground,
125
+ ...style
126
+ }), [frnl.visualParameters, style]);
127
+ return /* @__PURE__ */ jsx("div", { id, "data-frnl-component": "frnlNodeGraph", "data-frnl-state": frnl.state, className, style: graphStyle, children: /* @__PURE__ */ jsxs(
128
+ ReactFlow,
129
+ {
130
+ nodes,
131
+ edges,
132
+ nodeTypes,
133
+ nodesDraggable: editable,
134
+ nodesConnectable: editable,
135
+ elementsSelectable: editable,
136
+ fitView,
137
+ onNodesChange: (changes) => frnl.events.nodesChange(changes),
138
+ onEdgesChange: (changes) => frnl.events.edgesChange(changes),
139
+ onConnect: (connection) => editable && frnl.events.connect(connection),
140
+ onNodeClick: (event, node) => editable && frnl.events.nodeClick({ event, node }),
141
+ onNodeDragStop: (event, node) => editable && frnl.events.nodeDrag({ event, node }),
142
+ onSelectionChange: (selection) => editable && frnl.events.selectionChange(selection),
143
+ onViewportChange: (viewport) => editable && frnl.events.viewportChange(viewport),
144
+ proOptions: { hideAttribution: true },
145
+ children: [
146
+ showBackground && /* @__PURE__ */ jsx(Background, {}),
147
+ showControls && /* @__PURE__ */ jsx(Controls, {}),
148
+ showMiniMap && /* @__PURE__ */ jsx(MiniMap, {})
149
+ ]
150
+ }
151
+ ) });
152
+ };
153
+ frnlNodeGraph.displayName = "frnlNodeGraph";
154
+
155
+ // src/frnl/frnlForceGraph.tsx
156
+ import { useEffect, useMemo as useMemo2, useRef, useState } from "react";
157
+ import {
158
+ forceCenter,
159
+ forceLink,
160
+ forceManyBody,
161
+ forceSimulation,
162
+ forceX,
163
+ forceY
164
+ } from "d3-force";
165
+ import { defineFrnlComponent as defineFrnlComponent2 } from "@ultrst-armada/frnlts";
166
+ import { useFrnlComponent as useFrnlComponent2 } from "@ultrst-armada/frnlts/react";
167
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
168
+ var frnlForceGraphDefinition = defineFrnlComponent2({
169
+ name: "frnlForceGraph",
170
+ states: {
171
+ idle: {
172
+ name: "idle",
173
+ events: {
174
+ nodeClick: { functionId: "frnlForceGraph.idle.nodeClick" },
175
+ nodeHover: { functionId: "frnlForceGraph.idle.nodeHover" }
176
+ },
177
+ visualParameters: {
178
+ background: "var(--frnl-force-graph-background, var(--skipo-bg-panel, #0f172a))",
179
+ nodeRadius: 7,
180
+ edgeOpacity: 0.45
181
+ },
182
+ phases: { sustainPhase: { visualDefinition: { parameters: {} } } }
183
+ },
184
+ focused: {
185
+ name: "focused",
186
+ events: {
187
+ nodeClick: { functionId: "frnlForceGraph.focused.nodeClick" },
188
+ nodeHover: { functionId: "frnlForceGraph.focused.nodeHover" }
189
+ },
190
+ visualParameters: { nodeRadius: 9, edgeOpacity: 0.7 },
191
+ phases: { sustainPhase: { visualDefinition: { parameters: {} } } }
192
+ }
193
+ }
194
+ });
195
+ var frnlForceGraph = ({
196
+ id = "frnlForceGraph",
197
+ parentId,
198
+ nodes,
199
+ links,
200
+ width = 800,
201
+ height = 500,
202
+ className = "",
203
+ style,
204
+ onNodeClick,
205
+ onNodeHover
206
+ }) => {
207
+ const store = useFloksFrnlStore();
208
+ const simulationRef = useRef(null);
209
+ const [positions, setPositions] = useState(nodes);
210
+ const [focusedId, setFocusedId] = useState(null);
211
+ const handlers = useMemo2(() => ({
212
+ "frnlForceGraph.idle.nodeClick": (node) => onNodeClick?.(node),
213
+ "frnlForceGraph.idle.nodeHover": (node) => onNodeHover?.(node),
214
+ "frnlForceGraph.focused.nodeClick": (node) => onNodeClick?.(node),
215
+ "frnlForceGraph.focused.nodeHover": (node) => onNodeHover?.(node)
216
+ }), [onNodeClick, onNodeHover]);
217
+ const frnl = useFrnlComponent2({
218
+ id,
219
+ parentId,
220
+ definition: frnlForceGraphDefinition,
221
+ store,
222
+ state: focusedId ? "focused" : "idle",
223
+ properties: { nodeCount: nodes.length, edgeCount: links.length },
224
+ handlers
225
+ });
226
+ useEffect(() => {
227
+ const simulation = forceSimulation(nodes.map((node) => ({ ...node }))).force("charge", forceManyBody().strength(-70)).force("center", forceCenter(width / 2, height / 2)).force("x", forceX(width / 2).strength(0.04)).force("y", forceY(height / 2).strength(0.04)).force("link", forceLink(links.map((link) => ({ ...link }))).id((node) => node.id).distance(120).strength(0.7)).alphaDecay(0.08).velocityDecay(0.45);
228
+ simulation.on("tick", () => setPositions([...simulation.nodes()]));
229
+ simulationRef.current = simulation;
230
+ return () => {
231
+ simulation.stop();
232
+ simulationRef.current = null;
233
+ };
234
+ }, [height, links, nodes, width]);
235
+ const nodeRadius = Number(frnl.visualParameters.nodeRadius ?? 7);
236
+ const edgeOpacity = Number(frnl.visualParameters.edgeOpacity ?? 0.45);
237
+ const background = String(frnl.visualParameters.background ?? "transparent");
238
+ return /* @__PURE__ */ jsxs2(
239
+ "svg",
240
+ {
241
+ id,
242
+ "data-frnl-component": "frnlForceGraph",
243
+ "data-frnl-state": frnl.state,
244
+ className,
245
+ width,
246
+ height,
247
+ viewBox: "0 0 " + width + " " + height,
248
+ style: { background, ...style },
249
+ children: [
250
+ links.map((link, index) => {
251
+ const source = positions.find((node) => node.id === link.source);
252
+ const target = positions.find((node) => node.id === link.target);
253
+ if (!source || !target) return null;
254
+ return /* @__PURE__ */ jsx2(
255
+ "line",
256
+ {
257
+ x1: source.x ?? 0,
258
+ y1: source.y ?? 0,
259
+ x2: target.x ?? 0,
260
+ y2: target.y ?? 0,
261
+ stroke: "currentColor",
262
+ opacity: edgeOpacity
263
+ },
264
+ index
265
+ );
266
+ }),
267
+ positions.map((node) => /* @__PURE__ */ jsxs2(
268
+ "g",
269
+ {
270
+ transform: "translate(" + (node.x ?? 0) + " " + (node.y ?? 0) + ")",
271
+ onMouseEnter: () => frnl.events.nodeHover(node),
272
+ onMouseLeave: () => frnl.events.nodeHover(null),
273
+ onClick: () => {
274
+ setFocusedId(node.id);
275
+ frnl.events.nodeClick(node);
276
+ },
277
+ children: [
278
+ /* @__PURE__ */ jsx2("circle", { r: node.id === focusedId ? nodeRadius + 2 : nodeRadius, fill: "currentColor" }),
279
+ /* @__PURE__ */ jsx2("text", { x: nodeRadius + 5, y: "4", fontSize: "11", fill: "currentColor", children: node.label ?? node.id })
280
+ ]
281
+ },
282
+ node.id
283
+ ))
284
+ ]
285
+ }
286
+ );
287
+ };
288
+ frnlForceGraph.displayName = "frnlForceGraph";
289
+
290
+ // src/components/graph/GraphsMenu.tsx
291
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
292
+ var GRAPHS_MENU_REQUIRED_SERVICES = ["workspace"];
293
+ function GraphsMenu({ graphs, onSelectGraph, onCreateGraph, loading, error }) {
294
+ const ForceGraph = frnlForceGraph;
295
+ const NodeGraph = frnlNodeGraph;
296
+ return /* @__PURE__ */ jsx3(
297
+ TilesMenu,
298
+ {
299
+ id: "graphsMenu",
300
+ title: "Graphs",
301
+ subtitle: "Reusable graph workspaces backed by the canonical FRNL graph components.",
302
+ tiles: graphs,
303
+ loading,
304
+ error,
305
+ createLabel: "NEW GRAPH",
306
+ onSelect: onSelectGraph,
307
+ onCreate: onCreateGraph,
308
+ renderTile: (graph) => /* @__PURE__ */ jsxs3(Fragment, { children: [
309
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 text-xs font-black uppercase", children: [
310
+ graph.kind === "force" ? /* @__PURE__ */ jsx3(Network, { size: 15 }) : /* @__PURE__ */ jsx3(GitBranch, { size: 15 }),
311
+ graph.title
312
+ ] }),
313
+ /* @__PURE__ */ jsx3("p", { className: "mt-2 text-[11px] text-[var(--skipo-text-muted)]", children: graph.description }),
314
+ /* @__PURE__ */ jsx3("div", { className: "mt-3 h-28 border border-[var(--skipo-border-color)] overflow-hidden", children: graph.kind === "force" ? /* @__PURE__ */ jsx3(ForceGraph, { nodes: graph.nodes ?? [], links: graph.links ?? [], width: 420, height: 150 }) : /* @__PURE__ */ jsx3(NodeGraph, { nodes: graph.nodes ?? [], edges: graph.edges ?? [], editable: false, showControls: false, showMiniMap: false }) })
315
+ ] })
316
+ }
317
+ );
318
+ }
319
+
320
+ export {
321
+ GRAPHS_MENU_REQUIRED_SERVICES,
322
+ GraphsMenu
323
+ };