@knime/scripting-editor 0.0.4 → 0.0.5

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,26 +1,11 @@
1
- # org.knime.scripting.editor.js
1
+ # KNIME Scripting Editor Components
2
2
 
3
- This template should help get you started developing with Vue 3 in Vite.
3
+ This package contains shared components that are used in scripting editor dialogs in KNIME Analytics Platform.
4
4
 
5
5
  ## Recommended IDE Setup
6
6
 
7
7
  [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
8
8
 
9
- ## Type Support for `.vue` Imports in TS
10
-
11
- TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
12
-
13
- If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
14
-
15
- 1. Disable the built-in TypeScript Extension
16
- 1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17
- 2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18
- 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
19
-
20
- ## Customize configuration
21
-
22
- See [Vite Configuration Reference](https://vitejs.dev/config/).
23
-
24
9
  ## Project Setup
25
10
 
26
11
  ```sh
@@ -30,7 +15,7 @@ npm install
30
15
  ### Compile and Hot-Reload for Development
31
16
 
32
17
  ```sh
33
- npm run dev
18
+ npm run build-watch
34
19
  ```
35
20
 
36
21
  ### Type-Check, Compile and Minify for Production
@@ -1,36 +1,59 @@
1
- import { defineComponent as _, openBlock as a, createElementBlock as l, createElementVNode as t, toDisplayString as p, pushScopeId as d, popScopeId as i, createTextVNode as r } from "vue";
2
- const h = (e) => (d("data-v-af185b77"), e = e(), i(), e), u = { class: "greetings" }, f = { class: "green" }, g = /* @__PURE__ */ h(() => /* @__PURE__ */ t("h3", null, [
3
- /* @__PURE__ */ r(" You’ve successfully created a project with - yes! "),
4
- /* @__PURE__ */ t("a", {
5
- href: "https://vitejs.dev/",
6
- target: "_blank",
7
- rel: "noopener"
8
- }, "Vite"),
9
- /* @__PURE__ */ r(" + "),
10
- /* @__PURE__ */ t("a", {
11
- href: "https://vuejs.org/",
12
- target: "_blank",
13
- rel: "noopener"
14
- }, "Vue 3"),
15
- /* @__PURE__ */ r(". ")
16
- ], -1)), v = /* @__PURE__ */ _({
17
- __name: "HelloWorld",
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".code-editor[data-v-6ef3894e]{height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ import { defineComponent as l, ref as c, onMounted as d, openBlock as s, createElementBlock as u } from "vue";
3
+ import * as i from "monaco-editor";
4
+ const p = /* @__PURE__ */ l({
5
+ __name: "CodeEditor",
18
6
  props: {
19
- msg: {}
7
+ initialScript: {
8
+ type: String,
9
+ default: ""
10
+ },
11
+ language: {
12
+ type: String,
13
+ default: null
14
+ },
15
+ fileName: {
16
+ type: String,
17
+ default: "main.txt"
18
+ }
20
19
  },
21
- setup(e) {
22
- return (o, s) => (a(), l("div", u, [
23
- t("h1", f, p(o.msg), 1),
24
- g
25
- ]));
20
+ emits: ["monaco-created"],
21
+ setup(r, { emit: n }) {
22
+ const e = r, t = c(null);
23
+ return d(() => {
24
+ if (t.value === null)
25
+ throw new Error(
26
+ "Editor reference is null. This is an implementation error"
27
+ );
28
+ const o = i.editor.createModel(
29
+ e.initialScript,
30
+ e.language,
31
+ i.Uri.parse(`inmemory://${e.fileName}`)
32
+ ), a = i.editor.create(t.value, {
33
+ model: o,
34
+ glyphMargin: !1,
35
+ lightbulb: {
36
+ enabled: !0
37
+ },
38
+ minimap: { enabled: !0 },
39
+ automaticLayout: !0,
40
+ scrollBeyondLastLine: !0,
41
+ fixedOverflowWidgets: !0
42
+ });
43
+ n("monaco-created", { editor: a, editorModel: o });
44
+ }), (o, a) => (s(), u("div", {
45
+ ref_key: "editorRef",
46
+ ref: t,
47
+ class: "code-editor"
48
+ }, null, 512));
26
49
  }
27
50
  });
28
- const m = (e, o) => {
29
- const s = e.__vccOpts || e;
30
- for (const [c, n] of o)
31
- s[c] = n;
32
- return s;
33
- }, b = /* @__PURE__ */ m(v, [["__scopeId", "data-v-af185b77"]]);
51
+ const f = (r, n) => {
52
+ const e = r.__vccOpts || r;
53
+ for (const [t, o] of n)
54
+ e[t] = o;
55
+ return e;
56
+ }, _ = /* @__PURE__ */ f(p, [["__scopeId", "data-v-6ef3894e"]]);
34
57
  export {
35
- b as HelloWorld
58
+ _ as CodeEditor
36
59
  };
@@ -1,2 +1,2 @@
1
- import HelloWorld from "../src/components/HelloWorld.vue";
2
- export { HelloWorld };
1
+ import CodeEditor from "../src/components/CodeEditor.vue";
2
+ export { CodeEditor };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@knime/scripting-editor",
3
3
  "type": "module",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "description": "Shared Scripting Editor components for KNIME",
6
6
  "author": "KNIME AG, Zurich, Switzerland",
7
7
  "license": "See the file license.txt",
@@ -24,7 +24,7 @@
24
24
  "prepare": "cd .. && husky install ./org.knime.scripting.editor.js/.husky"
25
25
  },
26
26
  "dependencies": {
27
- "consola": "3.2.3",
27
+ "monaco-editor": "0.40.0",
28
28
  "pinia": "2.1.4",
29
29
  "vue": "3.x",
30
30
  "webapps-common": "file:webapps-common"
@@ -51,6 +51,7 @@
51
51
  "stylelint": "15.10.2",
52
52
  "typescript": "5.1.6",
53
53
  "vite": "4.4.6",
54
+ "vite-plugin-css-injected-by-js": "3.2.1",
54
55
  "vite-plugin-dts": "3.4.0",
55
56
  "vitest": "0.33.0",
56
57
  "vue-tsc": "1.8.6"
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
- h1[data-v-af185b77]{font-weight:500;font-size:2.6rem;position:relative;top:-10px}h3[data-v-af185b77]{font-size:1.2rem}.greetings h1[data-v-af185b77],.greetings h3[data-v-af185b77]{text-align:center}@media (min-width: 1024px){.greetings h1[data-v-af185b77],.greetings h3[data-v-af185b77]{text-align:left}}