@guihz/trading-vue-editor-tes 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/README.md +30 -0
  2. package/lib/App.d.ts +3 -0
  3. package/lib/api/api.d.ts +1 -0
  4. package/lib/api/server.d.ts +8 -0
  5. package/lib/assets/parserTccWorker-CFBnUzVu.js +99 -0
  6. package/lib/assets/scriptsRunWorker-CSDMAOri.js +66 -0
  7. package/lib/components/editor/config/monarchTokens.d.ts +205 -0
  8. package/lib/components/editor/constants/contents.d.ts +40 -0
  9. package/lib/components/editor/constants/locals.d.ts +3 -0
  10. package/lib/components/editor/index.d.ts +21 -0
  11. package/lib/components/editor/parseScript/buildInConstants.d.ts +252 -0
  12. package/lib/components/editor/parseScript/buildInFuncNamespace/array.d.ts +144 -0
  13. package/lib/components/editor/parseScript/buildInFuncNamespace/color.d.ts +25 -0
  14. package/lib/components/editor/parseScript/buildInFuncNamespace/errorListener.d.ts +8 -0
  15. package/lib/components/editor/parseScript/buildInFuncNamespace/index.d.ts +12 -0
  16. package/lib/components/editor/parseScript/buildInFuncNamespace/input.d.ts +70 -0
  17. package/lib/components/editor/parseScript/buildInFuncNamespace/map.d.ts +37 -0
  18. package/lib/components/editor/parseScript/buildInFuncNamespace/math.d.ts +47 -0
  19. package/lib/components/editor/parseScript/buildInFuncNamespace/matrix.d.ts +136 -0
  20. package/lib/components/editor/parseScript/buildInFuncNamespace/string.d.ts +43 -0
  21. package/lib/components/editor/parseScript/buildInFuncNamespace/ta.d.ts +116 -0
  22. package/lib/components/editor/parseScript/buildInFuncNamespace/timeframe.d.ts +19 -0
  23. package/lib/components/editor/parseScript/buildInVariables.d.ts +122 -0
  24. package/lib/components/editor/parseScript/constants.d.ts +56 -0
  25. package/lib/components/editor/parseScript/enum.d.ts +248 -0
  26. package/lib/components/editor/parseScript/parseToJs.d.ts +44 -0
  27. package/lib/components/editor/parseScript/type.d.ts +27 -0
  28. package/lib/components/editor/parseScript/userTypeClass.d.ts +12 -0
  29. package/lib/components/editor/parseScript/utils.d.ts +8 -0
  30. package/lib/components/editor/parseScript/visitorParser.d.ts +303 -0
  31. package/lib/components/editor/parseScript/visitorUtils.d.ts +30 -0
  32. package/lib/components/editor/parseScript/workerStorage.d.ts +12 -0
  33. package/lib/components/editor/tokenizer/config.d.ts +40 -0
  34. package/lib/components/editor/tokenizer/utils.d.ts +33 -0
  35. package/lib/components/editor/type/index.d.ts +70 -0
  36. package/lib/components/editor/utils/color.d.ts +33 -0
  37. package/lib/components/editor/utils/completions.d.ts +61 -0
  38. package/lib/components/editor/utils/decorations.d.ts +23 -0
  39. package/lib/components/editor/utils/initEditor.d.ts +23 -0
  40. package/lib/components/editor/utils/overlayWidgets.d.ts +22 -0
  41. package/lib/components/editor/utils/parse.d.ts +43 -0
  42. package/lib/components/editor/utils/parserTccWorker.d.ts +25 -0
  43. package/lib/components/editor/utils/signatureHelp.d.ts +29 -0
  44. package/lib/components/editor/utils/suggestions.d.ts +18 -0
  45. package/lib/components/editor/utils/test.d.ts +22 -0
  46. package/lib/components/editor/utils/tools.d.ts +1 -0
  47. package/lib/main.d.ts +1 -0
  48. package/lib/packages/index.d.ts +5 -0
  49. package/lib/tccParser/LexerBase.d.ts +19 -0
  50. package/lib/tccParser/tccScriptParserVisitor.d.ts +486 -0
  51. package/lib/trading-vue-editor.js +64939 -0
  52. package/lib/trading-vue-editor.umd.cjs +144 -0
  53. package/package.json +53 -0
@@ -0,0 +1,40 @@
1
+ export declare enum Token {
2
+ Comment = "comment",
3
+ Text = "text",
4
+ String = "string",
5
+ Paren = "paren",
6
+ StringInvalid = "string.invalid",
7
+ ConstantNumericInteger = "constant.numeric.integer",
8
+ ConstantNumericFloat = "constant.numeric.float",
9
+ ConstantLanguage = "constant.language",
10
+ ConstantLanguageBoolean = "constant.other.boolean",
11
+ ConstantOtherColor = "constant.other.color",
12
+ SupportVariable = "support.variable",
13
+ SupportType = "support.type",
14
+ Keyword = "keyword",
15
+ KeywordEquals = "keyword.equals",
16
+ KeywordOperator = "keyword.operator",
17
+ CustomType = "entity.name.type",
18
+ VariableOther = "variable.other",
19
+ Property = "variable.other.property",
20
+ SupportFunction = "support.function",
21
+ SupportMethod = "support.method",
22
+ ImportedFunction = "meta.function-call",
23
+ Function = "entity.name.function",
24
+ ImportName = "entity.name.module",
25
+ ImportAlias = "entity.name.module.name",
26
+ ExtensionMethod = "entity.name.method",
27
+ Annotation = "comment.annotation",
28
+ PunctuationOperator = "punctuation.operator",
29
+ Empty = "empty",
30
+ Source = "source"
31
+ }
32
+ export declare enum DocTitle {
33
+ Type = "type",
34
+ Returns = "Returns",
35
+ Syntax = "Syntax",
36
+ Remarks = "Remarks",
37
+ Fields = "Fields",
38
+ Description = "Description",
39
+ Example = "Example"
40
+ }
@@ -0,0 +1,33 @@
1
+ import { IDocValue } from '../type';
2
+ import { Token } from './config';
3
+ import { IKeys } from '../constants/contents';
4
+ export declare function mergeToRegExpStr(keys: string[]): string;
5
+ interface ITokenRules {
6
+ [key: string]: ITokenRule[];
7
+ }
8
+ interface ITokenRule {
9
+ token?: Token | string | Token[];
10
+ regex?: string | RegExp;
11
+ next?: string;
12
+ merge?: boolean;
13
+ id?: string;
14
+ defaultToken?: string | Token;
15
+ [key: string]: unknown;
16
+ }
17
+ export declare function removeArrow(str: string): string;
18
+ export declare function getTokenRules(fields: IKeys): ITokenRules;
19
+ export declare class FormatMarkdown {
20
+ delimiter: string;
21
+ lineBreak: string;
22
+ paragraphBreak: string;
23
+ constructor();
24
+ bold(value: string): string;
25
+ italic(value: string): string;
26
+ pineCode(value: string): string;
27
+ code(value: string): string;
28
+ paragraph(...values: string[]): string;
29
+ link(value: string, url: URL): string;
30
+ }
31
+ export declare const formatMarkdown: FormatMarkdown;
32
+ export declare function markdownHoverBuilder(items: IDocValue[], currentIndex?: number, isSupport?: boolean): string;
33
+ export {};
@@ -0,0 +1,70 @@
1
+ import { IRange, languages, IMarkdownString, IPosition } from 'monaco-editor';
2
+ export interface IBaseItem {
3
+ label: string;
4
+ insertText?: string;
5
+ returnType?: string | string[];
6
+ constents?: IMarkdownString;
7
+ }
8
+ export interface ISuggestion extends Omit<languages.CompletionItem, 'range' | 'label'> {
9
+ label: string;
10
+ range?: IRange | languages.CompletionItemRanges;
11
+ }
12
+ export interface IModules {
13
+ [key: string]: ISuggestion;
14
+ }
15
+ export interface IKeyValue {
16
+ [key: string]: string | number;
17
+ }
18
+ export interface IKeyValueStr {
19
+ [key: string]: string;
20
+ }
21
+ export interface IKeyObjectValue {
22
+ [key: string]: any;
23
+ }
24
+ export interface IDocValue {
25
+ name: string;
26
+ title?: string;
27
+ desc?: string[];
28
+ kind?: string;
29
+ type?: string;
30
+ color?: string;
31
+ syntax?: string[];
32
+ detailedDesc?: IDetailedDesc[];
33
+ fields?: IField[];
34
+ returns?: string[];
35
+ remarks?: string | string[];
36
+ seeAlso?: string[];
37
+ args?: IArg[];
38
+ examples?: string[];
39
+ returnedTypes?: string[];
40
+ originalName?: string;
41
+ thisType?: string[];
42
+ template?: boolean;
43
+ info?: string;
44
+ range?: IRange;
45
+ isUser?: boolean;
46
+ pos?: IPosition;
47
+ scope?: number;
48
+ isForVar?: boolean;
49
+ hasMemberIndex?: boolean;
50
+ declare?: string;
51
+ }
52
+ export interface IDetailedDesc {
53
+ desc: string[];
54
+ examples?: string[];
55
+ }
56
+ export interface IField {
57
+ name: string;
58
+ desc?: string;
59
+ type?: string;
60
+ originName?: string;
61
+ isArg?: boolean;
62
+ isVarip?: boolean;
63
+ }
64
+ export interface IArg {
65
+ name: string;
66
+ desc?: string;
67
+ required?: boolean;
68
+ allowedTypeIDs?: string[];
69
+ displayType?: string;
70
+ }
@@ -0,0 +1,33 @@
1
+ import { editor, languages } from 'monaco-editor';
2
+ export declare class Color {
3
+ private _colors;
4
+ constructor();
5
+ getDocumentColors(list: editor.FindMatch[]): languages.IColorInformation[];
6
+ private get _defultColorsRegStr();
7
+ get colorMatchesRegStr(): string;
8
+ getDocumentColorPresentations(model: editor.ITextModel, { color, range }: languages.IColorInformation): {
9
+ label: string;
10
+ }[] | {
11
+ label: string;
12
+ textEdit: {
13
+ text: string;
14
+ range: import("monaco-editor").IRange;
15
+ };
16
+ }[] | null;
17
+ private _hexFromNumber;
18
+ private _normalize;
19
+ private _denormalize;
20
+ private _normalizeAlpha;
21
+ private _denormalizeAlpha;
22
+ private _extractNewExpression;
23
+ private _colorHexRepresentation;
24
+ private _colorRgbRepresentation;
25
+ private _colorNewRepresentation;
26
+ private _hexToColor;
27
+ private _rgbToColor;
28
+ private _isHexToken;
29
+ private _isRgbColor;
30
+ private _isColorExpression;
31
+ }
32
+ declare const _default: Color;
33
+ export default _default;
@@ -0,0 +1,61 @@
1
+ import { IDocValue, ISuggestion } from '../type';
2
+ export declare class MyCompletion {
3
+ private _bracketsPostfix;
4
+ private _builtinSubtreeCache;
5
+ private _formatter;
6
+ private _namespaceCache;
7
+ private _suggestions;
8
+ private _outermostNsItems;
9
+ private _funcArgsCache;
10
+ private _userSuggestions;
11
+ private _userFuncArgsCache;
12
+ private _userNamespaceCache;
13
+ private _userOutermostNsItems;
14
+ private _methodNamespaceCache;
15
+ private _userMethods;
16
+ private _userFunctions;
17
+ private _methodFuncs;
18
+ private _userTypes;
19
+ constructor();
20
+ get methodFuncs(): Map<string, IDocValue[]>;
21
+ get userFuncs(): Map<string, IDocValue[]>;
22
+ initBuiltinsTrees(): void;
23
+ getArgSuggestions(key: string): ISuggestion[] | undefined;
24
+ getSuggestions(key?: string): ISuggestion[] | undefined;
25
+ private _initUserDefind;
26
+ setUserDefind(functions: Map<string, IDocValue[]>, types: Map<string, IDocValue[]>, variables: Map<string, IDocValue[]>, methods: Map<string, IDocValue[]>): void;
27
+ private _getAllUserCompletionItems;
28
+ private _getAllCompletionItems;
29
+ private _getNodeKey;
30
+ private _mergeTreeSlices;
31
+ private _mergeCompletions;
32
+ private _mergeUserCompletions;
33
+ private _generateTreeSlice;
34
+ private _getBuiltinsCacheFragment;
35
+ private _getVariableCompletionItems;
36
+ private _setUserVariableSubItems;
37
+ private _getUserVariableCompletionItems;
38
+ private _getTypeCompletionItems;
39
+ private _getKeywordCompletionItems;
40
+ private _getMethodNamespaceCache;
41
+ private _getFunctionCompletionItems;
42
+ private _getSnippetsCompletionsList;
43
+ private _getFuncArgumentsCompletionItemsToCache;
44
+ private _getUserFuncArgumentsCompletionItemsToCache;
45
+ private _getNamedArgumentsCompletionList;
46
+ private _getVariableCompletionItem;
47
+ private _getKeywordCompletionItem;
48
+ private _getTypeCompletionItem;
49
+ private _getCustomTypeCompletionItem;
50
+ private _getInstanceTypeCompletionItemProp;
51
+ private _getFunctionCompletionItem;
52
+ private _getNamespaceCompletionItem;
53
+ private _extractExamples;
54
+ private _extractDescription;
55
+ private _createExampleSection;
56
+ private _createSyntaxSection;
57
+ private _createReturnSection;
58
+ private _createDescriptionSection;
59
+ }
60
+ declare const _default: MyCompletion;
61
+ export default _default;
@@ -0,0 +1,23 @@
1
+ import { Monaco } from "@monaco-editor/react";
2
+ import { editor } from "monaco-editor";
3
+ export declare class DiffDecorations {
4
+ private _editor;
5
+ private _monaco;
6
+ private _originalModel;
7
+ private _oldDecorations;
8
+ private _diffEditor?;
9
+ private _diffPopupWidget?;
10
+ private _didChangeListener?;
11
+ private _onMouseDownListener?;
12
+ constructor(editor: editor.IStandaloneCodeEditor, monaco: Monaco, theme?: string);
13
+ private _init;
14
+ update(val: string): void;
15
+ dispose(): void;
16
+ private _changesHandle;
17
+ private _changeHandle;
18
+ private _addDecorationList;
19
+ private _changeEvent;
20
+ private _eventListening;
21
+ private _onMouseDownHandle;
22
+ private _createDiffEditor;
23
+ }
@@ -0,0 +1,23 @@
1
+ import { Monaco } from "@monaco-editor/react";
2
+ import { IPosition, editor } from "monaco-editor";
3
+ export default class InitEditor {
4
+ private _editor;
5
+ private _monaco;
6
+ private _decorations?;
7
+ private _changPositionListener?;
8
+ constructor(editor: editor.IStandaloneCodeEditor, monaco: Monaco);
9
+ setModelMarkers(markers: editor.IMarkerData[]): void;
10
+ addDiffDecorations(): void;
11
+ removeDiffDecorations(): void;
12
+ setValue(val: string): void;
13
+ saveScripts(): void;
14
+ private _init;
15
+ private _setCursorPosition;
16
+ private _register;
17
+ private _setOptions;
18
+ private _addCommands;
19
+ private _addActions;
20
+ gotoLine(): void;
21
+ onChangeCursorPosition(_callback?: (postion: IPosition) => void): void;
22
+ private _addListening;
23
+ }
@@ -0,0 +1,22 @@
1
+ import { editor } from "monaco-editor";
2
+ export type TChangeType = 'added' | 'removed' | 'modified';
3
+ export declare enum ChangeType {
4
+ added = "added",
5
+ removed = "removed",
6
+ modified = "modified"
7
+ }
8
+ export declare class DiffPopupWidget {
9
+ private _domNode;
10
+ private _id;
11
+ private _top;
12
+ private _content?;
13
+ constructor(id: string, editor: editor.IStandaloneCodeEditor, hasMap?: boolean);
14
+ private _close;
15
+ private _retracement;
16
+ getId(): string;
17
+ getDomNode(): HTMLElement;
18
+ getPosition(): null;
19
+ show(top: number, originalTop: number, type: TChangeType): void;
20
+ hide(): void;
21
+ private scrollChangeHandler;
22
+ }
@@ -0,0 +1,43 @@
1
+ import { IDocValue, IKeyObjectValue, IKeyValue } from '../type';
2
+ interface IUserDefined {
3
+ functions?: Map<string, IDocValue[]>;
4
+ variables?: Map<string, IDocValue[]>;
5
+ types?: Map<string, IDocValue[]>;
6
+ methods?: Map<string, IDocValue[]>;
7
+ }
8
+ export declare class Parse {
9
+ private _userFunctions;
10
+ private _userVariables;
11
+ private _userTypes;
12
+ private _userMethods;
13
+ private _overloadsFuncs;
14
+ constructor();
15
+ setUserDefined(maps: IUserDefined, overloadsFuncs: IKeyValue[]): void;
16
+ parseLineContentFuncVar(lineContent: string, column: number, line: number): IKeyObjectValue | null | undefined;
17
+ private _getBuildInFunc;
18
+ private _getBuildInMethod;
19
+ private _getBuildInOther;
20
+ parseCurrentInputFunc(content: string, isQString?: boolean, isQqString?: boolean): {
21
+ funcName: string;
22
+ startIndex: number;
23
+ } | undefined;
24
+ parseCurrentInputFuncAndArg(content: string, isQString?: boolean, isQqString?: boolean): {
25
+ funcName: string;
26
+ args: string[];
27
+ } | undefined;
28
+ private _removeString;
29
+ private _getVariablesDocVal;
30
+ private _getUserVariablesDocVal;
31
+ private _getUserTypesDocVal;
32
+ private _getTypesAndFileds;
33
+ private _getFuncsDocVal;
34
+ private _getOverloadsFuncIndex;
35
+ private _getUserFuncsDocVal;
36
+ private _getUserMethodsDocVal;
37
+ private _getUserVarFuncsDocVal;
38
+ private _arrayTypeTransform;
39
+ private _matchContent;
40
+ private _judgeVal;
41
+ }
42
+ declare const _default: Parse;
43
+ export default _default;
@@ -0,0 +1,25 @@
1
+ /// <reference path="../../../../src/vite-env.d.ts" />
2
+ import { ErrorListener } from 'antlr4';
3
+ import { IKeyObjectValue } from '../type';
4
+ export default function parseTcc(program: string, hasTranscoding: boolean, keyObjs: IKeyObjectValue): Promise<{
5
+ errors: import("../parseScript/type").IError[];
6
+ functions: {
7
+ [k: string]: import("../type").IDocValue[];
8
+ };
9
+ variables: {
10
+ [k: string]: import("../type").IDocValue[];
11
+ };
12
+ types: {
13
+ [k: string]: import("../type").IDocValue[];
14
+ };
15
+ methods: {
16
+ [k: string]: import("../type").IDocValue[];
17
+ };
18
+ overloadsFuncs: import("../type").IKeyValue[];
19
+ codeStr: string;
20
+ preParserCode: string;
21
+ }>;
22
+ export declare class ExprErrorListener extends ErrorListener {
23
+ errors: any[];
24
+ syntaxError(_: any, __: any, line: number, column: number, msg: string): void;
25
+ }
@@ -0,0 +1,29 @@
1
+ export declare class SignatureHelp {
2
+ private _formatter;
3
+ private _isMac;
4
+ constructor(userAgent: string);
5
+ getSignatureHelpValues(funcName: string, args?: string[]): {
6
+ activeParameter: number;
7
+ activeSignature: number;
8
+ signatures: {
9
+ label: string;
10
+ documentation: {
11
+ value: string;
12
+ };
13
+ parameters: {
14
+ label: any[];
15
+ documentation: {
16
+ value: string;
17
+ };
18
+ }[];
19
+ }[];
20
+ } | null;
21
+ private _getActiveIndex;
22
+ private _getFuncItems;
23
+ private _getSequentialSignatures;
24
+ private _getSignatureLabel;
25
+ private _getFormattedSignatureDocumentation;
26
+ private _getSignatureParams;
27
+ }
28
+ declare const _default: SignatureHelp;
29
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import { Position, editor, languages, IRange, Uri } from 'monaco-editor';
2
+ export declare function provideCompletionItems(model: editor.ITextModel, position: Position): languages.ProviderResult<languages.CompletionList>;
3
+ export declare function provideHover(model: editor.ITextModel, position: Position): languages.ProviderResult<languages.Hover>;
4
+ export declare function provideSignatureHelp(model: editor.ITextModel, position: Position): languages.ProviderResult<languages.SignatureHelpResult>;
5
+ export declare function provideDocumentColors(model: editor.ITextModel): languages.IColorInformation[];
6
+ export declare function provideColorPresentations(model: editor.ITextModel, colorInfo: languages.IColorInformation): {
7
+ label: string;
8
+ }[];
9
+ export declare function openCodeEditor(source: editor.ICodeEditor, _: Uri, selectionOrPosition: IRange): boolean;
10
+ export declare function provideDefinition(model: editor.ITextModel, position: Position): {
11
+ uri: Uri;
12
+ range: {
13
+ startLineNumber: number;
14
+ endLineNumber: number;
15
+ startColumn: number;
16
+ endColumn: number;
17
+ };
18
+ };
@@ -0,0 +1,22 @@
1
+ /// <reference path="../../../../src/vite-env.d.ts" />
2
+ import { ErrorListener } from 'antlr4';
3
+ export default function parseTcc(program: string): {
4
+ errors: import("../parseScript/type").IError[];
5
+ functions: {
6
+ [k: string]: import("../type").IDocValue[];
7
+ };
8
+ variables: {
9
+ [k: string]: import("../type").IDocValue[];
10
+ };
11
+ types: {
12
+ [k: string]: import("../type").IDocValue[];
13
+ };
14
+ methods: {
15
+ [k: string]: import("../type").IDocValue[];
16
+ };
17
+ overloadsFuncs: import("../type").IKeyValue[];
18
+ };
19
+ export declare class ExprErrorListener extends ErrorListener {
20
+ errors: any[];
21
+ syntaxError(_: any, __: any, line: number, column: number, msg: string): void;
22
+ }
@@ -0,0 +1 @@
1
+ export declare function getTypeOriginName(type: string): string;
package/lib/main.d.ts ADDED
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1,5 @@
1
+ export { default as TradingVueEditor } from '../components/editor/index';
2
+ export type { IRefs as IEditorRefs } from '../components/editor/index';
3
+ export { parseTcc, scriptsRun } from '../components/editor/utils/parserTcc';
4
+ export type { IError, IPosition } from '../components/editor/parseScript/type';
5
+ export { VMarkerSeverity } from '../components/editor/parseScript/type';
@@ -0,0 +1,19 @@
1
+ /// <reference path="../../src/vite-env.d.ts" />
2
+ import { Lexer } from "antlr4";
3
+ export default abstract class LexerBase extends Lexer {
4
+ tokens: any[];
5
+ indents: any[];
6
+ opened: number;
7
+ constructor(input: any);
8
+ reset(): void;
9
+ emitToken(token: any): void;
10
+ nextToken(): any;
11
+ createDedent(): any;
12
+ getCharIndex(): any;
13
+ commonToken(type: number, text: string): any;
14
+ getIndentationCount(whitespace: string): number;
15
+ atStartOfInput(): boolean;
16
+ openBrace(): void;
17
+ closeBrace(): void;
18
+ onNewLine(): void;
19
+ }