| License | BSD3-style (see the file LICENSE) |
|---|---|
| Safe Haskell | None |
| Language | Haskell2010 |
Miso.Flow.Utils.Store
Description
Pure port of utils/store.ts from @xyflow/system: turning user
nodes into internal nodes (adoptUserNodes), keeping absolute
positions up to date, parent expansion, and the connection lookup.
The only part of the original left on the JavaScript side of the
bridge is updateNodeInternals' DOM measurement; its results are
merged back with applyMeasurement.
Synopsis
- data UpdateNodesOptions n = UpdateNodesOptions {
- unoNodeOrigin :: !NodeOrigin
- unoNodeExtent :: !CoordinateExtent
- unoElevateNodesOnSelect :: !Bool
- unoZIndexMode :: !ZIndexMode
- unoDefaults :: Node n -> Node n
- unoCheckEquality :: !Bool
- defaultUpdateNodesOptions :: UpdateNodesOptions n
- data AdoptUserNodesReturn = AdoptUserNodesReturn {}
- adoptUserNodes :: Eq n => [Node n] -> NodeLookup n -> UpdateNodesOptions n -> (NodeLookup n, ParentLookup n, AdoptUserNodesReturn)
- updateAbsolutePositions :: NodeLookup n -> UpdateNodesOptions n -> NodeLookup n
- isManualZIndexMode :: ZIndexMode -> Bool
- data ParentExpandChild = ParentExpandChild {}
- handleExpandParent :: [ParentExpandChild] -> NodeLookup n -> ParentLookup n -> NodeOrigin -> [NodeChange n]
- updateConnectionLookup :: [Edge e] -> (ConnectionLookup, EdgeLookup e)
- applyMeasurement :: [NodeMeasurement] -> NodeLookup n -> NodeLookup n
- data NodeMeasurement = NodeMeasurement {
- nmId :: !NodeId
- nmDimensions :: !Dimensions
- nmHandleBounds :: !(Maybe NodeHandleBounds)
- nmPositionAbsolute :: !(Maybe XYPosition)
Documentation
data UpdateNodesOptions n Source #
Options shared by adoptUserNodes and updateAbsolutePositions;
port of UpdateNodesOptions (the defaults field is a function here).
Constructors
| UpdateNodesOptions | |
Fields
| |
data AdoptUserNodesReturn Source #
Constructors
| AdoptUserNodesReturn | |
Fields | |
Instances
| Show AdoptUserNodesReturn Source # | |
Defined in Miso.Flow.Utils.Store Methods showsPrec :: Int -> AdoptUserNodesReturn -> ShowS # show :: AdoptUserNodesReturn -> String # showList :: [AdoptUserNodesReturn] -> ShowS # | |
| Eq AdoptUserNodesReturn Source # | |
Defined in Miso.Flow.Utils.Store Methods (==) :: AdoptUserNodesReturn -> AdoptUserNodesReturn -> Bool # (/=) :: AdoptUserNodesReturn -> AdoptUserNodesReturn -> Bool # | |
Arguments
| :: Eq n | |
| => [Node n] | |
| -> NodeLookup n | previous lookup (pass |
| -> UpdateNodesOptions n | |
| -> (NodeLookup n, ParentLookup n, AdoptUserNodesReturn) |
Build the internal NodeLookup / ParentLookup from user nodes;
port of adoptUserNodes. The previous lookup preserves measured
dimensions and DOM-measured handle bounds across updates (standing in
for the TS reference-equality cache, using Eq instead).
updateAbsolutePositions :: NodeLookup n -> UpdateNodesOptions n -> NodeLookup n Source #
Refresh positionAbsolute of every node in the lookup; port of
updateAbsolutePositions.
isManualZIndexMode :: ZIndexMode -> Bool Source #
data ParentExpandChild Source #
A child that may cause its parent to expand.
Constructors
| ParentExpandChild | |
Instances
| Show ParentExpandChild Source # | |
Defined in Miso.Flow.Utils.Store Methods showsPrec :: Int -> ParentExpandChild -> ShowS # show :: ParentExpandChild -> String # showList :: [ParentExpandChild] -> ShowS # | |
| Eq ParentExpandChild Source # | |
Defined in Miso.Flow.Utils.Store Methods (==) :: ParentExpandChild -> ParentExpandChild -> Bool # (/=) :: ParentExpandChild -> ParentExpandChild -> Bool # | |
handleExpandParent :: [ParentExpandChild] -> NodeLookup n -> ParentLookup n -> NodeOrigin -> [NodeChange n] Source #
Changes needed to expand parents so the given children fit; port of
handleExpandParent.
updateConnectionLookup :: [Edge e] -> (ConnectionLookup, EdgeLookup e) Source #
Build the ConnectionLookup and EdgeLookup from edges; port of
updateConnectionLookup.
applyMeasurement :: [NodeMeasurement] -> NodeLookup n -> NodeLookup n Source #
Merge measured dimensions and handle bounds into the lookup (the
Haskell half of updateNodeInternals).
data NodeMeasurement Source #
DOM measurement of one node, as reported over the bridge by the
JavaScript side's updateNodeInternals.
Constructors
| NodeMeasurement | |
Fields
| |
Instances
| Show NodeMeasurement Source # | |
Defined in Miso.Flow.Utils.Store Methods showsPrec :: Int -> NodeMeasurement -> ShowS # show :: NodeMeasurement -> String # showList :: [NodeMeasurement] -> ShowS # | |
| Eq NodeMeasurement Source # | |
Defined in Miso.Flow.Utils.Store Methods (==) :: NodeMeasurement -> NodeMeasurement -> Bool # (/=) :: NodeMeasurement -> NodeMeasurement -> Bool # | |