@liminis/editor 0.1.0-rc.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.
- package/LICENSE +34 -0
- package/README.md +376 -0
- package/dist/annotations/anchor-align.d.ts +50 -0
- package/dist/annotations/anchor-align.js +74 -0
- package/dist/annotations/anchor-model.d.ts +81 -0
- package/dist/annotations/anchor-model.js +80 -0
- package/dist/annotations/anchor-resolver.d.ts +92 -0
- package/dist/annotations/anchor-resolver.js +231 -0
- package/dist/annotations/block-structure.d.ts +65 -0
- package/dist/annotations/block-structure.js +113 -0
- package/dist/annotations/types.d.ts +159 -0
- package/dist/annotations/types.js +50 -0
- package/dist/annotations.d.ts +25 -0
- package/dist/annotations.js +27 -0
- package/dist/app/App.d.ts +64 -0
- package/dist/app/App.js +180 -0
- package/dist/app/editor/AmbientCorrectionPlugin.d.ts +18 -0
- package/dist/app/editor/AmbientCorrectionPlugin.js +185 -0
- package/dist/app/editor/AnchorScrollPlugin.d.ts +16 -0
- package/dist/app/editor/AnchorScrollPlugin.js +134 -0
- package/dist/app/editor/AnnotationMarkerPlugin.d.ts +24 -0
- package/dist/app/editor/AnnotationMarkerPlugin.js +224 -0
- package/dist/app/editor/AnnotationPlugin.d.ts +42 -0
- package/dist/app/editor/AnnotationPlugin.js +135 -0
- package/dist/app/editor/AnnotationSurface.d.ts +34 -0
- package/dist/app/editor/AnnotationSurface.js +115 -0
- package/dist/app/editor/AssetContext.d.ts +20 -0
- package/dist/app/editor/AssetContext.js +81 -0
- package/dist/app/editor/BlockClickPlugin.d.ts +8 -0
- package/dist/app/editor/BlockClickPlugin.js +126 -0
- package/dist/app/editor/CodeBlockPlugin.d.ts +1 -0
- package/dist/app/editor/CodeBlockPlugin.js +219 -0
- package/dist/app/editor/CorrectionPanelPlugin.d.ts +14 -0
- package/dist/app/editor/CorrectionPanelPlugin.js +333 -0
- package/dist/app/editor/DragHandlePlugin.d.ts +1 -0
- package/dist/app/editor/DragHandlePlugin.js +300 -0
- package/dist/app/editor/Editor.d.ts +84 -0
- package/dist/app/editor/Editor.js +539 -0
- package/dist/app/editor/FrontmatterPlugin.d.ts +19 -0
- package/dist/app/editor/FrontmatterPlugin.js +301 -0
- package/dist/app/editor/ImageModal.d.ts +13 -0
- package/dist/app/editor/ImageModal.js +267 -0
- package/dist/app/editor/ImagePlugin.d.ts +3 -0
- package/dist/app/editor/ImagePlugin.js +187 -0
- package/dist/app/editor/LinkClickPlugin.d.ts +23 -0
- package/dist/app/editor/LinkClickPlugin.js +90 -0
- package/dist/app/editor/MarkdownShortcutsPlugin.d.ts +49 -0
- package/dist/app/editor/MarkdownShortcutsPlugin.js +373 -0
- package/dist/app/editor/OrderedTaskListPlugin.d.ts +21 -0
- package/dist/app/editor/OrderedTaskListPlugin.js +78 -0
- package/dist/app/editor/SearchPlugin.d.ts +1 -0
- package/dist/app/editor/SearchPlugin.js +379 -0
- package/dist/app/editor/SelectionContextMenuPlugin.d.ts +29 -0
- package/dist/app/editor/SelectionContextMenuPlugin.js +160 -0
- package/dist/app/editor/SlashMenu.d.ts +11 -0
- package/dist/app/editor/SlashMenu.js +494 -0
- package/dist/app/editor/SlashMenuPlugin.d.ts +1 -0
- package/dist/app/editor/SlashMenuPlugin.js +168 -0
- package/dist/app/editor/TableActionsPlugin.d.ts +1 -0
- package/dist/app/editor/TableActionsPlugin.js +398 -0
- package/dist/app/editor/TogglePlugin.d.ts +1 -0
- package/dist/app/editor/TogglePlugin.js +159 -0
- package/dist/app/editor/Toolbar.d.ts +10 -0
- package/dist/app/editor/Toolbar.js +263 -0
- package/dist/app/editor/WikiLinkExistencePlugin.d.ts +17 -0
- package/dist/app/editor/WikiLinkExistencePlugin.js +104 -0
- package/dist/app/editor/WikiLinkFormatPlugin.d.ts +17 -0
- package/dist/app/editor/WikiLinkFormatPlugin.js +203 -0
- package/dist/app/editor/annotation-marks.d.ts +177 -0
- package/dist/app/editor/annotation-marks.js +750 -0
- package/dist/app/editor/annotationCommands.d.ts +13 -0
- package/dist/app/editor/annotationCommands.js +11 -0
- package/dist/app/editor/c4/C4InteractiveRenderer.d.ts +35 -0
- package/dist/app/editor/c4/C4InteractiveRenderer.js +299 -0
- package/dist/app/editor/c4/edge-clipping.d.ts +24 -0
- package/dist/app/editor/c4/edge-clipping.js +139 -0
- package/dist/app/editor/c4/hooks/useC4DiagramDrag.d.ts +38 -0
- package/dist/app/editor/c4/hooks/useC4DiagramDrag.js +112 -0
- package/dist/app/editor/c4/layout.d.ts +25 -0
- package/dist/app/editor/c4/layout.js +839 -0
- package/dist/app/editor/c4/parser.d.ts +19 -0
- package/dist/app/editor/c4/parser.js +410 -0
- package/dist/app/editor/c4/render-to-string.d.ts +24 -0
- package/dist/app/editor/c4/render-to-string.js +34 -0
- package/dist/app/editor/c4/renderer.d.ts +64 -0
- package/dist/app/editor/c4/renderer.js +569 -0
- package/dist/app/editor/c4/types.d.ts +203 -0
- package/dist/app/editor/c4/types.js +43 -0
- package/dist/app/editor/correction-yaml.d.ts +10 -0
- package/dist/app/editor/correction-yaml.js +40 -0
- package/dist/app/editor/editorNodes.d.ts +9 -0
- package/dist/app/editor/editorNodes.js +36 -0
- package/dist/app/editor/index.d.ts +1 -0
- package/dist/app/editor/index.js +1 -0
- package/dist/app/editor/mark-overlap-resolver.d.ts +6 -0
- package/dist/app/editor/mark-overlap-resolver.js +45 -0
- package/dist/app/editor/nodes/C4Component.d.ts +14 -0
- package/dist/app/editor/nodes/C4Component.js +284 -0
- package/dist/app/editor/nodes/C4Node.d.ts +32 -0
- package/dist/app/editor/nodes/C4Node.js +112 -0
- package/dist/app/editor/nodes/CalloutNode.d.ts +23 -0
- package/dist/app/editor/nodes/CalloutNode.js +94 -0
- package/dist/app/editor/nodes/CustomLinkNode.d.ts +57 -0
- package/dist/app/editor/nodes/CustomLinkNode.js +209 -0
- package/dist/app/editor/nodes/CustomListItemNode.d.ts +46 -0
- package/dist/app/editor/nodes/CustomListItemNode.js +120 -0
- package/dist/app/editor/nodes/CustomListNode.d.ts +27 -0
- package/dist/app/editor/nodes/CustomListNode.js +54 -0
- package/dist/app/editor/nodes/DefinitionListNode.d.ts +44 -0
- package/dist/app/editor/nodes/DefinitionListNode.js +151 -0
- package/dist/app/editor/nodes/DiagramContextMenu.d.ts +45 -0
- package/dist/app/editor/nodes/DiagramContextMenu.js +116 -0
- package/dist/app/editor/nodes/EquationComponent.d.ts +17 -0
- package/dist/app/editor/nodes/EquationComponent.js +130 -0
- package/dist/app/editor/nodes/EquationNode.d.ts +43 -0
- package/dist/app/editor/nodes/EquationNode.js +179 -0
- package/dist/app/editor/nodes/FootnoteNode.d.ts +40 -0
- package/dist/app/editor/nodes/FootnoteNode.js +151 -0
- package/dist/app/editor/nodes/FrontmatterNode.d.ts +24 -0
- package/dist/app/editor/nodes/FrontmatterNode.js +88 -0
- package/dist/app/editor/nodes/HorizontalRuleNode.d.ts +17 -0
- package/dist/app/editor/nodes/HorizontalRuleNode.js +57 -0
- package/dist/app/editor/nodes/HtmlNode.d.ts +32 -0
- package/dist/app/editor/nodes/HtmlNode.js +121 -0
- package/dist/app/editor/nodes/ImageComponent.d.ts +11 -0
- package/dist/app/editor/nodes/ImageComponent.js +228 -0
- package/dist/app/editor/nodes/ImageNode.d.ts +53 -0
- package/dist/app/editor/nodes/ImageNode.js +183 -0
- package/dist/app/editor/nodes/ListItemParagraphBreakNode.d.ts +42 -0
- package/dist/app/editor/nodes/ListItemParagraphBreakNode.js +95 -0
- package/dist/app/editor/nodes/MermaidComponent.d.ts +11 -0
- package/dist/app/editor/nodes/MermaidComponent.js +216 -0
- package/dist/app/editor/nodes/MermaidNode.d.ts +27 -0
- package/dist/app/editor/nodes/MermaidNode.js +96 -0
- package/dist/app/editor/nodes/ToggleNode.d.ts +56 -0
- package/dist/app/editor/nodes/ToggleNode.js +237 -0
- package/dist/app/editor/nodes/diagram-context-menu.d.ts +11 -0
- package/dist/app/editor/nodes/diagram-context-menu.js +70 -0
- package/dist/app/editor/nodes/diagram-utils.d.ts +13 -0
- package/dist/app/editor/nodes/diagram-utils.js +29 -0
- package/dist/app/editor/nodes/index.d.ts +30 -0
- package/dist/app/editor/nodes/index.js +17 -0
- package/dist/app/editor/utils.d.ts +2 -0
- package/dist/app/editor/utils.js +17 -0
- package/dist/app/mapper/index.d.ts +3 -0
- package/dist/app/mapper/index.js +2 -0
- package/dist/app/mapper/lexicalToMdast.d.ts +62 -0
- package/dist/app/mapper/lexicalToMdast.js +1937 -0
- package/dist/app/mapper/mdastToLexical.d.ts +31 -0
- package/dist/app/mapper/mdastToLexical.js +1075 -0
- package/dist/contract.d.ts +8 -0
- package/dist/contract.js +8 -0
- package/dist/headless.d.ts +40 -0
- package/dist/headless.js +45 -0
- package/dist/host/context.d.ts +20 -0
- package/dist/host/context.js +24 -0
- package/dist/host/defaults.d.ts +21 -0
- package/dist/host/defaults.js +47 -0
- package/dist/host/messages.d.ts +26 -0
- package/dist/host/messages.js +47 -0
- package/dist/host/types.d.ts +75 -0
- package/dist/host/types.js +13 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +51 -0
- package/dist/markdown/annotate-sentinels.d.ts +42 -0
- package/dist/markdown/annotate-sentinels.js +86 -0
- package/dist/markdown/parse.d.ts +56 -0
- package/dist/markdown/parse.js +516 -0
- package/dist/markdown/stringify.d.ts +7 -0
- package/dist/markdown/stringify.js +439 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/LICENSE +21 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/README.md +41 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/from-markdown.d.ts +72 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/from-markdown.js +127 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/index.d.ts +8 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/index.js +6 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/to-markdown.d.ts +17 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/to-markdown.js +33 -0
- package/dist/markdown.d.ts +28 -0
- package/dist/markdown.js +44 -0
- package/dist/mathjax-config.d.ts +89 -0
- package/dist/mathjax-config.js +133 -0
- package/dist/nodes.d.ts +34 -0
- package/dist/nodes.js +34 -0
- package/dist/stores/correctionStore.d.ts +15 -0
- package/dist/stores/correctionStore.js +12 -0
- package/dist/stores/editorStore.d.ts +16 -0
- package/dist/stores/editorStore.js +27 -0
- package/dist/styles.css +2477 -0
- package/dist/types.d.ts +296 -0
- package/dist/types.js +91 -0
- package/dist/utils/file-types.d.ts +10 -0
- package/dist/utils/file-types.js +46 -0
- package/docs/annotations.md +134 -0
- package/docs/decisions/README.md +72 -0
- package/docs/decisions/adr-002.md +27 -0
- package/docs/decisions/adr-007.md +27 -0
- package/docs/decisions/adr-010.md +26 -0
- package/docs/decisions/adr-024.md +124 -0
- package/docs/decisions/adr-024b.md +0 -0
- package/docs/decisions/adr-025.md +103 -0
- package/docs/decisions/adr-027.md +66 -0
- package/docs/decisions/adr-057.md +67 -0
- package/docs/decisions/adr-070.md +131 -0
- package/docs/decisions/adr-075.md +410 -0
- package/docs/decisions/adr-076.md +183 -0
- package/docs/decisions/adr-077.md +410 -0
- package/docs/decisions/adr-078.md +243 -0
- package/docs/decisions/adr-079.md +167 -0
- package/docs/decisions/adr-080.md +325 -0
- package/docs/decisions/adr-081.md +108 -0
- package/docs/decisions/adr-082.md +123 -0
- package/docs/decisions/adr-083.md +204 -0
- package/docs/decisions/adr-084.md +179 -0
- package/docs/editor-api.md +106 -0
- package/docs/markdown-pipeline.md +282 -0
- package/docs/provenance.md +106 -0
- package/docs/zusammen-editor-capability-map.md +232 -0
- package/package.json +175 -0
|
@@ -0,0 +1,203 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CorrectionEntry {
|
|
2
|
+
type: 'same_as' | 'retract';
|
|
3
|
+
canonical: string;
|
|
4
|
+
aliases: string[];
|
|
5
|
+
applied_at?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseCorrectionsYaml(raw: string | null): CorrectionEntry[];
|
|
8
|
+
export declare function serializeCorrectionsYaml(entries: CorrectionEntry[]): string;
|
|
9
|
+
export declare function mergeCorrection(entries: CorrectionEntry[], alias: string, canonical: string): CorrectionEntry[];
|
|
10
|
+
export declare function isExistingCanonical(entries: CorrectionEntry[], text: string): boolean;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { parse, stringify } from 'yaml';
|
|
2
|
+
export function parseCorrectionsYaml(raw) {
|
|
3
|
+
if (!raw?.trim())
|
|
4
|
+
return [];
|
|
5
|
+
try {
|
|
6
|
+
const parsed = parse(raw);
|
|
7
|
+
if (!Array.isArray(parsed?.corrections))
|
|
8
|
+
return [];
|
|
9
|
+
return parsed.corrections.filter((e) => typeof e === 'object' &&
|
|
10
|
+
e !== null &&
|
|
11
|
+
(e.type === 'same_as' || e.type === 'retract') &&
|
|
12
|
+
typeof e.canonical === 'string' &&
|
|
13
|
+
Array.isArray(e.aliases) &&
|
|
14
|
+
e.aliases.every((a) => typeof a === 'string') &&
|
|
15
|
+
(e.applied_at === undefined || typeof e.applied_at === 'string'));
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function serializeCorrectionsYaml(entries) {
|
|
22
|
+
const file = { corrections: entries };
|
|
23
|
+
return stringify(file);
|
|
24
|
+
}
|
|
25
|
+
export function mergeCorrection(entries, alias, canonical) {
|
|
26
|
+
const result = entries.map((e) => ({ ...e, aliases: [...e.aliases] }));
|
|
27
|
+
// If alias exists in a same_as entry, update that entry's canonical (never touch retract entries)
|
|
28
|
+
const existingIdx = result.findIndex((e) => e.type === 'same_as' && e.aliases.includes(alias));
|
|
29
|
+
if (existingIdx >= 0) {
|
|
30
|
+
result[existingIdx] = { ...result[existingIdx], canonical };
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
// Otherwise append a new same_as entry
|
|
34
|
+
result.push({ type: 'same_as', canonical, aliases: [alias] });
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
export function isExistingCanonical(entries, text) {
|
|
38
|
+
const lower = text.toLowerCase();
|
|
39
|
+
return entries.some((e) => e.type === 'same_as' && e.canonical.toLowerCase() === lower);
|
|
40
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Lexical node classes the production editor configures its
|
|
3
|
+
* `LexicalComposer` with — extracted into its own module so it can be the
|
|
4
|
+
* single source of truth for both `Editor.tsx` and the public `./nodes`
|
|
5
|
+
* entry point (see #954 / ADR-075). A hand-maintained second copy of this
|
|
6
|
+
* list is exactly the drift risk this module exists to eliminate.
|
|
7
|
+
*/
|
|
8
|
+
import type { Klass, LexicalNode } from 'lexical';
|
|
9
|
+
export declare const editorNodes: Klass<LexicalNode>[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { HeadingNode, QuoteNode } from '@lexical/rich-text';
|
|
2
|
+
import { CodeNode, CodeHighlightNode } from '@lexical/code';
|
|
3
|
+
import { AutoLinkNode } from '@lexical/link';
|
|
4
|
+
import { MarkNode } from '@lexical/mark';
|
|
5
|
+
import { TableNode, TableRowNode, TableCellNode } from '@lexical/table';
|
|
6
|
+
import { CalloutNode, ToggleContainerNode, ToggleTitleNode, ToggleContentNode, ImageNode, HorizontalRuleNode, EquationNode, MermaidNode, C4Node, FrontmatterNode, FootnoteNode, HtmlNode, ListItemParagraphBreakNode, CustomLinkNode, CustomListNode, DefinitionListNode, DefinitionTermNode, DefinitionDescriptionNode, CustomListItemNode, } from './nodes/index.js';
|
|
7
|
+
export const editorNodes = [
|
|
8
|
+
HeadingNode,
|
|
9
|
+
QuoteNode,
|
|
10
|
+
CustomListNode, // Replaces ListNode - uses same type 'list' but carries spread (loose/tight) state
|
|
11
|
+
CustomListItemNode, // Replaces ListItemNode - uses same type 'listitem' but carries per-item task-checked state
|
|
12
|
+
CodeNode,
|
|
13
|
+
CodeHighlightNode,
|
|
14
|
+
CustomLinkNode, // Replaces LinkNode - uses same type 'link' but renders data-href
|
|
15
|
+
AutoLinkNode,
|
|
16
|
+
TableNode,
|
|
17
|
+
TableRowNode,
|
|
18
|
+
TableCellNode,
|
|
19
|
+
CalloutNode,
|
|
20
|
+
ToggleContainerNode,
|
|
21
|
+
ToggleTitleNode,
|
|
22
|
+
ToggleContentNode,
|
|
23
|
+
ImageNode,
|
|
24
|
+
HorizontalRuleNode,
|
|
25
|
+
EquationNode,
|
|
26
|
+
MermaidNode,
|
|
27
|
+
C4Node,
|
|
28
|
+
FrontmatterNode,
|
|
29
|
+
FootnoteNode,
|
|
30
|
+
DefinitionListNode,
|
|
31
|
+
DefinitionTermNode,
|
|
32
|
+
DefinitionDescriptionNode,
|
|
33
|
+
HtmlNode,
|
|
34
|
+
ListItemParagraphBreakNode,
|
|
35
|
+
MarkNode, // Annotation live marks (see ADR-077); inert unless an annotation kind is configured
|
|
36
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Editor } from './Editor.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Editor } from './Editor.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LexicalEditor } from 'lexical';
|
|
2
|
+
/**
|
|
3
|
+
* Registers the un-nesting transform on `editor`. Returns the unregister
|
|
4
|
+
* function, so a host that mounts it in an effect can tear it down.
|
|
5
|
+
*/
|
|
6
|
+
export declare function registerMarkOverlapResolver(editor: LexicalEditor): () => void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Un-nests overlapping annotation marks into id-unioned siblings (Liminis
|
|
3
|
+
* #970, FR-005/FR-006).
|
|
4
|
+
*
|
|
5
|
+
* `$wrapSelectionInMarkNode` does not merge ids. When a placement's selection
|
|
6
|
+
* lands inside an existing `MarkNode`, it creates a *nested* `MarkNode` inside
|
|
7
|
+
* it — its own source says as much, and defers un-nesting to "a call to
|
|
8
|
+
* `registerNestedElementResolver<MarkNode>` somewhere else in the codebase".
|
|
9
|
+
* Nothing registered one, so a pair of overlapping annotations produced a
|
|
10
|
+
* `<mark>` inside a `<mark>`: the inner element carries only the inner id, so
|
|
11
|
+
* the shared region resolves to one annotation rather than both, and a click
|
|
12
|
+
* there fires once for the inner mark and again for the outer as the event
|
|
13
|
+
* bubbles. `AnnotationMarkerPlugin` already groups its decorations *by DOM
|
|
14
|
+
* element*, on the stated assumption that "overlapping annotations share one
|
|
15
|
+
* MarkNode — and therefore one element"; this registration is what makes that
|
|
16
|
+
* assumption true.
|
|
17
|
+
*
|
|
18
|
+
* With it, an overlap becomes a run of sibling marks — the disjoint parts
|
|
19
|
+
* carrying one id each, the shared part carrying both — so every id still has
|
|
20
|
+
* at least one element, the shared element resolves to both ids, and removing
|
|
21
|
+
* one id leaves the other's coverage over the shared region intact (a
|
|
22
|
+
* `MarkNode` with ids remaining is not unwrapped; see
|
|
23
|
+
* `removeMarksForAnnotations`).
|
|
24
|
+
*
|
|
25
|
+
* `annotation-marks.ts`'s `locateLiveMarkdownRange` already handles an id
|
|
26
|
+
* spread across several sibling marks (first open token → last close token,
|
|
27
|
+
* with interior tokens stripped), so splitting a mark this way does not change
|
|
28
|
+
* any recovered range.
|
|
29
|
+
*
|
|
30
|
+
* This is a Lexical *node transform*, so it runs at the end of the update that
|
|
31
|
+
* created the nesting — inside the same `editor.update()` as the batch that
|
|
32
|
+
* placed the marks, preserving the single-reconciliation guarantee (FR-009).
|
|
33
|
+
*/
|
|
34
|
+
import { $createMarkNode, MarkNode } from '@lexical/mark';
|
|
35
|
+
import { registerNestedElementResolver } from '@lexical/utils';
|
|
36
|
+
/**
|
|
37
|
+
* Registers the un-nesting transform on `editor`. Returns the unregister
|
|
38
|
+
* function, so a host that mounts it in an effect can tear it down.
|
|
39
|
+
*/
|
|
40
|
+
export function registerMarkOverlapResolver(editor) {
|
|
41
|
+
return registerNestedElementResolver(editor, MarkNode, (from) => $createMarkNode(from.getIDs()), (from, to) => {
|
|
42
|
+
for (const id of from.getIDs())
|
|
43
|
+
to.addID(id);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C4Component - React component for rendering and editing C4 architecture diagrams
|
|
3
|
+
*
|
|
4
|
+
* Uses the canonical React C4Renderer for diagram display.
|
|
5
|
+
* Provides editing UI (textarea overlay, click-to-edit) for the Lexical editor.
|
|
6
|
+
* Supports manual layout mode for drag-and-drop positioning of elements.
|
|
7
|
+
*/
|
|
8
|
+
import { NodeKey } from 'lexical';
|
|
9
|
+
interface C4ComponentProps {
|
|
10
|
+
code: string;
|
|
11
|
+
nodeKey: NodeKey;
|
|
12
|
+
}
|
|
13
|
+
export default function C4Component({ code, nodeKey, }: C4ComponentProps): JSX.Element;
|
|
14
|
+
export {};
|