@loopstack/loopstack-studio 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.js +12 -10
- package/dist/api/secrets.js +16 -0
- package/dist/components/dynamic-form/ArrayController.js +68 -64
- package/dist/components/dynamic-form/Form.js +56 -27
- package/dist/components/dynamic-form/FormElement.js +1 -1
- package/dist/components/dynamic-form/FormElementHeader.js +2 -2
- package/dist/components/dynamic-form/InputController.js +3 -1
- package/dist/components/dynamic-form/ObjectController.js +24 -21
- package/dist/components/dynamic-form/fields/BaseFieldWrapper.js +1 -1
- package/dist/components/dynamic-form/fields/InputField.js +20 -19
- package/dist/components/dynamic-form/fields/MarkdownViewField.js +20 -0
- package/dist/components/dynamic-form/fields/RadioField.js +18 -18
- package/dist/components/dynamic-form/fields/SelectField.js +19 -19
- package/dist/components/dynamic-form/fields/TextareaField.js +17 -17
- package/dist/components/layout/MainLayout.js +18 -31
- package/dist/components/layout/StudioSidebar.js +168 -108
- package/dist/components/page/PageBreadcrumbs.js +79 -32
- package/dist/components/ui-widgets/UiWidget.js +36 -27
- package/dist/components/ui-widgets/widgets/SecretInput.js +42 -0
- package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +80 -4
- package/dist/features/code-explorer/components/FileContentViewer.js +47 -30
- package/dist/features/code-explorer/components/FileTabsBar.js +3 -190
- package/dist/features/code-explorer/components/FileTabsBarBase.js +190 -0
- package/dist/features/code-explorer/index.js +2 -2
- package/dist/features/code-explorer/providers/CodeExplorerProvider.js +2 -162
- package/dist/features/code-explorer/utils/fileIcons.js +7 -4
- package/dist/features/debug/components/PipelineFlowViewer.js +46 -45
- package/dist/features/debug/components/pipeline-flow/WorkflowGraph.js +19 -19
- package/dist/features/documents/DocumentRenderer.js +20 -15
- package/dist/features/documents/components/DocumentList.js +5 -1
- package/dist/features/documents/renderers/AiMessage.js +11 -11
- package/dist/features/documents/renderers/ClaudeMessage.js +96 -0
- package/dist/features/documents/renderers/DocumentFormRenderer.js +17 -11
- package/dist/features/workbench/Workbench.js +64 -80
- package/dist/features/workbench/WorkflowItem.js +5 -5
- package/dist/features/workbench/components/RemoteFileTabsBar.js +18 -0
- package/dist/features/workbench/components/RemoteFileTree.js +90 -0
- package/dist/features/workbench/components/WorkbenchFilesPanel.js +67 -0
- package/dist/features/workbench/components/WorkbenchFloatingPanel.js +57 -49
- package/dist/features/workbench/components/WorkbenchFlowPanel.js +2 -2
- package/dist/features/workbench/components/WorkbenchIconSidebar.js +48 -28
- package/dist/features/workbench/components/WorkbenchSecretsPanel.js +182 -0
- package/dist/features/workbench/hooks/useWorkflowData.js +4 -4
- package/dist/features/workbench/providers/RemoteFileExplorerProvider.js +160 -0
- package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +46 -43
- package/dist/features/workspaces/components/PipelineForm.js +1 -1
- package/dist/features/workspaces/components/WorkspaceHomePage.js +93 -0
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/query-keys.js +41 -34
- package/dist/hooks/useFiles.js +1 -43
- package/dist/hooks/useSecrets.js +69 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +3 -2
- package/dist/node_modules/@xyflow/react/dist/esm/index.js +1 -1
- package/dist/pages/DashboardPage.js +87 -35
- package/dist/pages/EmbedWorkbenchPage.js +43 -39
- package/dist/pages/PipelineDebugPage.js +1 -1
- package/dist/pages/PreviewWorkbenchPage.js +167 -70
- package/dist/pages/WorkspacePage.js +102 -50
- package/dist/pages/WorkspaceRunsPage.js +71 -0
- package/dist/routing/LocalRouter.js +6 -0
- package/dist/types/ai.types.js +13 -0
- package/package.json +2 -3
- package/dist/node_modules/@ai-sdk/provider/dist/index.js +0 -65
- package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js +0 -1008
- package/dist/node_modules/ai/dist/index.js +0 -1083
- package/dist/node_modules/zod/v3/ZodError.js +0 -79
- package/dist/node_modules/zod/v3/errors.js +0 -6
- package/dist/node_modules/zod/v3/helpers/errorUtil.js +0 -5
- package/dist/node_modules/zod/v3/helpers/parseUtil.js +0 -90
- package/dist/node_modules/zod/v3/helpers/util.js +0 -72
- package/dist/node_modules/zod/v3/locales/en.js +0 -58
- package/dist/node_modules/zod/v3/types.js +0 -2425
- package/dist/node_modules/zod/v4/classic/errors.js +0 -21
- package/dist/node_modules/zod/v4/classic/iso.js +0 -29
- package/dist/node_modules/zod/v4/classic/parse.js +0 -4
- package/dist/node_modules/zod/v4/classic/schemas.js +0 -392
- package/dist/node_modules/zod/v4/core/api.js +0 -532
- package/dist/node_modules/zod/v4/core/checks.js +0 -283
- package/dist/node_modules/zod/v4/core/core.js +0 -44
- package/dist/node_modules/zod/v4/core/doc.js +0 -21
- package/dist/node_modules/zod/v4/core/errors.js +0 -40
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -305
- package/dist/node_modules/zod/v4/core/parse.js +0 -66
- package/dist/node_modules/zod/v4/core/regexes.js +0 -28
- package/dist/node_modules/zod/v4/core/registries.js +0 -38
- package/dist/node_modules/zod/v4/core/schemas.js +0 -863
- package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -220
- package/dist/node_modules/zod/v4/core/util.js +0 -267
- package/dist/node_modules/zod/v4/core/versions.js +0 -6
package/dist/api/index.js
CHANGED
|
@@ -5,20 +5,22 @@ import { createDocumentsApi } from "./documents.js";
|
|
|
5
5
|
import { createNamespacesApi } from "./namespaces.js";
|
|
6
6
|
import { createPipelinesApi } from "./pipelines.js";
|
|
7
7
|
import { createProcessorApi } from "./processor.js";
|
|
8
|
+
import { createSecretsApi } from "./secrets.js";
|
|
8
9
|
import { createWorkflowsApi } from "./workflows.js";
|
|
9
10
|
import { createWorkspacesApi } from "./workspaces.js";
|
|
10
11
|
import { createAxiosClient } from "./client.js";
|
|
11
|
-
function createApi(
|
|
12
|
+
function createApi(d) {
|
|
12
13
|
return {
|
|
13
|
-
auth: createAuthApi(
|
|
14
|
-
config: createConfigApi(
|
|
15
|
-
dashboard: createDashboardApi(
|
|
16
|
-
documents: createDocumentsApi(
|
|
17
|
-
namespaces: createNamespacesApi(
|
|
18
|
-
pipelines: createPipelinesApi(
|
|
19
|
-
processor: createProcessorApi(
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
auth: createAuthApi(d),
|
|
15
|
+
config: createConfigApi(d),
|
|
16
|
+
dashboard: createDashboardApi(d),
|
|
17
|
+
documents: createDocumentsApi(d),
|
|
18
|
+
namespaces: createNamespacesApi(d),
|
|
19
|
+
pipelines: createPipelinesApi(d),
|
|
20
|
+
processor: createProcessorApi(d),
|
|
21
|
+
secrets: createSecretsApi(d),
|
|
22
|
+
workflows: createWorkflowsApi(d),
|
|
23
|
+
workspaces: createWorkspacesApi(d)
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
export { createApi };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function createSecretsApi(e) {
|
|
2
|
+
return {
|
|
3
|
+
getByWorkspaceId: (t) => e.get(`/api/v1/workspaces/${t.workspaceId}/secrets`).then((e) => e.data),
|
|
4
|
+
create: (t) => e.post(`/api/v1/workspaces/${t.workspaceId}/secrets`, {
|
|
5
|
+
key: t.key,
|
|
6
|
+
value: t.value
|
|
7
|
+
}).then((e) => e.data),
|
|
8
|
+
upsert: (t) => e.put(`/api/v1/workspaces/${t.workspaceId}/secrets/upsert`, {
|
|
9
|
+
key: t.key,
|
|
10
|
+
value: t.value
|
|
11
|
+
}).then((e) => e.data),
|
|
12
|
+
update: (t) => e.put(`/api/v1/workspaces/${t.workspaceId}/secrets/${t.id}`, { value: t.value }).then((e) => e.data),
|
|
13
|
+
delete: (t) => e.delete(`/api/v1/workspaces/${t.workspaceId}/secrets/${t.id}`).then((e) => e.data)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export { createSecretsApi };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Button } from "../ui/button.js";
|
|
2
|
+
import { Card, CardContent } from "../ui/card.js";
|
|
2
3
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../ui/collapsible.js";
|
|
3
4
|
import { useArrayDefaultValue } from "./hooks/useArrayDefaultValue.js";
|
|
4
5
|
import { useMergeParentKey } from "./hooks/useMergeParentKey.js";
|
|
@@ -8,93 +9,96 @@ import React, { useState } from "react";
|
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { ChevronDown, ChevronRight, Plus, Trash2 } from "lucide-react";
|
|
10
11
|
import { useFieldArray } from "react-hook-form";
|
|
11
|
-
const ArrayController = (
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
control:
|
|
15
|
-
name:
|
|
16
|
-
},
|
|
17
|
-
let { fields:
|
|
18
|
-
|
|
19
|
-
let
|
|
20
|
-
|
|
12
|
+
const ArrayController = (y) => {
|
|
13
|
+
let b = c(48), { name: x, schema: S, ui: C, form: w, disabled: T, parentKey: E, viewOnly: D } = y, O = useMergeParentKey(E, x), k = C?.collapsed ?? !1, A = C?.fixed ?? !1, [j, M] = useState(!k), N = O ?? "", P;
|
|
14
|
+
b[0] !== w.control || b[1] !== N ? (P = {
|
|
15
|
+
control: w.control,
|
|
16
|
+
name: N
|
|
17
|
+
}, b[0] = w.control, b[1] = N, b[2] = P) : P = b[2];
|
|
18
|
+
let { fields: F, append: I, remove: L } = useFieldArray(P), R = useArrayDefaultValue(S.items), z;
|
|
19
|
+
b[3] === j ? z = b[4] : (z = jsx(j ? ChevronDown : ChevronRight, { className: "h-4 w-4" }), b[3] = j, b[4] = z);
|
|
20
|
+
let B = C?.title ?? S.title ?? x, V;
|
|
21
|
+
b[5] !== F.length || b[6] !== j ? (V = !j && /* @__PURE__ */ jsxs("span", {
|
|
21
22
|
className: "ml-2 text-sm text-gray-500",
|
|
22
23
|
children: [
|
|
23
24
|
"(",
|
|
24
|
-
|
|
25
|
+
F.length,
|
|
25
26
|
" ",
|
|
26
|
-
|
|
27
|
+
F.length === 1 ? "item" : "items",
|
|
27
28
|
")"
|
|
28
29
|
]
|
|
29
|
-
}),
|
|
30
|
-
let
|
|
31
|
-
|
|
30
|
+
}), b[5] = F.length, b[6] = j, b[7] = V) : V = b[7];
|
|
31
|
+
let H;
|
|
32
|
+
b[8] !== B || b[9] !== V ? (H = /* @__PURE__ */ jsxs("span", {
|
|
32
33
|
className: "font-medium",
|
|
33
|
-
children: [
|
|
34
|
-
}),
|
|
35
|
-
let
|
|
36
|
-
|
|
34
|
+
children: [B, V]
|
|
35
|
+
}), b[8] = B, b[9] = V, b[10] = H) : H = b[10];
|
|
36
|
+
let U;
|
|
37
|
+
b[11] !== z || b[12] !== H ? (U = /* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
37
38
|
asChild: !0,
|
|
38
39
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
39
40
|
variant: "ghost",
|
|
40
41
|
size: "sm",
|
|
41
42
|
className: "mb-2 flex items-center gap-2 p-2 hover:bg-gray-100",
|
|
42
43
|
type: "button",
|
|
43
|
-
children: [
|
|
44
|
+
children: [z, H]
|
|
44
45
|
})
|
|
45
|
-
}),
|
|
46
|
-
let
|
|
47
|
-
if (
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
className:
|
|
51
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
52
|
-
className: "
|
|
53
|
-
children:
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
}), b[11] = z, b[12] = H, b[13] = U) : U = b[13];
|
|
47
|
+
let W;
|
|
48
|
+
if (b[14] !== T || b[15] !== F || b[16] !== A || b[17] !== w || b[18] !== O || b[19] !== L || b[20] !== S.items || b[21] !== C?.items || b[22] !== D) {
|
|
49
|
+
let _;
|
|
50
|
+
b[24] !== T || b[25] !== A || b[26] !== w || b[27] !== O || b[28] !== L || b[29] !== S.items || b[30] !== C?.items || b[31] !== D ? (_ = (_, v) => /* @__PURE__ */ jsxs(Card, {
|
|
51
|
+
className: "gap-0 rounded-lg py-0 shadow-none",
|
|
52
|
+
children: [!D && !A && /* @__PURE__ */ jsx("div", {
|
|
53
|
+
className: "flex justify-end px-4 pt-2 pb-0",
|
|
54
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
55
|
+
type: "button",
|
|
56
|
+
onClick: () => L(v),
|
|
57
|
+
variant: "ghost",
|
|
58
|
+
size: "sm",
|
|
59
|
+
disabled: T,
|
|
60
|
+
className: "h-7 w-7 p-1.5",
|
|
61
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
|
|
62
|
+
})
|
|
63
|
+
}), /* @__PURE__ */ jsx(CardContent, {
|
|
64
|
+
className: `px-4 pb-2 ${!D && !A ? "pt-0" : "pt-3"}`,
|
|
65
|
+
children: S.items && /* @__PURE__ */ jsx(FormElement, {
|
|
66
|
+
name: v.toString(),
|
|
67
|
+
parentKey: O,
|
|
56
68
|
required: !1,
|
|
57
|
-
schema:
|
|
58
|
-
ui:
|
|
59
|
-
form:
|
|
60
|
-
disabled:
|
|
61
|
-
viewOnly:
|
|
69
|
+
schema: S.items,
|
|
70
|
+
ui: C?.items,
|
|
71
|
+
form: w,
|
|
72
|
+
disabled: T,
|
|
73
|
+
viewOnly: D
|
|
62
74
|
})
|
|
63
|
-
}), T ? "" : /* @__PURE__ */ jsx(Button, {
|
|
64
|
-
type: "button",
|
|
65
|
-
onClick: () => N(g),
|
|
66
|
-
variant: "ghost",
|
|
67
|
-
size: "sm",
|
|
68
|
-
disabled: C,
|
|
69
|
-
className: "mt-1 h-8 w-8 p-2",
|
|
70
|
-
children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
|
|
71
75
|
})]
|
|
72
|
-
},
|
|
73
|
-
} else
|
|
74
|
-
let
|
|
75
|
-
|
|
76
|
+
}, _.id), b[24] = T, b[25] = A, b[26] = w, b[27] = O, b[28] = L, b[29] = S.items, b[30] = C?.items, b[31] = D, b[32] = _) : _ = b[32], W = F.map(_), b[14] = T, b[15] = F, b[16] = A, b[17] = w, b[18] = O, b[19] = L, b[20] = S.items, b[21] = C?.items, b[22] = D, b[23] = W;
|
|
77
|
+
} else W = b[23];
|
|
78
|
+
let G;
|
|
79
|
+
b[33] !== I || b[34] !== R || b[35] !== T || b[36] !== A || b[37] !== S.items?.title || b[38] !== C?.items?.title || b[39] !== D ? (G = !D && !A ? /* @__PURE__ */ jsxs(Button, {
|
|
76
80
|
type: "button",
|
|
77
|
-
onClick: () =>
|
|
81
|
+
onClick: () => I(R),
|
|
78
82
|
variant: "outline",
|
|
79
83
|
size: "sm",
|
|
80
|
-
disabled:
|
|
81
|
-
className: "mt-
|
|
84
|
+
disabled: T,
|
|
85
|
+
className: "mt-2",
|
|
82
86
|
children: [
|
|
83
87
|
/* @__PURE__ */ jsx(Plus, { className: "mr-2 h-4 w-4" }),
|
|
84
88
|
"Add ",
|
|
85
|
-
|
|
89
|
+
C?.items?.title ?? S.items?.title ?? "Item"
|
|
86
90
|
]
|
|
87
|
-
}),
|
|
88
|
-
let
|
|
89
|
-
|
|
90
|
-
className: "
|
|
91
|
-
children: [
|
|
92
|
-
}) }),
|
|
93
|
-
let
|
|
94
|
-
return
|
|
95
|
-
open:
|
|
96
|
-
onOpenChange:
|
|
97
|
-
children: [
|
|
98
|
-
}),
|
|
91
|
+
}) : "", b[33] = I, b[34] = R, b[35] = T, b[36] = A, b[37] = S.items?.title, b[38] = C?.items?.title, b[39] = D, b[40] = G) : G = b[40];
|
|
92
|
+
let K;
|
|
93
|
+
b[41] !== W || b[42] !== G ? (K = /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsxs("div", {
|
|
94
|
+
className: "space-y-2",
|
|
95
|
+
children: [W, G]
|
|
96
|
+
}) }), b[41] = W, b[42] = G, b[43] = K) : K = b[43];
|
|
97
|
+
let q;
|
|
98
|
+
return b[44] !== j || b[45] !== K || b[46] !== U ? (q = /* @__PURE__ */ jsxs(Collapsible, {
|
|
99
|
+
open: j,
|
|
100
|
+
onOpenChange: M,
|
|
101
|
+
children: [U, K]
|
|
102
|
+
}), b[44] = j, b[45] = K, b[46] = U, b[47] = q) : q = b[47], q;
|
|
99
103
|
};
|
|
100
104
|
export { ArrayController };
|
|
@@ -1,35 +1,64 @@
|
|
|
1
1
|
import { FormElementHeader } from "./FormElementHeader.js";
|
|
2
2
|
import FormBody_default from "./FormBody.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
|
-
import React from "react";
|
|
4
|
+
import React, { useEffect } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
import { FormProvider } from "react-hook-form";
|
|
7
|
+
function extractSchemaDefaults(e) {
|
|
8
|
+
if (e.default !== void 0) return e.default;
|
|
9
|
+
if (e.properties) {
|
|
10
|
+
let a = {}, o = !1;
|
|
11
|
+
for (let [s, l] of Object.entries(e.properties)) if (l.default !== void 0) a[s] = l.default, o = !0;
|
|
12
|
+
else if (l.type === "object" && l.properties) {
|
|
13
|
+
let e = extractSchemaDefaults(l);
|
|
14
|
+
e !== void 0 && (a[s] = e, o = !0);
|
|
15
|
+
}
|
|
16
|
+
return o ? a : void 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
var Form_default = (s) => {
|
|
20
|
+
let u = c(28), { form: d, schema: f, ui: p, mimeType: m, disabled: h, viewOnly: g, actions: _ } = s, v = p, y = f, b;
|
|
21
|
+
u[0] !== d || u[1] !== y ? (b = () => {
|
|
22
|
+
let e = extractSchemaDefaults(y);
|
|
23
|
+
if (e) {
|
|
24
|
+
let a = d.getValues(), o = { ...e };
|
|
25
|
+
for (let [e, s] of Object.entries(a)) s !== void 0 && s !== "" && s !== null && (o[e] = s);
|
|
26
|
+
d.reset(o);
|
|
27
|
+
}
|
|
28
|
+
}, u[0] = d, u[1] = y, u[2] = b) : b = u[2];
|
|
29
|
+
let x;
|
|
30
|
+
u[3] === f ? x = u[4] : (x = [f], u[3] = f, u[4] = x), useEffect(b, x);
|
|
31
|
+
let S = v?.form?.title, C = v?.form?.description, w;
|
|
32
|
+
u[5] !== h || u[6] !== S || u[7] !== C ? (w = /* @__PURE__ */ jsx(FormElementHeader, {
|
|
33
|
+
title: S,
|
|
34
|
+
description: C,
|
|
35
|
+
disabled: h
|
|
36
|
+
}), u[5] = h, u[6] = S, u[7] = C, u[8] = w) : w = u[8];
|
|
37
|
+
let T = f, E = p?.form, D;
|
|
38
|
+
u[9] !== h || u[10] !== d || u[11] !== m || u[12] !== T || u[13] !== E || u[14] !== g ? (D = /* @__PURE__ */ jsx(FormBody_default, {
|
|
39
|
+
form: d,
|
|
40
|
+
mimeType: m,
|
|
41
|
+
schema: T,
|
|
42
|
+
ui: E,
|
|
43
|
+
disabled: h,
|
|
44
|
+
viewOnly: g
|
|
45
|
+
}), u[9] = h, u[10] = d, u[11] = m, u[12] = T, u[13] = E, u[14] = g, u[15] = D) : D = u[15];
|
|
46
|
+
let O;
|
|
47
|
+
u[16] !== _ || u[17] !== g ? (O = !g && !!_ && /* @__PURE__ */ jsx("div", {
|
|
24
48
|
className: "mt-4 flex w-full justify-end",
|
|
25
|
-
children:
|
|
26
|
-
}),
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
let
|
|
30
|
-
|
|
49
|
+
children: _
|
|
50
|
+
}), u[16] = _, u[17] = g, u[18] = O) : O = u[18];
|
|
51
|
+
let k;
|
|
52
|
+
u[19] !== D || u[20] !== O ? (k = /* @__PURE__ */ jsxs("form", { children: [D, O] }), u[19] = D, u[20] = O, u[21] = k) : k = u[21];
|
|
53
|
+
let A;
|
|
54
|
+
u[22] !== k || u[23] !== w ? (A = /* @__PURE__ */ jsxs("div", {
|
|
31
55
|
className: "container mx-auto",
|
|
32
|
-
children: [
|
|
33
|
-
}),
|
|
56
|
+
children: [w, k]
|
|
57
|
+
}), u[22] = k, u[23] = w, u[24] = A) : A = u[24];
|
|
58
|
+
let j;
|
|
59
|
+
return u[25] !== d || u[26] !== A ? (j = /* @__PURE__ */ jsx(FormProvider, {
|
|
60
|
+
...d,
|
|
61
|
+
children: A
|
|
62
|
+
}), u[25] = d, u[26] = A, u[27] = j) : j = u[27], j;
|
|
34
63
|
};
|
|
35
64
|
export { Form_default as default };
|
|
@@ -17,7 +17,7 @@ const FormElement = (d) => {
|
|
|
17
17
|
disabled: m
|
|
18
18
|
}), /* @__PURE__ */ jsx(ObjectController, { ...d })] });
|
|
19
19
|
case "array": return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx("div", {
|
|
20
|
-
className: "mt-
|
|
20
|
+
className: "mt-1",
|
|
21
21
|
children: /* @__PURE__ */ jsx(ArrayController, { ...d })
|
|
22
22
|
}) });
|
|
23
23
|
default: return /* @__PURE__ */ jsx(InputController, {
|
|
@@ -5,8 +5,8 @@ const FormElementHeader = (i) => {
|
|
|
5
5
|
let a = c(7), { title: o, description: s } = i;
|
|
6
6
|
if (!o && !s) return null;
|
|
7
7
|
let l;
|
|
8
|
-
a[0] === o ? l = a[1] : (l = o && /* @__PURE__ */ jsx("
|
|
9
|
-
className: "mb-
|
|
8
|
+
a[0] === o ? l = a[1] : (l = o && /* @__PURE__ */ jsx("h3", {
|
|
9
|
+
className: "mb-1.5 text-base font-semibold",
|
|
10
10
|
children: o
|
|
11
11
|
}), a[0] = o, a[1] = l);
|
|
12
12
|
let u;
|
|
@@ -2,6 +2,7 @@ import { InputField } from "./fields/InputField.js";
|
|
|
2
2
|
import { TextareaField } from "./fields/TextareaField.js";
|
|
3
3
|
import { CheckboxField } from "./fields/CheckboxField.js";
|
|
4
4
|
import { CodeViewField } from "./fields/CodeViewField.js";
|
|
5
|
+
import { MarkdownViewField } from "./fields/MarkdownViewField.js";
|
|
5
6
|
import { RadioField } from "./fields/RadioField.js";
|
|
6
7
|
import { SelectField } from "./fields/SelectField.js";
|
|
7
8
|
import { SliderField } from "./fields/SliderField.js";
|
|
@@ -17,7 +18,8 @@ var WIDGET_REGISTRY = {
|
|
|
17
18
|
slider: SliderField,
|
|
18
19
|
text: InputField,
|
|
19
20
|
textarea: TextareaField,
|
|
20
|
-
"code-view": CodeViewField
|
|
21
|
+
"code-view": CodeViewField,
|
|
22
|
+
"markdown-view": MarkdownViewField
|
|
21
23
|
}, WIDGET_NAMES = Object.keys(WIDGET_REGISTRY), resolveWidgetType = (e, o) => {
|
|
22
24
|
if (o && WIDGET_NAMES.includes(o)) return o;
|
|
23
25
|
let s = e;
|
|
@@ -3,30 +3,33 @@ import { FormElement } from "./FormElement.js";
|
|
|
3
3
|
import { useSortedPropertyNames } from "./hooks/useSortPropertyNames.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import {
|
|
7
|
-
const ObjectController = (
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
let S = x, C;
|
|
13
|
-
if (
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
const ObjectController = (a) => {
|
|
8
|
+
let o = c(24), { name: s, schema: l, ui: u, form: d, disabled: f, parentKey: p, viewOnly: m } = a, h = l, g = u, _;
|
|
9
|
+
o[0] === h.properties ? _ = o[1] : (_ = h.properties ?? {}, o[0] = h.properties, o[1] = _);
|
|
10
|
+
let v = useSortedPropertyNames(_, g?.order), y = useMergeParentKey(p, s), b;
|
|
11
|
+
o[2] === h.required ? b = o[3] : (b = h.required ?? [], o[2] = h.required, o[3] = b);
|
|
12
|
+
let x = b, S = v.length === 2 ? "grid grid-cols-2 gap-x-4" : void 0, C;
|
|
13
|
+
if (o[4] !== f || o[5] !== d || o[6] !== y || o[7] !== h.properties || o[8] !== g?.properties || o[9] !== v || o[10] !== x || o[11] !== m) {
|
|
14
14
|
let e;
|
|
15
|
-
|
|
16
|
-
let
|
|
17
|
-
return
|
|
18
|
-
form:
|
|
19
|
-
disabled:
|
|
20
|
-
viewOnly:
|
|
21
|
-
parentKey:
|
|
15
|
+
o[13] !== f || o[14] !== d || o[15] !== y || o[16] !== h.properties || o[17] !== g?.properties || o[18] !== x || o[19] !== m ? (e = (e) => {
|
|
16
|
+
let i = h.properties?.[e];
|
|
17
|
+
return i ? /* @__PURE__ */ jsx(FormElement, {
|
|
18
|
+
form: d,
|
|
19
|
+
disabled: f,
|
|
20
|
+
viewOnly: m,
|
|
21
|
+
parentKey: y,
|
|
22
22
|
name: e,
|
|
23
|
-
schema:
|
|
24
|
-
ui:
|
|
25
|
-
required:
|
|
23
|
+
schema: i,
|
|
24
|
+
ui: g?.properties?.[e],
|
|
25
|
+
required: x.includes(e)
|
|
26
26
|
}, `el-${e}`) : null;
|
|
27
|
-
},
|
|
28
|
-
} else C =
|
|
27
|
+
}, o[13] = f, o[14] = d, o[15] = y, o[16] = h.properties, o[17] = g?.properties, o[18] = x, o[19] = m, o[20] = e) : e = o[20], C = v.map(e), o[4] = f, o[5] = d, o[6] = y, o[7] = h.properties, o[8] = g?.properties, o[9] = v, o[10] = x, o[11] = m, o[12] = C;
|
|
28
|
+
} else C = o[12];
|
|
29
29
|
let w;
|
|
30
|
-
return
|
|
30
|
+
return o[21] !== S || o[22] !== C ? (w = /* @__PURE__ */ jsx("div", {
|
|
31
|
+
className: S,
|
|
32
|
+
children: C
|
|
33
|
+
}), o[21] = S, o[22] = C, o[23] = w) : w = o[23], w;
|
|
31
34
|
};
|
|
32
35
|
export { ObjectController };
|
|
@@ -33,7 +33,7 @@ const BaseFieldWrapper = (i) => {
|
|
|
33
33
|
}), a[18] = u, a[19] = w);
|
|
34
34
|
let T;
|
|
35
35
|
return a[20] !== p || a[21] !== b || a[22] !== x || a[23] !== S || a[24] !== C || a[25] !== w ? (T = /* @__PURE__ */ jsxs("div", {
|
|
36
|
-
className: "
|
|
36
|
+
className: "mb-4 block space-y-1.5",
|
|
37
37
|
children: [
|
|
38
38
|
b,
|
|
39
39
|
x,
|
|
@@ -15,6 +15,7 @@ const getInputType = (t) => {
|
|
|
15
15
|
case "time": return "time";
|
|
16
16
|
case "datetime": return "datetime-local";
|
|
17
17
|
case "phone": return "tel";
|
|
18
|
+
case "password": return "password";
|
|
18
19
|
}
|
|
19
20
|
switch (t.type) {
|
|
20
21
|
case "integer":
|
|
@@ -27,13 +28,13 @@ var isNumericType = (t) => t.type === "number" || t.type === "integer";
|
|
|
27
28
|
const InputField = (p) => {
|
|
28
29
|
let m = c(36), { name: h, schema: g, ui: _, required: v, form: y, disabled: b, viewOnly: x } = p, S = useFieldConfig(h, g, _, b), C;
|
|
29
30
|
m[0] === g ? C = m[1] : (C = getInputType(g), m[0] = g, m[1] = C);
|
|
30
|
-
let w = C, T;
|
|
31
|
-
m[2] !== g
|
|
32
|
-
let
|
|
33
|
-
m[5] !== v || m[6] !== g ? (
|
|
34
|
-
let
|
|
35
|
-
m[8] === g ?
|
|
36
|
-
let
|
|
31
|
+
let w = C, T = _, E;
|
|
32
|
+
m[2] !== g || m[3] !== T?.placeholder ? (E = T?.placeholder || g.placeholder || g.examples?.[0]?.toString() || "", m[2] = g, m[3] = T?.placeholder, m[4] = E) : E = m[4];
|
|
33
|
+
let D = E, O;
|
|
34
|
+
m[5] !== v || m[6] !== g ? (O = buildTextValidationRules(g, v), m[5] = v, m[6] = g, m[7] = O) : O = m[7];
|
|
35
|
+
let k = O, A;
|
|
36
|
+
m[8] === g ? A = m[9] : (A = isNumericType(g), m[8] = g, m[9] = A);
|
|
37
|
+
let j = A;
|
|
37
38
|
if (x) {
|
|
38
39
|
let t;
|
|
39
40
|
m[10] === S.fieldLabel ? t = m[11] : (t = /* @__PURE__ */ jsx(Label, {
|
|
@@ -49,12 +50,12 @@ const InputField = (p) => {
|
|
|
49
50
|
}), m[12] = y.control, m[13] = h, m[14] = u, m[15] = d) : d = m[15];
|
|
50
51
|
let f;
|
|
51
52
|
return m[16] !== t || m[17] !== d ? (f = /* @__PURE__ */ jsxs("div", {
|
|
52
|
-
className: "
|
|
53
|
+
className: "mb-4 block",
|
|
53
54
|
children: [t, d]
|
|
54
55
|
}), m[16] = t, m[17] = d, m[18] = f) : f = m[18], f;
|
|
55
56
|
}
|
|
56
|
-
let
|
|
57
|
-
m[19] !== S || m[20] !== w || m[21] !==
|
|
57
|
+
let M = S.defaultValue ?? (j ? void 0 : ""), N;
|
|
58
|
+
m[19] !== S || m[20] !== w || m[21] !== j || m[22] !== h || m[23] !== D || m[24] !== v || m[25] !== g.maxLength || m[26] !== g.maximum || m[27] !== g.minimum || m[28] !== g.multipleOf ? (N = (l) => {
|
|
58
59
|
let { field: u } = l;
|
|
59
60
|
return /* @__PURE__ */ jsx(BaseFieldWrapper, {
|
|
60
61
|
name: h,
|
|
@@ -67,14 +68,14 @@ const InputField = (p) => {
|
|
|
67
68
|
...u,
|
|
68
69
|
id: h,
|
|
69
70
|
onChange: (t) => {
|
|
70
|
-
if (!S.isReadOnly) if (
|
|
71
|
+
if (!S.isReadOnly) if (j) {
|
|
71
72
|
let l = t.target.value;
|
|
72
73
|
u.onChange(l === "" ? void 0 : Number(l));
|
|
73
74
|
} else u.onChange(t);
|
|
74
75
|
},
|
|
75
76
|
value: u.value ?? "",
|
|
76
77
|
type: w,
|
|
77
|
-
placeholder:
|
|
78
|
+
placeholder: D,
|
|
78
79
|
disabled: S.isDisabled,
|
|
79
80
|
readOnly: S.isReadOnly,
|
|
80
81
|
min: g.minimum,
|
|
@@ -85,15 +86,15 @@ const InputField = (p) => {
|
|
|
85
86
|
...S.getAriaProps()
|
|
86
87
|
})
|
|
87
88
|
});
|
|
88
|
-
}, m[19] = S, m[20] = w, m[21] =
|
|
89
|
-
let
|
|
90
|
-
return m[30] !== y.control || m[31] !== h || m[32] !==
|
|
89
|
+
}, m[19] = S, m[20] = w, m[21] = j, m[22] = h, m[23] = D, m[24] = v, m[25] = g.maxLength, m[26] = g.maximum, m[27] = g.minimum, m[28] = g.multipleOf, m[29] = N) : N = m[29];
|
|
90
|
+
let P;
|
|
91
|
+
return m[30] !== y.control || m[31] !== h || m[32] !== M || m[33] !== N || m[34] !== k ? (P = /* @__PURE__ */ jsx(Controller, {
|
|
91
92
|
name: h,
|
|
92
93
|
control: y.control,
|
|
93
|
-
defaultValue:
|
|
94
|
-
rules:
|
|
95
|
-
render:
|
|
96
|
-
}), m[30] = y.control, m[31] = h, m[32] =
|
|
94
|
+
defaultValue: M,
|
|
95
|
+
rules: k,
|
|
96
|
+
render: N
|
|
97
|
+
}), m[30] = y.control, m[31] = h, m[32] = M, m[33] = N, m[34] = k, m[35] = P) : P = m[35], P;
|
|
97
98
|
};
|
|
98
99
|
function _temp(t) {
|
|
99
100
|
let { field: l } = t;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import MarkdownContent_default from "../MarkdownContent.js";
|
|
2
|
+
import { useFieldConfig } from "../hooks/useFieldConfig.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Controller } from "react-hook-form";
|
|
7
|
+
const MarkdownViewField = (e) => {
|
|
8
|
+
let o = c(4), { name: s, schema: l, ui: u, form: d, disabled: f } = e, p = useFieldConfig(s, l, u, f).defaultValue || "", m;
|
|
9
|
+
return o[0] !== d.control || o[1] !== s || o[2] !== p ? (m = /* @__PURE__ */ jsx(Controller, {
|
|
10
|
+
name: s,
|
|
11
|
+
control: d.control,
|
|
12
|
+
defaultValue: p,
|
|
13
|
+
render: _temp
|
|
14
|
+
}), o[0] = d.control, o[1] = s, o[2] = p, o[3] = m) : m = o[3], m;
|
|
15
|
+
};
|
|
16
|
+
function _temp(i) {
|
|
17
|
+
let { field: a } = i;
|
|
18
|
+
return /* @__PURE__ */ jsx(MarkdownContent_default, { content: String(a.value ?? "") });
|
|
19
|
+
}
|
|
20
|
+
export { MarkdownViewField };
|
|
@@ -8,14 +8,14 @@ import React from "react";
|
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { Controller } from "react-hook-form";
|
|
10
10
|
const RadioField = (p) => {
|
|
11
|
-
let m = c(
|
|
12
|
-
m[0] !==
|
|
13
|
-
let
|
|
14
|
-
m[3] !==
|
|
15
|
-
let
|
|
16
|
-
m[6] ===
|
|
17
|
-
let
|
|
18
|
-
m[8] !== x || m[9] !==
|
|
11
|
+
let m = c(22), { name: h, schema: g, ui: _, required: v, form: y, disabled: b } = p, x = useFieldConfig(h, g, _, b), S = _, C = S?.enumOptions ?? g.enumOptions, w;
|
|
12
|
+
m[0] !== C || m[1] !== g ? (w = C ? C.map(_temp) : g.enum, m[0] = C, m[1] = g, m[2] = w) : w = m[2];
|
|
13
|
+
let T = w, E;
|
|
14
|
+
m[3] !== C || m[4] !== g ? (E = C ? C.map(_temp2) : g.enum, m[3] = C, m[4] = g, m[5] = E) : E = m[5];
|
|
15
|
+
let D = E, O = x.defaultValue || "", k = v ? "This field is required" : void 0, A;
|
|
16
|
+
m[6] === k ? A = m[7] : (A = { required: k }, m[6] = k, m[7] = A);
|
|
17
|
+
let j;
|
|
18
|
+
m[8] !== x || m[9] !== T || m[10] !== D || m[11] !== h || m[12] !== v || m[13] !== g || m[14] !== S?.inline ? (j = (d) => {
|
|
19
19
|
let { field: f } = d;
|
|
20
20
|
return /* @__PURE__ */ jsx(BaseFieldWrapper, {
|
|
21
21
|
name: h,
|
|
@@ -31,9 +31,9 @@ const RadioField = (p) => {
|
|
|
31
31
|
disabled: x.isDisabled,
|
|
32
32
|
required: v,
|
|
33
33
|
"aria-label": x.fieldLabel,
|
|
34
|
-
className: cn(g.inline && "flex flex-row space-y-0 space-x-4"),
|
|
34
|
+
className: cn((S?.inline ?? g.inline) && "flex flex-row space-y-0 space-x-4"),
|
|
35
35
|
...x.getAriaProps(),
|
|
36
|
-
children:
|
|
36
|
+
children: D?.map((u, d) => /* @__PURE__ */ jsxs("div", {
|
|
37
37
|
className: "flex items-center space-x-2",
|
|
38
38
|
children: [/* @__PURE__ */ jsx(RadioGroupItem, {
|
|
39
39
|
value: u,
|
|
@@ -43,20 +43,20 @@ const RadioField = (p) => {
|
|
|
43
43
|
}), /* @__PURE__ */ jsx(Label, {
|
|
44
44
|
htmlFor: `${h}-${u}`,
|
|
45
45
|
className: cn("cursor-pointer text-sm font-normal", x.isDisabled && "cursor-not-allowed opacity-70"),
|
|
46
|
-
children:
|
|
46
|
+
children: T?.[d] || u
|
|
47
47
|
})]
|
|
48
48
|
}, u))
|
|
49
49
|
})
|
|
50
50
|
});
|
|
51
|
-
}, m[8] = x, m[9] =
|
|
52
|
-
let
|
|
53
|
-
return m[
|
|
51
|
+
}, m[8] = x, m[9] = T, m[10] = D, m[11] = h, m[12] = v, m[13] = g, m[14] = S?.inline, m[15] = j) : j = m[15];
|
|
52
|
+
let M;
|
|
53
|
+
return m[16] !== y.control || m[17] !== h || m[18] !== O || m[19] !== A || m[20] !== j ? (M = /* @__PURE__ */ jsx(Controller, {
|
|
54
54
|
name: h,
|
|
55
55
|
control: y.control,
|
|
56
|
-
defaultValue:
|
|
57
|
-
rules:
|
|
58
|
-
render:
|
|
59
|
-
}), m[
|
|
56
|
+
defaultValue: O,
|
|
57
|
+
rules: A,
|
|
58
|
+
render: j
|
|
59
|
+
}), m[16] = y.control, m[17] = h, m[18] = O, m[19] = A, m[20] = j, m[21] = M) : M = m[21], M;
|
|
60
60
|
};
|
|
61
61
|
function _temp(n) {
|
|
62
62
|
return n.label;
|