@coral-viz/viz 0.2.3
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 +4 -0
- package/README.md +11 -0
- package/dist/compatibility/CompatibilityEdge.d.ts +106 -0
- package/dist/compatibility/CompatibilityEdge.d.ts.map +1 -0
- package/dist/compatibility/CompatibilityEdge.js +233 -0
- package/dist/compatibility/CompatibilityEdge.js.map +1 -0
- package/dist/compatibility/IncompatibilityTooltip.d.ts +44 -0
- package/dist/compatibility/IncompatibilityTooltip.d.ts.map +1 -0
- package/dist/compatibility/IncompatibilityTooltip.js +145 -0
- package/dist/compatibility/IncompatibilityTooltip.js.map +1 -0
- package/dist/compatibility/index.d.ts +10 -0
- package/dist/compatibility/index.d.ts.map +1 -0
- package/dist/compatibility/index.js +10 -0
- package/dist/compatibility/index.js.map +1 -0
- package/dist/compatibility/useEdgeCompatibility.d.ts +82 -0
- package/dist/compatibility/useEdgeCompatibility.d.ts.map +1 -0
- package/dist/compatibility/useEdgeCompatibility.js +170 -0
- package/dist/compatibility/useEdgeCompatibility.js.map +1 -0
- package/dist/compatibility/validateConnection.d.ts +56 -0
- package/dist/compatibility/validateConnection.d.ts.map +1 -0
- package/dist/compatibility/validateConnection.js +382 -0
- package/dist/compatibility/validateConnection.js.map +1 -0
- package/dist/components/EditContext.d.ts +45 -0
- package/dist/components/EditContext.d.ts.map +1 -0
- package/dist/components/EditContext.js +41 -0
- package/dist/components/EditContext.js.map +1 -0
- package/dist/components/ShapeRenderer.d.ts +35 -0
- package/dist/components/ShapeRenderer.d.ts.map +1 -0
- package/dist/components/ShapeRenderer.js +77 -0
- package/dist/components/ShapeRenderer.js.map +1 -0
- package/dist/components/SymbolNode.d.ts +53 -0
- package/dist/components/SymbolNode.d.ts.map +1 -0
- package/dist/components/SymbolNode.js +333 -0
- package/dist/components/SymbolNode.js.map +1 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +10 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/nodes.d.ts +43 -0
- package/dist/components/nodes.d.ts.map +1 -0
- package/dist/components/nodes.js +111 -0
- package/dist/components/nodes.js.map +1 -0
- package/dist/editor/CoralEditor.d.ts +29 -0
- package/dist/editor/CoralEditor.d.ts.map +1 -0
- package/dist/editor/CoralEditor.js +112 -0
- package/dist/editor/CoralEditor.js.map +1 -0
- package/dist/editor/FileControls.d.ts +34 -0
- package/dist/editor/FileControls.d.ts.map +1 -0
- package/dist/editor/FileControls.js +139 -0
- package/dist/editor/FileControls.js.map +1 -0
- package/dist/editor/LayoutControls.d.ts +41 -0
- package/dist/editor/LayoutControls.d.ts.map +1 -0
- package/dist/editor/LayoutControls.js +124 -0
- package/dist/editor/LayoutControls.js.map +1 -0
- package/dist/editor/converter.d.ts +37 -0
- package/dist/editor/converter.d.ts.map +1 -0
- package/dist/editor/converter.js +256 -0
- package/dist/editor/converter.js.map +1 -0
- package/dist/editor/index.d.ts +8 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +8 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/file/deserialize.d.ts +15 -0
- package/dist/file/deserialize.d.ts.map +1 -0
- package/dist/file/deserialize.js +145 -0
- package/dist/file/deserialize.js.map +1 -0
- package/dist/file/index.d.ts +15 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/file/index.js +20 -0
- package/dist/file/index.js.map +1 -0
- package/dist/file/migrate.d.ts +29 -0
- package/dist/file/migrate.d.ts.map +1 -0
- package/dist/file/migrate.js +103 -0
- package/dist/file/migrate.js.map +1 -0
- package/dist/file/schema.d.ts +385 -0
- package/dist/file/schema.d.ts.map +1 -0
- package/dist/file/schema.js +180 -0
- package/dist/file/schema.js.map +1 -0
- package/dist/file/serialize.d.ts +30 -0
- package/dist/file/serialize.d.ts.map +1 -0
- package/dist/file/serialize.js +218 -0
- package/dist/file/serialize.js.map +1 -0
- package/dist/file/validate.d.ts +21 -0
- package/dist/file/validate.d.ts.map +1 -0
- package/dist/file/validate.js +165 -0
- package/dist/file/validate.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/layout/elk.d.ts +77 -0
- package/dist/layout/elk.d.ts.map +1 -0
- package/dist/layout/elk.js +379 -0
- package/dist/layout/elk.js.map +1 -0
- package/dist/layout/index.d.ts +12 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +12 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/nodeSizing.d.ts +65 -0
- package/dist/layout/nodeSizing.d.ts.map +1 -0
- package/dist/layout/nodeSizing.js +319 -0
- package/dist/layout/nodeSizing.js.map +1 -0
- package/dist/layout/positionStability.d.ts +73 -0
- package/dist/layout/positionStability.d.ts.map +1 -0
- package/dist/layout/positionStability.js +199 -0
- package/dist/layout/positionStability.js.map +1 -0
- package/dist/layout/useAxisConstrain.d.ts +20 -0
- package/dist/layout/useAxisConstrain.d.ts.map +1 -0
- package/dist/layout/useAxisConstrain.js +106 -0
- package/dist/layout/useAxisConstrain.js.map +1 -0
- package/dist/layout/useDiagramState.d.ts +92 -0
- package/dist/layout/useDiagramState.d.ts.map +1 -0
- package/dist/layout/useDiagramState.js +256 -0
- package/dist/layout/useDiagramState.js.map +1 -0
- package/dist/layout/useLayoutHistory.d.ts +53 -0
- package/dist/layout/useLayoutHistory.d.ts.map +1 -0
- package/dist/layout/useLayoutHistory.js +124 -0
- package/dist/layout/useLayoutHistory.js.map +1 -0
- package/dist/properties/NodePropertiesPanel.d.ts +47 -0
- package/dist/properties/NodePropertiesPanel.d.ts.map +1 -0
- package/dist/properties/NodePropertiesPanel.js +199 -0
- package/dist/properties/NodePropertiesPanel.js.map +1 -0
- package/dist/properties/index.d.ts +10 -0
- package/dist/properties/index.d.ts.map +1 -0
- package/dist/properties/index.js +10 -0
- package/dist/properties/index.js.map +1 -0
- package/dist/properties/propertyUtils.d.ts +60 -0
- package/dist/properties/propertyUtils.d.ts.map +1 -0
- package/dist/properties/propertyUtils.js +89 -0
- package/dist/properties/propertyUtils.js.map +1 -0
- package/dist/settings/FontSettingsForm.d.ts +28 -0
- package/dist/settings/FontSettingsForm.d.ts.map +1 -0
- package/dist/settings/FontSettingsForm.js +129 -0
- package/dist/settings/FontSettingsForm.js.map +1 -0
- package/dist/settings/LayoutSettingsForm.d.ts +37 -0
- package/dist/settings/LayoutSettingsForm.d.ts.map +1 -0
- package/dist/settings/LayoutSettingsForm.js +165 -0
- package/dist/settings/LayoutSettingsForm.js.map +1 -0
- package/dist/settings/SettingsPanel.d.ts +55 -0
- package/dist/settings/SettingsPanel.d.ts.map +1 -0
- package/dist/settings/SettingsPanel.js +84 -0
- package/dist/settings/SettingsPanel.js.map +1 -0
- package/dist/settings/index.d.ts +13 -0
- package/dist/settings/index.d.ts.map +1 -0
- package/dist/settings/index.js +13 -0
- package/dist/settings/index.js.map +1 -0
- package/dist/settings/useSettings.d.ts +51 -0
- package/dist/settings/useSettings.d.ts.map +1 -0
- package/dist/settings/useSettings.js +154 -0
- package/dist/settings/useSettings.js.map +1 -0
- package/dist/text-editor/SplitEditor.d.ts +72 -0
- package/dist/text-editor/SplitEditor.d.ts.map +1 -0
- package/dist/text-editor/SplitEditor.js +172 -0
- package/dist/text-editor/SplitEditor.js.map +1 -0
- package/dist/text-editor/TextEditor.d.ts +53 -0
- package/dist/text-editor/TextEditor.d.ts.map +1 -0
- package/dist/text-editor/TextEditor.js +181 -0
- package/dist/text-editor/TextEditor.js.map +1 -0
- package/dist/text-editor/hooks/useBidirectionalSync.d.ts +106 -0
- package/dist/text-editor/hooks/useBidirectionalSync.d.ts.map +1 -0
- package/dist/text-editor/hooks/useBidirectionalSync.js +151 -0
- package/dist/text-editor/hooks/useBidirectionalSync.js.map +1 -0
- package/dist/text-editor/index.d.ts +9 -0
- package/dist/text-editor/index.d.ts.map +1 -0
- package/dist/text-editor/index.js +11 -0
- package/dist/text-editor/index.js.map +1 -0
- package/dist/types.d.ts +242 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/waypoints/index.d.ts +8 -0
- package/dist/waypoints/index.d.ts.map +1 -0
- package/dist/waypoints/index.js +7 -0
- package/dist/waypoints/index.js.map +1 -0
- package/dist/waypoints/operations.d.ts +29 -0
- package/dist/waypoints/operations.d.ts.map +1 -0
- package/dist/waypoints/operations.js +85 -0
- package/dist/waypoints/operations.js.map +1 -0
- package/dist/waypoints/router.d.ts +23 -0
- package/dist/waypoints/router.d.ts.map +1 -0
- package/dist/waypoints/router.js +109 -0
- package/dist/waypoints/router.js.map +1 -0
- package/dist/waypoints/types.d.ts +15 -0
- package/dist/waypoints/types.d.ts.map +1 -0
- package/dist/waypoints/types.js +5 -0
- package/dist/waypoints/types.js.map +1 -0
- package/dist/waypoints/useWaypointManager.d.ts +38 -0
- package/dist/waypoints/useWaypointManager.d.ts.map +1 -0
- package/dist/waypoints/useWaypointManager.js +106 -0
- package/dist/waypoints/useWaypointManager.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../src/text-editor/TextEditor.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAsCvE;;GAEG;AACH,SAAS,qBAAqB,CAAC,IAAY,EAAE,MAAc;IACzD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChD,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,MAAM;QAClB,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC;KAC3C,CA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CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAC3C,eAEE,KAAK,EAAE;4BACL,KAAK,EAAE,SAAS;4BAChB,SAAS,EAAE,KAAK;4BAChB,UAAU,EAAE,WAAW;4BACvB,QAAQ,EAAE,MAAM;yBACjB,sBAEK,KAAK,CAAC,IAAI,YAAQ,KAAK,CAAC,MAAM,QAAI,KAAK,CAAC,OAAO,KARhD,CAAC,CASF,CACP,CAAC,EACD,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,CAC3B,eAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,wBACvD,aAAa,CAAC,MAAM,GAAG,CAAC,aAC5B,CACP,IACG,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useBidirectionalSync - Hook for bidirectional text ↔ Graph-IR ↔ visual sync
|
|
3
|
+
*
|
|
4
|
+
* Keeps text DSL, Graph-IR, and visual editor in sync with debounced updates.
|
|
5
|
+
*/
|
|
6
|
+
import type { GraphIR, CoralNode, CoralEdge } from '../../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Parse function signature - converts text to Graph-IR
|
|
9
|
+
*/
|
|
10
|
+
export type ParseFunction = (text: string) => SyncParseResult;
|
|
11
|
+
/**
|
|
12
|
+
* Print function signature - converts Graph-IR to text
|
|
13
|
+
*/
|
|
14
|
+
export type PrintFunction = (graph: GraphIR) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Result of the parse function a host injects.
|
|
17
|
+
*
|
|
18
|
+
* Deliberately more permissive than `@coral-viz/language`'s `ParseResult` — this
|
|
19
|
+
* is the contract for any injected parser, Coral, Mermaid or DOT — and named
|
|
20
|
+
* distinctly so the ecosystem does not ship two public types called
|
|
21
|
+
* `SyncParseResult` (R-011 AC-7).
|
|
22
|
+
*/
|
|
23
|
+
export interface SyncParseResult {
|
|
24
|
+
success: boolean;
|
|
25
|
+
graph?: GraphIR;
|
|
26
|
+
errors: SyncParseError[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parse error with location information
|
|
30
|
+
*/
|
|
31
|
+
export interface SyncParseError {
|
|
32
|
+
message: string;
|
|
33
|
+
line: number;
|
|
34
|
+
column: number;
|
|
35
|
+
offset?: number;
|
|
36
|
+
}
|
|
37
|
+
/** @deprecated Use {@link SyncParseResult}. Kept for the 0.2.x line. */
|
|
38
|
+
export type ParseResult = SyncParseResult;
|
|
39
|
+
/** @deprecated Use {@link SyncParseError}. Kept for the 0.2.x line. */
|
|
40
|
+
export type ParseError = SyncParseError;
|
|
41
|
+
/**
|
|
42
|
+
* Source of the last change
|
|
43
|
+
*/
|
|
44
|
+
export type ChangeSource = 'text' | 'visual' | 'external';
|
|
45
|
+
/**
|
|
46
|
+
* Sync state returned by the hook
|
|
47
|
+
*/
|
|
48
|
+
export interface SyncState {
|
|
49
|
+
/** Current text content */
|
|
50
|
+
text: string;
|
|
51
|
+
/** Current Graph-IR (null if parse failed) */
|
|
52
|
+
graph: GraphIR | null;
|
|
53
|
+
/** Current parse errors */
|
|
54
|
+
errors: SyncParseError[];
|
|
55
|
+
/** Whether currently syncing */
|
|
56
|
+
isSyncing: boolean;
|
|
57
|
+
/** Source of the last change */
|
|
58
|
+
lastChangeSource: ChangeSource;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Sync actions returned by the hook
|
|
62
|
+
*/
|
|
63
|
+
export interface SyncActions {
|
|
64
|
+
/** Update text (from text editor) */
|
|
65
|
+
setText: (text: string) => void;
|
|
66
|
+
/** Update graph (from visual editor) */
|
|
67
|
+
setGraph: (graph: GraphIR) => void;
|
|
68
|
+
/** Update from visual editor nodes/edges changes */
|
|
69
|
+
setFromVisual: (nodes: CoralNode[], edges: CoralEdge[], originalGraph: GraphIR) => void;
|
|
70
|
+
/** Force sync from external source */
|
|
71
|
+
forceSync: (text: string) => void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Options for the sync hook
|
|
75
|
+
*/
|
|
76
|
+
export interface SyncOptions {
|
|
77
|
+
/** Initial text content */
|
|
78
|
+
initialText?: string;
|
|
79
|
+
/** Initial Graph-IR */
|
|
80
|
+
initialGraph?: GraphIR;
|
|
81
|
+
/** Parse function (text → Graph-IR) */
|
|
82
|
+
parse: ParseFunction;
|
|
83
|
+
/** Print function (Graph-IR → text) */
|
|
84
|
+
print: PrintFunction;
|
|
85
|
+
/** Debounce delay in ms (default: 100) */
|
|
86
|
+
debounceMs?: number;
|
|
87
|
+
/** Callback when graph changes */
|
|
88
|
+
onGraphChange?: (graph: GraphIR | null) => void;
|
|
89
|
+
/** Callback when errors change */
|
|
90
|
+
onErrorsChange?: (errors: SyncParseError[]) => void;
|
|
91
|
+
/** Callback when text changes */
|
|
92
|
+
onTextChange?: (text: string) => void;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Hook for bidirectional synchronization between text and visual editors.
|
|
96
|
+
*
|
|
97
|
+
* Maintains consistency between:
|
|
98
|
+
* - Text DSL (Coral, Mermaid, DOT)
|
|
99
|
+
* - Graph-IR (intermediate representation)
|
|
100
|
+
* - Visual editor state (React Flow nodes/edges)
|
|
101
|
+
*
|
|
102
|
+
* Changes are debounced to avoid excessive updates during typing.
|
|
103
|
+
*/
|
|
104
|
+
export declare function useBidirectionalSync(options: SyncOptions): [SyncState, SyncActions];
|
|
105
|
+
export default useBidirectionalSync;
|
|
106
|
+
//# sourceMappingURL=useBidirectionalSync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBidirectionalSync.d.ts","sourceRoot":"","sources":["../../../src/text-editor/hooks/useBidirectionalSync.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SA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,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;IACxF,sCAAsC;IACtC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uBAAuB;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uCAAuC;IACvC,KAAK,EAAE,aAAa,CAAC;IACrB,uCAAuC;IACvC,KAAK,EAAE,aAAa,CAAC;IACrB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,kCAAkC;IAClC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IACpD,iCAAiC;IACjC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CA0LnF;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useBidirectionalSync - Hook for bidirectional text ↔ Graph-IR ↔ visual sync
|
|
3
|
+
*
|
|
4
|
+
* Keeps text DSL, Graph-IR, and visual editor in sync with debounced updates.
|
|
5
|
+
*/
|
|
6
|
+
import { useState, useCallback, useRef, useEffect, useMemo } from 'react';
|
|
7
|
+
/**
|
|
8
|
+
* Hook for bidirectional synchronization between text and visual editors.
|
|
9
|
+
*
|
|
10
|
+
* Maintains consistency between:
|
|
11
|
+
* - Text DSL (Coral, Mermaid, DOT)
|
|
12
|
+
* - Graph-IR (intermediate representation)
|
|
13
|
+
* - Visual editor state (React Flow nodes/edges)
|
|
14
|
+
*
|
|
15
|
+
* Changes are debounced to avoid excessive updates during typing.
|
|
16
|
+
*/
|
|
17
|
+
export function useBidirectionalSync(options) {
|
|
18
|
+
const { initialText = '', initialGraph, parse, print, debounceMs = 100, onGraphChange, onErrorsChange, onTextChange, } = options;
|
|
19
|
+
// State
|
|
20
|
+
const [text, setTextState] = useState(initialText);
|
|
21
|
+
const [graph, setGraphState] = useState(initialGraph ?? null);
|
|
22
|
+
const [errors, setErrors] = useState([]);
|
|
23
|
+
const [isSyncing, setIsSyncing] = useState(false);
|
|
24
|
+
const [lastChangeSource, setLastChangeSource] = useState('external');
|
|
25
|
+
// Refs for debouncing and preventing feedback loops
|
|
26
|
+
const debounceTimeoutRef = useRef(null);
|
|
27
|
+
const isInternalUpdateRef = useRef(false);
|
|
28
|
+
// Parse text and update graph
|
|
29
|
+
const parseText = useCallback((newText) => {
|
|
30
|
+
const result = parse(newText);
|
|
31
|
+
setErrors(result.errors);
|
|
32
|
+
onErrorsChange?.(result.errors);
|
|
33
|
+
// A failed parse still carries everything that did parse, so one bad
|
|
34
|
+
// line must not blank the canvas (R-009 AC-8).
|
|
35
|
+
if (result.graph) {
|
|
36
|
+
setGraphState(result.graph);
|
|
37
|
+
onGraphChange?.(result.graph);
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}, [parse, onErrorsChange, onGraphChange]);
|
|
41
|
+
// Print graph and update text
|
|
42
|
+
const printGraph = useCallback((newGraph) => {
|
|
43
|
+
const newText = print(newGraph);
|
|
44
|
+
isInternalUpdateRef.current = true;
|
|
45
|
+
setTextState(newText);
|
|
46
|
+
onTextChange?.(newText);
|
|
47
|
+
isInternalUpdateRef.current = false;
|
|
48
|
+
return newText;
|
|
49
|
+
}, [print, onTextChange]);
|
|
50
|
+
// Debounced text update
|
|
51
|
+
const setText = useCallback((newText) => {
|
|
52
|
+
// Skip if this is an internal update from printing
|
|
53
|
+
if (isInternalUpdateRef.current) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
setTextState(newText);
|
|
57
|
+
setLastChangeSource('text');
|
|
58
|
+
setIsSyncing(true);
|
|
59
|
+
onTextChange?.(newText);
|
|
60
|
+
// Clear existing timeout
|
|
61
|
+
if (debounceTimeoutRef.current) {
|
|
62
|
+
clearTimeout(debounceTimeoutRef.current);
|
|
63
|
+
}
|
|
64
|
+
// Debounce parse
|
|
65
|
+
debounceTimeoutRef.current = setTimeout(() => {
|
|
66
|
+
parseText(newText);
|
|
67
|
+
setIsSyncing(false);
|
|
68
|
+
}, debounceMs);
|
|
69
|
+
}, [debounceMs, parseText, onTextChange]);
|
|
70
|
+
// Update from graph (visual editor changes)
|
|
71
|
+
const setGraph = useCallback((newGraph) => {
|
|
72
|
+
setGraphState(newGraph);
|
|
73
|
+
setLastChangeSource('visual');
|
|
74
|
+
setIsSyncing(true);
|
|
75
|
+
onGraphChange?.(newGraph);
|
|
76
|
+
// Clear existing timeout
|
|
77
|
+
if (debounceTimeoutRef.current) {
|
|
78
|
+
clearTimeout(debounceTimeoutRef.current);
|
|
79
|
+
}
|
|
80
|
+
// Debounce print
|
|
81
|
+
debounceTimeoutRef.current = setTimeout(() => {
|
|
82
|
+
printGraph(newGraph);
|
|
83
|
+
setErrors([]); // Clear errors when updating from visual
|
|
84
|
+
setIsSyncing(false);
|
|
85
|
+
}, debounceMs);
|
|
86
|
+
}, [debounceMs, printGraph, onGraphChange]);
|
|
87
|
+
// Update from visual editor nodes/edges
|
|
88
|
+
const setFromVisual = useCallback((nodes, edges, originalGraph) => {
|
|
89
|
+
// Convert React Flow nodes/edges back to Graph-IR
|
|
90
|
+
const newGraph = {
|
|
91
|
+
...originalGraph,
|
|
92
|
+
nodes: nodes.map((node) => ({
|
|
93
|
+
id: node.id,
|
|
94
|
+
type: node.data.nodeType,
|
|
95
|
+
label: node.data.label,
|
|
96
|
+
description: node.data.description,
|
|
97
|
+
properties: node.data.properties,
|
|
98
|
+
position: node.position,
|
|
99
|
+
dimensions: node.measured
|
|
100
|
+
? { width: node.measured.width ?? 0, height: node.measured.height ?? 0 }
|
|
101
|
+
: undefined,
|
|
102
|
+
})),
|
|
103
|
+
edges: edges.map((edge) => ({
|
|
104
|
+
id: edge.id,
|
|
105
|
+
source: edge.source,
|
|
106
|
+
target: edge.target,
|
|
107
|
+
type: edge.data?.edgeType,
|
|
108
|
+
label: edge.data?.label,
|
|
109
|
+
properties: edge.data?.properties,
|
|
110
|
+
})),
|
|
111
|
+
};
|
|
112
|
+
setGraph(newGraph);
|
|
113
|
+
}, [setGraph]);
|
|
114
|
+
// Force sync from external source
|
|
115
|
+
const forceSync = useCallback((newText) => {
|
|
116
|
+
setTextState(newText);
|
|
117
|
+
setLastChangeSource('external');
|
|
118
|
+
onTextChange?.(newText);
|
|
119
|
+
parseText(newText);
|
|
120
|
+
}, [parseText, onTextChange]);
|
|
121
|
+
// Cleanup on unmount
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
return () => {
|
|
124
|
+
if (debounceTimeoutRef.current) {
|
|
125
|
+
clearTimeout(debounceTimeoutRef.current);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}, []);
|
|
129
|
+
// Initial parse if text provided
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (initialText && !initialGraph) {
|
|
132
|
+
parseText(initialText);
|
|
133
|
+
}
|
|
134
|
+
}, []); // Only run once on mount
|
|
135
|
+
const state = useMemo(() => ({
|
|
136
|
+
text,
|
|
137
|
+
graph,
|
|
138
|
+
errors,
|
|
139
|
+
isSyncing,
|
|
140
|
+
lastChangeSource,
|
|
141
|
+
}), [text, graph, errors, isSyncing, lastChangeSource]);
|
|
142
|
+
const actions = useMemo(() => ({
|
|
143
|
+
setText,
|
|
144
|
+
setGraph,
|
|
145
|
+
setFromVisual,
|
|
146
|
+
forceSync,
|
|
147
|
+
}), [setText, setGraph, setFromVisual, forceSync]);
|
|
148
|
+
return [state, actions];
|
|
149
|
+
}
|
|
150
|
+
export default useBidirectionalSync;
|
|
151
|
+
//# sourceMappingURL=useBidirectionalSync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBidirectionalSync.js","sourceRoot":"","sources":["../../../src/text-editor/hooks/useBidirectionalSync.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAmG1E;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAoB;IACvD,MAAM,EACJ,WAAW,GAAG,EAAE,EAChB,YAAY,EACZ,KAAK,EACL,KAAK,EACL,UAAU,GAAG,GAAG,EAChB,aAAa,EACb,cAAc,EACd,YAAY,GACb,GAAG,OAAO,CAAC;IAEZ,QAAQ;IACR,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAiB,YAAY,IAAI,IAAI,CAAC,CAAC;IAC9E,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAmB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAe,UAAU,CAAC,CAAC;IAEnF,oDAAoD;IACpD,MAAM,kBAAkB,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAC;IAC9E,MAAM,mBAAmB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE1C,8BAA8B;IAC9B,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,OAAe,EAAmB,EAAE;QACnC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC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B,CAAC,OAAO,EAAE,CAAC;gBAC/B,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,iCAAiC;IACjC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,IAAI,CAAC,YAAY,EAAE,CAAC;YACjC,SAAS,CAAC,WAAW,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,yBAAyB;IAEjC,MAAM,KAAK,GAAc,OAAO,CAC9B,GAAG,EAAE,CAAC,CAAC;QACL,IAAI;QACJ,KAAK;QACL,MAAM;QACN,SAAS;QACT,gBAAgB;KACjB,CAAC,EACF,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,CAAC,CACnD,CAAC;IAEF,MAAM,OAAO,GAAgB,OAAO,CAClC,GAAG,EAAE,CAAC,CAAC;QACL,OAAO;QACP,QAAQ;QACR,aAAa;QACb,SAAS;KACV,CAAC,EACF,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,CAAC,CAC9C,CAAC;IAEF,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text Editor components for Coral
|
|
3
|
+
*
|
|
4
|
+
* Provides text editing with bidirectional sync to the visual editor.
|
|
5
|
+
*/
|
|
6
|
+
export { TextEditor, type TextEditorProps, type SyntaxLanguage } from './TextEditor.js';
|
|
7
|
+
export { SplitEditor, type SplitEditorProps, type SplitLayout, type PrimaryPane, } from './SplitEditor.js';
|
|
8
|
+
export { useBidirectionalSync, type SyncState, type SyncActions, type SyncOptions, type ParseFunction, type PrintFunction, type SyncParseResult, type SyncParseError, type ParseResult, type ParseError, type ChangeSource, } from './hooks/useBidirectionalSync.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/text-editor/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,oBAAoB,EACpB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EAEnB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text Editor components for Coral
|
|
3
|
+
*
|
|
4
|
+
* Provides text editing with bidirectional sync to the visual editor.
|
|
5
|
+
*/
|
|
6
|
+
// Components
|
|
7
|
+
export { TextEditor } from './TextEditor.js';
|
|
8
|
+
export { SplitEditor, } from './SplitEditor.js';
|
|
9
|
+
// Hooks
|
|
10
|
+
export { useBidirectionalSync, } from './hooks/useBidirectionalSync.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/text-editor/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,aAAa;AACb,OAAO,EAAE,UAAU,EAA6C,MAAM,iBAAiB,CAAC;AACxF,OAAO,EACL,WAAW,GAIZ,MAAM,kBAAkB,CAAC;AAE1B,QAAQ;AACR,OAAO,EACL,oBAAoB,GAYrB,MAAM,iCAAiC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for Coral Visual Editor
|
|
3
|
+
*/
|
|
4
|
+
import type { Node, Edge } from '@xyflow/react';
|
|
5
|
+
import type { ConnectionValidation } from '@coral-viz/render';
|
|
6
|
+
export type { PortAnchor, SizingMode, ShapeSizing, TextMeasureOptions, TextDimensions, NodeSizingOptions, NodeDimensions, ShapeDefinition, ShapeParameter, SymbolPort, SymbolVariant, SymbolDefinition, SymbolLibrary, ConnectionConstraints, ConnectionRule, NotationDefinition, NotationValidation, ValidationRule, IncompatibilityReason, HandleDragState, ShapeRegistry, SymbolRegistry, NotationRegistry, ValidationResult, ConnectionValidation, } from '@coral-viz/render';
|
|
7
|
+
import type { GraphNode, GraphEdge, Position, EdgeStyle } from '@graph-ir/core';
|
|
8
|
+
export type { GraphIR, GraphNode, GraphEdge, Position, Dimensions, EdgeStyle, LayoutOptions, } from '@graph-ir/core';
|
|
9
|
+
/**
|
|
10
|
+
* Graph-IR types (subset needed for visualization)
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Coral node data passed to React Flow nodes
|
|
14
|
+
* Includes index signature for React Flow v12 compatibility
|
|
15
|
+
*/
|
|
16
|
+
export interface CoralNodeData {
|
|
17
|
+
label: string;
|
|
18
|
+
nodeType: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
properties?: Record<string, unknown>;
|
|
21
|
+
/** Whether automatic layout and dragging must preserve this node's position. */
|
|
22
|
+
pinned?: boolean;
|
|
23
|
+
isGroup?: boolean;
|
|
24
|
+
childCount?: number;
|
|
25
|
+
/** Canonical fields carried through the React Flow projection unchanged. */
|
|
26
|
+
canonical?: Omit<GraphNode, 'children' | 'id' | 'type' | 'label' | 'description' | 'properties' | 'position' | 'pinned'>;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* React Flow node with Coral data
|
|
31
|
+
*/
|
|
32
|
+
export type CoralNode = Node<CoralNodeData>;
|
|
33
|
+
/**
|
|
34
|
+
* Coral edge data passed to React Flow edges
|
|
35
|
+
* Includes index signature for React Flow v12 compatibility
|
|
36
|
+
*/
|
|
37
|
+
export interface CoralEdgeData {
|
|
38
|
+
label?: string;
|
|
39
|
+
edgeType?: string;
|
|
40
|
+
properties?: Record<string, unknown>;
|
|
41
|
+
lineStyle?: EdgeStyle['lineStyle'];
|
|
42
|
+
routingPoints?: Position[];
|
|
43
|
+
/** Canonical fields carried through the React Flow projection unchanged. */
|
|
44
|
+
canonical?: Omit<GraphEdge, 'id' | 'source' | 'target' | 'sourcePort' | 'targetPort' | 'type' | 'label' | 'properties' | 'routingPoints'>;
|
|
45
|
+
/** ELK-compatible routed path (bend points from edge router) */
|
|
46
|
+
routedPath?: {
|
|
47
|
+
startPoint: Position;
|
|
48
|
+
endPoint: Position;
|
|
49
|
+
bendPoints: Position[];
|
|
50
|
+
};
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* React Flow edge with Coral data
|
|
55
|
+
*/
|
|
56
|
+
export type CoralEdge = Edge<CoralEdgeData>;
|
|
57
|
+
/**
|
|
58
|
+
* Props for custom Coral node components
|
|
59
|
+
* React Flow v12 passes these props to custom node components
|
|
60
|
+
*/
|
|
61
|
+
export interface CoralNodeProps {
|
|
62
|
+
id: string;
|
|
63
|
+
data: CoralNodeData;
|
|
64
|
+
selected?: boolean;
|
|
65
|
+
type?: string;
|
|
66
|
+
xPos?: number;
|
|
67
|
+
yPos?: number;
|
|
68
|
+
zIndex?: number;
|
|
69
|
+
isConnectable?: boolean;
|
|
70
|
+
positionAbsoluteX?: number;
|
|
71
|
+
positionAbsoluteY?: number;
|
|
72
|
+
dragging?: boolean;
|
|
73
|
+
sourcePosition?: string;
|
|
74
|
+
targetPosition?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Editor state
|
|
78
|
+
*/
|
|
79
|
+
export interface EditorState {
|
|
80
|
+
nodes: CoralNode[];
|
|
81
|
+
edges: CoralEdge[];
|
|
82
|
+
selectedNodes: string[];
|
|
83
|
+
selectedEdges: string[];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Editor callbacks
|
|
87
|
+
*/
|
|
88
|
+
export interface EditorCallbacks {
|
|
89
|
+
onNodesChange?: (nodes: CoralNode[]) => void;
|
|
90
|
+
onEdgesChange?: (edges: CoralEdge[]) => void;
|
|
91
|
+
onNodeSelect?: (nodeIds: string[]) => void;
|
|
92
|
+
onEdgeSelect?: (edgeIds: string[]) => void;
|
|
93
|
+
onNodeDoubleClick?: (nodeId: string) => void;
|
|
94
|
+
/** Called when a node label is edited inline */
|
|
95
|
+
onLabelEdit?: (nodeId: string, newLabel: string) => void;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Editor configuration
|
|
99
|
+
*/
|
|
100
|
+
export interface EditorConfig {
|
|
101
|
+
/** Enable node dragging */
|
|
102
|
+
draggable?: boolean;
|
|
103
|
+
/** Enable edge connections */
|
|
104
|
+
connectable?: boolean;
|
|
105
|
+
/** Enable selection */
|
|
106
|
+
selectable?: boolean;
|
|
107
|
+
/** Enable zooming */
|
|
108
|
+
zoomable?: boolean;
|
|
109
|
+
/** Enable panning */
|
|
110
|
+
pannable?: boolean;
|
|
111
|
+
/** Show minimap */
|
|
112
|
+
showMinimap?: boolean;
|
|
113
|
+
/** Show controls */
|
|
114
|
+
showControls?: boolean;
|
|
115
|
+
/** Fit view on load */
|
|
116
|
+
fitViewOnLoad?: boolean;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Edge style definition
|
|
120
|
+
*/
|
|
121
|
+
export interface NotationEdgeStyle {
|
|
122
|
+
name: string;
|
|
123
|
+
targetArrow: 'arrow' | 'triangle' | 'diamond' | 'circle' | 'none';
|
|
124
|
+
sourceArrow?: 'arrow' | 'triangle' | 'diamond' | 'circle' | 'none';
|
|
125
|
+
lineStyle: 'solid' | 'dashed' | 'dotted';
|
|
126
|
+
stroke: string;
|
|
127
|
+
strokeWidth: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Entry/exit point definition
|
|
131
|
+
*/
|
|
132
|
+
export interface FlowPoint {
|
|
133
|
+
symbol: string;
|
|
134
|
+
variant?: string;
|
|
135
|
+
min?: number;
|
|
136
|
+
max?: number;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Position source tracking - where did this position come from?
|
|
140
|
+
*/
|
|
141
|
+
export type PositionSource = 'elk-computed' | 'user-dragged' | 'loaded' | 'incremental';
|
|
142
|
+
/**
|
|
143
|
+
* Node with position metadata for tracking position origin
|
|
144
|
+
*/
|
|
145
|
+
export interface PositionedNode {
|
|
146
|
+
id: string;
|
|
147
|
+
position: Position;
|
|
148
|
+
positionSource: PositionSource;
|
|
149
|
+
/** When position was last updated */
|
|
150
|
+
positionTimestamp: number;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Graph diff result - identifies changes between two graph states
|
|
154
|
+
*/
|
|
155
|
+
export interface GraphDiff {
|
|
156
|
+
/** Node IDs that exist in new graph but not in old */
|
|
157
|
+
added: string[];
|
|
158
|
+
/** Node IDs that exist in old graph but not in new */
|
|
159
|
+
removed: string[];
|
|
160
|
+
/** Node IDs where label or type changed */
|
|
161
|
+
modified: string[];
|
|
162
|
+
/** Node IDs with no changes */
|
|
163
|
+
unchanged: string[];
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Position resolution result - maps node IDs to positions
|
|
167
|
+
*/
|
|
168
|
+
export interface PositionResolution {
|
|
169
|
+
/** Resolved positions for nodes */
|
|
170
|
+
positions: Map<string, Position>;
|
|
171
|
+
/** Node IDs that need ELK positioning (new nodes without positions) */
|
|
172
|
+
needsLayout: string[];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Simplified graph node for diffing (minimal fields needed for comparison)
|
|
176
|
+
*/
|
|
177
|
+
export interface DiffableNode {
|
|
178
|
+
id: string;
|
|
179
|
+
type: string;
|
|
180
|
+
label?: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Simplified graph for diffing
|
|
184
|
+
*/
|
|
185
|
+
export interface DiffableGraph {
|
|
186
|
+
nodes: DiffableNode[];
|
|
187
|
+
edges: Array<{
|
|
188
|
+
id: string;
|
|
189
|
+
source: string;
|
|
190
|
+
target: string;
|
|
191
|
+
}>;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Information about a connection being validated
|
|
195
|
+
*/
|
|
196
|
+
export interface ConnectionInfo {
|
|
197
|
+
/** Source node ID */
|
|
198
|
+
sourceNodeId: string;
|
|
199
|
+
/** Target node ID */
|
|
200
|
+
targetNodeId: string;
|
|
201
|
+
/** Source port ID (optional) */
|
|
202
|
+
sourcePortId?: string;
|
|
203
|
+
/** Target port ID (optional) */
|
|
204
|
+
targetPortId?: string;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Node info needed for connection validation
|
|
208
|
+
*/
|
|
209
|
+
export interface NodeConnectionInfo {
|
|
210
|
+
id: string;
|
|
211
|
+
symbolId: string;
|
|
212
|
+
variant?: string;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Edge compatibility status for rendering
|
|
216
|
+
*/
|
|
217
|
+
export type EdgeCompatibilityStatus = 'compatible' | 'warning' | 'incompatible';
|
|
218
|
+
/**
|
|
219
|
+
* Edge with compatibility information for rendering
|
|
220
|
+
*/
|
|
221
|
+
export interface EdgeCompatibility {
|
|
222
|
+
edgeId: string;
|
|
223
|
+
status: EdgeCompatibilityStatus;
|
|
224
|
+
validation: ConnectionValidation;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Props for connection validation context
|
|
228
|
+
*/
|
|
229
|
+
export interface ConnectionValidationContext {
|
|
230
|
+
/** Current notation ID */
|
|
231
|
+
notationId: string;
|
|
232
|
+
/** Map of node ID to node info for validation */
|
|
233
|
+
nodeInfo: Map<string, NodeConnectionInfo>;
|
|
234
|
+
/** Existing edges for constraint checking */
|
|
235
|
+
existingEdges: Array<{
|
|
236
|
+
source: string;
|
|
237
|
+
target: string;
|
|
238
|
+
sourcePort?: string;
|
|
239
|
+
targetPort?: string;
|
|
240
|
+
}>;
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAI9D,YAAY,EACV,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,cAAc,EACvE,iBAAiB,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAC9E,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,qBAAqB,EACrE,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,EACtE,qBAAqB,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EACrE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,GACzD,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAEV,SAAS,EACT,SAAS,EACT,QAAQ,EAER,SAAS,EAEV,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,OAAO,EACP,SAAS,EACT,SAAS,EACT,QAAQ,EACR,UAAU,EACV,SAAS,EACT,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AA+DH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,O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M,EAAE,uBAAuB,CAAC;IAChC,UAAU,EAAE,oBAAoB,CAAC;CAClC;AAGD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC1C,6CAA6C;IAC7C,aAAa,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpG"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Waypoint module (CORAL-REQ-015)
|
|
3
|
+
*/
|
|
4
|
+
export type { EdgeWaypoint } from './types.js';
|
|
5
|
+
export { createWaypoint, addWaypointToEdge, removeWaypointFromEdge, moveWaypoint, insertWaypointAtPosition, } from './operations.js';
|
|
6
|
+
export { routeWithWaypoints, type RoutedPath } from './router.js';
|
|
7
|
+
export { useWaypointManager, type UseWaypointManagerOptions, type UseWaypointManagerResult, } from './useWaypointManager.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/waypoints/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,EACZ,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Waypoint module (CORAL-REQ-015)
|
|
3
|
+
*/
|
|
4
|
+
export { createWaypoint, addWaypointToEdge, removeWaypointFromEdge, moveWaypoint, insertWaypointAtPosition, } from './operations.js';
|
|
5
|
+
export { routeWithWaypoints } from './router.js';
|
|
6
|
+
export { useWaypointManager, } from './useWaypointManager.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/waypoints/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,EACZ,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAmB,MAAM,aAAa,CAAC;AAClE,OAAO,EACL,kBAAkB,GAGnB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure waypoint operations (CORAL-REQ-015)
|
|
3
|
+
*
|
|
4
|
+
* All functions are immutable — they return new arrays.
|
|
5
|
+
*/
|
|
6
|
+
import type { EdgeWaypoint } from './types.js';
|
|
7
|
+
/** Create a new waypoint with a unique ID */
|
|
8
|
+
export declare function createWaypoint(x: number, y: number, type?: 'corner' | 'smooth'): EdgeWaypoint;
|
|
9
|
+
/** Add a waypoint to the end of an edge's waypoint list */
|
|
10
|
+
export declare function addWaypointToEdge(waypoints: EdgeWaypoint[], waypoint: EdgeWaypoint): EdgeWaypoint[];
|
|
11
|
+
/** Remove a waypoint by ID */
|
|
12
|
+
export declare function removeWaypointFromEdge(waypoints: EdgeWaypoint[], waypointId: string): EdgeWaypoint[];
|
|
13
|
+
/** Move a waypoint to a new position */
|
|
14
|
+
export declare function moveWaypoint(waypoints: EdgeWaypoint[], waypointId: string, x: number, y: number): EdgeWaypoint[];
|
|
15
|
+
/**
|
|
16
|
+
* Insert a waypoint at the closest segment of a polyline path.
|
|
17
|
+
*
|
|
18
|
+
* The path is an array of points representing the full edge path
|
|
19
|
+
* (startPoint + bendPoints + endPoint). The new waypoint is inserted
|
|
20
|
+
* at the position along the path where it is closest.
|
|
21
|
+
*/
|
|
22
|
+
export declare function insertWaypointAtPosition(existing: EdgeWaypoint[], path: Array<{
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
}>, position: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
}): EdgeWaypoint[];
|
|
29
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/waypoints/operations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,6CAA6C;AAC7C,wBAAgB,cAAc,CAC5B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,IAAI,GAAE,QAAQ,GAAG,QAAmB,GACnC,YAAY,CAEd;AAED,2DAA2D;AAC3D,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,YAAY,EAAE,EACzB,QAAQ,EAAE,YAAY,GACrB,YAAY,EAAE,CAEhB;AAED,8BAA8B;AAC9B,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,YAAY,EAAE,EACzB,UAAU,EAAE,MAAM,GACjB,YAAY,EAAE,CAEhB;AAED,wCAAwC;AACxC,wBAAgB,YAAY,CAC1B,SAAS,EAAE,YAAY,EAAE,EACzB,UAAU,EAAE,MAAM,EAClB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,YAAY,EAAE,CAIhB;AAuBD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EAAE,EACxB,IAAI,EAAE,KAAK,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EACrC,QAAQ,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GACjC,YAAY,EAAE,CAmDhB"}
|