treege 3.0.0-beta.9 → 3.0.0-beta.91
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/LICENSE +18 -12
- package/README.md +598 -79
- package/dist/DefaultSubmitButton-NeSDqyzv.js +1909 -0
- package/dist/ThemeContext-CPsC8QIP.js +1008 -0
- package/dist/editor/components/input/ComboboxWithCreate.d.ts +2 -1
- package/dist/editor/components/styles/EditorStyles.d.ts +2 -0
- package/dist/editor/constants/defaultNode.d.ts +1 -1
- package/dist/editor/constants/edgeTypes.d.ts +3 -2
- package/dist/editor/constants/inputTypeIcons.d.ts +3 -0
- package/dist/editor/constants/nodeSpacing.d.ts +25 -0
- package/dist/editor/constants/nodeTypes.d.ts +4 -5
- package/dist/editor/context/OpenApiContext.d.ts +79 -0
- package/dist/editor/context/TreegeEditorRuntimeProvider.d.ts +78 -0
- package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
- package/dist/editor/features/TreegeEditor/controls/MiniMapControl.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/dialogs/AuthorizeDialog.d.ts +20 -0
- package/dist/editor/features/TreegeEditor/dialogs/ChangeNodeTypeDialog.d.ts +2 -0
- package/dist/editor/features/TreegeEditor/dialogs/DeleteNodeDialog.d.ts +2 -0
- package/dist/editor/features/TreegeEditor/dialogs/HeadersDialog.d.ts +19 -0
- package/dist/editor/features/TreegeEditor/dialogs/OpenApiDialog.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/edges/ConditionalEdge.d.ts +2 -2
- package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +3 -0
- package/dist/editor/features/TreegeEditor/forms/HttpConfigForm.d.ts +4 -1
- package/dist/editor/features/TreegeEditor/forms/JsonTemplateEditor.d.ts +13 -0
- package/dist/editor/features/TreegeEditor/forms/OptionsMappingFields.d.ts +34 -0
- package/dist/editor/features/TreegeEditor/forms/OptionsSourceForm.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/forms/SensitiveHeaderWarning.d.ts +13 -0
- package/dist/editor/features/TreegeEditor/forms/SubmitConfigForm.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/inputs/ApiUrlCombobox.d.ts +20 -0
- package/dist/editor/features/TreegeEditor/inputs/ComboboxPattern.d.ts +2 -1
- package/dist/editor/features/TreegeEditor/inputs/DefaultFileValueField.d.ts +14 -0
- package/dist/editor/features/TreegeEditor/inputs/OptionImageField.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/inputs/SelectNodeGroup.d.ts +22 -1
- package/dist/editor/features/TreegeEditor/inputs/TranslatableInput.d.ts +20 -0
- package/dist/editor/features/TreegeEditor/layout/AutoLayout.d.ts +15 -0
- package/dist/editor/features/TreegeEditor/listeners/FlowChangeEmitter.d.ts +19 -0
- package/dist/editor/features/TreegeEditor/nodes/TreegeNode.d.ts +5 -0
- package/dist/editor/features/TreegeEditor/nodes/components/BottomHandleDropdown.d.ts +25 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeGroupBadge.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeImage.d.ts +5 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeImageButton.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeInputPreview.d.ts +12 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeLabelInput.d.ts +10 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeMoreMenu.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeRequiredButton.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeStackOrderButtons.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeTypeBadge.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeTypePickerMenuContent.d.ts +12 -0
- package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +4 -2
- package/dist/editor/features/TreegeEditor/panel/AIGeneratorDialog.d.ts +16 -0
- package/dist/editor/features/TreegeEditor/panel/ActionsPanel.d.ts +7 -2
- package/dist/editor/features/TreegeEditor/panel/MultiSelectionPanel.d.ts +7 -0
- package/dist/editor/hooks/useAvailableParentFields.d.ts +13 -0
- package/dist/editor/hooks/useFlowActions.d.ts +6 -2
- package/dist/editor/hooks/useFlowConnections.d.ts +14 -0
- package/dist/editor/hooks/useFlowContent.d.ts +16 -0
- package/dist/editor/hooks/useHistoryStore.d.ts +26 -0
- package/dist/editor/hooks/useIsStackedEdge.d.ts +8 -0
- package/dist/editor/hooks/useKeyValueRows.d.ts +15 -0
- package/dist/editor/hooks/useNodesSelection.d.ts +5 -5
- package/dist/editor/hooks/useStackPosition.d.ts +14 -0
- package/dist/editor/hooks/useTranslate.d.ts +1 -1
- package/dist/editor/hooks/useUndoRedo.d.ts +31 -0
- package/dist/editor/types/ai.d.ts +65 -0
- package/dist/editor/types/editor.d.ts +106 -10
- package/dist/editor/types/openapi.d.ts +106 -0
- package/dist/editor/utils/aiFlowGenerator.d.ts +5 -0
- package/dist/editor/utils/cleanEmptyData.d.ts +18 -0
- package/dist/editor/utils/cleanNodeConfig.d.ts +5 -0
- package/dist/editor/utils/dagreLayout.d.ts +8 -0
- package/dist/editor/utils/edge.d.ts +50 -0
- package/dist/editor/utils/groupColor.d.ts +14 -0
- package/dist/editor/utils/image.d.ts +7 -0
- package/dist/editor/utils/inputTypeIcon.d.ts +6 -0
- package/dist/editor/utils/jsonBindTarget.d.ts +15 -0
- package/dist/editor/utils/openApiPayload.d.ts +12 -0
- package/dist/editor/utils/openapi.d.ts +35 -0
- package/dist/editor/utils/sensitiveHeaders.d.ts +20 -0
- package/dist/editor/utils/stackPositionIndex.d.ts +9 -0
- package/dist/editor-DJbNgLSF.js +6485 -0
- package/dist/editor.js +3 -7
- package/dist/main.js +6 -52
- package/dist/renderer/context/TreegeRenderRuntimeProvider.d.ts +135 -0
- package/dist/renderer/context/TreegeRendererProvider.d.ts +15 -0
- package/dist/renderer/context/TreegeViewerProvider.d.ts +28 -0
- package/dist/renderer/features/TreegeRenderer/native/TreegeRenderer.d.ts +19 -11
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultFormWrapper.d.ts +7 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputLabel.d.ts +10 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputWrapper.d.ts +9 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputs.d.ts +20 -15
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultLoadingSkeleton.d.ts +8 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultStep.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButton.d.ts +9 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButtonWrapper.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultUI.d.ts +8 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DependencyHint.d.ts +15 -0
- package/dist/renderer/features/TreegeRenderer/native/components/OptionItemContent.d.ts +17 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAddressInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAutocompleteInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultCheckboxInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultFileInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHiddenInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHttpInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultNumberInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultPasswordInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultRadioInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSelectInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSubmitInput.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSwitchInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextareaInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +97 -24
- package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultFormWrapper.d.ts +3 -2
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultInputLabel.d.ts +9 -0
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultInputWrapper.d.ts +9 -0
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultLoadingSkeleton.d.ts +7 -0
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultStep.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultSubmitButton.d.ts +5 -1
- package/dist/renderer/features/TreegeRenderer/web/components/DependencyHint.d.ts +22 -0
- package/dist/renderer/features/TreegeRenderer/web/components/OptionItemContent.d.ts +17 -0
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSubmitInput.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/styles/RendererStyles.d.ts +2 -0
- package/dist/renderer/features/TreegeViewer/utils/viewerFields.d.ts +102 -0
- package/dist/renderer/features/TreegeViewer/web/TreegeViewer.d.ts +94 -0
- package/dist/renderer/hooks/useInputOptions.d.ts +28 -0
- package/dist/renderer/hooks/useRenderNode.d.ts +62 -0
- package/dist/renderer/hooks/useSubmitHandler.d.ts +37 -0
- package/dist/renderer/hooks/useTranslate.d.ts +7 -5
- package/dist/renderer/index.d.ts +10 -2
- package/dist/renderer/index.native.d.ts +20 -0
- package/dist/renderer/types/renderer.d.ts +332 -49
- package/dist/renderer/utils/extraPayload.d.ts +21 -0
- package/dist/renderer/utils/file.d.ts +24 -10
- package/dist/renderer/utils/flow.d.ts +1 -18
- package/dist/renderer/utils/form.d.ts +54 -2
- package/dist/renderer/utils/http.d.ts +177 -0
- package/dist/renderer/utils/jsonTemplate.d.ts +30 -0
- package/dist/renderer/utils/node.d.ts +29 -1
- package/dist/renderer/utils/sanitize.d.ts +85 -0
- package/dist/renderer/utils/sanitize.native.d.ts +69 -0
- package/dist/renderer/utils/step.d.ts +27 -0
- package/dist/renderer/utils/submit.d.ts +50 -0
- package/dist/renderer/utils/templateDependencies.d.ts +17 -0
- package/dist/renderer-CNbSt_QW.js +446 -0
- package/dist/renderer-native.d.ts +2 -0
- package/dist/renderer-native.js +3696 -0
- package/dist/renderer.js +5 -45
- package/dist/shared/components/ui/badge.d.ts +2 -2
- package/dist/shared/components/ui/button.d.ts +3 -3
- package/dist/shared/components/ui/collapsible.d.ts +1 -1
- package/dist/shared/components/ui/command.d.ts +1 -1
- package/dist/shared/components/ui/dropdown-menu.d.ts +1 -1
- package/dist/shared/components/ui/field.d.ts +24 -0
- package/dist/shared/components/ui/form.d.ts +1 -1
- package/dist/shared/components/ui/item.d.ts +23 -0
- package/dist/shared/components/ui/popover.d.ts +10 -2
- package/dist/shared/components/ui/select.d.ts +3 -1
- package/dist/shared/components/ui/sheet.d.ts +1 -1
- package/dist/shared/components/ui/skeleton.d.ts +3 -0
- package/dist/shared/components/ui/toggle-group.d.ts +7 -0
- package/dist/shared/components/ui/toggle.d.ts +9 -0
- package/dist/shared/components/ui/tooltip.d.ts +1 -1
- package/dist/shared/constants/colors.d.ts +45 -0
- package/dist/shared/constants/inputType.d.ts +6 -0
- package/dist/shared/constants/node.d.ts +0 -1
- package/dist/shared/context/PortalContainerContext.d.ts +5 -0
- package/dist/shared/context/ThemeContext.d.ts +2 -0
- package/dist/shared/context/ThemeContext.native.d.ts +22 -0
- package/dist/shared/hooks/useMediaQuery.d.ts +12 -0
- package/dist/shared/hooks/useThemeColors.d.ts +37 -0
- package/dist/shared/locales/ar.json.d.ts +259 -19
- package/dist/shared/locales/de.json.d.ts +260 -20
- package/dist/shared/locales/en.json.d.ts +261 -21
- package/dist/shared/locales/es.json.d.ts +260 -20
- package/dist/shared/locales/fr.json.d.ts +260 -20
- package/dist/shared/locales/it.json.d.ts +260 -20
- package/dist/shared/locales/pt.json.d.ts +260 -20
- package/dist/shared/types/edge.d.ts +6 -0
- package/dist/shared/types/file.d.ts +14 -0
- package/dist/shared/types/node.d.ts +155 -19
- package/dist/shared/utils/httpRecord.d.ts +20 -0
- package/dist/shared/utils/inputTypeGuards.d.ts +7 -0
- package/dist/shared/utils/nodeTypeGuards.d.ts +1 -6
- package/dist/shared/utils/normalizeLabel.d.ts +22 -0
- package/dist/shared/utils/translations.d.ts +21 -1
- package/dist/useRenderNode-CG466pNk.js +538 -0
- package/package.json +54 -22
- package/dist/ThemeContext-BIvs8Kw-.js +0 -758
- package/dist/TreegeEditor-Lv5Tn9_F.js +0 -2152
- package/dist/TreegeRenderer-BVaqgInZ.js +0 -1405
- package/dist/editor/context/TreegeEditorContext.d.ts +0 -12
- package/dist/editor/features/TreegeEditor/forms/FlowNodeForm.d.ts +0 -2
- package/dist/editor/features/TreegeEditor/inputs/SelectInputType.d.ts +0 -7
- package/dist/editor/features/TreegeEditor/nodes/FlowNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/GroupNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/InputNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/UINode.d.ts +0 -6
- package/dist/editor/hooks/useEdgesSelection.d.ts +0 -11
- package/dist/renderer/context/TreegeConfigContext.d.ts +0 -39
- package/dist/renderer/context/TreegeRendererContext.d.ts +0 -25
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultGroup.d.ts +0 -7
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultGroup.d.ts +0 -6
- /package/dist/editor/components/{data-display/logo.d.ts → branding/Logo.d.ts} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Translatable } from '../../../../../shared/types/translate';
|
|
2
|
+
interface NodeLabelInputProps {
|
|
3
|
+
nodeId: string;
|
|
4
|
+
label?: Translatable;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
autoFocus?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const NodeLabelInput: ({ nodeId, label, placeholder, className, autoFocus }: NodeLabelInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default NodeLabelInput;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NodeInit } from '../../../../hooks/useFlowConnections';
|
|
2
|
+
interface NodeTypePickerMenuContentProps {
|
|
3
|
+
/** Called with the picked node type. */
|
|
4
|
+
onSelect: (nodeInit: NodeInit) => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Shared dropdown body listing every creatable node type (inputs + UI). Used by
|
|
8
|
+
* the bottom handle (add child / branch) and the junction insert button so the
|
|
9
|
+
* picker stays identical across affordances.
|
|
10
|
+
*/
|
|
11
|
+
declare const NodeTypePickerMenuContent: ({ onSelect }: NodeTypePickerMenuContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default NodeTypePickerMenuContent;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { StackPosition } from '../../../../utils/stackPositionIndex';
|
|
2
3
|
interface NodeWrapperProps extends PropsWithChildren {
|
|
3
|
-
|
|
4
|
+
isSubmit?: boolean;
|
|
5
|
+
stackPosition?: StackPosition;
|
|
4
6
|
}
|
|
5
|
-
declare const NodeWrapper: ({ children,
|
|
7
|
+
declare const NodeWrapper: ({ children, isSubmit, stackPosition }: NodeWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export default NodeWrapper;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Edge, Node } from '@xyflow/react';
|
|
2
|
+
import { AIConfig } from '../../../types/ai';
|
|
3
|
+
export interface AIGeneratorDialogProps {
|
|
4
|
+
/**
|
|
5
|
+
* AI configuration from context
|
|
6
|
+
*/
|
|
7
|
+
aiConfig?: AIConfig;
|
|
8
|
+
/**
|
|
9
|
+
* Callback when tree is generated
|
|
10
|
+
*/
|
|
11
|
+
onGenerate: (data: {
|
|
12
|
+
edges: Edge[];
|
|
13
|
+
nodes: Node[];
|
|
14
|
+
}) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const AIGeneratorDialog: ({ aiConfig, onGenerate }: AIGeneratorDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExtraMenuItem } from '../../../types/editor';
|
|
2
|
+
import { Flow, HttpHeaders } from '../../../../shared/types/node';
|
|
2
3
|
export interface ActionsPanelProps {
|
|
3
4
|
onExportJson?: (data: Flow) => void;
|
|
4
5
|
onSave?: (data: Flow) => void;
|
|
6
|
+
extraMenuItems?: ExtraMenuItem[];
|
|
7
|
+
onAuthorize?: (headers: HttpHeaders) => void;
|
|
8
|
+
headers?: HttpHeaders;
|
|
9
|
+
onHeadersChange?: (headers: HttpHeaders) => void;
|
|
5
10
|
}
|
|
6
|
-
declare const ActionsPanel: ({ onExportJson, onSave }: ActionsPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const ActionsPanel: ({ onExportJson, onSave, extraMenuItems, onAuthorize, headers, onHeadersChange }: ActionsPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
12
|
export default ActionsPanel;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Floating bar that appears at the top-center of the canvas when two or more
|
|
3
|
+
* nodes are selected. Exposes batch actions: assign a group (reuses
|
|
4
|
+
* `SelectNodeGroup`), delete the selection, or clear it.
|
|
5
|
+
*/
|
|
6
|
+
declare const MultiSelectionPanel: () => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export default MultiSelectionPanel;
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns every Input ancestor reachable from the given node, traversing
|
|
3
|
+
* incoming edges depth-first. Cycle-safe (visited set). The result is the
|
|
4
|
+
* pool of fields that a downstream node — typically a conditional edge —
|
|
5
|
+
* may reference: each entry exposes the ancestor's `nodeId`, resolved
|
|
6
|
+
* display `label`, raw `name`, input `type`, and static `options` (when
|
|
7
|
+
* defined), so consumers can render a Select/Input bound to the right
|
|
8
|
+
* source value.
|
|
9
|
+
*
|
|
10
|
+
* Non-Input ancestors (UI nodes, flow nodes, groups) are excluded because
|
|
11
|
+
* they cannot supply a runtime value to evaluate a condition against.
|
|
12
|
+
*/
|
|
1
13
|
declare const useAvailableParentFields: (currentNodeId?: string) => {
|
|
2
14
|
label: string;
|
|
3
15
|
name: string | undefined;
|
|
4
16
|
nodeId: string;
|
|
17
|
+
options: import('../../shared/types/node').InputOption[] | undefined;
|
|
5
18
|
type: import('../../shared/types/node').InputType;
|
|
6
19
|
}[];
|
|
7
20
|
export default useAvailableParentFields;
|
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
declare const useFlowActions: () => {
|
|
6
6
|
clearSelection: () => void;
|
|
7
|
+
deleteNode: (id: string) => void;
|
|
8
|
+
deleteNodes: (ids: string[]) => void;
|
|
9
|
+
deleteSelectedNode: () => void;
|
|
10
|
+
selectNode: (id: string) => void;
|
|
7
11
|
updateNodeData: <T extends Record<string, unknown>>(id: string, data: Partial<T>) => void;
|
|
8
|
-
updateNodeType: (id: string, type: string) => void;
|
|
12
|
+
updateNodeType: (id: string, type: string, subType?: string) => void;
|
|
9
13
|
updateSelectedNodeData: <T extends Record<string, unknown>>(data: Partial<T>) => void;
|
|
10
|
-
updateSelectedNodeType: (type: string) => void;
|
|
14
|
+
updateSelectedNodeType: (type: string, subType?: string) => void;
|
|
11
15
|
};
|
|
12
16
|
export default useFlowActions;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { OnConnect, OnConnectEnd, OnEdgesDelete } from '@xyflow/react';
|
|
2
|
+
/**
|
|
3
|
+
* Shape passed to the node-creating actions (`onAddFromHandle`, `onInsertAfter`,
|
|
4
|
+
* and the internal `createNodeAndConnect`). Lets callers seed the new node's
|
|
5
|
+
* `type` and `data` while React Flow handles position, id, etc.
|
|
6
|
+
*/
|
|
7
|
+
export type NodeInit = {
|
|
8
|
+
type: string;
|
|
9
|
+
data?: Record<string, unknown>;
|
|
10
|
+
};
|
|
2
11
|
/**
|
|
3
12
|
* Custom hook to manage flow connections, including connecting nodes,
|
|
4
13
|
* handling connection ends, and deleting edges with conditional logic.
|
|
@@ -8,8 +17,13 @@ declare const useFlowConnections: () => {
|
|
|
8
17
|
source: string;
|
|
9
18
|
target: string;
|
|
10
19
|
}) => boolean;
|
|
20
|
+
moveStackNodeDown: (nodeId: string) => void;
|
|
21
|
+
moveStackNodeUp: (nodeId: string) => void;
|
|
22
|
+
onAddFromHandle: (sourceNodeId: string, nodeInit?: NodeInit) => void;
|
|
11
23
|
onConnect: OnConnect;
|
|
12
24
|
onConnectEnd: OnConnectEnd;
|
|
25
|
+
onCreateBranch: (sourceNodeId: string, nodeInit?: NodeInit) => void;
|
|
13
26
|
onEdgesDelete: OnEdgesDelete;
|
|
27
|
+
onInsertAfter: (sourceNodeId: string, nodeInit?: NodeInit) => void;
|
|
14
28
|
};
|
|
15
29
|
export default useFlowConnections;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content flags for the current flow, used to gate editor actions.
|
|
3
|
+
*
|
|
4
|
+
* A lone `group` node is just a container — it carries no form value, so it
|
|
5
|
+
* must not make the flow "saveable". `hasInputNodes` therefore counts only
|
|
6
|
+
* `input` nodes: that is what Save and Export JSON should gate on.
|
|
7
|
+
*
|
|
8
|
+
* `isEmpty` is broader (no nodes and no edges at all) and is meant for the
|
|
9
|
+
* Clear action, which should stay enabled as long as there is anything on the
|
|
10
|
+
* canvas to wipe — including an orphan group.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useFlowContent: () => {
|
|
13
|
+
hasInputNodes: boolean;
|
|
14
|
+
isEmpty: boolean;
|
|
15
|
+
};
|
|
16
|
+
export default useFlowContent;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Edge, Node } from '@xyflow/react';
|
|
2
|
+
type Snapshot = {
|
|
3
|
+
nodes: Node[];
|
|
4
|
+
edges: Edge[];
|
|
5
|
+
};
|
|
6
|
+
type HistoryStore = {
|
|
7
|
+
past: Snapshot[];
|
|
8
|
+
future: Snapshot[];
|
|
9
|
+
pushPast: (snapshot: Snapshot) => void;
|
|
10
|
+
popPast: () => Snapshot | undefined;
|
|
11
|
+
pushFuture: (snapshot: Snapshot) => void;
|
|
12
|
+
popFuture: () => Snapshot | undefined;
|
|
13
|
+
clearFuture: () => void;
|
|
14
|
+
reset: () => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Zustand store backing the editor's undo/redo history.
|
|
18
|
+
*
|
|
19
|
+
* Holds two stacks of `{ nodes, edges }` snapshots: `past` (states to undo into) and
|
|
20
|
+
* `future` (states to redo into). Both are capped at `MAX_HISTORY` to bound memory.
|
|
21
|
+
*
|
|
22
|
+
* Consumed exclusively by `useUndoRedo` — components should not read or mutate this
|
|
23
|
+
* store directly. Call `reset()` when loading a new flow to drop stale history.
|
|
24
|
+
*/
|
|
25
|
+
declare const useHistoryStore: import('zustand').UseBoundStore<import('zustand').StoreApi<HistoryStore>>;
|
|
26
|
+
export default useHistoryStore;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An edge is "stacked" when it connects two nodes that belong to the same
|
|
3
|
+
* visual chain — i.e. the source has a linear child (position "first" or
|
|
4
|
+
* "middle") and the target has a linear parent (position "middle" or "last").
|
|
5
|
+
* Stacked edges are not rendered: their endpoints touch border-to-border in
|
|
6
|
+
* the layout, making the line redundant.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useIsStackedEdge: (source: string, target: string) => boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { KeyValueEntry } from '../../shared/utils/httpRecord';
|
|
2
|
+
/**
|
|
3
|
+
* Bridges an editable list of key/value rows with a persisted
|
|
4
|
+
* `Record<string, string>` (headers, query params…).
|
|
5
|
+
*
|
|
6
|
+
* Records can't hold a half-typed row (an empty key, or two rows mid-edit), so
|
|
7
|
+
* the rows are the local source of truth while editing. Every mutation is
|
|
8
|
+
* serialized back to a record — empty keys dropped, last wins on duplicates —
|
|
9
|
+
* and pushed up via `onChange`. The rows reseed from `record` only when it
|
|
10
|
+
* changes from the outside (a different node, a static↔api toggle), never in
|
|
11
|
+
* response to our own emit, so adding a blank row doesn't immediately vanish.
|
|
12
|
+
* The reseed happens during render (React's recommended pattern) rather than in
|
|
13
|
+
* an effect, so there's no extra commit/flash.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useKeyValueRows: (record: Record<string, string> | undefined, onChange: (record: Record<string, string>) => void) => readonly [KeyValueEntry[], (rows: KeyValueEntry[]) => void];
|
|
@@ -10,10 +10,10 @@ declare const useNodesSelection: <TNodeData extends TreegeNodeData = TreegeNodeD
|
|
|
10
10
|
nodes: TreegeNode[];
|
|
11
11
|
selectedNode: ({
|
|
12
12
|
id: string;
|
|
13
|
-
position: import('@xyflow/
|
|
13
|
+
position: import('@xyflow/system').XYPosition;
|
|
14
14
|
data: TreegeNodeData;
|
|
15
|
-
sourcePosition?: import('@xyflow/
|
|
16
|
-
targetPosition?: import('@xyflow/
|
|
15
|
+
sourcePosition?: import('@xyflow/system').Position;
|
|
16
|
+
targetPosition?: import('@xyflow/system').Position;
|
|
17
17
|
hidden?: boolean;
|
|
18
18
|
selected?: boolean;
|
|
19
19
|
dragging?: boolean;
|
|
@@ -28,10 +28,10 @@ declare const useNodesSelection: <TNodeData extends TreegeNodeData = TreegeNodeD
|
|
|
28
28
|
initialHeight?: number;
|
|
29
29
|
parentId?: string;
|
|
30
30
|
zIndex?: number;
|
|
31
|
-
extent?: "parent" | import('@xyflow/
|
|
31
|
+
extent?: "parent" | import('@xyflow/system').CoordinateExtent | null;
|
|
32
32
|
expandParent?: boolean;
|
|
33
33
|
ariaLabel?: string;
|
|
34
|
-
origin?: import('@xyflow/
|
|
34
|
+
origin?: import('@xyflow/system').NodeOrigin;
|
|
35
35
|
handles?: import('@xyflow/system').NodeHandle[];
|
|
36
36
|
measured?: {
|
|
37
37
|
width?: number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StackPosition } from '../utils/stackPositionIndex';
|
|
2
|
+
export type StackPositionInfo = {
|
|
3
|
+
position: StackPosition;
|
|
4
|
+
isStackHead: boolean;
|
|
5
|
+
isStackTail: boolean;
|
|
6
|
+
isStackMiddle: boolean;
|
|
7
|
+
isStackSingle: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Returns the stack position of `nodeId` plus convenience booleans derived from
|
|
11
|
+
* it. Uses a shallow equality selector so consumers only re-render when one of
|
|
12
|
+
* the booleans actually flips, not on every edge mutation.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useStackPosition: (nodeId: string) => StackPositionInfo;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hook for translating text in the editor with context-aware language preference.
|
|
3
3
|
*
|
|
4
|
-
* This hook uses the language from
|
|
4
|
+
* This hook uses the language from TreegeEditorRuntimeContext and delegates to the shared useTranslate hook.
|
|
5
5
|
*
|
|
6
6
|
* @returns A function that translates either a translation key or a Translatable object
|
|
7
7
|
*
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OnBeforeDelete } from '@xyflow/react';
|
|
2
|
+
type UseUndoRedoOptions = {
|
|
3
|
+
enableShortcuts?: boolean;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Snapshot-based undo/redo for the ReactFlow editor.
|
|
7
|
+
*
|
|
8
|
+
* Maintains `past` / `future` stacks of `{ nodes, edges }` snapshots in `useHistoryStore`.
|
|
9
|
+
* Callers must invoke `takeSnapshot()` before any mutation they want to be undoable
|
|
10
|
+
* (drag start, node/edge creation, deletion, type change, …); the hook itself does
|
|
11
|
+
* not observe ReactFlow state changes.
|
|
12
|
+
*
|
|
13
|
+
* @param enableShortcuts - When true, binds Cmd/Ctrl+Z (undo) and Cmd/Ctrl+Shift+Z /
|
|
14
|
+
* Cmd/Ctrl+Y (redo) to the window. Should be enabled in a single root component
|
|
15
|
+
* (e.g. the editor) to avoid duplicate listeners.
|
|
16
|
+
*
|
|
17
|
+
* @returns
|
|
18
|
+
* - `takeSnapshot`: pushes the current flow onto `past` and clears `future`.
|
|
19
|
+
* - `onBeforeDelete`: adapter typed for ReactFlow's `onBeforeDelete` prop.
|
|
20
|
+
* - `undo` / `redo`: restore the previous / next snapshot.
|
|
21
|
+
* - `canUndo` / `canRedo`: booleans driven by stack length, suitable for disabling UI buttons.
|
|
22
|
+
*/
|
|
23
|
+
declare const useUndoRedo: ({ enableShortcuts }?: UseUndoRedoOptions) => {
|
|
24
|
+
canRedo: boolean;
|
|
25
|
+
canUndo: boolean;
|
|
26
|
+
onBeforeDelete: OnBeforeDelete;
|
|
27
|
+
redo: () => void;
|
|
28
|
+
takeSnapshot: () => void;
|
|
29
|
+
undo: () => void;
|
|
30
|
+
};
|
|
31
|
+
export default useUndoRedo;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Edge, Node } from '@xyflow/react';
|
|
2
|
+
/**
|
|
3
|
+
* AI Provider types for tree generation
|
|
4
|
+
*/
|
|
5
|
+
export type AIProvider = "gemini" | "openai" | "deepseek" | "claude";
|
|
6
|
+
/**
|
|
7
|
+
* AI Configuration for tree generation
|
|
8
|
+
*/
|
|
9
|
+
export interface AIConfig {
|
|
10
|
+
/**
|
|
11
|
+
* The AI provider to use
|
|
12
|
+
* @default "gemini"
|
|
13
|
+
*/
|
|
14
|
+
provider?: AIProvider;
|
|
15
|
+
/**
|
|
16
|
+
* API key for the selected provider
|
|
17
|
+
*/
|
|
18
|
+
apiKey: string;
|
|
19
|
+
/**
|
|
20
|
+
* Optional model name override
|
|
21
|
+
* - Gemini: "gemini-2.5-flash" (default), "gemini-2.5-pro-preview-03-25"
|
|
22
|
+
* - OpenAI: "gpt-4o-mini" (default), "gpt-4o", "gpt-3.5-turbo"
|
|
23
|
+
* - DeepSeek: "deepseek-chat" (default)
|
|
24
|
+
* - Claude: "claude-3-5-haiku-20241022" (default), "claude-3-5-sonnet-20241022"
|
|
25
|
+
*/
|
|
26
|
+
model?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Temperature for generation (0-1, default: 0.7)
|
|
29
|
+
*/
|
|
30
|
+
temperature?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* AI Generation request
|
|
34
|
+
*/
|
|
35
|
+
export interface AIGenerationRequest {
|
|
36
|
+
/**
|
|
37
|
+
* User prompt describing the desired tree/form
|
|
38
|
+
*/
|
|
39
|
+
prompt: string;
|
|
40
|
+
/**
|
|
41
|
+
* AI configuration
|
|
42
|
+
*/
|
|
43
|
+
config: AIConfig;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* AI Generation response
|
|
47
|
+
*/
|
|
48
|
+
export interface AIGenerationResponse {
|
|
49
|
+
/**
|
|
50
|
+
* Generated nodes
|
|
51
|
+
*/
|
|
52
|
+
nodes: Node[];
|
|
53
|
+
/**
|
|
54
|
+
* Generated edges
|
|
55
|
+
*/
|
|
56
|
+
edges: Edge[];
|
|
57
|
+
/**
|
|
58
|
+
* Optional explanation or metadata
|
|
59
|
+
*/
|
|
60
|
+
metadata?: {
|
|
61
|
+
explanation?: string;
|
|
62
|
+
nodesCount?: number;
|
|
63
|
+
edgesCount?: number;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import { Edge, Node } from '@xyflow/react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { AIConfig } from './ai';
|
|
4
|
+
import { OpenApiDocument } from './openapi';
|
|
5
|
+
import { Flow, HttpHeaders } from '../../shared/types/node';
|
|
6
|
+
export interface ExtraMenuItem {
|
|
4
7
|
/**
|
|
5
|
-
*
|
|
6
|
-
* Note: Individual defaultNodes/defaultEdges props take precedence over this.
|
|
8
|
+
* Label displayed in the menu item.
|
|
7
9
|
*/
|
|
8
|
-
|
|
10
|
+
label: ReactNode;
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
12
|
+
* Optional icon rendered before the label.
|
|
11
13
|
*/
|
|
12
|
-
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Callback triggered when the menu item is clicked.
|
|
17
|
+
*/
|
|
18
|
+
onClick?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* When true, styles the item as destructive.
|
|
21
|
+
*/
|
|
22
|
+
destructive?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface TreegeEditorProps {
|
|
13
25
|
/**
|
|
14
|
-
* Default
|
|
26
|
+
* Default flow structure containing combined nodes and edges.
|
|
27
|
+
* Note: Individual defaultNodes/defaultEdges props take precedence over this.
|
|
15
28
|
*/
|
|
16
|
-
|
|
29
|
+
flow?: Flow | null;
|
|
17
30
|
/**
|
|
18
31
|
* Callback function triggered when exporting JSON data.
|
|
19
32
|
*/
|
|
@@ -26,12 +39,95 @@ export interface TreegeEditorProps {
|
|
|
26
39
|
* @param data
|
|
27
40
|
*/
|
|
28
41
|
onSave?: (data: Flow) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Called (debounced) whenever the canvas changes, with the current flow
|
|
44
|
+
* (id + nodes + edges). Use it for live preview or autosave. Unlike `onSave`
|
|
45
|
+
* it is not gated on having input nodes, so it also reports an emptied canvas
|
|
46
|
+
* after Clear. Unlike `onSave`/`onExportJson` it does NOT strip sensitive
|
|
47
|
+
* headers — live consumers (e.g. `TreegeRenderer`) need the real flow, so do
|
|
48
|
+
* not persist its output verbatim if that matters to you.
|
|
49
|
+
*/
|
|
50
|
+
onChange?: (data: Flow) => void;
|
|
29
51
|
/**
|
|
30
52
|
* Theme for the editor interface.
|
|
31
53
|
*/
|
|
32
54
|
theme?: "dark" | "light";
|
|
33
55
|
/**
|
|
34
|
-
*
|
|
56
|
+
* Controlled editor UI language. When provided, the editor runs in controlled
|
|
57
|
+
* mode: this value always wins and the built-in switcher only fires
|
|
58
|
+
* `onLanguageChange` — you must update this prop to actually change the
|
|
59
|
+
* language. Leave undefined to let the editor manage it itself (see
|
|
60
|
+
* `defaultLanguage`).
|
|
35
61
|
*/
|
|
36
62
|
language?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Initial editor UI language in uncontrolled mode. The editor seeds its
|
|
65
|
+
* internal state with this value, then owns it so the user can switch at
|
|
66
|
+
* runtime via the actions panel. Ignored when `language` is provided.
|
|
67
|
+
* @default "en"
|
|
68
|
+
*/
|
|
69
|
+
defaultLanguage?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Called whenever the user switches the editor language via the built-in
|
|
72
|
+
* switcher, with the newly selected language. Required to react to the change
|
|
73
|
+
* in controlled mode; optional in uncontrolled mode (use it to persist or
|
|
74
|
+
* sync the choice).
|
|
75
|
+
*/
|
|
76
|
+
onLanguageChange?: (language: string) => void;
|
|
77
|
+
/**
|
|
78
|
+
* AI configuration for tree generation
|
|
79
|
+
*/
|
|
80
|
+
aiConfig?: AIConfig;
|
|
81
|
+
/**
|
|
82
|
+
* Additional CSS class names for custom styling.
|
|
83
|
+
*/
|
|
84
|
+
className?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Extra menu items to append to the "more" dropdown of the actions panel.
|
|
87
|
+
*/
|
|
88
|
+
extraMenuItems?: ExtraMenuItem[];
|
|
89
|
+
/**
|
|
90
|
+
* OpenAPI 3.x source used to power URL/route suggestions inside HTTP and
|
|
91
|
+
* Options-source forms, and to drive the Authorize flow. Accepts either:
|
|
92
|
+
* - a pre-parsed `OpenApiDocument` object
|
|
93
|
+
* - a URL string (the editor fetches it on mount and toasts on failure)
|
|
94
|
+
*
|
|
95
|
+
* Users can still load one at runtime via the editor's "OpenAPI" button.
|
|
96
|
+
*/
|
|
97
|
+
openApi?: OpenApiDocument | string;
|
|
98
|
+
/**
|
|
99
|
+
* Base URL the produced tree is meant to run against. Pass the same value you
|
|
100
|
+
* give to `TreegeRenderer`'s `baseUrl`. It drives two things in the editor:
|
|
101
|
+
* - HTTP/Options-source urls are stored **relative** to it (route picker emits
|
|
102
|
+
* relative paths), so the exported JSON stays environment-agnostic.
|
|
103
|
+
* - it is shown as a read-only prefix on URL fields and used to resolve the
|
|
104
|
+
* "Detect fields" probe, so editor-time previews hit a real host.
|
|
105
|
+
*
|
|
106
|
+
* Works with or without OpenAPI. When an OpenAPI document is loaded, its
|
|
107
|
+
* `servers[0].url` (or the Authorize dialog override) takes precedence for
|
|
108
|
+
* route resolution; otherwise this value is the base.
|
|
109
|
+
*/
|
|
110
|
+
baseUrl?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Global HTTP headers applied to in-editor requests (e.g. the "Detect
|
|
113
|
+
* fields" button in `OptionsSourceForm`). Pass the same value you give to
|
|
114
|
+
* `TreegeRenderer` so editor-time previews use the same auth and headers
|
|
115
|
+
* that the runtime form will use.
|
|
116
|
+
*/
|
|
117
|
+
headers?: HttpHeaders;
|
|
118
|
+
/**
|
|
119
|
+
* Called when the user submits the Authorize dialog. Receives the resulting
|
|
120
|
+
* HTTP headers (`Authorization`, API key headers…). The consumer is expected
|
|
121
|
+
* to forward those headers to `TreegeRenderer` (or `TreegeRendererProvider`)
|
|
122
|
+
* via its `headers` prop so every request issued by the form is authenticated.
|
|
123
|
+
*/
|
|
124
|
+
onAuthorize?: (headers: HttpHeaders) => void;
|
|
125
|
+
/**
|
|
126
|
+
* Called whenever the user edits the global headers via the editor's
|
|
127
|
+
* built-in "Global headers" dialog. The component is controlled — the
|
|
128
|
+
* parent is expected to update its `headers` state in response and pass
|
|
129
|
+
* the new list back via the `headers` prop, so every editor-time and
|
|
130
|
+
* runtime request reflects the change.
|
|
131
|
+
*/
|
|
132
|
+
onHeadersChange?: (headers: HttpHeaders) => void;
|
|
37
133
|
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal OpenAPI 3.x types — only what the editor needs to suggest API
|
|
3
|
+
* routes and authenticate against an API. Not a full OpenAPI definition.
|
|
4
|
+
*
|
|
5
|
+
* Swagger 2.0 (`swagger: "2.0"`) is intentionally not supported.
|
|
6
|
+
*/
|
|
7
|
+
export interface OpenApiDocument {
|
|
8
|
+
openapi: string;
|
|
9
|
+
info?: {
|
|
10
|
+
title?: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
};
|
|
14
|
+
servers?: Array<{
|
|
15
|
+
url: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
}>;
|
|
18
|
+
paths: Record<string, OpenApiPathItem | undefined>;
|
|
19
|
+
components?: {
|
|
20
|
+
securitySchemes?: Record<string, OpenApiSecurityScheme | undefined>;
|
|
21
|
+
schemas?: Record<string, OpenApiSchema>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Minimal JSON Schema subset — only what's needed to generate a request-body
|
|
26
|
+
* skeleton for a route. Supports `$ref` (to `#/components/schemas/*`), objects,
|
|
27
|
+
* arrays, primitives, and `example`/`default`/`enum` hints.
|
|
28
|
+
*/
|
|
29
|
+
export interface OpenApiSchema {
|
|
30
|
+
$ref?: string;
|
|
31
|
+
type?: "object" | "array" | "string" | "number" | "integer" | "boolean" | "null";
|
|
32
|
+
format?: string;
|
|
33
|
+
properties?: Record<string, OpenApiSchema>;
|
|
34
|
+
items?: OpenApiSchema;
|
|
35
|
+
required?: string[];
|
|
36
|
+
enum?: unknown[];
|
|
37
|
+
example?: unknown;
|
|
38
|
+
default?: unknown;
|
|
39
|
+
}
|
|
40
|
+
export interface OpenApiMediaType {
|
|
41
|
+
schema?: OpenApiSchema;
|
|
42
|
+
}
|
|
43
|
+
export interface OpenApiRequestBody {
|
|
44
|
+
required?: boolean;
|
|
45
|
+
content?: Record<string, OpenApiMediaType>;
|
|
46
|
+
}
|
|
47
|
+
export interface OpenApiPathItem {
|
|
48
|
+
get?: OpenApiOperation;
|
|
49
|
+
put?: OpenApiOperation;
|
|
50
|
+
post?: OpenApiOperation;
|
|
51
|
+
delete?: OpenApiOperation;
|
|
52
|
+
patch?: OpenApiOperation;
|
|
53
|
+
}
|
|
54
|
+
export interface OpenApiOperation {
|
|
55
|
+
summary?: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
tags?: string[];
|
|
58
|
+
operationId?: string;
|
|
59
|
+
requestBody?: OpenApiRequestBody;
|
|
60
|
+
}
|
|
61
|
+
/** HTTP Bearer auth scheme. */
|
|
62
|
+
export interface OpenApiHttpBearerScheme {
|
|
63
|
+
type: "http";
|
|
64
|
+
scheme: "bearer";
|
|
65
|
+
bearerFormat?: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
}
|
|
68
|
+
/** Header-based API key auth scheme. */
|
|
69
|
+
export interface OpenApiApiKeyHeaderScheme {
|
|
70
|
+
type: "apiKey";
|
|
71
|
+
in: "header";
|
|
72
|
+
name: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* OAuth2 with the `password` grant. The user provides username + password
|
|
77
|
+
* directly, the editor exchanges them at `tokenUrl` and uses the returned
|
|
78
|
+
* access token as a Bearer header.
|
|
79
|
+
*
|
|
80
|
+
* Other OAuth2 flows (`authorization_code`, `client_credentials`, `implicit`)
|
|
81
|
+
* are out of scope — they require browser redirects, server-side state, or
|
|
82
|
+
* PKCE.
|
|
83
|
+
*/
|
|
84
|
+
export interface OpenApiOAuth2PasswordScheme {
|
|
85
|
+
type: "oauth2";
|
|
86
|
+
/** Resolved against `servers[0].url` when the spec uses a relative path. */
|
|
87
|
+
tokenUrl: string;
|
|
88
|
+
description?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Security schemes the editor supports today. Other schemes (OAuth2 flows
|
|
92
|
+
* other than password, cookie/query API keys, openIdConnect) are filtered
|
|
93
|
+
* out at extraction time.
|
|
94
|
+
*/
|
|
95
|
+
export type OpenApiSecurityScheme = OpenApiHttpBearerScheme | OpenApiApiKeyHeaderScheme | OpenApiOAuth2PasswordScheme;
|
|
96
|
+
export type ApiRouteMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
97
|
+
/**
|
|
98
|
+
* One operation extracted from an OpenAPI document, flattened to a single
|
|
99
|
+
* (method, path) record for easy listing.
|
|
100
|
+
*/
|
|
101
|
+
export interface ApiRoute {
|
|
102
|
+
method: ApiRouteMethod;
|
|
103
|
+
path: string;
|
|
104
|
+
summary?: string;
|
|
105
|
+
operationId?: string;
|
|
106
|
+
}
|