@parallelworks/ui 0.36.0 → 0.38.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/README.md +16 -0
- package/dist/ai/agent/permissions.d.ts +2 -2
- package/dist/ai/agent/permissions.js +3 -1
- package/dist/ai/components/ChatSidebar.js +7 -4
- package/dist/ai/components/agent/PermissionPicker.js +1 -0
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.js +2 -2
- package/dist/ai/strings.d.ts +2 -0
- package/dist/ai/strings.js +2 -0
- package/dist/ai/ui/sidebar.d.ts +6 -0
- package/dist/ai/ui/sidebar.js +15 -1
- package/dist/components/Dropdown.d.ts +2 -0
- package/dist/components/Dropdown.js +7 -2
- package/dist/components/Input.d.ts +11 -6
- package/dist/components/Input.js +93 -74
- package/dist/components/Provider.d.ts +31 -0
- package/dist/components/Provider.js +50 -2
- package/dist/editing.d.ts +404 -0
- package/dist/editor/EditorField.js +1 -1
- package/dist/editor/Monaco.d.ts +15 -1
- package/dist/editor/Monaco.js +117 -13
- package/dist/editor/editorModel.d.ts +5 -0
- package/dist/editor/editorModel.js +23 -0
- package/dist/editor/index.d.ts +4 -0
- package/dist/editor/index.js +5 -1
- package/dist/editor/lintContext.d.ts +21 -0
- package/dist/editor/lintContext.js +136 -0
- package/dist/editor/lintOwner.d.ts +2 -0
- package/dist/editor/lintOwner.js +5 -0
- package/dist/editor/nestedText.d.ts +13 -0
- package/dist/editor/nestedText.js +15 -0
- package/dist/editor/reveal.d.ts +4 -0
- package/dist/editor/reveal.js +15 -0
- package/dist/editor/settingsYaml.d.ts +12 -0
- package/dist/editor/settingsYaml.js +41 -0
- package/dist/form/FieldWrapper.js +1 -0
- package/dist/form/Fields/DropdownField.js +1 -1
- package/dist/form/Fields/DurationField.js +1 -1
- package/dist/form/Form.js +65 -24
- package/dist/form/Wizard/WizardContainer.js +66 -6
- package/dist/form/Wizard/WizardStepContent.js +23 -10
- package/dist/form/Wizard/wizardPages.d.ts +12 -0
- package/dist/form/Wizard/wizardPages.js +5 -0
- package/dist/form/fieldRegistry.js +1 -1
- package/dist/form/formEditing.d.ts +25 -0
- package/dist/form/formEditing.js +20 -0
- package/dist/form/index.js +5 -5
- package/dist/graph/InputDialog.d.ts +80 -0
- package/dist/graph/InputDialog.js +2110 -0
- package/dist/graph/InputsEditor.d.ts +12 -0
- package/dist/graph/InputsEditor.js +1594 -0
- package/dist/graph/ProblemsButton.d.ts +9 -0
- package/dist/graph/ProblemsButton.js +61 -0
- package/dist/graph/ShortcutsButton.d.ts +15 -0
- package/dist/graph/ShortcutsButton.js +56 -0
- package/dist/graph/SuggestionInput.d.ts +18 -0
- package/dist/graph/SuggestionInput.js +29 -0
- package/dist/graph/ToolbarPopover.d.ts +8 -0
- package/dist/graph/ToolbarPopover.js +71 -0
- package/dist/graph/editorApi.d.ts +51 -0
- package/dist/graph/editorApi.js +8 -0
- package/dist/graph/editorChrome.d.ts +27 -0
- package/dist/graph/editorChrome.js +75 -0
- package/dist/graph/editorFields.d.ts +180 -0
- package/dist/graph/editorFields.js +394 -0
- package/dist/graph/editorPrimitives.d.ts +60 -0
- package/dist/graph/editorPrimitives.js +150 -0
- package/dist/graph/editorStrings.d.ts +695 -0
- package/dist/graph/editorStrings.js +707 -0
- package/dist/graph/expressionRefs.d.ts +12 -0
- package/dist/graph/fieldProblems.d.ts +32 -0
- package/dist/graph/fieldProblems.js +77 -0
- package/dist/graph/index.d.ts +7 -0
- package/dist/graph/index.js +6 -1
- package/dist/graph/inputLayout.d.ts +25 -0
- package/dist/graph/inputLayout.js +337 -0
- package/dist/graph/inputPages.d.ts +33 -0
- package/dist/graph/inputPages.js +186 -0
- package/dist/graph/inputRefs.d.ts +103 -0
- package/dist/graph/inputRefs.js +196 -0
- package/dist/graph/inputRows.d.ts +43 -0
- package/dist/graph/inputRows.js +65 -0
- package/dist/graph/records.d.ts +3 -0
- package/dist/graph/records.js +7 -0
- package/dist/graph/refusalText.d.ts +6 -0
- package/dist/graph/settingsViews.d.ts +26 -0
- package/dist/graph/settingsViews.js +62 -0
- package/dist/graph/usesInputs.d.ts +17 -0
- package/dist/graph/usesInputs.js +40 -0
- package/dist/icons/bi/BiRedo.js +16 -0
- package/dist/icons/bi/BiUndo.js +16 -0
- package/dist/icons/lu/LuBraces.js +27 -0
- package/dist/icons/lu/LuCode.js +27 -0
- package/dist/icons/lu/LuKeyboard.js +71 -0
- package/dist/icons/lu/LuNetwork.js +63 -0
- package/dist/icons/lu/LuTextCursorInput.js +45 -0
- package/dist/icons.d.ts +2 -2
- package/dist/icons.js +8 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/list/ActionToolbar.d.ts +2 -0
- package/dist/list/ActionToolbar.js +18 -5
- package/dist/list/RowContextMenu.d.ts +10 -1
- package/dist/list/RowContextMenu.js +185 -30
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { stepText } from "./utils.js";
|
|
2
|
+
import { EditingScope, useFormEditing } from "../formEditing.js";
|
|
2
3
|
import { FieldsFromOptions } from "../Form.js";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
//#region src/form/Wizard/WizardStepContent.tsx
|
|
5
6
|
function WizardStepContent({ currentStep, stepConfig, flatten = true, values, setFormDirty, setFieldValue, setFieldTouched, fieldNamePrefix = "", copy, ...fieldsProps }) {
|
|
7
|
+
const editing = useFormEditing();
|
|
6
8
|
if (!stepConfig.options) return null;
|
|
9
|
+
const path = editing ? [...editing.parent, currentStep] : null;
|
|
7
10
|
const parentInfo = copy !== void 0 ? {
|
|
8
11
|
parentName: currentStep,
|
|
9
12
|
fieldNamePrefix: `${fieldNamePrefix}${currentStep}[${copy}].`,
|
|
@@ -15,7 +18,7 @@ function WizardStepContent({ currentStep, stepConfig, flatten = true, values, se
|
|
|
15
18
|
parentName: fieldNamePrefix.slice(0, -1),
|
|
16
19
|
fieldNamePrefix
|
|
17
20
|
} : void 0;
|
|
18
|
-
|
|
21
|
+
const content = /* @__PURE__ */ jsxs("div", {
|
|
19
22
|
className: "mb-4 w-full",
|
|
20
23
|
children: [
|
|
21
24
|
stepText(stepConfig.title) && /* @__PURE__ */ jsx("h2", {
|
|
@@ -28,17 +31,27 @@ function WizardStepContent({ currentStep, stepConfig, flatten = true, values, se
|
|
|
28
31
|
style: { color: "var(--theme-muted-text-color)" },
|
|
29
32
|
children: stepText(stepConfig.description)
|
|
30
33
|
}),
|
|
31
|
-
/* @__PURE__ */ jsx(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
/* @__PURE__ */ jsx(EditingScope, {
|
|
35
|
+
editing,
|
|
36
|
+
path,
|
|
37
|
+
children: /* @__PURE__ */ jsx(FieldsFromOptions, {
|
|
38
|
+
options: stepConfig.options,
|
|
39
|
+
values,
|
|
40
|
+
setFormDirty,
|
|
41
|
+
setFieldValue,
|
|
42
|
+
setFieldTouched,
|
|
43
|
+
...parentInfo ? { parentInfo } : {},
|
|
44
|
+
...fieldsProps
|
|
45
|
+
}, copy === void 0 ? currentStep : `${currentStep}[${copy}]`)
|
|
46
|
+
})
|
|
40
47
|
]
|
|
41
48
|
});
|
|
49
|
+
const instance = `${fieldNamePrefix}${currentStep}${copy === void 0 ? "" : `[${copy}]`}`;
|
|
50
|
+
return editing && path ? /* @__PURE__ */ jsx(editing.Row, {
|
|
51
|
+
path,
|
|
52
|
+
instance,
|
|
53
|
+
children: content
|
|
54
|
+
}) : content;
|
|
42
55
|
}
|
|
43
56
|
//#endregion
|
|
44
57
|
export { WizardStepContent };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page each wizard of a form being edited shows, keyed by its list's path as JSON (`[]` for the
|
|
3
|
+
* form's own), so the editor can turn its pages as well as the wizard's own controls.
|
|
4
|
+
*/
|
|
5
|
+
export interface WizardPages {
|
|
6
|
+
page: (wizard: string) => number;
|
|
7
|
+
setPage: (wizard: string, index: number) => void;
|
|
8
|
+
/** How many pages the wizard draws, a repeated page's copies included, once it has drawn. */
|
|
9
|
+
count: (wizard: string) => number | undefined;
|
|
10
|
+
setCount: (wizard: string, count: number) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const WizardPagesContext: import("react").Context<WizardPages | null>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useSlots } from "../components/Provider.js";
|
|
2
|
-
import NumberField from "./Fields/NumberField.js";
|
|
3
2
|
import BooleanField from "./Fields/BooleanField.js";
|
|
4
3
|
import CheckboxGroupField from "./Fields/CheckboxGroupField.js";
|
|
5
4
|
import ColorField from "./Fields/ColorField.js";
|
|
@@ -7,6 +6,7 @@ import DropdownField from "./Fields/DropdownField.js";
|
|
|
7
6
|
import DurationField_default from "./Fields/DurationField.js";
|
|
8
7
|
import LabelField from "./Fields/LabelField.js";
|
|
9
8
|
import MultiDropdownField from "./Fields/MultiDropdownField.js";
|
|
9
|
+
import NumberField from "./Fields/NumberField.js";
|
|
10
10
|
import ObjectField from "./Fields/ObjectField.js";
|
|
11
11
|
import RadioField from "./Fields/RadioField.js";
|
|
12
12
|
import RangeField from "./Fields/RangeField.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ComponentType, type ReactNode } from 'react';
|
|
2
|
+
/** Editing controls a form builder wraps around rendered fields. */
|
|
3
|
+
export interface FormEditing {
|
|
4
|
+
/** Input path of the fields being rendered; empty at the top level. */
|
|
5
|
+
parent: string[];
|
|
6
|
+
Row: ComponentType<{
|
|
7
|
+
path: string[];
|
|
8
|
+
/** The field isn't drawn, such as one marked hidden. */
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
/** The field's name in the form's values, which tells one input's copies in a list's rows apart. */
|
|
11
|
+
instance?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}>;
|
|
14
|
+
Add: ComponentType<{
|
|
15
|
+
parent: string[];
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export declare const FormEditingContext: import("react").Context<FormEditing | null>;
|
|
19
|
+
export declare function useFormEditing(): FormEditing | null;
|
|
20
|
+
/** Fields rendered inside `children` belong to the input at `path`. */
|
|
21
|
+
export declare function EditingScope({ editing, path, children, }: {
|
|
22
|
+
editing: FormEditing | null;
|
|
23
|
+
path: string[] | null;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/form/formEditing.tsx
|
|
4
|
+
var FormEditingContext = createContext(null);
|
|
5
|
+
function useFormEditing() {
|
|
6
|
+
return useContext(FormEditingContext);
|
|
7
|
+
}
|
|
8
|
+
/** Fields rendered inside `children` belong to the input at `path`. */
|
|
9
|
+
function EditingScope({ editing, path, children }) {
|
|
10
|
+
if (!editing) return children;
|
|
11
|
+
return /* @__PURE__ */ jsx(FormEditingContext.Provider, {
|
|
12
|
+
value: path ? {
|
|
13
|
+
...editing,
|
|
14
|
+
parent: path
|
|
15
|
+
} : null,
|
|
16
|
+
children
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { EditingScope, FormEditingContext, useFormEditing };
|
package/dist/form/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { applySecondaryField, findSecondaryOption } from "./utils/secondaryField.js";
|
|
2
2
|
import { enforceOneMustBeTrue, flattenGroups, impureSetValueFromPath, initializeValues, resolvedFlag } from "./lib.js";
|
|
3
|
+
import { resolveFormLayout } from "./layout.js";
|
|
4
|
+
import { resolveLayoutCSS } from "./layoutCSS.js";
|
|
3
5
|
import { FieldProvider, useFieldControlProps, useFieldLabelledByProps, useFieldRequired } from "./fieldContext.js";
|
|
4
6
|
import { FieldWrapper } from "./FieldWrapper.js";
|
|
5
|
-
import { getInvalidDurationPaths, setDurationValidity } from "./Fields/durationValidity.js";
|
|
6
7
|
import FormikCustomDropdown_default from "./SpecialTypes/FormikCustomDropdown.js";
|
|
7
8
|
import FormikCustomInput from "./SpecialTypes/FormikCustomInput.js";
|
|
8
9
|
import FormikNumericInput from "./SpecialTypes/FormikNumericInput.js";
|
|
9
10
|
import { getPlaceholder } from "./utils/getPlaceholder.js";
|
|
10
|
-
import NumberField from "./Fields/NumberField.js";
|
|
11
|
-
import { ResourceOptionIcon } from "./Fields/ResourceOptionIcon.js";
|
|
12
|
-
import { resolveFormLayout } from "./layout.js";
|
|
13
|
-
import { resolveLayoutCSS } from "./layoutCSS.js";
|
|
14
11
|
import { FLEX_MAX_DURATION_RANGE, FLEX_WAIT_TIME_RANGE, STANDARD_MAX_DURATION_RANGE, collectPartitionDurationIssues, formatDuration, parseDuration } from "./utils/duration.js";
|
|
12
|
+
import { getInvalidDurationPaths, setDurationValidity } from "./Fields/durationValidity.js";
|
|
13
|
+
import NumberField from "./Fields/NumberField.js";
|
|
15
14
|
import { FieldRegistryContext, Registry } from "./fieldRegistry.js";
|
|
16
15
|
import { useParsedOpts } from "./useParsedOpts.js";
|
|
17
16
|
import { DynamicDefaultsSync, DynamicForm, FieldsFromOptions, GroupHeader, MultiSelectionDropdown, collectFieldsWithDefaults, findSelfReferencingFieldNames, resolveMetaOverrides, useDynamicDefaultsSync } from "./Form.js";
|
|
17
|
+
import { ResourceOptionIcon } from "./Fields/ResourceOptionIcon.js";
|
|
18
18
|
import DropdownWrapper from "./SpecialTypes/DropdownWrapper.js";
|
|
19
19
|
import FormikMultiSelectDropdown from "./SpecialTypes/FormikMultiSelectDropdown.js";
|
|
20
20
|
export { DropdownWrapper, DynamicDefaultsSync, DynamicForm, FLEX_MAX_DURATION_RANGE, FLEX_WAIT_TIME_RANGE, FieldProvider, FieldRegistryContext, FieldWrapper, FieldsFromOptions, FormikCustomDropdown_default as FormikCustomDropdown, FormikCustomInput, FormikMultiSelectDropdown, FormikNumericInput, GroupHeader, MultiSelectionDropdown, NumberField, Registry, ResourceOptionIcon, STANDARD_MAX_DURATION_RANGE, applySecondaryField, collectFieldsWithDefaults, collectPartitionDurationIssues, enforceOneMustBeTrue, findSecondaryOption, findSelfReferencingFieldNames, flattenGroups, formatDuration, getInvalidDurationPaths, getPlaceholder, impureSetValueFromPath, initializeValues, parseDuration, resolveFormLayout, resolveLayoutCSS, resolveMetaOverrides, resolvedFlag, setDurationValidity, useDynamicDefaultsSync, useFieldControlProps, useFieldLabelledByProps, useFieldRequired, useParsedOpts };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { FieldPatch, GraphEdit, InputPath, WorkflowEditing } from '../editing.js';
|
|
3
|
+
import { type Json, type OpenOnAdd } from './editorFields.js';
|
|
4
|
+
import { type InputsEditorStrings } from './editorStrings.js';
|
|
5
|
+
import { type InputSource } from './inputRefs.js';
|
|
6
|
+
import type { SettingsView } from './settingsViews.js';
|
|
7
|
+
/** Input types by menu group, in the order the add menu lists them. */
|
|
8
|
+
export declare const INPUT_TYPE_GROUPS: [keyof InputsEditorStrings['typeGroups'], string[]][];
|
|
9
|
+
declare const TEXT_FIELDS: readonly ['label', 'description', 'tooltip'];
|
|
10
|
+
declare const FLAG_FIELDS: readonly ['optional', 'hidden', 'disabled', 'ignore'];
|
|
11
|
+
type CommonKey = (typeof TEXT_FIELDS)[number] | (typeof FLAG_FIELDS)[number];
|
|
12
|
+
export declare function inputTypes(): string[];
|
|
13
|
+
export declare function commonKeys(type: string): CommonKey[];
|
|
14
|
+
/** Every key the dialog can write for an input of `type`. */
|
|
15
|
+
export declare function offeredInputKeys(editing: WorkflowEditing, type: string): string[];
|
|
16
|
+
/** The starting definition of a new input of `type`, with what the schema requires. */
|
|
17
|
+
export declare function newInputDefinition(type: string): Json;
|
|
18
|
+
/** An input a dialog creates when it saves, for a field that reads it. */
|
|
19
|
+
export interface PendingInput {
|
|
20
|
+
name: string;
|
|
21
|
+
definition: Json;
|
|
22
|
+
}
|
|
23
|
+
export declare function allNames(editing: WorkflowEditing, map: Json, out: Set<string>): Set<string>;
|
|
24
|
+
/** Where a dialog puts the inputs it creates: the top level, or one wizard step. */
|
|
25
|
+
export interface InputHome {
|
|
26
|
+
parent: string[];
|
|
27
|
+
index?: number;
|
|
28
|
+
}
|
|
29
|
+
/** `edit` after the edits that add `created` at `home`, as one undo step. */
|
|
30
|
+
export declare function withCreatedInputs(editing: WorkflowEditing, created: PendingInput[], home: InputHome, edit: GraphEdit | null): GraphEdit | null;
|
|
31
|
+
export interface NewInputs {
|
|
32
|
+
source: InputSource;
|
|
33
|
+
all: Json;
|
|
34
|
+
home: InputHome;
|
|
35
|
+
pending: PendingInput[];
|
|
36
|
+
adopt: (created: PendingInput[]) => void;
|
|
37
|
+
dialog: ReactNode;
|
|
38
|
+
/** The form's edit with the inputs it made, or null when there's nothing to save. */
|
|
39
|
+
save: (edit: GraphEdit | null) => GraphEdit | null;
|
|
40
|
+
}
|
|
41
|
+
/** Inputs a dialog's fields can read, plus the ones it creates on save. */
|
|
42
|
+
export declare function useNewInputs(inputs: Json | undefined, home?: InputHome): NewInputs;
|
|
43
|
+
/** Every setting of one input; `onSave` gets the whole definition and the change to it. */
|
|
44
|
+
interface InputDialogProps {
|
|
45
|
+
name: string;
|
|
46
|
+
definition: Json;
|
|
47
|
+
isNew: boolean;
|
|
48
|
+
/** Names already taken in the same container. */
|
|
49
|
+
siblings: string[];
|
|
50
|
+
allowStep: boolean;
|
|
51
|
+
/** The workflow's inputs, for settings that read another input. */
|
|
52
|
+
inputs?: Json | undefined;
|
|
53
|
+
/** Where inputs made for this dialog's settings will go. */
|
|
54
|
+
home?: InputHome | undefined;
|
|
55
|
+
/** A new input made for one field keeps the type that field needs. */
|
|
56
|
+
lockedType?: boolean;
|
|
57
|
+
/** `created` are inputs this dialog made for its own settings. */
|
|
58
|
+
onSave: (name: string, definition: Json, patch: Required<FieldPatch>, created: PendingInput[]) => void;
|
|
59
|
+
onDelete?: () => void;
|
|
60
|
+
onClose: () => void;
|
|
61
|
+
openOnAdd?: OpenOnAdd | undefined;
|
|
62
|
+
}
|
|
63
|
+
/** Saving an input as YAML text; `path` and `source` give an existing input's text with its comments. */
|
|
64
|
+
export interface InputYaml {
|
|
65
|
+
source?: string | undefined;
|
|
66
|
+
path?: InputPath | undefined;
|
|
67
|
+
/** `created` are the inputs the form made for its settings before switching to the YAML. */
|
|
68
|
+
onSave: (name: string, yaml: string, created: PendingInput[]) => void;
|
|
69
|
+
}
|
|
70
|
+
/** An input's settings in a form, or as YAML when `yaml` says how to save it; switching carries the edits across. */
|
|
71
|
+
export declare function InputDialog({ yaml, view, onViewChange, ...props }: InputDialogProps & {
|
|
72
|
+
yaml?: InputYaml | undefined;
|
|
73
|
+
view?: SettingsView | undefined;
|
|
74
|
+
onViewChange?: ((view: SettingsView) => void) | undefined;
|
|
75
|
+
}): import("react").JSX.Element;
|
|
76
|
+
/** A compact type chip for rows that list inputs. */
|
|
77
|
+
export declare function TypeBadge({ type }: {
|
|
78
|
+
type: string;
|
|
79
|
+
}): import("react").JSX.Element;
|
|
80
|
+
export {};
|