@ultrst-armada/floks 1.5.6 → 1.6.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/.krusbl-release-attestation.json +3 -3
- package/package.json +14 -3
- package/packages/canvas-ui/dist/authoring/index.d.ts +16 -1
- package/packages/canvas-ui/dist/authoring/index.js +5 -1
- package/packages/canvas-ui/dist/{chunk-NJOTRYYJ.js → chunk-TS7P3WWH.js} +52 -1
- package/packages/canvas-ui/dist/chunk-ZJXRL74D.js +239 -0
- package/packages/canvas-ui/dist/editor/index.d.ts +6 -1
- package/packages/canvas-ui/dist/editor/index.js +1 -1
- package/packages/canvas-ui/dist/index.d.ts +2 -1
- package/packages/canvas-ui/dist/index.js +18 -14
- package/packages/canvas-ui/dist/predictive/index.js +1 -1
- package/packages/canvas-ui/package.json +2 -2
- package/packages/ui/dist/{chunk-CUQ7R3H2.js → chunk-7IKBKQGJ.js} +1 -1
- package/packages/ui/dist/{chunk-KIFQA7L6.js → chunk-CWBCW6N2.js} +19 -45
- package/packages/ui/dist/chunk-DWMKISE5.js +28 -0
- package/packages/ui/dist/chunk-FA45WRNL.js +952 -0
- package/packages/ui/dist/components/ai/index.css +183 -0
- package/packages/ui/dist/components/ai/index.d.ts +279 -0
- package/packages/ui/dist/components/ai/index.js +39 -0
- package/packages/ui/dist/components/auth/index.js +3 -3
- package/packages/ui/dist/components/base/index.js +6 -4
- package/packages/ui/dist/components/composite/index.js +2 -2
- package/packages/ui/dist/components/layout/index.js +2 -2
- package/packages/ui/dist/components/settings/index.js +2 -2
- package/packages/ui/dist/frnl/index.js +3 -3
- package/packages/ui/dist/hierarchy/index.js +2 -2
- package/packages/ui/dist/index.d.ts +2 -0
- package/packages/ui/dist/index.js +75 -39
- package/packages/ui/package.json +6 -1
- package/packages/canvas-ui/dist/chunk-5I3TTHDX.js +0 -140
- package/packages/ui/dist/{chunk-GWW3BGOB.js → chunk-MYXPGPI3.js} +3 -3
- package/packages/ui/dist/{chunk-ZPQC46RO.js → chunk-NPIMIWVO.js} +4 -4
- package/packages/ui/dist/{chunk-YVWJ4SW7.js → chunk-PUHHHRQO.js} +3 -3
- package/packages/ui/dist/{chunk-DGZBP3ND.js → chunk-USCLIIBR.js} +3 -3
- package/packages/ui/dist/{chunk-SXRIBCJX.js → chunk-Y2QQZATG.js} +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"packageName": "@ultrst-armada/floks",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"sourceCommit": "
|
|
4
|
+
"version": "1.6.1",
|
|
5
|
+
"sourceCommit": "09378ff00c07fd74e245f3316a67d17e1dbe802c",
|
|
6
6
|
"releaseWorkflow": "npm Release",
|
|
7
|
-
"workflowRunId": "
|
|
7
|
+
"workflowRunId": "40839437328"
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultrst-armada/floks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"import": "./packages/ui/dist/index.js",
|
|
33
33
|
"default": "./packages/ui/dist/index.js"
|
|
34
34
|
},
|
|
35
|
+
"./ui/dist/index.css": "./packages/ui/dist/index.css",
|
|
35
36
|
"./ui/theme/tokens.css": "./packages/ui/src/theme/tokens.css",
|
|
36
37
|
"./ui/styles/*": "./packages/ui/src/styles/*",
|
|
37
38
|
"./canvas-ui": {
|
|
@@ -43,6 +44,16 @@
|
|
|
43
44
|
"types": "./packages/contracts/dist/index.d.ts",
|
|
44
45
|
"import": "./packages/contracts/dist/index.js",
|
|
45
46
|
"default": "./packages/contracts/dist/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./ui/ai": {
|
|
49
|
+
"types": "./packages/ui/dist/components/ai/index.d.ts",
|
|
50
|
+
"import": "./packages/ui/dist/components/ai/index.js",
|
|
51
|
+
"default": "./packages/ui/dist/components/ai/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./ai": {
|
|
54
|
+
"types": "./packages/ui/dist/components/ai/index.d.ts",
|
|
55
|
+
"import": "./packages/ui/dist/components/ai/index.js",
|
|
56
|
+
"default": "./packages/ui/dist/components/ai/index.js"
|
|
46
57
|
}
|
|
47
58
|
},
|
|
48
59
|
"scripts": {
|
|
@@ -61,7 +72,7 @@
|
|
|
61
72
|
"@dinilmusick/gutts": "^0.1.3"
|
|
62
73
|
},
|
|
63
74
|
"peerDependencies": {
|
|
64
|
-
"@ultrst-armada/kloks": "^1.
|
|
75
|
+
"@ultrst-armada/kloks": "^1.17.0",
|
|
65
76
|
"lucide-react": ">=0.300.0",
|
|
66
77
|
"react": "^18.0.0 || ^19.0.0",
|
|
67
78
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
@@ -72,7 +83,7 @@
|
|
|
72
83
|
"@types/node": "^22.0.0",
|
|
73
84
|
"@types/react": "^19.0.0",
|
|
74
85
|
"@types/react-dom": "^19.0.0",
|
|
75
|
-
"@ultrst-armada/kloks": "^1.
|
|
86
|
+
"@ultrst-armada/kloks": "^1.17.0",
|
|
76
87
|
"@ultrst-armada/frnlts": "^0.2.7",
|
|
77
88
|
"happy-dom": "^21.0.3",
|
|
78
89
|
"lucide-react": "^1.55.0",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
+
import { UIAuthoringValidation } from '@ultrst-armada/kloks/contracts';
|
|
2
3
|
|
|
3
4
|
type UIAuthoringContext = 'service' | 'general-component' | 'application';
|
|
4
5
|
type UIAuthoringNodeKind = 'page' | 'section' | 'component';
|
|
@@ -79,4 +80,18 @@ declare function UiAuthoringBindingEditor(props: {
|
|
|
79
80
|
onChange: (session: UIAuthoringSession) => void;
|
|
80
81
|
}): React__default.JSX.Element;
|
|
81
82
|
|
|
82
|
-
|
|
83
|
+
declare function UiAuthoringValidationPanel(props: {
|
|
84
|
+
validation?: UIAuthoringValidation;
|
|
85
|
+
status?: string;
|
|
86
|
+
onValidate?: () => void;
|
|
87
|
+
onGenerate?: () => void;
|
|
88
|
+
}): React__default.JSX.Element;
|
|
89
|
+
|
|
90
|
+
type UiAuthoringComponentRenderer = (node: UIAuthoringNode, slots: Record<string, React__default.ReactNode[]>) => React__default.ReactNode;
|
|
91
|
+
declare function UiAuthoringPreview(props: {
|
|
92
|
+
session: UIAuthoringSession;
|
|
93
|
+
renderComponent: UiAuthoringComponentRenderer;
|
|
94
|
+
emptyMessage?: string;
|
|
95
|
+
}): React__default.JSX.Element;
|
|
96
|
+
|
|
97
|
+
export { type AuthoringAssetRef, type UIAuthoringContext, type UIAuthoringNode, type UIAuthoringNodeKind, type UIAuthoringSession, UiAuthoringBindingEditor, type UiAuthoringComponentRenderer, UiAuthoringInspector, UiAuthoringPreview, UiAuthoringTree, UiAuthoringValidationPanel, UiAuthoringWorkspace, getAuthoringChildren, getAuthoringDepth, getAuthoringSubtreeIds };
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UiAuthoringBindingEditor,
|
|
3
3
|
UiAuthoringInspector,
|
|
4
|
+
UiAuthoringPreview,
|
|
4
5
|
UiAuthoringTree,
|
|
6
|
+
UiAuthoringValidationPanel,
|
|
5
7
|
UiAuthoringWorkspace,
|
|
6
8
|
getAuthoringChildren,
|
|
7
9
|
getAuthoringDepth,
|
|
8
10
|
getAuthoringSubtreeIds
|
|
9
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-TS7P3WWH.js";
|
|
10
12
|
export {
|
|
11
13
|
UiAuthoringBindingEditor,
|
|
12
14
|
UiAuthoringInspector,
|
|
15
|
+
UiAuthoringPreview,
|
|
13
16
|
UiAuthoringTree,
|
|
17
|
+
UiAuthoringValidationPanel,
|
|
14
18
|
UiAuthoringWorkspace,
|
|
15
19
|
getAuthoringChildren,
|
|
16
20
|
getAuthoringDepth,
|
|
@@ -294,6 +294,55 @@ function UiAuthoringWorkspace(props) {
|
|
|
294
294
|
] });
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
// src/authoring/UiAuthoringValidationPanel.tsx
|
|
298
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
299
|
+
function UiAuthoringValidationPanel(props) {
|
|
300
|
+
return /* @__PURE__ */ jsxs5("aside", { className: "border-t border-black/10 p-3 text-xs", "aria-label": "Authoring validation", children: [
|
|
301
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
302
|
+
/* @__PURE__ */ jsx5("strong", { className: "uppercase tracking-wide", children: "Validation" }),
|
|
303
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
|
|
304
|
+
props.onValidate && /* @__PURE__ */ jsx5("button", { type: "button", className: "rounded border px-2 py-1", onClick: props.onValidate, children: "Validate" }),
|
|
305
|
+
props.onGenerate && /* @__PURE__ */ jsx5("button", { type: "button", className: "rounded border px-2 py-1", onClick: props.onGenerate, disabled: props.validation?.valid !== true, children: "Generate" })
|
|
306
|
+
] })
|
|
307
|
+
] }),
|
|
308
|
+
props.status && /* @__PURE__ */ jsx5("p", { className: "mt-2 text-[10px] opacity-70", children: props.status }),
|
|
309
|
+
props.validation && /* @__PURE__ */ jsxs5("div", { className: "mt-2", role: "status", "aria-live": "polite", children: [
|
|
310
|
+
/* @__PURE__ */ jsx5("p", { className: props.validation.valid ? "text-emerald-700" : "text-red-700", children: props.validation.valid ? "Validation passed" : `Validation failed \xB7 ${props.validation.errors.length} error(s)` }),
|
|
311
|
+
props.validation.errors.length > 0 && /* @__PURE__ */ jsx5("ul", { className: "mt-1 list-disc pl-5 text-red-700", children: props.validation.errors.map((error, index) => /* @__PURE__ */ jsx5("li", { children: error }, index)) }),
|
|
312
|
+
props.validation.warnings.length > 0 && /* @__PURE__ */ jsx5("ul", { className: "mt-1 list-disc pl-5 text-amber-700", children: props.validation.warnings.map((warning, index) => /* @__PURE__ */ jsx5("li", { children: warning }, index)) })
|
|
313
|
+
] })
|
|
314
|
+
] });
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// src/authoring/UiAuthoringPreview.tsx
|
|
318
|
+
import React4 from "react";
|
|
319
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
320
|
+
function UiAuthoringPreview(props) {
|
|
321
|
+
const nodesById = new Map(props.session.nodes.map((node) => [node.id, node]));
|
|
322
|
+
const structuralChildren = (parentId) => props.session.nodes.filter(
|
|
323
|
+
(node) => node.parentId === parentId && node.kind !== "component" || node.parentId === parentId && nodesById.get(parentId)?.kind === "section"
|
|
324
|
+
);
|
|
325
|
+
const renderNode = (node) => {
|
|
326
|
+
if (node.kind === "page") {
|
|
327
|
+
return /* @__PURE__ */ jsx6("main", { "data-authoring-page": node.id, children: structuralChildren(node.id).map(renderNode) }, node.id);
|
|
328
|
+
}
|
|
329
|
+
if (node.kind === "section") {
|
|
330
|
+
return /* @__PURE__ */ jsx6("section", { "data-authoring-section": node.id, children: structuralChildren(node.id).map(renderNode) }, node.id);
|
|
331
|
+
}
|
|
332
|
+
const slotIds = node.slots || {};
|
|
333
|
+
const slots = Object.fromEntries(Object.entries(slotIds).map(([slot, childIds]) => [
|
|
334
|
+
slot,
|
|
335
|
+
childIds.map((id) => nodesById.get(id)).filter((child) => Boolean(child)).map(renderNode)
|
|
336
|
+
]));
|
|
337
|
+
return /* @__PURE__ */ jsx6(React4.Fragment, { children: props.renderComponent(node, slots) }, node.id);
|
|
338
|
+
};
|
|
339
|
+
const roots = props.session.nodes.filter(
|
|
340
|
+
(node) => !node.parentId || !nodesById.has(node.parentId)
|
|
341
|
+
);
|
|
342
|
+
if (!roots.length) return /* @__PURE__ */ jsx6("div", { className: "p-4 text-xs opacity-60", children: props.emptyMessage || "Add a page or component to preview." });
|
|
343
|
+
return /* @__PURE__ */ jsx6("div", { className: "min-h-0 w-full", children: roots.map(renderNode) });
|
|
344
|
+
}
|
|
345
|
+
|
|
297
346
|
export {
|
|
298
347
|
getAuthoringDepth,
|
|
299
348
|
getAuthoringChildren,
|
|
@@ -301,5 +350,7 @@ export {
|
|
|
301
350
|
UiAuthoringTree,
|
|
302
351
|
UiAuthoringInspector,
|
|
303
352
|
UiAuthoringBindingEditor,
|
|
304
|
-
UiAuthoringWorkspace
|
|
353
|
+
UiAuthoringWorkspace,
|
|
354
|
+
UiAuthoringValidationPanel,
|
|
355
|
+
UiAuthoringPreview
|
|
305
356
|
};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// src/editor/themes.ts
|
|
2
|
+
var skipoDarkTheme = {
|
|
3
|
+
base: "vs-dark",
|
|
4
|
+
inherit: true,
|
|
5
|
+
rules: [
|
|
6
|
+
{ token: "keyword", foreground: "d4af37" },
|
|
7
|
+
// Gold
|
|
8
|
+
{ token: "string", foreground: "98c379" },
|
|
9
|
+
// Olive
|
|
10
|
+
{ token: "number", foreground: "d19a66" },
|
|
11
|
+
// Orange
|
|
12
|
+
{ token: "comment", foreground: "5c6370", fontStyle: "italic" },
|
|
13
|
+
{ token: "type", foreground: "56b6c2" }
|
|
14
|
+
// Cyan
|
|
15
|
+
],
|
|
16
|
+
colors: {
|
|
17
|
+
"editor.background": "#16161e",
|
|
18
|
+
"editor.foreground": "#a9b1d6",
|
|
19
|
+
"editorLineNumber.foreground": "#363b54",
|
|
20
|
+
"editor.selectionBackground": "#28324a",
|
|
21
|
+
"editor.lineHighlightBackground": "#1c1c26",
|
|
22
|
+
"editorCursor.foreground": "#d4af37",
|
|
23
|
+
"editorIndentGuide.background": "#222222"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// src/editor/useMonaco.ts
|
|
28
|
+
import { useEffect, useState } from "react";
|
|
29
|
+
function useMonaco() {
|
|
30
|
+
const [monaco, setMonaco] = useState(null);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
let isMounted = true;
|
|
33
|
+
const monacoPkg = "monaco-editor";
|
|
34
|
+
import(
|
|
35
|
+
/* @vite-ignore */
|
|
36
|
+
monacoPkg
|
|
37
|
+
).then((monacoModule) => {
|
|
38
|
+
if (!isMounted) return;
|
|
39
|
+
monacoModule.editor.defineTheme("skipo-dark", skipoDarkTheme);
|
|
40
|
+
setMonaco(monacoModule);
|
|
41
|
+
}).catch((err) => {
|
|
42
|
+
console.warn("Failed to load monaco-editor", err);
|
|
43
|
+
});
|
|
44
|
+
return () => {
|
|
45
|
+
isMounted = false;
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
return monaco;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/editor/MonacoEditor.tsx
|
|
52
|
+
import { useEffect as useEffect2, useMemo, useRef, useState as useState2 } from "react";
|
|
53
|
+
import { MonacoIdeServiceFacade } from "@ultrst-armada/kloks/services";
|
|
54
|
+
import { jsx } from "react/jsx-runtime";
|
|
55
|
+
function MonacoEditor({
|
|
56
|
+
value,
|
|
57
|
+
language = "javascript",
|
|
58
|
+
readOnly = false,
|
|
59
|
+
minimap = false,
|
|
60
|
+
theme = "skipo-dark",
|
|
61
|
+
fontSize = 14,
|
|
62
|
+
sessionId,
|
|
63
|
+
uri,
|
|
64
|
+
ideService,
|
|
65
|
+
diagnostics = [],
|
|
66
|
+
completionProvider,
|
|
67
|
+
onValidate,
|
|
68
|
+
onServiceError,
|
|
69
|
+
onChange,
|
|
70
|
+
height = "100%",
|
|
71
|
+
width = "100%"
|
|
72
|
+
}) {
|
|
73
|
+
const containerRef = useRef(null);
|
|
74
|
+
const editorRef = useRef(null);
|
|
75
|
+
const sessionRef = useRef(sessionId);
|
|
76
|
+
const sessionReadyRef = useRef(Promise.resolve());
|
|
77
|
+
const monaco = useMonaco();
|
|
78
|
+
const service = ideService || MonacoIdeServiceFacade;
|
|
79
|
+
const [validationDiagnostics, setValidationDiagnostics] = useState2([]);
|
|
80
|
+
const validationRunRef = useRef(0);
|
|
81
|
+
const completionProviderRef = useRef(completionProvider);
|
|
82
|
+
const validateRef = useRef(onValidate);
|
|
83
|
+
const errorRef = useRef(onServiceError);
|
|
84
|
+
completionProviderRef.current = completionProvider;
|
|
85
|
+
validateRef.current = onValidate;
|
|
86
|
+
errorRef.current = onServiceError;
|
|
87
|
+
const activeDiagnostics = useMemo(() => [...diagnostics, ...validationDiagnostics], [diagnostics, validationDiagnostics]);
|
|
88
|
+
const executeForSession = (operation, input) => sessionReadyRef.current.then(() => service.execute(operation, input)).catch((error) => {
|
|
89
|
+
errorRef.current?.(error);
|
|
90
|
+
});
|
|
91
|
+
useEffect2(() => {
|
|
92
|
+
if (!sessionRef.current) sessionRef.current = sessionId || `editor-${Date.now().toString(36)}`;
|
|
93
|
+
sessionReadyRef.current = service.execute("createSession", {
|
|
94
|
+
sessionId: sessionRef.current,
|
|
95
|
+
uri: uri || `inmemory://${sessionRef.current}`,
|
|
96
|
+
language,
|
|
97
|
+
value,
|
|
98
|
+
options: { readOnly, minimap, fontSize }
|
|
99
|
+
});
|
|
100
|
+
void sessionReadyRef.current.catch((error) => errorRef.current?.(error));
|
|
101
|
+
return () => {
|
|
102
|
+
if (sessionRef.current) {
|
|
103
|
+
void sessionReadyRef.current.then(() => service.execute("disposeSession", { sessionId: sessionRef.current })).catch((error) => errorRef.current?.(error));
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}, []);
|
|
107
|
+
useEffect2(() => {
|
|
108
|
+
if (!monaco || !containerRef.current) return;
|
|
109
|
+
if (!editorRef.current) {
|
|
110
|
+
editorRef.current = monaco.editor.create(containerRef.current, {
|
|
111
|
+
value,
|
|
112
|
+
language,
|
|
113
|
+
theme,
|
|
114
|
+
readOnly,
|
|
115
|
+
fontSize,
|
|
116
|
+
minimap: { enabled: minimap },
|
|
117
|
+
automaticLayout: true,
|
|
118
|
+
scrollBeyondLastLine: false,
|
|
119
|
+
padding: { top: 16, bottom: 16 }
|
|
120
|
+
});
|
|
121
|
+
editorRef.current.onDidChangeModelContent(() => {
|
|
122
|
+
const nextValue = editorRef.current.getValue();
|
|
123
|
+
const currentSessionId = sessionRef.current;
|
|
124
|
+
void executeForSession("updateDocument", {
|
|
125
|
+
sessionId: currentSessionId,
|
|
126
|
+
value: nextValue,
|
|
127
|
+
language
|
|
128
|
+
});
|
|
129
|
+
const validate = validateRef.current;
|
|
130
|
+
if (validate && currentSessionId) {
|
|
131
|
+
const sequence = ++validationRunRef.current;
|
|
132
|
+
const document = {
|
|
133
|
+
uri: uri || `inmemory://${currentSessionId}`,
|
|
134
|
+
language,
|
|
135
|
+
value: nextValue,
|
|
136
|
+
version: sequence,
|
|
137
|
+
diagnostics: []
|
|
138
|
+
};
|
|
139
|
+
void validate(document).then((nextDiagnostics) => {
|
|
140
|
+
if (sequence !== validationRunRef.current) return;
|
|
141
|
+
setValidationDiagnostics(nextDiagnostics);
|
|
142
|
+
return executeForSession("setDiagnostics", { sessionId: currentSessionId, diagnostics: nextDiagnostics });
|
|
143
|
+
}).catch((error) => errorRef.current?.(error));
|
|
144
|
+
}
|
|
145
|
+
onChange?.(nextValue);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return () => {
|
|
149
|
+
if (editorRef.current) {
|
|
150
|
+
editorRef.current.dispose();
|
|
151
|
+
editorRef.current = null;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}, [monaco]);
|
|
155
|
+
useEffect2(() => {
|
|
156
|
+
if (editorRef.current && value !== editorRef.current.getValue()) editorRef.current.setValue(value);
|
|
157
|
+
}, [value]);
|
|
158
|
+
useEffect2(() => {
|
|
159
|
+
if (!editorRef.current) return;
|
|
160
|
+
monaco?.editor.setModelLanguage(editorRef.current.getModel(), language);
|
|
161
|
+
editorRef.current.updateOptions({ readOnly, fontSize, minimap: { enabled: minimap } });
|
|
162
|
+
if (theme) monaco?.editor.setTheme(theme);
|
|
163
|
+
if (sessionRef.current) {
|
|
164
|
+
void executeForSession("setOptions", {
|
|
165
|
+
sessionId: sessionRef.current,
|
|
166
|
+
options: { readOnly, minimap, fontSize }
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}, [language, readOnly, fontSize, minimap, theme, monaco]);
|
|
170
|
+
useEffect2(() => {
|
|
171
|
+
if (!monaco || !editorRef.current) return;
|
|
172
|
+
const model = editorRef.current.getModel();
|
|
173
|
+
if (!model) return;
|
|
174
|
+
const severity = monaco.MarkerSeverity || {};
|
|
175
|
+
monaco.editor.setModelMarkers(model, "kloks", activeDiagnostics.map((diagnostic) => ({
|
|
176
|
+
message: diagnostic.message,
|
|
177
|
+
severity: severity[diagnostic.severity === "error" ? "Error" : diagnostic.severity === "warning" ? "Warning" : diagnostic.severity === "info" ? "Info" : "Hint"] ?? severity.Error,
|
|
178
|
+
startLineNumber: diagnostic.startLineNumber,
|
|
179
|
+
startColumn: diagnostic.startColumn,
|
|
180
|
+
endLineNumber: diagnostic.endLineNumber,
|
|
181
|
+
endColumn: diagnostic.endColumn,
|
|
182
|
+
code: diagnostic.code,
|
|
183
|
+
source: "kloks"
|
|
184
|
+
})));
|
|
185
|
+
if (sessionRef.current) {
|
|
186
|
+
void executeForSession("setDiagnostics", {
|
|
187
|
+
sessionId: sessionRef.current,
|
|
188
|
+
diagnostics: activeDiagnostics
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}, [monaco, activeDiagnostics, service]);
|
|
192
|
+
useEffect2(() => {
|
|
193
|
+
if (!monaco || !completionProviderRef.current || !monaco.languages?.registerCompletionItemProvider) return;
|
|
194
|
+
const disposable = monaco.languages.registerCompletionItemProvider(language, {
|
|
195
|
+
triggerCharacters: ["."],
|
|
196
|
+
provideCompletionItems: async (model, position) => {
|
|
197
|
+
const provider = completionProviderRef.current;
|
|
198
|
+
if (!provider) return { suggestions: [] };
|
|
199
|
+
const currentSessionId = sessionRef.current;
|
|
200
|
+
if (!currentSessionId) return { suggestions: [] };
|
|
201
|
+
const word = model.getWordUntilPosition(position);
|
|
202
|
+
const range = {
|
|
203
|
+
startLineNumber: position.lineNumber,
|
|
204
|
+
endLineNumber: position.lineNumber,
|
|
205
|
+
startColumn: word.startColumn,
|
|
206
|
+
endColumn: word.endColumn
|
|
207
|
+
};
|
|
208
|
+
const items = await provider({
|
|
209
|
+
sessionId: currentSessionId,
|
|
210
|
+
uri: model.uri?.toString?.() || uri || `inmemory://${currentSessionId}`,
|
|
211
|
+
language: model.getLanguageId(),
|
|
212
|
+
value: model.getValue(),
|
|
213
|
+
position: {
|
|
214
|
+
lineNumber: position.lineNumber,
|
|
215
|
+
column: position.column,
|
|
216
|
+
offset: model.getOffsetAt(position)
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
const kinds = monaco.languages.CompletionItemKind || {};
|
|
220
|
+
return {
|
|
221
|
+
suggestions: items.map((item) => ({
|
|
222
|
+
...item,
|
|
223
|
+
kind: kinds[item.kind || "Text"] ?? kinds.Text,
|
|
224
|
+
insertText: item.insertText ?? item.label,
|
|
225
|
+
range
|
|
226
|
+
}))
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
return () => disposable?.dispose?.();
|
|
231
|
+
}, [monaco, language, uri]);
|
|
232
|
+
return /* @__PURE__ */ jsx("div", { ref: containerRef, style: { width, height, overflow: "hidden", borderRadius: "8px" } });
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export {
|
|
236
|
+
skipoDarkTheme,
|
|
237
|
+
useMonaco,
|
|
238
|
+
MonacoEditor
|
|
239
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { MonacoDiagnostic, MonacoCompletionProvider, MonacoDocument } from '@ultrst-armada/kloks/contracts';
|
|
2
3
|
|
|
3
4
|
interface EditorConfig {
|
|
4
5
|
value: string;
|
|
@@ -41,10 +42,14 @@ interface MonacoEditorProps extends EditorConfig {
|
|
|
41
42
|
sessionId?: string;
|
|
42
43
|
uri?: string;
|
|
43
44
|
ideService?: MonacoIdeServicePort;
|
|
45
|
+
diagnostics?: MonacoDiagnostic[];
|
|
46
|
+
completionProvider?: MonacoCompletionProvider;
|
|
47
|
+
onValidate?: (document: MonacoDocument) => Promise<MonacoDiagnostic[]>;
|
|
48
|
+
onServiceError?: (error: unknown) => void;
|
|
44
49
|
onChange?: (value: string) => void;
|
|
45
50
|
height?: string | number;
|
|
46
51
|
width?: string | number;
|
|
47
52
|
}
|
|
48
|
-
declare function MonacoEditor({ value, language, readOnly, minimap, theme, fontSize, sessionId, uri, ideService, onChange, height, width, }: MonacoEditorProps): React.JSX.Element;
|
|
53
|
+
declare function MonacoEditor({ value, language, readOnly, minimap, theme, fontSize, sessionId, uri, ideService, diagnostics, completionProvider, onValidate, onServiceError, onChange, height, width, }: MonacoEditorProps): React.JSX.Element;
|
|
49
54
|
|
|
50
55
|
export { type EditorConfig, MonacoEditor, type MonacoEditorProps, type MonacoIdeServicePort, skipoDarkTheme, useMonaco };
|
|
@@ -10,7 +10,8 @@ export { FrnlEditableNodeGraph, FrnlEditableNodeGraphProps, frnlEditableNodeGrap
|
|
|
10
10
|
export { B as BIOME_CONFIGS, C as COORD_SCALE, a as CameraState, b as Canvas2DViewerProps, c as ConnectingWireState } from './types-D3RRfQUo.js';
|
|
11
11
|
export { CanvasBackground2D, CanvasErrorBoundary, ContainerNode2D, EffectNode2D, MagneticTraces2D, ModuleNode2D, NODE_CARD_WIDTH, Node2DBase, Node2DBaseProps, NodeRenderer2D, NodeRenderer2DProps, RecorderWaveformDisplay, RecorderWaveformDisplayProps, RotaryKnob, RotaryKnobProps, SOCKET_ROW_HEIGHT, Socket2D, Socket2DProps, SocketScreenPosition, TriggerNode2D, Wire2D, Wire2DProps, getSocketLocalOffset, getSocketScreenPosition, renderSpriteIcon, useCanvas2DCoordinates, useCanvas2DMagnetic } from './graph-2d/index.js';
|
|
12
12
|
export { PredictiveGhostNodeCard, PredictiveGhostNodeCardProps, PredictiveHudToolbar, PredictiveLayer2D, PredictiveLayer2DProps, UsePredictiveGraph2DProps, UseViewer2DPredictiveProps, usePredictiveGraph2D } from './predictive/index.js';
|
|
13
|
-
export { AuthoringAssetRef, UIAuthoringContext, UIAuthoringNode, UIAuthoringNodeKind, UIAuthoringSession, UiAuthoringBindingEditor, UiAuthoringInspector, UiAuthoringTree, UiAuthoringWorkspace, getAuthoringChildren, getAuthoringDepth, getAuthoringSubtreeIds } from './authoring/index.js';
|
|
13
|
+
export { AuthoringAssetRef, UIAuthoringContext, UIAuthoringNode, UIAuthoringNodeKind, UIAuthoringSession, UiAuthoringBindingEditor, UiAuthoringComponentRenderer, UiAuthoringInspector, UiAuthoringPreview, UiAuthoringTree, UiAuthoringValidationPanel, UiAuthoringWorkspace, getAuthoringChildren, getAuthoringDepth, getAuthoringSubtreeIds } from './authoring/index.js';
|
|
14
|
+
import '@ultrst-armada/kloks/contracts';
|
|
14
15
|
|
|
15
16
|
interface MidpointWidgetsProps {
|
|
16
17
|
x: number;
|
|
@@ -7,12 +7,14 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
UiAuthoringBindingEditor,
|
|
9
9
|
UiAuthoringInspector,
|
|
10
|
+
UiAuthoringPreview,
|
|
10
11
|
UiAuthoringTree,
|
|
12
|
+
UiAuthoringValidationPanel,
|
|
11
13
|
UiAuthoringWorkspace,
|
|
12
14
|
getAuthoringChildren,
|
|
13
15
|
getAuthoringDepth,
|
|
14
16
|
getAuthoringSubtreeIds
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TS7P3WWH.js";
|
|
16
18
|
import {
|
|
17
19
|
CanvasViewport,
|
|
18
20
|
InfiniteCanvas,
|
|
@@ -28,7 +30,16 @@ import {
|
|
|
28
30
|
MonacoEditor,
|
|
29
31
|
skipoDarkTheme,
|
|
30
32
|
useMonaco
|
|
31
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ZJXRL74D.js";
|
|
34
|
+
import {
|
|
35
|
+
CanvasContextMenu,
|
|
36
|
+
CompatibleNodePicker,
|
|
37
|
+
FrnlEditableNodeGraph,
|
|
38
|
+
NodeSearchPalette,
|
|
39
|
+
frnlEditableNodeGraphDefinition,
|
|
40
|
+
menuCategory,
|
|
41
|
+
menuHidden
|
|
42
|
+
} from "./chunk-VESG3VP3.js";
|
|
32
43
|
import {
|
|
33
44
|
BIOME_CONFIGS,
|
|
34
45
|
COORD_SCALE,
|
|
@@ -45,20 +56,14 @@ import {
|
|
|
45
56
|
useCanvas2DCoordinates,
|
|
46
57
|
useCanvas2DMagnetic
|
|
47
58
|
} from "./chunk-XVAHT5WE.js";
|
|
48
|
-
import {
|
|
49
|
-
CanvasContextMenu,
|
|
50
|
-
CompatibleNodePicker,
|
|
51
|
-
FrnlEditableNodeGraph,
|
|
52
|
-
NodeSearchPalette,
|
|
53
|
-
frnlEditableNodeGraphDefinition,
|
|
54
|
-
menuCategory,
|
|
55
|
-
menuHidden
|
|
56
|
-
} from "./chunk-VESG3VP3.js";
|
|
57
59
|
import {
|
|
58
60
|
PredictiveGhostNodeCard,
|
|
59
61
|
PredictiveHudToolbar,
|
|
60
62
|
PredictiveLayer2D
|
|
61
63
|
} from "./chunk-RH5NINIT.js";
|
|
64
|
+
import {
|
|
65
|
+
usePredictiveGraph2D
|
|
66
|
+
} from "./chunk-QRYNQ36L.js";
|
|
62
67
|
import {
|
|
63
68
|
NODE_CARD_WIDTH,
|
|
64
69
|
Node2DBase,
|
|
@@ -69,9 +74,6 @@ import {
|
|
|
69
74
|
getSocketScreenPosition,
|
|
70
75
|
renderSpriteIcon
|
|
71
76
|
} from "./chunk-U2SC3RMJ.js";
|
|
72
|
-
import {
|
|
73
|
-
usePredictiveGraph2D
|
|
74
|
-
} from "./chunk-QRYNQ36L.js";
|
|
75
77
|
|
|
76
78
|
// src/node-graph-ui/widgets/MidpointWidgets.tsx
|
|
77
79
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -741,7 +743,9 @@ export {
|
|
|
741
743
|
TriggerNode2D,
|
|
742
744
|
UiAuthoringBindingEditor,
|
|
743
745
|
UiAuthoringInspector,
|
|
746
|
+
UiAuthoringPreview,
|
|
744
747
|
UiAuthoringTree,
|
|
748
|
+
UiAuthoringValidationPanel,
|
|
745
749
|
UiAuthoringWorkspace,
|
|
746
750
|
Viewer2DNodes,
|
|
747
751
|
Wire2D,
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
PredictiveHudToolbar,
|
|
4
4
|
PredictiveLayer2D
|
|
5
5
|
} from "../chunk-RH5NINIT.js";
|
|
6
|
-
import "../chunk-U2SC3RMJ.js";
|
|
7
6
|
import {
|
|
8
7
|
usePredictiveGraph2D
|
|
9
8
|
} from "../chunk-QRYNQ36L.js";
|
|
9
|
+
import "../chunk-U2SC3RMJ.js";
|
|
10
10
|
export {
|
|
11
11
|
PredictiveGhostNodeCard,
|
|
12
12
|
PredictiveHudToolbar,
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@floks/ui": "workspace:*",
|
|
67
67
|
"@ultrst-armada/frnlts": "^0.2.7",
|
|
68
|
-
"@ultrst-armada/kloks": "^1.
|
|
68
|
+
"@ultrst-armada/kloks": "^1.17.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@dnd-kit/core": "^6.0.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@dnd-kit/utilities": "^3.0.0",
|
|
74
74
|
"monaco-editor": "^0.50.0",
|
|
75
75
|
"react": "^18.0.0 || ^19.0.0",
|
|
76
|
-
"@ultrst-armada/kloks": "^1.
|
|
76
|
+
"@ultrst-armada/kloks": "^1.12.0"
|
|
77
77
|
},
|
|
78
78
|
"peerDependenciesMeta": {
|
|
79
79
|
"@dnd-kit/core": {
|