@elixpo/lixsketch 4.5.8
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 +21 -0
- package/README.md +169 -0
- package/fonts/fonts.css +29 -0
- package/fonts/lixCode.ttf +0 -0
- package/fonts/lixDefault.ttf +0 -0
- package/fonts/lixDocs.ttf +0 -0
- package/fonts/lixFancy.ttf +0 -0
- package/fonts/lixFont.woff2 +0 -0
- package/package.json +49 -0
- package/src/SketchEngine.js +473 -0
- package/src/core/AIRenderer.js +1390 -0
- package/src/core/CopyPaste.js +655 -0
- package/src/core/EraserTrail.js +234 -0
- package/src/core/EventDispatcher.js +371 -0
- package/src/core/GraphEngine.js +150 -0
- package/src/core/GraphMathParser.js +231 -0
- package/src/core/GraphRenderer.js +255 -0
- package/src/core/LayerOrder.js +91 -0
- package/src/core/LixScriptParser.js +1299 -0
- package/src/core/MermaidFlowchartRenderer.js +475 -0
- package/src/core/MermaidSequenceParser.js +197 -0
- package/src/core/MermaidSequenceRenderer.js +479 -0
- package/src/core/ResizeCode.js +175 -0
- package/src/core/ResizeShapes.js +318 -0
- package/src/core/SceneSerializer.js +778 -0
- package/src/core/Selection.js +1861 -0
- package/src/core/SnapGuides.js +273 -0
- package/src/core/UndoRedo.js +1358 -0
- package/src/core/ZoomPan.js +258 -0
- package/src/core/ai-system-prompt.js +663 -0
- package/src/index.js +69 -0
- package/src/shapes/Arrow.js +1979 -0
- package/src/shapes/Circle.js +751 -0
- package/src/shapes/CodeShape.js +244 -0
- package/src/shapes/Frame.js +1460 -0
- package/src/shapes/FreehandStroke.js +724 -0
- package/src/shapes/IconShape.js +265 -0
- package/src/shapes/ImageShape.js +270 -0
- package/src/shapes/Line.js +738 -0
- package/src/shapes/Rectangle.js +794 -0
- package/src/shapes/TextShape.js +225 -0
- package/src/tools/arrowTool.js +581 -0
- package/src/tools/circleTool.js +619 -0
- package/src/tools/codeTool.js +2103 -0
- package/src/tools/eraserTool.js +131 -0
- package/src/tools/frameTool.js +241 -0
- package/src/tools/freehandTool.js +620 -0
- package/src/tools/iconTool.js +1344 -0
- package/src/tools/imageTool.js +1323 -0
- package/src/tools/laserTool.js +317 -0
- package/src/tools/lineTool.js +502 -0
- package/src/tools/rectangleTool.js +544 -0
- package/src/tools/textTool.js +1823 -0
- package/src/utils/imageCompressor.js +107 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* @lixsketch/engine - Open-source SVG whiteboard engine
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* import { createSketchEngine } from '@lixsketch/engine';
|
|
7
|
+
*
|
|
8
|
+
* const engine = createSketchEngine(svgElement, {
|
|
9
|
+
* onEvent: (type, data) => console.log(type, data),
|
|
10
|
+
* });
|
|
11
|
+
* await engine.init();
|
|
12
|
+
* engine.setActiveTool('rectangle');
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// Main engine class
|
|
16
|
+
export { SketchEngine, default } from './SketchEngine.js';
|
|
17
|
+
|
|
18
|
+
// Shape classes
|
|
19
|
+
export { Rectangle } from './shapes/Rectangle.js';
|
|
20
|
+
export { Circle } from './shapes/Circle.js';
|
|
21
|
+
export { Arrow } from './shapes/Arrow.js';
|
|
22
|
+
export { Line } from './shapes/Line.js';
|
|
23
|
+
export { TextShape } from './shapes/TextShape.js';
|
|
24
|
+
export { CodeShape } from './shapes/CodeShape.js';
|
|
25
|
+
export { ImageShape } from './shapes/ImageShape.js';
|
|
26
|
+
export { IconShape } from './shapes/IconShape.js';
|
|
27
|
+
export { Frame } from './shapes/Frame.js';
|
|
28
|
+
export { FreehandStroke } from './shapes/FreehandStroke.js';
|
|
29
|
+
|
|
30
|
+
// Convenience factory
|
|
31
|
+
import { SketchEngine } from './SketchEngine.js';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Create and return a new SketchEngine instance.
|
|
35
|
+
*
|
|
36
|
+
* @param {SVGSVGElement} svgElement - The SVG element to mount on
|
|
37
|
+
* @param {Object} [options]
|
|
38
|
+
* @param {number} [options.initialZoom=1]
|
|
39
|
+
* @param {number} [options.minZoom=0.4]
|
|
40
|
+
* @param {number} [options.maxZoom=30]
|
|
41
|
+
* @param {function} [options.onEvent] - Callback for engine events:
|
|
42
|
+
* 'sidebar:select' - { sidebar, shapeName }
|
|
43
|
+
* 'sidebar:clear' - undefined
|
|
44
|
+
* 'zoom:change' - number
|
|
45
|
+
* 'tool:change' - string
|
|
46
|
+
* 'scene:change' - undefined
|
|
47
|
+
* @returns {SketchEngine}
|
|
48
|
+
*/
|
|
49
|
+
export function createSketchEngine(svgElement, options = {}) {
|
|
50
|
+
return new SketchEngine(svgElement, options);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Tool name constants
|
|
54
|
+
export const TOOLS = {
|
|
55
|
+
SELECT: 'select',
|
|
56
|
+
PAN: 'pan',
|
|
57
|
+
RECTANGLE: 'rectangle',
|
|
58
|
+
CIRCLE: 'circle',
|
|
59
|
+
LINE: 'line',
|
|
60
|
+
ARROW: 'arrow',
|
|
61
|
+
FREEHAND: 'freehand',
|
|
62
|
+
TEXT: 'text',
|
|
63
|
+
CODE: 'code',
|
|
64
|
+
ERASER: 'eraser',
|
|
65
|
+
LASER: 'laser',
|
|
66
|
+
IMAGE: 'image',
|
|
67
|
+
FRAME: 'frame',
|
|
68
|
+
ICON: 'icon',
|
|
69
|
+
};
|