@checkstack/ui 1.10.0 → 1.11.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/CHANGELOG.md +384 -0
- package/package.json +15 -7
- package/scripts/generate-stdlib-types.ts +2 -2
- package/src/components/ActionCard.tsx +221 -0
- package/src/components/CodeEditor/CodeEditor.tsx +51 -9
- package/src/components/CodeEditor/TypefoxEditor.tsx +868 -0
- package/src/components/CodeEditor/bracketKeyGroups.test.ts +120 -0
- package/src/components/CodeEditor/bracketKeyGroups.ts +205 -0
- package/src/components/CodeEditor/generateTypeDefinitions.ts +4 -4
- package/src/components/CodeEditor/index.ts +2 -0
- package/src/components/CodeEditor/scriptContext.test.ts +41 -0
- package/src/components/CodeEditor/scriptContext.ts +76 -1
- package/src/components/CodeEditor/templateValidation.ts +51 -0
- package/src/components/CodeEditor/types.ts +109 -0
- package/src/components/CodeEditor/validateJsonTemplate.test.ts +61 -0
- package/src/components/CodeEditor/validateJsonTemplate.ts +26 -0
- package/src/components/CodeEditor/validateXmlTemplate.test.ts +34 -0
- package/src/components/CodeEditor/validateXmlTemplate.ts +35 -0
- package/src/components/CodeEditor/validateYamlTemplate.test.ts +39 -0
- package/src/components/CodeEditor/validateYamlTemplate.ts +28 -0
- package/src/components/DynamicForm/DynamicForm.tsx +2 -0
- package/src/components/DynamicForm/FormField.tsx +29 -9
- package/src/components/DynamicForm/KeyValueEditor.tsx +2 -169
- package/src/components/DynamicForm/MultiTypeEditorField.tsx +16 -7
- package/src/components/DynamicForm/types.ts +11 -0
- package/src/components/TemplateInput.tsx +104 -0
- package/src/components/TemplateInputToggle.tsx +111 -0
- package/src/components/TemplateValueInput.test.ts +98 -0
- package/src/components/TemplateValueInput.tsx +470 -0
- package/src/components/VariablePicker.tsx +271 -0
- package/src/hooks/useInitOnceForKey.test.ts +27 -0
- package/src/hooks/useInitOnceForKey.ts +21 -18
- package/src/index.ts +5 -0
- package/stories/ActionCard.stories.tsx +62 -0
- package/stories/Alert.stories.tsx +5 -5
- package/stories/TemplateInputToggle.stories.tsx +77 -0
- package/stories/TemplateValueInput.stories.tsx +65 -0
- package/stories/VariablePicker.stories.tsx +109 -0
- package/src/components/CodeEditor/MonacoEditor.tsx +0 -616
- package/src/components/CodeEditor/monacoStdlib.ts +0 -62
- package/src/components/CodeEditor/monacoWorkers.ts +0 -118
|
@@ -1,13 +1,55 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
1
|
+
// Public `CodeEditor` component. Adapts the stable `CodeEditorProps` API to the
|
|
2
|
+
// `@typefox/monaco-editor-react`-backed `TypefoxEditor` (real VS Code language
|
|
3
|
+
// services in the browser). Consumers (DynamicForm, automation, healthcheck)
|
|
4
|
+
// import this and are unaffected by the underlying editor implementation.
|
|
5
|
+
import { TypefoxEditor } from "./TypefoxEditor";
|
|
6
|
+
import type { CodeEditorProps } from "./types";
|
|
3
7
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Code editor with context-aware IntelliSense, template / shell completion, and
|
|
10
|
+
* structural validation. See `CodeEditorProps`.
|
|
11
|
+
*/
|
|
12
|
+
export const CodeEditor = ({
|
|
13
|
+
id,
|
|
14
|
+
value,
|
|
15
|
+
onChange,
|
|
16
|
+
language = "typescript",
|
|
17
|
+
minHeight = "100px",
|
|
18
|
+
readOnly,
|
|
19
|
+
placeholder,
|
|
20
|
+
typeDefinitions,
|
|
21
|
+
templateProperties,
|
|
22
|
+
shellEnvVars,
|
|
23
|
+
markers,
|
|
24
|
+
}: CodeEditorProps) => {
|
|
25
|
+
// CodeEditorProps.minHeight is a CSS length string ("240px"); TypefoxEditor
|
|
26
|
+
// takes a pixel number.
|
|
27
|
+
const minHeightPx = Number.parseInt(minHeight, 10) || 100;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<TypefoxEditor
|
|
31
|
+
id={id ?? "code-editor"}
|
|
32
|
+
value={value}
|
|
33
|
+
onChange={onChange}
|
|
34
|
+
language={language}
|
|
35
|
+
minHeight={minHeightPx}
|
|
36
|
+
readOnly={readOnly}
|
|
37
|
+
placeholder={placeholder}
|
|
38
|
+
typeDefinitions={typeDefinitions}
|
|
39
|
+
templateProperties={templateProperties}
|
|
40
|
+
shellEnvVars={shellEnvVars}
|
|
41
|
+
markers={markers}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type {
|
|
47
|
+
CodeEditorProps,
|
|
48
|
+
CodeEditorLanguage,
|
|
49
|
+
TemplateProperty,
|
|
50
|
+
ShellEnvVar,
|
|
51
|
+
EditorMarker,
|
|
52
|
+
} from "./types";
|
|
11
53
|
|
|
12
54
|
export {
|
|
13
55
|
generateTypeDefinitions,
|