@parallelworks/ui 0.38.0 → 0.39.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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/ai/components/ChatInput.js +8 -23
  3. package/dist/ai/components/chatDraft.d.ts +7 -0
  4. package/dist/ai/components/chatDraft.js +66 -0
  5. package/dist/editing.d.ts +2 -0
  6. package/dist/editor/Monaco.js +1 -1
  7. package/dist/editor/index.js +1 -1
  8. package/dist/editor/lintContext.js +15 -3
  9. package/dist/graph/DependencyGraph.d.ts +8 -1
  10. package/dist/graph/DependencyGraph.js +433 -204
  11. package/dist/graph/GraphEditor.d.ts +27 -0
  12. package/dist/graph/GraphEditor.js +1543 -0
  13. package/dist/graph/GraphEditorDialogs.d.ts +87 -0
  14. package/dist/graph/GraphEditorDialogs.js +1808 -0
  15. package/dist/graph/InputDialog.js +4 -4
  16. package/dist/graph/InputsEditor.js +2 -2
  17. package/dist/graph/JobSummary.d.ts +3 -0
  18. package/dist/graph/JobSummary.js +34 -21
  19. package/dist/graph/MatrixGroup.d.ts +2 -1
  20. package/dist/graph/MatrixGroup.js +10 -3
  21. package/dist/graph/WorkflowSettingsDialog.d.ts +21 -0
  22. package/dist/graph/WorkflowSettingsDialog.js +670 -0
  23. package/dist/graph/editorFields.js +144 -3
  24. package/dist/graph/editorRows.d.ts +58 -0
  25. package/dist/graph/editorRows.js +460 -0
  26. package/dist/graph/editorStrings.d.ts +1 -0
  27. package/dist/graph/editorStrings.js +1 -0
  28. package/dist/graph/expressionRefs.js +39 -0
  29. package/dist/graph/fieldProblems.js +36 -2
  30. package/dist/graph/graphEditorState.d.ts +191 -0
  31. package/dist/graph/graphEditorState.js +74 -0
  32. package/dist/graph/index.d.ts +3 -0
  33. package/dist/graph/index.js +5 -2
  34. package/dist/graph/inputLayout.js +1 -1
  35. package/dist/graph/inputRefs.js +196 -4
  36. package/dist/graph/refusalText.js +13 -0
  37. package/dist/graph/stepWith.d.ts +38 -0
  38. package/dist/graph/stepWith.js +536 -0
  39. package/dist/styles.css +1 -1
  40. package/package.json +1 -1
@@ -10,15 +10,15 @@ import { FilterPill } from "../components/FilterPill.js";
10
10
  import { IconButton } from "../components/IconButton.js";
11
11
  import { Input, Textarea } from "../components/Input.js";
12
12
  import { useGraphEditorStrings, useInputsEditorStrings } from "./editorStrings.js";
13
+ import { asRecord } from "./records.js";
13
14
  import { INPUT_YAML_PATH } from "../editor/settingsYaml.js";
15
+ import { FIELD_TEXT_BOX, SuggestionInput } from "./SuggestionInput.js";
16
+ import { AddRowButton, ChoiceButtons, DialogShell, EXPRESSION, ExpressionToggle, FieldError, GrowingTextarea, KeyHint, LabelledField, Section, SectionMemory, StringListEditor, SuggestedInput, ToggleField, diffPatch, expressionError, flagError, isEmptyPatch, isScalar, labelled, parseJson, parseScalar, sameValue, text, unchangedValue, useSectionMemory, withoutUndefined } from "./editorFields.js";
17
+ import { FlagField, ValueOrInputField, inputRefs } from "./inputRefs.js";
14
18
  import { formatDuration, parseDuration } from "../form/utils/duration.js";
15
19
  import { FormEditingContext } from "../form/formEditing.js";
16
20
  import { DynamicForm } from "../form/Form.js";
17
- import { asRecord } from "./records.js";
18
- import { FIELD_TEXT_BOX, SuggestionInput } from "./SuggestionInput.js";
19
- import { AddRowButton, ChoiceButtons, DialogShell, EXPRESSION, ExpressionToggle, FieldError, GrowingTextarea, KeyHint, LabelledField, Section, SectionMemory, StringListEditor, SuggestedInput, ToggleField, diffPatch, expressionError, flagError, isEmptyPatch, isScalar, labelled, parseJson, parseScalar, sameValue, text, unchangedValue, useSectionMemory, withoutUndefined } from "./editorFields.js";
20
21
  import { withInputLayouts } from "./inputLayout.js";
21
- import { FlagField, ValueOrInputField, inputRefs } from "./inputRefs.js";
22
22
  import { NO_SCOPED, ViewSwitch, YamlPane, yamlProblem } from "./settingsViews.js";
23
23
  import cx from "classnames";
24
24
  import { useEffect, useId, useMemo, useRef, useState } from "react";
@@ -17,10 +17,10 @@ import { IconButton } from "../components/IconButton.js";
17
17
  import { useRowMenu } from "../list/RowContextMenu.js";
18
18
  import { MarqueeBox, createStore, reclaimFocus, returningFocus, trackDrag, useFocusAfterDialog, usePressOutside, useStore } from "./editorPrimitives.js";
19
19
  import { useGraphEditorStrings, useInputsEditorStrings } from "./editorStrings.js";
20
- import { FormEditingContext } from "../form/formEditing.js";
21
- import { WizardPagesContext } from "../form/Wizard/wizardPages.js";
22
20
  import { asRecord } from "./records.js";
23
21
  import { openOnAddOf, text } from "./editorFields.js";
22
+ import { FormEditingContext } from "../form/formEditing.js";
23
+ import { WizardPagesContext } from "../form/Wizard/wizardPages.js";
24
24
  import { dropLayoutEdits, isWizard, resizeLayout, withInputLayouts } from "./inputLayout.js";
25
25
  import { INPUT_TYPE_GROUPS, InputDialog, TypeBadge, allNames, newInputDefinition, withCreatedInputs } from "./InputDialog.js";
26
26
  import { overlaps, typing } from "./editorApi.js";
@@ -14,4 +14,7 @@ export declare function Joblist(inputs: JobHandlers & {
14
14
  jobNames: string[];
15
15
  growWidth?: boolean;
16
16
  preview?: boolean;
17
+ editable?: boolean;
18
+ /** Steps take edits where their jobs don't, as a matrix's runs show its one job's steps. */
19
+ editableSteps?: boolean;
17
20
  }): (import("react").JSX.Element | null)[];
@@ -3,8 +3,9 @@ import { IoDocumentTextOutline } from "../icons/io5/IoDocumentTextOutline.js";
3
3
  import { PiArrowBendUpRightBold } from "../icons/pi/PiArrowBendUpRightBold.js";
4
4
  import { TOOLTIP_ID } from "../components/Tooltip.js";
5
5
  import { Indicator } from "../components/Indicator.js";
6
- import { Reveal } from "./Reveal.js";
7
6
  import { jobLabel } from "./util.js";
7
+ import { AddStepButton, EditableJobRow, EditableStepRow } from "./editorRows.js";
8
+ import { Reveal } from "./Reveal.js";
8
9
  import cx from "classnames";
9
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
11
  //#region src/graph/JobSummary.tsx
@@ -35,36 +36,48 @@ function Joblist(inputs) {
35
36
  if (inputs.jobs[jobName]?._matrixGroup) return null;
36
37
  const job = inputs.jobs[jobName];
37
38
  const jobStatus = job?.status;
39
+ const label = jobLabel(jobName, job);
40
+ const toggle = /* @__PURE__ */ jsxs("button", {
41
+ type: "button",
42
+ "aria-expanded": inputs.isStepsOpen(jobName),
43
+ onClick: () => inputs.onJobClick(jobName),
44
+ className: cx("flex items-center gap-x-1.5 w-full text-left", jobStatus === "skipped" || jobStatus === "skipped-failed" ? "cursor-default" : "cursor-pointer"),
45
+ children: [!inputs.preview && /* @__PURE__ */ jsx(Indicator, { status: jobStatus }), /* @__PURE__ */ jsx("div", {
46
+ className: "font-medium",
47
+ children: label
48
+ })]
49
+ });
38
50
  return /* @__PURE__ */ jsxs("div", {
39
51
  className: "py-1 select-none",
40
- children: [/* @__PURE__ */ jsxs("button", {
41
- type: "button",
42
- "aria-expanded": inputs.isStepsOpen(jobName),
43
- onClick: () => inputs.onJobClick(jobName),
44
- className: cx("flex items-center gap-x-1.5 w-full text-left", jobStatus === "skipped" || jobStatus === "skipped-failed" ? "cursor-default" : "cursor-pointer"),
45
- children: [!inputs.preview && /* @__PURE__ */ jsx(Indicator, { status: jobStatus }), /* @__PURE__ */ jsx("div", {
46
- className: "font-medium",
47
- children: jobLabel(jobName, job)
48
- })]
49
- }), /* @__PURE__ */ jsx(Reveal, {
52
+ children: [inputs.editable ? /* @__PURE__ */ jsx(EditableJobRow, {
53
+ job: jobName,
54
+ label,
55
+ children: toggle
56
+ }) : toggle, /* @__PURE__ */ jsx(Reveal, {
50
57
  open: inputs.isStepsOpen(jobName),
51
58
  growWidth: inputs.growWidth ?? false,
52
- children: /* @__PURE__ */ jsx("div", {
59
+ children: /* @__PURE__ */ jsxs("div", {
53
60
  className: "flex flex-col gap-y-0.5 mt-0.5",
54
- children: (job?.steps || []).map((step, i) => {
61
+ children: [(job?.steps || []).map((step, i) => {
55
62
  const stepLabel = engine.stepLabel(step, i);
56
63
  const stepKey = `${jobName}:${i}`;
57
64
  const subJobs = step.subworkflow?.jobs;
58
65
  const canExpand = !!subJobs && Object.keys(subJobs).length > 0;
66
+ const stepButton = /* @__PURE__ */ jsxs("button", {
67
+ type: "button",
68
+ onClick: () => inputs.onStepClick(jobName, i),
69
+ className: cx(inputs.preview ? "ml-1.5" : "ml-4", "gap-x-1.5 flex items-center text-left"),
70
+ "data-testid": stepLabel,
71
+ children: [inputs.preview ? "↳" : /* @__PURE__ */ jsx(Indicator, { status: step.status }), /* @__PURE__ */ jsx("div", { children: stepLabel })]
72
+ });
59
73
  return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
60
74
  className: cx("flex items-center", step.status === "skipped" || step.status === "skipped-failed" ? "cursor-default" : "cursor-pointer"),
61
- children: [/* @__PURE__ */ jsxs("button", {
62
- type: "button",
63
- onClick: () => inputs.onStepClick(jobName, i),
64
- className: cx(inputs.preview ? "ml-1.5" : "ml-4", "gap-x-1.5 flex items-center text-left"),
65
- "data-testid": stepLabel,
66
- children: [inputs.preview ? "↳" : /* @__PURE__ */ jsx(Indicator, { status: step.status }), /* @__PURE__ */ jsx("div", { children: stepLabel })]
67
- }), step.subworkflow && /* @__PURE__ */ jsxs(Fragment, { children: [
75
+ children: [(inputs.editable || inputs.editableSteps) && !step.linkedStep ? /* @__PURE__ */ jsx(EditableStepRow, {
76
+ job: job?._matrix?.originaljob ?? jobName,
77
+ index: i,
78
+ label: stepLabel,
79
+ children: stepButton
80
+ }) : stepButton, step.subworkflow && /* @__PURE__ */ jsxs(Fragment, { children: [
68
81
  /* @__PURE__ */ jsx("button", {
69
82
  type: "button",
70
83
  "aria-label": jobActions.openSubworkflowLogs,
@@ -95,7 +108,7 @@ function Joblist(inputs) {
95
108
  })
96
109
  ] })]
97
110
  }), canExpand && inputs.renderSubworkflow(jobName, i)] }, stepKey);
98
- })
111
+ }), inputs.editable && /* @__PURE__ */ jsx(AddStepButton, { job: jobName })]
99
112
  })
100
113
  })]
101
114
  }, `job-${jobName}`);
@@ -12,7 +12,7 @@ export declare function MatrixGroupSummaryItem({ matrixGroup, status, isExpanded
12
12
  preview: boolean;
13
13
  }): import("react").JSX.Element;
14
14
  /** Matrix group node in the DAG visualization. */
15
- export declare function MatrixGroupNode({ matrixGroup, jobNames, idPrefix, isExpanded, onToggle, jobs, activeDists, onMouseEnter, onMouseLeave, hoveredRelated, animT, zBase, handlers, preview, rowsAbove, }: {
15
+ export declare function MatrixGroupNode({ matrixGroup, jobNames, idPrefix, isExpanded, onToggle, jobs, activeDists, onMouseEnter, onMouseLeave, hoveredRelated, animT, zBase, handlers, preview, editable, rowsAbove, }: {
16
16
  matrixGroup: MatrixGroup;
17
17
  jobNames: string[];
18
18
  idPrefix: string;
@@ -27,6 +27,7 @@ export declare function MatrixGroupNode({ matrixGroup, jobNames, idPrefix, isExp
27
27
  zBase: number;
28
28
  handlers: JobHandlers;
29
29
  preview: boolean;
30
+ editable?: boolean;
30
31
  /** Empty rows of its column above this node. */
31
32
  rowsAbove?: number;
32
33
  }): import("react").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { useStrings, useWorkflowEngine } from "../components/Provider.js";
2
2
  import { Indicator } from "../components/Indicator.js";
3
+ import { EditableJobRow } from "./editorRows.js";
3
4
  import { emptyRowsStyle } from "./gridSpacing.js";
4
5
  import { Reveal } from "./Reveal.js";
5
6
  import { Joblist } from "./JobSummary.js";
@@ -41,7 +42,7 @@ function MatrixGroupSummaryItem({ matrixGroup, status, isExpanded, onToggle, job
41
42
  });
42
43
  }
43
44
  /** Matrix group node in the DAG visualization. */
44
- function MatrixGroupNode({ matrixGroup, jobNames, idPrefix, isExpanded, onToggle, jobs, activeDists, onMouseEnter, onMouseLeave, hoveredRelated, animT, zBase, handlers, preview, rowsAbove = 0 }) {
45
+ function MatrixGroupNode({ matrixGroup, jobNames, idPrefix, isExpanded, onToggle, jobs, activeDists, onMouseEnter, onMouseLeave, hoveredRelated, animT, zBase, handlers, preview, editable = false, rowsAbove = 0 }) {
45
46
  const { dag: t } = useStrings();
46
47
  const matrixName = matrixGroup.originaljob;
47
48
  const first = jobNames[0] ?? "";
@@ -78,7 +79,12 @@ function MatrixGroupNode({ matrixGroup, jobNames, idPrefix, isExpanded, onToggle
78
79
  opacity: hoveredRelated && !hoveredRelated.has(first) ? .5 : 1,
79
80
  transition: `opacity ${animT}s`
80
81
  },
81
- children: [header, /* @__PURE__ */ jsx(Reveal, {
82
+ children: [editable ? /* @__PURE__ */ jsx(EditableJobRow, {
83
+ job: matrixName,
84
+ label: t.matrixOf(matrixName),
85
+ badge: false,
86
+ children: header
87
+ }) : header, /* @__PURE__ */ jsx(Reveal, {
82
88
  open: isExpanded,
83
89
  growWidth: true,
84
90
  children: /* @__PURE__ */ jsx("div", {
@@ -88,7 +94,8 @@ function MatrixGroupNode({ matrixGroup, jobNames, idPrefix, isExpanded, onToggle
88
94
  jobNames: matrixMembers,
89
95
  ...handlers,
90
96
  growWidth: true,
91
- preview
97
+ preview,
98
+ editableSteps: editable
92
99
  })
93
100
  })
94
101
  })]
@@ -0,0 +1,21 @@
1
+ import type { GraphEdit } from '../editing.js';
2
+ import { type Json } from './editorFields.js';
3
+ import type { SettingsView } from './settingsViews.js';
4
+ /** What this dialog writes; the schema coverage test holds these to the workflow schema. */
5
+ export declare const WORKFLOW_FIELDS: readonly ['env', 'timeout', 'permissions', 'sessions', 'links', 'needs'];
6
+ export declare const SESSION_FIELDS: string[];
7
+ export declare const LINK_FIELDS: string[];
8
+ export declare const NEEDS_FIELDS: string[];
9
+ export declare const INPUT_FORM_FIELDS: string[];
10
+ interface SettingsDialogProps {
11
+ workflow: Json;
12
+ onEdit: (edit: GraphEdit) => void;
13
+ onClose: () => void;
14
+ }
15
+ /** The workflow's own settings in a form, or as YAML; switching carries the edits across. */
16
+ export declare function WorkflowSettingsDialog(props: SettingsDialogProps & {
17
+ source?: string | undefined;
18
+ view?: SettingsView | undefined;
19
+ onViewChange?: ((view: SettingsView) => void) | undefined;
20
+ }): import("react").JSX.Element;
21
+ export {};