@harnessio/yaml-editor 0.13.0 → 0.15.0-beta-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 CHANGED
@@ -1 +1,29 @@
1
1
  # Yaml Editor
2
+
3
+ ## Development
4
+
5
+ Run `pnpm dev` and `pnpm playground`
6
+
7
+ ## Playground
8
+
9
+ `pnpm playground`
10
+
11
+ ## Production
12
+
13
+ `pnpm build`
14
+
15
+ ## Setup
16
+
17
+ ```tsx
18
+ import { ILanguageFeaturesService } from 'monaco-editor/esm/vs/editor/common/services/languageFeatures.js'
19
+ import { OutlineModel } from 'monaco-editor/esm/vs/editor/contrib/documentSymbols/browser/outlineModel.js'
20
+ import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js'
21
+
22
+ import { MonacoGlobals } from '@harnessio/yaml-editor'
23
+
24
+ MonacoGlobals.set({
25
+ ILanguageFeaturesService,
26
+ OutlineModel,
27
+ StandaloneServices
28
+ })
29
+ ```
@@ -1,7 +1,9 @@
1
+ import { EditorProps } from '@monaco-editor/react';
1
2
  import { BlameItem } from '../types/blame';
2
3
  import { ThemeDefinition } from '../types/themes';
3
4
 
4
- export interface BlameEditorProps<_> {
5
+ import * as monaco from 'monaco-editor';
6
+ export interface BlameEditorProps {
5
7
  code: string;
6
8
  language: string;
7
9
  themeConfig?: {
@@ -13,5 +15,7 @@ export interface BlameEditorProps<_> {
13
15
  lineNumbersPosition?: 'left' | 'center';
14
16
  blameData: BlameItem[];
15
17
  showSeparators?: boolean;
18
+ height?: EditorProps['height'];
19
+ options?: monaco.editor.IStandaloneEditorConstructionOptions;
16
20
  }
17
- export declare function BlameEditor<T>(props: BlameEditorProps<T>): JSX.Element;
21
+ export declare function BlameEditor({ code, language, themeConfig, lineNumbersPosition, blameData, showSeparators, theme: themeFromProps, height, options }: BlameEditorProps): JSX.Element;
@@ -1,5 +1,6 @@
1
+ import { EditorProps } from '@monaco-editor/react';
1
2
  import { ThemeDefinition } from '../types/themes';
2
- /// <reference types="react" />
3
+
3
4
  import * as monaco from 'monaco-editor';
4
5
  export interface CodeRevision {
5
6
  code: string;
@@ -15,8 +16,7 @@ export interface CodeEditorProps<_> {
15
16
  themes?: ThemeDefinition[];
16
17
  };
17
18
  theme?: string;
18
- options?: {
19
- readOnly?: boolean;
20
- };
19
+ options?: monaco.editor.IStandaloneEditorConstructionOptions;
20
+ height?: EditorProps['height'];
21
21
  }
22
- export declare function CodeEditor<T>(props: CodeEditorProps<T>): JSX.Element;
22
+ export declare function CodeEditor<T>({ codeRevision, onCodeRevisionChange, language, themeConfig, options, theme: themeFromProps, height }: CodeEditorProps<T>): JSX.Element;
@@ -1,5 +1,7 @@
1
+ import { EditorProps } from '@monaco-editor/react';
1
2
  import { ThemeDefinition } from '../types/themes';
2
3
 
4
+ import * as monaco from 'monaco-editor';
3
5
  export interface CodeRevision {
4
6
  code: string;
5
7
  revisionId?: number;
@@ -14,8 +16,7 @@ export interface DiffEditorProps<_> {
14
16
  themes?: ThemeDefinition[];
15
17
  };
16
18
  theme?: string;
17
- options?: {
18
- readOnly?: boolean;
19
- };
19
+ options?: monaco.editor.IStandaloneEditorConstructionOptions;
20
+ height?: EditorProps['height'];
20
21
  }
21
- export declare function CodeDiffEditor<T>(props: DiffEditorProps<T>): JSX.Element;
22
+ export declare function CodeDiffEditor<T>({ original, modified, language, themeConfig, options, theme: themeFromProps, height }: DiffEditorProps<T>): JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import { InlineAction } from '../types/inline-actions';
2
2
  import { PathSelector } from '../types/selectors';
3
3
  import { ThemeDefinition } from '../types/themes';
4
- /// <reference types="react" />
5
4
  import * as monaco from 'monaco-editor';
6
5
  export interface YamlRevision {
7
6
  yaml: string;
@@ -24,10 +23,13 @@ export interface YamlEditorProps<T> {
24
23
  themes?: ThemeDefinition[];
25
24
  };
26
25
  theme?: string;
26
+ options?: monaco.editor.IStandaloneEditorConstructionOptions;
27
27
  selection?: {
28
28
  path: string;
29
29
  className: string;
30
30
  revealInCenter?: boolean;
31
31
  };
32
+ animateOnUpdate?: boolean;
33
+ onAnimateEnd?: () => void;
32
34
  }
33
- export declare function YamlEditor<T>(props: YamlEditorProps<T>): JSX.Element;
35
+ export declare const YamlEditor: <T>(props: YamlEditorProps<T>) => JSX.Element;
@@ -11,5 +11,5 @@ export interface YamlEditorContextInterface {
11
11
  }) => void;
12
12
  }
13
13
  export declare const YamlEditorContext: import('react').Context<YamlEditorContextInterface>;
14
- export declare function YamlEditorContextProvider({ children }: React.PropsWithChildren): React.ReactElement;
14
+ export declare function YamlEditorContextProvider({ children }: React.PropsWithChildren<React.HTMLAttributes<HTMLElement>>): React.ReactElement;
15
15
  export declare function useYamlEditorContext(): YamlEditorContextInterface;
@@ -0,0 +1,2 @@
1
+ import * as monaco from 'monaco-editor';
2
+ export declare const MonacoCommonDefaultOptions: monaco.editor.IStandaloneDiffEditorConstructionOptions;