@elixpo/lixsketch 5.5.23 → 5.6.2
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 +85 -6
- package/dist/mcp/index.js +585 -0
- package/dist/mcp/index.js.map +7 -0
- package/dist/mcp/node.js +184 -0
- package/dist/mcp/node.js.map +7 -0
- package/dist/mcp/stdio.js +723 -0
- package/dist/mcp/stdio.js.map +7 -0
- package/dist/react/{CopyPaste-5OWPTCQ5.js → CopyPaste-YUDZ6DHY.js} +7 -7
- package/dist/react/EventDispatcher-7LAK7GQ7.js +1097 -0
- package/dist/react/EventDispatcher-7LAK7GQ7.js.map +7 -0
- package/dist/react/Frame-7D2MXCFF.js +11 -0
- package/dist/react/IconShape-ZADX7Y33.js +10 -0
- package/dist/react/ImageShape-UJQN2HI7.js +10 -0
- package/dist/react/Line-APEULMHE.js +10 -0
- package/dist/react/{SceneSerializer-RDISX4X7.js → SceneSerializer-SG6SJN5X.js} +17 -7
- package/dist/react/SceneSerializer-SG6SJN5X.js.map +7 -0
- package/dist/react/{Selection-ZL3G6IAO.js → Selection-2TSH3J6P.js} +6 -4
- package/dist/react/{SketchEngine-OB6ZW3B6.js → SketchEngine-UD2XV2KT.js} +50 -23
- package/dist/react/{SketchEngine-OB6ZW3B6.js.map → SketchEngine-UD2XV2KT.js.map} +2 -2
- package/dist/react/{UndoRedo-NL7KLR5B.js → UndoRedo-IN4SXDG6.js} +2 -2
- package/dist/react/{ZoomPan-FAWA5OPS.js → ZoomPan-RR7KUYZT.js} +34 -1
- package/dist/react/{ZoomPan-FAWA5OPS.js.map → ZoomPan-RR7KUYZT.js.map} +2 -2
- package/dist/react/{arrowTool-CNVGM6RX.js → arrowTool-OYDWJGQK.js} +3 -3
- package/dist/react/{chunk-U3TB4KRS.js → chunk-6GPEWDRB.js} +19 -12
- package/dist/react/chunk-6GPEWDRB.js.map +7 -0
- package/dist/react/{chunk-4BLMNGTR.js → chunk-7CM5XQDN.js} +3 -3
- package/dist/react/{chunk-XFQECTTF.js → chunk-APTOPAOY.js} +3 -3
- package/dist/react/{chunk-EDSKEM6E.js → chunk-ASBC5G35.js} +47 -8
- package/dist/react/chunk-ASBC5G35.js.map +7 -0
- package/dist/react/{chunk-4TAS67SL.js → chunk-EOURRJ55.js} +2 -2
- package/dist/react/{chunk-ETAAQUUV.js → chunk-GQUZPON4.js} +4 -4
- package/dist/react/{chunk-KVAQPCUH.js → chunk-K5BG5MHY.js} +49 -5
- package/dist/react/chunk-K5BG5MHY.js.map +7 -0
- package/dist/react/{chunk-AH4PWNEB.js → chunk-K5RY4EV7.js} +23 -3
- package/dist/react/chunk-K5RY4EV7.js.map +7 -0
- package/dist/react/{chunk-GC3KTQDA.js → chunk-LJR7EVW2.js} +3 -3
- package/dist/react/{chunk-SZD7DKYJ.js → chunk-LSHZYN77.js} +2 -2
- package/dist/react/{chunk-HFQZYCHJ.js → chunk-M6TMN76K.js} +3 -3
- package/dist/react/{chunk-V2QTYSBK.js → chunk-OP56XPWF.js} +2 -2
- package/dist/react/chunk-QZI4UIE5.js +48 -0
- package/dist/react/chunk-QZI4UIE5.js.map +7 -0
- package/dist/react/{chunk-ILGAFR56.js → chunk-RGMDWLRJ.js} +3 -3
- package/dist/react/{chunk-OFGJJKPH.js → chunk-XFL4R5ZF.js} +3 -3
- package/dist/react/{chunk-GPIYXREE.js → chunk-XOWNCYE4.js} +3 -3
- package/dist/react/{chunk-YF3TK7SC.js → chunk-XYUFEIZR.js} +2 -2
- package/dist/react/{circleTool-KICNRQCI.js → circleTool-LDKGZALF.js} +4 -4
- package/dist/react/{codeTool-NCQ73R6M.js → codeTool-4YZO5W7J.js} +4 -4
- package/dist/react/{frameTool-Y6KB67DO.js → frameTool-MXNJEXQQ.js} +4 -4
- package/dist/react/{freehandTool-MMULHCQ7.js → freehandTool-26D3FOOX.js} +4 -4
- package/dist/react/{iconTool-LSW2DYGB.js → iconTool-46O5VEUX.js} +4 -4
- package/dist/react/{imageTool-2DSR32RX.js → imageTool-P2RWZRHO.js} +4 -4
- package/dist/react/index.js +848 -614
- package/dist/react/index.js.map +4 -4
- package/dist/react/{lineTool-N5I7IGT7.js → lineTool-ZMR27U5L.js} +4 -4
- package/dist/react/{rectangleTool-YUT7ZK2E.js → rectangleTool-EJKK6UTX.js} +4 -4
- package/dist/react/{textTool-JMTX7OVT.js → textTool-S4XXZHZH.js} +5 -5
- package/package.json +7 -1
- package/src/EngineShortcuts.js +22 -0
- package/src/SketchEngine.js +27 -0
- package/src/core/EventDispatcher.js +35 -4
- package/src/core/SceneSerializer.js +5 -0
- package/src/core/Selection.js +26 -0
- package/src/core/UndoRedo.js +20 -16
- package/src/core/WebEmbedPolicy.js +41 -0
- package/src/core/ZoomPan.js +36 -0
- package/src/index.js +4 -0
- package/src/mcp/fileStore.js +70 -0
- package/src/mcp/index.js +5 -0
- package/src/mcp/node.js +2 -0
- package/src/mcp/preview.js +39 -0
- package/src/mcp/scene.js +275 -0
- package/src/mcp/server.js +195 -0
- package/src/mcp/stdio.js +41 -0
- package/src/mcp/stdioTransport.js +46 -0
- package/src/mcp/store.js +23 -0
- package/src/mcp/templates.js +51 -0
- package/src/react/LixSketchCanvas.jsx +4 -0
- package/src/react/components/Toolbar.jsx +84 -7
- package/src/react/components/modals/CommandPalette.jsx +8 -0
- package/src/react/components/modals/WebEmbedModal.jsx +40 -0
- package/src/react/components/sidebars/PaintBucketSidebar.jsx +49 -0
- package/src/react/components/sidebars/PaintbrushSidebar.jsx +1 -1
- package/src/react/store/useSketchStore.js +13 -0
- package/src/react/toolsEnum.js +4 -0
- package/src/shapes/Frame.js +47 -4
- package/src/shapes/ImageShape.js +49 -6
- package/src/tools/lassoTool.js +84 -0
- package/src/tools/paintBucketTool.js +50 -0
- package/src/tools/shapeRecognitionTool.js +431 -0
- package/src/tools/webEmbedTool.js +61 -0
- package/dist/react/EventDispatcher-GKNO2KSL.js +0 -464
- package/dist/react/EventDispatcher-GKNO2KSL.js.map +0 -7
- package/dist/react/Frame-RLSMJJSK.js +0 -11
- package/dist/react/IconShape-7OPXAKLK.js +0 -10
- package/dist/react/ImageShape-T7UEHP4A.js +0 -10
- package/dist/react/Line-WWQFBNX5.js +0 -10
- package/dist/react/SceneSerializer-RDISX4X7.js.map +0 -7
- package/dist/react/chunk-AH4PWNEB.js.map +0 -7
- package/dist/react/chunk-EDSKEM6E.js.map +0 -7
- package/dist/react/chunk-KVAQPCUH.js.map +0 -7
- package/dist/react/chunk-U3TB4KRS.js.map +0 -7
- /package/dist/react/{CopyPaste-5OWPTCQ5.js.map → CopyPaste-YUDZ6DHY.js.map} +0 -0
- /package/dist/react/{Frame-RLSMJJSK.js.map → Frame-7D2MXCFF.js.map} +0 -0
- /package/dist/react/{IconShape-7OPXAKLK.js.map → IconShape-ZADX7Y33.js.map} +0 -0
- /package/dist/react/{ImageShape-T7UEHP4A.js.map → ImageShape-UJQN2HI7.js.map} +0 -0
- /package/dist/react/{Line-WWQFBNX5.js.map → Line-APEULMHE.js.map} +0 -0
- /package/dist/react/{Selection-ZL3G6IAO.js.map → Selection-2TSH3J6P.js.map} +0 -0
- /package/dist/react/{UndoRedo-NL7KLR5B.js.map → UndoRedo-IN4SXDG6.js.map} +0 -0
- /package/dist/react/{arrowTool-CNVGM6RX.js.map → arrowTool-OYDWJGQK.js.map} +0 -0
- /package/dist/react/{chunk-4BLMNGTR.js.map → chunk-7CM5XQDN.js.map} +0 -0
- /package/dist/react/{chunk-XFQECTTF.js.map → chunk-APTOPAOY.js.map} +0 -0
- /package/dist/react/{chunk-4TAS67SL.js.map → chunk-EOURRJ55.js.map} +0 -0
- /package/dist/react/{chunk-ETAAQUUV.js.map → chunk-GQUZPON4.js.map} +0 -0
- /package/dist/react/{chunk-GC3KTQDA.js.map → chunk-LJR7EVW2.js.map} +0 -0
- /package/dist/react/{chunk-SZD7DKYJ.js.map → chunk-LSHZYN77.js.map} +0 -0
- /package/dist/react/{chunk-HFQZYCHJ.js.map → chunk-M6TMN76K.js.map} +0 -0
- /package/dist/react/{chunk-V2QTYSBK.js.map → chunk-OP56XPWF.js.map} +0 -0
- /package/dist/react/{chunk-ILGAFR56.js.map → chunk-RGMDWLRJ.js.map} +0 -0
- /package/dist/react/{chunk-OFGJJKPH.js.map → chunk-XFL4R5ZF.js.map} +0 -0
- /package/dist/react/{chunk-GPIYXREE.js.map → chunk-XOWNCYE4.js.map} +0 -0
- /package/dist/react/{chunk-YF3TK7SC.js.map → chunk-XYUFEIZR.js.map} +0 -0
- /package/dist/react/{circleTool-KICNRQCI.js.map → circleTool-LDKGZALF.js.map} +0 -0
- /package/dist/react/{codeTool-NCQ73R6M.js.map → codeTool-4YZO5W7J.js.map} +0 -0
- /package/dist/react/{frameTool-Y6KB67DO.js.map → frameTool-MXNJEXQQ.js.map} +0 -0
- /package/dist/react/{freehandTool-MMULHCQ7.js.map → freehandTool-26D3FOOX.js.map} +0 -0
- /package/dist/react/{iconTool-LSW2DYGB.js.map → iconTool-46O5VEUX.js.map} +0 -0
- /package/dist/react/{imageTool-2DSR32RX.js.map → imageTool-P2RWZRHO.js.map} +0 -0
- /package/dist/react/{lineTool-N5I7IGT7.js.map → lineTool-ZMR27U5L.js.map} +0 -0
- /package/dist/react/{rectangleTool-YUT7ZK2E.js.map → rectangleTool-EJKK6UTX.js.map} +0 -0
- /package/dist/react/{textTool-JMTX7OVT.js.map → textTool-S4XXZHZH.js.map} +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @lixsketch
|
|
1
|
+
# @elixpo/lixsketch
|
|
2
2
|
|
|
3
3
|
Open-source SVG whiteboard engine with a hand-drawn aesthetic. The core drawing engine behind [LixSketch](https://sketch.elixpo.com).
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ Build your own whiteboard, diagramming tool, or collaborative canvas with a few
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install @lixsketch
|
|
10
|
+
npm install @elixpo/lixsketch
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Quick Start
|
|
@@ -16,7 +16,7 @@ npm install @lixsketch/engine
|
|
|
16
16
|
<svg id="my-canvas" xmlns="http://www.w3.org/2000/svg" width="100%" height="100vh"></svg>
|
|
17
17
|
|
|
18
18
|
<script type="module">
|
|
19
|
-
import { createSketchEngine, TOOLS } from '@lixsketch
|
|
19
|
+
import { createSketchEngine, TOOLS } from '@elixpo/lixsketch';
|
|
20
20
|
|
|
21
21
|
const svg = document.getElementById('my-canvas');
|
|
22
22
|
svg.setAttribute('viewBox', `0 0 ${window.innerWidth} ${window.innerHeight}`);
|
|
@@ -106,7 +106,7 @@ The `onEvent` callback receives:
|
|
|
106
106
|
### Available Tools
|
|
107
107
|
|
|
108
108
|
```javascript
|
|
109
|
-
import { TOOLS } from '@lixsketch
|
|
109
|
+
import { TOOLS } from '@elixpo/lixsketch';
|
|
110
110
|
|
|
111
111
|
TOOLS.SELECT // Selection/move tool
|
|
112
112
|
TOOLS.PAN // Pan/hand tool
|
|
@@ -133,7 +133,7 @@ import {
|
|
|
133
133
|
Rectangle, Circle, Arrow, Line,
|
|
134
134
|
TextShape, CodeShape, ImageShape,
|
|
135
135
|
IconShape, Frame, FreehandStroke
|
|
136
|
-
} from '@lixsketch
|
|
136
|
+
} from '@elixpo/lixsketch';
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
## Fonts
|
|
@@ -141,7 +141,7 @@ import {
|
|
|
141
141
|
Optional hand-drawn fonts for the authentic LixSketch look:
|
|
142
142
|
|
|
143
143
|
```javascript
|
|
144
|
-
import '@lixsketch/
|
|
144
|
+
import '@elixpo/lixsketch/fonts';
|
|
145
145
|
```
|
|
146
146
|
|
|
147
147
|
## File Format
|
|
@@ -159,6 +159,85 @@ The `.lixsketch` format is JSON:
|
|
|
159
159
|
|
|
160
160
|
Files are fully interoperable between the web app, VS Code extension, and any custom integration.
|
|
161
161
|
|
|
162
|
+
## MCP server
|
|
163
|
+
|
|
164
|
+
The same package includes a local MCP server for structured canvas operations. It edits an atomic `.lixjson` file; open that file in LixSketch, or provide a custom scene store when embedding the server in another host.
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"mcpServers": {
|
|
169
|
+
"lixsketch": {
|
|
170
|
+
"command": "npx",
|
|
171
|
+
"args": [
|
|
172
|
+
"-y",
|
|
173
|
+
"@elixpo/lixsketch",
|
|
174
|
+
"--scene",
|
|
175
|
+
"/absolute/path/to/architecture.lixjson"
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The CLI can also be started directly:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
npx @elixpo/lixsketch --scene ./architecture.lixjson
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The stdio channel is reserved for MCP JSON-RPC. Server status is written to stderr.
|
|
189
|
+
|
|
190
|
+
### MCP tools
|
|
191
|
+
|
|
192
|
+
| Tool | Purpose |
|
|
193
|
+
|------|---------|
|
|
194
|
+
| `canvas_get` | Read canvas summary, revision, and optional shapes |
|
|
195
|
+
| `canvas_apply_patch` | Atomically add, update, translate, or delete shapes |
|
|
196
|
+
| `canvas_validate` | Validate format, geometry, IDs, and limits |
|
|
197
|
+
| `canvas_preview` | Produce a lightweight SVG preview |
|
|
198
|
+
| `canvas_new` | Create a blank canvas after explicit confirmation |
|
|
199
|
+
| `templates_search` | Search public marketplace templates |
|
|
200
|
+
| `template_insert` | Insert a template with remapped shape and relationship IDs |
|
|
201
|
+
|
|
202
|
+
Mutations accept `expectedRevision` for conflict detection. `canvas_apply_patch` and `template_insert` support `dryRun: true`. A single patch is either fully stored or not stored at all.
|
|
203
|
+
|
|
204
|
+
Supported structured shape types are rectangle, circle, line, arrow, frame, freehand stroke, and text. Images and arbitrary SVG markup are intentionally excluded from direct MCP writes.
|
|
205
|
+
|
|
206
|
+
### Programmatic server
|
|
207
|
+
|
|
208
|
+
Use a memory store in tests, or implement the same asynchronous `read()` and `write(scene)` interface to connect another persistence layer:
|
|
209
|
+
|
|
210
|
+
```javascript
|
|
211
|
+
import {
|
|
212
|
+
createLixSketchMcpServer,
|
|
213
|
+
MemorySceneStore,
|
|
214
|
+
createEmptyScene,
|
|
215
|
+
} from '@elixpo/lixsketch/mcp';
|
|
216
|
+
|
|
217
|
+
const server = createLixSketchMcpServer({
|
|
218
|
+
store: new MemorySceneStore(createEmptyScene('Architecture')),
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const result = await server.callTool('canvas_apply_patch', {
|
|
222
|
+
expectedRevision: 0,
|
|
223
|
+
operations: [
|
|
224
|
+
{
|
|
225
|
+
op: 'add',
|
|
226
|
+
shape: {
|
|
227
|
+
type: 'rectangle',
|
|
228
|
+
x: 120,
|
|
229
|
+
y: 80,
|
|
230
|
+
width: 220,
|
|
231
|
+
height: 100,
|
|
232
|
+
options: { stroke: '#a78bfa', fill: '#2f2442' },
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The browser engine and hosted platform can provide their own store adapter. Node hosts can import `FileSceneStore` and `serveLixSketchStdio` from `@elixpo/lixsketch/mcp/node`; browser and Worker bundles should continue to use the runtime-neutral `@elixpo/lixsketch/mcp` entry point.
|
|
240
|
+
|
|
162
241
|
## Requirements
|
|
163
242
|
|
|
164
243
|
- Browser environment with DOM (or DOM-compatible like VS Code Webview)
|