@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
@@ -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
- return /* @__PURE__ */ jsxs("div", {
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(FieldsFromOptions, {
32
- options: stepConfig.options,
33
- values,
34
- setFormDirty,
35
- setFieldValue,
36
- setFieldTouched,
37
- ...parentInfo ? { parentInfo } : {},
38
- ...fieldsProps
39
- }, copy === void 0 ? currentStep : `${currentStep}[${copy}]`)
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>;
@@ -0,0 +1,5 @@
1
+ import { createContext } from "react";
2
+ //#region src/form/Wizard/wizardPages.ts
3
+ var WizardPagesContext = createContext(null);
4
+ //#endregion
5
+ export { WizardPagesContext };
@@ -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 };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { GraphLayout } from '../editing.js';
3
3
  import type { MatrixGroup, WorkflowEngine } from '../engine.js';
4
+ import type { DependencyGraphEditor } from './editorApi.js';
4
5
  import { type RunLink, type WorkflowJob } from './types.js';
5
6
  export type ViewMode = 'dag' | 'tree';
6
7
  export declare const addCleanupSteps: ({ jobs }: {
@@ -17,6 +18,7 @@ export declare function computeGraphLayout(engine: WorkflowEngine, jobs: Record<
17
18
  ancestorDists: Record<string, Map<string, number>>;
18
19
  descendantDists: Record<string, Map<string, number>>;
19
20
  };
21
+ export declare function intoView(start: number, end: number, low: number, high: number): number;
20
22
  interface GraphRun {
21
23
  id?: string | undefined;
22
24
  number?: number | undefined;
@@ -29,20 +31,25 @@ interface GraphRun {
29
31
  executedJobs?: Record<string, unknown> | undefined;
30
32
  links?: Record<string, RunLink> | undefined;
31
33
  }
32
- export default function DependencyGraph({ run, preview, removeBorder, viewMode, setViewMode, layout, yamlJobs, fixedHeight, }: {
34
+ export default function DependencyGraph({ run, preview, removeBorder, viewMode, setViewMode, layout, editor, yamlJobs, inputs, workflow, fixedHeight, }: {
33
35
  run: GraphRun;
34
36
  preview?: boolean;
35
37
  removeBorder?: boolean | undefined;
36
38
  viewMode?: ViewMode;
37
39
  setViewMode?: (mode: ViewMode) => void;
38
40
  layout?: GraphLayout | undefined;
41
+ editor?: DependencyGraphEditor | undefined;
39
42
  yamlJobs?: Record<string, unknown> | undefined;
43
+ inputs?: Record<string, unknown> | undefined;
44
+ /** The workflow as written, for what the editor's expressions can read. */
45
+ workflow?: Record<string, unknown> | undefined;
40
46
  fixedHeight?: string | undefined;
41
47
  }): React.JSX.Element | undefined;
42
48
  export declare function DependencyGraphPreview(inputs: {
43
49
  yml?: Record<string, unknown>;
44
50
  removeBorder?: boolean;
45
51
  layout?: GraphLayout | undefined;
52
+ editor?: DependencyGraphEditor | undefined;
46
53
  /** A fixed panel height; without one the panel is only as tall as the graph. */
47
54
  height?: string | undefined;
48
55
  }): React.JSX.Element;