@pibit.ai/cure-design-system 0.6.46 → 0.6.48

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 (49) hide show
  1. package/dist/code-editor/code-editor.d.ts +88 -0
  2. package/dist/code-editor/code-editor.d.ts.map +1 -0
  3. package/dist/code-editor/code-editor.js +219 -0
  4. package/dist/code-editor/formatJsonEditorValue.d.ts +2 -0
  5. package/dist/code-editor/formatJsonEditorValue.d.ts.map +1 -0
  6. package/dist/code-editor/formatJsonEditorValue.js +20 -0
  7. package/dist/code-editor/index.d.ts +7 -0
  8. package/dist/code-editor/index.d.ts.map +1 -0
  9. package/dist/code-editor/index.js +14 -0
  10. package/dist/code-editor/json-code-editor.d.ts +26 -0
  11. package/dist/code-editor/json-code-editor.d.ts.map +1 -0
  12. package/dist/code-editor/json-code-editor.js +64 -0
  13. package/dist/code-editor/languages.d.ts +5 -0
  14. package/dist/code-editor/languages.d.ts.map +1 -0
  15. package/dist/code-editor/languages.js +31 -0
  16. package/dist/code-editor/theme.d.ts +9 -0
  17. package/dist/code-editor/theme.d.ts.map +1 -0
  18. package/dist/code-editor/theme.js +121 -0
  19. package/dist/rich-text/index.d.ts +8 -0
  20. package/dist/rich-text/index.d.ts.map +1 -0
  21. package/dist/rich-text/index.js +4 -0
  22. package/dist/styles/components.css +1 -1
  23. package/package.json +151 -1
  24. package/dist/applications/schedule-calendar/utils.test.d.ts +0 -2
  25. package/dist/applications/schedule-calendar/utils.test.d.ts.map +0 -1
  26. package/dist/patterns/condition-builder/utils.test.d.ts +0 -2
  27. package/dist/patterns/condition-builder/utils.test.d.ts.map +0 -1
  28. package/dist/patterns/table/cellRangeSelection.test.d.ts +0 -2
  29. package/dist/patterns/table/cellRangeSelection.test.d.ts.map +0 -1
  30. package/dist/patterns/table/rowReorderDrag.test.d.ts +0 -2
  31. package/dist/patterns/table/rowReorderDrag.test.d.ts.map +0 -1
  32. package/dist/patterns/table/tableUndoRedo.test.d.ts +0 -2
  33. package/dist/patterns/table/tableUndoRedo.test.d.ts.map +0 -1
  34. package/dist/patterns/table/tableZoomLayout.test.d.ts +0 -2
  35. package/dist/patterns/table/tableZoomLayout.test.d.ts.map +0 -1
  36. package/dist/patterns/table/toolbar/tableToolbarHelpers.test.d.ts +0 -2
  37. package/dist/patterns/table/toolbar/tableToolbarHelpers.test.d.ts.map +0 -1
  38. package/dist/patterns/table/toolbar/tableViewSnapshot.test.d.ts +0 -2
  39. package/dist/patterns/table/toolbar/tableViewSnapshot.test.d.ts.map +0 -1
  40. package/dist/patterns/table-component/buildTableColumns.test.d.ts +0 -2
  41. package/dist/patterns/table-component/buildTableColumns.test.d.ts.map +0 -1
  42. package/dist/patterns/table-component/columnReorderDrag.test.d.ts +0 -2
  43. package/dist/patterns/table-component/columnReorderDrag.test.d.ts.map +0 -1
  44. package/dist/primitives/dropdown/dropdown.nestedOverlay.test.d.ts +0 -2
  45. package/dist/primitives/dropdown/dropdown.nestedOverlay.test.d.ts.map +0 -1
  46. package/dist/primitives/select/__tests__/multi-select-utils.test.d.ts +0 -2
  47. package/dist/primitives/select/__tests__/multi-select-utils.test.d.ts.map +0 -1
  48. package/dist/utils/cn.test.d.ts +0 -2
  49. package/dist/utils/cn.test.d.ts.map +0 -1
@@ -0,0 +1,88 @@
1
+ import { Ref } from 'react';
2
+ import { BasicSetupOptions, ReactCodeMirrorRef, ViewUpdate } from '@uiw/react-codemirror';
3
+ import { EditorState, Extension } from '@codemirror/state';
4
+ import { EditorView } from '@codemirror/view';
5
+ import { CodeLanguage } from './languages';
6
+ export type { CodeLanguage } from './languages';
7
+ export interface CodeEditorProps {
8
+ /** Current code value */
9
+ value: string;
10
+ /** Callback when value changes */
11
+ onChange: (value: string) => void;
12
+ /** Programming language for syntax highlighting (pack loads on demand) */
13
+ language?: CodeLanguage;
14
+ /** Callback when language changes */
15
+ onLanguageChange?: (language: CodeLanguage) => void;
16
+ /** Placeholder text */
17
+ placeholder?: string;
18
+ /** Whether the field is disabled */
19
+ isDisabled?: boolean;
20
+ /** Non-editable with normal appearance */
21
+ isReadOnly?: boolean;
22
+ /** Whether the field has an error */
23
+ isInvalid?: boolean;
24
+ /** Number of rows for the textarea */
25
+ rows?: number;
26
+ /** Additional CSS classes */
27
+ className?: string;
28
+ /** Show language selector (reserved; the selector UI is not rendered today) */
29
+ showLanguageSelector?: boolean;
30
+ /** Show line numbers */
31
+ showLineNumbers?: boolean;
32
+ /**
33
+ * Auto-insert matching closing brace/bracket/quote when the opening
34
+ * character is typed. Defaults to true (CodeMirror's basicSetup includes it).
35
+ */
36
+ autoClosePairs?: boolean;
37
+ /**
38
+ * CodeMirror theme. The default DS chrome uses "none" plus the token-driven
39
+ * styles below; "light"/"dark" switch to CodeMirror's built-in themes and
40
+ * skip the DS chrome (used by chromeless hosts like the template editor).
41
+ */
42
+ theme?: "light" | "dark" | "none";
43
+ /** Stretch the editor to fill the parent flex container */
44
+ fillHeight?: boolean;
45
+ /**
46
+ * Grow to the full height of the content and leave scrolling to an ancestor
47
+ * container, so the scrollbar sits outside the editor box.
48
+ */
49
+ growWithContent?: boolean;
50
+ /** Show character/line count below the editor */
51
+ showFooter?: boolean;
52
+ /** Soft-wrap long lines. Off by default so JSON/logs scroll horizontally with stable line numbers. */
53
+ lineWrapping?: boolean;
54
+ /** Highlight the line under the cursor. Defaults to true when editable. */
55
+ highlightActiveLine?: boolean;
56
+ /** Shrink height to fit content, capped at `rows`. */
57
+ fitContent?: boolean;
58
+ /** Minimum visible rows when `fitContent` is enabled. Defaults to 1. */
59
+ minRows?: number;
60
+ /**
61
+ * Extra CodeMirror extensions, appended after the language and chrome.
62
+ * App-specific behavior (SQL helpers, variable chips, merge views) stays in
63
+ * the app and comes in through here.
64
+ */
65
+ extensions?: Extension[];
66
+ /** Lint diagnostics (e.g. `linter(jsonParseLinter())` + `lintGutter()`). */
67
+ lint?: Extension | Extension[];
68
+ /** Called once the underlying EditorView exists. */
69
+ onCreateEditor?: (view: EditorView, state: EditorState) => void;
70
+ /** Called on every CodeMirror view update (doc or selection changes). */
71
+ onUpdate?: (update: ViewUpdate) => void;
72
+ /** Ref to the underlying @uiw/react-codemirror handle ({ view, state, editor }). */
73
+ editorRef?: Ref<ReactCodeMirrorRef>;
74
+ /**
75
+ * Render the bare editor: no border wrapper, no footer, no DS chrome —
76
+ * the host owns all framing (and usually sets `theme` to a built-in).
77
+ */
78
+ chromeless?: boolean;
79
+ /** Explicit editor height (chromeless hosts; e.g. "100%"). */
80
+ height?: string;
81
+ /** Override the computed basicSetup entirely. */
82
+ basicSetup?: BasicSetupOptions | boolean;
83
+ onFocus?: () => void;
84
+ onBlur?: () => void;
85
+ }
86
+ export declare const CodeEditor: ({ value, onChange, language, placeholder, isDisabled, isReadOnly, isInvalid, rows, className, showLineNumbers, autoClosePairs, theme, fillHeight, growWithContent, showFooter, lineWrapping, highlightActiveLine, fitContent, minRows, extensions: extraExtensions, lint, onCreateEditor, onUpdate, editorRef, chromeless, height, basicSetup: basicSetupOverride, onFocus, onBlur, }: CodeEditorProps) => import("react/jsx-runtime").JSX.Element;
87
+ export default CodeEditor;
88
+ //# sourceMappingURL=code-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-editor.d.ts","sourceRoot":"","sources":["../../src/code-editor/code-editor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAmB,EACjB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EAChB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,eAAe;IAC9B,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IAEd,kCAAkC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,YAAY,CAAC;IAExB,qCAAqC;IACrC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;IAEpD,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,oCAAoC;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,+EAA+E;IAC/E,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAElC,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,sGAAsG;IACtG,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,2EAA2E;IAC3E,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B,sDAAsD;IACtD,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IAEzB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAE/B,oDAAoD;IACpD,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAEhE,yEAAyE;IACzE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAExC,oFAAoF;IACpF,SAAS,CAAC,EAAE,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAEpC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,iDAAiD;IACjD,UAAU,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAEzC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAsHD,eAAO,MAAM,UAAU,GAAI,uXA8BxB,eAAe,4CA6HjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,219 @@
1
+ import { jsx as T, jsxs as p } from "react/jsx-runtime";
2
+ import { useMemo as A, useState as U, useEffect as Z } from "react";
3
+ import W from "@uiw/react-codemirror";
4
+ import { syntaxHighlighting as oo, HighlightStyle as ro } from "@codemirror/language";
5
+ import { EditorView as X } from "@codemirror/view";
6
+ import { tags as o } from "@lezer/highlight";
7
+ import { cx as E } from "../utils/cn.js";
8
+ import { loadLanguageExtension as eo } from "./languages.js";
9
+ const to = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", H = 22, r = "var(--color-text-primary)", n = "var(--color-utility-warning-600)", R = "var(--color-utility-blue-600)", lo = "var(--color-utility-success-600)", co = ro.define([
10
+ { tag: o.propertyName, color: n },
11
+ { tag: o.definition(o.propertyName), color: n },
12
+ { tag: o.string, color: n },
13
+ { tag: o.special(o.string), color: n },
14
+ { tag: o.attributeValue, color: n },
15
+ { tag: o.bool, color: R },
16
+ { tag: o.null, color: R },
17
+ { tag: o.number, color: lo },
18
+ { tag: o.keyword, color: r },
19
+ { tag: o.controlKeyword, color: r },
20
+ { tag: o.operator, color: r },
21
+ { tag: o.variableName, color: r },
22
+ { tag: o.typeName, color: r },
23
+ { tag: o.className, color: r },
24
+ { tag: o.comment, color: r },
25
+ { tag: o.meta, color: r },
26
+ { tag: o.tagName, color: r },
27
+ { tag: o.attributeName, color: n },
28
+ { tag: o.bracket, color: r },
29
+ { tag: o.punctuation, color: r },
30
+ { tag: o.regexp, color: n },
31
+ { tag: o.name, color: r },
32
+ { tag: o.atom, color: r },
33
+ { tag: o.labelName, color: r },
34
+ { tag: o.content, color: r }
35
+ ]), no = X.theme({
36
+ "&": {
37
+ backgroundColor: "var(--color-bg-primary)"
38
+ },
39
+ ".cm-scroller": {
40
+ backgroundColor: "var(--color-bg-primary)"
41
+ },
42
+ ".cm-content": {
43
+ padding: "8px 12px",
44
+ caretColor: r
45
+ },
46
+ ".cm-gutters": {
47
+ backgroundColor: "var(--color-bg-primary)",
48
+ color: "var(--color-text-tertiary)",
49
+ borderRight: "1px solid var(--color-border-secondary)"
50
+ },
51
+ ".cm-lineNumbers .cm-gutterElement": {
52
+ padding: "0 8px 0 12px",
53
+ minWidth: "24px"
54
+ },
55
+ ".cm-foldGutter .cm-gutterElement": {
56
+ padding: "0 2px"
57
+ },
58
+ ".cm-activeLine": {
59
+ backgroundColor: "var(--color-bg-primary_hover)"
60
+ },
61
+ ".cm-activeLineGutter": {
62
+ backgroundColor: "var(--color-bg-primary)"
63
+ },
64
+ ".cm-selectionBackground, &.cm-focused .cm-selectionBackground": {
65
+ backgroundColor: "var(--color-bg-secondary) !important"
66
+ },
67
+ ".cm-cursor": {
68
+ borderLeftColor: r
69
+ },
70
+ ".cm-placeholder": {
71
+ color: "var(--color-text-placeholder)"
72
+ }
73
+ }), ao = (e, l) => l || {
74
+ javascript: "// Enter your JavaScript code here",
75
+ typescript: "// Enter your TypeScript code here",
76
+ python: "# Enter your Python code here",
77
+ sql: "-- Enter your SQL query here",
78
+ yaml: "# Enter your YAML configuration here",
79
+ xml: "<!-- Enter your XML here -->",
80
+ html: "<!-- Enter your HTML here -->",
81
+ css: "/* Enter your CSS here */",
82
+ json: `{
83
+ "key": "value"
84
+ }`,
85
+ markdown: "# Enter your Markdown here",
86
+ bash: "# Enter your bash script here",
87
+ shell: "# Enter your shell script here"
88
+ }[e], io = (e) => {
89
+ const [l, i] = U(null);
90
+ return Z(() => {
91
+ let d = !1;
92
+ return eo(e).then((f) => {
93
+ d || i({ language: e, extension: f });
94
+ }), () => {
95
+ d = !0;
96
+ };
97
+ }, [e]), (l == null ? void 0 : l.language) === e ? l.extension : null;
98
+ }, vo = ({
99
+ value: e = "",
100
+ onChange: l,
101
+ language: i = "python",
102
+ placeholder: d,
103
+ isDisabled: f = !1,
104
+ isReadOnly: Y = !1,
105
+ isInvalid: j = !1,
106
+ rows: w = 12,
107
+ className: M = "",
108
+ showLineNumbers: u = !1,
109
+ autoClosePairs: N = !0,
110
+ theme: h = "none",
111
+ fillHeight: s = !1,
112
+ growWithContent: g = !1,
113
+ showFooter: B = !0,
114
+ lineWrapping: S = !1,
115
+ highlightActiveLine: G,
116
+ fitContent: m = !1,
117
+ minRows: P = 1,
118
+ extensions: y,
119
+ lint: x,
120
+ onCreateEditor: I,
121
+ onUpdate: O,
122
+ editorRef: K,
123
+ chromeless: t = !1,
124
+ height: q,
125
+ basicSetup: k,
126
+ onFocus: F,
127
+ onBlur: V
128
+ }) => {
129
+ const c = !f && !Y, b = G ?? c, v = io(i), C = !t && h === "none", $ = A(() => {
130
+ const a = [];
131
+ return v && a.push(v), S && a.push(X.lineWrapping), C && a.push(
132
+ no,
133
+ oo(co)
134
+ ), x && a.push(x), y && a.push(...y), a;
135
+ }, [v, S, C, x, y]), z = A(
136
+ () => k ?? {
137
+ lineNumbers: u,
138
+ foldGutter: u,
139
+ closeBrackets: N && c,
140
+ highlightActiveLine: b,
141
+ highlightActiveLineGutter: u && b,
142
+ bracketMatching: c,
143
+ autocompletion: c,
144
+ indentOnInput: c
145
+ },
146
+ [
147
+ k,
148
+ u,
149
+ N,
150
+ c,
151
+ b
152
+ ]
153
+ ), _ = `${w * H}px`, D = ao(i, d), J = Math.max(P, (e ?? "").split(`
154
+ `).length), Q = `${Math.min(w, J) * H}px`, L = /* @__PURE__ */ T(
155
+ W,
156
+ {
157
+ ref: K,
158
+ value: e,
159
+ onChange: l,
160
+ onFocus: F,
161
+ onBlur: V,
162
+ onCreateEditor: I,
163
+ onUpdate: O,
164
+ theme: t ? h === "none" ? "light" : h : "none",
165
+ extensions: $,
166
+ basicSetup: z,
167
+ placeholder: D,
168
+ editable: c,
169
+ height: q ?? (s ? "100%" : m ? Q : void 0),
170
+ minHeight: t ? void 0 : s ? "100%" : m || g ? void 0 : _,
171
+ maxHeight: !t && m ? _ : void 0,
172
+ className: E(
173
+ !t && s && "h-full min-h-0 w-full [&_.cm-editor]:h-full [&_.cm-editor]:w-full [&_.cm-scroller]:overflow-auto",
174
+ !t && g && "flex w-full grow flex-col [&_.cm-editor]:w-full [&_.cm-editor]:grow [&_.cm-scroller]:overflow-visible",
175
+ !t && m && "[&_.cm-scroller]:overflow-auto",
176
+ t && M
177
+ ),
178
+ style: t ? void 0 : { fontSize: 13, fontFamily: to }
179
+ }
180
+ );
181
+ return t ? L : /* @__PURE__ */ p(
182
+ "div",
183
+ {
184
+ className: E(
185
+ s ? "flex h-full min-h-0 flex-1 flex-col" : g ? "flex grow flex-col" : "space-y-2",
186
+ M
187
+ ),
188
+ children: [
189
+ /* @__PURE__ */ T(
190
+ "div",
191
+ {
192
+ className: E(
193
+ "overflow-hidden rounded-lg border border-secondary",
194
+ s && "flex min-h-0 w-full flex-1 flex-col",
195
+ g && "flex w-full grow flex-col",
196
+ j ? "border-error-500" : "border-secondary"
197
+ ),
198
+ children: L
199
+ }
200
+ ),
201
+ B && e && /* @__PURE__ */ p("div", { className: "flex justify-between text-xs text-tertiary", children: [
202
+ /* @__PURE__ */ p("span", { children: [
203
+ e.length,
204
+ " characters"
205
+ ] }),
206
+ /* @__PURE__ */ p("span", { children: [
207
+ e.split(`
208
+ `).length,
209
+ " lines"
210
+ ] })
211
+ ] })
212
+ ]
213
+ }
214
+ );
215
+ };
216
+ export {
217
+ vo as CodeEditor,
218
+ vo as default
219
+ };
@@ -0,0 +1,2 @@
1
+ export declare function formatJsonEditorValue(value: unknown): string;
2
+ //# sourceMappingURL=formatJsonEditorValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatJsonEditorValue.d.ts","sourceRoot":"","sources":["../../src/code-editor/formatJsonEditorValue.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAgB5D"}
@@ -0,0 +1,20 @@
1
+ function n(r) {
2
+ if (r == null) return "";
3
+ if (typeof r == "string") {
4
+ const t = r.trim();
5
+ if (!t) return "";
6
+ try {
7
+ return JSON.stringify(JSON.parse(t), null, 2);
8
+ } catch {
9
+ return r;
10
+ }
11
+ }
12
+ try {
13
+ return JSON.stringify(r, null, 2);
14
+ } catch {
15
+ return String(r);
16
+ }
17
+ }
18
+ export {
19
+ n as formatJsonEditorValue
20
+ };
@@ -0,0 +1,7 @@
1
+ export { cureCodeMirrorTheme, cureEditorChrome, cureHighlightStyle, } from './theme';
2
+ export { CodeEditor, type CodeEditorProps } from './code-editor';
3
+ export { type CodeLanguage, loadLanguageExtension } from './languages';
4
+ export { JsonCodeEditor, type JsonCodeEditorProps } from './json-code-editor';
5
+ export { formatJsonEditorValue } from './formatJsonEditorValue';
6
+ export type { ReactCodeMirrorRef, ViewUpdate } from '@uiw/react-codemirror';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/code-editor/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,KAAK,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { cureCodeMirrorTheme as e, cureEditorChrome as t, cureHighlightStyle as d } from "./theme.js";
2
+ import { CodeEditor as m } from "./code-editor.js";
3
+ import { loadLanguageExtension as x } from "./languages.js";
4
+ import { JsonCodeEditor as n } from "./json-code-editor.js";
5
+ import { formatJsonEditorValue as u } from "./formatJsonEditorValue.js";
6
+ export {
7
+ m as CodeEditor,
8
+ n as JsonCodeEditor,
9
+ e as cureCodeMirrorTheme,
10
+ t as cureEditorChrome,
11
+ d as cureHighlightStyle,
12
+ u as formatJsonEditorValue,
13
+ x as loadLanguageExtension
14
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * JsonCodeEditor — JSON-mode CodeEditor with the shared workflow run-drawer settings.
3
+ */
4
+ export interface JsonCodeEditorProps {
5
+ value: string;
6
+ onChange?: (value: string) => void;
7
+ isReadOnly?: boolean;
8
+ isDisabled?: boolean;
9
+ isInvalid?: boolean;
10
+ /** Stretch to fill a flex parent (run drawer). */
11
+ fillHeight?: boolean;
12
+ /** Grow to the content height and let an ancestor own the scrollbar. */
13
+ growWithContent?: boolean;
14
+ /** Parent supplies border chrome — drop the editor's own border/radius. */
15
+ embedded?: boolean;
16
+ className?: string;
17
+ rows?: number;
18
+ placeholder?: string;
19
+ /** Defaults to true. Disable for compact inline forms (e.g. assertion value). */
20
+ showLineNumbers?: boolean;
21
+ onFocus?: () => void;
22
+ onBlur?: () => void;
23
+ }
24
+ export declare function JsonCodeEditor({ value, onChange, isReadOnly, isDisabled, isInvalid, fillHeight, growWithContent, embedded, className, rows, placeholder, showLineNumbers, onFocus, onBlur, }: JsonCodeEditorProps): import("react/jsx-runtime").JSX.Element;
25
+ export default JsonCodeEditor;
26
+ //# sourceMappingURL=json-code-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-code-editor.d.ts","sourceRoot":"","sources":["../../src/code-editor/json-code-editor.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAKH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kDAAkD;IAClD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wEAAwE;IACxE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAmB,EACnB,UAAkB,EAClB,UAAkB,EAClB,SAAiB,EACjB,UAAkB,EAClB,eAAuB,EACvB,QAAgB,EAChB,SAAS,EACT,IAAS,EACT,WAAW,EACX,eAAsB,EACtB,OAAO,EACP,MAAM,GACP,EAAE,mBAAmB,2CAqCrB;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { cx as a } from "../utils/cn.js";
3
+ import { CodeEditor as w } from "./code-editor.js";
4
+ function j({
5
+ value: f,
6
+ onChange: r = () => {
7
+ },
8
+ isReadOnly: s = !1,
9
+ isDisabled: n = !1,
10
+ isInvalid: d = !1,
11
+ fillHeight: e = !1,
12
+ growWithContent: l = !1,
13
+ embedded: i = !1,
14
+ className: u,
15
+ rows: m = 12,
16
+ placeholder: t,
17
+ showLineNumbers: c = !0,
18
+ onFocus: x,
19
+ onBlur: p
20
+ }) {
21
+ return /* @__PURE__ */ o(
22
+ "div",
23
+ {
24
+ className: a(
25
+ e && "flex min-h-0 w-full flex-1 flex-col overflow-hidden",
26
+ l && "flex w-full grow flex-col"
27
+ ),
28
+ children: /* @__PURE__ */ o(
29
+ w,
30
+ {
31
+ value: f,
32
+ onChange: r,
33
+ language: "json",
34
+ isReadOnly: s,
35
+ isDisabled: n,
36
+ isInvalid: d,
37
+ showLineNumbers: c,
38
+ showLanguageSelector: !1,
39
+ showFooter: !1,
40
+ autoClosePairs: !0,
41
+ lineWrapping: !0,
42
+ highlightActiveLine: !1,
43
+ fitContent: !e && !l,
44
+ minRows: 3,
45
+ fillHeight: e,
46
+ growWithContent: l,
47
+ rows: m,
48
+ placeholder: t,
49
+ onFocus: x,
50
+ onBlur: p,
51
+ className: a(
52
+ e && "min-h-0 w-full flex-1",
53
+ i && "[&>div]:rounded-none [&>div]:border-0",
54
+ u
55
+ )
56
+ }
57
+ )
58
+ }
59
+ );
60
+ }
61
+ export {
62
+ j as JsonCodeEditor,
63
+ j as default
64
+ };
@@ -0,0 +1,5 @@
1
+ import { Extension } from '@codemirror/state';
2
+ export type CodeLanguage = "javascript" | "typescript" | "python" | "sql" | "yaml" | "xml" | "html" | "css" | "json" | "markdown" | "bash" | "shell";
3
+ /** Loads (and caches) the language extension for `language`. */
4
+ export declare const loadLanguageExtension: (language: CodeLanguage) => Promise<Extension>;
5
+ //# sourceMappingURL=languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../src/code-editor/languages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,YAAY,GACZ,QAAQ,GACR,KAAK,GACL,MAAM,GACN,KAAK,GACL,MAAM,GACN,KAAK,GACL,MAAM,GACN,UAAU,GACV,MAAM,GACN,OAAO,CAAC;AAuCZ,gEAAgE;AAChE,eAAO,MAAM,qBAAqB,GAChC,UAAU,YAAY,KACrB,OAAO,CAAC,SAAS,CAQnB,CAAC"}
@@ -0,0 +1,31 @@
1
+ const n = {
2
+ javascript: () => import("@codemirror/lang-javascript").then(
3
+ (t) => t.javascript({ jsx: !0 })
4
+ ),
5
+ typescript: () => import("@codemirror/lang-javascript").then(
6
+ (t) => t.javascript({ jsx: !0, typescript: !0 })
7
+ ),
8
+ python: () => import("@codemirror/lang-python").then((t) => t.python()),
9
+ sql: () => import("@codemirror/lang-sql").then((t) => t.sql()),
10
+ yaml: () => import("@codemirror/lang-yaml").then((t) => t.yaml()),
11
+ xml: () => import("@codemirror/lang-xml").then((t) => t.xml()),
12
+ html: () => import("@codemirror/lang-html").then((t) => t.html()),
13
+ css: () => import("@codemirror/lang-css").then((t) => t.css()),
14
+ json: () => import("@codemirror/lang-json").then((t) => t.json()),
15
+ markdown: () => import("@codemirror/lang-markdown").then((t) => t.markdown()),
16
+ bash: () => o(),
17
+ shell: () => o()
18
+ }, o = async () => {
19
+ const [{ StreamLanguage: t }, { shell: r }] = await Promise.all([
20
+ import("@codemirror/language"),
21
+ import("@codemirror/legacy-modes/mode/shell")
22
+ ]);
23
+ return t.define(r);
24
+ }, s = /* @__PURE__ */ new Map(), p = (t) => {
25
+ const r = n[t] ?? n.javascript;
26
+ let e = s.get(t);
27
+ return e || (e = r(), s.set(t, e)), e;
28
+ };
29
+ export {
30
+ p as loadLanguageExtension
31
+ };
@@ -0,0 +1,9 @@
1
+ import { HighlightStyle } from '@codemirror/language';
2
+ import { Extension } from '@codemirror/state';
3
+ /** Editor chrome — gutters, selection, cursor, panels, tooltips. */
4
+ export declare const cureEditorChrome: Extension;
5
+ /** Syntax colors from the DS palette; variables invert in dark mode. */
6
+ export declare const cureHighlightStyle: HighlightStyle;
7
+ /** The DS CodeMirror theme: chrome + syntax highlighting. Light and dark. */
8
+ export declare const cureCodeMirrorTheme: Extension;
9
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/code-editor/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAsB,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAcnD,oEAAoE;AACpE,eAAO,MAAM,gBAAgB,WAgE3B,CAAC;AAEH,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,gBA+C7B,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,EAAE,SAGjC,CAAC"}
@@ -0,0 +1,121 @@
1
+ import { syntaxHighlighting as r, HighlightStyle as a } from "@codemirror/language";
2
+ import { EditorView as t } from "@codemirror/view";
3
+ import { tags as o } from "@lezer/highlight";
4
+ const c = t.theme({
5
+ "&": {
6
+ color: "var(--color-text-primary)",
7
+ backgroundColor: "var(--color-bg-primary)",
8
+ fontSize: "var(--text-sm)"
9
+ },
10
+ ".cm-content": {
11
+ caretColor: "var(--color-fg-brand-primary)",
12
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"
13
+ },
14
+ ".cm-cursor, .cm-dropCursor": {
15
+ borderLeftColor: "var(--color-fg-brand-primary)"
16
+ },
17
+ "&.cm-focused": {
18
+ outline: "none"
19
+ },
20
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, ::selection": {
21
+ backgroundColor: "var(--color-utility-brand-100)"
22
+ },
23
+ ".cm-activeLine": {
24
+ backgroundColor: "var(--color-bg-secondary)"
25
+ },
26
+ ".cm-gutters": {
27
+ backgroundColor: "var(--color-bg-secondary)",
28
+ color: "var(--color-text-quaternary)",
29
+ borderRight: "1px solid var(--color-border-secondary)"
30
+ },
31
+ ".cm-activeLineGutter": {
32
+ backgroundColor: "var(--color-bg-tertiary)",
33
+ color: "var(--color-text-secondary)"
34
+ },
35
+ ".cm-selectionMatch": {
36
+ backgroundColor: "var(--color-utility-brand-50)"
37
+ },
38
+ "&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": {
39
+ backgroundColor: "var(--color-utility-brand-100)",
40
+ outline: "1px solid var(--color-border-brand)"
41
+ },
42
+ ".cm-panels": {
43
+ backgroundColor: "var(--color-bg-secondary)",
44
+ color: "var(--color-text-primary)",
45
+ borderBottom: "1px solid var(--color-border-secondary)"
46
+ },
47
+ ".cm-tooltip": {
48
+ backgroundColor: "var(--color-bg-primary)",
49
+ color: "var(--color-text-primary)",
50
+ border: "1px solid var(--color-border-secondary)",
51
+ borderRadius: "var(--radius-md)"
52
+ },
53
+ ".cm-tooltip-autocomplete ul li[aria-selected]": {
54
+ backgroundColor: "var(--color-bg-brand-primary)",
55
+ color: "var(--color-text-brand-primary)"
56
+ },
57
+ ".cm-placeholder": {
58
+ color: "var(--color-text-placeholder)"
59
+ },
60
+ ".cm-lintRange-error": {
61
+ textDecorationColor: "var(--color-fg-error-primary)"
62
+ },
63
+ ".cm-lintRange-warning": {
64
+ textDecorationColor: "var(--color-fg-warning-primary)"
65
+ }
66
+ }), e = a.define([
67
+ {
68
+ tag: [o.keyword, o.modifier, o.operatorKeyword],
69
+ color: "var(--color-utility-purple-600)"
70
+ },
71
+ {
72
+ tag: [o.string, o.special(o.string)],
73
+ color: "var(--color-utility-success-600)"
74
+ },
75
+ {
76
+ tag: [o.number, o.bool, o.null, o.atom],
77
+ color: "var(--color-utility-orange-600)"
78
+ },
79
+ {
80
+ tag: [o.propertyName, o.attributeName],
81
+ color: "var(--color-utility-blue-600)"
82
+ },
83
+ {
84
+ tag: [o.function(o.variableName), o.function(o.propertyName)],
85
+ color: "var(--color-utility-blue-dark-600)"
86
+ },
87
+ {
88
+ tag: [o.definition(o.variableName), o.className, o.typeName],
89
+ color: "var(--color-utility-indigo-600)"
90
+ },
91
+ {
92
+ tag: [o.comment, o.meta],
93
+ color: "var(--color-text-quaternary)",
94
+ fontStyle: "italic"
95
+ },
96
+ {
97
+ tag: [o.tagName, o.heading],
98
+ color: "var(--color-utility-brand-600)"
99
+ },
100
+ {
101
+ tag: [o.operator, o.punctuation, o.separator],
102
+ color: "var(--color-text-secondary)"
103
+ },
104
+ { tag: [o.regexp, o.escape], color: "var(--color-utility-pink-600)" },
105
+ { tag: o.invalid, color: "var(--color-fg-error-primary)" },
106
+ {
107
+ tag: o.link,
108
+ color: "var(--color-text-brand-secondary)",
109
+ textDecoration: "underline"
110
+ },
111
+ { tag: o.strong, fontWeight: "600" },
112
+ { tag: o.emphasis, fontStyle: "italic" }
113
+ ]), d = [
114
+ c,
115
+ r(e)
116
+ ];
117
+ export {
118
+ d as cureCodeMirrorTheme,
119
+ c as cureEditorChrome,
120
+ e as cureHighlightStyle
121
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Class for rich-text content rendered by the Tiptap editors (and read-only
3
+ * renderings of their output). The styles ship in the DS stylesheet
4
+ * (`styles/editors.css`): headings, lists, blockquote, code, links and data
5
+ * pills from DS typography and color tokens.
6
+ */
7
+ export declare const RICH_TEXT_CONTENT_CLASS = "cure-rich-text";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rich-text/index.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ const t = "cure-rich-text";
2
+ export {
3
+ t as RICH_TEXT_CONTENT_CLASS
4
+ };