@parallelworks/ui 0.36.0 → 0.37.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/agent/PermissionPicker.js +1 -0
- package/dist/ai/strings.d.ts +2 -0
- package/dist/ai/strings.js +2 -0
- 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/Fields/DropdownField.js +1 -1
- package/dist/form/Fields/DurationField.js +1 -1
- package/dist/form/Form.js +1 -1
- package/dist/form/fieldRegistry.js +1 -1
- package/dist/form/index.js +5 -5
- package/dist/graph/InputDialog.d.ts +80 -0
- package/dist/graph/InputDialog.js +596 -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/SuggestionInput.d.ts +18 -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/editorChrome.d.ts +27 -0
- package/dist/graph/editorFields.d.ts +180 -0
- package/dist/graph/editorPrimitives.d.ts +60 -0
- package/dist/graph/editorPrimitives.js +59 -0
- package/dist/graph/editorStrings.d.ts +695 -0
- package/dist/graph/editorStrings.js +699 -0
- package/dist/graph/expressionRefs.d.ts +12 -0
- package/dist/graph/fieldProblems.d.ts +32 -0
- package/dist/graph/index.d.ts +6 -0
- package/dist/graph/index.js +5 -1
- package/dist/graph/inputLayout.d.ts +25 -0
- package/dist/graph/inputRefs.d.ts +103 -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/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
package/dist/editor/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { INPUT_YAML_PATH, JOB_YAML_PATH, SETTINGS_YAML_PATH, STEP_YAML_PATH, settingsSchemas } from "./settingsYaml.js";
|
|
1
2
|
import Editor from "./Editor.js";
|
|
2
3
|
import EditorField from "./EditorField.js";
|
|
3
4
|
import FormCodePanel from "./FormCodePanel.js";
|
|
5
|
+
import { HOST_MARKER_OWNER, LINT_OWNER } from "./lintOwner.js";
|
|
6
|
+
import { nestedWorkflowText } from "./nestedText.js";
|
|
7
|
+
import { revealLines } from "./reveal.js";
|
|
4
8
|
import { defineEditorThemes, getThemeName } from "./themes.js";
|
|
5
9
|
import { setupMonacoWorkers } from "./workers.js";
|
|
6
10
|
import { configureEditorYaml } from "./yaml.js";
|
|
7
|
-
export { Editor, EditorField, FormCodePanel, configureEditorYaml, defineEditorThemes, getThemeName, setupMonacoWorkers };
|
|
11
|
+
export { Editor, EditorField, FormCodePanel, HOST_MARKER_OWNER, INPUT_YAML_PATH, JOB_YAML_PATH, LINT_OWNER, SETTINGS_YAML_PATH, STEP_YAML_PATH, configureEditorYaml, defineEditorThemes, getThemeName, nestedWorkflowText, revealLines, settingsSchemas, setupMonacoWorkers };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { WorkflowEditing, WorkflowLintContext } from '../editing.js';
|
|
2
|
+
import { type UsesSources } from '../graph/usesInputs.js';
|
|
3
|
+
export { HOST_MARKER_OWNER, LINT_OWNER } from './lintOwner.js';
|
|
4
|
+
export interface LintSources extends UsesSources {
|
|
5
|
+
secrets?: (() => Promise<string[]>) | undefined;
|
|
6
|
+
/** `uses` values the host runs itself, which have no workflow to read inputs from. */
|
|
7
|
+
actions?: Record<string, unknown> | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* What the linter can't read from `source`: the inputs of each workflow a step uses, and which
|
|
11
|
+
* of the user's variables are secret, as far as they have arrived. `onMore` runs when more does.
|
|
12
|
+
*/
|
|
13
|
+
export declare function lintContext(editing: WorkflowEditing, source: string, sources: LintSources, onMore: () => void): WorkflowLintContext;
|
|
14
|
+
export declare function useLintSources(): LintSources;
|
|
15
|
+
/** lintContext for a component, which renders again when more of it arrives. */
|
|
16
|
+
export declare function useLintContext(source: string | undefined): WorkflowLintContext;
|
|
17
|
+
/**
|
|
18
|
+
* The engine's editing once its checks have loaded, rendering again when they have; undefined
|
|
19
|
+
* before then, without an engine that edits, or with `load` false.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useLintEditing(load?: boolean): WorkflowEditing | undefined;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { useLoadedWorkflowEngine, useRepoSuggestions, useSecretVariablesResolver, useWorkflowActions, useWorkflowJsonResolver } from "../components/Provider.js";
|
|
2
|
+
import { asRecord } from "../graph/records.js";
|
|
3
|
+
import { HOST_MARKER_OWNER, LINT_OWNER } from "./lintOwner.js";
|
|
4
|
+
import { DEFAULT_GITLAB_HOST, DEFAULT_REPO_YAML, loadUsesInputs } from "../graph/usesInputs.js";
|
|
5
|
+
import { useEffect, useMemo, useState } from "react";
|
|
6
|
+
//#region src/editor/lintContext.ts
|
|
7
|
+
var KEEP_MS = 6e4;
|
|
8
|
+
var KEEP_FAILED_MS = 1e4;
|
|
9
|
+
var stale = (kept) => !kept || Date.now() - kept.at > (kept.value === null ? KEEP_FAILED_MS : KEEP_MS);
|
|
10
|
+
function failed(kept) {
|
|
11
|
+
return kept?.value ? {
|
|
12
|
+
value: kept.value,
|
|
13
|
+
at: Date.now() - KEEP_MS + KEEP_FAILED_MS
|
|
14
|
+
} : {
|
|
15
|
+
value: null,
|
|
16
|
+
at: Date.now()
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
var targets = /* @__PURE__ */ new Map();
|
|
20
|
+
var secretNames;
|
|
21
|
+
var waiting = /* @__PURE__ */ new Map();
|
|
22
|
+
var SECRETS = "\0secrets";
|
|
23
|
+
function fetchOnce(key, onMore, load) {
|
|
24
|
+
const waiters = waiting.get(key);
|
|
25
|
+
if (waiters) {
|
|
26
|
+
waiters.add(onMore);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const told = /* @__PURE__ */ new Set([onMore]);
|
|
30
|
+
waiting.set(key, told);
|
|
31
|
+
load().finally(() => {
|
|
32
|
+
waiting.delete(key);
|
|
33
|
+
for (const tell of told) tell();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
var text = (value, fallback) => typeof value === "string" && value ? value : fallback;
|
|
37
|
+
/**
|
|
38
|
+
* What the linter can't read from `source`: the inputs of each workflow a step uses, and which
|
|
39
|
+
* of the user's variables are secret, as far as they have arrived. `onMore` runs when more does.
|
|
40
|
+
*/
|
|
41
|
+
function lintContext(editing, source, sources, onMore) {
|
|
42
|
+
let doc;
|
|
43
|
+
try {
|
|
44
|
+
doc = editing.loadYaml(source);
|
|
45
|
+
} catch {
|
|
46
|
+
doc = void 0;
|
|
47
|
+
}
|
|
48
|
+
const wanted = /* @__PURE__ */ new Map();
|
|
49
|
+
for (const job of Object.values(asRecord(asRecord(doc)["jobs"]))) {
|
|
50
|
+
const steps = asRecord(job)["steps"];
|
|
51
|
+
for (const step of Array.isArray(steps) ? steps : []) {
|
|
52
|
+
const uses = asRecord(step)["uses"];
|
|
53
|
+
if (typeof uses !== "string" || uses.includes("${{") || Object.hasOwn(sources.actions ?? {}, uses.trim())) continue;
|
|
54
|
+
const withBlock = asRecord(asRecord(step)["with"]);
|
|
55
|
+
const key = [
|
|
56
|
+
uses.trim(),
|
|
57
|
+
text(withBlock["$yaml"], DEFAULT_REPO_YAML),
|
|
58
|
+
text(withBlock["$host"], DEFAULT_GITLAB_HOST)
|
|
59
|
+
].join("\n");
|
|
60
|
+
wanted.set(uses.trim(), (wanted.get(uses.trim()) ?? /* @__PURE__ */ new Set()).add(key));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const usesInputs = {};
|
|
64
|
+
for (const [uses, keys] of wanted) {
|
|
65
|
+
const key = keys.size === 1 ? [...keys][0] : void 0;
|
|
66
|
+
if (key === void 0) continue;
|
|
67
|
+
const kept = targets.get(key);
|
|
68
|
+
if (kept?.value) usesInputs[uses] = kept.value;
|
|
69
|
+
if (stale(kept)) {
|
|
70
|
+
const [, yamlPath = DEFAULT_REPO_YAML, host = DEFAULT_GITLAB_HOST] = key.split("\n");
|
|
71
|
+
fetchOnce(key, onMore, () => loadUsesInputs(editing, uses, {
|
|
72
|
+
yamlPath,
|
|
73
|
+
host
|
|
74
|
+
}, sources).then((inputs) => {
|
|
75
|
+
targets.set(key, {
|
|
76
|
+
value: inputs,
|
|
77
|
+
at: Date.now()
|
|
78
|
+
});
|
|
79
|
+
}, () => {
|
|
80
|
+
targets.set(key, failed(targets.get(key)));
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const secrets = sources.secrets;
|
|
85
|
+
if (secrets && stale(secretNames)) fetchOnce(SECRETS, onMore, () => secrets().then((names) => {
|
|
86
|
+
secretNames = {
|
|
87
|
+
value: names,
|
|
88
|
+
at: Date.now()
|
|
89
|
+
};
|
|
90
|
+
}, () => {
|
|
91
|
+
secretNames = failed(secretNames);
|
|
92
|
+
}));
|
|
93
|
+
return {
|
|
94
|
+
usesInputs,
|
|
95
|
+
...secretNames?.value ? { secretVars: secretNames.value } : {}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function useLintSources() {
|
|
99
|
+
const resolve = useWorkflowJsonResolver();
|
|
100
|
+
const repos = useRepoSuggestions();
|
|
101
|
+
const secrets = useSecretVariablesResolver();
|
|
102
|
+
const actions = useWorkflowActions();
|
|
103
|
+
return useMemo(() => ({
|
|
104
|
+
resolve,
|
|
105
|
+
repos,
|
|
106
|
+
secrets,
|
|
107
|
+
actions
|
|
108
|
+
}), [
|
|
109
|
+
resolve,
|
|
110
|
+
repos,
|
|
111
|
+
secrets,
|
|
112
|
+
actions
|
|
113
|
+
]);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The engine's editing once its checks have loaded, rendering again when they have; undefined
|
|
117
|
+
* before then, without an engine that edits, or with `load` false.
|
|
118
|
+
*/
|
|
119
|
+
function useLintEditing(load = true) {
|
|
120
|
+
const engine = useLoadedWorkflowEngine();
|
|
121
|
+
const [ready, setReady] = useState(() => !!engine?.isReady());
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (!load || !engine?.editing) return;
|
|
124
|
+
if (engine.isReady()) {
|
|
125
|
+
setReady(true);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
engine.init();
|
|
129
|
+
return engine.onReady((loaded) => {
|
|
130
|
+
if (loaded) setReady(true);
|
|
131
|
+
});
|
|
132
|
+
}, [load, engine]);
|
|
133
|
+
return load && ready ? engine?.editing : void 0;
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
export { HOST_MARKER_OWNER, LINT_OWNER, lintContext, useLintEditing, useLintSources };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** An editor holding one job or step of a workflow, whose inputs live outside its text. */
|
|
2
|
+
export interface NestedWorkflowText {
|
|
3
|
+
/** The workflow's inputs, so a new group is named clear of them. */
|
|
4
|
+
inputs: () => Record<string, unknown>;
|
|
5
|
+
/** Adds the group of inputs a `with:` completion's expressions read. */
|
|
6
|
+
addInputs: (name: string, definition: Record<string, unknown>) => void;
|
|
7
|
+
}
|
|
8
|
+
/** Lets completions reach the workflow around the editor of model `uri`; returns the undo. */
|
|
9
|
+
export declare function publishNestedText(uri: string, text: {
|
|
10
|
+
current: NestedWorkflowText | undefined;
|
|
11
|
+
}): () => void;
|
|
12
|
+
/** The workflow around the editor of model `uri`, or undefined when its text is a whole workflow. */
|
|
13
|
+
export declare function nestedWorkflowText(uri: string): NestedWorkflowText | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/editor/nestedText.ts
|
|
2
|
+
var published = /* @__PURE__ */ new Map();
|
|
3
|
+
/** Lets completions reach the workflow around the editor of model `uri`; returns the undo. */
|
|
4
|
+
function publishNestedText(uri, text) {
|
|
5
|
+
published.set(uri, text);
|
|
6
|
+
return () => {
|
|
7
|
+
if (published.get(uri) === text) published.delete(uri);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/** The workflow around the editor of model `uri`, or undefined when its text is a whole workflow. */
|
|
11
|
+
function nestedWorkflowText(uri) {
|
|
12
|
+
return published.get(uri)?.current;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { nestedWorkflowText, publishNestedText };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Lets revealLines reach the editor showing `path`; returns the function that undoes it. */
|
|
2
|
+
export declare function registerRevealer(path: string, reveal: (start: number, end: number) => void): () => void;
|
|
3
|
+
/** Scrolls the editor showing `path` to 1-based lines `start`–`end` and flashes them. */
|
|
4
|
+
export declare function revealLines(path: string, start: number, end: number): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/editor/reveal.ts
|
|
2
|
+
var revealers = /* @__PURE__ */ new Map();
|
|
3
|
+
/** Lets revealLines reach the editor showing `path`; returns the function that undoes it. */
|
|
4
|
+
function registerRevealer(path, reveal) {
|
|
5
|
+
revealers.set(path, reveal);
|
|
6
|
+
return () => {
|
|
7
|
+
if (revealers.get(path) === reveal) revealers.delete(path);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/** Scrolls the editor showing `path` to 1-based lines `start`–`end` and flashes them. */
|
|
11
|
+
function revealLines(path, start, end) {
|
|
12
|
+
revealers.get(path)?.(start, end);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { registerRevealer, revealLines };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Editors holding one job's, step's or input's settings, each checked against that part of the workflow schema. */
|
|
2
|
+
export declare const JOB_YAML_PATH = "file:///workflow-job.yaml";
|
|
3
|
+
export declare const STEP_YAML_PATH = "file:///workflow-step.yaml";
|
|
4
|
+
export declare const INPUT_YAML_PATH = "file:///workflow-input.yaml";
|
|
5
|
+
export declare const SETTINGS_YAML_PATH = "file:///workflow-settings.yaml";
|
|
6
|
+
export type JsonSchema = Record<string, unknown>;
|
|
7
|
+
export declare function settingsSchemas(workflow: JsonSchema): {
|
|
8
|
+
job: JsonSchema;
|
|
9
|
+
step: JsonSchema;
|
|
10
|
+
input: JsonSchema;
|
|
11
|
+
settings: JsonSchema;
|
|
12
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/editor/settingsYaml.ts
|
|
2
|
+
/** Editors holding one job's, step's or input's settings, each checked against that part of the workflow schema. */
|
|
3
|
+
var JOB_YAML_PATH = "file:///workflow-job.yaml";
|
|
4
|
+
var STEP_YAML_PATH = "file:///workflow-step.yaml";
|
|
5
|
+
var INPUT_YAML_PATH = "file:///workflow-input.yaml";
|
|
6
|
+
var SETTINGS_YAML_PATH = "file:///workflow-settings.yaml";
|
|
7
|
+
var record = (value) => typeof value === "object" && value !== null ? value : {};
|
|
8
|
+
function settingsSchemas(workflow) {
|
|
9
|
+
const patterns = record(record(record(workflow["properties"])["jobs"])["patternProperties"]);
|
|
10
|
+
const job = record(Object.values(patterns)[0]);
|
|
11
|
+
const step = record(record(record(job["properties"])["steps"])["items"]);
|
|
12
|
+
const inputs = record(record(record(workflow["$defs"])["inputs"])["patternProperties"]);
|
|
13
|
+
const input = record(Object.values(inputs)[0]);
|
|
14
|
+
const shared = {
|
|
15
|
+
$schema: workflow["$schema"],
|
|
16
|
+
$defs: workflow["$defs"]
|
|
17
|
+
};
|
|
18
|
+
const { jobs: _jobs, on: _on, ...settings } = record(workflow["properties"]);
|
|
19
|
+
return {
|
|
20
|
+
job: {
|
|
21
|
+
...job,
|
|
22
|
+
...shared
|
|
23
|
+
},
|
|
24
|
+
step: {
|
|
25
|
+
...step,
|
|
26
|
+
...shared
|
|
27
|
+
},
|
|
28
|
+
input: {
|
|
29
|
+
...input,
|
|
30
|
+
...shared
|
|
31
|
+
},
|
|
32
|
+
settings: {
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: settings,
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
...shared
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { INPUT_YAML_PATH, JOB_YAML_PATH, SETTINGS_YAML_PATH, STEP_YAML_PATH, settingsSchemas };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FieldWrapper } from "../FieldWrapper.js";
|
|
2
2
|
import FormikCustomDropdown_default from "../SpecialTypes/FormikCustomDropdown.js";
|
|
3
|
-
import { getPlaceholder } from "../utils/getPlaceholder.js";
|
|
4
3
|
import { dependentOptions } from "../utils/dependentOptions.js";
|
|
4
|
+
import { getPlaceholder } from "../utils/getPlaceholder.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/form/Fields/DropdownField.tsx
|
|
7
7
|
var missingSetter = () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useStrings } from "../../components/Provider.js";
|
|
2
2
|
import { FieldWrapper } from "../FieldWrapper.js";
|
|
3
|
-
import { setDurationValidity } from "./durationValidity.js";
|
|
4
3
|
import { formatDuration, parseDuration } from "../utils/duration.js";
|
|
4
|
+
import { setDurationValidity } from "./durationValidity.js";
|
|
5
5
|
import cx from "classnames";
|
|
6
6
|
import { memo, useEffect, useRef, useState } from "react";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
package/dist/form/Form.js
CHANGED
|
@@ -9,9 +9,9 @@ import SectionHeader from "../components/SectionHeader.js";
|
|
|
9
9
|
import { Table } from "../components/Table.js";
|
|
10
10
|
import { parseWizardConfig } from "./Wizard/utils.js";
|
|
11
11
|
import { inputWidth, resolvedFlag } from "./lib.js";
|
|
12
|
-
import { useFieldControlProps, useFieldRequired } from "./fieldContext.js";
|
|
13
12
|
import { resolveFormLayout } from "./layout.js";
|
|
14
13
|
import { FormLayout, LayoutCSSContext } from "./FormLayout.js";
|
|
14
|
+
import { useFieldControlProps, useFieldRequired } from "./fieldContext.js";
|
|
15
15
|
import { getValueUsingPath } from "./utils/getValueUsingPath.js";
|
|
16
16
|
import { FieldRegistryContext, Registry } from "./fieldRegistry.js";
|
|
17
17
|
import { useParsedOpts } from "./useParsedOpts.js";
|
|
@@ -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";
|
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 {};
|