@parallelworks/ui 0.37.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 (64) hide show
  1. package/README.md +1 -1
  2. package/dist/ai/components/ChatInput.js +8 -23
  3. package/dist/ai/components/ChatSidebar.js +7 -4
  4. package/dist/ai/components/chatDraft.d.ts +7 -0
  5. package/dist/ai/components/chatDraft.js +66 -0
  6. package/dist/ai/index.d.ts +1 -1
  7. package/dist/ai/index.js +2 -2
  8. package/dist/ai/ui/sidebar.d.ts +6 -0
  9. package/dist/ai/ui/sidebar.js +15 -1
  10. package/dist/editing.d.ts +2 -0
  11. package/dist/editor/Monaco.js +1 -1
  12. package/dist/editor/index.js +1 -1
  13. package/dist/editor/lintContext.js +15 -3
  14. package/dist/form/FieldWrapper.js +1 -0
  15. package/dist/form/Form.js +64 -23
  16. package/dist/form/Wizard/WizardContainer.js +66 -6
  17. package/dist/form/Wizard/WizardStepContent.js +23 -10
  18. package/dist/form/Wizard/wizardPages.d.ts +12 -0
  19. package/dist/form/Wizard/wizardPages.js +5 -0
  20. package/dist/form/formEditing.d.ts +25 -0
  21. package/dist/form/formEditing.js +20 -0
  22. package/dist/graph/DependencyGraph.d.ts +8 -1
  23. package/dist/graph/DependencyGraph.js +433 -204
  24. package/dist/graph/GraphEditor.d.ts +27 -0
  25. package/dist/graph/GraphEditor.js +1543 -0
  26. package/dist/graph/GraphEditorDialogs.d.ts +87 -0
  27. package/dist/graph/GraphEditorDialogs.js +1808 -0
  28. package/dist/graph/InputDialog.js +1568 -54
  29. package/dist/graph/InputsEditor.d.ts +12 -0
  30. package/dist/graph/InputsEditor.js +1594 -0
  31. package/dist/graph/JobSummary.d.ts +3 -0
  32. package/dist/graph/JobSummary.js +34 -21
  33. package/dist/graph/MatrixGroup.d.ts +2 -1
  34. package/dist/graph/MatrixGroup.js +10 -3
  35. package/dist/graph/ShortcutsButton.js +56 -0
  36. package/dist/graph/SuggestionInput.js +29 -0
  37. package/dist/graph/WorkflowSettingsDialog.d.ts +21 -0
  38. package/dist/graph/WorkflowSettingsDialog.js +670 -0
  39. package/dist/graph/editorApi.js +8 -0
  40. package/dist/graph/editorChrome.js +75 -0
  41. package/dist/graph/editorFields.js +535 -0
  42. package/dist/graph/editorPrimitives.js +95 -4
  43. package/dist/graph/editorRows.d.ts +58 -0
  44. package/dist/graph/editorRows.js +460 -0
  45. package/dist/graph/editorStrings.d.ts +1 -0
  46. package/dist/graph/editorStrings.js +10 -1
  47. package/dist/graph/expressionRefs.js +39 -0
  48. package/dist/graph/fieldProblems.js +111 -0
  49. package/dist/graph/graphEditorState.d.ts +191 -0
  50. package/dist/graph/graphEditorState.js +74 -0
  51. package/dist/graph/index.d.ts +4 -0
  52. package/dist/graph/index.js +6 -2
  53. package/dist/graph/inputLayout.js +337 -0
  54. package/dist/graph/inputPages.d.ts +33 -0
  55. package/dist/graph/inputPages.js +186 -0
  56. package/dist/graph/inputRefs.js +388 -0
  57. package/dist/graph/inputRows.d.ts +43 -0
  58. package/dist/graph/inputRows.js +65 -0
  59. package/dist/graph/refusalText.js +13 -0
  60. package/dist/graph/settingsViews.js +62 -0
  61. package/dist/graph/stepWith.d.ts +38 -0
  62. package/dist/graph/stepWith.js +536 -0
  63. package/dist/styles.css +1 -1
  64. package/package.json +1 -1
@@ -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,56 @@
1
+ import { LuKeyboard } from "../icons/lu/LuKeyboard.js";
2
+ import { IconButton } from "../components/IconButton.js";
3
+ import { useGraphEditorStrings } from "./editorStrings.js";
4
+ import { ToolbarPopover } from "./ToolbarPopover.js";
5
+ import { Fragment, useRef, useState } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/graph/ShortcutsButton.tsx
8
+ var MOD_KEY = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform) ? "⌘" : "Ctrl";
9
+ var ALT_KEY = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform) ? "⌥" : "Alt";
10
+ /** A toolbar button that opens the list of gestures and keys a pane takes. */
11
+ function ShortcutsButton({ groups }) {
12
+ const t = useGraphEditorStrings();
13
+ const [open, setOpen] = useState(false);
14
+ const button = useRef(null);
15
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(IconButton, {
16
+ ref: button,
17
+ icon: /* @__PURE__ */ jsx(LuKeyboard, { className: "h-4 w-4" }),
18
+ label: t.shortcuts,
19
+ size: "sm",
20
+ variant: "ghost",
21
+ "aria-expanded": open,
22
+ showTooltip: !open,
23
+ onClick: () => setOpen((current) => !current)
24
+ }), open && /* @__PURE__ */ jsxs(ToolbarPopover, {
25
+ anchor: button,
26
+ label: t.shortcuts,
27
+ onClose: () => setOpen(false),
28
+ children: [/* @__PURE__ */ jsx("div", {
29
+ className: "text-[0.8125rem] font-semibold",
30
+ children: t.shortcuts
31
+ }), groups.map((group) => /* @__PURE__ */ jsxs("section", {
32
+ className: "mt-3",
33
+ children: [/* @__PURE__ */ jsx("h3", {
34
+ className: "mb-1.5 text-xs font-semibold theme-muted-text",
35
+ children: group.title
36
+ }), /* @__PURE__ */ jsx("dl", {
37
+ className: "grid grid-cols-[8.5rem_1fr] items-baseline gap-x-3 gap-y-1.5",
38
+ children: group.shortcuts.map((shortcut) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", {
39
+ className: "flex flex-wrap items-center gap-1",
40
+ children: shortcut.combos.map((keys, i) => /* @__PURE__ */ jsxs(Fragment, { children: [i > 0 && /* @__PURE__ */ jsx("span", {
41
+ className: "theme-muted-text",
42
+ children: "/"
43
+ }), keys.map((key) => /* @__PURE__ */ jsx("kbd", {
44
+ className: "rounded border theme-border px-1 py-px text-[11px]",
45
+ children: key
46
+ }, key))] }, keys.join("+")))
47
+ }), /* @__PURE__ */ jsx("dd", {
48
+ className: "theme-muted-text",
49
+ children: shortcut.does
50
+ })] }, shortcut.does))
51
+ })]
52
+ }, group.title))]
53
+ })] });
54
+ }
55
+ //#endregion
56
+ export { ALT_KEY, MOD_KEY, ShortcutsButton };
@@ -0,0 +1,29 @@
1
+ import Dropdown from "../components/Dropdown.js";
2
+ import cx from "classnames";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/graph/SuggestionInput.tsx
5
+ function suggestionOptions(suggestions) {
6
+ return suggestions.map(({ value, label }) => label ? {
7
+ label,
8
+ value,
9
+ description: value
10
+ } : value);
11
+ }
12
+ var FIELD_TEXT_BOX = "py-3 pl-4 rounded-lg text-sm !bg-[var(--theme-muted-panel-bg)]";
13
+ /**
14
+ * The dropdown for a field that takes any typed value as well as the ones it offers. Any of
15
+ * the dropdown's own props can still be passed, such as `allowCustomValue={false}`.
16
+ */
17
+ function SuggestionInput({ value, onChange, suggestions, allowCustomValue = true, ...props }) {
18
+ return /* @__PURE__ */ jsx(Dropdown, {
19
+ showCaret: suggestions.length > 0,
20
+ ...props,
21
+ textBoxClassName: cx(FIELD_TEXT_BOX, props.textBoxClassName),
22
+ allowCustomValue,
23
+ value,
24
+ options: suggestionOptions(suggestions),
25
+ onChange: (next) => onChange(next === void 0 ? "" : String(next))
26
+ });
27
+ }
28
+ //#endregion
29
+ export { FIELD_TEXT_BOX, SuggestionInput, suggestionOptions };
@@ -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 {};