@swiftlysingh/excalidraw-cli 1.0.1 → 1.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/README.md +77 -2
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +104 -15
- package/dist/cli.js.map +1 -1
- package/dist/exporter/dom-polyfill.d.ts +25 -0
- package/dist/exporter/dom-polyfill.d.ts.map +1 -0
- package/dist/exporter/dom-polyfill.js +220 -0
- package/dist/exporter/dom-polyfill.js.map +1 -0
- package/dist/exporter/image-exporter.d.ts +87 -0
- package/dist/exporter/image-exporter.d.ts.map +1 -0
- package/dist/exporter/image-exporter.js +188 -0
- package/dist/exporter/image-exporter.js.map +1 -0
- package/dist/exporter/index.d.ts +6 -0
- package/dist/exporter/index.d.ts.map +1 -0
- package/dist/exporter/index.js +5 -0
- package/dist/exporter/index.js.map +1 -0
- package/dist/factory/connection-factory.js +12 -8
- package/dist/factory/connection-factory.js.map +1 -1
- package/dist/factory/image-factory.d.ts +38 -0
- package/dist/factory/image-factory.d.ts.map +1 -0
- package/dist/factory/image-factory.js +172 -0
- package/dist/factory/image-factory.js.map +1 -0
- package/dist/factory/index.d.ts +1 -0
- package/dist/factory/index.d.ts.map +1 -1
- package/dist/factory/index.js +1 -0
- package/dist/factory/index.js.map +1 -1
- package/dist/factory/node-factory.js +16 -9
- package/dist/factory/node-factory.js.map +1 -1
- package/dist/factory/text-factory.d.ts +1 -0
- package/dist/factory/text-factory.d.ts.map +1 -1
- package/dist/factory/text-factory.js +1 -0
- package/dist/factory/text-factory.js.map +1 -1
- package/dist/generator/excalidraw-generator.d.ts.map +1 -1
- package/dist/generator/excalidraw-generator.js +100 -29
- package/dist/generator/excalidraw-generator.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -8
- package/dist/index.js.map +1 -1
- package/dist/layout/elk-layout.d.ts +8 -1
- package/dist/layout/elk-layout.d.ts.map +1 -1
- package/dist/layout/elk-layout.js +99 -3
- package/dist/layout/elk-layout.js.map +1 -1
- package/dist/layout/index.d.ts +1 -1
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/parser/dot-parser.d.ts +23 -0
- package/dist/parser/dot-parser.d.ts.map +1 -0
- package/dist/parser/dot-parser.js +277 -0
- package/dist/parser/dot-parser.js.map +1 -0
- package/dist/parser/dsl-parser.d.ts +10 -0
- package/dist/parser/dsl-parser.d.ts.map +1 -1
- package/dist/parser/dsl-parser.js +214 -8
- package/dist/parser/dsl-parser.js.map +1 -1
- package/dist/parser/index.d.ts +1 -0
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/index.js +1 -0
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/json-parser.js +1 -1
- package/dist/parser/json-parser.js.map +1 -1
- package/dist/types/dsl.d.ts +68 -1
- package/dist/types/dsl.d.ts.map +1 -1
- package/dist/types/dsl.js.map +1 -1
- package/dist/types/excalidraw.d.ts +22 -3
- package/dist/types/excalidraw.d.ts.map +1 -1
- package/dist/types/excalidraw.js.map +1 -1
- package/man/excalidraw-cli.1 +399 -0
- package/package.json +13 -4
package/dist/parser/index.js
CHANGED
package/dist/parser/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { DEFAULT_LAYOUT_OPTIONS } from '../types/dsl.js';
|
|
|
9
9
|
* Validate node type
|
|
10
10
|
*/
|
|
11
11
|
function isValidNodeType(type) {
|
|
12
|
-
return ['rectangle', 'diamond', 'ellipse', 'database'].includes(type);
|
|
12
|
+
return ['rectangle', 'diamond', 'ellipse', 'database', 'image'].includes(type);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Parse JSON input into FlowchartGraph
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-parser.js","sourceRoot":"","sources":["../../src/parser/json-parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;GAEG;AACH,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"json-parser.js","sourceRoot":"","sources":["../../src/parser/json-parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;GAEG;AACH,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACjF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAqB,CAAC;IAE7C,gBAAgB;IAChB,KAAK,MAAM,SA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;QACzB,GAAG,KAAK,CAAC,OAAO;KACjB,CAAC;IAEF,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACnC,KAAK;QACL,OAAO;KACR,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAmB,CAAC;QACvD,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,iBAAiB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,YAAY;AACZ,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/types/dsl.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Flowchart DSL Type Definitions
|
|
3
3
|
*/
|
|
4
|
-
export type NodeType = 'rectangle' | 'diamond' | 'ellipse' | 'database';
|
|
4
|
+
export type NodeType = 'rectangle' | 'diamond' | 'ellipse' | 'database' | 'image';
|
|
5
5
|
export type FlowDirection = 'TB' | 'BT' | 'LR' | 'RL';
|
|
6
6
|
export type LayoutAlgorithm = 'layered' | 'tree' | 'force';
|
|
7
7
|
export type ArrowheadType = 'arrow' | 'bar' | 'dot' | 'triangle' | null;
|
|
@@ -32,6 +32,27 @@ export interface EdgeStyle {
|
|
|
32
32
|
endArrowhead?: ArrowheadType;
|
|
33
33
|
roughness?: number;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Image source configuration
|
|
37
|
+
*/
|
|
38
|
+
export interface ImageSource {
|
|
39
|
+
src: string;
|
|
40
|
+
width?: number;
|
|
41
|
+
height?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Decoration position anchors
|
|
45
|
+
*/
|
|
46
|
+
export type DecorationAnchor = 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
47
|
+
/**
|
|
48
|
+
* Decoration attached to a node
|
|
49
|
+
*/
|
|
50
|
+
export interface NodeDecoration {
|
|
51
|
+
src: string;
|
|
52
|
+
anchor: DecorationAnchor;
|
|
53
|
+
width?: number;
|
|
54
|
+
height?: number;
|
|
55
|
+
}
|
|
35
56
|
/**
|
|
36
57
|
* A node in the flowchart graph
|
|
37
58
|
*/
|
|
@@ -40,6 +61,8 @@ export interface GraphNode {
|
|
|
40
61
|
type: NodeType;
|
|
41
62
|
label: string;
|
|
42
63
|
style?: NodeStyle;
|
|
64
|
+
image?: ImageSource;
|
|
65
|
+
decorations?: NodeDecoration[];
|
|
43
66
|
}
|
|
44
67
|
/**
|
|
45
68
|
* An edge (connection) between nodes
|
|
@@ -61,6 +84,33 @@ export interface LayoutOptions {
|
|
|
61
84
|
rankSpacing: number;
|
|
62
85
|
padding: number;
|
|
63
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Positioned image (decoration placed at absolute or relative position)
|
|
89
|
+
*/
|
|
90
|
+
export interface PositionedImage {
|
|
91
|
+
id: string;
|
|
92
|
+
src: string;
|
|
93
|
+
position: {
|
|
94
|
+
type: 'absolute';
|
|
95
|
+
x: number;
|
|
96
|
+
y: number;
|
|
97
|
+
} | {
|
|
98
|
+
type: 'near';
|
|
99
|
+
nodeLabel: string;
|
|
100
|
+
anchor?: DecorationAnchor;
|
|
101
|
+
};
|
|
102
|
+
width?: number;
|
|
103
|
+
height?: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Scatter configuration for distributing images across the canvas
|
|
107
|
+
*/
|
|
108
|
+
export interface ScatterConfig {
|
|
109
|
+
src: string;
|
|
110
|
+
count: number;
|
|
111
|
+
width?: number;
|
|
112
|
+
height?: number;
|
|
113
|
+
}
|
|
64
114
|
/**
|
|
65
115
|
* Complete flowchart graph representation
|
|
66
116
|
*/
|
|
@@ -68,6 +118,9 @@ export interface FlowchartGraph {
|
|
|
68
118
|
nodes: GraphNode[];
|
|
69
119
|
edges: GraphEdge[];
|
|
70
120
|
options: LayoutOptions;
|
|
121
|
+
images?: PositionedImage[];
|
|
122
|
+
scatter?: ScatterConfig[];
|
|
123
|
+
library?: string;
|
|
71
124
|
}
|
|
72
125
|
/**
|
|
73
126
|
* Default layout options
|
|
@@ -114,6 +167,17 @@ export interface LayoutedEdge extends GraphEdge {
|
|
|
114
167
|
y: number;
|
|
115
168
|
};
|
|
116
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Layouted positioned image with resolved coordinates
|
|
172
|
+
*/
|
|
173
|
+
export interface LayoutedImage {
|
|
174
|
+
id: string;
|
|
175
|
+
src: string;
|
|
176
|
+
x: number;
|
|
177
|
+
y: number;
|
|
178
|
+
width: number;
|
|
179
|
+
height: number;
|
|
180
|
+
}
|
|
117
181
|
/**
|
|
118
182
|
* Layouted flowchart graph
|
|
119
183
|
*/
|
|
@@ -123,5 +187,8 @@ export interface LayoutedGraph {
|
|
|
123
187
|
options: LayoutOptions;
|
|
124
188
|
width: number;
|
|
125
189
|
height: number;
|
|
190
|
+
images?: LayoutedImage[];
|
|
191
|
+
scatter?: ScatterConfig[];
|
|
192
|
+
library?: string;
|
|
126
193
|
}
|
|
127
194
|
//# sourceMappingURL=dsl.d.ts.map
|
package/dist/types/dsl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dsl.d.ts","sourceRoot":"","sources":["../../src/types/dsl.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"dsl.d.ts","sourceR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K,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChC,WAAW,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,WAAW,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/types/dsl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dsl.js","sourceRoot":"","sources":["../../src/types/dsl.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"dsl.js","sourceRoot":"","sources":["../../src/types/dsl.ts"],"names":[],"mappings":"AAAA;;GAEG;AA8IH;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,EAAE;CACZ,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Excalidraw Element Type Definitions
|
|
3
3
|
* Based on Excalidraw JSON schema
|
|
4
4
|
*/
|
|
5
|
-
export type ExcalidrawElementType = 'rectangle' | 'diamond' | 'ellipse' | 'text' | 'arrow' | 'line' | 'freedraw';
|
|
5
|
+
export type ExcalidrawElementType = 'rectangle' | 'diamond' | 'ellipse' | 'text' | 'arrow' | 'line' | 'freedraw' | 'image';
|
|
6
6
|
export type ExcalidrawFillStyle = 'solid' | 'hachure' | 'cross-hatch';
|
|
7
7
|
export type ExcalidrawStrokeStyle = 'solid' | 'dashed' | 'dotted';
|
|
8
8
|
export type ExcalidrawArrowhead = 'arrow' | 'bar' | 'dot' | 'triangle' | null;
|
|
@@ -118,10 +118,29 @@ export interface ExcalidrawLine extends ExcalidrawElementBase {
|
|
|
118
118
|
startArrowhead: ExcalidrawArrowhead;
|
|
119
119
|
endArrowhead: ExcalidrawArrowhead;
|
|
120
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Image element
|
|
123
|
+
*/
|
|
124
|
+
export interface ExcalidrawImage extends ExcalidrawElementBase {
|
|
125
|
+
type: 'image';
|
|
126
|
+
fileId: string;
|
|
127
|
+
status: 'pending' | 'saved' | 'error';
|
|
128
|
+
scale: [number, number];
|
|
129
|
+
}
|
|
121
130
|
/**
|
|
122
131
|
* Union type for all Excalidraw elements
|
|
123
132
|
*/
|
|
124
|
-
export type ExcalidrawElement = ExcalidrawRectangle | ExcalidrawDiamond | ExcalidrawEllipse | ExcalidrawText | ExcalidrawArrow | ExcalidrawLine;
|
|
133
|
+
export type ExcalidrawElement = ExcalidrawRectangle | ExcalidrawDiamond | ExcalidrawEllipse | ExcalidrawText | ExcalidrawArrow | ExcalidrawLine | ExcalidrawImage;
|
|
134
|
+
/**
|
|
135
|
+
* File data for embedded images
|
|
136
|
+
*/
|
|
137
|
+
export interface ExcalidrawFileData {
|
|
138
|
+
mimeType: string;
|
|
139
|
+
id: string;
|
|
140
|
+
dataURL: string;
|
|
141
|
+
created: number;
|
|
142
|
+
lastRetrieved?: number;
|
|
143
|
+
}
|
|
125
144
|
/**
|
|
126
145
|
* Application state for the canvas
|
|
127
146
|
*/
|
|
@@ -141,7 +160,7 @@ export interface ExcalidrawFile {
|
|
|
141
160
|
source: string;
|
|
142
161
|
elements: ExcalidrawElement[];
|
|
143
162
|
appState: ExcalidrawAppState;
|
|
144
|
-
files: Record<string,
|
|
163
|
+
files: Record<string, ExcalidrawFileData>;
|
|
145
164
|
}
|
|
146
165
|
/**
|
|
147
166
|
* Default app state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"excalidraw.d.ts","sourceRoot":"","sources":["../../src/types/excalidraw.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,qBAAqB,GAC7B,WAAW,GACX,SAAS,GACT,SAAS,GACT,MAAM,GACN,OAAO,GACP,MAAM,GACN,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"excalidraw.d.ts","sourceRoot":"","sources":["../../src/types/excalidraw.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,qBAAqB,GAC7B,WAAW,GACX,SAAS,GACT,SAAS,GACT,MAAM,GACN,OAAO,GACP,MAAM,GACN,UAAU,GACV,OAAO,CAAC;AAEZ,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AAEtE,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,IAAI,CAAC;AAE9E,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9D,MAAM,MAAM,uBAA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Q,EAAE,iBAAiB,EAAE,CAAC;IAC9B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAC3C;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,kBAM/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;eAGV,mBAAmB;;iBAEjB,qBAAqB;;;CAG9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"excalidraw.js","sourceRoot":"","sources":["../../src/types/excalidraw.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"excalidraw.js","sourceRoot":"","sources":["../../src/types/excalidraw.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsMH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAuB;IACnD,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,CAAC;IACX,eAAe,EAAE,KAAK;IACtB,mBAAmB,EAAE,SAAS;IAC9B,qBAAqB,EAAE,EAAE;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,WAAW,EAAE,SAAS;IACtB,eAAe,EAAE,aAAa;IAC9B,SAAS,EAAE,OAA8B;IACzC,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,OAAgC;IAC7C,SAAS,EAAE,CAAC;IACZ,OAAO,EAAE,GAAG;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,MAAM,EAAE,CAAC;IACT,SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,CAAC;IACX,UAAU,EAAE,CAAC;CACL,CAAC"}
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
.TH EXCALIDRAW-CLI 1 "March 2026" "excalidraw-cli 1.2.0" "User Commands"
|
|
2
|
+
.SH NAME
|
|
3
|
+
excalidraw-cli \- create Excalidraw diagrams from DSL, JSON, or Graphviz DOT
|
|
4
|
+
.SH SYNOPSIS
|
|
5
|
+
.B excalidraw-cli
|
|
6
|
+
.RB [ \-h " | " \-\-help ]
|
|
7
|
+
.RB [ \-V " | " \-\-version ]
|
|
8
|
+
.br
|
|
9
|
+
.B excalidraw-cli
|
|
10
|
+
.B create
|
|
11
|
+
.RI [ options ] " [input]"
|
|
12
|
+
.br
|
|
13
|
+
.B excalidraw-cli
|
|
14
|
+
.B parse
|
|
15
|
+
.RI [ options ] " <input>"
|
|
16
|
+
.br
|
|
17
|
+
.B excalidraw-cli
|
|
18
|
+
.B help
|
|
19
|
+
.RI [ command ]
|
|
20
|
+
.SH DESCRIPTION
|
|
21
|
+
.B excalidraw-cli
|
|
22
|
+
parses a flowchart description, lays it out with ELK, and writes an
|
|
23
|
+
.B .excalidraw
|
|
24
|
+
document.
|
|
25
|
+
.P
|
|
26
|
+
The
|
|
27
|
+
.B create
|
|
28
|
+
command accepts DSL, JSON, or Graphviz DOT from an inline string, standard
|
|
29
|
+
input, or a file. The
|
|
30
|
+
.B parse
|
|
31
|
+
command reads a file, validates it, and prints a summary of the parsed graph
|
|
32
|
+
without generating Excalidraw output.
|
|
33
|
+
.SH COMMANDS
|
|
34
|
+
.TP
|
|
35
|
+
.B create
|
|
36
|
+
Read input, parse it, apply layout, and write Excalidraw JSON.
|
|
37
|
+
.TP
|
|
38
|
+
.B parse
|
|
39
|
+
Read and validate an input file and print nodes, edges, and direction.
|
|
40
|
+
.TP
|
|
41
|
+
.B help
|
|
42
|
+
Show the built-in help for a command.
|
|
43
|
+
.SH OPTIONS
|
|
44
|
+
.SS "Global options"
|
|
45
|
+
.TP
|
|
46
|
+
.BR \-h ", " \-\-help
|
|
47
|
+
Show help and exit.
|
|
48
|
+
.TP
|
|
49
|
+
.BR \-V ", " \-\-version
|
|
50
|
+
Show version and exit.
|
|
51
|
+
.SS "create options"
|
|
52
|
+
.TP
|
|
53
|
+
.BR \-o ", " \-\-output " " <file>
|
|
54
|
+
Write the generated Excalidraw document to
|
|
55
|
+
.IR file .
|
|
56
|
+
The default is
|
|
57
|
+
.BR flowchart.excalidraw .
|
|
58
|
+
Use
|
|
59
|
+
.B -
|
|
60
|
+
to write to standard output.
|
|
61
|
+
.TP
|
|
62
|
+
.BR \-f ", " \-\-format " " <type>
|
|
63
|
+
Input format. Supported values are
|
|
64
|
+
.BR dsl ,
|
|
65
|
+
.BR json ,
|
|
66
|
+
and
|
|
67
|
+
.BR dot .
|
|
68
|
+
If omitted, the default is
|
|
69
|
+
.BR dsl ,
|
|
70
|
+
subject to file-extension auto-detection.
|
|
71
|
+
.TP
|
|
72
|
+
.BR \-\-inline " " <input>
|
|
73
|
+
Parse the supplied inline DSL, JSON, or DOT string.
|
|
74
|
+
For JSON or DOT, combine with
|
|
75
|
+
.BR \-\-format .
|
|
76
|
+
.TP
|
|
77
|
+
.BR \-\-stdin
|
|
78
|
+
Read input from standard input.
|
|
79
|
+
.TP
|
|
80
|
+
.BR \-d ", " \-\-direction " " <dir>
|
|
81
|
+
Override the graph direction after parsing.
|
|
82
|
+
Accepted values are
|
|
83
|
+
.BR TB ,
|
|
84
|
+
.BR BT ,
|
|
85
|
+
.BR LR ,
|
|
86
|
+
and
|
|
87
|
+
.BR RL .
|
|
88
|
+
If supplied, this overrides direction from DSL directives, JSON options, or
|
|
89
|
+
DOT
|
|
90
|
+
.BR rankdir .
|
|
91
|
+
.TP
|
|
92
|
+
.BR \-s ", " \-\-spacing " " <n>
|
|
93
|
+
Override node spacing after parsing.
|
|
94
|
+
If supplied and numeric, this overrides spacing from DSL directives or JSON
|
|
95
|
+
options.
|
|
96
|
+
.TP
|
|
97
|
+
.BR \-\-verbose
|
|
98
|
+
Print basic parse and layout progress information.
|
|
99
|
+
.SS "parse options"
|
|
100
|
+
.TP
|
|
101
|
+
.BR \-f ", " \-\-format " " <type>
|
|
102
|
+
Input format. Supported values are
|
|
103
|
+
.BR dsl ,
|
|
104
|
+
.BR json ,
|
|
105
|
+
and
|
|
106
|
+
.BR dot .
|
|
107
|
+
If omitted, the default is
|
|
108
|
+
.BR dsl ,
|
|
109
|
+
subject to file-extension auto-detection.
|
|
110
|
+
.SH INPUT SOURCES
|
|
111
|
+
For
|
|
112
|
+
.BR create ,
|
|
113
|
+
input is selected in this order:
|
|
114
|
+
.TP
|
|
115
|
+
.B 1.
|
|
116
|
+
.B \-\-inline
|
|
117
|
+
.TP
|
|
118
|
+
.B 2.
|
|
119
|
+
.B \-\-stdin
|
|
120
|
+
.TP
|
|
121
|
+
.B 3.
|
|
122
|
+
The positional
|
|
123
|
+
.I input
|
|
124
|
+
file argument
|
|
125
|
+
.P
|
|
126
|
+
If none of these is provided,
|
|
127
|
+
.B create
|
|
128
|
+
exits with an error.
|
|
129
|
+
.P
|
|
130
|
+
.B parse
|
|
131
|
+
always reads the positional
|
|
132
|
+
.I input
|
|
133
|
+
file argument.
|
|
134
|
+
.SH FORMAT DETECTION
|
|
135
|
+
When an input file is used and
|
|
136
|
+
.B \-\-format
|
|
137
|
+
was not explicitly provided,
|
|
138
|
+
.B excalidraw-cli
|
|
139
|
+
auto-detects the format from the file extension:
|
|
140
|
+
.TP
|
|
141
|
+
.B .json
|
|
142
|
+
Use JSON input.
|
|
143
|
+
.TP
|
|
144
|
+
.B .dot
|
|
145
|
+
or
|
|
146
|
+
.B .gv
|
|
147
|
+
Use DOT input.
|
|
148
|
+
.TP
|
|
149
|
+
Any other extension
|
|
150
|
+
Use DSL input.
|
|
151
|
+
.P
|
|
152
|
+
For
|
|
153
|
+
.B \-\-inline
|
|
154
|
+
or
|
|
155
|
+
.BR \-\-stdin ,
|
|
156
|
+
the format remains
|
|
157
|
+
.B dsl
|
|
158
|
+
unless
|
|
159
|
+
.B \-\-format
|
|
160
|
+
is provided.
|
|
161
|
+
.SH DSL FORMAT
|
|
162
|
+
.SS "Node syntax"
|
|
163
|
+
.TP
|
|
164
|
+
.B [Label]
|
|
165
|
+
Rectangle node.
|
|
166
|
+
.TP
|
|
167
|
+
.B {Label}
|
|
168
|
+
Diamond node.
|
|
169
|
+
.TP
|
|
170
|
+
.B (Label)
|
|
171
|
+
Ellipse node.
|
|
172
|
+
.TP
|
|
173
|
+
.B [[Label]]
|
|
174
|
+
Database node.
|
|
175
|
+
.TP
|
|
176
|
+
.B ![path]
|
|
177
|
+
Image node using the default image size.
|
|
178
|
+
.TP
|
|
179
|
+
.B 
|
|
180
|
+
Image node with explicit width and height.
|
|
181
|
+
.SS "Edge syntax"
|
|
182
|
+
.TP
|
|
183
|
+
.B A -> B
|
|
184
|
+
Solid edge.
|
|
185
|
+
.TP
|
|
186
|
+
.B A --> B
|
|
187
|
+
Dashed edge.
|
|
188
|
+
.TP
|
|
189
|
+
.B A -> \(dqlabel\(dq -> B
|
|
190
|
+
Labeled edge.
|
|
191
|
+
.P
|
|
192
|
+
Nodes are deduplicated by label and type.
|
|
193
|
+
Chains such as
|
|
194
|
+
.B [A] -> [B] -> [C]
|
|
195
|
+
produce one edge per hop.
|
|
196
|
+
.SS "Comments"
|
|
197
|
+
.TP
|
|
198
|
+
.B # comment
|
|
199
|
+
Ignore the remainder of the line.
|
|
200
|
+
.SS "Directives"
|
|
201
|
+
.TP
|
|
202
|
+
.B @direction TB|BT|LR|RL
|
|
203
|
+
Set graph direction.
|
|
204
|
+
.TP
|
|
205
|
+
.B @spacing N
|
|
206
|
+
Set node spacing.
|
|
207
|
+
.TP
|
|
208
|
+
.B @image path at X,Y
|
|
209
|
+
Place an image at absolute coordinates.
|
|
210
|
+
.TP
|
|
211
|
+
.B @image path near (NodeLabel) [anchor]
|
|
212
|
+
Place an image relative to a node label.
|
|
213
|
+
.TP
|
|
214
|
+
.B @decorate path [anchor]
|
|
215
|
+
Attach a decoration image to the preceding node.
|
|
216
|
+
If
|
|
217
|
+
.I anchor
|
|
218
|
+
is omitted, the default is
|
|
219
|
+
.BR top-right .
|
|
220
|
+
.TP
|
|
221
|
+
.B @sticker name
|
|
222
|
+
Add a sticker image at the default absolute position
|
|
223
|
+
.BR 0,0 .
|
|
224
|
+
.TP
|
|
225
|
+
.B @sticker name at X,Y
|
|
226
|
+
Add a sticker at absolute coordinates.
|
|
227
|
+
.TP
|
|
228
|
+
.B @sticker name near (NodeLabel) [anchor]
|
|
229
|
+
Add a sticker relative to a node label.
|
|
230
|
+
.TP
|
|
231
|
+
.B @library path
|
|
232
|
+
Set the sticker library path used to resolve
|
|
233
|
+
.B sticker:
|
|
234
|
+
references.
|
|
235
|
+
.TP
|
|
236
|
+
.B @scatter path count:N [width:W] [height:H]
|
|
237
|
+
Scatter repeated images across the output canvas.
|
|
238
|
+
.SH JSON FORMAT
|
|
239
|
+
JSON input must parse to an object with the following top-level properties:
|
|
240
|
+
.TP
|
|
241
|
+
.B nodes
|
|
242
|
+
Required array of node objects. Each node has:
|
|
243
|
+
.IR id ,
|
|
244
|
+
.IR type ,
|
|
245
|
+
.IR label ,
|
|
246
|
+
and optional
|
|
247
|
+
.IR style .
|
|
248
|
+
.TP
|
|
249
|
+
.B edges
|
|
250
|
+
Required array of edge objects. Each edge has:
|
|
251
|
+
.IR from ,
|
|
252
|
+
.IR to ,
|
|
253
|
+
and optional
|
|
254
|
+
.IR label
|
|
255
|
+
and
|
|
256
|
+
.IR style .
|
|
257
|
+
.TP
|
|
258
|
+
.B options
|
|
259
|
+
Optional object merged into the default layout options.
|
|
260
|
+
.P
|
|
261
|
+
Recognized JSON node types are
|
|
262
|
+
.BR rectangle ,
|
|
263
|
+
.BR diamond ,
|
|
264
|
+
.BR ellipse ,
|
|
265
|
+
and
|
|
266
|
+
.BR database .
|
|
267
|
+
Any other node type is treated as
|
|
268
|
+
.BR rectangle .
|
|
269
|
+
.SH DOT FORMAT
|
|
270
|
+
DOT input is parsed with
|
|
271
|
+
.BR ts-graphviz .
|
|
272
|
+
Supported behavior includes:
|
|
273
|
+
.TP
|
|
274
|
+
.B Graph kinds
|
|
275
|
+
.B digraph
|
|
276
|
+
and
|
|
277
|
+
.B graph
|
|
278
|
+
are accepted.
|
|
279
|
+
.TP
|
|
280
|
+
.B Edges
|
|
281
|
+
Directed
|
|
282
|
+
.RB ( -> )
|
|
283
|
+
and undirected
|
|
284
|
+
.RB ( -- )
|
|
285
|
+
edges are accepted.
|
|
286
|
+
Edge chains are expanded into one edge per hop.
|
|
287
|
+
.TP
|
|
288
|
+
.B Labels
|
|
289
|
+
Node
|
|
290
|
+
.B label=
|
|
291
|
+
and edge
|
|
292
|
+
.B label=
|
|
293
|
+
attributes are preserved.
|
|
294
|
+
.TP
|
|
295
|
+
.B Shapes
|
|
296
|
+
DOT shapes are mapped to Excalidraw node types:
|
|
297
|
+
.B diamond
|
|
298
|
+
to diamond;
|
|
299
|
+
.BR ellipse ,
|
|
300
|
+
.BR oval ,
|
|
301
|
+
and
|
|
302
|
+
.B circle
|
|
303
|
+
to ellipse;
|
|
304
|
+
.BR cylinder ,
|
|
305
|
+
.BR record ,
|
|
306
|
+
and
|
|
307
|
+
.B mrecord
|
|
308
|
+
to database;
|
|
309
|
+
all other shapes to rectangle.
|
|
310
|
+
.TP
|
|
311
|
+
.B Layout attributes
|
|
312
|
+
.B rankdir=TB|BT|LR|RL
|
|
313
|
+
sets direction.
|
|
314
|
+
.B nodesep
|
|
315
|
+
and
|
|
316
|
+
.B ranksep
|
|
317
|
+
are converted into approximate pixel spacing.
|
|
318
|
+
.TP
|
|
319
|
+
.B Styles
|
|
320
|
+
Node and edge
|
|
321
|
+
.B color
|
|
322
|
+
and dashed or dotted
|
|
323
|
+
.B style
|
|
324
|
+
attributes are preserved when possible.
|
|
325
|
+
.TP
|
|
326
|
+
.B Subgraphs
|
|
327
|
+
Subgraph nodes and edges are flattened into the main graph.
|
|
328
|
+
.SH IMAGES AND STICKERS
|
|
329
|
+
Image nodes, positioned images, decorations, scattered images, and stickers
|
|
330
|
+
are embedded from local files.
|
|
331
|
+
HTTP and HTTPS URLs are accepted syntactically but are skipped during output
|
|
332
|
+
generation with a warning.
|
|
333
|
+
.P
|
|
334
|
+
If image dimensions are not provided, the default size is
|
|
335
|
+
.BR 100x100 .
|
|
336
|
+
For scattered images, the default size is
|
|
337
|
+
.BR 30x30 .
|
|
338
|
+
.P
|
|
339
|
+
Sticker names are resolved relative to the active
|
|
340
|
+
.B @library
|
|
341
|
+
path.
|
|
342
|
+
Common file extensions such as
|
|
343
|
+
.BR .png ,
|
|
344
|
+
.BR .svg ,
|
|
345
|
+
.BR .jpg ,
|
|
346
|
+
.BR .jpeg ,
|
|
347
|
+
.BR .gif ,
|
|
348
|
+
and
|
|
349
|
+
.B .webp
|
|
350
|
+
are tried automatically.
|
|
351
|
+
.SH OUTPUT
|
|
352
|
+
.B create
|
|
353
|
+
writes formatted Excalidraw JSON.
|
|
354
|
+
If
|
|
355
|
+
.B \-\-output
|
|
356
|
+
is not
|
|
357
|
+
.BR - ,
|
|
358
|
+
the command prints
|
|
359
|
+
.BR "Created: <file>" .
|
|
360
|
+
.P
|
|
361
|
+
.B parse
|
|
362
|
+
prints a human-readable summary containing node count, edge count, direction,
|
|
363
|
+
then the parsed node and edge list.
|
|
364
|
+
.SH DIAGNOSTICS
|
|
365
|
+
The commands exit with status 1 on parse errors, missing input, file read
|
|
366
|
+
failures, or generation failures.
|
|
367
|
+
.P
|
|
368
|
+
Image resolution failures are warnings when the rest of the document can still
|
|
369
|
+
be generated.
|
|
370
|
+
.SH EXAMPLES
|
|
371
|
+
.TP
|
|
372
|
+
.B Create from inline DSL
|
|
373
|
+
excalidraw-cli create --inline "(Start) -> [Process] -> (End)" -o flow.excalidraw
|
|
374
|
+
.TP
|
|
375
|
+
.B Create from inline JSON
|
|
376
|
+
excalidraw-cli create --format json --inline '{"nodes":[{"id":"a","type":"rectangle","label":"A"}],"edges":[]}' -o flow.excalidraw
|
|
377
|
+
.TP
|
|
378
|
+
.B Create from stdin
|
|
379
|
+
echo "[A] -> [B]" | excalidraw-cli create --stdin -o diagram.excalidraw
|
|
380
|
+
.TP
|
|
381
|
+
.B Write to stdout
|
|
382
|
+
excalidraw-cli create flowchart.dsl -o -
|
|
383
|
+
.TP
|
|
384
|
+
.B Parse a DOT file
|
|
385
|
+
excalidraw-cli parse graph.dot --format dot
|
|
386
|
+
.TP
|
|
387
|
+
.B Show command help
|
|
388
|
+
excalidraw-cli help create
|
|
389
|
+
.SH EXIT STATUS
|
|
390
|
+
.TP
|
|
391
|
+
.B 0
|
|
392
|
+
Success.
|
|
393
|
+
.TP
|
|
394
|
+
.B 1
|
|
395
|
+
Failure.
|
|
396
|
+
.SH SEE ALSO
|
|
397
|
+
Excalidraw:
|
|
398
|
+
.UR https://excalidraw.com
|
|
399
|
+
.UE
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swiftlysingh/excalidraw-cli",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "CLI for creating Excalidraw flowcharts programmatically",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
"bin": {
|
|
9
9
|
"excalidraw-cli": "dist/cli.js"
|
|
10
10
|
},
|
|
11
|
+
"man": [
|
|
12
|
+
"man/excalidraw-cli.1"
|
|
13
|
+
],
|
|
11
14
|
"scripts": {
|
|
12
15
|
"build": "tsc",
|
|
13
16
|
"dev": "tsc --watch",
|
|
@@ -31,17 +34,23 @@
|
|
|
31
34
|
"url": "https://github.com/swiftlysingh/excalidraw-cli.git"
|
|
32
35
|
},
|
|
33
36
|
"files": [
|
|
34
|
-
"dist"
|
|
37
|
+
"dist",
|
|
38
|
+
"man"
|
|
35
39
|
],
|
|
36
40
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
41
|
+
"node": ">=20.19.0"
|
|
38
42
|
},
|
|
39
43
|
"dependencies": {
|
|
44
|
+
"@excalidraw/utils": "0.1.3-test32",
|
|
45
|
+
"@resvg/resvg-js": "^2.6.2",
|
|
40
46
|
"commander": "^12.1.0",
|
|
41
47
|
"elkjs": "^0.9.3",
|
|
42
|
-
"
|
|
48
|
+
"jsdom": "^28.1.0",
|
|
49
|
+
"nanoid": "^5.0.9",
|
|
50
|
+
"ts-graphviz": "^3.0.6"
|
|
43
51
|
},
|
|
44
52
|
"devDependencies": {
|
|
53
|
+
"@types/jsdom": "^28.0.0",
|
|
45
54
|
"@types/node": "^22.10.5",
|
|
46
55
|
"@typescript-eslint/eslint-plugin": "^8.19.1",
|
|
47
56
|
"@typescript-eslint/parser": "^8.19.1",
|