x4js 2.2.30 → 2.2.32

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/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "2.2.30",
3
+ "version": "2.2.32",
4
4
  "type": "module",
5
5
  "main": "src/x4.ts",
6
6
  "module": "src/x4.ts",
7
7
  "types": "src/x4.ts",
8
8
  "exports": {
9
- ".": "./src/x4.ts"
9
+ ".": "./src/x4.ts",
10
+ "./monaco": "./src/components/monaco/monaco.ts"
10
11
  },
11
12
  "scripts": {
12
13
  "build-publish": "deno run --allow-all ./publish.ts",
@@ -15,7 +15,7 @@ interface MonacoEditorProps extends ComponentProps {
15
15
  export class MonacoEditor extends Component<MonacoEditorProps> {
16
16
 
17
17
  static initCount = 0;
18
- static basePath: string = "./bin";
18
+ static basePath: string = "monaco/";
19
19
  static monaco: typeof Monaco;
20
20
  static initCbs: Function[] = [];
21
21
 
@@ -26,7 +26,11 @@ export class MonacoEditor extends Component<MonacoEditorProps> {
26
26
  return;
27
27
  }
28
28
 
29
- this.monaco = (await import( "./bin/monaco.js" )).default;
29
+ // path must be hard coded for esbuild to work
30
+ const dynamicImport = new Function("path", "return import('./'+path)");
31
+ this.monaco = (await dynamicImport(this.basePath + "monaco.js")).default;
32
+ //this.monaco = (await import(`${this.basePath}monaco.js`)).default;
33
+ //this.monaco = (await import( "./bin/monaco.js" )).default;
30
34
  this.initCount++;
31
35
 
32
36
  globalThis.MonacoEnvironment = {
@@ -49,15 +53,16 @@ export class MonacoEditor extends Component<MonacoEditorProps> {
49
53
  workerPath = "editor.worker.js";
50
54
  }
51
55
 
52
- const fullpath = MonacoEditor.basePath+'/workers/'+workerPath;
56
+ const fullpath = MonacoEditor.basePath+'workers/'+workerPath;
53
57
  console.log( `getting "${label} path: ${fullpath}` );
54
58
  return fullpath;
55
59
  }
56
60
  };
57
61
 
62
+ // custom append css
58
63
  const link = document.createElement('link');
59
64
  link.rel = 'stylesheet';
60
- link.href = MonacoEditor.basePath+'/monaco.css';
65
+ link.href = MonacoEditor.basePath+'monaco.css';
61
66
  link.type = 'text/css';
62
67
  document.head.appendChild(link);
63
68
  }
@@ -1,4 +1,18 @@
1
1
  # using monaco in x4
2
2
 
3
3
  you must copy ./bin/* in your destination folder ex. monaco folder
4
- see demo/components/monaco for a full example.
4
+
5
+
6
+
7
+
8
+ fr x4build update your package.json this this
9
+
10
+ {
11
+ ...
12
+ "x4build": {
13
+ "copy": [
14
+ { "from": "./node_modules/x4js/src/components/monaco/bin", "to": "monaco" }
15
+ ]
16
+ }
17
+ ...
18
+ }