@codecanvas-ide/engine 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Daniel Feliz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,53 @@
1
- # Temporary Holding Version
1
+ # @codecanvas-ide/engine
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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
+ usages are drawn as lines; anything changed on the canvas is written back to the text.
6
+
7
+ - Blocks with previews, nested blocks, and a stable layout you can save in the repo
8
+ - Usage lines, references across files, rename across files (TypeScript language service)
9
+ - Syntax and type errors on the blocks
10
+ - Changes against a base version (e.g. the last commit), and merge conflicts
11
+ - No framework: plain TypeScript and the DOM
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ npm install @codecanvas-ide/engine
17
+ ```
18
+
19
+ ## Use
20
+
21
+ ```ts
22
+ import { CodeCanvas, Project } from '@codecanvas-ide/engine';
23
+
24
+ const project = new Project({ 'src/cart.ts': cartText, 'src/pricing.ts': pricingText });
25
+ const canvas = new CodeCanvas(document.getElementById('canvas')!, {
26
+ project,
27
+ createEditor: ({ parent, text, onChange, onClose }) => myEditor(parent, text, onChange, onClose),
28
+ onTextChange: (text) => saveFile('src/cart.ts', text),
29
+ onLayoutChange: (layout) => saveLayout('src/cart.ts', layout),
30
+ });
31
+ canvas.openFile('src/cart.ts', cartText);
32
+ ```
33
+
34
+ Give the project the folder's TypeScript settings, so imports resolve as in the editor. In a monorepo,
35
+ pass every config file and `package.json`: each config gets its own program, and packages that import
36
+ each other by name resolve to their source.
37
+
38
+ ```ts
39
+ project.setWorkspace({
40
+ configFiles: [{ path: 'packages/web/tsconfig.json', text: webConfigText }],
41
+ packageFiles: { 'packages/utils/package.json': utilsManifestText },
42
+ });
43
+ ```
44
+
45
+ To keep TypeScript work off the page's thread, run the project in a worker: `serveProject(self)` in the
46
+ worker script, and `connectProjectWorker(worker)` in place of `new Project()` on the page.
47
+
48
+ `dist/codecanvas-engine.js` is the same engine as one UMD file with TypeScript included, for hosts that
49
+ load scripts with an AMD loader.
50
+
51
+ ## License
52
+
53
+ MIT
@@ -0,0 +1 @@
1
+ export * from './types/index.js';