@liminis/editor 0.3.0 → 0.4.1

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 (36) hide show
  1. package/LICENSE +0 -13
  2. package/README.md +122 -75
  3. package/dist/app/editor/CorrectionPanelPlugin.js +10 -11
  4. package/dist/app/editor/DragHandlePlugin.js +1 -1
  5. package/dist/app/editor/SelectionContextMenuPlugin.js +4 -4
  6. package/dist/app/editor/nodes/C4Component.js +8 -10
  7. package/dist/app/editor/nodes/C4Node.d.ts +1 -1
  8. package/dist/app/editor/nodes/DiagramContextMenu.js +5 -5
  9. package/dist/headless.d.ts +3 -5
  10. package/dist/headless.js +2 -4
  11. package/dist/index.d.ts +1 -1
  12. package/dist/styles.css +425 -454
  13. package/docs/architecture.md +80 -0
  14. package/docs/decisions/adr-93-liminis-editor-defined-aliases.md +28 -1
  15. package/docs/decisions/adr-98-invert-token-direction.md +309 -0
  16. package/docs/diagrams/architecture-1-dark.svg +1 -0
  17. package/docs/diagrams/architecture-1.svg +1 -0
  18. package/docs/diagrams/architecture-2-dark.svg +1 -0
  19. package/docs/diagrams/architecture-2.svg +1 -0
  20. package/package.json +2 -2
  21. package/dist/app/editor/c4/C4InteractiveRenderer.d.ts +0 -35
  22. package/dist/app/editor/c4/C4InteractiveRenderer.js +0 -299
  23. package/dist/app/editor/c4/edge-clipping.d.ts +0 -24
  24. package/dist/app/editor/c4/edge-clipping.js +0 -139
  25. package/dist/app/editor/c4/hooks/useC4DiagramDrag.d.ts +0 -38
  26. package/dist/app/editor/c4/hooks/useC4DiagramDrag.js +0 -112
  27. package/dist/app/editor/c4/layout.d.ts +0 -25
  28. package/dist/app/editor/c4/layout.js +0 -839
  29. package/dist/app/editor/c4/parser.d.ts +0 -19
  30. package/dist/app/editor/c4/parser.js +0 -410
  31. package/dist/app/editor/c4/render-to-string.d.ts +0 -24
  32. package/dist/app/editor/c4/render-to-string.js +0 -34
  33. package/dist/app/editor/c4/renderer.d.ts +0 -64
  34. package/dist/app/editor/c4/renderer.js +0 -569
  35. package/dist/app/editor/c4/types.d.ts +0 -203
  36. package/dist/app/editor/c4/types.js +0 -43
@@ -1,203 +0,0 @@
1
- /**
2
- * Type definitions for the C4 architecture diagram plugin.
3
- * Defines AST nodes for parsed C4 DSL and layout types for rendering.
4
- */
5
- /**
6
- * Type of C4 element in the diagram
7
- */
8
- export type C4ElementType = 'system' | 'container' | 'component' | 'person';
9
- /**
10
- * Shape override for C4 elements (e.g., cylinder for databases)
11
- */
12
- export type C4Shape = 'rectangle' | 'cylinder' | 'queue';
13
- /**
14
- * Layout direction for element groupings
15
- */
16
- export type C4Direction = 'right' | 'down' | 'left' | 'up';
17
- /**
18
- * Style modifier for elements (boundary creates dotted enclosure)
19
- */
20
- export type C4Style = 'boundary';
21
- /**
22
- * Properties that can be attached to any C4 element
23
- */
24
- export interface C4Properties {
25
- /** Technology stack (e.g., "React, TypeScript") */
26
- tech?: string;
27
- /** Description of the element's purpose */
28
- description?: string;
29
- /** Whether this is an external system */
30
- external?: boolean;
31
- /** Shape override (e.g., cylinder for databases) */
32
- shape?: C4Shape;
33
- /** Layout direction for children */
34
- direction?: C4Direction;
35
- /** Style modifier (boundary for dotted enclosure) */
36
- style?: C4Style;
37
- }
38
- /**
39
- * Core C4 element representing systems, containers, components, or persons.
40
- * Elements can be nested (e.g., containers within systems).
41
- */
42
- export interface C4Element {
43
- /** Type of C4 element */
44
- type: C4ElementType;
45
- /** Unique identifier for this element (from [id] in DSL) */
46
- id: string;
47
- /** Human-readable name (from "Name" in DSL) */
48
- name: string;
49
- /** Element properties */
50
- properties: C4Properties;
51
- /** Nested child elements */
52
- children: C4Element[];
53
- /** Parent element id, if nested */
54
- parent?: string;
55
- }
56
- /**
57
- * Relationship between two C4 elements (arrow in diagram)
58
- */
59
- export interface C4Relationship {
60
- /** Source element id */
61
- sourceId: string;
62
- /** Target element id */
63
- targetId: string;
64
- /** Relationship label (e.g., "JSON/HTTPS", "SQL/TCP") */
65
- label: string;
66
- }
67
- /**
68
- * Complete C4 diagram AST
69
- */
70
- export interface C4Diagram {
71
- /** All elements in the diagram (flat list, nesting via parent field) */
72
- elements: C4Element[];
73
- /** All relationships between elements */
74
- relationships: C4Relationship[];
75
- /** Layout direction from LAYOUT_* directive */
76
- direction?: C4Direction;
77
- }
78
- /**
79
- * 2D point for edge routing
80
- */
81
- export interface Point {
82
- x: number;
83
- y: number;
84
- }
85
- /**
86
- * Positioned node after layout calculation
87
- */
88
- export interface LayoutNode {
89
- /** Element id */
90
- id: string;
91
- /** X position (left edge) */
92
- x: number;
93
- /** Y position (top edge) */
94
- y: number;
95
- /** Node width */
96
- width: number;
97
- /** Node height */
98
- height: number;
99
- /** Reference to the C4 element */
100
- element: C4Element;
101
- /** Child nodes (for nested layout) */
102
- children?: LayoutNode[];
103
- }
104
- /**
105
- * Routed edge between two nodes
106
- */
107
- export interface LayoutEdge {
108
- /** Source node id */
109
- source: string;
110
- /** Target node id */
111
- target: string;
112
- /** Points defining the edge path */
113
- points: Point[];
114
- /** Edge label */
115
- label: string;
116
- }
117
- /**
118
- * Complete layout result ready for rendering
119
- */
120
- export interface LayoutResult {
121
- /** Positioned nodes */
122
- nodes: LayoutNode[];
123
- /** Routed edges */
124
- edges: LayoutEdge[];
125
- /** Total diagram width */
126
- width: number;
127
- /** Total diagram height */
128
- height: number;
129
- /** ViewBox origin X (non-zero when nodes have negative coordinates) */
130
- viewBoxX: number;
131
- /** ViewBox origin Y (non-zero when nodes have negative coordinates) */
132
- viewBoxY: number;
133
- }
134
- /**
135
- * Options for layout calculation
136
- */
137
- export interface LayoutOptions {
138
- /** Base width for nodes (default: 200) */
139
- nodeWidth?: number;
140
- /** Base height for nodes (default: 80) */
141
- nodeHeight?: number;
142
- /** Padding around nested elements (default: 20) */
143
- nodePadding?: number;
144
- /** Vertical separation between ranks (default: 80) */
145
- rankSep?: number;
146
- /** Horizontal separation between edges (default: 20) */
147
- edgeSep?: number;
148
- }
149
- /**
150
- * Parse error with location information
151
- */
152
- export interface ParseError {
153
- /** Error message */
154
- message: string;
155
- /** Line number (1-indexed) */
156
- line: number;
157
- /** Column number (1-indexed) */
158
- column: number;
159
- }
160
- /**
161
- * Result of parsing C4 DSL code
162
- */
163
- export interface ParseResult {
164
- /** Parsed diagram (null if parsing failed) */
165
- diagram: C4Diagram | null;
166
- /** Parse errors (empty if successful) */
167
- errors: ParseError[];
168
- }
169
- /**
170
- * Check if an element is a system
171
- */
172
- export declare function isSystem(element: C4Element): boolean;
173
- /**
174
- * Check if an element is a container
175
- */
176
- export declare function isContainer(element: C4Element): boolean;
177
- /**
178
- * Check if an element is a component
179
- */
180
- export declare function isComponent(element: C4Element): boolean;
181
- /**
182
- * Check if an element is a person
183
- */
184
- export declare function isPerson(element: C4Element): boolean;
185
- /**
186
- * Check if an element is external
187
- */
188
- export declare function isExternal(element: C4Element): boolean;
189
- /**
190
- * Check if an element has boundary style
191
- */
192
- export declare function isBoundary(element: C4Element): boolean;
193
- /**
194
- * Manual layout data for user-positioned diagram elements.
195
- * When present, positions are user-defined instead of computed by dagre.
196
- */
197
- export interface ManualLayout {
198
- /** Element positions keyed by element ID */
199
- positions: Record<string, {
200
- x: number;
201
- y: number;
202
- }>;
203
- }
@@ -1,43 +0,0 @@
1
- /**
2
- * Type definitions for the C4 architecture diagram plugin.
3
- * Defines AST nodes for parsed C4 DSL and layout types for rendering.
4
- */
5
- // =============================================================================
6
- // TYPE GUARDS
7
- // =============================================================================
8
- /**
9
- * Check if an element is a system
10
- */
11
- export function isSystem(element) {
12
- return element.type === 'system';
13
- }
14
- /**
15
- * Check if an element is a container
16
- */
17
- export function isContainer(element) {
18
- return element.type === 'container';
19
- }
20
- /**
21
- * Check if an element is a component
22
- */
23
- export function isComponent(element) {
24
- return element.type === 'component';
25
- }
26
- /**
27
- * Check if an element is a person
28
- */
29
- export function isPerson(element) {
30
- return element.type === 'person';
31
- }
32
- /**
33
- * Check if an element is external
34
- */
35
- export function isExternal(element) {
36
- return element.properties.external === true;
37
- }
38
- /**
39
- * Check if an element has boundary style
40
- */
41
- export function isBoundary(element) {
42
- return element.properties.style === 'boundary';
43
- }