@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":"useLayoutHistory.js","sourceRoot":"","sources":["../../src/layout/useLayoutHistory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAgDtD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,UAAmC,EAAE;IAErC,MAAM,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAEpC,8CAA8C;IAC9C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAqB,EAAE,CAAC,CAAC;IAC/D,wDAAwD;IACxD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;I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
|
+
*
|
|
4
|
+
* A panel that displays and allows editing of node properties.
|
|
5
|
+
* Shows node info (ID, type), basic properties (label, description),
|
|
6
|
+
* and custom properties with type-appropriate input controls.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type { CoralNode } from '../types.js';
|
|
10
|
+
import { type PropertyValue } from './propertyUtils.js';
|
|
11
|
+
/**
|
|
12
|
+
* Change event for property updates
|
|
13
|
+
*/
|
|
14
|
+
export interface PropertyChange {
|
|
15
|
+
nodeId: string;
|
|
16
|
+
field: 'label' | 'description' | 'property';
|
|
17
|
+
propertyKey?: string;
|
|
18
|
+
oldValue: unknown;
|
|
19
|
+
newValue: unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Props for NodePropertiesPanel
|
|
23
|
+
*/
|
|
24
|
+
export interface NodePropertiesPanelProps {
|
|
25
|
+
/** Currently selected node (null if none selected) */
|
|
26
|
+
selectedNode: CoralNode | null;
|
|
27
|
+
/** Callback when any property changes */
|
|
28
|
+
onPropertyChange: (change: PropertyChange) => void;
|
|
29
|
+
/** Callback to add a new custom property */
|
|
30
|
+
onAddProperty?: (nodeId: string, key: string, value: PropertyValue) => void;
|
|
31
|
+
/** Callback to remove a custom property */
|
|
32
|
+
onRemoveProperty?: (nodeId: string, key: string) => void;
|
|
33
|
+
/** Whether the panel is disabled (read-only mode) */
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
/** Panel width */
|
|
36
|
+
width?: number | string;
|
|
37
|
+
/** Show node ID (read-only info) */
|
|
38
|
+
showNodeId?: boolean;
|
|
39
|
+
/** Show node type (read-only info) */
|
|
40
|
+
showNodeType?: boolean;
|
|
41
|
+
/** Allow adding custom properties */
|
|
42
|
+
allowAddProperties?: boolean;
|
|
43
|
+
/** Allow removing custom properties */
|
|
44
|
+
allowRemoveProperties?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare function NodePropertiesPanel({ selectedNode, onPropertyChange, onAddProperty, onRemoveProperty, disabled, width, showNodeId, showNodeType, allowAddProperties, allowRemoveProperties, }: NodePropertiesPanelProps): React.ReactElement;
|
|
47
|
+
//# sourceMappingURL=NodePropertiesPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodePropertiesPanel.d.ts","sourceRoot":"","sources":["../../src/properties/NodePropertiesPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAIL,KAAK,aAAa,EAEnB,MAAM,oBAAoB,CAAC;AAM5B;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,UAAU,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,sDAAsD;IACtD,YAAY,EAAE,SAAS,GAAG,IAAI,CAAC;IAE/B,yCAAyC;IACzC,gBAAgB,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAEnD,4CAA4C;IAC5C,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAE5E,2CAA2C;IAC3C,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzD,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB,oCAAoC;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,sCAAsC;IACtC,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,qCAAqC;IACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,uCAAuC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAiHD,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,QAAgB,EAChB,KAAW,EACX,UAAiB,EACjB,YAAmB,EACnB,kBAAyB,EACzB,qBAA4B,GAC7B,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CA6T/C"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* NodePropertiesPanel Component
|
|
4
|
+
*
|
|
5
|
+
* A panel that displays and allows editing of node properties.
|
|
6
|
+
* Shows node info (ID, type), basic properties (label, description),
|
|
7
|
+
* and custom properties with type-appropriate input controls.
|
|
8
|
+
*/
|
|
9
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
10
|
+
import { extractPropertyFields, } from './propertyUtils.js';
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// Styles
|
|
13
|
+
// ============================================================================
|
|
14
|
+
const labelStyles = {
|
|
15
|
+
fontSize: '12px',
|
|
16
|
+
fontWeight: 500,
|
|
17
|
+
color: '#555',
|
|
18
|
+
marginBottom: '4px',
|
|
19
|
+
display: 'block',
|
|
20
|
+
};
|
|
21
|
+
const inputStyles = {
|
|
22
|
+
padding: '6px 10px',
|
|
23
|
+
fontSize: '13px',
|
|
24
|
+
borderRadius: '4px',
|
|
25
|
+
border: '1px solid #ccc',
|
|
26
|
+
backgroundColor: '#fff',
|
|
27
|
+
width: '100%',
|
|
28
|
+
boxSizing: 'border-box',
|
|
29
|
+
};
|
|
30
|
+
const sectionHeaderStyles = {
|
|
31
|
+
fontSize: '11px',
|
|
32
|
+
fontWeight: 600,
|
|
33
|
+
color: '#888',
|
|
34
|
+
textTransform: 'uppercase',
|
|
35
|
+
letterSpacing: '0.5px',
|
|
36
|
+
marginBottom: '8px',
|
|
37
|
+
marginTop: '16px',
|
|
38
|
+
};
|
|
39
|
+
const formGroupStyles = {
|
|
40
|
+
marginBottom: '12px',
|
|
41
|
+
};
|
|
42
|
+
function PropertyInput({ meta, onChange, disabled }) {
|
|
43
|
+
const { type, value, isEditable } = meta;
|
|
44
|
+
// Non-editable types show as read-only
|
|
45
|
+
if (!isEditable) {
|
|
46
|
+
return (_jsx("div", { style: {
|
|
47
|
+
padding: '6px 10px',
|
|
48
|
+
fontSize: '12px',
|
|
49
|
+
color: '#666',
|
|
50
|
+
backgroundColor: '#f5f5f5',
|
|
51
|
+
borderRadius: '4px',
|
|
52
|
+
fontStyle: 'italic',
|
|
53
|
+
}, children: type === 'object' ? '{...}' : type === 'array' ? '[...]' : String(value) }));
|
|
54
|
+
}
|
|
55
|
+
// Boolean: checkbox
|
|
56
|
+
if (type === 'boolean') {
|
|
57
|
+
return (_jsx("input", { type: "checkbox", checked: Boolean(value), onChange: (e) => onChange(e.target.checked), disabled: disabled }));
|
|
58
|
+
}
|
|
59
|
+
// Number: number input
|
|
60
|
+
if (type === 'number') {
|
|
61
|
+
return (_jsx("input", { type: "number", value: value, onChange: (e) => {
|
|
62
|
+
const parsed = parseFloat(e.target.value);
|
|
63
|
+
onChange(isNaN(parsed) ? 0 : parsed);
|
|
64
|
+
}, disabled: disabled, style: inputStyles }));
|
|
65
|
+
}
|
|
66
|
+
// String (default): text input
|
|
67
|
+
return (_jsx("input", { type: "text", value: String(value ?? ''), onChange: (e) => onChange(e.target.value), disabled: disabled, style: inputStyles }));
|
|
68
|
+
}
|
|
69
|
+
// ============================================================================
|
|
70
|
+
// NodePropertiesPanel Component
|
|
71
|
+
// ============================================================================
|
|
72
|
+
export function NodePropertiesPanel({ selectedNode, onPropertyChange, onAddProperty, onRemoveProperty, disabled = false, width = 320, showNodeId = true, showNodeType = true, allowAddProperties = true, allowRemoveProperties = true, }) {
|
|
73
|
+
const [newPropertyKey, setNewPropertyKey] = useState('');
|
|
74
|
+
const [newPropertyValue, setNewPropertyValue] = useState('');
|
|
75
|
+
const [newPropertyType, setNewPropertyType] = useState('string');
|
|
76
|
+
// Extract custom properties
|
|
77
|
+
const customProperties = useMemo(() => extractPropertyFields(selectedNode?.data?.properties), [selectedNode?.data?.properties]);
|
|
78
|
+
// Handle label change
|
|
79
|
+
const handleLabelChange = useCallback((e) => {
|
|
80
|
+
if (!selectedNode)
|
|
81
|
+
return;
|
|
82
|
+
onPropertyChange({
|
|
83
|
+
nodeId: selectedNode.id,
|
|
84
|
+
field: 'label',
|
|
85
|
+
oldValue: selectedNode.data.label,
|
|
86
|
+
newValue: e.target.value,
|
|
87
|
+
});
|
|
88
|
+
}, [selectedNode, onPropertyChange]);
|
|
89
|
+
// Handle description change
|
|
90
|
+
const handleDescriptionChange = useCallback((e) => {
|
|
91
|
+
if (!selectedNode)
|
|
92
|
+
return;
|
|
93
|
+
onPropertyChange({
|
|
94
|
+
nodeId: selectedNode.id,
|
|
95
|
+
field: 'description',
|
|
96
|
+
oldValue: selectedNode.data.description,
|
|
97
|
+
newValue: e.target.value,
|
|
98
|
+
});
|
|
99
|
+
}, [selectedNode, onPropertyChange]);
|
|
100
|
+
// Handle custom property change
|
|
101
|
+
const handlePropertyValueChange = useCallback((key, oldValue, newValue) => {
|
|
102
|
+
if (!selectedNode)
|
|
103
|
+
return;
|
|
104
|
+
onPropertyChange({
|
|
105
|
+
nodeId: selectedNode.id,
|
|
106
|
+
field: 'property',
|
|
107
|
+
propertyKey: key,
|
|
108
|
+
oldValue,
|
|
109
|
+
newValue,
|
|
110
|
+
});
|
|
111
|
+
}, [selectedNode, onPropertyChange]);
|
|
112
|
+
// Handle add new property
|
|
113
|
+
const handleAddProperty = useCallback(() => {
|
|
114
|
+
if (!selectedNode || !newPropertyKey.trim() || !onAddProperty)
|
|
115
|
+
return;
|
|
116
|
+
let value;
|
|
117
|
+
switch (newPropertyType) {
|
|
118
|
+
case 'number':
|
|
119
|
+
value = parseFloat(newPropertyValue) || 0;
|
|
120
|
+
break;
|
|
121
|
+
case 'boolean':
|
|
122
|
+
value = newPropertyValue === 'true';
|
|
123
|
+
break;
|
|
124
|
+
default:
|
|
125
|
+
value = newPropertyValue;
|
|
126
|
+
}
|
|
127
|
+
onAddProperty(selectedNode.id, newPropertyKey.trim(), value);
|
|
128
|
+
setNewPropertyKey('');
|
|
129
|
+
setNewPropertyValue('');
|
|
130
|
+
}, [selectedNode, newPropertyKey, newPropertyValue, newPropertyType, onAddProperty]);
|
|
131
|
+
// Empty state
|
|
132
|
+
if (!selectedNode) {
|
|
133
|
+
return (_jsx("div", { style: {
|
|
134
|
+
width,
|
|
135
|
+
backgroundColor: '#fff',
|
|
136
|
+
borderRadius: '8px',
|
|
137
|
+
boxShadow: '0 2px 8px rgba(0,0,0,0.15)',
|
|
138
|
+
padding: '16px',
|
|
139
|
+
}, children: _jsx("div", { style: {
|
|
140
|
+
color: '#999',
|
|
141
|
+
fontStyle: 'italic',
|
|
142
|
+
textAlign: 'center',
|
|
143
|
+
padding: '24px 0',
|
|
144
|
+
}, children: "No node selected" }) }));
|
|
145
|
+
}
|
|
146
|
+
return (_jsxs("div", { style: {
|
|
147
|
+
width,
|
|
148
|
+
backgroundColor: '#fff',
|
|
149
|
+
borderRadius: '8px',
|
|
150
|
+
boxShadow: '0 2px 8px rgba(0,0,0,0.15)',
|
|
151
|
+
overflow: 'hidden',
|
|
152
|
+
}, children: [_jsx("div", { style: {
|
|
153
|
+
padding: '12px 16px',
|
|
154
|
+
borderBottom: '1px solid #e0e0e0',
|
|
155
|
+
fontWeight: 600,
|
|
156
|
+
fontSize: '14px',
|
|
157
|
+
}, children: "Node Properties" }), _jsxs("div", { style: { padding: '12px', maxHeight: '500px', overflowY: 'auto' }, children: [_jsx("div", { style: sectionHeaderStyles, children: "Node Info" }), showNodeId && (_jsxs("div", { style: { ...formGroupStyles, display: 'flex', gap: '8px' }, children: [_jsx("span", { style: { ...labelStyles, width: '50px', marginBottom: 0 }, children: "ID:" }), _jsx("span", { style: { fontSize: '12px', color: '#666', fontFamily: 'monospace' }, children: selectedNode.id })] })), showNodeType && (_jsxs("div", { style: { ...formGroupStyles, display: 'flex', gap: '8px' }, children: [_jsx("span", { style: { ...labelStyles, width: '50px', marginBottom: 0 }, children: "Type:" }), _jsx("span", { style: { fontSize: '12px', color: '#666' }, children: selectedNode.data.nodeType })] })), _jsx("div", { style: sectionHeaderStyles, children: "Basic Properties" }), _jsxs("div", { style: formGroupStyles, children: [_jsx("label", { style: labelStyles, children: "Label" }), _jsx("input", { type: "text", value: selectedNode.data.label, onChange: handleLabelChange, disabled: disabled, style: inputStyles })] }), _jsxs("div", { style: formGroupStyles, children: [_jsx("label", { style: labelStyles, children: "Description" }), _jsx("textarea", { value: selectedNode.data.description ?? '', onChange: handleDescriptionChange, disabled: disabled, placeholder: "Optional description...", rows: 3, style: {
|
|
158
|
+
...inputStyles,
|
|
159
|
+
resize: 'vertical',
|
|
160
|
+
minHeight: '60px',
|
|
161
|
+
} })] }), _jsx("div", { style: sectionHeaderStyles, children: "Custom Properties" }), customProperties.length === 0 ? (_jsx("div", { style: {
|
|
162
|
+
fontSize: '12px',
|
|
163
|
+
color: '#999',
|
|
164
|
+
fontStyle: 'italic',
|
|
165
|
+
marginBottom: '12px',
|
|
166
|
+
}, children: "No custom properties" })) : (_jsx("div", { style: { marginBottom: '12px' }, children: customProperties.map((prop) => (_jsxs("div", { style: {
|
|
167
|
+
display: 'flex',
|
|
168
|
+
alignItems: 'center',
|
|
169
|
+
gap: '8px',
|
|
170
|
+
marginBottom: '8px',
|
|
171
|
+
}, children: [_jsx("span", { style: {
|
|
172
|
+
fontSize: '12px',
|
|
173
|
+
fontWeight: 500,
|
|
174
|
+
minWidth: '80px',
|
|
175
|
+
color: '#555',
|
|
176
|
+
}, children: prop.key }), _jsx("div", { style: { flex: 1 }, children: _jsx(PropertyInput, { meta: prop, onChange: (newValue) => handlePropertyValueChange(prop.key, prop.value, newValue), disabled: disabled }) }), allowRemoveProperties && onRemoveProperty && (_jsx("button", { type: "button", onClick: () => onRemoveProperty(selectedNode.id, prop.key), disabled: disabled, style: {
|
|
177
|
+
padding: '4px 8px',
|
|
178
|
+
border: 'none',
|
|
179
|
+
background: 'transparent',
|
|
180
|
+
color: '#d32f2f',
|
|
181
|
+
cursor: disabled ? 'default' : 'pointer',
|
|
182
|
+
fontSize: '14px',
|
|
183
|
+
}, title: "Remove property", children: "\u00D7" }))] }, prop.key))) })), allowAddProperties && onAddProperty && (_jsxs("div", { style: {
|
|
184
|
+
padding: '12px',
|
|
185
|
+
backgroundColor: '#f5f5f5',
|
|
186
|
+
borderRadius: '4px',
|
|
187
|
+
marginTop: '8px',
|
|
188
|
+
}, children: [_jsxs("div", { style: { display: 'flex', gap: '8px', marginBottom: '8px' }, children: [_jsx("input", { type: "text", placeholder: "Property name", value: newPropertyKey, onChange: (e) => setNewPropertyKey(e.target.value), disabled: disabled, style: { ...inputStyles, flex: 1 } }), _jsxs("select", { value: newPropertyType, onChange: (e) => setNewPropertyType(e.target.value), disabled: disabled, style: { ...inputStyles, width: '80px' }, children: [_jsx("option", { value: "string", children: "Text" }), _jsx("option", { value: "number", children: "Number" }), _jsx("option", { value: "boolean", children: "Boolean" })] })] }), newPropertyType !== 'boolean' && (_jsx("input", { type: newPropertyType === 'number' ? 'number' : 'text', placeholder: "Value", value: newPropertyValue, onChange: (e) => setNewPropertyValue(e.target.value), disabled: disabled, style: { ...inputStyles, marginBottom: '8px' } })), newPropertyType === 'boolean' && (_jsxs("select", { value: newPropertyValue, onChange: (e) => setNewPropertyValue(e.target.value), disabled: disabled, style: { ...inputStyles, marginBottom: '8px' }, children: [_jsx("option", { value: "true", children: "True" }), _jsx("option", { value: "false", children: "False" })] })), _jsx("button", { type: "button", onClick: handleAddProperty, disabled: disabled || !newPropertyKey.trim(), style: {
|
|
189
|
+
width: '100%',
|
|
190
|
+
padding: '8px',
|
|
191
|
+
border: 'none',
|
|
192
|
+
borderRadius: '4px',
|
|
193
|
+
backgroundColor: newPropertyKey.trim() && !disabled ? '#1976d2' : '#ccc',
|
|
194
|
+
color: '#fff',
|
|
195
|
+
cursor: newPropertyKey.trim() && !disabled ? 'pointer' : 'default',
|
|
196
|
+
fontSize: '13px',
|
|
197
|
+
}, children: "+ Add Property" })] }))] })] }));
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=NodePropertiesPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodePropertiesPanel.js","sourceRoot":"","sources":["../../src/properties/NodePropertiesPanel.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;AAEH,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EACL,qBAAqB,GAKtB,MAAM,oBAAoB,CAAC;AAoD5B,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,MAAM,WAAW,GAAwB;IACvC,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,GAAG;IACf,KAAK,EAAE,MAAM;IACb,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,OAAO;CACjB,CAAC;AAEF,MAAM,WAAW,GAAwB;IACvC,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,MAAM;IAChB,YAAY,EAAE,KAAK;IACnB,MAAM,EAAE,gBAAgB;IACxB,eAAe,EAAE,MAAM;IACvB,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,YAAY;CACxB,CAAC;AAEF,MAAM,mBAAmB,GAAwB;IAC/C,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,GAAG;IACf,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,WAAW;IAC1B,aAAa,EAAE,OAAO;IACtB,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,MAAM;CAClB,CAAC;AAEF,MAAM,eAAe,GAAwB;IAC3C,Y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IACG,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Properties Module
|
|
3
|
+
*
|
|
4
|
+
* Components and utilities for displaying and editing node properties.
|
|
5
|
+
*/
|
|
6
|
+
export { NodePropertiesPanel } from './NodePropertiesPanel.js';
|
|
7
|
+
export type { NodePropertiesPanelProps, PropertyChange, } from './NodePropertiesPanel.js';
|
|
8
|
+
export { detectPropertyType, isEditableProperty, parsePropertyValue, extractPropertyFields, } from './propertyUtils.js';
|
|
9
|
+
export type { PropertyType, PropertyValue, PropertyFieldMeta, } from './propertyUtils.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/properties/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D,YAAY,EACV,wBAAwB,EACxB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,YAAY,EACZ,aAAa,EACb,iBAAiB,GAClB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Properties Module
|
|
3
|
+
*
|
|
4
|
+
* Components and utilities for displaying and editing node properties.
|
|
5
|
+
*/
|
|
6
|
+
// Components
|
|
7
|
+
export { NodePropertiesPanel } from './NodePropertiesPanel.js';
|
|
8
|
+
// Utilities
|
|
9
|
+
export { detectPropertyType, isEditableProperty, parsePropertyValue, extractPropertyFields, } from './propertyUtils.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/properties/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,aAAa;AACb,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAQ/D,YAAY;AACZ,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Property Utilities
|
|
3
|
+
*
|
|
4
|
+
* Utility functions for detecting property types, parsing values,
|
|
5
|
+
* and extracting property field metadata for the NodePropertiesPanel.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Supported property types
|
|
9
|
+
*/
|
|
10
|
+
export type PropertyType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'unknown';
|
|
11
|
+
/**
|
|
12
|
+
* Property values that can be edited inline
|
|
13
|
+
*/
|
|
14
|
+
export type PropertyValue = string | number | boolean | null | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Metadata about a property field for rendering
|
|
17
|
+
*/
|
|
18
|
+
export interface PropertyFieldMeta {
|
|
19
|
+
/** Property key name */
|
|
20
|
+
key: string;
|
|
21
|
+
/** Detected type of the value */
|
|
22
|
+
type: PropertyType;
|
|
23
|
+
/** Current value */
|
|
24
|
+
value: unknown;
|
|
25
|
+
/** Whether this property can be edited inline (string, number, boolean only) */
|
|
26
|
+
isEditable: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Detect the type of a property value
|
|
30
|
+
*
|
|
31
|
+
* @param value - The value to check
|
|
32
|
+
* @returns The detected property type
|
|
33
|
+
*/
|
|
34
|
+
export declare function detectPropertyType(value: unknown): PropertyType;
|
|
35
|
+
/**
|
|
36
|
+
* Check if a property value can be edited inline
|
|
37
|
+
*
|
|
38
|
+
* Only primitive types (string, number, boolean) are editable.
|
|
39
|
+
* Complex types (array, object) and null/undefined are not.
|
|
40
|
+
*
|
|
41
|
+
* @param value - The value to check
|
|
42
|
+
* @returns true if the value can be edited inline
|
|
43
|
+
*/
|
|
44
|
+
export declare function isEditableProperty(value: unknown): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Parse a string input to the correct property type
|
|
47
|
+
*
|
|
48
|
+
* @param input - The string input to parse
|
|
49
|
+
* @param targetType - The type to parse as
|
|
50
|
+
* @returns The parsed value
|
|
51
|
+
*/
|
|
52
|
+
export declare function parsePropertyValue(input: string, targetType: PropertyType): PropertyValue;
|
|
53
|
+
/**
|
|
54
|
+
* Extract property field metadata from a properties object
|
|
55
|
+
*
|
|
56
|
+
* @param properties - The properties object to extract from
|
|
57
|
+
* @returns Array of property field metadata
|
|
58
|
+
*/
|
|
59
|
+
export declare function extractPropertyFields(properties: Record<string, unknown> | undefined): PropertyFieldMeta[];
|
|
60
|
+
//# sourceMappingURL=propertyUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertyUtils.d.ts","sourceRoot":"","sources":["../../src/properties/propertyUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAE5F;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,iCAAiC;IACjC,IAAI,EAAE,YAAY,CAAC;IACnB,oBAAoB;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,gFAAgF;IAChF,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CA0B/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG1D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,GAAG,aAAa,CAoBzF;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC9C,iBAAiB,EAAE,CAWrB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Property Utilities
|
|
3
|
+
*
|
|
4
|
+
* Utility functions for detecting property types, parsing values,
|
|
5
|
+
* and extracting property field metadata for the NodePropertiesPanel.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Detect the type of a property value
|
|
9
|
+
*
|
|
10
|
+
* @param value - The value to check
|
|
11
|
+
* @returns The detected property type
|
|
12
|
+
*/
|
|
13
|
+
export function detectPropertyType(value) {
|
|
14
|
+
if (value === null || value === undefined) {
|
|
15
|
+
return 'unknown';
|
|
16
|
+
}
|
|
17
|
+
if (typeof value === 'string') {
|
|
18
|
+
return 'string';
|
|
19
|
+
}
|
|
20
|
+
if (typeof value === 'number') {
|
|
21
|
+
return 'number';
|
|
22
|
+
}
|
|
23
|
+
if (typeof value === 'boolean') {
|
|
24
|
+
return 'boolean';
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(value)) {
|
|
27
|
+
return 'array';
|
|
28
|
+
}
|
|
29
|
+
if (typeof value === 'object') {
|
|
30
|
+
return 'object';
|
|
31
|
+
}
|
|
32
|
+
return 'unknown';
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Check if a property value can be edited inline
|
|
36
|
+
*
|
|
37
|
+
* Only primitive types (string, number, boolean) are editable.
|
|
38
|
+
* Complex types (array, object) and null/undefined are not.
|
|
39
|
+
*
|
|
40
|
+
* @param value - The value to check
|
|
41
|
+
* @returns true if the value can be edited inline
|
|
42
|
+
*/
|
|
43
|
+
export function isEditableProperty(value) {
|
|
44
|
+
const type = detectPropertyType(value);
|
|
45
|
+
return type === 'string' || type === 'number' || type === 'boolean';
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Parse a string input to the correct property type
|
|
49
|
+
*
|
|
50
|
+
* @param input - The string input to parse
|
|
51
|
+
* @param targetType - The type to parse as
|
|
52
|
+
* @returns The parsed value
|
|
53
|
+
*/
|
|
54
|
+
export function parsePropertyValue(input, targetType) {
|
|
55
|
+
switch (targetType) {
|
|
56
|
+
case 'string':
|
|
57
|
+
return input;
|
|
58
|
+
case 'number': {
|
|
59
|
+
const num = parseFloat(input);
|
|
60
|
+
return isNaN(num) ? 0 : num;
|
|
61
|
+
}
|
|
62
|
+
case 'boolean':
|
|
63
|
+
return input === 'true' || input === '1';
|
|
64
|
+
// Non-editable types return input as string (for display purposes)
|
|
65
|
+
case 'object':
|
|
66
|
+
case 'array':
|
|
67
|
+
case 'unknown':
|
|
68
|
+
default:
|
|
69
|
+
return input;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Extract property field metadata from a properties object
|
|
74
|
+
*
|
|
75
|
+
* @param properties - The properties object to extract from
|
|
76
|
+
* @returns Array of property field metadata
|
|
77
|
+
*/
|
|
78
|
+
export function extractPropertyFields(properties) {
|
|
79
|
+
if (!properties) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
return Object.entries(properties).map(([key, value]) => ({
|
|
83
|
+
key,
|
|
84
|
+
type: detectPropertyType(value),
|
|
85
|
+
value,
|
|
86
|
+
isEditable: isEditableProperty(value),
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=propertyUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertyUtils.js","sourceRoot":"","sources":["../../src/properties/propertyUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0BH;;;;;GAKG;AACH,MAAM,UAA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C,mEAAmE;QACnE,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,SAAS,CAAC;QACf;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAA+C;IAE/C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QACvD,GAAG;QACH,IAAI,EAAE,kBAAkB,CAAC,KAAK,CAAC;QAC/B,KAAK;QACL,UAAU,EAAE,kBAAkB,CAAC,KAAK,CAAC;KACtC,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FontSettingsForm Component (CORAL-REQ-012)
|
|
3
|
+
*
|
|
4
|
+
* Form for configuring diagram font settings:
|
|
5
|
+
* - Font family preset selection
|
|
6
|
+
* - Font size preset or custom
|
|
7
|
+
* - Font weight toggle
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { type DiagramFontSettings } from '../file/schema.js';
|
|
11
|
+
/**
|
|
12
|
+
* Props for FontSettingsForm
|
|
13
|
+
*/
|
|
14
|
+
export interface FontSettingsFormProps {
|
|
15
|
+
/** Current font settings */
|
|
16
|
+
settings: DiagramFontSettings;
|
|
17
|
+
/** Callback when settings change */
|
|
18
|
+
onChange: (settings: DiagramFontSettings) => void;
|
|
19
|
+
/** Callback when Apply is clicked */
|
|
20
|
+
onApply?: () => void;
|
|
21
|
+
/** Whether the form is disabled */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* FontSettingsForm component
|
|
26
|
+
*/
|
|
27
|
+
export declare function FontSettingsForm({ settings, onChange, onApply, disabled, }: FontSettingsFormProps): React.ReactElement;
|
|
28
|
+
//# sourceMappingURL=FontSettingsForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontSettingsForm.d.ts","sourceRoot":"","sources":["../../src/settings/FontSettingsForm.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAEL,KAAK,mBAAmB,EAIzB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,4BAA4B;IAC5B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,oCAAoC;IACpC,QAAQ,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA2CD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAgB,GACjB,EAAE,qBAAqB,GAAG,KAAK,CAAC,YAAY,CAuN5C"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* FontSettingsForm Component (CORAL-REQ-012)
|
|
4
|
+
*
|
|
5
|
+
* Form for configuring diagram font settings:
|
|
6
|
+
* - Font family preset selection
|
|
7
|
+
* - Font size preset or custom
|
|
8
|
+
* - Font weight toggle
|
|
9
|
+
*/
|
|
10
|
+
import { useCallback, useMemo } from 'react';
|
|
11
|
+
import { FONT_FAMILY_PRESETS, FONT_SIZE_PRESETS, } from '../file/schema.js';
|
|
12
|
+
/**
|
|
13
|
+
* Shared input styles
|
|
14
|
+
*/
|
|
15
|
+
const inputStyles = {
|
|
16
|
+
padding: '6px 10px',
|
|
17
|
+
fontSize: '13px',
|
|
18
|
+
borderRadius: '4px',
|
|
19
|
+
border: '1px solid #ccc',
|
|
20
|
+
backgroundColor: '#fff',
|
|
21
|
+
width: '100%',
|
|
22
|
+
boxSizing: 'border-box',
|
|
23
|
+
};
|
|
24
|
+
const labelStyles = {
|
|
25
|
+
fontSize: '12px',
|
|
26
|
+
fontWeight: 500,
|
|
27
|
+
color: '#555',
|
|
28
|
+
marginBottom: '4px',
|
|
29
|
+
display: 'block',
|
|
30
|
+
};
|
|
31
|
+
const formGroupStyles = {
|
|
32
|
+
marginBottom: '12px',
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Find the preset ID that matches a font family, or 'custom'
|
|
36
|
+
*/
|
|
37
|
+
function findFontFamilyPresetId(family) {
|
|
38
|
+
const preset = FONT_FAMILY_PRESETS.find((p) => p.family === family);
|
|
39
|
+
return preset?.id ?? 'custom';
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Find the preset ID that matches a font size, or 'custom'
|
|
43
|
+
*/
|
|
44
|
+
function findFontSizePresetId(size) {
|
|
45
|
+
const preset = FONT_SIZE_PRESETS.find((p) => p.size === size);
|
|
46
|
+
return preset?.id ?? 'custom';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* FontSettingsForm component
|
|
50
|
+
*/
|
|
51
|
+
export function FontSettingsForm({ settings, onChange, onApply, disabled = false, }) {
|
|
52
|
+
const fontSettings = settings.default;
|
|
53
|
+
// Determine current preset selections
|
|
54
|
+
const currentFamilyPreset = useMemo(() => findFontFamilyPresetId(fontSettings.family), [fontSettings.family]);
|
|
55
|
+
const currentSizePreset = useMemo(() => findFontSizePresetId(fontSettings.size), [fontSettings.size]);
|
|
56
|
+
// Handle font family change
|
|
57
|
+
const handleFamilyChange = useCallback((e) => {
|
|
58
|
+
const presetId = e.target.value;
|
|
59
|
+
const preset = FONT_FAMILY_PRESETS.find((p) => p.id === presetId);
|
|
60
|
+
if (preset) {
|
|
61
|
+
onChange({
|
|
62
|
+
...settings,
|
|
63
|
+
default: { ...fontSettings, family: preset.family },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, [settings, fontSettings, onChange]);
|
|
67
|
+
// Handle font size preset change
|
|
68
|
+
const handleSizePresetChange = useCallback((e) => {
|
|
69
|
+
const presetId = e.target.value;
|
|
70
|
+
if (presetId === 'custom') {
|
|
71
|
+
// Keep current size when switching to custom
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const preset = FONT_SIZE_PRESETS.find((p) => p.id === presetId);
|
|
75
|
+
if (preset) {
|
|
76
|
+
onChange({
|
|
77
|
+
...settings,
|
|
78
|
+
default: { ...fontSettings, size: preset.size },
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}, [settings, fontSettings, onChange]);
|
|
82
|
+
// Handle custom font size change
|
|
83
|
+
const handleCustomSizeChange = useCallback((e) => {
|
|
84
|
+
const size = parseInt(e.target.value, 10);
|
|
85
|
+
if (!isNaN(size) && size >= 8 && size <= 32) {
|
|
86
|
+
onChange({
|
|
87
|
+
...settings,
|
|
88
|
+
default: { ...fontSettings, size },
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}, [settings, fontSettings, onChange]);
|
|
92
|
+
// Handle font weight change
|
|
93
|
+
const handleWeightChange = useCallback((e) => {
|
|
94
|
+
const weight = e.target.value === 'bold' ? 'bold' : 'normal';
|
|
95
|
+
onChange({
|
|
96
|
+
...settings,
|
|
97
|
+
default: { ...fontSettings, weight },
|
|
98
|
+
});
|
|
99
|
+
}, [settings, fontSettings, onChange]);
|
|
100
|
+
// Handle line height change
|
|
101
|
+
const handleLineHeightChange = useCallback((e) => {
|
|
102
|
+
const lineHeight = parseFloat(e.target.value);
|
|
103
|
+
if (!isNaN(lineHeight) && lineHeight >= 1.0 && lineHeight <= 2.5) {
|
|
104
|
+
onChange({
|
|
105
|
+
...settings,
|
|
106
|
+
default: { ...fontSettings, lineHeight },
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}, [settings, fontSettings, onChange]);
|
|
110
|
+
return (_jsxs("div", { style: { padding: '12px' }, children: [_jsxs("div", { style: formGroupStyles, children: [_jsx("label", { style: labelStyles, children: "Font Family" }), _jsx("select", { value: currentFamilyPreset, onChange: handleFamilyChange, disabled: disabled, style: inputStyles, "aria-label": "Font Family", children: FONT_FAMILY_PRESETS.map((preset) => (_jsx("option", { value: preset.id, children: preset.name }, preset.id))) }), _jsx("div", { style: {
|
|
111
|
+
fontSize: '13px',
|
|
112
|
+
marginTop: '6px',
|
|
113
|
+
padding: '8px',
|
|
114
|
+
backgroundColor: '#f5f5f5',
|
|
115
|
+
borderRadius: '4px',
|
|
116
|
+
fontFamily: fontSettings.family,
|
|
117
|
+
}, children: "The quick brown fox jumps over the lazy dog" })] }), _jsxs("div", { style: formGroupStyles, children: [_jsx("label", { style: labelStyles, children: "Font Size" }), _jsxs("div", { style: { display: 'flex', gap: '8px', alignItems: 'center' }, children: [_jsxs("select", { value: currentSizePreset, onChange: handleSizePresetChange, disabled: disabled, style: { ...inputStyles, flex: 1 }, "aria-label": "Font Size Preset", children: [FONT_SIZE_PRESETS.map((preset) => (_jsxs("option", { value: preset.id, children: [preset.name, " (", preset.size, "px)"] }, preset.id))), _jsx("option", { value: "custom", children: "Custom" })] }), _jsx("input", { type: "number", min: 8, max: 32, value: fontSettings.size, onChange: handleCustomSizeChange, disabled: disabled, style: { ...inputStyles, width: '70px', flex: 'none' }, "aria-label": "Custom Font Size" }), _jsx("span", { style: { fontSize: '12px', color: '#666' }, children: "px" })] })] }), _jsxs("div", { style: formGroupStyles, children: [_jsx("label", { style: labelStyles, children: "Font Weight" }), _jsxs("select", { value: fontSettings.weight === 'bold' || (typeof fontSettings.weight === 'number' && fontSettings.weight >= 600) ? 'bold' : 'normal', onChange: handleWeightChange, disabled: disabled, style: inputStyles, "aria-label": "Font Weight", children: [_jsx("option", { value: "normal", children: "Normal" }), _jsx("option", { value: "bold", children: "Bold" })] })] }), _jsxs("div", { style: formGroupStyles, children: [_jsx("label", { style: labelStyles, children: "Line Height" }), _jsx("input", { type: "range", min: "1.0", max: "2.0", step: "0.1", value: fontSettings.lineHeight, onChange: handleLineHeightChange, disabled: disabled, style: { width: '100%' }, "aria-label": "Line Height" }), _jsx("div", { style: { fontSize: '11px', color: '#666', textAlign: 'right' }, children: fontSettings.lineHeight.toFixed(1) })] }), onApply && (_jsx("div", { style: { marginTop: '16px' }, children: _jsx("button", { type: "button", onClick: onApply, disabled: disabled, style: {
|
|
118
|
+
padding: '8px 16px',
|
|
119
|
+
fontSize: '13px',
|
|
120
|
+
fontWeight: 500,
|
|
121
|
+
borderRadius: '4px',
|
|
122
|
+
border: 'none',
|
|
123
|
+
backgroundColor: disabled ? '#ccc' : '#1976d2',
|
|
124
|
+
color: '#fff',
|
|
125
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
126
|
+
width: '100%',
|
|
127
|
+
}, children: "Apply Font Changes" }) }))] }));
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=FontSettingsForm.js.map
|