@checkstack/ui 1.10.0 → 1.12.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/.storybook/main.ts +43 -0
- package/CHANGELOG.md +565 -0
- package/package.json +15 -7
- package/scripts/generate-stdlib-types.ts +25 -2
- package/src/components/ActionCard.tsx +309 -0
- package/src/components/CodeEditor/CodeEditor.tsx +132 -9
- package/src/components/CodeEditor/TypefoxEditor.tsx +1024 -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/generated/builtin-modules.json +1 -0
- package/src/components/CodeEditor/importSpecifiers.test.ts +286 -0
- package/src/components/CodeEditor/importSpecifiers.ts +267 -0
- package/src/components/CodeEditor/index.ts +26 -0
- package/src/components/CodeEditor/monacoTsService.ts +217 -0
- package/src/components/CodeEditor/popoutTitle.test.ts +37 -0
- package/src/components/CodeEditor/popoutTitle.ts +31 -0
- package/src/components/CodeEditor/scriptContext.test.ts +41 -0
- package/src/components/CodeEditor/scriptContext.ts +76 -1
- package/src/components/CodeEditor/scriptDiagnostics.test.ts +135 -0
- package/src/components/CodeEditor/scriptDiagnostics.ts +172 -0
- package/src/components/CodeEditor/templateValidation.ts +51 -0
- package/src/components/CodeEditor/types.ts +168 -0
- package/src/components/CodeEditor/validateJsonTemplate.test.ts +61 -0
- package/src/components/CodeEditor/validateJsonTemplate.ts +26 -0
- package/src/components/CodeEditor/validateScripts.ts +132 -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/Dialog.tsx +32 -11
- package/src/components/DurationInput.tsx +121 -0
- package/src/components/DynamicForm/DynamicForm.tsx +27 -1
- package/src/components/DynamicForm/FormField.tsx +138 -10
- package/src/components/DynamicForm/KeyValueEditor.tsx +2 -169
- package/src/components/DynamicForm/MultiTypeEditorField.tsx +83 -9
- package/src/components/DynamicForm/SecretEnvEditor.tsx +315 -0
- package/src/components/DynamicForm/index.ts +6 -0
- package/src/components/DynamicForm/secretEnv.logic.test.ts +126 -0
- package/src/components/DynamicForm/secretEnv.logic.ts +87 -0
- package/src/components/DynamicForm/types.ts +83 -1
- package/src/components/DynamicForm/utils.ts +32 -0
- package/src/components/Popover.tsx +6 -1
- package/src/components/ScriptTestPanel.logic.test.ts +139 -0
- package/src/components/ScriptTestPanel.logic.ts +137 -0
- package/src/components/ScriptTestPanel.tsx +394 -0
- package/src/components/Sheet.tsx +21 -6
- 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/TimeOfDayInput.tsx +116 -0
- package/src/components/VariablePicker.tsx +271 -0
- package/src/components/comboboxInteraction.ts +39 -0
- package/src/components/portalContainer.ts +24 -0
- package/src/hooks/useInitOnceForKey.test.ts +27 -0
- package/src/hooks/useInitOnceForKey.ts +21 -18
- package/src/index.ts +9 -0
- package/stories/ActionCard.stories.tsx +122 -0
- package/stories/Alert.stories.tsx +5 -5
- package/stories/CodeEditor.stories.tsx +47 -2
- package/stories/DurationInput.stories.tsx +59 -0
- package/stories/ScriptTestPanel.stories.tsx +106 -0
- package/stories/SecretEnvEditor.stories.tsx +80 -0
- package/stories/TemplateInputToggle.stories.tsx +77 -0
- package/stories/TemplateValueInput.stories.tsx +65 -0
- package/stories/TimeOfDayInput.stories.tsx +34 -0
- package/stories/VariablePicker.stories.tsx +109 -0
- package/tsconfig.json +1 -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,118 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
2
|
-
/**
|
|
3
|
-
* Eager, module-load-time Monaco bootstrap. Three things happen here,
|
|
4
|
-
* in this exact order, before any `<CodeEditor>` instance can mount:
|
|
5
|
-
*
|
|
6
|
-
* 1. Bundle the per-language web workers via Vite's `?worker` import
|
|
7
|
-
* suffix and install them via `MonacoEnvironment.getWorker`.
|
|
8
|
-
* Without locally-bundled workers, the loader's default CDN path
|
|
9
|
-
* sometimes fails silently (CORS on the worker scripts) and the
|
|
10
|
-
* TS service falls back to no-language-service mode.
|
|
11
|
-
*
|
|
12
|
-
* 2. Configure the TypeScript language service — compiler options,
|
|
13
|
-
* diagnostics options, eager-model-sync. The TS service in
|
|
14
|
-
* monaco-editor is a singleton that initialises lazily the FIRST
|
|
15
|
-
* time it sees a TS/JS model. Doing this config inside a
|
|
16
|
-
* per-mount `onMount` (the previous shape) meant a shell editor
|
|
17
|
-
* mounted first would start the service with defaults, and the
|
|
18
|
-
* later TS editor's config arrived too late.
|
|
19
|
-
*
|
|
20
|
-
* 3. Tell `@monaco-editor/react`'s loader to use our locally-bundled
|
|
21
|
-
* Monaco instance via `loader.config({ monaco })`. Without this
|
|
22
|
-
* the loader pulls Monaco from a CDN at runtime — which defeats
|
|
23
|
-
* the worker setup above.
|
|
24
|
-
*
|
|
25
|
-
* This file is imported as a SIDE EFFECT from MonacoEditor.tsx, so the
|
|
26
|
-
* setup runs on the first import of CodeEditor regardless of which
|
|
27
|
-
* language ends up being mounted first.
|
|
28
|
-
*/
|
|
29
|
-
import * as monaco from "monaco-editor";
|
|
30
|
-
import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker";
|
|
31
|
-
import jsonWorker from "monaco-editor/esm/vs/language/json/json.worker?worker";
|
|
32
|
-
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";
|
|
33
|
-
import htmlWorker from "monaco-editor/esm/vs/language/html/html.worker?worker";
|
|
34
|
-
import tsWorker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";
|
|
35
|
-
import { loader } from "@monaco-editor/react";
|
|
36
|
-
|
|
37
|
-
// ─── 1. Workers ──────────────────────────────────────────────────────────
|
|
38
|
-
|
|
39
|
-
interface MonacoEnvironmentLike {
|
|
40
|
-
getWorker(workerId: string, label: string): Worker;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
(
|
|
44
|
-
globalThis as unknown as { MonacoEnvironment: MonacoEnvironmentLike }
|
|
45
|
-
).MonacoEnvironment = {
|
|
46
|
-
getWorker(_workerId: string, label: string): Worker {
|
|
47
|
-
switch (label) {
|
|
48
|
-
case "json": {
|
|
49
|
-
return new jsonWorker();
|
|
50
|
-
}
|
|
51
|
-
case "css":
|
|
52
|
-
case "scss":
|
|
53
|
-
case "less": {
|
|
54
|
-
return new cssWorker();
|
|
55
|
-
}
|
|
56
|
-
case "html":
|
|
57
|
-
case "handlebars":
|
|
58
|
-
case "razor": {
|
|
59
|
-
return new htmlWorker();
|
|
60
|
-
}
|
|
61
|
-
case "typescript":
|
|
62
|
-
case "javascript": {
|
|
63
|
-
return new tsWorker();
|
|
64
|
-
}
|
|
65
|
-
default: {
|
|
66
|
-
return new editorWorker();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// ─── 2. TypeScript language service ──────────────────────────────────────
|
|
73
|
-
//
|
|
74
|
-
// In monaco-editor 0.55 the canonical access path is `monaco.typescript`
|
|
75
|
-
// (the older `monaco.languages.typescript` is marked
|
|
76
|
-
// `{ deprecated: true }` in the type defs and emits a tombstone object).
|
|
77
|
-
// Both still resolve to the same singleton at runtime; we use the new
|
|
78
|
-
// path for type-safety.
|
|
79
|
-
|
|
80
|
-
const tsDefaults = monaco.typescript.typescriptDefaults;
|
|
81
|
-
const jsDefaults = monaco.typescript.javascriptDefaults;
|
|
82
|
-
|
|
83
|
-
for (const defaults of [tsDefaults, jsDefaults]) {
|
|
84
|
-
defaults.setCompilerOptions({
|
|
85
|
-
target: monaco.typescript.ScriptTarget.ESNext,
|
|
86
|
-
module: monaco.typescript.ModuleKind.ESNext,
|
|
87
|
-
moduleResolution: monaco.typescript.ModuleResolutionKind.NodeJs,
|
|
88
|
-
lib: ["esnext"],
|
|
89
|
-
// Pulls the bundled @types/node + bun-types declarations into the
|
|
90
|
-
// ambient scope, so `process`, `Buffer`, the `Bun` global, etc. are
|
|
91
|
-
// typed without the user needing any `/// <reference>`.
|
|
92
|
-
types: ["node", "bun-types"],
|
|
93
|
-
allowNonTsExtensions: false,
|
|
94
|
-
noEmit: true,
|
|
95
|
-
strict: true,
|
|
96
|
-
esModuleInterop: true,
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// Suppress diagnostics that don't apply to our script context:
|
|
100
|
-
// - 1108: "A 'return' statement can only be used within a function body"
|
|
101
|
-
// The runtime wraps legacy scripts in an async IIFE, so a
|
|
102
|
-
// top-level `return X;` is valid in the user's source.
|
|
103
|
-
defaults.setDiagnosticsOptions({
|
|
104
|
-
diagnosticCodesToIgnore: [1108],
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// Eagerly push models to the TS worker the moment they're created so
|
|
108
|
-
// diagnostics + completions are available on the first keystroke.
|
|
109
|
-
defaults.setEagerModelSync(true);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// ─── 3. Loader ───────────────────────────────────────────────────────────
|
|
113
|
-
//
|
|
114
|
-
// Must be the LAST step: once a `<Editor>` mounts, `loader.init()` is
|
|
115
|
-
// called and config is locked. Pointing at our local `monaco` import
|
|
116
|
-
// bypasses the loader's default AMD/CDN path entirely.
|
|
117
|
-
|
|
118
|
-
loader.config({ monaco });
|