@snack-uikit/code-editor 0.2.1-preview-a9faaab6.0 → 0.2.1-preview-ca0a56c2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,8 +18,8 @@ import { extractSupportProps } from '@snack-uikit/utils';
18
18
  import { CODE_EDITOR_OPTIONS, DEFAULT_THEME_OPTIONS, DEFAULT_THEME_VALUES } from './constants';
19
19
  import { useCalculatedThemeValues } from './hooks';
20
20
  import styles from './styles.module.css';
21
- import { initMonacoEditorReactLoaderConfig, isDark } from './utils';
22
- initMonacoEditorReactLoaderConfig();
21
+ import { initLoaderConfig, isDark } from './utils';
22
+ initLoaderConfig();
23
23
  export function CodeEditor(_a) {
24
24
  var { themeClassName, className, theme, options, loading, hasBackground = true } = _a, props = __rest(_a, ["themeClassName", "className", "theme", "options", "loading", "hasBackground"]);
25
25
  const monaco = useMonaco();
@@ -1,3 +1,3 @@
1
1
  export declare function rgb2hsl(HTMLcolor: string): number[];
2
2
  export declare function isDark(color: string): boolean;
3
- export declare function initMonacoEditorReactLoaderConfig(): void;
3
+ export declare function initLoaderConfig(): void;
@@ -34,14 +34,11 @@ export function isDark(color) {
34
34
  const [h, _, l] = rgb2hsl(color);
35
35
  return (h < 0.55 && l >= 0.5) || (h >= 0.55 && l >= 0.75);
36
36
  }
37
- export function initMonacoEditorReactLoaderConfig() {
37
+ export function initLoaderConfig() {
38
38
  if (!window) {
39
39
  return;
40
40
  }
41
41
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
42
  // @ts-ignore
43
- const vs = window['__snack_code_editor_paths__'];
44
- if (vs) {
45
- loader.config({ paths: { vs } });
46
- }
43
+ window['__snack-code-editor-loader-config__'] && loader.config(['__snack-code-editor-loader-config__']);
47
44
  }
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
+ export { loader } from '@monaco-editor/react';
1
2
  export * from './components';
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
+ export { loader } from '@monaco-editor/react';
1
2
  export * from './components';
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.2.1-preview-a9faaab6.0",
7
+ "version": "0.2.1-preview-ca0a56c2.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -37,5 +37,5 @@
37
37
  "@snack-uikit/utils": "3.3.0",
38
38
  "classnames": "2.5.1"
39
39
  },
40
- "gitHead": "6314839f8b24a0700f000e7a40145e85f0b0eea2"
40
+ "gitHead": "538bc48611701596344eadb53708065010591cfc"
41
41
  }
@@ -8,9 +8,9 @@ import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
8
8
  import { CODE_EDITOR_OPTIONS, DEFAULT_THEME_OPTIONS, DEFAULT_THEME_VALUES } from './constants';
9
9
  import { useCalculatedThemeValues } from './hooks';
10
10
  import styles from './styles.module.scss';
11
- import { initMonacoEditorReactLoaderConfig, isDark } from './utils';
11
+ import { initLoaderConfig, isDark } from './utils';
12
12
 
13
- initMonacoEditorReactLoaderConfig();
13
+ initLoaderConfig();
14
14
 
15
15
  export type CodeEditorProps = WithSupportProps<{
16
16
  /** Класснейм подключенной темы (из хука useThemeConfig() или ThemeProvider)
@@ -48,16 +48,12 @@ export function isDark(color: string) {
48
48
  return (h < 0.55 && l >= 0.5) || (h >= 0.55 && l >= 0.75);
49
49
  }
50
50
 
51
- export function initMonacoEditorReactLoaderConfig() {
51
+ export function initLoaderConfig() {
52
52
  if (!window) {
53
53
  return;
54
54
  }
55
55
 
56
56
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
57
57
  // @ts-ignore
58
- const vs = window['__snack_code_editor_paths__'] as string | undefined;
59
-
60
- if (vs) {
61
- loader.config({ paths: { vs } });
62
- }
58
+ window['__snack-code-editor-loader-config__'] && loader.config(['__snack-code-editor-loader-config__']);
63
59
  }
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
+ export { loader } from '@monaco-editor/react';
1
2
  export * from './components';