@melv1c/ui-kit 0.0.0 → 1.0.1
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 +1 -1
- package/dist/base.css +5 -0
- package/dist/code-editors/index.cjs +200 -0
- package/dist/code-editors/index.cjs.map +1 -0
- package/dist/code-editors/index.d.cts +46 -0
- package/dist/code-editors/index.d.ts +46 -0
- package/dist/code-editors/index.js +197 -0
- package/dist/code-editors/index.js.map +1 -0
- package/dist/index.cjs +1 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -116
- package/dist/index.d.ts +4 -116
- package/dist/index.js +3 -27
- package/dist/index.js.map +1 -1
- package/dist/{rich-text-editor-MOJDWQTI.cjs → rich-text-editor/index.cjs} +5 -5
- package/dist/rich-text-editor/index.cjs.map +1 -0
- package/dist/rich-text-editor/index.d.cts +50 -0
- package/dist/rich-text-editor/index.d.ts +50 -0
- package/dist/{rich-text-editor-JUERRDHQ.js → rich-text-editor/index.js} +5 -5
- package/dist/rich-text-editor/index.js.map +1 -0
- package/package.json +13 -3
- package/dist/chunk-2ZWQNZEN.cjs +0 -63
- package/dist/chunk-2ZWQNZEN.cjs.map +0 -1
- package/dist/chunk-RZJFYAJW.js +0 -60
- package/dist/chunk-RZJFYAJW.js.map +0 -1
- package/dist/code-diff-editor-IT2RMVDC.js +0 -73
- package/dist/code-diff-editor-IT2RMVDC.js.map +0 -1
- package/dist/code-diff-editor-J24VGXHL.cjs +0 -75
- package/dist/code-diff-editor-J24VGXHL.cjs.map +0 -1
- package/dist/code-editor-DK64HVFQ.cjs +0 -84
- package/dist/code-editor-DK64HVFQ.cjs.map +0 -1
- package/dist/code-editor-EJIJXZLN.js +0 -82
- package/dist/code-editor-EJIJXZLN.js.map +0 -1
- package/dist/rich-text-editor-JUERRDHQ.js.map +0 -1
- package/dist/rich-text-editor-MOJDWQTI.cjs.map +0 -1
- package/styles.css +0 -120
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A React component library built with Tailwind CSS and TypeScript.
|
|
|
4
4
|
|
|
5
5
|
## Documentation
|
|
6
6
|
|
|
7
|
-
For detailed usage instructions, installation guides, and component documentation, visit the [online documentation](https://
|
|
7
|
+
For detailed usage instructions, installation guides, and component documentation, visit the [online documentation](https://ui-kit.melvyn.be).
|
|
8
8
|
|
|
9
9
|
## Concept
|
|
10
10
|
|
package/dist/base.css
CHANGED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkQ4GFV3J3_cjs = require('../chunk-Q4GFV3J3.cjs');
|
|
4
|
+
var chunkI7WHASOO_cjs = require('../chunk-I7WHASOO.cjs');
|
|
5
|
+
require('../chunk-Q7SFCCGT.cjs');
|
|
6
|
+
var react$1 = require('@monaco-editor/react');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
|
|
11
|
+
// src/components/optionals/code-editors/qualifio-themes.ts
|
|
12
|
+
async function defineQualifioThemes(monaco) {
|
|
13
|
+
monaco.editor.defineTheme("qualifio", {
|
|
14
|
+
base: "vs",
|
|
15
|
+
inherit: true,
|
|
16
|
+
rules: [],
|
|
17
|
+
colors: {
|
|
18
|
+
"editor.foreground": "#666666",
|
|
19
|
+
"editor.background": "#f8fafb",
|
|
20
|
+
"editor.lineHighlightBackground": "#f8fafb",
|
|
21
|
+
"editorCursor.foreground": "#666666",
|
|
22
|
+
"editorLineNumber.foreground": "#D8D8D8",
|
|
23
|
+
"editorLineNumber.activeForeground": "#D8D8D8",
|
|
24
|
+
"editor.selectionBackground": "#dff5fb",
|
|
25
|
+
"editor.selectionHighlightBackground": "#dff5fb",
|
|
26
|
+
"editor.wordHighlightBackground": "#dff5fb",
|
|
27
|
+
"editor.wordHighlightStrongBackground": "#dff5fb",
|
|
28
|
+
"editor.findMatchBackground": "#FFF7E2",
|
|
29
|
+
"editor.findMatchHighlightBackground": "#FFF7E2",
|
|
30
|
+
"editorBracketMatch.background": "#f2f2f2",
|
|
31
|
+
"editorBracketMatch.border": "#D8D8D8",
|
|
32
|
+
"editorIndentGuide.background": "#D8D8D8",
|
|
33
|
+
"editorIndentGuide.activeBackground": "#666666",
|
|
34
|
+
"editorWidget.background": "#FFFFFF",
|
|
35
|
+
"editorWidget.border": "#D8D8D8",
|
|
36
|
+
"editorSuggestWidget.background": "#FFFFFF",
|
|
37
|
+
"editorSuggestWidget.border": "#D8D8D8",
|
|
38
|
+
"editorSuggestWidget.selectedBackground": "#dff5fb",
|
|
39
|
+
"editorHoverWidget.background": "#FFFFFF",
|
|
40
|
+
"editorHoverWidget.border": "#D8D8D8"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
var codeEditorVariants = classVarianceAuthority.cva(
|
|
45
|
+
"relative overflow-hidden rounded-md border transition-[color,box-shadow] outline-none focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
|
|
46
|
+
{
|
|
47
|
+
variants: {
|
|
48
|
+
variant: {
|
|
49
|
+
default: "border-input bg-transparent dark:bg-input/30",
|
|
50
|
+
ghost: "border-transparent bg-transparent",
|
|
51
|
+
card: "border-border bg-card shadow-sm"
|
|
52
|
+
},
|
|
53
|
+
size: {
|
|
54
|
+
default: "h-[300px]",
|
|
55
|
+
sm: "h-[150px]",
|
|
56
|
+
lg: "h-[500px]"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
variant: "default",
|
|
61
|
+
size: "default"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
function LoadingFallback() {
|
|
66
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkQ4GFV3J3_cjs.Skeleton, { className: "h-full w-full" });
|
|
67
|
+
}
|
|
68
|
+
function CodeDiffEditor({
|
|
69
|
+
original,
|
|
70
|
+
modified,
|
|
71
|
+
language,
|
|
72
|
+
theme = "qualifio",
|
|
73
|
+
readOnly = false,
|
|
74
|
+
disabled = false,
|
|
75
|
+
className,
|
|
76
|
+
variant,
|
|
77
|
+
size,
|
|
78
|
+
onMount,
|
|
79
|
+
options,
|
|
80
|
+
...props
|
|
81
|
+
}) {
|
|
82
|
+
const editorOptions = react.useMemo(
|
|
83
|
+
() => ({
|
|
84
|
+
readOnly: readOnly || disabled,
|
|
85
|
+
fontSize: 14,
|
|
86
|
+
fontFamily: "'Menlo', 'Monaco', Consolas, monospace",
|
|
87
|
+
scrollBeyondLastLine: false,
|
|
88
|
+
automaticLayout: true,
|
|
89
|
+
padding: { top: 12, bottom: 12 },
|
|
90
|
+
renderSideBySide: true,
|
|
91
|
+
enableSplitViewResizing: true,
|
|
92
|
+
...options
|
|
93
|
+
}),
|
|
94
|
+
[readOnly, disabled, options]
|
|
95
|
+
);
|
|
96
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
"data-slot": "code-diff-editor",
|
|
100
|
+
className: chunkI7WHASOO_cjs.cn(
|
|
101
|
+
codeEditorVariants({ variant, size }),
|
|
102
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
103
|
+
className
|
|
104
|
+
),
|
|
105
|
+
...props,
|
|
106
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
107
|
+
react$1.DiffEditor,
|
|
108
|
+
{
|
|
109
|
+
language,
|
|
110
|
+
theme,
|
|
111
|
+
original,
|
|
112
|
+
modified,
|
|
113
|
+
beforeMount: (monaco) => {
|
|
114
|
+
defineQualifioThemes(monaco).catch((error) => {
|
|
115
|
+
console.error("Failed to define Qualifio themes:", error);
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
onMount,
|
|
119
|
+
options: editorOptions,
|
|
120
|
+
loading: /* @__PURE__ */ jsxRuntime.jsx(LoadingFallback, {})
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
function LoadingFallback2() {
|
|
127
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkQ4GFV3J3_cjs.Skeleton, { className: "h-full w-full" });
|
|
128
|
+
}
|
|
129
|
+
function CodeEditor({
|
|
130
|
+
value,
|
|
131
|
+
defaultValue,
|
|
132
|
+
language,
|
|
133
|
+
theme = "qualifio",
|
|
134
|
+
readOnly = false,
|
|
135
|
+
disabled = false,
|
|
136
|
+
lineNumbers = true,
|
|
137
|
+
wordWrap = false,
|
|
138
|
+
minimap = false,
|
|
139
|
+
className,
|
|
140
|
+
variant,
|
|
141
|
+
size,
|
|
142
|
+
onChange,
|
|
143
|
+
onMount,
|
|
144
|
+
onValidate,
|
|
145
|
+
options,
|
|
146
|
+
...props
|
|
147
|
+
}) {
|
|
148
|
+
const editorOptions = react.useMemo(
|
|
149
|
+
() => ({
|
|
150
|
+
readOnly: readOnly || disabled,
|
|
151
|
+
lineNumbers: lineNumbers ? "on" : "off",
|
|
152
|
+
wordWrap: wordWrap ? "on" : "off",
|
|
153
|
+
minimap: { enabled: minimap },
|
|
154
|
+
fontSize: 14,
|
|
155
|
+
fontFamily: "'Menlo', 'Monaco', Consolas, monospace",
|
|
156
|
+
scrollBeyondLastLine: false,
|
|
157
|
+
automaticLayout: true,
|
|
158
|
+
padding: { top: 12, bottom: 12 },
|
|
159
|
+
bracketPairColorization: { enabled: true },
|
|
160
|
+
...options
|
|
161
|
+
}),
|
|
162
|
+
[readOnly, disabled, lineNumbers, wordWrap, minimap, options]
|
|
163
|
+
);
|
|
164
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
"data-slot": "code-editor",
|
|
168
|
+
className: chunkI7WHASOO_cjs.cn(
|
|
169
|
+
codeEditorVariants({ variant, size }),
|
|
170
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
171
|
+
className
|
|
172
|
+
),
|
|
173
|
+
...props,
|
|
174
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
175
|
+
react$1.Editor,
|
|
176
|
+
{
|
|
177
|
+
language,
|
|
178
|
+
theme,
|
|
179
|
+
value,
|
|
180
|
+
defaultValue,
|
|
181
|
+
onChange,
|
|
182
|
+
beforeMount: (monaco) => {
|
|
183
|
+
defineQualifioThemes(monaco).catch((error) => {
|
|
184
|
+
console.error("Failed to define Qualifio themes:", error);
|
|
185
|
+
});
|
|
186
|
+
},
|
|
187
|
+
onMount,
|
|
188
|
+
onValidate,
|
|
189
|
+
options: editorOptions,
|
|
190
|
+
loading: /* @__PURE__ */ jsxRuntime.jsx(LoadingFallback2, {})
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
exports.CodeDiffEditor = CodeDiffEditor;
|
|
198
|
+
exports.CodeEditor = CodeEditor;
|
|
199
|
+
//# sourceMappingURL=index.cjs.map
|
|
200
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/optionals/code-editors/qualifio-themes.ts","../../src/components/optionals/code-editors/variants.ts","../../src/components/optionals/code-editors/code-diff-editor.tsx","../../src/components/optionals/code-editors/code-editor.tsx"],"names":["cva","jsx","Skeleton","useMemo","cn","DiffEditor","LoadingFallback","Editor"],"mappings":";;;;;;;;;;;AAMA,eAAsB,qBAAqB,MAAA,EAAgB;AACzD,EAAA,MAAA,CAAO,MAAA,CAAO,YAAY,UAAA,EAAY;AAAA,IACpC,IAAA,EAAM,IAAA;AAAA,IACN,OAAA,EAAS,IAAA;AAAA,IACT,OAAO,EAAC;AAAA,IACR,MAAA,EAAQ;AAAA,MACN,mBAAA,EAAqB,SAAA;AAAA,MACrB,mBAAA,EAAqB,SAAA;AAAA,MACrB,gCAAA,EAAkC,SAAA;AAAA,MAClC,yBAAA,EAA2B,SAAA;AAAA,MAC3B,6BA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AAA;AAAA,IACA,CAAC,QAAA,EAAU,QAAA,EAAU,WAAA,EAAa,QAAA,EAAU,SAAS,OAAO;AAAA,GAC9D;AAEA,EAAA,uBACEF,cAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAWG,oBAAA;AAAA,QACT,kBAAA,CAAmB,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA;AAAA,QACpC,QAAA,IAAY,+BAAA;AAAA,QACZ;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,QAAA,kBAAAH,cAAAA;AAAA,QAACM,cAAA;AAAA,QAAA;AAAA,UACC,QAAA;AAAA,UACA,KAAA;AAAA,UACA,KAAA;AAAA,UACA,YAAA;AAAA,UACA,QAAA;AAAA,UACA,WAAA,EAAa,CAAC,MAAA,KAAW;AACvB,YAAA,oBAAA,CAAqB,MAAM,CAAA,CAAE,KAAA,CAAM,CAAC,KAAA,KAAU;AAC5C,cAAA,OAAA,CAAQ,KAAA,CAAM,qCAAqC,KAAK,CAAA;AAAA,YAC1D,CAAC,CAAA;AAAA,UACH,CAAA;AAAA,UACA,OAAA;AAAA,UACA,UAAA;AAAA,UACA,OAAA,EAAS,aAAA;AAAA,UACT,OAAA,kBAASN,cAAAA,CAACK,gBAAAA,EAAA,EAAgB;AAAA;AAAA;AAC5B;AAAA,GACF;AAEJ","file":"index.cjs","sourcesContent":["import type { Monaco } from \"@monaco-editor/react\";\n\n/**\n * Defines the Qualifio theme for Monaco Editor\n * This function should be called once when Monaco is loaded\n */\nexport async function defineQualifioThemes(monaco: Monaco) {\n monaco.editor.defineTheme(\"qualifio\", {\n base: \"vs\",\n inherit: true,\n rules: [],\n colors: {\n \"editor.foreground\": \"#666666\",\n \"editor.background\": \"#f8fafb\",\n \"editor.lineHighlightBackground\": \"#f8fafb\",\n \"editorCursor.foreground\": \"#666666\",\n \"editorLineNumber.foreground\": \"#D8D8D8\",\n \"editorLineNumber.activeForeground\": \"#D8D8D8\",\n \"editor.selectionBackground\": \"#dff5fb\",\n \"editor.selectionHighlightBackground\": \"#dff5fb\",\n \"editor.wordHighlightBackground\": \"#dff5fb\",\n \"editor.wordHighlightStrongBackground\": \"#dff5fb\",\n \"editor.findMatchBackground\": \"#FFF7E2\",\n \"editor.findMatchHighlightBackground\": \"#FFF7E2\",\n \"editorBracketMatch.background\": \"#f2f2f2\",\n \"editorBracketMatch.border\": \"#D8D8D8\",\n \"editorIndentGuide.background\": \"#D8D8D8\",\n \"editorIndentGuide.activeBackground\": \"#666666\",\n \"editorWidget.background\": \"#FFFFFF\",\n \"editorWidget.border\": \"#D8D8D8\",\n \"editorSuggestWidget.background\": \"#FFFFFF\",\n \"editorSuggestWidget.border\": \"#D8D8D8\",\n \"editorSuggestWidget.selectedBackground\": \"#dff5fb\",\n \"editorHoverWidget.background\": \"#FFFFFF\",\n \"editorHoverWidget.border\": \"#D8D8D8\",\n },\n });\n}\n","import { cva } from \"class-variance-authority\";\n\nexport const codeEditorVariants = cva(\n \"relative overflow-hidden rounded-md border transition-[color,box-shadow] outline-none focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]\",\n {\n variants: {\n variant: {\n default: \"border-input bg-transparent dark:bg-input/30\",\n ghost: \"border-transparent bg-transparent\",\n card: \"border-border bg-card shadow-sm\",\n },\n size: {\n default: \"h-[300px]\",\n sm: \"h-[150px]\",\n lg: \"h-[500px]\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n","import { Skeleton } from \"@/components/base/skeleton\";\nimport { cn } from \"@/lib/utils\";\nimport {\n DiffEditor,\n type DiffEditorProps,\n type Monaco,\n} from \"@monaco-editor/react\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport type { editor } from \"monaco-editor\";\nimport { type HTMLAttributes, useMemo } from \"react\";\nimport { defineQualifioThemes } from \"./qualifio-themes\";\nimport type { EditorTheme, SupportedLanguage } from \"./types\";\nimport { codeEditorVariants } from \"./variants\";\n\ninterface CodeDiffEditorProps\n extends\n VariantProps<typeof codeEditorVariants>,\n Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n original?: string;\n modified?: string;\n language: SupportedLanguage;\n theme?: EditorTheme;\n readOnly?: boolean;\n disabled?: boolean;\n onMount?: (editor: editor.IStandaloneDiffEditor, monaco: Monaco) => void;\n options?: editor.IDiffEditorConstructionOptions;\n}\n\nfunction LoadingFallback() {\n return <Skeleton className=\"h-full w-full\" />;\n}\n\nfunction CodeDiffEditor({\n original,\n modified,\n language,\n theme = \"qualifio\",\n readOnly = false,\n disabled = false,\n className,\n variant,\n size,\n onMount,\n options,\n ...props\n}: CodeDiffEditorProps) {\n const editorOptions = useMemo(\n () => ({\n readOnly: readOnly || disabled,\n fontSize: 14,\n fontFamily: \"'Menlo', 'Monaco', Consolas, monospace\",\n scrollBeyondLastLine: false,\n automaticLayout: true,\n padding: { top: 12, bottom: 12 },\n renderSideBySide: true,\n enableSplitViewResizing: true,\n ...options,\n }),\n [readOnly, disabled, options],\n );\n\n return (\n <div\n data-slot=\"code-diff-editor\"\n className={cn(\n codeEditorVariants({ variant, size }),\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n <DiffEditor\n language={language}\n theme={theme}\n original={original}\n modified={modified}\n beforeMount={(monaco) => {\n defineQualifioThemes(monaco).catch((error) => {\n console.error(\"Failed to define Qualifio themes:\", error);\n });\n }}\n onMount={onMount}\n options={editorOptions}\n loading={<LoadingFallback />}\n />\n </div>\n );\n}\n\nexport { CodeDiffEditor, type DiffEditorProps };\n","import { Editor, type Monaco } from \"@monaco-editor/react\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport type { editor } from \"monaco-editor\";\nimport { type HTMLAttributes, useMemo } from \"react\";\nimport { Skeleton } from \"@/components/base/skeleton\";\nimport { cn } from \"@/lib/utils\";\nimport { defineQualifioThemes } from \"./qualifio-themes\";\nimport type { EditorTheme, SupportedLanguage } from \"./types\";\nimport { codeEditorVariants } from \"./variants\";\n\ninterface CodeEditorProps\n extends\n VariantProps<typeof codeEditorVariants>,\n Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n value?: string;\n defaultValue?: string;\n language: SupportedLanguage;\n theme?: EditorTheme;\n readOnly?: boolean;\n disabled?: boolean;\n lineNumbers?: boolean;\n wordWrap?: boolean;\n minimap?: boolean;\n onChange?: (value: string | undefined) => void;\n onMount?: (editor: editor.IStandaloneCodeEditor, monaco: Monaco) => void;\n onValidate?: (markers: editor.IMarker[]) => void;\n options?: editor.IStandaloneEditorConstructionOptions;\n}\n\nfunction LoadingFallback() {\n return <Skeleton className=\"h-full w-full\" />;\n}\n\nfunction CodeEditor({\n value,\n defaultValue,\n language,\n theme = \"qualifio\",\n readOnly = false,\n disabled = false,\n lineNumbers = true,\n wordWrap = false,\n minimap = false,\n className,\n variant,\n size,\n onChange,\n onMount,\n onValidate,\n options,\n ...props\n}: CodeEditorProps) {\n const editorOptions = useMemo(\n () => ({\n readOnly: readOnly || disabled,\n lineNumbers: lineNumbers ? (\"on\" as const) : (\"off\" as const),\n wordWrap: wordWrap ? (\"on\" as const) : (\"off\" as const),\n minimap: { enabled: minimap },\n fontSize: 14,\n fontFamily: \"'Menlo', 'Monaco', Consolas, monospace\",\n scrollBeyondLastLine: false,\n automaticLayout: true,\n padding: { top: 12, bottom: 12 },\n bracketPairColorization: { enabled: true },\n ...options,\n }),\n [readOnly, disabled, lineNumbers, wordWrap, minimap, options],\n );\n\n return (\n <div\n data-slot=\"code-editor\"\n className={cn(\n codeEditorVariants({ variant, size }),\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n <Editor\n language={language}\n theme={theme}\n value={value}\n defaultValue={defaultValue}\n onChange={onChange}\n beforeMount={(monaco) => {\n defineQualifioThemes(monaco).catch((error) => {\n console.error(\"Failed to define Qualifio themes:\", error);\n });\n }}\n onMount={onMount}\n onValidate={onValidate}\n options={editorOptions}\n loading={<LoadingFallback />}\n />\n </div>\n );\n}\n\nexport { CodeEditor, type CodeEditorProps };\nexport type { EditorTheme, SupportedLanguage } from \"./types\";\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Monaco } from '@monaco-editor/react';
|
|
3
|
+
export { DiffEditorProps } from '@monaco-editor/react';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { editor } from 'monaco-editor';
|
|
6
|
+
import { HTMLAttributes } from 'react';
|
|
7
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
8
|
+
|
|
9
|
+
type SupportedLanguage = "javascript" | "typescript" | "json" | "html" | "css" | "markdown" | "python" | "sql" | "xml" | "yaml" | "plaintext";
|
|
10
|
+
type EditorTheme = "light" | "vs-dark" | "qualifio";
|
|
11
|
+
|
|
12
|
+
declare const codeEditorVariants: (props?: ({
|
|
13
|
+
variant?: "default" | "ghost" | "card" | null | undefined;
|
|
14
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
15
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
16
|
+
|
|
17
|
+
interface CodeDiffEditorProps extends VariantProps<typeof codeEditorVariants>, Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
18
|
+
original?: string;
|
|
19
|
+
modified?: string;
|
|
20
|
+
language: SupportedLanguage;
|
|
21
|
+
theme?: EditorTheme;
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
onMount?: (editor: editor.IStandaloneDiffEditor, monaco: Monaco) => void;
|
|
25
|
+
options?: editor.IDiffEditorConstructionOptions;
|
|
26
|
+
}
|
|
27
|
+
declare function CodeDiffEditor({ original, modified, language, theme, readOnly, disabled, className, variant, size, onMount, options, ...props }: CodeDiffEditorProps): react_jsx_runtime.JSX.Element;
|
|
28
|
+
|
|
29
|
+
interface CodeEditorProps extends VariantProps<typeof codeEditorVariants>, Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
30
|
+
value?: string;
|
|
31
|
+
defaultValue?: string;
|
|
32
|
+
language: SupportedLanguage;
|
|
33
|
+
theme?: EditorTheme;
|
|
34
|
+
readOnly?: boolean;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
lineNumbers?: boolean;
|
|
37
|
+
wordWrap?: boolean;
|
|
38
|
+
minimap?: boolean;
|
|
39
|
+
onChange?: (value: string | undefined) => void;
|
|
40
|
+
onMount?: (editor: editor.IStandaloneCodeEditor, monaco: Monaco) => void;
|
|
41
|
+
onValidate?: (markers: editor.IMarker[]) => void;
|
|
42
|
+
options?: editor.IStandaloneEditorConstructionOptions;
|
|
43
|
+
}
|
|
44
|
+
declare function CodeEditor({ value, defaultValue, language, theme, readOnly, disabled, lineNumbers, wordWrap, minimap, className, variant, size, onChange, onMount, onValidate, options, ...props }: CodeEditorProps): react_jsx_runtime.JSX.Element;
|
|
45
|
+
|
|
46
|
+
export { CodeDiffEditor, CodeEditor, type CodeEditorProps, type EditorTheme, type SupportedLanguage };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Monaco } from '@monaco-editor/react';
|
|
3
|
+
export { DiffEditorProps } from '@monaco-editor/react';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { editor } from 'monaco-editor';
|
|
6
|
+
import { HTMLAttributes } from 'react';
|
|
7
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
8
|
+
|
|
9
|
+
type SupportedLanguage = "javascript" | "typescript" | "json" | "html" | "css" | "markdown" | "python" | "sql" | "xml" | "yaml" | "plaintext";
|
|
10
|
+
type EditorTheme = "light" | "vs-dark" | "qualifio";
|
|
11
|
+
|
|
12
|
+
declare const codeEditorVariants: (props?: ({
|
|
13
|
+
variant?: "default" | "ghost" | "card" | null | undefined;
|
|
14
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
15
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
16
|
+
|
|
17
|
+
interface CodeDiffEditorProps extends VariantProps<typeof codeEditorVariants>, Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
18
|
+
original?: string;
|
|
19
|
+
modified?: string;
|
|
20
|
+
language: SupportedLanguage;
|
|
21
|
+
theme?: EditorTheme;
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
onMount?: (editor: editor.IStandaloneDiffEditor, monaco: Monaco) => void;
|
|
25
|
+
options?: editor.IDiffEditorConstructionOptions;
|
|
26
|
+
}
|
|
27
|
+
declare function CodeDiffEditor({ original, modified, language, theme, readOnly, disabled, className, variant, size, onMount, options, ...props }: CodeDiffEditorProps): react_jsx_runtime.JSX.Element;
|
|
28
|
+
|
|
29
|
+
interface CodeEditorProps extends VariantProps<typeof codeEditorVariants>, Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
30
|
+
value?: string;
|
|
31
|
+
defaultValue?: string;
|
|
32
|
+
language: SupportedLanguage;
|
|
33
|
+
theme?: EditorTheme;
|
|
34
|
+
readOnly?: boolean;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
lineNumbers?: boolean;
|
|
37
|
+
wordWrap?: boolean;
|
|
38
|
+
minimap?: boolean;
|
|
39
|
+
onChange?: (value: string | undefined) => void;
|
|
40
|
+
onMount?: (editor: editor.IStandaloneCodeEditor, monaco: Monaco) => void;
|
|
41
|
+
onValidate?: (markers: editor.IMarker[]) => void;
|
|
42
|
+
options?: editor.IStandaloneEditorConstructionOptions;
|
|
43
|
+
}
|
|
44
|
+
declare function CodeEditor({ value, defaultValue, language, theme, readOnly, disabled, lineNumbers, wordWrap, minimap, className, variant, size, onChange, onMount, onValidate, options, ...props }: CodeEditorProps): react_jsx_runtime.JSX.Element;
|
|
45
|
+
|
|
46
|
+
export { CodeDiffEditor, CodeEditor, type CodeEditorProps, type EditorTheme, type SupportedLanguage };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { Skeleton } from '../chunk-PYHBC3IQ.js';
|
|
2
|
+
import { cn } from '../chunk-WZ2GOU2J.js';
|
|
3
|
+
import '../chunk-PZ5AY32C.js';
|
|
4
|
+
import { DiffEditor, Editor } from '@monaco-editor/react';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { cva } from 'class-variance-authority';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
// src/components/optionals/code-editors/qualifio-themes.ts
|
|
10
|
+
async function defineQualifioThemes(monaco) {
|
|
11
|
+
monaco.editor.defineTheme("qualifio", {
|
|
12
|
+
base: "vs",
|
|
13
|
+
inherit: true,
|
|
14
|
+
rules: [],
|
|
15
|
+
colors: {
|
|
16
|
+
"editor.foreground": "#666666",
|
|
17
|
+
"editor.background": "#f8fafb",
|
|
18
|
+
"editor.lineHighlightBackground": "#f8fafb",
|
|
19
|
+
"editorCursor.foreground": "#666666",
|
|
20
|
+
"editorLineNumber.foreground": "#D8D8D8",
|
|
21
|
+
"editorLineNumber.activeForeground": "#D8D8D8",
|
|
22
|
+
"editor.selectionBackground": "#dff5fb",
|
|
23
|
+
"editor.selectionHighlightBackground": "#dff5fb",
|
|
24
|
+
"editor.wordHighlightBackground": "#dff5fb",
|
|
25
|
+
"editor.wordHighlightStrongBackground": "#dff5fb",
|
|
26
|
+
"editor.findMatchBackground": "#FFF7E2",
|
|
27
|
+
"editor.findMatchHighlightBackground": "#FFF7E2",
|
|
28
|
+
"editorBracketMatch.background": "#f2f2f2",
|
|
29
|
+
"editorBracketMatch.border": "#D8D8D8",
|
|
30
|
+
"editorIndentGuide.background": "#D8D8D8",
|
|
31
|
+
"editorIndentGuide.activeBackground": "#666666",
|
|
32
|
+
"editorWidget.background": "#FFFFFF",
|
|
33
|
+
"editorWidget.border": "#D8D8D8",
|
|
34
|
+
"editorSuggestWidget.background": "#FFFFFF",
|
|
35
|
+
"editorSuggestWidget.border": "#D8D8D8",
|
|
36
|
+
"editorSuggestWidget.selectedBackground": "#dff5fb",
|
|
37
|
+
"editorHoverWidget.background": "#FFFFFF",
|
|
38
|
+
"editorHoverWidget.border": "#D8D8D8"
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
var codeEditorVariants = cva(
|
|
43
|
+
"relative overflow-hidden rounded-md border transition-[color,box-shadow] outline-none focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
|
|
44
|
+
{
|
|
45
|
+
variants: {
|
|
46
|
+
variant: {
|
|
47
|
+
default: "border-input bg-transparent dark:bg-input/30",
|
|
48
|
+
ghost: "border-transparent bg-transparent",
|
|
49
|
+
card: "border-border bg-card shadow-sm"
|
|
50
|
+
},
|
|
51
|
+
size: {
|
|
52
|
+
default: "h-[300px]",
|
|
53
|
+
sm: "h-[150px]",
|
|
54
|
+
lg: "h-[500px]"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
defaultVariants: {
|
|
58
|
+
variant: "default",
|
|
59
|
+
size: "default"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
function LoadingFallback() {
|
|
64
|
+
return /* @__PURE__ */ jsx(Skeleton, { className: "h-full w-full" });
|
|
65
|
+
}
|
|
66
|
+
function CodeDiffEditor({
|
|
67
|
+
original,
|
|
68
|
+
modified,
|
|
69
|
+
language,
|
|
70
|
+
theme = "qualifio",
|
|
71
|
+
readOnly = false,
|
|
72
|
+
disabled = false,
|
|
73
|
+
className,
|
|
74
|
+
variant,
|
|
75
|
+
size,
|
|
76
|
+
onMount,
|
|
77
|
+
options,
|
|
78
|
+
...props
|
|
79
|
+
}) {
|
|
80
|
+
const editorOptions = useMemo(
|
|
81
|
+
() => ({
|
|
82
|
+
readOnly: readOnly || disabled,
|
|
83
|
+
fontSize: 14,
|
|
84
|
+
fontFamily: "'Menlo', 'Monaco', Consolas, monospace",
|
|
85
|
+
scrollBeyondLastLine: false,
|
|
86
|
+
automaticLayout: true,
|
|
87
|
+
padding: { top: 12, bottom: 12 },
|
|
88
|
+
renderSideBySide: true,
|
|
89
|
+
enableSplitViewResizing: true,
|
|
90
|
+
...options
|
|
91
|
+
}),
|
|
92
|
+
[readOnly, disabled, options]
|
|
93
|
+
);
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
"data-slot": "code-diff-editor",
|
|
98
|
+
className: cn(
|
|
99
|
+
codeEditorVariants({ variant, size }),
|
|
100
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
101
|
+
className
|
|
102
|
+
),
|
|
103
|
+
...props,
|
|
104
|
+
children: /* @__PURE__ */ jsx(
|
|
105
|
+
DiffEditor,
|
|
106
|
+
{
|
|
107
|
+
language,
|
|
108
|
+
theme,
|
|
109
|
+
original,
|
|
110
|
+
modified,
|
|
111
|
+
beforeMount: (monaco) => {
|
|
112
|
+
defineQualifioThemes(monaco).catch((error) => {
|
|
113
|
+
console.error("Failed to define Qualifio themes:", error);
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
onMount,
|
|
117
|
+
options: editorOptions,
|
|
118
|
+
loading: /* @__PURE__ */ jsx(LoadingFallback, {})
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function LoadingFallback2() {
|
|
125
|
+
return /* @__PURE__ */ jsx(Skeleton, { className: "h-full w-full" });
|
|
126
|
+
}
|
|
127
|
+
function CodeEditor({
|
|
128
|
+
value,
|
|
129
|
+
defaultValue,
|
|
130
|
+
language,
|
|
131
|
+
theme = "qualifio",
|
|
132
|
+
readOnly = false,
|
|
133
|
+
disabled = false,
|
|
134
|
+
lineNumbers = true,
|
|
135
|
+
wordWrap = false,
|
|
136
|
+
minimap = false,
|
|
137
|
+
className,
|
|
138
|
+
variant,
|
|
139
|
+
size,
|
|
140
|
+
onChange,
|
|
141
|
+
onMount,
|
|
142
|
+
onValidate,
|
|
143
|
+
options,
|
|
144
|
+
...props
|
|
145
|
+
}) {
|
|
146
|
+
const editorOptions = useMemo(
|
|
147
|
+
() => ({
|
|
148
|
+
readOnly: readOnly || disabled,
|
|
149
|
+
lineNumbers: lineNumbers ? "on" : "off",
|
|
150
|
+
wordWrap: wordWrap ? "on" : "off",
|
|
151
|
+
minimap: { enabled: minimap },
|
|
152
|
+
fontSize: 14,
|
|
153
|
+
fontFamily: "'Menlo', 'Monaco', Consolas, monospace",
|
|
154
|
+
scrollBeyondLastLine: false,
|
|
155
|
+
automaticLayout: true,
|
|
156
|
+
padding: { top: 12, bottom: 12 },
|
|
157
|
+
bracketPairColorization: { enabled: true },
|
|
158
|
+
...options
|
|
159
|
+
}),
|
|
160
|
+
[readOnly, disabled, lineNumbers, wordWrap, minimap, options]
|
|
161
|
+
);
|
|
162
|
+
return /* @__PURE__ */ jsx(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
"data-slot": "code-editor",
|
|
166
|
+
className: cn(
|
|
167
|
+
codeEditorVariants({ variant, size }),
|
|
168
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
169
|
+
className
|
|
170
|
+
),
|
|
171
|
+
...props,
|
|
172
|
+
children: /* @__PURE__ */ jsx(
|
|
173
|
+
Editor,
|
|
174
|
+
{
|
|
175
|
+
language,
|
|
176
|
+
theme,
|
|
177
|
+
value,
|
|
178
|
+
defaultValue,
|
|
179
|
+
onChange,
|
|
180
|
+
beforeMount: (monaco) => {
|
|
181
|
+
defineQualifioThemes(monaco).catch((error) => {
|
|
182
|
+
console.error("Failed to define Qualifio themes:", error);
|
|
183
|
+
});
|
|
184
|
+
},
|
|
185
|
+
onMount,
|
|
186
|
+
onValidate,
|
|
187
|
+
options: editorOptions,
|
|
188
|
+
loading: /* @__PURE__ */ jsx(LoadingFallback2, {})
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export { CodeDiffEditor, CodeEditor };
|
|
196
|
+
//# sourceMappingURL=index.js.map
|
|
197
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/optionals/code-editors/qualifio-themes.ts","../../src/components/optionals/code-editors/variants.ts","../../src/components/optionals/code-editors/code-diff-editor.tsx","../../src/components/optionals/code-editors/code-editor.tsx"],"names":["LoadingFallback","jsx","useMemo"],"mappings":";;;;;;;;;AAMA,eAAsB,qBAAqB,MAAA,EAAgB;AACzD,EAAA,MAAA,CAAO,MAAA,CAAO,YAAY,UAAA,EAAY;AAAA,IACpC,IAAA,EAAM,IAAA;AAAA,IACN,OAAA,EAAS,IAAA;AAAA,IACT,OAAO,EAAC;AAAA,IACR,MAAA,EAAQ;AAAA,MACN,mBAAA,EAAqB,SAAA;AAAA,MACrB,mBAAA,EAAqB,SAAA;AAAA,MACrB,gCAAA,EAAkC,SAAA;AAAA,MAClC,yBAAA,EAA2B,SAAA;AAAA,MAC3B,6BAAA,EAA+B,SAAA;AAAA,MAC/B,mCAAA,EAAqC,SAAA;AAAA,MACrC,4BAAA,EAA8B,SAAA;AAAA,MAC9B,qCAAA,EAAuC,SAAA;AAAA,MACvC,gCAAA,EAAkC,SAAA;AAAA,MAClC,sCAAA,EAAwC,SAAA;AAAA,MACxC,4BAAA,EAA8B,SAAA;AAAA,MAC9B,qCAAA,EAAuC,SAAA;AAAA,MACvC,+BAAA,EAAiC,SAAA;AAAA,MACjC,2BAAA,EAA6B,SAAA;AAAA,MAC7B,8BAAA,EAAgC,SAAA;AAAA,MAChC,oCAAA,EAAsC,SAAA;AAAA,MACtC,yBAAA,EAA2B,SAAA;AAAA,MAC3B,qBAAA,EAAuB,SAAA;AAAA,MACvB,gCAAA,EAAkC,SAAA;AAAA,MAClC,4BAAA,EAA8B,SAAA;AAAA,MAC9B,wCAAA,EAA0C,SAAA;AAAA,MAC1C,8BAAA,EAA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KAAA,CAAM,CAAC,KAAA,KAAU;AAC5C,cAAA,OAAA,CAAQ,KAAA,CAAM,qCAAqC,KAAK,CAAA;AAAA,YAC1D,CAAC,CAAA;AAAA,UACH,CAAA;AAAA,UACA,OAAA;AAAA,UACA,UAAA;AAAA,UACA,OAAA,EAAS,aAAA;AAAA,UACT,OAAA,kBAASA,GAAAA,CAACD,gBAAAA,EAAA,EAAgB;AAAA;AAAA;AAC5B;AAAA,GACF;AAEJ","file":"index.js","sourcesContent":["import type { Monaco } from \"@monaco-editor/react\";\n\n/**\n * Defines the Qualifio theme for Monaco Editor\n * This function should be called once when Monaco is loaded\n */\nexport async function defineQualifioThemes(monaco: Monaco) {\n monaco.editor.defineTheme(\"qualifio\", {\n base: \"vs\",\n inherit: true,\n rules: [],\n colors: {\n \"editor.foreground\": \"#666666\",\n \"editor.background\": \"#f8fafb\",\n \"editor.lineHighlightBackground\": \"#f8fafb\",\n \"editorCursor.foreground\": \"#666666\",\n \"editorLineNumber.foreground\": \"#D8D8D8\",\n \"editorLineNumber.activeForeground\": \"#D8D8D8\",\n \"editor.selectionBackground\": \"#dff5fb\",\n \"editor.selectionHighlightBackground\": \"#dff5fb\",\n \"editor.wordHighlightBackground\": \"#dff5fb\",\n \"editor.wordHighlightStrongBackground\": \"#dff5fb\",\n \"editor.findMatchBackground\": \"#FFF7E2\",\n \"editor.findMatchHighlightBackground\": \"#FFF7E2\",\n \"editorBracketMatch.background\": \"#f2f2f2\",\n \"editorBracketMatch.border\": \"#D8D8D8\",\n \"editorIndentGuide.background\": \"#D8D8D8\",\n \"editorIndentGuide.activeBackground\": \"#666666\",\n \"editorWidget.background\": \"#FFFFFF\",\n \"editorWidget.border\": \"#D8D8D8\",\n \"editorSuggestWidget.background\": \"#FFFFFF\",\n \"editorSuggestWidget.border\": \"#D8D8D8\",\n \"editorSuggestWidget.selectedBackground\": \"#dff5fb\",\n \"editorHoverWidget.background\": \"#FFFFFF\",\n \"editorHoverWidget.border\": \"#D8D8D8\",\n },\n });\n}\n","import { cva } from \"class-variance-authority\";\n\nexport const codeEditorVariants = cva(\n \"relative overflow-hidden rounded-md border transition-[color,box-shadow] outline-none focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]\",\n {\n variants: {\n variant: {\n default: \"border-input bg-transparent dark:bg-input/30\",\n ghost: \"border-transparent bg-transparent\",\n card: \"border-border bg-card shadow-sm\",\n },\n size: {\n default: \"h-[300px]\",\n sm: \"h-[150px]\",\n lg: \"h-[500px]\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n","import { Skeleton } from \"@/components/base/skeleton\";\nimport { cn } from \"@/lib/utils\";\nimport {\n DiffEditor,\n type DiffEditorProps,\n type Monaco,\n} from \"@monaco-editor/react\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport type { editor } from \"monaco-editor\";\nimport { type HTMLAttributes, useMemo } from \"react\";\nimport { defineQualifioThemes } from \"./qualifio-themes\";\nimport type { EditorTheme, SupportedLanguage } from \"./types\";\nimport { codeEditorVariants } from \"./variants\";\n\ninterface CodeDiffEditorProps\n extends\n VariantProps<typeof codeEditorVariants>,\n Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n original?: string;\n modified?: string;\n language: SupportedLanguage;\n theme?: EditorTheme;\n readOnly?: boolean;\n disabled?: boolean;\n onMount?: (editor: editor.IStandaloneDiffEditor, monaco: Monaco) => void;\n options?: editor.IDiffEditorConstructionOptions;\n}\n\nfunction LoadingFallback() {\n return <Skeleton className=\"h-full w-full\" />;\n}\n\nfunction CodeDiffEditor({\n original,\n modified,\n language,\n theme = \"qualifio\",\n readOnly = false,\n disabled = false,\n className,\n variant,\n size,\n onMount,\n options,\n ...props\n}: CodeDiffEditorProps) {\n const editorOptions = useMemo(\n () => ({\n readOnly: readOnly || disabled,\n fontSize: 14,\n fontFamily: \"'Menlo', 'Monaco', Consolas, monospace\",\n scrollBeyondLastLine: false,\n automaticLayout: true,\n padding: { top: 12, bottom: 12 },\n renderSideBySide: true,\n enableSplitViewResizing: true,\n ...options,\n }),\n [readOnly, disabled, options],\n );\n\n return (\n <div\n data-slot=\"code-diff-editor\"\n className={cn(\n codeEditorVariants({ variant, size }),\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n <DiffEditor\n language={language}\n theme={theme}\n original={original}\n modified={modified}\n beforeMount={(monaco) => {\n defineQualifioThemes(monaco).catch((error) => {\n console.error(\"Failed to define Qualifio themes:\", error);\n });\n }}\n onMount={onMount}\n options={editorOptions}\n loading={<LoadingFallback />}\n />\n </div>\n );\n}\n\nexport { CodeDiffEditor, type DiffEditorProps };\n","import { Editor, type Monaco } from \"@monaco-editor/react\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport type { editor } from \"monaco-editor\";\nimport { type HTMLAttributes, useMemo } from \"react\";\nimport { Skeleton } from \"@/components/base/skeleton\";\nimport { cn } from \"@/lib/utils\";\nimport { defineQualifioThemes } from \"./qualifio-themes\";\nimport type { EditorTheme, SupportedLanguage } from \"./types\";\nimport { codeEditorVariants } from \"./variants\";\n\ninterface CodeEditorProps\n extends\n VariantProps<typeof codeEditorVariants>,\n Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n value?: string;\n defaultValue?: string;\n language: SupportedLanguage;\n theme?: EditorTheme;\n readOnly?: boolean;\n disabled?: boolean;\n lineNumbers?: boolean;\n wordWrap?: boolean;\n minimap?: boolean;\n onChange?: (value: string | undefined) => void;\n onMount?: (editor: editor.IStandaloneCodeEditor, monaco: Monaco) => void;\n onValidate?: (markers: editor.IMarker[]) => void;\n options?: editor.IStandaloneEditorConstructionOptions;\n}\n\nfunction LoadingFallback() {\n return <Skeleton className=\"h-full w-full\" />;\n}\n\nfunction CodeEditor({\n value,\n defaultValue,\n language,\n theme = \"qualifio\",\n readOnly = false,\n disabled = false,\n lineNumbers = true,\n wordWrap = false,\n minimap = false,\n className,\n variant,\n size,\n onChange,\n onMount,\n onValidate,\n options,\n ...props\n}: CodeEditorProps) {\n const editorOptions = useMemo(\n () => ({\n readOnly: readOnly || disabled,\n lineNumbers: lineNumbers ? (\"on\" as const) : (\"off\" as const),\n wordWrap: wordWrap ? (\"on\" as const) : (\"off\" as const),\n minimap: { enabled: minimap },\n fontSize: 14,\n fontFamily: \"'Menlo', 'Monaco', Consolas, monospace\",\n scrollBeyondLastLine: false,\n automaticLayout: true,\n padding: { top: 12, bottom: 12 },\n bracketPairColorization: { enabled: true },\n ...options,\n }),\n [readOnly, disabled, lineNumbers, wordWrap, minimap, options],\n );\n\n return (\n <div\n data-slot=\"code-editor\"\n className={cn(\n codeEditorVariants({ variant, size }),\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n <Editor\n language={language}\n theme={theme}\n value={value}\n defaultValue={defaultValue}\n onChange={onChange}\n beforeMount={(monaco) => {\n defineQualifioThemes(monaco).catch((error) => {\n console.error(\"Failed to define Qualifio themes:\", error);\n });\n }}\n onMount={onMount}\n onValidate={onValidate}\n options={editorOptions}\n loading={<LoadingFallback />}\n />\n </div>\n );\n}\n\nexport { CodeEditor, type CodeEditorProps };\nexport type { EditorTheme, SupportedLanguage } from \"./types\";\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkQV4CTFLS_cjs = require('./chunk-QV4CTFLS.cjs');
|
|
4
3
|
var chunkQ4GFV3J3_cjs = require('./chunk-Q4GFV3J3.cjs');
|
|
5
4
|
var chunkGQ6Z5A4R_cjs = require('./chunk-GQ6Z5A4R.cjs');
|
|
6
5
|
var chunkI7WHASOO_cjs = require('./chunk-I7WHASOO.cjs');
|
|
6
|
+
var chunkQV4CTFLS_cjs = require('./chunk-QV4CTFLS.cjs');
|
|
7
7
|
require('./chunk-Q7SFCCGT.cjs');
|
|
8
8
|
var React9 = require('react');
|
|
9
9
|
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
@@ -3882,30 +3882,6 @@ function TranslationProvider({
|
|
|
3882
3882
|
}
|
|
3883
3883
|
return /* @__PURE__ */ jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: i18n2, children });
|
|
3884
3884
|
}
|
|
3885
|
-
var CodeEditorInternal = React9.lazy(
|
|
3886
|
-
() => import('./code-editor-DK64HVFQ.cjs').then((m) => ({ default: m.CodeEditor }))
|
|
3887
|
-
);
|
|
3888
|
-
var CodeDiffEditorInternal = React9.lazy(
|
|
3889
|
-
() => import('./code-diff-editor-J24VGXHL.cjs').then((m) => ({ default: m.CodeDiffEditor }))
|
|
3890
|
-
);
|
|
3891
|
-
function EditorSkeleton() {
|
|
3892
|
-
return /* @__PURE__ */ jsxRuntime.jsx(chunkQ4GFV3J3_cjs.Skeleton, { className: "h-full w-full min-h-50" });
|
|
3893
|
-
}
|
|
3894
|
-
function LazyCodeEditor(props) {
|
|
3895
|
-
return /* @__PURE__ */ jsxRuntime.jsx(React9.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(EditorSkeleton, {}), children: /* @__PURE__ */ jsxRuntime.jsx(CodeEditorInternal, { ...props }) });
|
|
3896
|
-
}
|
|
3897
|
-
function LazyCodeDiffEditor(props) {
|
|
3898
|
-
return /* @__PURE__ */ jsxRuntime.jsx(React9.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(EditorSkeleton, {}), children: /* @__PURE__ */ jsxRuntime.jsx(CodeDiffEditorInternal, { ...props }) });
|
|
3899
|
-
}
|
|
3900
|
-
var RichTextEditorInternal = React9.lazy(
|
|
3901
|
-
() => import('./rich-text-editor-MOJDWQTI.cjs').then((m) => ({ default: m.RichTextEditor }))
|
|
3902
|
-
);
|
|
3903
|
-
function EditorSkeleton2() {
|
|
3904
|
-
return /* @__PURE__ */ jsxRuntime.jsx(chunkQ4GFV3J3_cjs.Skeleton, { className: "h-full w-full min-h-[100px]" });
|
|
3905
|
-
}
|
|
3906
|
-
function LazyRichTextEditor(props) {
|
|
3907
|
-
return /* @__PURE__ */ jsxRuntime.jsx(React9.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(EditorSkeleton2, {}), children: /* @__PURE__ */ jsxRuntime.jsx(RichTextEditorInternal, { ...props }) });
|
|
3908
|
-
}
|
|
3909
3885
|
|
|
3910
3886
|
Object.defineProperty(exports, "Skeleton", {
|
|
3911
3887
|
enumerable: true,
|
|
@@ -4010,8 +3986,6 @@ exports.CarouselItem = CarouselItem;
|
|
|
4010
3986
|
exports.CarouselNext = CarouselNext;
|
|
4011
3987
|
exports.CarouselPrevious = CarouselPrevious;
|
|
4012
3988
|
exports.Checkbox = Checkbox;
|
|
4013
|
-
exports.CodeDiffEditor = LazyCodeDiffEditor;
|
|
4014
|
-
exports.CodeEditor = LazyCodeEditor;
|
|
4015
3989
|
exports.Collapsible = Collapsible;
|
|
4016
3990
|
exports.CollapsibleContent = CollapsibleContent2;
|
|
4017
3991
|
exports.CollapsibleTrigger = CollapsibleTrigger2;
|
|
@@ -4122,7 +4096,6 @@ exports.PreviousButton = PreviousButton;
|
|
|
4122
4096
|
exports.Progress = Progress;
|
|
4123
4097
|
exports.RadioGroup = RadioGroup4;
|
|
4124
4098
|
exports.RadioGroupItem = RadioGroupItem;
|
|
4125
|
-
exports.RichTextEditor = LazyRichTextEditor;
|
|
4126
4099
|
exports.ScrollArea = ScrollArea;
|
|
4127
4100
|
exports.ScrollBar = ScrollBar;
|
|
4128
4101
|
exports.Select = Select;
|