@likec4/diagram 1.17.1 → 1.19.0
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 +1 -1
- package/dist/LikeC4CustomColors.d.ts +7 -0
- package/dist/LikeC4CustomColors.js +30 -0
- package/dist/LikeC4Diagram.css.d.ts +5 -0
- package/dist/LikeC4Diagram.css.js +13 -0
- package/dist/LikeC4Diagram.d.ts +6 -0
- package/dist/LikeC4Diagram.js +194 -0
- package/dist/LikeC4Diagram.props.d.ts +166 -0
- package/dist/LikeC4ModelProvider.d.ts +9 -0
- package/dist/LikeC4ModelProvider.js +12 -0
- package/dist/LikeC4Search.css.d.ts +1 -0
- package/dist/LikeC4Search.css.js +5 -0
- package/dist/LikeC4Search.d.ts +2 -0
- package/dist/LikeC4Search.js +96 -0
- package/dist/StaticLikeC4Diagram.d.ts +3 -0
- package/dist/StaticLikeC4Diagram.js +41 -0
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/controls/Text.d.ts +2 -0
- package/dist/controls/Text.js +7 -0
- package/dist/controls/action-button-bar/ActionButtonBar.css.d.ts +1 -0
- package/dist/controls/action-button-bar/ActionButtonBar.css.js +5 -0
- package/dist/controls/action-button-bar/ActionButtonBar.d.ts +9 -0
- package/dist/controls/action-button-bar/ActionButtonBar.js +100 -0
- package/dist/controls/action-button-bar/useActionButtonBarCtx.d.ts +10 -0
- package/dist/controls/action-button-bar/useActionButtonBarCtx.js +9 -0
- package/dist/controls/action-buttons/ActionButton.css.d.ts +1 -0
- package/dist/controls/action-buttons/ActionButton.css.js +5 -0
- package/dist/controls/action-buttons/ActionButton.d.ts +9 -0
- package/dist/controls/action-buttons/ActionButton.js +66 -0
- package/dist/controls/action-buttons/ActionButtons.d.ts +12 -0
- package/dist/controls/action-buttons/ActionButtons.js +99 -0
- package/dist/globals.css.d.ts +1 -0
- package/dist/globals.css.js +92 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/useDiagramState.d.ts +6 -0
- package/dist/hooks/useDiagramState.js +27 -0
- package/dist/hooks/useMantinePortalProps.d.ts +9 -0
- package/dist/hooks/useMantinePortalProps.js +9 -0
- package/dist/hooks/useSetState.d.ts +2 -0
- package/dist/hooks/useSetState.js +19 -0
- package/dist/hooks/useUpdateEffect.d.ts +4 -0
- package/dist/hooks/useUpdateEffect.js +32 -0
- package/dist/hooks/useXYFlow.d.ts +270 -0
- package/dist/hooks/useXYFlow.js +20 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +25 -0
- package/dist/likec4model/LikeC4ModelContext.d.ts +3 -0
- package/dist/likec4model/LikeC4ModelContext.js +5 -0
- package/dist/likec4model/index.d.ts +2 -0
- package/dist/likec4model/useLikeC4ElementsTree.d.ts +12 -0
- package/dist/likec4model/useLikeC4ElementsTree.js +25 -0
- package/dist/likec4model/useLikeC4Model.d.ts +20 -0
- package/dist/likec4model/useLikeC4Model.js +55 -0
- package/dist/overlays/OverlayContext.d.ts +10 -0
- package/dist/overlays/OverlayContext.js +9 -0
- package/dist/overlays/Overlays.css.d.ts +3 -0
- package/dist/overlays/Overlays.css.js +7 -0
- package/dist/overlays/Overlays.d.ts +2 -0
- package/dist/overlays/Overlays.js +137 -0
- package/dist/overlays/edge-details/EdgeDetailsXYFlow.d.ts +5 -0
- package/dist/overlays/edge-details/EdgeDetailsXYFlow.js +185 -0
- package/dist/overlays/edge-details/SelectEdge.css.d.ts +7 -0
- package/dist/overlays/edge-details/SelectEdge.css.js +17 -0
- package/dist/overlays/edge-details/SelectEdge.d.ts +5 -0
- package/dist/overlays/edge-details/SelectEdge.js +129 -0
- package/dist/overlays/edge-details/_types.d.ts +14 -0
- package/dist/overlays/edge-details/use-layouted-edge-details.d.ts +21 -0
- package/dist/overlays/edge-details/use-layouted-edge-details.js +270 -0
- package/dist/overlays/edge-details/xyflow/CompoundNode.d.ts +5 -0
- package/dist/overlays/edge-details/xyflow/CompoundNode.js +76 -0
- package/dist/overlays/edge-details/xyflow/ElementNode.d.ts +5 -0
- package/dist/overlays/edge-details/xyflow/ElementNode.js +159 -0
- package/dist/overlays/edge-details/xyflow/RelationshipEdge.d.ts +3 -0
- package/dist/overlays/edge-details/xyflow/RelationshipEdge.js +84 -0
- package/dist/overlays/edge-details/xyflow/styles.css.d.ts +9 -0
- package/dist/overlays/edge-details/xyflow/styles.css.js +21 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.d.ts +16 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.js +33 -0
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +7 -0
- package/dist/overlays/element-details/ElementDetailsCard.js +484 -0
- package/dist/overlays/element-details/TabPanelDeployments.css.d.ts +4 -0
- package/dist/overlays/element-details/TabPanelDeployments.css.js +11 -0
- package/dist/overlays/element-details/TabPanelDeployments.d.ts +7 -0
- package/dist/overlays/element-details/TabPanelDeployments.js +173 -0
- package/dist/overlays/element-details/TabPanelRelationships.css.d.ts +5 -0
- package/dist/overlays/element-details/TabPanelRelationships.css.js +11 -0
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +8 -0
- package/dist/overlays/element-details/TabPanelRelationships.js +157 -0
- package/dist/overlays/element-details/TabPanelStructure.css.d.ts +2 -0
- package/dist/overlays/element-details/TabPanelStructure.css.js +7 -0
- package/dist/overlays/element-details/TabPanelStructure.d.ts +25 -0
- package/dist/overlays/element-details/TabPanelStructure.js +91 -0
- package/dist/overlays/index.d.ts +1 -0
- package/dist/overlays/relationships-of/RelationshipsOverlay.d.ts +5 -0
- package/dist/overlays/relationships-of/RelationshipsOverlay.js +193 -0
- package/dist/overlays/relationships-of/RelationshipsXYFlow.d.ts +19 -0
- package/dist/overlays/relationships-of/RelationshipsXYFlow.js +290 -0
- package/dist/overlays/relationships-of/SelectElement.css.d.ts +2 -0
- package/dist/overlays/relationships-of/SelectElement.css.js +7 -0
- package/dist/overlays/relationships-of/SelectElement.d.ts +7 -0
- package/dist/overlays/relationships-of/SelectElement.js +126 -0
- package/dist/overlays/relationships-of/_types.d.ts +28 -0
- package/dist/overlays/relationships-of/use-layouted-relationships.d.ts +22 -0
- package/dist/overlays/relationships-of/use-layouted-relationships.js +496 -0
- package/dist/overlays/relationships-of/xyflow/CompoundNode.d.ts +6 -0
- package/dist/overlays/relationships-of/xyflow/CompoundNode.js +120 -0
- package/dist/overlays/relationships-of/xyflow/ElementNode.d.ts +6 -0
- package/dist/overlays/relationships-of/xyflow/ElementNode.js +194 -0
- package/dist/overlays/relationships-of/xyflow/EmptyNode.d.ts +5 -0
- package/dist/overlays/relationships-of/xyflow/EmptyNode.js +18 -0
- package/dist/overlays/relationships-of/xyflow/RelationshipEdge.d.ts +3 -0
- package/dist/overlays/relationships-of/xyflow/RelationshipEdge.js +123 -0
- package/dist/overlays/relationships-of/xyflow/styles.css.d.ts +14 -0
- package/dist/overlays/relationships-of/xyflow/styles.css.js +24 -0
- package/dist/overlays/shared/xyflow/RelationshipEdge.css.d.ts +4 -0
- package/dist/overlays/shared/xyflow/RelationshipEdge.css.js +12 -0
- package/dist/overlays/shared/xyflow/_types.d.ts +77 -0
- package/dist/state/DiagramContext.d.ts +1609 -0
- package/dist/state/DiagramContext.js +101 -0
- package/dist/state/aligners.d.ts +42 -0
- package/dist/state/aligners.js +349 -0
- package/dist/state/diagram-to-xyflow.d.ts +11 -0
- package/dist/state/diagram-to-xyflow.js +113 -0
- package/dist/state/diagramStore.d.ts +1705 -0
- package/dist/state/diagramStore.js +808 -0
- package/dist/state/diagramStore.layout.d.ts +4 -0
- package/dist/state/diagramStore.layout.js +56 -0
- package/dist/style.css +1 -0
- package/dist/theme-vars.css.d.ts +72 -0
- package/dist/theme-vars.css.js +6 -0
- package/dist/theme-vars.css.ts.vanilla.css.js +1 -0
- package/dist/theme-vars.d.ts +3 -0
- package/dist/theme-vars.js +5 -0
- package/dist/ui/DiagramTitlePanel.css.d.ts +4 -0
- package/dist/ui/DiagramTitlePanel.css.js +11 -0
- package/dist/ui/DiagramTitlePanel.d.ts +1 -0
- package/dist/ui/DiagramTitlePanel.js +159 -0
- package/dist/ui/DynamicViewWalkthrough.css.d.ts +4 -0
- package/dist/ui/DynamicViewWalkthrough.css.js +11 -0
- package/dist/ui/DynamicViewWalkthrough.d.ts +1 -0
- package/dist/ui/DynamicViewWalkthrough.js +156 -0
- package/dist/ui/EnsureMantine.d.ts +7 -0
- package/dist/ui/EnsureMantine.js +14 -0
- package/dist/ui/FramerMotionConfig.d.ts +2 -0
- package/dist/ui/FramerMotionConfig.js +14 -0
- package/dist/ui/Link.d.ts +4 -0
- package/dist/ui/Link.js +36 -0
- package/dist/ui/notation/NotationPanel.css.d.ts +6 -0
- package/dist/ui/notation/NotationPanel.css.js +16 -0
- package/dist/ui/notation/NotationPanel.d.ts +1 -0
- package/dist/ui/notation/NotationPanel.js +250 -0
- package/dist/ui/notation/index.d.ts +1 -0
- package/dist/ui/top-left/ChangeAutoLayoutButton.d.ts +2 -0
- package/dist/ui/top-left/ChangeAutoLayoutButton.js +159 -0
- package/dist/ui/top-left/ManualLayoutToolsButton.d.ts +2 -0
- package/dist/ui/top-left/ManualLayoutToolsButton.js +137 -0
- package/dist/ui/top-left/TopLeftPanel.d.ts +4 -0
- package/dist/ui/top-left/TopLeftPanel.js +211 -0
- package/dist/ui/top-left/_shared.d.ts +7 -0
- package/dist/ui/top-left/_shared.js +22 -0
- package/dist/ui/top-left/styles.css.d.ts +8 -0
- package/dist/ui/top-left/styles.css.js +17 -0
- package/dist/utils/types.d.ts +8 -0
- package/dist/utils/vector.d.ts +24 -0
- package/dist/utils/vector.js +55 -0
- package/dist/xyflow/EdgeMarkers.d.ts +12 -0
- package/dist/xyflow/EdgeMarkers.js +192 -0
- package/dist/xyflow/FitviewOnDiagramChange.d.ts +4 -0
- package/dist/xyflow/FitviewOnDiagramChange.js +72 -0
- package/dist/xyflow/SelectEdgesOnNodeFocus.d.ts +1 -0
- package/dist/xyflow/SelectEdgesOnNodeFocus.js +96 -0
- package/dist/xyflow/XYFlow.d.ts +8 -0
- package/dist/xyflow/XYFlow.js +145 -0
- package/dist/xyflow/XYFlowBackground.d.ts +10 -0
- package/dist/xyflow/XYFlowBackground.js +25 -0
- package/dist/xyflow/XYFlowInner.d.ts +8 -0
- package/dist/xyflow/XYFlowInner.js +41 -0
- package/dist/xyflow/const.d.ts +7 -0
- package/dist/xyflow/const.js +12 -0
- package/dist/xyflow/edges/EdgeLabel.d.ts +7 -0
- package/dist/xyflow/edges/EdgeLabel.js +160 -0
- package/dist/xyflow/edges/RelationshipEdge.d.ts +6 -0
- package/dist/xyflow/edges/RelationshipEdge.js +443 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.css.d.ts +4 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.css.js +11 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.d.ts +13 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.js +211 -0
- package/dist/xyflow/edges/edges.css.d.ts +17 -0
- package/dist/xyflow/edges/edges.css.js +37 -0
- package/dist/xyflow/edges/utils.d.ts +16 -0
- package/dist/xyflow/edges/utils.js +24 -0
- package/dist/xyflow/nodes/AnimateVariants.d.ts +1313 -0
- package/dist/xyflow/nodes/AnimateVariants.js +123 -0
- package/dist/xyflow/nodes/Node.css.d.ts +3 -0
- package/dist/xyflow/nodes/Node.css.js +9 -0
- package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +14 -0
- package/dist/xyflow/nodes/compound/CompoundNode.css.js +27 -0
- package/dist/xyflow/nodes/compound/CompoundNode.d.ts +6 -0
- package/dist/xyflow/nodes/compound/CompoundNode.js +216 -0
- package/dist/xyflow/nodes/compound/index.d.ts +1 -0
- package/dist/xyflow/nodes/element/ElementLink.css.d.ts +3 -0
- package/dist/xyflow/nodes/element/ElementLink.d.ts +6 -0
- package/dist/xyflow/nodes/element/ElementNode.d.ts +6 -0
- package/dist/xyflow/nodes/element/ElementNode.js +190 -0
- package/dist/xyflow/nodes/element/ElementShapeSvg.d.ts +17 -0
- package/dist/xyflow/nodes/element/ElementShapeSvg.js +175 -0
- package/dist/xyflow/nodes/element/element.css.d.ts +18 -0
- package/dist/xyflow/nodes/element/element.css.js +31 -0
- package/dist/xyflow/nodes/element/index.d.ts +1 -0
- package/dist/xyflow/nodes/shared/ElementIcon.d.ts +8 -0
- package/dist/xyflow/nodes/shared/ElementIcon.js +38 -0
- package/dist/xyflow/nodes/shared/Toolbar.d.ts +9 -0
- package/dist/xyflow/nodes/shared/Toolbar.js +436 -0
- package/dist/xyflow/types.d.ts +36 -0
- package/dist/xyflow/useLayoutConstraints.d.ts +42 -0
- package/dist/xyflow/useLayoutConstraints.js +226 -0
- package/dist/xyflow/useXYFlowEvents.d.ts +160 -0
- package/dist/xyflow/useXYFlowEvents.js +275 -0
- package/dist/xyflow/utils.d.ts +22 -0
- package/dist/xyflow/utils.js +72 -0
- package/package.json +40 -31
- package/src/LikeC4Diagram.props.ts +21 -12
- package/src/LikeC4Diagram.tsx +8 -10
- package/src/LikeC4Search.css.ts +12 -0
- package/src/LikeC4Search.tsx +45 -93
- package/src/controls/Text.ts +5 -0
- package/src/controls/action-button-bar/ActionButtonBar.css.ts +13 -0
- package/src/controls/action-button-bar/ActionButtonBar.tsx +138 -0
- package/src/controls/action-button-bar/useActionButtonBarCtx.ts +13 -0
- package/src/controls/action-buttons/ActionButton.css.ts +29 -0
- package/src/controls/action-buttons/ActionButton.tsx +66 -0
- package/src/controls/action-buttons/ActionButtons.tsx +138 -0
- package/src/hooks/useDiagramState.ts +8 -3
- package/src/hooks/useXYFlow.ts +9 -8
- package/src/index.ts +12 -6
- package/src/likec4model/index.ts +12 -2
- package/src/likec4model/useLikeC4ElementsTree.ts +6 -13
- package/src/likec4model/useLikeC4Model.ts +21 -11
- package/src/overlays/Overlays.tsx +96 -63
- package/src/overlays/edge-details/EdgeDetailsXYFlow.tsx +18 -10
- package/src/overlays/edge-details/_types.ts +13 -33
- package/src/overlays/edge-details/use-layouted-edge-details.ts +35 -26
- package/src/overlays/edge-details/xyflow/CompoundNode.tsx +3 -11
- package/src/overlays/edge-details/xyflow/ElementNode.tsx +8 -13
- package/src/overlays/edge-details/xyflow/RelationshipEdge.tsx +7 -7
- package/src/overlays/edge-details/xyflow/styles.css.ts +1 -59
- package/src/overlays/element-details/ElementDetailsCard.tsx +91 -78
- package/src/overlays/element-details/TabPanelDeployments.css.ts +69 -0
- package/src/overlays/element-details/TabPanelDeployments.tsx +217 -0
- package/src/overlays/element-details/TabPanelRelationships.tsx +8 -9
- package/src/overlays/element-details/TabPanelStructure.tsx +10 -10
- package/src/overlays/relationships-of/RelationshipsOverlay.tsx +1 -1
- package/src/overlays/relationships-of/RelationshipsXYFlow.tsx +26 -34
- package/src/overlays/relationships-of/SelectElement.tsx +2 -2
- package/src/overlays/relationships-of/_types.ts +20 -58
- package/src/overlays/relationships-of/use-layouted-relationships.ts +54 -59
- package/src/overlays/relationships-of/xyflow/CompoundNode.tsx +10 -16
- package/src/overlays/relationships-of/xyflow/ElementNode.tsx +24 -21
- package/src/overlays/relationships-of/xyflow/EmptyNode.tsx +4 -7
- package/src/overlays/relationships-of/xyflow/RelationshipEdge.tsx +16 -15
- package/src/overlays/shared/xyflow/RelationshipEdge.css.ts +60 -0
- package/src/overlays/shared/xyflow/_types.ts +87 -0
- package/src/state/diagram-to-xyflow.ts +6 -7
- package/src/state/diagramStore.layout.ts +3 -4
- package/src/state/diagramStore.ts +63 -48
- package/src/theme-vars.css.ts +81 -0
- package/src/theme-vars.ts +8 -81
- package/src/ui/DiagramTitlePanel.tsx +7 -34
- package/src/ui/Link.tsx +40 -0
- package/src/ui/notation/NotationPanel.tsx +4 -2
- package/src/ui/top-left/ChangeAutoLayoutButton.tsx +2 -2
- package/src/ui/top-left/TopLeftPanel.tsx +5 -5
- package/src/utils/types.ts +6 -0
- package/src/xyflow/SelectEdgesOnNodeFocus.tsx +3 -3
- package/src/xyflow/XYFlow.tsx +2 -2
- package/src/xyflow/edges/EdgeLabel.tsx +26 -19
- package/src/xyflow/edges/RelationshipEdge.tsx +5 -3
- package/src/xyflow/edges/RelationshipsDropdownMenu.tsx +23 -10
- package/src/xyflow/edges/edges.css.ts +68 -74
- package/src/xyflow/edges/utils.ts +6 -6
- package/src/xyflow/nodes/AnimateVariants.ts +143 -0
- package/src/xyflow/nodes/Node.css.ts +44 -0
- package/src/xyflow/nodes/compound/CompoundNode.css.ts +27 -75
- package/src/xyflow/nodes/compound/CompoundNode.tsx +82 -163
- package/src/xyflow/nodes/element/ElementLink.tsx +2 -3
- package/src/xyflow/nodes/element/ElementNode.tsx +73 -252
- package/src/xyflow/nodes/element/element.css.ts +40 -64
- package/src/xyflow/nodes/shared/ElementIcon.tsx +1 -1
- package/src/xyflow/nodes/shared/Toolbar.tsx +51 -35
- package/src/xyflow/types.ts +48 -51
- package/src/xyflow/useLayoutConstraints.ts +10 -10
- package/src/xyflow/useXYFlowEvents.ts +31 -35
- package/src/xyflow/utils.ts +2 -2
- package/src/ui/OptionsPanel.css.ts +0 -9
- package/src/ui/OptionsPanel.tsx +0 -70
- package/src/ui/options/EdgeOptions.tsx +0 -142
- package/src/ui/options/NodeOptions.tsx +0 -362
- package/src/xyflow/nodes/element/ElementDetails.css.ts +0 -101
- package/src/xyflow/nodes/element/ElementDetails.tsx +0 -393
- package/src/xyflow/nodes/use-animate-variants.tsx +0 -64
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Position, type XYPosition } from '@xyflow/react'
|
|
2
2
|
import { getNodeDimensions } from '@xyflow/system'
|
|
3
|
-
import type {
|
|
3
|
+
import type { DiagramFlowTypes } from '../types'
|
|
4
4
|
|
|
5
|
-
export function getNodeCenter(node:
|
|
5
|
+
export function getNodeCenter(node: DiagramFlowTypes.InternalNode): XYPosition {
|
|
6
6
|
const { width, height } = getNodeDimensions(node)
|
|
7
7
|
const { x, y } = node.internals.positionAbsolute
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ export function getNodeCenter(node: InternalXYFlowNode): XYPosition {
|
|
|
15
15
|
// this helper function returns the intersection point
|
|
16
16
|
// of the line between the center of the intersectionNode and the target node
|
|
17
17
|
export function getNodeIntersectionFromCenterToPoint(
|
|
18
|
-
intersectionNode:
|
|
18
|
+
intersectionNode: DiagramFlowTypes.InternalNode,
|
|
19
19
|
{ x: x1, y: y1 }: XYPosition
|
|
20
20
|
) {
|
|
21
21
|
// https://math.stackexchange.com/questions/1724792/an-algorithm-for-finding-the-intersection-point-between-a-center-of-vision-and-a
|
|
@@ -47,7 +47,7 @@ export function getNodeIntersectionFromCenterToPoint(
|
|
|
47
47
|
|
|
48
48
|
// this helper function returns the intersection point
|
|
49
49
|
// of the line between the center of the intersectionNode and the target node
|
|
50
|
-
function getNodeIntersection(intersectionNode:
|
|
50
|
+
function getNodeIntersection(intersectionNode: DiagramFlowTypes.InternalNode, targetNode: DiagramFlowTypes.InternalNode): XYPosition {
|
|
51
51
|
// https://math.stackexchange.com/questions/1724792/an-algorithm-for-finding-the-intersection-point-between-a-center-of-vision-and-a
|
|
52
52
|
const {
|
|
53
53
|
width: intersectionNodeWidth,
|
|
@@ -81,7 +81,7 @@ function getNodeIntersection(intersectionNode: InternalXYFlowNode, targetNode: I
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// returns the position (top,right,bottom or right) passed node compared to the intersection point
|
|
84
|
-
export function getPointPosition(node:
|
|
84
|
+
export function getPointPosition(node: DiagramFlowTypes.InternalNode, intersectionPoint: XYPosition) {
|
|
85
85
|
const n = {
|
|
86
86
|
// x: node.data.element.position[0],
|
|
87
87
|
// y: node.data.element.position[1],
|
|
@@ -135,7 +135,7 @@ export function getPointPosition(node: InternalXYFlowNode, intersectionPoint: XY
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
// returns the parameters (sx, sy, tx, ty, sourcePos, targetPos) you need to create an edge
|
|
138
|
-
export function getEdgeParams(source:
|
|
138
|
+
export function getEdgeParams(source: DiagramFlowTypes.InternalNode, target: DiagramFlowTypes.InternalNode) {
|
|
139
139
|
const sourceIntersectionPoint = getNodeIntersection(source, target)
|
|
140
140
|
const targetIntersectionPoint = getNodeIntersection(target, source)
|
|
141
141
|
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { fallbackVar } from '@vanilla-extract/css'
|
|
2
|
+
import type { Variants } from 'framer-motion'
|
|
3
|
+
import { useMemo, useState } from 'react'
|
|
4
|
+
import { isEmpty, isNumber, isString } from 'remeda'
|
|
5
|
+
import { vars } from '../../theme-vars'
|
|
6
|
+
|
|
7
|
+
const DEFAULT_SCALE_BY = 0
|
|
8
|
+
const SELECTED_SCALE_BY = 16
|
|
9
|
+
const HOVERED_SCALE_BY = 12
|
|
10
|
+
const TAP_SCALE_BY = -16
|
|
11
|
+
|
|
12
|
+
const DELAY_NODE = 0.1
|
|
13
|
+
const DELAY_NODE_CHILDREN = 0.06
|
|
14
|
+
|
|
15
|
+
const DIMMED_OPACITY = 0.15
|
|
16
|
+
const DIMMED_DELAY = 0.2
|
|
17
|
+
|
|
18
|
+
export type VariantKeys = 'dimmed' | 'hoverd' | 'idle' | 'selected' | 'tap'
|
|
19
|
+
|
|
20
|
+
export const NodeVariants = (width: number, height: number, opts?: {
|
|
21
|
+
selectedScaleBy?: number
|
|
22
|
+
hoveredScaleBy?: number
|
|
23
|
+
tapScaleBy?: number
|
|
24
|
+
}) => {
|
|
25
|
+
const {
|
|
26
|
+
selectedScaleBy = SELECTED_SCALE_BY,
|
|
27
|
+
hoveredScaleBy = HOVERED_SCALE_BY,
|
|
28
|
+
tapScaleBy = TAP_SCALE_BY,
|
|
29
|
+
} = opts ?? {}
|
|
30
|
+
|
|
31
|
+
// Same scale for X and Y
|
|
32
|
+
const maxwh = Math.max(width, height)
|
|
33
|
+
const scaleBy = (diffPx: number) => ({
|
|
34
|
+
scale: (maxwh + diffPx) / maxwh,
|
|
35
|
+
// scaleY: (maxwh + diffPx) / maxwh,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
dimmed: {
|
|
40
|
+
filter: `grayscale(0.85) ${fallbackVar(vars.safariAnimationHook, 'blur(1px)')}`,
|
|
41
|
+
opacity: DIMMED_OPACITY,
|
|
42
|
+
transition: {
|
|
43
|
+
delay: DIMMED_DELAY,
|
|
44
|
+
ease: 'easeInOut',
|
|
45
|
+
},
|
|
46
|
+
willChange: 'opacity, filter',
|
|
47
|
+
},
|
|
48
|
+
idle: {
|
|
49
|
+
...scaleBy(DEFAULT_SCALE_BY),
|
|
50
|
+
transition: {
|
|
51
|
+
delay: DELAY_NODE,
|
|
52
|
+
delayChildren: DELAY_NODE_CHILDREN,
|
|
53
|
+
},
|
|
54
|
+
filter: `grayscale(0) ${fallbackVar(vars.safariAnimationHook, 'blur(0px)')}`,
|
|
55
|
+
},
|
|
56
|
+
selected: {
|
|
57
|
+
...scaleBy(selectedScaleBy),
|
|
58
|
+
},
|
|
59
|
+
hovered: (_, { scale }) => ({
|
|
60
|
+
...scaleBy(hoveredScaleBy),
|
|
61
|
+
transition: !isNumber(scale) || (scale === 1)
|
|
62
|
+
? ({
|
|
63
|
+
delay: DELAY_NODE,
|
|
64
|
+
delayChildren: DELAY_NODE_CHILDREN,
|
|
65
|
+
})
|
|
66
|
+
: {},
|
|
67
|
+
}),
|
|
68
|
+
tap: {
|
|
69
|
+
...scaleBy(tapScaleBy),
|
|
70
|
+
},
|
|
71
|
+
} satisfies Variants
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function useFramerAnimateVariants() {
|
|
75
|
+
const [variants, setVariants] = useState<string[] | null>(null)
|
|
76
|
+
|
|
77
|
+
const handlers = useMemo(() => {
|
|
78
|
+
const getTarget = (e: MouseEvent | undefined) => {
|
|
79
|
+
try {
|
|
80
|
+
// 🤔 Sometimes target is null
|
|
81
|
+
return (e?.target as HTMLElement | null)?.closest('[data-animate-target]')?.getAttribute('data-animate-target')
|
|
82
|
+
?? null
|
|
83
|
+
} catch (_e) {
|
|
84
|
+
console.warn(`Failed to get animate target`, _e)
|
|
85
|
+
// noop
|
|
86
|
+
return null
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const onHoverStart = (e: MouseEvent) => {
|
|
91
|
+
e?.stopPropagation()
|
|
92
|
+
const hoverTarget = getTarget(e)
|
|
93
|
+
if (!isString(hoverTarget)) {
|
|
94
|
+
setVariants(null)
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
if (isEmpty(hoverTarget)) {
|
|
98
|
+
setVariants(['hovered'])
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
setVariants(['hovered', `hovered:${hoverTarget}`])
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const resetVariants = (e: MouseEvent) => {
|
|
105
|
+
e?.stopPropagation()
|
|
106
|
+
const hoverTarget = getTarget(e)
|
|
107
|
+
if (!isString(hoverTarget) || isEmpty(hoverTarget)) {
|
|
108
|
+
setVariants(null)
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
setVariants(v => v?.filter(v => !v.includes(hoverTarget)) ?? null)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return ({
|
|
115
|
+
onTapStart: (e: MouseEvent) => {
|
|
116
|
+
e?.stopPropagation()
|
|
117
|
+
const tapTarget = getTarget(e)
|
|
118
|
+
if (!isString(tapTarget)) {
|
|
119
|
+
setVariants(null)
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
if (isEmpty(tapTarget)) {
|
|
123
|
+
setVariants([
|
|
124
|
+
'hovered',
|
|
125
|
+
'tap',
|
|
126
|
+
])
|
|
127
|
+
} else {
|
|
128
|
+
setVariants([
|
|
129
|
+
'hovered',
|
|
130
|
+
`hovered:${tapTarget}`,
|
|
131
|
+
`tap:${tapTarget}`,
|
|
132
|
+
])
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
onHoverStart,
|
|
136
|
+
onHoverEnd: resetVariants,
|
|
137
|
+
onTapCancel: resetVariants,
|
|
138
|
+
onTap: onHoverStart,
|
|
139
|
+
})
|
|
140
|
+
}, [setVariants])
|
|
141
|
+
|
|
142
|
+
return [variants, handlers] as const
|
|
143
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { style } from "@vanilla-extract/css";
|
|
2
|
+
|
|
3
|
+
export const topLeftBtnContainer = style({
|
|
4
|
+
position: 'absolute',
|
|
5
|
+
left: 3,
|
|
6
|
+
top: 6
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
export const topRightBtnContainer = style({
|
|
10
|
+
position: 'absolute',
|
|
11
|
+
top: 2,
|
|
12
|
+
right: 2,
|
|
13
|
+
selectors: {
|
|
14
|
+
[`:where([data-likec4-shape='browser']) &`]: {
|
|
15
|
+
right: 5
|
|
16
|
+
},
|
|
17
|
+
':where([data-likec4-shape="cylinder"], [data-likec4-shape="storage"]) &': {
|
|
18
|
+
top: 14
|
|
19
|
+
},
|
|
20
|
+
':where([data-likec4-shape="queue"]) &': {
|
|
21
|
+
top: 1,
|
|
22
|
+
right: 12
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const bottomBtnContainer = style({
|
|
28
|
+
zIndex: 100,
|
|
29
|
+
position: 'absolute',
|
|
30
|
+
left: 0,
|
|
31
|
+
width: '100%',
|
|
32
|
+
bottom: 2,
|
|
33
|
+
display: 'flex',
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
flexWrap: 'nowrap',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
pointerEvents: 'none',
|
|
39
|
+
selectors: {
|
|
40
|
+
[`:where([data-likec4-shape='browser']) &`]: {
|
|
41
|
+
bottom: 4
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { rem } from '@mantine/core'
|
|
2
2
|
import { createVar, fallbackVar, globalStyle, keyframes, style } from '@vanilla-extract/css'
|
|
3
3
|
import { calc } from '@vanilla-extract/css-utils'
|
|
4
|
-
import { mantine, vars
|
|
4
|
+
import { mantine, vars } from '../../../theme-vars'
|
|
5
5
|
|
|
6
6
|
// For framer motion
|
|
7
7
|
export const containerForFramer = style({
|
|
@@ -39,17 +39,20 @@ export const nodeHandlerInCenter = style({
|
|
|
39
39
|
visibility: 'hidden'
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
globalStyle(`:where([data-mantine-color-scheme='dark'] .likec4-compound-transparent)`, {
|
|
43
|
+
vars: {
|
|
44
|
+
['--_compound-border-color']: `color-mix(in srgb, ${vars.compound.titleColor} 25%, ${vars.element.stroke})`
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
globalStyle(`:where([data-mantine-color-scheme='light'] .likec4-compound-transparent)`, {
|
|
48
|
+
vars: {
|
|
49
|
+
['--_compound-title-color']: vars.element.stroke
|
|
50
|
+
}
|
|
50
51
|
})
|
|
51
52
|
|
|
52
53
|
export const varOpacity = createVar('opacity')
|
|
54
|
+
export const varBorderColor = createVar('border-color')
|
|
55
|
+
export const varBorderRadius = createVar('border-transparency')
|
|
53
56
|
export const varBorderTransparency = createVar('border-transparency')
|
|
54
57
|
|
|
55
58
|
const outlineColor = fallbackVar(
|
|
@@ -62,14 +65,17 @@ export const compoundBody = style({
|
|
|
62
65
|
width: '100%',
|
|
63
66
|
height: '100%',
|
|
64
67
|
position: 'relative',
|
|
65
|
-
borderRadius:
|
|
68
|
+
borderRadius: varBorderRadius,
|
|
66
69
|
boxShadow: '0 4px 10px 0.5px rgba(0,0,0,0.1) , 0 2px 2px -1px rgba(0,0,0,0.4)',
|
|
67
70
|
padding: 0,
|
|
68
71
|
margin: 0,
|
|
69
72
|
transition: 'all 200ms ease-out',
|
|
70
|
-
backgroundClip: 'padding-box',
|
|
73
|
+
// backgroundClip: 'padding-box',
|
|
71
74
|
// overflow: 'hidden',
|
|
72
75
|
cursor: 'default',
|
|
76
|
+
vars: {
|
|
77
|
+
[varBorderRadius]: '6px'
|
|
78
|
+
},
|
|
73
79
|
selectors: {
|
|
74
80
|
[`:where(.react-flow__node.selected) &`]: {
|
|
75
81
|
boxShadow: 'none'
|
|
@@ -88,8 +94,11 @@ export const compoundBody = style({
|
|
|
88
94
|
width: '100%',
|
|
89
95
|
height: '100%',
|
|
90
96
|
pointerEvents: 'none',
|
|
97
|
+
border: '1px solid transparent',
|
|
98
|
+
borderRadius: varBorderRadius,
|
|
91
99
|
transition: 'background 175ms ease-out, opacity 175ms ease-out',
|
|
92
|
-
background: vars.element.fill
|
|
100
|
+
background: vars.element.fill,
|
|
101
|
+
backgroundClip: 'border-box'
|
|
93
102
|
}
|
|
94
103
|
})
|
|
95
104
|
export const compoundTitle = style({
|
|
@@ -97,19 +106,20 @@ export const compoundTitle = style({
|
|
|
97
106
|
alignItems: 'center',
|
|
98
107
|
gap: 6,
|
|
99
108
|
paddingLeft: 14,
|
|
100
|
-
paddingTop:
|
|
109
|
+
paddingTop: 6,
|
|
101
110
|
minHeight: 30,
|
|
111
|
+
paddingRight: 2,
|
|
102
112
|
selectors: {
|
|
103
113
|
[`:where(.react-flow__node.draggable) &`]: {
|
|
104
114
|
cursor: 'grab'
|
|
105
115
|
},
|
|
106
116
|
[`:where(.likec4-compound-transparent) &`]: {
|
|
107
|
-
paddingTop:
|
|
117
|
+
paddingTop: 3
|
|
108
118
|
}
|
|
109
119
|
}
|
|
110
120
|
})
|
|
111
121
|
export const withNavigation = style({
|
|
112
|
-
paddingLeft:
|
|
122
|
+
paddingLeft: 32
|
|
113
123
|
})
|
|
114
124
|
|
|
115
125
|
const opacityDeltaOnHover = createVar('opacityDeltaOnHover')
|
|
@@ -117,8 +127,9 @@ export const transparent = style({
|
|
|
117
127
|
borderStyle: 'dashed',
|
|
118
128
|
borderWidth: 3,
|
|
119
129
|
boxShadow: 'none',
|
|
120
|
-
borderColor: `color-mix(in srgb , ${
|
|
130
|
+
borderColor: `color-mix(in srgb , ${varBorderColor}, transparent ${fallbackVar(varBorderTransparency, '5%')})`,
|
|
121
131
|
vars: {
|
|
132
|
+
[varBorderColor]: `var(--_compound-border-color,${vars.element.stroke})`,
|
|
122
133
|
[opacityDeltaOnHover]: '0'
|
|
123
134
|
},
|
|
124
135
|
':before': {
|
|
@@ -156,12 +167,6 @@ export const title = style({
|
|
|
156
167
|
mixBlendMode: 'screen'
|
|
157
168
|
})
|
|
158
169
|
|
|
159
|
-
globalStyle(`:where([data-mantine-color-scheme='light'] .likec4-compound-transparent)`, {
|
|
160
|
-
vars: {
|
|
161
|
-
['--_compound-title-color']: vars.element.stroke
|
|
162
|
-
}
|
|
163
|
-
})
|
|
164
|
-
|
|
165
170
|
const indicatorKeyframes = keyframes({
|
|
166
171
|
'from': {
|
|
167
172
|
opacity: 0.6
|
|
@@ -228,59 +233,6 @@ globalStyle(`:where([data-mantine-color-scheme='light'] .likec4-compound-transpa
|
|
|
228
233
|
}
|
|
229
234
|
})
|
|
230
235
|
|
|
231
|
-
const btn = style({
|
|
232
|
-
pointerEvents: 'all',
|
|
233
|
-
cursor: 'pointer',
|
|
234
|
-
color: `var(--_compound-title-color,${navigateBtnColor})`,
|
|
235
|
-
opacity: 'var(--ai-opacity)',
|
|
236
|
-
backgroundColor: 'var(--ai-bg)',
|
|
237
|
-
vars: {
|
|
238
|
-
'--ai-opacity': '1',
|
|
239
|
-
'--ai-bg-idle': `color-mix(in srgb , ${vars.element.fill}, transparent 99%)`,
|
|
240
|
-
'--ai-bg': `var(--ai-bg-idle)`,
|
|
241
|
-
'--ai-bg-hover': `color-mix(in srgb , ${vars.element.fill} 65%, ${vars.element.stroke})`,
|
|
242
|
-
'--ai-hover': `color-mix(in srgb , ${vars.element.fill} 50%, ${vars.element.stroke})`
|
|
243
|
-
},
|
|
244
|
-
':hover': {
|
|
245
|
-
boxShadow: mantine.shadows.md
|
|
246
|
-
},
|
|
247
|
-
selectors: {
|
|
248
|
-
[`${whereLight} .likec4-compound-transparent &`]: {
|
|
249
|
-
opacity: 0.85,
|
|
250
|
-
vars: {
|
|
251
|
-
'--ai-bg-hover': `color-mix(in srgb , ${vars.element.fill}, transparent 20%)`,
|
|
252
|
-
'--ai-hover': `color-mix(in srgb , ${vars.element.fill}, transparent 10%)`,
|
|
253
|
-
'--ai-bg': `color-mix(in srgb , ${vars.element.fill}, transparent 99%)`
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
})
|
|
258
|
-
|
|
259
|
-
export const navigateBtn = style([btn, {
|
|
260
|
-
position: 'absolute',
|
|
261
|
-
left: 3,
|
|
262
|
-
top: 6
|
|
263
|
-
}])
|
|
264
|
-
|
|
265
|
-
export const detailsBtn = style([btn, {
|
|
266
|
-
// position: 'absolute',
|
|
267
|
-
// top: 2,
|
|
268
|
-
// right: 2,
|
|
269
|
-
// selectors: {
|
|
270
|
-
// [`:where([data-likec4-shape='browser']) &`]: {
|
|
271
|
-
// top: 3,
|
|
272
|
-
// right: 5
|
|
273
|
-
// },
|
|
274
|
-
// ':where([data-likec4-shape="cylinder"], [data-likec4-shape="storage"]) &': {
|
|
275
|
-
// top: 14
|
|
276
|
-
// },
|
|
277
|
-
// ':where([data-likec4-shape="queue"]) &': {
|
|
278
|
-
// top: 1,
|
|
279
|
-
// right: 12
|
|
280
|
-
// }
|
|
281
|
-
// }
|
|
282
|
-
}])
|
|
283
|
-
|
|
284
236
|
export const elementIcon = style({
|
|
285
237
|
flex: `0 0 ${iconSize}`,
|
|
286
238
|
height: iconSize,
|