@loopstack/loopstack-studio 0.23.1 → 0.25.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/config.js +3 -3
- package/dist/api/index.js +10 -12
- package/dist/api/processor.js +1 -1
- package/dist/api/secrets.js +16 -0
- package/dist/api/workflows.js +7 -1
- package/dist/components/dynamic-form/ArrayController.js +68 -64
- package/dist/components/dynamic-form/CodeContent.js +3 -3
- package/dist/components/dynamic-form/Form.js +46 -40
- package/dist/components/dynamic-form/FormElement.js +1 -1
- package/dist/components/dynamic-form/FormElementHeader.js +2 -2
- 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/CodeViewField.js +36 -36
- package/dist/components/dynamic-form/fields/InputField.js +20 -19
- 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/feedback/LoadingCentered.js +1 -1
- package/dist/components/layout/MainLayout.js +18 -31
- package/dist/components/layout/StudioSidebar.js +169 -109
- package/dist/components/loopstack-elements/link.js +77 -76
- package/dist/components/loopstack-elements/tool.js +171 -0
- package/dist/components/page/PageBreadcrumbs.js +79 -32
- package/dist/components/ui-widgets/UiActions.js +10 -4
- package/dist/components/ui-widgets/widgets/ButtonFullWidth.js +8 -6
- package/dist/components/ui-widgets/widgets/SubmitButton.js +8 -6
- package/dist/features/code-explorer/components/FileContentViewer.js +92 -100
- package/dist/features/dashboard/RunItem.js +1 -1
- package/dist/features/debug/components/ConfigFlowViewer.js +2 -2
- package/dist/features/debug/components/{PipelineDebugHeader.js → WorkflowDebugHeader.js} +5 -5
- package/dist/features/debug/components/{PipelineDebugLegend.js → WorkflowDebugLegend.js} +2 -2
- package/dist/features/debug/components/{PipelineFlowViewer.js → WorkflowFlowViewer.js} +9 -9
- package/dist/features/debug/components/workflow-flow/WorkflowGraph.js +46 -0
- package/dist/features/debug/index.js +2 -2
- package/dist/features/debug/lib/flow-utils.js +142 -150
- package/dist/features/documents/DocumentRenderer.js +66 -30
- package/dist/features/documents/components/DocumentItem.js +2 -2
- package/dist/features/documents/components/DocumentList.js +18 -11
- package/dist/features/documents/document-details/DocumentDetails.js +4 -4
- package/dist/features/documents/renderers/AiMessage.js +12 -12
- package/dist/features/documents/renderers/ChoicesRenderer.js +92 -0
- package/dist/features/documents/renderers/ClaudeMessage.js +1 -1
- package/dist/features/documents/renderers/ConfirmPromptRenderer.js +56 -0
- package/dist/features/documents/renderers/DocumentFormRenderer.js +95 -65
- package/dist/features/documents/renderers/LinkMessageRenderer.js +8 -10
- package/dist/features/documents/renderers/SecretInputRenderer.js +87 -0
- package/dist/features/documents/renderers/TextPromptRenderer.js +57 -0
- package/dist/features/documents/renderers/useDocumentTransition.js +30 -0
- package/dist/features/oauth/OAuthPromptRenderer.js +20 -20
- package/dist/features/runs/Runs.js +8 -8
- package/dist/features/workbench/Workbench.js +35 -35
- package/dist/features/workbench/WorkflowItem.js +10 -9
- package/dist/features/workbench/WorkflowList.js +56 -73
- package/dist/features/workbench/components/NewRunDialog.js +18 -18
- package/dist/features/workbench/components/WorkbenchFilesPanel.js +33 -26
- package/dist/features/workbench/components/WorkbenchFloatingPanel.js +13 -44
- package/dist/features/workbench/components/WorkbenchFlowPanel.js +27 -29
- package/dist/features/workbench/components/WorkbenchIconSidebar.js +17 -17
- package/dist/features/workbench/components/WorkbenchPreviewPanel.js +2 -2
- package/dist/features/workbench/components/WorkbenchSecretsPanel.js +182 -0
- package/dist/features/workbench/components/WorkbenchSettingsModal.js +16 -41
- package/dist/features/workbench/components/WorkflowForms.js +14 -13
- package/dist/features/workbench/components/WorkflowHistoryItem.js +60 -81
- package/dist/features/workbench/components/{PipelineHistoryList.js → WorkflowHistoryList.js} +5 -5
- package/dist/features/workbench/components/buttons/WorkflowButtons.js +56 -54
- package/dist/features/workbench/hooks/useWorkflowData.js +10 -10
- package/dist/features/workbench/hooks/useWorkflowListState.js +8 -45
- package/dist/features/workbench/index.js +2 -3
- package/dist/features/workbench/providers/RemoteFileExplorerProvider.js +132 -117
- package/dist/features/workbench/providers/ScrollProvider.js +2 -2
- package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +4 -4
- package/dist/features/workspaces/Workspaces.js +1 -1
- package/dist/features/workspaces/components/CreateWorkspace.js +12 -12
- package/dist/features/workspaces/components/ExecutionTimeline.js +22 -21
- package/dist/features/workspaces/components/{NewPipelineRunDialog.js → NewWorkflowRunDialog.js} +6 -6
- package/dist/features/workspaces/components/{PipelineForm.js → WorkflowRunForm.js} +31 -31
- package/dist/features/workspaces/components/WorkspaceHomePage.js +11 -11
- package/dist/features/workspaces/components/{pipeline-form → workflow-form}/ArgumentsView.js +1 -1
- package/dist/features/workspaces/components/{pipeline-form → workflow-form}/SelectionView.js +16 -16
- package/dist/hooks/index.js +3 -3
- package/dist/hooks/query-keys.js +34 -68
- package/dist/hooks/useConfig.js +5 -5
- package/dist/hooks/useProcessor.js +5 -5
- package/dist/hooks/useSecrets.js +69 -0
- package/dist/hooks/useWorkflows.js +155 -68
- package/dist/index.d.ts +158 -116
- package/dist/index.js +5 -5
- package/dist/packages/contracts/dist/enums/index.js +11 -12
- package/dist/packages/contracts/dist/enums/workflow-state.enum.js +1 -1
- package/dist/pages/DashboardPage.js +87 -35
- package/dist/pages/DebugWorkflowDetailsPage.js +8 -8
- package/dist/pages/DebugWorkflowsPage.js +10 -10
- package/dist/pages/EmbedWorkbenchPage.js +39 -45
- package/dist/pages/PreviewWorkbenchPage.js +130 -255
- package/dist/pages/RunsListPage.js +1 -1
- package/dist/pages/StudioLandingPage.js +13 -13
- package/dist/pages/WorkbenchPage.js +6 -6
- package/dist/pages/WorkflowDebugPage.js +114 -0
- package/dist/pages/WorkspacePage.js +4 -2
- package/dist/providers/InvalidationEventsProvider.js +19 -19
- package/dist/providers/SseProvider.js +0 -1
- package/dist/routing/LocalRouter.js +14 -17
- package/dist/types/ai.types.js +13 -0
- package/package.json +2 -3
- package/dist/api/namespaces.js +0 -7
- package/dist/api/pipelines.js +0 -13
- package/dist/components/ai-elements/tool.js +0 -158
- package/dist/features/debug/components/pipeline-flow/WorkflowGraph.js +0 -41
- package/dist/features/workbench/NavigationItems.js +0 -52
- package/dist/features/workbench/WorkbenchNavigation.js +0 -38
- package/dist/features/workbench/components/NavigationItem.js +0 -68
- package/dist/features/workbench/hooks/useIntersectionObserver.js +0 -44
- package/dist/hooks/useNamespaceTree.js +0 -27
- package/dist/hooks/useNamespaces.js +0 -25
- package/dist/hooks/usePipelines.js +0 -161
- 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/packages/contracts/dist/enums/pipeline-state.js +0 -10
- package/dist/pages/PipelineDebugPage.js +0 -115
- /package/dist/features/debug/components/{pipeline-flow → workflow-flow}/StateNode.js +0 -0
- /package/dist/features/debug/components/{pipeline-flow → workflow-flow}/WorkflowTransitionEdge.js +0 -0
- /package/dist/features/workspaces/components/{pipeline-form → workflow-form}/HeaderSection.js +0 -0
package/dist/api/config.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function createConfigApi(e) {
|
|
2
2
|
return {
|
|
3
3
|
getWorkspaceTypes: () => e.get("/api/v1/config/workspaces").then((e) => e.data),
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
getWorkflowTypesByWorkspace: (t) => e.get(`/api/v1/config/workspaces/${encodeURIComponent(t.workspaceBlockName)}/workflows`).then((e) => e.data),
|
|
5
|
+
getWorkflowConfig: (t) => e.get(`/api/v1/config/workflows/${encodeURIComponent(t.alias)}`).then((e) => e.data),
|
|
6
|
+
getWorkflowSource: (t) => e.get(`/api/v1/config/workflows/${encodeURIComponent(t.alias)}/source`).then((e) => e.data),
|
|
7
7
|
getAvailableEnvironments: () => e.get("/api/v1/config/environments").then((e) => e.data)
|
|
8
8
|
};
|
|
9
9
|
}
|
package/dist/api/index.js
CHANGED
|
@@ -2,23 +2,21 @@ import { createAuthApi } from "./auth.js";
|
|
|
2
2
|
import { createConfigApi } from "./config.js";
|
|
3
3
|
import { createDashboardApi } from "./dashboard.js";
|
|
4
4
|
import { createDocumentsApi } from "./documents.js";
|
|
5
|
-
import { createNamespacesApi } from "./namespaces.js";
|
|
6
|
-
import { createPipelinesApi } from "./pipelines.js";
|
|
7
5
|
import { createProcessorApi } from "./processor.js";
|
|
6
|
+
import { createSecretsApi } from "./secrets.js";
|
|
8
7
|
import { createWorkflowsApi } from "./workflows.js";
|
|
9
8
|
import { createWorkspacesApi } from "./workspaces.js";
|
|
10
9
|
import { createAxiosClient } from "./client.js";
|
|
11
|
-
function createApi(
|
|
10
|
+
function createApi(l) {
|
|
12
11
|
return {
|
|
13
|
-
auth: createAuthApi(
|
|
14
|
-
config: createConfigApi(
|
|
15
|
-
dashboard: createDashboardApi(
|
|
16
|
-
documents: createDocumentsApi(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
workspaces: createWorkspacesApi(u)
|
|
12
|
+
auth: createAuthApi(l),
|
|
13
|
+
config: createConfigApi(l),
|
|
14
|
+
dashboard: createDashboardApi(l),
|
|
15
|
+
documents: createDocumentsApi(l),
|
|
16
|
+
processor: createProcessorApi(l),
|
|
17
|
+
secrets: createSecretsApi(l),
|
|
18
|
+
workflows: createWorkflowsApi(l),
|
|
19
|
+
workspaces: createWorkspacesApi(l)
|
|
22
20
|
};
|
|
23
21
|
}
|
|
24
22
|
export { createApi };
|
package/dist/api/processor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
function createProcessorApi(e) {
|
|
2
|
-
return {
|
|
2
|
+
return { runWorkflow: (t) => e.post(`/api/v1/processor/run/${t.workflowId}`, t.runWorkflowPayloadDto, t.force === void 0 ? void 0 : { params: { force: t.force } }).then((e) => e.data) };
|
|
3
3
|
}
|
|
4
4
|
export { createProcessorApi };
|
|
@@ -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 };
|
package/dist/api/workflows.js
CHANGED
|
@@ -2,7 +2,13 @@ function createWorkflowsApi(e) {
|
|
|
2
2
|
return {
|
|
3
3
|
getById: (t) => e.get(`/api/v1/workflows/${t.id}`).then((e) => e.data),
|
|
4
4
|
getAll: (t) => e.get("/api/v1/workflows", { params: t }).then((e) => e.data),
|
|
5
|
-
|
|
5
|
+
create: (t) => e.post("/api/v1/workflows", t.workflowCreateDto).then((e) => e.data),
|
|
6
|
+
update: (t) => e.put(`/api/v1/workflows/${t.id}`, t.workflowUpdateDto).then((e) => e.data),
|
|
7
|
+
delete: (t) => e.delete(`/api/v1/workflows/id/${t.id}`).then((e) => e.data),
|
|
8
|
+
batchDelete: (t) => e.delete("/api/v1/workflows/batch", { data: { ids: t.ids } }).then((e) => e.data),
|
|
9
|
+
getFileTree: (t) => e.get(`/api/v1/files/workflows/${t.workflowId}`).then((e) => e.data),
|
|
10
|
+
getFileContent: (t) => e.get(`/api/v1/files/workflows/${t.workflowId}/${t.filePath}`).then((e) => e.data),
|
|
11
|
+
getCheckpoints: (t) => e.get(`/api/v1/workflows/${t.id}/checkpoints`).then((e) => e.data)
|
|
6
12
|
};
|
|
7
13
|
}
|
|
8
14
|
export { createWorkflowsApi };
|
|
@@ -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 };
|
|
@@ -148,10 +148,10 @@ var adaptedPrism = {
|
|
|
148
148
|
});
|
|
149
149
|
},
|
|
150
150
|
code(e) {
|
|
151
|
-
let { className: a, children: s, ...l } = e, u = /language-(\w+)/.exec(a ?? ""), d = Array.isArray(s) ? s.map(_temp).join("") : typeof s == "string" ? s : "";
|
|
152
|
-
return u ? /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Prism, {
|
|
151
|
+
let { className: a, children: s, ...l } = e, u = /language-(\w+)/.exec(a ?? ""), d = Array.isArray(s) ? s.map(_temp).join("") : typeof s == "string" ? s : "", f = d.includes("\n");
|
|
152
|
+
return u || f ? /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Prism, {
|
|
153
153
|
style: adaptedPrism,
|
|
154
|
-
language: u[1],
|
|
154
|
+
language: u?.[1] ?? "text",
|
|
155
155
|
PreTag: "div",
|
|
156
156
|
...l,
|
|
157
157
|
children: d.replace(/\n$/, "")
|
|
@@ -3,56 +3,62 @@ import FormBody_default from "./FormBody.js";
|
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import React, { useEffect } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { FormProvider } from "react-hook-form";
|
|
6
7
|
function extractSchemaDefaults(e) {
|
|
7
8
|
if (e.default !== void 0) return e.default;
|
|
8
9
|
if (e.properties) {
|
|
9
|
-
let
|
|
10
|
-
for (let [
|
|
11
|
-
else if (
|
|
12
|
-
let e = extractSchemaDefaults(
|
|
13
|
-
e !== void 0 && (
|
|
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);
|
|
14
15
|
}
|
|
15
|
-
return
|
|
16
|
+
return o ? a : void 0;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
|
-
var Form_default = (
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
let e = extractSchemaDefaults(
|
|
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);
|
|
22
23
|
if (e) {
|
|
23
|
-
let
|
|
24
|
-
for (let [e,
|
|
25
|
-
|
|
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);
|
|
26
27
|
}
|
|
27
|
-
},
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
title:
|
|
33
|
-
description:
|
|
34
|
-
disabled:
|
|
35
|
-
}),
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
form:
|
|
39
|
-
mimeType:
|
|
40
|
-
schema:
|
|
41
|
-
ui:
|
|
42
|
-
disabled:
|
|
43
|
-
viewOnly:
|
|
44
|
-
}),
|
|
45
|
-
let D;
|
|
46
|
-
l[16] !== g || l[17] !== h ? (D = !h && !!g && /* @__PURE__ */ jsx("div", {
|
|
47
|
-
className: "mt-4 flex w-full justify-end",
|
|
48
|
-
children: g
|
|
49
|
-
}), l[16] = g, l[17] = h, l[18] = D) : D = l[18];
|
|
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];
|
|
50
46
|
let O;
|
|
51
|
-
|
|
47
|
+
u[16] !== _ || u[17] !== g ? (O = !g && !!_ && /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: "mt-4 flex w-full justify-end",
|
|
49
|
+
children: _
|
|
50
|
+
}), u[16] = _, u[17] = g, u[18] = O) : O = u[18];
|
|
52
51
|
let k;
|
|
53
|
-
|
|
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", {
|
|
54
55
|
className: "container mx-auto",
|
|
55
|
-
children: [
|
|
56
|
-
}),
|
|
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;
|
|
57
63
|
};
|
|
58
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;
|
|
@@ -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,
|
|
@@ -6,58 +6,58 @@ import React from "react";
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { Check, Copy } from "lucide-react";
|
|
8
8
|
import { Controller } from "react-hook-form";
|
|
9
|
-
var stripCodeFence = (e) => {
|
|
10
|
-
let
|
|
11
|
-
return
|
|
12
|
-
};
|
|
13
|
-
const CodeViewField = (
|
|
14
|
-
let
|
|
15
|
-
|
|
9
|
+
var codeFenceRegex = /^```[\w-]*\n?([\s\S]*?)\n?```$/, stripCodeFence = (e) => {
|
|
10
|
+
let d = e.match(codeFenceRegex);
|
|
11
|
+
return d ? d[1] : e;
|
|
12
|
+
}, ensureCodeFenced = (e) => !e || codeFenceRegex.test(e.trim()) ? e : "```\n" + e + "\n```";
|
|
13
|
+
const CodeViewField = (p) => {
|
|
14
|
+
let m = c(11), { name: h, schema: g, ui: _, required: v, form: y, disabled: b } = p, [x, S] = React.useState(!1), C = useFieldConfig(h, g, _, b), w;
|
|
15
|
+
m[0] === Symbol.for("react.memo_cache_sentinel") ? (w = async (e) => {
|
|
16
16
|
try {
|
|
17
|
-
let
|
|
18
|
-
await navigator.clipboard.writeText(
|
|
17
|
+
let d = stripCodeFence(e);
|
|
18
|
+
await navigator.clipboard.writeText(d), S(!0), setTimeout(() => S(!1), 2e3);
|
|
19
19
|
} catch (e) {
|
|
20
|
-
let
|
|
21
|
-
console.error("Failed to copy:",
|
|
20
|
+
let d = e;
|
|
21
|
+
console.error("Failed to copy:", d);
|
|
22
22
|
}
|
|
23
|
-
},
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
let { field:
|
|
23
|
+
}, m[0] = w) : w = m[0];
|
|
24
|
+
let T = w, E = C.defaultValue || "", D;
|
|
25
|
+
m[1] !== C || m[2] !== x || m[3] !== h || m[4] !== v ? (D = (d) => {
|
|
26
|
+
let { field: f } = d;
|
|
27
27
|
return /* @__PURE__ */ jsx(BaseFieldWrapper, {
|
|
28
|
-
name:
|
|
29
|
-
label:
|
|
30
|
-
required:
|
|
31
|
-
error:
|
|
32
|
-
helpText:
|
|
33
|
-
description:
|
|
28
|
+
name: h,
|
|
29
|
+
label: C.fieldLabel,
|
|
30
|
+
required: v,
|
|
31
|
+
error: C.error,
|
|
32
|
+
helpText: C.helpText,
|
|
33
|
+
description: C.description,
|
|
34
34
|
children: /* @__PURE__ */ jsxs("div", {
|
|
35
35
|
className: "relative w-full overflow-hidden rounded-md border",
|
|
36
|
-
...
|
|
36
|
+
...C.getAriaProps(),
|
|
37
37
|
children: [/* @__PURE__ */ jsx("button", {
|
|
38
38
|
type: "button",
|
|
39
|
-
onClick: () => void
|
|
40
|
-
disabled:
|
|
39
|
+
onClick: () => void T(String(f.value ?? "")),
|
|
40
|
+
disabled: !f.value,
|
|
41
41
|
className: "bg-background/80 hover:bg-background absolute top-2 right-2 z-10 rounded-md border p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
42
|
-
title:
|
|
43
|
-
"aria-label":
|
|
44
|
-
children:
|
|
42
|
+
title: x ? "Copied!" : "Copy to clipboard",
|
|
43
|
+
"aria-label": x ? "Copied to clipboard" : "Copy code to clipboard",
|
|
44
|
+
children: x ? /* @__PURE__ */ jsx(Check, {
|
|
45
45
|
className: "h-4 w-4 text-green-600",
|
|
46
46
|
"aria-hidden": "true"
|
|
47
47
|
}) : /* @__PURE__ */ jsx(Copy, {
|
|
48
48
|
className: "h-4 w-4",
|
|
49
49
|
"aria-hidden": "true"
|
|
50
50
|
})
|
|
51
|
-
}), /* @__PURE__ */ jsx(CodeContent_default, { content: String(
|
|
51
|
+
}), /* @__PURE__ */ jsx(CodeContent_default, { content: ensureCodeFenced(String(f.value ?? "")) })]
|
|
52
52
|
})
|
|
53
53
|
});
|
|
54
|
-
},
|
|
55
|
-
let
|
|
56
|
-
return
|
|
57
|
-
name:
|
|
58
|
-
control:
|
|
59
|
-
defaultValue:
|
|
60
|
-
render:
|
|
61
|
-
}),
|
|
54
|
+
}, m[1] = C, m[2] = x, m[3] = h, m[4] = v, m[5] = D) : D = m[5];
|
|
55
|
+
let O;
|
|
56
|
+
return m[6] !== y.control || m[7] !== h || m[8] !== E || m[9] !== D ? (O = /* @__PURE__ */ jsx(Controller, {
|
|
57
|
+
name: h,
|
|
58
|
+
control: y.control,
|
|
59
|
+
defaultValue: E,
|
|
60
|
+
render: D
|
|
61
|
+
}), m[6] = y.control, m[7] = h, m[8] = E, m[9] = D, m[10] = O) : O = m[10], O;
|
|
62
62
|
};
|
|
63
63
|
export { CodeViewField };
|