@codecanvas-ide/engine 0.1.0 → 0.3.0

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,12 +1,14 @@
1
1
  # @codecanvas-ide/engine
2
2
 
3
- The canvas of [CodeCanvas](https://github.com/d-feliz/codecanvas-ide): it shows a TypeScript file as a
4
- zoomable diagram and lets you edit it there. Every function, class, variable and import is a block;
3
+ The canvas of [CodeCanvas](https://github.com/d-feliz/codecanvas-ide): it shows a TypeScript or JavaScript
4
+ file as a zoomable diagram and lets you edit it there. Every function, class, variable and import is a block;
5
5
  usages are drawn as lines; anything changed on the canvas is written back to the text.
6
6
 
7
7
  - Blocks with previews, nested blocks, and a stable layout you can save in the repo
8
8
  - Usage lines, references across files, rename across files (TypeScript language service)
9
9
  - Syntax and type errors on the blocks
10
+ - React: components, state and render links, turned on by itself in React files; the toolbar
11
+ shows the language (JS, TS, React JS/TS/JSX/TSX), also as `model.language`
10
12
  - Changes against a base version (e.g. the last commit), and merge conflicts
11
13
  - No framework: plain TypeScript and the DOM
12
14
 
@@ -31,6 +33,17 @@ const canvas = new CodeCanvas(document.getElementById('canvas')!, {
31
33
  canvas.openFile('src/cart.ts', cartText);
32
34
  ```
33
35
 
36
+ Give the project the folder's TypeScript settings, so imports resolve as in the editor. In a monorepo,
37
+ pass every config file and `package.json`: each config gets its own program, and packages that import
38
+ each other by name resolve to their source.
39
+
40
+ ```ts
41
+ project.setWorkspace({
42
+ configFiles: [{ path: 'packages/web/tsconfig.json', text: webConfigText }],
43
+ packageFiles: { 'packages/utils/package.json': utilsManifestText },
44
+ });
45
+ ```
46
+
34
47
  To keep TypeScript work off the page's thread, run the project in a worker: `serveProject(self)` in the
35
48
  worker script, and `connectProjectWorker(worker)` in place of `new Project()` on the page.
36
49