import { type ComponentProps, type ReactNode } from 'react'; import { type FieldProps } from '../components/Field.js'; import { Textarea } from '../components/Input.js'; import type { FieldPatch } from '../editing.js'; import { type GraphEditorStrings } from './editorStrings.js'; import { type Json } from './records.js'; export { asRecord, type Json } from './records.js'; export type Strings = GraphEditorStrings; export declare const EXPRESSION: RegExp; export declare const ENV_KEY: RegExp; export declare const DURATION: RegExp; export declare function withoutUndefined(value: Json): Json; export declare function text(value: unknown): string; export declare function isScalar(value: unknown): boolean; export declare function parseScalar(value: string): unknown; export declare function sameValue(a: unknown, b: unknown): boolean; /** Keys whose value changed: undefined removes a key, anything else writes it. */ export declare function diffPatch(original: Json, next: Json): Required; export declare function isEmptyPatch(patch: Required): boolean; export declare function conditionText(value: unknown): string; export declare function parseCondition(value: string): unknown; export declare function durationError(value: string, t: Strings, pattern?: RegExp): string | undefined; export declare function expressionError(value: string, t: Strings): string | undefined; export declare function orUndefined(value: string): string | undefined; export declare function countError(value: string, min: number, message: string): string | undefined; export declare function parseCount(value: string): unknown; export declare function parseJson(value: string): { ok: boolean; value?: unknown; }; /** A key/value row; nested values are edited as JSON. */ export interface Row { key: string; value: string; nested?: boolean; /** What the row was read from; while its text is unchanged a save writes this back as it was. */ original?: unknown; } export declare function unchangedValue(text: string, original: unknown, nested?: boolean): boolean; /** Rows for a map; with `nested` false a non-scalar is shown as its JSON text and saved as a string. */ export declare function rowsFrom(value: unknown, nested?: boolean): Row[]; export declare function rowsTo(rows: Row[], parse: (value: string) => unknown): Json | undefined; export declare function rowsError(rows: Row[], keyPattern: RegExp, keyMessage: string, t: Strings, valueError?: (value: string) => string | undefined): string | undefined; /** A switch that may instead hold a `${{ }}` expression. */ export type Flag = boolean | string | undefined; export declare function flagOf(value: unknown): Flag; export declare function flagError(value: Flag, t: Strings): string | undefined; export declare function flagValue(checked: boolean, fallback: boolean, original: unknown): Flag; /** Whether each section of a dialog is open, kept while the dialog is up so switching views keeps it. */ export declare const SectionMemory: import("react").Context | null>; export declare function useSectionMemory(): Map; /** A titled part of an editor dialog. It opens as it was last left in this * dialog, and opens itself when a problem inside would otherwise be hidden. */ export declare function DialogSection({ title, description, open, alert, children, }: { title: string; description?: string; /** Whether it starts open; read once, when its dialog first shows it. */ open?: boolean; /** A problem inside, which opens it so a folded section can't hide why Save is off. */ alert?: boolean; children: ReactNode; }): import("react").JSX.Element; /** The YAML key a field sets, beside its name; left out where the name already says it. */ export declare function KeyHint({ label, yamlKey }: { label: string; yamlKey: string; }): import("react").JSX.Element | null; /** Label props for an Input or Textarea that sets `yamlKey`. */ export declare function labelled(label: string, yamlKey: string): { label: string; hint: import("react").JSX.Element; }; /** A Field for a setting the YAML holds, with the key it sets beside its name. With `id` * its label names the one control that takes that id; without, it names its controls as a * group, as a list of rows or a set of choices wants. */ export declare function YamlField({ label, yamlKey, description, actions, error, required, id, children, }: { label: string; yamlKey?: string | undefined; description?: ReactNode; actions?: ReactNode; error?: ReactNode; required?: boolean | undefined; id?: string | undefined; children: FieldProps['children']; }): import("react").JSX.Element; /** * Switches a field between its own control and a typed expression, where the schema takes one. Its * name says what pressing it does, so it isn't also announced as pressed. */ export declare function ExpressionToggle({ active, onChange, }: { active: boolean; onChange: (active: boolean) => void; }): import("react").JSX.Element; export declare function ToggleField({ label, yamlKey, description, checked, onChange, disabled, error, }: { label: string; yamlKey?: string; description: string; checked: boolean; onChange: (checked: boolean) => void; disabled?: boolean; error?: string | undefined; }): import("react").JSX.Element; /** One of a few choices. A YamlField around it names it; standing alone, `label` does. */ export declare function ChoiceButtons({ label, options, value, onChange, }: { label?: string | undefined; options: { value: T; label: string; }[]; value: T; onChange: (value: T) => void; }): import("react").JSX.Element; export declare function AddRowButton({ label, onClick }: { label: string; onClick: () => void; }): import("react").JSX.Element; export declare function KeyValueEditor({ rows, onChange, error, valuePlaceholder, keyPlaceholder, addLabel, valueSuggestions, lint, }: { rows: Row[]; onChange: (rows: Row[]) => void; error: string | undefined; valuePlaceholder?: string; keyPlaceholder?: string; addLabel?: string; /** Offered on each value, such as references to the workflow's inputs. */ valueSuggestions?: string[]; /** Whether each row shows the problems at its key, inside the caller's LintScope. */ lint?: boolean; }): import("react").JSX.Element; export declare function updateAt(items: T[], index: number, item: T): T[]; export declare function removeAt(items: T[], index: number): T[]; /** A list of single values, such as permissions or variable names. */ export declare function StringListEditor({ label, values, onChange, addLabel, placeholder, error, suggestions, }: { /** The list's name, which names each of its rows. */ label: string; values: string[]; onChange: (values: string[]) => void; addLabel: string; placeholder?: string; error?: string | undefined; /** Offered on each row; any other value can still be typed. */ suggestions?: string[]; }): import("react").JSX.Element; export declare function SuggestedInput({ label, yamlKey, description, value, onChange, suggestions, error, placeholder, }: { label: string; yamlKey?: string; description?: string; value: string; onChange: (value: string) => void; suggestions: string[]; error?: string | undefined; placeholder?: string; }): import("react").JSX.Element; /** A text area that starts one line tall and grows with its text. */ export declare function useGrowingArea(value: string): import("react").RefObject; export declare const GROWING_AREA = "!min-h-0 !resize-none overflow-hidden"; export declare function GrowingTextarea(props: Omit, 'rows'> & { value: string; }): import("react").JSX.Element; /** Whether adding a job, step or input opens its dialog first; any of those dialogs sets it. */ export interface OpenOnAdd { open: boolean; onChange: (open: boolean) => void; } /** The dialogs' "open when adding" switch, when the host keeps the setting. */ export declare function openOnAddOf(editor: { openOnAdd?: boolean; onOpenOnAddChange?: (open: boolean) => void; } | undefined): OpenOnAdd | undefined; export interface DialogShellProps { title: string; onClose: () => void; onSubmit: () => void; saveDisabled: boolean; dirty: boolean; /** A dialog opened on top of this one owns Escape and outside clicks. */ locked?: boolean; footerStart?: ReactNode; /** Controls beside the title, such as a switch between views. */ headerEnd?: ReactNode; openOnAdd?: OpenOnAdd | undefined; children: ReactNode; } export declare function DialogShell({ title, onClose, onSubmit, saveDisabled, dirty, locked, footerStart, headerEnd, openOnAdd, children, }: DialogShellProps): import("react").JSX.Element;