@react-fabric/monaco 1.0.0-beta.9 → 1.0.2

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.
@@ -1,30 +1,50 @@
1
1
  import { type RefProp } from "@react-fabric/core/dist/types/types";
2
+ import * as monacoEditor from "monaco-editor";
2
3
  export interface MonacoEditorRef {
4
+ focus: () => void;
3
5
  validate: () => boolean;
4
6
  getValue: () => string | undefined;
7
+ addAction?: monacoEditor.editor.IStandaloneCodeEditor["addAction"];
8
+ addCommand?: monacoEditor.editor.IStandaloneCodeEditor["addCommand"];
9
+ executeCommand?: monacoEditor.editor.IStandaloneCodeEditor["executeCommand"];
10
+ setModel?: monacoEditor.editor.IStandaloneCodeEditor["setModel"];
5
11
  }
6
12
  export interface BaseEditorProps {
7
- value?: string | AnyObject;
13
+ value?: string;
8
14
  required?: boolean;
9
15
  readOnly?: boolean;
10
16
  minimal?: boolean;
11
- language?: "json" | "css" | "html" | "text" | "markdown";
12
17
  onChange?: (value: string) => void;
13
- }
14
- type EditorProps = BaseEditorProps & ({
15
- language: "json";
18
+ language?: "css" | "text" | "markdown" | "yaml" | "xml" | "json" | "html";
16
19
  schema?: Array<{
17
20
  uri: string;
18
21
  schema: KeyValue;
19
22
  }>;
20
- handlebarSuggestions?: never;
21
- } | {
22
- language: "html";
23
- schema?: never;
24
23
  handlebarSuggestions?: Array<{
25
24
  text: string;
26
25
  description?: string;
27
26
  }>;
28
- });
29
- export declare const CodeEditor: ({ ref, value, schema, handlebarSuggestions, required, readOnly, minimal, onChange, language, }: EditorProps & RefProp<MonacoEditorRef>) => import("react/jsx-runtime").JSX.Element;
30
- export {};
27
+ }
28
+ /**
29
+ * CodeEditor component to render a code editor using Monaco Editor.
30
+ * It supports JSON and HTML languages with optional schema validation and handlebar suggestions.
31
+ * The editor can be configured to be read-only, minimal, and can handle changes in the code.
32
+ * It provides a ref to access the editor's value and validation methods.
33
+ *
34
+ * @example
35
+ * ```jsx
36
+ * <CodeEditor
37
+ * value={initialValue}
38
+ * schema={[{ uri: "http://example.com/schema.json", schema: {} }]}
39
+ * handlebarSuggestions={[{ text: "example", description: "An example suggestion" }]}
40
+ * required={true}
41
+ * readOnly={false}
42
+ * minimal={false}
43
+ * onChange={(value) => console.log("Code changed:", value)}
44
+ * language="json"
45
+ * />
46
+ * ```
47
+ *
48
+ * @see {@link https://microsoft.github.io/monaco-editor/}
49
+ */
50
+ export declare function CodeEditor({ ref, value, schema, handlebarSuggestions, required, readOnly, minimal, onChange, language, }: BaseEditorProps & RefProp<MonacoEditorRef>): import("react").JSX.Element;
@@ -1 +1,27 @@
1
+ /**
2
+ * React Fabric
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2024 Adarsh Pastakia
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ export declare const MONACO_PACKAGE = "@react-fabric/monaco";
26
+ export declare const MONACO_VERSION = "1.0.0";
1
27
  export { CodeEditor } from "./components/CodeEditor";
package/package.json CHANGED
@@ -1,19 +1,21 @@
1
1
  {
2
2
  "name": "@react-fabric/monaco",
3
- "version": "1.0.0-beta.9",
3
+ "version": "1.0.2",
4
4
  "description": "RUF: Monaco editor",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
7
- "repository": "https://github.com/adarshpastakia/react-ui-framework/tree/main/packages/monaco",
7
+ "repository": "https://github.com/adarshpastakia/react-fabric/tree/main/packages/monaco",
8
8
  "source": "src/index.ts",
9
9
  "main": "dist/cjs/index.js",
10
10
  "module": "dist/esm/index.js",
11
11
  "types": "dist/types/index.d.ts",
12
12
  "directories": {
13
13
  "src": "src",
14
+ "styles": "css",
14
15
  "test": "tests"
15
16
  },
16
17
  "files": [
18
+ "css",
17
19
  "src",
18
20
  "dist"
19
21
  ],
@@ -22,8 +24,6 @@
22
24
  "registry": "https://registry.npmjs.org/"
23
25
  },
24
26
  "scripts": {
25
- "makelink": "yarn link",
26
- "removelink": "yarn unlink",
27
27
  "prebuild": "rm -rf ./dist",
28
28
  "build:dts": "tsc -p ./tsconfig.build.json",
29
29
  "build:rollup": "rollup -c ../../rollup.config.mjs",
@@ -33,21 +33,21 @@
33
33
  "watch": "npm-run-all -p watch:rollup watch:dts"
34
34
  },
35
35
  "dependencies": {
36
- "@react-fabric/core": "^1.0.0-beta.9",
37
- "@react-fabric/utilities": "^1.0.0-beta.9",
38
- "classnames": "^2.5.1",
39
- "monaco-editor": "^0.52.0",
40
- "react-monaco-editor": "^0.56.2"
36
+ "@monaco-editor/react": "~4.7.0",
37
+ "@react-fabric/core": "^1.0.2",
38
+ "@react-fabric/utilities": "^1.0.2",
39
+ "axios": "1.20.0",
40
+ "monaco-editor": "^0.57.0"
41
41
  },
42
42
  "peerDependencies": {
43
- "i18next": "^23.15.1",
44
- "react": ">=18.0.0 <20.0.0",
45
- "react-dom": ">=18.0.0 <20.0.0",
46
- "react-i18next": "^15.0.2"
43
+ "i18next": "~26.3.6",
44
+ "react": "~19.3.0",
45
+ "react-dom": "~19.3.0",
46
+ "react-i18next": "~17.0.11"
47
47
  },
48
48
  "engines": {
49
- "node": ">=18.12.0",
50
- "npm": ">=8.19.0"
49
+ "node": ">=24.0.0",
50
+ "npm": ">=11.0.0"
51
51
  },
52
- "gitHead": "3dde23444bcebf68c30198af5c2fef55572da38f"
52
+ "gitHead": "b9fc477b5b3a13b782977bf17762027f376ac30e"
53
53
  }
@@ -21,61 +21,79 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import {
25
- Section,
26
- useDebounce,
27
- useIsDark,
28
- useResizeObserver,
29
- } from "@react-fabric/core";
24
+ import MonacoEditor from "@monaco-editor/react";
25
+ import { Layout, useApplicationContext, useDebounce, useResizeObserver } from "@react-fabric/core";
30
26
  import { type RefProp } from "@react-fabric/core/dist/types/types";
31
- import { isEmpty, isString } from "@react-fabric/utilities";
32
- import classNames from "classnames";
33
- import type monacoEditor from "monaco-editor";
34
- import {
35
- useCallback,
36
- useDeferredValue,
37
- useImperativeHandle,
38
- useLayoutEffect,
39
- useMemo,
40
- useRef,
41
- useState,
42
- } from "react";
43
- import MonacoEditor from "react-monaco-editor";
44
- import classes from "./CodeEditor.module.css";
27
+ import { cn, isEmpty, isString } from "@react-fabric/utilities";
28
+ import * as monacoEditor from "monaco-editor";
29
+ import { useCallback, useDeferredValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
45
30
 
46
31
  export interface MonacoEditorRef {
32
+ focus: () => void;
47
33
  validate: () => boolean;
48
34
  getValue: () => string | undefined;
35
+
36
+ addAction?: monacoEditor.editor.IStandaloneCodeEditor["addAction"];
37
+ addCommand?: monacoEditor.editor.IStandaloneCodeEditor["addCommand"];
38
+ executeCommand?: monacoEditor.editor.IStandaloneCodeEditor["executeCommand"];
39
+ setModel?: monacoEditor.editor.IStandaloneCodeEditor["setModel"];
49
40
  }
50
41
 
51
42
  export interface BaseEditorProps {
52
- value?: string | AnyObject;
43
+ value?: string;
53
44
 
54
45
  required?: boolean;
55
46
  readOnly?: boolean;
56
47
 
57
48
  minimal?: boolean;
58
49
 
59
- language?: "json" | "css" | "html" | "text" | "markdown";
60
-
61
50
  onChange?: (value: string) => void;
51
+
52
+ language?: "css" | "text" | "markdown" | "yaml" | "xml" | "json" | "html";
53
+ schema?: Array<{ uri: string; schema: KeyValue }>;
54
+ handlebarSuggestions?: Array<{ text: string; description?: string }>;
62
55
  }
63
56
 
64
- type EditorProps = BaseEditorProps &
65
- (
66
- | {
67
- language: "json";
68
- schema?: Array<{ uri: string; schema: KeyValue }>;
69
- handlebarSuggestions?: never;
70
- }
71
- | {
72
- language: "html";
73
- schema?: never;
74
- handlebarSuggestions?: Array<{ text: string; description?: string }>;
75
- }
76
- );
57
+ monacoEditor.editor.defineTheme("my-light", {
58
+ base: "vs", // can also be 'vs' or 'hc-black'
59
+ inherit: true, // set to false to completely replace the builtin rules
60
+ rules: [],
61
+ colors: {
62
+ "minimap.background": "#8881",
63
+ },
64
+ });
65
+ monacoEditor.editor.defineTheme("my-dark", {
66
+ base: "vs-dark", // can also be 'vs' or 'hc-black'
67
+ inherit: true, // set to false to completely replace the builtin rules
68
+ rules: [],
69
+ colors: {
70
+ "minimap.background": "#8881",
71
+ },
72
+ });
77
73
 
78
- export const CodeEditor = ({
74
+ /**
75
+ * CodeEditor component to render a code editor using Monaco Editor.
76
+ * It supports JSON and HTML languages with optional schema validation and handlebar suggestions.
77
+ * The editor can be configured to be read-only, minimal, and can handle changes in the code.
78
+ * It provides a ref to access the editor's value and validation methods.
79
+ *
80
+ * @example
81
+ * ```jsx
82
+ * <CodeEditor
83
+ * value={initialValue}
84
+ * schema={[{ uri: "http://example.com/schema.json", schema: {} }]}
85
+ * handlebarSuggestions={[{ text: "example", description: "An example suggestion" }]}
86
+ * required={true}
87
+ * readOnly={false}
88
+ * minimal={false}
89
+ * onChange={(value) => console.log("Code changed:", value)}
90
+ * language="json"
91
+ * />
92
+ * ```
93
+ *
94
+ * @see {@link https://microsoft.github.io/monaco-editor/}
95
+ */
96
+ export function CodeEditor({
79
97
  ref,
80
98
  value,
81
99
  schema,
@@ -85,43 +103,34 @@ export const CodeEditor = ({
85
103
  minimal,
86
104
  onChange,
87
105
  language = "json",
88
- }: EditorProps & RefProp<MonacoEditorRef>) => {
89
- const [editorRef, setEditorRef] = useState<AnyObject>();
90
- const [monacoRef, setMonacoRef] = useState<typeof monacoEditor>();
91
- const isDark = useIsDark();
106
+ }: BaseEditorProps & RefProp<MonacoEditorRef>) {
107
+ const [editorRef, setEditorRef] = useState<monacoEditor.editor.IStandaloneCodeEditor>();
108
+ const monacoRef = useRef<typeof monacoEditor>(null);
109
+ const { isDark } = useApplicationContext();
92
110
 
93
111
  /** ***************** watch theme change *******************/
94
112
  const [theme, setTheme] = useState("");
95
113
  useLayoutEffect(() => {
96
- editorRef && setTheme(isDark ? "vs-dark" : "light");
97
- }, [isDark, editorRef]);
114
+ // eslint-disable-next-line @eslint-react/set-state-in-effect
115
+ setTheme(isDark ? "my-dark" : "my-light");
116
+ }, [isDark]);
98
117
 
99
118
  /** ***************** watch editor container resize *******************/
100
- const resizeHandler = useCallback(
101
- (size: AnyObject) => editorRef?.layout(size),
102
- [editorRef],
103
- );
119
+ const resizeHandler = useCallback((size: monacoEditor.editor.IDimension) => editorRef?.layout(size), [editorRef]);
104
120
  const containerRef = useResizeObserver(resizeHandler);
105
121
 
106
122
  /** ***************** defer value and pass to editor as defaultValue *******************/
107
123
  const deferredValue = useDeferredValue(value);
108
- const codeValue = useMemo(
109
- () =>
110
- isString(deferredValue)
111
- ? deferredValue
112
- : JSON.stringify(deferredValue, null, 4),
113
- [deferredValue],
114
- );
124
+ const codeValue = useMemo(() => (isString(deferredValue) ? deferredValue : JSON.stringify(deferredValue, null, 4)), [deferredValue]);
115
125
 
116
126
  const handleChange = useDebounce(
117
127
  (value: string) => {
118
128
  const model = editorRef?.getModel();
119
129
  if (model) {
120
- const markers = monacoRef?.editor.getModelMarkers({
130
+ const markers = monacoRef.current?.editor.getModelMarkers({
121
131
  owner: model.getLanguageId(),
122
132
  });
123
- markers?.filter((m) => m.severity > 7).length === 0 &&
124
- onChange?.(value);
133
+ if (markers?.filter((m) => m.severity === monacoEditor.MarkerSeverity.Error).length === 0) onChange?.(value);
125
134
  }
126
135
  },
127
136
  [onChange, editorRef],
@@ -131,36 +140,43 @@ export const CodeEditor = ({
131
140
  useImperativeHandle(
132
141
  ref,
133
142
  () => ({
143
+ addAction: editorRef?.addAction.bind(editorRef),
144
+ addCommand: editorRef?.addCommand.bind(editorRef),
145
+ executeCommand: editorRef?.executeCommand.bind(editorRef),
146
+ setModel: editorRef?.setModel.bind(editorRef),
147
+ focus() {
148
+ editorRef?.focus();
149
+ },
134
150
  getValue() {
135
151
  return editorRef?.getValue();
136
152
  },
137
153
  validate() {
138
154
  const model = editorRef?.getModel();
139
155
  if (model) {
140
- const markers = monacoRef?.editor.getModelMarkers({
156
+ const markers = monacoRef.current?.editor.getModelMarkers({
141
157
  owner: model.getLanguageId(),
142
158
  });
143
- return markers?.filter((m) => m.severity > 8).length === 0;
159
+ return markers?.filter((m) => m.severity === monacoEditor.MarkerSeverity.Error).length === 0;
144
160
  }
145
161
  try {
146
162
  let val = editorRef?.getValue();
147
- if (language === "json") val = JSON.parse(val);
163
+ if (language === "json") val = JSON.parse(val ?? "{}") as never;
148
164
  return required ? !isEmpty(val) : true;
149
165
  } catch {
150
166
  return false;
151
167
  }
152
168
  },
153
169
  }),
154
- [required, language],
170
+ [editorRef, language, required],
155
171
  );
156
172
 
157
- const disposeRef = useRef<AnyObject>();
173
+ const disposeRef = useRef<monacoEditor.IDisposable>(null);
158
174
  const schemaUri = useCallback(
159
175
  (monaco: typeof monacoEditor) => {
160
176
  if (language === "json" && schema) {
161
- const [main, ...rest] = schema;
177
+ const [main, ...rest] = schema as Array<{ uri: string; schema: KeyValue }>;
162
178
  // configure the JSON language support with schemas and schema associations
163
- monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
179
+ monaco?.json?.jsonDefaults.setDiagnosticsOptions({
164
180
  validate: true,
165
181
  allowComments: false,
166
182
  schemas: [
@@ -174,48 +190,45 @@ export const CodeEditor = ({
174
190
  }
175
191
  if (language === "html" && handlebarSuggestions) {
176
192
  disposeRef.current?.dispose?.();
177
- disposeRef.current = monaco.languages.registerCompletionItemProvider(
178
- "html",
179
- {
180
- triggerCharacters: ["{{"],
181
- provideCompletionItems: function (model, position) {
182
- // find out if we are completing a property in the 'dependencies' object.
183
- const textUntilPosition = model.getValueInRange({
184
- startLineNumber: 1,
185
- startColumn: 1,
186
- endLineNumber: position.lineNumber,
187
- endColumn: position.column,
188
- });
189
- const match = textUntilPosition.match(/\{\{(.*)([^}])?$/);
190
- if (!match) {
191
- return { suggestions: [] };
192
- }
193
- const word = model.getWordUntilPosition(position);
194
- const range = {
195
- startLineNumber: position.lineNumber,
196
- endLineNumber: position.lineNumber,
197
- startColumn: word.startColumn,
198
- endColumn: word.endColumn,
199
- };
200
- return {
201
- suggestions: handlebarSuggestions.map((hs) => ({
202
- label: hs.text,
203
- kind: monaco.languages.CompletionItemKind.Text,
204
- documentation: hs.description,
205
- insertText: hs.text,
206
- range,
207
- })),
208
- };
209
- },
193
+ disposeRef.current = monaco.languages.registerCompletionItemProvider("html", {
194
+ triggerCharacters: ["{{"],
195
+ provideCompletionItems: function (model, position) {
196
+ // find out if we are completing a property in the 'dependencies' object.
197
+ const textUntilPosition = model.getValueInRange({
198
+ startLineNumber: 1,
199
+ startColumn: 1,
200
+ endLineNumber: position.lineNumber,
201
+ endColumn: position.column,
202
+ });
203
+ const match = textUntilPosition.match(/\{\{(.*)([^}])?$/);
204
+ if (!match) {
205
+ return { suggestions: [] };
206
+ }
207
+ const word = model.getWordUntilPosition(position);
208
+ const range = {
209
+ startLineNumber: position.lineNumber,
210
+ endLineNumber: position.lineNumber,
211
+ startColumn: word.startColumn,
212
+ endColumn: word.endColumn,
213
+ };
214
+ return {
215
+ suggestions: handlebarSuggestions.map((hs) => ({
216
+ label: hs.text,
217
+ kind: monaco.languages.CompletionItemKind.Text,
218
+ documentation: hs.description,
219
+ insertText: hs.text,
220
+ range,
221
+ })),
222
+ };
210
223
  },
211
- );
224
+ });
212
225
  }
213
226
  },
214
- [schema, language],
227
+ [language, schema, handlebarSuggestions],
215
228
  );
216
229
 
217
- const resetSchema = useCallback((_: unknown, monaco: typeof monacoEditor) => {
218
- monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
230
+ useEffect(() => {
231
+ monacoRef.current?.json?.jsonDefaults.setDiagnosticsOptions({
219
232
  validate: true,
220
233
  allowComments: false,
221
234
  schemas: [],
@@ -223,25 +236,18 @@ export const CodeEditor = ({
223
236
  }, []);
224
237
 
225
238
  return (
226
- <Section>
227
- <div
228
- ref={containerRef}
229
- data-testid="code-editor"
230
- className={classNames(classes.codeEditor, "area-content")}
231
- >
239
+ <Layout className="relative">
240
+ <div ref={containerRef} data-ref="codeEditor" className={cn("fabric-codeEditor", "absolute inset-0")}>
232
241
  <MonacoEditor
233
- editorDidMount={(e, m) => [
234
- !!e && setEditorRef(e),
235
- !!m && setMonacoRef(m),
236
- ]}
237
- editorWillMount={schemaUri}
238
- editorWillUnmount={resetSchema}
242
+ onMount={(e, m) => [!!e && setEditorRef(e), !!m && (monacoRef.current = m as typeof monacoEditor)]}
243
+ beforeMount={schemaUri}
244
+ theme={theme}
239
245
  value={codeValue}
240
246
  language={language}
241
247
  onChange={handleChange}
242
- theme={theme}
243
- className={classes.editor}
248
+ className={"fabric-editor"}
244
249
  options={{
250
+ theme,
245
251
  readOnly,
246
252
  minimap: {
247
253
  enabled: !minimal,
@@ -254,6 +260,6 @@ export const CodeEditor = ({
254
260
  }}
255
261
  />
256
262
  </div>
257
- </Section>
263
+ </Layout>
258
264
  );
259
- };
265
+ }
package/src/index.ts CHANGED
@@ -1,24 +1,29 @@
1
- /*
1
+ /**
2
2
  * React Fabric
3
- * @version: 1.0.0
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2024 Adarsh Pastakia
4
6
  *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
5
13
  *
6
- * The MIT License (MIT)
7
- * Copyright (c) 2024 Adarsh Pastakia
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
8
16
  *
9
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
10
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
11
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
13
- * subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all copies or substantial
16
- * portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
- * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
22
24
  */
23
25
 
26
+ export const MONACO_PACKAGE = "@react-fabric/monaco";
27
+ export const MONACO_VERSION = "1.0.0";
28
+
24
29
  export { CodeEditor } from "./components/CodeEditor";
@@ -1 +0,0 @@
1
- @layer util{.codeEditor{border:solid transparent;border-width:1px 1px 2px;direction:ltr;overflow:hidden;&:has(:global(.monaco-editor.focused)){border-color:theme(borderColor.primary.500)}.editor{&>:global(.monaco-editor){--vscode-menu-background:theme(colors.tint.50)!important;--vscode-menu-border:theme(borderColor.base)!important;--vscode-focusBorder:transparent!important;--vscode-menu-selectionBackground:color(from var(--primary) srgb r g b/80%)!important;--vscode-editor-background:var(--fabric-bg)!important;--vscode-editor-foreground:var(--fabric-text)!important;--vscode-breadcrumb-background:var(--fabric-bg)!important;--vscode-editorGutter-background:color(from theme(colors.tint.50) srgb r g g/50%)!important;--vscode-minimapSlider-background:color(from var(--tint) srgb r g b/20%)!important;--vscode-minimapSlider-hoverBackground:color(from var(--tint) srgb r g b/25%)!important;--vscode-minimapSlider-activeBackground:color(from var(--tint) srgb r g b/30%)!important;--vscode-input-border:var(--primary)!important;--vscode-editorStickyScroll-background:var(--fabric-bg)!important;--vscode-editorMarkerNavigation-background:var(--fabric-bg)!important;--vscode-editor-wordHighlightTextBackground:color(from theme(colors.accent.700) srgb r g b/20%)!important}& :global(.minimap-decorations-layer){background-color:color(from theme(colors.tint.50) srgb r g g/50%)!important}& :global(.folded-background){opacity:.5}& :global(.monaco-findInput) textarea{min-height:unset;resize:none}& :global{.editor-widget.suggest-widget .message{font-size:.75rem}}& span{padding:0}}}.editorTools{@apply bg-base}}
@@ -1 +0,0 @@
1
- @layer util{.codeEditor{border:solid transparent;border-width:1px 1px 2px;direction:ltr;overflow:hidden;&:has(:global(.monaco-editor.focused)){border-color:theme(borderColor.primary.500)}.editor{&>:global(.monaco-editor){--vscode-menu-background:theme(colors.tint.50)!important;--vscode-menu-border:theme(borderColor.base)!important;--vscode-focusBorder:transparent!important;--vscode-menu-selectionBackground:color(from var(--primary) srgb r g b/80%)!important;--vscode-editor-background:var(--fabric-bg)!important;--vscode-editor-foreground:var(--fabric-text)!important;--vscode-breadcrumb-background:var(--fabric-bg)!important;--vscode-editorGutter-background:color(from theme(colors.tint.50) srgb r g g/50%)!important;--vscode-minimapSlider-background:color(from var(--tint) srgb r g b/20%)!important;--vscode-minimapSlider-hoverBackground:color(from var(--tint) srgb r g b/25%)!important;--vscode-minimapSlider-activeBackground:color(from var(--tint) srgb r g b/30%)!important;--vscode-input-border:var(--primary)!important;--vscode-editorStickyScroll-background:var(--fabric-bg)!important;--vscode-editorMarkerNavigation-background:var(--fabric-bg)!important;--vscode-editor-wordHighlightTextBackground:color(from theme(colors.accent.700) srgb r g b/20%)!important}& :global(.minimap-decorations-layer){background-color:color(from theme(colors.tint.50) srgb r g g/50%)!important}& :global(.folded-background){opacity:.5}& :global(.monaco-findInput) textarea{min-height:unset;resize:none}& :global{.editor-widget.suggest-widget .message{font-size:.75rem}}& span{padding:0}}}.editorTools{@apply bg-base}}
@@ -1,98 +0,0 @@
1
- /*
2
- * React Fabric
3
- * @version: 1.0.0
4
- *
5
- *
6
- * The MIT License (MIT)
7
- * Copyright (c) 2024 Adarsh Pastakia
8
- *
9
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
10
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
11
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
13
- * subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all copies or substantial
16
- * portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
- * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
- */
23
-
24
- /* stylelint-disable custom-property-pattern */
25
-
26
- @layer util {
27
- .codeEditor {
28
- direction: ltr;
29
- overflow: hidden;
30
- border: 1px solid transparent;
31
- border-bottom-width: 2px;
32
-
33
- &:has(:global(.monaco-editor.focused)) {
34
- border-color: theme(borderColor.primary.500);
35
- }
36
-
37
- .editor {
38
- & > :global(.monaco-editor) {
39
- --vscode-menu-background: theme(colors.tint.50) !important;
40
- --vscode-menu-border: theme(borderColor.base) !important;
41
- --vscode-focusBorder: transparent !important;
42
- --vscode-menu-selectionBackground: color(
43
- from var(--primary) srgb r g b / 80%
44
- ) !important;
45
- --vscode-editor-background: var(--fabric-bg) !important;
46
- --vscode-editor-foreground: var(--fabric-text) !important;
47
- --vscode-breadcrumb-background: var(--fabric-bg) !important;
48
- --vscode-editorGutter-background: color(
49
- from theme(colors.tint.50) srgb r g g / 50%
50
- ) !important;
51
- --vscode-minimapSlider-background: color(
52
- from var(--tint) srgb r g b / 20%
53
- ) !important;
54
- --vscode-minimapSlider-hoverBackground: color(
55
- from var(--tint) srgb r g b / 25%
56
- ) !important;
57
- --vscode-minimapSlider-activeBackground: color(
58
- from var(--tint) srgb r g b / 30%
59
- ) !important;
60
- --vscode-input-border: var(--primary) !important;
61
- --vscode-editorStickyScroll-background: var(--fabric-bg) !important;
62
- --vscode-editorMarkerNavigation-background: var(--fabric-bg) !important;
63
- --vscode-editor-wordHighlightTextBackground: color(
64
- from theme(colors.accent.700) srgb r g b / 20%
65
- ) !important;
66
- }
67
-
68
- & :global(.minimap-decorations-layer) {
69
- background-color: color(
70
- from theme(colors.tint.50) srgb r g g / 50%
71
- ) !important;
72
- }
73
-
74
- & :global(.folded-background) {
75
- opacity: 0.5;
76
- }
77
-
78
- & :global(.monaco-findInput) textarea {
79
- resize: initial;
80
- min-height: unset;
81
- }
82
-
83
- & :global {
84
- .editor-widget.suggest-widget .message {
85
- font-size: 0.75rem;
86
- }
87
- }
88
-
89
- & span {
90
- padding: 0;
91
- }
92
- }
93
- }
94
-
95
- .editorTools {
96
- @apply bg-base;
97
- }
98
- }