@knime/scripting-editor 0.0.46 → 0.0.48
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/dist/lib/main.d.ts +9 -10
- package/dist/main.js +20002 -0
- package/dist/scripting-service-browser-mock.d.ts +1 -0
- package/dist/scripting-service-browser-mock.js +111 -0
- package/dist/scripting-service-instance.d.ts +1 -0
- package/dist/scripting-service-instance.js +8 -0
- package/dist/src/components/CompactTabBar.vue.d.ts +3 -1
- package/dist/src/components/InputOutputItem.vue.d.ts +13 -10
- package/dist/src/components/InputOutputPane.vue.d.ts +2 -2
- package/dist/src/components/OutputConsole.vue.d.ts +7 -3
- package/dist/src/components/ScriptingEditor.vue.d.ts +58 -128
- package/dist/src/components/{AiBar.vue.d.ts → ai-assistant/AiBar.vue.d.ts} +3 -3
- package/dist/src/components/ai-assistant/AiSuggestion.vue.d.ts +6 -0
- package/dist/src/consoleHandler.d.ts +3 -0
- package/dist/src/editor.d.ts +63 -0
- package/dist/src/scripting-service-browser-mock.d.ts +30 -0
- package/dist/src/scripting-service-instance.d.ts +21 -0
- package/dist/src/scripting-service.d.ts +33 -22
- package/package.json +40 -36
- package/dist/knime-scripting-editor.js +0 -23747
- package/dist/src/components/CodeEditor.vue.d.ts +0 -43
- package/dist/src/editor-service.d.ts +0 -27
- package/dist/src/store/editor.d.ts +0 -8
- /package/dist/{knime-scripting-editor.d.ts → main.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/scripting-service-browser-mock'
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
function l(e) {
|
|
2
|
+
return new Promise((n) => setTimeout(n, e));
|
|
3
|
+
}
|
|
4
|
+
const c = 100, a = 2e3, r = (e, ...n) => {
|
|
5
|
+
typeof consola > "u" ? console.log(e, ...n) : consola.log(e, ...n);
|
|
6
|
+
}, u = (e, ...n) => {
|
|
7
|
+
typeof consola > "u" ? console.error(e, ...n) : consola.error(e, ...n);
|
|
8
|
+
}, i = (e) => (...n) => (r(`Called scriptingService.${e}`, ...n), Promise.resolve()), g = [
|
|
9
|
+
{
|
|
10
|
+
name: "Input Table 1",
|
|
11
|
+
subItems: [
|
|
12
|
+
{
|
|
13
|
+
name: "Column 1",
|
|
14
|
+
type: "Number"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "Column 2",
|
|
18
|
+
type: "String"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "Column 3",
|
|
22
|
+
type: "String"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
], S = [
|
|
27
|
+
{
|
|
28
|
+
name: "Output Table 1"
|
|
29
|
+
}
|
|
30
|
+
], d = {
|
|
31
|
+
name: "Flow Variables",
|
|
32
|
+
subItems: [
|
|
33
|
+
{
|
|
34
|
+
name: "flowVar1",
|
|
35
|
+
type: "Number"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "flowVar2",
|
|
39
|
+
type: "String"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "flowVar3",
|
|
43
|
+
type: "String"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}, v = (e) => {
|
|
47
|
+
const n = /* @__PURE__ */ new Map(), o = {
|
|
48
|
+
getHubId: () => Promise.resolve("My Mocked KNIME Hub"),
|
|
49
|
+
isLoggedIn: () => Promise.resolve(!0),
|
|
50
|
+
suggestCode: async () => {
|
|
51
|
+
await l(a);
|
|
52
|
+
const s = n.get("codeSuggestion");
|
|
53
|
+
return typeof s < "u" && s({
|
|
54
|
+
status: "SUCCESS",
|
|
55
|
+
code: JSON.stringify({ code: "// THIS IS A FAKE AI SUGGESTION" })
|
|
56
|
+
}), {};
|
|
57
|
+
},
|
|
58
|
+
abortSuggestCodeRequest: () => Promise.resolve()
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
async sendToService(s, t) {
|
|
62
|
+
return r(`Called scriptingService.sendToService("${s}")`, t), await l(c), e.sendToServiceMockResponses && s in e.sendToServiceMockResponses ? e.sendToServiceMockResponses[s](t) : s in o ? o[s](t) : (u(
|
|
63
|
+
`${s} not implemented in sendToServiceMockResponses.
|
|
64
|
+
Returning undefined.`
|
|
65
|
+
), Promise.resolve());
|
|
66
|
+
},
|
|
67
|
+
// Settings and dialog window
|
|
68
|
+
getInitialSettings() {
|
|
69
|
+
return r("Called scriptingService.getInitialSettings"), Promise.resolve(e.initialSettings ?? { script: "Hello world" });
|
|
70
|
+
},
|
|
71
|
+
saveSettings: i("saveSettings"),
|
|
72
|
+
closeDialog: i("closeDialog"),
|
|
73
|
+
// Input and output objects
|
|
74
|
+
inputsAvailable() {
|
|
75
|
+
return r("Called scriptingService.inputsAvailable"), Promise.resolve(e.inputsAvailable ?? !0);
|
|
76
|
+
},
|
|
77
|
+
getInputObjects() {
|
|
78
|
+
return r("Called scriptingService.getInputObjects"), Promise.resolve(e.inputObjects ?? g);
|
|
79
|
+
},
|
|
80
|
+
getOutputObjects() {
|
|
81
|
+
return r("Called scriptingService.getOutputObjects"), Promise.resolve(e.outputObjects ?? S);
|
|
82
|
+
},
|
|
83
|
+
getFlowVariableInputs() {
|
|
84
|
+
return r("Called scriptingService.getFlowVariableInputs"), Promise.resolve(
|
|
85
|
+
e.flowVariableInputs ?? d
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
// Code assistant
|
|
89
|
+
isCodeAssistantInstalled() {
|
|
90
|
+
return r("Called scriptingService.isCodeAssistantInstalled"), Promise.resolve(!0);
|
|
91
|
+
},
|
|
92
|
+
isCodeAssistantEnabled() {
|
|
93
|
+
return r("Called scriptingService.isCodeAssistantEnabled"), Promise.resolve(!0);
|
|
94
|
+
},
|
|
95
|
+
// Event handler
|
|
96
|
+
registerEventHandler(s, t) {
|
|
97
|
+
r("Called scriptingService.registerEventHandler", s), n.set(s, t);
|
|
98
|
+
},
|
|
99
|
+
// Language server
|
|
100
|
+
connectToLanguageServer: i("connectToLanguageServer"),
|
|
101
|
+
configureLanguageServer: i("configureLanguageServer"),
|
|
102
|
+
// Console handling
|
|
103
|
+
eventHandlers: n
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
d as DEFAULT_FLOW_VARIABLE_INPUTS,
|
|
108
|
+
g as DEFAULT_INPUT_OBJECTS,
|
|
109
|
+
S as DEFAULT_OUTPUT_OBJECTS,
|
|
110
|
+
v as createScriptingServiceMock
|
|
111
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/scripting-service-instance'
|
|
@@ -15,7 +15,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
15
15
|
type: ArrayConstructor;
|
|
16
16
|
default: () => never[];
|
|
17
17
|
};
|
|
18
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
18
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
"update:modelValue": (...args: any[]) => void;
|
|
20
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
21
|
disabled: {
|
|
20
22
|
type: BooleanConstructor;
|
|
21
23
|
default: boolean;
|
|
@@ -23,15 +23,18 @@ export type InputOutputModel = {
|
|
|
23
23
|
}[];
|
|
24
24
|
};
|
|
25
25
|
export declare const INPUT_OUTPUT_DRAG_EVENT_ID = "input_output_drag_event";
|
|
26
|
-
declare const _default: import("vue").DefineComponent<{
|
|
27
|
-
inputOutputItem:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
27
|
+
inputOutputItem: InputOutputModel;
|
|
28
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
29
|
+
inputOutputItem: InputOutputModel;
|
|
30
|
+
}>>>, {}, {}>;
|
|
31
|
+
export default _default;
|
|
32
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
33
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
34
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
35
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
36
|
+
} : {
|
|
37
|
+
type: import('vue').PropType<T[K]>;
|
|
34
38
|
required: true;
|
|
35
39
|
};
|
|
36
|
-
}
|
|
37
|
-
export default _default;
|
|
40
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
2
|
-
"drop-event-handler-created": (dropEventHandler:
|
|
2
|
+
"drop-event-handler-created": (dropEventHandler: (payload: DragEvent) => void) => void;
|
|
3
3
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
|
|
4
|
-
"onDrop-event-handler-created"?: ((dropEventHandler:
|
|
4
|
+
"onDrop-event-handler-created"?: ((dropEventHandler: (payload: DragEvent) => void) => any) | undefined;
|
|
5
5
|
}, {}, {}>;
|
|
6
6
|
export default _default;
|
|
@@ -6,11 +6,15 @@ export type ConsoleText = XOR<{
|
|
|
6
6
|
}, {
|
|
7
7
|
error: string;
|
|
8
8
|
}>;
|
|
9
|
-
export type ConsoleHandler =
|
|
9
|
+
export type ConsoleHandler = {
|
|
10
|
+
writeln: (text: ConsoleText) => void;
|
|
11
|
+
write: (text: ConsoleText) => void;
|
|
12
|
+
clear: () => void;
|
|
13
|
+
};
|
|
10
14
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
-
"console-created": (handler: ConsoleHandler
|
|
15
|
+
"console-created": (handler: ConsoleHandler) => void;
|
|
12
16
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
|
|
13
|
-
"onConsole-created"?: ((handler: ConsoleHandler
|
|
17
|
+
"onConsole-created"?: ((handler: ConsoleHandler) => any) | undefined;
|
|
14
18
|
}, {}, {}>, {
|
|
15
19
|
"console-status"?(_: {}): any;
|
|
16
20
|
}>;
|
|
@@ -1,142 +1,72 @@
|
|
|
1
|
-
import { type PropType } from "vue";
|
|
2
|
-
import { type SettingsMenuItem } from "./SettingsPage.vue";
|
|
3
1
|
import type { MenuItem } from "webapps-common/ui/components/MenuItems.vue";
|
|
4
|
-
import type { editor } from "monaco-editor";
|
|
5
|
-
import type { ConsoleHandler } from "./OutputConsole.vue";
|
|
6
2
|
export type PaneSizes = {
|
|
7
3
|
[key in "left" | "right" | "bottom"]: number;
|
|
8
4
|
};
|
|
9
|
-
|
|
10
|
-
title:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
menuItems: {
|
|
27
|
-
type: {
|
|
28
|
-
(arrayLength: number): MenuItem[];
|
|
29
|
-
(...items: MenuItem[]): MenuItem[];
|
|
30
|
-
new (arrayLength: number): MenuItem[];
|
|
31
|
-
new (...items: MenuItem[]): MenuItem[];
|
|
32
|
-
isArray(arg: any): arg is any[];
|
|
33
|
-
readonly prototype: any[];
|
|
34
|
-
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
35
|
-
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
36
|
-
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
37
|
-
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
38
|
-
of<T_4>(...items: T_4[]): T_4[];
|
|
39
|
-
readonly [Symbol.species]: ArrayConstructor;
|
|
40
|
-
};
|
|
41
|
-
default: never[];
|
|
42
|
-
};
|
|
43
|
-
showControlBar: {
|
|
44
|
-
type: BooleanConstructor;
|
|
45
|
-
default: boolean;
|
|
46
|
-
};
|
|
47
|
-
initialPaneSizes: {
|
|
48
|
-
type: PropType<PaneSizes>;
|
|
49
|
-
default: PaneSizes;
|
|
50
|
-
};
|
|
51
|
-
}, unknown, {
|
|
52
|
-
currentPaneSizes: PaneSizes;
|
|
53
|
-
previousPaneSizes: PaneSizes;
|
|
54
|
-
commonMenuItems: MenuItem[];
|
|
55
|
-
editorModel: editor.ITextModel | null;
|
|
56
|
-
showSettingsPage: boolean;
|
|
57
|
-
bottomPaneOptions: {
|
|
58
|
-
value: string;
|
|
59
|
-
label: string;
|
|
60
|
-
}[];
|
|
61
|
-
bottomPaneActiveTab: import("vue").Ref<string>;
|
|
62
|
-
dropEventHandler: Function | null;
|
|
63
|
-
}, {
|
|
64
|
-
usedMainPaneSize(): number;
|
|
65
|
-
usedHorizontalCodeEditorPaneSize(): number;
|
|
66
|
-
usedVerticalCodeEditorPaneSize(): number;
|
|
67
|
-
isLeftPaneCollapsed(): boolean;
|
|
68
|
-
isRightPaneCollapsed(): boolean;
|
|
69
|
-
isBottomPaneCollapsed(): boolean;
|
|
70
|
-
}, {
|
|
71
|
-
collapsePane(pane: keyof PaneSizes): void;
|
|
72
|
-
resizePane(size: number, pane: keyof PaneSizes, updatePreviousPaneSize?: boolean): void;
|
|
73
|
-
updatePreviousPaneSize(pane: keyof PaneSizes): void;
|
|
74
|
-
updateRightPane(size: number): void;
|
|
75
|
-
onMonacoCreated({ editor, editorModel, }: {
|
|
76
|
-
editor: editor.IStandaloneCodeEditor;
|
|
77
|
-
editorModel: editor.ITextModel;
|
|
78
|
-
}): void;
|
|
79
|
-
saveSettings(): void;
|
|
80
|
-
closeDialog(): void;
|
|
81
|
-
onMenuItemClicked(args: {
|
|
82
|
-
event: Event;
|
|
83
|
-
item: SettingsMenuItem;
|
|
84
|
-
}): void;
|
|
85
|
-
onDropEventHandlerCreated(dropEventHandler: Function): void;
|
|
86
|
-
onConsoleCreated(handler: ConsoleHandler, clearConsoleCallback: () => void): void;
|
|
87
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("monaco-created" | "menu-item-clicked" | "save-settings")[], "monaco-created" | "menu-item-clicked" | "save-settings", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
88
|
-
title: {
|
|
89
|
-
type: StringConstructor;
|
|
90
|
-
default: null;
|
|
91
|
-
};
|
|
92
|
-
language: {
|
|
93
|
-
type: StringConstructor;
|
|
94
|
-
default: null;
|
|
95
|
-
};
|
|
96
|
-
fileName: {
|
|
97
|
-
type: StringConstructor;
|
|
98
|
-
default: null;
|
|
99
|
-
};
|
|
100
|
-
rightPaneLayout: {
|
|
101
|
-
type: PropType<"fixed" | "relative">;
|
|
102
|
-
default: string;
|
|
103
|
-
};
|
|
104
|
-
menuItems: {
|
|
105
|
-
type: {
|
|
106
|
-
(arrayLength: number): MenuItem[];
|
|
107
|
-
(...items: MenuItem[]): MenuItem[];
|
|
108
|
-
new (arrayLength: number): MenuItem[];
|
|
109
|
-
new (...items: MenuItem[]): MenuItem[];
|
|
110
|
-
isArray(arg: any): arg is any[];
|
|
111
|
-
readonly prototype: any[];
|
|
112
|
-
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
113
|
-
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
114
|
-
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
115
|
-
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
116
|
-
of<T_4>(...items: T_4[]): T_4[];
|
|
117
|
-
readonly [Symbol.species]: ArrayConstructor;
|
|
118
|
-
};
|
|
119
|
-
default: never[];
|
|
120
|
-
};
|
|
121
|
-
showControlBar: {
|
|
122
|
-
type: BooleanConstructor;
|
|
123
|
-
default: boolean;
|
|
5
|
+
interface Props {
|
|
6
|
+
title: string;
|
|
7
|
+
language: string;
|
|
8
|
+
fileName: string;
|
|
9
|
+
rightPaneLayout?: "fixed" | "relative";
|
|
10
|
+
menuItems?: MenuItem[];
|
|
11
|
+
showControlBar?: boolean;
|
|
12
|
+
initialPaneSizes?: PaneSizes;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
15
|
+
rightPaneLayout: string;
|
|
16
|
+
menuItems: () => never[];
|
|
17
|
+
showControlBar: boolean;
|
|
18
|
+
initialPaneSizes: () => {
|
|
19
|
+
left: number;
|
|
20
|
+
right: number;
|
|
21
|
+
bottom: number;
|
|
124
22
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
23
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
|
+
"menu-item-clicked": (...args: any[]) => void;
|
|
25
|
+
"save-settings": (...args: any[]) => void;
|
|
26
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
27
|
+
rightPaneLayout: string;
|
|
28
|
+
menuItems: () => never[];
|
|
29
|
+
showControlBar: boolean;
|
|
30
|
+
initialPaneSizes: () => {
|
|
31
|
+
left: number;
|
|
32
|
+
right: number;
|
|
33
|
+
bottom: number;
|
|
128
34
|
};
|
|
129
|
-
}
|
|
130
|
-
"onMonaco-created"?: ((...args: any[]) => any) | undefined;
|
|
35
|
+
}>>> & {
|
|
131
36
|
"onMenu-item-clicked"?: ((...args: any[]) => any) | undefined;
|
|
132
37
|
"onSave-settings"?: ((...args: any[]) => any) | undefined;
|
|
133
38
|
}, {
|
|
134
|
-
title: string;
|
|
135
|
-
language: string;
|
|
136
|
-
fileName: string;
|
|
137
39
|
menuItems: MenuItem[];
|
|
138
40
|
rightPaneLayout: "fixed" | "relative";
|
|
139
41
|
showControlBar: boolean;
|
|
140
42
|
initialPaneSizes: PaneSizes;
|
|
141
|
-
}, {}
|
|
43
|
+
}, {}>, {
|
|
44
|
+
"settings-title"?(_: {}): any;
|
|
45
|
+
"settings-content"?(_: {}): any;
|
|
46
|
+
"code-editor-controls"?(_: {}): any;
|
|
47
|
+
"right-pane"?(_: {}): any;
|
|
48
|
+
"console-status"?(_: {}): any;
|
|
49
|
+
}>;
|
|
142
50
|
export default _default;
|
|
51
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
52
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
53
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
54
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
55
|
+
} : {
|
|
56
|
+
type: import('vue').PropType<T[K]>;
|
|
57
|
+
required: true;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
type __VLS_WithDefaults<P, D> = {
|
|
61
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
62
|
+
default: D[K];
|
|
63
|
+
}> : P[K];
|
|
64
|
+
};
|
|
65
|
+
type __VLS_Prettify<T> = {
|
|
66
|
+
[K in keyof T]: T[K];
|
|
67
|
+
} & {};
|
|
68
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
69
|
+
new (): {
|
|
70
|
+
$slots: S;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PropType } from "vue";
|
|
2
|
-
import type { PaneSizes } from "
|
|
2
|
+
import type { PaneSizes } from "../ScriptingEditor.vue";
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
currentPaneSizes: {
|
|
5
5
|
type: PropType<PaneSizes>;
|
|
@@ -14,7 +14,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
14
14
|
default: null;
|
|
15
15
|
};
|
|
16
16
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
-
"accept-suggestion": (
|
|
17
|
+
"accept-suggestion": () => void;
|
|
18
18
|
"close-ai-bar": () => void;
|
|
19
19
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
20
|
currentPaneSizes: {
|
|
@@ -30,7 +30,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
30
30
|
default: null;
|
|
31
31
|
};
|
|
32
32
|
}>> & {
|
|
33
|
-
"onAccept-suggestion"?: ((
|
|
33
|
+
"onAccept-suggestion"?: (() => any) | undefined;
|
|
34
34
|
"onClose-ai-bar"?: (() => any) | undefined;
|
|
35
35
|
}, {
|
|
36
36
|
language: string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
2
|
+
"accept-suggestion": (acceptedCode: string) => void;
|
|
3
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
|
|
4
|
+
"onAccept-suggestion"?: ((acceptedCode: string) => any) | undefined;
|
|
5
|
+
}, {}, {}>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as monaco from "monaco-editor";
|
|
2
|
+
import { type Ref } from "vue";
|
|
3
|
+
type ContainerParams = {
|
|
4
|
+
/** The HTML element to mount the editor to. */
|
|
5
|
+
container: Ref<HTMLDivElement | undefined>;
|
|
6
|
+
};
|
|
7
|
+
export type UseCodeEditorParams = ContainerParams & ({
|
|
8
|
+
language: string;
|
|
9
|
+
fileName: string;
|
|
10
|
+
} | {
|
|
11
|
+
editorModel: monaco.editor.ITextModel;
|
|
12
|
+
});
|
|
13
|
+
export type UseCodeEditorReturn = {
|
|
14
|
+
editorModel: monaco.editor.ITextModel;
|
|
15
|
+
editor: Ref<monaco.editor.IStandaloneCodeEditor | undefined>;
|
|
16
|
+
/**
|
|
17
|
+
* The current text in the editor. Allows updating the full text. The user
|
|
18
|
+
* will be able to undo the change.
|
|
19
|
+
*/
|
|
20
|
+
text: Ref<string>;
|
|
21
|
+
/**
|
|
22
|
+
* The current selection in the editor.
|
|
23
|
+
*/
|
|
24
|
+
selection: Readonly<Ref<string>>;
|
|
25
|
+
/**
|
|
26
|
+
* All currently selected lines in the editor from first to last column.
|
|
27
|
+
* Also includes partly selected lines.
|
|
28
|
+
*/
|
|
29
|
+
selectedLines: Readonly<Ref<string>>;
|
|
30
|
+
/**
|
|
31
|
+
* Set the initial text of the editor. The user won't be able to undo this.
|
|
32
|
+
* @param text the text to set
|
|
33
|
+
*/
|
|
34
|
+
setInitialText: (text: string) => void;
|
|
35
|
+
};
|
|
36
|
+
export type UseDiffEditorParams = ContainerParams & {
|
|
37
|
+
originalModel: monaco.editor.ITextModel;
|
|
38
|
+
modifiedFileName: string;
|
|
39
|
+
};
|
|
40
|
+
export type UseDiffEditorReturn = {
|
|
41
|
+
editorModel: monaco.editor.IDiffEditorModel;
|
|
42
|
+
editor: Ref<monaco.editor.IStandaloneDiffEditor | undefined>;
|
|
43
|
+
/**
|
|
44
|
+
* The current modified text. Allows updating the full text. The user
|
|
45
|
+
* will be able to undo the change.
|
|
46
|
+
*/
|
|
47
|
+
modifiedText: Ref<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Set the initial modified text of the editor. The user won't be able to undo this.
|
|
50
|
+
* @param text the text to set
|
|
51
|
+
*/
|
|
52
|
+
setInitialModifiedText: (modifiedText: string) => void;
|
|
53
|
+
};
|
|
54
|
+
export declare const useCodeEditor: (params: UseCodeEditorParams) => UseCodeEditorReturn;
|
|
55
|
+
export declare const useDiffEditor: (params: UseDiffEditorParams) => UseDiffEditorReturn;
|
|
56
|
+
export declare const useMainCodeEditorStore: () => import("vue").ShallowRef<UseCodeEditorReturn | undefined>;
|
|
57
|
+
export declare const useMainCodeEditor: (params: UseCodeEditorParams) => UseCodeEditorReturn;
|
|
58
|
+
declare const _default: {
|
|
59
|
+
useCodeEditor: (params: UseCodeEditorParams) => UseCodeEditorReturn;
|
|
60
|
+
useDiffEditor: (params: UseDiffEditorParams) => UseDiffEditorReturn;
|
|
61
|
+
useMainCodeEditorStore: () => import("vue").ShallowRef<UseCodeEditorReturn | undefined>;
|
|
62
|
+
};
|
|
63
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { InputOutputModel } from "./components/InputOutputItem.vue";
|
|
2
|
+
import type { NodeSettings, ScriptingServiceType } from "./scripting-service";
|
|
3
|
+
export declare const DEFAULT_INPUT_OBJECTS: {
|
|
4
|
+
name: string;
|
|
5
|
+
subItems: {
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
}[];
|
|
9
|
+
}[];
|
|
10
|
+
export declare const DEFAULT_OUTPUT_OBJECTS: {
|
|
11
|
+
name: string;
|
|
12
|
+
}[];
|
|
13
|
+
export declare const DEFAULT_FLOW_VARIABLE_INPUTS: {
|
|
14
|
+
name: string;
|
|
15
|
+
subItems: {
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
export type ScriptingServiceMockOptions = {
|
|
21
|
+
sendToServiceMockResponses?: Record<string, (options?: any[]) => Promise<any>>;
|
|
22
|
+
initialSettings?: NodeSettings;
|
|
23
|
+
inputsAvailable?: boolean;
|
|
24
|
+
inputObjects?: InputOutputModel[];
|
|
25
|
+
outputObjects?: InputOutputModel[];
|
|
26
|
+
flowVariableInputs?: InputOutputModel;
|
|
27
|
+
};
|
|
28
|
+
export declare const createScriptingServiceMock: (opt: ScriptingServiceMockOptions) => ScriptingServiceType & {
|
|
29
|
+
eventHandlers: Map<string, (args: any) => void>;
|
|
30
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module stores the currently singleton instance of the scripting service.
|
|
3
|
+
* Client code should not use this module directly but should use the
|
|
4
|
+
* `getScriptingService` method instead.
|
|
5
|
+
*
|
|
6
|
+
* The active scripting service instance is set here to allow for a custom
|
|
7
|
+
* scripting service instance in a browser development environment. See
|
|
8
|
+
* `getScriptingService` for an example.
|
|
9
|
+
*/
|
|
10
|
+
import { type ScriptingServiceType } from "./scripting-service";
|
|
11
|
+
/**
|
|
12
|
+
* Do not call this method directly! This method is only called when importing
|
|
13
|
+
* the scripting service to set the singleton instance.
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
export declare const setScriptingServiceInstance: (scriptingService: ScriptingServiceType) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Do not call this method directly! Use `getScriptingService` instead.
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
export declare const getScriptingServiceInstance: () => ScriptingServiceType;
|
|
@@ -1,49 +1,60 @@
|
|
|
1
|
-
import { editor as monaco, type IDisposable } from "monaco-editor";
|
|
2
|
-
import type { ConsoleText } from "./components/OutputConsole.vue";
|
|
3
1
|
import type { InputOutputModel } from "./components/InputOutputItem.vue";
|
|
4
2
|
export type NodeSettings = {
|
|
5
3
|
script: string;
|
|
6
4
|
scriptUsedFlowVariable?: string;
|
|
7
5
|
};
|
|
8
6
|
declare class ScriptingService {
|
|
9
|
-
private _knimeService;
|
|
10
7
|
private _jsonDataService;
|
|
11
|
-
private
|
|
8
|
+
private _closeService;
|
|
12
9
|
private _eventHandlers;
|
|
13
10
|
private _runEventPoller;
|
|
14
|
-
private _editorService;
|
|
15
11
|
private _monacoLSPConnection;
|
|
16
|
-
protected _clearConsoleCallback?: Function;
|
|
17
12
|
constructor();
|
|
18
13
|
private eventPoller;
|
|
19
|
-
stopEventPoller
|
|
14
|
+
private stopEventPoller;
|
|
20
15
|
sendToService(methodName: string, options?: any[]): Promise<any>;
|
|
21
16
|
getInitialSettings(): Promise<NodeSettings>;
|
|
22
17
|
saveSettings(settings: NodeSettings): Promise<void>;
|
|
23
18
|
closeDialog(): Promise<void>;
|
|
24
19
|
registerEventHandler(type: string, handler: (args: any) => void): void;
|
|
25
|
-
registerLanguageServerEventHandler(handler: (message: string) => void): void;
|
|
26
|
-
registerConsoleEventHandler(handler: (text: ConsoleText) => void): void;
|
|
27
|
-
sendToConsole(text: ConsoleText): void;
|
|
28
|
-
initEditorService(editor: monaco.IStandaloneCodeEditor, editorModel: monaco.ITextModel): void;
|
|
29
|
-
getScript(): string | null;
|
|
30
|
-
getSelectedLines(): string | null;
|
|
31
20
|
connectToLanguageServer(): Promise<void>;
|
|
32
21
|
configureLanguageServer(settings: any): Promise<void>;
|
|
33
|
-
setScript(newScript: string): void;
|
|
34
|
-
pasteToEditor(textToPaste: string): void;
|
|
35
|
-
setOnDidChangeContentListener(callback: Function): IDisposable | null;
|
|
36
22
|
isCodeAssistantEnabled(): Promise<boolean>;
|
|
37
23
|
isCodeAssistantInstalled(): Promise<boolean>;
|
|
38
24
|
inputsAvailable(): Promise<boolean>;
|
|
39
25
|
getFlowVariableInputs(): Promise<InputOutputModel>;
|
|
40
26
|
getInputObjects(): Promise<InputOutputModel[]>;
|
|
41
27
|
getOutputObjects(): Promise<InputOutputModel[]>;
|
|
42
|
-
clearConsole(): void;
|
|
43
|
-
}
|
|
44
|
-
export declare class ScriptingServiceInternal extends ScriptingService {
|
|
45
|
-
initClearConsoleCallback(clearConsoleCallback: () => void): void;
|
|
46
28
|
}
|
|
47
29
|
export type ScriptingServiceType = Pick<ScriptingService, keyof ScriptingService>;
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Get the singleton instance of the scripting service. The scripting service
|
|
32
|
+
* provides access to the backend KNIME instance.
|
|
33
|
+
*
|
|
34
|
+
* Note that it is possible to provide a custom scripting service instance in
|
|
35
|
+
* a browser development environment (see example).
|
|
36
|
+
*
|
|
37
|
+
* @returns the scripting service instance
|
|
38
|
+
* @example
|
|
39
|
+
* // Provide a custom scripting service instance in a browser development environment
|
|
40
|
+
* // vite.config.ts
|
|
41
|
+
* resolve: {
|
|
42
|
+
* alias: {
|
|
43
|
+
* "./scripting-service-instance.js":
|
|
44
|
+
* process.env.APP_ENV === "browser"
|
|
45
|
+
* ? <path to scripting-service-instance-browser.ts>,
|
|
46
|
+
* : "./scripting-service-instance.js",
|
|
47
|
+
* },
|
|
48
|
+
* },
|
|
49
|
+
*
|
|
50
|
+
* // scripting-service-instance-browser.ts
|
|
51
|
+
* import { createScriptingServiceMock } from "@knime/scripting-editor/scripting-service-browser-mock";
|
|
52
|
+
* const scriptingService = createScriptingServiceMock({
|
|
53
|
+
* // optional customizations
|
|
54
|
+
* });
|
|
55
|
+
* export const getScriptingServiceInstance = () => scriptingService;
|
|
56
|
+
* export const setScriptingServiceInstance = () => {};
|
|
57
|
+
*/
|
|
58
|
+
export declare const getScriptingService: () => ScriptingServiceType;
|
|
59
|
+
export declare const initConsoleEventHandler: () => void;
|
|
60
|
+
export {};
|