@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.
Files changed (130) hide show
  1. package/README.md +85 -6
  2. package/dist/mcp/index.js +585 -0
  3. package/dist/mcp/index.js.map +7 -0
  4. package/dist/mcp/node.js +184 -0
  5. package/dist/mcp/node.js.map +7 -0
  6. package/dist/mcp/stdio.js +723 -0
  7. package/dist/mcp/stdio.js.map +7 -0
  8. package/dist/react/{CopyPaste-5OWPTCQ5.js → CopyPaste-YUDZ6DHY.js} +7 -7
  9. package/dist/react/EventDispatcher-7LAK7GQ7.js +1097 -0
  10. package/dist/react/EventDispatcher-7LAK7GQ7.js.map +7 -0
  11. package/dist/react/Frame-7D2MXCFF.js +11 -0
  12. package/dist/react/IconShape-ZADX7Y33.js +10 -0
  13. package/dist/react/ImageShape-UJQN2HI7.js +10 -0
  14. package/dist/react/Line-APEULMHE.js +10 -0
  15. package/dist/react/{SceneSerializer-RDISX4X7.js → SceneSerializer-SG6SJN5X.js} +17 -7
  16. package/dist/react/SceneSerializer-SG6SJN5X.js.map +7 -0
  17. package/dist/react/{Selection-ZL3G6IAO.js → Selection-2TSH3J6P.js} +6 -4
  18. package/dist/react/{SketchEngine-OB6ZW3B6.js → SketchEngine-UD2XV2KT.js} +50 -23
  19. package/dist/react/{SketchEngine-OB6ZW3B6.js.map → SketchEngine-UD2XV2KT.js.map} +2 -2
  20. package/dist/react/{UndoRedo-NL7KLR5B.js → UndoRedo-IN4SXDG6.js} +2 -2
  21. package/dist/react/{ZoomPan-FAWA5OPS.js → ZoomPan-RR7KUYZT.js} +34 -1
  22. package/dist/react/{ZoomPan-FAWA5OPS.js.map → ZoomPan-RR7KUYZT.js.map} +2 -2
  23. package/dist/react/{arrowTool-CNVGM6RX.js → arrowTool-OYDWJGQK.js} +3 -3
  24. package/dist/react/{chunk-U3TB4KRS.js → chunk-6GPEWDRB.js} +19 -12
  25. package/dist/react/chunk-6GPEWDRB.js.map +7 -0
  26. package/dist/react/{chunk-4BLMNGTR.js → chunk-7CM5XQDN.js} +3 -3
  27. package/dist/react/{chunk-XFQECTTF.js → chunk-APTOPAOY.js} +3 -3
  28. package/dist/react/{chunk-EDSKEM6E.js → chunk-ASBC5G35.js} +47 -8
  29. package/dist/react/chunk-ASBC5G35.js.map +7 -0
  30. package/dist/react/{chunk-4TAS67SL.js → chunk-EOURRJ55.js} +2 -2
  31. package/dist/react/{chunk-ETAAQUUV.js → chunk-GQUZPON4.js} +4 -4
  32. package/dist/react/{chunk-KVAQPCUH.js → chunk-K5BG5MHY.js} +49 -5
  33. package/dist/react/chunk-K5BG5MHY.js.map +7 -0
  34. package/dist/react/{chunk-AH4PWNEB.js → chunk-K5RY4EV7.js} +23 -3
  35. package/dist/react/chunk-K5RY4EV7.js.map +7 -0
  36. package/dist/react/{chunk-GC3KTQDA.js → chunk-LJR7EVW2.js} +3 -3
  37. package/dist/react/{chunk-SZD7DKYJ.js → chunk-LSHZYN77.js} +2 -2
  38. package/dist/react/{chunk-HFQZYCHJ.js → chunk-M6TMN76K.js} +3 -3
  39. package/dist/react/{chunk-V2QTYSBK.js → chunk-OP56XPWF.js} +2 -2
  40. package/dist/react/chunk-QZI4UIE5.js +48 -0
  41. package/dist/react/chunk-QZI4UIE5.js.map +7 -0
  42. package/dist/react/{chunk-ILGAFR56.js → chunk-RGMDWLRJ.js} +3 -3
  43. package/dist/react/{chunk-OFGJJKPH.js → chunk-XFL4R5ZF.js} +3 -3
  44. package/dist/react/{chunk-GPIYXREE.js → chunk-XOWNCYE4.js} +3 -3
  45. package/dist/react/{chunk-YF3TK7SC.js → chunk-XYUFEIZR.js} +2 -2
  46. package/dist/react/{circleTool-KICNRQCI.js → circleTool-LDKGZALF.js} +4 -4
  47. package/dist/react/{codeTool-NCQ73R6M.js → codeTool-4YZO5W7J.js} +4 -4
  48. package/dist/react/{frameTool-Y6KB67DO.js → frameTool-MXNJEXQQ.js} +4 -4
  49. package/dist/react/{freehandTool-MMULHCQ7.js → freehandTool-26D3FOOX.js} +4 -4
  50. package/dist/react/{iconTool-LSW2DYGB.js → iconTool-46O5VEUX.js} +4 -4
  51. package/dist/react/{imageTool-2DSR32RX.js → imageTool-P2RWZRHO.js} +4 -4
  52. package/dist/react/index.js +848 -614
  53. package/dist/react/index.js.map +4 -4
  54. package/dist/react/{lineTool-N5I7IGT7.js → lineTool-ZMR27U5L.js} +4 -4
  55. package/dist/react/{rectangleTool-YUT7ZK2E.js → rectangleTool-EJKK6UTX.js} +4 -4
  56. package/dist/react/{textTool-JMTX7OVT.js → textTool-S4XXZHZH.js} +5 -5
  57. package/package.json +7 -1
  58. package/src/EngineShortcuts.js +22 -0
  59. package/src/SketchEngine.js +27 -0
  60. package/src/core/EventDispatcher.js +35 -4
  61. package/src/core/SceneSerializer.js +5 -0
  62. package/src/core/Selection.js +26 -0
  63. package/src/core/UndoRedo.js +20 -16
  64. package/src/core/WebEmbedPolicy.js +41 -0
  65. package/src/core/ZoomPan.js +36 -0
  66. package/src/index.js +4 -0
  67. package/src/mcp/fileStore.js +70 -0
  68. package/src/mcp/index.js +5 -0
  69. package/src/mcp/node.js +2 -0
  70. package/src/mcp/preview.js +39 -0
  71. package/src/mcp/scene.js +275 -0
  72. package/src/mcp/server.js +195 -0
  73. package/src/mcp/stdio.js +41 -0
  74. package/src/mcp/stdioTransport.js +46 -0
  75. package/src/mcp/store.js +23 -0
  76. package/src/mcp/templates.js +51 -0
  77. package/src/react/LixSketchCanvas.jsx +4 -0
  78. package/src/react/components/Toolbar.jsx +84 -7
  79. package/src/react/components/modals/CommandPalette.jsx +8 -0
  80. package/src/react/components/modals/WebEmbedModal.jsx +40 -0
  81. package/src/react/components/sidebars/PaintBucketSidebar.jsx +49 -0
  82. package/src/react/components/sidebars/PaintbrushSidebar.jsx +1 -1
  83. package/src/react/store/useSketchStore.js +13 -0
  84. package/src/react/toolsEnum.js +4 -0
  85. package/src/shapes/Frame.js +47 -4
  86. package/src/shapes/ImageShape.js +49 -6
  87. package/src/tools/lassoTool.js +84 -0
  88. package/src/tools/paintBucketTool.js +50 -0
  89. package/src/tools/shapeRecognitionTool.js +431 -0
  90. package/src/tools/webEmbedTool.js +61 -0
  91. package/dist/react/EventDispatcher-GKNO2KSL.js +0 -464
  92. package/dist/react/EventDispatcher-GKNO2KSL.js.map +0 -7
  93. package/dist/react/Frame-RLSMJJSK.js +0 -11
  94. package/dist/react/IconShape-7OPXAKLK.js +0 -10
  95. package/dist/react/ImageShape-T7UEHP4A.js +0 -10
  96. package/dist/react/Line-WWQFBNX5.js +0 -10
  97. package/dist/react/SceneSerializer-RDISX4X7.js.map +0 -7
  98. package/dist/react/chunk-AH4PWNEB.js.map +0 -7
  99. package/dist/react/chunk-EDSKEM6E.js.map +0 -7
  100. package/dist/react/chunk-KVAQPCUH.js.map +0 -7
  101. package/dist/react/chunk-U3TB4KRS.js.map +0 -7
  102. /package/dist/react/{CopyPaste-5OWPTCQ5.js.map → CopyPaste-YUDZ6DHY.js.map} +0 -0
  103. /package/dist/react/{Frame-RLSMJJSK.js.map → Frame-7D2MXCFF.js.map} +0 -0
  104. /package/dist/react/{IconShape-7OPXAKLK.js.map → IconShape-ZADX7Y33.js.map} +0 -0
  105. /package/dist/react/{ImageShape-T7UEHP4A.js.map → ImageShape-UJQN2HI7.js.map} +0 -0
  106. /package/dist/react/{Line-WWQFBNX5.js.map → Line-APEULMHE.js.map} +0 -0
  107. /package/dist/react/{Selection-ZL3G6IAO.js.map → Selection-2TSH3J6P.js.map} +0 -0
  108. /package/dist/react/{UndoRedo-NL7KLR5B.js.map → UndoRedo-IN4SXDG6.js.map} +0 -0
  109. /package/dist/react/{arrowTool-CNVGM6RX.js.map → arrowTool-OYDWJGQK.js.map} +0 -0
  110. /package/dist/react/{chunk-4BLMNGTR.js.map → chunk-7CM5XQDN.js.map} +0 -0
  111. /package/dist/react/{chunk-XFQECTTF.js.map → chunk-APTOPAOY.js.map} +0 -0
  112. /package/dist/react/{chunk-4TAS67SL.js.map → chunk-EOURRJ55.js.map} +0 -0
  113. /package/dist/react/{chunk-ETAAQUUV.js.map → chunk-GQUZPON4.js.map} +0 -0
  114. /package/dist/react/{chunk-GC3KTQDA.js.map → chunk-LJR7EVW2.js.map} +0 -0
  115. /package/dist/react/{chunk-SZD7DKYJ.js.map → chunk-LSHZYN77.js.map} +0 -0
  116. /package/dist/react/{chunk-HFQZYCHJ.js.map → chunk-M6TMN76K.js.map} +0 -0
  117. /package/dist/react/{chunk-V2QTYSBK.js.map → chunk-OP56XPWF.js.map} +0 -0
  118. /package/dist/react/{chunk-ILGAFR56.js.map → chunk-RGMDWLRJ.js.map} +0 -0
  119. /package/dist/react/{chunk-OFGJJKPH.js.map → chunk-XFL4R5ZF.js.map} +0 -0
  120. /package/dist/react/{chunk-GPIYXREE.js.map → chunk-XOWNCYE4.js.map} +0 -0
  121. /package/dist/react/{chunk-YF3TK7SC.js.map → chunk-XYUFEIZR.js.map} +0 -0
  122. /package/dist/react/{circleTool-KICNRQCI.js.map → circleTool-LDKGZALF.js.map} +0 -0
  123. /package/dist/react/{codeTool-NCQ73R6M.js.map → codeTool-4YZO5W7J.js.map} +0 -0
  124. /package/dist/react/{frameTool-Y6KB67DO.js.map → frameTool-MXNJEXQQ.js.map} +0 -0
  125. /package/dist/react/{freehandTool-MMULHCQ7.js.map → freehandTool-26D3FOOX.js.map} +0 -0
  126. /package/dist/react/{iconTool-LSW2DYGB.js.map → iconTool-46O5VEUX.js.map} +0 -0
  127. /package/dist/react/{imageTool-2DSR32RX.js.map → imageTool-P2RWZRHO.js.map} +0 -0
  128. /package/dist/react/{lineTool-N5I7IGT7.js.map → lineTool-ZMR27U5L.js.map} +0 -0
  129. /package/dist/react/{rectangleTool-YUT7ZK2E.js.map → rectangleTool-EJKK6UTX.js.map} +0 -0
  130. /package/dist/react/{textTool-JMTX7OVT.js.map → textTool-S4XXZHZH.js.map} +0 -0
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @lixsketch/engine
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/engine
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/engine';
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/engine';
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/engine';
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/engine/fonts';
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)