@snack-uikit/code-editor 0.5.1 → 0.5.2-preview-764c2b6c.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.
@@ -27,7 +27,6 @@ const constants_1 = require("./constants");
27
27
  const hooks_1 = require("./hooks");
28
28
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
29
29
  const utils_2 = require("./utils");
30
- (0, utils_2.initLoaderConfig)();
31
30
  function CodeEditor(_a) {
32
31
  var {
33
32
  themeName,
@@ -2,5 +2,4 @@ import { SchemasSettings } from 'monaco-yaml';
2
2
  import { JsonSchema } from './types';
3
3
  export declare function rgb2hsl(HTMLcolor: string): number[];
4
4
  export declare function isDark(color: string): boolean;
5
- export declare function initLoaderConfig(): void;
6
5
  export declare const getJsonSchema: (jsonSchema?: JsonSchema) => SchemasSettings | undefined;
@@ -11,8 +11,6 @@ Object.defineProperty(exports, "__esModule", {
11
11
  exports.getJsonSchema = void 0;
12
12
  exports.rgb2hsl = rgb2hsl;
13
13
  exports.isDark = isDark;
14
- exports.initLoaderConfig = initLoaderConfig;
15
- const react_1 = require("@monaco-editor/react");
16
14
  const chroma_js_1 = __importDefault(require("chroma-js"));
17
15
  const constants_1 = require("./constants");
18
16
  function rgb2hsl(HTMLcolor) {
@@ -48,14 +46,6 @@ function isDark(color) {
48
46
  const [h, _, l] = rgb2hsl(color);
49
47
  return h < 0.55 && l >= 0.5 || h >= 0.55 && l >= 0.75;
50
48
  }
51
- function initLoaderConfig() {
52
- if (!window) {
53
- return;
54
- }
55
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
56
- // @ts-ignore
57
- window['__snack-code-editor-loader-config__'] && react_1.loader.config(window['__snack-code-editor-loader-config__']);
58
- }
59
49
  const getJsonSchema = jsonSchema => jsonSchema && Object.assign(Object.assign({}, jsonSchema), {
60
50
  uri: (jsonSchema === null || jsonSchema === void 0 ? void 0 : jsonSchema.uri) || constants_1.DEFAULT_SCHEMA_URI,
61
51
  fileMatch: [jsonSchema.fileMatch]
@@ -18,8 +18,7 @@ import { extractSupportProps, isBrowser } from '@snack-uikit/utils';
18
18
  import { CODE_EDITOR_OPTIONS, DEFAULT_THEME_OPTIONS, DEFAULT_THEME_VALUES } from './constants';
19
19
  import { useApplyJsonSchema, useCalculatedThemeValues } from './hooks';
20
20
  import styles from './styles.module.css';
21
- import { initLoaderConfig, isDark } from './utils';
22
- initLoaderConfig();
21
+ import { isDark } from './utils';
23
22
  export function CodeEditor(_a) {
24
23
  var { themeName, className, theme, options, loading, hasBackground = true, onMount, language } = _a, props = __rest(_a, ["themeName", "className", "theme", "options", "loading", "hasBackground", "onMount", "language"]);
25
24
  const monaco = useMonaco();
@@ -2,5 +2,4 @@ import { SchemasSettings } from 'monaco-yaml';
2
2
  import { JsonSchema } from './types';
3
3
  export declare function rgb2hsl(HTMLcolor: string): number[];
4
4
  export declare function isDark(color: string): boolean;
5
- export declare function initLoaderConfig(): void;
6
5
  export declare const getJsonSchema: (jsonSchema?: JsonSchema) => SchemasSettings | undefined;
@@ -1,4 +1,3 @@
1
- import { loader } from '@monaco-editor/react';
2
1
  import chroma from 'chroma-js';
3
2
  import { DEFAULT_SCHEMA_URI } from './constants';
4
3
  export function rgb2hsl(HTMLcolor) {
@@ -38,12 +37,4 @@ export function isDark(color) {
38
37
  const [h, _, l] = rgb2hsl(color);
39
38
  return (h < 0.55 && l >= 0.5) || (h >= 0.55 && l >= 0.75);
40
39
  }
41
- export function initLoaderConfig() {
42
- if (!window) {
43
- return;
44
- }
45
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
46
- // @ts-ignore
47
- window['__snack-code-editor-loader-config__'] && loader.config(window['__snack-code-editor-loader-config__']);
48
- }
49
40
  export const getJsonSchema = (jsonSchema) => jsonSchema && Object.assign(Object.assign({}, jsonSchema), { uri: (jsonSchema === null || jsonSchema === void 0 ? void 0 : jsonSchema.uri) || DEFAULT_SCHEMA_URI, fileMatch: [jsonSchema.fileMatch] });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.5.1",
7
+ "version": "0.5.2-preview-764c2b6c.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -46,5 +46,5 @@
46
46
  "devDependencies": {
47
47
  "@types/chroma-js": "2.4.4"
48
48
  },
49
- "gitHead": "ec4e54b1ea5c4455ca404632e1f205e22b881f98"
49
+ "gitHead": "94362d8761d20e89d81c91a7272051da3109ae93"
50
50
  }
@@ -9,9 +9,7 @@ import { CODE_EDITOR_OPTIONS, DEFAULT_THEME_OPTIONS, DEFAULT_THEME_VALUES } from
9
9
  import { useApplyJsonSchema, useCalculatedThemeValues } from './hooks';
10
10
  import styles from './styles.module.scss';
11
11
  import { EditorBaseProps, EditorWithJsonSchemaProps } from './types';
12
- import { initLoaderConfig, isDark } from './utils';
13
-
14
- initLoaderConfig();
12
+ import { isDark } from './utils';
15
13
 
16
14
  export type CodeEditorProps = WithSupportProps<{
17
15
  /**
@@ -1,4 +1,3 @@
1
- import { loader } from '@monaco-editor/react';
2
1
  import chroma from 'chroma-js';
3
2
  import { SchemasSettings } from 'monaco-yaml';
4
3
 
@@ -55,15 +54,5 @@ export function isDark(color: string) {
55
54
  return (h < 0.55 && l >= 0.5) || (h >= 0.55 && l >= 0.75);
56
55
  }
57
56
 
58
- export function initLoaderConfig() {
59
- if (!window) {
60
- return;
61
- }
62
-
63
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
64
- // @ts-ignore
65
- window['__snack-code-editor-loader-config__'] && loader.config(window['__snack-code-editor-loader-config__']);
66
- }
67
-
68
57
  export const getJsonSchema = (jsonSchema?: JsonSchema): SchemasSettings | undefined =>
69
58
  jsonSchema && { ...jsonSchema, uri: jsonSchema?.uri || DEFAULT_SCHEMA_URI, fileMatch: [jsonSchema.fileMatch] };