@cloud-ru/uikit-product-code-editor 0.3.6 → 0.3.8

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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 0.3.8 (2025-11-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **PD-3377:** removed contributors ([121640f](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/121640f7b88b20a728a6ad2c39de8841532bb308))
12
+
13
+
14
+
15
+
16
+
17
+ ## 0.3.7 (2025-11-12)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **PD-3377:** contributors update to publish all packages ([719fd3e](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/719fd3e1249e247443b125c47ea408d92c8395c3))
23
+
24
+
25
+
26
+
27
+
6
28
  ## 0.3.6 (2025-11-12)
7
29
 
8
30
  **Note:** Version bump only for package @cloud-ru/uikit-product-code-editor
@@ -0,0 +1,23 @@
1
+ import { ComponentType } from 'react';
2
+ import { ProductCodeEditorProps } from './types';
3
+ /**
4
+ * CodeEditor с загруженным 'monaco-editor'
5
+ *
6
+ * @example Пример использования
7
+ * ```tsx
8
+ * import { Suspense, lazy } from 'react'
9
+ * import { AsyncProductCodeEditor } from ''
10
+ *
11
+ * const Editor = lazy(() => AsyncProductCodeEditor())
12
+ *
13
+ * const MyComponent = () => {
14
+ * return <Suspense fallback='loading...'>
15
+ * <Editor language='json' value="" />
16
+ * </Suspense>
17
+ * }
18
+ *
19
+ * ```
20
+ */
21
+ export declare const AsyncProductCodeEditor: () => Promise<{
22
+ default: ComponentType<ProductCodeEditorProps>;
23
+ }>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AsyncProductCodeEditor = void 0;
13
+ const loader_1 = require("./loader");
14
+ const withMonaco_1 = require("./withMonaco");
15
+ /**
16
+ * CodeEditor с загруженным 'monaco-editor'
17
+ *
18
+ * @example Пример использования
19
+ * ```tsx
20
+ * import { Suspense, lazy } from 'react'
21
+ * import { AsyncProductCodeEditor } from ''
22
+ *
23
+ * const Editor = lazy(() => AsyncProductCodeEditor())
24
+ *
25
+ * const MyComponent = () => {
26
+ * return <Suspense fallback='loading...'>
27
+ * <Editor language='json' value="" />
28
+ * </Suspense>
29
+ * }
30
+ *
31
+ * ```
32
+ */
33
+ const AsyncProductCodeEditor = () => __awaiter(void 0, void 0, void 0, function* () {
34
+ const monaco = yield (0, loader_1.loadMonacoEditor)();
35
+ if (monaco) {
36
+ return { default: (0, withMonaco_1.withMonaco)(monaco).CodeEditor };
37
+ }
38
+ return { default: (0, withMonaco_1.withMonaco)().CodeEditor };
39
+ });
40
+ exports.AsyncProductCodeEditor = AsyncProductCodeEditor;
@@ -0,0 +1,27 @@
1
+ import { ProductCodeEditorProps } from './types';
2
+ export type LazyProductCodeEditorProps = ProductCodeEditorProps;
3
+ /**
4
+ * Готовый preset
5
+ *
6
+ * @example Пример использования
7
+ * ```tsx
8
+ * import { LazyProductCodeEditor } from ''
9
+ *
10
+ * const MyComponent = () => {
11
+ * return <LazyProductCodeEditor />
12
+ * }
13
+ * ```
14
+ * `LazyProductCodeEditor` работает как:
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const Editor = lazy(() => AsyncMonacoCodeEditor())
19
+ *
20
+ * const LazyProductCodeEditor = (props: CodeEditorProps) => {
21
+ * <Suspense fallback={<snack-uikit-spinner height={props.height} />}>
22
+ * <Editor {...props}/>
23
+ * </Suspense>
24
+ * }
25
+ * ````
26
+ */
27
+ export declare function LazyProductCodeEditor(props: LazyProductCodeEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LazyProductCodeEditor = LazyProductCodeEditor;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const loaders_1 = require("@snack-uikit/loaders");
7
+ const AsyncProductCodeEditor_1 = require("./AsyncProductCodeEditor");
8
+ const CodeEditor = (0, react_1.lazy)(() => (0, AsyncProductCodeEditor_1.AsyncProductCodeEditor)());
9
+ function Loader(props) {
10
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
11
+ display: 'flex',
12
+ alignItems: 'center',
13
+ justifyContent: 'center',
14
+ width: '100%',
15
+ height: props.height,
16
+ }, children: (0, jsx_runtime_1.jsx)(loaders_1.Spinner, {}) }));
17
+ }
18
+ /**
19
+ * Готовый preset
20
+ *
21
+ * @example Пример использования
22
+ * ```tsx
23
+ * import { LazyProductCodeEditor } from ''
24
+ *
25
+ * const MyComponent = () => {
26
+ * return <LazyProductCodeEditor />
27
+ * }
28
+ * ```
29
+ * `LazyProductCodeEditor` работает как:
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * const Editor = lazy(() => AsyncMonacoCodeEditor())
34
+ *
35
+ * const LazyProductCodeEditor = (props: CodeEditorProps) => {
36
+ * <Suspense fallback={<snack-uikit-spinner height={props.height} />}>
37
+ * <Editor {...props}/>
38
+ * </Suspense>
39
+ * }
40
+ * ````
41
+ */
42
+ function LazyProductCodeEditor(props) {
43
+ const { height } = props;
44
+ return ((0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Loader, { height: height }), children: (0, jsx_runtime_1.jsx)(CodeEditor, Object.assign({}, props)) }));
45
+ }
@@ -0,0 +1,4 @@
1
+ export { AsyncProductCodeEditor } from './AsyncProductCodeEditor';
2
+ export { LazyProductCodeEditor } from './LazyProductCodeEditor';
3
+ export { preloadMonacoEditor } from './loader';
4
+ export { type ProductCodeEditorProps, type EditorJsonSchema } from './types';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.preloadMonacoEditor = exports.LazyProductCodeEditor = exports.AsyncProductCodeEditor = void 0;
4
+ var AsyncProductCodeEditor_1 = require("./AsyncProductCodeEditor");
5
+ Object.defineProperty(exports, "AsyncProductCodeEditor", { enumerable: true, get: function () { return AsyncProductCodeEditor_1.AsyncProductCodeEditor; } });
6
+ var LazyProductCodeEditor_1 = require("./LazyProductCodeEditor");
7
+ Object.defineProperty(exports, "LazyProductCodeEditor", { enumerable: true, get: function () { return LazyProductCodeEditor_1.LazyProductCodeEditor; } });
8
+ var loader_1 = require("./loader");
9
+ Object.defineProperty(exports, "preloadMonacoEditor", { enumerable: true, get: function () { return loader_1.preloadMonacoEditor; } });
@@ -0,0 +1,12 @@
1
+ declare global {
2
+ interface Window {
3
+ '__snack-monaco-editor-loader__'?: {
4
+ loadMonaco: () => Promise<unknown>;
5
+ };
6
+ }
7
+ }
8
+ export declare const loadMonacoEditor: () => Promise<unknown>;
9
+ /**
10
+ * Подгрузить 'monaco-editor'
11
+ */
12
+ export declare const preloadMonacoEditor: () => Promise<unknown>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.preloadMonacoEditor = exports.loadMonacoEditor = void 0;
13
+ const loadMonacoEditor = () => __awaiter(void 0, void 0, void 0, function* () {
14
+ var _a;
15
+ if ((_a = window['__snack-monaco-editor-loader__']) === null || _a === void 0 ? void 0 : _a.loadMonaco) {
16
+ const monaco = yield window['__snack-monaco-editor-loader__'].loadMonaco();
17
+ return monaco;
18
+ }
19
+ return null;
20
+ });
21
+ exports.loadMonacoEditor = loadMonacoEditor;
22
+ /**
23
+ * Подгрузить 'monaco-editor'
24
+ */
25
+ const preloadMonacoEditor = () => __awaiter(void 0, void 0, void 0, function* () { return (0, exports.loadMonacoEditor)(); });
26
+ exports.preloadMonacoEditor = preloadMonacoEditor;
@@ -0,0 +1,3 @@
1
+ import type { CodeEditorProps, JsonSchema as Scheme } from '@snack-uikit/code-editor';
2
+ export type ProductCodeEditorProps = CodeEditorProps;
3
+ export type EditorJsonSchema = Scheme;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { CodeEditor } from '@snack-uikit/code-editor';
2
+ export declare const withMonaco: (monaco?: any) => {
3
+ CodeEditor: typeof CodeEditor;
4
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withMonaco = void 0;
4
+ const code_editor_1 = require("@snack-uikit/code-editor");
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const withMonaco = (monaco) => {
7
+ if (monaco) {
8
+ code_editor_1.loader.config({ monaco });
9
+ }
10
+ return {
11
+ CodeEditor: code_editor_1.CodeEditor,
12
+ };
13
+ };
14
+ exports.withMonaco = withMonaco;
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./components"), exports);
@@ -0,0 +1,23 @@
1
+ import { ComponentType } from 'react';
2
+ import { ProductCodeEditorProps } from './types';
3
+ /**
4
+ * CodeEditor с загруженным 'monaco-editor'
5
+ *
6
+ * @example Пример использования
7
+ * ```tsx
8
+ * import { Suspense, lazy } from 'react'
9
+ * import { AsyncProductCodeEditor } from ''
10
+ *
11
+ * const Editor = lazy(() => AsyncProductCodeEditor())
12
+ *
13
+ * const MyComponent = () => {
14
+ * return <Suspense fallback='loading...'>
15
+ * <Editor language='json' value="" />
16
+ * </Suspense>
17
+ * }
18
+ *
19
+ * ```
20
+ */
21
+ export declare const AsyncProductCodeEditor: () => Promise<{
22
+ default: ComponentType<ProductCodeEditorProps>;
23
+ }>;
@@ -0,0 +1,36 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { loadMonacoEditor } from './loader';
11
+ import { withMonaco } from './withMonaco';
12
+ /**
13
+ * CodeEditor с загруженным 'monaco-editor'
14
+ *
15
+ * @example Пример использования
16
+ * ```tsx
17
+ * import { Suspense, lazy } from 'react'
18
+ * import { AsyncProductCodeEditor } from ''
19
+ *
20
+ * const Editor = lazy(() => AsyncProductCodeEditor())
21
+ *
22
+ * const MyComponent = () => {
23
+ * return <Suspense fallback='loading...'>
24
+ * <Editor language='json' value="" />
25
+ * </Suspense>
26
+ * }
27
+ *
28
+ * ```
29
+ */
30
+ export const AsyncProductCodeEditor = () => __awaiter(void 0, void 0, void 0, function* () {
31
+ const monaco = yield loadMonacoEditor();
32
+ if (monaco) {
33
+ return { default: withMonaco(monaco).CodeEditor };
34
+ }
35
+ return { default: withMonaco().CodeEditor };
36
+ });
@@ -0,0 +1,27 @@
1
+ import { ProductCodeEditorProps } from './types';
2
+ export type LazyProductCodeEditorProps = ProductCodeEditorProps;
3
+ /**
4
+ * Готовый preset
5
+ *
6
+ * @example Пример использования
7
+ * ```tsx
8
+ * import { LazyProductCodeEditor } from ''
9
+ *
10
+ * const MyComponent = () => {
11
+ * return <LazyProductCodeEditor />
12
+ * }
13
+ * ```
14
+ * `LazyProductCodeEditor` работает как:
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const Editor = lazy(() => AsyncMonacoCodeEditor())
19
+ *
20
+ * const LazyProductCodeEditor = (props: CodeEditorProps) => {
21
+ * <Suspense fallback={<snack-uikit-spinner height={props.height} />}>
22
+ * <Editor {...props}/>
23
+ * </Suspense>
24
+ * }
25
+ * ````
26
+ */
27
+ export declare function LazyProductCodeEditor(props: LazyProductCodeEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { lazy, Suspense } from 'react';
3
+ import { Spinner } from '@snack-uikit/loaders';
4
+ import { AsyncProductCodeEditor } from './AsyncProductCodeEditor';
5
+ const CodeEditor = lazy(() => AsyncProductCodeEditor());
6
+ function Loader(props) {
7
+ return (_jsx("div", { style: {
8
+ display: 'flex',
9
+ alignItems: 'center',
10
+ justifyContent: 'center',
11
+ width: '100%',
12
+ height: props.height,
13
+ }, children: _jsx(Spinner, {}) }));
14
+ }
15
+ /**
16
+ * Готовый preset
17
+ *
18
+ * @example Пример использования
19
+ * ```tsx
20
+ * import { LazyProductCodeEditor } from ''
21
+ *
22
+ * const MyComponent = () => {
23
+ * return <LazyProductCodeEditor />
24
+ * }
25
+ * ```
26
+ * `LazyProductCodeEditor` работает как:
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * const Editor = lazy(() => AsyncMonacoCodeEditor())
31
+ *
32
+ * const LazyProductCodeEditor = (props: CodeEditorProps) => {
33
+ * <Suspense fallback={<snack-uikit-spinner height={props.height} />}>
34
+ * <Editor {...props}/>
35
+ * </Suspense>
36
+ * }
37
+ * ````
38
+ */
39
+ export function LazyProductCodeEditor(props) {
40
+ const { height } = props;
41
+ return (_jsx(Suspense, { fallback: _jsx(Loader, { height: height }), children: _jsx(CodeEditor, Object.assign({}, props)) }));
42
+ }
@@ -0,0 +1,4 @@
1
+ export { AsyncProductCodeEditor } from './AsyncProductCodeEditor';
2
+ export { LazyProductCodeEditor } from './LazyProductCodeEditor';
3
+ export { preloadMonacoEditor } from './loader';
4
+ export { type ProductCodeEditorProps, type EditorJsonSchema } from './types';
@@ -0,0 +1,3 @@
1
+ export { AsyncProductCodeEditor } from './AsyncProductCodeEditor';
2
+ export { LazyProductCodeEditor } from './LazyProductCodeEditor';
3
+ export { preloadMonacoEditor } from './loader';
@@ -0,0 +1,12 @@
1
+ declare global {
2
+ interface Window {
3
+ '__snack-monaco-editor-loader__'?: {
4
+ loadMonaco: () => Promise<unknown>;
5
+ };
6
+ }
7
+ }
8
+ export declare const loadMonacoEditor: () => Promise<unknown>;
9
+ /**
10
+ * Подгрузить 'monaco-editor'
11
+ */
12
+ export declare const preloadMonacoEditor: () => Promise<unknown>;
@@ -0,0 +1,21 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ export const loadMonacoEditor = () => __awaiter(void 0, void 0, void 0, function* () {
11
+ var _a;
12
+ if ((_a = window['__snack-monaco-editor-loader__']) === null || _a === void 0 ? void 0 : _a.loadMonaco) {
13
+ const monaco = yield window['__snack-monaco-editor-loader__'].loadMonaco();
14
+ return monaco;
15
+ }
16
+ return null;
17
+ });
18
+ /**
19
+ * Подгрузить 'monaco-editor'
20
+ */
21
+ export const preloadMonacoEditor = () => __awaiter(void 0, void 0, void 0, function* () { return loadMonacoEditor(); });
@@ -0,0 +1,3 @@
1
+ import type { CodeEditorProps, JsonSchema as Scheme } from '@snack-uikit/code-editor';
2
+ export type ProductCodeEditorProps = CodeEditorProps;
3
+ export type EditorJsonSchema = Scheme;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { CodeEditor } from '@snack-uikit/code-editor';
2
+ export declare const withMonaco: (monaco?: any) => {
3
+ CodeEditor: typeof CodeEditor;
4
+ };
@@ -0,0 +1,10 @@
1
+ import { CodeEditor, loader } from '@snack-uikit/code-editor';
2
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
+ export const withMonaco = (monaco) => {
4
+ if (monaco) {
5
+ loader.config({ monaco });
6
+ }
7
+ return {
8
+ CodeEditor,
9
+ };
10
+ };
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1 @@
1
+ export * from './components';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloud-ru/uikit-product-code-editor",
3
3
  "title": "Code Editor",
4
- "version": "0.3.6",
4
+ "version": "0.3.8",
5
5
  "sideEffects": [
6
6
  "*.css",
7
7
  "*.woff",
@@ -39,5 +39,5 @@
39
39
  "@snack-uikit/code-editor": "0.7.2",
40
40
  "@snack-uikit/loaders": "0.9.4"
41
41
  },
42
- "gitHead": "e8bd79bc92b26a8f52611972eec98a867536ccd3"
42
+ "gitHead": "ce69097516055b330a0b05da5e29ac5b66e56284"
43
43
  }