@likec4/diagram 1.48.0 → 1.49.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.
Files changed (303) hide show
  1. package/README.md +7 -9
  2. package/adhoc-editor/package.json +4 -0
  3. package/dist/LikeC4Diagram.d.ts +2 -1
  4. package/dist/LikeC4Diagram.js +77 -79
  5. package/dist/LikeC4Diagram.props.d.ts +9 -1
  6. package/dist/LikeC4ModelProvider.d.ts +4 -4
  7. package/dist/LikeC4ModelProvider.js +2 -2
  8. package/dist/LikeC4ProjectsOverview.d.ts +3 -2
  9. package/dist/LikeC4ProjectsProvider.d.ts +2 -1
  10. package/dist/LikeC4ProjectsProvider.js +4 -4
  11. package/dist/LikeC4Styles.d.ts +2 -1
  12. package/dist/LikeC4View.d.ts +14 -1
  13. package/dist/LikeC4View.js +31 -18
  14. package/dist/ReactLikeC4.d.ts +2 -1
  15. package/dist/ReactLikeC4.js +3 -1
  16. package/dist/StaticLikeC4Diagram.d.ts +2 -1
  17. package/dist/StaticLikeC4Diagram.js +1 -0
  18. package/dist/_virtual/store-1b2fbb72.cjs.js +3 -0
  19. package/dist/_virtual/xstate-store-react.cjs.js +5 -0
  20. package/dist/_virtual/xstate-store-react.cjs2.js +3 -0
  21. package/dist/adhoc-editor/EditorPanel.d.ts +1 -0
  22. package/dist/adhoc-editor/EditorPanel.js +105 -0
  23. package/dist/adhoc-editor/ElementsTree.d.ts +2 -0
  24. package/dist/adhoc-editor/ElementsTree.js +142 -0
  25. package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +1 -1
  26. package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +46 -43
  27. package/dist/adhoc-editor/components/Tree.d.ts +48 -0
  28. package/dist/adhoc-editor/components/Tree.js +296 -0
  29. package/dist/adhoc-editor/hooks.d.ts +3 -3
  30. package/dist/adhoc-editor/hooks.js +5 -23
  31. package/dist/adhoc-editor/index.d.ts +1 -1
  32. package/dist/adhoc-editor/index.js +1 -0
  33. package/dist/adhoc-editor/{ActorProvider.d.ts → state/ActorProvider.d.ts} +1 -3
  34. package/dist/adhoc-editor/{ActorProvider.js → state/ActorProvider.js} +10 -11
  35. package/dist/adhoc-editor/state/actor.d.ts +13 -0
  36. package/dist/adhoc-editor/{actor.editor.d.ts → state/actor.editor.d.ts} +6 -4
  37. package/dist/adhoc-editor/state/actor.editor.js +205 -0
  38. package/dist/adhoc-editor/{actor.js → state/actor.js} +2 -6
  39. package/dist/adhoc-editor/{actor.layouter.d.ts → state/actor.layouter.d.ts} +7 -4
  40. package/dist/adhoc-editor/{actor.layouter.js → state/actor.layouter.js} +17 -13
  41. package/dist/adhoc-editor/{actor.types.d.ts → state/actor.types.d.ts} +12 -6
  42. package/dist/adhoc-editor/{actor.types.js → state/actor.types.js} +8 -1
  43. package/dist/adhoc-editor/state/panel.d.ts +95 -0
  44. package/dist/adhoc-editor/state/panel.js +139 -0
  45. package/dist/adhoc-editor/state/utils.d.ts +17 -0
  46. package/dist/adhoc-editor/state/utils.js +32 -0
  47. package/dist/adhoc-editor/useElementsTree.d.ts +18 -0
  48. package/dist/adhoc-editor/useElementsTree.js +130 -0
  49. package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +1 -1
  50. package/dist/base/const.d.ts +1 -0
  51. package/dist/base-primitives/compound/CompoundActionButton.js +26 -12
  52. package/dist/base-primitives/compound/CompoundDetailsButton.js +22 -9
  53. package/dist/base-primitives/compound/CompoundNodeContainer.js +5 -4
  54. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  55. package/dist/base-primitives/edge/EdgeLabel.js +3 -4
  56. package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +2 -1
  57. package/dist/base-primitives/edge/EdgeLabelContainer.js +12 -19
  58. package/dist/base-primitives/element/ElementActionButtons.js +35 -10
  59. package/dist/base-primitives/element/ElementDetailsButton.js +47 -18
  60. package/dist/base-primitives/element/ElementNodeContainer.d.ts +3 -3
  61. package/dist/base-primitives/element/ElementNodeContainer.js +23 -10
  62. package/dist/base-primitives/element/ElementShape.d.ts +2 -2
  63. package/dist/base-primitives/element/ElementShape.js +70 -7
  64. package/dist/components/ErrorFallback.js +1 -1
  65. package/dist/components/Link.js +3 -3
  66. package/dist/components/Logo.js +1 -1
  67. package/dist/components/NavigationPanel.js +2 -4
  68. package/dist/components/PortalToContainer.js +3 -4
  69. package/dist/components/RootContainer.js +9 -16
  70. package/dist/components/ViewNotFound.d.ts +3 -3
  71. package/dist/components/ViewNotFound.js +30 -26
  72. package/dist/context/CurrentViewModelProvider.d.ts +2 -0
  73. package/dist/context/CurrentViewModelProvider.js +12 -0
  74. package/dist/context/DefaultMantineProvider.d.ts +1 -1
  75. package/dist/context/DefaultMantineProvider.js +10 -1
  76. package/dist/context/DiagramEventHandlers.d.ts +5 -5
  77. package/dist/context/DiagramEventHandlers.js +10 -4
  78. package/dist/context/DiagramFeatures.d.ts +8 -7
  79. package/dist/context/DiagramFeatures.js +5 -3
  80. package/dist/context/FramerMotionConfig.d.ts +1 -3
  81. package/dist/context/IconRenderer.d.ts +5 -4
  82. package/dist/context/IconRenderer.js +51 -24
  83. package/dist/context/LikeC4ModelContext.d.ts +10 -5
  84. package/dist/context/LikeC4ModelContext.js +11 -3
  85. package/dist/context/LikeC4ProjectsContext.d.ts +3 -2
  86. package/dist/context/LikeC4ProjectsContext.js +6 -2
  87. package/dist/context/RootContainerContext.d.ts +10 -3
  88. package/dist/context/RootContainerContext.js +8 -3
  89. package/dist/context/TagStylesContext.js +1 -1
  90. package/dist/custom/index.js +16 -15
  91. package/dist/editor/LikeC4EditorProvider.js +1 -1
  92. package/dist/editor/applyChangesToManualLayout.js +7 -7
  93. package/dist/editor/editorActor.actions.js +20 -20
  94. package/dist/editor/editorActor.states.js +0 -9
  95. package/dist/editor/useEditorActorLogic.d.ts +1 -2
  96. package/dist/editor/useEditorActorLogic.js +8 -11
  97. package/dist/hooks/index.d.ts +2 -2
  98. package/dist/hooks/safeContext.d.ts +4 -5
  99. package/dist/hooks/useCallbackRef.js +7 -6
  100. package/dist/hooks/useCurrentView.js +5 -10
  101. package/dist/hooks/useCurrentViewModel.d.ts +2 -6
  102. package/dist/hooks/useCurrentViewModel.js +3 -7
  103. package/dist/hooks/useDiagram.d.ts +9 -1
  104. package/dist/hooks/useDiagram.js +8 -2
  105. package/dist/hooks/useDiagramCompareLayout.d.ts +5 -5
  106. package/dist/hooks/useLikeC4ElementsTree.d.ts +1 -1
  107. package/dist/hooks/useLikeC4ElementsTree.js +1 -1
  108. package/dist/hooks/useLikeC4Model.d.ts +6 -2
  109. package/dist/hooks/useLikeC4Model.js +7 -9
  110. package/dist/hooks/useLikeC4Project.d.ts +4 -6
  111. package/dist/hooks/useLikeC4Project.js +19 -31
  112. package/dist/hooks/useLikeC4Styles.js +3 -9
  113. package/dist/hooks/useMantinePortalProps.d.ts +1 -1
  114. package/dist/hooks/useMediaPrint.d.ts +0 -2
  115. package/dist/hooks/useOverlaysActor.js +4 -4
  116. package/dist/hooks/useSearchActor.js +4 -4
  117. package/dist/index.d.ts +1 -3
  118. package/dist/index.js +2 -2
  119. package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -1
  120. package/dist/likec4diagram/DiagramXYFlow.js +5 -7
  121. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +22 -24
  122. package/dist/likec4diagram/custom/edges/edges.css.js +2 -1
  123. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +40 -55
  124. package/dist/likec4diagram/custom/nodes/ElementActions.js +2 -2
  125. package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +1 -2
  126. package/dist/likec4diagram/custom/nodes/NodeDrifts.js +3 -20
  127. package/dist/likec4diagram/custom/nodes/NodeNotes.d.ts +6 -0
  128. package/dist/likec4diagram/custom/nodes/NodeNotes.js +286 -0
  129. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -2
  130. package/dist/likec4diagram/custom/nodes/nodes.js +5 -2
  131. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +12 -8
  132. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +3 -3
  133. package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +1 -1
  134. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +8 -28
  135. package/dist/likec4diagram/state/DiagramActorProvider.js +30 -56
  136. package/dist/likec4diagram/state/diagram-api.d.ts +11 -0
  137. package/dist/likec4diagram/state/diagram-api.js +15 -0
  138. package/dist/likec4diagram/state/machine.actions.d.ts +27 -0
  139. package/dist/likec4diagram/state/machine.actions.js +78 -21
  140. package/dist/likec4diagram/state/machine.actions.layout.d.ts +1 -0
  141. package/dist/likec4diagram/state/machine.actions.layout.js +38 -3
  142. package/dist/likec4diagram/state/machine.js +4 -1
  143. package/dist/likec4diagram/state/machine.setup.d.ts +19 -2
  144. package/dist/likec4diagram/state/machine.state.navigating.js +1 -1
  145. package/dist/likec4diagram/state/machine.state.ready.d.ts +61 -1
  146. package/dist/likec4diagram/state/machine.state.ready.js +11 -3
  147. package/dist/likec4diagram/state/utils.d.ts +2 -1
  148. package/dist/likec4diagram/state/utils.js +1 -1
  149. package/dist/likec4diagram/types.d.ts +2 -2
  150. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +1 -1
  151. package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
  152. package/dist/likec4diagram/useLayoutConstraints.d.ts +12 -12
  153. package/dist/likec4diagram/useLayoutConstraints.js +125 -86
  154. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +2 -0
  155. package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +7 -2
  156. package/dist/navigationpanel/NavigationPanel.js +2 -2
  157. package/dist/navigationpanel/NavigationPanelDropdown.js +13 -13
  158. package/dist/navigationpanel/_common.js +2 -2
  159. package/dist/navigationpanel/actor.js +1 -1
  160. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -2
  161. package/dist/navigationpanel/comparepanel/ComparePanel.js +155 -29
  162. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +1 -1
  163. package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -0
  164. package/dist/navigationpanel/comparepanel/DriftsSummary.js +264 -0
  165. package/dist/navigationpanel/controls/DetailsControls.js +4 -4
  166. package/dist/navigationpanel/controls/LayoutWarning.js +1 -1
  167. package/dist/navigationpanel/controls/LogoButton.js +1 -1
  168. package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
  169. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  170. package/dist/navigationpanel/controls/SearchControl.js +1 -1
  171. package/dist/navigationpanel/controls/ToggleReadonly.js +3 -3
  172. package/dist/navigationpanel/dropdown/ProjectsMenu.js +1 -1
  173. package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
  174. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
  175. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
  176. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
  177. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +6 -6
  178. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +16 -16
  179. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
  180. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +1 -1
  181. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +1 -1
  182. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +1 -1
  183. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +2 -2
  184. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +1 -1
  185. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +1 -1
  186. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +1 -1
  187. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +1 -1
  188. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +2 -2
  189. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +1 -1
  190. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +1 -1
  191. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +1 -1
  192. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +1 -1
  193. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +14 -0
  194. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +2 -2
  195. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +2 -2
  196. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +1 -1
  197. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +1 -1
  198. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +1 -1
  199. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js +2 -2
  200. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +14 -0
  201. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +1 -1
  202. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +1 -1
  203. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +14 -0
  204. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +1 -1
  205. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +2 -2
  206. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +2 -2
  207. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +2 -2
  208. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +2 -2
  209. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +2 -2
  210. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +2 -2
  211. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +2 -2
  212. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +2 -2
  213. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +1 -1
  214. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +1 -1
  215. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +2 -2
  216. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +2 -2
  217. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +1 -1
  218. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +1 -1
  219. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +1 -1
  220. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +1 -1
  221. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +2 -2
  222. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +2 -2
  223. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +14 -0
  224. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +2 -2
  225. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +1 -1
  226. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +1 -1
  227. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +1 -1
  228. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +2 -2
  229. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +1 -1
  230. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +1 -1
  231. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +1 -1
  232. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +1 -1
  233. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.4 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +1 -1
  234. package/dist/node_modules/.pnpm/@xstate_store@3.14.0_react@19.2.4/node_modules/@xstate/store/dist/store-1b2fbb72.cjs.js +742 -0
  235. package/dist/node_modules/.pnpm/@xstate_store@3.14.0_react@19.2.4/node_modules/@xstate/store/react/dist/xstate-store-react.cjs.js +175 -0
  236. package/dist/overlays/element-details/ElementDetailsCard.css.js +11 -11
  237. package/dist/overlays/element-details/ElementDetailsCard.js +39 -40
  238. package/dist/overlays/element-details/MetadataValue.js +7 -7
  239. package/dist/overlays/element-details/TabPanelDeployments.js +4 -4
  240. package/dist/overlays/element-details/TabPanelRelationships.css.js +5 -5
  241. package/dist/overlays/element-details/TabPanelRelationships.js +4 -5
  242. package/dist/overlays/element-details/TabPanelStructure.css.js +3 -3
  243. package/dist/overlays/element-details/TabPanelStructure.js +1 -1
  244. package/dist/overlays/overlaysActor.js +1 -1
  245. package/dist/overlays/relationship-details/RelationshipDetails.js +3 -3
  246. package/dist/overlays/relationship-details/SelectEdge.css.js +4 -4
  247. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  248. package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
  249. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -6
  250. package/dist/overlays/relationships-browser/SelectElement.css.js +2 -2
  251. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  252. package/dist/overlays/relationships-browser/actor.js +1 -1
  253. package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
  254. package/dist/overlays/relationships-browser/custom/EmptyNode.js +1 -1
  255. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -1
  256. package/dist/projects-overview/ProjectsOverview.js +2 -2
  257. package/dist/projects-overview/ProjectsOverviewXY.d.ts +1 -5
  258. package/dist/projects-overview/ProjectsOverviewXY.js +1 -1
  259. package/dist/projects-overview/actor.d.ts +1 -1
  260. package/dist/projects-overview/context.d.ts +2 -2
  261. package/dist/projects-overview/context.js +2 -1
  262. package/dist/projects-overview/custom/nodeTypes.js +1 -1
  263. package/dist/search/Search.d.ts +2 -1
  264. package/dist/search/Search.js +108 -87
  265. package/dist/search/components/ElementsColumn.css.js +3 -3
  266. package/dist/search/components/ElementsColumn.js +93 -59
  267. package/dist/search/components/PickView.js +8 -4
  268. package/dist/search/components/SearchByTags.js +1 -1
  269. package/dist/search/components/SearchInput.js +2 -2
  270. package/dist/search/components/ViewsColum.d.ts +2 -1
  271. package/dist/search/components/ViewsColum.js +39 -35
  272. package/dist/search/components/ViewsColumn.css.js +1 -1
  273. package/dist/search/components/_shared.css.js +11 -11
  274. package/dist/search/components/utils.js +1 -4
  275. package/dist/search/hooks.js +4 -1
  276. package/dist/search/searchActor.d.ts +12 -2
  277. package/dist/search/searchActor.js +60 -4
  278. package/dist/shadowroot/ShadowRoot.d.ts +5 -2
  279. package/dist/shadowroot/ShadowRoot.js +7 -5
  280. package/dist/shadowroot/styles.css.js +3 -2
  281. package/dist/styles.css2.js +1 -1
  282. package/dist/utils/view-bounds.d.ts +3 -2
  283. package/dist/utils/view-bounds.js +1 -1
  284. package/dist/utils/xyflow.d.ts +10 -5
  285. package/dist/utils/xyflow.js +24 -22
  286. package/package.json +29 -28
  287. package/panda.buildinfo.json +175 -86
  288. package/styles-min.css +1 -1
  289. package/styles.css +1 -1
  290. package/bundle/index.js +0 -52554
  291. package/bundle/package.json +0 -4
  292. package/dist/adhoc-editor/EditorNavigationPanel.d.ts +0 -1
  293. package/dist/adhoc-editor/EditorNavigationPanel.js +0 -32
  294. package/dist/adhoc-editor/SelectElementOverlay.d.ts +0 -1
  295. package/dist/adhoc-editor/SelectElementOverlay.js +0 -124
  296. package/dist/adhoc-editor/actor.d.ts +0 -131
  297. package/dist/adhoc-editor/actor.editor.js +0 -96
  298. package/dist/adhoc-editor/viewrules/ViewRulesPanel.js +0 -104
  299. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.js +0 -14
  300. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -14
  301. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -14
  302. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -14
  303. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -14
@@ -1,7 +1,8 @@
1
- import { LogAction, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, ActionFunction, DoneActorEvent, ErrorActorEvent } from 'xstate';
2
- import { Context, Events, AdhocViewServiceActor } from './actor.types';
1
+ import { ActionFunction, LogAction, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, DoneActorEvent, ErrorActorEvent } from 'xstate';
2
+ import { Context, Events, EmittedEvents, AdhocViewServiceActor } from './actor.types';
3
3
  import { AdhocViewPredicate } from '@likec4/core/compute-view';
4
4
  import { LayoutedElementView } from '@likec4/core';
5
+ export declare const emitViewUpdate: () => ActionFunction<Context, Events, Events, undefined, never, never, never, never, EmittedEvents>;
5
6
  export declare const layouter: {
6
7
  initial: string;
7
8
  states: {
@@ -30,13 +31,15 @@ export declare const layouter: {
30
31
  };
31
32
  onDone: {
32
33
  target: "#layouter-idle";
33
- actions: ActionFunction<Context, DoneActorEvent<{
34
+ actions: ( ActionFunction<Context, DoneActorEvent<{
34
35
  view: LayoutedElementView;
35
36
  }, string>, Events, undefined, {
36
37
  src: "service";
37
38
  logic: AdhocViewServiceActor;
38
39
  id: string | undefined;
39
- }, never, never, never, never>;
40
+ }, never, never, never, never> | ActionFunction<Context, DoneActorEvent<{
41
+ view: LayoutedElementView;
42
+ }, string>, Events, undefined, never, never, never, never, EmittedEvents>)[];
40
43
  };
41
44
  onError: {
42
45
  target: "#layouter-idle";
@@ -1,6 +1,6 @@
1
1
  import { objectHash } from '@likec4/core/utils';
2
2
  import { piped, filter, map } from 'remeda';
3
- import { log, assign } from 'xstate';
3
+ import { log, assign, emit } from 'xstate';
4
4
  import { machine, ruleToPredicate } from './actor.types.js';
5
5
 
6
6
  const to = {
@@ -17,6 +17,7 @@ const idle = machine.createStateConfig({
17
17
  }
18
18
  }
19
19
  });
20
+ const emitViewUpdate = () => machine.emit({ type: "view.update" });
20
21
  const selectEnabled = piped(
21
22
  filter((rule) => rule.enabled),
22
23
  map(ruleToPredicate)
@@ -31,17 +32,20 @@ const call = machine.createStateConfig({
31
32
  predicates: selectEnabled(context.rules)
32
33
  }),
33
34
  onDone: {
34
- actions: assign({
35
- view: ({ context, event }) => {
36
- const id = objectHash(selectEnabled(context.rules));
37
- return {
38
- ...event.output.view,
39
- hash: id,
40
- id
41
- };
42
- },
43
- error: void 0
44
- }),
35
+ actions: [
36
+ assign({
37
+ view: ({ context, event }) => {
38
+ const id = objectHash(selectEnabled(context.rules));
39
+ return {
40
+ ...event.output.view,
41
+ hash: id,
42
+ id
43
+ };
44
+ },
45
+ error: void 0
46
+ }),
47
+ emit({ type: "view.update" })
48
+ ],
45
49
  ...to.idle
46
50
  },
47
51
  onError: {
@@ -63,4 +67,4 @@ const layouter = machine.createStateConfig({
63
67
  }
64
68
  });
65
69
 
66
- export { layouter };
70
+ export { emitViewUpdate, layouter };
@@ -1,5 +1,5 @@
1
1
  import { AdhocViewPredicate } from '@likec4/core/compute-view';
2
- import { Fqn, LayoutedElementView, ModelExpression } from '@likec4/core/types';
2
+ import { Fqn, LayoutedElementView, ModelFqnExpr } from '@likec4/core/types';
3
3
  import { PromiseActorLogic } from 'xstate/actors';
4
4
  import { SetupReturn, NonReducibleUnknown, MetaObject } from 'xstate';
5
5
  type CalcAdhocViewInput = {
@@ -15,7 +15,7 @@ export type AdhocViewServiceActor = PromiseActorLogic<CalcAdhocViewOutput, CalcA
15
15
  export type Input = {};
16
16
  export type AdhocRule = {
17
17
  id: string;
18
- expr: ModelExpression;
18
+ expr: ModelFqnExpr.Ref;
19
19
  enabled: boolean;
20
20
  type: 'include' | 'exclude';
21
21
  };
@@ -27,13 +27,18 @@ export interface Context {
27
27
  }
28
28
  export type EmittedEvents = {
29
29
  type: 'navigate.to';
30
+ } | {
31
+ type: 'view.update';
32
+ } | {
33
+ type: 'click.element';
34
+ id: Fqn;
30
35
  };
31
36
  export type Events = {
32
- type: 'include.element';
33
- model: Fqn;
37
+ type: 'toggle.element';
38
+ id: Fqn;
34
39
  } | {
35
- type: 'exclude.element';
36
- model: Fqn;
40
+ type: 'click.element';
41
+ id: Fqn;
37
42
  } | {
38
43
  type: 'toggle.rule';
39
44
  ruleId: string;
@@ -54,4 +59,5 @@ export declare const machine: SetupReturn<Context, Events, {
54
59
  }, {}, {}, {
55
60
  hasView: unknown;
56
61
  }, never, "hasView", NonReducibleUnknown, NonReducibleUnknown, EmittedEvents, MetaObject>;
62
+ export declare function createContext(): Context;
57
63
  export {};
@@ -18,5 +18,12 @@ const machine = setup({
18
18
  hasView: ({ context }) => context.view !== null
19
19
  }
20
20
  });
21
+ function createContext() {
22
+ return {
23
+ view: null,
24
+ error: void 0,
25
+ rules: []
26
+ };
27
+ }
21
28
 
22
- export { machine, ruleToPredicate };
29
+ export { createContext, machine, ruleToPredicate };
@@ -0,0 +1,95 @@
1
+ import { Fqn } from '@likec4/core';
2
+ import { StoreSnapshot, Store } from '@xstate/store';
3
+ import { TreeCollection } from '@zag-js/collection';
4
+ import { PropsWithChildren } from 'react';
5
+ import { TreeNodeData } from '../useElementsTree';
6
+ type EditorPanelState = {
7
+ searchInput: string;
8
+ expandedValue: string[];
9
+ collection: TreeCollection<TreeNodeData>;
10
+ };
11
+ declare const createEditorPanelStore: ({ initial, sideEffects, }: {
12
+ initial: TreeCollection<TreeNodeData>;
13
+ sideEffects: {
14
+ onElementStateClick: (payload: {
15
+ id: Fqn;
16
+ }) => void;
17
+ };
18
+ }) => Store<EditorPanelState, {
19
+ inputChange: {
20
+ value: string;
21
+ };
22
+ inputKeyDown: {};
23
+ modelUpdate: {
24
+ collection: TreeCollection<TreeNodeData>;
25
+ };
26
+ elementClick: {
27
+ id: Fqn;
28
+ };
29
+ }, {
30
+ type: "inputKeyDown";
31
+ }>;
32
+ export type EditorPanelStore = ReturnType<typeof createEditorPanelStore>;
33
+ export declare const EditorPanelStoreProvider: (props: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
34
+ export declare function selectEditorPanelState<T>(selector: (state: EditorPanelState) => T): [
35
+ selector: (snapshot: StoreSnapshot<EditorPanelState>) => T,
36
+ compare: (a: NoInfer<T> | undefined, b: NoInfer<T>) => boolean
37
+ ];
38
+ export declare function selectEditorPanelState<T>(selector: (state: EditorPanelState) => T, compare: (a: NoInfer<T> | undefined, b: NoInfer<T>) => boolean): [
39
+ selector: (snapshot: StoreSnapshot<EditorPanelState>) => T,
40
+ compare: (a: NoInfer<T> | undefined, b: NoInfer<T>) => boolean
41
+ ];
42
+ export declare function useEditorPanelStore(): Store<EditorPanelState, {
43
+ inputChange: {
44
+ value: string;
45
+ };
46
+ inputKeyDown: {};
47
+ modelUpdate: {
48
+ collection: TreeCollection<TreeNodeData>;
49
+ };
50
+ elementClick: {
51
+ id: Fqn;
52
+ };
53
+ }, {
54
+ type: "inputKeyDown";
55
+ }>;
56
+ export declare function useEditorPanelState<T>(arg1: readonly [
57
+ (snapshot: StoreSnapshot<EditorPanelState>) => T,
58
+ (a: NoInfer<T> | undefined, b: NoInfer<T>) => boolean
59
+ ]): T;
60
+ export declare function useEditorPanelState<T>(selector: (snapshot: StoreSnapshot<EditorPanelState>) => T, compare?: (a: NoInfer<T> | undefined, b: NoInfer<T>) => boolean): T;
61
+ /**
62
+ * Hook to subscribe to editor panel events
63
+ * @param args - The event name and handler function
64
+ * @example
65
+ * useOnEditorPanelEvent('inputKeyDown', () => {
66
+ * console.log('Input key down event')
67
+ * })
68
+ */
69
+ export declare function useOnEditorPanelEvent(...args: Parameters<EditorPanelStore['on']>): void;
70
+ /**
71
+ * Hook to access the editor panel store trigger or create a wrapped trigger function
72
+ *
73
+ * @overload
74
+ * @returns The store trigger object
75
+ *
76
+ * @overload
77
+ * @template T - The parameter types for the wrapped trigger function
78
+ * @param trigger - A function that receives the store trigger as the first parameter
79
+ * @returns A wrapped function that calls the trigger with the store trigger prepended
80
+ *
81
+ * @example
82
+ * // Get the trigger object directly
83
+ * const trigger = useEditorPanelTrigger()
84
+ * trigger.inputChange({ value: 'search' })
85
+ *
86
+ * @example
87
+ * // Create a wrapped trigger function
88
+ * const handleInputChange = useEditorPanelTrigger((trigger, value: string) => {
89
+ * trigger.inputChange({ value })
90
+ * })
91
+ * handleInputChange('search')
92
+ */
93
+ export declare function useEditorPanelTrigger(): EditorPanelStore['trigger'];
94
+ export declare function useEditorPanelTrigger<T extends any[]>(trigger: (...params: [trigger: EditorPanelStore['trigger'], ...T]) => void): (...args: T) => void;
95
+ export {};
@@ -0,0 +1,139 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { createStore, shallowEqual } from '@xstate/store';
3
+ import { useRef, useMemo, useEffect, createContext, useContext } from 'react';
4
+ import { hasAtLeast } from 'remeda';
5
+ import { useAdhocEditorActor } from '../hooks.js';
6
+ import { createTreeCollection } from '../useElementsTree.js';
7
+ import { deriveElementStates } from './utils.js';
8
+ import { useLikeC4Model } from '../../hooks/useLikeC4Model.js';
9
+ import { useUpdateEffect } from '../../hooks/useUpdateEffect.js';
10
+ import { x as xstateStoreReact_cjsExports } from '../../_virtual/xstate-store-react.cjs.js';
11
+ import { useCallbackRef } from '../../hooks/useCallbackRef.js';
12
+
13
+ const createEditorPanelStore = ({
14
+ initial,
15
+ sideEffects
16
+ }) => createStore({
17
+ context: {
18
+ searchInput: "",
19
+ expandedValue: [],
20
+ collection: initial
21
+ },
22
+ emits: {
23
+ inputKeyDown: (payload) => {
24
+ }
25
+ },
26
+ on: {
27
+ "inputChange": (context, event) => {
28
+ return {
29
+ ...context,
30
+ searchInput: event.value
31
+ };
32
+ },
33
+ "inputKeyDown": (context, event, enqueue) => {
34
+ enqueue.emit.inputKeyDown();
35
+ },
36
+ "modelUpdate": (context, event) => {
37
+ return {
38
+ ...context,
39
+ collection: event.collection
40
+ };
41
+ },
42
+ "elementClick": (context, event, enqueue) => {
43
+ const current = context.collection.findNode(event.id);
44
+ const path = context.collection.getIndexPath(event.id);
45
+ if (!current || !path) {
46
+ return context;
47
+ }
48
+ enqueue.effect(() => {
49
+ sideEffects.onElementStateClick({ id: event.id });
50
+ });
51
+ return context;
52
+ }
53
+ }
54
+ });
55
+ const EditorPanelStoreContext = createContext(null);
56
+ const EditorPanelStoreProvider = (props) => {
57
+ const likec4model = useLikeC4Model();
58
+ const likec4modelRef = useRef(likec4model);
59
+ likec4modelRef.current = likec4model;
60
+ const actorRef = useAdhocEditorActor();
61
+ const store = useMemo(() => createEditorPanelStore({
62
+ initial: createTreeCollection(likec4model),
63
+ sideEffects: {
64
+ onElementStateClick({ id }) {
65
+ actorRef.send({ type: "toggle.element", id });
66
+ }
67
+ }
68
+ }), [actorRef]);
69
+ useUpdateEffect(() => {
70
+ store.trigger.modelUpdate({
71
+ collection: createTreeCollection(
72
+ likec4model,
73
+ deriveElementStates(actorRef.getSnapshot().context)
74
+ )
75
+ });
76
+ }, [likec4model]);
77
+ useEffect(() => {
78
+ const subscription = actorRef.on("view.update", () => {
79
+ store.trigger.modelUpdate({
80
+ collection: createTreeCollection(
81
+ likec4modelRef.current,
82
+ deriveElementStates(actorRef.getSnapshot().context)
83
+ )
84
+ });
85
+ });
86
+ return () => {
87
+ subscription.unsubscribe();
88
+ };
89
+ }, [actorRef]);
90
+ return /* @__PURE__ */ jsx(EditorPanelStoreContext.Provider, { value: store, children: props.children });
91
+ };
92
+ function selectEditorPanelState(selector, compare) {
93
+ return [
94
+ (snapshot) => selector(snapshot.context),
95
+ compare ?? shallowEqual
96
+ ];
97
+ }
98
+ function useEditorPanelStore() {
99
+ return useContext(EditorPanelStoreContext);
100
+ }
101
+ function useEditorPanelState(...args) {
102
+ const store = useEditorPanelStore();
103
+ let selector, compare;
104
+ if (args.length === 2) {
105
+ [selector, compare] = args;
106
+ } else if (args.length === 1 && Array.isArray(args[0]) && hasAtLeast(args[0], 2)) {
107
+ [selector, compare] = args[0];
108
+ } else if (args.length === 1 && Array.isArray(args[0]) && hasAtLeast(args[0], 1)) {
109
+ [selector, compare] = [args[0], shallowEqual];
110
+ } else if (args.length === 1 && typeof args[0] === "function") {
111
+ [selector, compare] = [args[0], shallowEqual];
112
+ } else {
113
+ throw new Error("Invalid arguments for useEditorPanelState");
114
+ }
115
+ return xstateStoreReact_cjsExports.useSelector(store, selector, compare);
116
+ }
117
+ function useOnEditorPanelEvent(...args) {
118
+ const store = useEditorPanelStore();
119
+ const event = args[0];
120
+ const handler = useCallbackRef(args[1]);
121
+ useEffect(() => {
122
+ const subscription = store.on(event, handler);
123
+ return () => {
124
+ subscription.unsubscribe();
125
+ };
126
+ }, [event, store]);
127
+ }
128
+ function useEditorPanelTrigger(...args) {
129
+ const store = useEditorPanelStore();
130
+ if (args.length === 0) {
131
+ return store.trigger;
132
+ }
133
+ const trigger = args[0];
134
+ return useCallbackRef((...args2) => {
135
+ trigger(...[store.trigger, ...args2]);
136
+ });
137
+ }
138
+
139
+ export { EditorPanelStoreProvider, selectEditorPanelState, useEditorPanelState, useEditorPanelStore, useEditorPanelTrigger, useOnEditorPanelEvent };
@@ -0,0 +1,17 @@
1
+ import { Fqn } from '@likec4/core/types';
2
+ import { Context } from './actor.types';
3
+ /**
4
+ * Derives the state of elements in the view based on the active rules.
5
+ *
6
+ * Categorizes elements into:
7
+ * - Explicitly included: Elements that are both in the view and have an enabled include rule
8
+ * - Implicitly included: Elements in the view without an explicit include rule
9
+ * - Excluded: Elements with an enabled exclude rule that are not in the view
10
+ */
11
+ export declare function deriveElementStates({ rules, view }: Pick<Context, 'rules' | 'view'>): {
12
+ includedExplicit: Set<Fqn>;
13
+ includedImplicit: Set<Fqn>;
14
+ excluded: Set<Fqn>;
15
+ disabled: Set<Fqn>;
16
+ };
17
+ export type ElementStates = ReturnType<typeof deriveElementStates>;
@@ -0,0 +1,32 @@
1
+ import { toSet, difference } from '@likec4/core/utils';
2
+ import { isNonNullish, pipe, filter, map } from 'remeda';
3
+
4
+ function deriveElementStates({ rules, view }) {
5
+ const includedInView = new Set(view ? view.nodes.map((node) => node.modelRef ?? null).filter(isNonNullish) : []);
6
+ const explicits = pipe(
7
+ rules,
8
+ filter((r) => r.type === "include" && r.enabled),
9
+ map((r) => r.expr.ref.model),
10
+ toSet()
11
+ );
12
+ const excluded = pipe(
13
+ rules,
14
+ filter((r) => r.type === "exclude" && r.enabled),
15
+ map((r) => r.expr.ref.model),
16
+ toSet()
17
+ );
18
+ const disabled = pipe(
19
+ rules,
20
+ filter((r) => !r.enabled),
21
+ map((r) => r.expr.ref.model),
22
+ toSet()
23
+ );
24
+ return {
25
+ disabled,
26
+ includedExplicit: explicits,
27
+ includedImplicit: difference(includedInView, explicits),
28
+ excluded: difference(excluded, includedInView)
29
+ };
30
+ }
31
+
32
+ export { deriveElementStates };
@@ -0,0 +1,18 @@
1
+ import { LikeC4Model } from '@likec4/core/model';
2
+ import { ElementShape, Fqn } from '@likec4/core/types';
3
+ import { TreeCollection } from '@zag-js/collection';
4
+ import { ElementStates } from './state/utils';
5
+ import * as tree from '@zag-js/tree-view';
6
+ export interface TreeNodeData {
7
+ id: Fqn;
8
+ title: string;
9
+ icon?: string | undefined;
10
+ shape: ElementShape;
11
+ children: TreeNodeData[];
12
+ state: 'include-explicit' | 'include-implicit' | 'exclude' | 'disabled' | 'not-present';
13
+ }
14
+ export interface ElementsTreeProps extends tree.Props<TreeNodeData> {
15
+ }
16
+ export declare function createTreeCollection(model: LikeC4Model, states?: ElementStates): TreeCollection<TreeNodeData>;
17
+ export type TreeApi = tree.Api<any, TreeNodeData>;
18
+ export declare function useElementsTree(): TreeApi;
@@ -0,0 +1,130 @@
1
+ import { compareNaturalHierarchically, toArray } from '@likec4/core/utils';
2
+ import { useMachine, normalizeProps } from '@zag-js/react';
3
+ import * as tree from '@zag-js/tree-view';
4
+ import { useDeferredValue, useMemo, useState, useEffect } from 'react';
5
+ import { difference, hasAtLeast, sort } from 'remeda';
6
+ import { useId } from '../hooks/useId.js';
7
+ import { useEditorPanelState, useOnEditorPanelEvent, selectEditorPanelState } from './state/panel.js';
8
+
9
+ function getElementState(id, states) {
10
+ if (!states) {
11
+ return "not-present";
12
+ }
13
+ if (states.disabled.has(id)) {
14
+ return "disabled";
15
+ }
16
+ if (states.includedExplicit.has(id)) {
17
+ return "include-explicit";
18
+ }
19
+ if (states.includedImplicit.has(id)) {
20
+ return "include-implicit";
21
+ }
22
+ if (states.excluded.has(id)) {
23
+ return "exclude";
24
+ }
25
+ return "not-present";
26
+ }
27
+ function mapToTreeNodes(elements, states) {
28
+ return toArray(elements).map((el) => ({
29
+ id: el.id,
30
+ title: el.title,
31
+ shape: el.shape,
32
+ icon: el.icon ?? void 0,
33
+ children: mapToTreeNodes(el.children(), states),
34
+ state: getElementState(el.id, states)
35
+ }));
36
+ }
37
+ function createTreeCollection(model, states) {
38
+ return tree.collection({
39
+ rootNode: {
40
+ id: "@ROOT",
41
+ title: "",
42
+ shape: "rectangle",
43
+ icon: void 0,
44
+ children: mapToTreeNodes(model.roots(), states),
45
+ state: "not-present"
46
+ },
47
+ nodeToValue(node) {
48
+ return node.id;
49
+ },
50
+ nodeToString(node) {
51
+ return node.title;
52
+ },
53
+ nodeToChildren(node) {
54
+ return node.children;
55
+ },
56
+ isNodeDisabled() {
57
+ return false;
58
+ }
59
+ });
60
+ }
61
+ const select = selectEditorPanelState(
62
+ (s) => ({
63
+ searchInput: s.searchInput.length > 2 ? s.searchInput.toLowerCase() : "",
64
+ collection: s.collection
65
+ }),
66
+ (a, b) => a?.searchInput === b.searchInput && a?.collection.isEqual(b.collection)
67
+ );
68
+ function useElementsTree() {
69
+ const { searchInput, collection } = useEditorPanelState(select);
70
+ const lowerCaseInput = useDeferredValue(searchInput);
71
+ const filteredCollection = useMemo(() => {
72
+ if (!lowerCaseInput) return collection;
73
+ return collection.filter((c) => c.title.toLowerCase().includes(lowerCaseInput));
74
+ }, [collection, lowerCaseInput]);
75
+ const [expandedValue, setExpandedValue] = useState([]);
76
+ useEffect(() => {
77
+ if (filteredCollection === collection) {
78
+ return;
79
+ }
80
+ setExpandedValue((current) => {
81
+ const newBranches = difference(filteredCollection.getBranchValues(), current);
82
+ if (hasAtLeast(newBranches, 1)) {
83
+ return sort([...current, ...newBranches], compareNaturalHierarchically());
84
+ }
85
+ return current;
86
+ });
87
+ }, [filteredCollection]);
88
+ const service = useMachine(tree.machine, {
89
+ id: useId(),
90
+ collection: filteredCollection,
91
+ defaultCheckedValue: [],
92
+ defaultSelectedValue: [],
93
+ expandedValue,
94
+ onExpandedChange({ expandedValue: expandedValue2 }) {
95
+ setExpandedValue(expandedValue2);
96
+ },
97
+ // checkedValue,
98
+ // defaultExpandedValue: [],
99
+ // defaultFocusedValue: null,
100
+ // onCheckedChange({ checkedValue }) {
101
+ // console.log({ checkedValue })
102
+ // },
103
+ onFocusChange(details) {
104
+ console.log("Focus change", details);
105
+ },
106
+ onSelectionChange(details) {
107
+ console.log("Selection change", details);
108
+ }
109
+ // expandOnClick,
110
+ // onSelectionChange({ focusedValue, selectedNodes }) {
111
+ // console.log({ focusedValue, selectedNodes })
112
+ // if (selectedNodes.length === 0) {
113
+ // return
114
+ // }
115
+ // api.deselect(selectedNodes.map(n => n.id))
116
+ // },
117
+ });
118
+ service.context.get("focusedValue")?.slice;
119
+ const api = tree.connect(service, normalizeProps);
120
+ api.select;
121
+ useOnEditorPanelEvent("inputKeyDown", () => {
122
+ const first = api.collection.getFirstNode()?.id;
123
+ if (first) {
124
+ api.focus(first);
125
+ }
126
+ });
127
+ return api;
128
+ }
129
+
130
+ export { createTreeCollection, useElementsTree };
@@ -1,4 +1,4 @@
1
- import { AdhocRule } from '../actor.types';
1
+ import { AdhocRule } from '../state/actor.types';
2
2
  export declare function ViewRulesPanel({ rules, onToggle, onDelete, }: {
3
3
  rules: AdhocRule[];
4
4
  onToggle: (rule: AdhocRule) => void;
@@ -1,6 +1,7 @@
1
1
  export declare const ZIndexes: {
2
2
  readonly Compound: 1;
3
3
  readonly Edge: 20;
4
+ readonly EdgeLabel: 25;
4
5
  readonly Element: 20;
5
6
  readonly Max: 30;
6
7
  };
@@ -6,8 +6,28 @@ import { useDebouncedValue } from '@mantine/hooks';
6
6
  import * as m from 'motion/react-m';
7
7
  import { stopPropagation } from '../../utils/xyflow.js';
8
8
  import { compoundActionBtn } from './actionbtns.css.js';
9
- import IconZoomScan from '../../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js';
9
+ import IconZoomScan from '../../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js';
10
10
 
11
+ const variants = {
12
+ normal: {
13
+ scale: 1,
14
+ x: 0,
15
+ y: 0
16
+ },
17
+ hovered: {
18
+ scale: 1.2,
19
+ x: -1,
20
+ y: -1
21
+ },
22
+ whileHover: {
23
+ scale: 1.4,
24
+ x: -3,
25
+ y: -1
26
+ },
27
+ whileTap: {
28
+ scale: 1
29
+ }
30
+ };
11
31
  function CompoundActionButton({
12
32
  data: {
13
33
  hovered: isHovered = false
@@ -17,22 +37,16 @@ function CompoundActionButton({
17
37
  }) {
18
38
  const debounced = useDebouncedValue(isHovered, isHovered ? 130 : 0);
19
39
  const isHoverDebounced = debounced[0] && isHovered;
40
+ let variant = isHoverDebounced ? "hovered" : "normal";
20
41
  return /* @__PURE__ */ jsx(
21
42
  m.div,
22
43
  {
23
44
  initial: false,
24
- animate: {
25
- scale: isHoverDebounced ? 1.2 : 1,
26
- x: isHoverDebounced ? -1 : 0,
27
- y: isHoverDebounced ? -1 : 0
28
- },
29
- whileHover: {
30
- scale: 1.4,
31
- x: -3,
32
- y: -1
33
- },
45
+ variants,
46
+ animate: variant,
47
+ whileHover: "whileHover",
48
+ whileTap: "whileTap",
34
49
  className: "likec4-compound-navigation compound-action",
35
- whileTap: { scale: 1 },
36
50
  onClick: stopPropagation,
37
51
  tabIndex: -1,
38
52
  children: /* @__PURE__ */ jsx(