edododraw 0.1.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 +27 -0
- package/README.md +71 -0
- package/dist-lib/chunks/EdodoDraw-CUf224RG.js +5432 -0
- package/dist-lib/chunks/EdodoDraw-CUf224RG.js.map +1 -0
- package/dist-lib/engine/annotate/interact.d.ts +69 -0
- package/dist-lib/engine/annotate/interact.d.ts.map +1 -0
- package/dist-lib/engine/annotate/layer.d.ts +34 -0
- package/dist-lib/engine/annotate/layer.d.ts.map +1 -0
- package/dist-lib/engine/camera/controller.d.ts +42 -0
- package/dist-lib/engine/camera/controller.d.ts.map +1 -0
- package/dist-lib/engine/camera/easing.d.ts +9 -0
- package/dist-lib/engine/camera/easing.d.ts.map +1 -0
- package/dist-lib/engine/camera/fit.d.ts +21 -0
- package/dist-lib/engine/camera/fit.d.ts.map +1 -0
- package/dist-lib/engine/dsl/ast.d.ts +266 -0
- package/dist-lib/engine/dsl/ast.d.ts.map +1 -0
- package/dist-lib/engine/dsl/compile.d.ts +18 -0
- package/dist-lib/engine/dsl/compile.d.ts.map +1 -0
- package/dist-lib/engine/dsl/diagnostics.d.ts +42 -0
- package/dist-lib/engine/dsl/diagnostics.d.ts.map +1 -0
- package/dist-lib/engine/dsl/index.d.ts +19 -0
- package/dist-lib/engine/dsl/index.d.ts.map +1 -0
- package/dist-lib/engine/dsl/lexer.d.ts +8 -0
- package/dist-lib/engine/dsl/lexer.d.ts.map +1 -0
- package/dist-lib/engine/dsl/lower.d.ts +35 -0
- package/dist-lib/engine/dsl/lower.d.ts.map +1 -0
- package/dist-lib/engine/dsl/parser.d.ts +19 -0
- package/dist-lib/engine/dsl/parser.d.ts.map +1 -0
- package/dist-lib/engine/dsl/tokens.d.ts +66 -0
- package/dist-lib/engine/dsl/tokens.d.ts.map +1 -0
- package/dist-lib/engine/export.d.ts +22 -0
- package/dist-lib/engine/export.d.ts.map +1 -0
- package/dist-lib/engine/geometry.d.ts +55 -0
- package/dist-lib/engine/geometry.d.ts.map +1 -0
- package/dist-lib/engine/import/mermaid.d.ts +25 -0
- package/dist-lib/engine/import/mermaid.d.ts.map +1 -0
- package/dist-lib/engine/index.d.ts +32 -0
- package/dist-lib/engine/index.d.ts.map +1 -0
- package/dist-lib/engine/layout/dag.d.ts +29 -0
- package/dist-lib/engine/layout/dag.d.ts.map +1 -0
- package/dist-lib/engine/layout/grid.d.ts +12 -0
- package/dist-lib/engine/layout/grid.d.ts.map +1 -0
- package/dist-lib/engine/layout/index.d.ts +30 -0
- package/dist-lib/engine/layout/index.d.ts.map +1 -0
- package/dist-lib/engine/layout/radial.d.ts +18 -0
- package/dist-lib/engine/layout/radial.d.ts.map +1 -0
- package/dist-lib/engine/plugins/builtins.d.ts +10 -0
- package/dist-lib/engine/plugins/builtins.d.ts.map +1 -0
- package/dist-lib/engine/plugins/registry.d.ts +19 -0
- package/dist-lib/engine/plugins/registry.d.ts.map +1 -0
- package/dist-lib/engine/render/edges.d.ts +42 -0
- package/dist-lib/engine/render/edges.d.ts.map +1 -0
- package/dist-lib/engine/render/fontData.d.ts +8 -0
- package/dist-lib/engine/render/fontData.d.ts.map +1 -0
- package/dist-lib/engine/render/shapes.d.ts +26 -0
- package/dist-lib/engine/render/shapes.d.ts.map +1 -0
- package/dist-lib/engine/render/svgRenderer.d.ts +56 -0
- package/dist-lib/engine/render/svgRenderer.d.ts.map +1 -0
- package/dist-lib/engine/render/theme.css.d.ts +16 -0
- package/dist-lib/engine/render/theme.css.d.ts.map +1 -0
- package/dist-lib/engine/scene/anchors.d.ts +20 -0
- package/dist-lib/engine/scene/anchors.d.ts.map +1 -0
- package/dist-lib/engine/scene/defaults.d.ts +47 -0
- package/dist-lib/engine/scene/defaults.d.ts.map +1 -0
- package/dist-lib/engine/scene/palette.d.ts +71 -0
- package/dist-lib/engine/scene/palette.d.ts.map +1 -0
- package/dist-lib/engine/scene/query.d.ts +25 -0
- package/dist-lib/engine/scene/query.d.ts.map +1 -0
- package/dist-lib/engine/scene/types.d.ts +203 -0
- package/dist-lib/engine/scene/types.d.ts.map +1 -0
- package/dist-lib/engine/timeline/player.d.ts +44 -0
- package/dist-lib/engine/timeline/player.d.ts.map +1 -0
- package/dist-lib/fonts/CascadiaCode-Regular.woff2 +0 -0
- package/dist-lib/fonts/Excalifont-Regular-349fac6ca4700ffec595a7150a0d1e1d.woff2 +0 -0
- package/dist-lib/fonts/Excalifont-Regular-3f2c5db56cc93c5a6873b1361d730c16.woff2 +0 -0
- package/dist-lib/fonts/Excalifont-Regular-41b173a47b57366892116a575a43e2b6.woff2 +0 -0
- package/dist-lib/fonts/Excalifont-Regular-623ccf21b21ef6b3a0d87738f77eb071.woff2 +0 -0
- package/dist-lib/fonts/Excalifont-Regular-a88b72a24fb54c9f94e3b5fdaa7481c9.woff2 +0 -0
- package/dist-lib/fonts/Excalifont-Regular-b9dcf9d2e50a1eaf42fc664b50a3fd0d.woff2 +0 -0
- package/dist-lib/fonts/Excalifont-Regular-be310b9bcd4f1a43f571c46df7809174.woff2 +0 -0
- package/dist-lib/fonts/Nunito-Regular.woff2 +0 -0
- package/dist-lib/fonts/Virgil-Regular.woff2 +0 -0
- package/dist-lib/index.js +76 -0
- package/dist-lib/index.js.map +1 -0
- package/dist-lib/lib/EdodoDraw.d.ts +96 -0
- package/dist-lib/lib/EdodoDraw.d.ts.map +1 -0
- package/dist-lib/lib/index.d.ts +17 -0
- package/dist-lib/lib/index.d.ts.map +1 -0
- package/dist-lib/lib/react.d.ts +25 -0
- package/dist-lib/lib/react.d.ts.map +1 -0
- package/dist-lib/react.js +29 -0
- package/dist-lib/react.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scene IR — the single intermediate representation every producer compiles to
|
|
3
|
+
* (EDodoDraw DSL, Mermaid import, programmatic API) and the renderer consumes.
|
|
4
|
+
*
|
|
5
|
+
* Design goals:
|
|
6
|
+
* - Flat, serializable, JSON-friendly (no class instances, no functions).
|
|
7
|
+
* - Forward-compatible: annotations + timeline steps live here from day one.
|
|
8
|
+
* - Plugin-extensible: `shape`, arrow `animation`, and annotation `kind` are
|
|
9
|
+
* open string unions resolved through registries, not hard-coded switches.
|
|
10
|
+
*/
|
|
11
|
+
import type { Point } from "../geometry.js";
|
|
12
|
+
/** Built-in node shapes. Plugins may register more (any string is accepted). */
|
|
13
|
+
export type ShapeKind = "rectangle" | "round-rectangle" | "ellipse" | "circle" | "diamond" | "triangle" | "hexagon" | "parallelogram" | "trapezoid" | "cylinder" | "cloud" | "document" | "note" | "actor" | "pill" | "text" | (string & {});
|
|
14
|
+
export type FillStyle = "hachure" | "cross-hatch" | "solid" | "zigzag" | "dots" | "none";
|
|
15
|
+
export type StrokeStyle = "solid" | "dashed" | "dotted";
|
|
16
|
+
export type FontKind = "hand" | "normal" | "code";
|
|
17
|
+
export type TextAlign = "left" | "center" | "right";
|
|
18
|
+
export type VerticalAlign = "top" | "middle" | "bottom";
|
|
19
|
+
/** Arrowhead styles. Plugins may register more. */
|
|
20
|
+
export type ArrowheadKind = "none" | "arrow" | "triangle" | "triangle-outline" | "bar" | "dot" | "circle" | "circle-outline" | "diamond" | "diamond-outline" | "crow" | (string & {});
|
|
21
|
+
/** Animated arrow presentation. Plugins may register more. */
|
|
22
|
+
export type ArrowAnimationKind = "none" | "flow" | "dash-march" | "draw-on" | "pulse" | "comet" | "gradient-flow" | "electric" | (string & {});
|
|
23
|
+
export type EdgeRouting = "straight" | "curved" | "orthogonal" | "elbow";
|
|
24
|
+
export type LayoutKind = "dag" | "dag-lr" | "dag-rl" | "dag-bt" | "grid" | "radial" | "manual";
|
|
25
|
+
export interface NodeStyle {
|
|
26
|
+
stroke: string;
|
|
27
|
+
fill: string | null;
|
|
28
|
+
fillStyle: FillStyle;
|
|
29
|
+
strokeWidth: number;
|
|
30
|
+
strokeStyle: StrokeStyle;
|
|
31
|
+
roughness: number;
|
|
32
|
+
roundness: number | null;
|
|
33
|
+
fontFamily: FontKind;
|
|
34
|
+
fontSize: number;
|
|
35
|
+
textColor: string;
|
|
36
|
+
textAlign: TextAlign;
|
|
37
|
+
verticalAlign: VerticalAlign;
|
|
38
|
+
opacity: number;
|
|
39
|
+
seed: number;
|
|
40
|
+
shadow?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface EdgeStyle {
|
|
43
|
+
stroke: string;
|
|
44
|
+
strokeWidth: number;
|
|
45
|
+
strokeStyle: StrokeStyle;
|
|
46
|
+
roughness: number;
|
|
47
|
+
startArrowhead: ArrowheadKind;
|
|
48
|
+
endArrowhead: ArrowheadKind;
|
|
49
|
+
animation: ArrowAnimationKind;
|
|
50
|
+
animationSpeed: number;
|
|
51
|
+
opacity: number;
|
|
52
|
+
seed: number;
|
|
53
|
+
fontFamily: FontKind;
|
|
54
|
+
fontSize: number;
|
|
55
|
+
textColor: string;
|
|
56
|
+
labelBg: string | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A connection point on a node. Either a named compass anchor, a fractional
|
|
60
|
+
* position along a side ("top:0.3"), or an explicit angle. Resolved to a world
|
|
61
|
+
* point by the anchor resolver — see scene/anchors.ts.
|
|
62
|
+
*/
|
|
63
|
+
export type AnchorName = "c" | "center" | "n" | "s" | "e" | "w" | "ne" | "nw" | "se" | "sw" | "top" | "bottom" | "left" | "right" | (string & {});
|
|
64
|
+
export interface EndpointRef {
|
|
65
|
+
/** Node id to attach to, or null for a free/world point. */
|
|
66
|
+
node: string | null;
|
|
67
|
+
/** Anchor on the node (ignored for free points). Undefined = auto. */
|
|
68
|
+
anchor?: AnchorName;
|
|
69
|
+
/** Free world point (used when node is null). */
|
|
70
|
+
point?: Point;
|
|
71
|
+
}
|
|
72
|
+
export interface SceneNode {
|
|
73
|
+
id: string;
|
|
74
|
+
shape: ShapeKind;
|
|
75
|
+
/** World-space top-left + size. Set by layout or explicitly. */
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
w: number;
|
|
79
|
+
h: number;
|
|
80
|
+
label: string;
|
|
81
|
+
style: NodeStyle;
|
|
82
|
+
/** Group id this node belongs to (for containers/frames). */
|
|
83
|
+
group?: string;
|
|
84
|
+
/** z-order; higher draws on top. */
|
|
85
|
+
z: number;
|
|
86
|
+
/** Layout hint: explicit position pins the node (manual placement). */
|
|
87
|
+
pinned?: boolean;
|
|
88
|
+
/** Arbitrary plugin/importer data (e.g. mermaid subtype). */
|
|
89
|
+
data?: Record<string, unknown>;
|
|
90
|
+
}
|
|
91
|
+
export interface SceneEdge {
|
|
92
|
+
id: string;
|
|
93
|
+
from: EndpointRef;
|
|
94
|
+
to: EndpointRef;
|
|
95
|
+
label: string;
|
|
96
|
+
style: EdgeStyle;
|
|
97
|
+
routing: EdgeRouting;
|
|
98
|
+
/** Computed polyline in world space (filled by router/layout). */
|
|
99
|
+
points?: Point[];
|
|
100
|
+
z: number;
|
|
101
|
+
data?: Record<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
export interface SceneGroup {
|
|
104
|
+
id: string;
|
|
105
|
+
label: string;
|
|
106
|
+
/** Member node ids. */
|
|
107
|
+
members: string[];
|
|
108
|
+
style: Partial<NodeStyle>;
|
|
109
|
+
/** If true, draws a container frame around members. */
|
|
110
|
+
frame: boolean;
|
|
111
|
+
}
|
|
112
|
+
export type AnnotationKind = "highlight" | "underline" | "point-at" | "spotlight" | "box-around" | "circle-around" | "strike" | "connector" | "callout" | "ink" | (string & {});
|
|
113
|
+
/** How an annotation anchors so it tracks its target under camera/layout moves. */
|
|
114
|
+
export interface AnnotationTarget {
|
|
115
|
+
/** Target a node/edge/group by id, or null for absolute world placement. */
|
|
116
|
+
ref: string | null;
|
|
117
|
+
/** Optional sub-target: "label" | "border" | anchor name. */
|
|
118
|
+
part?: string;
|
|
119
|
+
/** Absolute world point/rect for ref-less annotations. */
|
|
120
|
+
point?: Point;
|
|
121
|
+
rect?: {
|
|
122
|
+
x: number;
|
|
123
|
+
y: number;
|
|
124
|
+
w: number;
|
|
125
|
+
h: number;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export interface Annotation {
|
|
129
|
+
id: string;
|
|
130
|
+
kind: AnnotationKind;
|
|
131
|
+
target: AnnotationTarget;
|
|
132
|
+
/** Secondary target for connectors/point-at (the "from" side). */
|
|
133
|
+
target2?: AnnotationTarget;
|
|
134
|
+
text?: string;
|
|
135
|
+
color: string;
|
|
136
|
+
/** Free-form per-kind options (thickness, padding, curve, etc.). */
|
|
137
|
+
options: Record<string, unknown>;
|
|
138
|
+
z: number;
|
|
139
|
+
/** Whether this annotation was authored in code (scripted) or live (user). */
|
|
140
|
+
origin: "script" | "live";
|
|
141
|
+
}
|
|
142
|
+
export type EasingName = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "back-out" | "anticipate" | "spring";
|
|
143
|
+
export interface CameraDirective {
|
|
144
|
+
/** Camera operation for this step. */
|
|
145
|
+
op: "fit-all" | "focus" | "focus-group" | "zoom" | "pan" | "reset" | "none";
|
|
146
|
+
/** Target node/group ids for focus ops. */
|
|
147
|
+
targets?: string[];
|
|
148
|
+
zoom?: number;
|
|
149
|
+
/** Padding around focus target in screen px. */
|
|
150
|
+
padding?: number;
|
|
151
|
+
/** Absolute pan center (world). */
|
|
152
|
+
center?: Point;
|
|
153
|
+
easing?: EasingName;
|
|
154
|
+
durationMs?: number;
|
|
155
|
+
}
|
|
156
|
+
export interface Step {
|
|
157
|
+
id: string;
|
|
158
|
+
name: string;
|
|
159
|
+
camera?: CameraDirective;
|
|
160
|
+
/** Annotations revealed during this step (ids reference scene.annotations,
|
|
161
|
+
* or inline annotations owned by the step). */
|
|
162
|
+
annotations: Annotation[];
|
|
163
|
+
/** Node/edge ids to reveal (fade/draw-in) at this step; empty = all visible. */
|
|
164
|
+
reveal?: string[];
|
|
165
|
+
/** Node/edge ids to hide during this step. */
|
|
166
|
+
hide?: string[];
|
|
167
|
+
/** Narration / caption shown for the step. */
|
|
168
|
+
caption?: string;
|
|
169
|
+
/** Auto-advance after N ms (0/undefined = wait for user). */
|
|
170
|
+
autoAdvanceMs?: number;
|
|
171
|
+
}
|
|
172
|
+
export interface Theme {
|
|
173
|
+
name: string;
|
|
174
|
+
background: string;
|
|
175
|
+
defaultStroke: string;
|
|
176
|
+
defaultText: string;
|
|
177
|
+
gridColor: string;
|
|
178
|
+
/** Named color palette resolved by the DSL (e.g. "green" -> stroke/fill). */
|
|
179
|
+
mode: "light" | "dark";
|
|
180
|
+
}
|
|
181
|
+
export interface SceneMeta {
|
|
182
|
+
title?: string;
|
|
183
|
+
layout: LayoutKind;
|
|
184
|
+
/** Layout tuning (rank/node separation). */
|
|
185
|
+
spacing?: {
|
|
186
|
+
rank?: number;
|
|
187
|
+
node?: number;
|
|
188
|
+
};
|
|
189
|
+
/** Author-declared canvas hints. */
|
|
190
|
+
background?: string;
|
|
191
|
+
}
|
|
192
|
+
export interface Scene {
|
|
193
|
+
id: string;
|
|
194
|
+
theme: Theme;
|
|
195
|
+
meta: SceneMeta;
|
|
196
|
+
nodes: SceneNode[];
|
|
197
|
+
edges: SceneEdge[];
|
|
198
|
+
groups: SceneGroup[];
|
|
199
|
+
/** Baseline annotations always present (step annotations layer on top). */
|
|
200
|
+
annotations: Annotation[];
|
|
201
|
+
steps: Step[];
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/engine/scene/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAM5C,gFAAgF;AAChF,MAAM,MAAM,SAAS,GACjB,WAAW,GACX,iBAAiB,GACjB,SAAS,GACT,QAAQ,GACR,SAAS,GACT,UAAU,GACV,SAAS,GACT,eAAe,GACf,WAAW,GACX,UAAU,GACV,OAAO,GACP,UAAU,GACV,MAAM,GACN,OAAO,GAC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C1B,KAAK,EAAE,IAAI,EAAE,CAAC;CACf"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimelinePlayer — plays a scene's steps as a magic-move presentation.
|
|
3
|
+
* Each step diffs against the running state: camera (sticky), visibility
|
|
4
|
+
* (sticky), and beat-scoped annotations (replaced each step). Always-on
|
|
5
|
+
* scene.annotations render underneath every step.
|
|
6
|
+
*/
|
|
7
|
+
import type { AnnotationLayer } from "../annotate/layer.js";
|
|
8
|
+
import type { CameraController } from "../camera/controller.js";
|
|
9
|
+
import type { SvgRenderer } from "../render/svgRenderer.js";
|
|
10
|
+
import type { Scene } from "../scene/types.js";
|
|
11
|
+
export interface PlayerState {
|
|
12
|
+
index: number;
|
|
13
|
+
total: number;
|
|
14
|
+
caption: string;
|
|
15
|
+
playing: boolean;
|
|
16
|
+
stepName: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class TimelinePlayer {
|
|
19
|
+
private renderer;
|
|
20
|
+
private controller;
|
|
21
|
+
private annotations;
|
|
22
|
+
private scene;
|
|
23
|
+
private steps;
|
|
24
|
+
private idx;
|
|
25
|
+
private playing;
|
|
26
|
+
private timer;
|
|
27
|
+
onChange?: (state: PlayerState) => void;
|
|
28
|
+
constructor(renderer: SvgRenderer, controller: CameraController, annotations: AnnotationLayer);
|
|
29
|
+
get hasTimeline(): boolean;
|
|
30
|
+
load(scene: Scene): void;
|
|
31
|
+
private emit;
|
|
32
|
+
/** Cumulative sticky visibility through step `i`. */
|
|
33
|
+
private computeHidden;
|
|
34
|
+
goto(i: number, animate?: boolean): Promise<void>;
|
|
35
|
+
private runCamera;
|
|
36
|
+
next(): void;
|
|
37
|
+
prev(): void;
|
|
38
|
+
restart(): void;
|
|
39
|
+
play(): void;
|
|
40
|
+
private scheduleNext;
|
|
41
|
+
pause(): void;
|
|
42
|
+
dispose(): void;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=player.d.ts.map
|
|
@@ -0,0 +1 @@
|
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,OAAO,IAAI,IAAI;IAKf,IAAI,IAAI,IAAI;IAQZ,OAAO,CAAC,YAAY;IAgBpB,KAAK,IAAI,IAAI;IAMb,OAAO,IAAI,IAAI;CAGhB"}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { A, C, D, a, E, b, F, c, L, d, M, S, e, T, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, B, G, H, I, J, K, N, O, P, Q, R, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah } from "./chunks/EdodoDraw-CUf224RG.js";
|
|
2
|
+
export {
|
|
3
|
+
A as AnnotationLayer,
|
|
4
|
+
C as CameraController,
|
|
5
|
+
D as DARK_THEME,
|
|
6
|
+
a as DiagnosticBag,
|
|
7
|
+
E as EASINGS,
|
|
8
|
+
b as EdodoDraw,
|
|
9
|
+
F as FILL_PALETTE,
|
|
10
|
+
c as FONT_FAMILY,
|
|
11
|
+
L as LIGHT_THEME,
|
|
12
|
+
d as LiveAnnotationController,
|
|
13
|
+
M as MARKER_PALETTE,
|
|
14
|
+
S as STROKE_PALETTE,
|
|
15
|
+
e as SvgRenderer,
|
|
16
|
+
T as TimelinePlayer,
|
|
17
|
+
f as applyLayout,
|
|
18
|
+
g as bboxCenter,
|
|
19
|
+
h as bboxOfPoints,
|
|
20
|
+
i as bboxSize,
|
|
21
|
+
j as bboxToRect,
|
|
22
|
+
k as bboxUnion,
|
|
23
|
+
l as borderPointToward,
|
|
24
|
+
m as cameraForBBox,
|
|
25
|
+
n as cameraForCenter,
|
|
26
|
+
o as clamp,
|
|
27
|
+
p as compileEdd,
|
|
28
|
+
q as convertMermaid,
|
|
29
|
+
r as defaultEdgeStyle,
|
|
30
|
+
s as defaultNodeSize,
|
|
31
|
+
t as defaultNodeStyle,
|
|
32
|
+
u as dist,
|
|
33
|
+
v as downloadJSON,
|
|
34
|
+
w as downloadPNG,
|
|
35
|
+
x as downloadSVG,
|
|
36
|
+
y as easingByName,
|
|
37
|
+
z as edgeBBox,
|
|
38
|
+
B as elementBBox,
|
|
39
|
+
G as elementsBBox,
|
|
40
|
+
H as ellipseBorderToward,
|
|
41
|
+
I as emptyBBox,
|
|
42
|
+
J as emptyScene,
|
|
43
|
+
K as ensureEngineStyles,
|
|
44
|
+
N as expandBBox,
|
|
45
|
+
O as exportPNGBlob,
|
|
46
|
+
P as exportSVGString,
|
|
47
|
+
Q as extractMermaidBlocks,
|
|
48
|
+
R as formatDiagnostic,
|
|
49
|
+
U as getEdge,
|
|
50
|
+
V as getGroup,
|
|
51
|
+
W as getNode,
|
|
52
|
+
X as getShapePlugin,
|
|
53
|
+
Y as groupBBox,
|
|
54
|
+
Z as hashString,
|
|
55
|
+
_ as hitTestNode,
|
|
56
|
+
$ as injectMermaid,
|
|
57
|
+
a0 as isEmptyBBox,
|
|
58
|
+
a1 as lerp,
|
|
59
|
+
a2 as listShapePlugins,
|
|
60
|
+
a3 as makeEdge,
|
|
61
|
+
a4 as makeNode,
|
|
62
|
+
a5 as nodeBBox,
|
|
63
|
+
a6 as nodeRect,
|
|
64
|
+
a7 as nodeRectOf,
|
|
65
|
+
a8 as pairedStrokeForFill,
|
|
66
|
+
a9 as pointInRect,
|
|
67
|
+
aa as rectCenter,
|
|
68
|
+
ab as rectToBBox,
|
|
69
|
+
ac as registerShape,
|
|
70
|
+
ad as resolveAnchor,
|
|
71
|
+
ae as resolveFill,
|
|
72
|
+
af as resolveMarker,
|
|
73
|
+
ag as resolveStroke,
|
|
74
|
+
ah as sceneBBox
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EdodoDraw — the framework-agnostic embedding facade.
|
|
3
|
+
*
|
|
4
|
+
* One class that mounts a diagram into any DOM element and exposes the full
|
|
5
|
+
* feature set (render, camera magic-move, timeline, live annotations, export)
|
|
6
|
+
* behind a small, stable API. The React wrapper and the playground both build
|
|
7
|
+
* on this, so the published package is exactly what we dogfood.
|
|
8
|
+
*
|
|
9
|
+
* const edd = new EdodoDraw(document.getElementById("diagram"));
|
|
10
|
+
* await edd.render(`scene { a[Hello] --> b[World] }`);
|
|
11
|
+
* edd.play();
|
|
12
|
+
*/
|
|
13
|
+
import { LiveAnnotationController, type LiveState, type Tool } from "../engine/annotate/interact.js";
|
|
14
|
+
import { CameraController } from "../engine/camera/controller.js";
|
|
15
|
+
import type { Diagnostic } from "../engine/dsl/diagnostics.js";
|
|
16
|
+
import type { Scene } from "../engine/scene/types.js";
|
|
17
|
+
import { TimelinePlayer, type PlayerState } from "../engine/timeline/player.js";
|
|
18
|
+
export interface EdodoDrawOptions {
|
|
19
|
+
/** Enable pan (drag) + zoom (wheel) + live-annotation pointer handling. */
|
|
20
|
+
interactive?: boolean;
|
|
21
|
+
/** Draw a dotted grid that pans/zooms with the camera. Default true. */
|
|
22
|
+
grid?: boolean;
|
|
23
|
+
/** Fit the whole diagram after each render. Default true. */
|
|
24
|
+
autoFit?: boolean;
|
|
25
|
+
/** Padding (screen px) used when fitting. */
|
|
26
|
+
padding?: number;
|
|
27
|
+
}
|
|
28
|
+
export type EdodoEvent = "render" | "state" | "live" | "diagnostics";
|
|
29
|
+
export interface RenderResult {
|
|
30
|
+
scene: Scene;
|
|
31
|
+
diagnostics: Diagnostic[];
|
|
32
|
+
}
|
|
33
|
+
export declare class EdodoDraw {
|
|
34
|
+
readonly container: HTMLElement;
|
|
35
|
+
private opts;
|
|
36
|
+
private renderer;
|
|
37
|
+
private controller;
|
|
38
|
+
private annotations;
|
|
39
|
+
private player;
|
|
40
|
+
private live;
|
|
41
|
+
private scene;
|
|
42
|
+
private source;
|
|
43
|
+
private renderSeq;
|
|
44
|
+
private listeners;
|
|
45
|
+
private textInput;
|
|
46
|
+
private cleanup;
|
|
47
|
+
constructor(container: HTMLElement, options?: EdodoDrawOptions);
|
|
48
|
+
on(event: "state", cb: (s: PlayerState) => void): () => void;
|
|
49
|
+
on(event: "live", cb: (s: LiveState) => void): () => void;
|
|
50
|
+
on(event: "diagnostics", cb: (d: Diagnostic[]) => void): () => void;
|
|
51
|
+
on(event: "render", cb: (r: RenderResult) => void): () => void;
|
|
52
|
+
private emit;
|
|
53
|
+
/**
|
|
54
|
+
* Compile + render EDodoDraw source. Async because a `mermaid` block may need
|
|
55
|
+
* the (lazy-loaded) Mermaid runtime. Safe to call on every keystroke; stale
|
|
56
|
+
* runs are discarded.
|
|
57
|
+
*/
|
|
58
|
+
render(source: string): Promise<RenderResult>;
|
|
59
|
+
getScene(): Scene;
|
|
60
|
+
getSource(): string;
|
|
61
|
+
fit(animate?: boolean): void;
|
|
62
|
+
focus(ids: string[], opts?: {
|
|
63
|
+
zoom?: number;
|
|
64
|
+
padding?: number;
|
|
65
|
+
}): Promise<void>;
|
|
66
|
+
zoomBy(factor: number): void;
|
|
67
|
+
reset(): void;
|
|
68
|
+
get camera(): CameraController;
|
|
69
|
+
play(): void;
|
|
70
|
+
pause(): void;
|
|
71
|
+
next(): void;
|
|
72
|
+
prev(): void;
|
|
73
|
+
goto(i: number): void;
|
|
74
|
+
restart(): void;
|
|
75
|
+
get timeline(): TimelinePlayer;
|
|
76
|
+
setTool(tool: Tool): void;
|
|
77
|
+
undo(): void;
|
|
78
|
+
redo(): void;
|
|
79
|
+
clearAnnotations(): void;
|
|
80
|
+
/** Serialize live annotations into an `annotate { … }` block. */
|
|
81
|
+
annotationsToCode(): string;
|
|
82
|
+
get annotator(): LiveAnnotationController;
|
|
83
|
+
toSVG(): Promise<string>;
|
|
84
|
+
toPNG(): Promise<Blob>;
|
|
85
|
+
toJSON(): Scene;
|
|
86
|
+
downloadSVG(): Promise<void>;
|
|
87
|
+
downloadPNG(): Promise<void>;
|
|
88
|
+
downloadJSON(): void;
|
|
89
|
+
resize(): void;
|
|
90
|
+
destroy(): void;
|
|
91
|
+
private updateGrid;
|
|
92
|
+
private localPoint;
|
|
93
|
+
private bindInteraction;
|
|
94
|
+
private showTextInput;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=EdodoDraw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EdodoDraw.d.ts","sourceRoot":"","sources":["../../src/lib/EdodoDraw.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,wBAAwB,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAGlE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGhF,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wEAAwE;IACxE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,aAAa,CAAC;AAErE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,qBAAa,SAAS;IACpB,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC,OAAO,CAAC,IAAI,CAA6B;IACzC,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,UAAU,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,IAAI;IAGb,IAAI,MAAM,IAAI,gBAAgB,CAE7B;IAGD,IAAI,IAAI,IAAI;IAGZ,KAAK,IAAI,IAAI;IAGb,IAAI,IAAI,IAAI;IAGZ,IAAI,IAAI,IAAI;IAGZ,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAGrB,OAAO,IAAI,IAAI;IAGf,IAAI,QAAQ,IAAI,cAAc,CAE7B;IAGD,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAGzB,IAAI,IAAI,IAAI;IAGZ,IAAI,IAAI,IAAI;IAGZ,gBAAgB,IAAI,IAAI;IAGxB,iEAAiE;IACjE,iBAAiB,IAAI,MAAM;IAG3B,IAAI,SAAS,IAAI,wBAAwB,CAExC;IAGD,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAGxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAGtB,MAAM,IAAI,KAAK;IAGf,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAG5B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAG5B,YAAY,IAAI,IAAI;IAKpB,MAAM,IAAI,IAAI;IAKd,OAAO,IAAI,IAAI;IAUf,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,eAAe;IAgEvB,OAAO,CAAC,aAAa;CAqCtB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `edododraw` — public npm entry point.
|
|
3
|
+
*
|
|
4
|
+
* Two levels of API:
|
|
5
|
+
* - High-level facade: `new EdodoDraw(el).render(source)` — mount a diagram
|
|
6
|
+
* with camera, timeline, live annotations, and export in one object.
|
|
7
|
+
* - Low-level engine: `compileEdd`, `SvgRenderer`, `CameraController`,
|
|
8
|
+
* `registerShape`, the Scene IR types, etc. — compose your own.
|
|
9
|
+
*
|
|
10
|
+
* A React wrapper is available at `edododraw/react`.
|
|
11
|
+
*/
|
|
12
|
+
export { EdodoDraw } from "./EdodoDraw.js";
|
|
13
|
+
export type { EdodoDrawOptions, RenderResult, EdodoEvent } from "./EdodoDraw.js";
|
|
14
|
+
export * from "../engine/index.js";
|
|
15
|
+
export { convertMermaid, extractMermaidBlocks, injectMermaid } from "../engine/import/mermaid.js";
|
|
16
|
+
export type { MermaidFragment } from "../engine/import/mermaid.js";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjF,cAAc,oBAAoB,CAAC;AAGnC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAClG,YAAY,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `edododraw/react` — a thin React wrapper over the EdodoDraw facade.
|
|
3
|
+
*
|
|
4
|
+
* <EdodoDrawView source={code} interactive onReady={(edd) => …} />
|
|
5
|
+
*
|
|
6
|
+
* React is a peer dependency; nothing here is imported by the core entry.
|
|
7
|
+
*/
|
|
8
|
+
import type { CSSProperties } from "react";
|
|
9
|
+
import { EdodoDraw, type EdodoDrawOptions } from "./EdodoDraw.js";
|
|
10
|
+
import type { Diagnostic } from "../engine/dsl/diagnostics.js";
|
|
11
|
+
import type { PlayerState } from "../engine/timeline/player.js";
|
|
12
|
+
export interface EdodoDrawViewProps extends EdodoDrawOptions {
|
|
13
|
+
/** EDodoDraw source to render (re-renders whenever it changes). */
|
|
14
|
+
source: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
/** Called once with the imperative instance after mount. */
|
|
18
|
+
onReady?: (edd: EdodoDraw) => void;
|
|
19
|
+
onDiagnostics?: (diags: Diagnostic[]) => void;
|
|
20
|
+
onState?: (state: PlayerState) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function EdodoDrawView({ source, className, style, onReady, onDiagnostics, onState, ...opts }: EdodoDrawViewProps): import("react").JSX.Element;
|
|
23
|
+
export { EdodoDraw } from "./EdodoDraw.js";
|
|
24
|
+
export type { EdodoDrawOptions } from "./EdodoDraw.js";
|
|
25
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/lib/react.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,IAAI,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAC9C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CACxC;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,+BAwBvH;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect } from "react";
|
|
3
|
+
import { b as EdodoDraw } from "./chunks/EdodoDraw-CUf224RG.js";
|
|
4
|
+
function EdodoDrawView({ source, className, style, onReady, onDiagnostics, onState, ...opts }) {
|
|
5
|
+
const hostRef = useRef(null);
|
|
6
|
+
const eddRef = useRef(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const host = hostRef.current;
|
|
9
|
+
if (!host) return;
|
|
10
|
+
const edd = new EdodoDraw(host, opts);
|
|
11
|
+
eddRef.current = edd;
|
|
12
|
+
if (onDiagnostics) edd.on("diagnostics", onDiagnostics);
|
|
13
|
+
if (onState) edd.on("state", onState);
|
|
14
|
+
onReady?.(edd);
|
|
15
|
+
return () => {
|
|
16
|
+
edd.destroy();
|
|
17
|
+
eddRef.current = null;
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
void eddRef.current?.render(source);
|
|
22
|
+
}, [source]);
|
|
23
|
+
return /* @__PURE__ */ jsx("div", { ref: hostRef, className, style: { width: "100%", height: "100%", ...style } });
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
EdodoDraw,
|
|
27
|
+
EdodoDrawView
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sources":["../src/lib/react.tsx"],"sourcesContent":["/**\n * `edododraw/react` — a thin React wrapper over the EdodoDraw facade.\n *\n * <EdodoDrawView source={code} interactive onReady={(edd) => …} />\n *\n * React is a peer dependency; nothing here is imported by the core entry.\n */\n\nimport { useEffect, useRef } from \"react\";\nimport type { CSSProperties } from \"react\";\nimport { EdodoDraw, type EdodoDrawOptions } from \"./EdodoDraw.js\";\nimport type { Diagnostic } from \"../engine/dsl/diagnostics.js\";\nimport type { PlayerState } from \"../engine/timeline/player.js\";\n\nexport interface EdodoDrawViewProps extends EdodoDrawOptions {\n /** EDodoDraw source to render (re-renders whenever it changes). */\n source: string;\n className?: string;\n style?: CSSProperties;\n /** Called once with the imperative instance after mount. */\n onReady?: (edd: EdodoDraw) => void;\n onDiagnostics?: (diags: Diagnostic[]) => void;\n onState?: (state: PlayerState) => void;\n}\n\nexport function EdodoDrawView({ source, className, style, onReady, onDiagnostics, onState, ...opts }: EdodoDrawViewProps) {\n const hostRef = useRef<HTMLDivElement | null>(null);\n const eddRef = useRef<EdodoDraw | null>(null);\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const edd = new EdodoDraw(host, opts);\n eddRef.current = edd;\n if (onDiagnostics) edd.on(\"diagnostics\", onDiagnostics);\n if (onState) edd.on(\"state\", onState);\n onReady?.(edd);\n return () => {\n edd.destroy();\n eddRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n void eddRef.current?.render(source);\n }, [source]);\n\n return <div ref={hostRef} className={className} style={{ width: \"100%\", height: \"100%\", ...style }} />;\n}\n\nexport { EdodoDraw } from \"./EdodoDraw.js\";\nexport type { EdodoDrawOptions } from \"./EdodoDraw.js\";\n"],"names":[],"mappings":";;;AAyBO,SAAS,cAAc,EAAE,QAAQ,WAAW,OAAO,SAAS,eAAe,SAAS,GAAG,QAA4B;AACxH,QAAM,UAAU,OAA8B,IAAI;AAClD,QAAM,SAAS,OAAyB,IAAI;AAE5C,YAAU,MAAM;AACd,UAAM,OAAO,QAAQ;AACrB,QAAI,CAAC,KAAM;AACX,UAAM,MAAM,IAAI,UAAU,MAAM,IAAI;AACpC,WAAO,UAAU;AACjB,QAAI,cAAe,KAAI,GAAG,eAAe,aAAa;AACtD,QAAI,QAAS,KAAI,GAAG,SAAS,OAAO;AACpC,cAAU,GAAG;AACb,WAAO,MAAM;AACX,UAAI,QAAA;AACJ,aAAO,UAAU;AAAA,IACnB;AAAA,EAEF,GAAG,CAAA,CAAE;AAEL,YAAU,MAAM;AACd,SAAK,OAAO,SAAS,OAAO,MAAM;AAAA,EACpC,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO,oBAAC,OAAA,EAAI,KAAK,SAAS,WAAsB,OAAO,EAAE,OAAO,QAAQ,QAAQ,QAAQ,GAAG,QAAM,CAAG;AACtG;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "edododraw",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A 100% code/syntax-to-diagram engine with the Excalidraw hand-drawn aesthetic, magic-move camera, scriptable + real-time annotations, animated arrows, and first-class Mermaid import.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "vivmagarwal",
|
|
8
|
+
"homepage": "https://vivmagarwal.github.io/edododraw/",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/vivmagarwal/edododraw.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/vivmagarwal/edododraw/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"diagram",
|
|
18
|
+
"diagrams-as-code",
|
|
19
|
+
"excalidraw",
|
|
20
|
+
"mermaid",
|
|
21
|
+
"flowchart",
|
|
22
|
+
"hand-drawn",
|
|
23
|
+
"svg",
|
|
24
|
+
"rough",
|
|
25
|
+
"visualization",
|
|
26
|
+
"presentation"
|
|
27
|
+
],
|
|
28
|
+
"main": "./dist-lib/index.js",
|
|
29
|
+
"module": "./dist-lib/index.js",
|
|
30
|
+
"types": "./dist-lib/lib/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist-lib/lib/index.d.ts",
|
|
34
|
+
"import": "./dist-lib/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./react": {
|
|
37
|
+
"types": "./dist-lib/lib/react.d.ts",
|
|
38
|
+
"import": "./dist-lib/react.js"
|
|
39
|
+
},
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": [
|
|
43
|
+
"**/builtins.js",
|
|
44
|
+
"**/builtins.ts"
|
|
45
|
+
],
|
|
46
|
+
"files": [
|
|
47
|
+
"dist-lib",
|
|
48
|
+
"README.md",
|
|
49
|
+
"LICENSE"
|
|
50
|
+
],
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"dev": "vite",
|
|
56
|
+
"build": "tsc -b && vite build",
|
|
57
|
+
"build:lib": "vite build --config vite.lib.config.ts",
|
|
58
|
+
"build:types": "tsc -p tsconfig.lib.json",
|
|
59
|
+
"build:pkg": "npm run build:lib && npm run build:types",
|
|
60
|
+
"preview": "vite preview --port 4173 --strictPort",
|
|
61
|
+
"typecheck": "tsc -b --noEmit",
|
|
62
|
+
"test": "vitest run",
|
|
63
|
+
"test:watch": "vitest",
|
|
64
|
+
"prepublishOnly": "npm run build:pkg"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@dagrejs/dagre": "^1.1.4",
|
|
68
|
+
"roughjs": "^4.6.6"
|
|
69
|
+
},
|
|
70
|
+
"optionalDependencies": {
|
|
71
|
+
"@excalidraw/mermaid-to-excalidraw": "^1.1.4"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"react": ">=18",
|
|
75
|
+
"react-dom": ">=18"
|
|
76
|
+
},
|
|
77
|
+
"peerDependenciesMeta": {
|
|
78
|
+
"react": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"react-dom": {
|
|
82
|
+
"optional": true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@excalidraw/mermaid-to-excalidraw": "^1.1.4",
|
|
87
|
+
"@types/node": "^22.10.2",
|
|
88
|
+
"@types/react": "^18.3.18",
|
|
89
|
+
"@types/react-dom": "^18.3.5",
|
|
90
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
91
|
+
"jsdom": "^25.0.1",
|
|
92
|
+
"marked": "^18.0.5",
|
|
93
|
+
"react": "^18.3.1",
|
|
94
|
+
"react-dom": "^18.3.1",
|
|
95
|
+
"typescript": "^5.7.2",
|
|
96
|
+
"vite": "^6.0.5",
|
|
97
|
+
"vitest": "^2.1.8"
|
|
98
|
+
}
|
|
99
|
+
}
|